@augmentcode/auggie 1.2.0-prerelease.202611050911 → 1.2.0-prerelease.202611051212

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/auggie-v2.mjs +13 -13
  2. package/package.json +1 -1
package/auggie-v2.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ced4b0e9-781c-5bef-ac9a-e2553fab113a")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f8ddc39f-51ba-58fb-999b-19e55cee1349")}catch(e){}}();
4
4
  import { createRequire as __createRequire } from "node:module"; import { dirname as __pathDirname } from "node:path"; import { fileURLToPath as __fileURLToPath } from "node:url"; const require = __createRequire(import.meta.url); const __dirname = __pathDirname(__fileURLToPath(import.meta.url));
5
5
  var U5i=Object.create;var S1e=Object.defineProperty;var V5i=Object.getOwnPropertyDescriptor;var G5i=Object.getOwnPropertyNames;var W5i=Object.getPrototypeOf,$5i=Object.prototype.hasOwnProperty;var Ke=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var C=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var G=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},li=(e,t)=>{for(var n in t)S1e(e,n,{get:t[n],enumerable:!0})},sin=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of G5i(t))!$5i.call(e,i)&&i!==n&&S1e(e,i,{get:()=>t[i],enumerable:!(r=V5i(t,i))||r.enumerable});return e};var _n=(e,t,n)=>(n=e!=null?U5i(W5i(e)):{},sin(t||!e||!e.__esModule?S1e(n,"default",{value:e,enumerable:!0}):n,e)),Ui=e=>sin(S1e({},"__esModule",{value:!0}),e);import*as Q5i from"node:tls";function H5i(e){let t=[],n="",r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(s==='"')r=!r;else if(s==="\\"&&r){if(i++,i===e.length)return;n+=e[i]}else s===" "&&!r?n&&(t.push(n),n=""):n+=s}if(!r)return n&&t.push(n),t}function Y5i(){let e=H5i(process.env.NODE_OPTIONS??"");return e===void 0||[...e,...process.execArgv].some(t=>t.split("=",1)[0]?.replaceAll("_","-")==="--use-openssl-ca")}function v1e(){if(cA!==void 0)return cA;if(process.env.AUGGIE_USE_SYSTEM_CA==="0")return cA="opted-out",cA;if(Y5i())return cA="explicit-policy",cA;let{getCACertificates:e,setDefaultCACertificates:t}=Q5i;if(typeof e!="function"||typeof t!="function")return cA="unsupported",cA;try{let n=e("default"),r=e("system");if(r.length===0)return cA="empty-store",cA;t([...n,...r]),cA="enabled"}catch{cA="failed"}return cA}var cA,fJe=C(()=>{"use strict"});function mU(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),i=c=>{if(c.length===0)return{matches:!0,score:0};if(c.length>r.length)return{matches:!1,score:0};let d=0,p=0,m=-1,f=0;for(let h=0;h<r.length&&d<c.length;h++)if(r[h]===c[d]){let g=h===0||/[\s\-_./:]/.test(r[h-1]);m===h-1?(f++,p-=f*5):(f=0,m>=0&&(p+=(h-m-1)*2)),g&&(p-=10),p+=h*.1,m=h,d++}return d<c.length?{matches:!1,score:0}:(c===r&&(p-=100),{matches:!0,score:p})},s=i(n);if(s.matches)return s;let o=n.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/),a=n.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/),l=o?`${o.groups?.digits??""}${o.groups?.letters??""}`:a?`${a.groups?.letters??""}${a.groups?.digits??""}`:"";if(!l)return s;let u=i(l);return u.matches?{matches:!0,score:u.score+5}:s}function uc(e,t,n){if(!t.trim())return e;let r=t.trim().split(/\s+/).filter(s=>s.length>0);if(r.length===0)return e;let i=[];for(let s of e){let o=n(s),a=0,l=!0;for(let u of r){let c=mU(u,o);if(c.matches)a+=c.score;else{l=!1;break}}l&&i.push({item:s,totalScore:a})}return i.sort((s,o)=>s.totalScore-o.totalScore),i.map(s=>s.item)}var x1e=C(()=>{"use strict"});import{spawn as Z5i}from"child_process";import{readdirSync as j5i,statSync as oin}from"fs";import{homedir as ain}from"os";import{basename as hJe,dirname as C1e,join as PM}from"path";function fU(e){return e.replace(/\\/g,"/")}function z5i(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X5i(e){let t=fU(e);if(!t.includes("/"))return t;let n=t.endsWith("/"),r=t.replace(/^\/+|\/+$/g,"");if(!r)return t;let i="[\\\\/]",s=r.split("/").filter(Boolean).map(a=>z5i(a));if(s.length===0)return t;let o=s.join(i);return n&&(o+=i),o}function lin(e){for(let t=e.length-1;t>=0;t-=1)if(min.has(e[t]??""))return t;return-1}function q5i(e){let t=!1,n=-1;for(let r=0;r<e.length;r+=1)e[r]==='"'&&(t=!t,t&&(n=r));return t?n:null}function cin(e,t){return t===0||min.has(e[t-1]??"")}function uin(e){let t=q5i(e);return t===null?null:t>0&&e[t-1]==="@"?cin(e,t-1)?e.slice(t-1):null:cin(e,t)?e.slice(t):null}function din(e){return e.startsWith('@"')?{rawPrefix:e.slice(2),isAtPrefix:!0,isQuotedPrefix:!0}:e.startsWith('"')?{rawPrefix:e.slice(1),isAtPrefix:!1,isQuotedPrefix:!0}:e.startsWith("@")?{rawPrefix:e.slice(1),isAtPrefix:!0,isQuotedPrefix:!1}:{rawPrefix:e,isAtPrefix:!1,isQuotedPrefix:!1}}function pin(e,t){let n=t.isQuotedPrefix||e.includes(" "),r=t.isAtPrefix?"@":"";return n?`${`${r}"`}${e}"`:`${r}${e}`}async function K5i(e,t,n,r,i){let s=["--base-directory",e,"--max-results",String(r),"--type","f","--type","d","--follow","--hidden","--exclude",".git","--exclude",".git/*","--exclude",".git/**"];return fU(n).includes("/")&&s.push("--full-path"),n&&s.push(X5i(n)),await new Promise(o=>{if(i.aborted){o([]);return}let a=Z5i(t,s,{stdio:["ignore","pipe","pipe"]}),l="",u=!1,c=p=>{u||(u=!0,i.removeEventListener("abort",d),o(p))},d=()=>{a.exitCode===null&&a.kill("SIGKILL")};i.addEventListener("abort",d,{once:!0}),a.stdout.setEncoding("utf-8"),a.stdout.on("data",p=>{l+=p}),a.on("error",()=>{c([])}),a.on("close",p=>{if(i.aborted||p!==0||!l){c([]);return}let m=l.trim().split(`
6
6
  `).filter(Boolean),f=[];for(let h of m){let g=fU(h),b=g.endsWith("/"),A=b?g.slice(0,-1):g;A===".git"||A.startsWith(".git/")||A.includes("/.git/")||f.push({path:g,isDirectory:b})}c(f)})})}var min,DM,fin=C(()=>{"use strict";x1e();min=new Set([" "," ",'"',"'","="]);DM=class{commands;basePath;fdPath;dollarItems;constructor(t=[],n,r=null,i=[]){this.commands=t,this.basePath=n,this.fdPath=r,this.dollarItems=i}getArgumentHint(t,n,r){if(t.length!==1||n!==0||r!==t[0]?.length)return;let i=/^\/(\S+)\s*$/u.exec(t[0]);if(!i)return;let s=this.commands.find(o=>("name"in o?o.name:o.value)===i[1]);if(!(!s||!("name"in s)||s.isAvailable?.()===!1))return s.argumentHint}async getSuggestions(t,n,r,i){let o=(t[n]||"").slice(0,r),a=this.extractAtPrefix(o);if(a){let{rawPrefix:d,isQuotedPrefix:p}=din(a),m=await this.getFuzzyFileSuggestions(d,{isQuotedPrefix:p,signal:i.signal});return m.length===0?null:{items:m,prefix:a}}let l=this.extractDollarPrefix(o);if(l!==null&&this.dollarItems.length>0){let d=l.slice(1),p=uc(this.dollarItems,d,m=>m.value);return p.length===0?null:{items:p,prefix:l}}if(!i.force&&o.startsWith("/")){let d=o.indexOf(" "),p=this.commands.filter(b=>!("isAvailable"in b)||b.isAvailable?.()!==!1);if(d===-1){let b=o.slice(1),A=p.map(S=>{let _="name"in S?S.name:S.value,x="argumentHint"in S&&S.argumentHint?S.argumentHint:void 0,v=S.description??"",w=x?v?`${x} \u2014 ${v}`:x:v;return{name:_,label:_,description:w||void 0}}),y=uc(A,b,S=>S.name).map(S=>({value:S.name,label:S.label,...S.description&&{description:S.description}}));return y.length===0?null:{items:y,prefix:o}}let m=o.slice(1,d),f=o.slice(d+1),h=p.find(b=>("name"in b?b.name:b.value)===m);if(!h||!("getArgumentCompletions"in h)||!h.getArgumentCompletions)return null;let g=await h.getArgumentCompletions(f);return!Array.isArray(g)||g.length===0?null:{items:g,prefix:f}}let u=this.extractPathPrefix(o,i.force??!1);if(u===null)return null;let c=this.getFileSuggestions(u);return c.length===0?null:{items:c,prefix:u}}applyCompletion(t,n,r,i,s){let o=t[n]||"",a=o.slice(0,r-s.length),l=o.slice(r),u=s.startsWith('"')||s.startsWith('@"'),c=l.startsWith('"'),d=i.value.endsWith('"'),p=u&&d&&c?l.slice(1):l;if(s.startsWith("/")&&a.trim()===""&&!s.slice(1).includes("/")){let S=`${a}/${i.value} ${p}`,_=[...t];return _[n]=S,{lines:_,cursorLine:n,cursorCol:a.length+i.value.length+2}}if(s.startsWith("$")){let _=/^[\w-]+(?:[./][\w-]+)*$/.test(i.value)?`$${i.value}`:`$"${i.value}"`,x=`${a}${_} ${p}`,v=[...t];return v[n]=x,{lines:v,cursorLine:n,cursorCol:a.length+_.length+1}}if(s.startsWith("@")){let S=i.label.endsWith("/"),_=S?"":" ",x=`${a+i.value}${_}${p}`,v=[...t];v[n]=x;let w=i.value.endsWith('"'),T=S&&w?i.value.length-1:i.value.length;return{lines:v,cursorLine:n,cursorCol:a.length+T+_.length}}let f=o.slice(0,r);if(f.includes("/")&&f.includes(" ")){let S=a+i.value+p,_=[...t];_[n]=S;let x=i.label.endsWith("/"),v=i.value.endsWith('"'),w=x&&v?i.value.length-1:i.value.length;return{lines:_,cursorLine:n,cursorCol:a.length+w}}let h=a+i.value+p,g=[...t];g[n]=h;let b=i.label.endsWith("/"),A=i.value.endsWith('"'),y=b&&A?i.value.length-1:i.value.length;return{lines:g,cursorLine:n,cursorCol:a.length+y}}extractAtPrefix(t){let n=uin(t);if(n?.startsWith('@"'))return n;let r=lin(t),i=r===-1?0:r+1;return t[i]==="@"?t.slice(i):null}extractDollarPrefix(t){let n=t.match(/(?:^|\s)(\$\S*)$/);return n?n[1]:null}extractPathPrefix(t,n=!1){let r=uin(t);if(r)return r;let i=lin(t),s=i===-1?t:t.slice(i+1);return n||s.includes("/")||s.startsWith(".")||s.startsWith("~/")||s===""&&t.endsWith(" ")?s:null}expandHomePath(t){if(t.startsWith("~/")){let n=PM(ain(),t.slice(2));return t.endsWith("/")&&!n.endsWith("/")?`${n}/`:n}else if(t==="~")return ain();return t}resolveScopedFuzzyQuery(t){let n=fU(t),r=n.lastIndexOf("/");if(r===-1)return null;let i=n.slice(0,r+1),s=n.slice(r+1),o;i.startsWith("~/")?o=this.expandHomePath(i):i.startsWith("/")?o=i:o=PM(this.basePath,i);try{if(!oin(o).isDirectory())return null}catch{return null}return{baseDir:o,query:s,displayBase:i}}scopedPathForDisplay(t,n){let r=fU(n);return t==="/"?`/${r}`:`${fU(t)}${r}`}getFileSuggestions(t){try{let n,r,{rawPrefix:i,isAtPrefix:s,isQuotedPrefix:o}=din(t),a=i;if(a.startsWith("~")&&(a=this.expandHomePath(a)),i===""||i==="./"||i==="../"||i==="~"||i==="~/"||i==="/"||s&&i==="")i.startsWith("~")||a.startsWith("/")?n=a:n=PM(this.basePath,a),r="";else if(i.endsWith("/"))i.startsWith("~")||a.startsWith("/")?n=a:n=PM(this.basePath,a),r="";else{let d=C1e(a),p=hJe(a);i.startsWith("~")||a.startsWith("/")?n=d:n=PM(this.basePath,d),r=p}let u=j5i(n,{withFileTypes:!0}),c=[];for(let d of u){if(!d.name.toLowerCase().startsWith(r.toLowerCase()))continue;let p=d.isDirectory();if(!p&&d.isSymbolicLink())try{let A=PM(n,d.name);p=oin(A).isDirectory()}catch{}let m,f=d.name,h=i;if(h.endsWith("/"))m=h+f;else if(h.includes("/")||h.includes("\\"))if(h.startsWith("~/")){let A=h.slice(2),y=C1e(A);m=`~/${y==="."?f:PM(y,f)}`}else if(h.startsWith("/")){let A=C1e(h);A==="/"?m=`/${f}`:m=`${A}/${f}`}else m=PM(C1e(h),f),h.startsWith("./")&&!m.startsWith("./")&&(m=`./${m}`);else h.startsWith("~")?m=`~/${f}`:m=f;m=fU(m);let g=p?`${m}/`:m,b=pin(g,{isDirectory:p,isAtPrefix:s,isQuotedPrefix:o});c.push({value:b,label:f+(p?"/":"")})}return c.sort((d,p)=>{let m=d.value.endsWith("/"),f=p.value.endsWith("/");return m&&!f?-1:!m&&f?1:d.label.localeCompare(p.label)}),c}catch{return[]}}scoreEntry(t,n,r){let s=hJe(t).toLowerCase(),o=n.toLowerCase(),a=0;return s===o?a=100:s.startsWith(o)?a=80:s.includes(o)?a=50:t.toLowerCase().includes(o)&&(a=30),r&&a>0&&(a+=10),a}async getFuzzyFileSuggestions(t,n){if(!this.fdPath||n.signal.aborted)return[];try{let r=this.resolveScopedFuzzyQuery(t),i=r?.baseDir??this.basePath,s=r?.query??t,o=await K5i(i,this.fdPath,s,100,n.signal);if(n.signal.aborted)return[];let a=o.map(c=>({...c,score:s?this.scoreEntry(c.path,s,c.isDirectory):1})).filter(c=>c.score>0);a.sort((c,d)=>d.score-c.score);let l=a.slice(0,20),u=[];for(let{path:c,isDirectory:d}of l){let p=d?c.slice(0,-1):c,m=r?this.scopedPathForDisplay(r.displayBase,p):p,f=hJe(p),h=d?`${m}/`:m,g=pin(h,{isDirectory:d,isAtPrefix:!0,isQuotedPrefix:n.isQuotedPrefix});u.push({value:g,label:f+(d?"/":""),description:m})}return u}catch{return[]}}shouldTriggerFileCompletion(t,n,r){let s=(t[n]||"").slice(0,r);return!(s.trim().startsWith("/")&&!s.trim().includes(" "))}}});var hin,gin,bin,yin,Ain,Ein,gJe,_in=C(()=>{hin=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],gin=12288,bin=65510,yin=[12288,12288,65281,65376,65504,65510],Ain=4352,Ein=262141,gJe=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141]});var T1e,Sin=C(()=>{T1e=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),s=i*2;if(t<e[s])r=i-1;else if(t>e[s+1])n=i+1;else return!0}return!1}});function rUi(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],s=e[r+1];if(vin>=i&&vin<=s)return[i,s];s-i>n-t&&(t=i,n=s)}return[t,n]}var vin,tUi,nUi,xin,Cin,Tin,Iin=C(()=>{_in();Sin();vin=19968,[tUi,nUi]=rUi(gJe);xin=e=>e<161||e>1114109?!1:T1e(hin,e),Cin=e=>e<gin||e>bin?!1:T1e(yin,e),Tin=e=>e>=tUi&&e<=nUi?!0:e<Ain||e>Ein?!1:T1e(gJe,e)});function iUi(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function bJe(e,{ambiguousAsWide:t=!1}={}){return iUi(e),Cin(e)||Tin(e)||t&&xin(e)?2:1}var win=C(()=>{Iin()});function I1e(){return fN}function sUi(e){let t=e.codePointAt(0);return t>=126976&&t<=130047||t>=8960&&t<=9215||t>=9728&&t<=10175||t>=11088&&t<=11093||e.includes("\uFE0F")||e.length>2}function EJe(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n>126)return!1}return!0}function uUi(e,t){if(t<=0||e.length===0)return{text:"",width:0};if(EJe(e)){let l=e.slice(0,t);return{text:l,width:l.length}}let n=e.includes("\x1B"),r=e.includes(" ");if(!n&&!r){let l="",u=0;for(let{segment:c}of fN.segment(e)){let d=hU(c);if(u+d>t)break;l+=c,u+=d}return{text:l,width:u}}let i="",s=0,o=0,a="";for(;o<e.length;){let l=uA(e,o);if(l){a+=l.code,o+=l.length;continue}if(e[o]===" "){if(s+3>t)break;a&&(i+=a,a=""),i+=" ",s+=3,o++;continue}let u=o;for(;u<e.length&&e[u]!==" "&&!uA(e,u);)u++;for(let{segment:c}of fN.segment(e.slice(o,u))){let d=hU(c);if(s+d>t)return{text:i,width:s};a&&(i+=a,a=""),i+=c,s+=d}o=u}return{text:i,width:s}}function yJe(e,t,n,r,i,s){let o="\x1B[0m",a=t+r,l;return n.length>0?l=`${e}${o}${n}${o}`:l=`${e}${o}`,s?l+" ".repeat(Math.max(0,i-a)):l}function hU(e){if(oUi.test(e))return 0;if(sUi(e)&&lUi.test(e))return 2;let n=e.replace(aUi,"").codePointAt(0);if(n===void 0)return 0;if(n>=127462&&n<=127487)return 2;let r=bJe(n);if(e.length>1)for(let i of e.slice(1)){let s=i.codePointAt(0);s>=65280&&s<=65519?r+=bJe(s):(s===3635||s===3763)&&(r+=1)}return r}function Wt(e){if(e.length===0)return 0;if(EJe(e))return e.length;let t=Hre.get(e);if(t!==void 0)return t;let n=e;if(e.includes(" ")&&(n=n.replace(/\t/g," ")),n.includes("\x1B")){let i="",s=0;for(;s<n.length;){let o=uA(n,s);if(o){s+=o.length;continue}i+=n[s],s++}n=i}let r=0;for(let{segment:i}of fN.segment(n))r+=hU(i);if(Hre.size>=cUi){let i=Hre.keys().next().value;i!==void 0&&Hre.delete(i)}return Hre.set(e,r),r}function Nin(e){return dUi.test(e)?e.replace(pUi,t=>t==="\u0E33"?"\u0E4D\u0E32":"\u0ECD\u0EB2"):e}function uA(e,t){if(t>=e.length||e[t]!=="\x1B")return null;let n=e[t+1];if(n==="["){let r=t+2;for(;r<e.length&&!/[mGKHJ]/.test(e[r]);)r++;return r<e.length?{code:e.substring(t,r+1),length:r+1-t}:null}if(n==="]"){let r=t+2;for(;r<e.length;){if(e[r]==="\x07")return{code:e.substring(t,r+1),length:r+1-t};if(e[r]==="\x1B"&&e[r+1]==="\\")return{code:e.substring(t,r+2),length:r+2-t};r++}return null}if(n==="_"){let r=t+2;for(;r<e.length;){if(e[r]==="\x07")return{code:e.substring(t,r+1),length:r+1-t};if(e[r]==="\x1B"&&e[r+1]==="\\")return{code:e.substring(t,r+2),length:r+2-t};r++}return null}return null}function mUi(e){if(!e.startsWith("\x1B]8;"))return;let t=e.endsWith("\x07")?"\x07":"\x1B\\",n=e.slice(4,t==="\x07"?-1:-2),r=n.indexOf(";");if(r===-1)return;let i=n.slice(0,r),s=n.slice(r+1);return s?{params:i,url:s,terminator:t}:null}function fUi(e){return`\x1B]8;${e.params};${e.url}${e.terminator}`}function hUi(e){return`\x1B]8;;${e}`}function kin(e,t){let n=0;for(;n<e.length;){let r=uA(e,n);r?(t.process(r.code),n+=r.length):n++}}function gUi(e){let t=[],n="",r="",i=!1,s=0;for(;s<e.length;){let o=uA(e,s);if(o){r+=o.code,s+=o.length;continue}let a=e[s],l=a===" ";l!==i&&n&&(t.push(n),n=""),r&&(n+=r,r=""),i=l,n+=a,s++}return r&&(n+=r),n&&t.push(n),t}function fr(e,t){return gU(e,t).map(n=>n.text)}function gU(e,t,{continuationIndent:n=0}={}){let r=" ".repeat(Math.max(0,Math.min(Math.floor(n),t-1))),i=t-r.length,s=e.split(`
@@ -212,7 +212,7 @@ GFS4: `),console.error(e)});ju[Wf]||(Lmn=global[Wf]||[],Umn(ju,Lmn),ju.close=(fu
212
212
 
213
213
  `)}m.write("payload.value = newResult;"),m.write("return payload;");let A=m.compile();return(y,S)=>A(p,y,S)},s,o=h3,a=!m3.jitless,u=a&&jrt.value,c=t.catchall,d;e._zod.parse=(p,m)=>{d??(d=r.value);let f=p.value;return o(f)?a&&u&&m?.async===!1&&m.jitless!==!0?(s||(s=i(t.shape)),p=s(p,m),c?chn([],f,p,m,d,e):p):n(p,m):(p.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),p)}});qse=Ut("$ZodUnion",(e,t)=>{fs.init(e,t),oo(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),oo(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),oo(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),oo(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Lse(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1,o=[];for(let a of t.options){let l=a._zod.run({value:r.value,issues:[]},i);if(l instanceof Promise)o.push(l),s=!0;else{if(l.issues.length===0)return l;o.push(l)}}return s?Promise.all(o).then(a=>Zfn(a,r,e,i)):Zfn(o,r,e,i)}});Vst=Ut("$ZodXor",(e,t)=>{qse.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let s=!1,o=[];for(let a of t.options){let l=a._zod.run({value:r.value,issues:[]},i);l instanceof Promise?(o.push(l),s=!0):o.push(l)}return s?Promise.all(o).then(a=>jfn(a,r,e,i)):jfn(o,r,e,i)}}),Gst=Ut("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,qse.init(e,t);let n=e._zod.parse;oo(e._zod,"propValues",()=>{let i={};for(let s of t.options){let o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,l]of Object.entries(o)){i[a]||(i[a]=new Set);for(let u of l)i[a].add(u)}}return i});let r=RH(()=>{let i=t.options,s=new Map;for(let o of i){let a=o._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let l of a){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,o)}}return s});e._zod.parse=(i,s)=>{let o=i.value;if(!h3(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:e}),i;let a=r.value.get(o?.[t.discriminator]);return a?a._zod.run(i,s):t.unionFallback||s.direction==="backward"?n(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Wst=Ut("$ZodIntersection",(e,t)=>{fs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value,s=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([l,u])=>zfn(n,l,u)):zfn(n,s,o)}});HCe=Ut("$ZodTuple",(e,t)=>{fs.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let o=[],a=Xfn(n,"optin"),l=Xfn(n,"optout");if(!t.rest){if(s.length<a)return r.issues.push({code:"too_small",minimum:a,inclusive:!0,input:s,inst:e,origin:"array"}),r;s.length>n.length&&r.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=new Array(n.length);for(let c=0;c<n.length;c++){let d=n[c]._zod.run({value:s[c],issues:[]},i);d instanceof Promise?o.push(d.then(p=>{u[c]=p})):u[c]=d}if(t.rest){let c=n.length-1,d=s.slice(n.length);for(let p of d){c++;let m=t.rest._zod.run({value:p,issues:[]},i);m instanceof Promise?o.push(m.then(f=>qfn(f,r,c))):qfn(m,r,c)}}return o.length?Promise.all(o).then(()=>Kfn(u,r,n,s,l)):Kfn(u,r,n,s,l)}});$st=Ut("$ZodRecord",(e,t)=>{fs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!MP(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],o=t.keyType._zod.values;if(o){n.value={};let a=new Set;for(let u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let c=t.keyType._zod.run({value:u,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(m=>qg(m,r,gd())),input:u,path:[u],inst:e});continue}let d=c.value,p=t.valueType._zod.run({value:i[u],issues:[]},r);p instanceof Promise?s.push(p.then(m=>{m.issues.length&&n.issues.push(...Gy(u,m.issues)),n.value[d]=m.value})):(p.issues.length&&n.issues.push(...Gy(u,p.issues)),n.value[d]=p.value)}let l;for(let u in i)a.has(u)||(l=l??[],l.push(u));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{n.value={};for(let a of Reflect.ownKeys(i)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&PCe.test(a)&&l.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(l=d)}if(l.issues.length){t.mode==="loose"?n.value[a]=i[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(d=>qg(d,r,gd())),input:a,path:[a],inst:e});continue}let c=t.valueType._zod.run({value:i[a],issues:[]},r);c instanceof Promise?s.push(c.then(d=>{d.issues.length&&n.issues.push(...Gy(a,d.issues)),n.value[l.value]=d.value})):(c.issues.length&&n.issues.push(...Gy(a,c.issues)),n.value[l.value]=c.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Qst=Ut("$ZodMap",(e,t)=>{fs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let s=[];n.value=new Map;for(let[o,a]of i){let l=t.keyType._zod.run({value:o,issues:[]},r),u=t.valueType._zod.run({value:a,issues:[]},r);l instanceof Promise||u instanceof Promise?s.push(Promise.all([l,u]).then(([c,d])=>{Jfn(c,d,n,o,i,e,r)})):Jfn(l,u,n,o,i,e,r)}return s.length?Promise.all(s).then(()=>n):n}});Hst=Ut("$ZodSet",(e,t)=>{fs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let s=[];n.value=new Set;for(let o of i){let a=t.valueType._zod.run({value:o,issues:[]},r);a instanceof Promise?s.push(a.then(l=>ehn(l,n))):ehn(a,n)}return s.length?Promise.all(s).then(()=>n):n}});Yst=Ut("$ZodEnum",(e,t)=>{fs.init(e,t);let n=Bse(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(i=>Fse.has(typeof i)).map(i=>typeof i=="string"?J_(i):i.toString()).join("|")})$`),e._zod.parse=(i,s)=>{let o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:n,input:o,inst:e}),i}}),Zst=Ut("$ZodLiteral",(e,t)=>{if(fs.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?J_(r):r?J_(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,i)=>{let s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),jst=Ut("$ZodFile",(e,t)=>{fs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;return i instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),n}}),zst=Ut("$ZodTransform",(e,t)=>{fs.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new NP(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(n.value=o,n.fallback=!0,n));if(i instanceof Promise)throw new xv;return n.value=i,n.fallback=!0,n}});YCe=Ut("$ZodOptional",(e,t)=>{fs.init(e,t),e._zod.optin="optional",e._zod.optout="optional",oo(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),oo(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Lse(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){let i=n.value,s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(o=>thn(o,i)):thn(s,i)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Xst=Ut("$ZodExactOptional",(e,t)=>{YCe.init(e,t),oo(e._zod,"values",()=>t.innerType._zod.values),oo(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),qst=Ut("$ZodNullable",(e,t)=>{fs.init(e,t),oo(e._zod,"optin",()=>t.innerType._zod.optin),oo(e._zod,"optout",()=>t.innerType._zod.optout),oo(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Lse(n.source)}|null)$`):void 0}),oo(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Kst=Ut("$ZodDefault",(e,t)=>{fs.init(e,t),e._zod.optin="optional",oo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>nhn(s,t)):nhn(i,t)}});Jst=Ut("$ZodPrefault",(e,t)=>{fs.init(e,t),e._zod.optin="optional",oo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),eot=Ut("$ZodNonOptional",(e,t)=>{fs.init(e,t),oo(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>rhn(s,e)):rhn(i,e)}});tot=Ut("$ZodSuccess",(e,t)=>{fs.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new NP("ZodSuccess");let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>(n.value=s.issues.length===0,n)):(n.value=i.issues.length===0,n)}}),not=Ut("$ZodCatch",(e,t)=>{fs.init(e,t),e._zod.optin="optional",oo(e._zod,"optout",()=>t.innerType._zod.optout),oo(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>qg(o,r,gd()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>qg(s,r,gd()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),rot=Ut("$ZodNaN",(e,t)=>{fs.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),ZCe=Ut("$ZodPipe",(e,t)=>{fs.init(e,t),oo(e._zod,"values",()=>t.in._zod.values),oo(e._zod,"optin",()=>t.in._zod.optin),oo(e._zod,"optout",()=>t.out._zod.optout),oo(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let s=t.out._zod.run(n,r);return s instanceof Promise?s.then(o=>UCe(o,t.in,r)):UCe(s,t.in,r)}let i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>UCe(s,t.out,r)):UCe(i,t.out,r)}});Kse=Ut("$ZodCodec",(e,t)=>{fs.init(e,t),oo(e._zod,"values",()=>t.in._zod.values),oo(e._zod,"optin",()=>t.in._zod.optin),oo(e._zod,"optout",()=>t.out._zod.optout),oo(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let s=t.in._zod.run(n,r);return s instanceof Promise?s.then(o=>VCe(o,t,r)):VCe(s,t,r)}else{let s=t.out._zod.run(n,r);return s instanceof Promise?s.then(o=>VCe(o,t,r)):VCe(s,t,r)}}});iot=Ut("$ZodPreprocess",(e,t)=>{ZCe.init(e,t)}),sot=Ut("$ZodReadonly",(e,t)=>{fs.init(e,t),oo(e._zod,"propValues",()=>t.innerType._zod.propValues),oo(e._zod,"values",()=>t.innerType._zod.values),oo(e._zod,"optin",()=>t.innerType?._zod?.optin),oo(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(ihn):ihn(i)}});oot=Ut("$ZodTemplateLiteral",(e,t)=>{fs.init(e,t);let n=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){if(!r._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);let i=r._zod.pattern instanceof RegExp?r._zod.pattern.source:r._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${r._zod.traits}`);let s=i.startsWith("^")?1:0,o=i.endsWith("$")?i.length-1:i.length;n.push(i.slice(s,o))}else if(r===null||Xrt.has(typeof r))n.push(J_(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,i)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),aot=Ut("$ZodFunction",(e,t)=>(fs.init(e,t),e._def=t,e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return function(...r){let i=e._def.input?Qse(e._def.input,r):r,s=Reflect.apply(n,this,i);return e._def.output?Qse(e._def.output,s):s}},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return async function(...r){let i=e._def.input?await Hse(e._def.input,r):r,s=await Reflect.apply(n,this,i);return e._def.output?await Hse(e._def.output,s):s}},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new HCe({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),lot=Ut("$ZodPromise",(e,t)=>{fs.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(i=>t.innerType._zod.run({value:i,issues:[]},r))}),cot=Ut("$ZodLazy",(e,t)=>{fs.init(e,t),oo(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),oo(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),oo(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),oo(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),oo(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),uot=Ut("$ZodCustom",(e,t)=>{gc.init(e,t),fs.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(s=>shn(s,n,r,e));shn(i,n,r,e)}})});function dhn(){return{localeError:Nzi()}}var Nzi,phn=C(()=>{ni();Nzi=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(i){return e[i]??null}let n={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${i.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${s}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return i.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${Mn(i.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${s} ${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${s} ${i.minimum.toString()} ${o.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${i.prefix}"`:s.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${s.suffix}"`:s.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${s.includes}"`:s.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${s.pattern}`:`${n[s.format]??i.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${i.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${i.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${i.keys.length>1?"\u0629":""}: ${nn(i.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}}});function mhn(){return{localeError:kzi()}}var kzi,fhn=C(()=>{ni();kzi=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${i.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${s}, daxil olan ${a}`}case"invalid_value":return i.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${Mn(i.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${s}${i.maximum.toString()} ${o.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${s}${i.minimum.toString()} ${o.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${s.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:s.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${s.suffix}" il\u0259 bitm\u0259lidir`:s.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${s.includes}" daxil olmal\u0131d\u0131r`:s.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${s.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${n[s.format]??i.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${i.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${i.keys.length>1?"lar":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`${i.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${i.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}}});function hhn(e,t,n,r){let i=Math.abs(e),s=i%10,o=i%100;return o>=11&&o<=19?r:s===1?t:s>=2&&s<=4?n:r}function ghn(){return{localeError:Ozi()}}var Ozi,bhn=C(()=>{ni();Ozi=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(i){return e[i]??null}let n={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},r={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${i.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${s}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${Mn(i.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);if(o){let a=Number(i.maximum),l=hhn(a,o.unit.one,o.unit.few,o.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${o.verb} ${s}${i.maximum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);if(o){let a=Number(i.minimum),l=hhn(a,o.unit.one,o.unit.few,o.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${o.verb} ${s}${i.minimum.toString()} ${l}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${s.includes}"`:s.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${n[s.format]??i.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${i.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${nn(i.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${i.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}}});function yhn(){return{localeError:Mzi()}}var Mzi,Ahn=C(()=>{ni();Mzi=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(i){return e[i]??null}let n={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},r={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${s}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${Mn(i.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${s}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${s}${i.minimum.toString()} ${o.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${s.prefix}"`;if(s.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${s.suffix}"`;if(s.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${s.includes}"`;if(s.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${s.pattern}`;let o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return s.format==="emoji"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="datetime"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="date"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),s.format==="time"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="duration"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${o} ${n[s.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${i.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u043E\u0432\u0435":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}}});function Ehn(){return{localeError:Pzi()}}var Pzi,_hn=C(()=>{ni();Pzi=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(i){return e[i]??null}let n={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${i.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${s}, s'ha rebut ${a}`}case"invalid_value":return i.values.length===1?`Valor inv\xE0lid: s'esperava ${Mn(i.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${nn(i.values," o ")}`;case"too_big":{let s=i.inclusive?"com a m\xE0xim":"menys de",o=t(i.origin);return o?`Massa gran: s'esperava que ${i.origin??"el valor"} contingu\xE9s ${s} ${i.maximum.toString()} ${o.unit??"elements"}`:`Massa gran: s'esperava que ${i.origin??"el valor"} fos ${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?"com a m\xEDnim":"m\xE9s de",o=t(i.origin);return o?`Massa petit: s'esperava que ${i.origin} contingu\xE9s ${s} ${i.minimum.toString()} ${o.unit}`:`Massa petit: s'esperava que ${i.origin} fos ${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${s.prefix}"`:s.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${s.suffix}"`:s.format==="includes"?`Format inv\xE0lid: ha d'incloure "${s.includes}"`:s.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${s.pattern}`:`Format inv\xE0lid per a ${n[s.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${i.divisor}`;case"unrecognized_keys":return`Clau${i.keys.length>1?"s":""} no reconeguda${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${i.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${i.origin}`;default:return"Entrada inv\xE0lida"}}}});function Shn(){return{localeError:Dzi()}}var Dzi,vhn=C(()=>{ni();Dzi=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(i){return e[i]??null}let n={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},r={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${i.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${s}, obdr\u017Eeno ${a}`}case"invalid_value":return i.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${Mn(i.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${s}${i.maximum.toString()} ${o.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${s}${i.minimum.toString()} ${o.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${s.prefix}"`:s.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${s.suffix}"`:s.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${s.includes}"`:s.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${s.pattern}`:`Neplatn\xFD form\xE1t ${n[s.format]??i.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${i.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${nn(i.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${i.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${i.origin}`;default:return"Neplatn\xFD vstup"}}}});function xhn(){return{localeError:Bzi()}}var Bzi,Chn=C(()=>{ni();Bzi=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(i){return e[i]??null}let n={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Ugyldigt input: forventede instanceof ${i.expected}, fik ${a}`:`Ugyldigt input: forventede ${s}, fik ${a}`}case"invalid_value":return i.values.length===1?`Ugyldig v\xE6rdi: forventede ${Mn(i.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin),a=r[i.origin]??i.origin;return o?`For stor: forventede ${a??"value"} ${o.verb} ${s} ${i.maximum.toString()} ${o.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin),a=r[i.origin]??i.origin;return o?`For lille: forventede ${a} ${o.verb} ${s} ${i.minimum.toString()} ${o.unit}`:`For lille: forventede ${a} havde ${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ugyldig streng: skal starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: skal ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: skal indeholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${s.pattern}`:`Ugyldig ${n[s.format]??i.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${nn(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${i.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${i.origin}`;default:return"Ugyldigt input"}}}});function Thn(){return{localeError:Lzi()}}var Lzi,Ihn=C(()=>{ni();Lzi=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(i){return e[i]??null}let n={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},r={nan:"NaN",number:"Zahl",array:"Array"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${i.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${s}, erhalten ${a}`}case"invalid_value":return i.values.length===1?`Ung\xFCltige Eingabe: erwartet ${Mn(i.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${s}${i.maximum.toString()} ${o.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${s}${i.maximum.toString()} ist`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Zu klein: erwartet, dass ${i.origin} ${s}${i.minimum.toString()} ${o.unit} hat`:`Zu klein: erwartet, dass ${i.origin} ${s}${i.minimum.toString()} ist`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ung\xFCltiger String: muss mit "${s.prefix}" beginnen`:s.format==="ends_with"?`Ung\xFCltiger String: muss mit "${s.suffix}" enden`:s.format==="includes"?`Ung\xFCltiger String: muss "${s.includes}" enthalten`:s.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${s.pattern} entsprechen`:`Ung\xFCltig: ${n[s.format]??i.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${i.divisor} sein`;case"unrecognized_keys":return`${i.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${nn(i.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${i.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${i.origin}`;default:return"Ung\xFCltige Eingabe"}}}});function whn(){return{localeError:Fzi()}}var Fzi,Rhn=C(()=>{ni();Fzi=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(i){return e[i]??null}let n={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return typeof i.expected=="string"&&/^[A-Z]/.test(i.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${i.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${s}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return i.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${Mn(i.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${s}${i.maximum.toString()} ${o.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${s}${i.minimum.toString()} ${o.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${s.prefix}"`:s.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${s.suffix}"`:s.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${s.includes}"`:s.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${s.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${n[s.format]??i.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${i.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${i.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${i.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${nn(i.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${i.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${i.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}}});function jCe(){return{localeError:Uzi()}}var Uzi,pot=C(()=>{ni();Uzi=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Mn(i.values[0])}`:`Invalid option: expected one of ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${o.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(o=>`'${o}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}}});function Nhn(){return{localeError:Vzi()}}var Vzi,khn=C(()=>{ni();Vzi=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(i){return e[i]??null}let n={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},r={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${i.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${s}, ricevi\u011Dis ${a}`}case"invalid_value":return i.values.length===1?`Nevalida enigo: atendi\u011Dis ${Mn(i.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${s}${i.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Tro malgranda: atendi\u011Dis ke ${i.origin} havu ${s}${i.minimum.toString()} ${o.unit}`:`Tro malgranda: atendi\u011Dis ke ${i.origin} estu ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${s.prefix}"`:s.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${s.suffix}"`:s.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${s.includes}"`:s.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${s.pattern}`:`Nevalida ${n[s.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} \u015Dlosilo${i.keys.length>1?"j":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}}});function Ohn(){return{localeError:Gzi()}}var Gzi,Mhn=C(()=>{ni();Gzi=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(i){return e[i]??null}let n={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${i.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${s}, recibido ${a}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: se esperaba ${Mn(i.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin),a=r[i.origin]??i.origin;return o?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${s}${i.maximum.toString()} ${o.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin),a=r[i.origin]??i.origin;return o?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${s}${i.minimum.toString()} ${o.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inv\xE1lida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${s.pattern}`:`Inv\xE1lido ${n[s.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Llave${i.keys.length>1?"s":""} desconocida${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${r[i.origin]??i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${r[i.origin]??i.origin}`;default:return"Entrada inv\xE1lida"}}}});function Phn(){return{localeError:Wzi()}}var Wzi,Dhn=C(()=>{ni();Wzi=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(i){return e[i]??null}let n={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},r={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${i.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${s} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return i.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${Mn(i.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${nn(i.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${s}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${s}${i.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${s}${i.minimum.toString()} ${o.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${s}${i.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${s.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:s.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${s.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:s.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${s.includes}" \u0628\u0627\u0634\u062F`:s.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${s.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${n[s.format]??i.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${i.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${i.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${nn(i.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${i.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${i.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}}});function Bhn(){return{localeError:$zi()}}var $zi,Lhn=C(()=>{ni();$zi=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(i){return e[i]??null}let n={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Virheellinen tyyppi: odotettiin instanceof ${i.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${s}, oli ${a}`}case"invalid_value":return i.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${Mn(i.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Liian suuri: ${o.subject} t\xE4ytyy olla ${s}${i.maximum.toString()} ${o.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Liian pieni: ${o.subject} t\xE4ytyy olla ${s}${i.minimum.toString()} ${o.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${s.prefix}"`:s.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${s.suffix}"`:s.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${s.includes}"`:s.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${s.pattern}`:`Virheellinen ${n[s.format]??i.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${i.divisor} monikerta`;case"unrecognized_keys":return`${i.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${nn(i.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}}});function Fhn(){return{localeError:Qzi()}}var Qzi,Uhn=C(()=>{ni();Qzi=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(i){return e[i]??null}let n={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},r={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : instanceof ${i.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${s} attendu, ${a} re\xE7u`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : ${Mn(i.values[0])} attendu`:`Option invalide : une valeur parmi ${nn(i.values,"|")} attendue`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Trop grand : ${r[i.origin]??"valeur"} doit ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${r[i.origin]??"valeur"} doit \xEAtre ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Trop petit : ${r[i.origin]??"valeur"} doit ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`Trop petit : ${r[i.origin]??"valeur"} doit \xEAtre ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Cha\xEEne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${s.pattern}`:`${n[s.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${nn(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}}});function Vhn(){return{localeError:Hzi()}}var Hzi,Ghn=C(()=>{ni();Hzi=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(i){return e[i]??null}let n={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : attendu instanceof ${i.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${s}, re\xE7u ${a}`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : attendu ${Mn(i.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"\u2264":"<",o=t(i.origin);return o?`Trop grand : attendu que ${i.origin??"la valeur"} ait ${s}${i.maximum.toString()} ${o.unit}`:`Trop grand : attendu que ${i.origin??"la valeur"} soit ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?"\u2265":">",o=t(i.origin);return o?`Trop petit : attendu que ${i.origin} ait ${s}${i.minimum.toString()} ${o.unit}`:`Trop petit : attendu que ${i.origin} soit ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Cha\xEEne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${s.pattern}`:`${n[s.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${nn(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}}});function Whn(){return{localeError:Yzi()}}var Yzi,$hn=C(()=>{ni();Yzi=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},n=u=>u?e[u]:void 0,r=u=>{let c=n(u);return c?c.label:u??e.unknown.label},i=u=>`\u05D4${r(u)}`,s=u=>(n(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",o=u=>u?t[u]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},l={nan:"NaN"};return u=>{switch(u.code){case"invalid_type":{let c=u.expected,d=l[c??""]??r(c),p=Pn(u.input),m=l[p]??e[p]?.label??p;return/^[A-Z]/.test(u.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${u.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${m}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${m}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${Mn(u.values[0])}`;let c=u.values.map(m=>Mn(m));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${c[0]} \u05D0\u05D5 ${c[1]}`;let d=c[c.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${c.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let c=o(u.origin),d=i(u.origin??"value");if(u.origin==="string")return`${c?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${c?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let f=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${f}`}if(u.origin==="array"||u.origin==="set"){let f=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",h=u.inclusive?`${u.maximum} ${c?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${c?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${f} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=u.inclusive?"<=":"<",m=s(u.origin??"value");return c?.unit?`${c.longLabel} \u05DE\u05D3\u05D9: ${d} ${m} ${p}${u.maximum.toString()} ${c.unit}`:`${c?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${m} ${p}${u.maximum.toString()}`}case"too_small":{let c=o(u.origin),d=i(u.origin??"value");if(u.origin==="string")return`${c?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${c?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let f=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${f}`}if(u.origin==="array"||u.origin==="set"){let f=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let g=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${f} \u05DC\u05D4\u05DB\u05D9\u05DC ${g}`}let h=u.inclusive?`${u.minimum} ${c?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${c?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${f} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`.trim()}let p=u.inclusive?">=":">",m=s(u.origin??"value");return c?.unit?`${c.shortLabel} \u05DE\u05D3\u05D9: ${d} ${m} ${p}${u.minimum.toString()} ${c.unit}`:`${c?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${m} ${p}${u.minimum.toString()}`}case"invalid_format":{let c=u;if(c.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${c.prefix}"`;if(c.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${c.suffix}"`;if(c.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${c.includes}"`;if(c.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${c.pattern}`;let d=a[c.format],p=d?.label??c.format,f=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${p} \u05DC\u05D0 ${f}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${nn(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${i(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}}});function Qhn(){return{localeError:Zzi()}}var Zzi,Hhn=C(()=>{ni();Zzi=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(i){return e[i]??null}let n={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},r={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${i.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${s}, a primljeno je ${a}`}case"invalid_value":return i.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${Mn(i.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin),a=r[i.origin]??i.origin;return o?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${s}${i.maximum.toString()} ${o.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin),a=r[i.origin]??i.origin;return o?`Premalo: o\u010Dekivano da ${a} ima ${s}${i.minimum.toString()} ${o.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${s.prefix}"`:s.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${s.suffix}"`:s.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${s.includes}"`:s.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${s.pattern}`:`Neispravna ${n[s.format]??i.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${i.divisor}`;case"unrecognized_keys":return`Neprepoznat${i.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${nn(i.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${r[i.origin]??i.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${r[i.origin]??i.origin}`;default:return"Neispravan unos"}}}});function Yhn(){return{localeError:jzi()}}var jzi,Zhn=C(()=>{ni();jzi=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(i){return e[i]??null}let n={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},r={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${i.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${s}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return i.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${Mn(i.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`T\xFAl nagy: ${i.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${s}${i.maximum.toString()} ${o.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${i.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} m\xE9rete t\xFAl kicsi ${s}${i.minimum.toString()} ${o.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} t\xFAl kicsi ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\xC9rv\xE9nytelen string: "${s.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:s.format==="ends_with"?`\xC9rv\xE9nytelen string: "${s.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:s.format==="includes"?`\xC9rv\xE9nytelen string: "${s.includes}" \xE9rt\xE9ket kell tartalmaznia`:s.format==="regex"?`\xC9rv\xE9nytelen string: ${s.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${n[s.format]??i.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${i.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${i.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${i.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}}});function jhn(e,t,n){return Math.abs(e)===1?t:n}function LH(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],n=e[e.length-1];return e+(t.includes(n)?"\u0576":"\u0568")}function zhn(){return{localeError:zzi()}}var zzi,Xhn=C(()=>{ni();zzi=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(i){return e[i]??null}let n={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},r={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${i.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${s}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return i.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${Mn(i.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);if(o){let a=Number(i.maximum),l=jhn(a,o.unit.one,o.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${LH(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${s}${i.maximum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${LH(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);if(o){let a=Number(i.minimum),l=jhn(a,o.unit.one,o.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${LH(i.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${s}${i.minimum.toString()} ${l}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${LH(i.origin)} \u056C\u056B\u0576\u056B ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${s.prefix}"-\u0578\u057E`:s.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${s.suffix}"-\u0578\u057E`:s.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${s.includes}"`:s.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${s.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${n[s.format]??i.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${i.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${i.keys.length>1?"\u0576\u0565\u0580":""}. ${nn(i.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${LH(i.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${LH(i.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}}});function qhn(){return{localeError:Xzi()}}var Xzi,Khn=C(()=>{ni();Xzi=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(i){return e[i]??null}let n={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Input tidak valid: diharapkan instanceof ${i.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${s}, diterima ${a}`}case"invalid_value":return i.values.length===1?`Input tidak valid: diharapkan ${Mn(i.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Terlalu besar: diharapkan ${i.origin??"value"} memiliki ${s}${i.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: diharapkan ${i.origin??"value"} menjadi ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Terlalu kecil: diharapkan ${i.origin} memiliki ${s}${i.minimum.toString()} ${o.unit}`:`Terlalu kecil: diharapkan ${i.origin} menjadi ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`String tidak valid: harus dimulai dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak valid: harus berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak valid: harus menyertakan "${s.includes}"`:s.format==="regex"?`String tidak valid: harus sesuai pola ${s.pattern}`:`${n[s.format]??i.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${i.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${i.origin}`;default:return"Input tidak valid"}}}});function Jhn(){return{localeError:qzi()}}var qzi,egn=C(()=>{ni();qzi=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(i){return e[i]??null}let n={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},r={nan:"NaN",number:"n\xFAmer",array:"fylki"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${i.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${s}`}case"invalid_value":return i.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${Mn(i.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} hafi ${s}${i.maximum.toString()} ${o.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} s\xE9 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} hafi ${s}${i.minimum.toString()} ${o.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} s\xE9 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${s.prefix}"`:s.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${s.suffix}"`:s.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${s.includes}"`:s.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${s.pattern}`:`Rangt ${n[s.format]??i.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${i.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${i.keys.length>1?"ir lyklar":"ur lykill"}: ${nn(i.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${i.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${i.origin}`;default:return"Rangt gildi"}}}});function tgn(){return{localeError:Kzi()}}var Kzi,ngn=C(()=>{ni();Kzi=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(i){return e[i]??null}let n={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"numero",array:"vettore"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Input non valido: atteso instanceof ${i.expected}, ricevuto ${a}`:`Input non valido: atteso ${s}, ricevuto ${a}`}case"invalid_value":return i.values.length===1?`Input non valido: atteso ${Mn(i.values[0])}`:`Opzione non valida: atteso uno tra ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Troppo grande: ${i.origin??"valore"} deve avere ${s}${i.maximum.toString()} ${o.unit??"elementi"}`:`Troppo grande: ${i.origin??"valore"} deve essere ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Troppo piccolo: ${i.origin} deve avere ${s}${i.minimum.toString()} ${o.unit}`:`Troppo piccolo: ${i.origin} deve essere ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Stringa non valida: deve iniziare con "${s.prefix}"`:s.format==="ends_with"?`Stringa non valida: deve terminare con "${s.suffix}"`:s.format==="includes"?`Stringa non valida: deve includere "${s.includes}"`:s.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${s.pattern}`:`Input non valido: ${n[s.format]??i.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${i.divisor}`;case"unrecognized_keys":return`Chiav${i.keys.length>1?"i":"e"} non riconosciut${i.keys.length>1?"e":"a"}: ${nn(i.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${i.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${i.origin}`;default:return"Input non valido"}}}});function rgn(){return{localeError:Jzi()}}var Jzi,ign=C(()=>{ni();Jzi=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(i){return e[i]??null}let n={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},r={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${i.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${s}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return i.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${Mn(i.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${nn(i.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let s=i.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",o=t(i.origin);return o?`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${o.unit??"\u8981\u7D20"}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let s=i.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",o=t(i.origin);return o?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${o.unit}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${s.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${n[s.format]??i.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${i.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${i.keys.length>1?"\u7FA4":""}: ${nn(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}}});function sgn(){return{localeError:eXi()}}var eXi,ogn=C(()=>{ni();eXi=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(i){return e[i]??null}let n={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},r={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${i.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${s}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return i.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${Mn(i.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${nn(i.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} \u10D8\u10E7\u10DD\u10E1 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${s.prefix}"-\u10D8\u10D7`:s.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${s.suffix}"-\u10D8\u10D7`:s.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${s.includes}"-\u10E1`:s.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${s.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${n[s.format]??i.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${i.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${i.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${nn(i.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${i.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${i.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}}});function zCe(){return{localeError:tXi()}}var tXi,mot=C(()=>{ni();tXi=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(i){return e[i]??null}let n={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},r={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${i.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${s} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return i.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${Mn(i.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${s} ${i.maximum.toString()} ${o.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${s} ${i.minimum.toString()} ${o.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${s.prefix}"`:s.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${s.suffix}"`:s.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${s.includes}"`:s.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${s.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${n[s.format]??i.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${i.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${nn(i.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}}});function agn(){return zCe()}var lgn=C(()=>{mot()});function cgn(){return{localeError:nXi()}}var nXi,ugn=C(()=>{ni();nXi=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${i.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${s}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return i.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${Mn(i.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${nn(i.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let s=i.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",o=s==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(i.origin),l=a?.unit??"\uC694\uC18C";return a?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()}${l} ${s}${o}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()} ${s}${o}`}case"too_small":{let s=i.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",o=s==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=t(i.origin),l=a?.unit??"\uC694\uC18C";return a?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()}${l} ${s}${o}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()} ${s}${o}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:s.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:s.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:s.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${s.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${n[s.format]??i.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${i.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${nn(i.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${i.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${i.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}}});function dgn(e){let t=Math.abs(e),n=t%10,r=t%100;return r>=11&&r<=19||n===0?"many":n===1?"one":"few"}function pgn(){return{localeError:rXi()}}var Jse,rXi,mgn=C(()=>{ni();Jse=e=>e.charAt(0).toUpperCase()+e.slice(1);rXi=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(i,s,o,a){let l=e[i]??null;return l===null?l:{unit:l.unit[s],verb:l.verb[a][o?"inclusive":"notInclusive"]}}let n={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},r={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${i.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${s}`}case"invalid_value":return i.values.length===1?`Privalo b\u016Bti ${Mn(i.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${nn(i.values,"|")} pasirinkim\u0173`;case"too_big":{let s=r[i.origin]??i.origin,o=t(i.origin,dgn(Number(i.maximum)),i.inclusive??!1,"smaller");if(o?.verb)return`${Jse(s??i.origin??"reik\u0161m\u0117")} ${o.verb} ${i.maximum.toString()} ${o.unit??"element\u0173"}`;let a=i.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${Jse(s??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${i.maximum.toString()} ${o?.unit}`}case"too_small":{let s=r[i.origin]??i.origin,o=t(i.origin,dgn(Number(i.minimum)),i.inclusive??!1,"bigger");if(o?.verb)return`${Jse(s??i.origin??"reik\u0161m\u0117")} ${o.verb} ${i.minimum.toString()} ${o.unit??"element\u0173"}`;let a=i.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${Jse(s??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${i.minimum.toString()} ${o?.unit}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${s.prefix}"`:s.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${s.suffix}"`:s.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${s.includes}"`:s.format==="regex"?`Eilut\u0117 privalo atitikti ${s.pattern}`:`Neteisingas ${n[s.format]??i.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${i.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${i.keys.length>1?"i":"as"} rakt${i.keys.length>1?"ai":"as"}: ${nn(i.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let s=r[i.origin]??i.origin;return`${Jse(s??i.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}}});function fgn(){return{localeError:iXi()}}var iXi,hgn=C(()=>{ni();iXi=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(i){return e[i]??null}let n={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},r={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${i.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${s}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Mn(i.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${s}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0438\u043C\u0430 ${s}${i.minimum.toString()} ${o.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${s.pattern}`:`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${nn(i.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${i.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${i.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}}});function ggn(){return{localeError:sXi()}}var sXi,bgn=C(()=>{ni();sXi=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(i){return e[i]??null}let n={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"nombor"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Input tidak sah: dijangka instanceof ${i.expected}, diterima ${a}`:`Input tidak sah: dijangka ${s}, diterima ${a}`}case"invalid_value":return i.values.length===1?`Input tidak sah: dijangka ${Mn(i.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Terlalu besar: dijangka ${i.origin??"nilai"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: dijangka ${i.origin??"nilai"} adalah ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Terlalu kecil: dijangka ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`Terlalu kecil: dijangka ${i.origin} adalah ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`String tidak sah: mesti bermula dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak sah: mesti mengandungi "${s.includes}"`:s.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${s.pattern}`:`${n[s.format]??i.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${nn(i.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${i.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${i.origin}`;default:return"Input tidak sah"}}}});function ygn(){return{localeError:oXi()}}var oXi,Agn=C(()=>{ni();oXi=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(i){return e[i]??null}let n={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},r={nan:"NaN",number:"getal"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Ongeldige invoer: verwacht instanceof ${i.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${s}, ontving ${a}`}case"invalid_value":return i.values.length===1?`Ongeldige invoer: verwacht ${Mn(i.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin),a=i.origin==="date"?"laat":i.origin==="string"?"lang":"groot";return o?`Te ${a}: verwacht dat ${i.origin??"waarde"} ${s}${i.maximum.toString()} ${o.unit??"elementen"} ${o.verb}`:`Te ${a}: verwacht dat ${i.origin??"waarde"} ${s}${i.maximum.toString()} is`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin),a=i.origin==="date"?"vroeg":i.origin==="string"?"kort":"klein";return o?`Te ${a}: verwacht dat ${i.origin} ${s}${i.minimum.toString()} ${o.unit} ${o.verb}`:`Te ${a}: verwacht dat ${i.origin} ${s}${i.minimum.toString()} is`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ongeldige tekst: moet met "${s.prefix}" beginnen`:s.format==="ends_with"?`Ongeldige tekst: moet op "${s.suffix}" eindigen`:s.format==="includes"?`Ongeldige tekst: moet "${s.includes}" bevatten`:s.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${s.pattern}`:`Ongeldig: ${n[s.format]??i.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${i.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${i.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${i.origin}`;default:return"Ongeldige invoer"}}}});function Egn(){return{localeError:aXi()}}var aXi,_gn=C(()=>{ni();aXi=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(i){return e[i]??null}let n={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"tall",array:"liste"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Ugyldig input: forventet instanceof ${i.expected}, fikk ${a}`:`Ugyldig input: forventet ${s}, fikk ${a}`}case"invalid_value":return i.values.length===1?`Ugyldig verdi: forventet ${Mn(i.values[0])}`:`Ugyldig valg: forventet en av ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${s}${i.maximum.toString()} ${o.unit??"elementer"}`:`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`For lite(n): forventet ${i.origin} til \xE5 ha ${s}${i.minimum.toString()} ${o.unit}`:`For lite(n): forventet ${i.origin} til \xE5 ha ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${s.pattern}`:`Ugyldig ${n[s.format]??i.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${nn(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${i.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${i.origin}`;default:return"Ugyldig input"}}}});function Sgn(){return{localeError:lXi()}}var lXi,vgn=C(()=>{ni();lXi=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(i){return e[i]??null}let n={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},r={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`F\xE2sit giren: umulan instanceof ${i.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${s}, al\u0131nan ${a}`}case"invalid_value":return i.values.length===1?`F\xE2sit giren: umulan ${Mn(i.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${s}${i.maximum.toString()} ${o.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${s}${i.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${s}${i.minimum.toString()} ${o.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${s}${i.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let s=i;return s.format==="starts_with"?`F\xE2sit metin: "${s.prefix}" ile ba\u015Flamal\u0131.`:s.format==="ends_with"?`F\xE2sit metin: "${s.suffix}" ile bitmeli.`:s.format==="includes"?`F\xE2sit metin: "${s.includes}" ihtiv\xE2 etmeli.`:s.format==="regex"?`F\xE2sit metin: ${s.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${n[s.format]??i.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${i.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${i.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}}});function xgn(){return{localeError:cXi()}}var cXi,Cgn=C(()=>{ni();cXi=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(i){return e[i]??null}let n={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},r={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${i.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${s} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return i.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${Mn(i.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${nn(i.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${s}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${s}${i.maximum.toString()} \u0648\u064A`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${s}${i.minimum.toString()} ${o.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${s}${i.minimum.toString()} \u0648\u064A`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${s.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:s.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${s.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:s.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${s.includes}" \u0648\u0644\u0631\u064A`:s.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${s.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${n[s.format]??i.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${i.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${i.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${nn(i.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${i.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${i.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}}});function Tgn(){return{localeError:uXi()}}var uXi,Ign=C(()=>{ni();uXi=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(i){return e[i]??null}let n={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},r={nan:"NaN",number:"liczba",array:"tablica"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${i.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${s}, otrzymano ${a}`}case"invalid_value":return i.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${Mn(i.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${s}${i.maximum.toString()} ${o.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${s}${i.minimum.toString()} ${o.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${s.prefix}"`:s.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${s.suffix}"`:s.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${s.includes}"`:s.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${s.pattern}`:`Nieprawid\u0142ow(y/a/e) ${n[s.format]??i.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${i.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${i.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${i.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}}});function wgn(){return{localeError:dXi()}}var dXi,Rgn=C(()=>{ni();dXi=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(i){return e[i]??null}let n={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",number:"n\xFAmero",null:"nulo"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Tipo inv\xE1lido: esperado instanceof ${i.expected}, recebido ${a}`:`Tipo inv\xE1lido: esperado ${s}, recebido ${a}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: esperado ${Mn(i.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Muito grande: esperado que ${i.origin??"valor"} tivesse ${s}${i.maximum.toString()} ${o.unit??"elementos"}`:`Muito grande: esperado que ${i.origin??"valor"} fosse ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Muito pequeno: esperado que ${i.origin} tivesse ${s}${i.minimum.toString()} ${o.unit}`:`Muito pequeno: esperado que ${i.origin} fosse ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${s.prefix}"`:s.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inv\xE1lido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${s.pattern}`:`${n[s.format]??i.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Chave${i.keys.length>1?"s":""} desconhecida${i.keys.length>1?"s":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${i.origin}`;default:return"Campo inv\xE1lido"}}}});function Ngn(){return{localeError:pXi()}}var pXi,kgn=C(()=>{ni();pXi=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(i){return e[i]??null}let n={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},r={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return`Intrare invalid\u0103: a\u0219teptat ${s}, primit ${a}`}case"invalid_value":return i.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${Mn(i.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Prea mare: a\u0219teptat ca ${i.origin??"valoarea"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${i.origin??"valoarea"} s\u0103 fie ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Prea mic: a\u0219teptat ca ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`Prea mic: a\u0219teptat ca ${i.origin} s\u0103 fie ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${s.prefix}"`:s.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${s.suffix}"`:s.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${s.includes}"`:s.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${s.pattern}`:`Format invalid: ${n[s.format]??i.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${i.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${nn(i.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${i.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${i.origin}`;default:return"Intrare invalid\u0103"}}}});function Ogn(e,t,n,r){let i=Math.abs(e),s=i%10,o=i%100;return o>=11&&o<=19?r:s===1?t:s>=2&&s<=4?n:r}function Mgn(){return{localeError:mXi()}}var mXi,Pgn=C(()=>{ni();mXi=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(i){return e[i]??null}let n={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},r={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${s}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${Mn(i.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);if(o){let a=Number(i.maximum),l=Ogn(a,o.unit.one,o.unit.few,o.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${s}${i.maximum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);if(o){let a=Number(i.minimum),l=Ogn(a,o.unit.one,o.unit.few,o.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${s}${i.minimum.toString()} ${l}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${n[s.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${i.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0438":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}}});function Dgn(){return{localeError:fXi()}}var fXi,Bgn=C(()=>{ni();fXi=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(i){return e[i]??null}let n={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},r={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${i.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${s}, prejeto ${a}`}case"invalid_value":return i.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${Mn(i.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} imelo ${s}${i.maximum.toString()} ${o.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Premajhno: pri\u010Dakovano, da bo ${i.origin} imelo ${s}${i.minimum.toString()} ${o.unit}`:`Premajhno: pri\u010Dakovano, da bo ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${s.prefix}"`:s.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${s.suffix}"`:s.format==="includes"?`Neveljaven niz: mora vsebovati "${s.includes}"`:s.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${s.pattern}`:`Neveljaven ${n[s.format]??i.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${i.divisor}`;case"unrecognized_keys":return`Neprepoznan${i.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${nn(i.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${i.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${i.origin}`;default:return"Neveljaven vnos"}}}});function Lgn(){return{localeError:hXi()}}var hXi,Fgn=C(()=>{ni();hXi=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(i){return e[i]??null}let n={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},r={nan:"NaN",number:"antal",array:"lista"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${i.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${s}, fick ${a}`}case"invalid_value":return i.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${Mn(i.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`F\xF6r stor(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${s}${i.maximum.toString()} ${o.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${i.origin??"v\xE4rdet"} att ha ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${s}${i.minimum.toString()} ${o.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${s.prefix}"`:s.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${s.suffix}"`:s.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${s.includes}"`:s.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${s.pattern}"`:`Ogiltig(t) ${n[s.format]??i.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${nn(i.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${i.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${i.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}}});function Ugn(){return{localeError:gXi()}}var gXi,Vgn=C(()=>{ni();gXi=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(i){return e[i]??null}let n={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${i.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return i.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Mn(i.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${nn(i.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${s}${i.maximum.toString()} ${o.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${s}${i.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${s}${i.minimum.toString()} ${o.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${s}${i.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${s.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${n[s.format]??i.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${i.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${i.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}}});function Ggn(){return{localeError:bXi()}}var bXi,Wgn=C(()=>{ni();bXi=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(i){return e[i]??null}let n={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},r={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${i.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${s} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return i.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${Mn(i.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",o=t(i.origin);return o?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${i.maximum.toString()} ${o.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",o=t(i.origin);return o?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${i.minimum.toString()} ${o.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${s.prefix}"`:s.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${s.suffix}"`:s.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${s.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:s.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${s.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${n[s.format]??i.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${i.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${nn(i.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}}});function $gn(){return{localeError:yXi()}}var yXi,Qgn=C(()=>{ni();yXi=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(i){return e[i]??null}let n={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${i.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${s}, al\u0131nan ${a}`}case"invalid_value":return i.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Mn(i.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${s}${i.maximum.toString()} ${o.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${s}${i.minimum.toString()} ${o.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ge\xE7ersiz metin: "${s.prefix}" ile ba\u015Flamal\u0131`:s.format==="ends_with"?`Ge\xE7ersiz metin: "${s.suffix}" ile bitmeli`:s.format==="includes"?`Ge\xE7ersiz metin: "${s.includes}" i\xE7ermeli`:s.format==="regex"?`Ge\xE7ersiz metin: ${s.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${n[s.format]??i.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${i.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${i.keys.length>1?"lar":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${i.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}}});function XCe(){return{localeError:AXi()}}var AXi,fot=C(()=>{ni();AXi=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(i){return e[i]??null}let n={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},r={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${i.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${s}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${Mn(i.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} \u0431\u0443\u0434\u0435 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${n[s.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0456":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${i.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}}});function Hgn(){return XCe()}var Ygn=C(()=>{fot()});function Zgn(){return{localeError:EXi()}}var EXi,jgn=C(()=>{ni();EXi=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(i){return e[i]??null}let n={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},r={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${i.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${s} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return i.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${Mn(i.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${nn(i.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${s}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${s}${i.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u06D2 ${s}${i.minimum.toString()} ${o.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u0627 ${s}${i.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${s.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${n[s.format]??i.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${i.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${i.keys.length>1?"\u0632":""}: ${nn(i.keys,"\u060C ")}`;case"invalid_key":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}}});function zgn(){return{localeError:_Xi()}}var _Xi,Xgn=C(()=>{ni();_Xi=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(i){return e[i]??null}let n={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},r={nan:"NaN",number:"raqam",array:"massiv"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${i.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${s}, qabul qilingan ${a}`}case"invalid_value":return i.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${Mn(i.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Juda katta: kutilgan ${i.origin??"qiymat"} ${s}${i.maximum.toString()} ${o.unit} ${o.verb}`:`Juda katta: kutilgan ${i.origin??"qiymat"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Juda kichik: kutilgan ${i.origin} ${s}${i.minimum.toString()} ${o.unit} ${o.verb}`:`Juda kichik: kutilgan ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${s.prefix}" bilan boshlanishi kerak`:s.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${s.suffix}" bilan tugashi kerak`:s.format==="includes"?`Noto\u2018g\u2018ri satr: "${s.includes}" ni o\u2018z ichiga olishi kerak`:s.format==="regex"?`Noto\u2018g\u2018ri satr: ${s.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${n[s.format]??i.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${i.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${i.keys.length>1?"lar":""}: ${nn(i.keys,", ")}`;case"invalid_key":return`${i.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${i.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}}});function qgn(){return{localeError:SXi()}}var SXi,Kgn=C(()=>{ni();SXi=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(i){return e[i]??null}let n={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},r={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${i.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${s}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return i.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${Mn(i.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${s.prefix}"`:s.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${s.suffix}"`:s.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${s.includes}"`:s.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${s.pattern}`:`${n[s.format]??i.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${i.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${nn(i.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}}});function Jgn(){return{localeError:vXi()}}var vXi,ebn=C(()=>{ni();vXi=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(i){return e[i]??null}let n={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},r={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${i.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${s}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return i.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${Mn(i.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${s}${i.maximum.toString()} ${o.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${s}${i.minimum.toString()} ${o.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${s.prefix}" \u5F00\u5934`:s.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${s.suffix}" \u7ED3\u5C3E`:s.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${s.includes}"`:s.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${s.pattern}`:`\u65E0\u6548${n[s.format]??i.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${i.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${nn(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${i.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}}});function tbn(){return{localeError:xXi()}}var xXi,nbn=C(()=>{ni();xXi=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(i){return e[i]??null}let n={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},r={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${i.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${s}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return i.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${Mn(i.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${s}${i.maximum.toString()} ${o.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${s}${i.minimum.toString()} ${o.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${s.prefix}" \u958B\u982D`:s.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${s.suffix}" \u7D50\u5C3E`:s.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${s.includes}"`:s.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${s.pattern}`:`\u7121\u6548\u7684 ${n[s.format]??i.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${i.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${i.keys.length>1?"\u5011":""}\uFF1A${nn(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}}});function rbn(){return{localeError:CXi()}}var CXi,ibn=C(()=>{ni();CXi=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(i){return e[i]??null}let n={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},r={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return i=>{switch(i.code){case"invalid_type":{let s=r[i.expected]??i.expected,o=Pn(i.input),a=r[o]??o;return/^[A-Z]/.test(i.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${i.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${s}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return i.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${Mn(i.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${nn(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=t(i.origin);return o?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin??"iye"} ${o.verb} ${s}${i.maximum} ${o.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${s}${i.maximum}`}case"too_small":{let s=i.inclusive?">=":">",o=t(i.origin);return o?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin} ${o.verb} ${s}${i.minimum} ${o.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${s}${i.minimum}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${s.prefix}"`:s.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${s.suffix}"`:s.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${s.includes}"`:s.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${s.pattern}`:`A\u1E63\xEC\u1E63e: ${n[s.format]??i.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${i.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${nn(i.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}}});var FH={};li(FH,{ar:()=>dhn,az:()=>mhn,be:()=>ghn,bg:()=>yhn,ca:()=>Ehn,cs:()=>Shn,da:()=>xhn,de:()=>Thn,el:()=>whn,en:()=>jCe,eo:()=>Nhn,es:()=>Ohn,fa:()=>Phn,fi:()=>Bhn,fr:()=>Fhn,frCA:()=>Vhn,he:()=>Whn,hr:()=>Qhn,hu:()=>Yhn,hy:()=>zhn,id:()=>qhn,is:()=>Jhn,it:()=>tgn,ja:()=>rgn,ka:()=>sgn,kh:()=>agn,km:()=>zCe,ko:()=>cgn,lt:()=>pgn,mk:()=>fgn,ms:()=>ggn,nl:()=>ygn,no:()=>Egn,ota:()=>Sgn,pl:()=>Tgn,ps:()=>xgn,pt:()=>wgn,ro:()=>Ngn,ru:()=>Mgn,sl:()=>Dgn,sv:()=>Lgn,ta:()=>Ugn,th:()=>Ggn,tr:()=>$gn,ua:()=>Hgn,uk:()=>XCe,ur:()=>Zgn,uz:()=>zgn,vi:()=>qgn,yo:()=>rbn,zhCN:()=>Jgn,zhTW:()=>tbn});var qCe=C(()=>{phn();fhn();bhn();Ahn();_hn();vhn();Chn();Ihn();Rhn();pot();khn();Mhn();Dhn();Lhn();Uhn();Ghn();$hn();Hhn();Zhn();Xhn();Khn();egn();ngn();ign();ogn();lgn();mot();ugn();mgn();hgn();bgn();Agn();_gn();vgn();Cgn();Ign();Rgn();kgn();Pgn();Bgn();Fgn();Vgn();Wgn();Qgn();Ygn();fot();jgn();Xgn();Kgn();ebn();nbn();ibn()});function JCe(){return new KCe}var sbn,hot,got,KCe,$f,eoe=C(()=>{hot=Symbol("ZodOutput"),got=Symbol("ZodInput"),KCe=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};(sbn=globalThis).__zod_globalRegistry??(sbn.__zod_globalRegistry=JCe());$f=globalThis.__zod_globalRegistry});function bot(e,t){return new e({type:"string",...Vn(t)})}function yot(e,t){return new e({type:"string",coerce:!0,...Vn(t)})}function eTe(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Vn(t)})}function toe(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Vn(t)})}function tTe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Vn(t)})}function nTe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Vn(t)})}function rTe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Vn(t)})}function iTe(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Vn(t)})}function noe(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Vn(t)})}function sTe(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Vn(t)})}function oTe(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Vn(t)})}function aTe(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Vn(t)})}function lTe(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Vn(t)})}function cTe(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Vn(t)})}function uTe(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Vn(t)})}function dTe(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Vn(t)})}function pTe(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Vn(t)})}function mTe(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Vn(t)})}function Aot(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...Vn(t)})}function fTe(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Vn(t)})}function hTe(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Vn(t)})}function gTe(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Vn(t)})}function bTe(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Vn(t)})}function yTe(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Vn(t)})}function ATe(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Vn(t)})}function _ot(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Vn(t)})}function Sot(e,t){return new e({type:"string",format:"date",check:"string_format",...Vn(t)})}function vot(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Vn(t)})}function xot(e,t){return new e({type:"string",format:"duration",check:"string_format",...Vn(t)})}function Cot(e,t){return new e({type:"number",checks:[],...Vn(t)})}function Tot(e,t){return new e({type:"number",coerce:!0,checks:[],...Vn(t)})}function Iot(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Vn(t)})}function wot(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...Vn(t)})}function Rot(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...Vn(t)})}function Not(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...Vn(t)})}function kot(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...Vn(t)})}function Oot(e,t){return new e({type:"boolean",...Vn(t)})}function Mot(e,t){return new e({type:"boolean",coerce:!0,...Vn(t)})}function Pot(e,t){return new e({type:"bigint",...Vn(t)})}function Dot(e,t){return new e({type:"bigint",coerce:!0,...Vn(t)})}function Bot(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...Vn(t)})}function Lot(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...Vn(t)})}function Fot(e,t){return new e({type:"symbol",...Vn(t)})}function Uot(e,t){return new e({type:"undefined",...Vn(t)})}function Vot(e,t){return new e({type:"null",...Vn(t)})}function Got(e){return new e({type:"any"})}function Wot(e){return new e({type:"unknown"})}function $ot(e,t){return new e({type:"never",...Vn(t)})}function Qot(e,t){return new e({type:"void",...Vn(t)})}function Hot(e,t){return new e({type:"date",...Vn(t)})}function Yot(e,t){return new e({type:"date",coerce:!0,...Vn(t)})}function Zot(e,t){return new e({type:"nan",...Vn(t)})}function kT(e,t){return new BCe({check:"less_than",...Vn(t),value:e,inclusive:!1})}function EA(e,t){return new BCe({check:"less_than",...Vn(t),value:e,inclusive:!0})}function OT(e,t){return new LCe({check:"greater_than",...Vn(t),value:e,inclusive:!1})}function Kg(e,t){return new LCe({check:"greater_than",...Vn(t),value:e,inclusive:!0})}function ETe(e){return OT(0,e)}function _Te(e){return kT(0,e)}function STe(e){return EA(0,e)}function vTe(e){return Kg(0,e)}function DP(e,t){return new Pit({check:"multiple_of",...Vn(t),value:e})}function BP(e,t){return new Lit({check:"max_size",...Vn(t),maximum:e})}function MT(e,t){return new Fit({check:"min_size",...Vn(t),minimum:e})}function y3(e,t){return new Uit({check:"size_equals",...Vn(t),size:e})}function A3(e,t){return new Vit({check:"max_length",...Vn(t),maximum:e})}function VN(e,t){return new Git({check:"min_length",...Vn(t),minimum:e})}function E3(e,t){return new Wit({check:"length_equals",...Vn(t),length:e})}function UH(e,t){return new $it({check:"string_format",format:"regex",...Vn(t),pattern:e})}function VH(e){return new Qit({check:"string_format",format:"lowercase",...Vn(e)})}function GH(e){return new Hit({check:"string_format",format:"uppercase",...Vn(e)})}function WH(e,t){return new Yit({check:"string_format",format:"includes",...Vn(t),includes:e})}function $H(e,t){return new Zit({check:"string_format",format:"starts_with",...Vn(t),prefix:e})}function QH(e,t){return new jit({check:"string_format",format:"ends_with",...Vn(t),suffix:e})}function xTe(e,t,n){return new zit({check:"property",property:e,schema:t,...Vn(n)})}function HH(e,t){return new Xit({check:"mime_type",mime:e,...Vn(t)})}function Cv(e){return new qit({check:"overwrite",tx:e})}function YH(e){return Cv(t=>t.normalize(e))}function ZH(){return Cv(e=>e.trim())}function jH(){return Cv(e=>e.toLowerCase())}function zH(){return Cv(e=>e.toUpperCase())}function XH(){return Cv(e=>Zrt(e))}function jot(e,t,n){return new e({type:"array",element:t,...Vn(n)})}function IXi(e,t,n){return new e({type:"union",options:t,...Vn(n)})}function wXi(e,t,n){return new e({type:"union",options:t,inclusive:!1,...Vn(n)})}function RXi(e,t,n,r){return new e({type:"union",options:n,discriminator:t,...Vn(r)})}function NXi(e,t,n){return new e({type:"intersection",left:t,right:n})}function kXi(e,t,n,r){let i=n instanceof fs,s=i?r:n,o=i?n:null;return new e({type:"tuple",items:t,rest:o,...Vn(s)})}function OXi(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,...Vn(r)})}function MXi(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,...Vn(r)})}function PXi(e,t,n){return new e({type:"set",valueType:t,...Vn(n)})}function DXi(e,t,n){let r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new e({type:"enum",entries:r,...Vn(n)})}function BXi(e,t,n){return new e({type:"enum",entries:t,...Vn(n)})}function LXi(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...Vn(n)})}function zot(e,t){return new e({type:"file",...Vn(t)})}function FXi(e,t){return new e({type:"transform",transform:t})}function UXi(e,t){return new e({type:"optional",innerType:t})}function VXi(e,t){return new e({type:"nullable",innerType:t})}function GXi(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():zrt(n)}})}function WXi(e,t,n){return new e({type:"nonoptional",innerType:t,...Vn(n)})}function $Xi(e,t){return new e({type:"success",innerType:t})}function QXi(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:()=>n})}function HXi(e,t,n){return new e({type:"pipe",in:t,out:n})}function YXi(e,t){return new e({type:"readonly",innerType:t})}function ZXi(e,t,n){return new e({type:"template_literal",parts:t,...Vn(n)})}function jXi(e,t){return new e({type:"lazy",getter:t})}function zXi(e,t){return new e({type:"promise",innerType:t})}function Xot(e,t,n){let r=Vn(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function qot(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Vn(n)})}function Kot(e,t){let n=obn(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(NH(i,r.value,n._zod.def));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(NH(s))}},e(r.value,r)),t);return n}function obn(e,t){let n=new gc({check:"custom",...Vn(t)});return n._zod.check=e,n}function Jot(e){let t=new gc({check:"describe"});return t._zod.onattach=[n=>{let r=$f.get(n)??{};$f.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function eat(e){let t=new gc({check:"meta"});return t._zod.onattach=[n=>{let r=$f.get(n)??{};$f.add(n,{...r,...e})}],t._zod.check=()=>{},t}function tat(e,t){let n=Vn(t),r=n.truthy??["true","1","yes","on","y","enabled"],i=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(m=>typeof m=="string"?m.toLowerCase():m),i=i.map(m=>typeof m=="string"?m.toLowerCase():m));let s=new Set(r),o=new Set(i),a=e.Codec??Kse,l=e.Boolean??Xse,u=e.String??b3,c=new u({type:"string",error:n.error}),d=new l({type:"boolean",error:n.error}),p=new a({type:"pipe",in:c,out:d,transform:((m,f)=>{let h=m;return n.case!=="sensitive"&&(h=h.toLowerCase()),s.has(h)?!0:o.has(h)?!1:(f.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...o],input:f.value,inst:p,continue:!1}),{})}),reverseTransform:((m,f)=>m===!0?r[0]||"true":i[0]||"false"),error:n.error});return p}function qH(e,t,n,r={}){let i=Vn(r),s={...Vn(r),check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...i};return n instanceof RegExp&&(s.pattern=n),new e(s)}var Eot,abn=C(()=>{FCe();eoe();dot();ni();Eot={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function LP(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??$f,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function gl(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{let c={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,c);else{let p=o.schema,m=t.processors[i.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);m(e,t,p,c)}let d=e._zod.parent;d&&(o.ref||(o.ref=d),gl(d,t,c),t.seen.get(d).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),t.io==="input"&&Jg(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function FP(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let o of e.seen.entries()){let a=e.metadataRegistry.get(o[0])?.id;if(a){let l=r.get(a);if(l&&l!==o[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,o[0])}}let i=o=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(o[0])?.id,p=e.external.uri??(f=>f);if(d)return{ref:p(d)};let m=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=m,{defId:m,ref:`${p("__shared")}#/${a}/${m}`}}if(o[1]===n)return{ref:"#"};let u=`#/${a}/`,c=o[1].schema.id??`__schema${e.counter++}`;return{defId:c,ref:u+c}},s=o=>{if(o[1].schema.$ref)return;let a=o[1],{ref:l,defId:u}=i(o);a.def={...a.schema},u&&(a.defId=u);let c=a.schema;for(let d in c)delete c[d];c.$ref=l};if(e.cycles==="throw")for(let o of e.seen.entries()){let a=o[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
214
214
 
215
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let a=o[1];if(t===o[0]){s(o);continue}if(e.external){let u=e.external.registry.get(o[0])?.id;if(t!==o[0]&&u){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}if(a.count>1&&e.reused==="ref"){s(o);continue}}}function UP(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let l=e.seen.get(a);if(l.ref===null)return;let u=l.def??l.schema,c={...u},d=l.ref;if(l.ref=null,d){r(d);let m=e.seen.get(d),f=m.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,c),a._zod.parent===d)for(let g in u)g==="$ref"||g==="allOf"||g in c||delete u[g];if(f.$ref&&m.def)for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}let p=a._zod.parent;if(p&&p!==d){r(p);let m=e.seen.get(p);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let f in u)f==="$ref"||f==="allOf"||f in m.def&&JSON.stringify(u[f])===JSON.stringify(m.def[f])&&delete u[f]}e.override({zodSchema:a,jsonSchema:u,path:l.path??[]})};for(let a of[...e.seen.entries()].reverse())r(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;let o=e.external?.defs??{};for(let a of e.seen.entries()){let l=a[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,o[l.defId]=l.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:KH(t,"input",e.processors),output:KH(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Jg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Jg(r.element,n);if(r.type==="set")return Jg(r.valueType,n);if(r.type==="lazy")return Jg(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Jg(r.innerType,n);if(r.type==="intersection")return Jg(r.left,n)||Jg(r.right,n);if(r.type==="record"||r.type==="map")return Jg(r.keyType,n)||Jg(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Jg(r.in,n)||Jg(r.out,n);if(r.type==="object"){for(let i in r.shape)if(Jg(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(let i of r.options)if(Jg(i,n))return!0;return!1}if(r.type==="tuple"){for(let i of r.items)if(Jg(i,n))return!0;return!!(r.rest&&Jg(r.rest,n))}return!1}var nat,KH,roe=C(()=>{eoe();nat=(e,t={})=>n=>{let r=LP({...n,processors:t});return gl(e,r),FP(r,e),UP(r,e)},KH=(e,t,n={})=>r=>{let{libraryOptions:i,target:s}=r??{},o=LP({...i??{},target:s,io:t,processors:n});return gl(e,o),FP(o,e),UP(o,e)}});function wTe(e,t){if("_idmap"in e){let r=e,i=LP({...t,processors:CTe}),s={};for(let l of r._idmap.entries()){let[u,c]=l;gl(c,i)}let o={},a={registry:r,uri:t?.uri,defs:s};i.external=a;for(let l of r._idmap.entries()){let[u,c]=l;FP(i,c),o[u]=UP(i,c)}if(Object.keys(s).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[l]:s}}return{schemas:o}}let n=LP({...t,processors:CTe});return gl(e,n),FP(n,e),UP(n,e)}var XXi,rat,iat,sat,oat,aat,lat,cat,uat,dat,pat,mat,fat,hat,gat,bat,yat,Aat,Eat,_at,Sat,vat,xat,Cat,Tat,Iat,TTe,wat,Rat,Nat,kat,Oat,Mat,Pat,Dat,Bat,Lat,Fat,ITe,Uat,CTe,ioe=C(()=>{roe();ni();XXi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rat=(e,t,n,r)=>{let i=n;i.type="string";let{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=XXi[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),l&&l.size>0){let c=[...l];c.length===1?i.pattern=c[0].source:c.length>1&&(i.allOf=[...c.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},iat=(e,t,n,r)=>{let i=n,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:c}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";let d=typeof c=="number"&&c>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(o??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";d?m?(i.minimum=c,i.exclusiveMinimum=!0):i.exclusiveMinimum=c:typeof s=="number"&&(i.minimum=s),p?m?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:typeof o=="number"&&(i.maximum=o),typeof l=="number"&&(i.multipleOf=l)},sat=(e,t,n,r)=>{n.type="boolean"},oat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},aat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},lat=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},cat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},uat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},dat=(e,t,n,r)=>{n.not={}},pat=(e,t,n,r)=>{},mat=(e,t,n,r)=>{},fat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},hat=(e,t,n,r)=>{let i=e._zod.def,s=Bse(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},gat=(e,t,n,r)=>{let i=e._zod.def,s=[];for(let o of i.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){let o=s[0];n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[o]:n.const=o}else s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),s.every(o=>typeof o=="boolean")&&(n.type="boolean"),s.every(o=>o===null)&&(n.type="null"),n.enum=s},bat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},yat=(e,t,n,r)=>{let i=n,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=s.source},Aat=(e,t,n,r)=>{let i=n,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:a,mime:l}=e._zod.bag;o!==void 0&&(s.minLength=o),a!==void 0&&(s.maxLength=a),l?l.length===1?(s.contentMediaType=l[0],Object.assign(i,s)):(Object.assign(i,s),i.anyOf=l.map(u=>({contentMediaType:u}))):Object.assign(i,s)},Eat=(e,t,n,r)=>{n.type="boolean"},_at=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Sat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},vat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},xat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Cat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Tat=(e,t,n,r)=>{let i=n,s=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=gl(s.element,t,{...r,path:[...r.path,"items"]})},Iat=(e,t,n,r)=>{let i=n,s=e._zod.def;i.type="object",i.properties={};let o=s.shape;for(let u in o)i.properties[u]=gl(o[u],t,{...r,path:[...r.path,"properties",u]});let a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{let c=s.shape[u]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));l.size>0&&(i.required=Array.from(l)),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=gl(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},TTe=(e,t,n,r)=>{let i=e._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>gl(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},wat=(e,t,n,r)=>{let i=e._zod.def,s=gl(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=gl(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=l},Rat=(e,t,n,r)=>{let i=n,s=e._zod.def;i.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((p,m)=>gl(p,t,{...r,path:[...r.path,o,m]})),u=s.rest?gl(s.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=l,u&&(i.items=u)):t.target==="openapi-3.0"?(i.items={anyOf:l},u&&i.items.anyOf.push(u),i.minItems=l.length,u||(i.maxItems=l.length)):(i.items=l,u&&(i.additionalItems=u));let{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(i.minItems=c),typeof d=="number"&&(i.maxItems=d)},Nat=(e,t,n,r)=>{let i=n,s=e._zod.def;i.type="object";let o=s.keyType,l=o._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){let c=gl(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(let d of l)i.patternProperties[d.source]=c}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=gl(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=gl(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let u=o._zod.values;if(u){let c=[...u].filter(d=>typeof d=="string"||typeof d=="number");c.length>0&&(i.required=c)}},kat=(e,t,n,r)=>{let i=e._zod.def,s=gl(i.innerType,t,r),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Oat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType},Mat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Pat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Dat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},Bat=(e,t,n,r)=>{let i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?i.out:i.in:i.out;gl(o,t,r);let a=t.seen.get(e);a.ref=o},Lat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType,n.readOnly=!0},Fat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType},ITe=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType},Uat=(e,t,n,r)=>{let i=e._zod.innerType;gl(i,t,r);let s=t.seen.get(e);s.ref=i},CTe={string:rat,number:iat,boolean:sat,bigint:oat,symbol:aat,null:lat,undefined:cat,void:uat,never:dat,any:pat,unknown:mat,date:fat,enum:hat,literal:gat,nan:bat,template_literal:yat,file:Aat,success:Eat,custom:_at,function:Sat,transform:vat,map:xat,set:Cat,array:Tat,object:Iat,union:TTe,intersection:wat,tuple:Rat,record:Nat,nullable:kat,nonoptional:Oat,default:Mat,prefault:Pat,catch:Dat,pipe:Bat,readonly:Lat,promise:Fat,optional:ITe,lazy:Uat}});var RTe,lbn=C(()=>{ioe();roe();RTe=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=LP({processors:CTe,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return gl(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),FP(this.ctx,t);let r=UP(this.ctx,t),{"~standard":i,...s}=r;return s}}});var cbn={};var ubn=C(()=>{});var PT={};li(PT,{$ZodAny:()=>Mst,$ZodArray:()=>Fst,$ZodAsyncError:()=>xv,$ZodBase64:()=>vst,$ZodBase64URL:()=>xst,$ZodBigInt:()=>QCe,$ZodBigIntFormat:()=>Rst,$ZodBoolean:()=>Xse,$ZodCIDRv4:()=>Est,$ZodCIDRv6:()=>_st,$ZodCUID:()=>lst,$ZodCUID2:()=>cst,$ZodCatch:()=>not,$ZodCheck:()=>gc,$ZodCheckBigIntFormat:()=>Bit,$ZodCheckEndsWith:()=>jit,$ZodCheckGreaterThan:()=>LCe,$ZodCheckIncludes:()=>Yit,$ZodCheckLengthEquals:()=>Wit,$ZodCheckLessThan:()=>BCe,$ZodCheckLowerCase:()=>Qit,$ZodCheckMaxLength:()=>Vit,$ZodCheckMaxSize:()=>Lit,$ZodCheckMimeType:()=>Xit,$ZodCheckMinLength:()=>Git,$ZodCheckMinSize:()=>Fit,$ZodCheckMultipleOf:()=>Pit,$ZodCheckNumberFormat:()=>Dit,$ZodCheckOverwrite:()=>qit,$ZodCheckProperty:()=>zit,$ZodCheckRegex:()=>$it,$ZodCheckSizeEquals:()=>Uit,$ZodCheckStartsWith:()=>Zit,$ZodCheckStringFormat:()=>BH,$ZodCheckUpperCase:()=>Hit,$ZodCodec:()=>Kse,$ZodCustom:()=>uot,$ZodCustomStringFormat:()=>Ist,$ZodDate:()=>Lst,$ZodDefault:()=>Kst,$ZodDiscriminatedUnion:()=>Gst,$ZodE164:()=>Cst,$ZodEmail:()=>ist,$ZodEmoji:()=>ost,$ZodEncodeError:()=>NP,$ZodEnum:()=>Yst,$ZodError:()=>Gse,$ZodExactOptional:()=>Xst,$ZodFile:()=>jst,$ZodFunction:()=>aot,$ZodGUID:()=>nst,$ZodIPv4:()=>bst,$ZodIPv6:()=>yst,$ZodISODate:()=>fst,$ZodISODateTime:()=>mst,$ZodISODuration:()=>gst,$ZodISOTime:()=>hst,$ZodIntersection:()=>Wst,$ZodJWT:()=>Tst,$ZodKSUID:()=>pst,$ZodLazy:()=>cot,$ZodLiteral:()=>Zst,$ZodMAC:()=>Ast,$ZodMap:()=>Qst,$ZodNaN:()=>rot,$ZodNanoID:()=>ast,$ZodNever:()=>Dst,$ZodNonOptional:()=>eot,$ZodNull:()=>Ost,$ZodNullable:()=>qst,$ZodNumber:()=>$Ce,$ZodNumberFormat:()=>wst,$ZodObject:()=>uhn,$ZodObjectJIT:()=>Ust,$ZodOptional:()=>YCe,$ZodPipe:()=>ZCe,$ZodPrefault:()=>Jst,$ZodPreprocess:()=>iot,$ZodPromise:()=>lot,$ZodReadonly:()=>sot,$ZodRealError:()=>Wy,$ZodRecord:()=>$st,$ZodRegistry:()=>KCe,$ZodSet:()=>Hst,$ZodString:()=>b3,$ZodStringFormat:()=>jl,$ZodSuccess:()=>tot,$ZodSymbol:()=>Nst,$ZodTemplateLiteral:()=>oot,$ZodTransform:()=>zst,$ZodTuple:()=>HCe,$ZodType:()=>fs,$ZodULID:()=>ust,$ZodURL:()=>sst,$ZodUUID:()=>rst,$ZodUndefined:()=>kst,$ZodUnion:()=>qse,$ZodUnknown:()=>Pst,$ZodVoid:()=>Bst,$ZodXID:()=>dst,$ZodXor:()=>Vst,$brand:()=>$rt,$constructor:()=>Ut,$input:()=>got,$output:()=>hot,Doc:()=>zse,JSONSchema:()=>cbn,JSONSchemaGenerator:()=>RTe,NEVER:()=>Pse,TimePrecision:()=>Eot,_any:()=>Got,_array:()=>jot,_base64:()=>gTe,_base64url:()=>bTe,_bigint:()=>Pot,_boolean:()=>Oot,_catch:()=>QXi,_check:()=>obn,_cidrv4:()=>fTe,_cidrv6:()=>hTe,_coercedBigint:()=>Dot,_coercedBoolean:()=>Mot,_coercedDate:()=>Yot,_coercedNumber:()=>Tot,_coercedString:()=>yot,_cuid:()=>aTe,_cuid2:()=>lTe,_custom:()=>Xot,_date:()=>Hot,_decode:()=>TCe,_decodeAsync:()=>wCe,_default:()=>GXi,_discriminatedUnion:()=>RXi,_e164:()=>yTe,_email:()=>eTe,_emoji:()=>sTe,_encode:()=>CCe,_encodeAsync:()=>ICe,_endsWith:()=>QH,_enum:()=>DXi,_file:()=>zot,_float32:()=>wot,_float64:()=>Rot,_gt:()=>OT,_gte:()=>Kg,_guid:()=>toe,_includes:()=>WH,_int:()=>Iot,_int32:()=>Not,_int64:()=>Bot,_intersection:()=>NXi,_ipv4:()=>pTe,_ipv6:()=>mTe,_isoDate:()=>Sot,_isoDateTime:()=>_ot,_isoDuration:()=>xot,_isoTime:()=>vot,_jwt:()=>ATe,_ksuid:()=>dTe,_lazy:()=>jXi,_length:()=>E3,_literal:()=>LXi,_lowercase:()=>VH,_lt:()=>kT,_lte:()=>EA,_mac:()=>Aot,_map:()=>MXi,_max:()=>EA,_maxLength:()=>A3,_maxSize:()=>BP,_mime:()=>HH,_min:()=>Kg,_minLength:()=>VN,_minSize:()=>MT,_multipleOf:()=>DP,_nan:()=>Zot,_nanoid:()=>oTe,_nativeEnum:()=>BXi,_negative:()=>_Te,_never:()=>$ot,_nonnegative:()=>vTe,_nonoptional:()=>WXi,_nonpositive:()=>STe,_normalize:()=>YH,_null:()=>Vot,_nullable:()=>VXi,_number:()=>Cot,_optional:()=>UXi,_overwrite:()=>Cv,_parse:()=>kH,_parseAsync:()=>OH,_pipe:()=>HXi,_positive:()=>ETe,_promise:()=>zXi,_property:()=>xTe,_readonly:()=>YXi,_record:()=>OXi,_refine:()=>qot,_regex:()=>UH,_safeDecode:()=>NCe,_safeDecodeAsync:()=>OCe,_safeEncode:()=>RCe,_safeEncodeAsync:()=>kCe,_safeParse:()=>MH,_safeParseAsync:()=>DH,_set:()=>PXi,_size:()=>y3,_slugify:()=>XH,_startsWith:()=>$H,_string:()=>bot,_stringFormat:()=>qH,_stringbool:()=>tat,_success:()=>$Xi,_superRefine:()=>Kot,_symbol:()=>Fot,_templateLiteral:()=>ZXi,_toLowerCase:()=>jH,_toUpperCase:()=>zH,_transform:()=>FXi,_trim:()=>ZH,_tuple:()=>kXi,_uint32:()=>kot,_uint64:()=>Lot,_ulid:()=>cTe,_undefined:()=>Uot,_union:()=>IXi,_unknown:()=>Wot,_uppercase:()=>GH,_url:()=>noe,_uuid:()=>tTe,_uuidv4:()=>nTe,_uuidv6:()=>rTe,_uuidv7:()=>iTe,_void:()=>Qot,_xid:()=>uTe,_xor:()=>wXi,clone:()=>Xg,config:()=>gd,createStandardJSONSchemaMethod:()=>KH,createToJSONSchemaMethod:()=>nat,decode:()=>Mfn,decodeAsync:()=>Dfn,describe:()=>Jot,encode:()=>Ofn,encodeAsync:()=>Pfn,extractDefs:()=>FP,finalize:()=>UP,flattenError:()=>Wse,formatError:()=>$se,globalConfig:()=>m3,globalRegistry:()=>$f,initializeContext:()=>LP,isValidBase64:()=>Sst,isValidBase64URL:()=>ohn,isValidJWT:()=>ahn,locales:()=>FH,meta:()=>eat,parse:()=>Qse,parseAsync:()=>Hse,prettifyError:()=>nit,process:()=>gl,regexes:()=>AA,registry:()=>JCe,safeDecode:()=>Lfn,safeDecodeAsync:()=>Ufn,safeEncode:()=>Bfn,safeEncodeAsync:()=>Ffn,safeParse:()=>PH,safeParseAsync:()=>Yse,toDotPath:()=>kfn,toJSONSchema:()=>wTe,treeifyError:()=>tit,util:()=>Dn,version:()=>Jit});var eb=C(()=>{f3();iit();rit();dot();FCe();est();ni();DCe();qCe();eoe();Kit();abn();roe();ioe();lbn();ubn()});var NTe={};li(NTe,{endsWith:()=>QH,gt:()=>OT,gte:()=>Kg,includes:()=>WH,length:()=>E3,lowercase:()=>VH,lt:()=>kT,lte:()=>EA,maxLength:()=>A3,maxSize:()=>BP,mime:()=>HH,minLength:()=>VN,minSize:()=>MT,multipleOf:()=>DP,negative:()=>_Te,nonnegative:()=>vTe,nonpositive:()=>STe,normalize:()=>YH,overwrite:()=>Cv,positive:()=>ETe,property:()=>xTe,regex:()=>UH,size:()=>y3,slugify:()=>XH,startsWith:()=>$H,toLowerCase:()=>jH,toUpperCase:()=>zH,trim:()=>ZH,uppercase:()=>GH});var kTe=C(()=>{eb()});var VP={};li(VP,{ZodISODate:()=>MTe,ZodISODateTime:()=>OTe,ZodISODuration:()=>DTe,ZodISOTime:()=>PTe,date:()=>Gat,datetime:()=>Vat,duration:()=>$at,time:()=>Wat});function Vat(e){return _ot(OTe,e)}function Gat(e){return Sot(MTe,e)}function Wat(e){return vot(PTe,e)}function $at(e){return xot(DTe,e)}var OTe,MTe,PTe,DTe,soe=C(()=>{eb();aoe();OTe=Ut("ZodISODateTime",(e,t)=>{mst.init(e,t),zl.init(e,t)});MTe=Ut("ZodISODate",(e,t)=>{fst.init(e,t),zl.init(e,t)});PTe=Ut("ZodISOTime",(e,t)=>{hst.init(e,t),zl.init(e,t)});DTe=Ut("ZodISODuration",(e,t)=>{gst.init(e,t),zl.init(e,t)})});var dbn,Op,$y,Qat=C(()=>{eb();eb();ni();dbn=(e,t)=>{Gse.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>$se(e,n)},flatten:{value:n=>Wse(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,wH,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,wH,2)}},isEmpty:{get(){return e.issues.length===0}}})},Op=Ut("ZodError",dbn),$y=Ut("ZodError",dbn,{Parent:Error})});var Hat,Yat,Zat,jat,zat,Xat,qat,Kat,Jat,elt,tlt,nlt,rlt=C(()=>{eb();Qat();Hat=kH($y),Yat=OH($y),Zat=MH($y),jat=DH($y),zat=CCe($y),Xat=TCe($y),qat=ICe($y),Kat=wCe($y),Jat=RCe($y),elt=NCe($y),tlt=kCe($y),nlt=OCe($y)});var ooe={};li(ooe,{ZodAny:()=>llt,ZodArray:()=>plt,ZodBase64:()=>XTe,ZodBase64URL:()=>qTe,ZodBigInt:()=>oY,ZodBigIntFormat:()=>eIe,ZodBoolean:()=>sY,ZodCIDRv4:()=>jTe,ZodCIDRv6:()=>zTe,ZodCUID:()=>GTe,ZodCUID2:()=>WTe,ZodCatch:()=>Olt,ZodCodec:()=>yoe,ZodCustom:()=>Aoe,ZodCustomStringFormat:()=>rY,ZodDate:()=>moe,ZodDefault:()=>Tlt,ZodDiscriminatedUnion:()=>flt,ZodE164:()=>KTe,ZodEmail:()=>FTe,ZodEmoji:()=>UTe,ZodEnum:()=>eY,ZodExactOptional:()=>vlt,ZodFile:()=>_lt,ZodFunction:()=>Wlt,ZodGUID:()=>loe,ZodIPv4:()=>YTe,ZodIPv6:()=>ZTe,ZodIntersection:()=>hlt,ZodJWT:()=>JTe,ZodKSUID:()=>HTe,ZodLazy:()=>Ult,ZodLiteral:()=>Elt,ZodMAC:()=>ilt,ZodMap:()=>ylt,ZodNaN:()=>Plt,ZodNanoID:()=>VTe,ZodNever:()=>ult,ZodNonOptional:()=>sIe,ZodNull:()=>alt,ZodNullable:()=>Clt,ZodNumber:()=>iY,ZodNumberFormat:()=>_3,ZodObject:()=>foe,ZodOptional:()=>iIe,ZodPipe:()=>boe,ZodPrefault:()=>wlt,ZodPreprocess:()=>Dlt,ZodPromise:()=>Glt,ZodReadonly:()=>Blt,ZodRecord:()=>JH,ZodSet:()=>Alt,ZodString:()=>tY,ZodStringFormat:()=>zl,ZodSuccess:()=>klt,ZodSymbol:()=>slt,ZodTemplateLiteral:()=>Flt,ZodTransform:()=>Slt,ZodTuple:()=>glt,ZodType:()=>Fs,ZodULID:()=>$Te,ZodURL:()=>doe,ZodUUID:()=>DT,ZodUndefined:()=>olt,ZodUnion:()=>hoe,ZodUnknown:()=>clt,ZodVoid:()=>dlt,ZodXID:()=>QTe,ZodXor:()=>mlt,_ZodString:()=>LTe,_default:()=>Ilt,_function:()=>myn,any:()=>tIe,array:()=>Nn,base64:()=>Obn,base64url:()=>Mbn,bigint:()=>Qbn,boolean:()=>Ji,catch:()=>Mlt,check:()=>fyn,cidrv4:()=>Nbn,cidrv6:()=>kbn,codec:()=>cyn,cuid:()=>Sbn,cuid2:()=>vbn,custom:()=>oIe,date:()=>Xbn,describe:()=>hyn,discriminatedUnion:()=>goe,e164:()=>Pbn,email:()=>mbn,emoji:()=>Ebn,enum:()=>Qf,exactOptional:()=>xlt,file:()=>syn,float32:()=>Vbn,float64:()=>Gbn,function:()=>myn,guid:()=>fbn,hash:()=>Ubn,hex:()=>Fbn,hostname:()=>Lbn,httpUrl:()=>Abn,instanceof:()=>byn,int:()=>tp,int32:()=>Wbn,int64:()=>Hbn,intersection:()=>Qy,invertCodec:()=>uyn,ipv4:()=>Ibn,ipv6:()=>Rbn,json:()=>Ayn,jwt:()=>Dbn,keyof:()=>qbn,ksuid:()=>Tbn,lazy:()=>Vlt,literal:()=>Mt,looseObject:()=>np,looseRecord:()=>tyn,mac:()=>wbn,map:()=>nyn,meta:()=>gyn,nan:()=>lyn,nanoid:()=>_bn,nativeEnum:()=>iyn,never:()=>nIe,nonoptional:()=>Nlt,null:()=>poe,nullable:()=>coe,nullish:()=>oyn,number:()=>Qr,object:()=>Je,optional:()=>bc,partialRecord:()=>eyn,pipe:()=>BTe,prefault:()=>Rlt,preprocess:()=>Eoe,promise:()=>pyn,readonly:()=>Llt,record:()=>vt,refine:()=>$lt,set:()=>ryn,strictObject:()=>Kbn,string:()=>Ae,stringFormat:()=>Bbn,stringbool:()=>yyn,success:()=>ayn,superRefine:()=>Qlt,symbol:()=>Zbn,templateLiteral:()=>dyn,transform:()=>rIe,tuple:()=>blt,uint32:()=>$bn,uint64:()=>Ybn,ulid:()=>xbn,undefined:()=>jbn,union:()=>ur,unknown:()=>Et,url:()=>nY,uuid:()=>hbn,uuidv4:()=>gbn,uuidv6:()=>bbn,uuidv7:()=>ybn,void:()=>zbn,xid:()=>Cbn,xor:()=>Jbn});function uoe(e,t,n){let r=Object.getPrototypeOf(e),i=pbn.get(r);if(i||(i=new Set,pbn.set(r,i)),!i.has(t)){i.add(t);for(let s in n){let o=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}function Ae(e){return bot(tY,e)}function mbn(e){return eTe(FTe,e)}function fbn(e){return toe(loe,e)}function hbn(e){return tTe(DT,e)}function gbn(e){return nTe(DT,e)}function bbn(e){return rTe(DT,e)}function ybn(e){return iTe(DT,e)}function nY(e){return noe(doe,e)}function Abn(e){return noe(doe,{protocol:AA.httpProtocol,hostname:AA.domain,...Dn.normalizeParams(e)})}function Ebn(e){return sTe(UTe,e)}function _bn(e){return oTe(VTe,e)}function Sbn(e){return aTe(GTe,e)}function vbn(e){return lTe(WTe,e)}function xbn(e){return cTe($Te,e)}function Cbn(e){return uTe(QTe,e)}function Tbn(e){return dTe(HTe,e)}function Ibn(e){return pTe(YTe,e)}function wbn(e){return Aot(ilt,e)}function Rbn(e){return mTe(ZTe,e)}function Nbn(e){return fTe(jTe,e)}function kbn(e){return hTe(zTe,e)}function Obn(e){return gTe(XTe,e)}function Mbn(e){return bTe(qTe,e)}function Pbn(e){return yTe(KTe,e)}function Dbn(e){return ATe(JTe,e)}function Bbn(e,t,n={}){return qH(rY,e,t,n)}function Lbn(e){return qH(rY,"hostname",AA.hostname,e)}function Fbn(e){return qH(rY,"hex",AA.hex,e)}function Ubn(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,i=AA[r];if(!i)throw new Error(`Unrecognized hash format: ${r}`);return qH(rY,r,i,t)}function Qr(e){return Cot(iY,e)}function tp(e){return Iot(_3,e)}function Vbn(e){return wot(_3,e)}function Gbn(e){return Rot(_3,e)}function Wbn(e){return Not(_3,e)}function $bn(e){return kot(_3,e)}function Ji(e){return Oot(sY,e)}function Qbn(e){return Pot(oY,e)}function Hbn(e){return Bot(eIe,e)}function Ybn(e){return Lot(eIe,e)}function Zbn(e){return Fot(slt,e)}function jbn(e){return Uot(olt,e)}function poe(e){return Vot(alt,e)}function tIe(){return Got(llt)}function Et(){return Wot(clt)}function nIe(e){return $ot(ult,e)}function zbn(e){return Qot(dlt,e)}function Xbn(e){return Hot(moe,e)}function Nn(e,t){return jot(plt,e,t)}function qbn(e){let t=e._zod.def.shape;return Qf(Object.keys(t))}function Je(e,t){let n={type:"object",shape:e??{},...Dn.normalizeParams(t)};return new foe(n)}function Kbn(e,t){return new foe({type:"object",shape:e,catchall:nIe(),...Dn.normalizeParams(t)})}function np(e,t){return new foe({type:"object",shape:e,catchall:Et(),...Dn.normalizeParams(t)})}function ur(e,t){return new hoe({type:"union",options:e,...Dn.normalizeParams(t)})}function Jbn(e,t){return new mlt({type:"union",options:e,inclusive:!1,...Dn.normalizeParams(t)})}function goe(e,t,n){return new flt({type:"union",options:t,discriminator:e,...Dn.normalizeParams(n)})}function Qy(e,t){return new hlt({type:"intersection",left:e,right:t})}function blt(e,t,n){let r=t instanceof fs,i=r?n:t,s=r?t:null;return new glt({type:"tuple",items:e,rest:s,...Dn.normalizeParams(i)})}function vt(e,t,n){return!t||!t._zod?new JH({type:"record",keyType:Ae(),valueType:e,...Dn.normalizeParams(t)}):new JH({type:"record",keyType:e,valueType:t,...Dn.normalizeParams(n)})}function eyn(e,t,n){let r=Xg(e);return r._zod.values=void 0,new JH({type:"record",keyType:r,valueType:t,...Dn.normalizeParams(n)})}function tyn(e,t,n){return new JH({type:"record",keyType:e,valueType:t,mode:"loose",...Dn.normalizeParams(n)})}function nyn(e,t,n){return new ylt({type:"map",keyType:e,valueType:t,...Dn.normalizeParams(n)})}function ryn(e,t){return new Alt({type:"set",valueType:e,...Dn.normalizeParams(t)})}function Qf(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new eY({type:"enum",entries:n,...Dn.normalizeParams(t)})}function iyn(e,t){return new eY({type:"enum",entries:e,...Dn.normalizeParams(t)})}function Mt(e,t){return new Elt({type:"literal",values:Array.isArray(e)?e:[e],...Dn.normalizeParams(t)})}function syn(e){return zot(_lt,e)}function rIe(e){return new Slt({type:"transform",transform:e})}function bc(e){return new iIe({type:"optional",innerType:e})}function xlt(e){return new vlt({type:"optional",innerType:e})}function coe(e){return new Clt({type:"nullable",innerType:e})}function oyn(e){return bc(coe(e))}function Ilt(e,t){return new Tlt({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Dn.shallowClone(t)}})}function Rlt(e,t){return new wlt({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Dn.shallowClone(t)}})}function Nlt(e,t){return new sIe({type:"nonoptional",innerType:e,...Dn.normalizeParams(t)})}function ayn(e){return new klt({type:"success",innerType:e})}function Mlt(e,t){return new Olt({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function lyn(e){return Zot(Plt,e)}function BTe(e,t){return new boe({type:"pipe",in:e,out:t})}function cyn(e,t,n){return new yoe({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function uyn(e){let t=e._zod.def;return new yoe({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function Llt(e){return new Blt({type:"readonly",innerType:e})}function dyn(e,t){return new Flt({type:"template_literal",parts:e,...Dn.normalizeParams(t)})}function Vlt(e){return new Ult({type:"lazy",getter:e})}function pyn(e){return new Glt({type:"promise",innerType:e})}function myn(e){return new Wlt({type:"function",input:Array.isArray(e?.input)?blt(e?.input):e?.input??Nn(Et()),output:e?.output??Et()})}function fyn(e){let t=new gc({check:"custom"});return t._zod.check=e,t}function oIe(e,t){return Xot(Aoe,e??(()=>!0),t)}function $lt(e,t={}){return qot(Aoe,e,t)}function Qlt(e,t){return Kot(e,t)}function byn(e,t={}){let n=new Aoe({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...Dn.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Ayn(e){let t=Vlt(()=>ur([Ae(e),Qr(),Ji(),poe(),Nn(t),vt(Ae(),t)]));return t}function Eoe(e,t){return new Dlt({type:"pipe",in:rIe(e),out:t})}var pbn,Fs,LTe,tY,zl,FTe,loe,DT,doe,UTe,VTe,GTe,WTe,$Te,QTe,HTe,YTe,ilt,ZTe,jTe,zTe,XTe,qTe,KTe,JTe,rY,iY,_3,sY,oY,eIe,slt,olt,alt,llt,clt,ult,dlt,moe,plt,foe,hoe,mlt,flt,hlt,glt,JH,ylt,Alt,eY,Elt,_lt,Slt,iIe,vlt,Clt,Tlt,wlt,sIe,klt,Olt,Plt,boe,yoe,Dlt,Blt,Flt,Ult,Glt,Wlt,Aoe,hyn,gyn,yyn,aoe=C(()=>{eb();eb();ioe();roe();kTe();soe();rlt();pbn=new WeakMap;Fs=Ut("ZodType",(e,t)=>(fs.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:KH(e,"input"),output:KH(e,"output")}}),e.toJSONSchema=nat(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>Hat(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Zat(e,n,r),e.parseAsync=async(n,r)=>Yat(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>jat(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>zat(e,n,r),e.decode=(n,r)=>Xat(e,n,r),e.encodeAsync=async(n,r)=>qat(e,n,r),e.decodeAsync=async(n,r)=>Kat(e,n,r),e.safeEncode=(n,r)=>Jat(e,n,r),e.safeDecode=(n,r)=>elt(e,n,r),e.safeEncodeAsync=async(n,r)=>tlt(e,n,r),e.safeDecodeAsync=async(n,r)=>nlt(e,n,r),uoe(e,"ZodType",{check(...n){let r=this.def;return this.clone(Dn.mergeDefs(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Xg(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check($lt(n,r))},superRefine(n,r){return this.check(Qlt(n,r))},overwrite(n){return this.check(Cv(n))},optional(){return bc(this)},exactOptional(){return xlt(this)},nullable(){return coe(this)},nullish(){return bc(coe(this))},nonoptional(n){return Nlt(this,n)},array(){return Nn(this)},or(n){return ur([this,n])},and(n){return Qy(this,n)},transform(n){return BTe(this,rIe(n))},default(n){return Ilt(this,n)},prefault(n){return Rlt(this,n)},catch(n){return Mlt(this,n)},pipe(n){return BTe(this,n)},readonly(){return Llt(this)},describe(n){let r=this.clone();return $f.add(r,{description:n}),r},meta(...n){if(n.length===0)return $f.get(this);let r=this.clone();return $f.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return $f.get(e)?.description},configurable:!0}),e)),LTe=Ut("_ZodString",(e,t)=>{b3.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>rat(e,r,i,s);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,uoe(e,"_ZodString",{regex(...r){return this.check(UH(...r))},includes(...r){return this.check(WH(...r))},startsWith(...r){return this.check($H(...r))},endsWith(...r){return this.check(QH(...r))},min(...r){return this.check(VN(...r))},max(...r){return this.check(A3(...r))},length(...r){return this.check(E3(...r))},nonempty(...r){return this.check(VN(1,...r))},lowercase(r){return this.check(VH(r))},uppercase(r){return this.check(GH(r))},trim(){return this.check(ZH())},normalize(...r){return this.check(YH(...r))},toLowerCase(){return this.check(jH())},toUpperCase(){return this.check(zH())},slugify(){return this.check(XH())}})}),tY=Ut("ZodString",(e,t)=>{b3.init(e,t),LTe.init(e,t),e.email=n=>e.check(eTe(FTe,n)),e.url=n=>e.check(noe(doe,n)),e.jwt=n=>e.check(ATe(JTe,n)),e.emoji=n=>e.check(sTe(UTe,n)),e.guid=n=>e.check(toe(loe,n)),e.uuid=n=>e.check(tTe(DT,n)),e.uuidv4=n=>e.check(nTe(DT,n)),e.uuidv6=n=>e.check(rTe(DT,n)),e.uuidv7=n=>e.check(iTe(DT,n)),e.nanoid=n=>e.check(oTe(VTe,n)),e.guid=n=>e.check(toe(loe,n)),e.cuid=n=>e.check(aTe(GTe,n)),e.cuid2=n=>e.check(lTe(WTe,n)),e.ulid=n=>e.check(cTe($Te,n)),e.base64=n=>e.check(gTe(XTe,n)),e.base64url=n=>e.check(bTe(qTe,n)),e.xid=n=>e.check(uTe(QTe,n)),e.ksuid=n=>e.check(dTe(HTe,n)),e.ipv4=n=>e.check(pTe(YTe,n)),e.ipv6=n=>e.check(mTe(ZTe,n)),e.cidrv4=n=>e.check(fTe(jTe,n)),e.cidrv6=n=>e.check(hTe(zTe,n)),e.e164=n=>e.check(yTe(KTe,n)),e.datetime=n=>e.check(Vat(n)),e.date=n=>e.check(Gat(n)),e.time=n=>e.check(Wat(n)),e.duration=n=>e.check($at(n))});zl=Ut("ZodStringFormat",(e,t)=>{jl.init(e,t),LTe.init(e,t)}),FTe=Ut("ZodEmail",(e,t)=>{ist.init(e,t),zl.init(e,t)});loe=Ut("ZodGUID",(e,t)=>{nst.init(e,t),zl.init(e,t)});DT=Ut("ZodUUID",(e,t)=>{rst.init(e,t),zl.init(e,t)});doe=Ut("ZodURL",(e,t)=>{sst.init(e,t),zl.init(e,t)});UTe=Ut("ZodEmoji",(e,t)=>{ost.init(e,t),zl.init(e,t)});VTe=Ut("ZodNanoID",(e,t)=>{ast.init(e,t),zl.init(e,t)});GTe=Ut("ZodCUID",(e,t)=>{lst.init(e,t),zl.init(e,t)});WTe=Ut("ZodCUID2",(e,t)=>{cst.init(e,t),zl.init(e,t)});$Te=Ut("ZodULID",(e,t)=>{ust.init(e,t),zl.init(e,t)});QTe=Ut("ZodXID",(e,t)=>{dst.init(e,t),zl.init(e,t)});HTe=Ut("ZodKSUID",(e,t)=>{pst.init(e,t),zl.init(e,t)});YTe=Ut("ZodIPv4",(e,t)=>{bst.init(e,t),zl.init(e,t)});ilt=Ut("ZodMAC",(e,t)=>{Ast.init(e,t),zl.init(e,t)});ZTe=Ut("ZodIPv6",(e,t)=>{yst.init(e,t),zl.init(e,t)});jTe=Ut("ZodCIDRv4",(e,t)=>{Est.init(e,t),zl.init(e,t)});zTe=Ut("ZodCIDRv6",(e,t)=>{_st.init(e,t),zl.init(e,t)});XTe=Ut("ZodBase64",(e,t)=>{vst.init(e,t),zl.init(e,t)});qTe=Ut("ZodBase64URL",(e,t)=>{xst.init(e,t),zl.init(e,t)});KTe=Ut("ZodE164",(e,t)=>{Cst.init(e,t),zl.init(e,t)});JTe=Ut("ZodJWT",(e,t)=>{Tst.init(e,t),zl.init(e,t)});rY=Ut("ZodCustomStringFormat",(e,t)=>{Ist.init(e,t),zl.init(e,t)});iY=Ut("ZodNumber",(e,t)=>{$Ce.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>iat(e,r,i,s),uoe(e,"ZodNumber",{gt(r,i){return this.check(OT(r,i))},gte(r,i){return this.check(Kg(r,i))},min(r,i){return this.check(Kg(r,i))},lt(r,i){return this.check(kT(r,i))},lte(r,i){return this.check(EA(r,i))},max(r,i){return this.check(EA(r,i))},int(r){return this.check(tp(r))},safe(r){return this.check(tp(r))},positive(r){return this.check(OT(0,r))},nonnegative(r){return this.check(Kg(0,r))},negative(r){return this.check(kT(0,r))},nonpositive(r){return this.check(EA(0,r))},multipleOf(r,i){return this.check(DP(r,i))},step(r,i){return this.check(DP(r,i))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});_3=Ut("ZodNumberFormat",(e,t)=>{wst.init(e,t),iY.init(e,t)});sY=Ut("ZodBoolean",(e,t)=>{Xse.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>sat(e,n,r,i)});oY=Ut("ZodBigInt",(e,t)=>{QCe.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>oat(e,r,i,s),e.gte=(r,i)=>e.check(Kg(r,i)),e.min=(r,i)=>e.check(Kg(r,i)),e.gt=(r,i)=>e.check(OT(r,i)),e.gte=(r,i)=>e.check(Kg(r,i)),e.min=(r,i)=>e.check(Kg(r,i)),e.lt=(r,i)=>e.check(kT(r,i)),e.lte=(r,i)=>e.check(EA(r,i)),e.max=(r,i)=>e.check(EA(r,i)),e.positive=r=>e.check(OT(BigInt(0),r)),e.negative=r=>e.check(kT(BigInt(0),r)),e.nonpositive=r=>e.check(EA(BigInt(0),r)),e.nonnegative=r=>e.check(Kg(BigInt(0),r)),e.multipleOf=(r,i)=>e.check(DP(r,i));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});eIe=Ut("ZodBigIntFormat",(e,t)=>{Rst.init(e,t),oY.init(e,t)});slt=Ut("ZodSymbol",(e,t)=>{Nst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>aat(e,n,r,i)});olt=Ut("ZodUndefined",(e,t)=>{kst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>cat(e,n,r,i)});alt=Ut("ZodNull",(e,t)=>{Ost.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>lat(e,n,r,i)});llt=Ut("ZodAny",(e,t)=>{Mst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>pat(e,n,r,i)});clt=Ut("ZodUnknown",(e,t)=>{Pst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>mat(e,n,r,i)});ult=Ut("ZodNever",(e,t)=>{Dst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>dat(e,n,r,i)});dlt=Ut("ZodVoid",(e,t)=>{Bst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>uat(e,n,r,i)});moe=Ut("ZodDate",(e,t)=>{Lst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>fat(e,r,i,s),e.min=(r,i)=>e.check(Kg(r,i)),e.max=(r,i)=>e.check(EA(r,i));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});plt=Ut("ZodArray",(e,t)=>{Fst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Tat(e,n,r,i),e.element=t.element,uoe(e,"ZodArray",{min(n,r){return this.check(VN(n,r))},nonempty(n){return this.check(VN(1,n))},max(n,r){return this.check(A3(n,r))},length(n,r){return this.check(E3(n,r))},unwrap(){return this.element}})});foe=Ut("ZodObject",(e,t)=>{Ust.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Iat(e,n,r,i),Dn.defineLazy(e,"shape",()=>t.shape),uoe(e,"ZodObject",{keyof(){return Qf(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Et()})},loose(){return this.clone({...this._zod.def,catchall:Et()})},strict(){return this.clone({...this._zod.def,catchall:nIe()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Dn.extend(this,n)},safeExtend(n){return Dn.safeExtend(this,n)},merge(n){return Dn.merge(this,n)},pick(n){return Dn.pick(this,n)},omit(n){return Dn.omit(this,n)},partial(...n){return Dn.partial(iIe,this,n[0])},required(...n){return Dn.required(sIe,this,n[0])}})});hoe=Ut("ZodUnion",(e,t)=>{qse.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>TTe(e,n,r,i),e.options=t.options});mlt=Ut("ZodXor",(e,t)=>{hoe.init(e,t),Vst.init(e,t),e._zod.processJSONSchema=(n,r,i)=>TTe(e,n,r,i),e.options=t.options});flt=Ut("ZodDiscriminatedUnion",(e,t)=>{hoe.init(e,t),Gst.init(e,t)});hlt=Ut("ZodIntersection",(e,t)=>{Wst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>wat(e,n,r,i)});glt=Ut("ZodTuple",(e,t)=>{HCe.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Rat(e,n,r,i),e.rest=n=>e.clone({...e._zod.def,rest:n})});JH=Ut("ZodRecord",(e,t)=>{$st.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Nat(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});ylt=Ut("ZodMap",(e,t)=>{Qst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>xat(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(MT(...n)),e.nonempty=n=>e.check(MT(1,n)),e.max=(...n)=>e.check(BP(...n)),e.size=(...n)=>e.check(y3(...n))});Alt=Ut("ZodSet",(e,t)=>{Hst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Cat(e,n,r,i),e.min=(...n)=>e.check(MT(...n)),e.nonempty=n=>e.check(MT(1,n)),e.max=(...n)=>e.check(BP(...n)),e.size=(...n)=>e.check(y3(...n))});eY=Ut("ZodEnum",(e,t)=>{Yst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>hat(e,r,i,s),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{let s={};for(let o of r)if(n.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new eY({...t,checks:[],...Dn.normalizeParams(i),entries:s})},e.exclude=(r,i)=>{let s={...t.entries};for(let o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new eY({...t,checks:[],...Dn.normalizeParams(i),entries:s})}});Elt=Ut("ZodLiteral",(e,t)=>{Zst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>gat(e,n,r,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});_lt=Ut("ZodFile",(e,t)=>{jst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Aat(e,n,r,i),e.min=(n,r)=>e.check(MT(n,r)),e.max=(n,r)=>e.check(BP(n,r)),e.mime=(n,r)=>e.check(HH(Array.isArray(n)?n:[n],r))});Slt=Ut("ZodTransform",(e,t)=>{zst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>vat(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new NP(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Dn.issue(s,n.value,t));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),n.issues.push(Dn.issue(o))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});iIe=Ut("ZodOptional",(e,t)=>{YCe.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ITe(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});vlt=Ut("ZodExactOptional",(e,t)=>{Xst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ITe(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Clt=Ut("ZodNullable",(e,t)=>{qst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>kat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Tlt=Ut("ZodDefault",(e,t)=>{Kst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Mat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});wlt=Ut("ZodPrefault",(e,t)=>{Jst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Pat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});sIe=Ut("ZodNonOptional",(e,t)=>{eot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Oat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});klt=Ut("ZodSuccess",(e,t)=>{tot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Eat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Olt=Ut("ZodCatch",(e,t)=>{not.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Dat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});Plt=Ut("ZodNaN",(e,t)=>{rot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>bat(e,n,r,i)});boe=Ut("ZodPipe",(e,t)=>{ZCe.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Bat(e,n,r,i),e.in=t.in,e.out=t.out});yoe=Ut("ZodCodec",(e,t)=>{boe.init(e,t),Kse.init(e,t)});Dlt=Ut("ZodPreprocess",(e,t)=>{boe.init(e,t),iot.init(e,t)}),Blt=Ut("ZodReadonly",(e,t)=>{sot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Lat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Flt=Ut("ZodTemplateLiteral",(e,t)=>{oot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>yat(e,n,r,i)});Ult=Ut("ZodLazy",(e,t)=>{cot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Uat(e,n,r,i),e.unwrap=()=>e._zod.def.getter()});Glt=Ut("ZodPromise",(e,t)=>{lot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Fat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Wlt=Ut("ZodFunction",(e,t)=>{aot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Sat(e,n,r,i)});Aoe=Ut("ZodCustom",(e,t)=>{uot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>_at(e,n,r,i)});hyn=Jot,gyn=eat;yyn=(...e)=>tat({Codec:yoe,Boolean:sY,String:tY},...e)});function JXi(e){gd({customError:e})}function eqi(){return gd().customError}var Ylt,Hlt,Eyn=C(()=>{eb();Ylt={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};Hlt||(Hlt={})});function nqi(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function rqi(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let i=n[1];if(!i||!t.defs[i])throw new Error(`Reference not found: ${e}`);return t.defs[i]}throw new Error(`Reference not found: ${e}`)}function _yn(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return br.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let i=e.$ref;if(t.refs.has(i))return t.refs.get(i);if(t.processing.has(i))return br.lazy(()=>{if(!t.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return t.refs.get(i)});t.processing.add(i);let s=rqi(i,t),o=eg(s,t);return t.refs.set(i,o),t.processing.delete(i),o}if(e.enum!==void 0){let i=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&i.length===1&&i[0]===null)return br.null();if(i.length===0)return br.never();if(i.length===1)return br.literal(i[0]);if(i.every(o=>typeof o=="string"))return br.enum(i);let s=i.map(o=>br.literal(o));return s.length<2?s[0]:br.union([s[0],s[1],...s.slice(2)])}if(e.const!==void 0)return br.literal(e.const);let n=e.type;if(Array.isArray(n)){let i=n.map(s=>{let o={...e,type:s};return _yn(o,t)});return i.length===0?br.never():i.length===1?i[0]:br.union(i)}if(!n)return br.any();let r;switch(n){case"string":{let i=br.string();if(e.format){let s=e.format;s==="email"?i=i.check(br.email()):s==="uri"||s==="uri-reference"?i=i.check(br.url()):s==="uuid"||s==="guid"?i=i.check(br.uuid()):s==="date-time"?i=i.check(br.iso.datetime()):s==="date"?i=i.check(br.iso.date()):s==="time"?i=i.check(br.iso.time()):s==="duration"?i=i.check(br.iso.duration()):s==="ipv4"?i=i.check(br.ipv4()):s==="ipv6"?i=i.check(br.ipv6()):s==="mac"?i=i.check(br.mac()):s==="cidr"?i=i.check(br.cidrv4()):s==="cidr-v6"?i=i.check(br.cidrv6()):s==="base64"?i=i.check(br.base64()):s==="base64url"?i=i.check(br.base64url()):s==="e164"?i=i.check(br.e164()):s==="jwt"?i=i.check(br.jwt()):s==="emoji"?i=i.check(br.emoji()):s==="nanoid"?i=i.check(br.nanoid()):s==="cuid"?i=i.check(br.cuid()):s==="cuid2"?i=i.check(br.cuid2()):s==="ulid"?i=i.check(br.ulid()):s==="xid"?i=i.check(br.xid()):s==="ksuid"&&(i=i.check(br.ksuid()))}typeof e.minLength=="number"&&(i=i.min(e.minLength)),typeof e.maxLength=="number"&&(i=i.max(e.maxLength)),e.pattern&&(i=i.regex(new RegExp(e.pattern))),r=i;break}case"number":case"integer":{let i=n==="integer"?br.number().int():br.number();typeof e.minimum=="number"&&(i=i.min(e.minimum)),typeof e.maximum=="number"&&(i=i.max(e.maximum)),typeof e.exclusiveMinimum=="number"?i=i.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(i=i.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?i=i.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(i=i.lt(e.maximum)),typeof e.multipleOf=="number"&&(i=i.multipleOf(e.multipleOf)),r=i;break}case"boolean":{r=br.boolean();break}case"null":{r=br.null();break}case"object":{let i={},s=e.properties||{},o=new Set(e.required||[]);for(let[l,u]of Object.entries(s)){let c=eg(u,t);i[l]=o.has(l)?c:c.optional()}if(e.propertyNames){let l=eg(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties=="object"?eg(e.additionalProperties,t):br.any();if(Object.keys(i).length===0){r=br.record(l,u);break}let c=br.object(i).passthrough(),d=br.looseRecord(l,u);r=br.intersection(c,d);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),c=[];for(let p of u){let m=eg(l[p],t),f=br.string().regex(new RegExp(p));c.push(br.looseRecord(f,m))}let d=[];if(Object.keys(i).length>0&&d.push(br.object(i).passthrough()),d.push(...c),d.length===0)r=br.object({}).passthrough();else if(d.length===1)r=d[0];else{let p=br.intersection(d[0],d[1]);for(let m=2;m<d.length;m++)p=br.intersection(p,d[m]);r=p}break}let a=br.object(i);e.additionalProperties===!1?r=a.strict():typeof e.additionalProperties=="object"?r=a.catchall(eg(e.additionalProperties,t)):r=a.passthrough();break}case"array":{let i=e.prefixItems,s=e.items;if(i&&Array.isArray(i)){let o=i.map(l=>eg(l,t)),a=s&&typeof s=="object"&&!Array.isArray(s)?eg(s,t):void 0;a?r=br.tuple(o).rest(a):r=br.tuple(o),typeof e.minItems=="number"&&(r=r.check(br.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(br.maxLength(e.maxItems)))}else if(Array.isArray(s)){let o=s.map(l=>eg(l,t)),a=e.additionalItems&&typeof e.additionalItems=="object"?eg(e.additionalItems,t):void 0;a?r=br.tuple(o).rest(a):r=br.tuple(o),typeof e.minItems=="number"&&(r=r.check(br.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(br.maxLength(e.maxItems)))}else if(s!==void 0){let o=eg(s,t),a=br.array(o);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=br.array(br.any());break}default:throw new Error(`Unsupported type: ${n}`)}return r}function eg(e,t){if(typeof e=="boolean")return e?br.any():br.never();let n=_yn(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>eg(u,t)),l=br.union(a);n=r?br.intersection(n,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>eg(u,t)),l=br.xor(a);n=r?br.intersection(n,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:br.any();else{let a=r?n:eg(e.allOf[0],t),l=r?0:1;for(let u=l;u<e.allOf.length;u++)a=br.intersection(a,eg(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=br.nullable(n)),e.readOnly===!0&&(n=br.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let i={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of s)a in e&&(i[a]=e[a]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let a of o)a in e&&(i[a]=e[a]);for(let a of Object.keys(e))tqi.has(a)||(i[a]=e[a]);return Object.keys(i).length>0&&t.registry.add(n,i),e.description&&(n=n.describe(e.description)),n}function Syn(e,t){if(typeof e=="boolean")return e?br.any():br.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=nqi(n,t?.defaultTarget),i=n.$defs||n.definitions||{},s={version:r,defs:i,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??$f};return eg(n,s)}var br,tqi,vyn=C(()=>{eoe();kTe();soe();aoe();br={...ooe,...NTe,iso:VP},tqi=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"])});var _oe={};li(_oe,{bigint:()=>aqi,boolean:()=>oqi,date:()=>lqi,number:()=>sqi,string:()=>iqi});function iqi(e){return yot(tY,e)}function sqi(e){return Tot(iY,e)}function oqi(e){return Mot(sY,e)}function aqi(e){return Dot(oY,e)}function lqi(e){return Yot(moe,e)}var xyn=C(()=>{eb();aoe()});var Ct={};li(Ct,{$brand:()=>$rt,$input:()=>got,$output:()=>hot,NEVER:()=>Pse,TimePrecision:()=>Eot,ZodAny:()=>llt,ZodArray:()=>plt,ZodBase64:()=>XTe,ZodBase64URL:()=>qTe,ZodBigInt:()=>oY,ZodBigIntFormat:()=>eIe,ZodBoolean:()=>sY,ZodCIDRv4:()=>jTe,ZodCIDRv6:()=>zTe,ZodCUID:()=>GTe,ZodCUID2:()=>WTe,ZodCatch:()=>Olt,ZodCodec:()=>yoe,ZodCustom:()=>Aoe,ZodCustomStringFormat:()=>rY,ZodDate:()=>moe,ZodDefault:()=>Tlt,ZodDiscriminatedUnion:()=>flt,ZodE164:()=>KTe,ZodEmail:()=>FTe,ZodEmoji:()=>UTe,ZodEnum:()=>eY,ZodError:()=>Op,ZodExactOptional:()=>vlt,ZodFile:()=>_lt,ZodFirstPartyTypeKind:()=>Hlt,ZodFunction:()=>Wlt,ZodGUID:()=>loe,ZodIPv4:()=>YTe,ZodIPv6:()=>ZTe,ZodISODate:()=>MTe,ZodISODateTime:()=>OTe,ZodISODuration:()=>DTe,ZodISOTime:()=>PTe,ZodIntersection:()=>hlt,ZodIssueCode:()=>Ylt,ZodJWT:()=>JTe,ZodKSUID:()=>HTe,ZodLazy:()=>Ult,ZodLiteral:()=>Elt,ZodMAC:()=>ilt,ZodMap:()=>ylt,ZodNaN:()=>Plt,ZodNanoID:()=>VTe,ZodNever:()=>ult,ZodNonOptional:()=>sIe,ZodNull:()=>alt,ZodNullable:()=>Clt,ZodNumber:()=>iY,ZodNumberFormat:()=>_3,ZodObject:()=>foe,ZodOptional:()=>iIe,ZodPipe:()=>boe,ZodPrefault:()=>wlt,ZodPreprocess:()=>Dlt,ZodPromise:()=>Glt,ZodReadonly:()=>Blt,ZodRealError:()=>$y,ZodRecord:()=>JH,ZodSet:()=>Alt,ZodString:()=>tY,ZodStringFormat:()=>zl,ZodSuccess:()=>klt,ZodSymbol:()=>slt,ZodTemplateLiteral:()=>Flt,ZodTransform:()=>Slt,ZodTuple:()=>glt,ZodType:()=>Fs,ZodULID:()=>$Te,ZodURL:()=>doe,ZodUUID:()=>DT,ZodUndefined:()=>olt,ZodUnion:()=>hoe,ZodUnknown:()=>clt,ZodVoid:()=>dlt,ZodXID:()=>QTe,ZodXor:()=>mlt,_ZodString:()=>LTe,_default:()=>Ilt,_function:()=>myn,any:()=>tIe,array:()=>Nn,base64:()=>Obn,base64url:()=>Mbn,bigint:()=>Qbn,boolean:()=>Ji,catch:()=>Mlt,check:()=>fyn,cidrv4:()=>Nbn,cidrv6:()=>kbn,clone:()=>Xg,codec:()=>cyn,coerce:()=>_oe,config:()=>gd,core:()=>PT,cuid:()=>Sbn,cuid2:()=>vbn,custom:()=>oIe,date:()=>Xbn,decode:()=>Xat,decodeAsync:()=>Kat,describe:()=>hyn,discriminatedUnion:()=>goe,e164:()=>Pbn,email:()=>mbn,emoji:()=>Ebn,encode:()=>zat,encodeAsync:()=>qat,endsWith:()=>QH,enum:()=>Qf,exactOptional:()=>xlt,file:()=>syn,flattenError:()=>Wse,float32:()=>Vbn,float64:()=>Gbn,formatError:()=>$se,fromJSONSchema:()=>Syn,function:()=>myn,getErrorMap:()=>eqi,globalRegistry:()=>$f,gt:()=>OT,gte:()=>Kg,guid:()=>fbn,hash:()=>Ubn,hex:()=>Fbn,hostname:()=>Lbn,httpUrl:()=>Abn,includes:()=>WH,instanceof:()=>byn,int:()=>tp,int32:()=>Wbn,int64:()=>Hbn,intersection:()=>Qy,invertCodec:()=>uyn,ipv4:()=>Ibn,ipv6:()=>Rbn,iso:()=>VP,json:()=>Ayn,jwt:()=>Dbn,keyof:()=>qbn,ksuid:()=>Tbn,lazy:()=>Vlt,length:()=>E3,literal:()=>Mt,locales:()=>FH,looseObject:()=>np,looseRecord:()=>tyn,lowercase:()=>VH,lt:()=>kT,lte:()=>EA,mac:()=>wbn,map:()=>nyn,maxLength:()=>A3,maxSize:()=>BP,meta:()=>gyn,mime:()=>HH,minLength:()=>VN,minSize:()=>MT,multipleOf:()=>DP,nan:()=>lyn,nanoid:()=>_bn,nativeEnum:()=>iyn,negative:()=>_Te,never:()=>nIe,nonnegative:()=>vTe,nonoptional:()=>Nlt,nonpositive:()=>STe,normalize:()=>YH,null:()=>poe,nullable:()=>coe,nullish:()=>oyn,number:()=>Qr,object:()=>Je,optional:()=>bc,overwrite:()=>Cv,parse:()=>Hat,parseAsync:()=>Yat,partialRecord:()=>eyn,pipe:()=>BTe,positive:()=>ETe,prefault:()=>Rlt,preprocess:()=>Eoe,prettifyError:()=>nit,promise:()=>pyn,property:()=>xTe,readonly:()=>Llt,record:()=>vt,refine:()=>$lt,regex:()=>UH,regexes:()=>AA,registry:()=>JCe,safeDecode:()=>elt,safeDecodeAsync:()=>nlt,safeEncode:()=>Jat,safeEncodeAsync:()=>tlt,safeParse:()=>Zat,safeParseAsync:()=>jat,set:()=>ryn,setErrorMap:()=>JXi,size:()=>y3,slugify:()=>XH,startsWith:()=>$H,strictObject:()=>Kbn,string:()=>Ae,stringFormat:()=>Bbn,stringbool:()=>yyn,success:()=>ayn,superRefine:()=>Qlt,symbol:()=>Zbn,templateLiteral:()=>dyn,toJSONSchema:()=>wTe,toLowerCase:()=>jH,toUpperCase:()=>zH,transform:()=>rIe,treeifyError:()=>tit,trim:()=>ZH,tuple:()=>blt,uint32:()=>$bn,uint64:()=>Ybn,ulid:()=>xbn,undefined:()=>jbn,union:()=>ur,unknown:()=>Et,uppercase:()=>GH,url:()=>nY,util:()=>Dn,uuid:()=>hbn,uuidv4:()=>gbn,uuidv6:()=>bbn,uuidv7:()=>ybn,void:()=>zbn,xid:()=>Cbn,xor:()=>Jbn});var Soe=C(()=>{eb();aoe();kTe();Qat();rlt();Eyn();eb();pot();eb();ioe();vyn();qCe();soe();soe();xyn();gd(jCe())});var Hf=C(()=>{Soe();Soe()});var Cyn,aIe,cqi,uqi,dqi,pqi,mqi,fqi,hqi,Tyn,Iyn=C(()=>{"use strict";Hf();Cyn=["off","bell","desktop_notification"],aIe=e=>e===null?"null":Array.isArray(e)?"an array":`a ${typeof e}`,cqi=e=>{try{return new RegExp(e),!0}catch{return!1}},uqi=Ct.discriminatedUnion("type",[Ct.object({type:Ct.enum(["allow","deny","ask-user"])}),Ct.object({type:Ct.literal("webhook-policy"),webhookUrl:Ct.url({error:'"permission.webhookUrl" must be a valid URL for a "webhook-policy".'})}),Ct.object({type:Ct.literal("script-policy"),script:Ct.string({error:'"permission.script" must be a non-empty string for a "script-policy".'}).min(1,{error:'"permission.script" must be a non-empty string for a "script-policy".'})})],{error:'unknown or invalid "permission".'}),dqi=Ct.object({toolName:Ct.string({error:'"toolName" must be a non-empty string.'}).min(1,{error:'"toolName" must be a non-empty string.'}),permission:uqi,eventType:Ct.enum(["tool-call","tool-response"],{error:'"eventType" must be "tool-call" or "tool-response" when present.'}).optional(),shellInputRegex:Ct.string({error:'"shellInputRegex" must be a string when present.'}).refine(cqi,{error:'"shellInputRegex" must be a valid regular expression when present.'}).optional()},{error:e=>`rule must be an object, got ${aIe(e.input)}.`}),pqi=e=>{let t=e.issues[0];if(t===void 0)return"invalid rule.";let n=t.message.endsWith(".")?t.message:`${t.message}.`;return t.path.length===0||n.startsWith('"')?n:`"${t.path.join(".")}": ${n}`},mqi='Expected { "toolName": string, "permission": { "type": "allow" | "deny" | "ask-user" } | { "type": "webhook-policy", "webhookUrl": string } | { "type": "script-policy", "script": string }, "eventType"?: "tool-call" | "tool-response", "shellInputRegex"?: string }.',fqi=e=>{let t=e.toolPermissions;if(t===void 0)return[];if(!Array.isArray(t))return e.toolPermissions=void 0,[`Ignoring "toolPermissions": expected an array of rules, got ${aIe(t)}.`];let n=[],r=[];for(let i=0;i<t.length;i++){let s=dqi.safeParse(t[i]);s.success?r.push(t[i]):n.push(`Dropping invalid "toolPermissions" rule at index ${i}: ${pqi(s.error)} ${mqi}`)}return n.length>0&&(e.toolPermissions=r),n},hqi=e=>{if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,e.queueMode=void 0),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",e.websockets=void 0),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){let t=e.skills;t.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=t.enableSkillCommands),Array.isArray(t.customDirectories)&&t.customDirectories.length>0?e.skills=t.customDirectories:e.skills=void 0}return e},Tyn=e=>{let t=hqi(e),n=fqi(t);e.autoUpdate!==void 0&&typeof e.autoUpdate!="boolean"&&(n.push(`Ignoring "autoUpdate": expected a boolean, got ${aIe(e.autoUpdate)}.`),t.autoUpdate=void 0);for(let r of["verbose","collapseLongPastedText","updateTerminalTitle"])e[r]!==void 0&&typeof e[r]!="boolean"&&(n.push(`Ignoring "${r}": expected a boolean, got ${aIe(e[r])}.`),t[r]=void 0);for(let r of["numPastedLinesToCollapse","numPastedCharsToCollapse"]){let i=e[r];i!==void 0&&!(typeof i=="number"&&Number.isInteger(i)&&i>0)&&(n.push(`Ignoring "${r}": expected a positive integer.`),t[r]=void 0)}return e.notificationMode!==void 0&&!Cyn.includes(e.notificationMode)&&(n.push(`Ignoring "notificationMode": expected one of ${Cyn.join(", ")}.`),t.notificationMode=void 0),{settings:t,warnings:n}}});var gqi,wyn,bqi,BT,yqi,GP,jlt,Zlt,Aqi,S3,v3=C(()=>{"use strict";Wrt();Iyn();gqi=new Map([["defaultModel","model"],["shellPath","shell"],["shellCommandPrefix","startupScript"]]),wyn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),bqi=e=>{xfn(e,{onObjectProperty:t=>{if(GP.has(t))throw new Error(`Settings document contains reserved key "${t}".`)}})},BT=e=>{bqi(e);let t=[],n=Sfn(e,t,{allowTrailingComma:!0});if(t.length>0){let r=t.map(i=>Cfn(i.error)).join(", ");throw new Error(`Failed to parse settings JSON: ${r}`)}if(n===void 0)return{};if(!wyn(n))throw new Error("Settings document is not a valid object. Expected a JSON object but found a different type (e.g., array).");return n},yqi={tabSize:2,insertSpaces:!0},GP=new Set(["__proto__","constructor","prototype"]),jlt=e=>{let t=typeof e=="string"?e.split("."):[...e],n=typeof e=="string"?e:e.join(".");for(let r of t){if(r==="")throw new Error(`Invalid settings path "${n}": empty segment.`);if(GP.has(r))throw new Error(`Invalid settings path "${n}": "${r}" is a reserved key.`)}return t},Zlt=(e,t,n)=>{let r=_Ce(e,jlt(t),n,{formattingOptions:yqi});return SCe(e,r)},Aqi=(e,t)=>{let n=e;for(let r of t){if(!wyn(n)||!Object.hasOwn(n,r))return!1;n=n[r]}return!0},S3=class{constructor(t){this.settings={};this.warnings=[];this.store=t}drainWarnings(){let t=this.warnings;return this.warnings=[],t}getSettings(){return structuredClone(this.settings)}publish(t){let n=BT(t),{settings:r,warnings:i}=Tyn(n);this.warnings.push(...i),this.settings=r}reload(){let t=this.store.read();if(t===void 0||t.trim()===""){this.settings={};return}this.publish(t)}remove(t){let n={persisted:!1,effectiveChange:!1},r;return this.store.modify(i=>{if(i===void 0||i.trim()==="")return;let s=BT(i),o=i;for(let a of t.paths){let l=jlt(a);Aqi(s,l)&&(o=Zlt(o,l,void 0),s=BT(o))}if(o!==i)return r=o,o}),r!==void 0&&(this.publish(r),n={persisted:!0,effectiveChange:!0}),n}update(t){return this.updateAll([t])}updateAll(t){let n={persisted:!1,effectiveChange:!1},r;return this.store.modify(i=>{let s=i===void 0||i.trim()===""?"{}":i;BT(s);let o=t.reduce((a,l)=>{let u=jlt(l.path),c=Zlt(a,u,l.value),d=u.length===1?gqi.get(u[0]):void 0;return d&&typeof l.value=="string"&&Object.hasOwn(BT(a),d)&&(c=Zlt(c,d,l.value)),c},s);if(BT(o),o!==s)return r=o,o}),r!==void 0&&(this.publish(r),n={persisted:!0,effectiveChange:!0}),n}}});var zlt,voe,Ryn,Eqi,_qi,Sqi,vqi,x3,lIe=C(()=>{"use strict";en();v3();zlt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),voe=e=>Array.isArray(e)?e.map(voe):zlt(e)?Object.fromEntries(Object.entries(e).filter(([t])=>!GP.has(t)).map(([t,n])=>[t,voe(n)])):structuredClone(e),Ryn=(e,t,n=!1)=>{for(let[r,i]of Object.entries(t)){if(GP.has(r)||i===void 0)continue;let s=e[r];n&&r==="toolPermissions"&&Array.isArray(i)?e[r]=[...voe(i),...Array.isArray(s)?s:[]]:zlt(s)&&zlt(i)?e[r]={...s,...voe(i)}:e[r]=voe(i)}},Eqi="managed",_qi="global",Sqi="project",vqi="local",x3=class{constructor(t,n={},r={}){this.errors=[];this.locals=t,this.overrides=n,this.vfs=r}drainErrors(){let t=this.errors;return this.errors=[],t}getSettings(){return this.mergeLayers([_qi,Sqi,vqi,Eqi])}getGlobalSettings(){return this.locals.global.getSettings()}getManagedSettings(){return this.locals.managed.getSettings()}getLocalSettings(){return this.locals.local.getSettings()}getProjectSettings(){return this.locals.project.getSettings()}getVfsUserSettings(){return this.vfs.vfsUser?.getSettings()??{}}getVfsSpaceSettings(){return this.vfs.vfsSpace?.getSettings()??{}}getVfsOrgSettings(){return this.vfs.vfsOrg?.getSettings()??{}}mergeLayers(t){let n={},r=t.map(i=>this.locals[i].getSettings());for(let i of r)Ryn(n,i,!0);return Ryn(n,this.overrides),n}reload(){let t=[...Object.entries(this.locals),...Object.entries(this.vfs)];for(let[n,r]of t)if(r){try{r.reload()}catch(i){let s=i instanceof Error?i:new Error(String(i));tt.error("settings reload failed",{scope:n,error:s}),this.errors.push({scope:n,error:s})}for(let i of r.drainWarnings())this.errors.push({scope:n,error:new Error(i)})}}remove(t,n){return this.routeWrite(t,r=>r.remove(n))}update(t,n){return this.routeWrite(t,r=>r.update(n))}updateAll(t,n){return this.routeWrite(t,r=>r.updateAll(n))}routeWrite(t,n){if(t==="managed")throw new Error('Refusing to write read-only settings scope "managed"');let r=this.getSettings(),i=n(this.locals[t]);for(let a of this.locals[t].drainWarnings())this.errors.push({scope:t,error:new Error(a)});if(!i.persisted)return i;let s=this.getSettings(),o=JSON.stringify(r)!==JSON.stringify(s);return{persisted:i.persisted,effectiveChange:o}}}});var Xlt,qlt=C(()=>{"use strict";Brt();lIe();v3();Xlt=(e,t)=>{let n=i=>new S3(new d3(i)),r=new x3({managed:n(e.managedPath),global:n(e.globalPath),project:n(e.projectPath),local:n(e.localPath)},t,{vfsUser:e.vfsUserPath?n(e.vfsUserPath):void 0,vfsSpace:e.vfsSpacePath?n(e.vfsSpacePath):void 0,vfsOrg:e.vfsOrgPath?n(e.vfsOrgPath):void 0});return r.reload(),r}});var Klt,Jlt,Nyn,C3,cIe=C(()=>{"use strict";v3();Klt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Jlt=e=>{if(Array.isArray(e))return e.map(Jlt);if(!Klt(e))return structuredClone(e);let t={};for(let[n,r]of Object.entries(e))GP.has(n)||(t[n]=Jlt(r));return t},Nyn=(e,t)=>{let n=structuredClone(e);for(let r of Object.keys(t)){let i=t[r];if(i===void 0||GP.has(r))continue;let s=n[r],o=Jlt(i);Klt(s)&&Klt(o)?n[r]={...s,...o}:n[r]=o}return n},C3=class{constructor(t){this.errors=[];this.manager=t}get settings(){let t=this.manager.getSettings();return this.dynamicOverrides?Nyn(t,this.dynamicOverrides):t}update(t,n,r){if(this.dynamicOverrides=void 0,typeof n=="object"&&"path"in n)return this.manager.update(t,n);try{this.manager.update(t,{path:n,value:r})}catch(i){let s=i instanceof Error?i:new Error(String(i));this.errors.push({scope:t,error:s})}}updateAll(t,n){return this.dynamicOverrides=void 0,this.manager.updateAll(t,n)}remove(t,n){return this.dynamicOverrides=void 0,this.manager.remove(t,n)}removeForCompatibility(t,n){try{this.remove(t,n)}catch(r){let i=r instanceof Error?r:new Error(String(r));this.errors.push({scope:t,error:i})}}getSettings(){return structuredClone(this.settings)}getGlobalSettings(){return structuredClone(this.manager.getGlobalSettings())}getProjectSettings(){return structuredClone(this.manager.getProjectSettings())}getLocalSettings(){return structuredClone(this.manager.getLocalSettings())}getManagedSettings(){return structuredClone(this.manager.getManagedSettings())}getVfsUserSettings(){return structuredClone(this.manager.getVfsUserSettings())}getVfsSpaceSettings(){return structuredClone(this.manager.getVfsSpaceSettings())}getVfsOrgSettings(){return structuredClone(this.manager.getVfsOrgSettings())}reload(){this.manager.reload(),this.dynamicOverrides=void 0}applyOverrides(t){this.dynamicOverrides=Nyn(this.dynamicOverrides??{},t)}flush(){}drainErrors(){let t=[...this.manager.drainErrors(),...this.errors];return this.errors=[],t}getAutoUpdate(){return this.settings.autoUpdate??!0}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(t){this.update("global","lastChangelogVersion",t)}getSessionDir(){return this.settings.sessionDir}getWorktreeDir(){return this.settings.worktreeDir}getDefaultModel(){let{defaultModel:t,model:n}=this.settings;return t??n}setDefaultModel(t){this.update("global","defaultModel",t)}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(t){this.update("global","steeringMode",t)}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(t){this.update("global","followUpMode",t)}getTheme(){let t=this.settings.theme;return t==="default-dark"?"dark":t}setTheme(t){this.update("global","theme",t==="default-dark"?"dark":t)}getVerbose(){return this.settings.verbose===!0}setVerbose(t){if(this.getManagedSettings().verbose!==void 0)return;let n="global";this.getLocalSettings().verbose!==void 0?n="local":this.getProjectSettings().verbose!==void 0&&(n="project"),this.update(n,"verbose",t)}getUpdateTerminalTitle(){return this.settings.updateTerminalTitle!==!1}getNotificationMode(){return this.settings.notificationMode??"off"}getCollapseLongPastedText(){return this.settings.collapseLongPastedText!==!1}getNumPastedLinesToCollapse(){let t=this.settings.numPastedLinesToCollapse;return typeof t=="number"&&Number.isInteger(t)&&t>0?t:10}getNumPastedCharsToCollapse(){let t=this.settings.numPastedCharsToCollapse;return typeof t=="number"&&Number.isInteger(t)&&t>0?t:1e3}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(t){this.update("global","defaultThinkingLevel",t)}getTransport(){return this.settings.transport??"sse"}setTransport(t){this.update("global","transport",t)}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(t){this.update("global","compaction.enabled",t)}getCompactionReserveTokens(){return this.settings.compaction?.reserveTokens??16384}getCompactionProtectedHeadTokens(){return this.settings.compaction?.protectedHeadTokens??2e4}getCompactionKeepRecentTokens(){return this.settings.compaction?.keepRecentTokens??2e4}getCompactionSummarizationModel(){return this.settings.compaction?.summarizationModel}getCompactionSettings(){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(),protectedHeadTokens:this.getCompactionProtectedHeadTokens(),keepRecentTokens:this.getCompactionKeepRecentTokens(),summarizationModel:this.getCompactionSummarizationModel(),useReserveTrigger:this.settings.compaction?.useReserveTrigger??!1,inputBudgetTriggerRatio:this.settings.compaction?.inputBudgetTriggerRatio,fallbackInputBudgetRatio:this.settings.compaction?.fallbackInputBudgetRatio,maxMessageTokens:this.settings.compaction?.maxMessageTokens}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(t){this.update("global","retry.enabled",t)}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??3,baseDelayMs:this.settings.retry?.baseDelayMs??2e3,maxDelayMs:this.settings.retry?.maxDelayMs??6e4}}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!1}setHideThinkingBlock(t){this.update("global","hideThinkingBlock",t)}getCollapsePromptCommands(){return this.settings.collapsePromptCommands??!1}setCollapsePromptCommands(t){this.update("global","collapsePromptCommands",t)}getShellPath(){let{shellPath:t,shell:n}=this.settings;return t??n}setShellPath(t){this.update("global","shellPath",t)}getQuietStartup(){return this.settings.quietStartup??!1}setQuietStartup(t){this.update("global","quietStartup",t)}getShellCommandPrefix(){let{shellCommandPrefix:t,startupScript:n}=this.settings;return t??n}setShellCommandPrefix(t){this.update("global","shellCommandPrefix",t)}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(t){this.update("global","npmCommand",t?[...t]:void 0)}getCollapseChangelog(){return this.settings.collapseChangelog??!1}setCollapseChangelog(t){this.update("global","collapseChangelog",t)}getPackages(){return[...this.settings.packages??[]]}setPackages(t){this.update("global","packages",t)}setProjectPackages(t){this.update("project","packages",t)}setLocalPackages(t){this.update("local","packages",t)}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(t){this.update("global","extensions",t)}setProjectExtensionPaths(t){this.update("project","extensions",t)}setLocalExtensionPaths(t){this.update("local","extensions",t)}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(t){this.update("global","skills",t)}setProjectSkillPaths(t){this.update("project","skills",t)}setLocalSkillPaths(t){this.update("local","skills",t)}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(t){this.update("global","prompts",t)}setProjectPromptTemplatePaths(t){this.update("project","prompts",t)}setLocalPromptTemplatePaths(t){this.update("local","prompts",t)}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(t){this.update("global","themes",t)}setProjectThemePaths(t){this.update("project","themes",t)}setLocalThemePaths(t){this.update("local","themes",t)}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(t){this.update("global","enableSkillCommands",t)}getEnableHashline(){return this.settings.enableHashline??!1}setEnableHashline(t){this.update("global","enableHashline",t)}getEnabledPlugins(){let t={};for(let[n,r]of Object.entries(this.settings.enabledPlugins??{}))typeof r=="boolean"&&(t[n]=r);return t}getToolPermissions(){let t=this.settings.toolPermissions;return Array.isArray(t)?structuredClone(t):[]}getToolPermissionSources(){let t=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()];return["managed","local","project","global"].map((n,r)=>({source:n,rules:structuredClone(t[r]?.toolPermissions??[])}))}getToolPermissionScopeRuleSets(){let t=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=[];for(let r of t){let i=r.toolPermissions;Array.isArray(i)&&i.length>0&&n.push(structuredClone(i))}return n}setPluginEnabled(t,n){this.update("global",["enabledPlugins",t],n)}getToolSearchEnabled(){let t=this.settings;return t.toolSearchEnabled??(t.enableToolSearch===!0?!0:void 0)}setToolSearchEnabled(t){t===void 0?this.removeForCompatibility("global",{paths:["toolSearchEnabled","enableToolSearch"]}):this.update("global","toolSearchEnabled",t)}getThinkingBudgets(){return this.settings.thinkingBudgets}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(t){this.update("global","terminal.showImages",t)}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(t){this.update("global","terminal.clearOnShrink",t)}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(t){this.update("global","images.autoResize",t)}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(t){this.update("global","images.blockImages",t)}getEnabledModels(){return this.settings.enabledModels?[...this.settings.enabledModels]:void 0}setEnabledModels(t){this.update("global","enabledModels",t)}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(t){this.update("global","doubleEscapeAction",t)}getTreeFilterMode(){let t=this.settings.treeFilterMode;return t&&["default","no-tools","user-only","labeled-only","all"].includes(t)?t:"default"}setTreeFilterMode(t){this.update("global","treeFilterMode",t)}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(t){this.update("global","showHardwareCursor",t)}getEditorPaddingX(){return this.settings.editorPaddingX??0}setEditorPaddingX(t){this.update("global","editorPaddingX",Math.max(0,Math.min(3,Math.floor(t))))}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(t){this.update("global","autocompleteMaxVisible",Math.max(3,Math.min(20,Math.floor(t))))}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getHooks(){return this.settings.hooks}getTelemetrySettings(){return this.settings.telemetry}getEnvInjection(){let t=this.settings.env;if(!t||typeof t!="object")return{};let n={};for(let[r,i]of Object.entries(t))typeof i=="string"&&(n[r]=i);return n}getFeatureFlagOverrides(){return this.settings.featureFlagOverrides}getIndexingDirsUnion(){let t=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=r=>{let i=new Set,s=[];for(let o of t){let a=o[r];if(Array.isArray(a))for(let l of a)typeof l!="string"||i.has(l)||(i.add(l),s.push(l))}return s};return{allowDirs:n("indexingAllowDirs"),denyDirs:n("indexingDenyDirs")}}getRemovedToolsUnion(){let t=[this.settings,this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=new Set,r=[];for(let i of t){let s=i.removedTools;if(Array.isArray(s))for(let o of s)typeof o!="string"||n.has(o)||(n.add(o),r.push(o))}return r}}});var ect,tct=C(()=>{"use strict";qlt();cIe();ect=(e,t)=>new C3(Xlt(e,t))});var xoe,nct=C(()=>{"use strict";xoe=class{constructor(t){this.content=t}read(){return this.content}modify(t){let n=t(this.content);n!==void 0&&(this.content=n)}}});import{homedir as kyn}from"node:os";import{join as T3}from"node:path";var xqi,Cqi,rct,Coe,gi,Oyn=C(()=>{"use strict";nct();lIe();v3();tct();cIe();xqi="AUGGIE_CODING_AGENT_DIR",Cqi=()=>{let e=process.env[`${xqi}_MANAGED`];if(e)return e==="~"?T3(kyn(),"settings.json"):e.startsWith("~/")?kyn()+e.slice(1):e;if(process.platform==="win32"){let t=process.env.ProgramData||"C:\\ProgramData";return T3(t,"augment","settings.json")}return T3("/etc","augment","settings.json")},rct=e=>e?T3(e,".augment","settings.json"):void 0,Coe=(e,t,n)=>({globalPath:T3(t,"settings.json"),projectPath:T3(e,".augment","settings.json"),localPath:T3(e,".augment","settings.local.json"),managedPath:Cqi(),vfsUserPath:rct(n?.user),vfsSpacePath:rct(n?.space),vfsOrgPath:rct(n?.org)}),gi={create(e,t,n){return ect(Coe(e,t,n))},inMemory(e={}){let t=r=>new S3(new xoe(r===void 0?void 0:JSON.stringify(r))),n=new x3({managed:t(),local:t(),project:t(),global:t(e)});return n.reload(),new C3(n)}}});import{createHash as Tqi}from"node:crypto";import{statSync as Myn}from"node:fs";var Dyn,Iqi,ict,wqi,Rqi,aY,Byn,sct,Lyn,oct,Nqi,Fyn,Pyn,kqi,act,Uyn=C(()=>{"use strict";Wrt();Brt();v3();Dyn=new WeakMap,Iqi="Duplicate permission keys; editing disabled. Repair duplicate keys in the settings file, then reopen /permissions.",ict=(e,t)=>{let n=new Set;for(let r of e?.type==="object"?e.children??[]:[]){let i=r.children?.[0]?.value;if(t.includes(i)){if(n.has(i))return!0;n.add(i)}}return!1},wqi=e=>ict(e,["toolName","permission","eventType","shellInputRegex"])?!0:e.type!=="object"?!1:(e.children??[]).some(t=>t.children?.[0]?.value==="permission"&&ict(t.children?.[1],["type","script","webhookUrl"])),Rqi=e=>{let t=vfn(e);if(ict(t,["toolPermissions"]))return!0;for(let n of t?.children??[]){if(n.children?.[0]?.value!=="toolPermissions")continue;let r=n.children?.[1];if(r?.type==="array"&&(r.children??[]).some(wqi))return!0}return!1},aY=e=>Tqi("sha256").update(JSON.stringify(e)??"undefined").digest("hex"),Byn=e=>aY(e),sct=e=>e===void 0||e.trim()===""?"{}":e,Lyn=e=>{let t=BT(sct(e));if(t.toolPermissions===void 0)return[];if(!Array.isArray(t.toolPermissions))throw new Error("toolPermissions must be an array.");return t.toolPermissions},oct=e=>{let t=new d3(e).read(),n={revision:Byn(t),entries:Lyn(t)};return Rqi(sct(t))&&(n.editingDisabledReason=Iqi),Dyn.set(n,{path:RP(e),revision:n.revision,editingDisabledReason:n.editingDisabledReason}),n},Nqi=(e,t)=>{if(RP(e)===RP(t))return!0;try{let n=Myn(e),r=Myn(t);return n.dev===r.dev&&n.ino===r.ino}catch(n){if(typeof n=="object"&&n!==null&&"code"in n&&n.code==="ENOENT")return!1;throw n}},Fyn=(e,t,n,r=!1)=>SCe(e,_Ce(e,t,n,{isArrayInsertion:r,formattingOptions:{insertSpaces:!0,tabSize:2}})),Pyn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),kqi=e=>{let{content:t,entry:n,mutation:r,validate:i}=e;if(!Pyn(n)||!Pyn(n.permission))throw new Error("Permission rule is invalid.");let s=n.permission,o={...s,...r.permission};s.type==="webhook-policy"&&o.type!=="webhook-policy"&&(o.webhookUrl=void 0),s.type==="script-policy"&&o.type!=="script-policy"&&(o.script=void 0),i({...n,permission:o});let a=t;for(let l of["type","webhookUrl","script"])o[l]!==s[l]&&(a=Fyn(a,["toolPermissions",r.index,"permission",l],o[l]));return a},act=e=>{let{paths:t,source:n,document:r,mutation:i,validate:s}=e;if(n!=="global"&&n!=="project"&&n!=="local")throw new Error("Permission source is read-only.");let o=t[`${n}Path`],a=()=>{for(let c of[t.managedPath,t.vfsUserPath,t.vfsSpacePath,t.vfsOrgPath])if(c&&Nqi(o,c))throw new Error("Permission target aliases a read-only source.")};a();let l=RP(o),u=Dyn.get(r);if(!u||u.path!==l||u.revision!==r.revision)throw new Error("Permission source was not inspected. Reopen the manager.");if(u.editingDisabledReason)throw new Error(u.editingDisabledReason);new d3(l).modify(c=>{if(a(),RP(o)!==l)throw new Error("Permission target changed. Reopen the manager.");if(Byn(c)!==u.revision)throw new Error("Permission settings changed. Reopen the manager before saving.");let d=Lyn(c),p=sct(c),m=h=>(BT(h),h),f=Fyn;if(i.kind==="add")return s(i.rule),BT(p).toolPermissions===void 0?m(f(p,["toolPermissions"],[i.rule])):m(f(p,["toolPermissions",d.length],i.rule,!0));if(!Number.isInteger(i.index)||i.index<0||i.index>=d.length||aY(d[i.index])!==i.fingerprint)throw new Error("Permission rule changed. Reopen the manager before saving.");return i.kind==="remove"?m(f(p,["toolPermissions",i.index],void 0)):m(kqi({content:p,entry:d[i.index],mutation:i,validate:s}))})}});function bd(e){return Vyn.get(e)??[e]}function _A(e){return Gyn.get(e)??[e]}var Oqi,Vyn,Gyn,Wyn=C(()=>{"use strict";Oqi=[{current:["read"],legacy:["view"]},{current:["write"],legacy:["save-file","save_file"]},{current:["edit"],legacy:["str-replace-editor","str_replace_editor"]},{current:["grep"],legacy:["grep-search"]},{current:["bash","terminal"],legacy:["launch-process","shell"]}],Vyn=new Map,Gyn=new Map;for(let{current:e,legacy:t}of Oqi){let n=[...e,...t];for(let r of n)Vyn.set(r,n);for(let r of t)Gyn.set(r,e)}});var Ol=C(()=>{"use strict";tct();cIe();Oyn();qlt();nct();Uyn();lIe();v3();Wyn()});import{resolve as WP}from"node:path";function Qyn(e){return vse(e)??WP(e)}function dIe(e,t){return gi.create(t??e,e)}function lY({agentDir:e,workspacePath:t}){let n=dIe(e,t),{allowDirs:r,denyDirs:i}=n.getIndexingDirsUnion(),s={};for(let o of r)s[WP(o)]="allow";for(let o of i)s[WP(o)]="deny";return s}function Hyn({agentDir:e,workspacePath:t}){let n=lct({agentDir:e,workspacePath:t});if(n==="allowed")return"allow";if(n==="deny"||n==="never")return"deny"}function lct({agentDir:e,workspacePath:t}){let n=dIe(e,t),{allowDirs:r,denyDirs:i}=n.getIndexingDirsUnion();return Art([...r],[...i],t)}async function cct({agentDir:e,workspacePath:t,permission:n}){await Promise.resolve();let r=Qyn(t),i=dIe(e,t),s=i.getGlobalSettings(),o=Array.isArray(s.indexingAllowDirs)?[...s.indexingAllowDirs]:[],a=Array.isArray(s.indexingDenyDirs)?[...s.indexingDenyDirs]:[];if(n==="allow"){let l=a.filter(d=>WP(d)!==r),u=o.filter(d=>WP(d)!==r);u.push(r);let c=[{path:"indexingAllowDirs",value:u}];l.length!==a.length&&c.push({path:"indexingDenyDirs",value:l}),i.updateAll("global",c)}else{let l=o.filter(d=>WP(d)!==r),u=a.filter(d=>WP(d)!==r);u.push(r);let c=[{path:"indexingDenyDirs",value:u}];l.length!==o.length&&c.push({path:"indexingAllowDirs",value:l}),i.updateAll("global",c)}$yn.debug(`Saved indexing permission for ${r}: ${n}`)}async function pIe({agentDir:e,workspacePaths:t}){await Promise.resolve();let n=dIe(e,t[0]),{allowDirs:r,denyDirs:i}=n.getIndexingDirsUnion(),s=n.getGlobalSettings(),o=Array.isArray(s.indexingAllowDirs)?[...s.indexingAllowDirs]:[],a=Array.isArray(s.indexingDenyDirs)?[...s.indexingDenyDirs]:[],l=!1;for(let u of t)if(Art([...r,...o],[...i,...a],u)==="none"){let d=Qyn(u);o.some(p=>WP(p)===d)||(o.push(d),l=!0)}l&&(n.update("global",{path:"indexingAllowDirs",value:o}),$yn.debug(`Allowed unruled workspaces in settings.json: ${t.join(", ")}`))}var $yn,uIe,cY=C(()=>{"use strict";en();Ol();brt();Cse();$yn=tt.child({prefix:"pi-indexer-perms"}),uIe="settings.json"});function Yyn({requestedWorkspace:e,primaryWorkspace:t,additionalWorkspaces:n}){let r=e??t.workspace,i=[t,...n],s=i.find(a=>a.workspace===r);if(s)return{ok:!0,workspace:s};let o=i.map(a=>` - ${a.workspace}`).join(`
215
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let a=o[1];if(t===o[0]){s(o);continue}if(e.external){let u=e.external.registry.get(o[0])?.id;if(t!==o[0]&&u){s(o);continue}}if(e.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}if(a.count>1&&e.reused==="ref"){s(o);continue}}}function UP(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let l=e.seen.get(a);if(l.ref===null)return;let u=l.def??l.schema,c={...u},d=l.ref;if(l.ref=null,d){r(d);let m=e.seen.get(d),f=m.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,c),a._zod.parent===d)for(let g in u)g==="$ref"||g==="allOf"||g in c||delete u[g];if(f.$ref&&m.def)for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}let p=a._zod.parent;if(p&&p!==d){r(p);let m=e.seen.get(p);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let f in u)f==="$ref"||f==="allOf"||f in m.def&&JSON.stringify(u[f])===JSON.stringify(m.def[f])&&delete u[f]}e.override({zodSchema:a,jsonSchema:u,path:l.path??[]})};for(let a of[...e.seen.entries()].reverse())r(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&i.id===s&&delete i.id;let o=e.external?.defs??{};for(let a of e.seen.entries()){let l=a[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,o[l.defId]=l.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:KH(t,"input",e.processors),output:KH(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Jg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Jg(r.element,n);if(r.type==="set")return Jg(r.valueType,n);if(r.type==="lazy")return Jg(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Jg(r.innerType,n);if(r.type==="intersection")return Jg(r.left,n)||Jg(r.right,n);if(r.type==="record"||r.type==="map")return Jg(r.keyType,n)||Jg(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Jg(r.in,n)||Jg(r.out,n);if(r.type==="object"){for(let i in r.shape)if(Jg(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(let i of r.options)if(Jg(i,n))return!0;return!1}if(r.type==="tuple"){for(let i of r.items)if(Jg(i,n))return!0;return!!(r.rest&&Jg(r.rest,n))}return!1}var nat,KH,roe=C(()=>{eoe();nat=(e,t={})=>n=>{let r=LP({...n,processors:t});return gl(e,r),FP(r,e),UP(r,e)},KH=(e,t,n={})=>r=>{let{libraryOptions:i,target:s}=r??{},o=LP({...i??{},target:s,io:t,processors:n});return gl(e,o),FP(o,e),UP(o,e)}});function wTe(e,t){if("_idmap"in e){let r=e,i=LP({...t,processors:CTe}),s={};for(let l of r._idmap.entries()){let[u,c]=l;gl(c,i)}let o={},a={registry:r,uri:t?.uri,defs:s};i.external=a;for(let l of r._idmap.entries()){let[u,c]=l;FP(i,c),o[u]=UP(i,c)}if(Object.keys(s).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[l]:s}}return{schemas:o}}let n=LP({...t,processors:CTe});return gl(e,n),FP(n,e),UP(n,e)}var XXi,rat,iat,sat,oat,aat,lat,cat,uat,dat,pat,mat,fat,hat,gat,bat,yat,Aat,Eat,_at,Sat,vat,xat,Cat,Tat,Iat,TTe,wat,Rat,Nat,kat,Oat,Mat,Pat,Dat,Bat,Lat,Fat,ITe,Uat,CTe,ioe=C(()=>{roe();ni();XXi={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rat=(e,t,n,r)=>{let i=n;i.type="string";let{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=XXi[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),l&&l.size>0){let c=[...l];c.length===1?i.pattern=c[0].source:c.length>1&&(i.allOf=[...c.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},iat=(e,t,n,r)=>{let i=n,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:c}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";let d=typeof c=="number"&&c>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(o??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";d?m?(i.minimum=c,i.exclusiveMinimum=!0):i.exclusiveMinimum=c:typeof s=="number"&&(i.minimum=s),p?m?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u:typeof o=="number"&&(i.maximum=o),typeof l=="number"&&(i.multipleOf=l)},sat=(e,t,n,r)=>{n.type="boolean"},oat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},aat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},lat=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},cat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},uat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},dat=(e,t,n,r)=>{n.not={}},pat=(e,t,n,r)=>{},mat=(e,t,n,r)=>{},fat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},hat=(e,t,n,r)=>{let i=e._zod.def,s=Bse(i.entries);s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),n.enum=s},gat=(e,t,n,r)=>{let i=e._zod.def,s=[];for(let o of i.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){let o=s[0];n.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[o]:n.const=o}else s.every(o=>typeof o=="number")&&(n.type="number"),s.every(o=>typeof o=="string")&&(n.type="string"),s.every(o=>typeof o=="boolean")&&(n.type="boolean"),s.every(o=>o===null)&&(n.type="null"),n.enum=s},bat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},yat=(e,t,n,r)=>{let i=n,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=s.source},Aat=(e,t,n,r)=>{let i=n,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:a,mime:l}=e._zod.bag;o!==void 0&&(s.minLength=o),a!==void 0&&(s.maxLength=a),l?l.length===1?(s.contentMediaType=l[0],Object.assign(i,s)):(Object.assign(i,s),i.anyOf=l.map(u=>({contentMediaType:u}))):Object.assign(i,s)},Eat=(e,t,n,r)=>{n.type="boolean"},_at=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Sat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},vat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},xat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Cat=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Tat=(e,t,n,r)=>{let i=n,s=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=gl(s.element,t,{...r,path:[...r.path,"items"]})},Iat=(e,t,n,r)=>{let i=n,s=e._zod.def;i.type="object",i.properties={};let o=s.shape;for(let u in o)i.properties[u]=gl(o[u],t,{...r,path:[...r.path,"properties",u]});let a=new Set(Object.keys(o)),l=new Set([...a].filter(u=>{let c=s.shape[u]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));l.size>0&&(i.required=Array.from(l)),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=gl(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},TTe=(e,t,n,r)=>{let i=e._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>gl(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?n.oneOf=o:n.anyOf=o},wat=(e,t,n,r)=>{let i=e._zod.def,s=gl(i.left,t,{...r,path:[...r.path,"allOf",0]}),o=gl(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];n.allOf=l},Rat=(e,t,n,r)=>{let i=n,s=e._zod.def;i.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((p,m)=>gl(p,t,{...r,path:[...r.path,o,m]})),u=s.rest?gl(s.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=l,u&&(i.items=u)):t.target==="openapi-3.0"?(i.items={anyOf:l},u&&i.items.anyOf.push(u),i.minItems=l.length,u||(i.maxItems=l.length)):(i.items=l,u&&(i.additionalItems=u));let{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(i.minItems=c),typeof d=="number"&&(i.maxItems=d)},Nat=(e,t,n,r)=>{let i=n,s=e._zod.def;i.type="object";let o=s.keyType,l=o._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){let c=gl(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(let d of l)i.patternProperties[d.source]=c}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=gl(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=gl(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let u=o._zod.values;if(u){let c=[...u].filter(d=>typeof d=="string"||typeof d=="number");c.length>0&&(i.required=c)}},kat=(e,t,n,r)=>{let i=e._zod.def,s=gl(i.innerType,t,r),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Oat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType},Mat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Pat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Dat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},Bat=(e,t,n,r)=>{let i=e._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?s?i.out:i.in:i.out;gl(o,t,r);let a=t.seen.get(e);a.ref=o},Lat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType,n.readOnly=!0},Fat=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType},ITe=(e,t,n,r)=>{let i=e._zod.def;gl(i.innerType,t,r);let s=t.seen.get(e);s.ref=i.innerType},Uat=(e,t,n,r)=>{let i=e._zod.innerType;gl(i,t,r);let s=t.seen.get(e);s.ref=i},CTe={string:rat,number:iat,boolean:sat,bigint:oat,symbol:aat,null:lat,undefined:cat,void:uat,never:dat,any:pat,unknown:mat,date:fat,enum:hat,literal:gat,nan:bat,template_literal:yat,file:Aat,success:Eat,custom:_at,function:Sat,transform:vat,map:xat,set:Cat,array:Tat,object:Iat,union:TTe,intersection:wat,tuple:Rat,record:Nat,nullable:kat,nonoptional:Oat,default:Mat,prefault:Pat,catch:Dat,pipe:Bat,readonly:Lat,promise:Fat,optional:ITe,lazy:Uat}});var RTe,lbn=C(()=>{ioe();roe();RTe=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=LP({processors:CTe,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return gl(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),FP(this.ctx,t);let r=UP(this.ctx,t),{"~standard":i,...s}=r;return s}}});var cbn={};var ubn=C(()=>{});var PT={};li(PT,{$ZodAny:()=>Mst,$ZodArray:()=>Fst,$ZodAsyncError:()=>xv,$ZodBase64:()=>vst,$ZodBase64URL:()=>xst,$ZodBigInt:()=>QCe,$ZodBigIntFormat:()=>Rst,$ZodBoolean:()=>Xse,$ZodCIDRv4:()=>Est,$ZodCIDRv6:()=>_st,$ZodCUID:()=>lst,$ZodCUID2:()=>cst,$ZodCatch:()=>not,$ZodCheck:()=>gc,$ZodCheckBigIntFormat:()=>Bit,$ZodCheckEndsWith:()=>jit,$ZodCheckGreaterThan:()=>LCe,$ZodCheckIncludes:()=>Yit,$ZodCheckLengthEquals:()=>Wit,$ZodCheckLessThan:()=>BCe,$ZodCheckLowerCase:()=>Qit,$ZodCheckMaxLength:()=>Vit,$ZodCheckMaxSize:()=>Lit,$ZodCheckMimeType:()=>Xit,$ZodCheckMinLength:()=>Git,$ZodCheckMinSize:()=>Fit,$ZodCheckMultipleOf:()=>Pit,$ZodCheckNumberFormat:()=>Dit,$ZodCheckOverwrite:()=>qit,$ZodCheckProperty:()=>zit,$ZodCheckRegex:()=>$it,$ZodCheckSizeEquals:()=>Uit,$ZodCheckStartsWith:()=>Zit,$ZodCheckStringFormat:()=>BH,$ZodCheckUpperCase:()=>Hit,$ZodCodec:()=>Kse,$ZodCustom:()=>uot,$ZodCustomStringFormat:()=>Ist,$ZodDate:()=>Lst,$ZodDefault:()=>Kst,$ZodDiscriminatedUnion:()=>Gst,$ZodE164:()=>Cst,$ZodEmail:()=>ist,$ZodEmoji:()=>ost,$ZodEncodeError:()=>NP,$ZodEnum:()=>Yst,$ZodError:()=>Gse,$ZodExactOptional:()=>Xst,$ZodFile:()=>jst,$ZodFunction:()=>aot,$ZodGUID:()=>nst,$ZodIPv4:()=>bst,$ZodIPv6:()=>yst,$ZodISODate:()=>fst,$ZodISODateTime:()=>mst,$ZodISODuration:()=>gst,$ZodISOTime:()=>hst,$ZodIntersection:()=>Wst,$ZodJWT:()=>Tst,$ZodKSUID:()=>pst,$ZodLazy:()=>cot,$ZodLiteral:()=>Zst,$ZodMAC:()=>Ast,$ZodMap:()=>Qst,$ZodNaN:()=>rot,$ZodNanoID:()=>ast,$ZodNever:()=>Dst,$ZodNonOptional:()=>eot,$ZodNull:()=>Ost,$ZodNullable:()=>qst,$ZodNumber:()=>$Ce,$ZodNumberFormat:()=>wst,$ZodObject:()=>uhn,$ZodObjectJIT:()=>Ust,$ZodOptional:()=>YCe,$ZodPipe:()=>ZCe,$ZodPrefault:()=>Jst,$ZodPreprocess:()=>iot,$ZodPromise:()=>lot,$ZodReadonly:()=>sot,$ZodRealError:()=>Wy,$ZodRecord:()=>$st,$ZodRegistry:()=>KCe,$ZodSet:()=>Hst,$ZodString:()=>b3,$ZodStringFormat:()=>jl,$ZodSuccess:()=>tot,$ZodSymbol:()=>Nst,$ZodTemplateLiteral:()=>oot,$ZodTransform:()=>zst,$ZodTuple:()=>HCe,$ZodType:()=>fs,$ZodULID:()=>ust,$ZodURL:()=>sst,$ZodUUID:()=>rst,$ZodUndefined:()=>kst,$ZodUnion:()=>qse,$ZodUnknown:()=>Pst,$ZodVoid:()=>Bst,$ZodXID:()=>dst,$ZodXor:()=>Vst,$brand:()=>$rt,$constructor:()=>Ut,$input:()=>got,$output:()=>hot,Doc:()=>zse,JSONSchema:()=>cbn,JSONSchemaGenerator:()=>RTe,NEVER:()=>Pse,TimePrecision:()=>Eot,_any:()=>Got,_array:()=>jot,_base64:()=>gTe,_base64url:()=>bTe,_bigint:()=>Pot,_boolean:()=>Oot,_catch:()=>QXi,_check:()=>obn,_cidrv4:()=>fTe,_cidrv6:()=>hTe,_coercedBigint:()=>Dot,_coercedBoolean:()=>Mot,_coercedDate:()=>Yot,_coercedNumber:()=>Tot,_coercedString:()=>yot,_cuid:()=>aTe,_cuid2:()=>lTe,_custom:()=>Xot,_date:()=>Hot,_decode:()=>TCe,_decodeAsync:()=>wCe,_default:()=>GXi,_discriminatedUnion:()=>RXi,_e164:()=>yTe,_email:()=>eTe,_emoji:()=>sTe,_encode:()=>CCe,_encodeAsync:()=>ICe,_endsWith:()=>QH,_enum:()=>DXi,_file:()=>zot,_float32:()=>wot,_float64:()=>Rot,_gt:()=>OT,_gte:()=>Kg,_guid:()=>toe,_includes:()=>WH,_int:()=>Iot,_int32:()=>Not,_int64:()=>Bot,_intersection:()=>NXi,_ipv4:()=>pTe,_ipv6:()=>mTe,_isoDate:()=>Sot,_isoDateTime:()=>_ot,_isoDuration:()=>xot,_isoTime:()=>vot,_jwt:()=>ATe,_ksuid:()=>dTe,_lazy:()=>jXi,_length:()=>E3,_literal:()=>LXi,_lowercase:()=>VH,_lt:()=>kT,_lte:()=>EA,_mac:()=>Aot,_map:()=>MXi,_max:()=>EA,_maxLength:()=>A3,_maxSize:()=>BP,_mime:()=>HH,_min:()=>Kg,_minLength:()=>VN,_minSize:()=>MT,_multipleOf:()=>DP,_nan:()=>Zot,_nanoid:()=>oTe,_nativeEnum:()=>BXi,_negative:()=>_Te,_never:()=>$ot,_nonnegative:()=>vTe,_nonoptional:()=>WXi,_nonpositive:()=>STe,_normalize:()=>YH,_null:()=>Vot,_nullable:()=>VXi,_number:()=>Cot,_optional:()=>UXi,_overwrite:()=>Cv,_parse:()=>kH,_parseAsync:()=>OH,_pipe:()=>HXi,_positive:()=>ETe,_promise:()=>zXi,_property:()=>xTe,_readonly:()=>YXi,_record:()=>OXi,_refine:()=>qot,_regex:()=>UH,_safeDecode:()=>NCe,_safeDecodeAsync:()=>OCe,_safeEncode:()=>RCe,_safeEncodeAsync:()=>kCe,_safeParse:()=>MH,_safeParseAsync:()=>DH,_set:()=>PXi,_size:()=>y3,_slugify:()=>XH,_startsWith:()=>$H,_string:()=>bot,_stringFormat:()=>qH,_stringbool:()=>tat,_success:()=>$Xi,_superRefine:()=>Kot,_symbol:()=>Fot,_templateLiteral:()=>ZXi,_toLowerCase:()=>jH,_toUpperCase:()=>zH,_transform:()=>FXi,_trim:()=>ZH,_tuple:()=>kXi,_uint32:()=>kot,_uint64:()=>Lot,_ulid:()=>cTe,_undefined:()=>Uot,_union:()=>IXi,_unknown:()=>Wot,_uppercase:()=>GH,_url:()=>noe,_uuid:()=>tTe,_uuidv4:()=>nTe,_uuidv6:()=>rTe,_uuidv7:()=>iTe,_void:()=>Qot,_xid:()=>uTe,_xor:()=>wXi,clone:()=>Xg,config:()=>gd,createStandardJSONSchemaMethod:()=>KH,createToJSONSchemaMethod:()=>nat,decode:()=>Mfn,decodeAsync:()=>Dfn,describe:()=>Jot,encode:()=>Ofn,encodeAsync:()=>Pfn,extractDefs:()=>FP,finalize:()=>UP,flattenError:()=>Wse,formatError:()=>$se,globalConfig:()=>m3,globalRegistry:()=>$f,initializeContext:()=>LP,isValidBase64:()=>Sst,isValidBase64URL:()=>ohn,isValidJWT:()=>ahn,locales:()=>FH,meta:()=>eat,parse:()=>Qse,parseAsync:()=>Hse,prettifyError:()=>nit,process:()=>gl,regexes:()=>AA,registry:()=>JCe,safeDecode:()=>Lfn,safeDecodeAsync:()=>Ufn,safeEncode:()=>Bfn,safeEncodeAsync:()=>Ffn,safeParse:()=>PH,safeParseAsync:()=>Yse,toDotPath:()=>kfn,toJSONSchema:()=>wTe,treeifyError:()=>tit,util:()=>Dn,version:()=>Jit});var eb=C(()=>{f3();iit();rit();dot();FCe();est();ni();DCe();qCe();eoe();Kit();abn();roe();ioe();lbn();ubn()});var NTe={};li(NTe,{endsWith:()=>QH,gt:()=>OT,gte:()=>Kg,includes:()=>WH,length:()=>E3,lowercase:()=>VH,lt:()=>kT,lte:()=>EA,maxLength:()=>A3,maxSize:()=>BP,mime:()=>HH,minLength:()=>VN,minSize:()=>MT,multipleOf:()=>DP,negative:()=>_Te,nonnegative:()=>vTe,nonpositive:()=>STe,normalize:()=>YH,overwrite:()=>Cv,positive:()=>ETe,property:()=>xTe,regex:()=>UH,size:()=>y3,slugify:()=>XH,startsWith:()=>$H,toLowerCase:()=>jH,toUpperCase:()=>zH,trim:()=>ZH,uppercase:()=>GH});var kTe=C(()=>{eb()});var VP={};li(VP,{ZodISODate:()=>MTe,ZodISODateTime:()=>OTe,ZodISODuration:()=>DTe,ZodISOTime:()=>PTe,date:()=>Gat,datetime:()=>Vat,duration:()=>$at,time:()=>Wat});function Vat(e){return _ot(OTe,e)}function Gat(e){return Sot(MTe,e)}function Wat(e){return vot(PTe,e)}function $at(e){return xot(DTe,e)}var OTe,MTe,PTe,DTe,soe=C(()=>{eb();aoe();OTe=Ut("ZodISODateTime",(e,t)=>{mst.init(e,t),zl.init(e,t)});MTe=Ut("ZodISODate",(e,t)=>{fst.init(e,t),zl.init(e,t)});PTe=Ut("ZodISOTime",(e,t)=>{hst.init(e,t),zl.init(e,t)});DTe=Ut("ZodISODuration",(e,t)=>{gst.init(e,t),zl.init(e,t)})});var dbn,Op,$y,Qat=C(()=>{eb();eb();ni();dbn=(e,t)=>{Gse.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>$se(e,n)},flatten:{value:n=>Wse(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,wH,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,wH,2)}},isEmpty:{get(){return e.issues.length===0}}})},Op=Ut("ZodError",dbn),$y=Ut("ZodError",dbn,{Parent:Error})});var Hat,Yat,Zat,jat,zat,Xat,qat,Kat,Jat,elt,tlt,nlt,rlt=C(()=>{eb();Qat();Hat=kH($y),Yat=OH($y),Zat=MH($y),jat=DH($y),zat=CCe($y),Xat=TCe($y),qat=ICe($y),Kat=wCe($y),Jat=RCe($y),elt=NCe($y),tlt=kCe($y),nlt=OCe($y)});var ooe={};li(ooe,{ZodAny:()=>llt,ZodArray:()=>plt,ZodBase64:()=>XTe,ZodBase64URL:()=>qTe,ZodBigInt:()=>oY,ZodBigIntFormat:()=>eIe,ZodBoolean:()=>sY,ZodCIDRv4:()=>jTe,ZodCIDRv6:()=>zTe,ZodCUID:()=>GTe,ZodCUID2:()=>WTe,ZodCatch:()=>Olt,ZodCodec:()=>yoe,ZodCustom:()=>Aoe,ZodCustomStringFormat:()=>rY,ZodDate:()=>moe,ZodDefault:()=>Tlt,ZodDiscriminatedUnion:()=>flt,ZodE164:()=>KTe,ZodEmail:()=>FTe,ZodEmoji:()=>UTe,ZodEnum:()=>eY,ZodExactOptional:()=>vlt,ZodFile:()=>_lt,ZodFunction:()=>Wlt,ZodGUID:()=>loe,ZodIPv4:()=>YTe,ZodIPv6:()=>ZTe,ZodIntersection:()=>hlt,ZodJWT:()=>JTe,ZodKSUID:()=>HTe,ZodLazy:()=>Ult,ZodLiteral:()=>Elt,ZodMAC:()=>ilt,ZodMap:()=>ylt,ZodNaN:()=>Plt,ZodNanoID:()=>VTe,ZodNever:()=>ult,ZodNonOptional:()=>sIe,ZodNull:()=>alt,ZodNullable:()=>Clt,ZodNumber:()=>iY,ZodNumberFormat:()=>_3,ZodObject:()=>foe,ZodOptional:()=>iIe,ZodPipe:()=>boe,ZodPrefault:()=>wlt,ZodPreprocess:()=>Dlt,ZodPromise:()=>Glt,ZodReadonly:()=>Blt,ZodRecord:()=>JH,ZodSet:()=>Alt,ZodString:()=>tY,ZodStringFormat:()=>zl,ZodSuccess:()=>klt,ZodSymbol:()=>slt,ZodTemplateLiteral:()=>Flt,ZodTransform:()=>Slt,ZodTuple:()=>glt,ZodType:()=>Fs,ZodULID:()=>$Te,ZodURL:()=>doe,ZodUUID:()=>DT,ZodUndefined:()=>olt,ZodUnion:()=>hoe,ZodUnknown:()=>clt,ZodVoid:()=>dlt,ZodXID:()=>QTe,ZodXor:()=>mlt,_ZodString:()=>LTe,_default:()=>Ilt,_function:()=>myn,any:()=>tIe,array:()=>Nn,base64:()=>Obn,base64url:()=>Mbn,bigint:()=>Qbn,boolean:()=>Ji,catch:()=>Mlt,check:()=>fyn,cidrv4:()=>Nbn,cidrv6:()=>kbn,codec:()=>cyn,cuid:()=>Sbn,cuid2:()=>vbn,custom:()=>oIe,date:()=>Xbn,describe:()=>hyn,discriminatedUnion:()=>goe,e164:()=>Pbn,email:()=>mbn,emoji:()=>Ebn,enum:()=>Qf,exactOptional:()=>xlt,file:()=>syn,float32:()=>Vbn,float64:()=>Gbn,function:()=>myn,guid:()=>fbn,hash:()=>Ubn,hex:()=>Fbn,hostname:()=>Lbn,httpUrl:()=>Abn,instanceof:()=>byn,int:()=>tp,int32:()=>Wbn,int64:()=>Hbn,intersection:()=>Qy,invertCodec:()=>uyn,ipv4:()=>Ibn,ipv6:()=>Rbn,json:()=>Ayn,jwt:()=>Dbn,keyof:()=>qbn,ksuid:()=>Tbn,lazy:()=>Vlt,literal:()=>Mt,looseObject:()=>np,looseRecord:()=>tyn,mac:()=>wbn,map:()=>nyn,meta:()=>gyn,nan:()=>lyn,nanoid:()=>_bn,nativeEnum:()=>iyn,never:()=>nIe,nonoptional:()=>Nlt,null:()=>poe,nullable:()=>coe,nullish:()=>oyn,number:()=>Qr,object:()=>Je,optional:()=>bc,partialRecord:()=>eyn,pipe:()=>BTe,prefault:()=>Rlt,preprocess:()=>Eoe,promise:()=>pyn,readonly:()=>Llt,record:()=>vt,refine:()=>$lt,set:()=>ryn,strictObject:()=>Kbn,string:()=>Ae,stringFormat:()=>Bbn,stringbool:()=>yyn,success:()=>ayn,superRefine:()=>Qlt,symbol:()=>Zbn,templateLiteral:()=>dyn,transform:()=>rIe,tuple:()=>blt,uint32:()=>$bn,uint64:()=>Ybn,ulid:()=>xbn,undefined:()=>jbn,union:()=>ur,unknown:()=>Et,url:()=>nY,uuid:()=>hbn,uuidv4:()=>gbn,uuidv6:()=>bbn,uuidv7:()=>ybn,void:()=>zbn,xid:()=>Cbn,xor:()=>Jbn});function uoe(e,t,n){let r=Object.getPrototypeOf(e),i=pbn.get(r);if(i||(i=new Set,pbn.set(r,i)),!i.has(t)){i.add(t);for(let s in n){let o=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}function Ae(e){return bot(tY,e)}function mbn(e){return eTe(FTe,e)}function fbn(e){return toe(loe,e)}function hbn(e){return tTe(DT,e)}function gbn(e){return nTe(DT,e)}function bbn(e){return rTe(DT,e)}function ybn(e){return iTe(DT,e)}function nY(e){return noe(doe,e)}function Abn(e){return noe(doe,{protocol:AA.httpProtocol,hostname:AA.domain,...Dn.normalizeParams(e)})}function Ebn(e){return sTe(UTe,e)}function _bn(e){return oTe(VTe,e)}function Sbn(e){return aTe(GTe,e)}function vbn(e){return lTe(WTe,e)}function xbn(e){return cTe($Te,e)}function Cbn(e){return uTe(QTe,e)}function Tbn(e){return dTe(HTe,e)}function Ibn(e){return pTe(YTe,e)}function wbn(e){return Aot(ilt,e)}function Rbn(e){return mTe(ZTe,e)}function Nbn(e){return fTe(jTe,e)}function kbn(e){return hTe(zTe,e)}function Obn(e){return gTe(XTe,e)}function Mbn(e){return bTe(qTe,e)}function Pbn(e){return yTe(KTe,e)}function Dbn(e){return ATe(JTe,e)}function Bbn(e,t,n={}){return qH(rY,e,t,n)}function Lbn(e){return qH(rY,"hostname",AA.hostname,e)}function Fbn(e){return qH(rY,"hex",AA.hex,e)}function Ubn(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,i=AA[r];if(!i)throw new Error(`Unrecognized hash format: ${r}`);return qH(rY,r,i,t)}function Qr(e){return Cot(iY,e)}function tp(e){return Iot(_3,e)}function Vbn(e){return wot(_3,e)}function Gbn(e){return Rot(_3,e)}function Wbn(e){return Not(_3,e)}function $bn(e){return kot(_3,e)}function Ji(e){return Oot(sY,e)}function Qbn(e){return Pot(oY,e)}function Hbn(e){return Bot(eIe,e)}function Ybn(e){return Lot(eIe,e)}function Zbn(e){return Fot(slt,e)}function jbn(e){return Uot(olt,e)}function poe(e){return Vot(alt,e)}function tIe(){return Got(llt)}function Et(){return Wot(clt)}function nIe(e){return $ot(ult,e)}function zbn(e){return Qot(dlt,e)}function Xbn(e){return Hot(moe,e)}function Nn(e,t){return jot(plt,e,t)}function qbn(e){let t=e._zod.def.shape;return Qf(Object.keys(t))}function Je(e,t){let n={type:"object",shape:e??{},...Dn.normalizeParams(t)};return new foe(n)}function Kbn(e,t){return new foe({type:"object",shape:e,catchall:nIe(),...Dn.normalizeParams(t)})}function np(e,t){return new foe({type:"object",shape:e,catchall:Et(),...Dn.normalizeParams(t)})}function ur(e,t){return new hoe({type:"union",options:e,...Dn.normalizeParams(t)})}function Jbn(e,t){return new mlt({type:"union",options:e,inclusive:!1,...Dn.normalizeParams(t)})}function goe(e,t,n){return new flt({type:"union",options:t,discriminator:e,...Dn.normalizeParams(n)})}function Qy(e,t){return new hlt({type:"intersection",left:e,right:t})}function blt(e,t,n){let r=t instanceof fs,i=r?n:t,s=r?t:null;return new glt({type:"tuple",items:e,rest:s,...Dn.normalizeParams(i)})}function vt(e,t,n){return!t||!t._zod?new JH({type:"record",keyType:Ae(),valueType:e,...Dn.normalizeParams(t)}):new JH({type:"record",keyType:e,valueType:t,...Dn.normalizeParams(n)})}function eyn(e,t,n){let r=Xg(e);return r._zod.values=void 0,new JH({type:"record",keyType:r,valueType:t,...Dn.normalizeParams(n)})}function tyn(e,t,n){return new JH({type:"record",keyType:e,valueType:t,mode:"loose",...Dn.normalizeParams(n)})}function nyn(e,t,n){return new ylt({type:"map",keyType:e,valueType:t,...Dn.normalizeParams(n)})}function ryn(e,t){return new Alt({type:"set",valueType:e,...Dn.normalizeParams(t)})}function Qf(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new eY({type:"enum",entries:n,...Dn.normalizeParams(t)})}function iyn(e,t){return new eY({type:"enum",entries:e,...Dn.normalizeParams(t)})}function Mt(e,t){return new Elt({type:"literal",values:Array.isArray(e)?e:[e],...Dn.normalizeParams(t)})}function syn(e){return zot(_lt,e)}function rIe(e){return new Slt({type:"transform",transform:e})}function bc(e){return new iIe({type:"optional",innerType:e})}function xlt(e){return new vlt({type:"optional",innerType:e})}function coe(e){return new Clt({type:"nullable",innerType:e})}function oyn(e){return bc(coe(e))}function Ilt(e,t){return new Tlt({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Dn.shallowClone(t)}})}function Rlt(e,t){return new wlt({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Dn.shallowClone(t)}})}function Nlt(e,t){return new sIe({type:"nonoptional",innerType:e,...Dn.normalizeParams(t)})}function ayn(e){return new klt({type:"success",innerType:e})}function Mlt(e,t){return new Olt({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}function lyn(e){return Zot(Plt,e)}function BTe(e,t){return new boe({type:"pipe",in:e,out:t})}function cyn(e,t,n){return new yoe({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function uyn(e){let t=e._zod.def;return new yoe({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function Llt(e){return new Blt({type:"readonly",innerType:e})}function dyn(e,t){return new Flt({type:"template_literal",parts:e,...Dn.normalizeParams(t)})}function Vlt(e){return new Ult({type:"lazy",getter:e})}function pyn(e){return new Glt({type:"promise",innerType:e})}function myn(e){return new Wlt({type:"function",input:Array.isArray(e?.input)?blt(e?.input):e?.input??Nn(Et()),output:e?.output??Et()})}function fyn(e){let t=new gc({check:"custom"});return t._zod.check=e,t}function oIe(e,t){return Xot(Aoe,e??(()=>!0),t)}function $lt(e,t={}){return qot(Aoe,e,t)}function Qlt(e,t){return Kot(e,t)}function byn(e,t={}){let n=new Aoe({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...Dn.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Ayn(e){let t=Vlt(()=>ur([Ae(e),Qr(),Ji(),poe(),Nn(t),vt(Ae(),t)]));return t}function Eoe(e,t){return new Dlt({type:"pipe",in:rIe(e),out:t})}var pbn,Fs,LTe,tY,zl,FTe,loe,DT,doe,UTe,VTe,GTe,WTe,$Te,QTe,HTe,YTe,ilt,ZTe,jTe,zTe,XTe,qTe,KTe,JTe,rY,iY,_3,sY,oY,eIe,slt,olt,alt,llt,clt,ult,dlt,moe,plt,foe,hoe,mlt,flt,hlt,glt,JH,ylt,Alt,eY,Elt,_lt,Slt,iIe,vlt,Clt,Tlt,wlt,sIe,klt,Olt,Plt,boe,yoe,Dlt,Blt,Flt,Ult,Glt,Wlt,Aoe,hyn,gyn,yyn,aoe=C(()=>{eb();eb();ioe();roe();kTe();soe();rlt();pbn=new WeakMap;Fs=Ut("ZodType",(e,t)=>(fs.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:KH(e,"input"),output:KH(e,"output")}}),e.toJSONSchema=nat(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>Hat(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Zat(e,n,r),e.parseAsync=async(n,r)=>Yat(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>jat(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>zat(e,n,r),e.decode=(n,r)=>Xat(e,n,r),e.encodeAsync=async(n,r)=>qat(e,n,r),e.decodeAsync=async(n,r)=>Kat(e,n,r),e.safeEncode=(n,r)=>Jat(e,n,r),e.safeDecode=(n,r)=>elt(e,n,r),e.safeEncodeAsync=async(n,r)=>tlt(e,n,r),e.safeDecodeAsync=async(n,r)=>nlt(e,n,r),uoe(e,"ZodType",{check(...n){let r=this.def;return this.clone(Dn.mergeDefs(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Xg(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check($lt(n,r))},superRefine(n,r){return this.check(Qlt(n,r))},overwrite(n){return this.check(Cv(n))},optional(){return bc(this)},exactOptional(){return xlt(this)},nullable(){return coe(this)},nullish(){return bc(coe(this))},nonoptional(n){return Nlt(this,n)},array(){return Nn(this)},or(n){return ur([this,n])},and(n){return Qy(this,n)},transform(n){return BTe(this,rIe(n))},default(n){return Ilt(this,n)},prefault(n){return Rlt(this,n)},catch(n){return Mlt(this,n)},pipe(n){return BTe(this,n)},readonly(){return Llt(this)},describe(n){let r=this.clone();return $f.add(r,{description:n}),r},meta(...n){if(n.length===0)return $f.get(this);let r=this.clone();return $f.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return $f.get(e)?.description},configurable:!0}),e)),LTe=Ut("_ZodString",(e,t)=>{b3.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>rat(e,r,i,s);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,uoe(e,"_ZodString",{regex(...r){return this.check(UH(...r))},includes(...r){return this.check(WH(...r))},startsWith(...r){return this.check($H(...r))},endsWith(...r){return this.check(QH(...r))},min(...r){return this.check(VN(...r))},max(...r){return this.check(A3(...r))},length(...r){return this.check(E3(...r))},nonempty(...r){return this.check(VN(1,...r))},lowercase(r){return this.check(VH(r))},uppercase(r){return this.check(GH(r))},trim(){return this.check(ZH())},normalize(...r){return this.check(YH(...r))},toLowerCase(){return this.check(jH())},toUpperCase(){return this.check(zH())},slugify(){return this.check(XH())}})}),tY=Ut("ZodString",(e,t)=>{b3.init(e,t),LTe.init(e,t),e.email=n=>e.check(eTe(FTe,n)),e.url=n=>e.check(noe(doe,n)),e.jwt=n=>e.check(ATe(JTe,n)),e.emoji=n=>e.check(sTe(UTe,n)),e.guid=n=>e.check(toe(loe,n)),e.uuid=n=>e.check(tTe(DT,n)),e.uuidv4=n=>e.check(nTe(DT,n)),e.uuidv6=n=>e.check(rTe(DT,n)),e.uuidv7=n=>e.check(iTe(DT,n)),e.nanoid=n=>e.check(oTe(VTe,n)),e.guid=n=>e.check(toe(loe,n)),e.cuid=n=>e.check(aTe(GTe,n)),e.cuid2=n=>e.check(lTe(WTe,n)),e.ulid=n=>e.check(cTe($Te,n)),e.base64=n=>e.check(gTe(XTe,n)),e.base64url=n=>e.check(bTe(qTe,n)),e.xid=n=>e.check(uTe(QTe,n)),e.ksuid=n=>e.check(dTe(HTe,n)),e.ipv4=n=>e.check(pTe(YTe,n)),e.ipv6=n=>e.check(mTe(ZTe,n)),e.cidrv4=n=>e.check(fTe(jTe,n)),e.cidrv6=n=>e.check(hTe(zTe,n)),e.e164=n=>e.check(yTe(KTe,n)),e.datetime=n=>e.check(Vat(n)),e.date=n=>e.check(Gat(n)),e.time=n=>e.check(Wat(n)),e.duration=n=>e.check($at(n))});zl=Ut("ZodStringFormat",(e,t)=>{jl.init(e,t),LTe.init(e,t)}),FTe=Ut("ZodEmail",(e,t)=>{ist.init(e,t),zl.init(e,t)});loe=Ut("ZodGUID",(e,t)=>{nst.init(e,t),zl.init(e,t)});DT=Ut("ZodUUID",(e,t)=>{rst.init(e,t),zl.init(e,t)});doe=Ut("ZodURL",(e,t)=>{sst.init(e,t),zl.init(e,t)});UTe=Ut("ZodEmoji",(e,t)=>{ost.init(e,t),zl.init(e,t)});VTe=Ut("ZodNanoID",(e,t)=>{ast.init(e,t),zl.init(e,t)});GTe=Ut("ZodCUID",(e,t)=>{lst.init(e,t),zl.init(e,t)});WTe=Ut("ZodCUID2",(e,t)=>{cst.init(e,t),zl.init(e,t)});$Te=Ut("ZodULID",(e,t)=>{ust.init(e,t),zl.init(e,t)});QTe=Ut("ZodXID",(e,t)=>{dst.init(e,t),zl.init(e,t)});HTe=Ut("ZodKSUID",(e,t)=>{pst.init(e,t),zl.init(e,t)});YTe=Ut("ZodIPv4",(e,t)=>{bst.init(e,t),zl.init(e,t)});ilt=Ut("ZodMAC",(e,t)=>{Ast.init(e,t),zl.init(e,t)});ZTe=Ut("ZodIPv6",(e,t)=>{yst.init(e,t),zl.init(e,t)});jTe=Ut("ZodCIDRv4",(e,t)=>{Est.init(e,t),zl.init(e,t)});zTe=Ut("ZodCIDRv6",(e,t)=>{_st.init(e,t),zl.init(e,t)});XTe=Ut("ZodBase64",(e,t)=>{vst.init(e,t),zl.init(e,t)});qTe=Ut("ZodBase64URL",(e,t)=>{xst.init(e,t),zl.init(e,t)});KTe=Ut("ZodE164",(e,t)=>{Cst.init(e,t),zl.init(e,t)});JTe=Ut("ZodJWT",(e,t)=>{Tst.init(e,t),zl.init(e,t)});rY=Ut("ZodCustomStringFormat",(e,t)=>{Ist.init(e,t),zl.init(e,t)});iY=Ut("ZodNumber",(e,t)=>{$Ce.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>iat(e,r,i,s),uoe(e,"ZodNumber",{gt(r,i){return this.check(OT(r,i))},gte(r,i){return this.check(Kg(r,i))},min(r,i){return this.check(Kg(r,i))},lt(r,i){return this.check(kT(r,i))},lte(r,i){return this.check(EA(r,i))},max(r,i){return this.check(EA(r,i))},int(r){return this.check(tp(r))},safe(r){return this.check(tp(r))},positive(r){return this.check(OT(0,r))},nonnegative(r){return this.check(Kg(0,r))},negative(r){return this.check(kT(0,r))},nonpositive(r){return this.check(EA(0,r))},multipleOf(r,i){return this.check(DP(r,i))},step(r,i){return this.check(DP(r,i))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});_3=Ut("ZodNumberFormat",(e,t)=>{wst.init(e,t),iY.init(e,t)});sY=Ut("ZodBoolean",(e,t)=>{Xse.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>sat(e,n,r,i)});oY=Ut("ZodBigInt",(e,t)=>{QCe.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>oat(e,r,i,s),e.gte=(r,i)=>e.check(Kg(r,i)),e.min=(r,i)=>e.check(Kg(r,i)),e.gt=(r,i)=>e.check(OT(r,i)),e.gte=(r,i)=>e.check(Kg(r,i)),e.min=(r,i)=>e.check(Kg(r,i)),e.lt=(r,i)=>e.check(kT(r,i)),e.lte=(r,i)=>e.check(EA(r,i)),e.max=(r,i)=>e.check(EA(r,i)),e.positive=r=>e.check(OT(BigInt(0),r)),e.negative=r=>e.check(kT(BigInt(0),r)),e.nonpositive=r=>e.check(EA(BigInt(0),r)),e.nonnegative=r=>e.check(Kg(BigInt(0),r)),e.multipleOf=(r,i)=>e.check(DP(r,i));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});eIe=Ut("ZodBigIntFormat",(e,t)=>{Rst.init(e,t),oY.init(e,t)});slt=Ut("ZodSymbol",(e,t)=>{Nst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>aat(e,n,r,i)});olt=Ut("ZodUndefined",(e,t)=>{kst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>cat(e,n,r,i)});alt=Ut("ZodNull",(e,t)=>{Ost.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>lat(e,n,r,i)});llt=Ut("ZodAny",(e,t)=>{Mst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>pat(e,n,r,i)});clt=Ut("ZodUnknown",(e,t)=>{Pst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>mat(e,n,r,i)});ult=Ut("ZodNever",(e,t)=>{Dst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>dat(e,n,r,i)});dlt=Ut("ZodVoid",(e,t)=>{Bst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>uat(e,n,r,i)});moe=Ut("ZodDate",(e,t)=>{Lst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>fat(e,r,i,s),e.min=(r,i)=>e.check(Kg(r,i)),e.max=(r,i)=>e.check(EA(r,i));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});plt=Ut("ZodArray",(e,t)=>{Fst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Tat(e,n,r,i),e.element=t.element,uoe(e,"ZodArray",{min(n,r){return this.check(VN(n,r))},nonempty(n){return this.check(VN(1,n))},max(n,r){return this.check(A3(n,r))},length(n,r){return this.check(E3(n,r))},unwrap(){return this.element}})});foe=Ut("ZodObject",(e,t)=>{Ust.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Iat(e,n,r,i),Dn.defineLazy(e,"shape",()=>t.shape),uoe(e,"ZodObject",{keyof(){return Qf(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Et()})},loose(){return this.clone({...this._zod.def,catchall:Et()})},strict(){return this.clone({...this._zod.def,catchall:nIe()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Dn.extend(this,n)},safeExtend(n){return Dn.safeExtend(this,n)},merge(n){return Dn.merge(this,n)},pick(n){return Dn.pick(this,n)},omit(n){return Dn.omit(this,n)},partial(...n){return Dn.partial(iIe,this,n[0])},required(...n){return Dn.required(sIe,this,n[0])}})});hoe=Ut("ZodUnion",(e,t)=>{qse.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>TTe(e,n,r,i),e.options=t.options});mlt=Ut("ZodXor",(e,t)=>{hoe.init(e,t),Vst.init(e,t),e._zod.processJSONSchema=(n,r,i)=>TTe(e,n,r,i),e.options=t.options});flt=Ut("ZodDiscriminatedUnion",(e,t)=>{hoe.init(e,t),Gst.init(e,t)});hlt=Ut("ZodIntersection",(e,t)=>{Wst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>wat(e,n,r,i)});glt=Ut("ZodTuple",(e,t)=>{HCe.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Rat(e,n,r,i),e.rest=n=>e.clone({...e._zod.def,rest:n})});JH=Ut("ZodRecord",(e,t)=>{$st.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Nat(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType});ylt=Ut("ZodMap",(e,t)=>{Qst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>xat(e,n,r,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(MT(...n)),e.nonempty=n=>e.check(MT(1,n)),e.max=(...n)=>e.check(BP(...n)),e.size=(...n)=>e.check(y3(...n))});Alt=Ut("ZodSet",(e,t)=>{Hst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Cat(e,n,r,i),e.min=(...n)=>e.check(MT(...n)),e.nonempty=n=>e.check(MT(1,n)),e.max=(...n)=>e.check(BP(...n)),e.size=(...n)=>e.check(y3(...n))});eY=Ut("ZodEnum",(e,t)=>{Yst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(r,i,s)=>hat(e,r,i,s),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{let s={};for(let o of r)if(n.has(o))s[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new eY({...t,checks:[],...Dn.normalizeParams(i),entries:s})},e.exclude=(r,i)=>{let s={...t.entries};for(let o of r)if(n.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new eY({...t,checks:[],...Dn.normalizeParams(i),entries:s})}});Elt=Ut("ZodLiteral",(e,t)=>{Zst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>gat(e,n,r,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});_lt=Ut("ZodFile",(e,t)=>{jst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Aat(e,n,r,i),e.min=(n,r)=>e.check(MT(n,r)),e.max=(n,r)=>e.check(BP(n,r)),e.mime=(n,r)=>e.check(HH(Array.isArray(n)?n:[n],r))});Slt=Ut("ZodTransform",(e,t)=>{zst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>vat(e,n,r,i),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new NP(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Dn.issue(s,n.value,t));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),n.issues.push(Dn.issue(o))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});iIe=Ut("ZodOptional",(e,t)=>{YCe.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ITe(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});vlt=Ut("ZodExactOptional",(e,t)=>{Xst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ITe(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Clt=Ut("ZodNullable",(e,t)=>{qst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>kat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Tlt=Ut("ZodDefault",(e,t)=>{Kst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Mat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});wlt=Ut("ZodPrefault",(e,t)=>{Jst.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Pat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});sIe=Ut("ZodNonOptional",(e,t)=>{eot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Oat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});klt=Ut("ZodSuccess",(e,t)=>{tot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Eat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Olt=Ut("ZodCatch",(e,t)=>{not.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Dat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});Plt=Ut("ZodNaN",(e,t)=>{rot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>bat(e,n,r,i)});boe=Ut("ZodPipe",(e,t)=>{ZCe.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Bat(e,n,r,i),e.in=t.in,e.out=t.out});yoe=Ut("ZodCodec",(e,t)=>{boe.init(e,t),Kse.init(e,t)});Dlt=Ut("ZodPreprocess",(e,t)=>{boe.init(e,t),iot.init(e,t)}),Blt=Ut("ZodReadonly",(e,t)=>{sot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Lat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Flt=Ut("ZodTemplateLiteral",(e,t)=>{oot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>yat(e,n,r,i)});Ult=Ut("ZodLazy",(e,t)=>{cot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Uat(e,n,r,i),e.unwrap=()=>e._zod.def.getter()});Glt=Ut("ZodPromise",(e,t)=>{lot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Fat(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});Wlt=Ut("ZodFunction",(e,t)=>{aot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Sat(e,n,r,i)});Aoe=Ut("ZodCustom",(e,t)=>{uot.init(e,t),Fs.init(e,t),e._zod.processJSONSchema=(n,r,i)=>_at(e,n,r,i)});hyn=Jot,gyn=eat;yyn=(...e)=>tat({Codec:yoe,Boolean:sY,String:tY},...e)});function JXi(e){gd({customError:e})}function eqi(){return gd().customError}var Ylt,Hlt,Eyn=C(()=>{eb();Ylt={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};Hlt||(Hlt={})});function nqi(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function rqi(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let i=n[1];if(!i||!t.defs[i])throw new Error(`Reference not found: ${e}`);return t.defs[i]}throw new Error(`Reference not found: ${e}`)}function _yn(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return br.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let i=e.$ref;if(t.refs.has(i))return t.refs.get(i);if(t.processing.has(i))return br.lazy(()=>{if(!t.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return t.refs.get(i)});t.processing.add(i);let s=rqi(i,t),o=eg(s,t);return t.refs.set(i,o),t.processing.delete(i),o}if(e.enum!==void 0){let i=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&i.length===1&&i[0]===null)return br.null();if(i.length===0)return br.never();if(i.length===1)return br.literal(i[0]);if(i.every(o=>typeof o=="string"))return br.enum(i);let s=i.map(o=>br.literal(o));return s.length<2?s[0]:br.union([s[0],s[1],...s.slice(2)])}if(e.const!==void 0)return br.literal(e.const);let n=e.type;if(Array.isArray(n)){let i=n.map(s=>{let o={...e,type:s};return _yn(o,t)});return i.length===0?br.never():i.length===1?i[0]:br.union(i)}if(!n)return br.any();let r;switch(n){case"string":{let i=br.string();if(e.format){let s=e.format;s==="email"?i=i.check(br.email()):s==="uri"||s==="uri-reference"?i=i.check(br.url()):s==="uuid"||s==="guid"?i=i.check(br.uuid()):s==="date-time"?i=i.check(br.iso.datetime()):s==="date"?i=i.check(br.iso.date()):s==="time"?i=i.check(br.iso.time()):s==="duration"?i=i.check(br.iso.duration()):s==="ipv4"?i=i.check(br.ipv4()):s==="ipv6"?i=i.check(br.ipv6()):s==="mac"?i=i.check(br.mac()):s==="cidr"?i=i.check(br.cidrv4()):s==="cidr-v6"?i=i.check(br.cidrv6()):s==="base64"?i=i.check(br.base64()):s==="base64url"?i=i.check(br.base64url()):s==="e164"?i=i.check(br.e164()):s==="jwt"?i=i.check(br.jwt()):s==="emoji"?i=i.check(br.emoji()):s==="nanoid"?i=i.check(br.nanoid()):s==="cuid"?i=i.check(br.cuid()):s==="cuid2"?i=i.check(br.cuid2()):s==="ulid"?i=i.check(br.ulid()):s==="xid"?i=i.check(br.xid()):s==="ksuid"&&(i=i.check(br.ksuid()))}typeof e.minLength=="number"&&(i=i.min(e.minLength)),typeof e.maxLength=="number"&&(i=i.max(e.maxLength)),e.pattern&&(i=i.regex(new RegExp(e.pattern))),r=i;break}case"number":case"integer":{let i=n==="integer"?br.number().int():br.number();typeof e.minimum=="number"&&(i=i.min(e.minimum)),typeof e.maximum=="number"&&(i=i.max(e.maximum)),typeof e.exclusiveMinimum=="number"?i=i.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(i=i.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?i=i.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(i=i.lt(e.maximum)),typeof e.multipleOf=="number"&&(i=i.multipleOf(e.multipleOf)),r=i;break}case"boolean":{r=br.boolean();break}case"null":{r=br.null();break}case"object":{let i={},s=e.properties||{},o=new Set(e.required||[]);for(let[l,u]of Object.entries(s)){let c=eg(u,t);i[l]=o.has(l)?c:c.optional()}if(e.propertyNames){let l=eg(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties=="object"?eg(e.additionalProperties,t):br.any();if(Object.keys(i).length===0){r=br.record(l,u);break}let c=br.object(i).passthrough(),d=br.looseRecord(l,u);r=br.intersection(c,d);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),c=[];for(let p of u){let m=eg(l[p],t),f=br.string().regex(new RegExp(p));c.push(br.looseRecord(f,m))}let d=[];if(Object.keys(i).length>0&&d.push(br.object(i).passthrough()),d.push(...c),d.length===0)r=br.object({}).passthrough();else if(d.length===1)r=d[0];else{let p=br.intersection(d[0],d[1]);for(let m=2;m<d.length;m++)p=br.intersection(p,d[m]);r=p}break}let a=br.object(i);e.additionalProperties===!1?r=a.strict():typeof e.additionalProperties=="object"?r=a.catchall(eg(e.additionalProperties,t)):r=a.passthrough();break}case"array":{let i=e.prefixItems,s=e.items;if(i&&Array.isArray(i)){let o=i.map(l=>eg(l,t)),a=s&&typeof s=="object"&&!Array.isArray(s)?eg(s,t):void 0;a?r=br.tuple(o).rest(a):r=br.tuple(o),typeof e.minItems=="number"&&(r=r.check(br.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(br.maxLength(e.maxItems)))}else if(Array.isArray(s)){let o=s.map(l=>eg(l,t)),a=e.additionalItems&&typeof e.additionalItems=="object"?eg(e.additionalItems,t):void 0;a?r=br.tuple(o).rest(a):r=br.tuple(o),typeof e.minItems=="number"&&(r=r.check(br.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(br.maxLength(e.maxItems)))}else if(s!==void 0){let o=eg(s,t),a=br.array(o);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=br.array(br.any());break}default:throw new Error(`Unsupported type: ${n}`)}return r}function eg(e,t){if(typeof e=="boolean")return e?br.any():br.never();let n=_yn(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>eg(u,t)),l=br.union(a);n=r?br.intersection(n,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>eg(u,t)),l=br.xor(a);n=r?br.intersection(n,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:br.any();else{let a=r?n:eg(e.allOf[0],t),l=r?0:1;for(let u=l;u<e.allOf.length;u++)a=br.intersection(a,eg(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=br.nullable(n)),e.readOnly===!0&&(n=br.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let i={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of s)a in e&&(i[a]=e[a]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let a of o)a in e&&(i[a]=e[a]);for(let a of Object.keys(e))tqi.has(a)||(i[a]=e[a]);return Object.keys(i).length>0&&t.registry.add(n,i),e.description&&(n=n.describe(e.description)),n}function Syn(e,t){if(typeof e=="boolean")return e?br.any():br.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=nqi(n,t?.defaultTarget),i=n.$defs||n.definitions||{},s={version:r,defs:i,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??$f};return eg(n,s)}var br,tqi,vyn=C(()=>{eoe();kTe();soe();aoe();br={...ooe,...NTe,iso:VP},tqi=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"])});var _oe={};li(_oe,{bigint:()=>aqi,boolean:()=>oqi,date:()=>lqi,number:()=>sqi,string:()=>iqi});function iqi(e){return yot(tY,e)}function sqi(e){return Tot(iY,e)}function oqi(e){return Mot(sY,e)}function aqi(e){return Dot(oY,e)}function lqi(e){return Yot(moe,e)}var xyn=C(()=>{eb();aoe()});var Ct={};li(Ct,{$brand:()=>$rt,$input:()=>got,$output:()=>hot,NEVER:()=>Pse,TimePrecision:()=>Eot,ZodAny:()=>llt,ZodArray:()=>plt,ZodBase64:()=>XTe,ZodBase64URL:()=>qTe,ZodBigInt:()=>oY,ZodBigIntFormat:()=>eIe,ZodBoolean:()=>sY,ZodCIDRv4:()=>jTe,ZodCIDRv6:()=>zTe,ZodCUID:()=>GTe,ZodCUID2:()=>WTe,ZodCatch:()=>Olt,ZodCodec:()=>yoe,ZodCustom:()=>Aoe,ZodCustomStringFormat:()=>rY,ZodDate:()=>moe,ZodDefault:()=>Tlt,ZodDiscriminatedUnion:()=>flt,ZodE164:()=>KTe,ZodEmail:()=>FTe,ZodEmoji:()=>UTe,ZodEnum:()=>eY,ZodError:()=>Op,ZodExactOptional:()=>vlt,ZodFile:()=>_lt,ZodFirstPartyTypeKind:()=>Hlt,ZodFunction:()=>Wlt,ZodGUID:()=>loe,ZodIPv4:()=>YTe,ZodIPv6:()=>ZTe,ZodISODate:()=>MTe,ZodISODateTime:()=>OTe,ZodISODuration:()=>DTe,ZodISOTime:()=>PTe,ZodIntersection:()=>hlt,ZodIssueCode:()=>Ylt,ZodJWT:()=>JTe,ZodKSUID:()=>HTe,ZodLazy:()=>Ult,ZodLiteral:()=>Elt,ZodMAC:()=>ilt,ZodMap:()=>ylt,ZodNaN:()=>Plt,ZodNanoID:()=>VTe,ZodNever:()=>ult,ZodNonOptional:()=>sIe,ZodNull:()=>alt,ZodNullable:()=>Clt,ZodNumber:()=>iY,ZodNumberFormat:()=>_3,ZodObject:()=>foe,ZodOptional:()=>iIe,ZodPipe:()=>boe,ZodPrefault:()=>wlt,ZodPreprocess:()=>Dlt,ZodPromise:()=>Glt,ZodReadonly:()=>Blt,ZodRealError:()=>$y,ZodRecord:()=>JH,ZodSet:()=>Alt,ZodString:()=>tY,ZodStringFormat:()=>zl,ZodSuccess:()=>klt,ZodSymbol:()=>slt,ZodTemplateLiteral:()=>Flt,ZodTransform:()=>Slt,ZodTuple:()=>glt,ZodType:()=>Fs,ZodULID:()=>$Te,ZodURL:()=>doe,ZodUUID:()=>DT,ZodUndefined:()=>olt,ZodUnion:()=>hoe,ZodUnknown:()=>clt,ZodVoid:()=>dlt,ZodXID:()=>QTe,ZodXor:()=>mlt,_ZodString:()=>LTe,_default:()=>Ilt,_function:()=>myn,any:()=>tIe,array:()=>Nn,base64:()=>Obn,base64url:()=>Mbn,bigint:()=>Qbn,boolean:()=>Ji,catch:()=>Mlt,check:()=>fyn,cidrv4:()=>Nbn,cidrv6:()=>kbn,clone:()=>Xg,codec:()=>cyn,coerce:()=>_oe,config:()=>gd,core:()=>PT,cuid:()=>Sbn,cuid2:()=>vbn,custom:()=>oIe,date:()=>Xbn,decode:()=>Xat,decodeAsync:()=>Kat,describe:()=>hyn,discriminatedUnion:()=>goe,e164:()=>Pbn,email:()=>mbn,emoji:()=>Ebn,encode:()=>zat,encodeAsync:()=>qat,endsWith:()=>QH,enum:()=>Qf,exactOptional:()=>xlt,file:()=>syn,flattenError:()=>Wse,float32:()=>Vbn,float64:()=>Gbn,formatError:()=>$se,fromJSONSchema:()=>Syn,function:()=>myn,getErrorMap:()=>eqi,globalRegistry:()=>$f,gt:()=>OT,gte:()=>Kg,guid:()=>fbn,hash:()=>Ubn,hex:()=>Fbn,hostname:()=>Lbn,httpUrl:()=>Abn,includes:()=>WH,instanceof:()=>byn,int:()=>tp,int32:()=>Wbn,int64:()=>Hbn,intersection:()=>Qy,invertCodec:()=>uyn,ipv4:()=>Ibn,ipv6:()=>Rbn,iso:()=>VP,json:()=>Ayn,jwt:()=>Dbn,keyof:()=>qbn,ksuid:()=>Tbn,lazy:()=>Vlt,length:()=>E3,literal:()=>Mt,locales:()=>FH,looseObject:()=>np,looseRecord:()=>tyn,lowercase:()=>VH,lt:()=>kT,lte:()=>EA,mac:()=>wbn,map:()=>nyn,maxLength:()=>A3,maxSize:()=>BP,meta:()=>gyn,mime:()=>HH,minLength:()=>VN,minSize:()=>MT,multipleOf:()=>DP,nan:()=>lyn,nanoid:()=>_bn,nativeEnum:()=>iyn,negative:()=>_Te,never:()=>nIe,nonnegative:()=>vTe,nonoptional:()=>Nlt,nonpositive:()=>STe,normalize:()=>YH,null:()=>poe,nullable:()=>coe,nullish:()=>oyn,number:()=>Qr,object:()=>Je,optional:()=>bc,overwrite:()=>Cv,parse:()=>Hat,parseAsync:()=>Yat,partialRecord:()=>eyn,pipe:()=>BTe,positive:()=>ETe,prefault:()=>Rlt,preprocess:()=>Eoe,prettifyError:()=>nit,promise:()=>pyn,property:()=>xTe,readonly:()=>Llt,record:()=>vt,refine:()=>$lt,regex:()=>UH,regexes:()=>AA,registry:()=>JCe,safeDecode:()=>elt,safeDecodeAsync:()=>nlt,safeEncode:()=>Jat,safeEncodeAsync:()=>tlt,safeParse:()=>Zat,safeParseAsync:()=>jat,set:()=>ryn,setErrorMap:()=>JXi,size:()=>y3,slugify:()=>XH,startsWith:()=>$H,strictObject:()=>Kbn,string:()=>Ae,stringFormat:()=>Bbn,stringbool:()=>yyn,success:()=>ayn,superRefine:()=>Qlt,symbol:()=>Zbn,templateLiteral:()=>dyn,toJSONSchema:()=>wTe,toLowerCase:()=>jH,toUpperCase:()=>zH,transform:()=>rIe,treeifyError:()=>tit,trim:()=>ZH,tuple:()=>blt,uint32:()=>$bn,uint64:()=>Ybn,ulid:()=>xbn,undefined:()=>jbn,union:()=>ur,unknown:()=>Et,uppercase:()=>GH,url:()=>nY,util:()=>Dn,uuid:()=>hbn,uuidv4:()=>gbn,uuidv6:()=>bbn,uuidv7:()=>ybn,void:()=>zbn,xid:()=>Cbn,xor:()=>Jbn});var Soe=C(()=>{eb();aoe();kTe();Qat();rlt();Eyn();eb();pot();eb();ioe();vyn();qCe();soe();soe();xyn();gd(jCe())});var Hf=C(()=>{Soe();Soe()});var Cyn,aIe,cqi,uqi,dqi,pqi,mqi,fqi,hqi,Tyn,Iyn=C(()=>{"use strict";Hf();Cyn=["off","bell","desktop_notification"],aIe=e=>e===null?"null":Array.isArray(e)?"an array":`a ${typeof e}`,cqi=e=>{try{return new RegExp(e),!0}catch{return!1}},uqi=Ct.discriminatedUnion("type",[Ct.object({type:Ct.enum(["allow","deny","ask-user"])}),Ct.object({type:Ct.literal("webhook-policy"),webhookUrl:Ct.url({error:'"permission.webhookUrl" must be a valid URL for a "webhook-policy".'})}),Ct.object({type:Ct.literal("script-policy"),script:Ct.string({error:'"permission.script" must be a non-empty string for a "script-policy".'}).min(1,{error:'"permission.script" must be a non-empty string for a "script-policy".'})})],{error:'unknown or invalid "permission".'}),dqi=Ct.object({toolName:Ct.string({error:'"toolName" must be a non-empty string.'}).min(1,{error:'"toolName" must be a non-empty string.'}),permission:uqi,eventType:Ct.enum(["tool-call","tool-response"],{error:'"eventType" must be "tool-call" or "tool-response" when present.'}).optional(),shellInputRegex:Ct.string({error:'"shellInputRegex" must be a string when present.'}).refine(cqi,{error:'"shellInputRegex" must be a valid regular expression when present.'}).optional()},{error:e=>`rule must be an object, got ${aIe(e.input)}.`}),pqi=e=>{let t=e.issues[0];if(t===void 0)return"invalid rule.";let n=t.message.endsWith(".")?t.message:`${t.message}.`;return t.path.length===0||n.startsWith('"')?n:`"${t.path.join(".")}": ${n}`},mqi='Expected { "toolName": string, "permission": { "type": "allow" | "deny" | "ask-user" } | { "type": "webhook-policy", "webhookUrl": string } | { "type": "script-policy", "script": string }, "eventType"?: "tool-call" | "tool-response", "shellInputRegex"?: string }.',fqi=e=>{let t=e.toolPermissions;if(t===void 0)return[];if(!Array.isArray(t))return e.toolPermissions=void 0,[`Ignoring "toolPermissions": expected an array of rules, got ${aIe(t)}.`];let n=[],r=[];for(let i=0;i<t.length;i++){let s=dqi.safeParse(t[i]);s.success?r.push(t[i]):n.push(`Dropping invalid "toolPermissions" rule at index ${i}: ${pqi(s.error)} ${mqi}`)}return n.length>0&&(e.toolPermissions=r),n},hqi=e=>{if("queueMode"in e&&!("steeringMode"in e)&&(e.steeringMode=e.queueMode,e.queueMode=void 0),!("transport"in e)&&typeof e.websockets=="boolean"&&(e.transport=e.websockets?"websocket":"sse",e.websockets=void 0),"skills"in e&&typeof e.skills=="object"&&e.skills!==null&&!Array.isArray(e.skills)){let t=e.skills;t.enableSkillCommands!==void 0&&e.enableSkillCommands===void 0&&(e.enableSkillCommands=t.enableSkillCommands),Array.isArray(t.customDirectories)&&t.customDirectories.length>0?e.skills=t.customDirectories:e.skills=void 0}return e},Tyn=e=>{let t=hqi(e),n=fqi(t);e.autoUpdate!==void 0&&typeof e.autoUpdate!="boolean"&&(n.push(`Ignoring "autoUpdate": expected a boolean, got ${aIe(e.autoUpdate)}.`),t.autoUpdate=void 0);for(let r of["verbose","collapseLongPastedText","updateTerminalTitle"])e[r]!==void 0&&typeof e[r]!="boolean"&&(n.push(`Ignoring "${r}": expected a boolean, got ${aIe(e[r])}.`),t[r]=void 0);for(let r of["numPastedLinesToCollapse","numPastedCharsToCollapse"]){let i=e[r];i!==void 0&&!(typeof i=="number"&&Number.isInteger(i)&&i>0)&&(n.push(`Ignoring "${r}": expected a positive integer.`),t[r]=void 0)}return e.notificationMode!==void 0&&!Cyn.includes(e.notificationMode)&&(n.push(`Ignoring "notificationMode": expected one of ${Cyn.join(", ")}.`),t.notificationMode=void 0),{settings:t,warnings:n}}});var gqi,wyn,bqi,BT,yqi,GP,jlt,Zlt,Aqi,S3,v3=C(()=>{"use strict";Wrt();Iyn();gqi=new Map([["defaultModel","model"],["shellPath","shell"],["shellCommandPrefix","startupScript"]]),wyn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),bqi=e=>{xfn(e,{onObjectProperty:t=>{if(GP.has(t))throw new Error(`Settings document contains reserved key "${t}".`)}})},BT=e=>{bqi(e);let t=[],n=Sfn(e,t,{allowTrailingComma:!0});if(t.length>0){let r=t.map(i=>Cfn(i.error)).join(", ");throw new Error(`Failed to parse settings JSON: ${r}`)}if(n===void 0)return{};if(!wyn(n))throw new Error("Settings document is not a valid object. Expected a JSON object but found a different type (e.g., array).");return n},yqi={tabSize:2,insertSpaces:!0},GP=new Set(["__proto__","constructor","prototype"]),jlt=e=>{let t=typeof e=="string"?e.split("."):[...e],n=typeof e=="string"?e:e.join(".");for(let r of t){if(r==="")throw new Error(`Invalid settings path "${n}": empty segment.`);if(GP.has(r))throw new Error(`Invalid settings path "${n}": "${r}" is a reserved key.`)}return t},Zlt=(e,t,n)=>{let r=_Ce(e,jlt(t),n,{formattingOptions:yqi});return SCe(e,r)},Aqi=(e,t)=>{let n=e;for(let r of t){if(!wyn(n)||!Object.hasOwn(n,r))return!1;n=n[r]}return!0},S3=class{constructor(t){this.settings={};this.warnings=[];this.store=t}drainWarnings(){let t=this.warnings;return this.warnings=[],t}getSettings(){return structuredClone(this.settings)}publish(t){let n=BT(t),{settings:r,warnings:i}=Tyn(n);this.warnings.push(...i),this.settings=r}reload(){let t=this.store.read();if(t===void 0||t.trim()===""){this.settings={};return}this.publish(t)}remove(t){let n={persisted:!1,effectiveChange:!1},r;return this.store.modify(i=>{if(i===void 0||i.trim()==="")return;let s=BT(i),o=i;for(let a of t.paths){let l=jlt(a);Aqi(s,l)&&(o=Zlt(o,l,void 0),s=BT(o))}if(o!==i)return r=o,o}),r!==void 0&&(this.publish(r),n={persisted:!0,effectiveChange:!0}),n}update(t){return this.updateAll([t])}updateAll(t){let n={persisted:!1,effectiveChange:!1},r;return this.store.modify(i=>{let s=i===void 0||i.trim()===""?"{}":i;BT(s);let o=t.reduce((a,l)=>{let u=jlt(l.path),c=Zlt(a,u,l.value),d=u.length===1?gqi.get(u[0]):void 0;return d&&typeof l.value=="string"&&Object.hasOwn(BT(a),d)&&(c=Zlt(c,d,l.value)),c},s);if(BT(o),o!==s)return r=o,o}),r!==void 0&&(this.publish(r),n={persisted:!0,effectiveChange:!0}),n}}});var zlt,voe,Ryn,Eqi,_qi,Sqi,vqi,x3,lIe=C(()=>{"use strict";en();v3();zlt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),voe=e=>Array.isArray(e)?e.map(voe):zlt(e)?Object.fromEntries(Object.entries(e).filter(([t])=>!GP.has(t)).map(([t,n])=>[t,voe(n)])):structuredClone(e),Ryn=(e,t,n=!1)=>{for(let[r,i]of Object.entries(t)){if(GP.has(r)||i===void 0)continue;let s=e[r];n&&r==="toolPermissions"&&Array.isArray(i)?e[r]=[...voe(i),...Array.isArray(s)?s:[]]:zlt(s)&&zlt(i)?e[r]={...s,...voe(i)}:e[r]=voe(i)}},Eqi="managed",_qi="global",Sqi="project",vqi="local",x3=class{constructor(t,n={},r={}){this.errors=[];this.locals=t,this.overrides=n,this.vfs=r}drainErrors(){let t=this.errors;return this.errors=[],t}getSettings(){return this.mergeLayers([_qi,Sqi,vqi,Eqi])}getGlobalSettings(){return this.locals.global.getSettings()}getManagedSettings(){return this.locals.managed.getSettings()}getLocalSettings(){return this.locals.local.getSettings()}getProjectSettings(){return this.locals.project.getSettings()}getVfsUserSettings(){return this.vfs.vfsUser?.getSettings()??{}}getVfsSpaceSettings(){return this.vfs.vfsSpace?.getSettings()??{}}getVfsOrgSettings(){return this.vfs.vfsOrg?.getSettings()??{}}mergeLayers(t){let n={},r=t.map(i=>this.locals[i].getSettings());for(let i of r)Ryn(n,i,!0);return Ryn(n,this.overrides),n}reload(){let t=[...Object.entries(this.locals),...Object.entries(this.vfs)];for(let[n,r]of t)if(r){try{r.reload()}catch(i){let s=i instanceof Error?i:new Error(String(i));tt.error("settings reload failed",{scope:n,error:s}),this.errors.push({scope:n,error:s})}for(let i of r.drainWarnings())this.errors.push({scope:n,error:new Error(i)})}}remove(t,n){return this.routeWrite(t,r=>r.remove(n))}update(t,n){return this.routeWrite(t,r=>r.update(n))}updateAll(t,n){return this.routeWrite(t,r=>r.updateAll(n))}routeWrite(t,n){if(t==="managed")throw new Error('Refusing to write read-only settings scope "managed"');let r=this.getSettings(),i=n(this.locals[t]);for(let a of this.locals[t].drainWarnings())this.errors.push({scope:t,error:new Error(a)});if(!i.persisted)return i;let s=this.getSettings(),o=JSON.stringify(r)!==JSON.stringify(s);return{persisted:i.persisted,effectiveChange:o}}}});var Xlt,qlt=C(()=>{"use strict";Brt();lIe();v3();Xlt=(e,t)=>{let n=i=>new S3(new d3(i)),r=new x3({managed:n(e.managedPath),global:n(e.globalPath),project:n(e.projectPath),local:n(e.localPath)},t,{vfsUser:e.vfsUserPath?n(e.vfsUserPath):void 0,vfsSpace:e.vfsSpacePath?n(e.vfsSpacePath):void 0,vfsOrg:e.vfsOrgPath?n(e.vfsOrgPath):void 0});return r.reload(),r}});var Klt,Jlt,Nyn,C3,cIe=C(()=>{"use strict";v3();Klt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Jlt=e=>{if(Array.isArray(e))return e.map(Jlt);if(!Klt(e))return structuredClone(e);let t={};for(let[n,r]of Object.entries(e))GP.has(n)||(t[n]=Jlt(r));return t},Nyn=(e,t)=>{let n=structuredClone(e);for(let r of Object.keys(t)){let i=t[r];if(i===void 0||GP.has(r))continue;let s=n[r],o=Jlt(i);Klt(s)&&Klt(o)?n[r]={...s,...o}:n[r]=o}return n},C3=class{constructor(t){this.errors=[];this.manager=t}get settings(){let t=this.manager.getSettings();return this.dynamicOverrides?Nyn(t,this.dynamicOverrides):t}update(t,n,r){if(this.dynamicOverrides=void 0,typeof n=="object"&&"path"in n)return this.manager.update(t,n);try{this.manager.update(t,{path:n,value:r})}catch(i){let s=i instanceof Error?i:new Error(String(i));this.errors.push({scope:t,error:s})}}updateAll(t,n){return this.dynamicOverrides=void 0,this.manager.updateAll(t,n)}remove(t,n){return this.dynamicOverrides=void 0,this.manager.remove(t,n)}removeForCompatibility(t,n){try{this.remove(t,n)}catch(r){let i=r instanceof Error?r:new Error(String(r));this.errors.push({scope:t,error:i})}}getSettings(){return structuredClone(this.settings)}getGlobalSettings(){return structuredClone(this.manager.getGlobalSettings())}getProjectSettings(){return structuredClone(this.manager.getProjectSettings())}getLocalSettings(){return structuredClone(this.manager.getLocalSettings())}getManagedSettings(){return structuredClone(this.manager.getManagedSettings())}getVfsUserSettings(){return structuredClone(this.manager.getVfsUserSettings())}getVfsSpaceSettings(){return structuredClone(this.manager.getVfsSpaceSettings())}getVfsOrgSettings(){return structuredClone(this.manager.getVfsOrgSettings())}reload(){this.manager.reload(),this.dynamicOverrides=void 0}applyOverrides(t){this.dynamicOverrides=Nyn(this.dynamicOverrides??{},t)}flush(){}drainErrors(){let t=[...this.manager.drainErrors(),...this.errors];return this.errors=[],t}getAutoUpdate(){return this.settings.autoUpdate??!0}getLastChangelogVersion(){return this.settings.lastChangelogVersion}setLastChangelogVersion(t){this.update("global","lastChangelogVersion",t)}getSessionDir(){return this.settings.sessionDir}getWorktreeDir(){return this.settings.worktreeDir}getDefaultModel(){let{defaultModel:t,model:n}=this.settings;return t??n}setDefaultModel(t){this.update("global","defaultModel",t)}getSteeringMode(){return this.settings.steeringMode||"one-at-a-time"}setSteeringMode(t){this.update("global","steeringMode",t)}getFollowUpMode(){return this.settings.followUpMode||"one-at-a-time"}setFollowUpMode(t){this.update("global","followUpMode",t)}getTheme(){let t=this.settings.theme;return t==="default-dark"?"dark":t}setTheme(t){this.update("global","theme",t==="default-dark"?"dark":t)}getVerbose(){return this.settings.verbose===!0}setVerbose(t){if(this.getManagedSettings().verbose!==void 0)return;let n="global";this.getLocalSettings().verbose!==void 0?n="local":this.getProjectSettings().verbose!==void 0&&(n="project"),this.update(n,"verbose",t)}getUpdateTerminalTitle(){return this.settings.updateTerminalTitle!==!1}getNotificationMode(){return this.settings.notificationMode??"off"}getCollapseLongPastedText(){return this.settings.collapseLongPastedText!==!1}getNumPastedLinesToCollapse(){let t=this.settings.numPastedLinesToCollapse;return typeof t=="number"&&Number.isInteger(t)&&t>0?t:10}getNumPastedCharsToCollapse(){let t=this.settings.numPastedCharsToCollapse;return typeof t=="number"&&Number.isInteger(t)&&t>0?t:1e3}getDefaultThinkingLevel(){return this.settings.defaultThinkingLevel}setDefaultThinkingLevel(t){this.update("global","defaultThinkingLevel",t)}getCompactionEnabled(){return this.settings.compaction?.enabled??!0}setCompactionEnabled(t){this.update("global","compaction.enabled",t)}getCompactionReserveTokens(){return this.settings.compaction?.reserveTokens??16384}getCompactionProtectedHeadTokens(){return this.settings.compaction?.protectedHeadTokens??2e4}getCompactionKeepRecentTokens(){return this.settings.compaction?.keepRecentTokens??2e4}getCompactionSummarizationModel(){return this.settings.compaction?.summarizationModel}getCompactionSettings(){return{enabled:this.getCompactionEnabled(),reserveTokens:this.getCompactionReserveTokens(),protectedHeadTokens:this.getCompactionProtectedHeadTokens(),keepRecentTokens:this.getCompactionKeepRecentTokens(),summarizationModel:this.getCompactionSummarizationModel(),useReserveTrigger:this.settings.compaction?.useReserveTrigger??!1,inputBudgetTriggerRatio:this.settings.compaction?.inputBudgetTriggerRatio,fallbackInputBudgetRatio:this.settings.compaction?.fallbackInputBudgetRatio,maxMessageTokens:this.settings.compaction?.maxMessageTokens}}getBranchSummarySettings(){return{reserveTokens:this.settings.branchSummary?.reserveTokens??16384,skipPrompt:this.settings.branchSummary?.skipPrompt??!1}}getBranchSummarySkipPrompt(){return this.settings.branchSummary?.skipPrompt??!1}getRetryEnabled(){return this.settings.retry?.enabled??!0}setRetryEnabled(t){this.update("global","retry.enabled",t)}getRetrySettings(){return{enabled:this.getRetryEnabled(),maxRetries:this.settings.retry?.maxRetries??3,baseDelayMs:this.settings.retry?.baseDelayMs??2e3,maxDelayMs:this.settings.retry?.maxDelayMs??6e4}}getHideThinkingBlock(){return this.settings.hideThinkingBlock??!1}setHideThinkingBlock(t){this.update("global","hideThinkingBlock",t)}getCollapsePromptCommands(){return this.settings.collapsePromptCommands??!1}setCollapsePromptCommands(t){this.update("global","collapsePromptCommands",t)}getShellPath(){let{shellPath:t,shell:n}=this.settings;return t??n}setShellPath(t){this.update("global","shellPath",t)}getQuietStartup(){return this.settings.quietStartup??!1}setQuietStartup(t){this.update("global","quietStartup",t)}getShellCommandPrefix(){let{shellCommandPrefix:t,startupScript:n}=this.settings;return t??n}setShellCommandPrefix(t){this.update("global","shellCommandPrefix",t)}getNpmCommand(){return this.settings.npmCommand?[...this.settings.npmCommand]:void 0}setNpmCommand(t){this.update("global","npmCommand",t?[...t]:void 0)}getCollapseChangelog(){return this.settings.collapseChangelog??!1}setCollapseChangelog(t){this.update("global","collapseChangelog",t)}getPackages(){return[...this.settings.packages??[]]}setPackages(t){this.update("global","packages",t)}setProjectPackages(t){this.update("project","packages",t)}setLocalPackages(t){this.update("local","packages",t)}getExtensionPaths(){return[...this.settings.extensions??[]]}setExtensionPaths(t){this.update("global","extensions",t)}setProjectExtensionPaths(t){this.update("project","extensions",t)}setLocalExtensionPaths(t){this.update("local","extensions",t)}getSkillPaths(){return[...this.settings.skills??[]]}setSkillPaths(t){this.update("global","skills",t)}setProjectSkillPaths(t){this.update("project","skills",t)}setLocalSkillPaths(t){this.update("local","skills",t)}getPromptTemplatePaths(){return[...this.settings.prompts??[]]}setPromptTemplatePaths(t){this.update("global","prompts",t)}setProjectPromptTemplatePaths(t){this.update("project","prompts",t)}setLocalPromptTemplatePaths(t){this.update("local","prompts",t)}getThemePaths(){return[...this.settings.themes??[]]}setThemePaths(t){this.update("global","themes",t)}setProjectThemePaths(t){this.update("project","themes",t)}setLocalThemePaths(t){this.update("local","themes",t)}getEnableSkillCommands(){return this.settings.enableSkillCommands??!0}setEnableSkillCommands(t){this.update("global","enableSkillCommands",t)}getEnableHashline(){return this.settings.enableHashline??!1}setEnableHashline(t){this.update("global","enableHashline",t)}getEnabledPlugins(){let t={};for(let[n,r]of Object.entries(this.settings.enabledPlugins??{}))typeof r=="boolean"&&(t[n]=r);return t}getToolPermissions(){let t=this.settings.toolPermissions;return Array.isArray(t)?structuredClone(t):[]}getToolPermissionSources(){let t=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()];return["managed","local","project","global"].map((n,r)=>({source:n,rules:structuredClone(t[r]?.toolPermissions??[])}))}getToolPermissionScopeRuleSets(){let t=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=[];for(let r of t){let i=r.toolPermissions;Array.isArray(i)&&i.length>0&&n.push(structuredClone(i))}return n}setPluginEnabled(t,n){this.update("global",["enabledPlugins",t],n)}getToolSearchEnabled(){let t=this.settings;return t.toolSearchEnabled??(t.enableToolSearch===!0?!0:void 0)}setToolSearchEnabled(t){t===void 0?this.removeForCompatibility("global",{paths:["toolSearchEnabled","enableToolSearch"]}):this.update("global","toolSearchEnabled",t)}getThinkingBudgets(){return this.settings.thinkingBudgets}getShowImages(){return this.settings.terminal?.showImages??!0}setShowImages(t){this.update("global","terminal.showImages",t)}getClearOnShrink(){return this.settings.terminal?.clearOnShrink!==void 0?this.settings.terminal.clearOnShrink:process.env.PI_CLEAR_ON_SHRINK==="1"}setClearOnShrink(t){this.update("global","terminal.clearOnShrink",t)}getImageAutoResize(){return this.settings.images?.autoResize??!0}setImageAutoResize(t){this.update("global","images.autoResize",t)}getBlockImages(){return this.settings.images?.blockImages??!1}setBlockImages(t){this.update("global","images.blockImages",t)}getEnabledModels(){return this.settings.enabledModels?[...this.settings.enabledModels]:void 0}setEnabledModels(t){this.update("global","enabledModels",t)}getDoubleEscapeAction(){return this.settings.doubleEscapeAction??"tree"}setDoubleEscapeAction(t){this.update("global","doubleEscapeAction",t)}getTreeFilterMode(){let t=this.settings.treeFilterMode;return t&&["default","no-tools","user-only","labeled-only","all"].includes(t)?t:"default"}setTreeFilterMode(t){this.update("global","treeFilterMode",t)}getShowHardwareCursor(){return this.settings.showHardwareCursor??process.env.PI_HARDWARE_CURSOR==="1"}setShowHardwareCursor(t){this.update("global","showHardwareCursor",t)}getEditorPaddingX(){return this.settings.editorPaddingX??0}setEditorPaddingX(t){this.update("global","editorPaddingX",Math.max(0,Math.min(3,Math.floor(t))))}getAutocompleteMaxVisible(){return this.settings.autocompleteMaxVisible??5}setAutocompleteMaxVisible(t){this.update("global","autocompleteMaxVisible",Math.max(3,Math.min(20,Math.floor(t))))}getCodeBlockIndent(){return this.settings.markdown?.codeBlockIndent??" "}getHooks(){return this.settings.hooks}getTelemetrySettings(){return this.settings.telemetry}getEnvInjection(){let t=this.settings.env;if(!t||typeof t!="object")return{};let n={};for(let[r,i]of Object.entries(t))typeof i=="string"&&(n[r]=i);return n}getFeatureFlagOverrides(){return this.settings.featureFlagOverrides}getIndexingDirsUnion(){let t=[this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=r=>{let i=new Set,s=[];for(let o of t){let a=o[r];if(Array.isArray(a))for(let l of a)typeof l!="string"||i.has(l)||(i.add(l),s.push(l))}return s};return{allowDirs:n("indexingAllowDirs"),denyDirs:n("indexingDenyDirs")}}getRemovedToolsUnion(){let t=[this.settings,this.getManagedSettings(),this.getLocalSettings(),this.getProjectSettings(),this.getGlobalSettings()],n=new Set,r=[];for(let i of t){let s=i.removedTools;if(Array.isArray(s))for(let o of s)typeof o!="string"||n.has(o)||(n.add(o),r.push(o))}return r}}});var ect,tct=C(()=>{"use strict";qlt();cIe();ect=(e,t)=>new C3(Xlt(e,t))});var xoe,nct=C(()=>{"use strict";xoe=class{constructor(t){this.content=t}read(){return this.content}modify(t){let n=t(this.content);n!==void 0&&(this.content=n)}}});import{homedir as kyn}from"node:os";import{join as T3}from"node:path";var xqi,Cqi,rct,Coe,gi,Oyn=C(()=>{"use strict";nct();lIe();v3();tct();cIe();xqi="AUGGIE_CODING_AGENT_DIR",Cqi=()=>{let e=process.env[`${xqi}_MANAGED`];if(e)return e==="~"?T3(kyn(),"settings.json"):e.startsWith("~/")?kyn()+e.slice(1):e;if(process.platform==="win32"){let t=process.env.ProgramData||"C:\\ProgramData";return T3(t,"augment","settings.json")}return T3("/etc","augment","settings.json")},rct=e=>e?T3(e,".augment","settings.json"):void 0,Coe=(e,t,n)=>({globalPath:T3(t,"settings.json"),projectPath:T3(e,".augment","settings.json"),localPath:T3(e,".augment","settings.local.json"),managedPath:Cqi(),vfsUserPath:rct(n?.user),vfsSpacePath:rct(n?.space),vfsOrgPath:rct(n?.org)}),gi={create(e,t,n){return ect(Coe(e,t,n))},inMemory(e={}){let t=r=>new S3(new xoe(r===void 0?void 0:JSON.stringify(r))),n=new x3({managed:t(),local:t(),project:t(),global:t(e)});return n.reload(),new C3(n)}}});import{createHash as Tqi}from"node:crypto";import{statSync as Myn}from"node:fs";var Dyn,Iqi,ict,wqi,Rqi,aY,Byn,sct,Lyn,oct,Nqi,Fyn,Pyn,kqi,act,Uyn=C(()=>{"use strict";Wrt();Brt();v3();Dyn=new WeakMap,Iqi="Duplicate permission keys; editing disabled. Repair duplicate keys in the settings file, then reopen /permissions.",ict=(e,t)=>{let n=new Set;for(let r of e?.type==="object"?e.children??[]:[]){let i=r.children?.[0]?.value;if(t.includes(i)){if(n.has(i))return!0;n.add(i)}}return!1},wqi=e=>ict(e,["toolName","permission","eventType","shellInputRegex"])?!0:e.type!=="object"?!1:(e.children??[]).some(t=>t.children?.[0]?.value==="permission"&&ict(t.children?.[1],["type","script","webhookUrl"])),Rqi=e=>{let t=vfn(e);if(ict(t,["toolPermissions"]))return!0;for(let n of t?.children??[]){if(n.children?.[0]?.value!=="toolPermissions")continue;let r=n.children?.[1];if(r?.type==="array"&&(r.children??[]).some(wqi))return!0}return!1},aY=e=>Tqi("sha256").update(JSON.stringify(e)??"undefined").digest("hex"),Byn=e=>aY(e),sct=e=>e===void 0||e.trim()===""?"{}":e,Lyn=e=>{let t=BT(sct(e));if(t.toolPermissions===void 0)return[];if(!Array.isArray(t.toolPermissions))throw new Error("toolPermissions must be an array.");return t.toolPermissions},oct=e=>{let t=new d3(e).read(),n={revision:Byn(t),entries:Lyn(t)};return Rqi(sct(t))&&(n.editingDisabledReason=Iqi),Dyn.set(n,{path:RP(e),revision:n.revision,editingDisabledReason:n.editingDisabledReason}),n},Nqi=(e,t)=>{if(RP(e)===RP(t))return!0;try{let n=Myn(e),r=Myn(t);return n.dev===r.dev&&n.ino===r.ino}catch(n){if(typeof n=="object"&&n!==null&&"code"in n&&n.code==="ENOENT")return!1;throw n}},Fyn=(e,t,n,r=!1)=>SCe(e,_Ce(e,t,n,{isArrayInsertion:r,formattingOptions:{insertSpaces:!0,tabSize:2}})),Pyn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),kqi=e=>{let{content:t,entry:n,mutation:r,validate:i}=e;if(!Pyn(n)||!Pyn(n.permission))throw new Error("Permission rule is invalid.");let s=n.permission,o={...s,...r.permission};s.type==="webhook-policy"&&o.type!=="webhook-policy"&&(o.webhookUrl=void 0),s.type==="script-policy"&&o.type!=="script-policy"&&(o.script=void 0),i({...n,permission:o});let a=t;for(let l of["type","webhookUrl","script"])o[l]!==s[l]&&(a=Fyn(a,["toolPermissions",r.index,"permission",l],o[l]));return a},act=e=>{let{paths:t,source:n,document:r,mutation:i,validate:s}=e;if(n!=="global"&&n!=="project"&&n!=="local")throw new Error("Permission source is read-only.");let o=t[`${n}Path`],a=()=>{for(let c of[t.managedPath,t.vfsUserPath,t.vfsSpacePath,t.vfsOrgPath])if(c&&Nqi(o,c))throw new Error("Permission target aliases a read-only source.")};a();let l=RP(o),u=Dyn.get(r);if(!u||u.path!==l||u.revision!==r.revision)throw new Error("Permission source was not inspected. Reopen the manager.");if(u.editingDisabledReason)throw new Error(u.editingDisabledReason);new d3(l).modify(c=>{if(a(),RP(o)!==l)throw new Error("Permission target changed. Reopen the manager.");if(Byn(c)!==u.revision)throw new Error("Permission settings changed. Reopen the manager before saving.");let d=Lyn(c),p=sct(c),m=h=>(BT(h),h),f=Fyn;if(i.kind==="add")return s(i.rule),BT(p).toolPermissions===void 0?m(f(p,["toolPermissions"],[i.rule])):m(f(p,["toolPermissions",d.length],i.rule,!0));if(!Number.isInteger(i.index)||i.index<0||i.index>=d.length||aY(d[i.index])!==i.fingerprint)throw new Error("Permission rule changed. Reopen the manager before saving.");return i.kind==="remove"?m(f(p,["toolPermissions",i.index],void 0)):m(kqi({content:p,entry:d[i.index],mutation:i,validate:s}))})}});function bd(e){return Vyn.get(e)??[e]}function _A(e){return Gyn.get(e)??[e]}var Oqi,Vyn,Gyn,Wyn=C(()=>{"use strict";Oqi=[{current:["read"],legacy:["view"]},{current:["write"],legacy:["save-file","save_file"]},{current:["edit"],legacy:["str-replace-editor","str_replace_editor"]},{current:["grep"],legacy:["grep-search"]},{current:["bash","terminal"],legacy:["launch-process","shell"]}],Vyn=new Map,Gyn=new Map;for(let{current:e,legacy:t}of Oqi){let n=[...e,...t];for(let r of n)Vyn.set(r,n);for(let r of t)Gyn.set(r,e)}});var Ol=C(()=>{"use strict";tct();cIe();Oyn();qlt();nct();Uyn();lIe();v3();Wyn()});import{resolve as WP}from"node:path";function Qyn(e){return vse(e)??WP(e)}function dIe(e,t){return gi.create(t??e,e)}function lY({agentDir:e,workspacePath:t}){let n=dIe(e,t),{allowDirs:r,denyDirs:i}=n.getIndexingDirsUnion(),s={};for(let o of r)s[WP(o)]="allow";for(let o of i)s[WP(o)]="deny";return s}function Hyn({agentDir:e,workspacePath:t}){let n=lct({agentDir:e,workspacePath:t});if(n==="allowed")return"allow";if(n==="deny"||n==="never")return"deny"}function lct({agentDir:e,workspacePath:t}){let n=dIe(e,t),{allowDirs:r,denyDirs:i}=n.getIndexingDirsUnion();return Art([...r],[...i],t)}async function cct({agentDir:e,workspacePath:t,permission:n}){await Promise.resolve();let r=Qyn(t),i=dIe(e,t),s=i.getGlobalSettings(),o=Array.isArray(s.indexingAllowDirs)?[...s.indexingAllowDirs]:[],a=Array.isArray(s.indexingDenyDirs)?[...s.indexingDenyDirs]:[];if(n==="allow"){let l=a.filter(d=>WP(d)!==r),u=o.filter(d=>WP(d)!==r);u.push(r);let c=[{path:"indexingAllowDirs",value:u}];l.length!==a.length&&c.push({path:"indexingDenyDirs",value:l}),i.updateAll("global",c)}else{let l=o.filter(d=>WP(d)!==r),u=a.filter(d=>WP(d)!==r);u.push(r);let c=[{path:"indexingDenyDirs",value:u}];l.length!==o.length&&c.push({path:"indexingAllowDirs",value:l}),i.updateAll("global",c)}$yn.debug(`Saved indexing permission for ${r}: ${n}`)}async function pIe({agentDir:e,workspacePaths:t}){await Promise.resolve();let n=dIe(e,t[0]),{allowDirs:r,denyDirs:i}=n.getIndexingDirsUnion(),s=n.getGlobalSettings(),o=Array.isArray(s.indexingAllowDirs)?[...s.indexingAllowDirs]:[],a=Array.isArray(s.indexingDenyDirs)?[...s.indexingDenyDirs]:[],l=!1;for(let u of t)if(Art([...r,...o],[...i,...a],u)==="none"){let d=Qyn(u);o.some(p=>WP(p)===d)||(o.push(d),l=!0)}l&&(n.update("global",{path:"indexingAllowDirs",value:o}),$yn.debug(`Allowed unruled workspaces in settings.json: ${t.join(", ")}`))}var $yn,uIe,cY=C(()=>{"use strict";en();Ol();brt();Cse();$yn=tt.child({prefix:"pi-indexer-perms"}),uIe="settings.json"});function Yyn({requestedWorkspace:e,primaryWorkspace:t,additionalWorkspaces:n}){let r=e??t.workspace,i=[t,...n],s=i.find(a=>a.workspace===r);if(s)return{ok:!0,workspace:s};let o=i.map(a=>` - ${a.workspace}`).join(`
216
216
  `);return{ok:!1,message:`Unknown workspace "${r}". Valid \`workspace\` values:
217
217
  ${o}`}}function Zyn({workspace:e,timeoutMs:t,signal:n}){return Tse(e.readiness.settled,t,n)}function jyn({primaryReadiness:e}){return e.settled}var Mqi,uY,zyn=C(()=>{"use strict";_rt();Mqi=97;uY=class{checkpointCoveredIndexedFiles=-1;latestProgress;resolveSettled;ready=!1;terminal=!1;settled;constructor(){this.settled=new Promise(t=>{this.resolveSettled=t})}get isReady(){return this.ready}updateProgress(t){this.terminal||(this.latestProgress=t,this.evaluate())}updateCheckpoint(){this.terminal||(this.checkpointCoveredIndexedFiles=this.latestProgress?.filesIndexed??0,this.evaluate())}settleCompleted(){return this.evaluate(),this.ready||(this.terminal=!0,this.settle()),this.ready}settleTerminal(){this.terminal=!0,this.settle()}evaluate(){let t=this.latestProgress;if(!t?.walkComplete)return;let n=t.filesPreIndexed+t.filesTracked;if(n===0){this.ready=!0,this.settle();return}if(this.checkpointCoveredIndexedFiles<t.filesIndexed)return;(t.filesPreIndexed+t.filesProcessed)/n*100>=Mqi&&(this.ready=!0,this.settle())}settle(){this.resolveSettled?.(),this.resolveSettled=void 0}}});import{realpathSync as e0n,statSync as Pqi}from"node:fs";import{homedir as Dqi}from"node:os";import{delimiter as Xyn,resolve as Toe}from"node:path";function Kyn(e){let t;try{t=e0n(e)}catch{t=Toe(e)}return process.platform==="darwin"||process.platform==="win32"?t.toLowerCase():t}function Lqi(e){return Kyn(e)===Kyn(Dqi())}function Fqi(e){try{let t=Pqi(e,{bigint:!0});if(t.isDirectory()&&typeof t.dev=="bigint"&&t.dev>=0n&&typeof t.ino=="bigint"&&t.ino>0n)return`directory:${t.dev}:${t.ino}`}catch{}try{return`path:${e0n(e)}`}catch{return`path:${Toe(e)}`}}function Uqi(){let e=globalThis,t=e[Jyn];if(!t){let n,r=new Promise(l=>{n=l}),i,s=new Promise(l=>{i=l}),{promise:o,resolve:a}=o3();t={indexing:{kind:"not_started"},primaryIndexingComplete:o,primaryIndexingCompleteResolve:a,primaryReadiness:new uY,api:void 0,apiResolve:n,apiReady:r,credentials:void 0,credentialsResolve:i,credentialsReady:s,featureFlags:void 0,indexingPolicy:void 0,worker:void 0,workerHost:void 0,checkpoint:void 0,latestCtx:void 0,activeLoader:void 0,lastWidgetStatus:void 0,additionalWorkers:[],lastPrimaryProgress:void 0,primaryCwd:void 0,primaryStartedAt:void 0,primaryDone:void 0,allDoneClearTimer:void 0,indexingGeneration:0,warnings:new Map},e[Jyn]=t}return t.warnings??=new Map,t}async function dct(e=5e3){if(qt.api)return!0;let t=new Promise(n=>setTimeout(n,e));return await Promise.race([qt.apiReady,t]),qt.api?!0:(Io.warn("Augment API client not available \u2014 augment:api event was not emitted."),!1)}function Vqi(e){let t=[],n=new Set;for(let r of e.split(`
218
218
  `)){let s=r.match(/^Path: (.+)$/)?.[1];s&&!n.has(s)&&(n.add(s),t.push(s))}return t}function Gqi(e){let t={workspace:qt.primaryCwd??"(primary)",get checkpoint(){return qt.checkpoint},readiness:qt.primaryReadiness,get indexingState(){return qt.indexing}},n=qt.additionalWorkers.map(r=>({workspace:r.cwd,get checkpoint(){return r.checkpoint},readiness:r.readiness,get indexingState(){return r.indexingState}}));return Yyn({requestedWorkspace:e,primaryWorkspace:t,additionalWorkspaces:n})}function t0n(e){let t=(ne,ue)=>{try{e.events.emit(lT,{event:ne,properties:ue})}catch(le){Io.debug(`segment track publish failed for ${ne}: ${le}`)}};e.registerFlag("wait-for-indexing",{description:"Block the first agent turn until workspace indexing completes (or is skipped / fails). Useful for non-interactive runs.",type:"boolean",default:!1}),e.registerFlag(qyn,{description:"Internal: wait for primary workspace readiness before executing codebase-retrieval. Used by the v2 cloud run-as-agent compatibility path.",type:"boolean",default:!1}),e.registerFlag("allow-indexing",{description:"Automatically allow indexing for the current workspace and skip the confirmation prompt. The workspace is added to the persisted allowlist.",type:"boolean",default:!1}),e.registerFlag("add-workspace",{description:"Internal: path-delimiter-joined list of resolved additional workspace roots to index. Set by main.ts from --add-workspace.",type:"string"}),e.events.on("augment:api",ne=>{qt.api=ne,Io.debug("Received shared Augment API client via augment:api event"),qt.apiResolve?.()}),e.events.on("augment:credentials",ne=>{qt.credentials=ne,Io.debug("Received Augment credentials via augment:credentials event"),qt.credentialsResolve?.()}),e.events.on("augment:indexing-policy",ne=>{qt.indexingPolicy=ne,Io.debug(`Received indexing policy via augment:indexing-policy event (daemonChild=${qt.indexingPolicy.daemonChild})`)});async function n(ne,ue){if(e.getFlag(qyn)!==!0||ne.readiness.isReady||ne.indexingState.kind==="failed"||ne.indexingState.kind==="skipped")return;Io.info(`wait-for-indexing-on-retrieval: blocking codebase-retrieval until ${ne.workspace} is ready`);let le=await Zyn({workspace:ne,timeoutMs:uct,signal:ue});if(le==="aborted"){Io.info(`wait-for-indexing-on-retrieval: cancelled while waiting for ${ne.workspace}`);return}if(le==="timeout"){Io.warn(`wait-for-indexing-on-retrieval: timed out after 10 minutes waiting for ${ne.workspace}; proceeding anyway`);return}Io.info(`wait-for-indexing-on-retrieval: indexing ${ne.indexingState.kind}, proceeding with codebase-retrieval for ${ne.workspace}`)}let r=te.Object({information_request:te.String({description:"A full natural-language question describing what you want to understand, not keywords."}),workspace:te.Optional(te.String({description:"Absolute path of the workspace folder to search. Omit to search the primary workspace."}))}),i={name:"codebase-retrieval",label:"Codebase Retrieval",description:Wqi,parameters:r,async execute(ne,ue,le,W,Q){let j=await dct();if(!j||!qt.api){let we;return qt.indexing.kind==="skipped"||qt.indexing.kind==="failed"?we=Ert(qt.indexing):j?we="Codebase retrieval unavailable: Augment API adapter is not initialized.":we="Codebase retrieval unavailable: Augment API client not ready.",{content:[{type:"text",text:we}],details:{ready:!1,filePaths:[],message:we}}}let Z=Gqi(ue.workspace);if(!Z.ok)return{content:[{type:"text",text:Z.message}],details:{ready:!1,filePaths:[],message:Z.message}};let z=Z.workspace;if(await n(z,le),le?.aborted)throw new DOMException("Codebase retrieval cancelled","AbortError");if(!z.readiness.isReady){let we=Ert(z.indexingState);return{content:[{type:"text",text:we}],details:{ready:!1,filePaths:[],message:we}}}let ce=z.checkpoint,ge=hmn(Q.sessionManager.getBranch()),ee=gmn(ge);Io.debug(`Codebase retrieval [${z.workspace}] with ${ee.length}/${ge.length} chat history exchanges`);let X=Date.now(),$=await qt.api.agentCodebaseRetrieval(qt.api.createRequestId(),ue.information_request,{checkpointId:ce?.checkpointId,addedBlobs:ce?.addedBlobs??[],deletedBlobs:ce?.deletedBlobs??[]},ee,0,void 0,le),se=$.formattedRetrieval||"No results found.",oe=Vqi(se);return{content:[{type:"text",text:se}],details:{ready:!0,filePaths:oe,analytics:{totalElapsedMs:Date.now()-X,codebaseRetrievalElapsedMs:$.codebaseRetrievalElapsedMs,conversationRetrievalElapsedMs:$.conversationRetrievalElapsedMs,conversationInitialRetrievalMs:$.conversationInitialRetrievalMs,conversationQueryRewritingMs:$.conversationQueryRewritingMs,conversationFollowupRetrievalMs:$.conversationFollowupRetrievalMs,blobNameLookupMs:$.blobNameLookupMs,codebaseChunksRetrieved:$.codebaseChunksRetrieved,conversationChunksInitial:$.conversationChunksInitial,conversationQueriesGenerated:$.conversationQueriesGenerated,conversationChunksFollowup:$.conversationChunksFollowup,conversationChunksCombined:$.conversationChunksCombined,codebaseResultLenPreTruncation:$.codebaseResultLenPreTruncation,codebaseResultLen:$.codebaseResultLen,conversationResultLenPreTruncation:$.conversationResultLenPreTruncation,conversationResultLen:$.conversationResultLen,combinedResultLen:$.combinedResultLen,totalBudget:$.totalBudget,codebaseBudget:$.codebaseBudget,conversationBudget:$.conversationBudget,codebaseTruncated:$.codebaseTruncated,conversationTruncated:$.conversationTruncated,finalTruncated:$.finalTruncated}}}},renderCall(ne,ue,le){let W=ne.information_request??"...",Q=le.lastComponent??new Ot("",0,0);return Q.setText(`${ue.fg("toolTitle",ue.bold("codebase-retrieval"))} ${ue.fg("accent",W)}`),Q},renderResult(ne,ue,le,W){let Q=W.lastComponent??new Ot("",0,0),j=ne.details,Z=j?.filePaths??[],z=Hqi(j,ne);if((z?.startsWith("Indexing failed")||z?.startsWith("Not authenticated"))&&z)Q.setText(`
@@ -292,7 +292,7 @@ ${s}${a}`;throw new Error(l)}function Lds(e){let t=e.instancePath?e.instancePath
292
292
 
293
293
  Re-emit the call with a corrected arguments object.`:`
294
294
 
295
- Offending fields: ${e.join(", ")}. Re-emit the call with corrected values for those fields only.`}function Uds(e,t){if(t.params?.missingProperty!==void 0||t.params?.additionalProperty!==void 0||!t.instancePath)return"";let n=Vds(e,t.instancePath);if(n===void 0)return"";if(typeof n=="string")return` (current value: ${n.length>VRe?JSON.stringify(`${n.slice(0,VRe)}\u2026`):JSON.stringify(n)})`;let r;try{r=JSON.stringify(n)}catch{return""}return r===void 0?"":` (current value: ${r.length>VRe?`${r.slice(0,VRe)}\u2026`:r})`}function Vds(e,t){if(t===""||t==="/")return e;let n=t.split("/").slice(1),r=e;for(let i of n){let s=i.replace(/~1/g,"/").replace(/~0/g,"~");if(r==null)return;if(Array.isArray(r)){let o=Number(s);if(!Number.isInteger(o)||o<0)return;r=r[o];continue}if(typeof r!="object")return;r=r[s]}return r}var Oft,Mft,Pft,Nds,kds,nNn,Ods,rNn,Mds,Pds,GRe,Dft,VRe,oNn=C(()=>{"use strict";Oft=_n(oZ(),1),Mft=_n($Rn(),1),Pft=_n(kft(),1),Nds=Oft.default.default||Oft.default,kds=Mft.default.default||Mft.default,nNn=Pft.default.default||Pft.default,Ods=typeof globalThis<"u"&&globalThis.chrome?.runtime?.id!==void 0;rNn={allErrors:!0,strict:!1,coerceTypes:!0},Mds=/^https?:\/\/json-schema\.org\/draft-07\/schema#?$/,Pds=/^https?:\/\/json-schema\.org\/draft\/2020-12\/schema#?$/;GRe=null,Dft=null;if(sNn())try{let e=new Nds(rNn);nNn(e);let t=new kds(rNn);nNn(t),iNn(e,"http://json-schema.org/draft-07/schema#","https://json-schema.org/draft-07/schema"),iNn(t,"https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"),GRe=e,Dft=t}catch{console.warn("AJV validation disabled due to CSP restrictions")}VRe=200});var c4={};li(c4,{AssistantMessageEventStream:()=>jN,EventStream:()=>rD,LEGACY_THINKING_LEVELS:()=>Ywe,StringEnum:()=>rRe,Type:()=>te,appendAssistantMessageDiagnostic:()=>Zdt,calculateCost:()=>irs,calculateDetailedContextUsedTokens:()=>$T,cleanupSessionResources:()=>nis,clearApiProviders:()=>Vdt,complete:()=>upt,completeSimple:()=>ib,createAssistantMessageDiagnostic:()=>prs,createAssistantMessageEventStream:()=>brs,createAugmentTransportErrorDiagnostic:()=>zdt,discoverAugmentModels:()=>X3,extractDiagnosticError:()=>iTn,findAugmentTransportErrorContext:()=>Rv,findEnvKeys:()=>qCn,formatThrownValue:()=>rTn,formatUnsupportedReasoningEffort:()=>rm,getApiProvider:()=>j3,getApiProviders:()=>jns,getEnvApiKey:()=>WT,getModel:()=>rrs,getModels:()=>hae,getOrCreateAugmentClient:()=>rl,getOverflowPatterns:()=>dis,getProviders:()=>fae,isContextOverflow:()=>XN,isContextOverflowErrorText:()=>WY,isDetailedContextUsage:()=>TA,isLegacyThinkingLevel:()=>rb,isModelUnavailableErrorText:()=>yae,modelsAreEqual:()=>co,normalizeReasoningEfforts:()=>zwe,parseAugmentTransportErrorDiagnostic:()=>oTn,parseJsonWithRepair:()=>WTn,parseStreamingJson:()=>fpt,reasoningSelectionLabel:()=>IA,reasoningSelections:()=>zf,registerApiProvider:()=>Z3,registerBuiltInApiProviders:()=>apt,registerSessionResourceCleanup:()=>tis,repairJson:()=>mpt,resetApiProviders:()=>zN,resolveReasoningCapabilities:()=>Xu,resolveReasoningSelection:()=>ss,sanitizeAugmentTransportErrorContext:()=>gae,stream:()=>FTn,streamAugment:()=>GY,streamSimple:()=>QT,streamSimpleAugment:()=>DTn,supportsXhigh:()=>eTn,toProviderStopReason:()=>Hdt,unregisterApiProviders:()=>zns,validateToolArguments:()=>WRe,validateToolCall:()=>Bds});var Bi=C(()=>{"use strict";us();$we();Qdt();Ydt();opt();lpt();BTn();UTn();Zwe();Xdt();Kwe();$Tn();HTn();YTn();oNn()});var fD,Bft=C(()=>{fD={name:"@augmentcode/auggie-v2",version:"1.2.0",description:"Auggie CLI Client by Augment Code",type:"module",piConfig:{name:"auggie",configDir:".augment"},bin:{auggie:"dist/cli.js","auggie-v2":"dist/cli.js",pi:"dist/cli.js"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{source:"./src/index.ts",types:"./dist/index.d.ts",import:"./dist/index.js"},"./hooks":{types:"./dist/core/hooks/index.d.ts",import:"./dist/core/hooks/index.js"}},files:["dist","docs","examples","CHANGELOG.md"],scripts:{"check-types":"pnpm run bake:export-html && tsgo -p tsconfig.build.json",clean:"shx rm -rf dist",banners:"tsx --conditions=source scripts/print-banners.ts","cli:source":"tsx --conditions=source src/cli.ts",dev:"pnpm run bake:export-html && pnpm run cli:source","dev:debug":"pnpm run bake:export-html && node --conditions=source --inspect-wait=ws://localhost:6499/57uz7t2uyri --import tsx src/cli.ts","bake:export-html":"node scripts/bake-export-html.mjs",build:"pnpm run bake:export-html && tsgo -p tsconfig.build.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm:release":"node scripts/build-npm-release.mjs","build:migration-engine":"node scripts/build-migration-engine.mjs","build:release:sea":"node scripts/build-sea-release.mjs","build:release:sea:from-onison":"node scripts/build-sea-from-onison.mjs","build:release-js":"pnpm run bake:export-html && tsgo -p tsconfig.release.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm":"pnpm run build:npm:release","clean:npm-artifacts":"find dist -name '*.js' -not -path 'dist/cli.js' -not -path 'dist/index.js' -not -path 'dist/release/*' -not -path 'dist/core/export-html/*' -delete && find dist -name '*.js.map' -delete","copy-assets":"shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/",test:"pnpm run bake:export-html && vitest --run","test:acp:e2e":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/acp/","test:e2e:sanity":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/tui/sanity.test.ts","test:e2e:tui":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/tui/","test:e2e:cli":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/cli/",prepublishOnly:"pnpm run clean && pnpm run build"},dependencies:{"@agentclientprotocol/sdk":"1.4.0","@augmentcode/api-client":"workspace:*","@earendil-works/pi-agent-core":"workspace:*","@earendil-works/pi-ai":"workspace:*","@earendil-works/pi-indexing":"workspace:*","@earendil-works/pi-tui":"workspace:*","@hermes/ask-user":"workspace:*","@hermes/augment-legacy-tools":"workspace:*","@hermes/btw":"workspace:*","@hermes/cloud":"workspace:*","@hermes/context-usage":"workspace:*","@hermes/cosmos":"workspace:*","@hermes/daemon":"workspace:*","@hermes/git-credentials":"workspace:*","@hermes/hashline-edit":"workspace:*","@hermes/hooks":"workspace:*","@hermes/import-sessions":"workspace:*","@hermes/logger":"workspace:*","@hermes/lsp":"workspace:*","@hermes/mcp":"workspace:*","@hermes/migration":"workspace:*","@hermes/open-browser":"workspace:*","@hermes/otel":"workspace:*","@hermes/path-utils":"workspace:*","@hermes/plugins":"workspace:*","@hermes/prompt-enhancer":"workspace:*","@hermes/segment-analytics":"workspace:*","@hermes/sentry":"workspace:*","@hermes/settings":"workspace:*","@hermes/shared-types":"workspace:*","@hermes/subagents":"workspace:*","@hermes/tool-permissions":"workspace:*","@mariozechner/jiti":"^2.6.2","@sentry/node":"^10.53.1","@silvia-odwyer/photon-node":"^0.3.4","@sinclair/typebox":"^0.34.41",ajv:"^8.17.1",chalk:"^5.5.0","cli-highlight":"^2.1.11",diff:"^8.0.2","extract-zip":"^2.0.1",fdir:"^6.5.0","file-type":"^21.1.1",glob:"^13.0.1","hosted-git-info":"^9.0.2",ignore:"^7.0.5",jimp:"^1.6.1","jsonc-parser":"3.3.1",marked:"^15.0.12",minimatch:"^10.2.3","proper-lockfile":"^4.1.2","strip-ansi":"^7.1.0",turndown:"^7.2.4",undici:"^7.19.1",yaml:"^2.8.2",zod:"^4.4.3"},overrides:{rimraf:"6.1.2",gaxios:{rimraf:"6.1.2"}},optionalDependencies:{"@mariozechner/clipboard":"^0.3.2"},devDependencies:{"@tintinweb/pi-subagents":"workspace:*","@types/diff":"^7.0.2","@types/hosted-git-info":"^3.0.5","@types/ms":"^2.1.0","@types/node":"^24.3.0","@types/proper-lockfile":"^4.1.4","@types/turndown":"^5.0.5",level:"^10.0.0",shx:"^0.4.0",tsx:"^4.21.0",typescript:"^5.7.3",vitest:"^3.2.4"},keywords:["coding-agent","ai","llm","cli","tui","agent"],author:"Mario Zechner",license:"MIT",repository:{type:"git",url:"git+https://github.com/badlogic/pi-mono.git",directory:"packages/coding-agent"},engines:{node:">=20.6.0"}}});import{existsSync as Wds}from"node:fs";import{homedir as Xae}from"node:os";import{dirname as Lft,join as Dv,resolve as lNn}from"node:path";import{fileURLToPath as $ds}from"node:url";function cNn(){let e=process.env.PI_PACKAGE_DIR;if(e)return e==="~"?Xae():e.startsWith("~/")?Xae()+e.slice(1):e;let t=aNn;for(;t!==Lft(t);){if(Wds(Dv(t,"package.json")))return t;t=Lft(t)}return aNn}function $Re(){return lNn(Dv(cNn(),"docs"))}function QRe(){return lNn(Dv(cNn(),"CHANGELOG.md"))}function mNn(e){return e==="~"?Xae():e.startsWith("~/")?Xae()+e.slice(1):e}function XT(){let e=process.env.AUGMENT_CACHE_DIR;return e?mNn(e):Dv(Xae(),".augment")}function Dr(){let e=process.env[Fft];return e?mNn(e):XT()}function Jae(){return Dv(Dr(),"themes")}function fNn(){return Dv(Dr(),"models.json")}function hNn(){return Dv(Dr(),"auth.json")}function gNn(){return Dv(Dr(),"settings.json")}function wA(){return XT()}function dZ(){return Dv(Dr(),"bin")}function bNn(){return Dv(Dr(),qae)}function yNn(){return Dv(Dr(),`${Jr}-debug.log`)}var Qds,aNn,Jr,Ms,qae,Kae,uNn,Hds,gs,dNn,pNn,Fft,Us=C(()=>{"use strict";Bft();Qds=$ds(import.meta.url),aNn=Lft(Qds);Jr=fD.piConfig?.name||"auggie",Ms=fD.piConfig?.configDir||".augment",qae="sessions-v2",Kae=Jr,uNn="Auggie Coding Agent",Hds="1.2.0-prerelease.202611050911",gs=Hds??fD.version,dNn="663f865a9cbbbc67593e89337b3ad0a0d324684b",pNn="2026-11-05T17:11:41Z",Fft=`${Jr.toUpperCase()}_CODING_AGENT_DIR`});function Uft(...e){return new globalThis.Function(...e)}var ANn=C(()=>{});var HRe,YRe,Vft,ENn=C(()=>{oP();AH();Fr();Vc();HRe=class extends vi{constructor(t){super(`Duplicate type kind '${t}' detected`)}},YRe=class extends vi{constructor(t){super(`Duplicate string format '${t}' detected`)}};(function(e){function t(r,i){if(wp.Has(r))throw new HRe(r);return wp.Set(r,i),(s={})=>vP({...s,[on]:r})}e.Type=t;function n(r,i){if(jh.Has(r))throw new YRe(r);return jh.Set(r,i),r}e.Format=n})(Vft||(Vft={}))});var u4={};li(u4,{Evaluate:()=>Uft,TypeSystem:()=>Vft,TypeSystemDuplicateFormat:()=>YRe,TypeSystemDuplicateTypeKind:()=>HRe,TypeSystemPolicy:()=>mc});var pZ=C(()=>{ANn();Oie();ENn()});function _Nn(e){switch(e.errorType){case an.ArrayContains:return"Expected array to contain at least one matching value";case an.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case an.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case an.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case an.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case an.ArrayUniqueItems:return"Expected array elements to be unique";case an.Array:return"Expected array";case an.AsyncIterator:return"Expected AsyncIterator";case an.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case an.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case an.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case an.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case an.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case an.BigInt:return"Expected bigint";case an.Boolean:return"Expected boolean";case an.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case an.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case an.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case an.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case an.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case an.Date:return"Expected Date";case an.Function:return"Expected function";case an.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case an.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case an.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case an.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case an.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case an.Integer:return"Expected integer";case an.IntersectUnevaluatedProperties:return"Unexpected property";case an.Intersect:return"Expected all values to match";case an.Iterator:return"Expected Iterator";case an.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case an.Never:return"Never";case an.Not:return"Value should not match";case an.Null:return"Expected null";case an.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case an.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case an.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case an.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case an.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case an.Number:return"Expected number";case an.Object:return"Expected object";case an.ObjectAdditionalProperties:return"Unexpected property";case an.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case an.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case an.ObjectRequiredProperty:return"Expected required property";case an.Promise:return"Expected Promise";case an.RegExp:return"Expected string to match regular expression";case an.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case an.StringFormat:return`Expected string to match '${e.schema.format}' format`;case an.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case an.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case an.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case an.String:return"Expected string";case an.Symbol:return"Expected symbol";case an.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case an.Tuple:return"Expected tuple";case an.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case an.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case an.Uint8Array:return"Expected Uint8Array";case an.Undefined:return"Expected undefined";case an.Union:return"Expected union value";case an.Void:return"Expected void";case an.Kind:return`Expected kind '${e.schema[on]}'`;default:return"Unknown error type"}}function Yds(e){SNn=e}function Gft(){return SNn}var SNn,Wft=C(()=>{Fr();$ft();SNn=_Nn});function Zds(e,t){let n=t.find(r=>r.$id===e.$ref);if(n===void 0)throw new Qft(e);return aa(n,t)}function $m(e,t){return!Uo(e.$id)||t.some(n=>n.$id===e.$id)||t.push(e),t}function aa(e,t){return e[on]==="This"||e[on]==="Ref"?Zds(e,t):e}var Qft,vNn=C(()=>{Vc();Fr();axe();Qft=class extends vi{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}}});var lS=C(()=>{vNn()});function*qds(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let n=0;n<t;n++)yield e>>8*(t-1-n)&255}function Kds(e){sg(RA.Array);for(let t of e)fZ(t)}function Jds(e){sg(RA.Boolean),sg(e?1:0)}function eps(e){sg(RA.BigInt),CNn.setBigInt64(0,e);for(let t of TNn)sg(t)}function tps(e){sg(RA.Date),fZ(e.getTime())}function nps(e){sg(RA.Null)}function rps(e){sg(RA.Number),CNn.setFloat64(0,e);for(let t of TNn)sg(t)}function ips(e){sg(RA.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())fZ(t),fZ(e[t])}function sps(e){sg(RA.String);for(let t=0;t<e.length;t++)for(let n of qds(e.charCodeAt(t)))sg(n)}function ops(e){sg(RA.Symbol),fZ(e.description)}function aps(e){sg(RA.Uint8Array);for(let t=0;t<e.length;t++)sg(e[t])}function lps(e){return sg(RA.Undefined)}function fZ(e){if(wi(e))return Kds(e);if(yv(e))return Jds(e);if(Fm(e))return eps(e);if(Hh(e))return tps(e);if(uT(e))return nps(e);if(pi(e))return rps(e);if(ms(e))return ips(e);if(Uo(e))return sps(e);if(pT(e))return ops(e);if(WU(e))return aps(e);if(Nc(e))return lps(e);throw new ZRe(e)}function sg(e){mZ=mZ^Xds[e],mZ=mZ*jds%zds}function ek(e){return mZ=BigInt("14695981039346656037"),fZ(e),mZ}var ZRe,RA,mZ,jds,zds,Xds,xNn,CNn,TNn,INn=C(()=>{Ip();Vc();ZRe=class extends vi{constructor(t){super("Unable to hash value"),this.value=t}};(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(RA||(RA={}));mZ=BigInt("14695981039346656037"),[jds,zds]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Xds=Array.from({length:256}).map((e,t)=>BigInt(t)),xNn=new Float64Array(1),CNn=new DataView(xNn.buffer),TNn=new Uint8Array(xNn.buffer)});var hZ=C(()=>{INn()});function cps(e){return e[on]==="Any"||e[on]==="Unknown"}function Vo(e){return e!==void 0}function ups(e,t,n){return!0}function dps(e,t,n){return!0}function pps(e,t,n){if(!wi(n)||Vo(e.minItems)&&!(n.length>=e.minItems)||Vo(e.maxItems)&&!(n.length<=e.maxItems))return!1;for(let s of n)if(!Qm(e.items,t,s))return!1;if(e.uniqueItems===!0&&!(function(){let s=new Set;for(let o of n){let a=ek(o);if(s.has(a))return!1;s.add(a)}return!0})())return!1;if(!(Vo(e.contains)||pi(e.minContains)||pi(e.maxContains)))return!0;let r=Vo(e.contains)?e.contains:Gi(),i=n.reduce((s,o)=>Qm(r,t,o)?s+1:s,0);return!(i===0||pi(e.minContains)&&i<e.minContains||pi(e.maxContains)&&i>e.maxContains)}function mps(e,t,n){return wie(n)}function fps(e,t,n){return!(!Fm(n)||Vo(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Vo(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Vo(e.maximum)&&!(n<=e.maximum)||Vo(e.minimum)&&!(n>=e.minimum)||Vo(e.multipleOf)&&n%e.multipleOf!==BigInt(0))}function hps(e,t,n){return yv(n)}function gps(e,t,n){return Qm(e.returns,t,n.prototype)}function bps(e,t,n){return!(!Hh(n)||Vo(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)||Vo(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)||Vo(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)||Vo(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)||Vo(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)}function yps(e,t,n){return dT(n)}function Aps(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Qm(i,[...t,...r],n)}function Eps(e,t,n){return!(!kie(n)||Vo(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Vo(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Vo(e.maximum)&&!(n<=e.maximum)||Vo(e.minimum)&&!(n>=e.minimum)||Vo(e.multipleOf)&&n%e.multipleOf!==0)}function _ps(e,t,n){let r=e.allOf.every(i=>Qm(i,t,n));if(e.unevaluatedProperties===!1){let i=new RegExp(Ev(e)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o));return r&&s}else if(Gc(e.unevaluatedProperties)){let i=new RegExp(Ev(e)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o)||Qm(e.unevaluatedProperties,t,n[o]));return r&&s}else return r}function Sps(e,t,n){return Rie(n)}function vps(e,t,n){return n===e.const}function xps(e,t,n){return!1}function Cps(e,t,n){return!Qm(e.not,t,n)}function Tps(e,t,n){return uT(n)}function Ips(e,t,n){return!(!mc.IsNumberLike(n)||Vo(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Vo(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Vo(e.minimum)&&!(n>=e.minimum)||Vo(e.maximum)&&!(n<=e.maximum)||Vo(e.multipleOf)&&n%e.multipleOf!==0)}function wps(e,t,n){if(!mc.IsObjectLike(n)||Vo(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||Vo(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let i of r){let s=e.properties[i];if(e.required&&e.required.includes(i)){if(!Qm(s,t,n[i])||(_v(s)||cps(s))&&!(i in n))return!1}else if(mc.IsExactOptionalProperty(n,i)&&!Qm(s,t,n[i]))return!1}if(e.additionalProperties===!1){let i=Object.getOwnPropertyNames(n);return e.required&&e.required.length===r.length&&i.length===r.length?!0:i.every(s=>r.includes(s))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(n).every(s=>r.includes(s)||Qm(e.additionalProperties,t,n[s])):!0}function Rps(e,t,n){return Nie(n)}function Nps(e,t,n){if(!mc.IsRecordLike(n)||Vo(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||Vo(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let[r,i]=Object.entries(e.patternProperties)[0],s=new RegExp(r),o=Object.entries(n).every(([u,c])=>s.test(u)?Qm(i,t,c):!0),a=typeof e.additionalProperties=="object"?Object.entries(n).every(([u,c])=>s.test(u)?!0:Qm(e.additionalProperties,t,c)):!0,l=e.additionalProperties===!1?Object.getOwnPropertyNames(n).every(u=>s.test(u)):!0;return o&&a&&l}function kps(e,t,n){return Qm(aa(e,t),t,n)}function Ops(e,t,n){let r=new RegExp(e.source,e.flags);return Vo(e.minLength)&&!(n.length>=e.minLength)||Vo(e.maxLength)&&!(n.length<=e.maxLength)?!1:r.test(n)}function Mps(e,t,n){return!Uo(n)||Vo(e.minLength)&&!(n.length>=e.minLength)||Vo(e.maxLength)&&!(n.length<=e.maxLength)||Vo(e.pattern)&&!new RegExp(e.pattern).test(n)?!1:Vo(e.format)?jh.Has(e.format)?jh.Get(e.format)(n):!1:!0}function Pps(e,t,n){return pT(n)}function Dps(e,t,n){return Uo(n)&&new RegExp(e.pattern).test(n)}function Bps(e,t,n){return Qm(aa(e,t),t,n)}function Lps(e,t,n){if(!wi(n)||e.items===void 0&&n.length!==0||n.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!Qm(e.items[r],t,n[r]))return!1;return!0}function Fps(e,t,n){return Nc(n)}function Ups(e,t,n){return e.anyOf.some(r=>Qm(r,t,n))}function Vps(e,t,n){return!(!WU(n)||Vo(e.maxByteLength)&&!(n.length<=e.maxByteLength)||Vo(e.minByteLength)&&!(n.length>=e.minByteLength))}function Gps(e,t,n){return!0}function Wps(e,t,n){return mc.IsVoidLike(n)}function $ps(e,t,n){return wp.Has(e[on])?wp.Get(e[on])(e,n):!1}function Qm(e,t,n){let r=Vo(e.$id)?$m(e,t):t,i=e;switch(i[on]){case"Any":return ups(i,r,n);case"Argument":return dps(i,r,n);case"Array":return pps(i,r,n);case"AsyncIterator":return mps(i,r,n);case"BigInt":return fps(i,r,n);case"Boolean":return hps(i,r,n);case"Constructor":return gps(i,r,n);case"Date":return bps(i,r,n);case"Function":return yps(i,r,n);case"Import":return Aps(i,r,n);case"Integer":return Eps(i,r,n);case"Intersect":return _ps(i,r,n);case"Iterator":return Sps(i,r,n);case"Literal":return vps(i,r,n);case"Never":return xps(i,r,n);case"Not":return Cps(i,r,n);case"Null":return Tps(i,r,n);case"Number":return Ips(i,r,n);case"Object":return wps(i,r,n);case"Promise":return Rps(i,r,n);case"Record":return Nps(i,r,n);case"Ref":return kps(i,r,n);case"RegExp":return Ops(i,r,n);case"String":return Mps(i,r,n);case"Symbol":return Pps(i,r,n);case"TemplateLiteral":return Dps(i,r,n);case"This":return Bps(i,r,n);case"Tuple":return Lps(i,r,n);case"Undefined":return Fps(i,r,n);case"Union":return Ups(i,r,n);case"Uint8Array":return Vps(i,r,n);case"Unknown":return Gps(i,r,n);case"Void":return Wps(i,r,n);default:if(!wp.Has(i[on]))throw new jRe(i);return $ps(i,r,n)}}function Vs(...e){return e.length===3?Qm(e[0],e[1],e[2]):Qm(e[0],[],e[1])}var jRe,Hft=C(()=>{pZ();lS();hZ();Fr();hA();mP();oP();Vc();fd();Ip();Ks();jRe=class extends vi{constructor(t){super("Unknown type"),this.schema=t}}});var NA=C(()=>{Hft()});function tk(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Go(e){return e!==void 0}function yr(e,t,n,r,i=[]){return{type:e,schema:t,path:n,value:r,message:Gft()({errorType:e,path:n,schema:t,value:r,errors:i}),errors:i}}function*Qps(e,t,n,r){}function*Hps(e,t,n,r){}function*Yps(e,t,n,r){if(!wi(r))return yield yr(an.Array,e,n,r);Go(e.minItems)&&!(r.length>=e.minItems)&&(yield yr(an.ArrayMinItems,e,n,r)),Go(e.maxItems)&&!(r.length<=e.maxItems)&&(yield yr(an.ArrayMaxItems,e,n,r));for(let o=0;o<r.length;o++)yield*Hm(e.items,t,`${n}/${o}`,r[o]);if(e.uniqueItems===!0&&!(function(){let o=new Set;for(let a of r){let l=ek(a);if(o.has(l))return!1;o.add(l)}return!0})()&&(yield yr(an.ArrayUniqueItems,e,n,r)),!(Go(e.contains)||Go(e.minContains)||Go(e.maxContains)))return;let i=Go(e.contains)?e.contains:Gi(),s=r.reduce((o,a,l)=>Hm(i,t,`${n}${l}`,a).next().done===!0?o+1:o,0);s===0&&(yield yr(an.ArrayContains,e,n,r)),pi(e.minContains)&&s<e.minContains&&(yield yr(an.ArrayMinContains,e,n,r)),pi(e.maxContains)&&s>e.maxContains&&(yield yr(an.ArrayMaxContains,e,n,r))}function*Zps(e,t,n,r){wie(r)||(yield yr(an.AsyncIterator,e,n,r))}function*jps(e,t,n,r){if(!Fm(r))return yield yr(an.BigInt,e,n,r);Go(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.BigIntExclusiveMaximum,e,n,r)),Go(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.BigIntExclusiveMinimum,e,n,r)),Go(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.BigIntMaximum,e,n,r)),Go(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.BigIntMinimum,e,n,r)),Go(e.multipleOf)&&r%e.multipleOf!==BigInt(0)&&(yield yr(an.BigIntMultipleOf,e,n,r))}function*zps(e,t,n,r){yv(r)||(yield yr(an.Boolean,e,n,r))}function*Xps(e,t,n,r){yield*Hm(e.returns,t,n,r.prototype)}function*qps(e,t,n,r){if(!Hh(r))return yield yr(an.Date,e,n,r);Go(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)&&(yield yr(an.DateExclusiveMaximumTimestamp,e,n,r)),Go(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)&&(yield yr(an.DateExclusiveMinimumTimestamp,e,n,r)),Go(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)&&(yield yr(an.DateMaximumTimestamp,e,n,r)),Go(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)&&(yield yr(an.DateMinimumTimestamp,e,n,r)),Go(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0&&(yield yr(an.DateMultipleOfTimestamp,e,n,r))}function*Kps(e,t,n,r){dT(r)||(yield yr(an.Function,e,n,r))}function*Jps(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref];yield*Hm(s,[...t,...i],n,r)}function*ems(e,t,n,r){if(!kie(r))return yield yr(an.Integer,e,n,r);Go(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.IntegerExclusiveMaximum,e,n,r)),Go(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.IntegerExclusiveMinimum,e,n,r)),Go(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.IntegerMaximum,e,n,r)),Go(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.IntegerMinimum,e,n,r)),Go(e.multipleOf)&&r%e.multipleOf!==0&&(yield yr(an.IntegerMultipleOf,e,n,r))}function*tms(e,t,n,r){let i=!1;for(let s of e.allOf)for(let o of Hm(s,t,n,r))i=!0,yield o;if(i)return yield yr(an.Intersect,e,n,r);if(e.unevaluatedProperties===!1){let s=new RegExp(Ev(e));for(let o of Object.getOwnPropertyNames(r))s.test(o)||(yield yr(an.IntersectUnevaluatedProperties,e,`${n}/${o}`,r))}if(typeof e.unevaluatedProperties=="object"){let s=new RegExp(Ev(e));for(let o of Object.getOwnPropertyNames(r))if(!s.test(o)){let a=Hm(e.unevaluatedProperties,t,`${n}/${o}`,r[o]).next();a.done||(yield a.value)}}}function*nms(e,t,n,r){Rie(r)||(yield yr(an.Iterator,e,n,r))}function*rms(e,t,n,r){r!==e.const&&(yield yr(an.Literal,e,n,r))}function*ims(e,t,n,r){yield yr(an.Never,e,n,r)}function*sms(e,t,n,r){Hm(e.not,t,n,r).next().done===!0&&(yield yr(an.Not,e,n,r))}function*oms(e,t,n,r){uT(r)||(yield yr(an.Null,e,n,r))}function*ams(e,t,n,r){if(!mc.IsNumberLike(r))return yield yr(an.Number,e,n,r);Go(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.NumberExclusiveMaximum,e,n,r)),Go(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.NumberExclusiveMinimum,e,n,r)),Go(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.NumberMaximum,e,n,r)),Go(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.NumberMinimum,e,n,r)),Go(e.multipleOf)&&r%e.multipleOf!==0&&(yield yr(an.NumberMultipleOf,e,n,r))}function*lms(e,t,n,r){if(!mc.IsObjectLike(r))return yield yr(an.Object,e,n,r);Go(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield yr(an.ObjectMinProperties,e,n,r)),Go(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield yr(an.ObjectMaxProperties,e,n,r));let i=Array.isArray(e.required)?e.required:[],s=Object.getOwnPropertyNames(e.properties),o=Object.getOwnPropertyNames(r);for(let a of i)o.includes(a)||(yield yr(an.ObjectRequiredProperty,e.properties[a],`${n}/${tk(a)}`,void 0));if(e.additionalProperties===!1)for(let a of o)s.includes(a)||(yield yr(an.ObjectAdditionalProperties,e,`${n}/${tk(a)}`,r[a]));if(typeof e.additionalProperties=="object")for(let a of o)s.includes(a)||(yield*Hm(e.additionalProperties,t,`${n}/${tk(a)}`,r[a]));for(let a of s){let l=e.properties[a];e.required&&e.required.includes(a)?(yield*Hm(l,t,`${n}/${tk(a)}`,r[a]),_v(e)&&!(a in r)&&(yield yr(an.ObjectRequiredProperty,l,`${n}/${tk(a)}`,void 0))):mc.IsExactOptionalProperty(r,a)&&(yield*Hm(l,t,`${n}/${tk(a)}`,r[a]))}}function*cms(e,t,n,r){Nie(r)||(yield yr(an.Promise,e,n,r))}function*ums(e,t,n,r){if(!mc.IsRecordLike(r))return yield yr(an.Object,e,n,r);Go(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield yr(an.ObjectMinProperties,e,n,r)),Go(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield yr(an.ObjectMaxProperties,e,n,r));let[i,s]=Object.entries(e.patternProperties)[0],o=new RegExp(i);for(let[a,l]of Object.entries(r))o.test(a)&&(yield*Hm(s,t,`${n}/${tk(a)}`,l));if(typeof e.additionalProperties=="object")for(let[a,l]of Object.entries(r))o.test(a)||(yield*Hm(e.additionalProperties,t,`${n}/${tk(a)}`,l));if(e.additionalProperties===!1){for(let[a,l]of Object.entries(r))if(!o.test(a))return yield yr(an.ObjectAdditionalProperties,e,`${n}/${tk(a)}`,l)}}function*dms(e,t,n,r){yield*Hm(aa(e,t),t,n,r)}function*pms(e,t,n,r){if(!Uo(r))return yield yr(an.String,e,n,r);if(Go(e.minLength)&&!(r.length>=e.minLength)&&(yield yr(an.StringMinLength,e,n,r)),Go(e.maxLength)&&!(r.length<=e.maxLength)&&(yield yr(an.StringMaxLength,e,n,r)),!new RegExp(e.source,e.flags).test(r))return yield yr(an.RegExp,e,n,r)}function*mms(e,t,n,r){if(!Uo(r))return yield yr(an.String,e,n,r);Go(e.minLength)&&!(r.length>=e.minLength)&&(yield yr(an.StringMinLength,e,n,r)),Go(e.maxLength)&&!(r.length<=e.maxLength)&&(yield yr(an.StringMaxLength,e,n,r)),Uo(e.pattern)&&(new RegExp(e.pattern).test(r)||(yield yr(an.StringPattern,e,n,r))),Uo(e.format)&&(jh.Has(e.format)?jh.Get(e.format)(r)||(yield yr(an.StringFormat,e,n,r)):yield yr(an.StringFormatUnknown,e,n,r))}function*fms(e,t,n,r){pT(r)||(yield yr(an.Symbol,e,n,r))}function*hms(e,t,n,r){if(!Uo(r))return yield yr(an.String,e,n,r);new RegExp(e.pattern).test(r)||(yield yr(an.StringPattern,e,n,r))}function*gms(e,t,n,r){yield*Hm(aa(e,t),t,n,r)}function*bms(e,t,n,r){if(!wi(r))return yield yr(an.Tuple,e,n,r);if(e.items===void 0&&r.length!==0)return yield yr(an.TupleLength,e,n,r);if(r.length!==e.maxItems)return yield yr(an.TupleLength,e,n,r);if(e.items)for(let i=0;i<e.items.length;i++)yield*Hm(e.items[i],t,`${n}/${i}`,r[i])}function*yms(e,t,n,r){Nc(r)||(yield yr(an.Undefined,e,n,r))}function*Ams(e,t,n,r){if(Vs(e,t,r))return;let i=e.anyOf.map(s=>new kA(Hm(s,t,n,r)));yield yr(an.Union,e,n,r,i)}function*Ems(e,t,n,r){if(!WU(r))return yield yr(an.Uint8Array,e,n,r);Go(e.maxByteLength)&&!(r.length<=e.maxByteLength)&&(yield yr(an.Uint8ArrayMaxByteLength,e,n,r)),Go(e.minByteLength)&&!(r.length>=e.minByteLength)&&(yield yr(an.Uint8ArrayMinByteLength,e,n,r))}function*_ms(e,t,n,r){}function*Sms(e,t,n,r){mc.IsVoidLike(r)||(yield yr(an.Void,e,n,r))}function*vms(e,t,n,r){wp.Get(e[on])(e,r)||(yield yr(an.Kind,e,n,r))}function*Hm(e,t,n,r){let i=Go(e.$id)?[...t,e]:t,s=e;switch(s[on]){case"Any":return yield*Qps(s,i,n,r);case"Argument":return yield*Hps(s,i,n,r);case"Array":return yield*Yps(s,i,n,r);case"AsyncIterator":return yield*Zps(s,i,n,r);case"BigInt":return yield*jps(s,i,n,r);case"Boolean":return yield*zps(s,i,n,r);case"Constructor":return yield*Xps(s,i,n,r);case"Date":return yield*qps(s,i,n,r);case"Function":return yield*Kps(s,i,n,r);case"Import":return yield*Jps(s,i,n,r);case"Integer":return yield*ems(s,i,n,r);case"Intersect":return yield*tms(s,i,n,r);case"Iterator":return yield*nms(s,i,n,r);case"Literal":return yield*rms(s,i,n,r);case"Never":return yield*ims(s,i,n,r);case"Not":return yield*sms(s,i,n,r);case"Null":return yield*oms(s,i,n,r);case"Number":return yield*ams(s,i,n,r);case"Object":return yield*lms(s,i,n,r);case"Promise":return yield*cms(s,i,n,r);case"Record":return yield*ums(s,i,n,r);case"Ref":return yield*dms(s,i,n,r);case"RegExp":return yield*pms(s,i,n,r);case"String":return yield*mms(s,i,n,r);case"Symbol":return yield*fms(s,i,n,r);case"TemplateLiteral":return yield*hms(s,i,n,r);case"This":return yield*gms(s,i,n,r);case"Tuple":return yield*bms(s,i,n,r);case"Undefined":return yield*yms(s,i,n,r);case"Union":return yield*Ams(s,i,n,r);case"Uint8Array":return yield*Ems(s,i,n,r);case"Unknown":return yield*_ms(s,i,n,r);case"Void":return yield*Sms(s,i,n,r);default:if(!wp.Has(s[on]))throw new zRe(e);return yield*vms(s,i,n,r)}}function Bv(...e){let t=e.length===3?Hm(e[0],e[1],"",e[2]):Hm(e[0],[],"",e[1]);return new kA(t)}var an,zRe,kA,$ft=C(()=>{pZ();hA();oP();Dxe();Wft();Vc();lS();hZ();NA();Fr();fd();Ip();(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(an||(an={}));zRe=class extends vi{constructor(t){super("Unknown type"),this.schema=t}};kA=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}}});var d4={};li(d4,{DefaultErrorFunction:()=>_Nn,Errors:()=>Bv,GetErrorFunction:()=>Gft,SetErrorFunction:()=>Yds,ValueErrorIterator:()=>kA,ValueErrorType:()=>an,ValueErrorsUnknownTypeError:()=>zRe});var qT=C(()=>{$ft();Wft()});function _u(e,t,n){try{return fa(e)?e[kc].Decode(n):n}catch(r){throw new XRe(e,t,n,r)}}function xms(e,t,n,r){return wi(r)?_u(e,n,r.map((i,s)=>Lv(e.items,t,`${n}/${s}`,i))):_u(e,n,r)}function Cms(e,t,n,r){if(!ms(r)||ky(r))return _u(e,n,r);let i=X7(e),s=i.map(c=>c[0]),o={...r};for(let[c,d]of i)c in o&&(o[c]=Lv(d,t,`${n}/${c}`,o[c]));if(!fa(e.unevaluatedProperties))return _u(e,n,o);let a=Object.getOwnPropertyNames(o),l=e.unevaluatedProperties,u={...o};for(let c of a)s.includes(c)||(u[c]=_u(l,`${n}/${c}`,u[c]));return _u(e,n,u)}function Tms(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],o=Lv(s,[...t,...i],n,r);return _u(e,n,o)}function Ims(e,t,n,r){return _u(e,n,Lv(e.not,t,n,r))}function wms(e,t,n,r){if(!ms(r))return _u(e,n,r);let i=Kh(e),s={...r};for(let u of i)Vi(s,u)&&(Nc(s[u])&&(!hT(e.properties[u])||mc.IsExactOptionalProperty(s,u))||(s[u]=Lv(e.properties[u],t,`${n}/${u}`,s[u])));if(!Gc(e.additionalProperties))return _u(e,n,s);let o=Object.getOwnPropertyNames(s),a=e.additionalProperties,l={...s};for(let u of o)i.includes(u)||(l[u]=_u(a,`${n}/${u}`,l[u]));return _u(e,n,l)}function Rms(e,t,n,r){if(!ms(r))return _u(e,n,r);let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),o={...r};for(let c of Object.getOwnPropertyNames(r))s.test(c)&&(o[c]=Lv(e.patternProperties[i],t,`${n}/${c}`,o[c]));if(!Gc(e.additionalProperties))return _u(e,n,o);let a=Object.getOwnPropertyNames(o),l=e.additionalProperties,u={...o};for(let c of a)s.test(c)||(u[c]=_u(l,`${n}/${c}`,u[c]));return _u(e,n,u)}function Nms(e,t,n,r){let i=aa(e,t);return _u(e,n,Lv(i,t,n,r))}function kms(e,t,n,r){let i=aa(e,t);return _u(e,n,Lv(i,t,n,r))}function Oms(e,t,n,r){return wi(r)&&wi(e.items)?_u(e,n,e.items.map((i,s)=>Lv(i,t,`${n}/${s}`,r[s]))):_u(e,n,r)}function Mms(e,t,n,r){for(let i of e.anyOf){if(!Vs(i,t,r))continue;let s=Lv(i,t,n,r);return _u(e,n,s)}return _u(e,n,r)}function Lv(e,t,n,r){let i=$m(e,t),s=e;switch(e[on]){case"Array":return xms(s,i,n,r);case"Import":return Tms(s,i,n,r);case"Intersect":return Cms(s,i,n,r);case"Not":return Ims(s,i,n,r);case"Object":return wms(s,i,n,r);case"Record":return Rms(s,i,n,r);case"Ref":return Nms(s,i,n,r);case"Symbol":return _u(s,n,r);case"This":return kms(s,i,n,r);case"Tuple":return Oms(s,i,n,r);case"Union":return Mms(s,i,n,r);default:return _u(s,n,r)}}function m4(e,t,n){return Lv(e,t,"",n)}var p4,XRe,wNn=C(()=>{Oie();Fr();Vc();hA();lS();NA();Ip();Ks();p4=class extends vi{constructor(t,n,r){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},XRe=class extends vi{constructor(t,n,r,i){super(i instanceof Error?i.message:"Unknown error"),this.schema=t,this.path=n,this.value=r,this.error=i}}});function Jf(e,t,n){try{return fa(e)?e[kc].Encode(n):n}catch(r){throw new qRe(e,t,n,r)}}function Pms(e,t,n,r){let i=Jf(e,n,r);return wi(i)?i.map((s,o)=>Fv(e.items,t,`${n}/${o}`,s)):i}function Dms(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],o=Jf(e,n,r);return Fv(s,[...t,...i],n,o)}function Bms(e,t,n,r){let i=Jf(e,n,r);if(!ms(r)||ky(r))return i;let s=X7(e),o=s.map(d=>d[0]),a={...i};for(let[d,p]of s)d in a&&(a[d]=Fv(p,t,`${n}/${d}`,a[d]));if(!fa(e.unevaluatedProperties))return a;let l=Object.getOwnPropertyNames(a),u=e.unevaluatedProperties,c={...a};for(let d of l)o.includes(d)||(c[d]=Jf(u,`${n}/${d}`,c[d]));return c}function Lms(e,t,n,r){return Jf(e.not,n,Jf(e,n,r))}function Fms(e,t,n,r){let i=Jf(e,n,r);if(!ms(i))return i;let s=Kh(e),o={...i};for(let c of s)Vi(o,c)&&(Nc(o[c])&&(!hT(e.properties[c])||mc.IsExactOptionalProperty(o,c))||(o[c]=Fv(e.properties[c],t,`${n}/${c}`,o[c])));if(!Gc(e.additionalProperties))return o;let a=Object.getOwnPropertyNames(o),l=e.additionalProperties,u={...o};for(let c of a)s.includes(c)||(u[c]=Jf(l,`${n}/${c}`,u[c]));return u}function Ums(e,t,n,r){let i=Jf(e,n,r);if(!ms(r))return i;let s=Object.getOwnPropertyNames(e.patternProperties)[0],o=new RegExp(s),a={...i};for(let d of Object.getOwnPropertyNames(r))o.test(d)&&(a[d]=Fv(e.patternProperties[s],t,`${n}/${d}`,a[d]));if(!Gc(e.additionalProperties))return a;let l=Object.getOwnPropertyNames(a),u=e.additionalProperties,c={...a};for(let d of l)o.test(d)||(c[d]=Jf(u,`${n}/${d}`,c[d]));return c}function Vms(e,t,n,r){let i=aa(e,t),s=Fv(i,t,n,r);return Jf(e,n,s)}function Gms(e,t,n,r){let i=aa(e,t),s=Fv(i,t,n,r);return Jf(e,n,s)}function Wms(e,t,n,r){let i=Jf(e,n,r);return wi(e.items)?e.items.map((s,o)=>Fv(s,t,`${n}/${o}`,i[o])):[]}function $ms(e,t,n,r){for(let i of e.anyOf){if(!Vs(i,t,r))continue;let s=Fv(i,t,n,r);return Jf(e,n,s)}for(let i of e.anyOf){let s=Fv(i,t,n,r);if(Vs(e,t,s))return Jf(e,n,s)}return Jf(e,n,r)}function Fv(e,t,n,r){let i=$m(e,t),s=e;switch(e[on]){case"Array":return Pms(s,i,n,r);case"Import":return Dms(s,i,n,r);case"Intersect":return Bms(s,i,n,r);case"Not":return Lms(s,i,n,r);case"Object":return Fms(s,i,n,r);case"Record":return Ums(s,i,n,r);case"Ref":return Vms(s,i,n,r);case"This":return Gms(s,i,n,r);case"Tuple":return Wms(s,i,n,r);case"Union":return $ms(s,i,n,r);default:return Jf(s,n,r)}}function h4(e,t,n){return Fv(e,t,"",n)}var f4,qRe,RNn=C(()=>{Oie();Fr();Vc();hA();lS();NA();Ip();Ks();f4=class extends vi{constructor(t,n,r){super("The encoded value does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},qRe=class extends vi{constructor(t,n,r,i){super(`${i instanceof Error?i.message:"Unknown error"}`),this.schema=t,this.path=n,this.value=r,this.error=i}}});function Qms(e,t){return fa(e)||im(e.items,t)}function Hms(e,t){return fa(e)||im(e.items,t)}function Yms(e,t){return fa(e)||im(e.returns,t)||e.parameters.some(n=>im(n,t))}function Zms(e,t){return fa(e)||im(e.returns,t)||e.parameters.some(n=>im(n,t))}function jms(e,t){return fa(e)||fa(e.unevaluatedProperties)||e.allOf.some(n=>im(n,t))}function zms(e,t){let n=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((i,s)=>[...i,e.$defs[s]],[]),r=e.$defs[e.$ref];return fa(e)||im(r,[...n,...t])}function Xms(e,t){return fa(e)||im(e.items,t)}function qms(e,t){return fa(e)||im(e.not,t)}function Kms(e,t){return fa(e)||Object.values(e.properties).some(n=>im(n,t))||Gc(e.additionalProperties)&&im(e.additionalProperties,t)}function Jms(e,t){return fa(e)||im(e.item,t)}function efs(e,t){let n=Object.getOwnPropertyNames(e.patternProperties)[0],r=e.patternProperties[n];return fa(e)||im(r,t)||Gc(e.additionalProperties)&&fa(e.additionalProperties)}function tfs(e,t){return fa(e)?!0:im(aa(e,t),t)}function nfs(e,t){return fa(e)?!0:im(aa(e,t),t)}function rfs(e,t){return fa(e)||!Nc(e.items)&&e.items.some(n=>im(n,t))}function ifs(e,t){return fa(e)||e.anyOf.some(n=>im(n,t))}function im(e,t){let n=$m(e,t),r=e;if(e.$id&&Yft.has(e.$id))return!1;switch(e.$id&&Yft.add(e.$id),e[on]){case"Array":return Qms(r,n);case"AsyncIterator":return Hms(r,n);case"Constructor":return Yms(r,n);case"Function":return Zms(r,n);case"Import":return zms(r,n);case"Intersect":return jms(r,n);case"Iterator":return Xms(r,n);case"Not":return qms(r,n);case"Object":return Kms(r,n);case"Promise":return Jms(r,n);case"Record":return efs(r,n);case"Ref":return tfs(r,n);case"This":return nfs(r,n);case"Tuple":return rfs(r,n);case"Union":return ifs(r,n);default:return fa(e)}}function KT(e,t){return Yft.clear(),im(e,t)}var Yft,NNn=C(()=>{lS();Fr();Ks();Ip();Yft=new Set});var gZ=C(()=>{wNn();RNn();NNn()});function hD(e){if(!Uo(e))throw Error("ConstantString: Not a String");return`'${JSON.stringify(e).slice(1,-1).replace(/'/g,"\\'")}'`}function kNn(e,t){return`${e}[${hD(t)}]`}var KRe,JRe,Zft,eNe,ele,gD,g4,ONn=C(()=>{gZ();qT();pZ();Vc();lS();hZ();Fr();oP();hA();Dxe();fd();ST();Ip();dnt();KRe=class{constructor(t,n,r,i){this.schema=t,this.references=n,this.checkFunc=r,this.code=i,this.hasTransform=KT(t,n)}Code(){return this.code}Schema(){return this.schema}References(){return this.references}Errors(t){return Bv(this.schema,this.references,t)}Check(t){return this.checkFunc(t)}Decode(t){if(!this.checkFunc(t))throw new p4(this.schema,t,this.Errors(t).First());return this.hasTransform?m4(this.schema,this.references,t):t}Encode(t){let n=this.hasTransform?h4(this.schema,this.references,t):t;if(!this.checkFunc(n))throw new f4(this.schema,t,this.Errors(t).First());return n}};(function(e){function t(s){return s===36}e.DollarSign=t;function n(s){return s===95}e.IsUnderscore=n;function r(s){return s>=65&&s<=90||s>=97&&s<=122}e.IsAlpha=r;function i(s){return s>=48&&s<=57}e.IsNumeric=i})(JRe||(JRe={}));(function(e){function t(n){let r=[];for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);JRe.IsNumeric(s)||JRe.IsAlpha(s)?r.push(n.charAt(i)):r.push(`_${s}_`)}return r.join("").replace(/__/g,"_")}e.Encode=t})(Zft||(Zft={}));eNe=class extends vi{constructor(t){super("Unknown type"),this.schema=t}},ele=class extends vi{constructor(t){super("Preflight validation check failed to guard for the given schema"),this.schema=t}};(function(e){function t(o,a,l){return mc.ExactOptionalPropertyTypes?`(${hD(a)} in ${o} ? ${l} : true)`:`(${kNn(o,a)} !== undefined ? ${l} : true)`}e.IsExactOptionalProperty=t;function n(o){return mc.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null)`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}))`}e.IsObjectLike=n;function r(o){return mc.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}) && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`}e.IsRecordLike=r;function i(o){return mc.AllowNaN?`typeof ${o} === 'number'`:`Number.isFinite(${o})`}e.IsNumberLike=i;function s(o){return mc.AllowNullVoid?`(${o} === undefined || ${o} === null)`:`${o} === undefined`}e.IsVoidLike=s})(gD||(gD={}));(function(e){function t(ee){return ee[on]==="Any"||ee[on]==="Unknown"}function*n(ee,X,$){yield"true"}function*r(ee,X,$){yield"true"}function*i(ee,X,$){yield`Array.isArray(${$})`;let[se,oe]=[j("value","any"),j("acc","number")];pi(ee.maxItems)&&(yield`${$}.length <= ${ee.maxItems}`),pi(ee.minItems)&&(yield`${$}.length >= ${ee.minItems}`);let we=ue(ee.items,X,"value");if(yield`((array) => { for(const ${se} of array) if(!(${we})) { return false }; return true; })(${$})`,Wc(ee.contains)||pi(ee.minContains)||pi(ee.maxContains)){let Re=Wc(ee.contains)?ee.contains:Gi(),xe=ue(Re,X,"value"),re=pi(ee.minContains)?[`(count >= ${ee.minContains})`]:[],Oe=pi(ee.maxContains)?[`(count <= ${ee.maxContains})`]:[],Ze=`const count = value.reduce((${oe}, ${se}) => ${xe} ? acc + 1 : acc, 0)`,He=["(count > 0)",...re,...Oe].join(" && ");yield`((${se}) => { ${Ze}; return ${He}})(${$})`}ee.uniqueItems===!0&&(yield`((${se}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${$})`)}function*s(ee,X,$){yield`(typeof value === 'object' && Symbol.asyncIterator in ${$})`}function*o(ee,X,$){yield`(typeof ${$} === 'bigint')`,Fm(ee.exclusiveMaximum)&&(yield`${$} < BigInt(${ee.exclusiveMaximum})`),Fm(ee.exclusiveMinimum)&&(yield`${$} > BigInt(${ee.exclusiveMinimum})`),Fm(ee.maximum)&&(yield`${$} <= BigInt(${ee.maximum})`),Fm(ee.minimum)&&(yield`${$} >= BigInt(${ee.minimum})`),Fm(ee.multipleOf)&&(yield`(${$} % BigInt(${ee.multipleOf})) === 0`)}function*a(ee,X,$){yield`(typeof ${$} === 'boolean')`}function*l(ee,X,$){yield*ie(ee.returns,X,`${$}.prototype`)}function*u(ee,X,$){yield`(${$} instanceof Date) && Number.isFinite(${$}.getTime())`,pi(ee.exclusiveMaximumTimestamp)&&(yield`${$}.getTime() < ${ee.exclusiveMaximumTimestamp}`),pi(ee.exclusiveMinimumTimestamp)&&(yield`${$}.getTime() > ${ee.exclusiveMinimumTimestamp}`),pi(ee.maximumTimestamp)&&(yield`${$}.getTime() <= ${ee.maximumTimestamp}`),pi(ee.minimumTimestamp)&&(yield`${$}.getTime() >= ${ee.minimumTimestamp}`),pi(ee.multipleOfTimestamp)&&(yield`(${$}.getTime() % ${ee.multipleOfTimestamp}) === 0`)}function*c(ee,X,$){yield`(typeof ${$} === 'function')`}function*d(ee,X,$){let se=globalThis.Object.getOwnPropertyNames(ee.$defs).reduce((oe,we)=>[...oe,ee.$defs[we]],[]);yield*ie(Gm(ee.$ref),[...X,...se],$)}function*p(ee,X,$){yield`Number.isInteger(${$})`,pi(ee.exclusiveMaximum)&&(yield`${$} < ${ee.exclusiveMaximum}`),pi(ee.exclusiveMinimum)&&(yield`${$} > ${ee.exclusiveMinimum}`),pi(ee.maximum)&&(yield`${$} <= ${ee.maximum}`),pi(ee.minimum)&&(yield`${$} >= ${ee.minimum}`),pi(ee.multipleOf)&&(yield`(${$} % ${ee.multipleOf}) === 0`)}function*m(ee,X,$){let se=ee.allOf.map(oe=>ue(oe,X,$)).join(" && ");if(ee.unevaluatedProperties===!1){let oe=W(`${new RegExp(Ev(ee))};`),we=`Object.getOwnPropertyNames(${$}).every(key => ${oe}.test(key))`;yield`(${se} && ${we})`}else if(Wc(ee.unevaluatedProperties)){let oe=W(`${new RegExp(Ev(ee))};`),we=`Object.getOwnPropertyNames(${$}).every(key => ${oe}.test(key) || ${ue(ee.unevaluatedProperties,X,`${$}[key]`)})`;yield`(${se} && ${we})`}else yield`(${se})`}function*f(ee,X,$){yield`(typeof value === 'object' && Symbol.iterator in ${$})`}function*h(ee,X,$){if(typeof ee.const=="number"||typeof ee.const=="boolean")yield`(${$} === ${ee.const})`;else if(typeof ee.const=="string")yield`(${$} === ${hD(ee.const)})`;else throw Error("Invalid Literal Value")}function*g(ee,X,$){yield"false"}function*b(ee,X,$){yield`(!${ue(ee.not,X,$)})`}function*A(ee,X,$){yield`(${$} === null)`}function*y(ee,X,$){yield gD.IsNumberLike($),pi(ee.exclusiveMaximum)&&(yield`${$} < ${ee.exclusiveMaximum}`),pi(ee.exclusiveMinimum)&&(yield`${$} > ${ee.exclusiveMinimum}`),pi(ee.maximum)&&(yield`${$} <= ${ee.maximum}`),pi(ee.minimum)&&(yield`${$} >= ${ee.minimum}`),pi(ee.multipleOf)&&(yield`(${$} % ${ee.multipleOf}) === 0`)}function*S(ee,X,$){yield gD.IsObjectLike($),pi(ee.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${ee.minProperties}`),pi(ee.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${ee.maxProperties}`);let se=Object.getOwnPropertyNames(ee.properties);for(let oe of se){let we=kNn($,oe),Re=ee.properties[oe];if(ee.required&&ee.required.includes(oe))yield*ie(Re,X,we),(_v(Re)||t(Re))&&(yield`(${hD(oe)} in ${$})`);else{let xe=ue(Re,X,we);yield gD.IsExactOptionalProperty($,oe,xe)}}if(ee.additionalProperties===!1)if(ee.required&&ee.required.length===se.length)yield`Object.getOwnPropertyNames(${$}).length === ${se.length}`;else{let oe=`[${se.map(we=>`${hD(we)}`).join(", ")}]`;yield`Object.getOwnPropertyNames(${$}).every(key => ${oe}.includes(key))`}if(typeof ee.additionalProperties=="object"){let oe=ue(ee.additionalProperties,X,`${$}[key]`),we=`[${se.map(Re=>`${hD(Re)}`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${$}).every(key => ${we}.includes(key) || ${oe}))`}}function*_(ee,X,$){yield`${$} instanceof Promise`}function*x(ee,X,$){yield gD.IsRecordLike($),pi(ee.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${ee.minProperties}`),pi(ee.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${ee.maxProperties}`);let[se,oe]=Object.entries(ee.patternProperties)[0],we=W(`${new RegExp(se)}`),Re=ue(oe,X,"value"),xe=Wc(ee.additionalProperties)?ue(ee.additionalProperties,X,$):ee.additionalProperties===!1?"false":"true",re=`(${we}.test(key) ? ${Re} : ${xe})`;yield`(Object.entries(${$}).every(([key, value]) => ${re}))`}function*v(ee,X,$){let se=aa(ee,X);if(ne.functions.has(ee.$ref))return yield`${le(ee.$ref)}(${$})`;yield*ie(se,X,$)}function*w(ee,X,$){let se=W(`${new RegExp(ee.source,ee.flags)};`);yield`(typeof ${$} === 'string')`,pi(ee.maxLength)&&(yield`${$}.length <= ${ee.maxLength}`),pi(ee.minLength)&&(yield`${$}.length >= ${ee.minLength}`),yield`${se}.test(${$})`}function*T(ee,X,$){yield`(typeof ${$} === 'string')`,pi(ee.maxLength)&&(yield`${$}.length <= ${ee.maxLength}`),pi(ee.minLength)&&(yield`${$}.length >= ${ee.minLength}`),ee.pattern!==void 0&&(yield`${W(`${new RegExp(ee.pattern)};`)}.test(${$})`),ee.format!==void 0&&(yield`format(${hD(ee.format)}, ${$})`)}function*P(ee,X,$){yield`(typeof ${$} === 'symbol')`}function*O(ee,X,$){yield`(typeof ${$} === 'string')`,yield`${W(`${new RegExp(ee.pattern)};`)}.test(${$})`}function*D(ee,X,$){yield`${le(ee.$ref)}(${$})`}function*k(ee,X,$){if(yield`Array.isArray(${$})`,ee.items===void 0)return yield`${$}.length === 0`;yield`(${$}.length === ${ee.maxItems})`;for(let se=0;se<ee.items.length;se++)yield`${ue(ee.items[se],X,`${$}[${se}]`)}`}function*M(ee,X,$){yield`${$} === undefined`}function*L(ee,X,$){yield`(${ee.anyOf.map(oe=>ue(oe,X,$)).join(" || ")})`}function*F(ee,X,$){yield`${$} instanceof Uint8Array`,pi(ee.maxByteLength)&&(yield`(${$}.length <= ${ee.maxByteLength})`),pi(ee.minByteLength)&&(yield`(${$}.length >= ${ee.minByteLength})`)}function*H(ee,X,$){yield"true"}function*U(ee,X,$){yield gD.IsVoidLike($)}function*J(ee,X,$){let se=ne.instances.size;ne.instances.set(se,ee),yield`kind(${hD(ee[on])}, ${se}, ${$})`}function*ie(ee,X,$,se=!0){let oe=Uo(ee.$id)?[...X,ee]:X,we=ee;if(se&&Uo(ee.$id)){let Re=le(ee.$id);if(ne.functions.has(Re))return yield`${Re}(${$})`;{ne.functions.set(Re,"<deferred>");let xe=Q(Re,ee,X,"value",!1);return ne.functions.set(Re,xe),yield`${Re}(${$})`}}switch(we[on]){case"Any":return yield*n(we,oe,$);case"Argument":return yield*r(we,oe,$);case"Array":return yield*i(we,oe,$);case"AsyncIterator":return yield*s(we,oe,$);case"BigInt":return yield*o(we,oe,$);case"Boolean":return yield*a(we,oe,$);case"Constructor":return yield*l(we,oe,$);case"Date":return yield*u(we,oe,$);case"Function":return yield*c(we,oe,$);case"Import":return yield*d(we,oe,$);case"Integer":return yield*p(we,oe,$);case"Intersect":return yield*m(we,oe,$);case"Iterator":return yield*f(we,oe,$);case"Literal":return yield*h(we,oe,$);case"Never":return yield*g(we,oe,$);case"Not":return yield*b(we,oe,$);case"Null":return yield*A(we,oe,$);case"Number":return yield*y(we,oe,$);case"Object":return yield*S(we,oe,$);case"Promise":return yield*_(we,oe,$);case"Record":return yield*x(we,oe,$);case"Ref":return yield*v(we,oe,$);case"RegExp":return yield*w(we,oe,$);case"String":return yield*T(we,oe,$);case"Symbol":return yield*P(we,oe,$);case"TemplateLiteral":return yield*O(we,oe,$);case"This":return yield*D(we,oe,$);case"Tuple":return yield*k(we,oe,$);case"Undefined":return yield*M(we,oe,$);case"Union":return yield*L(we,oe,$);case"Uint8Array":return yield*F(we,oe,$);case"Unknown":return yield*H(we,oe,$);case"Void":return yield*U(we,oe,$);default:if(!wp.Has(we[on]))throw new eNe(ee);return yield*J(we,oe,$)}}let ne={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ue(ee,X,$,se=!0){return`(${[...ie(ee,X,$,se)].join(" && ")})`}function le(ee){return`check_${Zft.Encode(ee)}`}function W(ee){let X=`local_${ne.variables.size}`;return ne.variables.set(X,`const ${X} = ${ee}`),X}function Q(ee,X,$,se,oe=!0){let[we,Re]=[`
295
+ Offending fields: ${e.join(", ")}. Re-emit the call with corrected values for those fields only.`}function Uds(e,t){if(t.params?.missingProperty!==void 0||t.params?.additionalProperty!==void 0||!t.instancePath)return"";let n=Vds(e,t.instancePath);if(n===void 0)return"";if(typeof n=="string")return` (current value: ${n.length>VRe?JSON.stringify(`${n.slice(0,VRe)}\u2026`):JSON.stringify(n)})`;let r;try{r=JSON.stringify(n)}catch{return""}return r===void 0?"":` (current value: ${r.length>VRe?`${r.slice(0,VRe)}\u2026`:r})`}function Vds(e,t){if(t===""||t==="/")return e;let n=t.split("/").slice(1),r=e;for(let i of n){let s=i.replace(/~1/g,"/").replace(/~0/g,"~");if(r==null)return;if(Array.isArray(r)){let o=Number(s);if(!Number.isInteger(o)||o<0)return;r=r[o];continue}if(typeof r!="object")return;r=r[s]}return r}var Oft,Mft,Pft,Nds,kds,nNn,Ods,rNn,Mds,Pds,GRe,Dft,VRe,oNn=C(()=>{"use strict";Oft=_n(oZ(),1),Mft=_n($Rn(),1),Pft=_n(kft(),1),Nds=Oft.default.default||Oft.default,kds=Mft.default.default||Mft.default,nNn=Pft.default.default||Pft.default,Ods=typeof globalThis<"u"&&globalThis.chrome?.runtime?.id!==void 0;rNn={allErrors:!0,strict:!1,coerceTypes:!0},Mds=/^https?:\/\/json-schema\.org\/draft-07\/schema#?$/,Pds=/^https?:\/\/json-schema\.org\/draft\/2020-12\/schema#?$/;GRe=null,Dft=null;if(sNn())try{let e=new Nds(rNn);nNn(e);let t=new kds(rNn);nNn(t),iNn(e,"http://json-schema.org/draft-07/schema#","https://json-schema.org/draft-07/schema"),iNn(t,"https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"),GRe=e,Dft=t}catch{console.warn("AJV validation disabled due to CSP restrictions")}VRe=200});var c4={};li(c4,{AssistantMessageEventStream:()=>jN,EventStream:()=>rD,LEGACY_THINKING_LEVELS:()=>Ywe,StringEnum:()=>rRe,Type:()=>te,appendAssistantMessageDiagnostic:()=>Zdt,calculateCost:()=>irs,calculateDetailedContextUsedTokens:()=>$T,cleanupSessionResources:()=>nis,clearApiProviders:()=>Vdt,complete:()=>upt,completeSimple:()=>ib,createAssistantMessageDiagnostic:()=>prs,createAssistantMessageEventStream:()=>brs,createAugmentTransportErrorDiagnostic:()=>zdt,discoverAugmentModels:()=>X3,extractDiagnosticError:()=>iTn,findAugmentTransportErrorContext:()=>Rv,findEnvKeys:()=>qCn,formatThrownValue:()=>rTn,formatUnsupportedReasoningEffort:()=>rm,getApiProvider:()=>j3,getApiProviders:()=>jns,getEnvApiKey:()=>WT,getModel:()=>rrs,getModels:()=>hae,getOrCreateAugmentClient:()=>rl,getOverflowPatterns:()=>dis,getProviders:()=>fae,isContextOverflow:()=>XN,isContextOverflowErrorText:()=>WY,isDetailedContextUsage:()=>TA,isLegacyThinkingLevel:()=>rb,isModelUnavailableErrorText:()=>yae,modelsAreEqual:()=>co,normalizeReasoningEfforts:()=>zwe,parseAugmentTransportErrorDiagnostic:()=>oTn,parseJsonWithRepair:()=>WTn,parseStreamingJson:()=>fpt,reasoningSelectionLabel:()=>IA,reasoningSelections:()=>zf,registerApiProvider:()=>Z3,registerBuiltInApiProviders:()=>apt,registerSessionResourceCleanup:()=>tis,repairJson:()=>mpt,resetApiProviders:()=>zN,resolveReasoningCapabilities:()=>Xu,resolveReasoningSelection:()=>ss,sanitizeAugmentTransportErrorContext:()=>gae,stream:()=>FTn,streamAugment:()=>GY,streamSimple:()=>QT,streamSimpleAugment:()=>DTn,supportsXhigh:()=>eTn,toProviderStopReason:()=>Hdt,unregisterApiProviders:()=>zns,validateToolArguments:()=>WRe,validateToolCall:()=>Bds});var Bi=C(()=>{"use strict";us();$we();Qdt();Ydt();opt();lpt();BTn();UTn();Zwe();Xdt();Kwe();$Tn();HTn();YTn();oNn()});var fD,Bft=C(()=>{fD={name:"@augmentcode/auggie-v2",version:"1.2.0",description:"Auggie CLI Client by Augment Code",type:"module",piConfig:{name:"auggie",configDir:".augment"},bin:{auggie:"dist/cli.js","auggie-v2":"dist/cli.js",pi:"dist/cli.js"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{source:"./src/index.ts",types:"./dist/index.d.ts",import:"./dist/index.js"},"./hooks":{types:"./dist/core/hooks/index.d.ts",import:"./dist/core/hooks/index.js"}},files:["dist","docs","examples","CHANGELOG.md"],scripts:{"check-types":"pnpm run bake:export-html && tsgo -p tsconfig.build.json",clean:"shx rm -rf dist",banners:"tsx --conditions=source scripts/print-banners.ts","cli:source":"tsx --conditions=source src/cli.ts",dev:"pnpm run bake:export-html && pnpm run cli:source","dev:debug":"pnpm run bake:export-html && node --conditions=source --inspect-wait=ws://localhost:6499/57uz7t2uyri --import tsx src/cli.ts","bake:export-html":"node scripts/bake-export-html.mjs",build:"pnpm run bake:export-html && tsgo -p tsconfig.build.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm:release":"node scripts/build-npm-release.mjs","build:migration-engine":"node scripts/build-migration-engine.mjs","build:release:sea":"node scripts/build-sea-release.mjs","build:release:sea:from-onison":"node scripts/build-sea-from-onison.mjs","build:release-js":"pnpm run bake:export-html && tsgo -p tsconfig.release.json --noCheck && shx chmod +x dist/cli.js && shx cp src/runtime/register-extensions.js dist/runtime/register-extensions.js && shx cp src/runtime/cloud-bridge.js dist/runtime/cloud-bridge.js && shx cp src/runtime/cloud-tracer-bridge.js dist/runtime/cloud-tracer-bridge.js && shx cp src/runtime/cloud-error-bridge.js dist/runtime/cloud-error-bridge.js && shx cp src/runtime/mcp-error-bridge.js dist/runtime/mcp-error-bridge.js && pnpm run copy-assets","build:npm":"pnpm run build:npm:release","clean:npm-artifacts":"find dist -name '*.js' -not -path 'dist/cli.js' -not -path 'dist/index.js' -not -path 'dist/release/*' -not -path 'dist/core/export-html/*' -delete && find dist -name '*.js.map' -delete","copy-assets":"shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/",test:"pnpm run bake:export-html && vitest --run","test:acp:e2e":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/acp/","test:e2e:sanity":"pnpm run bake:export-html && vitest --run --config vitest.e2e.config.ts e2e-test/tui/sanity.test.ts","test:e2e:tui":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/tui/","test:e2e:cli":"pnpm run bake:export-html && vitest --run --no-file-parallelism --config vitest.e2e.config.ts e2e-test/cli/",prepublishOnly:"pnpm run clean && pnpm run build"},dependencies:{"@agentclientprotocol/sdk":"1.4.0","@augmentcode/api-client":"workspace:*","@earendil-works/pi-agent-core":"workspace:*","@earendil-works/pi-ai":"workspace:*","@earendil-works/pi-indexing":"workspace:*","@earendil-works/pi-tui":"workspace:*","@hermes/ask-user":"workspace:*","@hermes/augment-legacy-tools":"workspace:*","@hermes/btw":"workspace:*","@hermes/cloud":"workspace:*","@hermes/context-usage":"workspace:*","@hermes/cosmos":"workspace:*","@hermes/daemon":"workspace:*","@hermes/git-credentials":"workspace:*","@hermes/hashline-edit":"workspace:*","@hermes/hooks":"workspace:*","@hermes/import-sessions":"workspace:*","@hermes/logger":"workspace:*","@hermes/lsp":"workspace:*","@hermes/mcp":"workspace:*","@hermes/migration":"workspace:*","@hermes/open-browser":"workspace:*","@hermes/otel":"workspace:*","@hermes/path-utils":"workspace:*","@hermes/plugins":"workspace:*","@hermes/prompt-enhancer":"workspace:*","@hermes/segment-analytics":"workspace:*","@hermes/sentry":"workspace:*","@hermes/settings":"workspace:*","@hermes/shared-types":"workspace:*","@hermes/subagents":"workspace:*","@hermes/tool-permissions":"workspace:*","@mariozechner/jiti":"^2.6.2","@sentry/node":"^10.53.1","@silvia-odwyer/photon-node":"^0.3.4","@sinclair/typebox":"^0.34.41",ajv:"^8.17.1",chalk:"^5.5.0","cli-highlight":"^2.1.11",diff:"^8.0.2","extract-zip":"^2.0.1",fdir:"^6.5.0","file-type":"^21.1.1",glob:"^13.0.1","hosted-git-info":"^9.0.2",ignore:"^7.0.5",jimp:"^1.6.1","jsonc-parser":"3.3.1",marked:"^15.0.12",minimatch:"^10.2.3","proper-lockfile":"^4.1.2","strip-ansi":"^7.1.0",turndown:"^7.2.4",undici:"^7.19.1",yaml:"^2.8.2",zod:"^4.4.3"},overrides:{rimraf:"6.1.2",gaxios:{rimraf:"6.1.2"}},optionalDependencies:{"@mariozechner/clipboard":"^0.3.2"},devDependencies:{"@tintinweb/pi-subagents":"workspace:*","@types/diff":"^7.0.2","@types/hosted-git-info":"^3.0.5","@types/ms":"^2.1.0","@types/node":"^24.3.0","@types/proper-lockfile":"^4.1.4","@types/turndown":"^5.0.5",level:"^10.0.0",shx:"^0.4.0",tsx:"^4.21.0",typescript:"^5.7.3",vitest:"^3.2.4"},keywords:["coding-agent","ai","llm","cli","tui","agent"],author:"Mario Zechner",license:"MIT",repository:{type:"git",url:"git+https://github.com/badlogic/pi-mono.git",directory:"packages/coding-agent"},engines:{node:">=20.6.0"}}});import{existsSync as Wds}from"node:fs";import{homedir as Xae}from"node:os";import{dirname as Lft,join as Dv,resolve as lNn}from"node:path";import{fileURLToPath as $ds}from"node:url";function cNn(){let e=process.env.PI_PACKAGE_DIR;if(e)return e==="~"?Xae():e.startsWith("~/")?Xae()+e.slice(1):e;let t=aNn;for(;t!==Lft(t);){if(Wds(Dv(t,"package.json")))return t;t=Lft(t)}return aNn}function $Re(){return lNn(Dv(cNn(),"docs"))}function QRe(){return lNn(Dv(cNn(),"CHANGELOG.md"))}function mNn(e){return e==="~"?Xae():e.startsWith("~/")?Xae()+e.slice(1):e}function XT(){let e=process.env.AUGMENT_CACHE_DIR;return e?mNn(e):Dv(Xae(),".augment")}function Dr(){let e=process.env[Fft];return e?mNn(e):XT()}function Jae(){return Dv(Dr(),"themes")}function fNn(){return Dv(Dr(),"models.json")}function hNn(){return Dv(Dr(),"auth.json")}function gNn(){return Dv(Dr(),"settings.json")}function wA(){return XT()}function dZ(){return Dv(Dr(),"bin")}function bNn(){return Dv(Dr(),qae)}function yNn(){return Dv(Dr(),`${Jr}-debug.log`)}var Qds,aNn,Jr,Ms,qae,Kae,uNn,Hds,gs,dNn,pNn,Fft,Us=C(()=>{"use strict";Bft();Qds=$ds(import.meta.url),aNn=Lft(Qds);Jr=fD.piConfig?.name||"auggie",Ms=fD.piConfig?.configDir||".augment",qae="sessions-v2",Kae=Jr,uNn="Auggie Coding Agent",Hds="1.2.0-prerelease.202611051212",gs=Hds??fD.version,dNn="c2bb47092477fbb2052b9393a3ec40143ce1c6c1",pNn="2026-11-05T20:12:17Z",Fft=`${Jr.toUpperCase()}_CODING_AGENT_DIR`});function Uft(...e){return new globalThis.Function(...e)}var ANn=C(()=>{});var HRe,YRe,Vft,ENn=C(()=>{oP();AH();Fr();Vc();HRe=class extends vi{constructor(t){super(`Duplicate type kind '${t}' detected`)}},YRe=class extends vi{constructor(t){super(`Duplicate string format '${t}' detected`)}};(function(e){function t(r,i){if(wp.Has(r))throw new HRe(r);return wp.Set(r,i),(s={})=>vP({...s,[on]:r})}e.Type=t;function n(r,i){if(jh.Has(r))throw new YRe(r);return jh.Set(r,i),r}e.Format=n})(Vft||(Vft={}))});var u4={};li(u4,{Evaluate:()=>Uft,TypeSystem:()=>Vft,TypeSystemDuplicateFormat:()=>YRe,TypeSystemDuplicateTypeKind:()=>HRe,TypeSystemPolicy:()=>mc});var pZ=C(()=>{ANn();Oie();ENn()});function _Nn(e){switch(e.errorType){case an.ArrayContains:return"Expected array to contain at least one matching value";case an.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case an.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case an.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case an.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case an.ArrayUniqueItems:return"Expected array elements to be unique";case an.Array:return"Expected array";case an.AsyncIterator:return"Expected AsyncIterator";case an.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case an.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case an.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case an.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case an.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case an.BigInt:return"Expected bigint";case an.Boolean:return"Expected boolean";case an.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case an.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case an.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case an.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case an.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case an.Date:return"Expected Date";case an.Function:return"Expected function";case an.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case an.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case an.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case an.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case an.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case an.Integer:return"Expected integer";case an.IntersectUnevaluatedProperties:return"Unexpected property";case an.Intersect:return"Expected all values to match";case an.Iterator:return"Expected Iterator";case an.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case an.Never:return"Never";case an.Not:return"Value should not match";case an.Null:return"Expected null";case an.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case an.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case an.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case an.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case an.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case an.Number:return"Expected number";case an.Object:return"Expected object";case an.ObjectAdditionalProperties:return"Unexpected property";case an.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case an.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case an.ObjectRequiredProperty:return"Expected required property";case an.Promise:return"Expected Promise";case an.RegExp:return"Expected string to match regular expression";case an.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case an.StringFormat:return`Expected string to match '${e.schema.format}' format`;case an.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case an.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case an.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case an.String:return"Expected string";case an.Symbol:return"Expected symbol";case an.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case an.Tuple:return"Expected tuple";case an.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case an.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case an.Uint8Array:return"Expected Uint8Array";case an.Undefined:return"Expected undefined";case an.Union:return"Expected union value";case an.Void:return"Expected void";case an.Kind:return`Expected kind '${e.schema[on]}'`;default:return"Unknown error type"}}function Yds(e){SNn=e}function Gft(){return SNn}var SNn,Wft=C(()=>{Fr();$ft();SNn=_Nn});function Zds(e,t){let n=t.find(r=>r.$id===e.$ref);if(n===void 0)throw new Qft(e);return aa(n,t)}function $m(e,t){return!Uo(e.$id)||t.some(n=>n.$id===e.$id)||t.push(e),t}function aa(e,t){return e[on]==="This"||e[on]==="Ref"?Zds(e,t):e}var Qft,vNn=C(()=>{Vc();Fr();axe();Qft=class extends vi{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}}});var lS=C(()=>{vNn()});function*qds(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let n=0;n<t;n++)yield e>>8*(t-1-n)&255}function Kds(e){sg(RA.Array);for(let t of e)fZ(t)}function Jds(e){sg(RA.Boolean),sg(e?1:0)}function eps(e){sg(RA.BigInt),CNn.setBigInt64(0,e);for(let t of TNn)sg(t)}function tps(e){sg(RA.Date),fZ(e.getTime())}function nps(e){sg(RA.Null)}function rps(e){sg(RA.Number),CNn.setFloat64(0,e);for(let t of TNn)sg(t)}function ips(e){sg(RA.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())fZ(t),fZ(e[t])}function sps(e){sg(RA.String);for(let t=0;t<e.length;t++)for(let n of qds(e.charCodeAt(t)))sg(n)}function ops(e){sg(RA.Symbol),fZ(e.description)}function aps(e){sg(RA.Uint8Array);for(let t=0;t<e.length;t++)sg(e[t])}function lps(e){return sg(RA.Undefined)}function fZ(e){if(wi(e))return Kds(e);if(yv(e))return Jds(e);if(Fm(e))return eps(e);if(Hh(e))return tps(e);if(uT(e))return nps(e);if(pi(e))return rps(e);if(ms(e))return ips(e);if(Uo(e))return sps(e);if(pT(e))return ops(e);if(WU(e))return aps(e);if(Nc(e))return lps(e);throw new ZRe(e)}function sg(e){mZ=mZ^Xds[e],mZ=mZ*jds%zds}function ek(e){return mZ=BigInt("14695981039346656037"),fZ(e),mZ}var ZRe,RA,mZ,jds,zds,Xds,xNn,CNn,TNn,INn=C(()=>{Ip();Vc();ZRe=class extends vi{constructor(t){super("Unable to hash value"),this.value=t}};(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(RA||(RA={}));mZ=BigInt("14695981039346656037"),[jds,zds]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Xds=Array.from({length:256}).map((e,t)=>BigInt(t)),xNn=new Float64Array(1),CNn=new DataView(xNn.buffer),TNn=new Uint8Array(xNn.buffer)});var hZ=C(()=>{INn()});function cps(e){return e[on]==="Any"||e[on]==="Unknown"}function Vo(e){return e!==void 0}function ups(e,t,n){return!0}function dps(e,t,n){return!0}function pps(e,t,n){if(!wi(n)||Vo(e.minItems)&&!(n.length>=e.minItems)||Vo(e.maxItems)&&!(n.length<=e.maxItems))return!1;for(let s of n)if(!Qm(e.items,t,s))return!1;if(e.uniqueItems===!0&&!(function(){let s=new Set;for(let o of n){let a=ek(o);if(s.has(a))return!1;s.add(a)}return!0})())return!1;if(!(Vo(e.contains)||pi(e.minContains)||pi(e.maxContains)))return!0;let r=Vo(e.contains)?e.contains:Gi(),i=n.reduce((s,o)=>Qm(r,t,o)?s+1:s,0);return!(i===0||pi(e.minContains)&&i<e.minContains||pi(e.maxContains)&&i>e.maxContains)}function mps(e,t,n){return wie(n)}function fps(e,t,n){return!(!Fm(n)||Vo(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Vo(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Vo(e.maximum)&&!(n<=e.maximum)||Vo(e.minimum)&&!(n>=e.minimum)||Vo(e.multipleOf)&&n%e.multipleOf!==BigInt(0))}function hps(e,t,n){return yv(n)}function gps(e,t,n){return Qm(e.returns,t,n.prototype)}function bps(e,t,n){return!(!Hh(n)||Vo(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)||Vo(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)||Vo(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)||Vo(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)||Vo(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)}function yps(e,t,n){return dT(n)}function Aps(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Qm(i,[...t,...r],n)}function Eps(e,t,n){return!(!kie(n)||Vo(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Vo(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Vo(e.maximum)&&!(n<=e.maximum)||Vo(e.minimum)&&!(n>=e.minimum)||Vo(e.multipleOf)&&n%e.multipleOf!==0)}function _ps(e,t,n){let r=e.allOf.every(i=>Qm(i,t,n));if(e.unevaluatedProperties===!1){let i=new RegExp(Ev(e)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o));return r&&s}else if(Gc(e.unevaluatedProperties)){let i=new RegExp(Ev(e)),s=Object.getOwnPropertyNames(n).every(o=>i.test(o)||Qm(e.unevaluatedProperties,t,n[o]));return r&&s}else return r}function Sps(e,t,n){return Rie(n)}function vps(e,t,n){return n===e.const}function xps(e,t,n){return!1}function Cps(e,t,n){return!Qm(e.not,t,n)}function Tps(e,t,n){return uT(n)}function Ips(e,t,n){return!(!mc.IsNumberLike(n)||Vo(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||Vo(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||Vo(e.minimum)&&!(n>=e.minimum)||Vo(e.maximum)&&!(n<=e.maximum)||Vo(e.multipleOf)&&n%e.multipleOf!==0)}function wps(e,t,n){if(!mc.IsObjectLike(n)||Vo(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||Vo(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let i of r){let s=e.properties[i];if(e.required&&e.required.includes(i)){if(!Qm(s,t,n[i])||(_v(s)||cps(s))&&!(i in n))return!1}else if(mc.IsExactOptionalProperty(n,i)&&!Qm(s,t,n[i]))return!1}if(e.additionalProperties===!1){let i=Object.getOwnPropertyNames(n);return e.required&&e.required.length===r.length&&i.length===r.length?!0:i.every(s=>r.includes(s))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(n).every(s=>r.includes(s)||Qm(e.additionalProperties,t,n[s])):!0}function Rps(e,t,n){return Nie(n)}function Nps(e,t,n){if(!mc.IsRecordLike(n)||Vo(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||Vo(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let[r,i]=Object.entries(e.patternProperties)[0],s=new RegExp(r),o=Object.entries(n).every(([u,c])=>s.test(u)?Qm(i,t,c):!0),a=typeof e.additionalProperties=="object"?Object.entries(n).every(([u,c])=>s.test(u)?!0:Qm(e.additionalProperties,t,c)):!0,l=e.additionalProperties===!1?Object.getOwnPropertyNames(n).every(u=>s.test(u)):!0;return o&&a&&l}function kps(e,t,n){return Qm(aa(e,t),t,n)}function Ops(e,t,n){let r=new RegExp(e.source,e.flags);return Vo(e.minLength)&&!(n.length>=e.minLength)||Vo(e.maxLength)&&!(n.length<=e.maxLength)?!1:r.test(n)}function Mps(e,t,n){return!Uo(n)||Vo(e.minLength)&&!(n.length>=e.minLength)||Vo(e.maxLength)&&!(n.length<=e.maxLength)||Vo(e.pattern)&&!new RegExp(e.pattern).test(n)?!1:Vo(e.format)?jh.Has(e.format)?jh.Get(e.format)(n):!1:!0}function Pps(e,t,n){return pT(n)}function Dps(e,t,n){return Uo(n)&&new RegExp(e.pattern).test(n)}function Bps(e,t,n){return Qm(aa(e,t),t,n)}function Lps(e,t,n){if(!wi(n)||e.items===void 0&&n.length!==0||n.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!Qm(e.items[r],t,n[r]))return!1;return!0}function Fps(e,t,n){return Nc(n)}function Ups(e,t,n){return e.anyOf.some(r=>Qm(r,t,n))}function Vps(e,t,n){return!(!WU(n)||Vo(e.maxByteLength)&&!(n.length<=e.maxByteLength)||Vo(e.minByteLength)&&!(n.length>=e.minByteLength))}function Gps(e,t,n){return!0}function Wps(e,t,n){return mc.IsVoidLike(n)}function $ps(e,t,n){return wp.Has(e[on])?wp.Get(e[on])(e,n):!1}function Qm(e,t,n){let r=Vo(e.$id)?$m(e,t):t,i=e;switch(i[on]){case"Any":return ups(i,r,n);case"Argument":return dps(i,r,n);case"Array":return pps(i,r,n);case"AsyncIterator":return mps(i,r,n);case"BigInt":return fps(i,r,n);case"Boolean":return hps(i,r,n);case"Constructor":return gps(i,r,n);case"Date":return bps(i,r,n);case"Function":return yps(i,r,n);case"Import":return Aps(i,r,n);case"Integer":return Eps(i,r,n);case"Intersect":return _ps(i,r,n);case"Iterator":return Sps(i,r,n);case"Literal":return vps(i,r,n);case"Never":return xps(i,r,n);case"Not":return Cps(i,r,n);case"Null":return Tps(i,r,n);case"Number":return Ips(i,r,n);case"Object":return wps(i,r,n);case"Promise":return Rps(i,r,n);case"Record":return Nps(i,r,n);case"Ref":return kps(i,r,n);case"RegExp":return Ops(i,r,n);case"String":return Mps(i,r,n);case"Symbol":return Pps(i,r,n);case"TemplateLiteral":return Dps(i,r,n);case"This":return Bps(i,r,n);case"Tuple":return Lps(i,r,n);case"Undefined":return Fps(i,r,n);case"Union":return Ups(i,r,n);case"Uint8Array":return Vps(i,r,n);case"Unknown":return Gps(i,r,n);case"Void":return Wps(i,r,n);default:if(!wp.Has(i[on]))throw new jRe(i);return $ps(i,r,n)}}function Vs(...e){return e.length===3?Qm(e[0],e[1],e[2]):Qm(e[0],[],e[1])}var jRe,Hft=C(()=>{pZ();lS();hZ();Fr();hA();mP();oP();Vc();fd();Ip();Ks();jRe=class extends vi{constructor(t){super("Unknown type"),this.schema=t}}});var NA=C(()=>{Hft()});function tk(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Go(e){return e!==void 0}function yr(e,t,n,r,i=[]){return{type:e,schema:t,path:n,value:r,message:Gft()({errorType:e,path:n,schema:t,value:r,errors:i}),errors:i}}function*Qps(e,t,n,r){}function*Hps(e,t,n,r){}function*Yps(e,t,n,r){if(!wi(r))return yield yr(an.Array,e,n,r);Go(e.minItems)&&!(r.length>=e.minItems)&&(yield yr(an.ArrayMinItems,e,n,r)),Go(e.maxItems)&&!(r.length<=e.maxItems)&&(yield yr(an.ArrayMaxItems,e,n,r));for(let o=0;o<r.length;o++)yield*Hm(e.items,t,`${n}/${o}`,r[o]);if(e.uniqueItems===!0&&!(function(){let o=new Set;for(let a of r){let l=ek(a);if(o.has(l))return!1;o.add(l)}return!0})()&&(yield yr(an.ArrayUniqueItems,e,n,r)),!(Go(e.contains)||Go(e.minContains)||Go(e.maxContains)))return;let i=Go(e.contains)?e.contains:Gi(),s=r.reduce((o,a,l)=>Hm(i,t,`${n}${l}`,a).next().done===!0?o+1:o,0);s===0&&(yield yr(an.ArrayContains,e,n,r)),pi(e.minContains)&&s<e.minContains&&(yield yr(an.ArrayMinContains,e,n,r)),pi(e.maxContains)&&s>e.maxContains&&(yield yr(an.ArrayMaxContains,e,n,r))}function*Zps(e,t,n,r){wie(r)||(yield yr(an.AsyncIterator,e,n,r))}function*jps(e,t,n,r){if(!Fm(r))return yield yr(an.BigInt,e,n,r);Go(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.BigIntExclusiveMaximum,e,n,r)),Go(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.BigIntExclusiveMinimum,e,n,r)),Go(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.BigIntMaximum,e,n,r)),Go(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.BigIntMinimum,e,n,r)),Go(e.multipleOf)&&r%e.multipleOf!==BigInt(0)&&(yield yr(an.BigIntMultipleOf,e,n,r))}function*zps(e,t,n,r){yv(r)||(yield yr(an.Boolean,e,n,r))}function*Xps(e,t,n,r){yield*Hm(e.returns,t,n,r.prototype)}function*qps(e,t,n,r){if(!Hh(r))return yield yr(an.Date,e,n,r);Go(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)&&(yield yr(an.DateExclusiveMaximumTimestamp,e,n,r)),Go(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)&&(yield yr(an.DateExclusiveMinimumTimestamp,e,n,r)),Go(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)&&(yield yr(an.DateMaximumTimestamp,e,n,r)),Go(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)&&(yield yr(an.DateMinimumTimestamp,e,n,r)),Go(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0&&(yield yr(an.DateMultipleOfTimestamp,e,n,r))}function*Kps(e,t,n,r){dT(r)||(yield yr(an.Function,e,n,r))}function*Jps(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref];yield*Hm(s,[...t,...i],n,r)}function*ems(e,t,n,r){if(!kie(r))return yield yr(an.Integer,e,n,r);Go(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.IntegerExclusiveMaximum,e,n,r)),Go(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.IntegerExclusiveMinimum,e,n,r)),Go(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.IntegerMaximum,e,n,r)),Go(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.IntegerMinimum,e,n,r)),Go(e.multipleOf)&&r%e.multipleOf!==0&&(yield yr(an.IntegerMultipleOf,e,n,r))}function*tms(e,t,n,r){let i=!1;for(let s of e.allOf)for(let o of Hm(s,t,n,r))i=!0,yield o;if(i)return yield yr(an.Intersect,e,n,r);if(e.unevaluatedProperties===!1){let s=new RegExp(Ev(e));for(let o of Object.getOwnPropertyNames(r))s.test(o)||(yield yr(an.IntersectUnevaluatedProperties,e,`${n}/${o}`,r))}if(typeof e.unevaluatedProperties=="object"){let s=new RegExp(Ev(e));for(let o of Object.getOwnPropertyNames(r))if(!s.test(o)){let a=Hm(e.unevaluatedProperties,t,`${n}/${o}`,r[o]).next();a.done||(yield a.value)}}}function*nms(e,t,n,r){Rie(r)||(yield yr(an.Iterator,e,n,r))}function*rms(e,t,n,r){r!==e.const&&(yield yr(an.Literal,e,n,r))}function*ims(e,t,n,r){yield yr(an.Never,e,n,r)}function*sms(e,t,n,r){Hm(e.not,t,n,r).next().done===!0&&(yield yr(an.Not,e,n,r))}function*oms(e,t,n,r){uT(r)||(yield yr(an.Null,e,n,r))}function*ams(e,t,n,r){if(!mc.IsNumberLike(r))return yield yr(an.Number,e,n,r);Go(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield yr(an.NumberExclusiveMaximum,e,n,r)),Go(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield yr(an.NumberExclusiveMinimum,e,n,r)),Go(e.maximum)&&!(r<=e.maximum)&&(yield yr(an.NumberMaximum,e,n,r)),Go(e.minimum)&&!(r>=e.minimum)&&(yield yr(an.NumberMinimum,e,n,r)),Go(e.multipleOf)&&r%e.multipleOf!==0&&(yield yr(an.NumberMultipleOf,e,n,r))}function*lms(e,t,n,r){if(!mc.IsObjectLike(r))return yield yr(an.Object,e,n,r);Go(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield yr(an.ObjectMinProperties,e,n,r)),Go(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield yr(an.ObjectMaxProperties,e,n,r));let i=Array.isArray(e.required)?e.required:[],s=Object.getOwnPropertyNames(e.properties),o=Object.getOwnPropertyNames(r);for(let a of i)o.includes(a)||(yield yr(an.ObjectRequiredProperty,e.properties[a],`${n}/${tk(a)}`,void 0));if(e.additionalProperties===!1)for(let a of o)s.includes(a)||(yield yr(an.ObjectAdditionalProperties,e,`${n}/${tk(a)}`,r[a]));if(typeof e.additionalProperties=="object")for(let a of o)s.includes(a)||(yield*Hm(e.additionalProperties,t,`${n}/${tk(a)}`,r[a]));for(let a of s){let l=e.properties[a];e.required&&e.required.includes(a)?(yield*Hm(l,t,`${n}/${tk(a)}`,r[a]),_v(e)&&!(a in r)&&(yield yr(an.ObjectRequiredProperty,l,`${n}/${tk(a)}`,void 0))):mc.IsExactOptionalProperty(r,a)&&(yield*Hm(l,t,`${n}/${tk(a)}`,r[a]))}}function*cms(e,t,n,r){Nie(r)||(yield yr(an.Promise,e,n,r))}function*ums(e,t,n,r){if(!mc.IsRecordLike(r))return yield yr(an.Object,e,n,r);Go(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield yr(an.ObjectMinProperties,e,n,r)),Go(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield yr(an.ObjectMaxProperties,e,n,r));let[i,s]=Object.entries(e.patternProperties)[0],o=new RegExp(i);for(let[a,l]of Object.entries(r))o.test(a)&&(yield*Hm(s,t,`${n}/${tk(a)}`,l));if(typeof e.additionalProperties=="object")for(let[a,l]of Object.entries(r))o.test(a)||(yield*Hm(e.additionalProperties,t,`${n}/${tk(a)}`,l));if(e.additionalProperties===!1){for(let[a,l]of Object.entries(r))if(!o.test(a))return yield yr(an.ObjectAdditionalProperties,e,`${n}/${tk(a)}`,l)}}function*dms(e,t,n,r){yield*Hm(aa(e,t),t,n,r)}function*pms(e,t,n,r){if(!Uo(r))return yield yr(an.String,e,n,r);if(Go(e.minLength)&&!(r.length>=e.minLength)&&(yield yr(an.StringMinLength,e,n,r)),Go(e.maxLength)&&!(r.length<=e.maxLength)&&(yield yr(an.StringMaxLength,e,n,r)),!new RegExp(e.source,e.flags).test(r))return yield yr(an.RegExp,e,n,r)}function*mms(e,t,n,r){if(!Uo(r))return yield yr(an.String,e,n,r);Go(e.minLength)&&!(r.length>=e.minLength)&&(yield yr(an.StringMinLength,e,n,r)),Go(e.maxLength)&&!(r.length<=e.maxLength)&&(yield yr(an.StringMaxLength,e,n,r)),Uo(e.pattern)&&(new RegExp(e.pattern).test(r)||(yield yr(an.StringPattern,e,n,r))),Uo(e.format)&&(jh.Has(e.format)?jh.Get(e.format)(r)||(yield yr(an.StringFormat,e,n,r)):yield yr(an.StringFormatUnknown,e,n,r))}function*fms(e,t,n,r){pT(r)||(yield yr(an.Symbol,e,n,r))}function*hms(e,t,n,r){if(!Uo(r))return yield yr(an.String,e,n,r);new RegExp(e.pattern).test(r)||(yield yr(an.StringPattern,e,n,r))}function*gms(e,t,n,r){yield*Hm(aa(e,t),t,n,r)}function*bms(e,t,n,r){if(!wi(r))return yield yr(an.Tuple,e,n,r);if(e.items===void 0&&r.length!==0)return yield yr(an.TupleLength,e,n,r);if(r.length!==e.maxItems)return yield yr(an.TupleLength,e,n,r);if(e.items)for(let i=0;i<e.items.length;i++)yield*Hm(e.items[i],t,`${n}/${i}`,r[i])}function*yms(e,t,n,r){Nc(r)||(yield yr(an.Undefined,e,n,r))}function*Ams(e,t,n,r){if(Vs(e,t,r))return;let i=e.anyOf.map(s=>new kA(Hm(s,t,n,r)));yield yr(an.Union,e,n,r,i)}function*Ems(e,t,n,r){if(!WU(r))return yield yr(an.Uint8Array,e,n,r);Go(e.maxByteLength)&&!(r.length<=e.maxByteLength)&&(yield yr(an.Uint8ArrayMaxByteLength,e,n,r)),Go(e.minByteLength)&&!(r.length>=e.minByteLength)&&(yield yr(an.Uint8ArrayMinByteLength,e,n,r))}function*_ms(e,t,n,r){}function*Sms(e,t,n,r){mc.IsVoidLike(r)||(yield yr(an.Void,e,n,r))}function*vms(e,t,n,r){wp.Get(e[on])(e,r)||(yield yr(an.Kind,e,n,r))}function*Hm(e,t,n,r){let i=Go(e.$id)?[...t,e]:t,s=e;switch(s[on]){case"Any":return yield*Qps(s,i,n,r);case"Argument":return yield*Hps(s,i,n,r);case"Array":return yield*Yps(s,i,n,r);case"AsyncIterator":return yield*Zps(s,i,n,r);case"BigInt":return yield*jps(s,i,n,r);case"Boolean":return yield*zps(s,i,n,r);case"Constructor":return yield*Xps(s,i,n,r);case"Date":return yield*qps(s,i,n,r);case"Function":return yield*Kps(s,i,n,r);case"Import":return yield*Jps(s,i,n,r);case"Integer":return yield*ems(s,i,n,r);case"Intersect":return yield*tms(s,i,n,r);case"Iterator":return yield*nms(s,i,n,r);case"Literal":return yield*rms(s,i,n,r);case"Never":return yield*ims(s,i,n,r);case"Not":return yield*sms(s,i,n,r);case"Null":return yield*oms(s,i,n,r);case"Number":return yield*ams(s,i,n,r);case"Object":return yield*lms(s,i,n,r);case"Promise":return yield*cms(s,i,n,r);case"Record":return yield*ums(s,i,n,r);case"Ref":return yield*dms(s,i,n,r);case"RegExp":return yield*pms(s,i,n,r);case"String":return yield*mms(s,i,n,r);case"Symbol":return yield*fms(s,i,n,r);case"TemplateLiteral":return yield*hms(s,i,n,r);case"This":return yield*gms(s,i,n,r);case"Tuple":return yield*bms(s,i,n,r);case"Undefined":return yield*yms(s,i,n,r);case"Union":return yield*Ams(s,i,n,r);case"Uint8Array":return yield*Ems(s,i,n,r);case"Unknown":return yield*_ms(s,i,n,r);case"Void":return yield*Sms(s,i,n,r);default:if(!wp.Has(s[on]))throw new zRe(e);return yield*vms(s,i,n,r)}}function Bv(...e){let t=e.length===3?Hm(e[0],e[1],"",e[2]):Hm(e[0],[],"",e[1]);return new kA(t)}var an,zRe,kA,$ft=C(()=>{pZ();hA();oP();Dxe();Wft();Vc();lS();hZ();NA();Fr();fd();Ip();(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(an||(an={}));zRe=class extends vi{constructor(t){super("Unknown type"),this.schema=t}};kA=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}}});var d4={};li(d4,{DefaultErrorFunction:()=>_Nn,Errors:()=>Bv,GetErrorFunction:()=>Gft,SetErrorFunction:()=>Yds,ValueErrorIterator:()=>kA,ValueErrorType:()=>an,ValueErrorsUnknownTypeError:()=>zRe});var qT=C(()=>{$ft();Wft()});function _u(e,t,n){try{return fa(e)?e[kc].Decode(n):n}catch(r){throw new XRe(e,t,n,r)}}function xms(e,t,n,r){return wi(r)?_u(e,n,r.map((i,s)=>Lv(e.items,t,`${n}/${s}`,i))):_u(e,n,r)}function Cms(e,t,n,r){if(!ms(r)||ky(r))return _u(e,n,r);let i=X7(e),s=i.map(c=>c[0]),o={...r};for(let[c,d]of i)c in o&&(o[c]=Lv(d,t,`${n}/${c}`,o[c]));if(!fa(e.unevaluatedProperties))return _u(e,n,o);let a=Object.getOwnPropertyNames(o),l=e.unevaluatedProperties,u={...o};for(let c of a)s.includes(c)||(u[c]=_u(l,`${n}/${c}`,u[c]));return _u(e,n,u)}function Tms(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],o=Lv(s,[...t,...i],n,r);return _u(e,n,o)}function Ims(e,t,n,r){return _u(e,n,Lv(e.not,t,n,r))}function wms(e,t,n,r){if(!ms(r))return _u(e,n,r);let i=Kh(e),s={...r};for(let u of i)Vi(s,u)&&(Nc(s[u])&&(!hT(e.properties[u])||mc.IsExactOptionalProperty(s,u))||(s[u]=Lv(e.properties[u],t,`${n}/${u}`,s[u])));if(!Gc(e.additionalProperties))return _u(e,n,s);let o=Object.getOwnPropertyNames(s),a=e.additionalProperties,l={...s};for(let u of o)i.includes(u)||(l[u]=_u(a,`${n}/${u}`,l[u]));return _u(e,n,l)}function Rms(e,t,n,r){if(!ms(r))return _u(e,n,r);let i=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(i),o={...r};for(let c of Object.getOwnPropertyNames(r))s.test(c)&&(o[c]=Lv(e.patternProperties[i],t,`${n}/${c}`,o[c]));if(!Gc(e.additionalProperties))return _u(e,n,o);let a=Object.getOwnPropertyNames(o),l=e.additionalProperties,u={...o};for(let c of a)s.test(c)||(u[c]=_u(l,`${n}/${c}`,u[c]));return _u(e,n,u)}function Nms(e,t,n,r){let i=aa(e,t);return _u(e,n,Lv(i,t,n,r))}function kms(e,t,n,r){let i=aa(e,t);return _u(e,n,Lv(i,t,n,r))}function Oms(e,t,n,r){return wi(r)&&wi(e.items)?_u(e,n,e.items.map((i,s)=>Lv(i,t,`${n}/${s}`,r[s]))):_u(e,n,r)}function Mms(e,t,n,r){for(let i of e.anyOf){if(!Vs(i,t,r))continue;let s=Lv(i,t,n,r);return _u(e,n,s)}return _u(e,n,r)}function Lv(e,t,n,r){let i=$m(e,t),s=e;switch(e[on]){case"Array":return xms(s,i,n,r);case"Import":return Tms(s,i,n,r);case"Intersect":return Cms(s,i,n,r);case"Not":return Ims(s,i,n,r);case"Object":return wms(s,i,n,r);case"Record":return Rms(s,i,n,r);case"Ref":return Nms(s,i,n,r);case"Symbol":return _u(s,n,r);case"This":return kms(s,i,n,r);case"Tuple":return Oms(s,i,n,r);case"Union":return Mms(s,i,n,r);default:return _u(s,n,r)}}function m4(e,t,n){return Lv(e,t,"",n)}var p4,XRe,wNn=C(()=>{Oie();Fr();Vc();hA();lS();NA();Ip();Ks();p4=class extends vi{constructor(t,n,r){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},XRe=class extends vi{constructor(t,n,r,i){super(i instanceof Error?i.message:"Unknown error"),this.schema=t,this.path=n,this.value=r,this.error=i}}});function Jf(e,t,n){try{return fa(e)?e[kc].Encode(n):n}catch(r){throw new qRe(e,t,n,r)}}function Pms(e,t,n,r){let i=Jf(e,n,r);return wi(i)?i.map((s,o)=>Fv(e.items,t,`${n}/${o}`,s)):i}function Dms(e,t,n,r){let i=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],o=Jf(e,n,r);return Fv(s,[...t,...i],n,o)}function Bms(e,t,n,r){let i=Jf(e,n,r);if(!ms(r)||ky(r))return i;let s=X7(e),o=s.map(d=>d[0]),a={...i};for(let[d,p]of s)d in a&&(a[d]=Fv(p,t,`${n}/${d}`,a[d]));if(!fa(e.unevaluatedProperties))return a;let l=Object.getOwnPropertyNames(a),u=e.unevaluatedProperties,c={...a};for(let d of l)o.includes(d)||(c[d]=Jf(u,`${n}/${d}`,c[d]));return c}function Lms(e,t,n,r){return Jf(e.not,n,Jf(e,n,r))}function Fms(e,t,n,r){let i=Jf(e,n,r);if(!ms(i))return i;let s=Kh(e),o={...i};for(let c of s)Vi(o,c)&&(Nc(o[c])&&(!hT(e.properties[c])||mc.IsExactOptionalProperty(o,c))||(o[c]=Fv(e.properties[c],t,`${n}/${c}`,o[c])));if(!Gc(e.additionalProperties))return o;let a=Object.getOwnPropertyNames(o),l=e.additionalProperties,u={...o};for(let c of a)s.includes(c)||(u[c]=Jf(l,`${n}/${c}`,u[c]));return u}function Ums(e,t,n,r){let i=Jf(e,n,r);if(!ms(r))return i;let s=Object.getOwnPropertyNames(e.patternProperties)[0],o=new RegExp(s),a={...i};for(let d of Object.getOwnPropertyNames(r))o.test(d)&&(a[d]=Fv(e.patternProperties[s],t,`${n}/${d}`,a[d]));if(!Gc(e.additionalProperties))return a;let l=Object.getOwnPropertyNames(a),u=e.additionalProperties,c={...a};for(let d of l)o.test(d)||(c[d]=Jf(u,`${n}/${d}`,c[d]));return c}function Vms(e,t,n,r){let i=aa(e,t),s=Fv(i,t,n,r);return Jf(e,n,s)}function Gms(e,t,n,r){let i=aa(e,t),s=Fv(i,t,n,r);return Jf(e,n,s)}function Wms(e,t,n,r){let i=Jf(e,n,r);return wi(e.items)?e.items.map((s,o)=>Fv(s,t,`${n}/${o}`,i[o])):[]}function $ms(e,t,n,r){for(let i of e.anyOf){if(!Vs(i,t,r))continue;let s=Fv(i,t,n,r);return Jf(e,n,s)}for(let i of e.anyOf){let s=Fv(i,t,n,r);if(Vs(e,t,s))return Jf(e,n,s)}return Jf(e,n,r)}function Fv(e,t,n,r){let i=$m(e,t),s=e;switch(e[on]){case"Array":return Pms(s,i,n,r);case"Import":return Dms(s,i,n,r);case"Intersect":return Bms(s,i,n,r);case"Not":return Lms(s,i,n,r);case"Object":return Fms(s,i,n,r);case"Record":return Ums(s,i,n,r);case"Ref":return Vms(s,i,n,r);case"This":return Gms(s,i,n,r);case"Tuple":return Wms(s,i,n,r);case"Union":return $ms(s,i,n,r);default:return Jf(s,n,r)}}function h4(e,t,n){return Fv(e,t,"",n)}var f4,qRe,RNn=C(()=>{Oie();Fr();Vc();hA();lS();NA();Ip();Ks();f4=class extends vi{constructor(t,n,r){super("The encoded value does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},qRe=class extends vi{constructor(t,n,r,i){super(`${i instanceof Error?i.message:"Unknown error"}`),this.schema=t,this.path=n,this.value=r,this.error=i}}});function Qms(e,t){return fa(e)||im(e.items,t)}function Hms(e,t){return fa(e)||im(e.items,t)}function Yms(e,t){return fa(e)||im(e.returns,t)||e.parameters.some(n=>im(n,t))}function Zms(e,t){return fa(e)||im(e.returns,t)||e.parameters.some(n=>im(n,t))}function jms(e,t){return fa(e)||fa(e.unevaluatedProperties)||e.allOf.some(n=>im(n,t))}function zms(e,t){let n=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((i,s)=>[...i,e.$defs[s]],[]),r=e.$defs[e.$ref];return fa(e)||im(r,[...n,...t])}function Xms(e,t){return fa(e)||im(e.items,t)}function qms(e,t){return fa(e)||im(e.not,t)}function Kms(e,t){return fa(e)||Object.values(e.properties).some(n=>im(n,t))||Gc(e.additionalProperties)&&im(e.additionalProperties,t)}function Jms(e,t){return fa(e)||im(e.item,t)}function efs(e,t){let n=Object.getOwnPropertyNames(e.patternProperties)[0],r=e.patternProperties[n];return fa(e)||im(r,t)||Gc(e.additionalProperties)&&fa(e.additionalProperties)}function tfs(e,t){return fa(e)?!0:im(aa(e,t),t)}function nfs(e,t){return fa(e)?!0:im(aa(e,t),t)}function rfs(e,t){return fa(e)||!Nc(e.items)&&e.items.some(n=>im(n,t))}function ifs(e,t){return fa(e)||e.anyOf.some(n=>im(n,t))}function im(e,t){let n=$m(e,t),r=e;if(e.$id&&Yft.has(e.$id))return!1;switch(e.$id&&Yft.add(e.$id),e[on]){case"Array":return Qms(r,n);case"AsyncIterator":return Hms(r,n);case"Constructor":return Yms(r,n);case"Function":return Zms(r,n);case"Import":return zms(r,n);case"Intersect":return jms(r,n);case"Iterator":return Xms(r,n);case"Not":return qms(r,n);case"Object":return Kms(r,n);case"Promise":return Jms(r,n);case"Record":return efs(r,n);case"Ref":return tfs(r,n);case"This":return nfs(r,n);case"Tuple":return rfs(r,n);case"Union":return ifs(r,n);default:return fa(e)}}function KT(e,t){return Yft.clear(),im(e,t)}var Yft,NNn=C(()=>{lS();Fr();Ks();Ip();Yft=new Set});var gZ=C(()=>{wNn();RNn();NNn()});function hD(e){if(!Uo(e))throw Error("ConstantString: Not a String");return`'${JSON.stringify(e).slice(1,-1).replace(/'/g,"\\'")}'`}function kNn(e,t){return`${e}[${hD(t)}]`}var KRe,JRe,Zft,eNe,ele,gD,g4,ONn=C(()=>{gZ();qT();pZ();Vc();lS();hZ();Fr();oP();hA();Dxe();fd();ST();Ip();dnt();KRe=class{constructor(t,n,r,i){this.schema=t,this.references=n,this.checkFunc=r,this.code=i,this.hasTransform=KT(t,n)}Code(){return this.code}Schema(){return this.schema}References(){return this.references}Errors(t){return Bv(this.schema,this.references,t)}Check(t){return this.checkFunc(t)}Decode(t){if(!this.checkFunc(t))throw new p4(this.schema,t,this.Errors(t).First());return this.hasTransform?m4(this.schema,this.references,t):t}Encode(t){let n=this.hasTransform?h4(this.schema,this.references,t):t;if(!this.checkFunc(n))throw new f4(this.schema,t,this.Errors(t).First());return n}};(function(e){function t(s){return s===36}e.DollarSign=t;function n(s){return s===95}e.IsUnderscore=n;function r(s){return s>=65&&s<=90||s>=97&&s<=122}e.IsAlpha=r;function i(s){return s>=48&&s<=57}e.IsNumeric=i})(JRe||(JRe={}));(function(e){function t(n){let r=[];for(let i=0;i<n.length;i++){let s=n.charCodeAt(i);JRe.IsNumeric(s)||JRe.IsAlpha(s)?r.push(n.charAt(i)):r.push(`_${s}_`)}return r.join("").replace(/__/g,"_")}e.Encode=t})(Zft||(Zft={}));eNe=class extends vi{constructor(t){super("Unknown type"),this.schema=t}},ele=class extends vi{constructor(t){super("Preflight validation check failed to guard for the given schema"),this.schema=t}};(function(e){function t(o,a,l){return mc.ExactOptionalPropertyTypes?`(${hD(a)} in ${o} ? ${l} : true)`:`(${kNn(o,a)} !== undefined ? ${l} : true)`}e.IsExactOptionalProperty=t;function n(o){return mc.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null)`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}))`}e.IsObjectLike=n;function r(o){return mc.AllowArrayObject?`(typeof ${o} === 'object' && ${o} !== null && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`:`(typeof ${o} === 'object' && ${o} !== null && !Array.isArray(${o}) && !(${o} instanceof Date) && !(${o} instanceof Uint8Array))`}e.IsRecordLike=r;function i(o){return mc.AllowNaN?`typeof ${o} === 'number'`:`Number.isFinite(${o})`}e.IsNumberLike=i;function s(o){return mc.AllowNullVoid?`(${o} === undefined || ${o} === null)`:`${o} === undefined`}e.IsVoidLike=s})(gD||(gD={}));(function(e){function t(ee){return ee[on]==="Any"||ee[on]==="Unknown"}function*n(ee,X,$){yield"true"}function*r(ee,X,$){yield"true"}function*i(ee,X,$){yield`Array.isArray(${$})`;let[se,oe]=[j("value","any"),j("acc","number")];pi(ee.maxItems)&&(yield`${$}.length <= ${ee.maxItems}`),pi(ee.minItems)&&(yield`${$}.length >= ${ee.minItems}`);let we=ue(ee.items,X,"value");if(yield`((array) => { for(const ${se} of array) if(!(${we})) { return false }; return true; })(${$})`,Wc(ee.contains)||pi(ee.minContains)||pi(ee.maxContains)){let Re=Wc(ee.contains)?ee.contains:Gi(),xe=ue(Re,X,"value"),re=pi(ee.minContains)?[`(count >= ${ee.minContains})`]:[],Oe=pi(ee.maxContains)?[`(count <= ${ee.maxContains})`]:[],Ze=`const count = value.reduce((${oe}, ${se}) => ${xe} ? acc + 1 : acc, 0)`,He=["(count > 0)",...re,...Oe].join(" && ");yield`((${se}) => { ${Ze}; return ${He}})(${$})`}ee.uniqueItems===!0&&(yield`((${se}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${$})`)}function*s(ee,X,$){yield`(typeof value === 'object' && Symbol.asyncIterator in ${$})`}function*o(ee,X,$){yield`(typeof ${$} === 'bigint')`,Fm(ee.exclusiveMaximum)&&(yield`${$} < BigInt(${ee.exclusiveMaximum})`),Fm(ee.exclusiveMinimum)&&(yield`${$} > BigInt(${ee.exclusiveMinimum})`),Fm(ee.maximum)&&(yield`${$} <= BigInt(${ee.maximum})`),Fm(ee.minimum)&&(yield`${$} >= BigInt(${ee.minimum})`),Fm(ee.multipleOf)&&(yield`(${$} % BigInt(${ee.multipleOf})) === 0`)}function*a(ee,X,$){yield`(typeof ${$} === 'boolean')`}function*l(ee,X,$){yield*ie(ee.returns,X,`${$}.prototype`)}function*u(ee,X,$){yield`(${$} instanceof Date) && Number.isFinite(${$}.getTime())`,pi(ee.exclusiveMaximumTimestamp)&&(yield`${$}.getTime() < ${ee.exclusiveMaximumTimestamp}`),pi(ee.exclusiveMinimumTimestamp)&&(yield`${$}.getTime() > ${ee.exclusiveMinimumTimestamp}`),pi(ee.maximumTimestamp)&&(yield`${$}.getTime() <= ${ee.maximumTimestamp}`),pi(ee.minimumTimestamp)&&(yield`${$}.getTime() >= ${ee.minimumTimestamp}`),pi(ee.multipleOfTimestamp)&&(yield`(${$}.getTime() % ${ee.multipleOfTimestamp}) === 0`)}function*c(ee,X,$){yield`(typeof ${$} === 'function')`}function*d(ee,X,$){let se=globalThis.Object.getOwnPropertyNames(ee.$defs).reduce((oe,we)=>[...oe,ee.$defs[we]],[]);yield*ie(Gm(ee.$ref),[...X,...se],$)}function*p(ee,X,$){yield`Number.isInteger(${$})`,pi(ee.exclusiveMaximum)&&(yield`${$} < ${ee.exclusiveMaximum}`),pi(ee.exclusiveMinimum)&&(yield`${$} > ${ee.exclusiveMinimum}`),pi(ee.maximum)&&(yield`${$} <= ${ee.maximum}`),pi(ee.minimum)&&(yield`${$} >= ${ee.minimum}`),pi(ee.multipleOf)&&(yield`(${$} % ${ee.multipleOf}) === 0`)}function*m(ee,X,$){let se=ee.allOf.map(oe=>ue(oe,X,$)).join(" && ");if(ee.unevaluatedProperties===!1){let oe=W(`${new RegExp(Ev(ee))};`),we=`Object.getOwnPropertyNames(${$}).every(key => ${oe}.test(key))`;yield`(${se} && ${we})`}else if(Wc(ee.unevaluatedProperties)){let oe=W(`${new RegExp(Ev(ee))};`),we=`Object.getOwnPropertyNames(${$}).every(key => ${oe}.test(key) || ${ue(ee.unevaluatedProperties,X,`${$}[key]`)})`;yield`(${se} && ${we})`}else yield`(${se})`}function*f(ee,X,$){yield`(typeof value === 'object' && Symbol.iterator in ${$})`}function*h(ee,X,$){if(typeof ee.const=="number"||typeof ee.const=="boolean")yield`(${$} === ${ee.const})`;else if(typeof ee.const=="string")yield`(${$} === ${hD(ee.const)})`;else throw Error("Invalid Literal Value")}function*g(ee,X,$){yield"false"}function*b(ee,X,$){yield`(!${ue(ee.not,X,$)})`}function*A(ee,X,$){yield`(${$} === null)`}function*y(ee,X,$){yield gD.IsNumberLike($),pi(ee.exclusiveMaximum)&&(yield`${$} < ${ee.exclusiveMaximum}`),pi(ee.exclusiveMinimum)&&(yield`${$} > ${ee.exclusiveMinimum}`),pi(ee.maximum)&&(yield`${$} <= ${ee.maximum}`),pi(ee.minimum)&&(yield`${$} >= ${ee.minimum}`),pi(ee.multipleOf)&&(yield`(${$} % ${ee.multipleOf}) === 0`)}function*S(ee,X,$){yield gD.IsObjectLike($),pi(ee.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${ee.minProperties}`),pi(ee.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${ee.maxProperties}`);let se=Object.getOwnPropertyNames(ee.properties);for(let oe of se){let we=kNn($,oe),Re=ee.properties[oe];if(ee.required&&ee.required.includes(oe))yield*ie(Re,X,we),(_v(Re)||t(Re))&&(yield`(${hD(oe)} in ${$})`);else{let xe=ue(Re,X,we);yield gD.IsExactOptionalProperty($,oe,xe)}}if(ee.additionalProperties===!1)if(ee.required&&ee.required.length===se.length)yield`Object.getOwnPropertyNames(${$}).length === ${se.length}`;else{let oe=`[${se.map(we=>`${hD(we)}`).join(", ")}]`;yield`Object.getOwnPropertyNames(${$}).every(key => ${oe}.includes(key))`}if(typeof ee.additionalProperties=="object"){let oe=ue(ee.additionalProperties,X,`${$}[key]`),we=`[${se.map(Re=>`${hD(Re)}`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${$}).every(key => ${we}.includes(key) || ${oe}))`}}function*_(ee,X,$){yield`${$} instanceof Promise`}function*x(ee,X,$){yield gD.IsRecordLike($),pi(ee.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${ee.minProperties}`),pi(ee.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${ee.maxProperties}`);let[se,oe]=Object.entries(ee.patternProperties)[0],we=W(`${new RegExp(se)}`),Re=ue(oe,X,"value"),xe=Wc(ee.additionalProperties)?ue(ee.additionalProperties,X,$):ee.additionalProperties===!1?"false":"true",re=`(${we}.test(key) ? ${Re} : ${xe})`;yield`(Object.entries(${$}).every(([key, value]) => ${re}))`}function*v(ee,X,$){let se=aa(ee,X);if(ne.functions.has(ee.$ref))return yield`${le(ee.$ref)}(${$})`;yield*ie(se,X,$)}function*w(ee,X,$){let se=W(`${new RegExp(ee.source,ee.flags)};`);yield`(typeof ${$} === 'string')`,pi(ee.maxLength)&&(yield`${$}.length <= ${ee.maxLength}`),pi(ee.minLength)&&(yield`${$}.length >= ${ee.minLength}`),yield`${se}.test(${$})`}function*T(ee,X,$){yield`(typeof ${$} === 'string')`,pi(ee.maxLength)&&(yield`${$}.length <= ${ee.maxLength}`),pi(ee.minLength)&&(yield`${$}.length >= ${ee.minLength}`),ee.pattern!==void 0&&(yield`${W(`${new RegExp(ee.pattern)};`)}.test(${$})`),ee.format!==void 0&&(yield`format(${hD(ee.format)}, ${$})`)}function*P(ee,X,$){yield`(typeof ${$} === 'symbol')`}function*O(ee,X,$){yield`(typeof ${$} === 'string')`,yield`${W(`${new RegExp(ee.pattern)};`)}.test(${$})`}function*D(ee,X,$){yield`${le(ee.$ref)}(${$})`}function*k(ee,X,$){if(yield`Array.isArray(${$})`,ee.items===void 0)return yield`${$}.length === 0`;yield`(${$}.length === ${ee.maxItems})`;for(let se=0;se<ee.items.length;se++)yield`${ue(ee.items[se],X,`${$}[${se}]`)}`}function*M(ee,X,$){yield`${$} === undefined`}function*L(ee,X,$){yield`(${ee.anyOf.map(oe=>ue(oe,X,$)).join(" || ")})`}function*F(ee,X,$){yield`${$} instanceof Uint8Array`,pi(ee.maxByteLength)&&(yield`(${$}.length <= ${ee.maxByteLength})`),pi(ee.minByteLength)&&(yield`(${$}.length >= ${ee.minByteLength})`)}function*H(ee,X,$){yield"true"}function*U(ee,X,$){yield gD.IsVoidLike($)}function*J(ee,X,$){let se=ne.instances.size;ne.instances.set(se,ee),yield`kind(${hD(ee[on])}, ${se}, ${$})`}function*ie(ee,X,$,se=!0){let oe=Uo(ee.$id)?[...X,ee]:X,we=ee;if(se&&Uo(ee.$id)){let Re=le(ee.$id);if(ne.functions.has(Re))return yield`${Re}(${$})`;{ne.functions.set(Re,"<deferred>");let xe=Q(Re,ee,X,"value",!1);return ne.functions.set(Re,xe),yield`${Re}(${$})`}}switch(we[on]){case"Any":return yield*n(we,oe,$);case"Argument":return yield*r(we,oe,$);case"Array":return yield*i(we,oe,$);case"AsyncIterator":return yield*s(we,oe,$);case"BigInt":return yield*o(we,oe,$);case"Boolean":return yield*a(we,oe,$);case"Constructor":return yield*l(we,oe,$);case"Date":return yield*u(we,oe,$);case"Function":return yield*c(we,oe,$);case"Import":return yield*d(we,oe,$);case"Integer":return yield*p(we,oe,$);case"Intersect":return yield*m(we,oe,$);case"Iterator":return yield*f(we,oe,$);case"Literal":return yield*h(we,oe,$);case"Never":return yield*g(we,oe,$);case"Not":return yield*b(we,oe,$);case"Null":return yield*A(we,oe,$);case"Number":return yield*y(we,oe,$);case"Object":return yield*S(we,oe,$);case"Promise":return yield*_(we,oe,$);case"Record":return yield*x(we,oe,$);case"Ref":return yield*v(we,oe,$);case"RegExp":return yield*w(we,oe,$);case"String":return yield*T(we,oe,$);case"Symbol":return yield*P(we,oe,$);case"TemplateLiteral":return yield*O(we,oe,$);case"This":return yield*D(we,oe,$);case"Tuple":return yield*k(we,oe,$);case"Undefined":return yield*M(we,oe,$);case"Union":return yield*L(we,oe,$);case"Uint8Array":return yield*F(we,oe,$);case"Unknown":return yield*H(we,oe,$);case"Void":return yield*U(we,oe,$);default:if(!wp.Has(we[on]))throw new eNe(ee);return yield*J(we,oe,$)}}let ne={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ue(ee,X,$,se=!0){return`(${[...ie(ee,X,$,se)].join(" && ")})`}function le(ee){return`check_${Zft.Encode(ee)}`}function W(ee){let X=`local_${ne.variables.size}`;return ne.variables.set(X,`const ${X} = ${ee}`),X}function Q(ee,X,$,se,oe=!0){let[we,Re]=[`
296
296
  `,Ze=>"".padStart(Ze," ")],xe=j("value","any"),re=Z("boolean"),Oe=[...ie(X,$,se,oe)].map(Ze=>`${Re(4)}${Ze}`).join(` &&${we}`);return`function ${ee}(${xe})${re} {${we}${Re(2)}return (${we}${Oe}${we}${Re(2)})
297
297
  }`}function j(ee,X){let $=ne.language==="typescript"?`: ${X}`:"";return`${ee}${$}`}function Z(ee){return ne.language==="typescript"?`: ${ee}`:""}function z(ee,X,$){let se=Q("check",ee,X,"value"),oe=j("value","any"),we=Z("boolean"),Re=[...ne.functions.values()],xe=[...ne.variables.values()],re=Uo(ee.$id)?`return function check(${oe})${we} {
298
298
  return ${le(ee.$id)}(value)
@@ -6117,7 +6117,7 @@ ${r}
6117
6117
 
6118
6118
  `;return t.trimEnd()}function OTr(e){let t=Array.from(e,i=>{let s=i.codePointAt(0)??0;return s<=31||s===127?" ":i}).join("").replace(/\s+/gu," ").trim(),n=t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1).trim():t,r=Array.from(n);return r.length<=RTr?n:`${r.slice(0,RTr-1).join("")}\u2026`}function LSo(e){let t=OTr(e);if(t)return t[0]?.toUpperCase()+t.slice(1)}function qUe(e){return JSON.stringify([e.provider,e.id])}function T2t(e){let n=e.getSettings()[kTr];return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(r=>typeof r[1]=="string"))}function Sq(e,t,n){let r=[kTr,qUe(t)];if(n===void 0){e.remove("global",{paths:[r]});return}e.update("global",{path:r,value:n})}var RSo,NSo,kSo,DSo,BSo,wTr,kTr,RTr,CW,NTr,FSo,vq,KUe=C(()=>{"use strict";Bi();en();Ol();Us();yi();Aar();Ear();alr();llr();clr();Tvt();Glr();Nvt();Ovt();ccr();Pvt();xLe();dG();Zxt();MS();nf();Wz();lX();uIt();tme();qpe();_0r();KA();$B();v0r();C0r();Kue();UL();Nb();fCr();UCr();cTr();hTr();TTr();Wk();$ue();RSo=2e5,NSo=64e3,kSo="Tool result processing failed before it could be returned safely.";DSo=1e3,BSo=3600*1e3,wTr="subagent-usage",kTr="reasoningEffortPreferences",RTr=80;CW="augment",NTr="gemini-3-1-flash-lite-silent-override-1m-v1-c4-p2-agent",FSo=1e6,vq=class{get recoveryDiagnosticState(){return{pendingEvents:this._diagnosticPendingEvents,pendingContinuations:this._diagnosticPendingContinuations,activeContinuations:this._diagnosticActiveContinuations,isCompacting:this.isCompacting,isRetrying:this.isRetrying,isStreaming:this.isStreaming,disposed:this._diagnosticDisposed,messageCount:this.agent.state.messages.length}}_isCurrentAnchor(t){return!this._detachedClosed&&t.sessionId===this.sessionManager.getSessionId()&&t.generation===this._conversationGeneration&&(t.leafId===null||this.sessionManager.getBranch().some(n=>n.id===t.leafId))}closeDetachedCompletions(){this._detachedClosed||(this._detachedClosed=!0,this._invalidateDetachedWork(),this._detachedInvalidationListeners.clear())}_invalidateDetachedWork(){this._conversationGeneration++,this._detachedResults=new WeakMap;for(let t of this._detachedRequests)t.abort();for(let t of this._settledAppends.values())t.result||t.finish({status:"invalidated"});for(let t of this._detachedInvalidationListeners)try{t()}catch{tt.warn("Detached completion invalidation listener failed")}}async withHistoryAdmission(t){this._hostAdmissions++;try{return await t()}finally{this._hostAdmissions--,this._drainSettledAppends()}}_startDetachedCompletion(t){if(this._detachedClosed)throw new Error("Session is disposed");let n=this.isStreaming||this.isRetrying||!!this._reactiveRecovery,r=n?this._resolveActiveTurnModel():this.model;if(!r)throw new Error("No model selected");if(n&&!this._activeCommandModel&&this._activeTurnModelOverride&&r.id!==this._activeTurnModelOverride)throw new Error("Detached model configuration is unavailable");let i=Object.freeze({sessionId:this.sessionManager.getSessionId(),generation:this._conversationGeneration,leafId:this.sessionManager.getLeafId()}),s=t.selectMessages(structuredClone(this.sessionManager.buildSessionContext().messages)),o=structuredClone(s);o.push({role:"user",content:[{type:"text",text:`Answer the side question directly. Do not call tools or request a continuation.
6119
6119
 
6120
- ${t.question}`}],timestamp:Date.now()});let a=Promise.resolve(this.agent.convertToLlm(o));a.catch(()=>{});let l=this.agent.state,u=structuredClone({systemPrompt:l.systemPrompt,messages:[],tools:l.tools.map(({name:v,description:w,parameters:T})=>({name:v,description:w,parameters:T})),rules:l.rules,skills:l.skills,userGuidelines:l.userGuidelines,workspaceGuidelines:l.workspaceGuidelines,systemPromptAppend:l.systemPromptAppend}),c=structuredClone(r),d=ss(r,l.reasoningEffortOverride??(l.usesModelDefault?void 0:l.thinkingLevel)),p=_q(),m=_q(),f=new AbortController,h={question:t.question,requestId:p,accepted:!1,answer:void 0};this._detachedResults.set(i,h),this._detachedRequests.add(f);let g=()=>{h.accepted||this._detachedResults.delete(i),f.abort()};t.signal?.addEventListener("abort",g,{once:!0});let b=()=>{t.signal?.removeEventListener("abort",g),this._detachedRequests.delete(f)};f.signal.addEventListener("abort",b,{once:!0}),t.signal?.aborted&&g();let A={conversationId:m,parentConversationId:i.sessionId,rootConversationId:i.sessionId,requestId:p,turnId:p,silent:!1},y=r.api==="augment-chat-stream"?this._extensionRunner?.emitBeforeProviderRequest(A,"detached")??A:void 0,S={signal:f.signal,sessionId:m,reasoning:r.api!=="augment-chat-stream"&&rb(l.thinkingLevel)&&l.thinkingLevel!=="off"?l.thinkingLevel:void 0,reasoningEffort:r.api==="augment-chat-stream"&&!d.usesModelDefault?d.effort:void 0,thinkingBudgets:structuredClone(this.settingsManager.getThinkingBudgets()),transport:this.settingsManager.getTransport(),maxRetryDelayMs:this.settingsManager.getRetrySettings().maxDelayMs,silent:!1,onPayload:async v=>{if(r.api!=="augment-chat-stream")return v;let w=await y,T={...v};if(w&&typeof w=="object")for(let P of["parentConversationId","rootConversationId","expertId","workflowId","subscriptionId","senderUserId","reasoningEffort"])P in w&&(T[P]=w[P]);return this._omitUnavailableReasoningEffort(T,c),{...T,conversationId:m,requestId:p,turnId:p,silent:!1}}},_=this._prepareDetachedStream?.()??this._detachedStreamFn;return{requestId:p,anchor:i,events:async function*(){try{if(u.messages=structuredClone(await a),f.signal.aborted)return;let v=await _(c,u,S);for await(let w of v){if(f.signal.aborted)return;w.type==="done"&&(h.answer=Wlr(w)),yield w}}catch(v){if(!f.signal.aborted)throw v}finally{b()}}(),cancel:g}}_appendWhenSettled(t){let n=`${t.anchor.sessionId}/${t.anchor.generation}/${t.acceptanceId}`,r=this._settledAppends.get(n);if(r&&r.result?.status!=="committed")return r.options.anchor===t.anchor&&r.options.question===t.question&&r.options.answer===t.answer?r.promise:Promise.resolve({status:"error",reason:"invalid-content"});let i=this._findKeptSideQuestion(t);if(i)return Promise.resolve(i);let s=this._detachedResults.get(t.anchor),o=s?.answer,a=s&&o&&!s.accepted&&s.question===t.question&&o.content.every(p=>p.type==="text")&&o.content.map(p=>p.type==="text"?p.text:"").join("")===t.answer,l,u=new Promise(p=>{l=p}),c={options:{...t},completion:a?{requestId:s.requestId,answer:structuredClone(o)}:void 0,promise:u,result:void 0,finish:p=>{c.result||(c.result=p,c.completion=void 0,this._detachedResults.delete(t.anchor),t.signal?.removeEventListener("abort",d),l(p))}},d=()=>c.finish({status:"cancelled"});return this._settledAppends.set(n,c),t.signal?.addEventListener("abort",d,{once:!0}),this._isCurrentAnchor(t.anchor)?t.signal?.aborted?d():a&&t.acceptanceId.trim()&&t.question.trim()&&t.answer.trim()||c.finish({status:"error",reason:"invalid-content"}):c.finish({status:"invalidated"}),!c.result&&s&&(s.accepted=!0),this._drainSettledAppends(),u}_findKeptSideQuestion(t){if(t.anchor.sessionId!==this.sessionManager.getSessionId())return;let n=this.sessionManager.findSideQuestion(t.acceptanceId);if(n==="incomplete")return{status:"error",reason:"storage"};if(n){let s=n.parentId?this.sessionManager.getEntry(n.parentId):void 0;return s?.type==="message"&&s.message.role==="user"&&s.message.content===t.question&&n.message.role==="assistant"&&n.message.content.map(a=>a.type==="text"?a.text:"").join("")===t.answer?{status:"committed",entryId:n.id}:{status:"error",reason:"invalid-content"}}let r=this.sessionManager.getBranch().find(s=>s.type==="custom_message"&&s.customType===OBe&&s.details?.acceptanceId===t.acceptanceId);if(r?.type!=="custom_message")return;let i=r.details;return i.question===t.question&&i.answer===t.answer?{status:"committed",entryId:r.id}:{status:"error",reason:"invalid-content"}}_canAppendSettled(){return!(this._hostAdmissions||this._pendingAgentEvents||this.isStreaming||this.isCompacting||this.isRetrying||this._manualCompactionReadiness||this._proactiveCompactionReadiness||this._reactiveRecovery||this.agent.hasQueuedMessages())}_drainSettledAppends(){for(let t of this._settledAppends.values()){if(t.result)continue;if(!this._canAppendSettled())return;let{options:n}=t;if(!this._isCurrentAnchor(n.anchor)){t.finish({status:"invalidated"});continue}let r=this._findKeptSideQuestion(n);if(r){t.finish(r);continue}let i=t.completion;if(!i){t.finish({status:"error",reason:"invalid-content"});continue}let s={role:"user",content:n.question,timestamp:Date.now()},o=i.answer,a;try{a=this.sessionManager.appendSideQuestion(s,o,{acceptanceId:n.acceptanceId,requestId:i.requestId})}catch{t.finish({status:"error",reason:"storage"});continue}this.agent.state.messages.push(s,o),t.finish({status:"committed",entryId:a});for(let l of[s,o])this._emit({type:"message_start",message:l}),this._emit({type:"message_end",message:l})}}subscribeBranchChange(t){return this._branchChangeListeners.add(t),()=>this._branchChangeListeners.delete(t)}async _emitBranchChange(t){if(t==="closing"){this._invalidateDetachedWork();for(let n of[...this._queueItems]){if(n.kind!=="custom"||n.status!=="pending")continue;let r=n.message;this.sessionManager.appendCustomMessageEntry(r.customType,r.content,r.display,r.details,n.id),this._finalizeQueueHandoff(n.id)}this._rebuildAgentQueues()}for(let n of this._branchChangeListeners)await n(t)}constructor(t){this._warnedInvalidReasoningPreferences=new Set,this._eventListeners=[],this._agentEventQueue=Promise.resolve(),this._recoveryDiagnosticsEnabled=cIt(),this._diagnosticPendingEvents=0,this._diagnosticPendingContinuations=0,this._diagnosticActiveContinuations=0,this._diagnosticDisposed=!1,this._steeringMessages=[],this._followUpMessages=[],this._queueItems=[],this._queuedMessageIds=new WeakMap,this._queuedMessages=new Map,this._customQueuePaused=!1,this._conversationGeneration=0,this._hostAdmissions=0,this._detachedClosed=!1,this._pendingAgentEvents=0,this._detachedRequests=new Set,this._detachedResults=new WeakMap,this._detachedInvalidationListeners=new Set,this._settledAppends=new Map,this.detachedCompletion={start:i=>this._startDetachedCompletion(i),append:i=>this._appendWhenSettled(i),isCurrent:i=>this._isCurrentAnchor(i),subscribeInvalidation:i=>(this._detachedInvalidationListeners.add(i),()=>this._detachedInvalidationListeners.delete(i))},this._pendingNextTurnMessages=[],this._branchChangeListeners=new Set,this._compactionAbortController=void 0,this._autoCompactionAbortController=void 0,this._abortGeneration=0,this._reactiveContinuationFailed=!1,this._overflowRecoveryAttempted=!1,this._overflowEvictionAttempted=!1,this._summarizeAndRetryAttempted=!1,this._branchSummaryAbortController=void 0,this._retryAbortController=void 0,this._retryAttempt=0,this._retryPromise=void 0,this._retryResolve=void 0,this._rateLimitAttempt=0,this._rateLimitDeadline=void 0,this._bashAbortController=void 0,this._pendingBashMessages=[],this._extensionRunner=void 0,this._turnIndex=0,this._nextProviderRequestId=void 0,this._nextProviderModel=void 0,this._activeTurnModelOverride=void 0,this._commandContexts=new WeakMap,this._currentRequestId=void 0,this._turnStartSeen=!1,this._baseToolDefinitions=new Map,this._extensionMode="interactive",this._extensionRole="parent",this._toolRegistry=new Map,this._toolDefinitions=new Map,this._toolPromptSnippets=new Map,this._toolPromptGuidelines=new Map,this._toolResultPostProcessor=Uar({compressors:[_Cr(),SCr(),mCr(),ETr(),$Cr(),QCr(),fTr()],rawStoragePolicy:Bar([vCr,pCr,_Tr,HCr,mTr])}),this._baseSystemPrompt="",this._lastAssistantMessage=void 0,this._handleAgentEvent=i=>{i.type==="message_start"&&this._markQueueItemExecuting(i.message),i.type==="message_start"&&kb(i.message.role)&&(this._activeCommandModel=this._resolveCommandModel(this._commandContexts.get(i.message)?.model)),this._createRetryPromiseForAgentEnd(i),this._createReactiveRecoveryForAgentEnd(i);let s=this._createAgentEndObservation(i),o=this._createProactiveCompactionReadinessForAgentEnd(i),a=()=>this._processAgentEvent(i,s).catch(d=>{throw this._resolveRetry(),this._rejectReactiveRecovery(d instanceof Error?d:new Error(String(d))),d}).finally(()=>{s?.resolve(),this._resolveProactiveCompactionReadiness(o),this._pendingAgentEvents--,this._drainSettledAppends()});if(this._pendingAgentEvents++,this._agentEventQueue=this._agentEventQueue.then(a,a),!this._recoveryDiagnosticsEnabled){this._agentEventQueue.catch(()=>{});return}this._diagnosticPendingEvents++;let l={agentEnd:i.type==="agent_end",messageEnd:i.type==="message_end",turnEnd:i.type==="turn_end"},u=l.agentEnd||l.messageEnd||l.turnEnd;u&&Xs("event_queued",{...this.recoveryDiagnosticState,...l});let c=d=>{this._diagnosticPendingEvents--,(u||d)&&Xs(d?"event_processing_failed":"event_processed",{...this.recoveryDiagnosticState,...l})};this._agentEventQueue.then(()=>c(!1),()=>c(!0))},this.agent=t.agent,this._prepareDetachedStream=t.prepareDetachedStream;let n=t.agent.streamFn;this._detachedStreamFn=async(i,s,o)=>{let a=await this._getRequiredRequestAuth(i);if(o?.signal?.aborted)throw new Error("Request cancelled");return n(a.model,s,{...o,...a})},this.sessionManager=t.sessionManager,this.settingsManager=t.settingsManager,this._scopedModels=(t.scopedModels??[]).filter(({model:i})=>ux(i)),this._resourceLoader=t.resourceLoader,this._customTools=t.customTools??[],this._cwd=t.cwd,this._agentDir=t.agentDir??Dr(),this._pluginDirs=t.pluginDirs,this._mcpConfigOverride=t.mcpConfigOverride,this._permissionOverride=t.permissionOverride,this._modelRegistry=t.modelRegistry,this._featureFlags=t.featureFlags,this._extensionRunnerRef=t.extensionRunnerRef,this._initialActiveToolNames=t.initialActiveToolNames,this._cliRemovedTools=t.removedTools?[...t.removedTools]:[],this._removedTools=new Set([...this._cliRemovedTools,...this.settingsManager.getRemovedToolsUnion()].flatMap(bd)),this._baseToolsOverride=t.baseToolsOverride,this._toolsOptions=t.toolsOptions,this._backgroundBashExecutor=t.toolsOptions?.bash?.backgroundExecutor,this._sessionStartEvent=t.sessionStartEvent??{type:"session_start",reason:"startup"},this._errorReporter=t.errorReporter??{reportSummarizationError:yar,reportAgentStop:bar},this._scheduler=t.scheduler??((i,s)=>{setTimeout(s,i)}),t.role!==void 0&&(this._extensionRole=t.role),this._unsubscribeAgent=this.agent.subscribe(this._handleAgentEvent),this._installAgentToolHooks(),this._installCallerRequestIdInjector(),this._installCommandModelOverride(),this._buildRuntime({activeToolNames:this._initialActiveToolNames,includeAllExtensionTools:!0});let r=this._resourceLoader.getEventBus?.();r&&(this._unsubscribeResourceChanges=r.on(IX,()=>this._refreshSystemPromptFromResources())),this._subscribeToSubagentUsage()}_subscribeToSubagentUsage(){let t=this._resourceLoader.getEventBus?.();if(!t)return;let n=s=>this._recordSubagentUsage(s),r=t.on("subagents:completed",n),i=t.on("subagents:failed",n);this._unsubscribeSubagentUsage=()=>{r(),i()}}_recordSubagentUsage(t){let n=t?.tokens,r=n?.total??0;if(r<=0)return;let i={input:n?.input??0,output:n?.output??0,total:r};this.sessionManager.appendCustomEntry(wTr,i)}get modelRegistry(){return this._modelRegistry}async _getRequiredRequestAuth(t){let n=await this._modelRegistry.getApiKeyAndHeaders(t);if(!n.ok)throw new Error(n.error);if(n.apiKey)return{model:n.baseUrl?{...t,baseUrl:n.baseUrl}:t,apiKey:n.apiKey,headers:n.headers};throw this._modelRegistry.isUsingOAuth(t)?new Error(`Authentication failed for "${t.provider}". Credentials may have expired or network is unavailable. Run '/login ${t.provider}' to re-authenticate.`):new Error(`No API key found for ${t.provider}.
6120
+ ${t.question}`}],timestamp:Date.now()});let a=Promise.resolve(this.agent.convertToLlm(o));a.catch(()=>{});let l=this.agent.state,u=structuredClone({systemPrompt:l.systemPrompt,messages:[],tools:l.tools.map(({name:v,description:w,parameters:T})=>({name:v,description:w,parameters:T})),rules:l.rules,skills:l.skills,userGuidelines:l.userGuidelines,workspaceGuidelines:l.workspaceGuidelines,systemPromptAppend:l.systemPromptAppend}),c=structuredClone(r),d=ss(r,l.reasoningEffortOverride??(l.usesModelDefault?void 0:l.thinkingLevel)),p=_q(),m=_q(),f=new AbortController,h={question:t.question,requestId:p,accepted:!1,answer:void 0};this._detachedResults.set(i,h),this._detachedRequests.add(f);let g=()=>{h.accepted||this._detachedResults.delete(i),f.abort()};t.signal?.addEventListener("abort",g,{once:!0});let b=()=>{t.signal?.removeEventListener("abort",g),this._detachedRequests.delete(f)};f.signal.addEventListener("abort",b,{once:!0}),t.signal?.aborted&&g();let A={conversationId:m,parentConversationId:i.sessionId,rootConversationId:i.sessionId,requestId:p,turnId:p,silent:!1},y=r.api==="augment-chat-stream"?this._extensionRunner?.emitBeforeProviderRequest(A,"detached")??A:void 0,S={signal:f.signal,sessionId:m,reasoning:r.api!=="augment-chat-stream"&&rb(l.thinkingLevel)&&l.thinkingLevel!=="off"?l.thinkingLevel:void 0,reasoningEffort:r.api==="augment-chat-stream"&&!d.usesModelDefault?d.effort:void 0,thinkingBudgets:structuredClone(this.settingsManager.getThinkingBudgets()),maxRetryDelayMs:this.settingsManager.getRetrySettings().maxDelayMs,silent:!1,onPayload:async v=>{if(r.api!=="augment-chat-stream")return v;let w=await y,T={...v};if(w&&typeof w=="object")for(let P of["parentConversationId","rootConversationId","expertId","workflowId","subscriptionId","senderUserId","reasoningEffort"])P in w&&(T[P]=w[P]);return this._omitUnavailableReasoningEffort(T,c),{...T,conversationId:m,requestId:p,turnId:p,silent:!1}}},_=this._prepareDetachedStream?.()??this._detachedStreamFn;return{requestId:p,anchor:i,events:async function*(){try{if(u.messages=structuredClone(await a),f.signal.aborted)return;let v=await _(c,u,S);for await(let w of v){if(f.signal.aborted)return;w.type==="done"&&(h.answer=Wlr(w)),yield w}}catch(v){if(!f.signal.aborted)throw v}finally{b()}}(),cancel:g}}_appendWhenSettled(t){let n=`${t.anchor.sessionId}/${t.anchor.generation}/${t.acceptanceId}`,r=this._settledAppends.get(n);if(r&&r.result?.status!=="committed")return r.options.anchor===t.anchor&&r.options.question===t.question&&r.options.answer===t.answer?r.promise:Promise.resolve({status:"error",reason:"invalid-content"});let i=this._findKeptSideQuestion(t);if(i)return Promise.resolve(i);let s=this._detachedResults.get(t.anchor),o=s?.answer,a=s&&o&&!s.accepted&&s.question===t.question&&o.content.every(p=>p.type==="text")&&o.content.map(p=>p.type==="text"?p.text:"").join("")===t.answer,l,u=new Promise(p=>{l=p}),c={options:{...t},completion:a?{requestId:s.requestId,answer:structuredClone(o)}:void 0,promise:u,result:void 0,finish:p=>{c.result||(c.result=p,c.completion=void 0,this._detachedResults.delete(t.anchor),t.signal?.removeEventListener("abort",d),l(p))}},d=()=>c.finish({status:"cancelled"});return this._settledAppends.set(n,c),t.signal?.addEventListener("abort",d,{once:!0}),this._isCurrentAnchor(t.anchor)?t.signal?.aborted?d():a&&t.acceptanceId.trim()&&t.question.trim()&&t.answer.trim()||c.finish({status:"error",reason:"invalid-content"}):c.finish({status:"invalidated"}),!c.result&&s&&(s.accepted=!0),this._drainSettledAppends(),u}_findKeptSideQuestion(t){if(t.anchor.sessionId!==this.sessionManager.getSessionId())return;let n=this.sessionManager.findSideQuestion(t.acceptanceId);if(n==="incomplete")return{status:"error",reason:"storage"};if(n){let s=n.parentId?this.sessionManager.getEntry(n.parentId):void 0;return s?.type==="message"&&s.message.role==="user"&&s.message.content===t.question&&n.message.role==="assistant"&&n.message.content.map(a=>a.type==="text"?a.text:"").join("")===t.answer?{status:"committed",entryId:n.id}:{status:"error",reason:"invalid-content"}}let r=this.sessionManager.getBranch().find(s=>s.type==="custom_message"&&s.customType===OBe&&s.details?.acceptanceId===t.acceptanceId);if(r?.type!=="custom_message")return;let i=r.details;return i.question===t.question&&i.answer===t.answer?{status:"committed",entryId:r.id}:{status:"error",reason:"invalid-content"}}_canAppendSettled(){return!(this._hostAdmissions||this._pendingAgentEvents||this.isStreaming||this.isCompacting||this.isRetrying||this._manualCompactionReadiness||this._proactiveCompactionReadiness||this._reactiveRecovery||this.agent.hasQueuedMessages())}_drainSettledAppends(){for(let t of this._settledAppends.values()){if(t.result)continue;if(!this._canAppendSettled())return;let{options:n}=t;if(!this._isCurrentAnchor(n.anchor)){t.finish({status:"invalidated"});continue}let r=this._findKeptSideQuestion(n);if(r){t.finish(r);continue}let i=t.completion;if(!i){t.finish({status:"error",reason:"invalid-content"});continue}let s={role:"user",content:n.question,timestamp:Date.now()},o=i.answer,a;try{a=this.sessionManager.appendSideQuestion(s,o,{acceptanceId:n.acceptanceId,requestId:i.requestId})}catch{t.finish({status:"error",reason:"storage"});continue}this.agent.state.messages.push(s,o),t.finish({status:"committed",entryId:a});for(let l of[s,o])this._emit({type:"message_start",message:l}),this._emit({type:"message_end",message:l})}}subscribeBranchChange(t){return this._branchChangeListeners.add(t),()=>this._branchChangeListeners.delete(t)}async _emitBranchChange(t){if(t==="closing"){this._invalidateDetachedWork();for(let n of[...this._queueItems]){if(n.kind!=="custom"||n.status!=="pending")continue;let r=n.message;this.sessionManager.appendCustomMessageEntry(r.customType,r.content,r.display,r.details,n.id),this._finalizeQueueHandoff(n.id)}this._rebuildAgentQueues()}for(let n of this._branchChangeListeners)await n(t)}constructor(t){this._warnedInvalidReasoningPreferences=new Set,this._eventListeners=[],this._agentEventQueue=Promise.resolve(),this._recoveryDiagnosticsEnabled=cIt(),this._diagnosticPendingEvents=0,this._diagnosticPendingContinuations=0,this._diagnosticActiveContinuations=0,this._diagnosticDisposed=!1,this._steeringMessages=[],this._followUpMessages=[],this._queueItems=[],this._queuedMessageIds=new WeakMap,this._queuedMessages=new Map,this._customQueuePaused=!1,this._conversationGeneration=0,this._hostAdmissions=0,this._detachedClosed=!1,this._pendingAgentEvents=0,this._detachedRequests=new Set,this._detachedResults=new WeakMap,this._detachedInvalidationListeners=new Set,this._settledAppends=new Map,this.detachedCompletion={start:i=>this._startDetachedCompletion(i),append:i=>this._appendWhenSettled(i),isCurrent:i=>this._isCurrentAnchor(i),subscribeInvalidation:i=>(this._detachedInvalidationListeners.add(i),()=>this._detachedInvalidationListeners.delete(i))},this._pendingNextTurnMessages=[],this._branchChangeListeners=new Set,this._compactionAbortController=void 0,this._autoCompactionAbortController=void 0,this._abortGeneration=0,this._reactiveContinuationFailed=!1,this._overflowRecoveryAttempted=!1,this._overflowEvictionAttempted=!1,this._summarizeAndRetryAttempted=!1,this._branchSummaryAbortController=void 0,this._retryAbortController=void 0,this._retryAttempt=0,this._retryPromise=void 0,this._retryResolve=void 0,this._rateLimitAttempt=0,this._rateLimitDeadline=void 0,this._bashAbortController=void 0,this._pendingBashMessages=[],this._extensionRunner=void 0,this._turnIndex=0,this._nextProviderRequestId=void 0,this._nextProviderModel=void 0,this._activeTurnModelOverride=void 0,this._commandContexts=new WeakMap,this._currentRequestId=void 0,this._turnStartSeen=!1,this._baseToolDefinitions=new Map,this._extensionMode="interactive",this._extensionRole="parent",this._toolRegistry=new Map,this._toolDefinitions=new Map,this._toolPromptSnippets=new Map,this._toolPromptGuidelines=new Map,this._toolResultPostProcessor=Uar({compressors:[_Cr(),SCr(),mCr(),ETr(),$Cr(),QCr(),fTr()],rawStoragePolicy:Bar([vCr,pCr,_Tr,HCr,mTr])}),this._baseSystemPrompt="",this._lastAssistantMessage=void 0,this._handleAgentEvent=i=>{i.type==="message_start"&&this._markQueueItemExecuting(i.message),i.type==="message_start"&&kb(i.message.role)&&(this._activeCommandModel=this._resolveCommandModel(this._commandContexts.get(i.message)?.model)),this._createRetryPromiseForAgentEnd(i),this._createReactiveRecoveryForAgentEnd(i);let s=this._createAgentEndObservation(i),o=this._createProactiveCompactionReadinessForAgentEnd(i),a=()=>this._processAgentEvent(i,s).catch(d=>{throw this._resolveRetry(),this._rejectReactiveRecovery(d instanceof Error?d:new Error(String(d))),d}).finally(()=>{s?.resolve(),this._resolveProactiveCompactionReadiness(o),this._pendingAgentEvents--,this._drainSettledAppends()});if(this._pendingAgentEvents++,this._agentEventQueue=this._agentEventQueue.then(a,a),!this._recoveryDiagnosticsEnabled){this._agentEventQueue.catch(()=>{});return}this._diagnosticPendingEvents++;let l={agentEnd:i.type==="agent_end",messageEnd:i.type==="message_end",turnEnd:i.type==="turn_end"},u=l.agentEnd||l.messageEnd||l.turnEnd;u&&Xs("event_queued",{...this.recoveryDiagnosticState,...l});let c=d=>{this._diagnosticPendingEvents--,(u||d)&&Xs(d?"event_processing_failed":"event_processed",{...this.recoveryDiagnosticState,...l})};this._agentEventQueue.then(()=>c(!1),()=>c(!0))},this.agent=t.agent,this._prepareDetachedStream=t.prepareDetachedStream;let n=t.agent.streamFn;this._detachedStreamFn=async(i,s,o)=>{let a=await this._getRequiredRequestAuth(i);if(o?.signal?.aborted)throw new Error("Request cancelled");return n(a.model,s,{...o,...a})},this.sessionManager=t.sessionManager,this.settingsManager=t.settingsManager,this._scopedModels=(t.scopedModels??[]).filter(({model:i})=>ux(i)),this._resourceLoader=t.resourceLoader,this._customTools=t.customTools??[],this._cwd=t.cwd,this._agentDir=t.agentDir??Dr(),this._pluginDirs=t.pluginDirs,this._mcpConfigOverride=t.mcpConfigOverride,this._permissionOverride=t.permissionOverride,this._modelRegistry=t.modelRegistry,this._featureFlags=t.featureFlags,this._extensionRunnerRef=t.extensionRunnerRef,this._initialActiveToolNames=t.initialActiveToolNames,this._cliRemovedTools=t.removedTools?[...t.removedTools]:[],this._removedTools=new Set([...this._cliRemovedTools,...this.settingsManager.getRemovedToolsUnion()].flatMap(bd)),this._baseToolsOverride=t.baseToolsOverride,this._toolsOptions=t.toolsOptions,this._backgroundBashExecutor=t.toolsOptions?.bash?.backgroundExecutor,this._sessionStartEvent=t.sessionStartEvent??{type:"session_start",reason:"startup"},this._errorReporter=t.errorReporter??{reportSummarizationError:yar,reportAgentStop:bar},this._scheduler=t.scheduler??((i,s)=>{setTimeout(s,i)}),t.role!==void 0&&(this._extensionRole=t.role),this._unsubscribeAgent=this.agent.subscribe(this._handleAgentEvent),this._installAgentToolHooks(),this._installCallerRequestIdInjector(),this._installCommandModelOverride(),this._buildRuntime({activeToolNames:this._initialActiveToolNames,includeAllExtensionTools:!0});let r=this._resourceLoader.getEventBus?.();r&&(this._unsubscribeResourceChanges=r.on(IX,()=>this._refreshSystemPromptFromResources())),this._subscribeToSubagentUsage()}_subscribeToSubagentUsage(){let t=this._resourceLoader.getEventBus?.();if(!t)return;let n=s=>this._recordSubagentUsage(s),r=t.on("subagents:completed",n),i=t.on("subagents:failed",n);this._unsubscribeSubagentUsage=()=>{r(),i()}}_recordSubagentUsage(t){let n=t?.tokens,r=n?.total??0;if(r<=0)return;let i={input:n?.input??0,output:n?.output??0,total:r};this.sessionManager.appendCustomEntry(wTr,i)}get modelRegistry(){return this._modelRegistry}async _getRequiredRequestAuth(t){let n=await this._modelRegistry.getApiKeyAndHeaders(t);if(!n.ok)throw new Error(n.error);if(n.apiKey)return{model:n.baseUrl?{...t,baseUrl:n.baseUrl}:t,apiKey:n.apiKey,headers:n.headers};throw this._modelRegistry.isUsingOAuth(t)?new Error(`Authentication failed for "${t.provider}". Credentials may have expired or network is unavailable. Run '/login ${t.provider}' to re-authenticate.`):new Error(`No API key found for ${t.provider}.
6121
6121
 
6122
6122
  Use /login or set an API key environment variable. See ${v2t($Re(),"providers.md")}`)}async _tryResolveSummarizationModel(){let t=this._resolveSummaryModelSelection({warn:!0});if(!t)return;let n=await this._modelRegistry.getApiKeyAndHeaders(t);if(!n.ok||!n.apiKey){tt.warn(`Summarization model "${t.provider}/${t.id}" has no usable auth; using main model.`);return}return{model:n.baseUrl?{...t,baseUrl:n.baseUrl}:t,apiKey:n.apiKey,headers:n.headers}}_resolveUserSummarizationModel({warn:t}){let n=this.settingsManager.getCompactionSettings().summarizationModel;if(!n)return;let r=n.indexOf("/");if(r<=0||r===n.length-1){t&&tt.warn(`Ignoring malformed compaction.summarizationModel "${n}" (expected "provider/model-id"); trying the configured fallback model.`);return}let i=n.slice(0,r),s=n.slice(r+1),o=this._modelRegistry.findSupported(i,s);return!o&&t&&tt.warn(`Ignoring compaction.summarizationModel "${n}" because it was not found in the registry; trying the configured fallback model.`),o}_resolveSummaryModelSelection({warn:t}={warn:!1}){let n=this._resolveUserSummarizationModel({warn:t});if(n)return n;let r=this.model,i=Yxt(this._featureFlags,r?[r.id,`${r.provider}/${r.id}`]:[]);if(i){if(this._isValidFlagSummarizationModelId(i)){let s=this._buildSummarizationModelById(i);if(s)return s}t&&tt.warn(`Summarization model "${i}" is invalid or could not be created from the registered Augment provider; trying the default summarization model.`)}return this._buildSummarizationModelById(NTr)}_isValidFlagSummarizationModelId(t){let n=t.split("/");return n.length===1&&n[0].length>0||n.length===2&&n[0]===CW&&n[1].length>0}_buildSummarizationModelById(t){let n=this._modelRegistry.getSupported().find(o=>o.provider===CW);if(!n)return;let r=t.startsWith(`${CW}/`)?t.slice(CW.length+1):t,i=this.model,s=TLe(this._featureFlags,i?[i.id,`${i.provider}/${i.id}`]:[]);return{...n,id:r,name:r,contextWindow:s.maxTokens??(r===NTr?FSo:n.contextWindow)}}_resolveCompactionSettings(t){let n=this.settingsManager.getCompactionSettings(),r=this.model,i=r?[r.id,`${r.provider}/${r.id}`]:[],s=TLe(this._featureFlags,i),o=this._resolveUserSummarizationModel({warn:!1})?void 0:Yxt(this._featureFlags,i),a=o?.startsWith(`${CW}/`)?o.slice(CW.length+1):o,l=t.provider===CW&&t.id===a;return{...n,reserveTokens:s.reserveTokens??n.reserveTokens,keepRecentTokens:s.keepRecentTokens??n.keepRecentTokens,inputBudgetTriggerRatio:n.inputBudgetTriggerRatio??s.inputBudgetTriggerRatio,fallbackInputBudgetRatio:n.fallbackInputBudgetRatio??s.fallbackInputBudgetRatio,maxMessageTokens:n.maxMessageTokens??(l?s.maxMessageTokens:void 0),summaryContextWindow:l?s.maxTokens:void 0}}_resolveSummaryTriggerModel(){return this._resolveSummaryModelSelection()??this.model}_resolveTriggerSizing(){let t=this._resolveSummaryModelSelection();if(!t)return{...ITr(this._resolveActiveTurnModel()),settings:this.settingsManager.getCompactionSettings()};let n=this._resolveCompactionSettings(t),r=Math.max(0,n.protectedHeadTokens??xBe);return{window:n.summaryContextWindow??t.contextWindow,triggerHeadroomTokens:r+n.keepRecentTokens,settings:n}}_installAgentToolHooks(){this.agent.beforeToolCall=async({toolCall:t,args:n})=>{let r=this._extensionRunner,i=r?.hasHandlers("tool_call")??!1,s=r?.hasHandlers("tool_decision")??!1;if(!r||!i&&!s)return;await this._agentEventQueue;let o=async l=>{s&&await r.emit(x0r({toolName:t.name,toolCallId:t.id,result:l}))},a;if(i)try{a=await r.emitToolCall({type:"tool_call",toolName:t.name,toolCallId:t.id,input:n})}catch(l){let u=l instanceof Error?l.message:`Extension error: ${l}`;throw await o({block:!0,reason:u,decisionSource:"hook"}),l instanceof Error?l:new Error(`Extension failed, blocking execution: ${String(l)}`)}return await o(a),a},this.agent.afterToolCall=async({toolCall:t,args:n,result:r,isError:i})=>{try{let s=Az(r,{toolName:t.name,isError:i}),o=i,a=this._extensionRunner;if(a?.hasHandlers("tool_result")){let c=await a.emitToolResult({type:"tool_result",toolName:t.name,toolCallId:t.id,input:n,content:s.content,details:o?void 0:s.details,isError:o});c&&!o&&(s={content:c.content??s.content,details:c.details??s.details,terminate:s.terminate},o=c.isError??o)}let l=o?void 0:this._buildNestedContextTailForTool(t.name,n),u=await this._toolResultPostProcessor.process({toolCall:t,args:n,result:s,isError:o,sessionDir:this.sessionManager.getSessionDir(),sessionId:this.sessionManager.getSessionId()});return this._finalizeAfterToolCall({originalResult:r,originalIsError:i,currentResult:s,currentIsError:o,processedResult:u,nestedContextTail:l})}catch{return tt.error("Tool result processing failed",{toolName:t.name}),{content:[{type:"text",text:kSo}],details:{},isError:!0}}}}_finalizeAfterToolCall(t){let{originalResult:n,originalIsError:r,currentResult:i,currentIsError:s,processedResult:o,nestedContextTail:a}=t;if(!(o||a))return OSo(n,r,i,s);let l=o??i;return{content:a?[...l.content,{type:"text",text:a}]:l.content,details:l.details,isError:s,terminate:l.terminate}}_buildNestedContextTailForTool(t,n){if(t!=="read"&&t!=="edit"&&t!=="write"||!n||typeof n!="object"||!("path"in n))return;let r=n.path;if(typeof r!="string"||r.length===0)return;let i=this._resourceLoader.loadContextFilesForPath?.(r);if(!(!i||i.length===0))return PSo(i)}_emit(t){t.type==="compaction_start"?Xs("compaction_start",{...this.recoveryDiagnosticState,overflow:t.reason==="overflow",threshold:t.reason==="threshold",summarizeAndRetry:t.reason==="summarize_and_retry"}):t.type==="compaction_end"&&Xs(t.result?"compaction_success":"compaction_failure",{...this.recoveryDiagnosticState,aborted:t.aborted,willRetry:t.willRetry,tokensBefore:t.result?.tokensBefore,tokensAfter:t.tokensAfter,durationMs:t.durationMs});for(let n of this._eventListeners)n(t)}_emitQueueUpdate(t=!0){t&&this._persistQueue(),this._emit({type:"queue_update",steering:[...this._steeringMessages],followUp:[...this._followUpMessages]})}_persistQueue(){this.sessionManager.persistQueueState(this._queueItems)}_markQueueItemExecuting(t){let n=this._queuedMessageIds.get(t),r=this._queueItems.find(i=>i.id===n);if(!(!r||r.status!=="pending")&&(r.status="executing",r.kind!=="custom")){let i=r.delivery==="steering"?this._steeringMessages:this._followUpMessages,s=i.indexOf(r.text);s!==-1&&i.splice(s,1)}}_finalizeQueueHandoff(t){if(!t)return;let n=this._queueItems.length;this._queueItems=this._queueItems.filter(r=>r.id!==t),this._queuedMessages.delete(t),this._queueItems.length!==n&&this._persistQueue()}restoreQueue(t){for(let n of t){if(n.kind==="custom"){this._customQueuePaused=!0,this._admitQueuedMessage({...n,status:"pending",delivery:"followUp"},n.message);continue}if(n.promptCommand){let{context:a,message:l}=n.promptCommand;this._commandContexts.set(l,a),this._trackQueued("followUp",n.text,l,n.promptCommand);continue}let{expandedText:r,invocation:i,ruleReference:s,commandContext:o}=this._expandInput(n.text,void 0);this._queueFollowUp(r,void 0,i,s,o)}return Promise.resolve()}_createRetryPromiseForAgentEnd(t){if(t.type!=="agent_end"||this._retryPromise)return;if(!this.settingsManager.getRetrySettings().enabled){Xs("retry_gate",{...this.recoveryDiagnosticState,enabled:!1});return}let r=this._findLastAssistantInMessages(t.messages),i=!!r&&this._isRetryableError(r);Xs("retry_gate",{...this.recoveryDiagnosticState,enabled:!0,hasAssistant:!!r,retryable:i}),i&&(this._retryPromise=new Promise(s=>{this._retryResolve=s}),Xs("retry_promise_created",this.recoveryDiagnosticState))}_createReactiveRecoveryForAgentEnd(t){if(t.type!=="agent_end"||this._reactiveRecovery)return;let n=this._findLastAssistantInMessages(t.messages);if(!n||!this._willRetryAfterAgentEnd(n))return;let r,i,s=new Promise((o,a)=>{r=o,i=a});s.catch(()=>{}),this._reactiveRecovery={promise:s,resolve:r,reject:i},this._reactiveRecoveryFailure=void 0,this._reactiveContinuationFailed=!1}_createAgentEndObservation(t){if(t.type!=="agent_end")return;let n,i={promise:new Promise(s=>{n=s}),resolve:n,recovery:this._reactiveRecovery?.promise,abortGeneration:this._abortGeneration};return this._latestAgentEndObservation=i,i}_createProactiveCompactionReadinessForAgentEnd(t){if(t.type!=="agent_end"||this._proactiveCompactionReadiness||!this.settingsManager.getCompactionSettings().enabled)return;let n=this._findLastAssistantInMessages(t.messages);if(!n||n.stopReason==="error"||n.stopReason==="aborted"||n.stopReason==="summarize_and_retry")return;let r,s={promise:new Promise(o=>{r=o}),resolve:r};return this._proactiveCompactionReadiness=s,s}_resolveProactiveCompactionReadiness(t){!t||this._proactiveCompactionReadiness!==t||(this._proactiveCompactionReadiness=void 0,t.resolve())}_findLastAssistantInMessages(t){for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.role==="assistant")return r}}async _processAgentEvent(t,n){if(this._recoveryDiagnosticsEnabled&&(t.type==="agent_end"||t.type==="message_end"||t.type==="turn_end")&&Xs("event_processing",{...this.recoveryDiagnosticState,agentEnd:t.type==="agent_end",messageEnd:t.type==="message_end",turnEnd:t.type==="turn_end"}),t.type==="turn_start"){if(this._turnStartSeen&&this.model?.provider==="augment"){let i=_q();this._nextProviderRequestId=i,this._currentRequestId=i}this._turnStartSeen=!0}t.type==="message_start"&&(kb(t.message.role)&&(this._overflowRecoveryAttempted=!1,this._overflowEvictionAttempted=!1,this._summarizeAndRetryAttempted=!1),this._queuedMessageIds.has(t.message)&&this._emitQueueUpdate());let r=MSo(t);if(await this._emitExtensionEvent(r),this._emit(r),t.type==="message_end"){let i=t.message.role==="toolResult"?C2t(t.message):t.message;if(i.role==="custom"){let s=this._queuedMessageIds.get(i);this.sessionManager.appendCustomMessageEntry(i.customType,i.content,i.display,i.details,s),this._finalizeQueueHandoff(s),s&&this._emitQueueUpdate(!1)}else if(i.role==="user"||i.role==="assistant"||i.role==="toolResult"){let s=i.role==="user"?this._queuedMessageIds.get(i):void 0;this.sessionManager.appendMessage(i,s),this._finalizeQueueHandoff(s)}else if(i.role==="promptCommandInvocation"){let s=this._queuedMessageIds.get(i);this.sessionManager.appendMessage(i,s),this._finalizeQueueHandoff(s)}else if(i.role==="ruleReference"){let s=this._queuedMessageIds.get(i);this.sessionManager.appendMessage(i,s),this._finalizeQueueHandoff(s)}if(t.message.role==="assistant"){this._lastAssistantMessage=t.message;let s=t.message;if(s.stopReason!=="error"&&(this._overflowRecoveryAttempted=!1,this._overflowEvictionAttempted=!1),s.stopReason!=="error"&&s.stopReason!=="summarize_and_retry"&&(this._activeTurnModelOverride=void 0,this._summarizeAndRetryAttempted=!1),s.stopReason!=="error"){let o=this._retryAttempt+this._rateLimitAttempt;o>0&&(this._logPublicRetry("Automatic retry completed",{attempt:o,outcome:"completed"}),this._emit({type:"auto_retry_end",success:!0,attempt:o})),this._retryAttempt=0,this._rateLimitAttempt=0,this._rateLimitDeadline=void 0}}}if(t.type==="agent_end"){let i=this._findLastAssistantInMessages(t.messages)??this._lastAssistantMessage;if(this._lastAssistantMessage=void 0,!i||n&&n.abortGeneration!==this._abortGeneration){this._resolveRetry(),this._resolveReactiveRecovery();return}i.stopReason==="error"&&i.errorMessage&&tt.error(`LLM error [${i.provider}/${i.model}]: ${i.errorMessage}`);let s=this._willAttemptAutomaticRetryAfterAgentEnd(i),o=!1;if(this._isRetryableError(i)){let u=await this._handleRetryableError(i);if(s&&this._extensionRunner&&await this._extensionRunner.emit({type:"agent_end_recovery",messages:t.messages,willRetry:u==="retrying",...u==="aborted"?{retryAborted:!0}:{}}),u==="retrying")return;o=u==="aborted"}this._resolveRetry(),i.stopReason==="error"&&!o&&(this._emit({type:"message_send_error",errorMessage:i.errorMessage}),this._willRecoverViaOverflowCompaction(i)||this._errorReporter.reportAgentStop({reason:this._isRetryableError(i)?"retry_exhausted":"error",errorMessage:i.errorMessage,provider:i.provider,model:i.model,stopReason:i.stopReason,transportError:Rv(i.diagnostics)})),i.stopReason==="empty_completion"&&this._errorReporter.reportAgentStop({reason:"empty_completion",provider:i.provider,model:i.model,stopReason:i.stopReason}),n?.resolve(),this._reactiveRecovery&&i.stopReason!=="error"&&i.stopReason!=="aborted"&&i.stopReason!=="summarize_and_retry"&&this._resolveReactiveRecovery();let a=this._willRetryAfterAgentEnd(i),l=!1;try{l=await this._checkCompaction(i)}catch(u){throw this._rejectReactiveRecovery(u instanceof Error?u:new Error(String(u))),u}finally{Xs("agent_end_recovery",{...this.recoveryDiagnosticState,retryScheduled:l}),a&&this._extensionRunner&&await this._extensionRunner.emit({type:"agent_end_recovery",messages:t.messages,willRetry:l,continuationFailed:!l&&this._reactiveContinuationFailed})}l||(this._activeCommandModel=void 0),!l&&this._reactiveRecovery&&(this._reactiveRecoveryFailure?this._rejectReactiveRecovery(this._reactiveRecoveryFailure):this._resolveReactiveRecovery())}}_willAttemptAutomaticRetryAfterAgentEnd(t){return this.settingsManager.getRetrySettings().enabled&&this._isRetryableError(t)}_willRetryAfterAgentEnd(t){return t.stopReason==="summarize_and_retry"?!this._summarizeAndRetryAttempted&&this.settingsManager.getCompactionSettings().enabled&&!this._isAssistantFromBeforeLatestCompaction(t):this._willRecoverViaOverflowCompaction(t)?!this._overflowRecoveryAttempted||!this._overflowEvictionAttempted:!1}_resolveReactiveRecovery(){let t=this._reactiveRecovery;t&&(this._reactiveRecovery=void 0,this._reactiveRecoveryFailure=void 0,this._reactiveContinuationFailed=!1,t.resolve())}_rejectReactiveRecovery(t){let n=this._reactiveRecovery;n&&(this._reactiveRecovery=void 0,this._reactiveRecoveryFailure=void 0,this._reactiveContinuationFailed=!1,n.reject(t))}_recordReactiveRecoveryFailure(t){this._reactiveRecovery&&!this._reactiveRecoveryFailure&&(this._reactiveRecoveryFailure=new Error(t))}_resolveRetry(){this._retryResolve&&(this._retryResolve(),this._retryResolve=void 0,this._retryPromise=void 0,Xs("retry_resolved",this.recoveryDiagnosticState))}_findLastAssistantMessage(){let t=this.agent.state.messages;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.role==="assistant")return r}}async _emitExtensionEvent(t){if(this._extensionRunner){if(t.type==="agent_start")this._turnIndex=0,await this._extensionRunner.emit({type:"agent_start"});else if(t.type==="agent_end"){let n=this._lastAssistantMessage;await this._extensionRunner.emit({type:"agent_end",messages:t.messages,willRetry:n!==void 0&&(this._willAttemptAutomaticRetryAfterAgentEnd(n)||this._willRetryAfterAgentEnd(n))})}else if(t.type==="turn_start"){let n={type:"turn_start",turnIndex:this._turnIndex,timestamp:Date.now()};await this._extensionRunner.emit(n)}else if(t.type==="turn_end"){let n={type:"turn_end",turnIndex:this._turnIndex,message:t.message,toolResults:t.toolResults};await this._extensionRunner.emit(n),this._turnIndex++}else if(t.type==="message_start"){let n={type:"message_start",message:t.message};await this._extensionRunner.emit(n)}else if(t.type==="message_update"){let n={type:"message_update",message:t.message,assistantMessageEvent:t.assistantMessageEvent};await this._extensionRunner.emit(n)}else if(t.type==="message_end"){let n={type:"message_end",message:t.message};await this._extensionRunner.emit(n)}else if(t.type==="tool_execution_start"){let n={type:"tool_execution_start",toolCallId:t.toolCallId,toolName:t.toolName,args:t.args};await this._extensionRunner.emit(n)}else if(t.type==="tool_execution_update"){let n={type:"tool_execution_update",toolCallId:t.toolCallId,toolName:t.toolName,args:t.args,partialResult:t.partialResult};await this._extensionRunner.emit(n)}else if(t.type==="tool_execution_end"){let n={type:"tool_execution_end",toolCallId:t.toolCallId,toolName:t.toolName,result:t.result,isError:t.isError};await this._extensionRunner.emit(n)}}}subscribe(t){return this._eventListeners.push(t),()=>{let n=this._eventListeners.indexOf(t);n!==-1&&this._eventListeners.splice(n,1)}}_disconnectFromAgent(){this._unsubscribeAgent&&(this._unsubscribeAgent(),this._unsubscribeAgent=void 0)}_reconnectToAgent(){this._unsubscribeAgent||(this._unsubscribeAgent=this.agent.subscribe(this._handleAgentEvent))}async dispose(){this.closeDetachedCompletions();try{(this._proactiveCompactionReadiness||this._reactiveRecovery)&&await this.waitForAutomaticCompaction()}catch{}finally{this._diagnosticDisposed=!0,Xs("session_dispose",this.recoveryDiagnosticState),this._disconnectFromAgent(),this._unsubscribeResourceChanges?.(),this._unsubscribeResourceChanges=void 0,this._unsubscribeSubagentUsage?.(),this._unsubscribeSubagentUsage=void 0,this._eventListeners=[]}}async waitForAutomaticCompaction(){for(;this._proactiveCompactionReadiness||this._reactiveRecovery;)await Promise.all([this._proactiveCompactionReadiness?.promise,this._reactiveRecovery?.promise])}_getSubagentTokens(){let t=0;for(let n of this.sessionManager.getBranch())if(n.type==="custom"&&n.customType===wTr){let r=n.data;t+=r?.total??0}return t}async generateSessionName(t){let n=LSo(t),r=this.model;if(!(n&&r))return n;try{let i=await this._getRequiredRequestAuth(r),s=`Write a concise session title for the user message below.
6123
6123
  Use a topic-first noun phrase in Title Case, without action verbs like Investigate, Fix, or Validate. Use at most 6 words, excluding any ticket prefix.
@@ -6199,7 +6199,7 @@ Current working directory: ${e.fallbackCwd}`}function m4e(e){return`cwd from ses
6199
6199
  ${e.sessionCwd}
6200
6200
 
6201
6201
  continue in current cwd
6202
- ${e.fallbackCwd}`}function UW(e,t){let n=fMt(e,t);if(n)throw new n9(n)}var n9,nhe=C(()=>{"use strict";n9=class extends Error{constructor(t){super(BRo(t)),this.name="MissingSessionCwdError",this.issue=t}}});function JNr(e){let{reporter:t,sessionId:n,getRequestId:r}=e;return i=>{if(i.type==="tool_execution_start"){t.toolStarted(n,{toolCallId:i.toolCallId,toolName:i.toolName,args:i.args});return}i.type==="tool_execution_end"&&t.toolEnded(n,{toolCallId:i.toolCallId,toolName:i.toolName,result:i.result,isError:i.isError,requestId:r()})}}var ekr=C(()=>{"use strict"});function tkr(e){return{total_history_char_count:0,total_history_exchange_count:0,head_char_count:0,head_exchange_count:0,head_last_request_id:"",tail_char_count:0,tail_exchange_count:0,tail_last_request_id:"",summary_char_count:e.summaryCharCount,summarization_duration_ms:e.durationMs??0,is_cache_about_to_expire:!1,is_aborted:e.aborted??!1,total_history_token_count:e.tokensBefore,head_token_count:e.tokensBefore,tail_token_count:e.tokensAfter??0,tokens_from_backend:!1}}function nkr(e,t){if(e.truncated)return{original_char_count:e.totalBytes,original_line_count:e.totalLines,truncated_char_count:e.outputBytes,truncated_line_count:e.outputLines,tool_type:t}}function rkr(e){let{source:t,scope:n}=e.sourceInfo;return n==="user"||n==="project"?n:t}function ikr(e){let t=e.filter(n=>!n.disableModelInvocation);if(t.length!==0)return{skills:t.map(n=>({skill_name:n.name,skill_source:rkr(n)})),skill_count:t.length}}function skr(e,t,n){return{skill_name:e.name,skill_source:rkr(e),content_length:t,source_tool:n}}function okr(e,t){return{retrieval_mode:t?.retrievalMode??"codebase_only",total_elapsed_ms:Nu(e.totalElapsedMs),api_call_elapsed_ms:Nu(e.apiCallElapsedMs),rerank_elapsed_ms:Nu(e.rerankElapsedMs),enrich_elapsed_ms:Nu(e.enrichElapsedMs),codebase_retrieval_elapsed_ms:Nu(e.codebaseRetrievalElapsedMs),conversation_retrieval_elapsed_ms:Nu(e.conversationRetrievalElapsedMs),conversation_initial_retrieval_ms:Nu(e.conversationInitialRetrievalMs),conversation_query_rewriting_ms:Nu(e.conversationQueryRewritingMs),conversation_followup_retrieval_ms:Nu(e.conversationFollowupRetrievalMs),blob_name_lookup_ms:Nu(e.blobNameLookupMs),codebase_chunks_retrieved:Nu(e.codebaseChunksRetrieved),conversation_chunks_initial:Nu(e.conversationChunksInitial),conversation_queries_generated:Nu(e.conversationQueriesGenerated),conversation_chunks_followup:Nu(e.conversationChunksFollowup),conversation_chunks_combined:Nu(e.conversationChunksCombined),conversation_chunks_after_rerank:Nu(e.conversationChunksAfterRerank),codebase_result_len_pre_truncation:Nu(e.codebaseResultLenPreTruncation),codebase_result_len:Nu(e.codebaseResultLen),conversation_result_len_pre_truncation:Nu(e.conversationResultLenPreTruncation),conversation_result_len:Nu(e.conversationResultLen),combined_result_len:Nu(e.combinedResultLen),total_budget:Nu(e.totalBudget),codebase_budget:Nu(e.codebaseBudget),conversation_budget:Nu(e.conversationBudget),codebase_truncated:f4e(e.codebaseTruncated),conversation_truncated:f4e(e.conversationTruncated),final_truncated:f4e(e.finalTruncated),is_sub_agent:f4e(t?.isSubAgent)}}var Nu,f4e,akr=C(()=>{"use strict";Nu=e=>e??0,f4e=e=>e??!1});import{randomUUID as LRo}from"node:crypto";function VRo(e){if(typeof e!="object"||e===null)return;let t=e.details;if(!(typeof t!="object"||t===null))return t}function GRo(e,t){if(e===t)return!0;if(!([...t].some(i=>lkr.has(i))&&e.endsWith(t)))return!1;let r=e.at(-t.length-1);return r!==void 0&&lkr.has(r)}function WRo(e,t){return t.find(n=>GRo(n.filePath,e))}function ckr(e){let t=new hMt(e);return n=>t.handle(n)}function $Ro(e){if(typeof e!="object"||e===null)return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function ukr(e){let t=ikr(e.skills);t&&e.reporter.skillsIncludedInChat(e.sessionId,t)}var FRo,URo,lkr,hMt,dkr=C(()=>{"use strict";akr();FRo={"codebase-retrieval":"codebase_only","session-retrieval":"conversation_only"},URo={read:"read","web-fetch":"web-fetch",bash:"bash"};lkr=new Set(["/","\\"]);hMt=class{constructor(t){this.readPathsByCallId=new Map,this.options=t}handle(t){if(t.type==="compaction_start"){this.pendingCompactionChatHistoryLength=this.options.getChatHistoryLength?.();return}if(t.type==="compaction_end"){this.emitCompaction(t);return}if(t.type==="tool_execution_start"){this.rememberReadPath(t);return}if(t.type!=="tool_execution_end")return;let n=this.readPathsByCallId.get(t.toolCallId);if(this.readPathsByCallId.delete(t.toolCallId),t.isError)return;let r=VRo(t.result);this.emitTruncation(t.toolName,r),this.emitRetrieval(t.toolName,r),this.emitSkillContent(t.toolName,n,t.result)}emitCompaction(t){let n=this.pendingCompactionChatHistoryLength??0;this.pendingCompactionChatHistoryLength=void 0,!(t.aborted||!t.result)&&this.options.reporter.chatHistorySummarization(this.options.sessionId,LRo(),n,tkr({summaryCharCount:t.result.summary.length,tokensBefore:t.result.tokensBefore,tokensAfter:t.tokensAfter,durationMs:t.durationMs,aborted:!1}))}rememberReadPath(t){if(t.toolName!=="read")return;let n=t.args?.path;typeof n=="string"&&this.readPathsByCallId.set(t.toolCallId,n)}emitTruncation(t,n){let r=URo[t];if(!(r&&n?.truncation))return;let i=nkr(n.truncation,r);i&&this.options.reporter.contentTruncation(this.options.sessionId,i)}emitRetrieval(t,n){let r=FRo[t];r&&n?.analytics&&this.options.reporter.retrievalToolUsed(this.options.sessionId,okr(n.analytics,{retrievalMode:r}))}emitSkillContent(t,n,r){if(t!=="read"||!n)return;let i=WRo(n,this.options.getSkills());i&&this.options.reporter.skillContentLoaded(this.options.sessionId,skr(i,$Ro(r),"read"))}}});function pkr(e){return e==="8"?{kind:"mode-disabled",message:QRo}:{kind:"generic"}}var QRo,gMt=C(()=>{"use strict";QRo="CLI mode access has been disabled for your account. If you believe this to be an error, please contact your administrator."});function bMt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function h4e(e,...t){for(let n of t){let r=e[n];if(bMt(r))return r}}function VW(e,...t){for(let n of t){let r=e[n];if(typeof r=="string")return r}}function ZRo(e){if(typeof e=="string")return e.trim().length>0?{kind:"text",text:e}:null;if(!bMt(e))return null;let t=bMt(e.block)?e.block:e,n=h4e(t,"text","Text");if(n){let o=VW(n,"text");if(o!==void 0&&o.trim().length>0)return{kind:"text",text:o}}let r=h4e(t,"tool_use","toolUse","ToolUse");if(r){let o=VW(r,"id"),a=VW(r,"name");if(!o||!a)return null;let l=VW(r,"input");return{kind:"tool_use",toolUseId:o,toolName:a,inputJson:l&&l.trim().length>0?l:"{}"}}let i=h4e(t,"tool_result","toolResult","ToolResult");if(i){let o=VW(i,"tool_use_id","toolUseId");if(!o)return null;let a=i.is_error??i.isError;return{kind:"tool_result",toolUseId:o,content:VW(i,"content")??"",isError:typeof a=="boolean"?a:!1}}let s=h4e(t,"thinking","Thinking");if(s){let o=VW(s,"content");if(o!==void 0)return{kind:"thinking",content:o}}return null}function mkr(e){if(!Array.isArray(e.content))return[];let t=[];for(let n of e.content){let r=ZRo(n);r!==null&&t.push(r)}return t}function jRo(e){let t=[],n=[];for(let r of e)if(r.kind==="text"){if(r.text.trim().length===0)continue;n.push(r.text),t.push({type:nUe,text_node:{content:r.text}})}else r.kind==="tool_result"&&t.push({type:_Nt,tool_result_node:{content:r.content,is_error:r.isError}});return{requestNodes:t,requestText:n.join("")}}function zRo(e){let t=[],n=[],r=[],i=()=>{if(r.length===0)return;let s=r.join("");r.length=0,s.trim().length!==0&&t.push({type:rUe,content:s})};for(let s of e)if(s.kind==="text"){if(s.text.trim().length===0)continue;n.push(s.text),r.push(s.text)}else s.kind==="tool_use"?(i(),t.push({type:SNt,content:"",tool_use:{tool_name:s.toolName,input_json:s.inputJson}})):s.kind==="thinking"&&(i(),t.push({type:vNt,content:s.content,thinking:{content:s.content}}));return i(),{responseNodes:t,responseText:n.join("")}}function XRo(e){let t=[];for(let n of e)if(n.role==="user")t.push({user:n,assistants:[]});else if(n.role==="assistant"){let r=t.at(-1);r?r.assistants.push(n):t.push({assistants:[n]})}return t.map(({user:n,assistants:r})=>{let{requestNodes:i,requestText:s}=jRo(n?mkr(n):[]),{responseNodes:o,responseText:a}=zRo(r.flatMap(mkr));return{request_message:s,response_text:a,request_id:n?.id??r[0]?.id??"",request_nodes:i,response_nodes:o}})}async function qRo(e){let t=await e.fetchImpl(`${e.baseUrl}cloud-agents/agents/get-messages`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`,...e.userAgent?{"User-Agent":e.userAgent}:{}},body:JSON.stringify({agent_id:e.agentId,limit:HRo,...e.beforeTimestamp?{before_timestamp:e.beforeTimestamp}:{}})});if(!t.ok)throw new Error(`Fetching cloud-agent chat history failed: ${t.status} ${t.statusText}`);return await t.json()}async function KRo(e){let t=new Set,n=[],r;for(let o=0;o<YRo;o++){let a=await qRo({...e,beforeTimestamp:r}),l=Array.isArray(a.messages)?a.messages:[];n.push(l);let u=JRo(l,t),c=a.oldest_timestamp;if(a.has_next!==!0||l.length===0||!c||u===0)break;r=c}let i=new Set,s=[];for(let o=n.length-1;o>=0;o--)for(let a of n[o]){let l=a.id;if(l!==void 0){if(i.has(l))continue;i.add(l)}s.push(a)}return s}function JRo(e,t){let n=0;for(let r of e)(r.id===void 0||!t.has(r.id))&&n++,r.id!==void 0&&t.add(r.id);return n}function yMt(e){let t=e.fetchImpl??globalThis.fetch.bind(globalThis);return async n=>{let r=await e.readCredentials();if(!r)throw new Error("view-session requires an Augment login. Please sign in and try again.");let i=r.apiUrl.endsWith("/")?r.apiUrl:`${r.apiUrl}/`,s=await KRo({fetchImpl:t,baseUrl:i,apiKey:r.apiKey,userAgent:e.userAgent,agentId:n});return XRo(s)}}var HRo,YRo,fkr=C(()=>{"use strict";oUe();HRo=400,YRo=200});import{delimiter as tNo,isAbsolute as AMt,join as nNo,resolve as rhe}from"node:path";function rNo(e){return e.map(t=>{if(t.type!=="message")return{type:t.type,id:t.id,parentId:t.parentId};let n=t.message,r=typeof n.content=="string"?n.content:n.content.map(i=>({type:i.type,text:"text"in i?i.text:void 0}));return{type:t.type,id:t.id,parentId:t.parentId,message:{role:n.role,content:r,timestamp:n.timestamp}}})}function iNo(e){if(e instanceof Error){let t=e;return typeof t.status=="number"?String(t.status):typeof t.httpStatus=="number"?String(t.httpStatus):e.message}return String(e)}function sNo(e,t){let n=iNo(e);if(n!=="8"){let r=e instanceof Error?e.message:String(e);t.push({type:"error",message:`Failed to fetch feature flags: ${r}`})}return{flags:al(void 0),errorStatus:n}}function oNo(e,t,n){if(e.allowClientFeatureFlagOverrides!==!0)return e;let r=t.getFeatureFlagOverrides();if(!r)return e;try{let i=Mpr(r);return Ppr(e,i)}catch(i){let s=i instanceof Error?i.message:String(i);return n.push({type:"warning",message:`Failed to parse feature flag overrides, ignoring them: ${s}`}),e}}function aNo(e){return e.cosmosMultiRepoContextEnabled===!0}function lNo(e){return e.cosmosNestedAgentsMdEnabled===!0}function cNo(e,t,n){return e===void 0?void 0:{tenantUrl:e,userId:t,userEmail:n}}function uNo(e){return typeof e=="object"&&e!==null&&"workspacePath"in e&&"sourceWorkspacePath"in e&&"repositoryRoot"in e&&typeof e.workspacePath=="string"&&typeof e.sourceWorkspacePath=="string"&&typeof e.repositoryRoot=="string"&&AMt(e.workspacePath)&&AMt(e.sourceWorkspacePath)&&AMt(e.repositoryRoot)}function dNo(e,t){if(!e)return[];try{let n=JSON.parse(process.env.AUGMENT_DAEMON_INDEXING_WORKSPACES??"[]");if(!Array.isArray(n))return[];let r=new Map;for(let i of n){if(!uNo(i))continue;let s=rhe(i.workspacePath);t.has(s)&&r.set(s,{sourceWorkspacePath:rhe(i.sourceWorkspacePath),repositoryRoot:rhe(i.repositoryRoot)})}return[...r].map(([i,s])=>({workspacePath:i,...s}))}catch{return[]}}function pNo(e,t,n){let{allowDirs:r,denyDirs:i}=t.getIndexingDirsUnion(),s=n?.get("parent-daemon-id"),o=typeof s=="string"&&s.length>0,a=n?.get("cloud-agent"),l=typeof a=="string"&&a.length>0,u=o&&l,c=new Set([rhe(e)]),d=n?.get("add-workspace");if(typeof d=="string")for(let m of d.split(tNo))m.length>0&&c.add(rhe(m));let p=dNo(u,c);return{allowDirs:r,denyDirs:i,daemonChild:u,allowIndexingFlag:n?.get("allow-indexing")===!0,repositoryRoots:p}}function mNo(e,t){if(!t)return[];let n=[],r=e.getExtensions(),i=new Map;for(let o of r.extensions)for(let[a,l]of o.flags)i.set(a,{type:l.type});let s=[];for(let[o,a]of t){let l=i.get(o);if(!l){s.push(o);continue}if(l.type==="boolean"){r.runtime.flagValues.set(o,!0);continue}if(typeof a=="string"){r.runtime.flagValues.set(o,a);continue}n.push({type:"error",message:`Extension flag "--${o}" requires a value`})}return s.length>0&&n.push({type:"error",message:`Unknown option${s.length===1?"":"s"}: ${s.map(o=>`--${o}`).join(", ")}`}),n}function fNo(e){return e.prefetchedAugment?Promise.resolve(e.prefetchedAugment.modelConfig):e.augmentApiPromise?.then(t=>t.getModelConfig())}async function hNo({options:e,modelRegistry:t,augmentUserAgent:n}){if(e.resourceDiscoveryOnly)return{augmentCredentials:null,augmentApiPromise:void 0,modelConfigPromise:void 0};let r=e.prefetchedAugment?.credentials??await Xc(),i=r?rl(r.apiKey,r.apiUrl,n):void 0,s=fNo({prefetchedAugment:e.prefetchedAugment,augmentApiPromise:i});return await t.discoverAugmentModels(n,{credentials:r,modelConfig:s}),{augmentCredentials:r,augmentApiPromise:i,modelConfigPromise:s}}async function ihe(e){let t=e.cwd,n=e.agentDir??Dr(),r=e.authStorage??Nx.create(nNo(n,"auth.json")),i=e.settingsManager??gi.create(t,n),s=e.modelRegistry??QB.empty(r),o=e.augmentUserAgent??tf(),{augmentCredentials:a,augmentApiPromise:l,modelConfigPromise:u}=await hNo({options:e,modelRegistry:s,augmentUserAgent:o}),c=WB(),d={};c.on("conversation:identity",y=>{typeof y=="object"&&y!==null&&"conversationId"in y&&(typeof y.conversationId=="string"||y.conversationId===void 0)&&(d.conversationId=y.conversationId)}),$yr(c);let p=[],m,f={flags:al(void 0)},h,g;if(l&&u)try{m=await l;let y=await u;h=y.user?.id,g=y.user?.email,ehe({id:h,email:g});let S=al(y.featureFlagsV2);f={flags:oNo(S,i,p)}}catch(y){f=sNo(y,p)}let b=new bL({...e.resourceLoaderOptions??{},readOnlyPackages:e.resourceDiscoveryOnly||e.resourceLoaderOptions?.readOnlyPackages,cwd:t,agentDir:n,settingsManager:i,eventBus:c,multiRepoContextEnabled:aNo(f.flags),nestedContextDescentEnabled:lNo(f.flags)});await b.reload(),a&&m&&(c.emit("augment:api",m),c.emit("augment:credentials",{apiKey:a.apiKey,apiUrl:a.apiUrl,userAgent:o,userId:h,email:g,cliVersion:gs}));let A=b.getExtensions();for(let{name:y,config:S,extensionPath:_}of A.runtime.pendingProviderRegistrations)try{s.registerProvider(y,S)}catch(x){let v=x instanceof Error?x.message:String(x);p.push({type:"error",message:`Extension "${_}" error: ${v}`})}return A.runtime.pendingProviderRegistrations=[],p.push(...mNo(b,e.extensionFlagValues)),c.emit("augment:indexing-policy",pNo(t,i,e.extensionFlagValues)),c.emit("augment:feature-flags",f),c.emit("augment:feature-flags-startup-complete",void 0),{cwd:t,agentDir:n,conversationIdentity:d,pluginDirs:e.pluginDirs,mcpConfigOverride:e.mcpConfigOverride,permissionOverride:e.permissionOverride,authStorage:r,settingsManager:i,modelRegistry:s,resourceLoader:b,diagnostics:p,augmentUserAgent:o,augmentApi:m,augmentAccount:cNo(a?.apiUrl,h,g),featureFlags:f}}function she(e){let t=e.services.augmentApi,n=t?{viewSession:{operations:{fetchChatHistory:xNt({readCredentials:Xc,userAgent:e.services.augmentUserAgent}),fetchCloudAgentChatHistory:yMt({readCredentials:Xc,userAgent:e.services.augmentUserAgent})}},sessionRetrieval:{operations:{createRequestId:t.createRequestId.bind(t),agentCodebaseRetrieval:t.agentCodebaseRetrieval.bind(t),fetchCloudAgentChatHistory:yMt({readCredentials:Xc,userAgent:e.services.augmentUserAgent}),fetchChatHistory:xNt({readCredentials:Xc,userAgent:e.services.augmentUserAgent}),getBranch:()=>rNo(e.sessionManager.getBranch())}}}:void 0;return g4e({cwd:e.services.cwd,agentDir:e.services.agentDir,authStorage:e.services.authStorage,settingsManager:e.services.settingsManager,modelRegistry:e.services.modelRegistry,augmentUserAgent:e.services.augmentUserAgent,resourceLoader:e.services.resourceLoader,sessionManager:e.sessionManager,model:e.model,thinkingLevel:e.thinkingLevel,scopedModels:e.scopedModels,tools:e.tools,customTools:e.customTools,removedTools:e.removedTools,sessionStartEvent:e.sessionStartEvent,toolsOptions:{...n,bash:e.bashOptions},featureFlags:e.services.featureFlags.flags,pluginDirs:e.services.pluginDirs,mcpConfigOverride:e.services.mcpConfigOverride,permissionOverride:e.services.permissionOverride})}var EMt=C(()=>{"use strict";Bi();Ol();gMt();Us();t9();gh();Afe();Ode();dG();Qpe();nf();tme();_Mt();fkr();CNt()});import{copyFileSync as gNo,existsSync as hkr,mkdirSync as bNo}from"node:fs";import{basename as yNo,join as ANo,resolve as gkr}from"node:path";function ENo(e){return typeof e=="string"?e:e.filter(t=>t.type==="text"&&typeof t.text=="string").map(t=>t.text).join("")}async function b4e(e,t){UW(t.sessionManager,t.cwd);let n=await e(t);return process.cwd()!==n.services.cwd&&process.chdir(n.services.cwd),new ohe(n.session,n.services,e,n.diagnostics,n.modelFallbackMessage,t.usageReporter,t.toolUseReporter,t.enableSentrySummarizationSpans,t.backgroundBashEligible)}var ohe,SMt=C(()=>{"use strict";t3e();t9();Dde();MS();nhe();KA();ekr();dkr();EMt();ohe=class{subscribeLifecycle(t){return this.lifecycleListeners.add(t),()=>this.lifecycleListeners.delete(t)}async emitLifecycle(t){for(let n of this.lifecycleListeners)await n(t)}constructor(t,n,r,i=[],s,o,a,l=!1,u=!1){this.lifecycleListeners=new Set,this.backgroundBashEligible=u,this._session=t,this._services=n,this.createRuntime=r,this._diagnostics=i,this._modelFallbackMessage=s,this._usageReporter=o,this._toolUseReporter=a,this.enableSentrySummarizationSpans=l,this.attachUsageReporter(),this.attachSummarizationTracer()}attachUsageReporter(){let t=this._usageReporter,n=this._toolUseReporter;if(!(t||n))return;let r=this._session,i=r.sessionId,s=t?ckr({reporter:t,sessionId:i,getSkills:()=>this._services.resourceLoader.getSkills().skills,getChatHistoryLength:()=>r.sessionManager.getBranch().length}):void 0;t&&(t.sessionStarted(i),ukr({reporter:t,sessionId:i,skills:this._services.resourceLoader.getSkills().skills}));let o=n?JNr({reporter:n,sessionId:i,getRequestId:()=>r.currentRequestId}):void 0;this._usageUnsubscribe=r.subscribe(a=>{t&&a.type==="message_start"&&kb(a.message.role)&&t.userMessageSent(i),s?.(a),o?.(a)})}setAugmentAccount(t){this._services.augmentAccount=t,t?.userId||t?.userEmail?ehe({id:t.userId,email:t.userEmail}):uMt()}attachSummarizationTracer(){if(!this.enableSentrySummarizationSpans)return;let t=UTr();this._summarizationSubscriber=t,this._summarizationUnsubscribe=this._session.subscribe(t.handle)}detachSummarizationTracer(){this._summarizationUnsubscribe?.(),this._summarizationUnsubscribe=void 0,this._summarizationSubscriber?.dispose(),this._summarizationSubscriber=void 0}detachUsageReporter(){let t=this._usageReporter,n=this._toolUseReporter;(t||n)&&(this._usageUnsubscribe?.(),this._usageUnsubscribe=void 0,t?.sessionEnded(this._session.sessionId))}get services(){return this._services}get session(){return this._session}get cwd(){return this._services.cwd}get diagnostics(){return this._diagnostics}get modelFallbackMessage(){return this._modelFallbackMessage}async emitBeforeSwitch(t,n){let r=this.session.extensionRunner;return r?.hasHandlers("session_before_switch")?{cancelled:(await r.emit({type:"session_before_switch",reason:t,targetSessionFile:n}))?.cancel===!0}:{cancelled:!1}}async emitBeforeFork(t){let n=this.session.extensionRunner;return n?.hasHandlers("session_before_fork")?{cancelled:(await n.emit({type:"session_before_fork",entryId:t}))?.cancel===!0}:{cancelled:!1}}async teardownCurrent(){this.session.closeDetachedCompletions(),await this.emitLifecycle("closing"),await this.session.waitForAutomaticCompaction().catch(()=>{}),this.detachUsageReporter(),this.detachSummarizationTracer(),await Pde(this.session.extensionRunner),await this.session.dispose()}async apply(t){process.cwd()!==t.services.cwd&&process.chdir(t.services.cwd),this._session=t.session,this._services=t.services,this._diagnostics=t.diagnostics,this._modelFallbackMessage=t.modelFallbackMessage,this.attachUsageReporter(),this.attachSummarizationTracer(),await this.emitLifecycle("activated")}switchSession(t,n){return this.session.withHistoryAdmission(()=>this.switchSessionWithAdmission(t,n))}async switchSessionWithAdmission(t,n){let r=await this.emitBeforeSwitch("resume",t);if(r.cancelled)return r;let i=this.session.sessionFile,s=es.open(t,void 0,n);return UW(s,this.cwd),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:s.getCwd(),agentDir:this.services.agentDir,sessionManager:s,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:i}})),{cancelled:!1}}newSession(t){return this.session.withHistoryAdmission(()=>this.newSessionWithAdmission(t))}async newSessionWithAdmission(t){let n=await this.emitBeforeSwitch("new");if(n.cancelled)return n;let r=t?.cwd??this.cwd,i=this.session.sessionFile,s=this.session.sessionManager.getSessionDir(),o=es.create(r,s);return t?.parentSession&&o.newSession({parentSession:t.parentSession}),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:r,agentDir:this.services.agentDir,sessionManager:o,sessionStartEvent:{type:"session_start",reason:"new",previousSessionFile:i}})),t?.setup&&(await t.setup(this.session.sessionManager),this.session.agent.state.messages=this.session.sessionManager.buildSessionContext().messages),{cancelled:!1}}fork(t){return this.session.withHistoryAdmission(()=>this.forkWithAdmission(t))}async forkWithAdmission(t){if((await this.emitBeforeFork(t)).cancelled)return{cancelled:!0};let r=this.session.sessionManager.getEntry(t);if(!r||r.type!=="message")throw new Error("Invalid entry ID for forking");let i=r.message,s;if(i.role==="user")s=ENo(i.content);else if(i.role==="promptCommandInvocation")s=hh(i);else throw new Error("Invalid entry ID for forking");let o=this.session.sessionFile;if(this.session.sessionManager.isPersisted()){let l=this.session.sessionFile;if(!l)throw new Error("Persisted session is missing a session file");let u=this.session.sessionManager.getSessionDir();if(!r.parentId){let m=es.create(this.cwd,u);return m.newSession({parentSession:l}),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:m,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let d=es.open(l,u).createBranchedSession(r.parentId);if(!d)throw new Error("Failed to create forked session");let p=es.open(d,u);return await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:p.getCwd(),agentDir:this.services.agentDir,sessionManager:p,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let a=this.session.sessionManager;return await this.teardownCurrent(),r.parentId?a.createBranchedSession(r.parentId):a.newSession({parentSession:this.session.sessionFile}),await this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:a,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}importFromJsonl(t,n){return this.session.withHistoryAdmission(()=>this.importWithAdmission(t,n))}async importWithAdmission(t,n){let r=gkr(t);if(!hkr(r))throw new Error(`File not found: ${r}`);let i=this.session.sessionManager.getSessionDir();hkr(i)||bNo(i,{recursive:!0});let s=ANo(i,yNo(r)),o=await this.emitBeforeSwitch("resume",s);if(o.cancelled)return o;let a=this.session.sessionFile;gkr(s)!==r&&gNo(r,s);let l=es.open(s,i,n);return UW(l,this.cwd),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:l.getCwd(),agentDir:this.services.agentDir,sessionManager:l,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:a}})),{cancelled:!1}}async dispose(){this.session.closeDetachedCompletions(),await this.emitLifecycle("shutdown"),await this.session.waitForAutomaticCompaction().catch(()=>{}),this.detachUsageReporter(),this.detachSummarizationTracer(),await Pde(this.session.extensionRunner),await this.session.dispose(),await Promise.all([this._usageReporter?.flush(),this._toolUseReporter?.flush()])}}});import{join as bkr}from"node:path";function _No(){return Dr()}async function g4e(e={}){let t=e.cwd??process.cwd(),n=e.agentDir??_No(),r=e.resourceLoader,i=e.agentDir?bkr(n,"auth.json"):void 0,s=e.agentDir?bkr(n,"models.json"):void 0,o=e.authStorage??Nx.create(i),a=e.modelRegistry??QB.create(o,s),l=e.settingsManager??gi.create(t,n),u=e.sessionManager??es.create(t,h0(t,n));r||(r=new bL({cwd:t,agentDir:n,settingsManager:l}),await r.reload(),lE("resourceLoader.reload"));let c=u.buildSessionContext(),d=c.messages.length>0,p=u.getBranch().some(L=>L.type==="thinking_level_change"),m=e.model;if(m&&!ux(m))throw new Error(`Unsupported model: ${m.provider}/${m.id}`);let f;if(!m&&d&&c.model){let L=a.findSupported(c.model.provider,c.model.modelId);if(L&&a.hasConfiguredAuth(L)&&(m=L),!m&&!L){let F=a.findDeprecatedModelUpgrade(c.model.provider,c.model.modelId);F&&a.hasConfiguredAuth(F)&&(m=F,f=`Model ${c.model.provider}/${c.model.modelId} is retired. Using ${F.provider}/${F.id}`)}m||(f=`Could not restore model ${c.model.provider}/${c.model.modelId}`)}m||(m=(await Lmr({scopedModels:[],isContinuing:d,defaultModelId:l.getDefaultModel(),defaultThinkingLevel:l.getDefaultThinkingLevel(),modelRegistry:a})).model,m?f&&(f+=`. Using ${m.provider}/${m.id}`):f="Auggie couldn't load an available model. Restart Auggie to try again. If the problem continues, contact support.");let h=e.thinkingLevel,g=h==="default";h===void 0&&d&&(h=p?c.thinkingLevel:l.getDefaultThinkingLevel()??t2,g=p?c.usesModelDefault:!1);let b;h===void 0&&m&&(m.api==="augment-chat-stream"?(b=T2t(l)[qUe(m)],h=b,g=b===void 0):h=l.getDefaultThinkingLevel()??t2);let A=ss(m,g?"default":h);!A.valid&&m&&h&&(console.warn(rm(m,h)),b!==void 0&&Sq(l,m,void 0));let y=A.effort,S=A.usesModelDefault,_=["read","bash","edit","write","web-fetch","view-session"],x=new Set((e.removedTools??[]).flatMap(bd)),v=(e.tools?e.tools.map(L=>L.name).filter(L=>L in bw):_).filter(L=>!x.has(L)),w,T=e.augmentUserAgent??"",P=L=>{let F=jI(L);return l.getBlockImages()?F.map(H=>{if(H.role==="user"||H.role==="toolResult"){let U=H.content;if(Array.isArray(U)&&U.some(ie=>ie.type==="image")){let ie=U.map(ne=>ne.type==="image"?{type:"text",text:"Image reading is disabled."}:ne).filter((ne,ue,le)=>!(ne.type==="text"&&ne.text==="Image reading is disabled."&&ue>0&&le[ue-1].type==="text"&&le[ue-1].text==="Image reading is disabled."));return{...H,content:ie}}}return H}):F},O={},D=L=>async(F,H,U)=>{let J=await a.getApiKeyAndHeaders(F);if(!J.ok)throw new Error(J.error);if(U?.signal?.aborted)throw new Error("Request cancelled");let ie={...U,apiKey:J.apiKey,headers:J.headers||U?.headers?{...J.headers,...U?.headers}:void 0};return F.api==="augment-chat-stream"?GY({...F,baseUrl:J.baseUrl??F.baseUrl},{...H,systemPrompt:U?.silent||U?.silentType!==void 0?void 0:L()},{...ie,userAgent:T}):QT(F,H,ie)};w=new iG({initialState:{systemPrompt:"",model:m,thinkingLevel:y,usesModelDefault:S,tools:[]},convertToLlm:P,streamFn:D(()=>r.getExplicitSystemPrompt?.()),onPayload:(L,F)=>{let H=O.current;return H?.hasHandlers("before_provider_request")?H.emitBeforeProviderRequest(L):L},sessionId:u.getSessionId(),transformContext:L=>{let F=O.current;return F?F.emitContext(L):Promise.resolve(L)},steeringMode:l.getSteeringMode(),followUpMode:l.getFollowUpMode(),transport:l.getTransport(),thinkingBudgets:l.getThinkingBudgets(),maxRetryDelayMs:l.getRetrySettings().maxDelayMs}),d?(w.state.messages=c.messages,p||u.appendThinkingLevelChange(y,S),m&&(!u.getBranch().some(L=>L.type==="model_change")||m.provider!==c.model?.provider||m.id!==c.model?.modelId)&&u.appendModelChange(m.provider,m.id)):(m&&u.appendModelChange(m.provider,m.id),u.appendThinkingLevelChange(y,S)),m?.api==="augment-chat-stream"&&e.thinkingLevel!==void 0&&Sq(l,m,S?void 0:y);let k=new vq({prepareDetachedStream:()=>{let L=r.getExplicitSystemPrompt?.();return D(()=>L)},agent:w,sessionManager:u,settingsManager:l,cwd:t,agentDir:n,pluginDirs:e.pluginDirs,mcpConfigOverride:e.mcpConfigOverride,permissionOverride:e.permissionOverride,scopedModels:e.scopedModels,resourceLoader:r,customTools:e.customTools,toolsOptions:e.toolsOptions,modelRegistry:a,initialActiveToolNames:v,removedTools:e.removedTools,extensionRunnerRef:O,sessionStartEvent:e.sessionStartEvent,featureFlags:e.featureFlags,role:e.role}),M=r.getExtensions();return{session:k,extensionsResult:M,modelFallbackMessage:f}}var _Mt=C(()=>{"use strict";ude();Bi();Ol();Us();KUe();Afe();ACt();MS();nf();Wz();tme();KA();P2t();UL();SMt();UL()});function A4e(e){return vMt[e]}function Kq(e){return e==="user"?"global":e}function Jq(e){return e==="global"?"user":e}function E4e(e){let{files:t,alwaysShowPicker:n}=e;if(n&&t.length>=2)return{files:t};let r=t.filter(i=>i.exists);return r.length===0?{directTarget:"user"}:r.length===1?{directTarget:r[0].target}:{files:t}}var y4e,vMt,ykr=C(()=>{"use strict";y4e=["local","project","user"],vMt={user:"User settings (global)",project:"Project settings (shared)",local:"Local settings (personal)"}});function xNo(e){if(typeof e!="object"||e===null)return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function CNo(e){if(typeof e!="object"||e===null)return"";let t=e.content;if(!Array.isArray(t))return"";let n=[];for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&n.push(r.text);return n.join(`
6202
+ ${e.fallbackCwd}`}function UW(e,t){let n=fMt(e,t);if(n)throw new n9(n)}var n9,nhe=C(()=>{"use strict";n9=class extends Error{constructor(t){super(BRo(t)),this.name="MissingSessionCwdError",this.issue=t}}});function JNr(e){let{reporter:t,sessionId:n,getRequestId:r}=e;return i=>{if(i.type==="tool_execution_start"){t.toolStarted(n,{toolCallId:i.toolCallId,toolName:i.toolName,args:i.args});return}i.type==="tool_execution_end"&&t.toolEnded(n,{toolCallId:i.toolCallId,toolName:i.toolName,result:i.result,isError:i.isError,requestId:r()})}}var ekr=C(()=>{"use strict"});function tkr(e){return{total_history_char_count:0,total_history_exchange_count:0,head_char_count:0,head_exchange_count:0,head_last_request_id:"",tail_char_count:0,tail_exchange_count:0,tail_last_request_id:"",summary_char_count:e.summaryCharCount,summarization_duration_ms:e.durationMs??0,is_cache_about_to_expire:!1,is_aborted:e.aborted??!1,total_history_token_count:e.tokensBefore,head_token_count:e.tokensBefore,tail_token_count:e.tokensAfter??0,tokens_from_backend:!1}}function nkr(e,t){if(e.truncated)return{original_char_count:e.totalBytes,original_line_count:e.totalLines,truncated_char_count:e.outputBytes,truncated_line_count:e.outputLines,tool_type:t}}function rkr(e){let{source:t,scope:n}=e.sourceInfo;return n==="user"||n==="project"?n:t}function ikr(e){let t=e.filter(n=>!n.disableModelInvocation);if(t.length!==0)return{skills:t.map(n=>({skill_name:n.name,skill_source:rkr(n)})),skill_count:t.length}}function skr(e,t,n){return{skill_name:e.name,skill_source:rkr(e),content_length:t,source_tool:n}}function okr(e,t){return{retrieval_mode:t?.retrievalMode??"codebase_only",total_elapsed_ms:Nu(e.totalElapsedMs),api_call_elapsed_ms:Nu(e.apiCallElapsedMs),rerank_elapsed_ms:Nu(e.rerankElapsedMs),enrich_elapsed_ms:Nu(e.enrichElapsedMs),codebase_retrieval_elapsed_ms:Nu(e.codebaseRetrievalElapsedMs),conversation_retrieval_elapsed_ms:Nu(e.conversationRetrievalElapsedMs),conversation_initial_retrieval_ms:Nu(e.conversationInitialRetrievalMs),conversation_query_rewriting_ms:Nu(e.conversationQueryRewritingMs),conversation_followup_retrieval_ms:Nu(e.conversationFollowupRetrievalMs),blob_name_lookup_ms:Nu(e.blobNameLookupMs),codebase_chunks_retrieved:Nu(e.codebaseChunksRetrieved),conversation_chunks_initial:Nu(e.conversationChunksInitial),conversation_queries_generated:Nu(e.conversationQueriesGenerated),conversation_chunks_followup:Nu(e.conversationChunksFollowup),conversation_chunks_combined:Nu(e.conversationChunksCombined),conversation_chunks_after_rerank:Nu(e.conversationChunksAfterRerank),codebase_result_len_pre_truncation:Nu(e.codebaseResultLenPreTruncation),codebase_result_len:Nu(e.codebaseResultLen),conversation_result_len_pre_truncation:Nu(e.conversationResultLenPreTruncation),conversation_result_len:Nu(e.conversationResultLen),combined_result_len:Nu(e.combinedResultLen),total_budget:Nu(e.totalBudget),codebase_budget:Nu(e.codebaseBudget),conversation_budget:Nu(e.conversationBudget),codebase_truncated:f4e(e.codebaseTruncated),conversation_truncated:f4e(e.conversationTruncated),final_truncated:f4e(e.finalTruncated),is_sub_agent:f4e(t?.isSubAgent)}}var Nu,f4e,akr=C(()=>{"use strict";Nu=e=>e??0,f4e=e=>e??!1});import{randomUUID as LRo}from"node:crypto";function VRo(e){if(typeof e!="object"||e===null)return;let t=e.details;if(!(typeof t!="object"||t===null))return t}function GRo(e,t){if(e===t)return!0;if(!([...t].some(i=>lkr.has(i))&&e.endsWith(t)))return!1;let r=e.at(-t.length-1);return r!==void 0&&lkr.has(r)}function WRo(e,t){return t.find(n=>GRo(n.filePath,e))}function ckr(e){let t=new hMt(e);return n=>t.handle(n)}function $Ro(e){if(typeof e!="object"||e===null)return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function ukr(e){let t=ikr(e.skills);t&&e.reporter.skillsIncludedInChat(e.sessionId,t)}var FRo,URo,lkr,hMt,dkr=C(()=>{"use strict";akr();FRo={"codebase-retrieval":"codebase_only","session-retrieval":"conversation_only"},URo={read:"read","web-fetch":"web-fetch",bash:"bash"};lkr=new Set(["/","\\"]);hMt=class{constructor(t){this.readPathsByCallId=new Map,this.options=t}handle(t){if(t.type==="compaction_start"){this.pendingCompactionChatHistoryLength=this.options.getChatHistoryLength?.();return}if(t.type==="compaction_end"){this.emitCompaction(t);return}if(t.type==="tool_execution_start"){this.rememberReadPath(t);return}if(t.type!=="tool_execution_end")return;let n=this.readPathsByCallId.get(t.toolCallId);if(this.readPathsByCallId.delete(t.toolCallId),t.isError)return;let r=VRo(t.result);this.emitTruncation(t.toolName,r),this.emitRetrieval(t.toolName,r),this.emitSkillContent(t.toolName,n,t.result)}emitCompaction(t){let n=this.pendingCompactionChatHistoryLength??0;this.pendingCompactionChatHistoryLength=void 0,!(t.aborted||!t.result)&&this.options.reporter.chatHistorySummarization(this.options.sessionId,LRo(),n,tkr({summaryCharCount:t.result.summary.length,tokensBefore:t.result.tokensBefore,tokensAfter:t.tokensAfter,durationMs:t.durationMs,aborted:!1}))}rememberReadPath(t){if(t.toolName!=="read")return;let n=t.args?.path;typeof n=="string"&&this.readPathsByCallId.set(t.toolCallId,n)}emitTruncation(t,n){let r=URo[t];if(!(r&&n?.truncation))return;let i=nkr(n.truncation,r);i&&this.options.reporter.contentTruncation(this.options.sessionId,i)}emitRetrieval(t,n){let r=FRo[t];r&&n?.analytics&&this.options.reporter.retrievalToolUsed(this.options.sessionId,okr(n.analytics,{retrievalMode:r}))}emitSkillContent(t,n,r){if(t!=="read"||!n)return;let i=WRo(n,this.options.getSkills());i&&this.options.reporter.skillContentLoaded(this.options.sessionId,skr(i,$Ro(r),"read"))}}});function pkr(e){return e==="8"?{kind:"mode-disabled",message:QRo}:{kind:"generic"}}var QRo,gMt=C(()=>{"use strict";QRo="CLI mode access has been disabled for your account. If you believe this to be an error, please contact your administrator."});function bMt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function h4e(e,...t){for(let n of t){let r=e[n];if(bMt(r))return r}}function VW(e,...t){for(let n of t){let r=e[n];if(typeof r=="string")return r}}function ZRo(e){if(typeof e=="string")return e.trim().length>0?{kind:"text",text:e}:null;if(!bMt(e))return null;let t=bMt(e.block)?e.block:e,n=h4e(t,"text","Text");if(n){let o=VW(n,"text");if(o!==void 0&&o.trim().length>0)return{kind:"text",text:o}}let r=h4e(t,"tool_use","toolUse","ToolUse");if(r){let o=VW(r,"id"),a=VW(r,"name");if(!o||!a)return null;let l=VW(r,"input");return{kind:"tool_use",toolUseId:o,toolName:a,inputJson:l&&l.trim().length>0?l:"{}"}}let i=h4e(t,"tool_result","toolResult","ToolResult");if(i){let o=VW(i,"tool_use_id","toolUseId");if(!o)return null;let a=i.is_error??i.isError;return{kind:"tool_result",toolUseId:o,content:VW(i,"content")??"",isError:typeof a=="boolean"?a:!1}}let s=h4e(t,"thinking","Thinking");if(s){let o=VW(s,"content");if(o!==void 0)return{kind:"thinking",content:o}}return null}function mkr(e){if(!Array.isArray(e.content))return[];let t=[];for(let n of e.content){let r=ZRo(n);r!==null&&t.push(r)}return t}function jRo(e){let t=[],n=[];for(let r of e)if(r.kind==="text"){if(r.text.trim().length===0)continue;n.push(r.text),t.push({type:nUe,text_node:{content:r.text}})}else r.kind==="tool_result"&&t.push({type:_Nt,tool_result_node:{content:r.content,is_error:r.isError}});return{requestNodes:t,requestText:n.join("")}}function zRo(e){let t=[],n=[],r=[],i=()=>{if(r.length===0)return;let s=r.join("");r.length=0,s.trim().length!==0&&t.push({type:rUe,content:s})};for(let s of e)if(s.kind==="text"){if(s.text.trim().length===0)continue;n.push(s.text),r.push(s.text)}else s.kind==="tool_use"?(i(),t.push({type:SNt,content:"",tool_use:{tool_name:s.toolName,input_json:s.inputJson}})):s.kind==="thinking"&&(i(),t.push({type:vNt,content:s.content,thinking:{content:s.content}}));return i(),{responseNodes:t,responseText:n.join("")}}function XRo(e){let t=[];for(let n of e)if(n.role==="user")t.push({user:n,assistants:[]});else if(n.role==="assistant"){let r=t.at(-1);r?r.assistants.push(n):t.push({assistants:[n]})}return t.map(({user:n,assistants:r})=>{let{requestNodes:i,requestText:s}=jRo(n?mkr(n):[]),{responseNodes:o,responseText:a}=zRo(r.flatMap(mkr));return{request_message:s,response_text:a,request_id:n?.id??r[0]?.id??"",request_nodes:i,response_nodes:o}})}async function qRo(e){let t=await e.fetchImpl(`${e.baseUrl}cloud-agents/agents/get-messages`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`,...e.userAgent?{"User-Agent":e.userAgent}:{}},body:JSON.stringify({agent_id:e.agentId,limit:HRo,...e.beforeTimestamp?{before_timestamp:e.beforeTimestamp}:{}})});if(!t.ok)throw new Error(`Fetching cloud-agent chat history failed: ${t.status} ${t.statusText}`);return await t.json()}async function KRo(e){let t=new Set,n=[],r;for(let o=0;o<YRo;o++){let a=await qRo({...e,beforeTimestamp:r}),l=Array.isArray(a.messages)?a.messages:[];n.push(l);let u=JRo(l,t),c=a.oldest_timestamp;if(a.has_next!==!0||l.length===0||!c||u===0)break;r=c}let i=new Set,s=[];for(let o=n.length-1;o>=0;o--)for(let a of n[o]){let l=a.id;if(l!==void 0){if(i.has(l))continue;i.add(l)}s.push(a)}return s}function JRo(e,t){let n=0;for(let r of e)(r.id===void 0||!t.has(r.id))&&n++,r.id!==void 0&&t.add(r.id);return n}function yMt(e){let t=e.fetchImpl??globalThis.fetch.bind(globalThis);return async n=>{let r=await e.readCredentials();if(!r)throw new Error("view-session requires an Augment login. Please sign in and try again.");let i=r.apiUrl.endsWith("/")?r.apiUrl:`${r.apiUrl}/`,s=await KRo({fetchImpl:t,baseUrl:i,apiKey:r.apiKey,userAgent:e.userAgent,agentId:n});return XRo(s)}}var HRo,YRo,fkr=C(()=>{"use strict";oUe();HRo=400,YRo=200});import{delimiter as tNo,isAbsolute as AMt,join as nNo,resolve as rhe}from"node:path";function rNo(e){return e.map(t=>{if(t.type!=="message")return{type:t.type,id:t.id,parentId:t.parentId};let n=t.message,r=typeof n.content=="string"?n.content:n.content.map(i=>({type:i.type,text:"text"in i?i.text:void 0}));return{type:t.type,id:t.id,parentId:t.parentId,message:{role:n.role,content:r,timestamp:n.timestamp}}})}function iNo(e){if(e instanceof Error){let t=e;return typeof t.status=="number"?String(t.status):typeof t.httpStatus=="number"?String(t.httpStatus):e.message}return String(e)}function sNo(e,t){let n=iNo(e);if(n!=="8"){let r=e instanceof Error?e.message:String(e);t.push({type:"error",message:`Failed to fetch feature flags: ${r}`})}return{flags:al(void 0),errorStatus:n}}function oNo(e,t,n){if(e.allowClientFeatureFlagOverrides!==!0)return e;let r=t.getFeatureFlagOverrides();if(!r)return e;try{let i=Mpr(r);return Ppr(e,i)}catch(i){let s=i instanceof Error?i.message:String(i);return n.push({type:"warning",message:`Failed to parse feature flag overrides, ignoring them: ${s}`}),e}}function aNo(e){return e.cosmosMultiRepoContextEnabled===!0}function lNo(e){return e.cosmosNestedAgentsMdEnabled===!0}function cNo(e,t,n){return e===void 0?void 0:{tenantUrl:e,userId:t,userEmail:n}}function uNo(e){return typeof e=="object"&&e!==null&&"workspacePath"in e&&"sourceWorkspacePath"in e&&"repositoryRoot"in e&&typeof e.workspacePath=="string"&&typeof e.sourceWorkspacePath=="string"&&typeof e.repositoryRoot=="string"&&AMt(e.workspacePath)&&AMt(e.sourceWorkspacePath)&&AMt(e.repositoryRoot)}function dNo(e,t){if(!e)return[];try{let n=JSON.parse(process.env.AUGMENT_DAEMON_INDEXING_WORKSPACES??"[]");if(!Array.isArray(n))return[];let r=new Map;for(let i of n){if(!uNo(i))continue;let s=rhe(i.workspacePath);t.has(s)&&r.set(s,{sourceWorkspacePath:rhe(i.sourceWorkspacePath),repositoryRoot:rhe(i.repositoryRoot)})}return[...r].map(([i,s])=>({workspacePath:i,...s}))}catch{return[]}}function pNo(e,t,n){let{allowDirs:r,denyDirs:i}=t.getIndexingDirsUnion(),s=n?.get("parent-daemon-id"),o=typeof s=="string"&&s.length>0,a=n?.get("cloud-agent"),l=typeof a=="string"&&a.length>0,u=o&&l,c=new Set([rhe(e)]),d=n?.get("add-workspace");if(typeof d=="string")for(let m of d.split(tNo))m.length>0&&c.add(rhe(m));let p=dNo(u,c);return{allowDirs:r,denyDirs:i,daemonChild:u,allowIndexingFlag:n?.get("allow-indexing")===!0,repositoryRoots:p}}function mNo(e,t){if(!t)return[];let n=[],r=e.getExtensions(),i=new Map;for(let o of r.extensions)for(let[a,l]of o.flags)i.set(a,{type:l.type});let s=[];for(let[o,a]of t){let l=i.get(o);if(!l){s.push(o);continue}if(l.type==="boolean"){r.runtime.flagValues.set(o,!0);continue}if(typeof a=="string"){r.runtime.flagValues.set(o,a);continue}n.push({type:"error",message:`Extension flag "--${o}" requires a value`})}return s.length>0&&n.push({type:"error",message:`Unknown option${s.length===1?"":"s"}: ${s.map(o=>`--${o}`).join(", ")}`}),n}function fNo(e){return e.prefetchedAugment?Promise.resolve(e.prefetchedAugment.modelConfig):e.augmentApiPromise?.then(t=>t.getModelConfig())}async function hNo({options:e,modelRegistry:t,augmentUserAgent:n}){if(e.resourceDiscoveryOnly)return{augmentCredentials:null,augmentApiPromise:void 0,modelConfigPromise:void 0};let r=e.prefetchedAugment?.credentials??await Xc(),i=r?rl(r.apiKey,r.apiUrl,n):void 0,s=fNo({prefetchedAugment:e.prefetchedAugment,augmentApiPromise:i});return await t.discoverAugmentModels(n,{credentials:r,modelConfig:s}),{augmentCredentials:r,augmentApiPromise:i,modelConfigPromise:s}}async function ihe(e){let t=e.cwd,n=e.agentDir??Dr(),r=e.authStorage??Nx.create(nNo(n,"auth.json")),i=e.settingsManager??gi.create(t,n),s=e.modelRegistry??QB.empty(r),o=e.augmentUserAgent??tf(),{augmentCredentials:a,augmentApiPromise:l,modelConfigPromise:u}=await hNo({options:e,modelRegistry:s,augmentUserAgent:o}),c=WB(),d={};c.on("conversation:identity",y=>{typeof y=="object"&&y!==null&&"conversationId"in y&&(typeof y.conversationId=="string"||y.conversationId===void 0)&&(d.conversationId=y.conversationId)}),$yr(c);let p=[],m,f={flags:al(void 0)},h,g;if(l&&u)try{m=await l;let y=await u;h=y.user?.id,g=y.user?.email,ehe({id:h,email:g});let S=al(y.featureFlagsV2);f={flags:oNo(S,i,p)}}catch(y){f=sNo(y,p)}let b=new bL({...e.resourceLoaderOptions??{},readOnlyPackages:e.resourceDiscoveryOnly||e.resourceLoaderOptions?.readOnlyPackages,cwd:t,agentDir:n,settingsManager:i,eventBus:c,multiRepoContextEnabled:aNo(f.flags),nestedContextDescentEnabled:lNo(f.flags)});await b.reload(),a&&m&&(c.emit("augment:api",m),c.emit("augment:credentials",{apiKey:a.apiKey,apiUrl:a.apiUrl,userAgent:o,userId:h,email:g,cliVersion:gs}));let A=b.getExtensions();for(let{name:y,config:S,extensionPath:_}of A.runtime.pendingProviderRegistrations)try{s.registerProvider(y,S)}catch(x){let v=x instanceof Error?x.message:String(x);p.push({type:"error",message:`Extension "${_}" error: ${v}`})}return A.runtime.pendingProviderRegistrations=[],p.push(...mNo(b,e.extensionFlagValues)),c.emit("augment:indexing-policy",pNo(t,i,e.extensionFlagValues)),c.emit("augment:feature-flags",f),c.emit("augment:feature-flags-startup-complete",void 0),{cwd:t,agentDir:n,conversationIdentity:d,pluginDirs:e.pluginDirs,mcpConfigOverride:e.mcpConfigOverride,permissionOverride:e.permissionOverride,authStorage:r,settingsManager:i,modelRegistry:s,resourceLoader:b,diagnostics:p,augmentUserAgent:o,augmentApi:m,augmentAccount:cNo(a?.apiUrl,h,g),featureFlags:f}}function she(e){let t=e.services.augmentApi,n=t?{viewSession:{operations:{fetchChatHistory:xNt({readCredentials:Xc,userAgent:e.services.augmentUserAgent}),fetchCloudAgentChatHistory:yMt({readCredentials:Xc,userAgent:e.services.augmentUserAgent})}},sessionRetrieval:{operations:{createRequestId:t.createRequestId.bind(t),agentCodebaseRetrieval:t.agentCodebaseRetrieval.bind(t),fetchCloudAgentChatHistory:yMt({readCredentials:Xc,userAgent:e.services.augmentUserAgent}),fetchChatHistory:xNt({readCredentials:Xc,userAgent:e.services.augmentUserAgent}),getBranch:()=>rNo(e.sessionManager.getBranch())}}}:void 0;return g4e({cwd:e.services.cwd,agentDir:e.services.agentDir,authStorage:e.services.authStorage,settingsManager:e.services.settingsManager,modelRegistry:e.services.modelRegistry,augmentUserAgent:e.services.augmentUserAgent,resourceLoader:e.services.resourceLoader,sessionManager:e.sessionManager,model:e.model,thinkingLevel:e.thinkingLevel,scopedModels:e.scopedModels,tools:e.tools,customTools:e.customTools,removedTools:e.removedTools,sessionStartEvent:e.sessionStartEvent,toolsOptions:{...n,bash:e.bashOptions},featureFlags:e.services.featureFlags.flags,pluginDirs:e.services.pluginDirs,mcpConfigOverride:e.services.mcpConfigOverride,permissionOverride:e.services.permissionOverride})}var EMt=C(()=>{"use strict";Bi();Ol();gMt();Us();t9();gh();Afe();Ode();dG();Qpe();nf();tme();_Mt();fkr();CNt()});import{copyFileSync as gNo,existsSync as hkr,mkdirSync as bNo}from"node:fs";import{basename as yNo,join as ANo,resolve as gkr}from"node:path";function ENo(e){return typeof e=="string"?e:e.filter(t=>t.type==="text"&&typeof t.text=="string").map(t=>t.text).join("")}async function b4e(e,t){UW(t.sessionManager,t.cwd);let n=await e(t);return process.cwd()!==n.services.cwd&&process.chdir(n.services.cwd),new ohe(n.session,n.services,e,n.diagnostics,n.modelFallbackMessage,t.usageReporter,t.toolUseReporter,t.enableSentrySummarizationSpans,t.backgroundBashEligible)}var ohe,SMt=C(()=>{"use strict";t3e();t9();Dde();MS();nhe();KA();ekr();dkr();EMt();ohe=class{subscribeLifecycle(t){return this.lifecycleListeners.add(t),()=>this.lifecycleListeners.delete(t)}async emitLifecycle(t){for(let n of this.lifecycleListeners)await n(t)}constructor(t,n,r,i=[],s,o,a,l=!1,u=!1){this.lifecycleListeners=new Set,this.backgroundBashEligible=u,this._session=t,this._services=n,this.createRuntime=r,this._diagnostics=i,this._modelFallbackMessage=s,this._usageReporter=o,this._toolUseReporter=a,this.enableSentrySummarizationSpans=l,this.attachUsageReporter(),this.attachSummarizationTracer()}attachUsageReporter(){let t=this._usageReporter,n=this._toolUseReporter;if(!(t||n))return;let r=this._session,i=r.sessionId,s=t?ckr({reporter:t,sessionId:i,getSkills:()=>this._services.resourceLoader.getSkills().skills,getChatHistoryLength:()=>r.sessionManager.getBranch().length}):void 0;t&&(t.sessionStarted(i),ukr({reporter:t,sessionId:i,skills:this._services.resourceLoader.getSkills().skills}));let o=n?JNr({reporter:n,sessionId:i,getRequestId:()=>r.currentRequestId}):void 0;this._usageUnsubscribe=r.subscribe(a=>{t&&a.type==="message_start"&&kb(a.message.role)&&t.userMessageSent(i),s?.(a),o?.(a)})}setAugmentAccount(t){this._services.augmentAccount=t,t?.userId||t?.userEmail?ehe({id:t.userId,email:t.userEmail}):uMt()}attachSummarizationTracer(){if(!this.enableSentrySummarizationSpans)return;let t=UTr();this._summarizationSubscriber=t,this._summarizationUnsubscribe=this._session.subscribe(t.handle)}detachSummarizationTracer(){this._summarizationUnsubscribe?.(),this._summarizationUnsubscribe=void 0,this._summarizationSubscriber?.dispose(),this._summarizationSubscriber=void 0}detachUsageReporter(){let t=this._usageReporter,n=this._toolUseReporter;(t||n)&&(this._usageUnsubscribe?.(),this._usageUnsubscribe=void 0,t?.sessionEnded(this._session.sessionId))}get services(){return this._services}get session(){return this._session}get cwd(){return this._services.cwd}get diagnostics(){return this._diagnostics}get modelFallbackMessage(){return this._modelFallbackMessage}async emitBeforeSwitch(t,n){let r=this.session.extensionRunner;return r?.hasHandlers("session_before_switch")?{cancelled:(await r.emit({type:"session_before_switch",reason:t,targetSessionFile:n}))?.cancel===!0}:{cancelled:!1}}async emitBeforeFork(t){let n=this.session.extensionRunner;return n?.hasHandlers("session_before_fork")?{cancelled:(await n.emit({type:"session_before_fork",entryId:t}))?.cancel===!0}:{cancelled:!1}}async teardownCurrent(){this.session.closeDetachedCompletions(),await this.emitLifecycle("closing"),await this.session.waitForAutomaticCompaction().catch(()=>{}),this.detachUsageReporter(),this.detachSummarizationTracer(),await Pde(this.session.extensionRunner),await this.session.dispose()}async apply(t){process.cwd()!==t.services.cwd&&process.chdir(t.services.cwd),this._session=t.session,this._services=t.services,this._diagnostics=t.diagnostics,this._modelFallbackMessage=t.modelFallbackMessage,this.attachUsageReporter(),this.attachSummarizationTracer(),await this.emitLifecycle("activated")}switchSession(t,n){return this.session.withHistoryAdmission(()=>this.switchSessionWithAdmission(t,n))}async switchSessionWithAdmission(t,n){let r=await this.emitBeforeSwitch("resume",t);if(r.cancelled)return r;let i=this.session.sessionFile,s=es.open(t,void 0,n);return UW(s,this.cwd),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:s.getCwd(),agentDir:this.services.agentDir,sessionManager:s,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:i}})),{cancelled:!1}}newSession(t){return this.session.withHistoryAdmission(()=>this.newSessionWithAdmission(t))}async newSessionWithAdmission(t){let n=await this.emitBeforeSwitch("new");if(n.cancelled)return n;let r=t?.cwd??this.cwd,i=this.session.sessionFile,s=this.session.sessionManager.getSessionDir(),o=es.create(r,s);return t?.parentSession&&o.newSession({parentSession:t.parentSession}),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:r,agentDir:this.services.agentDir,sessionManager:o,sessionStartEvent:{type:"session_start",reason:"new",previousSessionFile:i}})),t?.setup&&(await t.setup(this.session.sessionManager),this.session.agent.state.messages=this.session.sessionManager.buildSessionContext().messages),{cancelled:!1}}fork(t){return this.session.withHistoryAdmission(()=>this.forkWithAdmission(t))}async forkWithAdmission(t){if((await this.emitBeforeFork(t)).cancelled)return{cancelled:!0};let r=this.session.sessionManager.getEntry(t);if(!r||r.type!=="message")throw new Error("Invalid entry ID for forking");let i=r.message,s;if(i.role==="user")s=ENo(i.content);else if(i.role==="promptCommandInvocation")s=hh(i);else throw new Error("Invalid entry ID for forking");let o=this.session.sessionFile;if(this.session.sessionManager.isPersisted()){let l=this.session.sessionFile;if(!l)throw new Error("Persisted session is missing a session file");let u=this.session.sessionManager.getSessionDir();if(!r.parentId){let m=es.create(this.cwd,u);return m.newSession({parentSession:l}),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:m,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let d=es.open(l,u).createBranchedSession(r.parentId);if(!d)throw new Error("Failed to create forked session");let p=es.open(d,u);return await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:p.getCwd(),agentDir:this.services.agentDir,sessionManager:p,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let a=this.session.sessionManager;return await this.teardownCurrent(),r.parentId?a.createBranchedSession(r.parentId):a.newSession({parentSession:this.session.sessionFile}),await this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:a,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}importFromJsonl(t,n){return this.session.withHistoryAdmission(()=>this.importWithAdmission(t,n))}async importWithAdmission(t,n){let r=gkr(t);if(!hkr(r))throw new Error(`File not found: ${r}`);let i=this.session.sessionManager.getSessionDir();hkr(i)||bNo(i,{recursive:!0});let s=ANo(i,yNo(r)),o=await this.emitBeforeSwitch("resume",s);if(o.cancelled)return o;let a=this.session.sessionFile;gkr(s)!==r&&gNo(r,s);let l=es.open(s,i,n);return UW(l,this.cwd),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:l.getCwd(),agentDir:this.services.agentDir,sessionManager:l,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:a}})),{cancelled:!1}}async dispose(){this.session.closeDetachedCompletions(),await this.emitLifecycle("shutdown"),await this.session.waitForAutomaticCompaction().catch(()=>{}),this.detachUsageReporter(),this.detachSummarizationTracer(),await Pde(this.session.extensionRunner),await this.session.dispose(),await Promise.all([this._usageReporter?.flush(),this._toolUseReporter?.flush()])}}});import{join as bkr}from"node:path";function _No(){return Dr()}async function g4e(e={}){let t=e.cwd??process.cwd(),n=e.agentDir??_No(),r=e.resourceLoader,i=e.agentDir?bkr(n,"auth.json"):void 0,s=e.agentDir?bkr(n,"models.json"):void 0,o=e.authStorage??Nx.create(i),a=e.modelRegistry??QB.create(o,s),l=e.settingsManager??gi.create(t,n),u=e.sessionManager??es.create(t,h0(t,n));r||(r=new bL({cwd:t,agentDir:n,settingsManager:l}),await r.reload(),lE("resourceLoader.reload"));let c=u.buildSessionContext(),d=c.messages.length>0,p=u.getBranch().some(L=>L.type==="thinking_level_change"),m=e.model;if(m&&!ux(m))throw new Error(`Unsupported model: ${m.provider}/${m.id}`);let f;if(!m&&d&&c.model){let L=a.findSupported(c.model.provider,c.model.modelId);if(L&&a.hasConfiguredAuth(L)&&(m=L),!m&&!L){let F=a.findDeprecatedModelUpgrade(c.model.provider,c.model.modelId);F&&a.hasConfiguredAuth(F)&&(m=F,f=`Model ${c.model.provider}/${c.model.modelId} is retired. Using ${F.provider}/${F.id}`)}m||(f=`Could not restore model ${c.model.provider}/${c.model.modelId}`)}m||(m=(await Lmr({scopedModels:[],isContinuing:d,defaultModelId:l.getDefaultModel(),defaultThinkingLevel:l.getDefaultThinkingLevel(),modelRegistry:a})).model,m?f&&(f+=`. Using ${m.provider}/${m.id}`):f="Auggie couldn't load an available model. Restart Auggie to try again. If the problem continues, contact support.");let h=e.thinkingLevel,g=h==="default";h===void 0&&d&&(h=p?c.thinkingLevel:l.getDefaultThinkingLevel()??t2,g=p?c.usesModelDefault:!1);let b;h===void 0&&m&&(m.api==="augment-chat-stream"?(b=T2t(l)[qUe(m)],h=b,g=b===void 0):h=l.getDefaultThinkingLevel()??t2);let A=ss(m,g?"default":h);!A.valid&&m&&h&&(console.warn(rm(m,h)),b!==void 0&&Sq(l,m,void 0));let y=A.effort,S=A.usesModelDefault,_=["read","bash","edit","write","web-fetch","view-session"],x=new Set((e.removedTools??[]).flatMap(bd)),v=(e.tools?e.tools.map(L=>L.name).filter(L=>L in bw):_).filter(L=>!x.has(L)),w,T=e.augmentUserAgent??"",P=L=>{let F=jI(L);return l.getBlockImages()?F.map(H=>{if(H.role==="user"||H.role==="toolResult"){let U=H.content;if(Array.isArray(U)&&U.some(ie=>ie.type==="image")){let ie=U.map(ne=>ne.type==="image"?{type:"text",text:"Image reading is disabled."}:ne).filter((ne,ue,le)=>!(ne.type==="text"&&ne.text==="Image reading is disabled."&&ue>0&&le[ue-1].type==="text"&&le[ue-1].text==="Image reading is disabled."));return{...H,content:ie}}}return H}):F},O={},D=L=>async(F,H,U)=>{let J=await a.getApiKeyAndHeaders(F);if(!J.ok)throw new Error(J.error);if(U?.signal?.aborted)throw new Error("Request cancelled");let ie={...U,apiKey:J.apiKey,headers:J.headers||U?.headers?{...J.headers,...U?.headers}:void 0};return F.api==="augment-chat-stream"?GY({...F,baseUrl:J.baseUrl??F.baseUrl},{...H,systemPrompt:U?.silent||U?.silentType!==void 0?void 0:L()},{...ie,userAgent:T}):QT(F,H,ie)};w=new iG({initialState:{systemPrompt:"",model:m,thinkingLevel:y,usesModelDefault:S,tools:[]},convertToLlm:P,streamFn:D(()=>r.getExplicitSystemPrompt?.()),onPayload:(L,F)=>{let H=O.current;return H?.hasHandlers("before_provider_request")?H.emitBeforeProviderRequest(L):L},sessionId:u.getSessionId(),transformContext:L=>{let F=O.current;return F?F.emitContext(L):Promise.resolve(L)},steeringMode:l.getSteeringMode(),followUpMode:l.getFollowUpMode(),thinkingBudgets:l.getThinkingBudgets(),maxRetryDelayMs:l.getRetrySettings().maxDelayMs}),d?(w.state.messages=c.messages,p||u.appendThinkingLevelChange(y,S),m&&(!u.getBranch().some(L=>L.type==="model_change")||m.provider!==c.model?.provider||m.id!==c.model?.modelId)&&u.appendModelChange(m.provider,m.id)):(m&&u.appendModelChange(m.provider,m.id),u.appendThinkingLevelChange(y,S)),m?.api==="augment-chat-stream"&&e.thinkingLevel!==void 0&&Sq(l,m,S?void 0:y);let k=new vq({prepareDetachedStream:()=>{let L=r.getExplicitSystemPrompt?.();return D(()=>L)},agent:w,sessionManager:u,settingsManager:l,cwd:t,agentDir:n,pluginDirs:e.pluginDirs,mcpConfigOverride:e.mcpConfigOverride,permissionOverride:e.permissionOverride,scopedModels:e.scopedModels,resourceLoader:r,customTools:e.customTools,toolsOptions:e.toolsOptions,modelRegistry:a,initialActiveToolNames:v,removedTools:e.removedTools,extensionRunnerRef:O,sessionStartEvent:e.sessionStartEvent,featureFlags:e.featureFlags,role:e.role}),M=r.getExtensions();return{session:k,extensionsResult:M,modelFallbackMessage:f}}var _Mt=C(()=>{"use strict";ude();Bi();Ol();Us();KUe();Afe();ACt();MS();nf();Wz();tme();KA();P2t();UL();SMt();UL()});function A4e(e){return vMt[e]}function Kq(e){return e==="user"?"global":e}function Jq(e){return e==="global"?"user":e}function E4e(e){let{files:t,alwaysShowPicker:n}=e;if(n&&t.length>=2)return{files:t};let r=t.filter(i=>i.exists);return r.length===0?{directTarget:"user"}:r.length===1?{directTarget:r[0].target}:{files:t}}var y4e,vMt,ykr=C(()=>{"use strict";y4e=["local","project","user"],vMt={user:"User settings (global)",project:"Project settings (shared)",local:"Local settings (personal)"}});function xNo(e){if(typeof e!="object"||e===null)return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function CNo(e){if(typeof e!="object"||e===null)return"";let t=e.content;if(!Array.isArray(t))return"";let n=[];for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&n.push(r.text);return n.join(`
6203
6203
  `)}function xMt(e,t){if(Ekr.has(e)){for(let[n,r]of TNo)if(n.test(t))return r;return"provider_error"}}function MNo(e){return e.replace(wNo,"<url>").replace(RNo,"<email>").replace(NNo,"<tok>").replace(kNo,"#").replace(ONo," ").trim().slice(0,INo)}function PNo(e){return typeof e=="object"&&e!==null?e:{}}function _kr(e){let t=!vNo(process.env.AUGGIE_V2_USAGE_OPT_OUT),n=e.userAgent??tf({subtype:Wde(e.appMode)}),r,i=[],s,o=new Map,a=async()=>{if(await s,!r||i.length===0)return;let l=i;i=[];let u;for(let c of l)c.requestId||(u??=r.createRequestId(),c.requestId=u);try{await r.logToolUseRequestEvent(l)}catch{}};return t&&(s=(async()=>{let u=await Xc();u&&(r=await rl(u.apiKey,u.apiUrl,n))})().catch(()=>{}),setInterval(()=>{a()},SNo).unref?.()),{toolStarted(l,u){if(t){if(o.size>=Akr){let c=o.keys().next().value;c!==void 0&&o.delete(c)}o.set(u.toolCallId,{startMs:Date.now(),args:u.args})}},toolEnded(l,u){if(!t)return;let c=o.get(u.toolCallId);o.delete(u.toolCallId);let d=Date.now(),p=u.isError?CNo(u.result):void 0;i.length>=Akr&&i.shift(),i.push({requestId:u.requestId??"",toolName:u.toolName,toolUseId:u.toolCallId,toolInput:PNo(c?.args),toolOutputIsError:u.isError,toolRunDurationMs:c?d-c.startMs:0,isMcpTool:!1,conversationId:l,chatHistoryLength:0,toolOutputLen:xNo(u.result),toolErrorClass:p===void 0?void 0:xMt(u.toolName,p),toolErrorSnippet:p!==void 0&&Ekr.has(u.toolName)?MNo(p):void 0,eventTimeSec:Math.floor(d/1e3),eventTimeNsec:d%1e3*1e6})},flush:a}}var SNo,Akr,vNo,Ekr,TNo,INo,wNo,RNo,NNo,kNo,ONo,CMt=C(()=>{"use strict";Bi();gh();nf();SNo=15e3,Akr=1e3,vNo=e=>e==="1"||e?.toLowerCase()==="true"||e?.toLowerCase()==="yes";Ekr=new Set(["find-tool","execute-tool"]),TNo=[[/^MCP server "[^"]*" is not available \(status: /,"server_not_available"],[/^MCP server "[^"]*" is not connected \(status: /,"server_not_available"],[/^MCP server "[^"]*" (?:is being disposed|client is gone)$/,"server_not_available"],[/is available but not attached\. Call attach-mcp-server now/,"server_not_attached"],[/^MCP server name "[^"]*" is ambiguous\./,"ambiguous_server_name"],[/is a built-in tool, not an MCP server\./,"builtin_tool_not_server"],[/^Built-in tool "[^"]*" is not available \(disabled\)\./,"builtin_tool_not_server"],[/^Validation failed for tool "(?:find-tool|execute-tool)":/,"invalid_parameters"],[/^(?:find-tool|execute-tool) requires /,"invalid_parameters"],[/^execute-tool "arguments" must be an object/,"invalid_parameters"],[/^No tools available on MCP server "/,"no_tools_on_server"],[/returned a result with no usable content/,"no_usable_content"],[/^MCP error -32001: (?:Request timed out|Maximum total timeout exceeded)/,"timeout"],[/^MCP error -32001: .*abort/i,"cancelled"]];INo=200,wNo=/https?:\/\/\S+/g,RNo=/[\w.+-]+@[\w-]+\.[\w.-]+/g,NNo=/[\w+/=-]{20,}/g,kNo=/\d{5,}/g,ONo=/\s+/g});var DNo,BNo,LNo,xkr,FNo,UNo,VNo,Skr,vkr,eK,_4e,TMt,IMt,GNo,S4e,NMt,GW,kMt,WNo,ahe,$No,wMt,RMt,QNo,v4e,x4e=C(()=>{"use strict";DNo="http/protobuf",BNo="delta",LNo="hmac",xkr=new Set(["1","true","yes","on"]),FNo=new Set(["0","false","no","off"]),UNo={metrics:"METRICS",logs:"LOGS",traces:"TRACES"},VNo={metrics:"/v1/metrics",logs:"/v1/logs",traces:"/v1/traces"},Skr=(e,t,n)=>{if(n==="grpc")return e;let r=VNo[t],i=e.endsWith("/")?e.slice(0,-1):e;return i.endsWith(r)?i:i+r},vkr=e=>xkr.has(e.trim().toLowerCase()),eK=e=>{if(e===void 0)return;let t=e.trim().toLowerCase();return xkr.has(t)?!0:FNo.has(t)?!1:void 0},_4e=(e,t)=>{if(e===void 0)return t;let n=Number.parseInt(e.trim(),10);return Number.isNaN(n)?t:n},TMt=(e,t)=>{let n=_4e(e,t);return n>0?n:t},IMt=(e,t)=>e&&e>0?e:t,GNo=e=>e==="grpc"||e==="http/protobuf"||e==="http/json",S4e=e=>{if(e===void 0)return;let t=e.trim().toLowerCase();return GNo(t)?t:void 0},NMt=e=>{if(e===void 0)return;let t=e.trim().toLowerCase();if(t==="delta"||t==="cumulative")return t},GW=e=>{if(e===void 0)return;let t=e.trim();return t.length>0?t:void 0},kMt=e=>{if(e===void 0)return;let t=e.trim().toLowerCase();if(t==="hmac"||t==="raw"||t==="off")return t},WNo=(e,t)=>(e??"").split(",").map(n=>n.trim().toLowerCase()).includes(t),ahe=e=>{let t={};if(!e)return t;for(let n of e.split(",")){let r=n.trim(),i=r.indexOf("=");if(i<=0)continue;let s=r.slice(0,i).trim();s&&(t[s]=r.slice(i+1).trim())}return t},$No=(e,t,n)=>{if(n.enabled!==void 0)return n.enabled;let r=e.AUGGIE_ENABLE_TELEMETRY;if(r!==void 0)return vkr(r);let i=e.CLAUDE_CODE_ENABLE_TELEMETRY;return i!==void 0?vkr(i):t.enabled??!1},wMt=(e,t,n,r)=>{let i=UNo[t],s=r.protocol??S4e(e[`OTEL_EXPORTER_OTLP_${i}_PROTOCOL`])??S4e(e.OTEL_EXPORTER_OTLP_PROTOCOL)??n.protocol??DNo,o=GW(r.endpoint),a=GW(e[`OTEL_EXPORTER_OTLP_${i}_ENDPOINT`]),l=GW(e.OTEL_EXPORTER_OTLP_ENDPOINT)??GW(n.endpoint),u;o!==void 0?u=Skr(o,t,s):a!==void 0?u=a:l!==void 0&&(u=Skr(l,t,s));let c={...n.headers,...ahe(e.OTEL_EXPORTER_OTLP_HEADERS),...ahe(e[`OTEL_EXPORTER_OTLP_${i}_HEADERS`]),...r.headers};return{endpoint:u,headers:c,protocol:s}},RMt=e=>e!==void 0&&e>0?e:void 0,QNo=(e,t,n)=>({bufferDir:GW(n.bufferDir)??GW(e.AUGGIE_TELEMETRY_BUFFER_DIR)??GW(t.bufferDir),bufferMaxBytes:RMt(n.bufferMaxBytes)??TMt(e.AUGGIE_TELEMETRY_BUFFER_MAX_BYTES,IMt(t.bufferMaxBytes,52428800)),breakerFailureThreshold:RMt(n.breakerFailureThreshold)??TMt(e.AUGGIE_TELEMETRY_BREAKER_FAILURE_THRESHOLD,IMt(t.breakerFailureThreshold,3)),breakerBackoffMs:RMt(n.breakerBackoffMs)??TMt(e.AUGGIE_TELEMETRY_BREAKER_BACKOFF_MS,IMt(t.breakerBackoffMs,3e4))}),v4e=(e={})=>{let t=e.env??process.env,n={...e.envInjection,...t},r=e.telemetry??{},i=e.managed??{},s={metrics:wMt(n,"metrics",r,i),logs:wMt(n,"logs",r,i),traces:wMt(n,"traces",r,i)},o=s.metrics.endpoint!==void 0||s.logs.endpoint!==void 0||s.traces.endpoint!==void 0;return{enabled:$No(n,r,i)&&o,exporter:s,metricExportIntervalMs:i.metricExportIntervalMs??_4e(n.OTEL_METRIC_EXPORT_INTERVAL,r.metricExportIntervalMs??2e4),logsExportIntervalMs:i.logsExportIntervalMs??_4e(n.OTEL_LOGS_EXPORT_INTERVAL,r.logsExportIntervalMs??5e3),metricsTemporalityPreference:i.metricsTemporalityPreference??NMt(n.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE)??r.metricsTemporalityPreference??BNo,resourceAttributes:{...r.resourceAttributes,...ahe(n.OTEL_RESOURCE_ATTRIBUTES),...i.resourceAttributes},includeVersion:i.includeVersion??eK(n.OTEL_METRICS_INCLUDE_VERSION)??r.includeVersion??!1,includeAccountUuid:i.includeAccountUuid??eK(n.OTEL_METRICS_INCLUDE_ACCOUNT_UUID)??r.includeAccountUuid??!0,identity:{mode:i.identityMode??kMt(n.AUGGIE_TELEMETRY_IDENTITY_MODE)??r.identityMode??LNo,secret:i.identitySecret??n.AUGGIE_TELEMETRY_IDENTITY_SECRET??r.identitySecret},shutdownTimeoutMs:i.shutdownTimeoutMs??_4e(n.AUGGIE_TELEMETRY_SHUTDOWN_TIMEOUT_MS,r.shutdownTimeoutMs??2e3),...QNo(n,r,i),genAiCaptureMessageContent:i.captureMessageContent??eK(n.OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT)??r.captureMessageContent??!1,genAiLatestExperimental:WNo(n.OTEL_SEMCONV_STABILITY_OPT_IN,"gen_ai_latest_experimental"),logUserPrompts:i.logUserPrompts??eK(n.OTEL_LOG_USER_PROMPTS)??r.logUserPrompts??!1,logToolDetails:i.logToolDetails??eK(n.OTEL_LOG_TOOL_DETAILS)??r.logToolDetails??!1,langsmithCompat:i.langsmithCompat??eK(n.AUGGIE_TELEMETRY_LANGSMITH_COMPAT)??r.langsmithCompat??!1}}});import{execFileSync as HNo}from"node:child_process";import{existsSync as YNo,readFileSync as ZNo}from"node:fs";var Ckr,jNo,zNo,Tkr,Ikr,XNo,PMt,wkr,qNo,KNo,JNo,eko,tko,OMt,nko,rko,WW,tK,MMt,Rkr,iko,C4e,DMt=C(()=>{"use strict";x4e();Ckr="/Library/Managed Preferences/com.augmentcode.auggie.plist",jNo="HKLM\\SOFTWARE\\Policies\\AugmentCode\\Auggie\\Telemetry",zNo="/etc/augment/auggie-managed-settings.json",Tkr="/usr/bin/plutil",Ikr="C:\\Windows\\System32\\reg.exe",XNo=2e3,PMt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),wkr=e=>PMt(e)?e.telemetry:void 0,qNo=(e,t)=>HNo(e,t,{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:XNo,windowsHide:!0}),KNo=/^ {4}(.+?) {4}(REG_[A-Z_]+) {4}(.*)$/,JNo=e=>{let t={};for(let n of e.split(/\r?\n/)){let r=KNo.exec(n);if(!r)continue;let[,i,s,o]=r;if(s==="REG_DWORD"||s==="REG_QWORD"){let a=Number(o.trim());Number.isFinite(a)&&(t[i]=a)}else(s==="REG_SZ"||s==="REG_EXPAND_SZ")&&(t[i]=o)}return Object.keys(t).length>0?t:void 0},eko=(e={})=>{let t=e.execRead??qNo,n=e.fileExists??YNo;return{darwin:()=>{if(!(n(Ckr)&&n(Tkr)))return;let r=t(Tkr,["-convert","json","-o","-",Ckr]);return wkr(JSON.parse(r))},linux:()=>wkr(JSON.parse(ZNo(zNo,"utf-8"))),win32:()=>{if(n(Ikr))return JNo(t(Ikr,["query",jNo]))}}},tko=eko(),OMt=e=>typeof e=="string"?e:void 0,nko=new Set(["1","true","yes","on"]),rko=new Set(["0","false","no","off"]),WW=e=>{if(typeof e=="boolean")return e;if(typeof e=="number")return e!==0;if(typeof e=="string"){let t=e.trim().toLowerCase();if(nko.has(t))return!0;if(rko.has(t))return!1}},tK=e=>{if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="string"){let t=e.trim();if(t.length===0)return;let n=Number(t);return Number.isFinite(n)?n:void 0}},MMt=e=>{if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0},Rkr=e=>{if(typeof e=="string"){let n=ahe(e);return Object.keys(n).length>0?n:void 0}if(!PMt(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return Object.keys(t).length>0?t:void 0},iko=e=>{if(!PMt(e))return;let t={breakerBackoffMs:tK(e.breakerBackoffMs),breakerFailureThreshold:tK(e.breakerFailureThreshold),bufferDir:MMt(e.bufferDir),bufferMaxBytes:tK(e.bufferMaxBytes),captureMessageContent:WW(e.captureMessageContent),enabled:WW(e.enabled),endpoint:MMt(e.endpoint),headers:Rkr(e.headers),identityMode:kMt(OMt(e.identityMode)),identitySecret:MMt(e.identitySecret),includeAccountUuid:WW(e.includeAccountUuid),includeVersion:WW(e.includeVersion),logsExportIntervalMs:tK(e.logsExportIntervalMs),langsmithCompat:WW(e.langsmithCompat),logToolDetails:WW(e.logToolDetails),logUserPrompts:WW(e.logUserPrompts),metricExportIntervalMs:tK(e.metricExportIntervalMs),metricsTemporalityPreference:NMt(OMt(e.metricsTemporalityPreference)),protocol:S4e(OMt(e.protocol)),resourceAttributes:Rkr(e.resourceAttributes),shutdownTimeoutMs:tK(e.shutdownTimeoutMs)};return Object.values(t).some(r=>r!==void 0)?t:void 0},C4e=(e={})=>{let t=e.platform??process.platform;if(t!=="darwin"&&t!=="win32"&&t!=="linux")return;let n=e.readers?.[t]??tko[t];try{return iko(n())}catch{return}}});function Am(e,t){if(typeof e=="string"){if(!t)throw new Error(`registerBuiltinExtension("${e}", factory) called without a factory`);T4e.push({name:e,factory:t,kind:"bundled"});return}if((e.kind??"bundled")==="prebundled"){if(e.factory!==void 0)throw new Error(`registerBuiltinExtension("${e.name}"): prebundled extensions must not be registered with a factory (the static factory import would inline the extension into the SEA, see apps/auggie-v2/docs/prebundled-extensions.md).`);T4e.push({name:e.name,kind:"prebundled"});return}if(!e.factory)throw new Error(`registerBuiltinExtension({ name: "${e.name}" }) called without a factory for kind="bundled"`);T4e.push({name:e.name,factory:e.factory,kind:"bundled"})}function Nkr(){return T4e}function kkr(e,t){return e.filter(n=>!t.has(n.name))}var T4e,BMt=C(()=>{"use strict";T4e=[]});import{statSync as sko}from"node:fs";import{resolve as oko}from"node:path";function LMt(e,t,n){let r=[],i=[];if(!e||e.length===0)return{resolved:r,errors:i};let s=new Set([t]);for(let o of e){let a=Yl(o),l=oko(n,a);if(s.has(l))continue;let u;try{u=sko(l)}catch(c){let d=c instanceof Error?c.message:String(c);i.push(`--add-workspace "${o}": ${d}`);continue}if(!u.isDirectory()){i.push(`--add-workspace "${o}": not a directory (${l})`);continue}s.add(l),r.push(l)}return{resolved:r,errors:i}}function Okr(e){return e.isCloudService?{kind:"tolerate",warnings:e.errors}:{kind:"fatal",fatalErrors:e.errors}}var Mkr=C(()=>{"use strict";jd()});function Pkr(e,t){return e.unknownFlags.has("cloud-agent")?"cloud-service":e.mode==="acp"||e.mode==="rpc"||e.mode==="json"?e.mode:e.mode==="stream"||e.print||!t?"print":"interactive"}function Dkr(e,t){return e==="json"?"json":t==="stream"?"stream":"text"}var Bkr=C(()=>{"use strict"});function lko(e){if(e.key==="logFile"&&e.value==="-")return{type:"error",message:"--log-file '-' (log to stderr) is not supported; pass a file path instead"};if(e.key!=="logLevel"||typeof e.value!="string")return e;let t=e.value.toLowerCase();return Lkr.includes(t)?{...e,value:t}:{type:"error",message:`Invalid --log-level "${e.value}". Valid values: ${Lkr.join(", ")}`}}function FMt(e,t,n=!1){let r=e[t],i=r.indexOf("="),s=i===-1?r:r.slice(0,i),o=ako.find(({flag:d,preCommandOnly:p})=>d===s&&(n||!p));if(!o)return;if(o.kind==="boolean")return i!==-1?void 0:{option:{key:o.key,flag:o.flag,value:!0},nextIndex:t+1};let a=i===-1?e[t+1]:r.slice(i+1),l=i===-1&&a?.startsWith("-")===!0,u=o.preCommandOnly&&i===-1&&(a==="auth"||a==="login");if(a===void 0||a.length===0||l||u)return{diagnostic:{type:"error",message:`${o.flag} requires a value`},nextIndex:t+1};let c=lko({key:o.key,flag:o.flag,value:a});return"key"in c?{option:c,nextIndex:t+(i===-1?2:1)}:{diagnostic:c,nextIndex:t+(i===-1?2:1)}}function r9(e){let t=[],n=[],r=[],i=0;for(;i<e.length;){if(e[i]==="--"){t.push(...e.slice(i));break}let s=FMt(e,i,t.length===0);if(s){s.option&&n.push(s.option),s.diagnostic&&r.push(s.diagnostic),i=s.nextIndex;continue}t.push(e[i]),i++}return{commandArgs:t,globalOptions:n,diagnostics:r}}function lhe(e,t){let n;for(let r of r9(e).globalOptions)r.key===t&&typeof r.value=="string"&&(n=r.value);return n}var ako,Lkr,$W=C(()=>{"use strict";ako=[{flag:"--augment-cache-dir",key:"augmentCacheDir",kind:"value"},{flag:"--login-url",key:"loginUrl",kind:"value",preCommandOnly:!0},{flag:"--log-file",key:"logFile",kind:"value"},{flag:"--log-level",key:"logLevel",kind:"value"},{flag:"--offline",key:"offline",kind:"boolean"}],Lkr=["error","warn","info","debug"]});function Vkr(e){if(!e)return;let t=e.filter(n=>n.trim().length>0);return t.length>0?t:void 0}function Fkr(e,t){let n=N2(e);if(!n.ok){t.diagnostics.push({type:"error",message:n.message});return}t.discoverWorkspaces=!0,t.discoverWorkspacesDepth=n.depth}function UMt(e){return e!==void 0&&!e.startsWith("-")&&!e.startsWith("@")}function pko(e,t,n,r){let i=cko[e];if(i!==void 0)return r[i]=!0,n;let s=e.indexOf("="),o=s===-1?e:e.slice(0,s),a=s===-1?void 0:e.slice(s+1);if((o==="--remove-tool"||o==="--remove-tools")&&a===void 0&&(t===void 0||t.startsWith("-")))return r.diagnostics.push({type:"error",message:`${o} requires a value`}),n;let l=a??t,u=a===void 0?n+1:n,c=uko[o];if(c!==void 0&&l!==void 0)return r[c]=l,u;let d=dko[o];if(d!==void 0&&l!==void 0){let p=r[d]??[];return p.push(l),r[d]=p,u}return null}function mko(e,t){e==="text"||e==="stream"||e==="json"||e==="rpc"||e==="acp"?t.mode=e:t.diagnostics.push({type:"error",message:`Invalid mode: ${e}. Expected text, stream, json, rpc, or acp`})}function fko(e,t){let n=e.split(",").map(i=>i.trim()),r=new Set;for(let i of n){let s=_A(i).filter(o=>Object.hasOwn(bw,o));if(s.length>0)for(let o of s)r.add(o);else t.diagnostics.push({type:"warning",message:`Unknown tool "${i}". Valid tools: ${Object.keys(bw).join(", ")}`})}t.tools=[...r]}function Ukr(e,t){if(e.length===0){t.diagnostics.push({type:"error",message:"--thinking requires a value"});return}t.thinking=e}function hko(e,t,n,r){return e==="--no-discover-workspaces"?(r.discoverWorkspaces=!1,n):e==="--discover-workspaces"?t!==void 0&&R2.test(t)?(Fkr(t,r),n+1):(r.discoverWorkspaces=!0,r.discoverWorkspacesDepth=1,n):e.startsWith("--discover-workspaces=")?(Fkr(e.slice(22),r),n):null}function gko(e,t,n,r){return e==="--thinking"?t===void 0||t.startsWith("-")?(r.diagnostics.push({type:"error",message:"--thinking requires a value"}),n):(Ukr(t,r),n+1):e.startsWith("--thinking=")?(Ukr(e.slice(11),r),n):null}function bko(e,t,n,r){if(e==="--acp")return r.mode="acp",n;if(e==="--mode"&&t!==void 0)return mko(t,r),n+1;let i=hko(e,t,n,r);if(i!==null)return i;if(e==="--worktree")return UMt(t)?(r.worktree=t,n+1):(r.worktree=!0,n);if(e.startsWith("--worktree="))return r.worktree=e.slice(11),n;if(e==="--models"&&t!==void 0)return r.models=t.split(",").map(o=>o.trim()),n+1;if(e==="--tools"&&t!==void 0)return fko(t,r),n+1;let s=gko(e,t,n,r);return s!==null?s:e==="--list-models"?UMt(t)?(r.listModels=t,n+1):(r.listModels=!0,n):e==="--list-models-json"?(r.listModelsJson=!0,n):null}function yko(e,t,n,r){let i=e.indexOf("=");if(i===-1){let s=e.slice(2);return UMt(t)?(r.unknownFlags.set(s,t),n+1):(r.unknownFlags.set(s,!0),n)}return r.unknownFlags.set(e.slice(2,i),e.slice(i+1)),n}function Eko(e){if(!((e[0]==="model"||e[0]==="models")&&e[1]==="list"))return e;let n=e.slice(2),r=n.includes("--json");return["--list-models",...n.filter(s=>s!=="--json"),...r?["--list-models-json"]:[]]}function _ko(e){for(let t=0;t<e.length-2;t++)if(e[t]==="cloud"&&e[t+1]==="run-as-agent"&&Gkr.test(e[t+2]??""))return[...e.slice(0,t),"--cloud-agent",e[t+2],...e.slice(t+3),Ako];return e}function Sko(e,t){if(e.option){let{key:n,value:r}=e.option;t[n]=r}e.diagnostic&&t.diagnostics.push(e.diagnostic)}function vko({arg:e,next:t,index:n,result:r,literalPositionals:i}){if(e.startsWith("@")&&!i)r.fileArgs.push(e.slice(1));else{if(e.startsWith("--"))return yko(e,t,n,r)+1;e.startsWith("-")?r.diagnostics.push({type:"error",message:`Unknown option: ${e}`}):r.messages.push(e)}return n+1}function che(e,t){let n=t?.compatibilityRewrites===!1?e:_ko(Eko(e)),r={messages:[],fileArgs:[],unknownFlags:new Map,diagnostics:[]},i=0;for(let[o,a]of n.entries()){if(o<i)continue;if(a==="--"){r.messages.push(...n.slice(o+1));break}if(t?.stopAtPositional&&!a.startsWith("-")){r.messages.push(...n.slice(o));break}let l=n[o+1],u=FMt(n,o);if(u){Sko(u,r),i=u.nextIndex;continue}let c=pko(a,l,o,r);if(c!==null){i=c+1;continue}let d=bko(a,l,o,r);if(d!==null){i=d+1;continue}i=vko({arg:a,next:l,index:o,result:r,literalPositionals:t?.literalPositionals})}Cko(r);let s=r.unknownFlags.get("cloud-agent");return typeof s=="string"&&Gkr.test(s)&&(r.cloudAgentId=s),r}function Cko(e){let t=e.unknownFlags.get("enhance-prompt");if(t!==void 0){if(typeof t=="string"&&xko.has(t.toLowerCase())){e.unknownFlags.delete("enhance-prompt");return}if(e.mode==="json"||e.mode==="rpc"||e.mode==="acp"){e.diagnostics.push({type:"error",message:`--enhance-prompt is not compatible with --mode ${e.mode}`});return}e.print||e.diagnostics.push({type:"error",message:"--enhance-prompt requires print mode (-p)"})}}function Wkr(e){let t=`${mt.bold(Jr)} - AI coding assistant with read, bash, edit, write tools
6204
6204
 
6205
6205
  ${mt.bold("Usage:")}
@@ -6386,7 +6386,7 @@ not revoke server-side tokens; use \`auggie token revoke\` for revocation.
6386
6386
 
6387
6387
  Interactive /login and /logout manage the platform session in session.json.`,bDr=`Usage: auggie auth status
6388
6388
 
6389
- Show whether the CLI has an active Augment authentication session.`,A5o="Note: Injected credentials remain active and may override the saved session.",E5o="Note: Injected credentials remain active.",_5o="AUGGIE_V2_SEGMENT_WRITE_KEY"});import{readFile as U5o}from"node:fs/promises";import{resolve as V5o}from"node:path";function $5o(e){let t=[],n;for(let r=0;r<e.length;r+=1){let i=e[r];if(i==="--"){t.push(...e.slice(r));break}if(i===hLt){let s=e[r+1];if(s===void 0||s.startsWith("-")||!s.trim())return{type:"fatal"};n=s,r+=1;continue}if(i.startsWith(`${hLt}=`)){let s=i.slice(hLt.length+1);if(!s.trim())return{type:"fatal"};n=s;continue}t.push(i)}return{type:"success",args:t,candidate:n}}async function IDr(e,t=W5o){let n=$5o(e);if(n.type==="fatal")return{type:"fatal",message:G5o};if(n.candidate===void 0)return{type:"success",args:n.args};let r=n.candidate.trim(),i;if(r.startsWith("{"))i=r;else try{i=await t.readPath(V5o(process.cwd(),r))}catch{return{type:"fatal",message:gLt}}let s;try{s=JSON.parse(i)}catch{return{type:"fatal",message:gLt}}let o=Lde(s);return o?{type:"success",args:n.args,credentials:o}:{type:"fatal",message:gLt}}var hLt,G5o,gLt,W5o,wDr=C(()=>{"use strict";Fde();hLt="--augment-session-json",G5o="--augment-session-json requires a value",gLt="--augment-session-json value is unusable",W5o={readPath:e=>U5o(e,"utf8")}});import{execFile as Q5o}from"node:child_process";import{existsSync as H5o,rmSync as Y5o}from"node:fs";import{promisify as Z5o}from"node:util";function yLt(e){let t=e.match(/^git@github\.com:(.+?)(?:\.git)?$/);if(t){let r=t[1];return{sshUrl:`git@github.com:${r}.git`,httpsUrl:`https://github.com/${r}.git`}}let n=e.match(/^https?:\/\/github\.com\/(.+?)(?:\.git)?$/);if(n){let r=n[1];return{sshUrl:`git@github.com:${r}.git`,httpsUrl:`https://github.com/${r}.git`}}return{sshUrl:e,httpsUrl:e}}function ODr(e){return e instanceof Error?e.message:String(e)}async function ALt({sshUrl:e,httpsUrl:t,targetDir:n,extraArgs:r=[]}){let i,s=e===t?[{url:e,env:e.startsWith("http")?bLt:RDr}]:[{url:e,env:RDr},{url:t,env:bLt}];for(let o of s)try{return await kDr("git",["clone","--depth","1",...r,o.url,n],{env:o.env}),{success:!0}}catch(a){i=a,H5o(n)&&Y5o(n,{recursive:!0,force:!0})}return{success:!1,error:ODr(i)}}function NDr(e,t){return kDr("git",e,{cwd:t,env:bLt})}async function MDr(e,t){try{return await NDr(["fetch","--depth","1","origin",t],e),await NDr(["checkout","FETCH_HEAD"],e),{success:!0}}catch(n){return{success:!1,error:ODr(n)}}}var kDr,RDr,bLt,PDr=C(()=>{"use strict";kDr=Z5o(Q5o),RDr={...process.env,GIT_TERMINAL_PROMPT:"0",GIT_SSH_COMMAND:"ssh -o BatchMode=yes"},bLt={...process.env,GIT_TERMINAL_PROMPT:"0"}});import{readFileSync as j5o}from"node:fs";import{join as ELt}from"node:path";function y9(e){let t=z5o(e,DDr);return t.manifest||t.diagnostics.length>0?t:{diagnostics:[`no marketplace manifest found (looked for ${DDr.join(", ")})`]}}function z5o(e,t){let n=[];for(let r of t){let i=ELt(e,r),s;try{s=j5o(i,"utf-8")}catch{continue}try{let o=JSON.parse(s);if(o&&typeof o=="object"&&!Array.isArray(o))return{manifest:o,manifestPath:i,diagnostics:n};n.push(`manifest at ${r} is not a JSON object; ignoring`)}catch(o){n.push(`failed to parse manifest at ${r}: ${o.message}`)}}return{diagnostics:n}}var DDr,dGe=C(()=>{"use strict";DDr=[ELt(".augment-plugin","marketplace.json"),ELt(".claude-plugin","marketplace.json")]});import{execFile as X5o}from"node:child_process";import{existsSync as Ow,mkdirSync as LDr,readdirSync as q5o,renameSync as K5o,rmSync as J5o,statSync as eUo}from"node:fs";import{dirname as tUo,isAbsolute as FDr,join as Mw,relative as UDr,resolve as _Lt}from"node:path";import{promisify as nUo}from"node:util";function WDr(e){let t=e.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!t||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(t)?null:t}function BDr(e){let t=e.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!t||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(t)?null:t}function rUo(e){let t=e.trim();if(!t)return null;let n=t.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(?:@(.+))?$/);if(n?.[1]&&n[2]){let r=n[1],i=n[2].replace(/\.git$/,"");return{repo:i,cloneUrl:`https://github.com/${r}/${i}`,...n[3]?{ref:n[3]}:{}}}if(/^(https?|ssh|file):\/\/|^git@/.test(t)){let[r,i]=t.split("#");if(!r)return null;let s=r.replace(/\/+$/,""),o=s.split(/[/:]/).pop()?.replace(/\.git$/,"");if(o)return{repo:o,cloneUrl:s,...i?{ref:i}:{}}}return null}function Pw(e){return typeof e=="string"&&e.length>0?e:void 0}function iUo(e,t){let n=Pw(e.repo);return n?{kind:"github",url:`https://github.com/${n.replace(/\.git$/,"")}.git`,...t?{ref:t}:{},...Pw(e.path)?{subdir:Pw(e.path)}:{}}:null}function sUo(e,t){let n=Pw(e.url);return n?{kind:"url",url:n,...t?{ref:t}:{},...Pw(e.path)?{subdir:Pw(e.path)}:{}}:null}function oUo(e,t){let n=Pw(e.url),r=Pw(e.path);return n&&r?{kind:"git-subdir",url:n,subdir:r,...t?{ref:t}:{}}:null}function SLt(e){if(!e||typeof e!="object")return null;let t=e,n=Pw(t.sha)??Pw(t.ref);switch(t.source){case"github":return iUo(t,n);case"url":return sUo(t,n);case"git-subdir":return oUo(t,n);default:return null}}function $Dr(e,t,n){let r=WDr(t);if(!r)return;let i=Mw(e,GDr,r);if(!Ow(Mw(i,".git")))return;if(!n)return i;let s=_Lt(i,n),o=UDr(i,s);if(!(o.startsWith("..")||FDr(o)))return Ow(s)?s:void 0}async function aUo(e,t){let n=typeof t.name=="string"?t.name:"",r=SLt(t.source);if(!r)return;let i=WDr(n);if(!i)return{name:n,status:"failed",error:"invalid plugin cache name"};let s=Mw(e,GDr,i);if(Ow(Mw(s,".git")))return{name:n,status:"skipped"};let o=tUo(s);Ow(o)||LDr(o,{recursive:!0});let{sshUrl:a,httpsUrl:l}=yLt(r.url),u=r.kind==="git-subdir",c=await ALt({sshUrl:a,httpsUrl:l,targetDir:s,extraArgs:u?["--filter=blob:none","--sparse"]:[]});if(!c.success)return{name:n,status:"failed",error:c.error};if(r.ref){let d=await MDr(s,r.ref);if(!d.success)return{name:n,status:"failed",error:d.error}}if(u&&r.kind==="git-subdir")try{await VDr("git",["sparse-checkout","set",r.subdir],{cwd:s,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}catch(d){return{name:n,status:"failed",error:d instanceof Error?d.message:String(d)}}return{name:n,status:"cloned"}}async function vLt(e){let{manifest:t}=y9(e),n=t?.plugins;if(!n||n.length===0)return[];let r=[];for(let i of n){let s=await aUo(e,i);s&&r.push(s)}return r}function lUo(e){try{return eUo(e).isDirectory()}catch{return!1}}function cUo(e,t){let n=UDr(_Lt(e),_Lt(t));return n!==""&&!n.startsWith("..")&&!FDr(n)}async function kK(e,t){let n=rUo(t);if(!n)return{success:!1,error:`Invalid repository: ${t}. Expected owner/repo, a Git URL (HTTPS/SSH/file), or a github.com URL.`};let{repo:r,ref:i,cloneUrl:s}=n;Ow(e)||LDr(e,{recursive:!0});let o=BDr(r);if(!o)return{success:!1,error:`Invalid repository name for marketplace directory: "${r}".`};let a=Mw(e,o);if(Ow(a))return{success:!1,alreadyInstalled:!0,marketplaceId:o,error:`Marketplace '${o}' is already installed.`};let{sshUrl:l,httpsUrl:u}=yLt(s),c=await ALt({sshUrl:l,httpsUrl:u,targetDir:a,extraArgs:i?["--branch",i]:[]});if(!c.success)return{success:!1,error:`Failed to clone '${s}': ${c.error}`};let{manifest:d}=y9(a),p=o,m=typeof d?.name=="string"?BDr(d.name):null;if(m&&m!==o){let f=Mw(e,m);if(!Ow(f))try{K5o(a,f),p=m}catch{}}return await vLt(Mw(e,p)),{success:!0,marketplaceId:p}}function OK(e,t){let n=Mw(e,t);if(!cUo(e,n))return{success:!1,error:`Refusing to remove '${t}': path is outside the marketplaces directory.`};if(!Ow(n))return{success:!1,error:`Marketplace '${t}' not found.`};try{return J5o(n,{recursive:!0,force:!0}),{success:!0}}catch(r){return{success:!1,error:`Failed to remove '${t}': ${r instanceof Error?r.message:String(r)}`}}}async function QDr(e){if(!Ow(Mw(e,".git")))return{success:!1,notGitRepo:!0,error:"Not a git repository"};try{return await VDr("git",["pull"],{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),await vLt(e),{success:!0}}catch(t){return{success:!1,error:t instanceof Error?t.message:String(t)}}}async function HDr(e){let t=!1;for(let n of e){if(!Ow(n))continue;let r;try{r=q5o(n)}catch{continue}for(let i of r){let s=Mw(n,i);if(!lUo(s))continue;(await vLt(s)).some(a=>a.status==="cloned")&&(t=!0)}}return t}var VDr,GDr,pGe=C(()=>{"use strict";PDr();dGe();VDr=nUo(X5o),GDr=".plugin-cache"});import{readFileSync as uUo}from"node:fs";import{join as dUo}from"node:path";function mGe(e){let t=dUo(e,"hooks","hooks.json"),n;try{n=uUo(t,"utf-8")}catch{return{diagnostics:[]}}let r;try{r=JSON.parse(n)}catch(s){return{diagnostics:[`failed to parse hooks/hooks.json: ${s.message}`]}}return!r||typeof r!="object"||Array.isArray(r)?{diagnostics:["hooks/hooks.json must be a JSON object"]}:{config:tw(r),diagnostics:[]}}var xLt=C(()=>{"use strict";o2()});import{existsSync as pUo,lstatSync as mUo,readdirSync as zDr,realpathSync as YDr,statSync as fUo}from"node:fs";import{basename as ZDr,isAbsolute as CLt,join as Vhe,relative as XDr,resolve as TLt}from"node:path";function ILt(e,t){let n=[],r=[],i=[],s=new Map;for(let o of new Set(e))for(let a of hUo(o,t,r)){let l=s.get(a.id);if(l!==void 0){i.push({id:a.id,shadowedRoot:o,winnerRoot:l});continue}s.set(a.id,o),n.push(a)}for(let[o,a]of Object.entries(t))a&&!s.has(o)&&r.push(`enabledPlugins["${o}"] = true but no plugin with that id was found in any marketplace root`);return{plugins:n,globalDiagnostics:r,shadowedPlugins:i}}function hUo(e,t,n){let r=[];if(!pUo(e))return r;let i=y9(e);if(!i.manifest)for(let o of i.diagnostics)o.startsWith("no marketplace manifest found")||n.push(`[${ZDr(e)}] ${o}`);if(i.manifest)return jDr(e,ZDr(e),t,r,n),r;let s;try{s=zDr(e)}catch(o){return n.push(`failed to read marketplaces directory ${e}: ${o.message}`),r}for(let o of s){let a=Vhe(e,o);Ghe(a)&&jDr(a,o,t,r,n)}return r}function jDr(e,t,n,r,i){let s=y9(e);if(!s.manifest){for(let u of s.diagnostics)i.push(`[${t}] ${u}`);return}let o=SUo(s.manifest.name,t),a=_Uo(e,s.manifest.metadata?.pluginRoot),l=Array.isArray(s.manifest.plugins)?s.manifest.plugins:[];l.length===0&&i.push(`[${o}] marketplace.json has no plugins[] entries`);for(let u of l){let c=gUo(u,e,a,o,n);c&&r.push(c)}for(let u of s.diagnostics)i.push(`[${o}] ${u}`)}function gUo(e,t,n,r,i){let s=typeof e.name=="string"?A9(e.name):void 0;if(!s)return;let o=`${s}@${r}`,a=i[o]===!0,l=[],u=EUo(e.source,s,t,n,l);return u?yUo(o,r,s,u,a,l,t):{id:o,marketplace:r,name:s,enabled:a,commandsDir:void 0,skillsDir:void 0,hooksConfig:void 0,agentsDirPresent:!1,diagnostics:l}}function bUo(e,t){let n=[],r;try{r=zDr(e).sort()}catch(s){return t.push(`failed to read agents directory: ${s.message}`),n}let i=[];for(let s of r){if(!s.endsWith(".md"))continue;let o=Vhe(e,s);try{if(!mUo(o).isFile()){i.push(s);continue}}catch(a){t.push(`failed to stat agent file ${s}: ${a.message}`);continue}n.push(o)}return i.length>0&&t.push(`ignoring non-regular agent file(s) under agents/ (symlinks / dirs / devices are not followed): ${i.join(", ")}`),n}function yUo(e,t,n,r,i,s,o){let a=Vhe(r,"commands"),l=Vhe(r,"skills"),u=Vhe(r,"agents"),c=vUo(a,r,s),d=Ghe(l)?l:void 0,p=Ghe(u),m=p&&i?bUo(u,s):void 0,f=mGe(r);for(let h of f.diagnostics)s.push(h);return{id:e,marketplace:t,name:n,root:r,marketplacePath:TLt(o),enabled:i,commandsDir:c,skillsDir:d,hooksConfig:f.config,agentsDirPresent:p,agentFiles:m,diagnostics:s}}function AUo(e,t,n,r){let i=SLt(e);if(!i){let o=e.source;r.push(`source kind "${typeof o=="string"?o:"object"}" is not supported; install the plugin manually as a relative directory`);return}let s=$Dr(n,t,i.subdir);if(s)return s;r.push(`source kind "${i.kind}" not fetched yet; run /plugins to clone it (or marketplace update)`)}function EUo(e,t,n,r,i){if(typeof e!="string"){if(e&&typeof e=="object")return AUo(e,t,n,i);i.push("plugin entry has no source field; skipping");return}if(CLt(e)){i.push(`absolute source "${e}" is not allowed; skipping`);return}let s=e.startsWith("./")?n:r,o=TLt(s,e),a=XDr(n,o);if(a.startsWith("..")||CLt(a)){i.push(`source "${e}" resolves outside the marketplace root; skipping`);return}if(!Ghe(o)){i.push(`source "${e}" does not point to an existing directory (looked at ${o})`);return}return o}function _Uo(e,t){return typeof t!="string"||t.length===0?e:TLt(e,t)}function SUo(e,t){if(typeof e=="string"&&e.length>0){let n=A9(e);if(n.length>0)return n}return t}function A9(e){let t="";for(let n of e){let r=n.codePointAt(0);if(r===void 0)continue;let i=r<=31,s=r>=127&&r<=159;i||s||(t+=n)}return t}function vUo(e,t,n){if(Ghe(e))try{let r=XDr(YDr(t),YDr(e));if(r===".."||r.startsWith("../")||r.startsWith("..\\")||CLt(r)){n.push("commands/ directory resolves outside the plugin root");return}return e}catch{n.push("commands/ directory could not be resolved");return}}function Ghe(e){try{return fUo(e).isDirectory()}catch{return!1}}var Whe=C(()=>{"use strict";pGe();xLt();dGe()});import{readFileSync as xUo}from"node:fs";import{basename as CUo}from"node:path";function Vx(e,t,n=!0){if(e!==void 0){if(typeof e!="string")throw new Gx(`Invalid ${t}: expected a string.`);return n?e.trim():e}}function W2(e,t){if(e!==void 0){if(typeof e!="boolean")throw new Gx(`Invalid ${t}: expected a boolean.`);return e}}function qDr(e){return A9(e.trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9_-]/g,"-").replace(/-+/g,"-"))}function fGe(e,t){if(typeof e=="string")return e.trim()==="none"?[]:[...new Set(e.split(",").map(n=>n.trim()).filter(Boolean))];if(!Array.isArray(e)||e.some(n=>typeof n!="string"||!n.trim()))throw new Gx(`Invalid ${t}: expected named strings as a list or CSV.`);return[...new Set(e.map(n=>n.trim()))]}function wUo(e){if(e===void 0)return!0;if(typeof e=="boolean")throw new Gx("Boolean skills is unsupported. Use disable_skills: true for opt-out; omit skills for defaults.");let t=fGe(e,"skills");return t.length?t:!1}function RUo(e){switch(e){case"red":case"blue":case"green":case"yellow":case"orange":case"purple":case"pink":case"cyan":return e;default:return}}function wLt(e,t,n){return{name:e,pluginId:t,source:"plugin",description:e,enabled:!1,invalidDefinition:!0,diagnostics:[n],builtinToolNames:[],disallowedTools:[],extensions:!1,skills:!1,systemPrompt:"",promptMode:"append"}}function NUo(e){if(typeof e=="string")return IUo.includes(e)?e:void 0}function kUo(e){return typeof e=="number"&&e>=0?e:void 0}function OUo(e){if(e==="user"||e==="project"||e==="local")return e}function MUo(e){if(e==null||e===!0)return!0;if(e===!1||e==="none")return!1;let t=fGe(e,"extensions");return t.length>0?t:!1}function PUo(e,t){let n=CUo(e,".md"),r=qDr(n),i;try{i=xUo(e,"utf-8")}catch{return wLt(r,t,"Custom-agent file could not be read.")}try{let{frontmatter:s,body:o}=fx(i);if(!s||typeof s!="object"||Array.isArray(s))throw new Gx("Invalid frontmatter mapping.");if(r=qDr(Vx(s.name,"name")||n),!r)throw new Gx("Invalid name: a non-empty identity is required.");for(let[a,l]of Object.entries({disallowed_tools:"Use disabled_tools instead.",prompt_mode:"Use replace_system_prompt: false for append or true for replace.",inherit_skills:"Use disable_skills for opt-out or skills for named selection."}))if(Object.hasOwn(s,a))throw new Gx(`Removed frontmatter field ${a}. ${l}`);return BUo({fm:s,body:o,name:r,pluginId:t})}catch(s){return wLt(r,t,s instanceof Gx?s.message:"Invalid custom-agent definition.")}}function DUo(e){let t=Vx(e.thinking,"thinking"),n=NUo(t),r=RUo(e.color),i=[];return e.color!==void 0&&!r&&i.push("Invalid color: expected a supported terminal label color."),t!==void 0&&n===void 0&&i.push("Invalid thinking: expected a supported thinking level. Model default retained."),{color:r,thinking:n,diagnostics:i.length?i:void 0}}function BUo({fm:e,body:t,name:n,pluginId:r}){let i=W2(e.replace_system_prompt,"replace_system_prompt")??!1;if(i&&!t.trim())throw new Gx("replace_system_prompt requires a non-empty Markdown body.");let s=W2(e.disable_skills,"disable_skills")??!1,o=wUo(e.skills);return{name:n,displayName:Vx(e.display_name,"display_name")||n,description:Vx(e.description,"description")||n,...DUo(e),toolDescription:Vx(e.tool_description,"tool_description")||void 0,instructionDescription:Vx(e.instruction_description,"instruction_description")||void 0,providerModel:Vx(e.provider_model,"provider_model",!1),providerApiKey:Vx(e.provider_api_key,"provider_api_key",!1),providerBaseUrl:Vx(e.provider_base_url,"provider_base_url",!1),builtinToolNames:e.tools===void 0?[...TUo]:fGe(e.tools,"tools"),disallowedTools:e.disabled_tools===void 0?void 0:fGe(e.disabled_tools,"disabled_tools"),extensions:MUo(e.extensions??e.inherit_extensions),skills:s?!1:o,disableSkills:s,disableRules:W2(e.disable_rules,"disable_rules")??!1,disableWorkspaceGuidelines:W2(e.disable_workspace_guidelines,"disable_workspace_guidelines")??!1,model:Vx(e.model,"model"),maxTurns:kUo(e.max_turns),systemPrompt:t.trim(),replaceSystemPrompt:i,promptMode:i?"replace":"append",inheritContext:W2(e.inherit_context,"inherit_context"),runInBackground:W2(e.run_in_background,"run_in_background"),isolated:W2(e.isolated,"isolated"),memory:OUo(e.memory),isolation:e.isolation==="worktree"?"worktree":void 0,enabled:W2(e.enabled,"enabled")??!0,hidden:W2(e.hidden,"hidden")??!1,finishTool:Vx(e.finish_tool,"finish_tool"),source:"plugin",pluginId:r}}function JDr(e){let t=new Map,n=[];if(!e.agentFiles||e.agentFiles.length===0)return{agents:t,diagnostics:n};let r=new Map;for(let i of e.agentFiles){let s=PUo(i,e.id);n.push(...s.diagnostics??[]);let o=s.name.toLowerCase();if(r.has(o)){let a=r.get(o)??s.name,l="Duplicate agent identity in the same directory.";n.push(l),t.set(a,wLt(a,e.id,l));continue}t.set(s.name,s),r.set(o,s.name)}return{agents:t,diagnostics:n}}var TUo,IUo,KDr,Gx,eBr=C(()=>{"use strict";Cs();Whe();TUo=["read","bash","edit","write","grep","find","ls"],IUo=["off","minimal","low","medium","high","xhigh"],KDr=["general-purpose","explore","plan"],Gx=class extends Error{}});import{lstatSync as LUo,readFileSync as FUo,realpathSync as tBr}from"node:fs";import{isAbsolute as UUo,join as VUo,relative as GUo}from"node:path";function MK(e,t){let n=e;for(let r of WUo){let i=`\${${r}}`;n.includes(i)&&(n=n.split(i).join(t))}return n}function RLt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function nBr(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=String(r));return Object.keys(t).length>0?t:void 0}function $Uo(e){if(e.type==="stdio"||e.type==="http"||e.type==="sse")return e.type;if(e.url)return"http";if(e.command)return"stdio"}function QUo(e,t){let n=$Uo(t);if(!n)throw new Error(`MCP server "${e}" must declare a 'command' (stdio) or 'url' (http/sse) property`);if(n==="http"||n==="sse"){if(!t.url)throw new Error(`MCP server "${e}" has type "${n}" but no 'url' property`);let a=typeof t.clientId=="string"?t.clientId.trim():void 0;return{type:n,name:e,disabled:t.disabled,url:t.url,headers:nBr(t.headers),auth:t.auth==="oauth"?"oauth":void 0,...a?{clientId:a}:{},cwd:t.cwd,timeoutMs:t.timeoutMs}}let r=t.command;if(!r)throw new Error(`MCP server "${e}" has type "stdio" but no 'command' property`);let i=Array.isArray(t.args)?t.args.map(a=>String(a)):[],s=t.useShellInterpolation??!0,o=s&&i.length>0?`${r} ${i.join(" ")}`:r;return{type:"stdio",name:e,disabled:t.disabled,command:o,args:s?[]:i,env:nBr(t.env),cwd:t.cwd,timeoutMs:t.timeoutMs,useShellInterpolation:s}}function rBr(e,t){if(!e)return;let n={};for(let[r,i]of Object.entries(e))n[r]=MK(i,t);return n}function HUo(e,t){return e.type==="stdio"?{...e,command:MK(e.command,t),args:e.args.map(n=>MK(n,t)),env:rBr(e.env,t),cwd:e.cwd?MK(e.cwd,t):void 0}:{...e,url:MK(e.url,t),headers:rBr(e.headers,t),cwd:e.cwd?MK(e.cwd,t):void 0}}function YUo(e,t){let n=VUo(e,".mcp.json"),r;try{r=LUo(n)}catch(i){if(i?.code==="ENOENT")return;t.push(`failed to stat .mcp.json: ${i.message}`);return}if(r.isSymbolicLink()){t.push(".mcp.json is a symlink; refusing to follow it out of the plugin root");return}if(!r.isFile()){t.push(".mcp.json is not a regular file; skipping");return}try{let i=tBr(e),s=tBr(n),o=GUo(i,s);if(o.startsWith("..")||UUo(o)){t.push(".mcp.json resolves outside the plugin root; skipping");return}}catch(i){t.push(`failed to resolve .mcp.json real path: ${i.message}`);return}try{return FUo(n,"utf-8")}catch(i){t.push(`failed to read .mcp.json: ${i.message}`);return}}function hGe(e){let t=[];if(!e.root)return{servers:[],diagnostics:t};let n=YUo(e.root,t);if(n===void 0)return{servers:[],diagnostics:t};let r;try{r=JSON.parse(n)}catch(o){return t.push(`failed to parse .mcp.json: ${o.message}`),{servers:[],diagnostics:t}}if(!RLt(r))return t.push(".mcp.json must be a JSON object"),{servers:[],diagnostics:t};let i=r.mcpServers;if(!RLt(i))return t.push('.mcp.json must contain an "mcpServers" object'),{servers:[],diagnostics:t};let s=[];for(let[o,a]of Object.entries(i)){let l=`${e.id}/${A9(o)}`;if(!RLt(a)){t.push(`MCP server "${l}" must be a JSON object`);continue}try{let u=QUo(l,a);s.push(HUo(u,e.root))}catch(u){t.push(u instanceof Error?u.message:String(u))}}return{servers:s,diagnostics:t}}var WUo,iBr,NLt=C(()=>{"use strict";Whe();WUo=["CLAUDE_PLUGIN_ROOT","AUGMENT_PLUGIN_ROOT","AUGGIE_PLUGIN_ROOT"];iBr="hermes:mcp:register-server-source"});function sBr(e,t,n){let r=gi.create(e,t,n),i={};for(let o of[r.getVfsOrgSettings(),r.getVfsSpaceSettings(),r.getVfsUserSettings(),r.getSettings()])for(let[a,l]of Object.entries(o.enabledPlugins??{}))typeof l=="boolean"&&(i[a]=l);let s=r.drainErrors().map(({scope:o,error:a})=>`failed to load ${o} settings: ${a.message}; enabledPlugins entries from this scope will be ignored`);return{enabled:i,diagnostics:s}}var oBr=C(()=>{"use strict";Cs()});var aBr,lBr=C(()=>{"use strict";aBr="hermes:subagents:register-agent-source"});import{lstatSync as ZUo,readdirSync as jUo,readFileSync as kLt}from"node:fs";import{basename as zUo,dirname as XUo,extname as qUo,isAbsolute as KUo,join as Wx,parse as JUo,relative as PK,resolve as $he,sep as OLt}from"node:path";function gGe(e){return typeof e=="string"&&bGe(e)||void 0}function cBr(e,t){let n=PK(e,t);return!KUo(n)&&n!==".."&&!n.startsWith(`..${OLt}`)}function e3o(e,t,n){let r=n?$he(n):JUo(e).root;if(!cBr(r,e)||!cBr(e,t))throw new Error("Plugin metadata path is outside the plugin root");let i=r,s;for(let o of["",...PK(r,t).split(OLt).filter(Boolean)]){i=Wx(i,o);try{s=ZUo(i)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.isSymbolicLink())throw new Error("Plugin metadata path contains a symbolic link")}return s}function DK(e){let t={agents:[],commands:[],rules:[],mcpServers:[],hooks:[],skills:[],diagnostics:[]};if(!e.root)return t.diagnostics.push("Plugin source is unavailable"),t;let n=$he(e.root),r=d=>e3o(n,d,e.marketplacePath),i=sX(),s=d=>{let p=`Could not read plugin ${d} metadata`;t.diagnostics.includes(p)||t.diagnostics.push(p)};try{if(!r(n)?.isDirectory())throw new Error("Plugin root is unavailable")}catch{return s("contents"),t}let o=(d,p,m,f)=>{let h={name:bGe(p)};try{if(!r(d)?.isFile())throw new Error("Plugin metadata file is unavailable");let{frontmatter:g}=fx(kLt(d,"utf8"));if(!g||typeof g!="object"||Array.isArray(g))throw new Error("Invalid plugin frontmatter");f&&(h.name=gGe(g.name)??h.name),h.description=gGe(g.description)}catch{s(m)}return h},a=(d,p,m)=>{let f=qUo(p);if(!(f===".md"||(d==="commands"||d==="rules")&&f===".txt")||d==="skills"&&XUo(p)!==m)return;let g=PK(m,p),b=d==="rules"?g:g.slice(0,-f.length).split(OLt).join(":");t[d].push(o(p,b,d,d==="agents"||d==="skills"))},l=(d,p,m)=>{try{let f=r(p);if(d==="skills"&&iL(i,PK(m,p),f?.isDirectory()))return;f?.isDirectory()?d!=="agents"&&c(d,p,m):f?.isFile()&&a(d,p,m)}catch{s(d)}},u=(d,p)=>{for(let m of iX){let f=Wx(d,m);try{let h=r(f);if(!h)continue;if(!h.isFile())throw new Error("Invalid skill ignore file");oX(i,kLt(f,"utf8"),PK(p,d))}catch{s("skills")}}},c=(d,p,m=p)=>{try{let f=r(p);if(!f)return;if(!f.isDirectory())throw new Error("Plugin metadata directory is invalid");if(d==="skills"){u(p,m);let h=Wx(p,"SKILL.md");if(!iL(i,PK(m,h))&&r(h)?.isFile()){t.skills.push(o(h,zUo(p),d,!0));return}}for(let h of jUo(p).sort())(d==="commands"||d==="skills")&&rL(h)||l(d,Wx(p,h),m)}catch{s(d)}};return c("agents",Wx(n,"agents")),c("commands",$he(e.commandsDir??Wx(n,"commands"))),c("rules",Wx(n,"rules")),c("skills",$he(e.skillsDir??Wx(n,"skills"))),t.hooks=r3o(n,r,s),t.mcpServers=i3o(e,r,s),Object.assign(t,n3o(n,r,s)),t}function t3o(e){let t={};for(let s of["description","version","homepage"]){let o=gGe(e[s]);o&&(t[s]=o)}let n=e.author,r=n&&typeof n=="object"&&!Array.isArray(n)?n.name:n,i=gGe(r);return i&&(t.author=i),t}function n3o(e,t,n){for(let r of[".augment-plugin",".claude-plugin"])try{let i=Wx(e,r,"plugin.json"),s=t(i);if(!s)continue;if(!s.isFile())throw new Error("Invalid plugin manifest file");let o=JSON.parse(kLt(i,"utf8"));if(!o||typeof o!="object"||Array.isArray(o))throw new Error("Invalid plugin manifest");return t3o(o)}catch{n("manifest")}return{}}function r3o(e,t,n){let r=[];try{let i=t(Wx(e,"hooks","hooks.json"));if(i){if(!i.isFile())throw new Error("Invalid plugin hooks file");let{config:s,diagnostics:o}=mGe(e);(!s||o.length)&&n("hook");for(let[a,l]of Object.entries(s??{}).sort(([u],[c])=>u.localeCompare(c)))for(let u of l??[])r.push({name:bGe(`${a}[${u.matcher??".*"}]`),description:"Command hook"})}}catch{n("hook")}return r}function i3o(e,t,n){if(!e.root)return[];let r=$he(e.root);try{let i=t(Wx(r,".mcp.json"));if(i){if(!i.isFile())throw new Error("Invalid plugin MCP file");let{servers:s,diagnostics:o}=hGe(e);return o.length&&n("MCP server"),s.map(a=>({name:bGe(a.name.slice(e.id.length+1)),description:`${a.type==="stdio"?"stdio":a.type.toUpperCase()} server`})).sort((a,l)=>a.name.localeCompare(l.name))}}catch{n("MCP server")}return[]}var bGe,uBr=C(()=>{"use strict";Cs();Whe();xLt();NLt();bGe=e=>A9(e.replace(/\s+/g," ")).trim()});var Hhe={};li(Hhe,{addMarketplace:()=>kK,default:()=>EGe,getDiscoveredMarketplaces:()=>Qhe,getDiscoveredPlugins:()=>$x,getInteractivePluginDiagnostics:()=>h3o,getPluginDetails:()=>DK,getPluginDiagnostics:()=>Qx,getV2MarketplacesRoot:()=>LK,removeMarketplace:()=>OK,updateMarketplace:()=>QDr});import{join as n6,resolve as s3o}from"node:path";import{existsSync as o3o,readdirSync as a3o,statSync as l3o}from"node:fs";function u3o(){return globalThis[dBr]??{}}function d3o(e){globalThis[dBr]=e}function EGe(e){f1=[],AGe=[],yGe=[],MLt=[],BK=[];let t=!1,n,r=new Map,i,s,o=new Map,a;e.events.on(nFe,w=>{n=w.register}),e.events.on(aBr,w=>{i=w.register}),e.events.on(iBr,w=>{a=w.registerServerSource}),e.events.on(c3o,w=>{d3o(w?.scopes??{})});function l(w,T,P=[]){let O=u3o(),{enabled:D,diagnostics:k}=sBr(w,T,O),M=[...new Set(P.map(ne=>s3o(w,ne)))],L=ILt(M,{}),F={...D};for(let ne of L.plugins)F[ne.id]=!0;let H=n6(wA(),"plugins","marketplaces"),U=n6(T,"plugins","marketplaces"),J=[O.user,O.space,O.org].flatMap(ne=>ne?[n6(ne,".augment","plugins","marketplaces")]:[]),ie=ILt([...M,H,U,...J],F);for(let ne of ie.shadowedPlugins)gE.debug(`plugin "${ne.id}" from ${ne.shadowedRoot} is shadowed by the higher-precedence root ${ne.winnerRoot}`);return ie.globalDiagnostics=[...k,...ie.globalDiagnostics],f1=ie.plugins,AGe=ie.globalDiagnostics,t=!0,ie}function u(w,T,P=[]){t||l(w,T,P)}function c(){let w=new Map,T=new Map;yGe=[];let P=[...f1.filter(O=>O.enabled)].sort((O,D)=>O.id.localeCompare(D.id));for(let O of P){let{agents:D,diagnostics:k}=JDr(O);for(let M of k)gE.warn(`[${O.id}] ${M}`),yGe.push({type:"warning",message:`[${O.id}] ${M}`,path:O.root});for(let[M,L]of D)d(O.id,M,L,w,T)}o=w}function d(w,T,P,O,D){let k=T.toLowerCase(),M=D.get(k);if(M){let L=M.name===T?`"${T}"`:`"${T}" (case-insensitive collision with "${M.name}")`;gE.warn(`[${w}] plugin-contributed agent ${L} shadowed by earlier plugin ${M.pluginId}; ignoring`);return}KDr.includes(k)&&gE.warn(`[${w}] plugin-contributed agent "${T}" shadows the built-in default agent of the same name; the plugin's definition will be used for every Agent-tool invocation across this session`),O.set(T,P),D.set(k,{pluginId:w,name:T})}function p(){if(!i)return;s?.(),s=i({getAgents:()=>o,getDiagnostics:()=>yGe})}function m(){let w=[];BK=[];let T=[...f1.filter(P=>P.enabled)].sort((P,O)=>P.id.localeCompare(O.id));for(let P of T){let{servers:O,diagnostics:D}=hGe(P);for(let k of D)gE.warn(`[${P.id}] ${k}`),BK.push({type:"warning",message:`[${P.id}] ${k}`,path:P.root});for(let k of O)w.push(k)}MLt=w}function f(){if(!a)return;a({source:"plugin",getServers:()=>MLt,getDiagnostics:()=>BK})}function h(){if(n){for(let w of r.values())w();r.clear();for(let w of f1){if(!w.enabled)continue;let T=p3o(w);T&&r.set(w.id,n(T))}}}function g(){for(let w of r.values())w();r.clear()}function b(){let w=[],T=[];for(let P of f1){if(!P.enabled){for(let O of P.diagnostics)gE.debug(`[${P.id}] ${O}`);continue}P.root&&P.commandsDir&&T.push({path:P.commandsDir,commandNamespace:`${P.name}--${P.marketplace}`}),P.root&&P.skillsDir&&w.push(P.skillsDir);for(let O of P.diagnostics)gE.warn(`[${P.id}] ${O}`)}return{skillPaths:w,promptPaths:T}}e.on("resources_discover",(w,T)=>{t=!1;let P=l(w.cwd,w.agentDir,T.pluginDirs),{skillPaths:O,promptPaths:D}=b();for(let M of P.globalDiagnostics)gE.warn(M);let k=f1.filter(M=>M.enabled).length;return f1.length>0&&gE.info(`Discovered ${f1.length} plugin(s); ${k} enabled`),h(),c(),p(),x(),m(),f(),v(),{skillPaths:O,promptPaths:D}}),e.on("session_start",(w,T)=>{u(T.cwd,T.agentDir,T.pluginDirs),h(),c(),p(),_(),m(),f();let P=n6(wA(),"plugins","marketplaces"),O=n6(T.agentDir,"plugins","marketplaces");HDr([P,O]).then(D=>{D&&(t=!1,l(T.cwd,T.agentDir,T.pluginDirs),h(),c(),p(),m(),f())}).catch(D=>{gE.debug(`background plugin source fetch failed: ${D instanceof Error?D.message:String(D)}`)})}),e.on("session_shutdown",()=>{g(),s?.(),s=void 0,o=new Map});let A=!1,y=!1,S=!1;function _(){!n&&!A&&(A=!0,gE.warn("@hermes/hooks did not register a hook listener; plugin hooks will not run. This usually means @hermes/hooks was removed from the built-in extension list."))}function x(){!i&&!y&&(y=!0,gE.debug("@hermes/subagents did not register an agent source; plugin-contributed subagents will not be available (expected when --disable-subagents is set)."))}function v(){!a&&!S&&(S=!0,gE.debug("@hermes/mcp did not register a server source; plugin-contributed MCP servers will not be loaded."))}}function p3o(e){if(e.root)return{source:e.id,isEnabled:()=>e.enabled,getConfig:()=>e.hooksConfig,env:m3o(e.root),postToolUsePrefix:`Plugin ${e.id} hook`,hookLabel:t=>`[${e.id}] ${t} hook`,blockedFallbackReason:"Blocked by plugin hook"}}function m3o(e){return{PLUGIN_ROOT:e,CLAUDE_PLUGIN_ROOT:e,AUGMENT_PLUGIN_ROOT:e,AUGGIE_PLUGIN_ROOT:e}}function $x(){return f1}function LK(e){return n6(e,"plugins","marketplaces")}function Qhe(e){let t=LK(e);if(!o3o(t))return[];let n;try{n=a3o(t)}catch{return[]}let r=[];for(let i of n){let s=n6(t,i);try{if(!l3o(s).isDirectory())continue}catch{continue}let{manifest:o}=y9(s);if(!o)continue;let a=typeof o.name=="string"&&o.name.length>0?o.name:i;r.push({dir:i,name:a,path:s})}return r}function Qx(){let e=[];for(let t of f1)for(let n of t.diagnostics)e.push({type:"warning",message:`[${t.id}] ${n}`,path:t.root});for(let t of AGe)e.push({type:"warning",message:t});for(let t of BK)e.push(t);return e}function h3o(){let e=[],t=new Set,n=0;for(let r of f1){let i=!1;for(let s of r.diagnostics){let o=r.enabled?null:f3o.exec(s);if(o?.[1]){t.add(o[1]),i=!0;continue}e.push({type:"warning",message:`[${r.id}] ${s}`,path:r.root})}i&&n++}if(n>0){let r=[...t].sort().join(", "),i=n===1?"plugin":"plugins";e.push({type:"warning",message:`${n} disabled ${i} use unsupported source kinds (${r}); enable one to see details, or re-run with --check-startup`})}for(let r of AGe)e.push({type:"warning",message:r});for(let r of BK)e.push(r);return e}var gE,c3o,dBr,f1,AGe,yGe,MLt,BK,f3o,Dw=C(()=>{"use strict";Cs();o2();en();eBr();Whe();pGe();dGe();NLt();oBr();lBr();uBr();pGe();gE=tt.child({prefix:"pi-plugins"}),c3o="augment:vfs-scopes",dBr=Symbol.for("__pi_plugins_vfs_scopes__");f1=[],AGe=[],yGe=[],MLt=[],BK=[];f3o=/^source kind "([^"]+)" (?:is not supported; install the plugin manually as a relative directory|not fetched yet; run \/plugins to clone it \(or marketplace update\))$/});function g3o(e){return{...e,execute:(t,n,r,i,s)=>{let o=Vwe(e.name);if(!o)throw new Error(`Cloud tool "${e.name}" is unavailable`);return o.execute(t,n,r,i,s)}}}function PLt(e){for(let t of PCn())e.registerTool(g3o(t))}var pBr=C(()=>{"use strict";FY()});function SGe(){let e=globalThis;return e[mBr]??=new Map,e[mBr]}function _Ge(){let e=globalThis;return e[fBr]??=new Map,e[fBr]}function vGe(){return[...SGe().values()]}function xGe(e){return SGe().get(e)}function gBr(e){return _Ge().get(e)}function E9(e,t){SGe().set(e.name,e),t===void 0?_Ge().delete(e.name):_Ge().set(e.name,t)}function FK(e,t){let n=SGe();(t===void 0||n.get(e)===t)&&(n.delete(e),_Ge().delete(e))}function bBr(e){Reflect.set(e,hBr,!0)}function CGe(e){return Reflect.get(e,hBr)===!0}var mBr,fBr,hBr,$2=C(()=>{"use strict";mBr=Symbol.for("__hermes_mcp_tool_registry__"),fBr=Symbol.for("__hermes_mcp_tool_server_registry__"),hBr=Symbol.for("__hermes_mcp_extension_factory__")});function b3o(e){return{...e,execute:(t,n,r,i,s)=>{let o=xGe(e.name);if(!o)throw new Error(`MCP tool "${e.name}" is unavailable`);return o.execute(t,n,r,i,s)}}}function TGe(e){for(let t of vGe())e.registerTool(b3o(t))}var yBr=C(()=>{"use strict";$2()});import{existsSync as y3o}from"node:fs";import{homedir as Yhe}from"node:os";import{dirname as DLt,join as Hx,resolve as EBr}from"node:path";import{fileURLToPath as A3o}from"node:url";function _Br(){let e=process.env.PI_PACKAGE_DIR;if(e)return e==="~"?Yhe():e.startsWith("~/")?Yhe()+e.slice(1):e;let t=ABr;for(;t!==DLt(t);){if(y3o(Hx(t,"package.json")))return t;t=DLt(t)}return ABr}function IGe(){return EBr(Hx(_Br(),"docs"))}function wGe(){return EBr(Hx(_Br(),"CHANGELOG.md"))}function CBr(e){return e==="~"?Yhe():e.startsWith("~/")?Yhe()+e.slice(1):e}function Bw(){let e=process.env.AUGMENT_CACHE_DIR;return e?CBr(e):Hx(Yhe(),".augment")}function nr(){let e=process.env[BLt];return e?CBr(e):Bw()}function zhe(){return Hx(nr(),"themes")}function TBr(){return Hx(nr(),"models.json")}function IBr(){return Hx(nr(),"auth.json")}function wBr(){return Hx(nr(),"settings.json")}function _9(){return Bw()}function UK(){return Hx(nr(),"bin")}function RBr(){return Hx(nr(),Zhe)}function NBr(){return Hx(nr(),`${ei}-debug.log`)}var E3o,ABr,ei,Bs,Zhe,jhe,SBr,_3o,Ws,vBr,xBr,BLt,$s=C(()=>{"use strict";Bft();E3o=A3o(import.meta.url),ABr=DLt(E3o);ei=fD.piConfig?.name||"auggie",Bs=fD.piConfig?.configDir||".augment",Zhe="sessions-v2",jhe=ei,SBr="Auggie Coding Agent",_3o="1.2.0-prerelease.202611050911",Ws=_3o??fD.version,vBr="663f865a9cbbbc67593e89337b3ad0a0d324684b",xBr="2026-11-05T17:11:41Z",BLt=`${ei.toUpperCase()}_CODING_AGENT_DIR`});var OBr,kBr=C(()=>{OBr={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"ansi",vars:{red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,gray:8,brightMagenta:13},colors:{accent:"magenta",border:"gray",borderAccent:"magenta",borderMuted:"gray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"gray",text:"",thinkingText:"gray",selectedBg:"gray",userMessageBg:"",userMessageText:"",customMessageBg:"",customMessageText:"",customMessageLabel:"magenta",toolPendingBg:"",toolSuccessBg:"",toolErrorBg:"",toolTitle:"magenta",toolOutput:"gray",mdHeading:"magenta",mdLink:"magenta",mdLinkUrl:"gray",mdCode:"magenta",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"magenta",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"gray",syntaxKeyword:"blue",syntaxFunction:"yellow",syntaxVariable:"cyan",syntaxString:"green",syntaxNumber:"magenta",syntaxType:"cyan",syntaxOperator:"",syntaxPunctuation:"",thinkingOff:"gray",thinkingMinimal:"gray",thinkingLow:"blue",thinkingMedium:"cyan",thinkingHigh:"magenta",thinkingXhigh:"brightMagenta",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var Lw,MBr=C(()=>{Lw={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"dark",vars:{cyan:"#00d7ff",blue:"#5f87ff",green:"#b5bd68",red:"#cc6666",yellow:"#ffff00",gray:"#808080",dimGray:"#666666",darkGray:"#505050",accent:"#8abeb7",selectedBg:"#3a3a4a",userMsgBg:"#343541",toolPendingBg:"#282832",toolSuccessBg:"#283228",toolErrorBg:"#3c2828",customMsgBg:"#2d2838"},colors:{accent:"accent",border:"blue",borderAccent:"cyan",borderMuted:"darkGray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"dimGray",text:"",thinkingText:"gray",agentRed:"#CC6666",agentBlue:"#81A2BE",agentGreen:"#B5BD68",agentYellow:"#F0C674",agentOrange:"#CE9178",agentPurple:"#B294BB",agentPink:"#D183E8",agentCyan:"#8ABEB7",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#9575cd",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"#b294bb",toolOutput:"gray",mdHeading:"#f0c674",mdLink:"#81a2be",mdLinkUrl:"dimGray",mdCode:"accent",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"accent",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"#6A9955",syntaxKeyword:"#569CD6",syntaxFunction:"#DCDCAA",syntaxVariable:"#9CDCFE",syntaxString:"#CE9178",syntaxNumber:"#B5CEA8",syntaxType:"#4EC9B0",syntaxOperator:"#D4D4D4",syntaxPunctuation:"#D4D4D4",thinkingOff:"darkGray",thinkingMinimal:"#6e6e6e",thinkingLow:"#5f87af",thinkingMedium:"#81a2be",thinkingHigh:"#b294bb",thinkingXhigh:"#d183e8",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var DBr,PBr=C(()=>{DBr={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"light",vars:{teal:"#5a8080",blue:"#547da7",green:"#588458",red:"#aa5555",yellow:"#9a7326",mediumGray:"#6c6c6c",dimGray:"#767676",lightGray:"#b0b0b0",selectedBg:"#d0d0e0",userMsgBg:"#e8e8e8",toolPendingBg:"#e8e8f0",toolSuccessBg:"#e8f0e8",toolErrorBg:"#f0e8e8",customMsgBg:"#ede7f6"},colors:{accent:"teal",border:"blue",borderAccent:"teal",borderMuted:"lightGray",success:"green",error:"red",warning:"yellow",muted:"mediumGray",dim:"dimGray",text:"",thinkingText:"mediumGray",agentRed:"#AA5555",agentBlue:"#476D94",agentGreen:"#477047",agentYellow:"#8A6822",agentOrange:"#795E26",agentPurple:"#875F87",agentPink:"#8B008B",agentCyan:"#4D7070",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#7e57c2",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"",toolOutput:"mediumGray",mdHeading:"yellow",mdLink:"blue",mdLinkUrl:"dimGray",mdCode:"teal",mdCodeBlock:"green",mdCodeBlockBorder:"mediumGray",mdQuote:"mediumGray",mdQuoteBorder:"mediumGray",mdHr:"mediumGray",mdListBullet:"green",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"mediumGray",syntaxComment:"#008000",syntaxKeyword:"#0000FF",syntaxFunction:"#795E26",syntaxVariable:"#001080",syntaxString:"#A31515",syntaxNumber:"#098658",syntaxType:"#267F99",syntaxOperator:"#000000",syntaxPunctuation:"#000000",thinkingOff:"lightGray",thinkingMinimal:"#767676",thinkingLow:"blue",thinkingMedium:"teal",thinkingHigh:"#875f87",thinkingXhigh:"#8b008b",bashMode:"green"},export:{pageBg:"#f8f8f8",cardBg:"#ffffff",infoBg:"#fffae6"}}});import*as Qb from"node:fs";import*as NGe from"node:path";function VLt(){let e=process.env.COLORTERM;if(e==="truecolor"||e==="24bit"||process.env.WT_SESSION)return"truecolor";let t=process.env.TERM||"";return t==="dumb"||t===""||t==="linux"||process.env.TERM_PROGRAM==="Apple_Terminal"||t==="screen"||t.startsWith("screen-")||t.startsWith("screen.")?"256color":"truecolor"}function GLt(e){let t=e.replace("#","");if(t.length!==6)throw new Error(`Invalid hex color: ${e}`);let n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),i=Number.parseInt(t.slice(4,6),16);if(Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i))throw new Error(`Invalid hex color: ${e}`);return{r:n,g:r,b:i}}function LLt(e){let t=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of RGe.entries()){let s=Math.abs(e-i);s<t&&(t=s,n=r)}return n}function T3o(e){let t=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of VBr.entries()){let s=Math.abs(e-i);s<t&&(t=s,n=r)}return n}function LBr(e,t,n,r,i,s){let o=e-r,a=t-i,l=n-s;return o*o*.299+a*a*.587+l*l*.114}function WLt(e,t,n){let r=LLt(e),i=LLt(t),s=LLt(n),o=RGe[r]??0,a=RGe[i]??0,l=RGe[s]??0,u=16+36*r+6*i+s,c=LBr(e,t,n,o,a,l),d=Math.round(.299*e+.587*t+.114*n),p=T3o(d),m=VBr[p]??0,f=232+p,h=LBr(e,t,n,m,m,m),g=Math.max(e,t,n),b=Math.min(e,t,n);return g-b<10&&h<c?f:u}function GBr(e){let{r:t,g:n,b:r}=GLt(e);return WLt(t,n,r)}function WBr(e,t,n){return`\x1B[${e<8?t+e:n+e-8}m`}function FBr(e,t){if(e==="")return"\x1B[39m";if(typeof e=="number")return e<16?WBr(e,30,90):`\x1B[38;5;${e}m`;if(e.startsWith("#")){if(t==="truecolor"){let{r,g:i,b:s}=GLt(e);return`\x1B[38;2;${r};${i};${s}m`}return`\x1B[38;5;${GBr(e)}m`}throw new Error(`Invalid color value: ${e}`)}function I3o(e,t){if(e==="")return"\x1B[49m";if(typeof e=="number")return e<16?WBr(e,40,100):`\x1B[48;5;${e}m`;if(e.startsWith("#")){if(t==="truecolor"){let{r,g:i,b:s}=GLt(e);return`\x1B[48;2;${r};${i};${s}m`}return`\x1B[48;5;${GBr(e)}m`}throw new Error(`Invalid color value: ${e}`)}function $Lt(e,t,n=new Set){if(typeof e=="number"||e===""||e.startsWith("#"))return e;if(n.has(e))throw new Error(`Circular variable reference detected: ${e}`);if(!(e in t))throw new Error(`Variable reference not found: ${e}`);n.add(e);let r=t[e];if(r===void 0)throw new Error(`Variable reference not found: ${e}`);return $Lt(r,t,n)}function $Br(e,t={}){let n={};for(let[r,i]of Object.entries(e))n[r]=$Lt(i,t);return n}function OGe(){let e=new Set(Object.keys(kGe)),t=zhe();if(Qb.existsSync(t)){let n=Qb.readdirSync(t);for(let r of n)r.endsWith(".json")&&e.add(r.slice(0,-5))}for(let n of o6.keys())e.add(n);return Array.from(e).sort()}function QBr(){let e=zhe(),t=[];for(let n of Object.keys(kGe))t.push({name:n,path:void 0});if(Qb.existsSync(e)){for(let n of Qb.readdirSync(e))if(n.endsWith(".json")){let r=n.slice(0,-5);t.some(i=>i.name===r)||t.push({name:r,path:NGe.join(e,n)})}}for(let[n,r]of o6.entries())t.some(i=>i.name===n)||t.push({name:n,path:r.sourcePath});return t.sort((n,r)=>n.name.localeCompare(r.name))}function w3o(e,t){if(!BBr.Check(t)){let n=Array.from(BBr.Errors(t)),r=[],i=[];for(let o of n){let l=o.path.match(/^\/colors\/(\w+)$/)?.[1];l&&o.message.includes("Required")?r.push(l):i.push(` - ${o.path}: ${o.message}`)}let s=`Invalid theme "${e}":
6389
+ Show whether the CLI has an active Augment authentication session.`,A5o="Note: Injected credentials remain active and may override the saved session.",E5o="Note: Injected credentials remain active.",_5o="AUGGIE_V2_SEGMENT_WRITE_KEY"});import{readFile as U5o}from"node:fs/promises";import{resolve as V5o}from"node:path";function $5o(e){let t=[],n;for(let r=0;r<e.length;r+=1){let i=e[r];if(i==="--"){t.push(...e.slice(r));break}if(i===hLt){let s=e[r+1];if(s===void 0||s.startsWith("-")||!s.trim())return{type:"fatal"};n=s,r+=1;continue}if(i.startsWith(`${hLt}=`)){let s=i.slice(hLt.length+1);if(!s.trim())return{type:"fatal"};n=s;continue}t.push(i)}return{type:"success",args:t,candidate:n}}async function IDr(e,t=W5o){let n=$5o(e);if(n.type==="fatal")return{type:"fatal",message:G5o};if(n.candidate===void 0)return{type:"success",args:n.args};let r=n.candidate.trim(),i;if(r.startsWith("{"))i=r;else try{i=await t.readPath(V5o(process.cwd(),r))}catch{return{type:"fatal",message:gLt}}let s;try{s=JSON.parse(i)}catch{return{type:"fatal",message:gLt}}let o=Lde(s);return o?{type:"success",args:n.args,credentials:o}:{type:"fatal",message:gLt}}var hLt,G5o,gLt,W5o,wDr=C(()=>{"use strict";Fde();hLt="--augment-session-json",G5o="--augment-session-json requires a value",gLt="--augment-session-json value is unusable",W5o={readPath:e=>U5o(e,"utf8")}});import{execFile as Q5o}from"node:child_process";import{existsSync as H5o,rmSync as Y5o}from"node:fs";import{promisify as Z5o}from"node:util";function yLt(e){let t=e.match(/^git@github\.com:(.+?)(?:\.git)?$/);if(t){let r=t[1];return{sshUrl:`git@github.com:${r}.git`,httpsUrl:`https://github.com/${r}.git`}}let n=e.match(/^https?:\/\/github\.com\/(.+?)(?:\.git)?$/);if(n){let r=n[1];return{sshUrl:`git@github.com:${r}.git`,httpsUrl:`https://github.com/${r}.git`}}return{sshUrl:e,httpsUrl:e}}function ODr(e){return e instanceof Error?e.message:String(e)}async function ALt({sshUrl:e,httpsUrl:t,targetDir:n,extraArgs:r=[]}){let i,s=e===t?[{url:e,env:e.startsWith("http")?bLt:RDr}]:[{url:e,env:RDr},{url:t,env:bLt}];for(let o of s)try{return await kDr("git",["clone","--depth","1",...r,o.url,n],{env:o.env}),{success:!0}}catch(a){i=a,H5o(n)&&Y5o(n,{recursive:!0,force:!0})}return{success:!1,error:ODr(i)}}function NDr(e,t){return kDr("git",e,{cwd:t,env:bLt})}async function MDr(e,t){try{return await NDr(["fetch","--depth","1","origin",t],e),await NDr(["checkout","FETCH_HEAD"],e),{success:!0}}catch(n){return{success:!1,error:ODr(n)}}}var kDr,RDr,bLt,PDr=C(()=>{"use strict";kDr=Z5o(Q5o),RDr={...process.env,GIT_TERMINAL_PROMPT:"0",GIT_SSH_COMMAND:"ssh -o BatchMode=yes"},bLt={...process.env,GIT_TERMINAL_PROMPT:"0"}});import{readFileSync as j5o}from"node:fs";import{join as ELt}from"node:path";function y9(e){let t=z5o(e,DDr);return t.manifest||t.diagnostics.length>0?t:{diagnostics:[`no marketplace manifest found (looked for ${DDr.join(", ")})`]}}function z5o(e,t){let n=[];for(let r of t){let i=ELt(e,r),s;try{s=j5o(i,"utf-8")}catch{continue}try{let o=JSON.parse(s);if(o&&typeof o=="object"&&!Array.isArray(o))return{manifest:o,manifestPath:i,diagnostics:n};n.push(`manifest at ${r} is not a JSON object; ignoring`)}catch(o){n.push(`failed to parse manifest at ${r}: ${o.message}`)}}return{diagnostics:n}}var DDr,dGe=C(()=>{"use strict";DDr=[ELt(".augment-plugin","marketplace.json"),ELt(".claude-plugin","marketplace.json")]});import{execFile as X5o}from"node:child_process";import{existsSync as Ow,mkdirSync as LDr,readdirSync as q5o,renameSync as K5o,rmSync as J5o,statSync as eUo}from"node:fs";import{dirname as tUo,isAbsolute as FDr,join as Mw,relative as UDr,resolve as _Lt}from"node:path";import{promisify as nUo}from"node:util";function WDr(e){let t=e.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!t||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(t)?null:t}function BDr(e){let t=e.replace(/\.\./g,"").replace(/[/\\]/g,"").replace(/^\.+/,"").trim();return!t||!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(t)?null:t}function rUo(e){let t=e.trim();if(!t)return null;let n=t.match(/^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+?)(?:@(.+))?$/);if(n?.[1]&&n[2]){let r=n[1],i=n[2].replace(/\.git$/,"");return{repo:i,cloneUrl:`https://github.com/${r}/${i}`,...n[3]?{ref:n[3]}:{}}}if(/^(https?|ssh|file):\/\/|^git@/.test(t)){let[r,i]=t.split("#");if(!r)return null;let s=r.replace(/\/+$/,""),o=s.split(/[/:]/).pop()?.replace(/\.git$/,"");if(o)return{repo:o,cloneUrl:s,...i?{ref:i}:{}}}return null}function Pw(e){return typeof e=="string"&&e.length>0?e:void 0}function iUo(e,t){let n=Pw(e.repo);return n?{kind:"github",url:`https://github.com/${n.replace(/\.git$/,"")}.git`,...t?{ref:t}:{},...Pw(e.path)?{subdir:Pw(e.path)}:{}}:null}function sUo(e,t){let n=Pw(e.url);return n?{kind:"url",url:n,...t?{ref:t}:{},...Pw(e.path)?{subdir:Pw(e.path)}:{}}:null}function oUo(e,t){let n=Pw(e.url),r=Pw(e.path);return n&&r?{kind:"git-subdir",url:n,subdir:r,...t?{ref:t}:{}}:null}function SLt(e){if(!e||typeof e!="object")return null;let t=e,n=Pw(t.sha)??Pw(t.ref);switch(t.source){case"github":return iUo(t,n);case"url":return sUo(t,n);case"git-subdir":return oUo(t,n);default:return null}}function $Dr(e,t,n){let r=WDr(t);if(!r)return;let i=Mw(e,GDr,r);if(!Ow(Mw(i,".git")))return;if(!n)return i;let s=_Lt(i,n),o=UDr(i,s);if(!(o.startsWith("..")||FDr(o)))return Ow(s)?s:void 0}async function aUo(e,t){let n=typeof t.name=="string"?t.name:"",r=SLt(t.source);if(!r)return;let i=WDr(n);if(!i)return{name:n,status:"failed",error:"invalid plugin cache name"};let s=Mw(e,GDr,i);if(Ow(Mw(s,".git")))return{name:n,status:"skipped"};let o=tUo(s);Ow(o)||LDr(o,{recursive:!0});let{sshUrl:a,httpsUrl:l}=yLt(r.url),u=r.kind==="git-subdir",c=await ALt({sshUrl:a,httpsUrl:l,targetDir:s,extraArgs:u?["--filter=blob:none","--sparse"]:[]});if(!c.success)return{name:n,status:"failed",error:c.error};if(r.ref){let d=await MDr(s,r.ref);if(!d.success)return{name:n,status:"failed",error:d.error}}if(u&&r.kind==="git-subdir")try{await VDr("git",["sparse-checkout","set",r.subdir],{cwd:s,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}catch(d){return{name:n,status:"failed",error:d instanceof Error?d.message:String(d)}}return{name:n,status:"cloned"}}async function vLt(e){let{manifest:t}=y9(e),n=t?.plugins;if(!n||n.length===0)return[];let r=[];for(let i of n){let s=await aUo(e,i);s&&r.push(s)}return r}function lUo(e){try{return eUo(e).isDirectory()}catch{return!1}}function cUo(e,t){let n=UDr(_Lt(e),_Lt(t));return n!==""&&!n.startsWith("..")&&!FDr(n)}async function kK(e,t){let n=rUo(t);if(!n)return{success:!1,error:`Invalid repository: ${t}. Expected owner/repo, a Git URL (HTTPS/SSH/file), or a github.com URL.`};let{repo:r,ref:i,cloneUrl:s}=n;Ow(e)||LDr(e,{recursive:!0});let o=BDr(r);if(!o)return{success:!1,error:`Invalid repository name for marketplace directory: "${r}".`};let a=Mw(e,o);if(Ow(a))return{success:!1,alreadyInstalled:!0,marketplaceId:o,error:`Marketplace '${o}' is already installed.`};let{sshUrl:l,httpsUrl:u}=yLt(s),c=await ALt({sshUrl:l,httpsUrl:u,targetDir:a,extraArgs:i?["--branch",i]:[]});if(!c.success)return{success:!1,error:`Failed to clone '${s}': ${c.error}`};let{manifest:d}=y9(a),p=o,m=typeof d?.name=="string"?BDr(d.name):null;if(m&&m!==o){let f=Mw(e,m);if(!Ow(f))try{K5o(a,f),p=m}catch{}}return await vLt(Mw(e,p)),{success:!0,marketplaceId:p}}function OK(e,t){let n=Mw(e,t);if(!cUo(e,n))return{success:!1,error:`Refusing to remove '${t}': path is outside the marketplaces directory.`};if(!Ow(n))return{success:!1,error:`Marketplace '${t}' not found.`};try{return J5o(n,{recursive:!0,force:!0}),{success:!0}}catch(r){return{success:!1,error:`Failed to remove '${t}': ${r instanceof Error?r.message:String(r)}`}}}async function QDr(e){if(!Ow(Mw(e,".git")))return{success:!1,notGitRepo:!0,error:"Not a git repository"};try{return await VDr("git",["pull"],{cwd:e,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),await vLt(e),{success:!0}}catch(t){return{success:!1,error:t instanceof Error?t.message:String(t)}}}async function HDr(e){let t=!1;for(let n of e){if(!Ow(n))continue;let r;try{r=q5o(n)}catch{continue}for(let i of r){let s=Mw(n,i);if(!lUo(s))continue;(await vLt(s)).some(a=>a.status==="cloned")&&(t=!0)}}return t}var VDr,GDr,pGe=C(()=>{"use strict";PDr();dGe();VDr=nUo(X5o),GDr=".plugin-cache"});import{readFileSync as uUo}from"node:fs";import{join as dUo}from"node:path";function mGe(e){let t=dUo(e,"hooks","hooks.json"),n;try{n=uUo(t,"utf-8")}catch{return{diagnostics:[]}}let r;try{r=JSON.parse(n)}catch(s){return{diagnostics:[`failed to parse hooks/hooks.json: ${s.message}`]}}return!r||typeof r!="object"||Array.isArray(r)?{diagnostics:["hooks/hooks.json must be a JSON object"]}:{config:tw(r),diagnostics:[]}}var xLt=C(()=>{"use strict";o2()});import{existsSync as pUo,lstatSync as mUo,readdirSync as zDr,realpathSync as YDr,statSync as fUo}from"node:fs";import{basename as ZDr,isAbsolute as CLt,join as Vhe,relative as XDr,resolve as TLt}from"node:path";function ILt(e,t){let n=[],r=[],i=[],s=new Map;for(let o of new Set(e))for(let a of hUo(o,t,r)){let l=s.get(a.id);if(l!==void 0){i.push({id:a.id,shadowedRoot:o,winnerRoot:l});continue}s.set(a.id,o),n.push(a)}for(let[o,a]of Object.entries(t))a&&!s.has(o)&&r.push(`enabledPlugins["${o}"] = true but no plugin with that id was found in any marketplace root`);return{plugins:n,globalDiagnostics:r,shadowedPlugins:i}}function hUo(e,t,n){let r=[];if(!pUo(e))return r;let i=y9(e);if(!i.manifest)for(let o of i.diagnostics)o.startsWith("no marketplace manifest found")||n.push(`[${ZDr(e)}] ${o}`);if(i.manifest)return jDr(e,ZDr(e),t,r,n),r;let s;try{s=zDr(e)}catch(o){return n.push(`failed to read marketplaces directory ${e}: ${o.message}`),r}for(let o of s){let a=Vhe(e,o);Ghe(a)&&jDr(a,o,t,r,n)}return r}function jDr(e,t,n,r,i){let s=y9(e);if(!s.manifest){for(let u of s.diagnostics)i.push(`[${t}] ${u}`);return}let o=SUo(s.manifest.name,t),a=_Uo(e,s.manifest.metadata?.pluginRoot),l=Array.isArray(s.manifest.plugins)?s.manifest.plugins:[];l.length===0&&i.push(`[${o}] marketplace.json has no plugins[] entries`);for(let u of l){let c=gUo(u,e,a,o,n);c&&r.push(c)}for(let u of s.diagnostics)i.push(`[${o}] ${u}`)}function gUo(e,t,n,r,i){let s=typeof e.name=="string"?A9(e.name):void 0;if(!s)return;let o=`${s}@${r}`,a=i[o]===!0,l=[],u=EUo(e.source,s,t,n,l);return u?yUo(o,r,s,u,a,l,t):{id:o,marketplace:r,name:s,enabled:a,commandsDir:void 0,skillsDir:void 0,hooksConfig:void 0,agentsDirPresent:!1,diagnostics:l}}function bUo(e,t){let n=[],r;try{r=zDr(e).sort()}catch(s){return t.push(`failed to read agents directory: ${s.message}`),n}let i=[];for(let s of r){if(!s.endsWith(".md"))continue;let o=Vhe(e,s);try{if(!mUo(o).isFile()){i.push(s);continue}}catch(a){t.push(`failed to stat agent file ${s}: ${a.message}`);continue}n.push(o)}return i.length>0&&t.push(`ignoring non-regular agent file(s) under agents/ (symlinks / dirs / devices are not followed): ${i.join(", ")}`),n}function yUo(e,t,n,r,i,s,o){let a=Vhe(r,"commands"),l=Vhe(r,"skills"),u=Vhe(r,"agents"),c=vUo(a,r,s),d=Ghe(l)?l:void 0,p=Ghe(u),m=p&&i?bUo(u,s):void 0,f=mGe(r);for(let h of f.diagnostics)s.push(h);return{id:e,marketplace:t,name:n,root:r,marketplacePath:TLt(o),enabled:i,commandsDir:c,skillsDir:d,hooksConfig:f.config,agentsDirPresent:p,agentFiles:m,diagnostics:s}}function AUo(e,t,n,r){let i=SLt(e);if(!i){let o=e.source;r.push(`source kind "${typeof o=="string"?o:"object"}" is not supported; install the plugin manually as a relative directory`);return}let s=$Dr(n,t,i.subdir);if(s)return s;r.push(`source kind "${i.kind}" not fetched yet; run /plugins to clone it (or marketplace update)`)}function EUo(e,t,n,r,i){if(typeof e!="string"){if(e&&typeof e=="object")return AUo(e,t,n,i);i.push("plugin entry has no source field; skipping");return}if(CLt(e)){i.push(`absolute source "${e}" is not allowed; skipping`);return}let s=e.startsWith("./")?n:r,o=TLt(s,e),a=XDr(n,o);if(a.startsWith("..")||CLt(a)){i.push(`source "${e}" resolves outside the marketplace root; skipping`);return}if(!Ghe(o)){i.push(`source "${e}" does not point to an existing directory (looked at ${o})`);return}return o}function _Uo(e,t){return typeof t!="string"||t.length===0?e:TLt(e,t)}function SUo(e,t){if(typeof e=="string"&&e.length>0){let n=A9(e);if(n.length>0)return n}return t}function A9(e){let t="";for(let n of e){let r=n.codePointAt(0);if(r===void 0)continue;let i=r<=31,s=r>=127&&r<=159;i||s||(t+=n)}return t}function vUo(e,t,n){if(Ghe(e))try{let r=XDr(YDr(t),YDr(e));if(r===".."||r.startsWith("../")||r.startsWith("..\\")||CLt(r)){n.push("commands/ directory resolves outside the plugin root");return}return e}catch{n.push("commands/ directory could not be resolved");return}}function Ghe(e){try{return fUo(e).isDirectory()}catch{return!1}}var Whe=C(()=>{"use strict";pGe();xLt();dGe()});import{readFileSync as xUo}from"node:fs";import{basename as CUo}from"node:path";function Vx(e,t,n=!0){if(e!==void 0){if(typeof e!="string")throw new Gx(`Invalid ${t}: expected a string.`);return n?e.trim():e}}function W2(e,t){if(e!==void 0){if(typeof e!="boolean")throw new Gx(`Invalid ${t}: expected a boolean.`);return e}}function qDr(e){return A9(e.trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9_-]/g,"-").replace(/-+/g,"-"))}function fGe(e,t){if(typeof e=="string")return e.trim()==="none"?[]:[...new Set(e.split(",").map(n=>n.trim()).filter(Boolean))];if(!Array.isArray(e)||e.some(n=>typeof n!="string"||!n.trim()))throw new Gx(`Invalid ${t}: expected named strings as a list or CSV.`);return[...new Set(e.map(n=>n.trim()))]}function wUo(e){if(e===void 0)return!0;if(typeof e=="boolean")throw new Gx("Boolean skills is unsupported. Use disable_skills: true for opt-out; omit skills for defaults.");let t=fGe(e,"skills");return t.length?t:!1}function RUo(e){switch(e){case"red":case"blue":case"green":case"yellow":case"orange":case"purple":case"pink":case"cyan":return e;default:return}}function wLt(e,t,n){return{name:e,pluginId:t,source:"plugin",description:e,enabled:!1,invalidDefinition:!0,diagnostics:[n],builtinToolNames:[],disallowedTools:[],extensions:!1,skills:!1,systemPrompt:"",promptMode:"append"}}function NUo(e){if(typeof e=="string")return IUo.includes(e)?e:void 0}function kUo(e){return typeof e=="number"&&e>=0?e:void 0}function OUo(e){if(e==="user"||e==="project"||e==="local")return e}function MUo(e){if(e==null||e===!0)return!0;if(e===!1||e==="none")return!1;let t=fGe(e,"extensions");return t.length>0?t:!1}function PUo(e,t){let n=CUo(e,".md"),r=qDr(n),i;try{i=xUo(e,"utf-8")}catch{return wLt(r,t,"Custom-agent file could not be read.")}try{let{frontmatter:s,body:o}=fx(i);if(!s||typeof s!="object"||Array.isArray(s))throw new Gx("Invalid frontmatter mapping.");if(r=qDr(Vx(s.name,"name")||n),!r)throw new Gx("Invalid name: a non-empty identity is required.");for(let[a,l]of Object.entries({disallowed_tools:"Use disabled_tools instead.",prompt_mode:"Use replace_system_prompt: false for append or true for replace.",inherit_skills:"Use disable_skills for opt-out or skills for named selection."}))if(Object.hasOwn(s,a))throw new Gx(`Removed frontmatter field ${a}. ${l}`);return BUo({fm:s,body:o,name:r,pluginId:t})}catch(s){return wLt(r,t,s instanceof Gx?s.message:"Invalid custom-agent definition.")}}function DUo(e){let t=Vx(e.thinking,"thinking"),n=NUo(t),r=RUo(e.color),i=[];return e.color!==void 0&&!r&&i.push("Invalid color: expected a supported terminal label color."),t!==void 0&&n===void 0&&i.push("Invalid thinking: expected a supported thinking level. Model default retained."),{color:r,thinking:n,diagnostics:i.length?i:void 0}}function BUo({fm:e,body:t,name:n,pluginId:r}){let i=W2(e.replace_system_prompt,"replace_system_prompt")??!1;if(i&&!t.trim())throw new Gx("replace_system_prompt requires a non-empty Markdown body.");let s=W2(e.disable_skills,"disable_skills")??!1,o=wUo(e.skills);return{name:n,displayName:Vx(e.display_name,"display_name")||n,description:Vx(e.description,"description")||n,...DUo(e),toolDescription:Vx(e.tool_description,"tool_description")||void 0,instructionDescription:Vx(e.instruction_description,"instruction_description")||void 0,providerModel:Vx(e.provider_model,"provider_model",!1),providerApiKey:Vx(e.provider_api_key,"provider_api_key",!1),providerBaseUrl:Vx(e.provider_base_url,"provider_base_url",!1),builtinToolNames:e.tools===void 0?[...TUo]:fGe(e.tools,"tools"),disallowedTools:e.disabled_tools===void 0?void 0:fGe(e.disabled_tools,"disabled_tools"),extensions:MUo(e.extensions??e.inherit_extensions),skills:s?!1:o,disableSkills:s,disableRules:W2(e.disable_rules,"disable_rules")??!1,disableWorkspaceGuidelines:W2(e.disable_workspace_guidelines,"disable_workspace_guidelines")??!1,model:Vx(e.model,"model"),maxTurns:kUo(e.max_turns),systemPrompt:t.trim(),replaceSystemPrompt:i,promptMode:i?"replace":"append",inheritContext:W2(e.inherit_context,"inherit_context"),runInBackground:W2(e.run_in_background,"run_in_background"),isolated:W2(e.isolated,"isolated"),memory:OUo(e.memory),isolation:e.isolation==="worktree"?"worktree":void 0,enabled:W2(e.enabled,"enabled")??!0,hidden:W2(e.hidden,"hidden")??!1,finishTool:Vx(e.finish_tool,"finish_tool"),source:"plugin",pluginId:r}}function JDr(e){let t=new Map,n=[];if(!e.agentFiles||e.agentFiles.length===0)return{agents:t,diagnostics:n};let r=new Map;for(let i of e.agentFiles){let s=PUo(i,e.id);n.push(...s.diagnostics??[]);let o=s.name.toLowerCase();if(r.has(o)){let a=r.get(o)??s.name,l="Duplicate agent identity in the same directory.";n.push(l),t.set(a,wLt(a,e.id,l));continue}t.set(s.name,s),r.set(o,s.name)}return{agents:t,diagnostics:n}}var TUo,IUo,KDr,Gx,eBr=C(()=>{"use strict";Cs();Whe();TUo=["read","bash","edit","write","grep","find","ls"],IUo=["off","minimal","low","medium","high","xhigh"],KDr=["general-purpose","explore","plan"],Gx=class extends Error{}});import{lstatSync as LUo,readFileSync as FUo,realpathSync as tBr}from"node:fs";import{isAbsolute as UUo,join as VUo,relative as GUo}from"node:path";function MK(e,t){let n=e;for(let r of WUo){let i=`\${${r}}`;n.includes(i)&&(n=n.split(i).join(t))}return n}function RLt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function nBr(e){if(!e)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=String(r));return Object.keys(t).length>0?t:void 0}function $Uo(e){if(e.type==="stdio"||e.type==="http"||e.type==="sse")return e.type;if(e.url)return"http";if(e.command)return"stdio"}function QUo(e,t){let n=$Uo(t);if(!n)throw new Error(`MCP server "${e}" must declare a 'command' (stdio) or 'url' (http/sse) property`);if(n==="http"||n==="sse"){if(!t.url)throw new Error(`MCP server "${e}" has type "${n}" but no 'url' property`);let a=typeof t.clientId=="string"?t.clientId.trim():void 0;return{type:n,name:e,disabled:t.disabled,url:t.url,headers:nBr(t.headers),auth:t.auth==="oauth"?"oauth":void 0,...a?{clientId:a}:{},cwd:t.cwd,timeoutMs:t.timeoutMs}}let r=t.command;if(!r)throw new Error(`MCP server "${e}" has type "stdio" but no 'command' property`);let i=Array.isArray(t.args)?t.args.map(a=>String(a)):[],s=t.useShellInterpolation??!0,o=s&&i.length>0?`${r} ${i.join(" ")}`:r;return{type:"stdio",name:e,disabled:t.disabled,command:o,args:s?[]:i,env:nBr(t.env),cwd:t.cwd,timeoutMs:t.timeoutMs,useShellInterpolation:s}}function rBr(e,t){if(!e)return;let n={};for(let[r,i]of Object.entries(e))n[r]=MK(i,t);return n}function HUo(e,t){return e.type==="stdio"?{...e,command:MK(e.command,t),args:e.args.map(n=>MK(n,t)),env:rBr(e.env,t),cwd:e.cwd?MK(e.cwd,t):void 0}:{...e,url:MK(e.url,t),headers:rBr(e.headers,t),cwd:e.cwd?MK(e.cwd,t):void 0}}function YUo(e,t){let n=VUo(e,".mcp.json"),r;try{r=LUo(n)}catch(i){if(i?.code==="ENOENT")return;t.push(`failed to stat .mcp.json: ${i.message}`);return}if(r.isSymbolicLink()){t.push(".mcp.json is a symlink; refusing to follow it out of the plugin root");return}if(!r.isFile()){t.push(".mcp.json is not a regular file; skipping");return}try{let i=tBr(e),s=tBr(n),o=GUo(i,s);if(o.startsWith("..")||UUo(o)){t.push(".mcp.json resolves outside the plugin root; skipping");return}}catch(i){t.push(`failed to resolve .mcp.json real path: ${i.message}`);return}try{return FUo(n,"utf-8")}catch(i){t.push(`failed to read .mcp.json: ${i.message}`);return}}function hGe(e){let t=[];if(!e.root)return{servers:[],diagnostics:t};let n=YUo(e.root,t);if(n===void 0)return{servers:[],diagnostics:t};let r;try{r=JSON.parse(n)}catch(o){return t.push(`failed to parse .mcp.json: ${o.message}`),{servers:[],diagnostics:t}}if(!RLt(r))return t.push(".mcp.json must be a JSON object"),{servers:[],diagnostics:t};let i=r.mcpServers;if(!RLt(i))return t.push('.mcp.json must contain an "mcpServers" object'),{servers:[],diagnostics:t};let s=[];for(let[o,a]of Object.entries(i)){let l=`${e.id}/${A9(o)}`;if(!RLt(a)){t.push(`MCP server "${l}" must be a JSON object`);continue}try{let u=QUo(l,a);s.push(HUo(u,e.root))}catch(u){t.push(u instanceof Error?u.message:String(u))}}return{servers:s,diagnostics:t}}var WUo,iBr,NLt=C(()=>{"use strict";Whe();WUo=["CLAUDE_PLUGIN_ROOT","AUGMENT_PLUGIN_ROOT","AUGGIE_PLUGIN_ROOT"];iBr="hermes:mcp:register-server-source"});function sBr(e,t,n){let r=gi.create(e,t,n),i={};for(let o of[r.getVfsOrgSettings(),r.getVfsSpaceSettings(),r.getVfsUserSettings(),r.getSettings()])for(let[a,l]of Object.entries(o.enabledPlugins??{}))typeof l=="boolean"&&(i[a]=l);let s=r.drainErrors().map(({scope:o,error:a})=>`failed to load ${o} settings: ${a.message}; enabledPlugins entries from this scope will be ignored`);return{enabled:i,diagnostics:s}}var oBr=C(()=>{"use strict";Cs()});var aBr,lBr=C(()=>{"use strict";aBr="hermes:subagents:register-agent-source"});import{lstatSync as ZUo,readdirSync as jUo,readFileSync as kLt}from"node:fs";import{basename as zUo,dirname as XUo,extname as qUo,isAbsolute as KUo,join as Wx,parse as JUo,relative as PK,resolve as $he,sep as OLt}from"node:path";function gGe(e){return typeof e=="string"&&bGe(e)||void 0}function cBr(e,t){let n=PK(e,t);return!KUo(n)&&n!==".."&&!n.startsWith(`..${OLt}`)}function e3o(e,t,n){let r=n?$he(n):JUo(e).root;if(!cBr(r,e)||!cBr(e,t))throw new Error("Plugin metadata path is outside the plugin root");let i=r,s;for(let o of["",...PK(r,t).split(OLt).filter(Boolean)]){i=Wx(i,o);try{s=ZUo(i)}catch(a){if(a.code==="ENOENT")return;throw a}if(s.isSymbolicLink())throw new Error("Plugin metadata path contains a symbolic link")}return s}function DK(e){let t={agents:[],commands:[],rules:[],mcpServers:[],hooks:[],skills:[],diagnostics:[]};if(!e.root)return t.diagnostics.push("Plugin source is unavailable"),t;let n=$he(e.root),r=d=>e3o(n,d,e.marketplacePath),i=sX(),s=d=>{let p=`Could not read plugin ${d} metadata`;t.diagnostics.includes(p)||t.diagnostics.push(p)};try{if(!r(n)?.isDirectory())throw new Error("Plugin root is unavailable")}catch{return s("contents"),t}let o=(d,p,m,f)=>{let h={name:bGe(p)};try{if(!r(d)?.isFile())throw new Error("Plugin metadata file is unavailable");let{frontmatter:g}=fx(kLt(d,"utf8"));if(!g||typeof g!="object"||Array.isArray(g))throw new Error("Invalid plugin frontmatter");f&&(h.name=gGe(g.name)??h.name),h.description=gGe(g.description)}catch{s(m)}return h},a=(d,p,m)=>{let f=qUo(p);if(!(f===".md"||(d==="commands"||d==="rules")&&f===".txt")||d==="skills"&&XUo(p)!==m)return;let g=PK(m,p),b=d==="rules"?g:g.slice(0,-f.length).split(OLt).join(":");t[d].push(o(p,b,d,d==="agents"||d==="skills"))},l=(d,p,m)=>{try{let f=r(p);if(d==="skills"&&iL(i,PK(m,p),f?.isDirectory()))return;f?.isDirectory()?d!=="agents"&&c(d,p,m):f?.isFile()&&a(d,p,m)}catch{s(d)}},u=(d,p)=>{for(let m of iX){let f=Wx(d,m);try{let h=r(f);if(!h)continue;if(!h.isFile())throw new Error("Invalid skill ignore file");oX(i,kLt(f,"utf8"),PK(p,d))}catch{s("skills")}}},c=(d,p,m=p)=>{try{let f=r(p);if(!f)return;if(!f.isDirectory())throw new Error("Plugin metadata directory is invalid");if(d==="skills"){u(p,m);let h=Wx(p,"SKILL.md");if(!iL(i,PK(m,h))&&r(h)?.isFile()){t.skills.push(o(h,zUo(p),d,!0));return}}for(let h of jUo(p).sort())(d==="commands"||d==="skills")&&rL(h)||l(d,Wx(p,h),m)}catch{s(d)}};return c("agents",Wx(n,"agents")),c("commands",$he(e.commandsDir??Wx(n,"commands"))),c("rules",Wx(n,"rules")),c("skills",$he(e.skillsDir??Wx(n,"skills"))),t.hooks=r3o(n,r,s),t.mcpServers=i3o(e,r,s),Object.assign(t,n3o(n,r,s)),t}function t3o(e){let t={};for(let s of["description","version","homepage"]){let o=gGe(e[s]);o&&(t[s]=o)}let n=e.author,r=n&&typeof n=="object"&&!Array.isArray(n)?n.name:n,i=gGe(r);return i&&(t.author=i),t}function n3o(e,t,n){for(let r of[".augment-plugin",".claude-plugin"])try{let i=Wx(e,r,"plugin.json"),s=t(i);if(!s)continue;if(!s.isFile())throw new Error("Invalid plugin manifest file");let o=JSON.parse(kLt(i,"utf8"));if(!o||typeof o!="object"||Array.isArray(o))throw new Error("Invalid plugin manifest");return t3o(o)}catch{n("manifest")}return{}}function r3o(e,t,n){let r=[];try{let i=t(Wx(e,"hooks","hooks.json"));if(i){if(!i.isFile())throw new Error("Invalid plugin hooks file");let{config:s,diagnostics:o}=mGe(e);(!s||o.length)&&n("hook");for(let[a,l]of Object.entries(s??{}).sort(([u],[c])=>u.localeCompare(c)))for(let u of l??[])r.push({name:bGe(`${a}[${u.matcher??".*"}]`),description:"Command hook"})}}catch{n("hook")}return r}function i3o(e,t,n){if(!e.root)return[];let r=$he(e.root);try{let i=t(Wx(r,".mcp.json"));if(i){if(!i.isFile())throw new Error("Invalid plugin MCP file");let{servers:s,diagnostics:o}=hGe(e);return o.length&&n("MCP server"),s.map(a=>({name:bGe(a.name.slice(e.id.length+1)),description:`${a.type==="stdio"?"stdio":a.type.toUpperCase()} server`})).sort((a,l)=>a.name.localeCompare(l.name))}}catch{n("MCP server")}return[]}var bGe,uBr=C(()=>{"use strict";Cs();Whe();xLt();NLt();bGe=e=>A9(e.replace(/\s+/g," ")).trim()});var Hhe={};li(Hhe,{addMarketplace:()=>kK,default:()=>EGe,getDiscoveredMarketplaces:()=>Qhe,getDiscoveredPlugins:()=>$x,getInteractivePluginDiagnostics:()=>h3o,getPluginDetails:()=>DK,getPluginDiagnostics:()=>Qx,getV2MarketplacesRoot:()=>LK,removeMarketplace:()=>OK,updateMarketplace:()=>QDr});import{join as n6,resolve as s3o}from"node:path";import{existsSync as o3o,readdirSync as a3o,statSync as l3o}from"node:fs";function u3o(){return globalThis[dBr]??{}}function d3o(e){globalThis[dBr]=e}function EGe(e){f1=[],AGe=[],yGe=[],MLt=[],BK=[];let t=!1,n,r=new Map,i,s,o=new Map,a;e.events.on(nFe,w=>{n=w.register}),e.events.on(aBr,w=>{i=w.register}),e.events.on(iBr,w=>{a=w.registerServerSource}),e.events.on(c3o,w=>{d3o(w?.scopes??{})});function l(w,T,P=[]){let O=u3o(),{enabled:D,diagnostics:k}=sBr(w,T,O),M=[...new Set(P.map(ne=>s3o(w,ne)))],L=ILt(M,{}),F={...D};for(let ne of L.plugins)F[ne.id]=!0;let H=n6(wA(),"plugins","marketplaces"),U=n6(T,"plugins","marketplaces"),J=[O.user,O.space,O.org].flatMap(ne=>ne?[n6(ne,".augment","plugins","marketplaces")]:[]),ie=ILt([...M,H,U,...J],F);for(let ne of ie.shadowedPlugins)gE.debug(`plugin "${ne.id}" from ${ne.shadowedRoot} is shadowed by the higher-precedence root ${ne.winnerRoot}`);return ie.globalDiagnostics=[...k,...ie.globalDiagnostics],f1=ie.plugins,AGe=ie.globalDiagnostics,t=!0,ie}function u(w,T,P=[]){t||l(w,T,P)}function c(){let w=new Map,T=new Map;yGe=[];let P=[...f1.filter(O=>O.enabled)].sort((O,D)=>O.id.localeCompare(D.id));for(let O of P){let{agents:D,diagnostics:k}=JDr(O);for(let M of k)gE.warn(`[${O.id}] ${M}`),yGe.push({type:"warning",message:`[${O.id}] ${M}`,path:O.root});for(let[M,L]of D)d(O.id,M,L,w,T)}o=w}function d(w,T,P,O,D){let k=T.toLowerCase(),M=D.get(k);if(M){let L=M.name===T?`"${T}"`:`"${T}" (case-insensitive collision with "${M.name}")`;gE.warn(`[${w}] plugin-contributed agent ${L} shadowed by earlier plugin ${M.pluginId}; ignoring`);return}KDr.includes(k)&&gE.warn(`[${w}] plugin-contributed agent "${T}" shadows the built-in default agent of the same name; the plugin's definition will be used for every Agent-tool invocation across this session`),O.set(T,P),D.set(k,{pluginId:w,name:T})}function p(){if(!i)return;s?.(),s=i({getAgents:()=>o,getDiagnostics:()=>yGe})}function m(){let w=[];BK=[];let T=[...f1.filter(P=>P.enabled)].sort((P,O)=>P.id.localeCompare(O.id));for(let P of T){let{servers:O,diagnostics:D}=hGe(P);for(let k of D)gE.warn(`[${P.id}] ${k}`),BK.push({type:"warning",message:`[${P.id}] ${k}`,path:P.root});for(let k of O)w.push(k)}MLt=w}function f(){if(!a)return;a({source:"plugin",getServers:()=>MLt,getDiagnostics:()=>BK})}function h(){if(n){for(let w of r.values())w();r.clear();for(let w of f1){if(!w.enabled)continue;let T=p3o(w);T&&r.set(w.id,n(T))}}}function g(){for(let w of r.values())w();r.clear()}function b(){let w=[],T=[];for(let P of f1){if(!P.enabled){for(let O of P.diagnostics)gE.debug(`[${P.id}] ${O}`);continue}P.root&&P.commandsDir&&T.push({path:P.commandsDir,commandNamespace:`${P.name}--${P.marketplace}`}),P.root&&P.skillsDir&&w.push(P.skillsDir);for(let O of P.diagnostics)gE.warn(`[${P.id}] ${O}`)}return{skillPaths:w,promptPaths:T}}e.on("resources_discover",(w,T)=>{t=!1;let P=l(w.cwd,w.agentDir,T.pluginDirs),{skillPaths:O,promptPaths:D}=b();for(let M of P.globalDiagnostics)gE.warn(M);let k=f1.filter(M=>M.enabled).length;return f1.length>0&&gE.info(`Discovered ${f1.length} plugin(s); ${k} enabled`),h(),c(),p(),x(),m(),f(),v(),{skillPaths:O,promptPaths:D}}),e.on("session_start",(w,T)=>{u(T.cwd,T.agentDir,T.pluginDirs),h(),c(),p(),_(),m(),f();let P=n6(wA(),"plugins","marketplaces"),O=n6(T.agentDir,"plugins","marketplaces");HDr([P,O]).then(D=>{D&&(t=!1,l(T.cwd,T.agentDir,T.pluginDirs),h(),c(),p(),m(),f())}).catch(D=>{gE.debug(`background plugin source fetch failed: ${D instanceof Error?D.message:String(D)}`)})}),e.on("session_shutdown",()=>{g(),s?.(),s=void 0,o=new Map});let A=!1,y=!1,S=!1;function _(){!n&&!A&&(A=!0,gE.warn("@hermes/hooks did not register a hook listener; plugin hooks will not run. This usually means @hermes/hooks was removed from the built-in extension list."))}function x(){!i&&!y&&(y=!0,gE.debug("@hermes/subagents did not register an agent source; plugin-contributed subagents will not be available (expected when --disable-subagents is set)."))}function v(){!a&&!S&&(S=!0,gE.debug("@hermes/mcp did not register a server source; plugin-contributed MCP servers will not be loaded."))}}function p3o(e){if(e.root)return{source:e.id,isEnabled:()=>e.enabled,getConfig:()=>e.hooksConfig,env:m3o(e.root),postToolUsePrefix:`Plugin ${e.id} hook`,hookLabel:t=>`[${e.id}] ${t} hook`,blockedFallbackReason:"Blocked by plugin hook"}}function m3o(e){return{PLUGIN_ROOT:e,CLAUDE_PLUGIN_ROOT:e,AUGMENT_PLUGIN_ROOT:e,AUGGIE_PLUGIN_ROOT:e}}function $x(){return f1}function LK(e){return n6(e,"plugins","marketplaces")}function Qhe(e){let t=LK(e);if(!o3o(t))return[];let n;try{n=a3o(t)}catch{return[]}let r=[];for(let i of n){let s=n6(t,i);try{if(!l3o(s).isDirectory())continue}catch{continue}let{manifest:o}=y9(s);if(!o)continue;let a=typeof o.name=="string"&&o.name.length>0?o.name:i;r.push({dir:i,name:a,path:s})}return r}function Qx(){let e=[];for(let t of f1)for(let n of t.diagnostics)e.push({type:"warning",message:`[${t.id}] ${n}`,path:t.root});for(let t of AGe)e.push({type:"warning",message:t});for(let t of BK)e.push(t);return e}function h3o(){let e=[],t=new Set,n=0;for(let r of f1){let i=!1;for(let s of r.diagnostics){let o=r.enabled?null:f3o.exec(s);if(o?.[1]){t.add(o[1]),i=!0;continue}e.push({type:"warning",message:`[${r.id}] ${s}`,path:r.root})}i&&n++}if(n>0){let r=[...t].sort().join(", "),i=n===1?"plugin":"plugins";e.push({type:"warning",message:`${n} disabled ${i} use unsupported source kinds (${r}); enable one to see details, or re-run with --check-startup`})}for(let r of AGe)e.push({type:"warning",message:r});for(let r of BK)e.push(r);return e}var gE,c3o,dBr,f1,AGe,yGe,MLt,BK,f3o,Dw=C(()=>{"use strict";Cs();o2();en();eBr();Whe();pGe();dGe();NLt();oBr();lBr();uBr();pGe();gE=tt.child({prefix:"pi-plugins"}),c3o="augment:vfs-scopes",dBr=Symbol.for("__pi_plugins_vfs_scopes__");f1=[],AGe=[],yGe=[],MLt=[],BK=[];f3o=/^source kind "([^"]+)" (?:is not supported; install the plugin manually as a relative directory|not fetched yet; run \/plugins to clone it \(or marketplace update\))$/});function g3o(e){return{...e,execute:(t,n,r,i,s)=>{let o=Vwe(e.name);if(!o)throw new Error(`Cloud tool "${e.name}" is unavailable`);return o.execute(t,n,r,i,s)}}}function PLt(e){for(let t of PCn())e.registerTool(g3o(t))}var pBr=C(()=>{"use strict";FY()});function SGe(){let e=globalThis;return e[mBr]??=new Map,e[mBr]}function _Ge(){let e=globalThis;return e[fBr]??=new Map,e[fBr]}function vGe(){return[...SGe().values()]}function xGe(e){return SGe().get(e)}function gBr(e){return _Ge().get(e)}function E9(e,t){SGe().set(e.name,e),t===void 0?_Ge().delete(e.name):_Ge().set(e.name,t)}function FK(e,t){let n=SGe();(t===void 0||n.get(e)===t)&&(n.delete(e),_Ge().delete(e))}function bBr(e){Reflect.set(e,hBr,!0)}function CGe(e){return Reflect.get(e,hBr)===!0}var mBr,fBr,hBr,$2=C(()=>{"use strict";mBr=Symbol.for("__hermes_mcp_tool_registry__"),fBr=Symbol.for("__hermes_mcp_tool_server_registry__"),hBr=Symbol.for("__hermes_mcp_extension_factory__")});function b3o(e){return{...e,execute:(t,n,r,i,s)=>{let o=xGe(e.name);if(!o)throw new Error(`MCP tool "${e.name}" is unavailable`);return o.execute(t,n,r,i,s)}}}function TGe(e){for(let t of vGe())e.registerTool(b3o(t))}var yBr=C(()=>{"use strict";$2()});import{existsSync as y3o}from"node:fs";import{homedir as Yhe}from"node:os";import{dirname as DLt,join as Hx,resolve as EBr}from"node:path";import{fileURLToPath as A3o}from"node:url";function _Br(){let e=process.env.PI_PACKAGE_DIR;if(e)return e==="~"?Yhe():e.startsWith("~/")?Yhe()+e.slice(1):e;let t=ABr;for(;t!==DLt(t);){if(y3o(Hx(t,"package.json")))return t;t=DLt(t)}return ABr}function IGe(){return EBr(Hx(_Br(),"docs"))}function wGe(){return EBr(Hx(_Br(),"CHANGELOG.md"))}function CBr(e){return e==="~"?Yhe():e.startsWith("~/")?Yhe()+e.slice(1):e}function Bw(){let e=process.env.AUGMENT_CACHE_DIR;return e?CBr(e):Hx(Yhe(),".augment")}function nr(){let e=process.env[BLt];return e?CBr(e):Bw()}function zhe(){return Hx(nr(),"themes")}function TBr(){return Hx(nr(),"models.json")}function IBr(){return Hx(nr(),"auth.json")}function wBr(){return Hx(nr(),"settings.json")}function _9(){return Bw()}function UK(){return Hx(nr(),"bin")}function RBr(){return Hx(nr(),Zhe)}function NBr(){return Hx(nr(),`${ei}-debug.log`)}var E3o,ABr,ei,Bs,Zhe,jhe,SBr,_3o,Ws,vBr,xBr,BLt,$s=C(()=>{"use strict";Bft();E3o=A3o(import.meta.url),ABr=DLt(E3o);ei=fD.piConfig?.name||"auggie",Bs=fD.piConfig?.configDir||".augment",Zhe="sessions-v2",jhe=ei,SBr="Auggie Coding Agent",_3o="1.2.0-prerelease.202611051212",Ws=_3o??fD.version,vBr="c2bb47092477fbb2052b9393a3ec40143ce1c6c1",xBr="2026-11-05T20:12:17Z",BLt=`${ei.toUpperCase()}_CODING_AGENT_DIR`});var OBr,kBr=C(()=>{OBr={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"ansi",vars:{red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,gray:8,brightMagenta:13},colors:{accent:"magenta",border:"gray",borderAccent:"magenta",borderMuted:"gray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"gray",text:"",thinkingText:"gray",selectedBg:"gray",userMessageBg:"",userMessageText:"",customMessageBg:"",customMessageText:"",customMessageLabel:"magenta",toolPendingBg:"",toolSuccessBg:"",toolErrorBg:"",toolTitle:"magenta",toolOutput:"gray",mdHeading:"magenta",mdLink:"magenta",mdLinkUrl:"gray",mdCode:"magenta",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"magenta",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"gray",syntaxKeyword:"blue",syntaxFunction:"yellow",syntaxVariable:"cyan",syntaxString:"green",syntaxNumber:"magenta",syntaxType:"cyan",syntaxOperator:"",syntaxPunctuation:"",thinkingOff:"gray",thinkingMinimal:"gray",thinkingLow:"blue",thinkingMedium:"cyan",thinkingHigh:"magenta",thinkingXhigh:"brightMagenta",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var Lw,MBr=C(()=>{Lw={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"dark",vars:{cyan:"#00d7ff",blue:"#5f87ff",green:"#b5bd68",red:"#cc6666",yellow:"#ffff00",gray:"#808080",dimGray:"#666666",darkGray:"#505050",accent:"#8abeb7",selectedBg:"#3a3a4a",userMsgBg:"#343541",toolPendingBg:"#282832",toolSuccessBg:"#283228",toolErrorBg:"#3c2828",customMsgBg:"#2d2838"},colors:{accent:"accent",border:"blue",borderAccent:"cyan",borderMuted:"darkGray",success:"green",error:"red",warning:"yellow",muted:"gray",dim:"dimGray",text:"",thinkingText:"gray",agentRed:"#CC6666",agentBlue:"#81A2BE",agentGreen:"#B5BD68",agentYellow:"#F0C674",agentOrange:"#CE9178",agentPurple:"#B294BB",agentPink:"#D183E8",agentCyan:"#8ABEB7",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#9575cd",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"#b294bb",toolOutput:"gray",mdHeading:"#f0c674",mdLink:"#81a2be",mdLinkUrl:"dimGray",mdCode:"accent",mdCodeBlock:"green",mdCodeBlockBorder:"gray",mdQuote:"gray",mdQuoteBorder:"gray",mdHr:"gray",mdListBullet:"accent",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"gray",syntaxComment:"#6A9955",syntaxKeyword:"#569CD6",syntaxFunction:"#DCDCAA",syntaxVariable:"#9CDCFE",syntaxString:"#CE9178",syntaxNumber:"#B5CEA8",syntaxType:"#4EC9B0",syntaxOperator:"#D4D4D4",syntaxPunctuation:"#D4D4D4",thinkingOff:"darkGray",thinkingMinimal:"#6e6e6e",thinkingLow:"#5f87af",thinkingMedium:"#81a2be",thinkingHigh:"#b294bb",thinkingXhigh:"#d183e8",bashMode:"green"},export:{pageBg:"#18181e",cardBg:"#1e1e24",infoBg:"#3c3728"}}});var DBr,PBr=C(()=>{DBr={$schema:"https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",name:"light",vars:{teal:"#5a8080",blue:"#547da7",green:"#588458",red:"#aa5555",yellow:"#9a7326",mediumGray:"#6c6c6c",dimGray:"#767676",lightGray:"#b0b0b0",selectedBg:"#d0d0e0",userMsgBg:"#e8e8e8",toolPendingBg:"#e8e8f0",toolSuccessBg:"#e8f0e8",toolErrorBg:"#f0e8e8",customMsgBg:"#ede7f6"},colors:{accent:"teal",border:"blue",borderAccent:"teal",borderMuted:"lightGray",success:"green",error:"red",warning:"yellow",muted:"mediumGray",dim:"dimGray",text:"",thinkingText:"mediumGray",agentRed:"#AA5555",agentBlue:"#476D94",agentGreen:"#477047",agentYellow:"#8A6822",agentOrange:"#795E26",agentPurple:"#875F87",agentPink:"#8B008B",agentCyan:"#4D7070",selectedBg:"selectedBg",userMessageBg:"userMsgBg",userMessageText:"",customMessageBg:"customMsgBg",customMessageText:"",customMessageLabel:"#7e57c2",toolPendingBg:"toolPendingBg",toolSuccessBg:"toolSuccessBg",toolErrorBg:"toolErrorBg",toolTitle:"",toolOutput:"mediumGray",mdHeading:"yellow",mdLink:"blue",mdLinkUrl:"dimGray",mdCode:"teal",mdCodeBlock:"green",mdCodeBlockBorder:"mediumGray",mdQuote:"mediumGray",mdQuoteBorder:"mediumGray",mdHr:"mediumGray",mdListBullet:"green",toolDiffAdded:"green",toolDiffRemoved:"red",toolDiffContext:"mediumGray",syntaxComment:"#008000",syntaxKeyword:"#0000FF",syntaxFunction:"#795E26",syntaxVariable:"#001080",syntaxString:"#A31515",syntaxNumber:"#098658",syntaxType:"#267F99",syntaxOperator:"#000000",syntaxPunctuation:"#000000",thinkingOff:"lightGray",thinkingMinimal:"#767676",thinkingLow:"blue",thinkingMedium:"teal",thinkingHigh:"#875f87",thinkingXhigh:"#8b008b",bashMode:"green"},export:{pageBg:"#f8f8f8",cardBg:"#ffffff",infoBg:"#fffae6"}}});import*as Qb from"node:fs";import*as NGe from"node:path";function VLt(){let e=process.env.COLORTERM;if(e==="truecolor"||e==="24bit"||process.env.WT_SESSION)return"truecolor";let t=process.env.TERM||"";return t==="dumb"||t===""||t==="linux"||process.env.TERM_PROGRAM==="Apple_Terminal"||t==="screen"||t.startsWith("screen-")||t.startsWith("screen.")?"256color":"truecolor"}function GLt(e){let t=e.replace("#","");if(t.length!==6)throw new Error(`Invalid hex color: ${e}`);let n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),i=Number.parseInt(t.slice(4,6),16);if(Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i))throw new Error(`Invalid hex color: ${e}`);return{r:n,g:r,b:i}}function LLt(e){let t=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of RGe.entries()){let s=Math.abs(e-i);s<t&&(t=s,n=r)}return n}function T3o(e){let t=Number.POSITIVE_INFINITY,n=0;for(let[r,i]of VBr.entries()){let s=Math.abs(e-i);s<t&&(t=s,n=r)}return n}function LBr(e,t,n,r,i,s){let o=e-r,a=t-i,l=n-s;return o*o*.299+a*a*.587+l*l*.114}function WLt(e,t,n){let r=LLt(e),i=LLt(t),s=LLt(n),o=RGe[r]??0,a=RGe[i]??0,l=RGe[s]??0,u=16+36*r+6*i+s,c=LBr(e,t,n,o,a,l),d=Math.round(.299*e+.587*t+.114*n),p=T3o(d),m=VBr[p]??0,f=232+p,h=LBr(e,t,n,m,m,m),g=Math.max(e,t,n),b=Math.min(e,t,n);return g-b<10&&h<c?f:u}function GBr(e){let{r:t,g:n,b:r}=GLt(e);return WLt(t,n,r)}function WBr(e,t,n){return`\x1B[${e<8?t+e:n+e-8}m`}function FBr(e,t){if(e==="")return"\x1B[39m";if(typeof e=="number")return e<16?WBr(e,30,90):`\x1B[38;5;${e}m`;if(e.startsWith("#")){if(t==="truecolor"){let{r,g:i,b:s}=GLt(e);return`\x1B[38;2;${r};${i};${s}m`}return`\x1B[38;5;${GBr(e)}m`}throw new Error(`Invalid color value: ${e}`)}function I3o(e,t){if(e==="")return"\x1B[49m";if(typeof e=="number")return e<16?WBr(e,40,100):`\x1B[48;5;${e}m`;if(e.startsWith("#")){if(t==="truecolor"){let{r,g:i,b:s}=GLt(e);return`\x1B[48;2;${r};${i};${s}m`}return`\x1B[48;5;${GBr(e)}m`}throw new Error(`Invalid color value: ${e}`)}function $Lt(e,t,n=new Set){if(typeof e=="number"||e===""||e.startsWith("#"))return e;if(n.has(e))throw new Error(`Circular variable reference detected: ${e}`);if(!(e in t))throw new Error(`Variable reference not found: ${e}`);n.add(e);let r=t[e];if(r===void 0)throw new Error(`Variable reference not found: ${e}`);return $Lt(r,t,n)}function $Br(e,t={}){let n={};for(let[r,i]of Object.entries(e))n[r]=$Lt(i,t);return n}function OGe(){let e=new Set(Object.keys(kGe)),t=zhe();if(Qb.existsSync(t)){let n=Qb.readdirSync(t);for(let r of n)r.endsWith(".json")&&e.add(r.slice(0,-5))}for(let n of o6.keys())e.add(n);return Array.from(e).sort()}function QBr(){let e=zhe(),t=[];for(let n of Object.keys(kGe))t.push({name:n,path:void 0});if(Qb.existsSync(e)){for(let n of Qb.readdirSync(e))if(n.endsWith(".json")){let r=n.slice(0,-5);t.some(i=>i.name===r)||t.push({name:r,path:NGe.join(e,n)})}}for(let[n,r]of o6.entries())t.some(i=>i.name===n)||t.push({name:n,path:r.sourcePath});return t.sort((n,r)=>n.name.localeCompare(r.name))}function w3o(e,t){if(!BBr.Check(t)){let n=Array.from(BBr.Errors(t)),r=[],i=[];for(let o of n){let l=o.path.match(/^\/colors\/(\w+)$/)?.[1];l&&o.message.includes("Required")?r.push(l):i.push(` - ${o.path}: ${o.message}`)}let s=`Invalid theme "${e}":
6390
6390
  `;throw r.length>0&&(s+=`
6391
6391
  Missing required color tokens:
6392
6392
  `,s+=r.map(o=>` - ${o}`).join(`
@@ -11407,7 +11407,7 @@ ${r}
11407
11407
 
11408
11408
  `;return t.trimEnd()}function b4r(e){let t=Array.from(e,i=>{let s=i.codePointAt(0)??0;return s<=31||s===127?" ":i}).join("").replace(/\s+/gu," ").trim(),n=t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1).trim():t,r=Array.from(n);return r.length<=f4r?n:`${r.slice(0,f4r-1).join("")}\u2026`}function EZo(e){let t=b4r(e);if(t)return t[0]?.toUpperCase()+t.slice(1)}function B6e(e){return JSON.stringify([e.provider,e.id])}function dUt(e){let n=e.getSettings()[g4r];return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(r=>typeof r[1]=="string"))}function PJ(e,t,n){let r=[g4r,B6e(t)];if(n===void 0){e.remove("global",{paths:[r]});return}e.update("global",{path:r,value:n})}var pZo,mZo,fZo,yZo,AZo,m4r,g4r,f4r,Q6,h4r,_Zo,DJ,L6e=C(()=>{"use strict";Bi();en();Ol();$s();Ai();rLr();iLr();QLr();HLr();YLr();x9t();x9r();w9t();N9t();Y9r();O9t();EWe();h6();J9t();b1();Af();aJ();fJ();IFt();ebe();qge();W5r();vE();M9();Q5r();Y5r();hge();H9();Yb();JUr();x3r();j3r();e4r();d4r();Z2();oge();pZo=2e5,mZo=64e3,fZo="Tool result processing failed before it could be returned safely.";yZo=1e3,AZo=3600*1e3,m4r="subagent-usage",g4r="reasoningEffortPreferences",f4r=80;Q6="augment",h4r="gemini-3-1-flash-lite-silent-override-1m-v1-c4-p2-agent",_Zo=1e6,DJ=class{agent;sessionManager;settingsManager;_scopedModels;_warnedInvalidReasoningPreferences=new Set;_unsubscribeAgent;_unsubscribeResourceChanges;_unsubscribeSubagentUsage;_eventListeners=[];_agentEventQueue=Promise.resolve();_recoveryDiagnosticsEnabled=TFt();_diagnosticPendingEvents=0;_diagnosticPendingContinuations=0;_diagnosticActiveContinuations=0;_diagnosticDisposed=!1;get recoveryDiagnosticState(){return{pendingEvents:this._diagnosticPendingEvents,pendingContinuations:this._diagnosticPendingContinuations,activeContinuations:this._diagnosticActiveContinuations,isCompacting:this.isCompacting,isRetrying:this.isRetrying,isStreaming:this.isStreaming,disposed:this._diagnosticDisposed,messageCount:this.agent.state.messages.length}}_steeringMessages=[];_followUpMessages=[];_queueItems=[];_queuedMessageIds=new WeakMap;_queuedMessages=new Map;_customQueuePaused=!1;_conversationGeneration=0;_hostAdmissions=0;_detachedClosed=!1;_pendingAgentEvents=0;_detachedRequests=new Set;_detachedResults=new WeakMap;_detachedInvalidationListeners=new Set;_settledAppends=new Map;detachedCompletion={start:t=>this._startDetachedCompletion(t),append:t=>this._appendWhenSettled(t),isCurrent:t=>this._isCurrentAnchor(t),subscribeInvalidation:t=>(this._detachedInvalidationListeners.add(t),()=>this._detachedInvalidationListeners.delete(t))};_isCurrentAnchor(t){return!this._detachedClosed&&t.sessionId===this.sessionManager.getSessionId()&&t.generation===this._conversationGeneration&&(t.leafId===null||this.sessionManager.getBranch().some(n=>n.id===t.leafId))}closeDetachedCompletions(){this._detachedClosed||(this._detachedClosed=!0,this._invalidateDetachedWork(),this._detachedInvalidationListeners.clear())}_invalidateDetachedWork(){this._conversationGeneration++,this._detachedResults=new WeakMap;for(let t of this._detachedRequests)t.abort();for(let t of this._settledAppends.values())t.result||t.finish({status:"invalidated"});for(let t of this._detachedInvalidationListeners)try{t()}catch{tt.warn("Detached completion invalidation listener failed")}}async withHistoryAdmission(t){this._hostAdmissions++;try{return await t()}finally{this._hostAdmissions--,this._drainSettledAppends()}}_startDetachedCompletion(t){if(this._detachedClosed)throw new Error("Session is disposed");let n=this.isStreaming||this.isRetrying||!!this._reactiveRecovery,r=n?this._resolveActiveTurnModel():this.model;if(!r)throw new Error("No model selected");if(n&&!this._activeCommandModel&&this._activeTurnModelOverride&&r.id!==this._activeTurnModelOverride)throw new Error("Detached model configuration is unavailable");let i=Object.freeze({sessionId:this.sessionManager.getSessionId(),generation:this._conversationGeneration,leafId:this.sessionManager.getLeafId()}),s=t.selectMessages(structuredClone(this.sessionManager.buildSessionContext().messages)),o=structuredClone(s);o.push({role:"user",content:[{type:"text",text:`Answer the side question directly. Do not call tools or request a continuation.
11409
11409
 
11410
- ${t.question}`}],timestamp:Date.now()});let a=Promise.resolve(this.agent.convertToLlm(o));a.catch(()=>{});let l=this.agent.state,u=structuredClone({systemPrompt:l.systemPrompt,messages:[],tools:l.tools.map(({name:v,description:w,parameters:T})=>({name:v,description:w,parameters:T})),rules:l.rules,skills:l.skills,userGuidelines:l.userGuidelines,workspaceGuidelines:l.workspaceGuidelines,systemPromptAppend:l.systemPromptAppend}),c=structuredClone(r),d=ss(r,l.reasoningEffortOverride??(l.usesModelDefault?void 0:l.thinkingLevel)),p=MJ(),m=MJ(),f=new AbortController,h={question:t.question,requestId:p,accepted:!1,answer:void 0};this._detachedResults.set(i,h),this._detachedRequests.add(f);let g=()=>{h.accepted||this._detachedResults.delete(i),f.abort()};t.signal?.addEventListener("abort",g,{once:!0});let b=()=>{t.signal?.removeEventListener("abort",g),this._detachedRequests.delete(f)};f.signal.addEventListener("abort",b,{once:!0}),t.signal?.aborted&&g();let A={conversationId:m,parentConversationId:i.sessionId,rootConversationId:i.sessionId,requestId:p,turnId:p,silent:!1},y=r.api==="augment-chat-stream"?this._extensionRunner?.emitBeforeProviderRequest(A,"detached")??A:void 0,S={signal:f.signal,sessionId:m,reasoning:r.api!=="augment-chat-stream"&&rb(l.thinkingLevel)&&l.thinkingLevel!=="off"?l.thinkingLevel:void 0,reasoningEffort:r.api==="augment-chat-stream"&&!d.usesModelDefault?d.effort:void 0,thinkingBudgets:structuredClone(this.settingsManager.getThinkingBudgets()),transport:this.settingsManager.getTransport(),maxRetryDelayMs:this.settingsManager.getRetrySettings().maxDelayMs,silent:!1,onPayload:async v=>{if(r.api!=="augment-chat-stream")return v;let w=await y,T={...v};if(w&&typeof w=="object")for(let P of["parentConversationId","rootConversationId","expertId","workflowId","subscriptionId","senderUserId","reasoningEffort"])P in w&&(T[P]=w[P]);return this._omitUnavailableReasoningEffort(T,c),{...T,conversationId:m,requestId:p,turnId:p,silent:!1}}},_=this._prepareDetachedStream?.()??this._detachedStreamFn;return{requestId:p,anchor:i,events:async function*(){try{if(u.messages=structuredClone(await a),f.signal.aborted)return;let v=await _(c,u,S);for await(let w of v){if(f.signal.aborted)return;w.type==="done"&&(h.answer=C9r(w)),yield w}}catch(v){if(!f.signal.aborted)throw v}finally{b()}}(),cancel:g}}_appendWhenSettled(t){let n=`${t.anchor.sessionId}/${t.anchor.generation}/${t.acceptanceId}`,r=this._settledAppends.get(n);if(r&&r.result?.status!=="committed")return r.options.anchor===t.anchor&&r.options.question===t.question&&r.options.answer===t.answer?r.promise:Promise.resolve({status:"error",reason:"invalid-content"});let i=this._findKeptSideQuestion(t);if(i)return Promise.resolve(i);let s=this._detachedResults.get(t.anchor),o=s?.answer,a=s&&o&&!s.accepted&&s.question===t.question&&o.content.every(p=>p.type==="text")&&o.content.map(p=>p.type==="text"?p.text:"").join("")===t.answer,l,u=new Promise(p=>{l=p}),c={options:{...t},completion:a?{requestId:s.requestId,answer:structuredClone(o)}:void 0,promise:u,result:void 0,finish:p=>{c.result||(c.result=p,c.completion=void 0,this._detachedResults.delete(t.anchor),t.signal?.removeEventListener("abort",d),l(p))}},d=()=>c.finish({status:"cancelled"});return this._settledAppends.set(n,c),t.signal?.addEventListener("abort",d,{once:!0}),this._isCurrentAnchor(t.anchor)?t.signal?.aborted?d():a&&t.acceptanceId.trim()&&t.question.trim()&&t.answer.trim()||c.finish({status:"error",reason:"invalid-content"}):c.finish({status:"invalidated"}),!c.result&&s&&(s.accepted=!0),this._drainSettledAppends(),u}_findKeptSideQuestion(t){if(t.anchor.sessionId!==this.sessionManager.getSessionId())return;let n=this.sessionManager.findSideQuestion(t.acceptanceId);if(n==="incomplete")return{status:"error",reason:"storage"};if(n){let s=n.parentId?this.sessionManager.getEntry(n.parentId):void 0;return s?.type==="message"&&s.message.role==="user"&&s.message.content===t.question&&n.message.role==="assistant"&&n.message.content.map(a=>a.type==="text"?a.text:"").join("")===t.answer?{status:"committed",entryId:n.id}:{status:"error",reason:"invalid-content"}}let r=this.sessionManager.getBranch().find(s=>s.type==="custom_message"&&s.customType===dWe&&s.details?.acceptanceId===t.acceptanceId);if(r?.type!=="custom_message")return;let i=r.details;return i.question===t.question&&i.answer===t.answer?{status:"committed",entryId:r.id}:{status:"error",reason:"invalid-content"}}_canAppendSettled(){return!(this._hostAdmissions||this._pendingAgentEvents||this.isStreaming||this.isCompacting||this.isRetrying||this._manualCompactionReadiness||this._proactiveCompactionReadiness||this._reactiveRecovery||this.agent.hasQueuedMessages())}_drainSettledAppends(){for(let t of this._settledAppends.values()){if(t.result)continue;if(!this._canAppendSettled())return;let{options:n}=t;if(!this._isCurrentAnchor(n.anchor)){t.finish({status:"invalidated"});continue}let r=this._findKeptSideQuestion(n);if(r){t.finish(r);continue}let i=t.completion;if(!i){t.finish({status:"error",reason:"invalid-content"});continue}let s={role:"user",content:n.question,timestamp:Date.now()},o=i.answer,a;try{a=this.sessionManager.appendSideQuestion(s,o,{acceptanceId:n.acceptanceId,requestId:i.requestId})}catch{t.finish({status:"error",reason:"storage"});continue}this.agent.state.messages.push(s,o),t.finish({status:"committed",entryId:a});for(let l of[s,o])this._emit({type:"message_start",message:l}),this._emit({type:"message_end",message:l})}}_pendingNextTurnMessages=[];_branchChangeListeners=new Set;subscribeBranchChange(t){return this._branchChangeListeners.add(t),()=>this._branchChangeListeners.delete(t)}async _emitBranchChange(t){if(t==="closing"){this._invalidateDetachedWork();for(let n of[...this._queueItems]){if(n.kind!=="custom"||n.status!=="pending")continue;let r=n.message;this.sessionManager.appendCustomMessageEntry(r.customType,r.content,r.display,r.details,n.id),this._finalizeQueueHandoff(n.id)}this._rebuildAgentQueues()}for(let n of this._branchChangeListeners)await n(t)}_manualCompactionReadiness;_compactionAbortController=void 0;_autoCompactionAbortController=void 0;_latestAgentEndObservation;_abortGeneration=0;_proactiveCompactionReadiness;_reactiveRecovery;_reactiveRecoveryFailure;_reactiveContinuationFailed=!1;_overflowRecoveryAttempted=!1;_overflowEvictionAttempted=!1;_summarizeAndRetryAttempted=!1;_branchSummaryAbortController=void 0;_retryAbortController=void 0;_retryAttempt=0;_retryPromise=void 0;_retryResolve=void 0;_rateLimitAttempt=0;_rateLimitDeadline=void 0;_bashAbortController=void 0;_pendingBashMessages=[];_extensionRunner=void 0;_turnIndex=0;_nextProviderRequestId=void 0;_nextProviderModel=void 0;_activeTurnModelOverride=void 0;_activeCommandModel;_commandContexts=new WeakMap;_currentRequestId=void 0;_turnStartSeen=!1;_prepareDetachedStream;_detachedStreamFn;_resourceLoader;_customTools;_baseToolDefinitions=new Map;_cwd;_agentDir;_pluginDirs;_mcpConfigOverride;_permissionOverride;_extensionRunnerRef;_initialActiveToolNames;_cliRemovedTools;_removedTools;_baseToolsOverride;_toolsOptions;_backgroundBashExecutor;_sessionStartEvent;_errorReporter;_scheduler;_extensionUIContext;_extensionCommandContextActions;_extensionShutdownHandler;_extensionErrorListener;_extensionMode="interactive";_extensionRole="parent";_extensionErrorUnsubscriber;_modelRegistry;_featureFlags;_lastRulesTruncationSignature;_toolRegistry=new Map;_toolDefinitions=new Map;_toolPromptSnippets=new Map;_toolPromptGuidelines=new Map;_toolResultPostProcessor=SLr({compressors:[o3r(),a3r(),KUr(),s4r(),w3r(),R3r(),J3r()],rawStoragePolicy:ALr([l3r,qUr,o4r,N3r,K3r])});_baseSystemPrompt="";constructor(t){this.agent=t.agent,this._prepareDetachedStream=t.prepareDetachedStream;let n=t.agent.streamFn;this._detachedStreamFn=async(i,s,o)=>{let a=await this._getRequiredRequestAuth(i);if(o?.signal?.aborted)throw new Error("Request cancelled");return n(a.model,s,{...o,...a})},this.sessionManager=t.sessionManager,this.settingsManager=t.settingsManager,this._scopedModels=(t.scopedModels??[]).filter(({model:i})=>jx(i)),this._resourceLoader=t.resourceLoader,this._customTools=t.customTools??[],this._cwd=t.cwd,this._agentDir=t.agentDir??nr(),this._pluginDirs=t.pluginDirs,this._mcpConfigOverride=t.mcpConfigOverride,this._permissionOverride=t.permissionOverride,this._modelRegistry=t.modelRegistry,this._featureFlags=t.featureFlags,this._extensionRunnerRef=t.extensionRunnerRef,this._initialActiveToolNames=t.initialActiveToolNames,this._cliRemovedTools=t.removedTools?[...t.removedTools]:[],this._removedTools=new Set([...this._cliRemovedTools,...this.settingsManager.getRemovedToolsUnion()].flatMap(bd)),this._baseToolsOverride=t.baseToolsOverride,this._toolsOptions=t.toolsOptions,this._backgroundBashExecutor=t.toolsOptions?.bash?.backgroundExecutor,this._sessionStartEvent=t.sessionStartEvent??{type:"session_start",reason:"startup"},this._errorReporter=t.errorReporter??{reportSummarizationError:nLr,reportAgentStop:tLr},this._scheduler=t.scheduler??((i,s)=>{setTimeout(s,i)}),t.role!==void 0&&(this._extensionRole=t.role),this._unsubscribeAgent=this.agent.subscribe(this._handleAgentEvent),this._installAgentToolHooks(),this._installCallerRequestIdInjector(),this._installCommandModelOverride(),this._buildRuntime({activeToolNames:this._initialActiveToolNames,includeAllExtensionTools:!0});let r=this._resourceLoader.getEventBus?.();r&&(this._unsubscribeResourceChanges=r.on(EJ,()=>this._refreshSystemPromptFromResources())),this._subscribeToSubagentUsage()}_subscribeToSubagentUsage(){let t=this._resourceLoader.getEventBus?.();if(!t)return;let n=s=>this._recordSubagentUsage(s),r=t.on("subagents:completed",n),i=t.on("subagents:failed",n);this._unsubscribeSubagentUsage=()=>{r(),i()}}_recordSubagentUsage(t){let n=t?.tokens,r=n?.total??0;if(r<=0)return;let i={input:n?.input??0,output:n?.output??0,total:r};this.sessionManager.appendCustomEntry(m4r,i)}get modelRegistry(){return this._modelRegistry}async _getRequiredRequestAuth(t){let n=await this._modelRegistry.getApiKeyAndHeaders(t);if(!n.ok)throw new Error(n.error);if(n.apiKey)return{model:n.baseUrl?{...t,baseUrl:n.baseUrl}:t,apiKey:n.apiKey,headers:n.headers};throw this._modelRegistry.isUsingOAuth(t)?new Error(`Authentication failed for "${t.provider}". Credentials may have expired or network is unavailable. Run '/login ${t.provider}' to re-authenticate.`):new Error(`No API key found for ${t.provider}.
11410
+ ${t.question}`}],timestamp:Date.now()});let a=Promise.resolve(this.agent.convertToLlm(o));a.catch(()=>{});let l=this.agent.state,u=structuredClone({systemPrompt:l.systemPrompt,messages:[],tools:l.tools.map(({name:v,description:w,parameters:T})=>({name:v,description:w,parameters:T})),rules:l.rules,skills:l.skills,userGuidelines:l.userGuidelines,workspaceGuidelines:l.workspaceGuidelines,systemPromptAppend:l.systemPromptAppend}),c=structuredClone(r),d=ss(r,l.reasoningEffortOverride??(l.usesModelDefault?void 0:l.thinkingLevel)),p=MJ(),m=MJ(),f=new AbortController,h={question:t.question,requestId:p,accepted:!1,answer:void 0};this._detachedResults.set(i,h),this._detachedRequests.add(f);let g=()=>{h.accepted||this._detachedResults.delete(i),f.abort()};t.signal?.addEventListener("abort",g,{once:!0});let b=()=>{t.signal?.removeEventListener("abort",g),this._detachedRequests.delete(f)};f.signal.addEventListener("abort",b,{once:!0}),t.signal?.aborted&&g();let A={conversationId:m,parentConversationId:i.sessionId,rootConversationId:i.sessionId,requestId:p,turnId:p,silent:!1},y=r.api==="augment-chat-stream"?this._extensionRunner?.emitBeforeProviderRequest(A,"detached")??A:void 0,S={signal:f.signal,sessionId:m,reasoning:r.api!=="augment-chat-stream"&&rb(l.thinkingLevel)&&l.thinkingLevel!=="off"?l.thinkingLevel:void 0,reasoningEffort:r.api==="augment-chat-stream"&&!d.usesModelDefault?d.effort:void 0,thinkingBudgets:structuredClone(this.settingsManager.getThinkingBudgets()),maxRetryDelayMs:this.settingsManager.getRetrySettings().maxDelayMs,silent:!1,onPayload:async v=>{if(r.api!=="augment-chat-stream")return v;let w=await y,T={...v};if(w&&typeof w=="object")for(let P of["parentConversationId","rootConversationId","expertId","workflowId","subscriptionId","senderUserId","reasoningEffort"])P in w&&(T[P]=w[P]);return this._omitUnavailableReasoningEffort(T,c),{...T,conversationId:m,requestId:p,turnId:p,silent:!1}}},_=this._prepareDetachedStream?.()??this._detachedStreamFn;return{requestId:p,anchor:i,events:async function*(){try{if(u.messages=structuredClone(await a),f.signal.aborted)return;let v=await _(c,u,S);for await(let w of v){if(f.signal.aborted)return;w.type==="done"&&(h.answer=C9r(w)),yield w}}catch(v){if(!f.signal.aborted)throw v}finally{b()}}(),cancel:g}}_appendWhenSettled(t){let n=`${t.anchor.sessionId}/${t.anchor.generation}/${t.acceptanceId}`,r=this._settledAppends.get(n);if(r&&r.result?.status!=="committed")return r.options.anchor===t.anchor&&r.options.question===t.question&&r.options.answer===t.answer?r.promise:Promise.resolve({status:"error",reason:"invalid-content"});let i=this._findKeptSideQuestion(t);if(i)return Promise.resolve(i);let s=this._detachedResults.get(t.anchor),o=s?.answer,a=s&&o&&!s.accepted&&s.question===t.question&&o.content.every(p=>p.type==="text")&&o.content.map(p=>p.type==="text"?p.text:"").join("")===t.answer,l,u=new Promise(p=>{l=p}),c={options:{...t},completion:a?{requestId:s.requestId,answer:structuredClone(o)}:void 0,promise:u,result:void 0,finish:p=>{c.result||(c.result=p,c.completion=void 0,this._detachedResults.delete(t.anchor),t.signal?.removeEventListener("abort",d),l(p))}},d=()=>c.finish({status:"cancelled"});return this._settledAppends.set(n,c),t.signal?.addEventListener("abort",d,{once:!0}),this._isCurrentAnchor(t.anchor)?t.signal?.aborted?d():a&&t.acceptanceId.trim()&&t.question.trim()&&t.answer.trim()||c.finish({status:"error",reason:"invalid-content"}):c.finish({status:"invalidated"}),!c.result&&s&&(s.accepted=!0),this._drainSettledAppends(),u}_findKeptSideQuestion(t){if(t.anchor.sessionId!==this.sessionManager.getSessionId())return;let n=this.sessionManager.findSideQuestion(t.acceptanceId);if(n==="incomplete")return{status:"error",reason:"storage"};if(n){let s=n.parentId?this.sessionManager.getEntry(n.parentId):void 0;return s?.type==="message"&&s.message.role==="user"&&s.message.content===t.question&&n.message.role==="assistant"&&n.message.content.map(a=>a.type==="text"?a.text:"").join("")===t.answer?{status:"committed",entryId:n.id}:{status:"error",reason:"invalid-content"}}let r=this.sessionManager.getBranch().find(s=>s.type==="custom_message"&&s.customType===dWe&&s.details?.acceptanceId===t.acceptanceId);if(r?.type!=="custom_message")return;let i=r.details;return i.question===t.question&&i.answer===t.answer?{status:"committed",entryId:r.id}:{status:"error",reason:"invalid-content"}}_canAppendSettled(){return!(this._hostAdmissions||this._pendingAgentEvents||this.isStreaming||this.isCompacting||this.isRetrying||this._manualCompactionReadiness||this._proactiveCompactionReadiness||this._reactiveRecovery||this.agent.hasQueuedMessages())}_drainSettledAppends(){for(let t of this._settledAppends.values()){if(t.result)continue;if(!this._canAppendSettled())return;let{options:n}=t;if(!this._isCurrentAnchor(n.anchor)){t.finish({status:"invalidated"});continue}let r=this._findKeptSideQuestion(n);if(r){t.finish(r);continue}let i=t.completion;if(!i){t.finish({status:"error",reason:"invalid-content"});continue}let s={role:"user",content:n.question,timestamp:Date.now()},o=i.answer,a;try{a=this.sessionManager.appendSideQuestion(s,o,{acceptanceId:n.acceptanceId,requestId:i.requestId})}catch{t.finish({status:"error",reason:"storage"});continue}this.agent.state.messages.push(s,o),t.finish({status:"committed",entryId:a});for(let l of[s,o])this._emit({type:"message_start",message:l}),this._emit({type:"message_end",message:l})}}_pendingNextTurnMessages=[];_branchChangeListeners=new Set;subscribeBranchChange(t){return this._branchChangeListeners.add(t),()=>this._branchChangeListeners.delete(t)}async _emitBranchChange(t){if(t==="closing"){this._invalidateDetachedWork();for(let n of[...this._queueItems]){if(n.kind!=="custom"||n.status!=="pending")continue;let r=n.message;this.sessionManager.appendCustomMessageEntry(r.customType,r.content,r.display,r.details,n.id),this._finalizeQueueHandoff(n.id)}this._rebuildAgentQueues()}for(let n of this._branchChangeListeners)await n(t)}_manualCompactionReadiness;_compactionAbortController=void 0;_autoCompactionAbortController=void 0;_latestAgentEndObservation;_abortGeneration=0;_proactiveCompactionReadiness;_reactiveRecovery;_reactiveRecoveryFailure;_reactiveContinuationFailed=!1;_overflowRecoveryAttempted=!1;_overflowEvictionAttempted=!1;_summarizeAndRetryAttempted=!1;_branchSummaryAbortController=void 0;_retryAbortController=void 0;_retryAttempt=0;_retryPromise=void 0;_retryResolve=void 0;_rateLimitAttempt=0;_rateLimitDeadline=void 0;_bashAbortController=void 0;_pendingBashMessages=[];_extensionRunner=void 0;_turnIndex=0;_nextProviderRequestId=void 0;_nextProviderModel=void 0;_activeTurnModelOverride=void 0;_activeCommandModel;_commandContexts=new WeakMap;_currentRequestId=void 0;_turnStartSeen=!1;_prepareDetachedStream;_detachedStreamFn;_resourceLoader;_customTools;_baseToolDefinitions=new Map;_cwd;_agentDir;_pluginDirs;_mcpConfigOverride;_permissionOverride;_extensionRunnerRef;_initialActiveToolNames;_cliRemovedTools;_removedTools;_baseToolsOverride;_toolsOptions;_backgroundBashExecutor;_sessionStartEvent;_errorReporter;_scheduler;_extensionUIContext;_extensionCommandContextActions;_extensionShutdownHandler;_extensionErrorListener;_extensionMode="interactive";_extensionRole="parent";_extensionErrorUnsubscriber;_modelRegistry;_featureFlags;_lastRulesTruncationSignature;_toolRegistry=new Map;_toolDefinitions=new Map;_toolPromptSnippets=new Map;_toolPromptGuidelines=new Map;_toolResultPostProcessor=SLr({compressors:[o3r(),a3r(),KUr(),s4r(),w3r(),R3r(),J3r()],rawStoragePolicy:ALr([l3r,qUr,o4r,N3r,K3r])});_baseSystemPrompt="";constructor(t){this.agent=t.agent,this._prepareDetachedStream=t.prepareDetachedStream;let n=t.agent.streamFn;this._detachedStreamFn=async(i,s,o)=>{let a=await this._getRequiredRequestAuth(i);if(o?.signal?.aborted)throw new Error("Request cancelled");return n(a.model,s,{...o,...a})},this.sessionManager=t.sessionManager,this.settingsManager=t.settingsManager,this._scopedModels=(t.scopedModels??[]).filter(({model:i})=>jx(i)),this._resourceLoader=t.resourceLoader,this._customTools=t.customTools??[],this._cwd=t.cwd,this._agentDir=t.agentDir??nr(),this._pluginDirs=t.pluginDirs,this._mcpConfigOverride=t.mcpConfigOverride,this._permissionOverride=t.permissionOverride,this._modelRegistry=t.modelRegistry,this._featureFlags=t.featureFlags,this._extensionRunnerRef=t.extensionRunnerRef,this._initialActiveToolNames=t.initialActiveToolNames,this._cliRemovedTools=t.removedTools?[...t.removedTools]:[],this._removedTools=new Set([...this._cliRemovedTools,...this.settingsManager.getRemovedToolsUnion()].flatMap(bd)),this._baseToolsOverride=t.baseToolsOverride,this._toolsOptions=t.toolsOptions,this._backgroundBashExecutor=t.toolsOptions?.bash?.backgroundExecutor,this._sessionStartEvent=t.sessionStartEvent??{type:"session_start",reason:"startup"},this._errorReporter=t.errorReporter??{reportSummarizationError:nLr,reportAgentStop:tLr},this._scheduler=t.scheduler??((i,s)=>{setTimeout(s,i)}),t.role!==void 0&&(this._extensionRole=t.role),this._unsubscribeAgent=this.agent.subscribe(this._handleAgentEvent),this._installAgentToolHooks(),this._installCallerRequestIdInjector(),this._installCommandModelOverride(),this._buildRuntime({activeToolNames:this._initialActiveToolNames,includeAllExtensionTools:!0});let r=this._resourceLoader.getEventBus?.();r&&(this._unsubscribeResourceChanges=r.on(EJ,()=>this._refreshSystemPromptFromResources())),this._subscribeToSubagentUsage()}_subscribeToSubagentUsage(){let t=this._resourceLoader.getEventBus?.();if(!t)return;let n=s=>this._recordSubagentUsage(s),r=t.on("subagents:completed",n),i=t.on("subagents:failed",n);this._unsubscribeSubagentUsage=()=>{r(),i()}}_recordSubagentUsage(t){let n=t?.tokens,r=n?.total??0;if(r<=0)return;let i={input:n?.input??0,output:n?.output??0,total:r};this.sessionManager.appendCustomEntry(m4r,i)}get modelRegistry(){return this._modelRegistry}async _getRequiredRequestAuth(t){let n=await this._modelRegistry.getApiKeyAndHeaders(t);if(!n.ok)throw new Error(n.error);if(n.apiKey)return{model:n.baseUrl?{...t,baseUrl:n.baseUrl}:t,apiKey:n.apiKey,headers:n.headers};throw this._modelRegistry.isUsingOAuth(t)?new Error(`Authentication failed for "${t.provider}". Credentials may have expired or network is unavailable. Run '/login ${t.provider}' to re-authenticate.`):new Error(`No API key found for ${t.provider}.
11411
11411
 
11412
11412
  Use /login or set an API key environment variable. See ${lUt(IGe(),"providers.md")}`)}async _tryResolveSummarizationModel(){let t=this._resolveSummaryModelSelection({warn:!0});if(!t)return;let n=await this._modelRegistry.getApiKeyAndHeaders(t);if(!n.ok||!n.apiKey){tt.warn(`Summarization model "${t.provider}/${t.id}" has no usable auth; using main model.`);return}return{model:n.baseUrl?{...t,baseUrl:n.baseUrl}:t,apiKey:n.apiKey,headers:n.headers}}_resolveUserSummarizationModel({warn:t}){let n=this.settingsManager.getCompactionSettings().summarizationModel;if(!n)return;let r=n.indexOf("/");if(r<=0||r===n.length-1){t&&tt.warn(`Ignoring malformed compaction.summarizationModel "${n}" (expected "provider/model-id"); trying the configured fallback model.`);return}let i=n.slice(0,r),s=n.slice(r+1),o=this._modelRegistry.findSupported(i,s);return!o&&t&&tt.warn(`Ignoring compaction.summarizationModel "${n}" because it was not found in the registry; trying the configured fallback model.`),o}_resolveSummaryModelSelection({warn:t}={warn:!1}){let n=this._resolveUserSummarizationModel({warn:t});if(n)return n;let r=this.model,i=K9t(this._featureFlags,r?[r.id,`${r.provider}/${r.id}`]:[]);if(i){if(this._isValidFlagSummarizationModelId(i)){let s=this._buildSummarizationModelById(i);if(s)return s}t&&tt.warn(`Summarization model "${i}" is invalid or could not be created from the registered Augment provider; trying the default summarization model.`)}return this._buildSummarizationModelById(h4r)}_isValidFlagSummarizationModelId(t){let n=t.split("/");return n.length===1&&n[0].length>0||n.length===2&&n[0]===Q6&&n[1].length>0}_buildSummarizationModelById(t){let n=this._modelRegistry.getSupported().find(o=>o.provider===Q6);if(!n)return;let r=t.startsWith(`${Q6}/`)?t.slice(Q6.length+1):t,i=this.model,s=SWe(this._featureFlags,i?[i.id,`${i.provider}/${i.id}`]:[]);return{...n,id:r,name:r,contextWindow:s.maxTokens??(r===h4r?_Zo:n.contextWindow)}}_resolveCompactionSettings(t){let n=this.settingsManager.getCompactionSettings(),r=this.model,i=r?[r.id,`${r.provider}/${r.id}`]:[],s=SWe(this._featureFlags,i),o=this._resolveUserSummarizationModel({warn:!1})?void 0:K9t(this._featureFlags,i),a=o?.startsWith(`${Q6}/`)?o.slice(Q6.length+1):o,l=t.provider===Q6&&t.id===a;return{...n,reserveTokens:s.reserveTokens??n.reserveTokens,keepRecentTokens:s.keepRecentTokens??n.keepRecentTokens,inputBudgetTriggerRatio:n.inputBudgetTriggerRatio??s.inputBudgetTriggerRatio,fallbackInputBudgetRatio:n.fallbackInputBudgetRatio??s.fallbackInputBudgetRatio,maxMessageTokens:n.maxMessageTokens??(l?s.maxMessageTokens:void 0),summaryContextWindow:l?s.maxTokens:void 0}}_resolveSummaryTriggerModel(){return this._resolveSummaryModelSelection()??this.model}_resolveTriggerSizing(){let t=this._resolveSummaryModelSelection();if(!t)return{...p4r(this._resolveActiveTurnModel()),settings:this.settingsManager.getCompactionSettings()};let n=this._resolveCompactionSettings(t),r=Math.max(0,n.protectedHeadTokens??rWe);return{window:n.summaryContextWindow??t.contextWindow,triggerHeadroomTokens:r+n.keepRecentTokens,settings:n}}_installAgentToolHooks(){this.agent.beforeToolCall=async({toolCall:t,args:n})=>{let r=this._extensionRunner,i=r?.hasHandlers("tool_call")??!1,s=r?.hasHandlers("tool_decision")??!1;if(!r||!i&&!s)return;await this._agentEventQueue;let o=async l=>{s&&await r.emit(H5r({toolName:t.name,toolCallId:t.id,result:l}))},a;if(i)try{a=await r.emitToolCall({type:"tool_call",toolName:t.name,toolCallId:t.id,input:n})}catch(l){let u=l instanceof Error?l.message:`Extension error: ${l}`;throw await o({block:!0,reason:u,decisionSource:"hook"}),l instanceof Error?l:new Error(`Extension failed, blocking execution: ${String(l)}`)}return await o(a),a},this.agent.afterToolCall=async({toolCall:t,args:n,result:r,isError:i})=>{try{let s=QK(r,{toolName:t.name,isError:i}),o=i,a=this._extensionRunner;if(a?.hasHandlers("tool_result")){let c=await a.emitToolResult({type:"tool_result",toolName:t.name,toolCallId:t.id,input:n,content:s.content,details:o?void 0:s.details,isError:o});c&&!o&&(s={content:c.content??s.content,details:c.details??s.details,terminate:s.terminate},o=c.isError??o)}let l=o?void 0:this._buildNestedContextTailForTool(t.name,n),u=await this._toolResultPostProcessor.process({toolCall:t,args:n,result:s,isError:o,sessionDir:this.sessionManager.getSessionDir(),sessionId:this.sessionManager.getSessionId()});return this._finalizeAfterToolCall({originalResult:r,originalIsError:i,currentResult:s,currentIsError:o,processedResult:u,nestedContextTail:l})}catch{return tt.error("Tool result processing failed",{toolName:t.name}),{content:[{type:"text",text:fZo}],details:{},isError:!0}}}}_finalizeAfterToolCall(t){let{originalResult:n,originalIsError:r,currentResult:i,currentIsError:s,processedResult:o,nestedContextTail:a}=t;if(!(o||a))return hZo(n,r,i,s);let l=o??i;return{content:a?[...l.content,{type:"text",text:a}]:l.content,details:l.details,isError:s,terminate:l.terminate}}_buildNestedContextTailForTool(t,n){if(t!=="read"&&t!=="edit"&&t!=="write"||!n||typeof n!="object"||!("path"in n))return;let r=n.path;if(typeof r!="string"||r.length===0)return;let i=this._resourceLoader.loadContextFilesForPath?.(r);if(!(!i||i.length===0))return bZo(i)}_emit(t){t.type==="compaction_start"?qs("compaction_start",{...this.recoveryDiagnosticState,overflow:t.reason==="overflow",threshold:t.reason==="threshold",summarizeAndRetry:t.reason==="summarize_and_retry"}):t.type==="compaction_end"&&qs(t.result?"compaction_success":"compaction_failure",{...this.recoveryDiagnosticState,aborted:t.aborted,willRetry:t.willRetry,tokensBefore:t.result?.tokensBefore,tokensAfter:t.tokensAfter,durationMs:t.durationMs});for(let n of this._eventListeners)n(t)}_emitQueueUpdate(t=!0){t&&this._persistQueue(),this._emit({type:"queue_update",steering:[...this._steeringMessages],followUp:[...this._followUpMessages]})}_persistQueue(){this.sessionManager.persistQueueState(this._queueItems)}_markQueueItemExecuting(t){let n=this._queuedMessageIds.get(t),r=this._queueItems.find(i=>i.id===n);if(!(!r||r.status!=="pending")&&(r.status="executing",r.kind!=="custom")){let i=r.delivery==="steering"?this._steeringMessages:this._followUpMessages,s=i.indexOf(r.text);s!==-1&&i.splice(s,1)}}_finalizeQueueHandoff(t){if(!t)return;let n=this._queueItems.length;this._queueItems=this._queueItems.filter(r=>r.id!==t),this._queuedMessages.delete(t),this._queueItems.length!==n&&this._persistQueue()}restoreQueue(t){for(let n of t){if(n.kind==="custom"){this._customQueuePaused=!0,this._admitQueuedMessage({...n,status:"pending",delivery:"followUp"},n.message);continue}if(n.promptCommand){let{context:a,message:l}=n.promptCommand;this._commandContexts.set(l,a),this._trackQueued("followUp",n.text,l,n.promptCommand);continue}let{expandedText:r,invocation:i,ruleReference:s,commandContext:o}=this._expandInput(n.text,void 0);this._queueFollowUp(r,void 0,i,s,o)}return Promise.resolve()}_lastAssistantMessage=void 0;_handleAgentEvent=t=>{t.type==="message_start"&&this._markQueueItemExecuting(t.message),t.type==="message_start"&&Zb(t.message.role)&&(this._activeCommandModel=this._resolveCommandModel(this._commandContexts.get(t.message)?.model)),this._createRetryPromiseForAgentEnd(t),this._createReactiveRecoveryForAgentEnd(t);let n=this._createAgentEndObservation(t),r=this._createProactiveCompactionReadinessForAgentEnd(t),i=()=>this._processAgentEvent(t,n).catch(l=>{throw this._resolveRetry(),this._rejectReactiveRecovery(l instanceof Error?l:new Error(String(l))),l}).finally(()=>{n?.resolve(),this._resolveProactiveCompactionReadiness(r),this._pendingAgentEvents--,this._drainSettledAppends()});if(this._pendingAgentEvents++,this._agentEventQueue=this._agentEventQueue.then(i,i),!this._recoveryDiagnosticsEnabled){this._agentEventQueue.catch(()=>{});return}this._diagnosticPendingEvents++;let s={agentEnd:t.type==="agent_end",messageEnd:t.type==="message_end",turnEnd:t.type==="turn_end"},o=s.agentEnd||s.messageEnd||s.turnEnd;o&&qs("event_queued",{...this.recoveryDiagnosticState,...s});let a=l=>{this._diagnosticPendingEvents--,(o||l)&&qs(l?"event_processing_failed":"event_processed",{...this.recoveryDiagnosticState,...s})};this._agentEventQueue.then(()=>a(!1),()=>a(!0))};_createRetryPromiseForAgentEnd(t){if(t.type!=="agent_end"||this._retryPromise)return;if(!this.settingsManager.getRetrySettings().enabled){qs("retry_gate",{...this.recoveryDiagnosticState,enabled:!1});return}let r=this._findLastAssistantInMessages(t.messages),i=!!r&&this._isRetryableError(r);qs("retry_gate",{...this.recoveryDiagnosticState,enabled:!0,hasAssistant:!!r,retryable:i}),i&&(this._retryPromise=new Promise(s=>{this._retryResolve=s}),qs("retry_promise_created",this.recoveryDiagnosticState))}_createReactiveRecoveryForAgentEnd(t){if(t.type!=="agent_end"||this._reactiveRecovery)return;let n=this._findLastAssistantInMessages(t.messages);if(!n||!this._willRetryAfterAgentEnd(n))return;let r,i,s=new Promise((o,a)=>{r=o,i=a});s.catch(()=>{}),this._reactiveRecovery={promise:s,resolve:r,reject:i},this._reactiveRecoveryFailure=void 0,this._reactiveContinuationFailed=!1}_createAgentEndObservation(t){if(t.type!=="agent_end")return;let n,i={promise:new Promise(s=>{n=s}),resolve:n,recovery:this._reactiveRecovery?.promise,abortGeneration:this._abortGeneration};return this._latestAgentEndObservation=i,i}_createProactiveCompactionReadinessForAgentEnd(t){if(t.type!=="agent_end"||this._proactiveCompactionReadiness||!this.settingsManager.getCompactionSettings().enabled)return;let n=this._findLastAssistantInMessages(t.messages);if(!n||n.stopReason==="error"||n.stopReason==="aborted"||n.stopReason==="summarize_and_retry")return;let r,s={promise:new Promise(o=>{r=o}),resolve:r};return this._proactiveCompactionReadiness=s,s}_resolveProactiveCompactionReadiness(t){!t||this._proactiveCompactionReadiness!==t||(this._proactiveCompactionReadiness=void 0,t.resolve())}_findLastAssistantInMessages(t){for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.role==="assistant")return r}}async _processAgentEvent(t,n){if(this._recoveryDiagnosticsEnabled&&(t.type==="agent_end"||t.type==="message_end"||t.type==="turn_end")&&qs("event_processing",{...this.recoveryDiagnosticState,agentEnd:t.type==="agent_end",messageEnd:t.type==="message_end",turnEnd:t.type==="turn_end"}),t.type==="turn_start"){if(this._turnStartSeen&&this.model?.provider==="augment"){let i=MJ();this._nextProviderRequestId=i,this._currentRequestId=i}this._turnStartSeen=!0}t.type==="message_start"&&(Zb(t.message.role)&&(this._overflowRecoveryAttempted=!1,this._overflowEvictionAttempted=!1,this._summarizeAndRetryAttempted=!1),this._queuedMessageIds.has(t.message)&&this._emitQueueUpdate());let r=gZo(t);if(await this._emitExtensionEvent(r),this._emit(r),t.type==="message_end"){let i=t.message.role==="toolResult"?uUt(t.message):t.message;if(i.role==="custom"){let s=this._queuedMessageIds.get(i);this.sessionManager.appendCustomMessageEntry(i.customType,i.content,i.display,i.details,s),this._finalizeQueueHandoff(s),s&&this._emitQueueUpdate(!1)}else if(i.role==="user"||i.role==="assistant"||i.role==="toolResult"){let s=i.role==="user"?this._queuedMessageIds.get(i):void 0;this.sessionManager.appendMessage(i,s),this._finalizeQueueHandoff(s)}else if(i.role==="promptCommandInvocation"){let s=this._queuedMessageIds.get(i);this.sessionManager.appendMessage(i,s),this._finalizeQueueHandoff(s)}else if(i.role==="ruleReference"){let s=this._queuedMessageIds.get(i);this.sessionManager.appendMessage(i,s),this._finalizeQueueHandoff(s)}if(t.message.role==="assistant"){this._lastAssistantMessage=t.message;let s=t.message;if(s.stopReason!=="error"&&(this._overflowRecoveryAttempted=!1,this._overflowEvictionAttempted=!1),s.stopReason!=="error"&&s.stopReason!=="summarize_and_retry"&&(this._activeTurnModelOverride=void 0,this._summarizeAndRetryAttempted=!1),s.stopReason!=="error"){let o=this._retryAttempt+this._rateLimitAttempt;o>0&&(this._logPublicRetry("Automatic retry completed",{attempt:o,outcome:"completed"}),this._emit({type:"auto_retry_end",success:!0,attempt:o})),this._retryAttempt=0,this._rateLimitAttempt=0,this._rateLimitDeadline=void 0}}}if(t.type==="agent_end"){let i=this._findLastAssistantInMessages(t.messages)??this._lastAssistantMessage;if(this._lastAssistantMessage=void 0,!i||n&&n.abortGeneration!==this._abortGeneration){this._resolveRetry(),this._resolveReactiveRecovery();return}i.stopReason==="error"&&i.errorMessage&&tt.error(`LLM error [${i.provider}/${i.model}]: ${i.errorMessage}`);let s=this._willAttemptAutomaticRetryAfterAgentEnd(i),o=!1;if(this._isRetryableError(i)){let u=await this._handleRetryableError(i);if(s&&this._extensionRunner&&await this._extensionRunner.emit({type:"agent_end_recovery",messages:t.messages,willRetry:u==="retrying",...u==="aborted"?{retryAborted:!0}:{}}),u==="retrying")return;o=u==="aborted"}this._resolveRetry(),i.stopReason==="error"&&!o&&(this._emit({type:"message_send_error",errorMessage:i.errorMessage}),this._willRecoverViaOverflowCompaction(i)||this._errorReporter.reportAgentStop({reason:this._isRetryableError(i)?"retry_exhausted":"error",errorMessage:i.errorMessage,provider:i.provider,model:i.model,stopReason:i.stopReason,transportError:Rv(i.diagnostics)})),i.stopReason==="empty_completion"&&this._errorReporter.reportAgentStop({reason:"empty_completion",provider:i.provider,model:i.model,stopReason:i.stopReason}),n?.resolve(),this._reactiveRecovery&&i.stopReason!=="error"&&i.stopReason!=="aborted"&&i.stopReason!=="summarize_and_retry"&&this._resolveReactiveRecovery();let a=this._willRetryAfterAgentEnd(i),l=!1;try{l=await this._checkCompaction(i)}catch(u){throw this._rejectReactiveRecovery(u instanceof Error?u:new Error(String(u))),u}finally{qs("agent_end_recovery",{...this.recoveryDiagnosticState,retryScheduled:l}),a&&this._extensionRunner&&await this._extensionRunner.emit({type:"agent_end_recovery",messages:t.messages,willRetry:l,continuationFailed:!l&&this._reactiveContinuationFailed})}l||(this._activeCommandModel=void 0),!l&&this._reactiveRecovery&&(this._reactiveRecoveryFailure?this._rejectReactiveRecovery(this._reactiveRecoveryFailure):this._resolveReactiveRecovery())}}_willAttemptAutomaticRetryAfterAgentEnd(t){return this.settingsManager.getRetrySettings().enabled&&this._isRetryableError(t)}_willRetryAfterAgentEnd(t){return t.stopReason==="summarize_and_retry"?!this._summarizeAndRetryAttempted&&this.settingsManager.getCompactionSettings().enabled&&!this._isAssistantFromBeforeLatestCompaction(t):this._willRecoverViaOverflowCompaction(t)?!this._overflowRecoveryAttempted||!this._overflowEvictionAttempted:!1}_resolveReactiveRecovery(){let t=this._reactiveRecovery;t&&(this._reactiveRecovery=void 0,this._reactiveRecoveryFailure=void 0,this._reactiveContinuationFailed=!1,t.resolve())}_rejectReactiveRecovery(t){let n=this._reactiveRecovery;n&&(this._reactiveRecovery=void 0,this._reactiveRecoveryFailure=void 0,this._reactiveContinuationFailed=!1,n.reject(t))}_recordReactiveRecoveryFailure(t){this._reactiveRecovery&&!this._reactiveRecoveryFailure&&(this._reactiveRecoveryFailure=new Error(t))}_resolveRetry(){this._retryResolve&&(this._retryResolve(),this._retryResolve=void 0,this._retryPromise=void 0,qs("retry_resolved",this.recoveryDiagnosticState))}_findLastAssistantMessage(){let t=this.agent.state.messages;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.role==="assistant")return r}}async _emitExtensionEvent(t){if(this._extensionRunner){if(t.type==="agent_start")this._turnIndex=0,await this._extensionRunner.emit({type:"agent_start"});else if(t.type==="agent_end"){let n=this._lastAssistantMessage;await this._extensionRunner.emit({type:"agent_end",messages:t.messages,willRetry:n!==void 0&&(this._willAttemptAutomaticRetryAfterAgentEnd(n)||this._willRetryAfterAgentEnd(n))})}else if(t.type==="turn_start"){let n={type:"turn_start",turnIndex:this._turnIndex,timestamp:Date.now()};await this._extensionRunner.emit(n)}else if(t.type==="turn_end"){let n={type:"turn_end",turnIndex:this._turnIndex,message:t.message,toolResults:t.toolResults};await this._extensionRunner.emit(n),this._turnIndex++}else if(t.type==="message_start"){let n={type:"message_start",message:t.message};await this._extensionRunner.emit(n)}else if(t.type==="message_update"){let n={type:"message_update",message:t.message,assistantMessageEvent:t.assistantMessageEvent};await this._extensionRunner.emit(n)}else if(t.type==="message_end"){let n={type:"message_end",message:t.message};await this._extensionRunner.emit(n)}else if(t.type==="tool_execution_start"){let n={type:"tool_execution_start",toolCallId:t.toolCallId,toolName:t.toolName,args:t.args};await this._extensionRunner.emit(n)}else if(t.type==="tool_execution_update"){let n={type:"tool_execution_update",toolCallId:t.toolCallId,toolName:t.toolName,args:t.args,partialResult:t.partialResult};await this._extensionRunner.emit(n)}else if(t.type==="tool_execution_end"){let n={type:"tool_execution_end",toolCallId:t.toolCallId,toolName:t.toolName,result:t.result,isError:t.isError};await this._extensionRunner.emit(n)}}}subscribe(t){return this._eventListeners.push(t),()=>{let n=this._eventListeners.indexOf(t);n!==-1&&this._eventListeners.splice(n,1)}}_disconnectFromAgent(){this._unsubscribeAgent&&(this._unsubscribeAgent(),this._unsubscribeAgent=void 0)}_reconnectToAgent(){this._unsubscribeAgent||(this._unsubscribeAgent=this.agent.subscribe(this._handleAgentEvent))}async dispose(){this.closeDetachedCompletions();try{(this._proactiveCompactionReadiness||this._reactiveRecovery)&&await this.waitForAutomaticCompaction()}catch{}finally{this._diagnosticDisposed=!0,qs("session_dispose",this.recoveryDiagnosticState),this._disconnectFromAgent(),this._unsubscribeResourceChanges?.(),this._unsubscribeResourceChanges=void 0,this._unsubscribeSubagentUsage?.(),this._unsubscribeSubagentUsage=void 0,this._eventListeners=[]}}async waitForAutomaticCompaction(){for(;this._proactiveCompactionReadiness||this._reactiveRecovery;)await Promise.all([this._proactiveCompactionReadiness?.promise,this._reactiveRecovery?.promise])}_getSubagentTokens(){let t=0;for(let n of this.sessionManager.getBranch())if(n.type==="custom"&&n.customType===m4r){let r=n.data;t+=r?.total??0}return t}async generateSessionName(t){let n=EZo(t),r=this.model;if(!(n&&r))return n;try{let i=await this._getRequiredRequestAuth(r),s=`Write a concise session title for the user message below.
11413
11413
  Use a topic-first noun phrase in Title Case, without action verbs like Investigate, Fix, or Validate. Use at most 6 words, excluding any ticket prefix.
@@ -11447,7 +11447,7 @@ Current working directory: ${e.fallbackCwd}`}function X6e(e){return`cwd from ses
11447
11447
  ${e.sessionCwd}
11448
11448
 
11449
11449
  continue in current cwd
11450
- ${e.fallbackCwd}`}function j6(e,t){let n=RUt(e,t);if(n)throw new j9(n)}var j9,wbe=C(()=>{"use strict";j9=class extends Error{issue;constructor(t){super(Gjo(t)),this.name="MissingSessionCwdError",this.issue=t}}});function oVr(e){let{reporter:t,sessionId:n,getRequestId:r}=e;return i=>{if(i.type==="tool_execution_start"){t.toolStarted(n,{toolCallId:i.toolCallId,toolName:i.toolName,args:i.args});return}i.type==="tool_execution_end"&&t.toolEnded(n,{toolCallId:i.toolCallId,toolName:i.toolName,result:i.result,isError:i.isError,requestId:r()})}}var aVr=C(()=>{"use strict"});function lVr(e){return{total_history_char_count:0,total_history_exchange_count:0,head_char_count:0,head_exchange_count:0,head_last_request_id:"",tail_char_count:0,tail_exchange_count:0,tail_last_request_id:"",summary_char_count:e.summaryCharCount,summarization_duration_ms:e.durationMs??0,is_cache_about_to_expire:!1,is_aborted:e.aborted??!1,total_history_token_count:e.tokensBefore,head_token_count:e.tokensBefore,tail_token_count:e.tokensAfter??0,tokens_from_backend:!1}}function cVr(e,t){if(e.truncated)return{original_char_count:e.totalBytes,original_line_count:e.totalLines,truncated_char_count:e.outputBytes,truncated_line_count:e.outputLines,tool_type:t}}function uVr(e){let{source:t,scope:n}=e.sourceInfo;return n==="user"||n==="project"?n:t}function dVr(e){let t=e.filter(n=>!n.disableModelInvocation);if(t.length!==0)return{skills:t.map(n=>({skill_name:n.name,skill_source:uVr(n)})),skill_count:t.length}}function pVr(e,t,n){return{skill_name:e.name,skill_source:uVr(e),content_length:t,source_tool:n}}function mVr(e,t){return{retrieval_mode:t?.retrievalMode??"codebase_only",total_elapsed_ms:ku(e.totalElapsedMs),api_call_elapsed_ms:ku(e.apiCallElapsedMs),rerank_elapsed_ms:ku(e.rerankElapsedMs),enrich_elapsed_ms:ku(e.enrichElapsedMs),codebase_retrieval_elapsed_ms:ku(e.codebaseRetrievalElapsedMs),conversation_retrieval_elapsed_ms:ku(e.conversationRetrievalElapsedMs),conversation_initial_retrieval_ms:ku(e.conversationInitialRetrievalMs),conversation_query_rewriting_ms:ku(e.conversationQueryRewritingMs),conversation_followup_retrieval_ms:ku(e.conversationFollowupRetrievalMs),blob_name_lookup_ms:ku(e.blobNameLookupMs),codebase_chunks_retrieved:ku(e.codebaseChunksRetrieved),conversation_chunks_initial:ku(e.conversationChunksInitial),conversation_queries_generated:ku(e.conversationQueriesGenerated),conversation_chunks_followup:ku(e.conversationChunksFollowup),conversation_chunks_combined:ku(e.conversationChunksCombined),conversation_chunks_after_rerank:ku(e.conversationChunksAfterRerank),codebase_result_len_pre_truncation:ku(e.codebaseResultLenPreTruncation),codebase_result_len:ku(e.codebaseResultLen),conversation_result_len_pre_truncation:ku(e.conversationResultLenPreTruncation),conversation_result_len:ku(e.conversationResultLen),combined_result_len:ku(e.combinedResultLen),total_budget:ku(e.totalBudget),codebase_budget:ku(e.codebaseBudget),conversation_budget:ku(e.conversationBudget),codebase_truncated:q6e(e.codebaseTruncated),conversation_truncated:q6e(e.conversationTruncated),final_truncated:q6e(e.finalTruncated),is_sub_agent:q6e(t?.isSubAgent)}}var ku,q6e,fVr=C(()=>{"use strict";ku=e=>e??0,q6e=e=>e??!1});import{randomUUID as Wjo}from"node:crypto";function Hjo(e){if(typeof e!="object"||e===null)return;let t=e.details;if(!(typeof t!="object"||t===null))return t}function Yjo(e,t){if(e===t)return!0;if(!([...t].some(i=>hVr.has(i))&&e.endsWith(t)))return!1;let r=e.at(-t.length-1);return r!==void 0&&hVr.has(r)}function Zjo(e,t){return t.find(n=>Yjo(n.filePath,e))}function gVr(e){let t=new NUt(e);return n=>t.handle(n)}function jjo(e){if(typeof e!="object"||e===null)return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function bVr(e){let t=dVr(e.skills);t&&e.reporter.skillsIncludedInChat(e.sessionId,t)}var $jo,Qjo,hVr,NUt,yVr=C(()=>{"use strict";fVr();$jo={"codebase-retrieval":"codebase_only","session-retrieval":"conversation_only"},Qjo={read:"read","web-fetch":"web-fetch",bash:"bash"};hVr=new Set(["/","\\"]);NUt=class{readPathsByCallId=new Map;pendingCompactionChatHistoryLength;options;constructor(t){this.options=t}handle(t){if(t.type==="compaction_start"){this.pendingCompactionChatHistoryLength=this.options.getChatHistoryLength?.();return}if(t.type==="compaction_end"){this.emitCompaction(t);return}if(t.type==="tool_execution_start"){this.rememberReadPath(t);return}if(t.type!=="tool_execution_end")return;let n=this.readPathsByCallId.get(t.toolCallId);if(this.readPathsByCallId.delete(t.toolCallId),t.isError)return;let r=Hjo(t.result);this.emitTruncation(t.toolName,r),this.emitRetrieval(t.toolName,r),this.emitSkillContent(t.toolName,n,t.result)}emitCompaction(t){let n=this.pendingCompactionChatHistoryLength??0;this.pendingCompactionChatHistoryLength=void 0,!(t.aborted||!t.result)&&this.options.reporter.chatHistorySummarization(this.options.sessionId,Wjo(),n,lVr({summaryCharCount:t.result.summary.length,tokensBefore:t.result.tokensBefore,tokensAfter:t.tokensAfter,durationMs:t.durationMs,aborted:!1}))}rememberReadPath(t){if(t.toolName!=="read")return;let n=t.args?.path;typeof n=="string"&&this.readPathsByCallId.set(t.toolCallId,n)}emitTruncation(t,n){let r=Qjo[t];if(!(r&&n?.truncation))return;let i=cVr(n.truncation,r);i&&this.options.reporter.contentTruncation(this.options.sessionId,i)}emitRetrieval(t,n){let r=$jo[t];r&&n?.analytics&&this.options.reporter.retrievalToolUsed(this.options.sessionId,mVr(n.analytics,{retrievalMode:r}))}emitSkillContent(t,n,r){if(t!=="read"||!n)return;let i=Zjo(n,this.options.getSkills());i&&this.options.reporter.skillContentLoaded(this.options.sessionId,pVr(i,jjo(r),"read"))}}});function AVr(e){return e==="8"?{kind:"mode-disabled",message:zjo}:{kind:"generic"}}var zjo,kUt=C(()=>{"use strict";zjo="CLI mode access has been disabled for your account. If you believe this to be an error, please contact your administrator."});function OUt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K6e(e,...t){for(let n of t){let r=e[n];if(OUt(r))return r}}function z6(e,...t){for(let n of t){let r=e[n];if(typeof r=="string")return r}}function Kjo(e){if(typeof e=="string")return e.trim().length>0?{kind:"text",text:e}:null;if(!OUt(e))return null;let t=OUt(e.block)?e.block:e,n=K6e(t,"text","Text");if(n){let o=z6(n,"text");if(o!==void 0&&o.trim().length>0)return{kind:"text",text:o}}let r=K6e(t,"tool_use","toolUse","ToolUse");if(r){let o=z6(r,"id"),a=z6(r,"name");if(!o||!a)return null;let l=z6(r,"input");return{kind:"tool_use",toolUseId:o,toolName:a,inputJson:l&&l.trim().length>0?l:"{}"}}let i=K6e(t,"tool_result","toolResult","ToolResult");if(i){let o=z6(i,"tool_use_id","toolUseId");if(!o)return null;let a=i.is_error??i.isError;return{kind:"tool_result",toolUseId:o,content:z6(i,"content")??"",isError:typeof a=="boolean"?a:!1}}let s=K6e(t,"thinking","Thinking");if(s){let o=z6(s,"content");if(o!==void 0)return{kind:"thinking",content:o}}return null}function EVr(e){if(!Array.isArray(e.content))return[];let t=[];for(let n of e.content){let r=Kjo(n);r!==null&&t.push(r)}return t}function Jjo(e){let t=[],n=[];for(let r of e)if(r.kind==="text"){if(r.text.trim().length===0)continue;n.push(r.text),t.push({type:C6e,text_node:{content:r.text}})}else r.kind==="tool_result"&&t.push({type:M5t,tool_result_node:{content:r.content,is_error:r.isError}});return{requestNodes:t,requestText:n.join("")}}function ezo(e){let t=[],n=[],r=[],i=()=>{if(r.length===0)return;let s=r.join("");r.length=0,s.trim().length!==0&&t.push({type:T6e,content:s})};for(let s of e)if(s.kind==="text"){if(s.text.trim().length===0)continue;n.push(s.text),r.push(s.text)}else s.kind==="tool_use"?(i(),t.push({type:P5t,content:"",tool_use:{tool_name:s.toolName,input_json:s.inputJson}})):s.kind==="thinking"&&(i(),t.push({type:D5t,content:s.content,thinking:{content:s.content}}));return i(),{responseNodes:t,responseText:n.join("")}}function tzo(e){let t=[];for(let n of e)if(n.role==="user")t.push({user:n,assistants:[]});else if(n.role==="assistant"){let r=t.at(-1);r?r.assistants.push(n):t.push({assistants:[n]})}return t.map(({user:n,assistants:r})=>{let{requestNodes:i,requestText:s}=Jjo(n?EVr(n):[]),{responseNodes:o,responseText:a}=ezo(r.flatMap(EVr));return{request_message:s,response_text:a,request_id:n?.id??r[0]?.id??"",request_nodes:i,response_nodes:o}})}async function nzo(e){let t=await e.fetchImpl(`${e.baseUrl}cloud-agents/agents/get-messages`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`,...e.userAgent?{"User-Agent":e.userAgent}:{}},body:JSON.stringify({agent_id:e.agentId,limit:Xjo,...e.beforeTimestamp?{before_timestamp:e.beforeTimestamp}:{}})});if(!t.ok)throw new Error(`Fetching cloud-agent chat history failed: ${t.status} ${t.statusText}`);return await t.json()}async function rzo(e){let t=new Set,n=[],r;for(let o=0;o<qjo;o++){let a=await nzo({...e,beforeTimestamp:r}),l=Array.isArray(a.messages)?a.messages:[];n.push(l);let u=izo(l,t),c=a.oldest_timestamp;if(a.has_next!==!0||l.length===0||!c||u===0)break;r=c}let i=new Set,s=[];for(let o=n.length-1;o>=0;o--)for(let a of n[o]){let l=a.id;if(l!==void 0){if(i.has(l))continue;i.add(l)}s.push(a)}return s}function izo(e,t){let n=0;for(let r of e)(r.id===void 0||!t.has(r.id))&&n++,r.id!==void 0&&t.add(r.id);return n}function MUt(e){let t=e.fetchImpl??globalThis.fetch.bind(globalThis);return async n=>{let r=await e.readCredentials();if(!r)throw new Error("view-session requires an Augment login. Please sign in and try again.");let i=r.apiUrl.endsWith("/")?r.apiUrl:`${r.apiUrl}/`,s=await rzo({fetchImpl:t,baseUrl:i,apiKey:r.apiKey,userAgent:e.userAgent,agentId:n});return tzo(s)}}var Xjo,qjo,_Vr=C(()=>{"use strict";R6e();Xjo=400,qjo=200});import{delimiter as ozo,isAbsolute as PUt,join as azo,resolve as Rbe}from"node:path";function lzo(e){return e.map(t=>{if(t.type!=="message")return{type:t.type,id:t.id,parentId:t.parentId};let n=t.message,r=typeof n.content=="string"?n.content:n.content.map(i=>({type:i.type,text:"text"in i?i.text:void 0}));return{type:t.type,id:t.id,parentId:t.parentId,message:{role:n.role,content:r,timestamp:n.timestamp}}})}function czo(e){if(e instanceof Error){let t=e;return typeof t.status=="number"?String(t.status):typeof t.httpStatus=="number"?String(t.httpStatus):e.message}return String(e)}function uzo(e,t){let n=czo(e);if(n!=="8"){let r=e instanceof Error?e.message:String(e);t.push({type:"error",message:`Failed to fetch feature flags: ${r}`})}return{flags:xE(void 0),errorStatus:n}}function dzo(e,t,n){if(e.allowClientFeatureFlagOverrides!==!0)return e;let r=t.getFeatureFlagOverrides();if(!r)return e;try{let i=cFr(r);return uFr(e,i)}catch(i){let s=i instanceof Error?i.message:String(i);return n.push({type:"warning",message:`Failed to parse feature flag overrides, ignoring them: ${s}`}),e}}function pzo(e){return e.cosmosMultiRepoContextEnabled===!0}function mzo(e){return e.cosmosNestedAgentsMdEnabled===!0}function fzo(e,t,n){return e===void 0?void 0:{tenantUrl:e,userId:t,userEmail:n}}function hzo(e){return typeof e=="object"&&e!==null&&"workspacePath"in e&&"sourceWorkspacePath"in e&&"repositoryRoot"in e&&typeof e.workspacePath=="string"&&typeof e.sourceWorkspacePath=="string"&&typeof e.repositoryRoot=="string"&&PUt(e.workspacePath)&&PUt(e.sourceWorkspacePath)&&PUt(e.repositoryRoot)}function gzo(e,t){if(!e)return[];try{let n=JSON.parse(process.env.AUGMENT_DAEMON_INDEXING_WORKSPACES??"[]");if(!Array.isArray(n))return[];let r=new Map;for(let i of n){if(!hzo(i))continue;let s=Rbe(i.workspacePath);t.has(s)&&r.set(s,{sourceWorkspacePath:Rbe(i.sourceWorkspacePath),repositoryRoot:Rbe(i.repositoryRoot)})}return[...r].map(([i,s])=>({workspacePath:i,...s}))}catch{return[]}}function bzo(e,t,n){let{allowDirs:r,denyDirs:i}=t.getIndexingDirsUnion(),s=n?.get("parent-daemon-id"),o=typeof s=="string"&&s.length>0,a=n?.get("cloud-agent"),l=typeof a=="string"&&a.length>0,u=o&&l,c=new Set([Rbe(e)]),d=n?.get("add-workspace");if(typeof d=="string")for(let m of d.split(ozo))m.length>0&&c.add(Rbe(m));let p=gzo(u,c);return{allowDirs:r,denyDirs:i,daemonChild:u,allowIndexingFlag:n?.get("allow-indexing")===!0,repositoryRoots:p}}function yzo(e,t){if(!t)return[];let n=[],r=e.getExtensions(),i=new Map;for(let o of r.extensions)for(let[a,l]of o.flags)i.set(a,{type:l.type});let s=[];for(let[o,a]of t){let l=i.get(o);if(!l){s.push(o);continue}if(l.type==="boolean"){r.runtime.flagValues.set(o,!0);continue}if(typeof a=="string"){r.runtime.flagValues.set(o,a);continue}n.push({type:"error",message:`Extension flag "--${o}" requires a value`})}return s.length>0&&n.push({type:"error",message:`Unknown option${s.length===1?"":"s"}: ${s.map(o=>`--${o}`).join(", ")}`}),n}function Azo(e){return e.prefetchedAugment?Promise.resolve(e.prefetchedAugment.modelConfig):e.augmentApiPromise?.then(t=>t.getModelConfig())}async function Ezo({options:e,modelRegistry:t,augmentUserAgent:n}){if(e.resourceDiscoveryOnly)return{augmentCredentials:null,augmentApiPromise:void 0,modelConfigPromise:void 0};let r=e.prefetchedAugment?.credentials??await Kc(),i=r?rl(r.apiKey,r.apiUrl,n):void 0,s=Azo({prefetchedAugment:e.prefetchedAugment,augmentApiPromise:i});return await t.discoverAugmentModels(n,{credentials:r,modelConfig:s}),{augmentCredentials:r,augmentApiPromise:i,modelConfigPromise:s}}async function Nbe(e){let t=e.cwd,n=e.agentDir??nr(),r=e.authStorage??Jx.create(azo(n,"auth.json")),i=e.settingsManager??gi.create(t,n),s=e.modelRegistry??P9.empty(r),o=e.augmentUserAgent??yf(),{augmentCredentials:a,augmentApiPromise:l,modelConfigPromise:u}=await Ezo({options:e,modelRegistry:s,augmentUserAgent:o}),c=O9(),d={};c.on("conversation:identity",y=>{typeof y=="object"&&y!==null&&"conversationId"in y&&(typeof y.conversationId=="string"||y.conversationId===void 0)&&(d.conversationId=y.conversationId)}),u5r(c);let p=[],m,f={flags:xE(void 0)},h,g;if(l&&u)try{m=await l;let y=await u;h=y.user?.id,g=y.user?.email,j6e({id:h,email:g});let S=xE(y.featureFlagsV2);f={flags:dzo(S,i,p)}}catch(y){f=uzo(y,p)}let b=new $w({...e.resourceLoaderOptions??{},readOnlyPackages:e.resourceDiscoveryOnly||e.resourceLoaderOptions?.readOnlyPackages,cwd:t,agentDir:n,settingsManager:i,eventBus:c,multiRepoContextEnabled:pzo(f.flags),nestedContextDescentEnabled:mzo(f.flags)});await b.reload(),a&&m&&(c.emit("augment:api",m),c.emit("augment:credentials",{apiKey:a.apiKey,apiUrl:a.apiUrl,userAgent:o,userId:h,email:g,cliVersion:Ws}));let A=b.getExtensions();for(let{name:y,config:S,extensionPath:_}of A.runtime.pendingProviderRegistrations)try{s.registerProvider(y,S)}catch(x){let v=x instanceof Error?x.message:String(x);p.push({type:"error",message:`Extension "${_}" error: ${v}`})}return A.runtime.pendingProviderRegistrations=[],p.push(...yzo(b,e.extensionFlagValues)),c.emit("augment:indexing-policy",bzo(t,i,e.extensionFlagValues)),c.emit("augment:feature-flags",f),c.emit("augment:feature-flags-startup-complete",void 0),{cwd:t,agentDir:n,conversationIdentity:d,pluginDirs:e.pluginDirs,mcpConfigOverride:e.mcpConfigOverride,permissionOverride:e.permissionOverride,authStorage:r,settingsManager:i,modelRegistry:s,resourceLoader:b,diagnostics:p,augmentUserAgent:o,augmentApi:m,augmentAccount:fzo(a?.apiUrl,h,g),featureFlags:f}}function kbe(e){let t=e.services.augmentApi,n=t?{viewSession:{operations:{fetchChatHistory:B5t({readCredentials:Kc,userAgent:e.services.augmentUserAgent}),fetchCloudAgentChatHistory:MUt({readCredentials:Kc,userAgent:e.services.augmentUserAgent})}},sessionRetrieval:{operations:{createRequestId:t.createRequestId.bind(t),agentCodebaseRetrieval:t.agentCodebaseRetrieval.bind(t),fetchCloudAgentChatHistory:MUt({readCredentials:Kc,userAgent:e.services.augmentUserAgent}),fetchChatHistory:B5t({readCredentials:Kc,userAgent:e.services.augmentUserAgent}),getBranch:()=>lzo(e.sessionManager.getBranch())}}}:void 0;return GJ({cwd:e.services.cwd,agentDir:e.services.agentDir,authStorage:e.services.authStorage,settingsManager:e.services.settingsManager,modelRegistry:e.services.modelRegistry,augmentUserAgent:e.services.augmentUserAgent,resourceLoader:e.services.resourceLoader,sessionManager:e.sessionManager,model:e.model,thinkingLevel:e.thinkingLevel,scopedModels:e.scopedModels,tools:e.tools,customTools:e.customTools,removedTools:e.removedTools,sessionStartEvent:e.sessionStartEvent,toolsOptions:{...n,bash:e.bashOptions},featureFlags:e.services.featureFlags.flags,pluginDirs:e.services.pluginDirs,mcpConfigOverride:e.services.mcpConfigOverride,permissionOverride:e.services.permissionOverride})}var DUt=C(()=>{"use strict";Bi();Ol();kUt();$s();Z6();wh();vbe();wge();h6();Qge();Af();ebe();BUt();_Vr();L5t()});import{copyFileSync as _zo,existsSync as SVr,mkdirSync as Szo}from"node:fs";import{basename as vzo,join as xzo,resolve as vVr}from"node:path";function Czo(e){return typeof e=="string"?e:e.filter(t=>t.type==="text"&&typeof t.text=="string").map(t=>t.text).join("")}async function J6e(e,t){j6(t.sessionManager,t.cwd);let n=await e(t);return process.cwd()!==n.services.cwd&&process.chdir(n.services.cwd),new Obe(n.session,n.services,e,n.diagnostics,n.modelFallbackMessage,t.usageReporter,t.toolUseReporter,t.enableSentrySummarizationSpans,t.backgroundBashEligible)}var Obe,LUt=C(()=>{"use strict";W6e();Z6();kge();b1();wbe();vE();aVr();yVr();DUt();Obe=class{backgroundBashEligible;lifecycleListeners=new Set;subscribeLifecycle(t){return this.lifecycleListeners.add(t),()=>this.lifecycleListeners.delete(t)}async emitLifecycle(t){for(let n of this.lifecycleListeners)await n(t)}_session;_services;createRuntime;_diagnostics;_modelFallbackMessage;_usageReporter;_toolUseReporter;enableSentrySummarizationSpans;_usageUnsubscribe;_summarizationUnsubscribe;_summarizationSubscriber;constructor(t,n,r,i=[],s,o,a,l=!1,u=!1){this.backgroundBashEligible=u,this._session=t,this._services=n,this.createRuntime=r,this._diagnostics=i,this._modelFallbackMessage=s,this._usageReporter=o,this._toolUseReporter=a,this.enableSentrySummarizationSpans=l,this.attachUsageReporter(),this.attachSummarizationTracer()}attachUsageReporter(){let t=this._usageReporter,n=this._toolUseReporter;if(!(t||n))return;let r=this._session,i=r.sessionId,s=t?gVr({reporter:t,sessionId:i,getSkills:()=>this._services.resourceLoader.getSkills().skills,getChatHistoryLength:()=>r.sessionManager.getBranch().length}):void 0;t&&(t.sessionStarted(i),bVr({reporter:t,sessionId:i,skills:this._services.resourceLoader.getSkills().skills}));let o=n?oVr({reporter:n,sessionId:i,getRequestId:()=>r.currentRequestId}):void 0;this._usageUnsubscribe=r.subscribe(a=>{t&&a.type==="message_start"&&Zb(a.message.role)&&t.userMessageSent(i),s?.(a),o?.(a)})}setAugmentAccount(t){this._services.augmentAccount=t,t?.userId||t?.userEmail?j6e({id:t.userId,email:t.userEmail}):eVr()}attachSummarizationTracer(){if(!this.enableSentrySummarizationSpans)return;let t=x4r();this._summarizationSubscriber=t,this._summarizationUnsubscribe=this._session.subscribe(t.handle)}detachSummarizationTracer(){this._summarizationUnsubscribe?.(),this._summarizationUnsubscribe=void 0,this._summarizationSubscriber?.dispose(),this._summarizationSubscriber=void 0}detachUsageReporter(){let t=this._usageReporter,n=this._toolUseReporter;(t||n)&&(this._usageUnsubscribe?.(),this._usageUnsubscribe=void 0,t?.sessionEnded(this._session.sessionId))}get services(){return this._services}get session(){return this._session}get cwd(){return this._services.cwd}get diagnostics(){return this._diagnostics}get modelFallbackMessage(){return this._modelFallbackMessage}async emitBeforeSwitch(t,n){let r=this.session.extensionRunner;return r?.hasHandlers("session_before_switch")?{cancelled:(await r.emit({type:"session_before_switch",reason:t,targetSessionFile:n}))?.cancel===!0}:{cancelled:!1}}async emitBeforeFork(t){let n=this.session.extensionRunner;return n?.hasHandlers("session_before_fork")?{cancelled:(await n.emit({type:"session_before_fork",entryId:t}))?.cancel===!0}:{cancelled:!1}}async teardownCurrent(){this.session.closeDetachedCompletions(),await this.emitLifecycle("closing"),await this.session.waitForAutomaticCompaction().catch(()=>{}),this.detachUsageReporter(),this.detachSummarizationTracer(),await Nge(this.session.extensionRunner),await this.session.dispose()}async apply(t){process.cwd()!==t.services.cwd&&process.chdir(t.services.cwd),this._session=t.session,this._services=t.services,this._diagnostics=t.diagnostics,this._modelFallbackMessage=t.modelFallbackMessage,this.attachUsageReporter(),this.attachSummarizationTracer(),await this.emitLifecycle("activated")}switchSession(t,n){return this.session.withHistoryAdmission(()=>this.switchSessionWithAdmission(t,n))}async switchSessionWithAdmission(t,n){let r=await this.emitBeforeSwitch("resume",t);if(r.cancelled)return r;let i=this.session.sessionFile,s=ds.open(t,void 0,n);return j6(s,this.cwd),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:s.getCwd(),agentDir:this.services.agentDir,sessionManager:s,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:i}})),{cancelled:!1}}newSession(t){return this.session.withHistoryAdmission(()=>this.newSessionWithAdmission(t))}async newSessionWithAdmission(t){let n=await this.emitBeforeSwitch("new");if(n.cancelled)return n;let r=t?.cwd??this.cwd,i=this.session.sessionFile,s=this.session.sessionManager.getSessionDir(),o=ds.create(r,s);return t?.parentSession&&o.newSession({parentSession:t.parentSession}),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:r,agentDir:this.services.agentDir,sessionManager:o,sessionStartEvent:{type:"session_start",reason:"new",previousSessionFile:i}})),t?.setup&&(await t.setup(this.session.sessionManager),this.session.agent.state.messages=this.session.sessionManager.buildSessionContext().messages),{cancelled:!1}}fork(t){return this.session.withHistoryAdmission(()=>this.forkWithAdmission(t))}async forkWithAdmission(t){if((await this.emitBeforeFork(t)).cancelled)return{cancelled:!0};let r=this.session.sessionManager.getEntry(t);if(!r||r.type!=="message")throw new Error("Invalid entry ID for forking");let i=r.message,s;if(i.role==="user")s=Czo(i.content);else if(i.role==="promptCommandInvocation")s=Ih(i);else throw new Error("Invalid entry ID for forking");let o=this.session.sessionFile;if(this.session.sessionManager.isPersisted()){let l=this.session.sessionFile;if(!l)throw new Error("Persisted session is missing a session file");let u=this.session.sessionManager.getSessionDir();if(!r.parentId){let m=ds.create(this.cwd,u);return m.newSession({parentSession:l}),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:m,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let d=ds.open(l,u).createBranchedSession(r.parentId);if(!d)throw new Error("Failed to create forked session");let p=ds.open(d,u);return await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:p.getCwd(),agentDir:this.services.agentDir,sessionManager:p,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let a=this.session.sessionManager;return await this.teardownCurrent(),r.parentId?a.createBranchedSession(r.parentId):a.newSession({parentSession:this.session.sessionFile}),await this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:a,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}importFromJsonl(t,n){return this.session.withHistoryAdmission(()=>this.importWithAdmission(t,n))}async importWithAdmission(t,n){let r=vVr(t);if(!SVr(r))throw new Error(`File not found: ${r}`);let i=this.session.sessionManager.getSessionDir();SVr(i)||Szo(i,{recursive:!0});let s=xzo(i,vzo(r)),o=await this.emitBeforeSwitch("resume",s);if(o.cancelled)return o;let a=this.session.sessionFile;vVr(s)!==r&&_zo(r,s);let l=ds.open(s,i,n);return j6(l,this.cwd),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:l.getCwd(),agentDir:this.services.agentDir,sessionManager:l,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:a}})),{cancelled:!1}}async dispose(){this.session.closeDetachedCompletions(),await this.emitLifecycle("shutdown"),await this.session.waitForAutomaticCompaction().catch(()=>{}),this.detachUsageReporter(),this.detachSummarizationTracer(),await Nge(this.session.extensionRunner),await this.session.dispose(),await Promise.all([this._usageReporter?.flush(),this._toolUseReporter?.flush()])}}});import{join as xVr}from"node:path";function Tzo(){return nr()}async function GJ(e={}){let t=e.cwd??process.cwd(),n=e.agentDir??Tzo(),r=e.resourceLoader,i=e.agentDir?xVr(n,"auth.json"):void 0,s=e.agentDir?xVr(n,"models.json"):void 0,o=e.authStorage??Jx.create(i),a=e.modelRegistry??P9.create(o,s),l=e.settingsManager??gi.create(t,n),u=e.sessionManager??ds.create(t,y1(t,n));r||(r=new $w({cwd:t,agentDir:n,settingsManager:l}),await r.reload(),TE("resourceLoader.reload"));let c=u.buildSessionContext(),d=c.messages.length>0,p=u.getBranch().some(L=>L.type==="thinking_level_change"),m=e.model;if(m&&!jx(m))throw new Error(`Unsupported model: ${m.provider}/${m.id}`);let f;if(!m&&d&&c.model){let L=a.findSupported(c.model.provider,c.model.modelId);if(L&&a.hasConfiguredAuth(L)&&(m=L),!m&&!L){let F=a.findDeprecatedModelUpgrade(c.model.provider,c.model.modelId);F&&a.hasConfiguredAuth(F)&&(m=F,f=`Model ${c.model.provider}/${c.model.modelId} is retired. Using ${F.provider}/${F.id}`)}m||(f=`Could not restore model ${c.model.provider}/${c.model.modelId}`)}m||(m=(await QFr({scopedModels:[],isContinuing:d,defaultModelId:l.getDefaultModel(),defaultThinkingLevel:l.getDefaultThinkingLevel(),modelRegistry:a})).model,m?f&&(f+=`. Using ${m.provider}/${m.id}`):f="Auggie couldn't load an available model. Restart Auggie to try again. If the problem continues, contact support.");let h=e.thinkingLevel,g=h==="default";h===void 0&&d&&(h=p?c.thinkingLevel:l.getDefaultThinkingLevel()??nO,g=p?c.usesModelDefault:!1);let b;h===void 0&&m&&(m.api==="augment-chat-stream"?(b=dUt(l)[B6e(m)],h=b,g=b===void 0):h=l.getDefaultThinkingLevel()??nO);let A=ss(m,g?"default":h);!A.valid&&m&&h&&(console.warn(rm(m,h)),b!==void 0&&PJ(l,m,void 0));let y=A.effort,S=A.usesModelDefault,_=["read","bash","edit","write","web-fetch","view-session"],x=new Set((e.removedTools??[]).flatMap(bd)),v=(e.tools?e.tools.map(L=>L.name).filter(L=>L in Hw):_).filter(L=>!x.has(L)),w,T=e.augmentUserAgent??"",P=L=>{let F=I9(L);return l.getBlockImages()?F.map(H=>{if(H.role==="user"||H.role==="toolResult"){let U=H.content;if(Array.isArray(U)&&U.some(ie=>ie.type==="image")){let ie=U.map(ne=>ne.type==="image"?{type:"text",text:"Image reading is disabled."}:ne).filter((ne,ue,le)=>!(ne.type==="text"&&ne.text==="Image reading is disabled."&&ue>0&&le[ue-1].type==="text"&&le[ue-1].text==="Image reading is disabled."));return{...H,content:ie}}}return H}):F},O={},D=L=>async(F,H,U)=>{let J=await a.getApiKeyAndHeaders(F);if(!J.ok)throw new Error(J.error);if(U?.signal?.aborted)throw new Error("Request cancelled");let ie={...U,apiKey:J.apiKey,headers:J.headers||U?.headers?{...J.headers,...U?.headers}:void 0};return F.api==="augment-chat-stream"?GY({...F,baseUrl:J.baseUrl??F.baseUrl},{...H,systemPrompt:U?.silent||U?.silentType!==void 0?void 0:L()},{...ie,userAgent:T}):QT(F,H,ie)};w=new iG({initialState:{systemPrompt:"",model:m,thinkingLevel:y,usesModelDefault:S,tools:[]},convertToLlm:P,streamFn:D(()=>r.getExplicitSystemPrompt?.()),onPayload:(L,F)=>{let H=O.current;return H?.hasHandlers("before_provider_request")?H.emitBeforeProviderRequest(L):L},sessionId:u.getSessionId(),transformContext:L=>{let F=O.current;return F?F.emitContext(L):Promise.resolve(L)},steeringMode:l.getSteeringMode(),followUpMode:l.getFollowUpMode(),transport:l.getTransport(),thinkingBudgets:l.getThinkingBudgets(),maxRetryDelayMs:l.getRetrySettings().maxDelayMs}),d?(w.state.messages=c.messages,p||u.appendThinkingLevelChange(y,S),m&&(!u.getBranch().some(L=>L.type==="model_change")||m.provider!==c.model?.provider||m.id!==c.model?.modelId)&&u.appendModelChange(m.provider,m.id)):(m&&u.appendModelChange(m.provider,m.id),u.appendThinkingLevelChange(y,S)),m?.api==="augment-chat-stream"&&e.thinkingLevel!==void 0&&PJ(l,m,S?void 0:y);let k=new DJ({prepareDetachedStream:()=>{let L=r.getExplicitSystemPrompt?.();return D(()=>L)},agent:w,sessionManager:u,settingsManager:l,cwd:t,agentDir:n,pluginDirs:e.pluginDirs,mcpConfigOverride:e.mcpConfigOverride,permissionOverride:e.permissionOverride,scopedModels:e.scopedModels,resourceLoader:r,customTools:e.customTools,toolsOptions:e.toolsOptions,modelRegistry:a,initialActiveToolNames:v,removedTools:e.removedTools,extensionRunnerRef:O,sessionStartEvent:e.sessionStartEvent,featureFlags:e.featureFlags,role:e.role}),M=r.getExtensions();return{session:k,extensionsResult:M,modelFallbackMessage:f}}var BUt=C(()=>{"use strict";ude();Bi();Ol();$s();L6e();vbe();gFt();b1();Af();aJ();ebe();vE();AUt();H9();LUt();H9()});function TVr(e){return FUt[e]}function IVr(e){return e==="user"?"global":e}function wVr(e){return e==="global"?"user":e}function RVr(e){let{files:t,alwaysShowPicker:n}=e;if(n&&t.length>=2)return{files:t};let r=t.filter(i=>i.exists);return r.length===0?{directTarget:"user"}:r.length===1?{directTarget:r[0].target}:{files:t}}var CVr,FUt,NVr=C(()=>{"use strict";CVr=["local","project","user"],FUt={user:"User settings (global)",project:"Project settings (shared)",local:"Local settings (personal)"}});function Rzo(e){if(typeof e!="object"||e===null)return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function Nzo(e){if(typeof e!="object"||e===null)return"";let t=e.content;if(!Array.isArray(t))return"";let n=[];for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&n.push(r.text);return n.join(`
11450
+ ${e.fallbackCwd}`}function j6(e,t){let n=RUt(e,t);if(n)throw new j9(n)}var j9,wbe=C(()=>{"use strict";j9=class extends Error{issue;constructor(t){super(Gjo(t)),this.name="MissingSessionCwdError",this.issue=t}}});function oVr(e){let{reporter:t,sessionId:n,getRequestId:r}=e;return i=>{if(i.type==="tool_execution_start"){t.toolStarted(n,{toolCallId:i.toolCallId,toolName:i.toolName,args:i.args});return}i.type==="tool_execution_end"&&t.toolEnded(n,{toolCallId:i.toolCallId,toolName:i.toolName,result:i.result,isError:i.isError,requestId:r()})}}var aVr=C(()=>{"use strict"});function lVr(e){return{total_history_char_count:0,total_history_exchange_count:0,head_char_count:0,head_exchange_count:0,head_last_request_id:"",tail_char_count:0,tail_exchange_count:0,tail_last_request_id:"",summary_char_count:e.summaryCharCount,summarization_duration_ms:e.durationMs??0,is_cache_about_to_expire:!1,is_aborted:e.aborted??!1,total_history_token_count:e.tokensBefore,head_token_count:e.tokensBefore,tail_token_count:e.tokensAfter??0,tokens_from_backend:!1}}function cVr(e,t){if(e.truncated)return{original_char_count:e.totalBytes,original_line_count:e.totalLines,truncated_char_count:e.outputBytes,truncated_line_count:e.outputLines,tool_type:t}}function uVr(e){let{source:t,scope:n}=e.sourceInfo;return n==="user"||n==="project"?n:t}function dVr(e){let t=e.filter(n=>!n.disableModelInvocation);if(t.length!==0)return{skills:t.map(n=>({skill_name:n.name,skill_source:uVr(n)})),skill_count:t.length}}function pVr(e,t,n){return{skill_name:e.name,skill_source:uVr(e),content_length:t,source_tool:n}}function mVr(e,t){return{retrieval_mode:t?.retrievalMode??"codebase_only",total_elapsed_ms:ku(e.totalElapsedMs),api_call_elapsed_ms:ku(e.apiCallElapsedMs),rerank_elapsed_ms:ku(e.rerankElapsedMs),enrich_elapsed_ms:ku(e.enrichElapsedMs),codebase_retrieval_elapsed_ms:ku(e.codebaseRetrievalElapsedMs),conversation_retrieval_elapsed_ms:ku(e.conversationRetrievalElapsedMs),conversation_initial_retrieval_ms:ku(e.conversationInitialRetrievalMs),conversation_query_rewriting_ms:ku(e.conversationQueryRewritingMs),conversation_followup_retrieval_ms:ku(e.conversationFollowupRetrievalMs),blob_name_lookup_ms:ku(e.blobNameLookupMs),codebase_chunks_retrieved:ku(e.codebaseChunksRetrieved),conversation_chunks_initial:ku(e.conversationChunksInitial),conversation_queries_generated:ku(e.conversationQueriesGenerated),conversation_chunks_followup:ku(e.conversationChunksFollowup),conversation_chunks_combined:ku(e.conversationChunksCombined),conversation_chunks_after_rerank:ku(e.conversationChunksAfterRerank),codebase_result_len_pre_truncation:ku(e.codebaseResultLenPreTruncation),codebase_result_len:ku(e.codebaseResultLen),conversation_result_len_pre_truncation:ku(e.conversationResultLenPreTruncation),conversation_result_len:ku(e.conversationResultLen),combined_result_len:ku(e.combinedResultLen),total_budget:ku(e.totalBudget),codebase_budget:ku(e.codebaseBudget),conversation_budget:ku(e.conversationBudget),codebase_truncated:q6e(e.codebaseTruncated),conversation_truncated:q6e(e.conversationTruncated),final_truncated:q6e(e.finalTruncated),is_sub_agent:q6e(t?.isSubAgent)}}var ku,q6e,fVr=C(()=>{"use strict";ku=e=>e??0,q6e=e=>e??!1});import{randomUUID as Wjo}from"node:crypto";function Hjo(e){if(typeof e!="object"||e===null)return;let t=e.details;if(!(typeof t!="object"||t===null))return t}function Yjo(e,t){if(e===t)return!0;if(!([...t].some(i=>hVr.has(i))&&e.endsWith(t)))return!1;let r=e.at(-t.length-1);return r!==void 0&&hVr.has(r)}function Zjo(e,t){return t.find(n=>Yjo(n.filePath,e))}function gVr(e){let t=new NUt(e);return n=>t.handle(n)}function jjo(e){if(typeof e!="object"||e===null)return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function bVr(e){let t=dVr(e.skills);t&&e.reporter.skillsIncludedInChat(e.sessionId,t)}var $jo,Qjo,hVr,NUt,yVr=C(()=>{"use strict";fVr();$jo={"codebase-retrieval":"codebase_only","session-retrieval":"conversation_only"},Qjo={read:"read","web-fetch":"web-fetch",bash:"bash"};hVr=new Set(["/","\\"]);NUt=class{readPathsByCallId=new Map;pendingCompactionChatHistoryLength;options;constructor(t){this.options=t}handle(t){if(t.type==="compaction_start"){this.pendingCompactionChatHistoryLength=this.options.getChatHistoryLength?.();return}if(t.type==="compaction_end"){this.emitCompaction(t);return}if(t.type==="tool_execution_start"){this.rememberReadPath(t);return}if(t.type!=="tool_execution_end")return;let n=this.readPathsByCallId.get(t.toolCallId);if(this.readPathsByCallId.delete(t.toolCallId),t.isError)return;let r=Hjo(t.result);this.emitTruncation(t.toolName,r),this.emitRetrieval(t.toolName,r),this.emitSkillContent(t.toolName,n,t.result)}emitCompaction(t){let n=this.pendingCompactionChatHistoryLength??0;this.pendingCompactionChatHistoryLength=void 0,!(t.aborted||!t.result)&&this.options.reporter.chatHistorySummarization(this.options.sessionId,Wjo(),n,lVr({summaryCharCount:t.result.summary.length,tokensBefore:t.result.tokensBefore,tokensAfter:t.tokensAfter,durationMs:t.durationMs,aborted:!1}))}rememberReadPath(t){if(t.toolName!=="read")return;let n=t.args?.path;typeof n=="string"&&this.readPathsByCallId.set(t.toolCallId,n)}emitTruncation(t,n){let r=Qjo[t];if(!(r&&n?.truncation))return;let i=cVr(n.truncation,r);i&&this.options.reporter.contentTruncation(this.options.sessionId,i)}emitRetrieval(t,n){let r=$jo[t];r&&n?.analytics&&this.options.reporter.retrievalToolUsed(this.options.sessionId,mVr(n.analytics,{retrievalMode:r}))}emitSkillContent(t,n,r){if(t!=="read"||!n)return;let i=Zjo(n,this.options.getSkills());i&&this.options.reporter.skillContentLoaded(this.options.sessionId,pVr(i,jjo(r),"read"))}}});function AVr(e){return e==="8"?{kind:"mode-disabled",message:zjo}:{kind:"generic"}}var zjo,kUt=C(()=>{"use strict";zjo="CLI mode access has been disabled for your account. If you believe this to be an error, please contact your administrator."});function OUt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K6e(e,...t){for(let n of t){let r=e[n];if(OUt(r))return r}}function z6(e,...t){for(let n of t){let r=e[n];if(typeof r=="string")return r}}function Kjo(e){if(typeof e=="string")return e.trim().length>0?{kind:"text",text:e}:null;if(!OUt(e))return null;let t=OUt(e.block)?e.block:e,n=K6e(t,"text","Text");if(n){let o=z6(n,"text");if(o!==void 0&&o.trim().length>0)return{kind:"text",text:o}}let r=K6e(t,"tool_use","toolUse","ToolUse");if(r){let o=z6(r,"id"),a=z6(r,"name");if(!o||!a)return null;let l=z6(r,"input");return{kind:"tool_use",toolUseId:o,toolName:a,inputJson:l&&l.trim().length>0?l:"{}"}}let i=K6e(t,"tool_result","toolResult","ToolResult");if(i){let o=z6(i,"tool_use_id","toolUseId");if(!o)return null;let a=i.is_error??i.isError;return{kind:"tool_result",toolUseId:o,content:z6(i,"content")??"",isError:typeof a=="boolean"?a:!1}}let s=K6e(t,"thinking","Thinking");if(s){let o=z6(s,"content");if(o!==void 0)return{kind:"thinking",content:o}}return null}function EVr(e){if(!Array.isArray(e.content))return[];let t=[];for(let n of e.content){let r=Kjo(n);r!==null&&t.push(r)}return t}function Jjo(e){let t=[],n=[];for(let r of e)if(r.kind==="text"){if(r.text.trim().length===0)continue;n.push(r.text),t.push({type:C6e,text_node:{content:r.text}})}else r.kind==="tool_result"&&t.push({type:M5t,tool_result_node:{content:r.content,is_error:r.isError}});return{requestNodes:t,requestText:n.join("")}}function ezo(e){let t=[],n=[],r=[],i=()=>{if(r.length===0)return;let s=r.join("");r.length=0,s.trim().length!==0&&t.push({type:T6e,content:s})};for(let s of e)if(s.kind==="text"){if(s.text.trim().length===0)continue;n.push(s.text),r.push(s.text)}else s.kind==="tool_use"?(i(),t.push({type:P5t,content:"",tool_use:{tool_name:s.toolName,input_json:s.inputJson}})):s.kind==="thinking"&&(i(),t.push({type:D5t,content:s.content,thinking:{content:s.content}}));return i(),{responseNodes:t,responseText:n.join("")}}function tzo(e){let t=[];for(let n of e)if(n.role==="user")t.push({user:n,assistants:[]});else if(n.role==="assistant"){let r=t.at(-1);r?r.assistants.push(n):t.push({assistants:[n]})}return t.map(({user:n,assistants:r})=>{let{requestNodes:i,requestText:s}=Jjo(n?EVr(n):[]),{responseNodes:o,responseText:a}=ezo(r.flatMap(EVr));return{request_message:s,response_text:a,request_id:n?.id??r[0]?.id??"",request_nodes:i,response_nodes:o}})}async function nzo(e){let t=await e.fetchImpl(`${e.baseUrl}cloud-agents/agents/get-messages`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`,...e.userAgent?{"User-Agent":e.userAgent}:{}},body:JSON.stringify({agent_id:e.agentId,limit:Xjo,...e.beforeTimestamp?{before_timestamp:e.beforeTimestamp}:{}})});if(!t.ok)throw new Error(`Fetching cloud-agent chat history failed: ${t.status} ${t.statusText}`);return await t.json()}async function rzo(e){let t=new Set,n=[],r;for(let o=0;o<qjo;o++){let a=await nzo({...e,beforeTimestamp:r}),l=Array.isArray(a.messages)?a.messages:[];n.push(l);let u=izo(l,t),c=a.oldest_timestamp;if(a.has_next!==!0||l.length===0||!c||u===0)break;r=c}let i=new Set,s=[];for(let o=n.length-1;o>=0;o--)for(let a of n[o]){let l=a.id;if(l!==void 0){if(i.has(l))continue;i.add(l)}s.push(a)}return s}function izo(e,t){let n=0;for(let r of e)(r.id===void 0||!t.has(r.id))&&n++,r.id!==void 0&&t.add(r.id);return n}function MUt(e){let t=e.fetchImpl??globalThis.fetch.bind(globalThis);return async n=>{let r=await e.readCredentials();if(!r)throw new Error("view-session requires an Augment login. Please sign in and try again.");let i=r.apiUrl.endsWith("/")?r.apiUrl:`${r.apiUrl}/`,s=await rzo({fetchImpl:t,baseUrl:i,apiKey:r.apiKey,userAgent:e.userAgent,agentId:n});return tzo(s)}}var Xjo,qjo,_Vr=C(()=>{"use strict";R6e();Xjo=400,qjo=200});import{delimiter as ozo,isAbsolute as PUt,join as azo,resolve as Rbe}from"node:path";function lzo(e){return e.map(t=>{if(t.type!=="message")return{type:t.type,id:t.id,parentId:t.parentId};let n=t.message,r=typeof n.content=="string"?n.content:n.content.map(i=>({type:i.type,text:"text"in i?i.text:void 0}));return{type:t.type,id:t.id,parentId:t.parentId,message:{role:n.role,content:r,timestamp:n.timestamp}}})}function czo(e){if(e instanceof Error){let t=e;return typeof t.status=="number"?String(t.status):typeof t.httpStatus=="number"?String(t.httpStatus):e.message}return String(e)}function uzo(e,t){let n=czo(e);if(n!=="8"){let r=e instanceof Error?e.message:String(e);t.push({type:"error",message:`Failed to fetch feature flags: ${r}`})}return{flags:xE(void 0),errorStatus:n}}function dzo(e,t,n){if(e.allowClientFeatureFlagOverrides!==!0)return e;let r=t.getFeatureFlagOverrides();if(!r)return e;try{let i=cFr(r);return uFr(e,i)}catch(i){let s=i instanceof Error?i.message:String(i);return n.push({type:"warning",message:`Failed to parse feature flag overrides, ignoring them: ${s}`}),e}}function pzo(e){return e.cosmosMultiRepoContextEnabled===!0}function mzo(e){return e.cosmosNestedAgentsMdEnabled===!0}function fzo(e,t,n){return e===void 0?void 0:{tenantUrl:e,userId:t,userEmail:n}}function hzo(e){return typeof e=="object"&&e!==null&&"workspacePath"in e&&"sourceWorkspacePath"in e&&"repositoryRoot"in e&&typeof e.workspacePath=="string"&&typeof e.sourceWorkspacePath=="string"&&typeof e.repositoryRoot=="string"&&PUt(e.workspacePath)&&PUt(e.sourceWorkspacePath)&&PUt(e.repositoryRoot)}function gzo(e,t){if(!e)return[];try{let n=JSON.parse(process.env.AUGMENT_DAEMON_INDEXING_WORKSPACES??"[]");if(!Array.isArray(n))return[];let r=new Map;for(let i of n){if(!hzo(i))continue;let s=Rbe(i.workspacePath);t.has(s)&&r.set(s,{sourceWorkspacePath:Rbe(i.sourceWorkspacePath),repositoryRoot:Rbe(i.repositoryRoot)})}return[...r].map(([i,s])=>({workspacePath:i,...s}))}catch{return[]}}function bzo(e,t,n){let{allowDirs:r,denyDirs:i}=t.getIndexingDirsUnion(),s=n?.get("parent-daemon-id"),o=typeof s=="string"&&s.length>0,a=n?.get("cloud-agent"),l=typeof a=="string"&&a.length>0,u=o&&l,c=new Set([Rbe(e)]),d=n?.get("add-workspace");if(typeof d=="string")for(let m of d.split(ozo))m.length>0&&c.add(Rbe(m));let p=gzo(u,c);return{allowDirs:r,denyDirs:i,daemonChild:u,allowIndexingFlag:n?.get("allow-indexing")===!0,repositoryRoots:p}}function yzo(e,t){if(!t)return[];let n=[],r=e.getExtensions(),i=new Map;for(let o of r.extensions)for(let[a,l]of o.flags)i.set(a,{type:l.type});let s=[];for(let[o,a]of t){let l=i.get(o);if(!l){s.push(o);continue}if(l.type==="boolean"){r.runtime.flagValues.set(o,!0);continue}if(typeof a=="string"){r.runtime.flagValues.set(o,a);continue}n.push({type:"error",message:`Extension flag "--${o}" requires a value`})}return s.length>0&&n.push({type:"error",message:`Unknown option${s.length===1?"":"s"}: ${s.map(o=>`--${o}`).join(", ")}`}),n}function Azo(e){return e.prefetchedAugment?Promise.resolve(e.prefetchedAugment.modelConfig):e.augmentApiPromise?.then(t=>t.getModelConfig())}async function Ezo({options:e,modelRegistry:t,augmentUserAgent:n}){if(e.resourceDiscoveryOnly)return{augmentCredentials:null,augmentApiPromise:void 0,modelConfigPromise:void 0};let r=e.prefetchedAugment?.credentials??await Kc(),i=r?rl(r.apiKey,r.apiUrl,n):void 0,s=Azo({prefetchedAugment:e.prefetchedAugment,augmentApiPromise:i});return await t.discoverAugmentModels(n,{credentials:r,modelConfig:s}),{augmentCredentials:r,augmentApiPromise:i,modelConfigPromise:s}}async function Nbe(e){let t=e.cwd,n=e.agentDir??nr(),r=e.authStorage??Jx.create(azo(n,"auth.json")),i=e.settingsManager??gi.create(t,n),s=e.modelRegistry??P9.empty(r),o=e.augmentUserAgent??yf(),{augmentCredentials:a,augmentApiPromise:l,modelConfigPromise:u}=await Ezo({options:e,modelRegistry:s,augmentUserAgent:o}),c=O9(),d={};c.on("conversation:identity",y=>{typeof y=="object"&&y!==null&&"conversationId"in y&&(typeof y.conversationId=="string"||y.conversationId===void 0)&&(d.conversationId=y.conversationId)}),u5r(c);let p=[],m,f={flags:xE(void 0)},h,g;if(l&&u)try{m=await l;let y=await u;h=y.user?.id,g=y.user?.email,j6e({id:h,email:g});let S=xE(y.featureFlagsV2);f={flags:dzo(S,i,p)}}catch(y){f=uzo(y,p)}let b=new $w({...e.resourceLoaderOptions??{},readOnlyPackages:e.resourceDiscoveryOnly||e.resourceLoaderOptions?.readOnlyPackages,cwd:t,agentDir:n,settingsManager:i,eventBus:c,multiRepoContextEnabled:pzo(f.flags),nestedContextDescentEnabled:mzo(f.flags)});await b.reload(),a&&m&&(c.emit("augment:api",m),c.emit("augment:credentials",{apiKey:a.apiKey,apiUrl:a.apiUrl,userAgent:o,userId:h,email:g,cliVersion:Ws}));let A=b.getExtensions();for(let{name:y,config:S,extensionPath:_}of A.runtime.pendingProviderRegistrations)try{s.registerProvider(y,S)}catch(x){let v=x instanceof Error?x.message:String(x);p.push({type:"error",message:`Extension "${_}" error: ${v}`})}return A.runtime.pendingProviderRegistrations=[],p.push(...yzo(b,e.extensionFlagValues)),c.emit("augment:indexing-policy",bzo(t,i,e.extensionFlagValues)),c.emit("augment:feature-flags",f),c.emit("augment:feature-flags-startup-complete",void 0),{cwd:t,agentDir:n,conversationIdentity:d,pluginDirs:e.pluginDirs,mcpConfigOverride:e.mcpConfigOverride,permissionOverride:e.permissionOverride,authStorage:r,settingsManager:i,modelRegistry:s,resourceLoader:b,diagnostics:p,augmentUserAgent:o,augmentApi:m,augmentAccount:fzo(a?.apiUrl,h,g),featureFlags:f}}function kbe(e){let t=e.services.augmentApi,n=t?{viewSession:{operations:{fetchChatHistory:B5t({readCredentials:Kc,userAgent:e.services.augmentUserAgent}),fetchCloudAgentChatHistory:MUt({readCredentials:Kc,userAgent:e.services.augmentUserAgent})}},sessionRetrieval:{operations:{createRequestId:t.createRequestId.bind(t),agentCodebaseRetrieval:t.agentCodebaseRetrieval.bind(t),fetchCloudAgentChatHistory:MUt({readCredentials:Kc,userAgent:e.services.augmentUserAgent}),fetchChatHistory:B5t({readCredentials:Kc,userAgent:e.services.augmentUserAgent}),getBranch:()=>lzo(e.sessionManager.getBranch())}}}:void 0;return GJ({cwd:e.services.cwd,agentDir:e.services.agentDir,authStorage:e.services.authStorage,settingsManager:e.services.settingsManager,modelRegistry:e.services.modelRegistry,augmentUserAgent:e.services.augmentUserAgent,resourceLoader:e.services.resourceLoader,sessionManager:e.sessionManager,model:e.model,thinkingLevel:e.thinkingLevel,scopedModels:e.scopedModels,tools:e.tools,customTools:e.customTools,removedTools:e.removedTools,sessionStartEvent:e.sessionStartEvent,toolsOptions:{...n,bash:e.bashOptions},featureFlags:e.services.featureFlags.flags,pluginDirs:e.services.pluginDirs,mcpConfigOverride:e.services.mcpConfigOverride,permissionOverride:e.services.permissionOverride})}var DUt=C(()=>{"use strict";Bi();Ol();kUt();$s();Z6();wh();vbe();wge();h6();Qge();Af();ebe();BUt();_Vr();L5t()});import{copyFileSync as _zo,existsSync as SVr,mkdirSync as Szo}from"node:fs";import{basename as vzo,join as xzo,resolve as vVr}from"node:path";function Czo(e){return typeof e=="string"?e:e.filter(t=>t.type==="text"&&typeof t.text=="string").map(t=>t.text).join("")}async function J6e(e,t){j6(t.sessionManager,t.cwd);let n=await e(t);return process.cwd()!==n.services.cwd&&process.chdir(n.services.cwd),new Obe(n.session,n.services,e,n.diagnostics,n.modelFallbackMessage,t.usageReporter,t.toolUseReporter,t.enableSentrySummarizationSpans,t.backgroundBashEligible)}var Obe,LUt=C(()=>{"use strict";W6e();Z6();kge();b1();wbe();vE();aVr();yVr();DUt();Obe=class{backgroundBashEligible;lifecycleListeners=new Set;subscribeLifecycle(t){return this.lifecycleListeners.add(t),()=>this.lifecycleListeners.delete(t)}async emitLifecycle(t){for(let n of this.lifecycleListeners)await n(t)}_session;_services;createRuntime;_diagnostics;_modelFallbackMessage;_usageReporter;_toolUseReporter;enableSentrySummarizationSpans;_usageUnsubscribe;_summarizationUnsubscribe;_summarizationSubscriber;constructor(t,n,r,i=[],s,o,a,l=!1,u=!1){this.backgroundBashEligible=u,this._session=t,this._services=n,this.createRuntime=r,this._diagnostics=i,this._modelFallbackMessage=s,this._usageReporter=o,this._toolUseReporter=a,this.enableSentrySummarizationSpans=l,this.attachUsageReporter(),this.attachSummarizationTracer()}attachUsageReporter(){let t=this._usageReporter,n=this._toolUseReporter;if(!(t||n))return;let r=this._session,i=r.sessionId,s=t?gVr({reporter:t,sessionId:i,getSkills:()=>this._services.resourceLoader.getSkills().skills,getChatHistoryLength:()=>r.sessionManager.getBranch().length}):void 0;t&&(t.sessionStarted(i),bVr({reporter:t,sessionId:i,skills:this._services.resourceLoader.getSkills().skills}));let o=n?oVr({reporter:n,sessionId:i,getRequestId:()=>r.currentRequestId}):void 0;this._usageUnsubscribe=r.subscribe(a=>{t&&a.type==="message_start"&&Zb(a.message.role)&&t.userMessageSent(i),s?.(a),o?.(a)})}setAugmentAccount(t){this._services.augmentAccount=t,t?.userId||t?.userEmail?j6e({id:t.userId,email:t.userEmail}):eVr()}attachSummarizationTracer(){if(!this.enableSentrySummarizationSpans)return;let t=x4r();this._summarizationSubscriber=t,this._summarizationUnsubscribe=this._session.subscribe(t.handle)}detachSummarizationTracer(){this._summarizationUnsubscribe?.(),this._summarizationUnsubscribe=void 0,this._summarizationSubscriber?.dispose(),this._summarizationSubscriber=void 0}detachUsageReporter(){let t=this._usageReporter,n=this._toolUseReporter;(t||n)&&(this._usageUnsubscribe?.(),this._usageUnsubscribe=void 0,t?.sessionEnded(this._session.sessionId))}get services(){return this._services}get session(){return this._session}get cwd(){return this._services.cwd}get diagnostics(){return this._diagnostics}get modelFallbackMessage(){return this._modelFallbackMessage}async emitBeforeSwitch(t,n){let r=this.session.extensionRunner;return r?.hasHandlers("session_before_switch")?{cancelled:(await r.emit({type:"session_before_switch",reason:t,targetSessionFile:n}))?.cancel===!0}:{cancelled:!1}}async emitBeforeFork(t){let n=this.session.extensionRunner;return n?.hasHandlers("session_before_fork")?{cancelled:(await n.emit({type:"session_before_fork",entryId:t}))?.cancel===!0}:{cancelled:!1}}async teardownCurrent(){this.session.closeDetachedCompletions(),await this.emitLifecycle("closing"),await this.session.waitForAutomaticCompaction().catch(()=>{}),this.detachUsageReporter(),this.detachSummarizationTracer(),await Nge(this.session.extensionRunner),await this.session.dispose()}async apply(t){process.cwd()!==t.services.cwd&&process.chdir(t.services.cwd),this._session=t.session,this._services=t.services,this._diagnostics=t.diagnostics,this._modelFallbackMessage=t.modelFallbackMessage,this.attachUsageReporter(),this.attachSummarizationTracer(),await this.emitLifecycle("activated")}switchSession(t,n){return this.session.withHistoryAdmission(()=>this.switchSessionWithAdmission(t,n))}async switchSessionWithAdmission(t,n){let r=await this.emitBeforeSwitch("resume",t);if(r.cancelled)return r;let i=this.session.sessionFile,s=ds.open(t,void 0,n);return j6(s,this.cwd),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:s.getCwd(),agentDir:this.services.agentDir,sessionManager:s,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:i}})),{cancelled:!1}}newSession(t){return this.session.withHistoryAdmission(()=>this.newSessionWithAdmission(t))}async newSessionWithAdmission(t){let n=await this.emitBeforeSwitch("new");if(n.cancelled)return n;let r=t?.cwd??this.cwd,i=this.session.sessionFile,s=this.session.sessionManager.getSessionDir(),o=ds.create(r,s);return t?.parentSession&&o.newSession({parentSession:t.parentSession}),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:r,agentDir:this.services.agentDir,sessionManager:o,sessionStartEvent:{type:"session_start",reason:"new",previousSessionFile:i}})),t?.setup&&(await t.setup(this.session.sessionManager),this.session.agent.state.messages=this.session.sessionManager.buildSessionContext().messages),{cancelled:!1}}fork(t){return this.session.withHistoryAdmission(()=>this.forkWithAdmission(t))}async forkWithAdmission(t){if((await this.emitBeforeFork(t)).cancelled)return{cancelled:!0};let r=this.session.sessionManager.getEntry(t);if(!r||r.type!=="message")throw new Error("Invalid entry ID for forking");let i=r.message,s;if(i.role==="user")s=Czo(i.content);else if(i.role==="promptCommandInvocation")s=Ih(i);else throw new Error("Invalid entry ID for forking");let o=this.session.sessionFile;if(this.session.sessionManager.isPersisted()){let l=this.session.sessionFile;if(!l)throw new Error("Persisted session is missing a session file");let u=this.session.sessionManager.getSessionDir();if(!r.parentId){let m=ds.create(this.cwd,u);return m.newSession({parentSession:l}),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:m,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let d=ds.open(l,u).createBranchedSession(r.parentId);if(!d)throw new Error("Failed to create forked session");let p=ds.open(d,u);return await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:p.getCwd(),agentDir:this.services.agentDir,sessionManager:p,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}let a=this.session.sessionManager;return await this.teardownCurrent(),r.parentId?a.createBranchedSession(r.parentId):a.newSession({parentSession:this.session.sessionFile}),await this.apply(await this.createRuntime({cwd:this.cwd,agentDir:this.services.agentDir,sessionManager:a,sessionStartEvent:{type:"session_start",reason:"fork",previousSessionFile:o}})),{cancelled:!1,selectedText:s}}importFromJsonl(t,n){return this.session.withHistoryAdmission(()=>this.importWithAdmission(t,n))}async importWithAdmission(t,n){let r=vVr(t);if(!SVr(r))throw new Error(`File not found: ${r}`);let i=this.session.sessionManager.getSessionDir();SVr(i)||Szo(i,{recursive:!0});let s=xzo(i,vzo(r)),o=await this.emitBeforeSwitch("resume",s);if(o.cancelled)return o;let a=this.session.sessionFile;vVr(s)!==r&&_zo(r,s);let l=ds.open(s,i,n);return j6(l,this.cwd),await this.teardownCurrent(),await this.apply(await this.createRuntime({cwd:l.getCwd(),agentDir:this.services.agentDir,sessionManager:l,sessionStartEvent:{type:"session_start",reason:"resume",previousSessionFile:a}})),{cancelled:!1}}async dispose(){this.session.closeDetachedCompletions(),await this.emitLifecycle("shutdown"),await this.session.waitForAutomaticCompaction().catch(()=>{}),this.detachUsageReporter(),this.detachSummarizationTracer(),await Nge(this.session.extensionRunner),await this.session.dispose(),await Promise.all([this._usageReporter?.flush(),this._toolUseReporter?.flush()])}}});import{join as xVr}from"node:path";function Tzo(){return nr()}async function GJ(e={}){let t=e.cwd??process.cwd(),n=e.agentDir??Tzo(),r=e.resourceLoader,i=e.agentDir?xVr(n,"auth.json"):void 0,s=e.agentDir?xVr(n,"models.json"):void 0,o=e.authStorage??Jx.create(i),a=e.modelRegistry??P9.create(o,s),l=e.settingsManager??gi.create(t,n),u=e.sessionManager??ds.create(t,y1(t,n));r||(r=new $w({cwd:t,agentDir:n,settingsManager:l}),await r.reload(),TE("resourceLoader.reload"));let c=u.buildSessionContext(),d=c.messages.length>0,p=u.getBranch().some(L=>L.type==="thinking_level_change"),m=e.model;if(m&&!jx(m))throw new Error(`Unsupported model: ${m.provider}/${m.id}`);let f;if(!m&&d&&c.model){let L=a.findSupported(c.model.provider,c.model.modelId);if(L&&a.hasConfiguredAuth(L)&&(m=L),!m&&!L){let F=a.findDeprecatedModelUpgrade(c.model.provider,c.model.modelId);F&&a.hasConfiguredAuth(F)&&(m=F,f=`Model ${c.model.provider}/${c.model.modelId} is retired. Using ${F.provider}/${F.id}`)}m||(f=`Could not restore model ${c.model.provider}/${c.model.modelId}`)}m||(m=(await QFr({scopedModels:[],isContinuing:d,defaultModelId:l.getDefaultModel(),defaultThinkingLevel:l.getDefaultThinkingLevel(),modelRegistry:a})).model,m?f&&(f+=`. Using ${m.provider}/${m.id}`):f="Auggie couldn't load an available model. Restart Auggie to try again. If the problem continues, contact support.");let h=e.thinkingLevel,g=h==="default";h===void 0&&d&&(h=p?c.thinkingLevel:l.getDefaultThinkingLevel()??nO,g=p?c.usesModelDefault:!1);let b;h===void 0&&m&&(m.api==="augment-chat-stream"?(b=dUt(l)[B6e(m)],h=b,g=b===void 0):h=l.getDefaultThinkingLevel()??nO);let A=ss(m,g?"default":h);!A.valid&&m&&h&&(console.warn(rm(m,h)),b!==void 0&&PJ(l,m,void 0));let y=A.effort,S=A.usesModelDefault,_=["read","bash","edit","write","web-fetch","view-session"],x=new Set((e.removedTools??[]).flatMap(bd)),v=(e.tools?e.tools.map(L=>L.name).filter(L=>L in Hw):_).filter(L=>!x.has(L)),w,T=e.augmentUserAgent??"",P=L=>{let F=I9(L);return l.getBlockImages()?F.map(H=>{if(H.role==="user"||H.role==="toolResult"){let U=H.content;if(Array.isArray(U)&&U.some(ie=>ie.type==="image")){let ie=U.map(ne=>ne.type==="image"?{type:"text",text:"Image reading is disabled."}:ne).filter((ne,ue,le)=>!(ne.type==="text"&&ne.text==="Image reading is disabled."&&ue>0&&le[ue-1].type==="text"&&le[ue-1].text==="Image reading is disabled."));return{...H,content:ie}}}return H}):F},O={},D=L=>async(F,H,U)=>{let J=await a.getApiKeyAndHeaders(F);if(!J.ok)throw new Error(J.error);if(U?.signal?.aborted)throw new Error("Request cancelled");let ie={...U,apiKey:J.apiKey,headers:J.headers||U?.headers?{...J.headers,...U?.headers}:void 0};return F.api==="augment-chat-stream"?GY({...F,baseUrl:J.baseUrl??F.baseUrl},{...H,systemPrompt:U?.silent||U?.silentType!==void 0?void 0:L()},{...ie,userAgent:T}):QT(F,H,ie)};w=new iG({initialState:{systemPrompt:"",model:m,thinkingLevel:y,usesModelDefault:S,tools:[]},convertToLlm:P,streamFn:D(()=>r.getExplicitSystemPrompt?.()),onPayload:(L,F)=>{let H=O.current;return H?.hasHandlers("before_provider_request")?H.emitBeforeProviderRequest(L):L},sessionId:u.getSessionId(),transformContext:L=>{let F=O.current;return F?F.emitContext(L):Promise.resolve(L)},steeringMode:l.getSteeringMode(),followUpMode:l.getFollowUpMode(),thinkingBudgets:l.getThinkingBudgets(),maxRetryDelayMs:l.getRetrySettings().maxDelayMs}),d?(w.state.messages=c.messages,p||u.appendThinkingLevelChange(y,S),m&&(!u.getBranch().some(L=>L.type==="model_change")||m.provider!==c.model?.provider||m.id!==c.model?.modelId)&&u.appendModelChange(m.provider,m.id)):(m&&u.appendModelChange(m.provider,m.id),u.appendThinkingLevelChange(y,S)),m?.api==="augment-chat-stream"&&e.thinkingLevel!==void 0&&PJ(l,m,S?void 0:y);let k=new DJ({prepareDetachedStream:()=>{let L=r.getExplicitSystemPrompt?.();return D(()=>L)},agent:w,sessionManager:u,settingsManager:l,cwd:t,agentDir:n,pluginDirs:e.pluginDirs,mcpConfigOverride:e.mcpConfigOverride,permissionOverride:e.permissionOverride,scopedModels:e.scopedModels,resourceLoader:r,customTools:e.customTools,toolsOptions:e.toolsOptions,modelRegistry:a,initialActiveToolNames:v,removedTools:e.removedTools,extensionRunnerRef:O,sessionStartEvent:e.sessionStartEvent,featureFlags:e.featureFlags,role:e.role}),M=r.getExtensions();return{session:k,extensionsResult:M,modelFallbackMessage:f}}var BUt=C(()=>{"use strict";ude();Bi();Ol();$s();L6e();vbe();gFt();b1();Af();aJ();ebe();vE();AUt();H9();LUt();H9()});function TVr(e){return FUt[e]}function IVr(e){return e==="user"?"global":e}function wVr(e){return e==="global"?"user":e}function RVr(e){let{files:t,alwaysShowPicker:n}=e;if(n&&t.length>=2)return{files:t};let r=t.filter(i=>i.exists);return r.length===0?{directTarget:"user"}:r.length===1?{directTarget:r[0].target}:{files:t}}var CVr,FUt,NVr=C(()=>{"use strict";CVr=["local","project","user"],FUt={user:"User settings (global)",project:"Project settings (shared)",local:"Local settings (personal)"}});function Rzo(e){if(typeof e!="object"||e===null)return 0;let t=e.content;if(!Array.isArray(t))return 0;let n=0;for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&(n+=r.text.length);return n}function Nzo(e){if(typeof e!="object"||e===null)return"";let t=e.content;if(!Array.isArray(t))return"";let n=[];for(let r of t)typeof r=="object"&&r!==null&&r.type==="text"&&typeof r.text=="string"&&n.push(r.text);return n.join(`
11451
11451
  `)}function UUt(e,t){if(OVr.has(e)){for(let[n,r]of kzo)if(n.test(t))return r;return"provider_error"}}function Fzo(e){return e.replace(Mzo,"<url>").replace(Pzo,"<email>").replace(Dzo,"<tok>").replace(Bzo,"#").replace(Lzo," ").trim().slice(0,Ozo)}function Uzo(e){return typeof e=="object"&&e!==null?e:{}}function MVr(e){let t=!wzo(process.env.AUGGIE_V2_USAGE_OPT_OUT),n=e.userAgent??yf({subtype:Fge(e.appMode)}),r,i=[],s,o=new Map,a=async()=>{if(await s,!r||i.length===0)return;let l=i;i=[];let u;for(let c of l)c.requestId||(u??=r.createRequestId(),c.requestId=u);try{await r.logToolUseRequestEvent(l)}catch{}};return t&&(s=(async()=>{let u=await Kc();u&&(r=await rl(u.apiKey,u.apiUrl,n))})().catch(()=>{}),setInterval(()=>{a()},Izo).unref?.()),{toolStarted(l,u){if(t){if(o.size>=kVr){let c=o.keys().next().value;c!==void 0&&o.delete(c)}o.set(u.toolCallId,{startMs:Date.now(),args:u.args})}},toolEnded(l,u){if(!t)return;let c=o.get(u.toolCallId);o.delete(u.toolCallId);let d=Date.now(),p=u.isError?Nzo(u.result):void 0;i.length>=kVr&&i.shift(),i.push({requestId:u.requestId??"",toolName:u.toolName,toolUseId:u.toolCallId,toolInput:Uzo(c?.args),toolOutputIsError:u.isError,toolRunDurationMs:c?d-c.startMs:0,isMcpTool:!1,conversationId:l,chatHistoryLength:0,toolOutputLen:Rzo(u.result),toolErrorClass:p===void 0?void 0:UUt(u.toolName,p),toolErrorSnippet:p!==void 0&&OVr.has(u.toolName)?Fzo(p):void 0,eventTimeSec:Math.floor(d/1e3),eventTimeNsec:d%1e3*1e6})},flush:a}}var Izo,kVr,wzo,OVr,kzo,Ozo,Mzo,Pzo,Dzo,Bzo,Lzo,VUt=C(()=>{"use strict";Bi();wh();Af();Izo=15e3,kVr=1e3,wzo=e=>e==="1"||e?.toLowerCase()==="true"||e?.toLowerCase()==="yes";OVr=new Set(["find-tool","execute-tool"]),kzo=[[/^MCP server "[^"]*" is not available \(status: /,"server_not_available"],[/^MCP server "[^"]*" is not connected \(status: /,"server_not_available"],[/^MCP server "[^"]*" (?:is being disposed|client is gone)$/,"server_not_available"],[/is available but not attached\. Call attach-mcp-server now/,"server_not_attached"],[/^MCP server name "[^"]*" is ambiguous\./,"ambiguous_server_name"],[/is a built-in tool, not an MCP server\./,"builtin_tool_not_server"],[/^Built-in tool "[^"]*" is not available \(disabled\)\./,"builtin_tool_not_server"],[/^Validation failed for tool "(?:find-tool|execute-tool)":/,"invalid_parameters"],[/^(?:find-tool|execute-tool) requires /,"invalid_parameters"],[/^execute-tool "arguments" must be an object/,"invalid_parameters"],[/^No tools available on MCP server "/,"no_tools_on_server"],[/returned a result with no usable content/,"no_usable_content"],[/^MCP error -32001: (?:Request timed out|Maximum total timeout exceeded)/,"timeout"],[/^MCP error -32001: .*abort/i,"cancelled"]];Ozo=200,Mzo=/https?:\/\/\S+/g,Pzo=/[\w.+-]+@[\w-]+\.[\w.-]+/g,Dzo=/[\w+/=-]{20,}/g,Bzo=/\d{5,}/g,Lzo=/\s+/g});function PVr(){return Vzo}function DVr(e,t){return e.filter(n=>!t.has(n.name))}var Vzo,BVr=C(()=>{"use strict";Vzo=[]});import{statSync as Gzo}from"node:fs";import{resolve as Wzo}from"node:path";function GUt(e,t,n){let r=[],i=[];if(!e||e.length===0)return{resolved:r,errors:i};let s=new Set([t]);for(let o of e){let a=Yl(o),l=Wzo(n,a);if(s.has(l))continue;let u;try{u=Gzo(l)}catch(c){let d=c instanceof Error?c.message:String(c);i.push(`--add-workspace "${o}": ${d}`);continue}if(!u.isDirectory()){i.push(`--add-workspace "${o}": not a directory (${l})`);continue}s.add(l),r.push(l)}return{resolved:r,errors:i}}function LVr(e){return e.isCloudService?{kind:"tolerate",warnings:e.errors}:{kind:"fatal",fatalErrors:e.errors}}var FVr=C(()=>{"use strict";jd()});function UVr(e,t){return e.unknownFlags.has("cloud-agent")?"cloud-service":e.mode==="acp"||e.mode==="rpc"||e.mode==="json"?e.mode:e.mode==="stream"||e.print||!t?"print":"interactive"}function VVr(e,t){return e==="json"?"json":t==="stream"?"stream":"text"}var GVr=C(()=>{"use strict"});function Qzo(e){if(e.key==="logFile"&&e.value==="-")return{type:"error",message:"--log-file '-' (log to stderr) is not supported; pass a file path instead"};if(e.key!=="logLevel"||typeof e.value!="string")return e;let t=e.value.toLowerCase();return WVr.includes(t)?{...e,value:t}:{type:"error",message:`Invalid --log-level "${e.value}". Valid values: ${WVr.join(", ")}`}}function WUt(e,t,n=!1){let r=e[t],i=r.indexOf("="),s=i===-1?r:r.slice(0,i),o=$zo.find(({flag:d,preCommandOnly:p})=>d===s&&(n||!p));if(!o)return;if(o.kind==="boolean")return i!==-1?void 0:{option:{key:o.key,flag:o.flag,value:!0},nextIndex:t+1};let a=i===-1?e[t+1]:r.slice(i+1),l=i===-1&&a?.startsWith("-")===!0,u=o.preCommandOnly&&i===-1&&(a==="auth"||a==="login");if(a===void 0||a.length===0||l||u)return{diagnostic:{type:"error",message:`${o.flag} requires a value`},nextIndex:t+1};let c=Qzo({key:o.key,flag:o.flag,value:a});return"key"in c?{option:c,nextIndex:t+(i===-1?2:1)}:{diagnostic:c,nextIndex:t+(i===-1?2:1)}}function z9(e){let t=[],n=[],r=[],i=0;for(;i<e.length;){if(e[i]==="--"){t.push(...e.slice(i));break}let s=WUt(e,i,t.length===0);if(s){s.option&&n.push(s.option),s.diagnostic&&r.push(s.diagnostic),i=s.nextIndex;continue}t.push(e[i]),i++}return{commandArgs:t,globalOptions:n,diagnostics:r}}function Mbe(e,t){let n;for(let r of z9(e).globalOptions)r.key===t&&typeof r.value=="string"&&(n=r.value);return n}var $zo,WVr,X6=C(()=>{"use strict";$zo=[{flag:"--augment-cache-dir",key:"augmentCacheDir",kind:"value"},{flag:"--login-url",key:"loginUrl",kind:"value",preCommandOnly:!0},{flag:"--log-file",key:"logFile",kind:"value"},{flag:"--log-level",key:"logLevel",kind:"value"},{flag:"--offline",key:"offline",kind:"boolean"}],WVr=["error","warn","info","debug"]});function HVr(e){if(!e)return;let t=e.filter(n=>n.trim().length>0);return t.length>0?t:void 0}function $Vr(e,t){let n=N2(e);if(!n.ok){t.diagnostics.push({type:"error",message:n.message});return}t.discoverWorkspaces=!0,t.discoverWorkspacesDepth=n.depth}function $Ut(e){return e!==void 0&&!e.startsWith("-")&&!e.startsWith("@")}function jzo(e,t,n,r){let i=Hzo[e];if(i!==void 0)return r[i]=!0,n;let s=e.indexOf("="),o=s===-1?e:e.slice(0,s),a=s===-1?void 0:e.slice(s+1);if((o==="--remove-tool"||o==="--remove-tools")&&a===void 0&&(t===void 0||t.startsWith("-")))return r.diagnostics.push({type:"error",message:`${o} requires a value`}),n;let l=a??t,u=a===void 0?n+1:n,c=Yzo[o];if(c!==void 0&&l!==void 0)return r[c]=l,u;let d=Zzo[o];if(d!==void 0&&l!==void 0){let p=r[d]??[];return p.push(l),r[d]=p,u}return null}function zzo(e,t){e==="text"||e==="stream"||e==="json"||e==="rpc"||e==="acp"?t.mode=e:t.diagnostics.push({type:"error",message:`Invalid mode: ${e}. Expected text, stream, json, rpc, or acp`})}function Xzo(e,t){let n=e.split(",").map(i=>i.trim()),r=new Set;for(let i of n){let s=_A(i).filter(o=>Object.hasOwn(Hw,o));if(s.length>0)for(let o of s)r.add(o);else t.diagnostics.push({type:"warning",message:`Unknown tool "${i}". Valid tools: ${Object.keys(Hw).join(", ")}`})}t.tools=[...r]}function QVr(e,t){if(e.length===0){t.diagnostics.push({type:"error",message:"--thinking requires a value"});return}t.thinking=e}function qzo(e,t,n,r){return e==="--no-discover-workspaces"?(r.discoverWorkspaces=!1,n):e==="--discover-workspaces"?t!==void 0&&R2.test(t)?($Vr(t,r),n+1):(r.discoverWorkspaces=!0,r.discoverWorkspacesDepth=1,n):e.startsWith("--discover-workspaces=")?($Vr(e.slice(22),r),n):null}function Kzo(e,t,n,r){return e==="--thinking"?t===void 0||t.startsWith("-")?(r.diagnostics.push({type:"error",message:"--thinking requires a value"}),n):(QVr(t,r),n+1):e.startsWith("--thinking=")?(QVr(e.slice(11),r),n):null}function Jzo(e,t,n,r){if(e==="--acp")return r.mode="acp",n;if(e==="--mode"&&t!==void 0)return zzo(t,r),n+1;let i=qzo(e,t,n,r);if(i!==null)return i;if(e==="--worktree")return $Ut(t)?(r.worktree=t,n+1):(r.worktree=!0,n);if(e.startsWith("--worktree="))return r.worktree=e.slice(11),n;if(e==="--models"&&t!==void 0)return r.models=t.split(",").map(o=>o.trim()),n+1;if(e==="--tools"&&t!==void 0)return Xzo(t,r),n+1;let s=Kzo(e,t,n,r);return s!==null?s:e==="--list-models"?$Ut(t)?(r.listModels=t,n+1):(r.listModels=!0,n):e==="--list-models-json"?(r.listModelsJson=!0,n):null}function eXo(e,t,n,r){let i=e.indexOf("=");if(i===-1){let s=e.slice(2);return $Ut(t)?(r.unknownFlags.set(s,t),n+1):(r.unknownFlags.set(s,!0),n)}return r.unknownFlags.set(e.slice(2,i),e.slice(i+1)),n}function nXo(e){if(!((e[0]==="model"||e[0]==="models")&&e[1]==="list"))return e;let n=e.slice(2),r=n.includes("--json");return["--list-models",...n.filter(s=>s!=="--json"),...r?["--list-models-json"]:[]]}function rXo(e){for(let t=0;t<e.length-2;t++)if(e[t]==="cloud"&&e[t+1]==="run-as-agent"&&YVr.test(e[t+2]??""))return[...e.slice(0,t),"--cloud-agent",e[t+2],...e.slice(t+3),tXo];return e}function iXo(e,t){if(e.option){let{key:n,value:r}=e.option;t[n]=r}e.diagnostic&&t.diagnostics.push(e.diagnostic)}function sXo({arg:e,next:t,index:n,result:r,literalPositionals:i}){if(e.startsWith("@")&&!i)r.fileArgs.push(e.slice(1));else{if(e.startsWith("--"))return eXo(e,t,n,r)+1;e.startsWith("-")?r.diagnostics.push({type:"error",message:`Unknown option: ${e}`}):r.messages.push(e)}return n+1}function Pbe(e,t){let n=t?.compatibilityRewrites===!1?e:rXo(nXo(e)),r={messages:[],fileArgs:[],unknownFlags:new Map,diagnostics:[]},i=0;for(let[o,a]of n.entries()){if(o<i)continue;if(a==="--"){r.messages.push(...n.slice(o+1));break}if(t?.stopAtPositional&&!a.startsWith("-")){r.messages.push(...n.slice(o));break}let l=n[o+1],u=WUt(n,o);if(u){iXo(u,r),i=u.nextIndex;continue}let c=jzo(a,l,o,r);if(c!==null){i=c+1;continue}let d=Jzo(a,l,o,r);if(d!==null){i=d+1;continue}i=sXo({arg:a,next:l,index:o,result:r,literalPositionals:t?.literalPositionals})}aXo(r);let s=r.unknownFlags.get("cloud-agent");return typeof s=="string"&&YVr.test(s)&&(r.cloudAgentId=s),r}function aXo(e){let t=e.unknownFlags.get("enhance-prompt");if(t!==void 0){if(typeof t=="string"&&oXo.has(t.toLowerCase())){e.unknownFlags.delete("enhance-prompt");return}if(e.mode==="json"||e.mode==="rpc"||e.mode==="acp"){e.diagnostics.push({type:"error",message:`--enhance-prompt is not compatible with --mode ${e.mode}`});return}e.print||e.diagnostics.push({type:"error",message:"--enhance-prompt requires print mode (-p)"})}}function ZVr(e){let t=`${mt.bold(ei)} - AI coding assistant with read, bash, edit, write tools
11452
11452
 
11453
11453
  ${mt.bold("Usage:")}
@@ -12506,7 +12506,7 @@ ${a.join(`
12506
12506
  ${u}`;let c=" ".repeat(Math.max(2,this.modelColumnWidth-Wt(a)+2));return a+c+u}addVisibleModelItems(t,n){for(let r=t;r<n;r++){let i=this.filteredModels[r];i&&this.listContainer.addChild(new Tn(()=>this.getModelLine(i,r),0,0))}}addScrollIndicator(t,n){t<=0&&n>=this.filteredModels.length||this.listContainer.addChild(new Tn(()=>fe.fg("muted",` (${this.selectedIndex+1}/${this.filteredModels.length})`),0,0))}addListStatus(){if(this.errorMessage){for(let n of this.errorMessage.split(`
12507
12507
  `))this.listContainer.addChild(new Tn(()=>fe.fg("error",n),0,0));return}if(this.filteredModels.length===0){this.listContainer.addChild(new Tn(()=>fe.fg("muted"," No matching models"),0,0));return}let t=this.filteredModels[this.selectedIndex];t&&(this.listContainer.addChild(new st(1)),this.listContainer.addChild(new Tn(()=>fe.fg("muted",` Model Name: ${t.model.name}`),0,0)))}updateList(){this.keyHintsText.invalidate(),this.listContainer.clear();let{startIndex:t,endIndex:n}=this.getVisibleModelRange();this.addVisibleModelItems(t,n),this.addScrollIndicator(t,n),this.addListStatus()}handleInput(t){let n=Hn();if(Nt(t,"shift+tab")){this.toggleScope();return}if(n.matches(t,"tui.input.tab")){this.cycleThinking();return}if(n.matches(t,"tui.select.up")){this.moveSelection(-1);return}if(n.matches(t,"tui.select.down")){this.moveSelection(1);return}if(n.matches(t,"tui.select.confirm")){this.confirmSelection();return}if(n.matches(t,"tui.select.cancel")){this.onCancelCallback();return}this.searchInput.handleInput(t),this.filterModels(this.searchInput.getValue())}toggleScope(){if(this.scopedModelItems.length===0)return;let t=this.scope==="all"?"scoped":"all";this.setScope(t)}moveSelection(t){let r=this.filteredModels.length-1;r<0||(this.selectedIndex+=t,this.selectedIndex<0&&(this.selectedIndex=r),this.selectedIndex>r&&(this.selectedIndex=0),this.updateList())}getPendingThinking(t){let n=JSON.stringify([t.provider,t.id]),r=this.pendingThinking.get(n);if(r)return r;let i=co(this.currentModel,t)?this.currentReasoningSelection:void 0,s=ss(t,i?.kind==="explicit"?i.effort:void 0),o=i&&s.valid?i:s,a=o.kind==="model-default"?{kind:"model-default"}:{kind:"explicit",effort:o.effort};return this.pendingThinking.set(n,a),a}getThinkingSelectionIndex(t,n){let r=this.getPendingThinking(t);return n.findIndex(i=>i.kind===r.kind&&(i.kind==="model-default"||r.kind==="explicit"&&i.effort===r.effort))}cycleThinking(){let t=this.filteredModels[this.selectedIndex]?.model;if(!t)return;let n=zf(t);if(n.length<2)return;let r=this.getThinkingSelectionIndex(t,n),i=n[(r+1)%n.length];i&&(this.pendingThinking.set(JSON.stringify([t.provider,t.id]),i),this.updateList(),this.tui.requestRender())}getThinkingLine(t){let n=zf(t);if(n.length===0)return"";let r=this.getThinkingSelectionIndex(t,n);return r<0&&(r=n.length,n.push(this.getPendingThinking(t))),n.map((s,o)=>{let a=IA(t,s);return o===r?fe.fg("accent",`[${a}]`):fe.fg("muted",a)}).join(fe.fg("dim"," \xB7 "))}confirmSelection(){let t=this.filteredModels[this.selectedIndex]?.model;if(!t)return;let n=zf(t).length>0?this.getPendingThinking(t):void 0;this.onSelectCallback(t,n)}render(t){return t!==this.renderWidth&&(this.renderWidth=t,this.updateList()),super.render(t)}getSearchInput(){return this.searchInput}}});function Wwi(e){return bKa.flatMap(([t,n])=>e[t].map(r=>({category:n,item:r})))}function yKa(e){let t=0;for(let[n,{category:r}]of e.entries())r!==e[n+1]?.category&&(t=Math.max(t,new Set(e.slice(n,n+W5).map(i=>i.category)).size));return Math.max(1,Math.min(e.length,W5)+t+(e.length>W5?2:0))}function AKa(e,t){return e==="plugins"?"Plugins":e==="marketplaces"?"Marketplace":t>0?`Errors(${t})`:"Errors"}function EKa(e){let t=e.trim();return t?t.includes("github.com")?!0:/^[\w.-]+\/[\w.-]+$/.test(t):!1}var W5,bKa,NQ,L_e,$wi,VKt,NXe,GKt,Qwi=C(()=>{"use strict";tn();Zy();Ai();au();xc();W5=8,bKa=[["agents","Agents"],["commands","Commands"],["rules","Rules"],["mcpServers","MCP Servers"],["hooks","Hooks"],["skills","Skills"]],NQ=e=>Array.from(Eu(e),t=>{let n=t.charCodeAt(0);return n<32||n>=127&&n<=159?" ":t}).join("").trim();L_e=["plugins","marketplaces","errors"];$wi=[{label:"Auggie",repo:"augmentcode/auggie",description:"Augment's own curated plugins"},{label:"Claude (official)",repo:"anthropics/claude-plugins-official",description:"Anthropic's official plugin directory"},{label:"Superpowers",repo:"obra/superpowers-marketplace",description:"Skills & workflow plugins by obra"},{label:"Claude Code",repo:"anthropics/claude-code",description:"Plugins bundled with the Claude Code repo"}];VKt=class{data;selectedTab="plugins";viewStack=[{kind:"list"}];selectedIndex=0;maxVisible=15;addInput;listFilter;addError=null;busyMessage=null;addSelectedIndex=0;onClose;onExit;onChange;_focused=!1;get focused(){return this._focused}set focused(t){this._focused=t}constructor(t){this.data=t,this.addInput=new hi,this.listFilter=new hi}get currentView(){return this.viewStack.at(-1)??{kind:"list"}}push(t){this.viewStack.push(t),this.selectedIndex=0,this.onChange?.()}back(){if(this.viewStack.length>1){this.viewStack.pop(),this.selectedIndex=0,this.addError=null,this.onChange?.();return}this.onClose?.()}rowsForTab(){return this.selectedTab==="plugins"?this.data.getPlugins():this.selectedTab==="marketplaces"?this.data.getMarketplaces():this.data.getErrors()}rowSearchText(t){if(this.selectedTab==="plugins"){let n=t;return`${n.name} ${n.id} ${n.marketplace}`}if(this.selectedTab==="marketplaces"){let n=t;return`${n.name} ${n.dir}`}return t.message}filteredRows(){let t=this.listFilter.getValue(),n=this.rowsForTab();return t.trim()?uc(n,t,r=>this.rowSearchText(r)):n}invalidate(){}render(t){let n=this.currentView;return n.kind==="add-marketplace"?this.renderAddMarketplace(t):n.kind==="plugin-detail"?this.renderPluginDetail(t,n):n.kind==="marketplace-detail"?this.renderMarketplaceDetail(t,n.dir):this.renderList(t)}renderTabBar(t){let n=this.data.getErrors().length,r=L_e.map(i=>{let s=AKa(i,n);return i===this.selectedTab?fe.fg("accent",fe.bold(`[ ${s} ]`)):fe.fg("muted",` ${s} `)});return At(r.join(" "),t,"")}renderList(t){let n=[];n.push(this.renderTabBar(t)),n.push("");let r=this.rowsForTab().length;r>0&&(n.push(...this.listFilter.render(t)),n.push(""));let i=this.filteredRows();if(i.length===0){let a=r>0?"No matches":this.emptyLabel();return n.push(fe.fg("muted",` ${a}`)),n.push(""),n.push(this.renderHints()),n}let{start:s,end:o}=this.visibleRange(i.length);for(let a=s;a<o;a++)n.push(this.renderRow(i[a],a===this.selectedIndex,t));return(s>0||o<i.length)&&n.push(fe.fg("dim",` (${this.selectedIndex+1}/${i.length})`)),n.push(""),n.push(this.renderHints()),n}emptyLabel(){return this.selectedTab==="plugins"?"No plugins discovered":this.selectedTab==="marketplaces"?"No marketplaces installed \u2014 press Ctrl+N to add one":"No problems \u{1F389}"}renderRow(t,n,r){let i=n?"> ":" ";if(this.selectedTab==="plugins"){let a=t,l=a.enabled?fe.fg("success","[x]"):fe.fg("dim","[ ]"),u=a.diagnostics.length>0?fe.fg("warning"," \u26A0"):"",c=n?fe.bold(a.name):a.name,d=fe.fg("dim",` @${a.marketplace}`);return At(`${i}${l} ${c}${d}${u}`,r,"...")}if(this.selectedTab==="marketplaces"){let a=t,l=n?fe.bold(a.name):a.name,u=fe.fg("dim",` (${a.pluginCount} plugins)`);return At(`${i}${l}${u}`,r,"...")}let s=t,o=n?fe.bold(s.message):s.message;return At(`${i}${fe.fg("warning",o)}`,r,"...")}renderHints(){let t=fe.fg("muted"," \xB7 "),n=this.listFilter.getValue().trim().length>0,r=_a("\u2191\u2193","move")+t+_a("tab","switch"),i=n?_a("esc","clear filter"):_a("type","filter")+t+_a("esc","close");return this.selectedTab==="plugins"?r+t+_a("space","toggle")+t+_a("enter","details")+t+i:this.selectedTab==="marketplaces"?r+t+_a("^n","add")+t+_a("^x","remove")+t+_a("enter","details")+t+i:r+t+i}loadPluginDetail(t){if(!t.loaded){t.loaded=!0;try{t.details=this.data.getPluginDetails(t.pluginId)}catch{t.details={agents:[],commands:[],rules:[],mcpServers:[],hooks:[],skills:[],diagnostics:["Could not read plugin contents metadata"]}}}return t.details}renderPluginDetail(t,n){let r=c=>At(c,Math.max(0,t),"\u2026"),i=this.data.getPlugins().find(c=>c.id===n.pluginId),s=i?this.loadPluginDetail(n):void 0;if(!i||!s)return[fe.fg("muted"," Plugin no longer available"),"",Wr("tui.select.cancel","back")].map(r);let o=[fe.bold(` ${NQ(i.name)}`),fe.fg("muted",` ${NQ(i.id)}`),"",` Status: ${i.enabled?fe.fg("success","enabled"):fe.fg("dim","disabled")}`];for(let[c,d]of[["description","Description"],["version","Version"],["author","Author"],["homepage","Homepage"]]){let p=NQ(s[c]??"");p&&o.push(` ${fe.fg("muted",`${d}:`)} ${p}`)}let a=[...i.diagnostics,...s.diagnostics];if(a.length>0){o.push("",fe.fg("warning"," Problems:"));for(let c of a)o.push(fe.fg("warning",` \u2022 ${NQ(c)}`))}let l=Wwi(s);n.offset=Math.max(0,Math.min(n.offset,l.length-W5)),o.push(...this.renderPluginContents(t,l,n.offset));let u=[_a("space","toggle"),Wr("tui.select.cancel","back")];return l.length>W5&&u.unshift(_a(`${Da("tui.select.up")}/${Da("tui.select.down")}`,"scroll")),o.push("",...fr(u.join(fe.fg("muted"," \xB7 ")),Math.max(1,t-2)).map(c=>` ${c}`)),o.map(r)}renderPluginContents(t,n,r){let i=["",fe.bold(` Configs (${n.length})`)],s=n.length>W5,o=i.length+yKa(n);n.length===0&&i.push(fe.fg("muted"," No configs")),s&&i.push(r>0?fe.fg("dim",` \u2191 ${r} more above`):"");let a=n.slice(r,r+W5),l=Math.max(1,Math.min(Math.max(0,...a.map(({item:d})=>Wt(NQ(d.name)))),Math.floor((t-8)*.4))),u;for(let{category:d,item:p}of a){d!==u&&(i.push(fe.fg("accent",` ${d}`)),u=d);let m=At(NQ(p.name),l,"\u2026"),f=" ".repeat(Math.max(0,l-Wt(m))+2),h=NQ(p.description??"")||"No description provided";i.push(` ${fe.fg("dim","\u2022")} ${m}${f}${fe.fg("muted",h)}`)}let c=n.length-r-a.length;for(;i.length<o-(s?1:0);)i.push("");return s&&i.push(c>0?fe.fg("dim",` \u2193 ${c} more below`):""),i}renderMarketplaceDetail(t,n){let r=this.data.getMarketplaces().find(o=>o.dir===n),i=[];if(!r)return i.push(fe.fg("muted"," Marketplace no longer available")),i.push(""),i.push(_a("esc","back")),i;i.push(fe.bold(` ${r.name}`)),i.push(fe.fg("muted",` ${r.dir}`)),i.push(""),i.push(` Plugins: ${r.pluginCount}`),i.push("");let s=this.data.getPlugins().filter(o=>o.marketplace===r.name||o.marketplace===r.dir);for(let o of s.slice(0,20)){let a=o.enabled?fe.fg("success","[x]"):fe.fg("dim","[ ]");i.push(At(` ${a} ${o.name}`,t,"..."))}return i.push(""),i.push(_a("d","remove")+fe.fg("muted"," \xB7 ")+_a("esc","back")),i}isCuratedInstalled(t){let n=t.split("/").at(-1)?.toLowerCase()??"";return n?this.data.getMarketplaces().some(r=>{let i=r.name.toLowerCase(),s=r.dir.toLowerCase();return i===n||s===n}):!1}addPickRows(){let t=this.addInput.getValue().trim().toLowerCase(),r=$wi.filter(o=>t?o.label.toLowerCase().includes(t)||o.repo.toLowerCase().includes(t)||o.description.toLowerCase().includes(t):!0).map(o=>({kind:"curated",entry:o,installed:this.isCuratedInstalled(o.repo)})),i=this.addInput.getValue().trim(),s=$wi.some(o=>o.repo.toLowerCase()===i.toLowerCase());return EKa(i)&&!s&&r.push({kind:"custom",repo:i}),r}renderAddMarketplace(t){let n=[];n.push(fe.bold(" Add marketplace")),n.push(fe.fg("muted"," Pick a popular one or type owner/repo or a URL:")),n.push(""),n.push(...this.addInput.render(t)),n.push("");let r=this.addPickRows();if(r.length===0)n.push(fe.fg("muted"," No matches \u2014 type owner/repo or a URL"));else for(let i=0;i<r.length;i++)n.push(...this.renderAddPickRow(r[i],i===this.addSelectedIndex,t));return this.busyMessage&&(n.push(""),n.push(fe.fg("muted",` ${this.busyMessage}`))),this.addError&&(n.push(""),n.push(At(` ${fe.fg("error",this.addError)}`,t,"..."))),n.push(""),n.push(_a("\u2191\u2193","move")+fe.fg("muted"," \xB7 ")+_a("enter","add")+fe.fg("muted"," \xB7 ")+_a("esc","cancel")),n}renderAddPickRow(t,n,r){let i=n?"> ":" ";if(t.kind==="custom"){let d=n?fe.bold(`Add "${t.repo}"`):`Add "${t.repo}"`;return[At(`${i}${fe.fg("accent","+")} ${d}`,r,"...")]}let{entry:s,installed:o}=t,a=n?fe.bold(s.label):s.label,l=o?fe.fg("success"," (installed)"):"",u=At(`${i}${a}${l}`,r,"..."),c=At(` ${fe.fg("dim",s.repo)} ${fe.fg("muted",s.description)}`,r,"...");return[u,c]}visibleRange(t){let n=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),t-this.maxVisible));return{start:n,end:Math.min(n+this.maxVisible,t)}}handleInput(t){if(Nt(t,"ctrl+c")){this.onExit?.();return}let n=this.currentView;if(n.kind==="add-marketplace"){this.handleAddInput(t);return}if(n.kind==="plugin-detail"){this.handlePluginDetailInput(t,n);return}if(n.kind==="marketplace-detail"){this.handleMarketplaceDetailInput(t,n.dir);return}this.handleListInput(t)}handleListInput(t){let n=Hn(),r=this.filteredRows();if(n.matches(t,"tui.select.cancel")){if(this.listFilter.getValue().trim()){this.listFilter.setValue(""),this.selectedIndex=0,this.onChange?.();return}this.back();return}if(n.matches(t,"tui.select.up")){this.selectedIndex=Math.max(0,this.selectedIndex-1),this.onChange?.();return}if(n.matches(t,"tui.select.down")){this.selectedIndex=Math.min(Math.max(0,r.length-1),this.selectedIndex+1),this.onChange?.();return}if(t===" "||Nt(t,"right")){this.cycleTab(1);return}if(Nt(t,"shift+tab")||Nt(t,"left")){this.cycleTab(-1);return}if(t===" "&&this.selectedTab==="plugins"){this.togglePluginVisible(this.selectedIndex);return}if(n.matches(t,"tui.select.confirm")){this.openDetailVisible(this.selectedIndex);return}if(this.selectedTab==="marketplaces"){if(Nt(t,"ctrl+n")){this.addInput.setValue(""),this.addError=null,this.addSelectedIndex=0,this.push({kind:"add-marketplace"});return}if(Nt(t,"ctrl+x")){this.removeMarketplaceVisible(this.selectedIndex);return}}this.listFilter.handleInput(t),this.selectedIndex=0,this.onChange?.()}togglePluginVisible(t){let n=this.filteredRows()[t];if(!n||this.selectedTab!=="plugins")return;let r=n.id,i=this.data.getPlugins().findIndex(s=>s.id===r);i>=0&&this.togglePluginAt(i)}openDetailVisible(t){let n=this.filteredRows()[t];if(n){if(this.selectedTab==="plugins"){let r=n.id,i=this.data.getPlugins().findIndex(s=>s.id===r);i>=0&&this.openDetailAt(i);return}if(this.selectedTab==="marketplaces"){let r=n.dir,i=this.data.getMarketplaces().findIndex(s=>s.dir===r);i>=0&&this.openDetailAt(i);return}}}removeMarketplaceVisible(t){let n=this.filteredRows()[t];if(!n||this.selectedTab!=="marketplaces")return;let r=n.dir,i=this.data.getMarketplaces().findIndex(s=>s.dir===r);i>=0&&this.removeMarketplaceAt(i)}cycleTab(t){let r=(L_e.indexOf(this.selectedTab)+t+L_e.length)%L_e.length;this.selectedTab=L_e[r],this.selectedIndex=0,this.listFilter.setValue(""),this.onChange?.()}openDetailAt(t){if(this.selectedTab==="plugins"){let n=this.data.getPlugins()[t];n&&this.push({kind:"plugin-detail",pluginId:n.id,offset:0});return}if(this.selectedTab==="marketplaces"){let n=this.data.getMarketplaces()[t];n&&this.push({kind:"marketplace-detail",dir:n.dir})}}togglePluginAt(t){let n=this.data.getPlugins()[t];n&&(this.data.settingsManager.setPluginEnabled(n.id,!n.enabled),this.data.refresh(),this.onChange?.())}removeMarketplaceAt(t){let n=this.data.getMarketplaces()[t];if(!n)return;this.data.removeMarketplace(n.dir)||(this.data.refresh(),this.selectedIndex=0),this.onChange?.()}handlePluginDetailInput(t,n){let r=Hn();if(r.matches(t,"tui.select.cancel")){this.back();return}if(t===" "){let a=this.data.getPlugins().find(l=>l.id===n.pluginId);a&&(this.data.settingsManager.setPluginEnabled(a.id,!a.enabled),this.data.refresh(),n.loaded=!1,n.details=void 0,n.offset=0,this.onChange?.());return}let i=r.matches(t,"tui.select.up"),s=r.matches(t,"tui.select.down");if(!i&&!s)return;let o=n.details?Wwi(n.details).length:0;n.offset=Math.max(0,Math.min(n.offset+(s?1:-1),o-W5)),this.onChange?.()}handleMarketplaceDetailInput(t,n){if(Hn().matches(t,"tui.select.cancel")){this.back();return}t==="d"&&(this.data.removeMarketplace(n)||(this.data.refresh(),this.back()))}handleAddInput(t){let n=Hn();if(n.matches(t,"tui.select.cancel")){this.back();return}if(this.busyMessage)return;let r=this.addPickRows();if(n.matches(t,"tui.select.up")){this.addSelectedIndex=Math.max(0,this.addSelectedIndex-1),this.onChange?.();return}if(n.matches(t,"tui.select.down")){this.addSelectedIndex=Math.min(Math.max(0,r.length-1),this.addSelectedIndex+1),this.onChange?.();return}if(n.matches(t,"tui.select.confirm")){let i=r[this.addSelectedIndex],s=i?.kind==="curated"?i.entry.repo:i?.repo??this.addInput.getValue().trim();this.submitAdd(s);return}this.addInput.handleInput(t),this.addSelectedIndex=0,this.onChange?.()}submitAdd(t){t&&(this.busyMessage=`Cloning ${t}\u2026`,this.addError=null,this.onChange?.(),this.data.addMarketplace(t).then(n=>{if(this.busyMessage=null,n){this.addError=n,this.onChange?.();return}this.data.refresh(),this.back()}).catch(n=>{this.busyMessage=null,this.addError=n instanceof Error?n.message:String(n),this.onChange?.()}))}},NXe=class extends Vt{body;_focused=!1;get focused(){return this._focused}set focused(t){this._focused=t,this.body.focused=t}handleInput(t){this.body.handleInput(t)}constructor(t,n,r,i){super(),this.addChild(new st(1)),this.addChild(new sr),this.addChild(new st(1)),this.addChild(new GKt),this.addChild(new st(1)),this.body=new VKt(t),this.body.onClose=n,this.body.onExit=r,this.body.onChange=()=>i(),this.addChild(this.body),this.addChild(new st(1)),this.addChild(new sr)}},GKt=class{invalidate(){}render(t){let n=fe.bold("Plugins");return[At(` ${n}`,t,"")]}}});var cre,WKt=C(()=>{"use strict";tn();Ai();xc();cre=class extends Gl{expanded=!1;markdownTheme;constructor(t){super(1,1,n=>fe.bg("customMessageBg",n)),this.markdownTheme=t}setExpanded(t){this.expanded=t,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}getExpandedHeaderSuffix(){return""}getCollapsedHintPrefix(){return""}updateDisplay(){this.clear(),this.expanded?this.renderExpanded():this.renderCollapsed()}renderExpanded(){let t=fe.fg("customMessageLabel",`\x1B[1m${this.getLabel()}\x1B[22m`);this.addChild(new Ot(t,0,0));let n=this.getExpandedHeaderSuffix(),r=`**${this.getTitle()}**${n?` ${n}`:""}
12508
12508
 
12509
- `;this.addChild(new Os(r+this.getBody(),0,0,this.markdownTheme,{color:i=>fe.fg("customMessageText",i)}))}renderCollapsed(){let t=this.getCollapsedHintPrefix(),n=t?[t]:[];n.push(`${Da("app.tools.expand")} to expand`);let r=fe.fg("customMessageLabel",`\x1B[1m${this.getLabel()}\x1B[22m `)+fe.fg("customMessageText",this.getTitle())+fe.fg("dim",` (${n.join(", ")})`);this.addChild(new Ot(r,0,0))}}});import{homedir as _Ka}from"node:os";var F_e,$Kt=C(()=>{"use strict";b1();Ai();WKt();F_e=class extends cre{command;args;expandedBody;source;constructor(t,n,r,i=bf(),s){super(i),this.command=t,this.args=n,this.expandedBody=r,this.source=s,this.updateDisplay()}getLabel(){return"[prompt]"}getTitle(){return Ih({command:this.command,args:this.args})}getBody(){return this.expandedBody.trim()?this.expandedBody:"_(empty prompt body)_"}getExpandedHeaderSuffix(){let t=this.formatSourcePath();return t?`_(from ${t})_`:""}getCollapsedHintPrefix(){let t=this.formatSourcePath();return t?`from ${t}`:""}formatSourcePath(){let t=this.source?.path;if(!t)return;let n=_Ka();return n&&t.startsWith(`${n}/`)?`~${t.slice(n.length)}`:t}}});function xKa(e){return{name:MXe(e.name),type:SKa[e.type]}}function CKa(e,t){let n=Math.min(15,Math.max(4,e-8)),r=t.reduce((i,s)=>Math.max(i,Wt(MXe(s.name))),20);return{nameWidth:Math.max(1,Math.min(r,e-4-n)),typeWidth:n}}function Hwi(e,t){let n=At(e,t,"\u2026");return n+" ".repeat(Math.max(0,t-Wt(n))+2)}function TKa(e,t){return fr(MXe(e),Math.max(1,t-2)).map(n=>` ${fe.fg("muted",n)}`)}var kXe,SKa,vKa,MXe,OXe,Ywi=C(()=>{"use strict";tn();Zy();Ai();au();xc();kXe=8,SKa={always:"always_apply","agent-requested":"agent_requested",manual:"manual"},vKa={always:"success","agent-requested":"accent",manual:"warning"},MXe=e=>Array.from(Eu(e),t=>{let n=t.charCodeAt(0);return n<32||n>=127&&n<=159?" ":t}).join("").trim();OXe=class{focused=!1;selected=0;showingDiagnostics=!1;snapshot;onClose;requestRender;constructor(t,n,r){this.snapshot=t,this.onClose=n,this.requestRender=r}invalidate(){}render(t){let n=m=>At(m,Math.max(0,t),"\u2026"),{rules:r,diagnostics:i}=this.snapshot,s=new sr(m=>fe.fg("border",m)),o=["",...s.render(t),"",n(fe.fg("accent",fe.bold(" Rules"))),""];i.length>0&&o.push(n(fe.fg("warning",` ${i.length} rule warning(s)`)),"");let a=CKa(t,r),{nameWidth:l,typeWidth:u}=a;o.push(n(fe.fg("muted",this.showingDiagnostics?" Warnings":` ${Hwi("Name",l)}${At("Type",u,"\u2026")}`))),this.showingDiagnostics||o.push("");let c=this.showingDiagnostics?i:r;if(c.length===0)o.push(n(fe.fg("muted",this.showingDiagnostics?" No warnings":" No rules loaded")));else{let m=Math.max(0,Math.min(this.selected-Math.floor(kXe/2),c.length-kXe));for(let f=m;f<Math.min(m+kXe,c.length);f++)o.push(...this.renderEntry(f,t,a));c.length>kXe&&o.push(n(fe.fg("dim",` ${this.selected+1}/${c.length}`)))}let d=fe.fg("muted"," \xB7 "),p=[_a(`${Da("tui.select.up")}/${Da("tui.select.down")}`,"navigate"),Wr("tui.select.cancel","close")];return i.length>0&&p.push(_a("d",this.showingDiagnostics?"rules":"inspect")),o.push("",...fr(p.join(d),Math.max(1,t-2)).map(m=>n(` ${m}`)),"",...s.render(t)),o.map(n)}renderEntry(t,n,r){let i=f=>At(f,n,"\u2026"),s=t===this.selected,o=s?fe.fg("accent","\u2192 "):" ";if(this.showingDiagnostics){let f=this.snapshot.diagnostics[t],h=MXe(f.message);if(s){let g=fr(h,Math.max(1,n-2)).map((b,A)=>i(`${A===0?o:" "}${fe.fg("warning",b)}`));return f.path&&g.push(...TKa(`Path: ${f.path}`,n)),g}return[i(`${o}${fe.fg("warning",h)}`)]}let{name:a,type:l}=xKa(this.snapshot.rules[t]),{nameWidth:u,typeWidth:c}=r,d=Hwi(a,u),p=s?fe.fg("accent",fe.bold(d)):d,m=fe.fg(vKa[this.snapshot.rules[t].type],At(l,c,"\u2026"));return[i(o+p+m)]}handleInput(t){let n=Hn();if(n.matches(t,"tui.select.cancel")){this.onClose();return}if(Nt(t,"d")&&this.snapshot.diagnostics.length>0){this.showingDiagnostics=!this.showingDiagnostics,this.selected=0,this.requestRender();return}let r=this.showingDiagnostics?this.snapshot.diagnostics.length:this.snapshot.rules.length;if(r!==0){if(n.matches(t,"tui.select.up"))this.selected=(this.selected-1+r)%r;else if(n.matches(t,"tui.select.down"))this.selected=(this.selected+1)%r;else return;this.requestRender()}}}});function PXe(e,t){return e===null||e.includes(t)}function IKa(e,t){if(e===null)return[t];let n=e.indexOf(t);return n>=0?[...e.slice(0,n),...e.slice(n+1)]:[...e,t]}function Zwi(e,t,n){if(e===null)return null;let r=n??t,i=[...e];for(let s of r)i.includes(s)||i.push(s);return i.length===t.length?null:i}function jwi(e,t,n){if(e===null)return n?t.filter(i=>!n.includes(i)):[];let r=new Set(n??e);return e.filter(i=>!r.has(i))}function wKa(e,t,n,r){let i=e??[...t],s=i.indexOf(n);if(s<0)return i;let o=s+r;if(o<0||o>=i.length)return i;let a=[...i];return[a[s],a[o]]=[a[o],a[s]],a}function RKa(e,t){if(e===null)return t;let n=new Set(e);return[...e,...t.filter(r=>!n.has(r))]}var U_e,QKt=C(()=>{"use strict";tn();Af();Ai();au();Gg();U_e=class extends Vt{modelsById=new Map;allIds=[];enabledIds=null;filteredItems=[];selectedIndex=0;searchInput;_focused=!1;get focused(){return this._focused}set focused(t){this._focused=t,this.searchInput.focused=t}listContainer;footerText;callbacks;maxVisible=15;isDirty=!1;constructor(t,n){super(),this.callbacks=n;for(let r of t.allModels){let i=`${r.provider}/${r.id}`;this.modelsById.set(i,r),this.allIds.push(i)}this.enabledIds=t.hasEnabledModelsFilter?[...t.enabledModelIds]:null,this.filteredItems=this.buildItems(),this.addChild(new sr),this.addChild(new st(1)),this.addChild(new Tn(()=>fe.fg("accent",fe.bold("Model Configuration")),0,0)),this.addChild(new Tn(()=>fe.fg("muted","Session-only. Ctrl+S to save to settings."),0,0)),this.addChild(new st(1)),this.searchInput=new hi,this.addChild(this.searchInput),this.addChild(new st(1)),this.listContainer=new Vt,this.addChild(this.listContainer),this.addChild(new st(1)),this.footerText=new Tn(()=>this.getFooterText(),0,0),this.addChild(this.footerText),this.addChild(new sr),this.updateList()}buildItems(){let t=[];for(let n of RKa(this.enabledIds,this.allIds)){let r=this.modelsById.get(n);r&&t.push({fullId:n,model:r,enabled:PXe(this.enabledIds,n)})}return t}getFooterText(){let t=this.enabledIds?.length??this.allIds.length,i=["Enter toggle","^A all","^X clear","^P provider","Alt+\u2191\u2193 reorder","^S save",this.enabledIds===null?"all enabled":`${t}/${this.allIds.length} enabled`];return this.isDirty?fe.fg("dim",` ${i.join(" \xB7 ")} `)+fe.fg("warning","(unsaved)"):fe.fg("dim",` ${i.join(" \xB7 ")}`)}refresh(){let t=this.searchInput.getValue(),n=this.buildItems();this.filteredItems=t?uc(n,t,r=>D9(r.model)):n,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredItems.length-1)),this.updateList(),this.footerText.setText(()=>this.getFooterText())}updateList(){if(this.listContainer.clear(),this.filteredItems.length===0){this.listContainer.addChild(new Tn(()=>fe.fg("muted"," No matching models"),0,0));return}let t=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),n=Math.min(t+this.maxVisible,this.filteredItems.length),r=this.enabledIds===null;for(let i=t;i<n;i++){let s=this.filteredItems[i];s&&this.listContainer.addChild(new Tn(()=>{let o=i===this.selectedIndex,a=o?fe.fg("accent","\u2192 "):" ",l=o?fe.fg("accent",s.model.name||s.model.id):s.model.name||s.model.id,u=fe.fg("muted",` [${s.model.provider}]`),c;return r?c="":s.enabled?c=fe.fg("success"," \u2713"):c=fe.fg("dim"," \u2717"),`${a}${l}${u}${c}`},0,0))}if((t>0||n<this.filteredItems.length)&&this.listContainer.addChild(new Tn(()=>fe.fg("muted",` (${this.selectedIndex+1}/${this.filteredItems.length})`),0,0)),this.filteredItems.length>0){let i=this.filteredItems[this.selectedIndex];this.listContainer.addChild(new st(1)),this.listContainer.addChild(new Tn(()=>fe.fg("muted",` Model Name: ${i.model.name}`),0,0))}}handleInput(t){let n=Hn();if(n.matches(t,"tui.select.up")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.updateList();return}if(n.matches(t,"tui.select.down")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.updateList();return}if(Nt(t,Wl.alt("up"))||Nt(t,Wl.alt("down"))){let r=this.filteredItems[this.selectedIndex];if(r&&PXe(this.enabledIds,r.fullId)){let i=Nt(t,Wl.alt("up"))?-1:1,s=this.enabledIds??this.allIds,a=s.indexOf(r.fullId)+i;a>=0&&a<s.length&&(this.enabledIds=wKa(this.enabledIds,this.allIds,r.fullId,i),this.isDirty=!0,this.selectedIndex+=i,this.refresh())}return}if(Nt(t,Wl.enter)){let r=this.filteredItems[this.selectedIndex];if(r){let i=this.enabledIds===null;this.enabledIds=IKa(this.enabledIds,r.fullId),this.isDirty=!0,i&&this.callbacks.onClearAll(),this.callbacks.onModelToggle(r.fullId,PXe(this.enabledIds,r.fullId)),this.refresh()}return}if(Nt(t,Wl.ctrl("a"))){let r=this.searchInput.getValue()?this.filteredItems.map(i=>i.fullId):void 0;this.enabledIds=Zwi(this.enabledIds,this.allIds,r),this.isDirty=!0,this.callbacks.onEnableAll(r??this.allIds),this.refresh();return}if(Nt(t,Wl.ctrl("x"))){let r=this.searchInput.getValue()?this.filteredItems.map(i=>i.fullId):void 0;this.enabledIds=jwi(this.enabledIds,this.allIds,r),this.isDirty=!0,this.callbacks.onClearAll(),this.refresh();return}if(Nt(t,Wl.ctrl("p"))){let r=this.filteredItems[this.selectedIndex];if(r){let i=r.model.provider,s=this.allIds.filter(a=>this.modelsById.get(a)?.provider===i),o=s.every(a=>PXe(this.enabledIds,a));this.enabledIds=o?jwi(this.enabledIds,this.allIds,s):Zwi(this.enabledIds,this.allIds,s),this.isDirty=!0,this.callbacks.onToggleProvider(i,s,!o),this.refresh()}return}if(Nt(t,Wl.ctrl("s"))){this.callbacks.onPersist(this.enabledIds??[...this.allIds]),this.isDirty=!1,this.footerText.setText(()=>this.getFooterText());return}if(Nt(t,Wl.ctrl("c"))){this.searchInput.getValue()?(this.searchInput.setValue(""),this.refresh()):this.callbacks.onCancel();return}if(Nt(t,Wl.escape)){this.callbacks.onCancel();return}this.searchInput.handleInput(t),this.refresh()}getSearchInput(){return this.searchInput}}});function kKa(e){return e===void 0?"Automatic":e?"Always on":"Always off"}var NKa,HKt,kQ,YKt=C(()=>{"use strict";tn();Ai();au();Gg();NKa={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},HKt=class extends Vt{selectList;constructor(t,n,r,i,s,o,a){super(),this.addChild(new Tn(()=>fe.bold(fe.fg("accent",t)),0,0)),n&&(this.addChild(new st(1)),this.addChild(new Tn(()=>fe.fg("muted",n),0,0))),this.addChild(new st(1)),this.selectList=new Rc(r,Math.min(r.length,10),yE(),NKa);let l=r.findIndex(u=>u.value===i);l!==-1&&this.selectList.setSelectedIndex(l),this.selectList.onSelect=u=>{s(u.value)},this.selectList.onCancel=o,a&&(this.selectList.onSelectionChange=u=>{a(u.value)}),this.addChild(this.selectList),this.addChild(new st(1)),this.addChild(new Tn(()=>fe.fg("dim"," Enter to select \xB7 Esc to go back"),0,0))}handleInput(t){this.selectList.handleInput(t)}};kQ=class extends Vt{settingsList;constructor(t,n){super();let r=Rl().images,i=[{id:"autocompact",label:"Auto-compact",description:"Automatically compact context when it gets too large",currentValue:t.autoCompact?"true":"false",values:["true","false"]},{id:"steering-mode",label:"Steering mode",description:"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:t.steeringMode,values:["one-at-a-time","all"]},{id:"follow-up-mode",label:"Follow-up mode",description:"Alt+Enter queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:t.followUpMode,values:["one-at-a-time","all"]},{id:"transport",label:"Transport",description:"Preferred transport for providers that support multiple transports",currentValue:t.transport,values:["sse","websocket","auto"]},{id:"hide-thinking",label:"Hide thinking",description:"Hide thinking blocks in assistant responses",currentValue:t.hideThinkingBlock?"true":"false",values:["true","false"]},{id:"collapse-changelog",label:"Collapse changelog",description:"Show condensed changelog after updates",currentValue:t.collapseChangelog?"true":"false",values:["true","false"]},{id:"quiet-startup",label:"Quiet startup",description:"Disable verbose printing at startup",currentValue:t.quietStartup?"true":"false",values:["true","false"]},{id:"double-escape-action",label:"Double-escape action",description:"Action when pressing Escape twice with empty editor",currentValue:t.doubleEscapeAction,values:["tree","fork","none"]},{id:"tree-filter-mode",label:"Tree filter mode",description:"Default filter when opening /tree",currentValue:t.treeFilterMode,values:["default","no-tools","user-only","labeled-only","all"]},{id:"theme",label:"Theme",description:"Color theme for the interface",currentValue:t.currentTheme,submenu:(m,f)=>new HKt("Theme","Select color theme",t.availableThemes.map(h=>({value:h,label:h})),m,h=>{n.onThemeChange(h),f(h)},()=>{n.onThemePreview?.(m),f()},h=>{n.onThemePreview?.(h)})}];r&&i.splice(1,0,{id:"show-images",label:"Show images",description:"Render images inline in terminal",currentValue:t.showImages?"true":"false",values:["true","false"]}),i.splice(r?2:1,0,{id:"auto-resize-images",label:"Auto-resize images",description:"Resize large images to 2000x2000 max for better model compatibility",currentValue:t.autoResizeImages?"true":"false",values:["true","false"]});let s=i.findIndex(m=>m.id==="auto-resize-images");i.splice(s+1,0,{id:"block-images",label:"Block images",description:"Prevent images from being sent to LLM providers",currentValue:t.blockImages?"true":"false",values:["true","false"]});let o=i.findIndex(m=>m.id==="block-images");i.splice(o+1,0,{id:"skill-commands",label:"Skill commands",description:"Register skills as /skill:name commands",currentValue:t.enableSkillCommands?"true":"false",values:["true","false"]});let a=i.findIndex(m=>m.id==="skill-commands");i.splice(a+1,0,{id:"enable-hashline",label:"Enable hashline",description:"Use the hashline read/edit tools (overrides the built-ins). Takes effect on next launch.",currentValue:t.enableHashline?"true":"false",values:["true","false"]}),t.toolSearchAutoEnable&&i.push({id:"automatic-tool-search",label:"MCP tool discovery",description:"Find MCP tools on demand when their definitions take up too much context. Changes apply after restarting the CLI.",currentValue:kKa(t.toolSearchEnabled),values:["Automatic","Always on","Always off"]});let l=i.findIndex(m=>m.id==="enable-hashline");i.splice(l+1,0,{id:"collapse-prompt-commands",label:"Collapse prompt commands",description:"Render /command invocations as a single line (Ctrl+O to expand)",currentValue:t.collapsePromptCommands?"true":"false",values:["true","false"]});let u=i.findIndex(m=>m.id==="collapse-prompt-commands");i.splice(u+1,0,{id:"show-hardware-cursor",label:"Show hardware cursor",description:"Show the terminal cursor while still positioning it for IME support",currentValue:t.showHardwareCursor?"true":"false",values:["true","false"]});let c=i.findIndex(m=>m.id==="show-hardware-cursor");i.splice(c+1,0,{id:"editor-padding",label:"Editor padding",description:"Horizontal padding for input editor (0-3)",currentValue:String(t.editorPaddingX),values:["0","1","2","3"]});let d=i.findIndex(m=>m.id==="editor-padding");i.splice(d+1,0,{id:"autocomplete-max-visible",label:"Autocomplete max items",description:"Max visible items in autocomplete dropdown (3-20)",currentValue:String(t.autocompleteMaxVisible),values:["3","5","7","10","15","20"]});let p=i.findIndex(m=>m.id==="autocomplete-max-visible");i.splice(p+1,0,{id:"clear-on-shrink",label:"Clear on shrink",description:"Clear empty rows when content shrinks (may cause flicker)",currentValue:t.clearOnShrink?"true":"false",values:["true","false"]}),this.addChild(new sr),this.settingsList=new YM(i,10,PGe(),(m,f)=>{switch(m){case"autocompact":n.onAutoCompactChange(f==="true");break;case"show-images":n.onShowImagesChange(f==="true");break;case"auto-resize-images":n.onAutoResizeImagesChange(f==="true");break;case"block-images":n.onBlockImagesChange(f==="true");break;case"skill-commands":n.onEnableSkillCommandsChange(f==="true");break;case"automatic-tool-search":n.onToolSearchEnabledChange?.(f==="Automatic"?void 0:f==="Always on");break;case"enable-hashline":n.onEnableHashlineChange(f==="true");break;case"steering-mode":n.onSteeringModeChange(f);break;case"follow-up-mode":n.onFollowUpModeChange(f);break;case"transport":n.onTransportChange(f);break;case"hide-thinking":n.onHideThinkingBlockChange(f==="true");break;case"collapse-changelog":n.onCollapseChangelogChange(f==="true");break;case"quiet-startup":n.onQuietStartupChange(f==="true");break;case"double-escape-action":n.onDoubleEscapeActionChange(f);break;case"tree-filter-mode":n.onTreeFilterModeChange(f);break;case"show-hardware-cursor":n.onShowHardwareCursorChange(f==="true");break;case"editor-padding":n.onEditorPaddingXChange(Number.parseInt(f,10));break;case"autocomplete-max-visible":n.onAutocompleteMaxVisibleChange(Number.parseInt(f,10));break;case"clear-on-shrink":n.onClearOnShrinkChange(f==="true");break;case"collapse-prompt-commands":n.onCollapsePromptCommandsChange(f==="true");break}},n.onCancel,{enableSearch:!0}),this.addChild(this.settingsList),this.addChild(new sr)}getSettingsList(){return this.settingsList}}});var OQ,ZKt=C(()=>{"use strict";Ai();WKt();OQ=class extends cre{skillBlock;constructor(t,n=bf()){super(n),this.skillBlock=t,this.updateDisplay()}getLabel(){return"[skill]"}getTitle(){return this.skillBlock.name}getBody(){return this.skillBlock.content}}});import{stripVTControlCharacters as zwi}from"node:util";function BKa(e){if(DKa.test(e))return!1;try{let t=new URL(e);return(t.protocol==="http:"||t.protocol==="https:")&&!t.username&&!t.password}catch{return!1}}function jKt(e){return e.split(OKa).map((t,n)=>t?fe.fg(n%2===0?"muted":"accent",t):"").join("")}function Xwi(e,t,n,r){let i=1,s=!1;for(let o=t+1;o<e.length;o++){if(e[o]==="`"){let a=e.indexOf("`",o+1);if(a!==-1){o=a;continue}}if(e[o]===n)i++,s=!0;else if(e[o]===r&&--i===0)return{end:o,nested:s}}}function LKa(e,t){return Rl().hyperlinks?GM(fe.underline(e),t):e===t?e:`${e} (${t})`}function FKa(e){let t="",n=0;for(let r=0;r<e.length;r++){if(e[r]==="`"){let u=e.indexOf("`",r+1);u!==-1&&(r=u);continue}if(e[r]!=="[")continue;let i=Xwi(e,r,"[","]");if(!i)break;if(e[i.end+1]!=="("){r=i.end;continue}let s=Xwi(e,i.end+1,"(",")");if(!s)break;let o=e.slice(r+1,i.end),a=e.slice(i.end+2,s.end);o&&!i.nested&&!o.includes(`
12509
+ `;this.addChild(new Os(r+this.getBody(),0,0,this.markdownTheme,{color:i=>fe.fg("customMessageText",i)}))}renderCollapsed(){let t=this.getCollapsedHintPrefix(),n=t?[t]:[];n.push(`${Da("app.tools.expand")} to expand`);let r=fe.fg("customMessageLabel",`\x1B[1m${this.getLabel()}\x1B[22m `)+fe.fg("customMessageText",this.getTitle())+fe.fg("dim",` (${n.join(", ")})`);this.addChild(new Ot(r,0,0))}}});import{homedir as _Ka}from"node:os";var F_e,$Kt=C(()=>{"use strict";b1();Ai();WKt();F_e=class extends cre{command;args;expandedBody;source;constructor(t,n,r,i=bf(),s){super(i),this.command=t,this.args=n,this.expandedBody=r,this.source=s,this.updateDisplay()}getLabel(){return"[prompt]"}getTitle(){return Ih({command:this.command,args:this.args})}getBody(){return this.expandedBody.trim()?this.expandedBody:"_(empty prompt body)_"}getExpandedHeaderSuffix(){let t=this.formatSourcePath();return t?`_(from ${t})_`:""}getCollapsedHintPrefix(){let t=this.formatSourcePath();return t?`from ${t}`:""}formatSourcePath(){let t=this.source?.path;if(!t)return;let n=_Ka();return n&&t.startsWith(`${n}/`)?`~${t.slice(n.length)}`:t}}});function xKa(e){return{name:MXe(e.name),type:SKa[e.type]}}function CKa(e,t){let n=Math.min(15,Math.max(4,e-8)),r=t.reduce((i,s)=>Math.max(i,Wt(MXe(s.name))),20);return{nameWidth:Math.max(1,Math.min(r,e-4-n)),typeWidth:n}}function Hwi(e,t){let n=At(e,t,"\u2026");return n+" ".repeat(Math.max(0,t-Wt(n))+2)}function TKa(e,t){return fr(MXe(e),Math.max(1,t-2)).map(n=>` ${fe.fg("muted",n)}`)}var kXe,SKa,vKa,MXe,OXe,Ywi=C(()=>{"use strict";tn();Zy();Ai();au();xc();kXe=8,SKa={always:"always_apply","agent-requested":"agent_requested",manual:"manual"},vKa={always:"success","agent-requested":"accent",manual:"warning"},MXe=e=>Array.from(Eu(e),t=>{let n=t.charCodeAt(0);return n<32||n>=127&&n<=159?" ":t}).join("").trim();OXe=class{focused=!1;selected=0;showingDiagnostics=!1;snapshot;onClose;requestRender;constructor(t,n,r){this.snapshot=t,this.onClose=n,this.requestRender=r}invalidate(){}render(t){let n=m=>At(m,Math.max(0,t),"\u2026"),{rules:r,diagnostics:i}=this.snapshot,s=new sr(m=>fe.fg("border",m)),o=["",...s.render(t),"",n(fe.fg("accent",fe.bold(" Rules"))),""];i.length>0&&o.push(n(fe.fg("warning",` ${i.length} rule warning(s)`)),"");let a=CKa(t,r),{nameWidth:l,typeWidth:u}=a;o.push(n(fe.fg("muted",this.showingDiagnostics?" Warnings":` ${Hwi("Name",l)}${At("Type",u,"\u2026")}`))),this.showingDiagnostics||o.push("");let c=this.showingDiagnostics?i:r;if(c.length===0)o.push(n(fe.fg("muted",this.showingDiagnostics?" No warnings":" No rules loaded")));else{let m=Math.max(0,Math.min(this.selected-Math.floor(kXe/2),c.length-kXe));for(let f=m;f<Math.min(m+kXe,c.length);f++)o.push(...this.renderEntry(f,t,a));c.length>kXe&&o.push(n(fe.fg("dim",` ${this.selected+1}/${c.length}`)))}let d=fe.fg("muted"," \xB7 "),p=[_a(`${Da("tui.select.up")}/${Da("tui.select.down")}`,"navigate"),Wr("tui.select.cancel","close")];return i.length>0&&p.push(_a("d",this.showingDiagnostics?"rules":"inspect")),o.push("",...fr(p.join(d),Math.max(1,t-2)).map(m=>n(` ${m}`)),"",...s.render(t)),o.map(n)}renderEntry(t,n,r){let i=f=>At(f,n,"\u2026"),s=t===this.selected,o=s?fe.fg("accent","\u2192 "):" ";if(this.showingDiagnostics){let f=this.snapshot.diagnostics[t],h=MXe(f.message);if(s){let g=fr(h,Math.max(1,n-2)).map((b,A)=>i(`${A===0?o:" "}${fe.fg("warning",b)}`));return f.path&&g.push(...TKa(`Path: ${f.path}`,n)),g}return[i(`${o}${fe.fg("warning",h)}`)]}let{name:a,type:l}=xKa(this.snapshot.rules[t]),{nameWidth:u,typeWidth:c}=r,d=Hwi(a,u),p=s?fe.fg("accent",fe.bold(d)):d,m=fe.fg(vKa[this.snapshot.rules[t].type],At(l,c,"\u2026"));return[i(o+p+m)]}handleInput(t){let n=Hn();if(n.matches(t,"tui.select.cancel")){this.onClose();return}if(Nt(t,"d")&&this.snapshot.diagnostics.length>0){this.showingDiagnostics=!this.showingDiagnostics,this.selected=0,this.requestRender();return}let r=this.showingDiagnostics?this.snapshot.diagnostics.length:this.snapshot.rules.length;if(r!==0){if(n.matches(t,"tui.select.up"))this.selected=(this.selected-1+r)%r;else if(n.matches(t,"tui.select.down"))this.selected=(this.selected+1)%r;else return;this.requestRender()}}}});function PXe(e,t){return e===null||e.includes(t)}function IKa(e,t){if(e===null)return[t];let n=e.indexOf(t);return n>=0?[...e.slice(0,n),...e.slice(n+1)]:[...e,t]}function Zwi(e,t,n){if(e===null)return null;let r=n??t,i=[...e];for(let s of r)i.includes(s)||i.push(s);return i.length===t.length?null:i}function jwi(e,t,n){if(e===null)return n?t.filter(i=>!n.includes(i)):[];let r=new Set(n??e);return e.filter(i=>!r.has(i))}function wKa(e,t,n,r){let i=e??[...t],s=i.indexOf(n);if(s<0)return i;let o=s+r;if(o<0||o>=i.length)return i;let a=[...i];return[a[s],a[o]]=[a[o],a[s]],a}function RKa(e,t){if(e===null)return t;let n=new Set(e);return[...e,...t.filter(r=>!n.has(r))]}var U_e,QKt=C(()=>{"use strict";tn();Af();Ai();au();Gg();U_e=class extends Vt{modelsById=new Map;allIds=[];enabledIds=null;filteredItems=[];selectedIndex=0;searchInput;_focused=!1;get focused(){return this._focused}set focused(t){this._focused=t,this.searchInput.focused=t}listContainer;footerText;callbacks;maxVisible=15;isDirty=!1;constructor(t,n){super(),this.callbacks=n;for(let r of t.allModels){let i=`${r.provider}/${r.id}`;this.modelsById.set(i,r),this.allIds.push(i)}this.enabledIds=t.hasEnabledModelsFilter?[...t.enabledModelIds]:null,this.filteredItems=this.buildItems(),this.addChild(new sr),this.addChild(new st(1)),this.addChild(new Tn(()=>fe.fg("accent",fe.bold("Model Configuration")),0,0)),this.addChild(new Tn(()=>fe.fg("muted","Session-only. Ctrl+S to save to settings."),0,0)),this.addChild(new st(1)),this.searchInput=new hi,this.addChild(this.searchInput),this.addChild(new st(1)),this.listContainer=new Vt,this.addChild(this.listContainer),this.addChild(new st(1)),this.footerText=new Tn(()=>this.getFooterText(),0,0),this.addChild(this.footerText),this.addChild(new sr),this.updateList()}buildItems(){let t=[];for(let n of RKa(this.enabledIds,this.allIds)){let r=this.modelsById.get(n);r&&t.push({fullId:n,model:r,enabled:PXe(this.enabledIds,n)})}return t}getFooterText(){let t=this.enabledIds?.length??this.allIds.length,i=["Enter toggle","^A all","^X clear","^P provider","Alt+\u2191\u2193 reorder","^S save",this.enabledIds===null?"all enabled":`${t}/${this.allIds.length} enabled`];return this.isDirty?fe.fg("dim",` ${i.join(" \xB7 ")} `)+fe.fg("warning","(unsaved)"):fe.fg("dim",` ${i.join(" \xB7 ")}`)}refresh(){let t=this.searchInput.getValue(),n=this.buildItems();this.filteredItems=t?uc(n,t,r=>D9(r.model)):n,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredItems.length-1)),this.updateList(),this.footerText.setText(()=>this.getFooterText())}updateList(){if(this.listContainer.clear(),this.filteredItems.length===0){this.listContainer.addChild(new Tn(()=>fe.fg("muted"," No matching models"),0,0));return}let t=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),n=Math.min(t+this.maxVisible,this.filteredItems.length),r=this.enabledIds===null;for(let i=t;i<n;i++){let s=this.filteredItems[i];s&&this.listContainer.addChild(new Tn(()=>{let o=i===this.selectedIndex,a=o?fe.fg("accent","\u2192 "):" ",l=o?fe.fg("accent",s.model.name||s.model.id):s.model.name||s.model.id,u=fe.fg("muted",` [${s.model.provider}]`),c;return r?c="":s.enabled?c=fe.fg("success"," \u2713"):c=fe.fg("dim"," \u2717"),`${a}${l}${u}${c}`},0,0))}if((t>0||n<this.filteredItems.length)&&this.listContainer.addChild(new Tn(()=>fe.fg("muted",` (${this.selectedIndex+1}/${this.filteredItems.length})`),0,0)),this.filteredItems.length>0){let i=this.filteredItems[this.selectedIndex];this.listContainer.addChild(new st(1)),this.listContainer.addChild(new Tn(()=>fe.fg("muted",` Model Name: ${i.model.name}`),0,0))}}handleInput(t){let n=Hn();if(n.matches(t,"tui.select.up")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.updateList();return}if(n.matches(t,"tui.select.down")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.updateList();return}if(Nt(t,Wl.alt("up"))||Nt(t,Wl.alt("down"))){let r=this.filteredItems[this.selectedIndex];if(r&&PXe(this.enabledIds,r.fullId)){let i=Nt(t,Wl.alt("up"))?-1:1,s=this.enabledIds??this.allIds,a=s.indexOf(r.fullId)+i;a>=0&&a<s.length&&(this.enabledIds=wKa(this.enabledIds,this.allIds,r.fullId,i),this.isDirty=!0,this.selectedIndex+=i,this.refresh())}return}if(Nt(t,Wl.enter)){let r=this.filteredItems[this.selectedIndex];if(r){let i=this.enabledIds===null;this.enabledIds=IKa(this.enabledIds,r.fullId),this.isDirty=!0,i&&this.callbacks.onClearAll(),this.callbacks.onModelToggle(r.fullId,PXe(this.enabledIds,r.fullId)),this.refresh()}return}if(Nt(t,Wl.ctrl("a"))){let r=this.searchInput.getValue()?this.filteredItems.map(i=>i.fullId):void 0;this.enabledIds=Zwi(this.enabledIds,this.allIds,r),this.isDirty=!0,this.callbacks.onEnableAll(r??this.allIds),this.refresh();return}if(Nt(t,Wl.ctrl("x"))){let r=this.searchInput.getValue()?this.filteredItems.map(i=>i.fullId):void 0;this.enabledIds=jwi(this.enabledIds,this.allIds,r),this.isDirty=!0,this.callbacks.onClearAll(),this.refresh();return}if(Nt(t,Wl.ctrl("p"))){let r=this.filteredItems[this.selectedIndex];if(r){let i=r.model.provider,s=this.allIds.filter(a=>this.modelsById.get(a)?.provider===i),o=s.every(a=>PXe(this.enabledIds,a));this.enabledIds=o?jwi(this.enabledIds,this.allIds,s):Zwi(this.enabledIds,this.allIds,s),this.isDirty=!0,this.callbacks.onToggleProvider(i,s,!o),this.refresh()}return}if(Nt(t,Wl.ctrl("s"))){this.callbacks.onPersist(this.enabledIds??[...this.allIds]),this.isDirty=!1,this.footerText.setText(()=>this.getFooterText());return}if(Nt(t,Wl.ctrl("c"))){this.searchInput.getValue()?(this.searchInput.setValue(""),this.refresh()):this.callbacks.onCancel();return}if(Nt(t,Wl.escape)){this.callbacks.onCancel();return}this.searchInput.handleInput(t),this.refresh()}getSearchInput(){return this.searchInput}}});function kKa(e){return e===void 0?"Automatic":e?"Always on":"Always off"}var NKa,HKt,kQ,YKt=C(()=>{"use strict";tn();Ai();au();Gg();NKa={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},HKt=class extends Vt{selectList;constructor(t,n,r,i,s,o,a){super(),this.addChild(new Tn(()=>fe.bold(fe.fg("accent",t)),0,0)),n&&(this.addChild(new st(1)),this.addChild(new Tn(()=>fe.fg("muted",n),0,0))),this.addChild(new st(1)),this.selectList=new Rc(r,Math.min(r.length,10),yE(),NKa);let l=r.findIndex(u=>u.value===i);l!==-1&&this.selectList.setSelectedIndex(l),this.selectList.onSelect=u=>{s(u.value)},this.selectList.onCancel=o,a&&(this.selectList.onSelectionChange=u=>{a(u.value)}),this.addChild(this.selectList),this.addChild(new st(1)),this.addChild(new Tn(()=>fe.fg("dim"," Enter to select \xB7 Esc to go back"),0,0))}handleInput(t){this.selectList.handleInput(t)}};kQ=class extends Vt{settingsList;constructor(t,n){super();let r=Rl().images,i=[{id:"autocompact",label:"Auto-compact",description:"Automatically compact context when it gets too large",currentValue:t.autoCompact?"true":"false",values:["true","false"]},{id:"steering-mode",label:"Steering mode",description:"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:t.steeringMode,values:["one-at-a-time","all"]},{id:"follow-up-mode",label:"Follow-up mode",description:"Alt+Enter queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:t.followUpMode,values:["one-at-a-time","all"]},{id:"hide-thinking",label:"Hide thinking",description:"Hide thinking blocks in assistant responses",currentValue:t.hideThinkingBlock?"true":"false",values:["true","false"]},{id:"collapse-changelog",label:"Collapse changelog",description:"Show condensed changelog after updates",currentValue:t.collapseChangelog?"true":"false",values:["true","false"]},{id:"quiet-startup",label:"Quiet startup",description:"Disable verbose printing at startup",currentValue:t.quietStartup?"true":"false",values:["true","false"]},{id:"double-escape-action",label:"Double-escape action",description:"Action when pressing Escape twice with empty editor",currentValue:t.doubleEscapeAction,values:["tree","fork","none"]},{id:"tree-filter-mode",label:"Tree filter mode",description:"Default filter when opening /tree",currentValue:t.treeFilterMode,values:["default","no-tools","user-only","labeled-only","all"]},{id:"theme",label:"Theme",description:"Color theme for the interface",currentValue:t.currentTheme,submenu:(m,f)=>new HKt("Theme","Select color theme",t.availableThemes.map(h=>({value:h,label:h})),m,h=>{n.onThemeChange(h),f(h)},()=>{n.onThemePreview?.(m),f()},h=>{n.onThemePreview?.(h)})}];r&&i.splice(1,0,{id:"show-images",label:"Show images",description:"Render images inline in terminal",currentValue:t.showImages?"true":"false",values:["true","false"]}),i.splice(r?2:1,0,{id:"auto-resize-images",label:"Auto-resize images",description:"Resize large images to 2000x2000 max for better model compatibility",currentValue:t.autoResizeImages?"true":"false",values:["true","false"]});let s=i.findIndex(m=>m.id==="auto-resize-images");i.splice(s+1,0,{id:"block-images",label:"Block images",description:"Prevent images from being sent to LLM providers",currentValue:t.blockImages?"true":"false",values:["true","false"]});let o=i.findIndex(m=>m.id==="block-images");i.splice(o+1,0,{id:"skill-commands",label:"Skill commands",description:"Register skills as /skill:name commands",currentValue:t.enableSkillCommands?"true":"false",values:["true","false"]});let a=i.findIndex(m=>m.id==="skill-commands");i.splice(a+1,0,{id:"enable-hashline",label:"Enable hashline",description:"Use the hashline read/edit tools (overrides the built-ins). Takes effect on next launch.",currentValue:t.enableHashline?"true":"false",values:["true","false"]}),t.toolSearchAutoEnable&&i.push({id:"automatic-tool-search",label:"MCP tool discovery",description:"Find MCP tools on demand when their definitions take up too much context. Changes apply after restarting the CLI.",currentValue:kKa(t.toolSearchEnabled),values:["Automatic","Always on","Always off"]});let l=i.findIndex(m=>m.id==="enable-hashline");i.splice(l+1,0,{id:"collapse-prompt-commands",label:"Collapse prompt commands",description:"Render /command invocations as a single line (Ctrl+O to expand)",currentValue:t.collapsePromptCommands?"true":"false",values:["true","false"]});let u=i.findIndex(m=>m.id==="collapse-prompt-commands");i.splice(u+1,0,{id:"show-hardware-cursor",label:"Show hardware cursor",description:"Show the terminal cursor while still positioning it for IME support",currentValue:t.showHardwareCursor?"true":"false",values:["true","false"]});let c=i.findIndex(m=>m.id==="show-hardware-cursor");i.splice(c+1,0,{id:"editor-padding",label:"Editor padding",description:"Horizontal padding for input editor (0-3)",currentValue:String(t.editorPaddingX),values:["0","1","2","3"]});let d=i.findIndex(m=>m.id==="editor-padding");i.splice(d+1,0,{id:"autocomplete-max-visible",label:"Autocomplete max items",description:"Max visible items in autocomplete dropdown (3-20)",currentValue:String(t.autocompleteMaxVisible),values:["3","5","7","10","15","20"]});let p=i.findIndex(m=>m.id==="autocomplete-max-visible");i.splice(p+1,0,{id:"clear-on-shrink",label:"Clear on shrink",description:"Clear empty rows when content shrinks (may cause flicker)",currentValue:t.clearOnShrink?"true":"false",values:["true","false"]}),this.addChild(new sr),this.settingsList=new YM(i,10,PGe(),(m,f)=>{switch(m){case"autocompact":n.onAutoCompactChange(f==="true");break;case"show-images":n.onShowImagesChange(f==="true");break;case"auto-resize-images":n.onAutoResizeImagesChange(f==="true");break;case"block-images":n.onBlockImagesChange(f==="true");break;case"skill-commands":n.onEnableSkillCommandsChange(f==="true");break;case"automatic-tool-search":n.onToolSearchEnabledChange?.(f==="Automatic"?void 0:f==="Always on");break;case"enable-hashline":n.onEnableHashlineChange(f==="true");break;case"steering-mode":n.onSteeringModeChange(f);break;case"follow-up-mode":n.onFollowUpModeChange(f);break;case"hide-thinking":n.onHideThinkingBlockChange(f==="true");break;case"collapse-changelog":n.onCollapseChangelogChange(f==="true");break;case"quiet-startup":n.onQuietStartupChange(f==="true");break;case"double-escape-action":n.onDoubleEscapeActionChange(f);break;case"tree-filter-mode":n.onTreeFilterModeChange(f);break;case"show-hardware-cursor":n.onShowHardwareCursorChange(f==="true");break;case"editor-padding":n.onEditorPaddingXChange(Number.parseInt(f,10));break;case"autocomplete-max-visible":n.onAutocompleteMaxVisibleChange(Number.parseInt(f,10));break;case"clear-on-shrink":n.onClearOnShrinkChange(f==="true");break;case"collapse-prompt-commands":n.onCollapsePromptCommandsChange(f==="true");break}},n.onCancel,{enableSearch:!0}),this.addChild(this.settingsList),this.addChild(new sr)}getSettingsList(){return this.settingsList}}});var OQ,ZKt=C(()=>{"use strict";Ai();WKt();OQ=class extends cre{skillBlock;constructor(t,n=bf()){super(n),this.skillBlock=t,this.updateDisplay()}getLabel(){return"[skill]"}getTitle(){return this.skillBlock.name}getBody(){return this.skillBlock.content}}});import{stripVTControlCharacters as zwi}from"node:util";function BKa(e){if(DKa.test(e))return!1;try{let t=new URL(e);return(t.protocol==="http:"||t.protocol==="https:")&&!t.username&&!t.password}catch{return!1}}function jKt(e){return e.split(OKa).map((t,n)=>t?fe.fg(n%2===0?"muted":"accent",t):"").join("")}function Xwi(e,t,n,r){let i=1,s=!1;for(let o=t+1;o<e.length;o++){if(e[o]==="`"){let a=e.indexOf("`",o+1);if(a!==-1){o=a;continue}}if(e[o]===n)i++,s=!0;else if(e[o]===r&&--i===0)return{end:o,nested:s}}}function LKa(e,t){return Rl().hyperlinks?GM(fe.underline(e),t):e===t?e:`${e} (${t})`}function FKa(e){let t="",n=0;for(let r=0;r<e.length;r++){if(e[r]==="`"){let u=e.indexOf("`",r+1);u!==-1&&(r=u);continue}if(e[r]!=="[")continue;let i=Xwi(e,r,"[","]");if(!i)break;if(e[i.end+1]!=="("){r=i.end;continue}let s=Xwi(e,i.end+1,"(",")");if(!s)break;let o=e.slice(r+1,i.end),a=e.slice(i.end+2,s.end);o&&!i.nested&&!o.includes(`
12510
12510
  `)&&!o.includes("`")&&!s.nested&&!a.includes("`")&&e[r-1]!=="!"&&BKa(a)&&(t+=jKt(e.slice(n,r))+fe.fg("muted",LKa(o,a)),n=s.end+1),r=s.end}return t+jKt(e.slice(n))}function qwi(e){let t=e.replace(MKa,`
12511
12511
  `).replaceAll(" "," "),n=zwi(t).replace(PKa,s=>s===`
12512
12512
  `?s:""),i=t===n?FKa(n):jKt(n);return zwi(i).trim()?i:""}var OKa,MKa,PKa,DKa,Kwi=C(()=>{"use strict";tn();Ai();OKa=/`([^`]*)`/g,MKa=/\r\n?|[\p{Zl}\p{Zp}]/gu,PKa=/[\p{Cc}\p{Bidi_Control}]/gu,DKa=/[\s\p{Cc}\p{Bidi_Control}]/u});var UKa,VKa,GKa,MQ,zKt=C(()=>{"use strict";tn();Ai();au();UKa={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},VKa={off:"No reasoning",minimal:"Minimal reasoning",low:"Light reasoning",medium:"Moderate reasoning",high:"Deep reasoning",xhigh:"Maximum reasoning"},GKa=(e,t)=>e.kind==="explicit"?e.effort:t?`${t} (default)`:"Model default",MQ=class extends Vt{selectList;constructor(t,n,r,i,s){super();let o=n.map((l,u)=>{let c=l.kind==="explicit"?l.effort:s;return{value:String(u),label:GKa(l,s),description:c?VKa[c]??"Model-defined reasoning effort":"Use the model or provider default"}});this.addChild(new sr),this.selectList=new Rc(o,o.length,yE(),UKa);let a=n.findIndex(l=>l.kind===t.kind&&(l.kind==="model-default"||t.kind==="explicit"&&l.effort===t.effort));a!==-1&&this.selectList.setSelectedIndex(a),this.selectList.onSelect=l=>{let u=n[Number(l.value)];u&&r(u)},this.selectList.onCancel=()=>{i()},this.addChild(this.selectList),this.addChild(new sr)}getSelectList(){return this.selectList}}});async function Jwi(e,t){if(t==="image/png")return{data:e,mimeType:t};let n=await TJ();if(!n)return null;try{let r=new Uint8Array(Buffer.from(e,"base64")),i=n.PhotonImage.new_from_byteslice(r),s=u6e(n,i,r);s!==i&&i.free();try{let o=s.get_bytes();return{data:Buffer.from(o).toString("base64"),mimeType:"image/png"}}finally{s.free()}}catch{return null}}var eRi=C(()=>{"use strict";c5t();p6e()});var eN,XKt=C(()=>{"use strict";tn();H9();Hb();eRi();Ai();eN=class extends Vt{contentBox;contentText;callRendererComponent;resultRendererComponent;rendererState={};imageComponents=[];imageSpacers=[];toolName;toolCallId;args;expanded=!1;showImages;isPartial=!0;toolDefinition;builtInToolDefinition;ui;cwd;executionStarted=!1;argsComplete=!1;result;convertedImages=new Map;hideComponent=!1;constructor(t,n,r,i,s,o,a=process.cwd()){super(),this.toolName=t,this.toolCallId=n,this.args=r,this.toolDefinition=s,this.builtInToolDefinition=k6e[t],this.showImages=i.showImages??!0,this.ui=o,this.cwd=a,this.addChild(new st(1)),this.contentBox=new Gl(1,1,l=>fe.bg("toolPendingBg",l)),this.contentText=new Ot("",1,1,l=>fe.bg("toolPendingBg",l)),this.hasRendererDefinition()?this.addChild(this.contentBox):this.addChild(this.contentText),this.updateDisplay()}getCallRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderCall??this.builtInToolDefinition.renderCall:this.builtInToolDefinition.renderCall:this.toolDefinition?.renderCall}getResultRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderResult??this.builtInToolDefinition.renderResult:this.builtInToolDefinition.renderResult:this.toolDefinition?.renderResult}hasRendererDefinition(){return this.builtInToolDefinition!==void 0||this.toolDefinition!==void 0}getRenderContext(t){return{args:this.args,toolCallId:this.toolCallId,invalidate:()=>{this.invalidate(),this.ui.requestRender()},lastComponent:t,state:this.rendererState,cwd:this.cwd,executionStarted:this.executionStarted,argsComplete:this.argsComplete,isPartial:this.isPartial,expanded:this.expanded,showImages:this.showImages,isError:this.result?.isError??!1}}createCallFallback(){return new Ot(fe.fg("toolTitle",fe.bold(this.toolName)),0,0)}createResultFallback(){let t=this.getTextOutput();if(t)return new Ot(fe.fg("toolOutput",t),0,0)}updateArgs(t){this.args=t,this.updateDisplay()}markExecutionStarted(){this.executionStarted=!0,this.updateDisplay(),this.ui.requestRender()}setArgsComplete(){this.argsComplete=!0,this.updateDisplay(),this.ui.requestRender()}updateResult(t,n=!1){this.result=t,this.isPartial=n,this.updateDisplay(),this.maybeConvertImagesForKitty()}maybeConvertImagesForKitty(){if(Rl().images!=="kitty"||!this.result)return;let n=this.result.content.filter(r=>r.type==="image");for(let r=0;r<n.length;r++){let i=n[r];if(!i.data||!i.mimeType||i.mimeType==="image/png"||this.convertedImages.has(r))continue;let s=r;Jwi(i.data,i.mimeType).then(o=>{o&&(this.convertedImages.set(s,o),this.updateDisplay(),this.ui.requestRender())})}}setExpanded(t){this.expanded=t,this.updateDisplay()}setShowImages(t){this.showImages=t,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}render(t){return this.hideComponent?[]:super.render(t)}updateDisplay(){let t;this.toolName==="bash"||this.isPartial?t=r=>fe.bg("toolPendingBg",r):this.result?.isError?t=r=>fe.bg("toolErrorBg",r):t=r=>fe.bg("toolSuccessBg",r);let n=!1;if(this.hideComponent=!1,this.hasRendererDefinition()){this.contentBox.setBgFn(t),this.contentBox.clear();let r=this.getCallRenderer();if(r)try{let i=r(this.args,fe,this.getRenderContext(this.callRendererComponent));this.callRendererComponent=i,this.contentBox.addChild(i),n=!0}catch{this.callRendererComponent=void 0,this.contentBox.addChild(this.createCallFallback()),n=!0}else this.contentBox.addChild(this.createCallFallback()),n=!0;if(this.result&&this.shouldShowResult()){let i=this.getResultRenderer(),s=this.expanded||this.result.isError===!0;if(i)try{let o=i({content:this.result.content,details:this.result.details},{expanded:s,isPartial:this.isPartial},fe,this.getRenderContext(this.resultRendererComponent));this.resultRendererComponent=o,this.contentBox.addChild(o),n=!0}catch{this.resultRendererComponent=void 0;let o=this.createResultFallback();o&&(this.contentBox.addChild(o),n=!0)}else{let o=this.createResultFallback();o&&(this.contentBox.addChild(o),n=!0)}}}else this.contentText.setCustomBgFn(t),this.contentText.setText(this.shouldShowResult()?this.formatToolExecution():fe.fg("toolTitle",fe.bold(this.toolName))),n=!0;for(let r of this.imageComponents)this.removeChild(r);this.imageComponents=[];for(let r of this.imageSpacers)this.removeChild(r);if(this.imageSpacers=[],this.result){let r=this.result.content.filter(s=>s.type==="image"),i=Rl();for(let s=0;s<r.length;s++){let o=r[s];if(i.images&&this.showImages&&o.data&&o.mimeType){let a=this.convertedImages.get(s),l=a?.data??o.data,u=a?.mimeType??o.mimeType;if(i.images==="kitty"&&u!=="image/png")continue;let c=new st(1);this.addChild(c),this.imageSpacers.push(c);let d=new QM(l,u,{fallbackColor:p=>fe.fg("toolOutput",p)},{maxWidthCells:60});this.imageComponents.push(d),this.addChild(d)}}}this.hasRendererDefinition()&&!n&&this.imageComponents.length===0&&(this.hideComponent=!0)}getTextOutput(){return gp(this.result,this.showImages)}shouldShowResult(){return this.expanded||this.result?.isError===!0||this.getDefaultExpanded()||this.toolName==="bash"&&this.args?.background===!0&&this.toolDefinition!==void 0&&this.toolDefinition.renderCall===k6e.bash.renderCall&&this.toolDefinition.renderResult===k6e.bash.renderResult}getDefaultExpanded(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.defaultExpanded??this.builtInToolDefinition.defaultExpanded??!1:this.builtInToolDefinition.defaultExpanded??!1:this.toolDefinition?.defaultExpanded??!1}formatToolExecution(){let t=fe.fg("toolTitle",fe.bold(this.toolName)),n=JSON.stringify(this.args,null,2);n&&(t+=`
@@ -12554,7 +12554,7 @@ ${n}`},1,0)),this.chatContainer.addChild(new sr(r=>fe.fg("warning",r))),this.ui.
12554
12554
 
12555
12555
  `);this.rememberSessionImagePaths(s);let o=$_e(s),a=t?.currentText??this.editor.getText(),l=[o,a].filter(u=>u.trim()).join(`
12556
12556
 
12557
- `);return this.editor.setText(l),this.updatePendingMessagesDisplay(),t?.abort&&this.agent.abort(),i.length}queueCompactionMessage(t,n){this.compactionQueuedMessages.push({text:t,mode:n}),this.editor.addToHistory?.($_e(t)),this.editor.setText(""),this.updatePendingMessagesDisplay(),this.showStatus("Queued message for after compaction")}isExtensionCommand(t){if(!t.startsWith("/"))return!1;let n=this.session.extensionRunner;if(!n)return!1;let r=t.indexOf(" "),i=r===-1?t.slice(1):t.slice(1,r);return!!n.getCommand(i)}trackSlashCommandUsage(t){if(!t.startsWith("/"))return;let n=t.indexOf(" "),r=n===-1?t.slice(1):t.slice(1,n);if(!r)return;let i;if(U9.some(o=>o.name===r)?i=r:this.isCustomSlashCommand(t,r)&&(i="custom"),!i)return;let s={commandName:i};this.session.resourceLoader.getEventBus?.().emit(U6e,s)}isCustomSlashCommand(t,n){return this.isExtensionCommand(t)||this.session.promptTemplates.some(r=>r.name===n)||this.skillCommands.has(n)}publishMessageSendError(t){let n={errorMessagePreview:t.slice(0,100),requestId:this.session.currentRequestId};this.session.resourceLoader.getEventBus?.().emit(V6e,n)}async flushCompactionQueue(t){if(this.compactionQueuedMessages.length===0)return;let n=[...this.compactionQueuedMessages];this.compactionQueuedMessages=[],this.updatePendingMessagesDisplay();let r=i=>{this.session.clearQueue(),this.compactionQueuedMessages=n,this.updatePendingMessagesDisplay(),this.showError(`Failed to send queued message${n.length>1?"s":""}: ${i instanceof Error?i.message:String(i)}`)};try{if(t?.willRetry){for(let u of n)this.isExtensionCommand(u.text)?await this.session.prompt(u.text):u.mode==="followUp"?await this.session.followUp(u.text):await this.session.steer(u.text);this.updatePendingMessagesDisplay();return}let i=n.findIndex(u=>!this.isExtensionCommand(u.text));if(i===-1){for(let u of n)await this.session.prompt(u.text);return}let s=n.slice(0,i),o=n[i],a=n.slice(i+1);for(let u of s)await this.session.prompt(u.text);let l=this.session.prompt(o.text).catch(u=>{r(u)});for(let u of a)this.isExtensionCommand(u.text)?await this.session.prompt(u.text):u.mode==="followUp"?await this.session.followUp(u.text):await this.session.steer(u.text);this.updatePendingMessagesDisplay()}catch(i){r(i)}}flushPendingBashComponents(){for(let t of this.pendingBashComponents)this.pendingMessagesContainer.removeChild(t),this.chatContainer.addChild(t);this.pendingBashComponents=[]}showSelector(t){let n=()=>{this.editorContainer.clear(),this.editorContainer.addChild(this.editor),this.ui.setFocus(this.editor)},{component:r,focus:i}=t(n);this.editorContainer.clear(),this.editorContainer.addChild(r),this.ui.setFocus(i),this.ui.requestRender()}showPluginsPage(){let t=nr(),n=LK(t);this.showSelector(r=>{let i={getPlugins:()=>{let o=this.settingsManager.getEnabledPlugins();return $x().map(a=>({id:a.id,name:a.name,marketplace:a.marketplace,enabled:o[a.id]??a.enabled,diagnostics:a.diagnostics}))},getPluginDetails:o=>{let a=$x().find(l=>l.id===o);return a?DK(a):void 0},getMarketplaces:()=>{let o=$x();return Qhe(t).map(a=>({dir:a.dir,name:a.name,pluginCount:o.filter(l=>l.marketplace===a.name||l.marketplace===a.dir).length}))},getErrors:()=>Qx().map(o=>({message:o.message,path:o.path})),settingsManager:this.settingsManager,addMarketplace:async o=>{let a=await kK(n,o);return a.success?null:a.error??"Failed to add"},removeMarketplace:o=>{let a=OK(n,o);return a.success?null:a.error??"Failed to remove"},refresh:()=>{this.session.reload().then(()=>this.ui.requestRender())}},s=new NXe(i,()=>r(),()=>this.handleCtrlC(),()=>this.ui.requestRender());return s.focused=!0,{component:s,focus:s}})}showRulesView(){let t=this.session.resourceLoader.getRules();this.showSelector(n=>{let r=new OXe(t,n,()=>this.ui.requestRender());return r.focused=!0,{component:r,focus:r}})}showSettingsSelector(){this.showSelector(t=>{let n=new kQ({autoCompact:this.session.autoCompactionEnabled,showImages:this.settingsManager.getShowImages(),autoResizeImages:this.settingsManager.getImageAutoResize(),blockImages:this.settingsManager.getBlockImages(),enableSkillCommands:this.settingsManager.getEnableSkillCommands(),enableHashline:this.settingsManager.getEnableHashline(),toolSearchEnabled:this.settingsManager.getToolSearchEnabled(),toolSearchAutoEnable:this.runtimeHost.services.featureFlags.flags.cliMcpToolSearchAutoEnable,steeringMode:this.session.steeringMode,followUpMode:this.session.followUpMode,transport:this.settingsManager.getTransport(),currentTheme:this.settingsManager.getTheme()||"dark",availableThemes:OGe(),hideThinkingBlock:this.hideThinkingBlock,collapseChangelog:this.settingsManager.getCollapseChangelog(),doubleEscapeAction:this.settingsManager.getDoubleEscapeAction(),treeFilterMode:this.settingsManager.getTreeFilterMode(),showHardwareCursor:this.settingsManager.getShowHardwareCursor(),editorPaddingX:this.settingsManager.getEditorPaddingX(),autocompleteMaxVisible:this.settingsManager.getAutocompleteMaxVisible(),quietStartup:this.settingsManager.getQuietStartup(),clearOnShrink:this.settingsManager.getClearOnShrink(),collapsePromptCommands:this.settingsManager.getCollapsePromptCommands()},{onAutoCompactChange:r=>{this.session.setAutoCompactionEnabled(r),this.footer.setAutoCompactEnabled(r)},onShowImagesChange:r=>{this.settingsManager.setShowImages(r);for(let i of this.chatContainer.children)i instanceof eN&&i.setShowImages(r)},onAutoResizeImagesChange:r=>{this.settingsManager.setImageAutoResize(r)},onBlockImagesChange:r=>{this.settingsManager.setBlockImages(r)},onEnableSkillCommandsChange:r=>{this.settingsManager.setEnableSkillCommands(r),this.setupAutocomplete(this.fdPath)},onToolSearchEnabledChange:r=>{this.settingsManager.setToolSearchEnabled(r)},onEnableHashlineChange:r=>{this.settingsManager.setEnableHashline(r)},onSteeringModeChange:r=>{this.session.setSteeringMode(r)},onFollowUpModeChange:r=>{this.session.setFollowUpMode(r)},onTransportChange:r=>{this.settingsManager.setTransport(r),this.session.agent.transport=r},onThemeChange:r=>{let i=qhe(r,!0);this.settingsManager.setTheme(r),this.ui.invalidate(),i.success||this.showError(`Failed to load theme "${r}": ${i.error}
12557
+ `);return this.editor.setText(l),this.updatePendingMessagesDisplay(),t?.abort&&this.agent.abort(),i.length}queueCompactionMessage(t,n){this.compactionQueuedMessages.push({text:t,mode:n}),this.editor.addToHistory?.($_e(t)),this.editor.setText(""),this.updatePendingMessagesDisplay(),this.showStatus("Queued message for after compaction")}isExtensionCommand(t){if(!t.startsWith("/"))return!1;let n=this.session.extensionRunner;if(!n)return!1;let r=t.indexOf(" "),i=r===-1?t.slice(1):t.slice(1,r);return!!n.getCommand(i)}trackSlashCommandUsage(t){if(!t.startsWith("/"))return;let n=t.indexOf(" "),r=n===-1?t.slice(1):t.slice(1,n);if(!r)return;let i;if(U9.some(o=>o.name===r)?i=r:this.isCustomSlashCommand(t,r)&&(i="custom"),!i)return;let s={commandName:i};this.session.resourceLoader.getEventBus?.().emit(U6e,s)}isCustomSlashCommand(t,n){return this.isExtensionCommand(t)||this.session.promptTemplates.some(r=>r.name===n)||this.skillCommands.has(n)}publishMessageSendError(t){let n={errorMessagePreview:t.slice(0,100),requestId:this.session.currentRequestId};this.session.resourceLoader.getEventBus?.().emit(V6e,n)}async flushCompactionQueue(t){if(this.compactionQueuedMessages.length===0)return;let n=[...this.compactionQueuedMessages];this.compactionQueuedMessages=[],this.updatePendingMessagesDisplay();let r=i=>{this.session.clearQueue(),this.compactionQueuedMessages=n,this.updatePendingMessagesDisplay(),this.showError(`Failed to send queued message${n.length>1?"s":""}: ${i instanceof Error?i.message:String(i)}`)};try{if(t?.willRetry){for(let u of n)this.isExtensionCommand(u.text)?await this.session.prompt(u.text):u.mode==="followUp"?await this.session.followUp(u.text):await this.session.steer(u.text);this.updatePendingMessagesDisplay();return}let i=n.findIndex(u=>!this.isExtensionCommand(u.text));if(i===-1){for(let u of n)await this.session.prompt(u.text);return}let s=n.slice(0,i),o=n[i],a=n.slice(i+1);for(let u of s)await this.session.prompt(u.text);let l=this.session.prompt(o.text).catch(u=>{r(u)});for(let u of a)this.isExtensionCommand(u.text)?await this.session.prompt(u.text):u.mode==="followUp"?await this.session.followUp(u.text):await this.session.steer(u.text);this.updatePendingMessagesDisplay()}catch(i){r(i)}}flushPendingBashComponents(){for(let t of this.pendingBashComponents)this.pendingMessagesContainer.removeChild(t),this.chatContainer.addChild(t);this.pendingBashComponents=[]}showSelector(t){let n=()=>{this.editorContainer.clear(),this.editorContainer.addChild(this.editor),this.ui.setFocus(this.editor)},{component:r,focus:i}=t(n);this.editorContainer.clear(),this.editorContainer.addChild(r),this.ui.setFocus(i),this.ui.requestRender()}showPluginsPage(){let t=nr(),n=LK(t);this.showSelector(r=>{let i={getPlugins:()=>{let o=this.settingsManager.getEnabledPlugins();return $x().map(a=>({id:a.id,name:a.name,marketplace:a.marketplace,enabled:o[a.id]??a.enabled,diagnostics:a.diagnostics}))},getPluginDetails:o=>{let a=$x().find(l=>l.id===o);return a?DK(a):void 0},getMarketplaces:()=>{let o=$x();return Qhe(t).map(a=>({dir:a.dir,name:a.name,pluginCount:o.filter(l=>l.marketplace===a.name||l.marketplace===a.dir).length}))},getErrors:()=>Qx().map(o=>({message:o.message,path:o.path})),settingsManager:this.settingsManager,addMarketplace:async o=>{let a=await kK(n,o);return a.success?null:a.error??"Failed to add"},removeMarketplace:o=>{let a=OK(n,o);return a.success?null:a.error??"Failed to remove"},refresh:()=>{this.session.reload().then(()=>this.ui.requestRender())}},s=new NXe(i,()=>r(),()=>this.handleCtrlC(),()=>this.ui.requestRender());return s.focused=!0,{component:s,focus:s}})}showRulesView(){let t=this.session.resourceLoader.getRules();this.showSelector(n=>{let r=new OXe(t,n,()=>this.ui.requestRender());return r.focused=!0,{component:r,focus:r}})}showSettingsSelector(){this.showSelector(t=>{let n=new kQ({autoCompact:this.session.autoCompactionEnabled,showImages:this.settingsManager.getShowImages(),autoResizeImages:this.settingsManager.getImageAutoResize(),blockImages:this.settingsManager.getBlockImages(),enableSkillCommands:this.settingsManager.getEnableSkillCommands(),enableHashline:this.settingsManager.getEnableHashline(),toolSearchEnabled:this.settingsManager.getToolSearchEnabled(),toolSearchAutoEnable:this.runtimeHost.services.featureFlags.flags.cliMcpToolSearchAutoEnable,steeringMode:this.session.steeringMode,followUpMode:this.session.followUpMode,currentTheme:this.settingsManager.getTheme()||"dark",availableThemes:OGe(),hideThinkingBlock:this.hideThinkingBlock,collapseChangelog:this.settingsManager.getCollapseChangelog(),doubleEscapeAction:this.settingsManager.getDoubleEscapeAction(),treeFilterMode:this.settingsManager.getTreeFilterMode(),showHardwareCursor:this.settingsManager.getShowHardwareCursor(),editorPaddingX:this.settingsManager.getEditorPaddingX(),autocompleteMaxVisible:this.settingsManager.getAutocompleteMaxVisible(),quietStartup:this.settingsManager.getQuietStartup(),clearOnShrink:this.settingsManager.getClearOnShrink(),collapsePromptCommands:this.settingsManager.getCollapsePromptCommands()},{onAutoCompactChange:r=>{this.session.setAutoCompactionEnabled(r),this.footer.setAutoCompactEnabled(r)},onShowImagesChange:r=>{this.settingsManager.setShowImages(r);for(let i of this.chatContainer.children)i instanceof eN&&i.setShowImages(r)},onAutoResizeImagesChange:r=>{this.settingsManager.setImageAutoResize(r)},onBlockImagesChange:r=>{this.settingsManager.setBlockImages(r)},onEnableSkillCommandsChange:r=>{this.settingsManager.setEnableSkillCommands(r),this.setupAutocomplete(this.fdPath)},onToolSearchEnabledChange:r=>{this.settingsManager.setToolSearchEnabled(r)},onEnableHashlineChange:r=>{this.settingsManager.setEnableHashline(r)},onSteeringModeChange:r=>{this.session.setSteeringMode(r)},onFollowUpModeChange:r=>{this.session.setFollowUpMode(r)},onThemeChange:r=>{let i=qhe(r,!0);this.settingsManager.setTheme(r),this.ui.invalidate(),i.success||this.showError(`Failed to load theme "${r}": ${i.error}
12558
12558
  Fell back to dark theme.`)},onThemePreview:r=>{qhe(r,!0).success&&(this.ui.invalidate(),this.ui.requestRender())},onHideThinkingBlockChange:r=>{this.hideThinkingBlock=r,this.settingsManager.setHideThinkingBlock(r);for(let i of this.chatContainer.children)i instanceof JR&&i.setHideThinkingBlock(r);this.chatContainer.clear(),this.rebuildChatFromMessages()},onCollapseChangelogChange:r=>{this.settingsManager.setCollapseChangelog(r)},onQuietStartupChange:r=>{this.settingsManager.setQuietStartup(r)},onDoubleEscapeActionChange:r=>{this.settingsManager.setDoubleEscapeAction(r)},onTreeFilterModeChange:r=>{this.settingsManager.setTreeFilterMode(r)},onShowHardwareCursorChange:r=>{this.settingsManager.setShowHardwareCursor(r),this.ui.setShowHardwareCursor(r)},onEditorPaddingXChange:r=>{this.settingsManager.setEditorPaddingX(r),this.defaultEditor.setPaddingX(r),this.editor!==this.defaultEditor&&this.editor.setPaddingX!==void 0&&this.editor.setPaddingX(r)},onAutocompleteMaxVisibleChange:r=>{this.settingsManager.setAutocompleteMaxVisible(r),this.defaultEditor.setAutocompleteMaxVisible(r),this.editor!==this.defaultEditor&&this.editor.setAutocompleteMaxVisible!==void 0&&this.editor.setAutocompleteMaxVisible(r)},onClearOnShrinkChange:r=>{this.settingsManager.setClearOnShrink(r),this.ui.setClearOnShrink(r)},onCollapsePromptCommandsChange:r=>{this.settingsManager.setCollapsePromptCommands(r)},onCancel:()=>{t(),this.ui.requestRender()}});return{component:n,focus:n.getSettingsList()}})}handleEffortCommand(t){let n=this.session.getAvailableReasoningSelections();if(n.length<cJa){this.showStatus("Current model has no reasoning effort choices");return}if(!t){this.showEffortSelector(n);return}let r=this.resolveEffortSelection(t.toLowerCase());if(!r){let i=["default",...this.session.getAvailableThinkingLevels()].join(", ");this.showStatus(`Unsupported effort "${t}" for this model. Valid levels: ${i}`);return}this.applyReasoningSelection(r)}resolveEffortSelection(t){return t==="default"?{kind:"model-default"}:this.session.getAvailableThinkingLevels().includes(t)?{kind:"explicit",effort:t}:void 0}showEffortSelector(t){this.showSelector(n=>{let r=new MQ(this.session.reasoningSelection,t,i=>{n(),this.applyReasoningSelection(i)},()=>{n(),this.ui.requestRender()},this.session.defaultThinkingEffort);return{component:r,focus:r.getSelectList()}})}applyReasoningSelection(t){this.session.setReasoningSelection(t),this.footer.invalidate(),this.updateEditorBorderColor(),this.showStatus(`Thinking level: ${this.session.reasoningSelectionDisplay}`)}async handleModelCommand(t){if(!t){this.showModelSelector();return}let n=await this.findExactModelMatch(t);if(n){try{await this.session.setModel(n),this.footer.invalidate(),this.updateEditorBorderColor(),this.showStatus(`Model: ${n.name||n.id}`),this.maybeWarnAboutAnthropicSubscriptionAuth(n),this.checkDaxnutsEasterEgg(n)}catch(r){this.showError(r instanceof Error?r.message:String(r))}return}this.showModelSelector(t)}async findExactModelMatch(t){let n=await this.getModelCandidates();return oJ(t,n)}async getModelCandidates(){if(this.session.scopedModels.length>0)return this.session.scopedModels.map(t=>t.model);this.session.modelRegistry.refresh();try{return await this.session.modelRegistry.getAvailableSupported()}catch{return[]}}async updateAvailableProviderCount(){let t=await this.getModelCandidates(),n=new Set(t.map(r=>r.provider));this.footerDataProvider.setAvailableProviderCount(n.size)}async maybeWarnAboutAnthropicSubscriptionAuth(t=this.session.model){if(this.anthropicSubscriptionWarningShown||!t||t.provider!=="anthropic")return;if(this.session.modelRegistry.authStorage.get("anthropic")?.type==="oauth"){this.anthropicSubscriptionWarningShown=!0,this.showWarning(ARi);return}try{let r=await this.session.modelRegistry.getApiKeyForProvider(t.provider);if(!fJa(r))return;this.anthropicSubscriptionWarningShown=!0,this.showWarning(ARi)}catch{}}showModelSelector(t){this.showSelector(n=>{let r=new RQ(this.ui,this.session.model,this.session.modelRegistry,this.session.scopedModels,async(i,s)=>{try{await this.session.setModel(i),s&&this.session.setReasoningSelection(s),this.footer.invalidate(),this.updateEditorBorderColor(),n(),this.showStatus(`Model: ${i.name||i.id}`),this.maybeWarnAboutAnthropicSubscriptionAuth(i),this.checkDaxnutsEasterEgg(i)}catch(o){n(),this.showError(o instanceof Error?o.message:String(o))}},()=>{n(),this.ui.requestRender()},t,this.session.reasoningSelection);return{component:r,focus:r}})}async showModelsSelector(){this.session.modelRegistry.refresh();let t=this.session.modelRegistry.getAvailableSupported();if(t.length===0){this.showStatus("No models available");return}let n=this.session.scopedModels,r=n.length>0,i=new Set,s=!1;if(r){for(let u of n)i.add(`${u.model.provider}/${u.model.id}`);s=!0}else{let u=this.settingsManager.getEnabledModels();if(u!==void 0&&u.length>0){s=!0;let c=await Uge(u,this.session.modelRegistry);for(let d of c)i.add(`${d.model.provider}/${d.model.id}`)}}let o=new Set(i),a=s,l=async u=>{if(u.size>0&&u.size<t.length){let c=await Uge(Array.from(u),this.session.modelRegistry);this.session.setScopedModels(c.map(d=>({model:d.model,thinkingLevel:d.thinkingLevel})))}else this.session.setScopedModels([]);await this.updateAvailableProviderCount(),this.ui.requestRender()};this.showSelector(u=>{let c=new U_e({allModels:t,enabledModelIds:o,hasEnabledModelsFilter:a},{onModelToggle:async(d,p)=>{p?o.add(d):o.delete(d),a=!0,await l(o)},onEnableAll:async d=>{o.clear();for(let p of d)o.add(p);a=!1,await l(o)},onClearAll:async()=>{o.clear(),a=!0,await l(o)},onToggleProvider:async(d,p,m)=>{for(let f of p)m?o.add(f):o.delete(f);a=!0,await l(o)},onPersist:d=>{let p=d.length===t.length?void 0:d;this.settingsManager.setEnabledModels(p),this.showStatus("Model selection saved to settings")},onCancel:()=>{u(),this.ui.requestRender()}});return{component:c,focus:c}})}showUserMessageSelector(){let t=this.session.getUserMessagesForForking();if(t.length===0){this.showStatus("No messages to fork from");return}this.showSelector(n=>{let r=new DQ(t.map(i=>({id:i.entryId,text:i.text})),async i=>{let s=await this.runtimeHost.fork(i);if(s.cancelled){n(),this.ui.requestRender();return}await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.editor.setText(s.selectedText??""),n(),this.showStatus("Branched to new session")},()=>{n(),this.ui.requestRender()});return{component:r,focus:r.getMessageList()}})}showTreeSelector(t){let n=this.sessionManager.getTree(),r=this.sessionManager.getLeafId(),i=this.settingsManager.getTreeFilterMode();if(n.length===0){this.showStatus("No entries in session");return}this.showSelector(s=>{let o=new PQ(n,r,this.ui.terminal.rows,async a=>{if(a===r){s(),this.showStatus("Already at this point");return}s();let l=!1,u;if(!this.settingsManager.getBranchSummarySkipPrompt())for(;;){let p=await this.showExtensionSelector("Summarize branch?",["No summary","Summarize","Summarize with custom prompt"]);if(p===void 0){this.showTreeSelector(a);return}if(l=p!=="No summary",!(p==="Summarize with custom prompt"&&(u=await this.showExtensionEditor("Custom summarization instructions"),u===void 0)))break}let c,d=this.defaultEditor.onEscape;l&&(this.defaultEditor.onEscape=()=>{this.session.abortBranchSummary()},this.chatContainer.addChild(new st(1)),c=new Wa(this.ui,p=>fe.fg("accent",p),p=>fe.fg("muted",p),`Summarizing branch... (${Da("app.interrupt")} to cancel)`),this.statusContainer.addChild(c),this.ui.requestRender());try{let p=await this.session.navigateTree(a,{summarize:l,customInstructions:u});if(p.aborted){this.showStatus("Branch summarization cancelled"),this.showTreeSelector(a);return}if(p.cancelled){this.showStatus("Navigation cancelled");return}this.chatContainer.clear(),this.renderInitialMessages(),p.editorText&&!this.editor.getText().trim()&&this.editor.setText(p.editorText),this.showStatus("Navigated to selected point")}catch(p){this.showError(p instanceof Error?p.message:String(p))}finally{c&&(c.stop(),this.statusContainer.clear()),this.defaultEditor.onEscape=d}},()=>{s(),this.ui.requestRender()},(a,l)=>{this.sessionManager.appendLabelChange(a,l),this.ui.requestRender()},t,i);return{component:o,focus:o}})}showSessionSelector(){this.showSelector(t=>{let n=new oM(r=>ds.list(this.sessionManager.getCwd(),this.sessionManager.getSessionDir(),r),r=>ds.listAll(void 0,r),async r=>{t(),await this.handleResumeSession(r)},()=>{t(),this.ui.requestRender()},()=>{this.shutdown()},()=>this.ui.requestRender(),{renameSession:async(r,i)=>{let s=(i??"").trim();if(!s)return;ds.open(r).appendSessionInfo(s)},showRenameHint:!0,keybindings:this.keybindings},this.sessionManager.getSessionFile());return{component:n,focus:n}})}async handleResumeSession(t){this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear();try{if((await this.runtimeHost.switchSession(t)).cancelled)return;await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.showStatus("Resumed session")}catch(n){if(n instanceof j9){let r=await this.promptForMissingSessionCwd(n);if(!r){this.showStatus("Resume cancelled");return}if((await this.runtimeHost.switchSession(t,r)).cancelled)return;await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.showStatus("Resumed session in current cwd");return}await this.handleFatalRuntimeError("Failed to resume session",n)}}async handleAugmentLogoutCommand(){let t=await Vw().catch(()=>{}),n=t?.status==="resolved"&&t.credentials.tokenSource!=="session-file",r=await Lbe(["logout"],{offline:process.env.PI_OFFLINE==="1"},{print:i=>this.showStatus(i),printError:i=>this.showError(i),printWarning:i=>this.showWarning(i)});r.type!=="completed"||r.exitCode!==0||(n||(this.runtimeHost.setAugmentAccount(void 0),this.session.modelRegistry.unregisterProvider("augment")),await this.updateAvailableProviderCount())}async handleAugmentLoginCommand(){let t;try{t=await Vw()}catch{this.showError("Credential state could not be read.");return}if(t.status==="resolved"&&(process.env.PI_OFFLINE==="1"||this.session.modelRegistry.isAugmentRegistryAvailable())){this.showStatus("You're already logged in.");return}let n=[...this.editorContainer.children],r=this.customFooter??this.footer;(this.onboardingLayout??this.ui).removeChild(this.widgetContainerBelow),(this.onboardingLayout??this.ui).removeChild(r);try{let i=await BZe({tui:this.ui,offline:process.env.PI_OFFLINE==="1",mount:c=>{this.editorContainer.clear(),this.editorContainer.addChild(c),this.ui.setFocus(c),this.ui.requestRender()},confirm:c=>this.showExtensionConfirm("Login",c)});if(i.type==="declined"){this.showStatus("Authentication was not changed.");return}if(i.type==="cancelled"){this.showStatus("Authentication cancelled.");return}if(i.type==="error"){this.showError(i.message);return}this.showStatus("Logged in successfully!");let{account:s,discovered:o}=await Cwi({modelRegistry:this.session.modelRegistry,userAgent:this.runtimeHost.services.augmentUserAgent});if(this.runtimeHost.setAugmentAccount(s),!o){this.showError("Models could not be loaded after login.");return}let l=this.session.settingsManager.getDefaultModel(),u=this.session.modelRegistry.getAvailableAugmentModel(l);if(!u){this.showError("No model was available after login.");return}await this.session.setModel(u),await this.updateAvailableProviderCount()}finally{this.editorContainer.clear();for(let i of n)this.editorContainer.addChild(i);(this.onboardingLayout??this.ui).addChild(this.widgetContainerBelow),(this.onboardingLayout??this.ui).addChild(r),this.ui.setFocus(this.editor),this.ui.requestRender()}}async handleReloadCommand(){if(this.session.isStreaming){this.showWarning("Wait for the current response to finish before reloading.");return}if(this.session.isCompacting){this.showWarning("Wait for compaction to finish before reloading.");return}this.resetExtensionUI();let t=new _Q(this.ui,fe,"Reloading keybindings, extensions, skills, custom commands, themes...",{cancellable:!1}),n=this.editor;this.editorContainer.clear(),this.editorContainer.addChild(t),this.ui.setFocus(t),this.ui.requestRender();let r=i=>{t.dispose(),this.editorContainer.clear(),this.editorContainer.addChild(i),this.ui.setFocus(i),this.ui.requestRender()};try{await this.session.reload(),this.toolOutputExpanded=this.settingsManager.getVerbose(),this.defaultEditor.setPasteOptions(this.getPasteOptions()),this.keybindings.reload(),MGe(this.session.resourceLoader.getThemes().themes),this.hideThinkingBlock=this.settingsManager.getHideThinkingBlock();let i=this.settingsManager.getTheme(),s=i?qhe(i,!0):{success:!0};s.success||this.showError(`Failed to load theme "${i}": ${s.error}
12559
12559
  Fell back to dark theme.`);let o=this.settingsManager.getEditorPaddingX(),a=this.settingsManager.getAutocompleteMaxVisible();this.defaultEditor.setPaddingX(o),this.defaultEditor.setAutocompleteMaxVisible(a),this.editor!==this.defaultEditor&&(this.editor.setPaddingX?.(o),this.editor.setAutocompleteMaxVisible?.(a)),this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor()),this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink()),this.setupAutocomplete(this.fdPath);let l=this.session.extensionRunner;l&&this.setupExtensionShortcuts(l),this.rebuildChatFromMessages(),r(this.editor),this.showLoadedResources({force:!1,showDiagnosticsWhenQuiet:!0});let u=this.session.modelRegistry.getError();u&&this.showError(`models.json error: ${u}`),this.showStatus("Reloaded keybindings, extensions, skills, custom commands, themes")}catch(i){r(n),this.showError(`Reload failed: ${i instanceof Error?i.message:String(i)}`)}}async handleExportCommand(t){let n=t.split(/\s+/),r=n.length>1?n[1]:void 0;try{if(r?.endsWith(".jsonl")){let i=this.session.exportToJsonl(r);this.showStatus(`Session exported to: ${i}`)}else{let i=await this.session.exportToHtml(r);this.showStatus(`Session exported to: ${i}`)}}catch(i){this.showError(`Failed to export session: ${i instanceof Error?i.message:"Unknown error"}`)}}async handleImportCommand(t){let n=t.split(/\s+/);if(n.length<2||!n[1]){this.showError("Usage: /import <path.jsonl>");return}let r=n[1];if(!await this.showExtensionConfirm("Import session",`Replace current session with ${r}?`)){this.showStatus("Import cancelled");return}try{if(this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear(),(await this.runtimeHost.importFromJsonl(r)).cancelled){this.showStatus("Import cancelled");return}await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.showStatus(`Session imported from: ${r}`)}catch(s){if(s instanceof j9){let o=await this.promptForMissingSessionCwd(s);if(!o){this.showStatus("Import cancelled");return}if((await this.runtimeHost.importFromJsonl(r,o)).cancelled){this.showStatus("Import cancelled");return}await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.showStatus(`Session imported from: ${r}`);return}await this.handleFatalRuntimeError("Failed to import session",s)}}async handleCopyCommand(){let t=this.session.getLastAssistantText();if(!t){this.showError("No agent messages to copy yet.");return}try{await ane(t),this.showStatus("Copied last agent message to clipboard")}catch(n){this.showError(n instanceof Error?n.message:String(n))}}handleNameCommand(t){let n=t.replace(/^\/name\s*/,"").trim();if(!n){let r=this.sessionManager.getSessionName();r?(this.chatContainer.addChild(new st(1)),this.chatContainer.addChild(new Tn(()=>fe.fg("dim",`Session name: ${r}`),1,0))):this.showWarning("Usage: /name <name>"),this.ui.requestRender();return}this.sessionManager.appendSessionInfo(n),this.updateTerminalTitle(),this.chatContainer.addChild(new st(1)),this.chatContainer.addChild(new Tn(()=>fe.fg("dim",`Session name set: ${n}`),1,0)),this.ui.requestRender()}handleSessionCommand(){let t=structuredClone(this.session.getSessionStats()),n=this.sessionManager.getSessionName(),r=this.sessionManager.getBranch(),i=pne({branch:r,...a_(r)}),s=()=>{let o=`${fe.bold("Session Info")}
12560
12560
 
@@ -13567,7 +13567,7 @@ ${a.join(`
13567
13567
  ${u}`;let c=" ".repeat(Math.max(2,this.modelColumnWidth-Wt(a)+2));return a+c+u}addVisibleModelItems(t,n){for(let r=t;r<n;r++){let i=this.filteredModels[r];i&&this.listContainer.addChild(new In(()=>this.getModelLine(i,r),0,0))}}addScrollIndicator(t,n){t<=0&&n>=this.filteredModels.length||this.listContainer.addChild(new In(()=>me.fg("muted",` (${this.selectedIndex+1}/${this.filteredModels.length})`),0,0))}addListStatus(){if(this.errorMessage){for(let n of this.errorMessage.split(`
13568
13568
  `))this.listContainer.addChild(new In(()=>me.fg("error",n),0,0));return}if(this.filteredModels.length===0){this.listContainer.addChild(new In(()=>me.fg("muted"," No matching models"),0,0));return}let t=this.filteredModels[this.selectedIndex];t&&(this.listContainer.addChild(new st(1)),this.listContainer.addChild(new In(()=>me.fg("muted",` Model Name: ${t.model.name}`),0,0)))}updateList(){this.keyHintsText.invalidate(),this.listContainer.clear();let{startIndex:t,endIndex:n}=this.getVisibleModelRange();this.addVisibleModelItems(t,n),this.addScrollIndicator(t,n),this.addListStatus()}handleInput(t){let n=Hn();if(Nt(t,"shift+tab")){this.toggleScope();return}if(n.matches(t,"tui.input.tab")){this.cycleThinking();return}if(n.matches(t,"tui.select.up")){this.moveSelection(-1);return}if(n.matches(t,"tui.select.down")){this.moveSelection(1);return}if(n.matches(t,"tui.select.confirm")){this.confirmSelection();return}if(n.matches(t,"tui.select.cancel")){this.onCancelCallback();return}this.searchInput.handleInput(t),this.filterModels(this.searchInput.getValue())}toggleScope(){if(this.scopedModelItems.length===0)return;let t=this.scope==="all"?"scoped":"all";this.setScope(t)}moveSelection(t){let r=this.filteredModels.length-1;r<0||(this.selectedIndex+=t,this.selectedIndex<0&&(this.selectedIndex=r),this.selectedIndex>r&&(this.selectedIndex=0),this.updateList())}getPendingThinking(t){let n=JSON.stringify([t.provider,t.id]),r=this.pendingThinking.get(n);if(r)return r;let i=co(this.currentModel,t)?this.currentReasoningSelection:void 0,s=ss(t,i?.kind==="explicit"?i.effort:void 0),o=i&&s.valid?i:s,a=o.kind==="model-default"?{kind:"model-default"}:{kind:"explicit",effort:o.effort};return this.pendingThinking.set(n,a),a}getThinkingSelectionIndex(t,n){let r=this.getPendingThinking(t);return n.findIndex(i=>i.kind===r.kind&&(i.kind==="model-default"||r.kind==="explicit"&&i.effort===r.effort))}cycleThinking(){let t=this.filteredModels[this.selectedIndex]?.model;if(!t)return;let n=zf(t);if(n.length<2)return;let r=this.getThinkingSelectionIndex(t,n),i=n[(r+1)%n.length];i&&(this.pendingThinking.set(JSON.stringify([t.provider,t.id]),i),this.updateList(),this.tui.requestRender())}getThinkingLine(t){let n=zf(t);if(n.length===0)return"";let r=this.getThinkingSelectionIndex(t,n);return r<0&&(r=n.length,n.push(this.getPendingThinking(t))),n.map((s,o)=>{let a=IA(t,s);return o===r?me.fg("accent",`[${a}]`):me.fg("muted",a)}).join(me.fg("dim"," \xB7 "))}confirmSelection(){let t=this.filteredModels[this.selectedIndex]?.model;if(!t)return;let n=zf(t).length>0?this.getPendingThinking(t):void 0;this.onSelectCallback(t,n)}render(t){return t!==this.renderWidth&&(this.renderWidth=t,this.updateList()),super.render(t)}getSearchInput(){return this.searchInput}}});function eBi(e){return oul.flatMap(([t,n])=>e[t].map(r=>({category:n,item:r})))}function aul(e){let t=0;for(let[n,{category:r}]of e.entries())r!==e[n+1]?.category&&(t=Math.max(t,new Set(e.slice(n,n+rU).map(i=>i.category)).size));return Math.max(1,Math.min(e.length,rU)+t+(e.length>rU?2:0))}function lul(e,t){return e==="plugins"?"Plugins":e==="marketplaces"?"Marketplace":t>0?`Errors(${t})`:"Errors"}function cul(e){let t=e.trim();return t?t.includes("github.com")?!0:/^[\w.-]+\/[\w.-]+$/.test(t):!1}var rU,oul,KQ,FSe,tBi,snn,lKe,onn,nBi=C(()=>{"use strict";tn();Zy();yi();du();Sc();rU=8,oul=[["agents","Agents"],["commands","Commands"],["rules","Rules"],["mcpServers","MCP Servers"],["hooks","Hooks"],["skills","Skills"]],KQ=e=>Array.from(Eu(e),t=>{let n=t.charCodeAt(0);return n<32||n>=127&&n<=159?" ":t}).join("").trim();FSe=["plugins","marketplaces","errors"];tBi=[{label:"Auggie",repo:"augmentcode/auggie",description:"Augment's own curated plugins"},{label:"Claude (official)",repo:"anthropics/claude-plugins-official",description:"Anthropic's official plugin directory"},{label:"Superpowers",repo:"obra/superpowers-marketplace",description:"Skills & workflow plugins by obra"},{label:"Claude Code",repo:"anthropics/claude-code",description:"Plugins bundled with the Claude Code repo"}];snn=class{get focused(){return this._focused}set focused(t){this._focused=t}constructor(t){this.selectedTab="plugins",this.viewStack=[{kind:"list"}],this.selectedIndex=0,this.maxVisible=15,this.addError=null,this.busyMessage=null,this.addSelectedIndex=0,this._focused=!1,this.data=t,this.addInput=new hi,this.listFilter=new hi}get currentView(){return this.viewStack.at(-1)??{kind:"list"}}push(t){this.viewStack.push(t),this.selectedIndex=0,this.onChange?.()}back(){if(this.viewStack.length>1){this.viewStack.pop(),this.selectedIndex=0,this.addError=null,this.onChange?.();return}this.onClose?.()}rowsForTab(){return this.selectedTab==="plugins"?this.data.getPlugins():this.selectedTab==="marketplaces"?this.data.getMarketplaces():this.data.getErrors()}rowSearchText(t){if(this.selectedTab==="plugins"){let n=t;return`${n.name} ${n.id} ${n.marketplace}`}if(this.selectedTab==="marketplaces"){let n=t;return`${n.name} ${n.dir}`}return t.message}filteredRows(){let t=this.listFilter.getValue(),n=this.rowsForTab();return t.trim()?uc(n,t,r=>this.rowSearchText(r)):n}invalidate(){}render(t){let n=this.currentView;return n.kind==="add-marketplace"?this.renderAddMarketplace(t):n.kind==="plugin-detail"?this.renderPluginDetail(t,n):n.kind==="marketplace-detail"?this.renderMarketplaceDetail(t,n.dir):this.renderList(t)}renderTabBar(t){let n=this.data.getErrors().length,r=FSe.map(i=>{let s=lul(i,n);return i===this.selectedTab?me.fg("accent",me.bold(`[ ${s} ]`)):me.fg("muted",` ${s} `)});return At(r.join(" "),t,"")}renderList(t){let n=[];n.push(this.renderTabBar(t)),n.push("");let r=this.rowsForTab().length;r>0&&(n.push(...this.listFilter.render(t)),n.push(""));let i=this.filteredRows();if(i.length===0){let a=r>0?"No matches":this.emptyLabel();return n.push(me.fg("muted",` ${a}`)),n.push(""),n.push(this.renderHints()),n}let{start:s,end:o}=this.visibleRange(i.length);for(let a=s;a<o;a++)n.push(this.renderRow(i[a],a===this.selectedIndex,t));return(s>0||o<i.length)&&n.push(me.fg("dim",` (${this.selectedIndex+1}/${i.length})`)),n.push(""),n.push(this.renderHints()),n}emptyLabel(){return this.selectedTab==="plugins"?"No plugins discovered":this.selectedTab==="marketplaces"?"No marketplaces installed \u2014 press Ctrl+N to add one":"No problems \u{1F389}"}renderRow(t,n,r){let i=n?"> ":" ";if(this.selectedTab==="plugins"){let a=t,l=a.enabled?me.fg("success","[x]"):me.fg("dim","[ ]"),u=a.diagnostics.length>0?me.fg("warning"," \u26A0"):"",c=n?me.bold(a.name):a.name,d=me.fg("dim",` @${a.marketplace}`);return At(`${i}${l} ${c}${d}${u}`,r,"...")}if(this.selectedTab==="marketplaces"){let a=t,l=n?me.bold(a.name):a.name,u=me.fg("dim",` (${a.pluginCount} plugins)`);return At(`${i}${l}${u}`,r,"...")}let s=t,o=n?me.bold(s.message):s.message;return At(`${i}${me.fg("warning",o)}`,r,"...")}renderHints(){let t=me.fg("muted"," \xB7 "),n=this.listFilter.getValue().trim().length>0,r=zs("\u2191\u2193","move")+t+zs("tab","switch"),i=n?zs("esc","clear filter"):zs("type","filter")+t+zs("esc","close");return this.selectedTab==="plugins"?r+t+zs("space","toggle")+t+zs("enter","details")+t+i:this.selectedTab==="marketplaces"?r+t+zs("^n","add")+t+zs("^x","remove")+t+zs("enter","details")+t+i:r+t+i}loadPluginDetail(t){if(!t.loaded){t.loaded=!0;try{t.details=this.data.getPluginDetails(t.pluginId)}catch{t.details={agents:[],commands:[],rules:[],mcpServers:[],hooks:[],skills:[],diagnostics:["Could not read plugin contents metadata"]}}}return t.details}renderPluginDetail(t,n){let r=c=>At(c,Math.max(0,t),"\u2026"),i=this.data.getPlugins().find(c=>c.id===n.pluginId),s=i?this.loadPluginDetail(n):void 0;if(!i||!s)return[me.fg("muted"," Plugin no longer available"),"",Gr("tui.select.cancel","back")].map(r);let o=[me.bold(` ${KQ(i.name)}`),me.fg("muted",` ${KQ(i.id)}`),"",` Status: ${i.enabled?me.fg("success","enabled"):me.fg("dim","disabled")}`];for(let[c,d]of[["description","Description"],["version","Version"],["author","Author"],["homepage","Homepage"]]){let p=KQ(s[c]??"");p&&o.push(` ${me.fg("muted",`${d}:`)} ${p}`)}let a=[...i.diagnostics,...s.diagnostics];if(a.length>0){o.push("",me.fg("warning"," Problems:"));for(let c of a)o.push(me.fg("warning",` \u2022 ${KQ(c)}`))}let l=eBi(s);n.offset=Math.max(0,Math.min(n.offset,l.length-rU)),o.push(...this.renderPluginContents(t,l,n.offset));let u=[zs("space","toggle"),Gr("tui.select.cancel","back")];return l.length>rU&&u.unshift(zs(`${Oa("tui.select.up")}/${Oa("tui.select.down")}`,"scroll")),o.push("",...fr(u.join(me.fg("muted"," \xB7 ")),Math.max(1,t-2)).map(c=>` ${c}`)),o.map(r)}renderPluginContents(t,n,r){let i=["",me.bold(` Configs (${n.length})`)],s=n.length>rU,o=i.length+aul(n);n.length===0&&i.push(me.fg("muted"," No configs")),s&&i.push(r>0?me.fg("dim",` \u2191 ${r} more above`):"");let a=n.slice(r,r+rU),l=Math.max(1,Math.min(Math.max(0,...a.map(({item:d})=>Wt(KQ(d.name)))),Math.floor((t-8)*.4))),u;for(let{category:d,item:p}of a){d!==u&&(i.push(me.fg("accent",` ${d}`)),u=d);let m=At(KQ(p.name),l,"\u2026"),f=" ".repeat(Math.max(0,l-Wt(m))+2),h=KQ(p.description??"")||"No description provided";i.push(` ${me.fg("dim","\u2022")} ${m}${f}${me.fg("muted",h)}`)}let c=n.length-r-a.length;for(;i.length<o-(s?1:0);)i.push("");return s&&i.push(c>0?me.fg("dim",` \u2193 ${c} more below`):""),i}renderMarketplaceDetail(t,n){let r=this.data.getMarketplaces().find(o=>o.dir===n),i=[];if(!r)return i.push(me.fg("muted"," Marketplace no longer available")),i.push(""),i.push(zs("esc","back")),i;i.push(me.bold(` ${r.name}`)),i.push(me.fg("muted",` ${r.dir}`)),i.push(""),i.push(` Plugins: ${r.pluginCount}`),i.push("");let s=this.data.getPlugins().filter(o=>o.marketplace===r.name||o.marketplace===r.dir);for(let o of s.slice(0,20)){let a=o.enabled?me.fg("success","[x]"):me.fg("dim","[ ]");i.push(At(` ${a} ${o.name}`,t,"..."))}return i.push(""),i.push(zs("d","remove")+me.fg("muted"," \xB7 ")+zs("esc","back")),i}isCuratedInstalled(t){let n=t.split("/").at(-1)?.toLowerCase()??"";return n?this.data.getMarketplaces().some(r=>{let i=r.name.toLowerCase(),s=r.dir.toLowerCase();return i===n||s===n}):!1}addPickRows(){let t=this.addInput.getValue().trim().toLowerCase(),r=tBi.filter(o=>t?o.label.toLowerCase().includes(t)||o.repo.toLowerCase().includes(t)||o.description.toLowerCase().includes(t):!0).map(o=>({kind:"curated",entry:o,installed:this.isCuratedInstalled(o.repo)})),i=this.addInput.getValue().trim(),s=tBi.some(o=>o.repo.toLowerCase()===i.toLowerCase());return cul(i)&&!s&&r.push({kind:"custom",repo:i}),r}renderAddMarketplace(t){let n=[];n.push(me.bold(" Add marketplace")),n.push(me.fg("muted"," Pick a popular one or type owner/repo or a URL:")),n.push(""),n.push(...this.addInput.render(t)),n.push("");let r=this.addPickRows();if(r.length===0)n.push(me.fg("muted"," No matches \u2014 type owner/repo or a URL"));else for(let i=0;i<r.length;i++)n.push(...this.renderAddPickRow(r[i],i===this.addSelectedIndex,t));return this.busyMessage&&(n.push(""),n.push(me.fg("muted",` ${this.busyMessage}`))),this.addError&&(n.push(""),n.push(At(` ${me.fg("error",this.addError)}`,t,"..."))),n.push(""),n.push(zs("\u2191\u2193","move")+me.fg("muted"," \xB7 ")+zs("enter","add")+me.fg("muted"," \xB7 ")+zs("esc","cancel")),n}renderAddPickRow(t,n,r){let i=n?"> ":" ";if(t.kind==="custom"){let d=n?me.bold(`Add "${t.repo}"`):`Add "${t.repo}"`;return[At(`${i}${me.fg("accent","+")} ${d}`,r,"...")]}let{entry:s,installed:o}=t,a=n?me.bold(s.label):s.label,l=o?me.fg("success"," (installed)"):"",u=At(`${i}${a}${l}`,r,"..."),c=At(` ${me.fg("dim",s.repo)} ${me.fg("muted",s.description)}`,r,"...");return[u,c]}visibleRange(t){let n=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),t-this.maxVisible));return{start:n,end:Math.min(n+this.maxVisible,t)}}handleInput(t){if(Nt(t,"ctrl+c")){this.onExit?.();return}let n=this.currentView;if(n.kind==="add-marketplace"){this.handleAddInput(t);return}if(n.kind==="plugin-detail"){this.handlePluginDetailInput(t,n);return}if(n.kind==="marketplace-detail"){this.handleMarketplaceDetailInput(t,n.dir);return}this.handleListInput(t)}handleListInput(t){let n=Hn(),r=this.filteredRows();if(n.matches(t,"tui.select.cancel")){if(this.listFilter.getValue().trim()){this.listFilter.setValue(""),this.selectedIndex=0,this.onChange?.();return}this.back();return}if(n.matches(t,"tui.select.up")){this.selectedIndex=Math.max(0,this.selectedIndex-1),this.onChange?.();return}if(n.matches(t,"tui.select.down")){this.selectedIndex=Math.min(Math.max(0,r.length-1),this.selectedIndex+1),this.onChange?.();return}if(t===" "||Nt(t,"right")){this.cycleTab(1);return}if(Nt(t,"shift+tab")||Nt(t,"left")){this.cycleTab(-1);return}if(t===" "&&this.selectedTab==="plugins"){this.togglePluginVisible(this.selectedIndex);return}if(n.matches(t,"tui.select.confirm")){this.openDetailVisible(this.selectedIndex);return}if(this.selectedTab==="marketplaces"){if(Nt(t,"ctrl+n")){this.addInput.setValue(""),this.addError=null,this.addSelectedIndex=0,this.push({kind:"add-marketplace"});return}if(Nt(t,"ctrl+x")){this.removeMarketplaceVisible(this.selectedIndex);return}}this.listFilter.handleInput(t),this.selectedIndex=0,this.onChange?.()}togglePluginVisible(t){let n=this.filteredRows()[t];if(!n||this.selectedTab!=="plugins")return;let r=n.id,i=this.data.getPlugins().findIndex(s=>s.id===r);i>=0&&this.togglePluginAt(i)}openDetailVisible(t){let n=this.filteredRows()[t];if(n){if(this.selectedTab==="plugins"){let r=n.id,i=this.data.getPlugins().findIndex(s=>s.id===r);i>=0&&this.openDetailAt(i);return}if(this.selectedTab==="marketplaces"){let r=n.dir,i=this.data.getMarketplaces().findIndex(s=>s.dir===r);i>=0&&this.openDetailAt(i);return}}}removeMarketplaceVisible(t){let n=this.filteredRows()[t];if(!n||this.selectedTab!=="marketplaces")return;let r=n.dir,i=this.data.getMarketplaces().findIndex(s=>s.dir===r);i>=0&&this.removeMarketplaceAt(i)}cycleTab(t){let r=(FSe.indexOf(this.selectedTab)+t+FSe.length)%FSe.length;this.selectedTab=FSe[r],this.selectedIndex=0,this.listFilter.setValue(""),this.onChange?.()}openDetailAt(t){if(this.selectedTab==="plugins"){let n=this.data.getPlugins()[t];n&&this.push({kind:"plugin-detail",pluginId:n.id,offset:0});return}if(this.selectedTab==="marketplaces"){let n=this.data.getMarketplaces()[t];n&&this.push({kind:"marketplace-detail",dir:n.dir})}}togglePluginAt(t){let n=this.data.getPlugins()[t];n&&(this.data.settingsManager.setPluginEnabled(n.id,!n.enabled),this.data.refresh(),this.onChange?.())}removeMarketplaceAt(t){let n=this.data.getMarketplaces()[t];if(!n)return;this.data.removeMarketplace(n.dir)||(this.data.refresh(),this.selectedIndex=0),this.onChange?.()}handlePluginDetailInput(t,n){let r=Hn();if(r.matches(t,"tui.select.cancel")){this.back();return}if(t===" "){let a=this.data.getPlugins().find(l=>l.id===n.pluginId);a&&(this.data.settingsManager.setPluginEnabled(a.id,!a.enabled),this.data.refresh(),n.loaded=!1,n.details=void 0,n.offset=0,this.onChange?.());return}let i=r.matches(t,"tui.select.up"),s=r.matches(t,"tui.select.down");if(!i&&!s)return;let o=n.details?eBi(n.details).length:0;n.offset=Math.max(0,Math.min(n.offset+(s?1:-1),o-rU)),this.onChange?.()}handleMarketplaceDetailInput(t,n){if(Hn().matches(t,"tui.select.cancel")){this.back();return}t==="d"&&(this.data.removeMarketplace(n)||(this.data.refresh(),this.back()))}handleAddInput(t){let n=Hn();if(n.matches(t,"tui.select.cancel")){this.back();return}if(this.busyMessage)return;let r=this.addPickRows();if(n.matches(t,"tui.select.up")){this.addSelectedIndex=Math.max(0,this.addSelectedIndex-1),this.onChange?.();return}if(n.matches(t,"tui.select.down")){this.addSelectedIndex=Math.min(Math.max(0,r.length-1),this.addSelectedIndex+1),this.onChange?.();return}if(n.matches(t,"tui.select.confirm")){let i=r[this.addSelectedIndex],s=i?.kind==="curated"?i.entry.repo:i?.repo??this.addInput.getValue().trim();this.submitAdd(s);return}this.addInput.handleInput(t),this.addSelectedIndex=0,this.onChange?.()}submitAdd(t){t&&(this.busyMessage=`Cloning ${t}\u2026`,this.addError=null,this.onChange?.(),this.data.addMarketplace(t).then(n=>{if(this.busyMessage=null,n){this.addError=n,this.onChange?.();return}this.data.refresh(),this.back()}).catch(n=>{this.busyMessage=null,this.addError=n instanceof Error?n.message:String(n),this.onChange?.()}))}},lKe=class extends Vt{get focused(){return this._focused}set focused(t){this._focused=t,this.body.focused=t}handleInput(t){this.body.handleInput(t)}constructor(t,n,r,i){super(),this._focused=!1,this.addChild(new st(1)),this.addChild(new rr),this.addChild(new st(1)),this.addChild(new onn),this.addChild(new st(1)),this.body=new snn(t),this.body.onClose=n,this.body.onExit=r,this.body.onChange=()=>i(),this.addChild(this.body),this.addChild(new st(1)),this.addChild(new rr)}},onn=class{invalidate(){}render(t){let n=me.bold("Plugins");return[At(` ${n}`,t,"")]}}});var Dre,ann=C(()=>{"use strict";tn();yi();Sc();Dre=class extends Gl{constructor(t){super(1,1,n=>me.bg("customMessageBg",n)),this.expanded=!1,this.markdownTheme=t}setExpanded(t){this.expanded=t,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}getExpandedHeaderSuffix(){return""}getCollapsedHintPrefix(){return""}updateDisplay(){this.clear(),this.expanded?this.renderExpanded():this.renderCollapsed()}renderExpanded(){let t=me.fg("customMessageLabel",`\x1B[1m${this.getLabel()}\x1B[22m`);this.addChild(new Ot(t,0,0));let n=this.getExpandedHeaderSuffix(),r=`**${this.getTitle()}**${n?` ${n}`:""}
13569
13569
 
13570
- `;this.addChild(new Os(r+this.getBody(),0,0,this.markdownTheme,{color:i=>me.fg("customMessageText",i)}))}renderCollapsed(){let t=this.getCollapsedHintPrefix(),n=t?[t]:[];n.push(`${Oa("app.tools.expand")} to expand`);let r=me.fg("customMessageLabel",`\x1B[1m${this.getLabel()}\x1B[22m `)+me.fg("customMessageText",this.getTitle())+me.fg("dim",` (${n.join(", ")})`);this.addChild(new Ot(r,0,0))}}});import{homedir as uul}from"node:os";var USe,lnn=C(()=>{"use strict";MS();yi();ann();USe=class extends Dre{constructor(t,n,r,i=Dp(),s){super(i),this.command=t,this.args=n,this.expandedBody=r,this.source=s,this.updateDisplay()}getLabel(){return"[prompt]"}getTitle(){return hh({command:this.command,args:this.args})}getBody(){return this.expandedBody.trim()?this.expandedBody:"_(empty prompt body)_"}getExpandedHeaderSuffix(){let t=this.formatSourcePath();return t?`_(from ${t})_`:""}getCollapsedHintPrefix(){let t=this.formatSourcePath();return t?`from ${t}`:""}formatSourcePath(){let t=this.source?.path;if(!t)return;let n=uul();return n&&t.startsWith(`${n}/`)?`~${t.slice(n.length)}`:t}}});function mul(e){return{name:dKe(e.name),type:dul[e.type]}}function ful(e,t){let n=Math.min(15,Math.max(4,e-8)),r=t.reduce((i,s)=>Math.max(i,Wt(dKe(s.name))),20);return{nameWidth:Math.max(1,Math.min(r,e-4-n)),typeWidth:n}}function rBi(e,t){let n=At(e,t,"\u2026");return n+" ".repeat(Math.max(0,t-Wt(n))+2)}function hul(e,t){return fr(dKe(e),Math.max(1,t-2)).map(n=>` ${me.fg("muted",n)}`)}var cKe,dul,pul,dKe,uKe,iBi=C(()=>{"use strict";tn();Zy();yi();du();Sc();cKe=8,dul={always:"always_apply","agent-requested":"agent_requested",manual:"manual"},pul={always:"success","agent-requested":"accent",manual:"warning"},dKe=e=>Array.from(Eu(e),t=>{let n=t.charCodeAt(0);return n<32||n>=127&&n<=159?" ":t}).join("").trim();uKe=class{constructor(t,n,r){this.focused=!1,this.selected=0,this.showingDiagnostics=!1,this.snapshot=t,this.onClose=n,this.requestRender=r}invalidate(){}render(t){let n=m=>At(m,Math.max(0,t),"\u2026"),{rules:r,diagnostics:i}=this.snapshot,s=new rr(m=>me.fg("border",m)),o=["",...s.render(t),"",n(me.fg("accent",me.bold(" Rules"))),""];i.length>0&&o.push(n(me.fg("warning",` ${i.length} rule warning(s)`)),"");let a=ful(t,r),{nameWidth:l,typeWidth:u}=a;o.push(n(me.fg("muted",this.showingDiagnostics?" Warnings":` ${rBi("Name",l)}${At("Type",u,"\u2026")}`))),this.showingDiagnostics||o.push("");let c=this.showingDiagnostics?i:r;if(c.length===0)o.push(n(me.fg("muted",this.showingDiagnostics?" No warnings":" No rules loaded")));else{let m=Math.max(0,Math.min(this.selected-Math.floor(cKe/2),c.length-cKe));for(let f=m;f<Math.min(m+cKe,c.length);f++)o.push(...this.renderEntry(f,t,a));c.length>cKe&&o.push(n(me.fg("dim",` ${this.selected+1}/${c.length}`)))}let d=me.fg("muted"," \xB7 "),p=[zs(`${Oa("tui.select.up")}/${Oa("tui.select.down")}`,"navigate"),Gr("tui.select.cancel","close")];return i.length>0&&p.push(zs("d",this.showingDiagnostics?"rules":"inspect")),o.push("",...fr(p.join(d),Math.max(1,t-2)).map(m=>n(` ${m}`)),"",...s.render(t)),o.map(n)}renderEntry(t,n,r){let i=f=>At(f,n,"\u2026"),s=t===this.selected,o=s?me.fg("accent","\u2192 "):" ";if(this.showingDiagnostics){let f=this.snapshot.diagnostics[t],h=dKe(f.message);if(s){let g=fr(h,Math.max(1,n-2)).map((b,A)=>i(`${A===0?o:" "}${me.fg("warning",b)}`));return f.path&&g.push(...hul(`Path: ${f.path}`,n)),g}return[i(`${o}${me.fg("warning",h)}`)]}let{name:a,type:l}=mul(this.snapshot.rules[t]),{nameWidth:u,typeWidth:c}=r,d=rBi(a,u),p=s?me.fg("accent",me.bold(d)):d,m=me.fg(pul[this.snapshot.rules[t].type],At(l,c,"\u2026"));return[i(o+p+m)]}handleInput(t){let n=Hn();if(n.matches(t,"tui.select.cancel")){this.onClose();return}if(Nt(t,"d")&&this.snapshot.diagnostics.length>0){this.showingDiagnostics=!this.showingDiagnostics,this.selected=0,this.requestRender();return}let r=this.showingDiagnostics?this.snapshot.diagnostics.length:this.snapshot.rules.length;if(r!==0){if(n.matches(t,"tui.select.up"))this.selected=(this.selected-1+r)%r;else if(n.matches(t,"tui.select.down"))this.selected=(this.selected+1)%r;else return;this.requestRender()}}}});function pKe(e,t){return e===null||e.includes(t)}function gul(e,t){if(e===null)return[t];let n=e.indexOf(t);return n>=0?[...e.slice(0,n),...e.slice(n+1)]:[...e,t]}function sBi(e,t,n){if(e===null)return null;let r=n??t,i=[...e];for(let s of r)i.includes(s)||i.push(s);return i.length===t.length?null:i}function oBi(e,t,n){if(e===null)return n?t.filter(i=>!n.includes(i)):[];let r=new Set(n??e);return e.filter(i=>!r.has(i))}function bul(e,t,n,r){let i=e??[...t],s=i.indexOf(n);if(s<0)return i;let o=s+r;if(o<0||o>=i.length)return i;let a=[...i];return[a[s],a[o]]=[a[o],a[s]],a}function yul(e,t){if(e===null)return t;let n=new Set(e);return[...e,...t.filter(r=>!n.has(r))]}var VSe,cnn=C(()=>{"use strict";tn();nf();yi();du();Qg();VSe=class extends Vt{get focused(){return this._focused}set focused(t){this._focused=t,this.searchInput.focused=t}constructor(t,n){super(),this.modelsById=new Map,this.allIds=[],this.enabledIds=null,this.filteredItems=[],this.selectedIndex=0,this._focused=!1,this.maxVisible=15,this.isDirty=!1,this.callbacks=n;for(let r of t.allModels){let i=`${r.provider}/${r.id}`;this.modelsById.set(i,r),this.allIds.push(i)}this.enabledIds=t.hasEnabledModelsFilter?[...t.enabledModelIds]:null,this.filteredItems=this.buildItems(),this.addChild(new rr),this.addChild(new st(1)),this.addChild(new In(()=>me.fg("accent",me.bold("Model Configuration")),0,0)),this.addChild(new In(()=>me.fg("muted","Session-only. Ctrl+S to save to settings."),0,0)),this.addChild(new st(1)),this.searchInput=new hi,this.addChild(this.searchInput),this.addChild(new st(1)),this.listContainer=new Vt,this.addChild(this.listContainer),this.addChild(new st(1)),this.footerText=new In(()=>this.getFooterText(),0,0),this.addChild(this.footerText),this.addChild(new rr),this.updateList()}buildItems(){let t=[];for(let n of yul(this.enabledIds,this.allIds)){let r=this.modelsById.get(n);r&&t.push({fullId:n,model:r,enabled:pKe(this.enabledIds,n)})}return t}getFooterText(){let t=this.enabledIds?.length??this.allIds.length,i=["Enter toggle","^A all","^X clear","^P provider","Alt+\u2191\u2193 reorder","^S save",this.enabledIds===null?"all enabled":`${t}/${this.allIds.length} enabled`];return this.isDirty?me.fg("dim",` ${i.join(" \xB7 ")} `)+me.fg("warning","(unsaved)"):me.fg("dim",` ${i.join(" \xB7 ")}`)}refresh(){let t=this.searchInput.getValue(),n=this.buildItems();this.filteredItems=t?uc(n,t,r=>HB(r.model)):n,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredItems.length-1)),this.updateList(),this.footerText.setText(()=>this.getFooterText())}updateList(){if(this.listContainer.clear(),this.filteredItems.length===0){this.listContainer.addChild(new In(()=>me.fg("muted"," No matching models"),0,0));return}let t=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),n=Math.min(t+this.maxVisible,this.filteredItems.length),r=this.enabledIds===null;for(let i=t;i<n;i++){let s=this.filteredItems[i];s&&this.listContainer.addChild(new In(()=>{let o=i===this.selectedIndex,a=o?me.fg("accent","\u2192 "):" ",l=o?me.fg("accent",s.model.name||s.model.id):s.model.name||s.model.id,u=me.fg("muted",` [${s.model.provider}]`),c;return r?c="":s.enabled?c=me.fg("success"," \u2713"):c=me.fg("dim"," \u2717"),`${a}${l}${u}${c}`},0,0))}if((t>0||n<this.filteredItems.length)&&this.listContainer.addChild(new In(()=>me.fg("muted",` (${this.selectedIndex+1}/${this.filteredItems.length})`),0,0)),this.filteredItems.length>0){let i=this.filteredItems[this.selectedIndex];this.listContainer.addChild(new st(1)),this.listContainer.addChild(new In(()=>me.fg("muted",` Model Name: ${i.model.name}`),0,0))}}handleInput(t){let n=Hn();if(n.matches(t,"tui.select.up")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.updateList();return}if(n.matches(t,"tui.select.down")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.updateList();return}if(Nt(t,Wl.alt("up"))||Nt(t,Wl.alt("down"))){let r=this.filteredItems[this.selectedIndex];if(r&&pKe(this.enabledIds,r.fullId)){let i=Nt(t,Wl.alt("up"))?-1:1,s=this.enabledIds??this.allIds,a=s.indexOf(r.fullId)+i;a>=0&&a<s.length&&(this.enabledIds=bul(this.enabledIds,this.allIds,r.fullId,i),this.isDirty=!0,this.selectedIndex+=i,this.refresh())}return}if(Nt(t,Wl.enter)){let r=this.filteredItems[this.selectedIndex];if(r){let i=this.enabledIds===null;this.enabledIds=gul(this.enabledIds,r.fullId),this.isDirty=!0,i&&this.callbacks.onClearAll(),this.callbacks.onModelToggle(r.fullId,pKe(this.enabledIds,r.fullId)),this.refresh()}return}if(Nt(t,Wl.ctrl("a"))){let r=this.searchInput.getValue()?this.filteredItems.map(i=>i.fullId):void 0;this.enabledIds=sBi(this.enabledIds,this.allIds,r),this.isDirty=!0,this.callbacks.onEnableAll(r??this.allIds),this.refresh();return}if(Nt(t,Wl.ctrl("x"))){let r=this.searchInput.getValue()?this.filteredItems.map(i=>i.fullId):void 0;this.enabledIds=oBi(this.enabledIds,this.allIds,r),this.isDirty=!0,this.callbacks.onClearAll(),this.refresh();return}if(Nt(t,Wl.ctrl("p"))){let r=this.filteredItems[this.selectedIndex];if(r){let i=r.model.provider,s=this.allIds.filter(a=>this.modelsById.get(a)?.provider===i),o=s.every(a=>pKe(this.enabledIds,a));this.enabledIds=o?oBi(this.enabledIds,this.allIds,s):sBi(this.enabledIds,this.allIds,s),this.isDirty=!0,this.callbacks.onToggleProvider(i,s,!o),this.refresh()}return}if(Nt(t,Wl.ctrl("s"))){this.callbacks.onPersist(this.enabledIds??[...this.allIds]),this.isDirty=!1,this.footerText.setText(()=>this.getFooterText());return}if(Nt(t,Wl.ctrl("c"))){this.searchInput.getValue()?(this.searchInput.setValue(""),this.refresh()):this.callbacks.onCancel();return}if(Nt(t,Wl.escape)){this.callbacks.onCancel();return}this.searchInput.handleInput(t),this.refresh()}getSearchInput(){return this.searchInput}}});function Eul(e){return e===void 0?"Automatic":e?"Always on":"Always off"}var Aul,unn,JQ,dnn=C(()=>{"use strict";tn();yi();du();Qg();Aul={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},unn=class extends Vt{constructor(t,n,r,i,s,o,a){super(),this.addChild(new In(()=>me.bold(me.fg("accent",t)),0,0)),n&&(this.addChild(new st(1)),this.addChild(new In(()=>me.fg("muted",n),0,0))),this.addChild(new st(1)),this.selectList=new Rc(r,Math.min(r.length,10),MA(),Aul);let l=r.findIndex(u=>u.value===i);l!==-1&&this.selectList.setSelectedIndex(l),this.selectList.onSelect=u=>{s(u.value)},this.selectList.onCancel=o,a&&(this.selectList.onSelectionChange=u=>{a(u.value)}),this.addChild(this.selectList),this.addChild(new st(1)),this.addChild(new In(()=>me.fg("dim"," Enter to select \xB7 Esc to go back"),0,0))}handleInput(t){this.selectList.handleInput(t)}};JQ=class extends Vt{constructor(t,n){super();let r=Rl().images,i=[{id:"autocompact",label:"Auto-compact",description:"Automatically compact context when it gets too large",currentValue:t.autoCompact?"true":"false",values:["true","false"]},{id:"steering-mode",label:"Steering mode",description:"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:t.steeringMode,values:["one-at-a-time","all"]},{id:"follow-up-mode",label:"Follow-up mode",description:"Alt+Enter queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:t.followUpMode,values:["one-at-a-time","all"]},{id:"transport",label:"Transport",description:"Preferred transport for providers that support multiple transports",currentValue:t.transport,values:["sse","websocket","auto"]},{id:"hide-thinking",label:"Hide thinking",description:"Hide thinking blocks in assistant responses",currentValue:t.hideThinkingBlock?"true":"false",values:["true","false"]},{id:"collapse-changelog",label:"Collapse changelog",description:"Show condensed changelog after updates",currentValue:t.collapseChangelog?"true":"false",values:["true","false"]},{id:"quiet-startup",label:"Quiet startup",description:"Disable verbose printing at startup",currentValue:t.quietStartup?"true":"false",values:["true","false"]},{id:"double-escape-action",label:"Double-escape action",description:"Action when pressing Escape twice with empty editor",currentValue:t.doubleEscapeAction,values:["tree","fork","none"]},{id:"tree-filter-mode",label:"Tree filter mode",description:"Default filter when opening /tree",currentValue:t.treeFilterMode,values:["default","no-tools","user-only","labeled-only","all"]},{id:"theme",label:"Theme",description:"Color theme for the interface",currentValue:t.currentTheme,submenu:(m,f)=>new unn("Theme","Select color theme",t.availableThemes.map(h=>({value:h,label:h})),m,h=>{n.onThemeChange(h),f(h)},()=>{n.onThemePreview?.(m),f()},h=>{n.onThemePreview?.(h)})}];r&&i.splice(1,0,{id:"show-images",label:"Show images",description:"Render images inline in terminal",currentValue:t.showImages?"true":"false",values:["true","false"]}),i.splice(r?2:1,0,{id:"auto-resize-images",label:"Auto-resize images",description:"Resize large images to 2000x2000 max for better model compatibility",currentValue:t.autoResizeImages?"true":"false",values:["true","false"]});let s=i.findIndex(m=>m.id==="auto-resize-images");i.splice(s+1,0,{id:"block-images",label:"Block images",description:"Prevent images from being sent to LLM providers",currentValue:t.blockImages?"true":"false",values:["true","false"]});let o=i.findIndex(m=>m.id==="block-images");i.splice(o+1,0,{id:"skill-commands",label:"Skill commands",description:"Register skills as /skill:name commands",currentValue:t.enableSkillCommands?"true":"false",values:["true","false"]});let a=i.findIndex(m=>m.id==="skill-commands");i.splice(a+1,0,{id:"enable-hashline",label:"Enable hashline",description:"Use the hashline read/edit tools (overrides the built-ins). Takes effect on next launch.",currentValue:t.enableHashline?"true":"false",values:["true","false"]}),t.toolSearchAutoEnable&&i.push({id:"automatic-tool-search",label:"MCP tool discovery",description:"Find MCP tools on demand when their definitions take up too much context. Changes apply after restarting the CLI.",currentValue:Eul(t.toolSearchEnabled),values:["Automatic","Always on","Always off"]});let l=i.findIndex(m=>m.id==="enable-hashline");i.splice(l+1,0,{id:"collapse-prompt-commands",label:"Collapse prompt commands",description:"Render /command invocations as a single line (Ctrl+O to expand)",currentValue:t.collapsePromptCommands?"true":"false",values:["true","false"]});let u=i.findIndex(m=>m.id==="collapse-prompt-commands");i.splice(u+1,0,{id:"show-hardware-cursor",label:"Show hardware cursor",description:"Show the terminal cursor while still positioning it for IME support",currentValue:t.showHardwareCursor?"true":"false",values:["true","false"]});let c=i.findIndex(m=>m.id==="show-hardware-cursor");i.splice(c+1,0,{id:"editor-padding",label:"Editor padding",description:"Horizontal padding for input editor (0-3)",currentValue:String(t.editorPaddingX),values:["0","1","2","3"]});let d=i.findIndex(m=>m.id==="editor-padding");i.splice(d+1,0,{id:"autocomplete-max-visible",label:"Autocomplete max items",description:"Max visible items in autocomplete dropdown (3-20)",currentValue:String(t.autocompleteMaxVisible),values:["3","5","7","10","15","20"]});let p=i.findIndex(m=>m.id==="autocomplete-max-visible");i.splice(p+1,0,{id:"clear-on-shrink",label:"Clear on shrink",description:"Clear empty rows when content shrinks (may cause flicker)",currentValue:t.clearOnShrink?"true":"false",values:["true","false"]}),this.addChild(new rr),this.settingsList=new YM(i,10,mke(),(m,f)=>{switch(m){case"autocompact":n.onAutoCompactChange(f==="true");break;case"show-images":n.onShowImagesChange(f==="true");break;case"auto-resize-images":n.onAutoResizeImagesChange(f==="true");break;case"block-images":n.onBlockImagesChange(f==="true");break;case"skill-commands":n.onEnableSkillCommandsChange(f==="true");break;case"automatic-tool-search":n.onToolSearchEnabledChange?.(f==="Automatic"?void 0:f==="Always on");break;case"enable-hashline":n.onEnableHashlineChange(f==="true");break;case"steering-mode":n.onSteeringModeChange(f);break;case"follow-up-mode":n.onFollowUpModeChange(f);break;case"transport":n.onTransportChange(f);break;case"hide-thinking":n.onHideThinkingBlockChange(f==="true");break;case"collapse-changelog":n.onCollapseChangelogChange(f==="true");break;case"quiet-startup":n.onQuietStartupChange(f==="true");break;case"double-escape-action":n.onDoubleEscapeActionChange(f);break;case"tree-filter-mode":n.onTreeFilterModeChange(f);break;case"show-hardware-cursor":n.onShowHardwareCursorChange(f==="true");break;case"editor-padding":n.onEditorPaddingXChange(Number.parseInt(f,10));break;case"autocomplete-max-visible":n.onAutocompleteMaxVisibleChange(Number.parseInt(f,10));break;case"clear-on-shrink":n.onClearOnShrinkChange(f==="true");break;case"collapse-prompt-commands":n.onCollapsePromptCommandsChange(f==="true");break}},n.onCancel,{enableSearch:!0}),this.addChild(this.settingsList),this.addChild(new rr)}getSettingsList(){return this.settingsList}}});var e7,pnn=C(()=>{"use strict";yi();ann();e7=class extends Dre{constructor(t,n=Dp()){super(n),this.skillBlock=t,this.updateDisplay()}getLabel(){return"[skill]"}getTitle(){return this.skillBlock.name}getBody(){return this.skillBlock.content}}});import{stripVTControlCharacters as aBi}from"node:util";function Cul(e){if(xul.test(e))return!1;try{let t=new URL(e);return(t.protocol==="http:"||t.protocol==="https:")&&!t.username&&!t.password}catch{return!1}}function mnn(e){return e.split(_ul).map((t,n)=>t?me.fg(n%2===0?"muted":"accent",t):"").join("")}function lBi(e,t,n,r){let i=1,s=!1;for(let o=t+1;o<e.length;o++){if(e[o]==="`"){let a=e.indexOf("`",o+1);if(a!==-1){o=a;continue}}if(e[o]===n)i++,s=!0;else if(e[o]===r&&--i===0)return{end:o,nested:s}}}function Tul(e,t){return Rl().hyperlinks?GM(me.underline(e),t):e===t?e:`${e} (${t})`}function Iul(e){let t="",n=0;for(let r=0;r<e.length;r++){if(e[r]==="`"){let u=e.indexOf("`",r+1);u!==-1&&(r=u);continue}if(e[r]!=="[")continue;let i=lBi(e,r,"[","]");if(!i)break;if(e[i.end+1]!=="("){r=i.end;continue}let s=lBi(e,i.end+1,"(",")");if(!s)break;let o=e.slice(r+1,i.end),a=e.slice(i.end+2,s.end);o&&!i.nested&&!o.includes(`
13570
+ `;this.addChild(new Os(r+this.getBody(),0,0,this.markdownTheme,{color:i=>me.fg("customMessageText",i)}))}renderCollapsed(){let t=this.getCollapsedHintPrefix(),n=t?[t]:[];n.push(`${Oa("app.tools.expand")} to expand`);let r=me.fg("customMessageLabel",`\x1B[1m${this.getLabel()}\x1B[22m `)+me.fg("customMessageText",this.getTitle())+me.fg("dim",` (${n.join(", ")})`);this.addChild(new Ot(r,0,0))}}});import{homedir as uul}from"node:os";var USe,lnn=C(()=>{"use strict";MS();yi();ann();USe=class extends Dre{constructor(t,n,r,i=Dp(),s){super(i),this.command=t,this.args=n,this.expandedBody=r,this.source=s,this.updateDisplay()}getLabel(){return"[prompt]"}getTitle(){return hh({command:this.command,args:this.args})}getBody(){return this.expandedBody.trim()?this.expandedBody:"_(empty prompt body)_"}getExpandedHeaderSuffix(){let t=this.formatSourcePath();return t?`_(from ${t})_`:""}getCollapsedHintPrefix(){let t=this.formatSourcePath();return t?`from ${t}`:""}formatSourcePath(){let t=this.source?.path;if(!t)return;let n=uul();return n&&t.startsWith(`${n}/`)?`~${t.slice(n.length)}`:t}}});function mul(e){return{name:dKe(e.name),type:dul[e.type]}}function ful(e,t){let n=Math.min(15,Math.max(4,e-8)),r=t.reduce((i,s)=>Math.max(i,Wt(dKe(s.name))),20);return{nameWidth:Math.max(1,Math.min(r,e-4-n)),typeWidth:n}}function rBi(e,t){let n=At(e,t,"\u2026");return n+" ".repeat(Math.max(0,t-Wt(n))+2)}function hul(e,t){return fr(dKe(e),Math.max(1,t-2)).map(n=>` ${me.fg("muted",n)}`)}var cKe,dul,pul,dKe,uKe,iBi=C(()=>{"use strict";tn();Zy();yi();du();Sc();cKe=8,dul={always:"always_apply","agent-requested":"agent_requested",manual:"manual"},pul={always:"success","agent-requested":"accent",manual:"warning"},dKe=e=>Array.from(Eu(e),t=>{let n=t.charCodeAt(0);return n<32||n>=127&&n<=159?" ":t}).join("").trim();uKe=class{constructor(t,n,r){this.focused=!1,this.selected=0,this.showingDiagnostics=!1,this.snapshot=t,this.onClose=n,this.requestRender=r}invalidate(){}render(t){let n=m=>At(m,Math.max(0,t),"\u2026"),{rules:r,diagnostics:i}=this.snapshot,s=new rr(m=>me.fg("border",m)),o=["",...s.render(t),"",n(me.fg("accent",me.bold(" Rules"))),""];i.length>0&&o.push(n(me.fg("warning",` ${i.length} rule warning(s)`)),"");let a=ful(t,r),{nameWidth:l,typeWidth:u}=a;o.push(n(me.fg("muted",this.showingDiagnostics?" Warnings":` ${rBi("Name",l)}${At("Type",u,"\u2026")}`))),this.showingDiagnostics||o.push("");let c=this.showingDiagnostics?i:r;if(c.length===0)o.push(n(me.fg("muted",this.showingDiagnostics?" No warnings":" No rules loaded")));else{let m=Math.max(0,Math.min(this.selected-Math.floor(cKe/2),c.length-cKe));for(let f=m;f<Math.min(m+cKe,c.length);f++)o.push(...this.renderEntry(f,t,a));c.length>cKe&&o.push(n(me.fg("dim",` ${this.selected+1}/${c.length}`)))}let d=me.fg("muted"," \xB7 "),p=[zs(`${Oa("tui.select.up")}/${Oa("tui.select.down")}`,"navigate"),Gr("tui.select.cancel","close")];return i.length>0&&p.push(zs("d",this.showingDiagnostics?"rules":"inspect")),o.push("",...fr(p.join(d),Math.max(1,t-2)).map(m=>n(` ${m}`)),"",...s.render(t)),o.map(n)}renderEntry(t,n,r){let i=f=>At(f,n,"\u2026"),s=t===this.selected,o=s?me.fg("accent","\u2192 "):" ";if(this.showingDiagnostics){let f=this.snapshot.diagnostics[t],h=dKe(f.message);if(s){let g=fr(h,Math.max(1,n-2)).map((b,A)=>i(`${A===0?o:" "}${me.fg("warning",b)}`));return f.path&&g.push(...hul(`Path: ${f.path}`,n)),g}return[i(`${o}${me.fg("warning",h)}`)]}let{name:a,type:l}=mul(this.snapshot.rules[t]),{nameWidth:u,typeWidth:c}=r,d=rBi(a,u),p=s?me.fg("accent",me.bold(d)):d,m=me.fg(pul[this.snapshot.rules[t].type],At(l,c,"\u2026"));return[i(o+p+m)]}handleInput(t){let n=Hn();if(n.matches(t,"tui.select.cancel")){this.onClose();return}if(Nt(t,"d")&&this.snapshot.diagnostics.length>0){this.showingDiagnostics=!this.showingDiagnostics,this.selected=0,this.requestRender();return}let r=this.showingDiagnostics?this.snapshot.diagnostics.length:this.snapshot.rules.length;if(r!==0){if(n.matches(t,"tui.select.up"))this.selected=(this.selected-1+r)%r;else if(n.matches(t,"tui.select.down"))this.selected=(this.selected+1)%r;else return;this.requestRender()}}}});function pKe(e,t){return e===null||e.includes(t)}function gul(e,t){if(e===null)return[t];let n=e.indexOf(t);return n>=0?[...e.slice(0,n),...e.slice(n+1)]:[...e,t]}function sBi(e,t,n){if(e===null)return null;let r=n??t,i=[...e];for(let s of r)i.includes(s)||i.push(s);return i.length===t.length?null:i}function oBi(e,t,n){if(e===null)return n?t.filter(i=>!n.includes(i)):[];let r=new Set(n??e);return e.filter(i=>!r.has(i))}function bul(e,t,n,r){let i=e??[...t],s=i.indexOf(n);if(s<0)return i;let o=s+r;if(o<0||o>=i.length)return i;let a=[...i];return[a[s],a[o]]=[a[o],a[s]],a}function yul(e,t){if(e===null)return t;let n=new Set(e);return[...e,...t.filter(r=>!n.has(r))]}var VSe,cnn=C(()=>{"use strict";tn();nf();yi();du();Qg();VSe=class extends Vt{get focused(){return this._focused}set focused(t){this._focused=t,this.searchInput.focused=t}constructor(t,n){super(),this.modelsById=new Map,this.allIds=[],this.enabledIds=null,this.filteredItems=[],this.selectedIndex=0,this._focused=!1,this.maxVisible=15,this.isDirty=!1,this.callbacks=n;for(let r of t.allModels){let i=`${r.provider}/${r.id}`;this.modelsById.set(i,r),this.allIds.push(i)}this.enabledIds=t.hasEnabledModelsFilter?[...t.enabledModelIds]:null,this.filteredItems=this.buildItems(),this.addChild(new rr),this.addChild(new st(1)),this.addChild(new In(()=>me.fg("accent",me.bold("Model Configuration")),0,0)),this.addChild(new In(()=>me.fg("muted","Session-only. Ctrl+S to save to settings."),0,0)),this.addChild(new st(1)),this.searchInput=new hi,this.addChild(this.searchInput),this.addChild(new st(1)),this.listContainer=new Vt,this.addChild(this.listContainer),this.addChild(new st(1)),this.footerText=new In(()=>this.getFooterText(),0,0),this.addChild(this.footerText),this.addChild(new rr),this.updateList()}buildItems(){let t=[];for(let n of yul(this.enabledIds,this.allIds)){let r=this.modelsById.get(n);r&&t.push({fullId:n,model:r,enabled:pKe(this.enabledIds,n)})}return t}getFooterText(){let t=this.enabledIds?.length??this.allIds.length,i=["Enter toggle","^A all","^X clear","^P provider","Alt+\u2191\u2193 reorder","^S save",this.enabledIds===null?"all enabled":`${t}/${this.allIds.length} enabled`];return this.isDirty?me.fg("dim",` ${i.join(" \xB7 ")} `)+me.fg("warning","(unsaved)"):me.fg("dim",` ${i.join(" \xB7 ")}`)}refresh(){let t=this.searchInput.getValue(),n=this.buildItems();this.filteredItems=t?uc(n,t,r=>HB(r.model)):n,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.filteredItems.length-1)),this.updateList(),this.footerText.setText(()=>this.getFooterText())}updateList(){if(this.listContainer.clear(),this.filteredItems.length===0){this.listContainer.addChild(new In(()=>me.fg("muted"," No matching models"),0,0));return}let t=Math.max(0,Math.min(this.selectedIndex-Math.floor(this.maxVisible/2),this.filteredItems.length-this.maxVisible)),n=Math.min(t+this.maxVisible,this.filteredItems.length),r=this.enabledIds===null;for(let i=t;i<n;i++){let s=this.filteredItems[i];s&&this.listContainer.addChild(new In(()=>{let o=i===this.selectedIndex,a=o?me.fg("accent","\u2192 "):" ",l=o?me.fg("accent",s.model.name||s.model.id):s.model.name||s.model.id,u=me.fg("muted",` [${s.model.provider}]`),c;return r?c="":s.enabled?c=me.fg("success"," \u2713"):c=me.fg("dim"," \u2717"),`${a}${l}${u}${c}`},0,0))}if((t>0||n<this.filteredItems.length)&&this.listContainer.addChild(new In(()=>me.fg("muted",` (${this.selectedIndex+1}/${this.filteredItems.length})`),0,0)),this.filteredItems.length>0){let i=this.filteredItems[this.selectedIndex];this.listContainer.addChild(new st(1)),this.listContainer.addChild(new In(()=>me.fg("muted",` Model Name: ${i.model.name}`),0,0))}}handleInput(t){let n=Hn();if(n.matches(t,"tui.select.up")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===0?this.filteredItems.length-1:this.selectedIndex-1,this.updateList();return}if(n.matches(t,"tui.select.down")){if(this.filteredItems.length===0)return;this.selectedIndex=this.selectedIndex===this.filteredItems.length-1?0:this.selectedIndex+1,this.updateList();return}if(Nt(t,Wl.alt("up"))||Nt(t,Wl.alt("down"))){let r=this.filteredItems[this.selectedIndex];if(r&&pKe(this.enabledIds,r.fullId)){let i=Nt(t,Wl.alt("up"))?-1:1,s=this.enabledIds??this.allIds,a=s.indexOf(r.fullId)+i;a>=0&&a<s.length&&(this.enabledIds=bul(this.enabledIds,this.allIds,r.fullId,i),this.isDirty=!0,this.selectedIndex+=i,this.refresh())}return}if(Nt(t,Wl.enter)){let r=this.filteredItems[this.selectedIndex];if(r){let i=this.enabledIds===null;this.enabledIds=gul(this.enabledIds,r.fullId),this.isDirty=!0,i&&this.callbacks.onClearAll(),this.callbacks.onModelToggle(r.fullId,pKe(this.enabledIds,r.fullId)),this.refresh()}return}if(Nt(t,Wl.ctrl("a"))){let r=this.searchInput.getValue()?this.filteredItems.map(i=>i.fullId):void 0;this.enabledIds=sBi(this.enabledIds,this.allIds,r),this.isDirty=!0,this.callbacks.onEnableAll(r??this.allIds),this.refresh();return}if(Nt(t,Wl.ctrl("x"))){let r=this.searchInput.getValue()?this.filteredItems.map(i=>i.fullId):void 0;this.enabledIds=oBi(this.enabledIds,this.allIds,r),this.isDirty=!0,this.callbacks.onClearAll(),this.refresh();return}if(Nt(t,Wl.ctrl("p"))){let r=this.filteredItems[this.selectedIndex];if(r){let i=r.model.provider,s=this.allIds.filter(a=>this.modelsById.get(a)?.provider===i),o=s.every(a=>pKe(this.enabledIds,a));this.enabledIds=o?oBi(this.enabledIds,this.allIds,s):sBi(this.enabledIds,this.allIds,s),this.isDirty=!0,this.callbacks.onToggleProvider(i,s,!o),this.refresh()}return}if(Nt(t,Wl.ctrl("s"))){this.callbacks.onPersist(this.enabledIds??[...this.allIds]),this.isDirty=!1,this.footerText.setText(()=>this.getFooterText());return}if(Nt(t,Wl.ctrl("c"))){this.searchInput.getValue()?(this.searchInput.setValue(""),this.refresh()):this.callbacks.onCancel();return}if(Nt(t,Wl.escape)){this.callbacks.onCancel();return}this.searchInput.handleInput(t),this.refresh()}getSearchInput(){return this.searchInput}}});function Eul(e){return e===void 0?"Automatic":e?"Always on":"Always off"}var Aul,unn,JQ,dnn=C(()=>{"use strict";tn();yi();du();Qg();Aul={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},unn=class extends Vt{constructor(t,n,r,i,s,o,a){super(),this.addChild(new In(()=>me.bold(me.fg("accent",t)),0,0)),n&&(this.addChild(new st(1)),this.addChild(new In(()=>me.fg("muted",n),0,0))),this.addChild(new st(1)),this.selectList=new Rc(r,Math.min(r.length,10),MA(),Aul);let l=r.findIndex(u=>u.value===i);l!==-1&&this.selectList.setSelectedIndex(l),this.selectList.onSelect=u=>{s(u.value)},this.selectList.onCancel=o,a&&(this.selectList.onSelectionChange=u=>{a(u.value)}),this.addChild(this.selectList),this.addChild(new st(1)),this.addChild(new In(()=>me.fg("dim"," Enter to select \xB7 Esc to go back"),0,0))}handleInput(t){this.selectList.handleInput(t)}};JQ=class extends Vt{constructor(t,n){super();let r=Rl().images,i=[{id:"autocompact",label:"Auto-compact",description:"Automatically compact context when it gets too large",currentValue:t.autoCompact?"true":"false",values:["true","false"]},{id:"steering-mode",label:"Steering mode",description:"Enter while streaming queues steering messages. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:t.steeringMode,values:["one-at-a-time","all"]},{id:"follow-up-mode",label:"Follow-up mode",description:"Alt+Enter queues follow-up messages until agent stops. 'one-at-a-time': deliver one, wait for response. 'all': deliver all at once.",currentValue:t.followUpMode,values:["one-at-a-time","all"]},{id:"hide-thinking",label:"Hide thinking",description:"Hide thinking blocks in assistant responses",currentValue:t.hideThinkingBlock?"true":"false",values:["true","false"]},{id:"collapse-changelog",label:"Collapse changelog",description:"Show condensed changelog after updates",currentValue:t.collapseChangelog?"true":"false",values:["true","false"]},{id:"quiet-startup",label:"Quiet startup",description:"Disable verbose printing at startup",currentValue:t.quietStartup?"true":"false",values:["true","false"]},{id:"double-escape-action",label:"Double-escape action",description:"Action when pressing Escape twice with empty editor",currentValue:t.doubleEscapeAction,values:["tree","fork","none"]},{id:"tree-filter-mode",label:"Tree filter mode",description:"Default filter when opening /tree",currentValue:t.treeFilterMode,values:["default","no-tools","user-only","labeled-only","all"]},{id:"theme",label:"Theme",description:"Color theme for the interface",currentValue:t.currentTheme,submenu:(m,f)=>new unn("Theme","Select color theme",t.availableThemes.map(h=>({value:h,label:h})),m,h=>{n.onThemeChange(h),f(h)},()=>{n.onThemePreview?.(m),f()},h=>{n.onThemePreview?.(h)})}];r&&i.splice(1,0,{id:"show-images",label:"Show images",description:"Render images inline in terminal",currentValue:t.showImages?"true":"false",values:["true","false"]}),i.splice(r?2:1,0,{id:"auto-resize-images",label:"Auto-resize images",description:"Resize large images to 2000x2000 max for better model compatibility",currentValue:t.autoResizeImages?"true":"false",values:["true","false"]});let s=i.findIndex(m=>m.id==="auto-resize-images");i.splice(s+1,0,{id:"block-images",label:"Block images",description:"Prevent images from being sent to LLM providers",currentValue:t.blockImages?"true":"false",values:["true","false"]});let o=i.findIndex(m=>m.id==="block-images");i.splice(o+1,0,{id:"skill-commands",label:"Skill commands",description:"Register skills as /skill:name commands",currentValue:t.enableSkillCommands?"true":"false",values:["true","false"]});let a=i.findIndex(m=>m.id==="skill-commands");i.splice(a+1,0,{id:"enable-hashline",label:"Enable hashline",description:"Use the hashline read/edit tools (overrides the built-ins). Takes effect on next launch.",currentValue:t.enableHashline?"true":"false",values:["true","false"]}),t.toolSearchAutoEnable&&i.push({id:"automatic-tool-search",label:"MCP tool discovery",description:"Find MCP tools on demand when their definitions take up too much context. Changes apply after restarting the CLI.",currentValue:Eul(t.toolSearchEnabled),values:["Automatic","Always on","Always off"]});let l=i.findIndex(m=>m.id==="enable-hashline");i.splice(l+1,0,{id:"collapse-prompt-commands",label:"Collapse prompt commands",description:"Render /command invocations as a single line (Ctrl+O to expand)",currentValue:t.collapsePromptCommands?"true":"false",values:["true","false"]});let u=i.findIndex(m=>m.id==="collapse-prompt-commands");i.splice(u+1,0,{id:"show-hardware-cursor",label:"Show hardware cursor",description:"Show the terminal cursor while still positioning it for IME support",currentValue:t.showHardwareCursor?"true":"false",values:["true","false"]});let c=i.findIndex(m=>m.id==="show-hardware-cursor");i.splice(c+1,0,{id:"editor-padding",label:"Editor padding",description:"Horizontal padding for input editor (0-3)",currentValue:String(t.editorPaddingX),values:["0","1","2","3"]});let d=i.findIndex(m=>m.id==="editor-padding");i.splice(d+1,0,{id:"autocomplete-max-visible",label:"Autocomplete max items",description:"Max visible items in autocomplete dropdown (3-20)",currentValue:String(t.autocompleteMaxVisible),values:["3","5","7","10","15","20"]});let p=i.findIndex(m=>m.id==="autocomplete-max-visible");i.splice(p+1,0,{id:"clear-on-shrink",label:"Clear on shrink",description:"Clear empty rows when content shrinks (may cause flicker)",currentValue:t.clearOnShrink?"true":"false",values:["true","false"]}),this.addChild(new rr),this.settingsList=new YM(i,10,mke(),(m,f)=>{switch(m){case"autocompact":n.onAutoCompactChange(f==="true");break;case"show-images":n.onShowImagesChange(f==="true");break;case"auto-resize-images":n.onAutoResizeImagesChange(f==="true");break;case"block-images":n.onBlockImagesChange(f==="true");break;case"skill-commands":n.onEnableSkillCommandsChange(f==="true");break;case"automatic-tool-search":n.onToolSearchEnabledChange?.(f==="Automatic"?void 0:f==="Always on");break;case"enable-hashline":n.onEnableHashlineChange(f==="true");break;case"steering-mode":n.onSteeringModeChange(f);break;case"follow-up-mode":n.onFollowUpModeChange(f);break;case"hide-thinking":n.onHideThinkingBlockChange(f==="true");break;case"collapse-changelog":n.onCollapseChangelogChange(f==="true");break;case"quiet-startup":n.onQuietStartupChange(f==="true");break;case"double-escape-action":n.onDoubleEscapeActionChange(f);break;case"tree-filter-mode":n.onTreeFilterModeChange(f);break;case"show-hardware-cursor":n.onShowHardwareCursorChange(f==="true");break;case"editor-padding":n.onEditorPaddingXChange(Number.parseInt(f,10));break;case"autocomplete-max-visible":n.onAutocompleteMaxVisibleChange(Number.parseInt(f,10));break;case"clear-on-shrink":n.onClearOnShrinkChange(f==="true");break;case"collapse-prompt-commands":n.onCollapsePromptCommandsChange(f==="true");break}},n.onCancel,{enableSearch:!0}),this.addChild(this.settingsList),this.addChild(new rr)}getSettingsList(){return this.settingsList}}});var e7,pnn=C(()=>{"use strict";yi();ann();e7=class extends Dre{constructor(t,n=Dp()){super(n),this.skillBlock=t,this.updateDisplay()}getLabel(){return"[skill]"}getTitle(){return this.skillBlock.name}getBody(){return this.skillBlock.content}}});import{stripVTControlCharacters as aBi}from"node:util";function Cul(e){if(xul.test(e))return!1;try{let t=new URL(e);return(t.protocol==="http:"||t.protocol==="https:")&&!t.username&&!t.password}catch{return!1}}function mnn(e){return e.split(_ul).map((t,n)=>t?me.fg(n%2===0?"muted":"accent",t):"").join("")}function lBi(e,t,n,r){let i=1,s=!1;for(let o=t+1;o<e.length;o++){if(e[o]==="`"){let a=e.indexOf("`",o+1);if(a!==-1){o=a;continue}}if(e[o]===n)i++,s=!0;else if(e[o]===r&&--i===0)return{end:o,nested:s}}}function Tul(e,t){return Rl().hyperlinks?GM(me.underline(e),t):e===t?e:`${e} (${t})`}function Iul(e){let t="",n=0;for(let r=0;r<e.length;r++){if(e[r]==="`"){let u=e.indexOf("`",r+1);u!==-1&&(r=u);continue}if(e[r]!=="[")continue;let i=lBi(e,r,"[","]");if(!i)break;if(e[i.end+1]!=="("){r=i.end;continue}let s=lBi(e,i.end+1,"(",")");if(!s)break;let o=e.slice(r+1,i.end),a=e.slice(i.end+2,s.end);o&&!i.nested&&!o.includes(`
13571
13571
  `)&&!o.includes("`")&&!s.nested&&!a.includes("`")&&e[r-1]!=="!"&&Cul(a)&&(t+=mnn(e.slice(n,r))+me.fg("muted",Tul(o,a)),n=s.end+1),r=s.end}return t+mnn(e.slice(n))}function cBi(e){let t=e.replace(Sul,`
13572
13572
  `).replaceAll(" "," "),n=aBi(t).replace(vul,s=>s===`
13573
13573
  `?s:""),i=t===n?Iul(n):mnn(n);return aBi(i).trim()?i:""}var _ul,Sul,vul,xul,uBi=C(()=>{"use strict";tn();yi();_ul=/`([^`]*)`/g,Sul=/\r\n?|[\p{Zl}\p{Zp}]/gu,vul=/[\p{Cc}\p{Bidi_Control}]/gu,xul=/[\s\p{Cc}\p{Bidi_Control}]/u});var wul,Rul,Nul,t7,fnn=C(()=>{"use strict";tn();yi();du();wul={minPrimaryColumnWidth:12,maxPrimaryColumnWidth:32},Rul={off:"No reasoning",minimal:"Minimal reasoning",low:"Light reasoning",medium:"Moderate reasoning",high:"Deep reasoning",xhigh:"Maximum reasoning"},Nul=(e,t)=>e.kind==="explicit"?e.effort:t?`${t} (default)`:"Model default",t7=class extends Vt{constructor(t,n,r,i,s){super();let o=n.map((l,u)=>{let c=l.kind==="explicit"?l.effort:s;return{value:String(u),label:Nul(l,s),description:c?Rul[c]??"Model-defined reasoning effort":"Use the model or provider default"}});this.addChild(new rr),this.selectList=new Rc(o,o.length,MA(),wul);let a=n.findIndex(l=>l.kind===t.kind&&(l.kind==="model-default"||t.kind==="explicit"&&l.effort===t.effort));a!==-1&&this.selectList.setSelectedIndex(a),this.selectList.onSelect=l=>{let u=n[Number(l.value)];u&&r(u)},this.selectList.onCancel=()=>{i()},this.addChild(this.selectList),this.addChild(new rr)}getSelectList(){return this.selectList}}});async function dBi(e,t){if(t==="image/png")return{data:e,mimeType:t};let n=await ZX();if(!n)return null;try{let r=new Uint8Array(Buffer.from(e,"base64")),i=n.PhotonImage.new_from_byteslice(r),s=I5e(n,i,r);s!==i&&i.free();try{let o=s.get_bytes();return{data:Buffer.from(o).toString("base64"),mimeType:"image/png"}}finally{s.free()}}catch{return null}}var pBi=C(()=>{"use strict";kRt();M5e()});var oN,hnn=C(()=>{"use strict";tn();UL();Rb();pBi();yi();oN=class extends Vt{constructor(t,n,r,i,s,o,a=process.cwd()){super(),this.rendererState={},this.imageComponents=[],this.imageSpacers=[],this.expanded=!1,this.isPartial=!0,this.executionStarted=!1,this.argsComplete=!1,this.convertedImages=new Map,this.hideComponent=!1,this.toolName=t,this.toolCallId=n,this.args=r,this.toolDefinition=s,this.builtInToolDefinition=YUe[t],this.showImages=i.showImages??!0,this.ui=o,this.cwd=a,this.addChild(new st(1)),this.contentBox=new Gl(1,1,l=>me.bg("toolPendingBg",l)),this.contentText=new Ot("",1,1,l=>me.bg("toolPendingBg",l)),this.hasRendererDefinition()?this.addChild(this.contentBox):this.addChild(this.contentText),this.updateDisplay()}getCallRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderCall??this.builtInToolDefinition.renderCall:this.builtInToolDefinition.renderCall:this.toolDefinition?.renderCall}getResultRenderer(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.renderResult??this.builtInToolDefinition.renderResult:this.builtInToolDefinition.renderResult:this.toolDefinition?.renderResult}hasRendererDefinition(){return this.builtInToolDefinition!==void 0||this.toolDefinition!==void 0}getRenderContext(t){return{args:this.args,toolCallId:this.toolCallId,invalidate:()=>{this.invalidate(),this.ui.requestRender()},lastComponent:t,state:this.rendererState,cwd:this.cwd,executionStarted:this.executionStarted,argsComplete:this.argsComplete,isPartial:this.isPartial,expanded:this.expanded,showImages:this.showImages,isError:this.result?.isError??!1}}createCallFallback(){return new Ot(me.fg("toolTitle",me.bold(this.toolName)),0,0)}createResultFallback(){let t=this.getTextOutput();if(t)return new Ot(me.fg("toolOutput",t),0,0)}updateArgs(t){this.args=t,this.updateDisplay()}markExecutionStarted(){this.executionStarted=!0,this.updateDisplay(),this.ui.requestRender()}setArgsComplete(){this.argsComplete=!0,this.updateDisplay(),this.ui.requestRender()}updateResult(t,n=!1){this.result=t,this.isPartial=n,this.updateDisplay(),this.maybeConvertImagesForKitty()}maybeConvertImagesForKitty(){if(Rl().images!=="kitty"||!this.result)return;let n=this.result.content.filter(r=>r.type==="image");for(let r=0;r<n.length;r++){let i=n[r];if(!i.data||!i.mimeType||i.mimeType==="image/png"||this.convertedImages.has(r))continue;let s=r;dBi(i.data,i.mimeType).then(o=>{o&&(this.convertedImages.set(s,o),this.updateDisplay(),this.ui.requestRender())})}}setExpanded(t){this.expanded=t,this.updateDisplay()}setShowImages(t){this.showImages=t,this.updateDisplay()}invalidate(){super.invalidate(),this.updateDisplay()}render(t){return this.hideComponent?[]:super.render(t)}updateDisplay(){let t;this.toolName==="bash"||this.isPartial?t=r=>me.bg("toolPendingBg",r):this.result?.isError?t=r=>me.bg("toolErrorBg",r):t=r=>me.bg("toolSuccessBg",r);let n=!1;if(this.hideComponent=!1,this.hasRendererDefinition()){this.contentBox.setBgFn(t),this.contentBox.clear();let r=this.getCallRenderer();if(r)try{let i=r(this.args,me,this.getRenderContext(this.callRendererComponent));this.callRendererComponent=i,this.contentBox.addChild(i),n=!0}catch{this.callRendererComponent=void 0,this.contentBox.addChild(this.createCallFallback()),n=!0}else this.contentBox.addChild(this.createCallFallback()),n=!0;if(this.result&&this.shouldShowResult()){let i=this.getResultRenderer(),s=this.expanded||this.result.isError===!0;if(i)try{let o=i({content:this.result.content,details:this.result.details},{expanded:s,isPartial:this.isPartial},me,this.getRenderContext(this.resultRendererComponent));this.resultRendererComponent=o,this.contentBox.addChild(o),n=!0}catch{this.resultRendererComponent=void 0;let o=this.createResultFallback();o&&(this.contentBox.addChild(o),n=!0)}else{let o=this.createResultFallback();o&&(this.contentBox.addChild(o),n=!0)}}}else this.contentText.setCustomBgFn(t),this.contentText.setText(this.shouldShowResult()?this.formatToolExecution():me.fg("toolTitle",me.bold(this.toolName))),n=!0;for(let r of this.imageComponents)this.removeChild(r);this.imageComponents=[];for(let r of this.imageSpacers)this.removeChild(r);if(this.imageSpacers=[],this.result){let r=this.result.content.filter(s=>s.type==="image"),i=Rl();for(let s=0;s<r.length;s++){let o=r[s];if(i.images&&this.showImages&&o.data&&o.mimeType){let a=this.convertedImages.get(s),l=a?.data??o.data,u=a?.mimeType??o.mimeType;if(i.images==="kitty"&&u!=="image/png")continue;let c=new st(1);this.addChild(c),this.imageSpacers.push(c);let d=new QM(l,u,{fallbackColor:p=>me.fg("toolOutput",p)},{maxWidthCells:60});this.imageComponents.push(d),this.addChild(d)}}}this.hasRendererDefinition()&&!n&&this.imageComponents.length===0&&(this.hideComponent=!0)}getTextOutput(){return up(this.result,this.showImages)}shouldShowResult(){return this.expanded||this.result?.isError===!0||this.getDefaultExpanded()||this.toolName==="bash"&&this.args?.background===!0&&this.toolDefinition!==void 0&&this.toolDefinition.renderCall===YUe.bash.renderCall&&this.toolDefinition.renderResult===YUe.bash.renderResult}getDefaultExpanded(){return this.builtInToolDefinition?this.toolDefinition?this.toolDefinition.defaultExpanded??this.builtInToolDefinition.defaultExpanded??!1:this.builtInToolDefinition.defaultExpanded??!1:this.toolDefinition?.defaultExpanded??!1}formatToolExecution(){let t=me.fg("toolTitle",me.bold(this.toolName)),n=JSON.stringify(this.args,null,2);n&&(t+=`
@@ -13615,7 +13615,7 @@ ${n}`},1,0)),this.chatContainer.addChild(new rr(r=>me.fg("warning",r))),this.ui.
13615
13615
 
13616
13616
  `);this.rememberSessionImagePaths(s);let o=QSe(s),a=t?.currentText??this.editor.getText(),l=[o,a].filter(u=>u.trim()).join(`
13617
13617
 
13618
- `);return this.editor.setText(l),this.updatePendingMessagesDisplay(),t?.abort&&this.agent.abort(),i.length}queueCompactionMessage(t,n){this.compactionQueuedMessages.push({text:t,mode:n}),this.editor.addToHistory?.(QSe(t)),this.editor.setText(""),this.updatePendingMessagesDisplay(),this.showStatus("Queued message for after compaction")}isExtensionCommand(t){if(!t.startsWith("/"))return!1;let n=this.session.extensionRunner;if(!n)return!1;let r=t.indexOf(" "),i=r===-1?t.slice(1):t.slice(1,r);return!!n.getCommand(i)}trackSlashCommandUsage(t){if(!t.startsWith("/"))return;let n=t.indexOf(" "),r=n===-1?t.slice(1):t.slice(1,n);if(!r)return;let i;if(hL.some(o=>o.name===r)?i=r:this.isCustomSlashCommand(t,r)&&(i="custom"),!i)return;let s={commandName:i};this.session.resourceLoader.getEventBus?.().emit(Tq,s)}isCustomSlashCommand(t,n){return this.isExtensionCommand(t)||this.session.promptTemplates.some(r=>r.name===n)||this.skillCommands.has(n)}publishMessageSendError(t){let n={errorMessagePreview:t.slice(0,100),requestId:this.session.currentRequestId};this.session.resourceLoader.getEventBus?.().emit(Iq,n)}async flushCompactionQueue(t){if(this.compactionQueuedMessages.length===0)return;let n=[...this.compactionQueuedMessages];this.compactionQueuedMessages=[],this.updatePendingMessagesDisplay();let r=i=>{this.session.clearQueue(),this.compactionQueuedMessages=n,this.updatePendingMessagesDisplay(),this.showError(`Failed to send queued message${n.length>1?"s":""}: ${i instanceof Error?i.message:String(i)}`)};try{if(t?.willRetry){for(let u of n)this.isExtensionCommand(u.text)?await this.session.prompt(u.text):u.mode==="followUp"?await this.session.followUp(u.text):await this.session.steer(u.text);this.updatePendingMessagesDisplay();return}let i=n.findIndex(u=>!this.isExtensionCommand(u.text));if(i===-1){for(let u of n)await this.session.prompt(u.text);return}let s=n.slice(0,i),o=n[i],a=n.slice(i+1);for(let u of s)await this.session.prompt(u.text);let l=this.session.prompt(o.text).catch(u=>{r(u)});for(let u of a)this.isExtensionCommand(u.text)?await this.session.prompt(u.text):u.mode==="followUp"?await this.session.followUp(u.text):await this.session.steer(u.text);this.updatePendingMessagesDisplay()}catch(i){r(i)}}flushPendingBashComponents(){for(let t of this.pendingBashComponents)this.pendingMessagesContainer.removeChild(t),this.chatContainer.addChild(t);this.pendingBashComponents=[]}showSelector(t){let n=()=>{this.editorContainer.clear(),this.editorContainer.addChild(this.editor),this.ui.setFocus(this.editor)},{component:r,focus:i}=t(n);this.editorContainer.clear(),this.editorContainer.addChild(r),this.ui.setFocus(i),this.ui.requestRender()}showPluginsPage(){let t=Dr(),n=LK(t);this.showSelector(r=>{let i={getPlugins:()=>{let o=this.settingsManager.getEnabledPlugins();return $x().map(a=>({id:a.id,name:a.name,marketplace:a.marketplace,enabled:o[a.id]??a.enabled,diagnostics:a.diagnostics}))},getPluginDetails:o=>{let a=$x().find(l=>l.id===o);return a?DK(a):void 0},getMarketplaces:()=>{let o=$x();return Qhe(t).map(a=>({dir:a.dir,name:a.name,pluginCount:o.filter(l=>l.marketplace===a.name||l.marketplace===a.dir).length}))},getErrors:()=>Qx().map(o=>({message:o.message,path:o.path})),settingsManager:this.settingsManager,addMarketplace:async o=>{let a=await kK(n,o);return a.success?null:a.error??"Failed to add"},removeMarketplace:o=>{let a=OK(n,o);return a.success?null:a.error??"Failed to remove"},refresh:()=>{this.session.reload().then(()=>this.ui.requestRender())}},s=new lKe(i,()=>r(),()=>this.handleCtrlC(),()=>this.ui.requestRender());return s.focused=!0,{component:s,focus:s}})}showRulesView(){let t=this.session.resourceLoader.getRules();this.showSelector(n=>{let r=new uKe(t,n,()=>this.ui.requestRender());return r.focused=!0,{component:r,focus:r}})}showSettingsSelector(){this.showSelector(t=>{let n=new JQ({autoCompact:this.session.autoCompactionEnabled,showImages:this.settingsManager.getShowImages(),autoResizeImages:this.settingsManager.getImageAutoResize(),blockImages:this.settingsManager.getBlockImages(),enableSkillCommands:this.settingsManager.getEnableSkillCommands(),enableHashline:this.settingsManager.getEnableHashline(),toolSearchEnabled:this.settingsManager.getToolSearchEnabled(),toolSearchAutoEnable:this.runtimeHost.services.featureFlags.flags.cliMcpToolSearchAutoEnable,steeringMode:this.session.steeringMode,followUpMode:this.session.followUpMode,transport:this.settingsManager.getTransport(),currentTheme:this.settingsManager.getTheme()||"dark",availableThemes:dke(),hideThinkingBlock:this.hideThinkingBlock,collapseChangelog:this.settingsManager.getCollapseChangelog(),doubleEscapeAction:this.settingsManager.getDoubleEscapeAction(),treeFilterMode:this.settingsManager.getTreeFilterMode(),showHardwareCursor:this.settingsManager.getShowHardwareCursor(),editorPaddingX:this.settingsManager.getEditorPaddingX(),autocompleteMaxVisible:this.settingsManager.getAutocompleteMaxVisible(),quietStartup:this.settingsManager.getQuietStartup(),clearOnShrink:this.settingsManager.getClearOnShrink(),collapsePromptCommands:this.settingsManager.getCollapsePromptCommands()},{onAutoCompactChange:r=>{this.session.setAutoCompactionEnabled(r),this.footer.setAutoCompactEnabled(r)},onShowImagesChange:r=>{this.settingsManager.setShowImages(r);for(let i of this.chatContainer.children)i instanceof oN&&i.setShowImages(r)},onAutoResizeImagesChange:r=>{this.settingsManager.setImageAutoResize(r)},onBlockImagesChange:r=>{this.settingsManager.setBlockImages(r)},onEnableSkillCommandsChange:r=>{this.settingsManager.setEnableSkillCommands(r),this.setupAutocomplete(this.fdPath)},onToolSearchEnabledChange:r=>{this.settingsManager.setToolSearchEnabled(r)},onEnableHashlineChange:r=>{this.settingsManager.setEnableHashline(r)},onSteeringModeChange:r=>{this.session.setSteeringMode(r)},onFollowUpModeChange:r=>{this.session.setFollowUpMode(r)},onTransportChange:r=>{this.settingsManager.setTransport(r),this.session.agent.transport=r},onThemeChange:r=>{let i=wle(r,!0);this.settingsManager.setTheme(r),this.ui.invalidate(),i.success||this.showError(`Failed to load theme "${r}": ${i.error}
13618
+ `);return this.editor.setText(l),this.updatePendingMessagesDisplay(),t?.abort&&this.agent.abort(),i.length}queueCompactionMessage(t,n){this.compactionQueuedMessages.push({text:t,mode:n}),this.editor.addToHistory?.(QSe(t)),this.editor.setText(""),this.updatePendingMessagesDisplay(),this.showStatus("Queued message for after compaction")}isExtensionCommand(t){if(!t.startsWith("/"))return!1;let n=this.session.extensionRunner;if(!n)return!1;let r=t.indexOf(" "),i=r===-1?t.slice(1):t.slice(1,r);return!!n.getCommand(i)}trackSlashCommandUsage(t){if(!t.startsWith("/"))return;let n=t.indexOf(" "),r=n===-1?t.slice(1):t.slice(1,n);if(!r)return;let i;if(hL.some(o=>o.name===r)?i=r:this.isCustomSlashCommand(t,r)&&(i="custom"),!i)return;let s={commandName:i};this.session.resourceLoader.getEventBus?.().emit(Tq,s)}isCustomSlashCommand(t,n){return this.isExtensionCommand(t)||this.session.promptTemplates.some(r=>r.name===n)||this.skillCommands.has(n)}publishMessageSendError(t){let n={errorMessagePreview:t.slice(0,100),requestId:this.session.currentRequestId};this.session.resourceLoader.getEventBus?.().emit(Iq,n)}async flushCompactionQueue(t){if(this.compactionQueuedMessages.length===0)return;let n=[...this.compactionQueuedMessages];this.compactionQueuedMessages=[],this.updatePendingMessagesDisplay();let r=i=>{this.session.clearQueue(),this.compactionQueuedMessages=n,this.updatePendingMessagesDisplay(),this.showError(`Failed to send queued message${n.length>1?"s":""}: ${i instanceof Error?i.message:String(i)}`)};try{if(t?.willRetry){for(let u of n)this.isExtensionCommand(u.text)?await this.session.prompt(u.text):u.mode==="followUp"?await this.session.followUp(u.text):await this.session.steer(u.text);this.updatePendingMessagesDisplay();return}let i=n.findIndex(u=>!this.isExtensionCommand(u.text));if(i===-1){for(let u of n)await this.session.prompt(u.text);return}let s=n.slice(0,i),o=n[i],a=n.slice(i+1);for(let u of s)await this.session.prompt(u.text);let l=this.session.prompt(o.text).catch(u=>{r(u)});for(let u of a)this.isExtensionCommand(u.text)?await this.session.prompt(u.text):u.mode==="followUp"?await this.session.followUp(u.text):await this.session.steer(u.text);this.updatePendingMessagesDisplay()}catch(i){r(i)}}flushPendingBashComponents(){for(let t of this.pendingBashComponents)this.pendingMessagesContainer.removeChild(t),this.chatContainer.addChild(t);this.pendingBashComponents=[]}showSelector(t){let n=()=>{this.editorContainer.clear(),this.editorContainer.addChild(this.editor),this.ui.setFocus(this.editor)},{component:r,focus:i}=t(n);this.editorContainer.clear(),this.editorContainer.addChild(r),this.ui.setFocus(i),this.ui.requestRender()}showPluginsPage(){let t=Dr(),n=LK(t);this.showSelector(r=>{let i={getPlugins:()=>{let o=this.settingsManager.getEnabledPlugins();return $x().map(a=>({id:a.id,name:a.name,marketplace:a.marketplace,enabled:o[a.id]??a.enabled,diagnostics:a.diagnostics}))},getPluginDetails:o=>{let a=$x().find(l=>l.id===o);return a?DK(a):void 0},getMarketplaces:()=>{let o=$x();return Qhe(t).map(a=>({dir:a.dir,name:a.name,pluginCount:o.filter(l=>l.marketplace===a.name||l.marketplace===a.dir).length}))},getErrors:()=>Qx().map(o=>({message:o.message,path:o.path})),settingsManager:this.settingsManager,addMarketplace:async o=>{let a=await kK(n,o);return a.success?null:a.error??"Failed to add"},removeMarketplace:o=>{let a=OK(n,o);return a.success?null:a.error??"Failed to remove"},refresh:()=>{this.session.reload().then(()=>this.ui.requestRender())}},s=new lKe(i,()=>r(),()=>this.handleCtrlC(),()=>this.ui.requestRender());return s.focused=!0,{component:s,focus:s}})}showRulesView(){let t=this.session.resourceLoader.getRules();this.showSelector(n=>{let r=new uKe(t,n,()=>this.ui.requestRender());return r.focused=!0,{component:r,focus:r}})}showSettingsSelector(){this.showSelector(t=>{let n=new JQ({autoCompact:this.session.autoCompactionEnabled,showImages:this.settingsManager.getShowImages(),autoResizeImages:this.settingsManager.getImageAutoResize(),blockImages:this.settingsManager.getBlockImages(),enableSkillCommands:this.settingsManager.getEnableSkillCommands(),enableHashline:this.settingsManager.getEnableHashline(),toolSearchEnabled:this.settingsManager.getToolSearchEnabled(),toolSearchAutoEnable:this.runtimeHost.services.featureFlags.flags.cliMcpToolSearchAutoEnable,steeringMode:this.session.steeringMode,followUpMode:this.session.followUpMode,currentTheme:this.settingsManager.getTheme()||"dark",availableThemes:dke(),hideThinkingBlock:this.hideThinkingBlock,collapseChangelog:this.settingsManager.getCollapseChangelog(),doubleEscapeAction:this.settingsManager.getDoubleEscapeAction(),treeFilterMode:this.settingsManager.getTreeFilterMode(),showHardwareCursor:this.settingsManager.getShowHardwareCursor(),editorPaddingX:this.settingsManager.getEditorPaddingX(),autocompleteMaxVisible:this.settingsManager.getAutocompleteMaxVisible(),quietStartup:this.settingsManager.getQuietStartup(),clearOnShrink:this.settingsManager.getClearOnShrink(),collapsePromptCommands:this.settingsManager.getCollapsePromptCommands()},{onAutoCompactChange:r=>{this.session.setAutoCompactionEnabled(r),this.footer.setAutoCompactEnabled(r)},onShowImagesChange:r=>{this.settingsManager.setShowImages(r);for(let i of this.chatContainer.children)i instanceof oN&&i.setShowImages(r)},onAutoResizeImagesChange:r=>{this.settingsManager.setImageAutoResize(r)},onBlockImagesChange:r=>{this.settingsManager.setBlockImages(r)},onEnableSkillCommandsChange:r=>{this.settingsManager.setEnableSkillCommands(r),this.setupAutocomplete(this.fdPath)},onToolSearchEnabledChange:r=>{this.settingsManager.setToolSearchEnabled(r)},onEnableHashlineChange:r=>{this.settingsManager.setEnableHashline(r)},onSteeringModeChange:r=>{this.session.setSteeringMode(r)},onFollowUpModeChange:r=>{this.session.setFollowUpMode(r)},onThemeChange:r=>{let i=wle(r,!0);this.settingsManager.setTheme(r),this.ui.invalidate(),i.success||this.showError(`Failed to load theme "${r}": ${i.error}
13619
13619
  Fell back to dark theme.`)},onThemePreview:r=>{wle(r,!0).success&&(this.ui.invalidate(),this.ui.requestRender())},onHideThinkingBlockChange:r=>{this.hideThinkingBlock=r,this.settingsManager.setHideThinkingBlock(r);for(let i of this.chatContainer.children)i instanceof sN&&i.setHideThinkingBlock(r);this.chatContainer.clear(),this.rebuildChatFromMessages()},onCollapseChangelogChange:r=>{this.settingsManager.setCollapseChangelog(r)},onQuietStartupChange:r=>{this.settingsManager.setQuietStartup(r)},onDoubleEscapeActionChange:r=>{this.settingsManager.setDoubleEscapeAction(r)},onTreeFilterModeChange:r=>{this.settingsManager.setTreeFilterMode(r)},onShowHardwareCursorChange:r=>{this.settingsManager.setShowHardwareCursor(r),this.ui.setShowHardwareCursor(r)},onEditorPaddingXChange:r=>{this.settingsManager.setEditorPaddingX(r),this.defaultEditor.setPaddingX(r),this.editor!==this.defaultEditor&&this.editor.setPaddingX!==void 0&&this.editor.setPaddingX(r)},onAutocompleteMaxVisibleChange:r=>{this.settingsManager.setAutocompleteMaxVisible(r),this.defaultEditor.setAutocompleteMaxVisible(r),this.editor!==this.defaultEditor&&this.editor.setAutocompleteMaxVisible!==void 0&&this.editor.setAutocompleteMaxVisible(r)},onClearOnShrinkChange:r=>{this.settingsManager.setClearOnShrink(r),this.ui.setClearOnShrink(r)},onCollapsePromptCommandsChange:r=>{this.settingsManager.setCollapsePromptCommands(r)},onCancel:()=>{t(),this.ui.requestRender()}});return{component:n,focus:n.getSettingsList()}})}handleEffortCommand(t){let n=this.session.getAvailableReasoningSelections();if(n.length<Kul){this.showStatus("Current model has no reasoning effort choices");return}if(!t){this.showEffortSelector(n);return}let r=this.resolveEffortSelection(t.toLowerCase());if(!r){let i=["default",...this.session.getAvailableThinkingLevels()].join(", ");this.showStatus(`Unsupported effort "${t}" for this model. Valid levels: ${i}`);return}this.applyReasoningSelection(r)}resolveEffortSelection(t){return t==="default"?{kind:"model-default"}:this.session.getAvailableThinkingLevels().includes(t)?{kind:"explicit",effort:t}:void 0}showEffortSelector(t){this.showSelector(n=>{let r=new t7(this.session.reasoningSelection,t,i=>{n(),this.applyReasoningSelection(i)},()=>{n(),this.ui.requestRender()},this.session.defaultThinkingEffort);return{component:r,focus:r.getSelectList()}})}applyReasoningSelection(t){this.session.setReasoningSelection(t),this.footer.invalidate(),this.updateEditorBorderColor(),this.showStatus(`Thinking level: ${this.session.reasoningSelectionDisplay}`)}async handleModelCommand(t){if(!t){this.showModelSelector();return}let n=await this.findExactModelMatch(t);if(n){try{await this.session.setModel(n),this.footer.invalidate(),this.updateEditorBorderColor(),this.showStatus(`Model: ${n.name||n.id}`),this.maybeWarnAboutAnthropicSubscriptionAuth(n),this.checkDaxnutsEasterEgg(n)}catch(r){this.showError(r instanceof Error?r.message:String(r))}return}this.showModelSelector(t)}async findExactModelMatch(t){let n=await this.getModelCandidates();return Gz(t,n)}async getModelCandidates(){if(this.session.scopedModels.length>0)return this.session.scopedModels.map(t=>t.model);this.session.modelRegistry.refresh();try{return await this.session.modelRegistry.getAvailableSupported()}catch{return[]}}async updateAvailableProviderCount(){let t=await this.getModelCandidates(),n=new Set(t.map(r=>r.provider));this.footerDataProvider.setAvailableProviderCount(n.size)}async maybeWarnAboutAnthropicSubscriptionAuth(t=this.session.model){if(this.anthropicSubscriptionWarningShown||!t||t.provider!=="anthropic")return;if(this.session.modelRegistry.authStorage.get("anthropic")?.type==="oauth"){this.anthropicSubscriptionWarningShown=!0,this.showWarning(kBi);return}try{let r=await this.session.modelRegistry.getApiKeyForProvider(t.provider);if(!rdl(r))return;this.anthropicSubscriptionWarningShown=!0,this.showWarning(kBi)}catch{}}showModelSelector(t){this.showSelector(n=>{let r=new qQ(this.ui,this.session.model,this.session.modelRegistry,this.session.scopedModels,async(i,s)=>{try{await this.session.setModel(i),s&&this.session.setReasoningSelection(s),this.footer.invalidate(),this.updateEditorBorderColor(),n(),this.showStatus(`Model: ${i.name||i.id}`),this.maybeWarnAboutAnthropicSubscriptionAuth(i),this.checkDaxnutsEasterEgg(i)}catch(o){n(),this.showError(o instanceof Error?o.message:String(o))}},()=>{n(),this.ui.requestRender()},t,this.session.reasoningSelection);return{component:r,focus:r}})}async showModelsSelector(){this.session.modelRegistry.refresh();let t=this.session.modelRegistry.getAvailableSupported();if(t.length===0){this.showStatus("No models available");return}let n=this.session.scopedModels,r=n.length>0,i=new Set,s=!1;if(r){for(let u of n)i.add(`${u.model.provider}/${u.model.id}`);s=!0}else{let u=this.settingsManager.getEnabledModels();if(u!==void 0&&u.length>0){s=!0;let c=await Zde(u,this.session.modelRegistry);for(let d of c)i.add(`${d.model.provider}/${d.model.id}`)}}let o=new Set(i),a=s,l=async u=>{if(u.size>0&&u.size<t.length){let c=await Zde(Array.from(u),this.session.modelRegistry);this.session.setScopedModels(c.map(d=>({model:d.model,thinkingLevel:d.thinkingLevel})))}else this.session.setScopedModels([]);await this.updateAvailableProviderCount(),this.ui.requestRender()};this.showSelector(u=>{let c=new VSe({allModels:t,enabledModelIds:o,hasEnabledModelsFilter:a},{onModelToggle:async(d,p)=>{p?o.add(d):o.delete(d),a=!0,await l(o)},onEnableAll:async d=>{o.clear();for(let p of d)o.add(p);a=!1,await l(o)},onClearAll:async()=>{o.clear(),a=!0,await l(o)},onToggleProvider:async(d,p,m)=>{for(let f of p)m?o.add(f):o.delete(f);a=!0,await l(o)},onPersist:d=>{let p=d.length===t.length?void 0:d;this.settingsManager.setEnabledModels(p),this.showStatus("Model selection saved to settings")},onCancel:()=>{u(),this.ui.requestRender()}});return{component:c,focus:c}})}showUserMessageSelector(){let t=this.session.getUserMessagesForForking();if(t.length===0){this.showStatus("No messages to fork from");return}this.showSelector(n=>{let r=new r7(t.map(i=>({id:i.entryId,text:i.text})),async i=>{let s=await this.runtimeHost.fork(i);if(s.cancelled){n(),this.ui.requestRender();return}await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.editor.setText(s.selectedText??""),n(),this.showStatus("Branched to new session")},()=>{n(),this.ui.requestRender()});return{component:r,focus:r.getMessageList()}})}showTreeSelector(t){let n=this.sessionManager.getTree(),r=this.sessionManager.getLeafId(),i=this.settingsManager.getTreeFilterMode();if(n.length===0){this.showStatus("No entries in session");return}this.showSelector(s=>{let o=new n7(n,r,this.ui.terminal.rows,async a=>{if(a===r){s(),this.showStatus("Already at this point");return}s();let l=!1,u;if(!this.settingsManager.getBranchSummarySkipPrompt())for(;;){let p=await this.showExtensionSelector("Summarize branch?",["No summary","Summarize","Summarize with custom prompt"]);if(p===void 0){this.showTreeSelector(a);return}if(l=p!=="No summary",!(p==="Summarize with custom prompt"&&(u=await this.showExtensionEditor("Custom summarization instructions"),u===void 0)))break}let c,d=this.defaultEditor.onEscape;l&&(this.defaultEditor.onEscape=()=>{this.session.abortBranchSummary()},this.chatContainer.addChild(new st(1)),c=new Wa(this.ui,p=>me.fg("accent",p),p=>me.fg("muted",p),`Summarizing branch... (${Oa("app.interrupt")} to cancel)`),this.statusContainer.addChild(c),this.ui.requestRender());try{let p=await this.session.navigateTree(a,{summarize:l,customInstructions:u});if(p.aborted){this.showStatus("Branch summarization cancelled"),this.showTreeSelector(a);return}if(p.cancelled){this.showStatus("Navigation cancelled");return}this.chatContainer.clear(),this.renderInitialMessages(),p.editorText&&!this.editor.getText().trim()&&this.editor.setText(p.editorText),this.showStatus("Navigated to selected point")}catch(p){this.showError(p instanceof Error?p.message:String(p))}finally{c&&(c.stop(),this.statusContainer.clear()),this.defaultEditor.onEscape=d}},()=>{s(),this.ui.requestRender()},(a,l)=>{this.sessionManager.appendLabelChange(a,l),this.ui.requestRender()},t,i);return{component:o,focus:o}})}showSessionSelector(){this.showSelector(t=>{let n=new TM(r=>es.list(this.sessionManager.getCwd(),this.sessionManager.getSessionDir(),r),r=>es.listAll(void 0,r),async r=>{t(),await this.handleResumeSession(r)},()=>{t(),this.ui.requestRender()},()=>{this.shutdown()},()=>this.ui.requestRender(),{renameSession:async(r,i)=>{let s=(i??"").trim();if(!s)return;es.open(r).appendSessionInfo(s)},showRenameHint:!0,keybindings:this.keybindings},this.sessionManager.getSessionFile());return{component:n,focus:n}})}async handleResumeSession(t){this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear();try{if((await this.runtimeHost.switchSession(t)).cancelled)return;await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.showStatus("Resumed session")}catch(n){if(n instanceof n9){let r=await this.promptForMissingSessionCwd(n);if(!r){this.showStatus("Resume cancelled");return}if((await this.runtimeHost.switchSession(t,r)).cancelled)return;await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.showStatus("Resumed session in current cwd");return}await this.handleFatalRuntimeError("Failed to resume session",n)}}async handleAugmentLogoutCommand(){let t=await qI().catch(()=>{}),n=t?.status==="resolved"&&t.credentials.tokenSource!=="session-file",r=await Uhe(["logout"],{offline:process.env.PI_OFFLINE==="1"},{print:i=>this.showStatus(i),printError:i=>this.showError(i),printWarning:i=>this.showWarning(i)});r.type!=="completed"||r.exitCode!==0||(n||(this.runtimeHost.setAugmentAccount(void 0),this.session.modelRegistry.unregisterProvider("augment")),await this.updateAvailableProviderCount())}async handleAugmentLoginCommand(){let t;try{t=await qI()}catch{this.showError("Credential state could not be read.");return}if(t.status==="resolved"&&(process.env.PI_OFFLINE==="1"||this.session.modelRegistry.isAugmentRegistryAvailable())){this.showStatus("You're already logged in.");return}let n=[...this.editorContainer.children],r=this.customFooter??this.footer;(this.onboardingLayout??this.ui).removeChild(this.widgetContainerBelow),(this.onboardingLayout??this.ui).removeChild(r);try{let i=await $qe({tui:this.ui,offline:process.env.PI_OFFLINE==="1",mount:c=>{this.editorContainer.clear(),this.editorContainer.addChild(c),this.ui.setFocus(c),this.ui.requestRender()},confirm:c=>this.showExtensionConfirm("Login",c)});if(i.type==="declined"){this.showStatus("Authentication was not changed.");return}if(i.type==="cancelled"){this.showStatus("Authentication cancelled.");return}if(i.type==="error"){this.showError(i.message);return}this.showStatus("Logged in successfully!");let{account:s,discovered:o}=await LDi({modelRegistry:this.session.modelRegistry,userAgent:this.runtimeHost.services.augmentUserAgent});if(this.runtimeHost.setAugmentAccount(s),!o){this.showError("Models could not be loaded after login.");return}let l=this.session.settingsManager.getDefaultModel(),u=this.session.modelRegistry.getAvailableAugmentModel(l);if(!u){this.showError("No model was available after login.");return}await this.session.setModel(u),await this.updateAvailableProviderCount()}finally{this.editorContainer.clear();for(let i of n)this.editorContainer.addChild(i);(this.onboardingLayout??this.ui).addChild(this.widgetContainerBelow),(this.onboardingLayout??this.ui).addChild(r),this.ui.setFocus(this.editor),this.ui.requestRender()}}async handleReloadCommand(){if(this.session.isStreaming){this.showWarning("Wait for the current response to finish before reloading.");return}if(this.session.isCompacting){this.showWarning("Wait for compaction to finish before reloading.");return}this.resetExtensionUI();let t=new $Q(this.ui,me,"Reloading keybindings, extensions, skills, custom commands, themes...",{cancellable:!1}),n=this.editor;this.editorContainer.clear(),this.editorContainer.addChild(t),this.ui.setFocus(t),this.ui.requestRender();let r=i=>{t.dispose(),this.editorContainer.clear(),this.editorContainer.addChild(i),this.ui.setFocus(i),this.ui.requestRender()};try{await this.session.reload(),this.toolOutputExpanded=this.settingsManager.getVerbose(),this.defaultEditor.setPasteOptions(this.getPasteOptions()),this.keybindings.reload(),pke(this.session.resourceLoader.getThemes().themes),this.hideThinkingBlock=this.settingsManager.getHideThinkingBlock();let i=this.settingsManager.getTheme(),s=i?wle(i,!0):{success:!0};s.success||this.showError(`Failed to load theme "${i}": ${s.error}
13620
13620
  Fell back to dark theme.`);let o=this.settingsManager.getEditorPaddingX(),a=this.settingsManager.getAutocompleteMaxVisible();this.defaultEditor.setPaddingX(o),this.defaultEditor.setAutocompleteMaxVisible(a),this.editor!==this.defaultEditor&&(this.editor.setPaddingX?.(o),this.editor.setAutocompleteMaxVisible?.(a)),this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor()),this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink()),this.setupAutocomplete(this.fdPath);let l=this.session.extensionRunner;l&&this.setupExtensionShortcuts(l),this.rebuildChatFromMessages(),r(this.editor),this.showLoadedResources({force:!1,showDiagnosticsWhenQuiet:!0});let u=this.session.modelRegistry.getError();u&&this.showError(`models.json error: ${u}`),this.showStatus("Reloaded keybindings, extensions, skills, custom commands, themes")}catch(i){r(n),this.showError(`Reload failed: ${i instanceof Error?i.message:String(i)}`)}}async handleExportCommand(t){let n=t.split(/\s+/),r=n.length>1?n[1]:void 0;try{if(r?.endsWith(".jsonl")){let i=this.session.exportToJsonl(r);this.showStatus(`Session exported to: ${i}`)}else{let i=await this.session.exportToHtml(r);this.showStatus(`Session exported to: ${i}`)}}catch(i){this.showError(`Failed to export session: ${i instanceof Error?i.message:"Unknown error"}`)}}async handleImportCommand(t){let n=t.split(/\s+/);if(n.length<2||!n[1]){this.showError("Usage: /import <path.jsonl>");return}let r=n[1];if(!await this.showExtensionConfirm("Import session",`Replace current session with ${r}?`)){this.showStatus("Import cancelled");return}try{if(this.loadingAnimation&&(this.loadingAnimation.stop(),this.loadingAnimation=void 0),this.statusContainer.clear(),(await this.runtimeHost.importFromJsonl(r)).cancelled){this.showStatus("Import cancelled");return}await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.showStatus(`Session imported from: ${r}`)}catch(s){if(s instanceof n9){let o=await this.promptForMissingSessionCwd(s);if(!o){this.showStatus("Import cancelled");return}if((await this.runtimeHost.importFromJsonl(r,o)).cancelled){this.showStatus("Import cancelled");return}await this.handleRuntimeSessionChange(),this.renderCurrentSessionState(),this.showStatus(`Session imported from: ${r}`);return}await this.handleFatalRuntimeError("Failed to import session",s)}}async handleCopyCommand(){let t=this.session.getLastAssistantText();if(!t){this.showError("No agent messages to copy yet.");return}try{await Ire(t),this.showStatus("Copied last agent message to clipboard")}catch(n){this.showError(n instanceof Error?n.message:String(n))}}handleNameCommand(t){let n=t.replace(/^\/name\s*/,"").trim();if(!n){let r=this.sessionManager.getSessionName();r?(this.chatContainer.addChild(new st(1)),this.chatContainer.addChild(new In(()=>me.fg("dim",`Session name: ${r}`),1,0))):this.showWarning("Usage: /name <name>"),this.ui.requestRender();return}this.sessionManager.appendSessionInfo(n),this.updateTerminalTitle(),this.chatContainer.addChild(new st(1)),this.chatContainer.addChild(new In(()=>me.fg("dim",`Session name set: ${n}`),1,0)),this.ui.requestRender()}handleSessionCommand(){let t=structuredClone(this.session.getSessionStats()),n=this.sessionManager.getSessionName(),r=this.sessionManager.getBranch(),i=wre({branch:r,...a_(r)}),s=()=>{let o=`${me.bold("Session Info")}
13621
13621
 
@@ -14258,4 +14258,4 @@ content-type/index.js:
14258
14258
  *)
14259
14259
  */
14260
14260
 
14261
- //# debugId=ced4b0e9-781c-5bef-ac9a-e2553fab113a
14261
+ //# debugId=f8ddc39f-51ba-58fb-999b-19e55cee1349