gitwarren 0.1.8 → 0.1.9
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.
|
@@ -60,7 +60,7 @@ ${n.join(`
|
|
|
60
60
|
|
|
61
61
|
`)}return E.write("payload.value = newResult;"),E.write("return payload;"),E.compile()};let c;const u=uh,m=!oo.jitless,p=m&&tF.value,g=t.catchall;let y;e._zod.parse=(b,S)=>{y??(y=i.value);const k=b.value;return u(k)?m&&p&&S?.async===!1&&S.jitless!==!0?(c||(c=l(t.shape)),b=c(b,S),g?P2([],k,b,S,y,e):b):n(b,S):(b.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),b)}});function Gk(e,t,n,i){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const s=e.filter(l=>!ka(l));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(l=>l.issues.map(c=>Ga(c,i,qs())))}),t)}const d9=Ce("$ZodUnion",(e,t)=>{Fn.init(e,t),fn(e,"optin",i=>i.def.options.some(s=>s._zod.optin==="defaulted")?"defaulted":i.def.options.some(s=>s._zod.optin!==void 0)?"optional":void 0),fn(e,"optout",i=>i.def.options.some(s=>s._zod.optout==="optional")?"optional":void 0),fn(e,"values",i=>{if(i.def.options.every(s=>s._zod.values))return new Set(i.def.options.flatMap(s=>Array.from(s._zod.values)))}),fn(e,"pattern",i=>{if(i.def.options.every(s=>s._zod.pattern)){const s=i.def.options.map(l=>l._zod.pattern);return new RegExp(`^(${s.map(l=>Fb(l.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,s)=>{if(n)return n(i,s);let l=!1;const c=[];for(const u of t.options){const m=u._zod.run({value:i.value,issues:[]},s);if(m instanceof Promise)c.push(m),l=!0;else{if(m.issues.length===0)return m;c.push(m)}}return l?Promise.all(c).then(u=>Gk(u,i,e,s)):Gk(c,i,e,s)}}),h9=Ce("$ZodIntersection",(e,t)=>{Fn.init(e,t),e._zod.parse=(n,i)=>{const s=n.value,l=t.left._zod.run({value:s,issues:[]},i),c=t.right._zod.run({value:s,issues:[]},i);return l instanceof Promise||c instanceof Promise?Promise.all([l,c]).then(([m,h])=>Yk(n,m,h)):Yk(n,l,c)}});function vy(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ru(e)&&Ru(t)){const n=Object.keys(t),i=Object.keys(e).filter(l=>n.indexOf(l)!==-1),s={...e,...t};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(const l of i){if(l==="__proto__")continue;const c=vy(e[l],t[l]);if(!c.valid)return{valid:!1,mergeErrorPath:[l,...c.mergeErrorPath]};s[l]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const s=e[i],l=t[i],c=vy(s,l);if(!c.valid)return{valid:!1,mergeErrorPath:[i,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Yk(e,t,n){const i=new Map;let s;const l=new Map,c=(h,p)=>{let g;if(h.code==="unrecognized_keys"&&!h.path?.length)s??(s=h),g=h.keys;else if(h.code==="invalid_key"&&h.origin==="record"&&h.path?.length===1){const y=String(h.path[0]);l.has(y)||l.set(y,h),g=[y]}else return!1;for(const y of g)i.has(y)||i.set(y,{}),i.get(y)[p]=!0;return!0};for(const h of t.issues)c(h,"l")||e.issues.push(h);for(const h of n.issues)c(h,"r")||e.issues.push(h);const u=[...i].filter(([,h])=>h.l&&h.r).map(([h])=>h);if(u.length){const h=s?u.filter(p=>s.keys.includes(p)):[];h.length&&e.issues.push({...s,keys:h});for(const p of u)!h.includes(p)&&l.has(p)&&e.issues.push(l.get(p))}const m=vy(t.value,n.value);if(!m.valid){if(ka(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(m.mergeErrorPath)}`)}return e.value=m.data,e}const m9=Ce("$ZodEnum",(e,t)=>{Fn.init(e,t);const n=p2(t.entries),i=new Set(n);e._zod.values=i;const s=n.filter(l=>nF.has(typeof l));e._zod.pattern=new RegExp(s.length?`^(${s.map(l=>om(l.toString())).join("|")})$`:"^[^\\s\\S]$"),e._zod.parse=(l,c)=>{const u=l.value;return i.has(u)||l.issues.push({code:"invalid_value",values:n,input:u,inst:e}),l}}),p9=Ce("$ZodTransform",(e,t)=>{Fn.init(e,t),e._zod.optin="optional",oo.memoizer?.guard(e),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new w2(e.constructor.name);const s=t.transform(n.value,n);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(c=>(n.value=c,n));if(s instanceof Promise)throw new Ra;return n.value=s,n}});function Kk(e,t){return e.value=t.issues.length?void 0:t.value,e}const L2=Ce("$ZodOptional",(e,t)=>{Fn.init(e,t),fn(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",fn(e,"values",n=>{const i=n.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),fn(e,"pattern",n=>{const i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Fb(i.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const s=t.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(l=>Kk(n,l)):Kk(n,s)}return t.innerType._zod.run(n,i)}}),g9=Ce("$ZodExactOptional",(e,t)=>{L2.init(e,t),fn(e,"values",n=>n.def.innerType._zod.values),fn(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),x9=Ce("$ZodNullable",(e,t)=>{Fn.init(e,t),fn(e,"optin",n=>n.def.innerType._zod.optin),fn(e,"optout",n=>n.def.innerType._zod.optout),fn(e,"pattern",n=>{const i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${Fb(i.source)}|null)$`):void 0}),fn(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)}),y9=Ce("$ZodDefault",(e,t)=>{Fn.init(e,t),e._zod.optin="defaulted",fn(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(l=>Xk(l,t)):Xk(s,t)}});function Xk(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const b9=Ce("$ZodPrefault",(e,t)=>{Fn.init(e,t),e._zod.optin="defaulted",fn(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))}),v9=Ce("$ZodNonOptional",(e,t)=>{Fn.init(e,t),fn(e,"values",n=>{const i=n.def.innerType._zod.values;return i?new Set([...i].filter(s=>s!==void 0)):void 0}),e._zod.parse=(n,i)=>{const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(l=>Jk(l,e)):Jk(s,e)}});function Jk(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Wk(e,t,n,i){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(s=>Ga(s,i,qs()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const w9=Ce("$ZodCatch",(e,t)=>{Fn.init(e,t),fn(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),fn(e,"optout",n=>n.def.innerType._zod.optout),fn(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const s=t.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(l=>Wk(n,l,t,i)):Wk(n,s,t,i)}}),S9=Ce("$ZodPipe",(e,t)=>{Fn.init(e,t),fn(e,"values",n=>n.def.in._zod.values),fn(e,"optin",n=>n.def.in._zod.optin),fn(e,"optout",n=>n.def.out._zod.optout),fn(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){const l=t.out._zod.run(n,i);return l instanceof Promise?l.then(c=>Ed(c,t.in,i)):Ed(l,t.in,i)}const s=t.in._zod.run(n,i);return s instanceof Promise?s.then(l=>Ed(l,t.out,i)):Ed(s,t.out,i)}});function Ed(e,t,n){return e.issues.some(i=>i.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const k9=Ce("$ZodReadonly",(e,t)=>{Fn.init(e,t),fn(e,"propValues",n=>n.def.innerType._zod.propValues),fn(e,"values",n=>n.def.innerType._zod.values),fn(e,"optin",n=>n.def.innerType?._zod?.optin),fn(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then($k):$k(s)}});function $k(e){return e.memo||(e.value=Object.freeze(e.value)),e}const E9=Ce("$ZodCustom",(e,t)=>{Hr.init(e,t),Fn.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{const i=n.value,s=t.fn(i);if(s instanceof Promise)return s.then(l=>Qk(l,n,i,e));Qk(s,n,i,e)}});function Qk(e,t,n,i){if(!e){const s={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),t.issues.push(ju(s))}}class C9 extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const wy="~memo",eE=[];function dx(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const tE=new WeakMap;function F2(e,t){const n=tE.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let i=!1;const s=u=>{!i&&u?._zod&&F2(u,t)&&(i=!0)},l=e._zod.def;switch(l.type){case"object":{for(const u of Reflect.ownKeys(l.shape))s(l.shape[u]);s(l.catchall);break}case"array":s(l.element);break;case"tuple":for(const u of l.items)s(u);s(l.rest);break;case"record":case"map":s(l.keyType),s(l.valueType);break;case"set":s(l.valueType);break;case"union":for(const u of l.options)s(u);break;case"intersection":s(l.left),s(l.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(l.innerType);break;case"pipe":s(l.in),s(l.out);break;case"function":s(l.input),s(l.output);break;case"lazy":s(e._zod.innerType);break;case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const u in l){const m=Object.getOwnPropertyDescriptor(l,u);if(!m||m.get)continue;const h=m.value;if(!(!h||typeof h!="object")){if(h._zod)s(h);else if(Array.isArray(h))for(const p of h)s(p)}}}return t.delete(e),tE.set(e,i),i}function T9(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}let Cd;const Td=[],R9={alloc(e,t,n){const i=Cd;if(!i)return n;Cd=void 0;const s={value:n,issues:null};return i.set(t.value,s),Td.push(s),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,i=(s,l)=>{if(l.direction!=="backward"&&N9(l,s.value))throw new C9;return n(s,l)};e._zod.parse=i,e._zod.run===n&&(e._zod.run=i)})},attach(e){var t;let n,i,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const l=e._zod.parse,c=(u,m)=>{if(n===void 0&&(n=F2(e,new Set),!n))return e._zod.parse=l,e._zod.run===c&&(e._zod.run=l),l(u,m);const h=u.value;if(h===null||typeof h!="object")return l(u,m);let p=m[wy];p||(p={buckets:new Map,backEdges:void 0},m[wy]=p);let g;i===m?g=s:(g=T9(p,e),i=m,s=g);const y=g.get(h);if(y)return u.value=y.value,y.issues?y.issues.length&&u.issues.push(...dx(y.issues)):(u.memo=!0,p.backEdges??(p.backEdges=new Set),p.backEdges.add(y.value)),u;Cd=g;const b=Td.length,S=l(u,m);Cd=void 0;const k=Td.length>b?Td.pop():void 0;return S instanceof Promise?S.then(E=>(k&&(k.issues=E.issues.length?dx(E.issues):eE),E)):(k&&(k.issues=S.issues.length?dx(S.issues):eE),S)};e._zod.parse=c,e._zod.run===l&&(e._zod.run=c)})}};function j9(){return R9}function N9(e,t){const n=e[wy]?.backEdges;return n!==void 0&&t!==null&&typeof t=="object"&&n.has(t)}const O9=()=>{const 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(l){return e[l]??null}const 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",credit_card:"credit card number",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};function s(l,c){return l==="number"&&typeof c=="number"&&!Number.isFinite(c)?String(c):i[l]??l}return l=>{switch(l.code){case"invalid_type":{const c=s(l.expected),u=hF(l.input),m=s(u,l.input);return`Invalid input: expected ${c}, received ${m}`}case"invalid_value":return l.values.length===1?`Invalid input: expected ${y2(l.values[0])}`:`Invalid option: expected one of ${_k(l.values,"|")}`;case"too_big":{const c=l.exact?"exactly ":l.inclusive?"<=":"<",u=t(l.origin);return u?`Too big: expected ${l.origin??"value"} to have ${c}${l.maximum.toString()} ${u.unit??"elements"}`:`Too big: expected ${l.origin??"value"} to be ${c}${l.maximum.toString()}`}case"too_small":{const c=l.exact?"exactly ":l.inclusive?">=":">",u=t(l.origin);return u?`Too small: expected ${l.origin} to have ${c}${l.minimum.toString()} ${u.unit}`:`Too small: expected ${l.origin} to be ${c}${l.minimum.toString()}`}case"invalid_format":{const c=l;return c.format==="starts_with"?`Invalid string: must start with "${c.prefix}"`:c.format==="ends_with"?`Invalid string: must end with "${c.suffix}"`:c.format==="includes"?`Invalid string: must include "${c.includes}"`:c.format==="regex"?`Invalid string: must match pattern ${c.pattern}`:`Invalid ${n[c.format]??l.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${l.divisor}`;case"unrecognized_keys":return`Unrecognized key${l.keys.length>1?"s":""}: ${_k(l.keys,", ")}`;case"invalid_key":return`Invalid key in ${l.origin}`;case"invalid_union":return l.options&&Array.isArray(l.options)&&l.options.length>0?`Invalid discriminator value. Expected ${l.options.map(u=>`'${u}'`).join(" | ")}`:l.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${l.origin}`;default:return"Invalid input"}}};function A9(){return{localeError:O9()}}var nE;class M9{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const i=n[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const s={...i,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function z9(){return new M9}(nE=globalThis).__zod_globalRegistry??(nE.__zod_globalRegistry=z9());const ou=globalThis.__zod_globalRegistry;function I9(e,t){return new e({type:"string",...ot(t)})}function D9(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ot(t)})}function _9(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ot(t)})}function P9(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ot(t)})}function L9(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ot(t)})}function F9(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ot(t)})}function H9(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ot(t)})}function B9(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ot(t)})}function V9(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ot(t)})}function U9(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ot(t)})}function Z9(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ot(t)})}function q9(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ot(t)})}function G9(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ot(t)})}function Y9(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ot(t)})}function K9(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ot(t)})}function X9(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ot(t)})}function J9(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ot(t)})}function W9(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ot(t)})}function $9(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ot(t)})}function Q9(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ot(t)})}function eH(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ot(t)})}function tH(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ot(t)})}function nH(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ot(t)})}function H2(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ot(t)})}function rH(e,t){return new e({type:"string",format:"date",check:"string_format",...ot(t)})}function iH(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ot(t)})}function oH(e,t){return new e({type:"string",format:"duration",check:"string_format",...ot(t)})}function sH(e,t){return new e({type:"number",checks:[],...ot(t)})}function lH(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ot(t)})}function aH(e,t){return new e({type:"boolean",...ot(t)})}function cH(e){return new e({type:"unknown"})}function uH(e,t){return new e({type:"never",...ot(t)})}function rE(e,t){return new j2({check:"less_than",...ot(t),value:e,inclusive:!1})}function hx(e,t){return new j2({check:"less_than",...ot(t),value:e,inclusive:!0})}function iE(e,t){return new N2({check:"greater_than",...ot(t),value:e,inclusive:!1})}function mx(e,t){return new N2({check:"greater_than",...ot(t),value:e,inclusive:!0})}function oE(e,t){return new d8({check:"multiple_of",...ot(t),value:e})}function B2(e,t){return new m8({check:"max_length",...ot(t),maximum:e})}function hh(e,t){return new p8({check:"min_length",...ot(t),minimum:e})}function V2(e,t){return new g8({check:"length_equals",...ot(t),length:e})}function fH(e,t){return new x8({check:"string_format",format:"regex",...ot(t),pattern:e})}function dH(e){return new y8({check:"string_format",format:"lowercase",...ot(e)})}function hH(e){return new b8({check:"string_format",format:"uppercase",...ot(e)})}function mH(e,t){return new v8({check:"string_format",format:"includes",...ot(t),includes:e})}function pH(e,t){return new w8({check:"string_format",format:"starts_with",...ot(t),prefix:e})}function gH(e,t){return new S8({check:"string_format",format:"ends_with",...ot(t),suffix:e})}function Ya(e){return new k8({check:"overwrite",tx:e})}function xH(e){return Ya(t=>t.normalize(e))}function yH(){return Ya(e=>e.trim())}function bH(){return Ya(e=>e.toLowerCase())}function vH(){return Ya(e=>e.toUpperCase())}function wH(){return Ya(e=>eF(e))}function SH(e,t,n){return new e({type:"array",element:t,...ot(n)})}function kH(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ot(n)})}function EH(e,t){const n=CH(i=>(i.addIssue=s=>{if(typeof s=="string")i.issues.push(ju(s,i.value,n._zod.def));else{const l=s;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),"input"in l||(l.input=i.value),l.inst??(l.inst=n),l.continue??(l.continue=!n._zod.def.abort),i.issues.push(ju(l))}},e(i.value,i)),t);return n}function CH(e,t){const n=new Hr({check:"custom",...ot(t)});return n._zod.check=e,n}function du(e,...t){for(const n of t)for(const i of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,i)&&ri(e,i,n[i]);return e}function U2(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??ou,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ka(e,t,n,i,s){const l=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:s}):t.unrepresentable;if(l==="any")return!1;if(l===void 0||l==="throw")throw new Error(s);return Object.assign(n,l),!0}function pr(e,t,n={path:[],schemaPath:[]}){var i;const s=e._zod.def,l=t.seen.get(e);if(l)return l.count++,n.schemaPath.includes(e)&&(l.cycle=n.path),l.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const u=e._zod.toJSONSchema?.();if(u)c.schema=u;else{const p={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,p);else{const y=c.schema,b=t.processors[s.type];if(!b)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);b(e,t,y,p)}const g=e._zod.parent;g&&(c.ref||(c.ref=g),pr(g,t,p),t.seen.get(g).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&du(c.schema,m),t.io==="input"&&jr(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&"_prefault"in c.schema&&((i=c.schema).default??(i.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function sE(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Z2(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const i=new Map;for(const c of e.seen.entries()){const u=e.metadataRegistry.get(c[0])?.id;if(u){const m=i.get(u);if(m&&m!==c[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(u,c[0])}}const s=c=>{const u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(c[0])?.id,y=e.external.uri??(S=>S);if(g)return{ref:y(g)};const b=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=b,{defId:b,ref:`${y("__shared")}#/${u}/${sE(b)}`}}const m="#",h=`${m}/${u}/`;if(c[1]===n&&!c[1].schema.id)return{ref:m};const p=c[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:h+sE(p)}},l=c=>{if(c[1].schema.$ref)return;const u=c[1],{ref:m,defId:h}=s(c);u.def={...u.schema},h&&(u.defId=h);const p=u.schema;for(const g in p)delete p[g];p.$ref=m};if(e.cycles==="throw")for(const c of e.seen.entries()){const u=c[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
|
|
62
62
|
|
|
63
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const c of e.seen.entries()){const u=c[1];if(t===c[0]){l(c);continue}if(e.external){const h=e.external.registry.get(c[0])?.id;if(t!==c[0]&&h){l(c);continue}}if(e.metadataRegistry.get(c[0])?.id){l(c);continue}if(u.cycle){l(c);continue}if(u.count>1&&e.reused==="ref"){l(c);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function q2(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const i of t){if(!i||typeof i!="object")return;q2(i);const s=Object.keys(i);if(s.length!==1||s[0]!=="type")return;const l=i.type;for(const c of Array.isArray(l)?l:[l]){if(typeof c!="string")return;n.includes(c)||n.push(c)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const G2=new Set(["type","properties","required","additionalProperties"]),lE=["oneOf","anyOf"];function aE(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Sy(e){const t=[];for(const l of e){if(typeof l!="object"||l.type!=="object")return null;for(const c in l)if(!G2.has(c))return null;t.push(l)}const n={},i=new Set;for(const l of t){for(const c in l.properties){if(Object.prototype.hasOwnProperty.call(n,c))continue;const u=[];for(const h of t){const p=h.properties?.[c]??aE(h);p!=null&&(u.some(g=>JSON.stringify(g)===JSON.stringify(p))||u.push(p))}const m=u.length===1?u[0]:Sy(u)??{allOf:u};ri(n,c,m)}for(const c of l.required??[])i.add(c)}const s={type:"object",properties:n};if(i.size&&(s.required=[...i]),t.every(l=>l.additionalProperties===!1))s.additionalProperties=!1;else{const l=[];for(const c of t){const u=aE(c);u&&!l.some(m=>JSON.stringify(m)===JSON.stringify(u))&&l.push(u)}l.length===1?s.additionalProperties=l[0]:l.length>1&&(s.additionalProperties={allOf:l})}return s}function TH(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const s of G2)if(s in e)return;const n=t.filter(s=>lE.some(l=>Array.isArray(s[l])));let i=null;if(!n.length)i=Sy(t);else{const s=n[0],l=lE.find(m=>Array.isArray(s[m]));if(Object.keys(s).length!==1)return;const c=t.filter(m=>m!==s),u=s[l].map(m=>Sy([...c,m]));if(u.some(m=>!m))return;i={[l]:u}}i&&(delete e.allOf,du(e,i))}function Y2(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=u=>{const m=e.seen.get(u);if(m.ref===null)return;const h=m.def??m.schema,p={...h},g=m.ref;if(m.ref=null,g){i(g);const b=e.seen.get(g),S=b.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(S)):du(h,S),du(h,p),u._zod.parent===g)for(const E in h)E==="$ref"||E==="allOf"||E in p||delete h[E];if(S.$ref&&b.def)for(const E in h)E==="$ref"||E==="allOf"||E in b.def&&JSON.stringify(h[E])===JSON.stringify(b.def[E])&&delete h[E]}const y=u._zod.parent;if(y&&y!==g){i(y);const b=e.seen.get(y);if(b?.schema.$ref&&(h.$ref=b.schema.$ref,b.def))for(const S in h)S==="$ref"||S==="allOf"||S in b.def&&JSON.stringify(h[S])===JSON.stringify(b.def[S])&&delete h[S]}e.override({zodSchema:u,jsonSchema:h,path:m.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const u of[...e.seen.entries()].reverse())i(u[0]);if(e.target!=="openapi-3.0")for(const u of e.seen.entries())q2(u[1].def??u[1].schema);for(const u of e.deferred)u();if(e.intersections.length){const u=new Map;for(const m of e.seen.values())for(const h of[m.schema,m.def]){const p=h?.allOf;if(!Array.isArray(p))continue;const g=u.get(p);g?g.push(h):u.set(p,[h])}for(const m of e.intersections)for(const h of u.get(m)??[])TH(h)}}const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(u)}du(s,n.defId?n.schema:n.def??n.schema);const l=e.metadataRegistry.get(t)?.id;l!==void 0&&s.id===l&&delete s.id;const c=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const u of e.seen.entries()){const m=u[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,ri(c,m.defId,m.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?s.$defs=c:s.definitions=c);try{const u=JSON.parse(JSON.stringify(s));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:mh(t,"input",e.processors),output:mh(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function jr(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return jr(i.element,n);if(i.type==="set")return jr(i.valueType,n);if(i.type==="lazy")return jr(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return jr(i.innerType,n);if(i.type==="intersection")return jr(i.left,n)||jr(i.right,n);if(i.type==="record"||i.type==="map")return jr(i.keyType,n)||jr(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:jr(i.in,n)||jr(i.out,n);if(i.type==="object"){for(const s in i.shape)if(jr(i.shape[s],n))return!0;return!1}if(i.type==="union"){for(const s of i.options)if(jr(s,n))return!0;return!1}if(i.type==="tuple"){for(const s of i.items)if(jr(s,n))return!0;return!!(i.rest&&jr(i.rest,n))}return!1}const RH=(e,t={})=>n=>{const i=U2({...n,processors:t});return pr(e,i),Z2(i,e),Y2(i,e)},mh=(e,t,n={})=>i=>{const{libraryOptions:s,target:l}=i??{},c=U2({...s??{},target:l,io:t,processors:n});return pr(e,c),Z2(c,e),Y2(c,e)},jH={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},NH=(e,t,n,i)=>{const s=n;s.type="string";const{minimum:l,maximum:c,format:u,patterns:m,contentEncoding:h,laxFormat:p}=e._zod.bag;if(typeof l=="number"&&(s.minLength=l),typeof c=="number"&&(s.maxLength=c),u&&(s.format=jH[u]??u,s.format===""&&delete s.format,(u==="time"||p)&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const g=[...m];g.length===1?s.pattern=g[0].source:g.length>1&&(s.allOf=[...g.map(y=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},OH=(e,t,n,i)=>{const s=n,{minimum:l,maximum:c,format:u,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof u=="string"&&u.includes("int")?s.type="integer":s.type="number";const g=typeof p=="number"&&p>=(l??Number.NEGATIVE_INFINITY),y=typeof h=="number"&&h<=(c??Number.POSITIVE_INFINITY),b=t.target==="draft-04"||t.target==="openapi-3.0";g?b?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p:typeof l=="number"&&(s.minimum=l),y?b?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h:typeof c=="number"&&(s.maximum=c),typeof m=="number"&&(Number.isFinite(m)&&m!==0?s.multipleOf=Math.abs(m):Ka(e,t,s,i,`A multipleOf divisor of ${m} cannot be represented in JSON Schema`))},AH=(e,t,n,i)=>{n.type="boolean"},MH=(e,t,n,i)=>{n.not={}},zH=(e,t,n,i)=>{},IH=(e,t,n,i)=>{const s=e._zod.def,l=p2(s.entries);if(l.length===0){n.not={};return}l.every(c=>typeof c=="number")&&(n.type="number"),l.every(c=>typeof c=="string")&&(n.type="string"),n.enum=l},DH=(e,t,n,i)=>{Ka(e,t,n,i,"Custom types cannot be represented in JSON Schema")},_H=(e,t,n,i)=>{Ka(e,t,n,i,"Transforms cannot be represented in JSON Schema")},PH=(e,t,n,i)=>{const s=n,l=e._zod.def,{minimum:c,maximum:u}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof u=="number"&&(s.maxItems=u),s.type="array",s.items=pr(l.element,t,{...i,path:[...i.path,"items"]})};function ky(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?ky(t.out):t.type==="catch"?ky(t.innerType):e._zod.optin}const LH=(e,t,n,i)=>{const s=n,l=e._zod.def,c=l.shape;if(Object.getOwnPropertySymbols(c).length&&Ka(e,t,s,i,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(const p in c)ri(s.properties,p,pr(c[p],t,{...i,path:[...i.path,"properties",p]}));const m=new Set(Object.keys(c)),h=new Set([...m].filter(p=>{const g=l.shape[p];return t.io==="input"?ky(g)===void 0:g._zod.optout===void 0}));h.size>0&&(s.required=Array.from(h)),l.catchall?._zod.def.type==="never"?s.additionalProperties=!1:l.catchall?l.catchall&&(s.additionalProperties=pr(l.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},FH=(e,t,n,i)=>{const s=e._zod.def,l=s.inclusive===!1,c=s.options.map((u,m)=>pr(u,t,{...i,path:[...i.path,l?"oneOf":"anyOf",m]}));l?n.oneOf=c:n.anyOf=c},HH=(e,t,n,i)=>{const s=e._zod.def,l=pr(s.left,t,{...i,path:[...i.path,"allOf",0]}),c=pr(s.right,t,{...i,path:[...i.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,m=[...u(l)?l.allOf:[l],...u(c)?c.allOf:[c]];n.allOf=m,t.intersections.push(m)},BH=(e,t,n,i)=>{const s=e._zod.def,l=pr(s.innerType,t,i),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=s.innerType,n.nullable=!0):n.anyOf=[l,{type:"null"}]},VH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType},Gb=Symbol();function K2(e,t,n,i,s){let l=!1;const c=JSON.stringify(e,(u,m)=>typeof m!="bigint"?m:(l=!0,null));return l?(Ka(t,n,i,s,"BigInt defaults cannot be represented in JSON Schema"),Gb):JSON.parse(c)}const UH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType;const c=K2(s.defaultValue,e,t,n,i);c!==Gb&&(n.default=c)},ZH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);if(l.ref=s.innerType,t.io!=="input")return;const c=K2(s.defaultValue,e,t,n,i);c!==Gb&&(n._prefault=c)},qH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{Ka(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=c},GH=(e,t,n,i)=>{const s=e._zod.def,l=s.in._zod.traits.has("$ZodTransform"),c=t.io==="input"?l?s.out:s.in:s.out;pr(c,t,i);const u=t.seen.get(e);u.ref=c},YH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType,n.readOnly=!0},X2=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType},cE=new WeakSet([Object.prototype,Error.prototype]);function Rd(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}const KH=(e,t)=>{k2.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);cE.has(n)||(cE.add(n),Rd(n,"format",i=>s=>TF(i,s)),Rd(n,"flatten",i=>s=>C2(i,s)),Rd(n,"addIssue",i=>s=>{i.issues.push(s),i.message=JSON.stringify(i.issues,yy,2)}),Rd(n,"addIssues",i=>s=>{i.issues.push(...s),i.message=JSON.stringify(i.issues,yy,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Ei=Ce("ZodError",KH,void 0,{Parent:Error}),XH=Vb(Ei),JH=Ub(Ei),WH=lm(Ei),$H=am(Ei),QH=NF(Ei),eB=OF(Ei),tB=AF(Ei),nB=MF(Ei),rB=zF(Ei),iB=IF(Ei),oB=DF(Ei),sB=_F(Ei);function lB(){oo.localeError||qs(A9())}function Yb(){oo.memoizer||qs({memoizer:j9()})}const Hn=Ce("ZodType",(e,t)=>(lB(),Fn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(Us(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Zs(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(nV(e,t))},superRefine(e,t){return this.check(rV(e,t))},overwrite(e){return this.check(Ya(e))},optional(){return dE(this)},exactOptional(){return UB(this)},nullable(){return hE(this)},nullish(){return dE(hE(this))},nonoptional(e){return XB(this,e)},array(){return Yu(this)},or(e){return LB([this,e])},and(e){return HB(this,e)},transform(e){return mE(this,VB(e))},default(e){return GB(this,e)},prefault(e){return KB(this,e)},catch(e){return WB(this,e)},pipe(e){return mE(this,e)},readonly(){return eV(this)},describe(e){const t=this.clone();return ou.add(t,{description:e}),t},meta(...e){if(e.length===0)return ou.get(this);const t=this.clone();return ou.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return v2(this,"~standard",{...O2(this),jsonSchema:{input:mh(this,"input"),output:mh(this,"output")}})},set"~standard"(e){Ia(this,"~standard",e)},parse:function e(t,n){return XH(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await JH(this,t,n,{callee:e})},safeParse(e,t){return WH(this,e,t)},async safeParseAsync(e,t){return $H(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ia(this,"spa",e)},encode:function e(t,n){return QH(this,t,n,{callee:e})},decode:function e(t,n){return eB(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await tB(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await nB(this,t,n,{callee:e})},safeEncode(e,t){return rB(this,e,t)},safeDecode(e,t){return iB(this,e,t)},async safeEncodeAsync(e,t){return oB(this,e,t)},async safeDecodeAsync(e,t){return sB(this,e,t)},toJSONSchema(e){return RH(this,{})(e)},get description(){return ou.get(this)?.description},get _def(){return this._zod.def}}),J2=Ce("_ZodString",(e,t)=>{qb.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(i,s,l)=>NH(e,i,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(fH(...e))},includes(...e){return this.check(mH(...e))},startsWith(...e){return this.check(pH(...e))},endsWith(...e){return this.check(gH(...e))},min(...e){return this.check(hh(...e))},max(...e){return this.check(B2(...e))},length(...e){return this.check(V2(...e))},nonempty(...e){return this.check(hh(1,...e))},lowercase(e){return this.check(dH(e))},uppercase(e){return this.check(hH(e))},trim(){return this.check(yH())},normalize(...e){return this.check(xH(...e))},toLowerCase(){return this.check(bH())},toUpperCase(){return this.check(vH())},slugify(){return this.check(wH())}}),aB=Ce("ZodString",(e,t)=>{qb.init(e,t),J2.init(e,t)},{email(e){return this.check(D9(dB,e))},url(e){return this.check(B9(mB,e))},jwt(e){return this.check(nH(NB,e))},emoji(e){return this.check(V9(pB,e))},guid(e){return this.check(_9(hB,e))},uuid(e){return this.check(P9(jd,e))},uuidv4(e){return this.check(L9(jd,e))},uuidv6(e){return this.check(F9(jd,e))},uuidv7(e){return this.check(H9(jd,e))},nanoid(e){return this.check(U9(gB,e))},cuid(e){return this.check(Z9(xB,e))},cuid2(e){return this.check(q9(yB,e))},ulid(e){return this.check(G9(bB,e))},base64(e){return this.check(Q9(TB,e))},base64url(e){return this.check(eH(RB,e))},xid(e){return this.check(Y9(vB,e))},ksuid(e){return this.check(K9(wB,e))},ipv4(e){return this.check(X9(SB,e))},ipv6(e){return this.check(J9(kB,e))},cidrv4(e){return this.check(W9(EB,e))},cidrv6(e){return this.check($9(CB,e))},e164(e){return this.check(tH(jB,e))},datetime(e){return this.check(H2(W2,e))},date(e){return this.check(rH(cB,e))},time(e){return this.check(iH(uB,e))},duration(e){return this.check(oH(fB,e))}});function Le(e){return I9(aB,e)}const Rn=Ce("ZodStringFormat",(e,t)=>{Cn.init(e,t),J2.init(e,t)}),W2=Ce("ZodISODateTime",(e,t)=>{V8.init(e,t),Rn.init(e,t)}),cB=Ce("ZodISODate",(e,t)=>{U8.init(e,t),Rn.init(e,t)}),uB=Ce("ZodISOTime",(e,t)=>{Z8.init(e,t),Rn.init(e,t)}),fB=Ce("ZodISODuration",(e,t)=>{q8.init(e,t),Rn.init(e,t)}),dB=Ce("ZodEmail",(e,t)=>{j8.init(e,t),Rn.init(e,t)}),hB=Ce("ZodGUID",(e,t)=>{T8.init(e,t),Rn.init(e,t)}),jd=Ce("ZodUUID",(e,t)=>{R8.init(e,t),Rn.init(e,t)}),mB=Ce("ZodURL",(e,t)=>{I8.init(e,t),Rn.init(e,t)}),pB=Ce("ZodEmoji",(e,t)=>{D8.init(e,t),Rn.init(e,t)}),gB=Ce("ZodNanoID",(e,t)=>{_8.init(e,t),Rn.init(e,t)}),xB=Ce("ZodCUID",(e,t)=>{P8.init(e,t),Rn.init(e,t)}),yB=Ce("ZodCUID2",(e,t)=>{L8.init(e,t),Rn.init(e,t)}),bB=Ce("ZodULID",(e,t)=>{F8.init(e,t),Rn.init(e,t)}),vB=Ce("ZodXID",(e,t)=>{H8.init(e,t),Rn.init(e,t)}),wB=Ce("ZodKSUID",(e,t)=>{B8.init(e,t),Rn.init(e,t)}),SB=Ce("ZodIPv4",(e,t)=>{G8.init(e,t),Rn.init(e,t)}),kB=Ce("ZodIPv6",(e,t)=>{K8.init(e,t),Rn.init(e,t)}),EB=Ce("ZodCIDRv4",(e,t)=>{X8.init(e,t),Rn.init(e,t)}),CB=Ce("ZodCIDRv6",(e,t)=>{W8.init(e,t),Rn.init(e,t)}),TB=Ce("ZodBase64",(e,t)=>{$8.init(e,t),Rn.init(e,t)}),RB=Ce("ZodBase64URL",(e,t)=>{e9.init(e,t),Rn.init(e,t)}),jB=Ce("ZodE164",(e,t)=>{t9.init(e,t),Rn.init(e,t)}),NB=Ce("ZodJWT",(e,t)=>{r9.init(e,t),Rn.init(e,t)}),$2=Ce("ZodNumber",(e,t)=>{D2.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(i,s,l)=>OH(e,i,s,l);const 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},{gt(e,t){return this.check(iE(e,t))},gte(e,t){return this.check(mx(e,t))},min(e,t){return this.check(mx(e,t))},lt(e,t){return this.check(rE(e,t))},lte(e,t){return this.check(hx(e,t))},max(e,t){return this.check(hx(e,t))},int(e){return this.check(uE(e))},safe(e){return this.check(uE(e))},positive(e){return this.check(iE(0,e))},nonnegative(e){return this.check(mx(0,e))},negative(e){return this.check(rE(0,e))},nonpositive(e){return this.check(hx(0,e))},multipleOf(e,t){return this.check(oE(e,t))},step(e,t){return this.check(oE(e,t))},finite(){return this}});function zn(e){return sH($2,e)}const OB=Ce("ZodNumberFormat",(e,t)=>{i9.init(e,t),$2.init(e,t)});function uE(e){return lH(OB,e)}const AB=Ce("ZodBoolean",(e,t)=>{o9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>AH(e,n,i)});function Er(e){return aH(AB,e)}const MB=Ce("ZodUnknown",(e,t)=>{s9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>zH()});function fE(){return cH(MB)}const zB=Ce("ZodNever",(e,t)=>{l9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>MH(e,n,i)});function IB(e){return uH(zB,e)}const DB=Ce("ZodArray",(e,t)=>{Yb(),a9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>PH(e,n,i,s),e.element=t.element},{min(e,t){return this.check(hh(e,t))},nonempty(e){return this.check(hh(1,e))},max(e,t){return this.check(B2(e,t))},length(e,t){return this.check(V2(e,t))},unwrap(){return this.element}});function Yu(e,t){return SH(DB,e,t)}const _B=Ce("ZodObject",(e,t)=>{Yb(),f9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>LH(e,n,i,s),yF(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ho(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:fE()})},loose(){return this.clone({...this._zod.def,catchall:fE()})},strict(){return this.clone({...this._zod.def,catchall:IB()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return lF(this,e)},safeExtend(e){return aF(this,e)},merge(e){return cF(this,e)},pick(e){return oF(this,e)},omit(e){return sF(this,e)},partial(...e){return Pk(Q2,this,e[0])},exactPartial(...e){return Pk(ej,this,e[0],"exactPartial")},required(...e){return uF(tj,this,e[0])}});function ut(e,t){const n={type:"object",shape:e??{},...ot(t)};return new _B(n)}const PB=Ce("ZodUnion",(e,t)=>{d9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>FH(e,n,i,s),e.options=t.options});function LB(e,t){return new PB({type:"union",options:e,...ot(t)})}const FB=Ce("ZodIntersection",(e,t)=>{h9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>HH(e,n,i,s)});function HB(e,t){return new FB({type:"intersection",left:e,right:t})}const Ey=Ce("ZodEnum",(e,t)=>{m9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(i,s,l)=>IH(e,i,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(i,s)=>{const l={};for(const c of i)if(n.has(c))l[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Ey({...t,checks:[],...ot(s),entries:l})},e.exclude=(i,s)=>{const l={...t.entries};for(const c of i)if(n.has(c))delete l[c];else throw new Error(`Key ${c} not found in enum`);return new Ey({...t,checks:[],...ot(s),entries:l})}});function Ho(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Ey({type:"enum",entries:n,...ot(t)})}const BB=Ce("ZodTransform",(e,t)=>{Yb(),p9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>_H(e,n,i,s),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new w2(e.constructor.name);n.addIssue=l=>{if(typeof l=="string")n.issues.push(ju(l,n.value,t));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),"input"in c||(c.input=n.value),c.inst??(c.inst=e),n.issues.push(ju(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(l=>(n.value=l,n)):(n.value=s,n)}});function VB(e){return new BB({type:"transform",transform:e})}const Q2=Ce("ZodOptional",(e,t)=>{L2.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>X2(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function dE(e){return new Q2({type:"optional",innerType:e})}const ej=Ce("ZodExactOptional",(e,t)=>{g9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>X2(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function UB(e){return new ej({type:"optional",innerType:e})}const ZB=Ce("ZodNullable",(e,t)=>{x9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>BH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function hE(e){return new ZB({type:"nullable",innerType:e})}const qB=Ce("ZodDefault",(e,t)=>{y9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>UH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function GB(e,t){return new qB({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():x2(t)}})}const YB=Ce("ZodPrefault",(e,t)=>{b9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>ZH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function KB(e,t){return new YB({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():x2(t)}})}const tj=Ce("ZodNonOptional",(e,t)=>{v9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>VH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function XB(e,t){return new tj({type:"nonoptional",innerType:e,...ot(t)})}const JB=Ce("ZodCatch",(e,t)=>{w9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>qH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function WB(e,t){return new JB({type:"catch",innerType:e,catchValue:typeof t=="function"?t:vF(t)})}const $B=Ce("ZodPipe",(e,t)=>{S9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>GH(e,n,i,s),e.in=t.in,e.out=t.out});function mE(e,t){return new $B({type:"pipe",in:e,out:t})}const QB=Ce("ZodReadonly",(e,t)=>{k9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>YH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function eV(e){return new QB({type:"readonly",innerType:e})}const tV=Ce("ZodCustom",(e,t)=>{E9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>DH(e,n,i,s)});function nV(e,t={}){return kH(tV,e,t)}function rV(e,t){return EH(e,t)}function vi(e){return H2(W2,e)}function pE(e,t){let n=3735928559^t,i=1103547991^t;for(let s=0;s<e.length;s+=1){const l=e.charCodeAt(s);n=Math.imul(n^l,2654435761),i=Math.imul(i^l,1597334677)}return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&i)+(n>>>0)}function iV(e){const t=[e.path,e.oldPath??"",e.status,e.isBinary?"binary":"text",e.isUntracked?"untracked":"tracked",e.truncated?"clipped":"whole",`${e.additions},${e.deletions}`];for(const n of e.hunks){t.push(n.header);for(const i of n.lines)t.push(`${i.type[0]}${i.content}`)}return t.join("\0")}const oV=32;function sV(e){const t=iV(e);return`${pE(t,0).toString(16)}-${pE(t,2654435769).toString(16)}`}const um=120,Gs=zn().int().positive(),nj=ut({id:Gs,path:Le(),name:Le(),createdAt:vi(),updatedAt:vi()}),lV=ut({exists:Er(),isGitRepository:Er(),branch:Le().nullable(),detachedAt:Le().nullable(),isEmpty:Er(),rootCommit:Le().nullable(),error:Le().nullable()});nj.extend({git:lV});const aV=ut({path:Le().trim().min(1,"Choose a folder inside a git repository."),name:Le().trim().min(1,"Name cannot be empty.").max(um).optional()}),cV=ut({id:Gs,name:Le().trim().min(1,"Name cannot be empty.").max(um).optional(),path:Le().trim().min(1,"Path cannot be empty.").optional()}).refine(e=>e.name!==void 0||e.path!==void 0,{message:"Provide a new name or a new path.",path:["name"]});ut({id:Gs});ut({id:Gs});const Da=255,Ku=zn().int().positive(),rj=Ho(["ssh","wsl","websocket"]),ij=Le().trim().min(1,"Enter a host to connect to, like user@machine.").max(Da).refine(e=>!e.startsWith("-"),{message:'A host cannot start with "-".'}).refine(e=>!/[\s;&|`$(){}<>'"\\]/.test(e),{message:"A host can only contain a user name, an @ and a machine name."}),uV=Le().trim().min(1,"Choose a WSL distribution.").max(Da).refine(e=>!e.startsWith("-"),{message:'A distribution name cannot start with "-".'}).refine(e=>!/[\s;&|`$(){}<>'"\\/]/.test(e),{message:"That is not a WSL distribution name."}),fV=Le().trim().min(1,"Enter the machine, like pc-wsl or pc-wsl.tail0123.ts.net.").max(Da).refine(e=>!e.startsWith("-"),{message:'A machine name cannot start with "-".'}).refine(e=>{try{return new URL(/^https?:\/\//i.test(e)?e:`http://${e}`).hostname.length>0}catch{return!1}},{message:"That is not a machine name or an address."}).refine(e=>{const t=e.replace(/^https?:\/\//i,"").split(/[:/]/)[0]?.toLowerCase()??"";return t!=="localhost"&&t!=="127.0.0.1"&&t!=="::1"},{message:"That is this computer. A host is another machine."});function dV(e){return e==="wsl"?uV:e==="websocket"?fV:ij}ut({name:Le(),isDefault:Er(),running:Er(),alreadyAdded:Er()});const hV=ut({id:Ku,instanceId:Le().nullable(),label:Le(),kind:rj,target:Le(),editorTarget:Le().nullable(),lastSeenAt:vi().nullable(),daemonVersion:Le().nullable(),createdAt:vi()}),mV=ut({connected:Er(),failures:zn().int().nonnegative(),lastError:Le().optional(),retryAfter:zn().optional()}),pV=hV.extend({state:mV}),gV=ut({target:Le().trim().min(1).max(Da),label:Le().trim().min(1,"Name cannot be empty.").max(um).optional(),kind:rj.optional(),editorTarget:Le().trim().max(Da).optional()}).superRefine((e,t)=>{const n=dV(e.kind??"ssh").safeParse(e.target);if(!n.success)for(const i of n.error.issues)t.addIssue({code:"custom",message:i.message,path:["target"]})}),xV=ut({id:Ku,label:Le().trim().min(1,"Name cannot be empty.").max(um).optional(),target:ij.optional(),editorTarget:Le().trim().max(Da).nullable().optional()}).refine(e=>e.label!==void 0||e.target!==void 0||e.editorTarget!==void 0,{message:"Provide something to change.",path:["label"]});ut({id:Ku});ut({id:Ku});ut({id:Ku,force:Er().optional()});const yV=Ho(["installed","upgraded","already-current"]);ut({action:yV,version:Le(),previousVersion:Le().nullable(),target:Le(),bytes:zn().int().nonnegative(),host:pV});const oj=200,sj=2e4,bV=255,Br=zn().int().positive(),Kb=Ho(["open","closed"]),ph=Le().trim().min(1,"Choose a branch.").max(bV,"That ref name is too long.").refine(e=>!e.startsWith("-"),{message:'A ref cannot start with "-".'}),vV=ut({id:Br,repositoryId:Gs,title:Le(),description:Le(),baseRef:Le(),headRef:Le(),status:Kb,createdAt:vi(),updatedAt:vi(),closedAt:vi().nullable()});vV.extend({repository:nj});ut({repositoryId:Gs.optional(),status:Kb.optional()});const wV=ut({repositoryId:Gs,title:Le().trim().min(1,"Title cannot be empty.").max(oj).optional(),description:Le().max(sj).optional(),baseRef:ph,headRef:ph});function Xa(e){return e.baseRef===e.headRef}function SV(e,t){return Xa({baseRef:e,headRef:t})?`Uncommitted work on ${t}`:`${t} into ${e}`}const kV=ut({id:Br,title:Le().trim().min(1,"Title cannot be empty.").max(oj).optional(),description:Le().max(sj).optional(),baseRef:ph.optional(),headRef:ph.optional(),status:Kb.optional()}).refine(e=>e.title!==void 0||e.description!==void 0||e.baseRef!==void 0||e.headRef!==void 0||e.status!==void 0,{message:"Provide at least one field to change.",path:["title"]});ut({id:Br});ut({id:Br});ut({id:Br});const EV=["committed","all","uncommitted"],fm=Ho(EV).optional().default("all");ut({id:Br,changes:fm});ut({id:Br,changes:fm});const lj=ut({id:Br,path:Le().min(1).max(4096),changes:fm});lj.extend({side:Ho(["base","head"])});lj.extend({line:zn().int().min(1).optional().default(1),editorId:Le().max(64).optional(),host:Le().max(200).optional()});ut({id:Gs});ut({reviewId:Br,filePath:Le(),contentDigest:Le(),reviewedAt:Le()});ut({reviewId:Br});ut({reviewId:Br,filePath:Le().min(1).max(4096),contentDigest:Le().min(1).max(oV).nullable()});const CV=2e4,TV=60,Xb=zn().int().positive(),dm=zn().int().positive(),aj=Ho(["base","head"]),RV=ut({kind:Ho(["human","agent"]),name:Le(),label:Le().nullable(),session:Le().nullable()}),jV=ut({url:Le(),path:Le(),alt:Le(),mimeType:Le(),byteSize:zn().int(),width:zn().int().nullable(),height:zn().int().nullable()});ut({sha:Le(),url:Le(),path:Le(),mimeType:Le(),byteSize:zn().int(),width:zn().int().nullable(),height:zn().int().nullable(),originalName:Le().nullable()});const NV=ut({id:Xb,threadId:dm,author:RV,body:Le(),attachments:Yu(jV),createdAt:vi(),updatedAt:vi()}),OV=ut({type:Ho(["context","insert","delete"]),content:Le(),oldNumber:zn().int().nullable(),newNumber:zn().int().nullable()}),AV=ut({lines:Yu(OV),clipped:Er()});ut({id:dm,reviewId:Br,filePath:Le().nullable(),side:aj.nullable(),line:zn().int().positive().nullable(),startLine:zn().int().positive().nullable(),anchorText:Le().nullable(),anchorSha:Le().nullable(),anchorSnapshot:AV.nullable(),resolvedAt:vi().nullable(),resolvedBy:Le().nullable(),createdAt:vi(),updatedAt:vi(),comments:Yu(NV)});const Jb=Le().trim().min(1,"Write something first.").max(CV,"That comment is too long.");ut({reviewId:Br});ut({reviewId:Br,body:Jb,filePath:Le().trim().min(1).optional(),side:aj.optional().default("head"),line:zn().int().positive().optional(),startLine:zn().int().positive().optional(),changes:fm}).refine(e=>e.filePath===void 0==(e.line===void 0),{message:"A line comment needs both a file and a line number.",path:["line"]}).refine(e=>e.startLine===void 0||e.line!==void 0,{message:"A range needs a line to end at.",path:["startLine"]}).refine(e=>e.startLine===void 0||e.startLine<=(e.line??0),{message:"The range has to start at or before the line it ends on.",path:["startLine"]});ut({threadId:dm,body:Jb});ut({id:Xb,body:Jb});ut({id:Xb});ut({threadId:dm,resolved:Er()});Le().trim().min(1,"A label cannot be empty.").max(TV,"That label is too long.");ut({name:Le().regex(VM,"That is not an attachment name.")});ut({name:Le(),mimeType:Le(),byteSize:zn().int(),base64:Le()});ut({host:Le().max(200).optional()});ut({path:Le().max(4096).optional()});const MV=ut({name:Le(),path:Le(),isRepository:Er(),isHidden:Er()});ut({path:Le(),parent:Le().nullable(),home:Le(),separator:Le(),entries:Yu(MV),truncated:Er()});ut({available:Er(),dnsName:Le().nullable(),login:Le().nullable(),exposed:Er(),webRoot:Le().nullable()});ut({exposed:Er()});ut({dnsName:Le(),origin:Le(),instanceId:Le(),version:Le().nullable(),alreadyAdded:Le().nullable()});function _a(e,t){const n=e.safeParse(t);if(n.success)return n.data;const i=C2(n.error),s={};for(const[c,u]of Object.entries(i.fieldErrors))u&&u.length>0&&(s[c]=u);const l=i.formErrors[0]??Object.values(s)[0]?.[0]??"The values provided are not valid.";throw new Eh("INVALID_INPUT",l,s)}function zV({open:e,onOpenChange:t,host:n,onAdded:i}){return d.jsx(Ba,{open:e,onOpenChange:t,children:d.jsx(Va,{children:e&&d.jsx(IV,{host:n,onAdded:i,onDone:()=>t(!1)},n?.id??"new")})})}function IV({host:e,onDone:t,onAdded:n}){const i=e!==void 0,{addHost:s,updateHost:l}=qu(),{distros:c,isLoading:u}=S6(!i),{data:m}=dn(i?null:Ut.tailnet,()=>Lt.hosts.tailnet()),[h,p]=w.useState(e?.kind??"ssh"),[g,y]=w.useState(e?.target??""),[b,S]=w.useState(e?.label??""),[k,E]=w.useState(e?.editorTarget??""),[C,T]=w.useState(!1),[R,N]=w.useState(null),I=!i&&c!==void 0&&c.length>0,M=!i&&m?.available===!0,P=I||M;function A(F){F!==h&&(p(F),y(""),N(null))}async function L(F){F.preventDefault(),T(!0),N(null);try{if(e){const V=_a(xV,{id:e.id,label:b.trim(),...g.trim()!==e.target?{target:g.trim()}:{},editorTarget:k.trim()||null});await l(V)}else{const V=b.trim(),Y=k.trim(),te=_a(gV,{target:g.trim(),kind:h,...V?{label:V}:{},...Y?{editorTarget:Y}:{}}),O=await s(te);t(),n?.(O);return}t()}catch(V){N(V)}finally{T(!1)}}const D=wl(R,"target"),U=wl(R,"label"),q=R&&!D&&!U?Jt(R):null,K=h==="wsl",G=h==="websocket",B=!(i&&e.kind==="wsl");return d.jsxs("form",{onSubmit:F=>{L(F)},noValidate:!0,children:[d.jsxs(Zu,{children:[d.jsx(Ua,{children:i?"Edit host":"Add host"}),d.jsx(Za,{children:i?"Rename this machine, or point it somewhere else if the address changed.":K?"A Linux distribution running on this PC. GitWarren talks to it through wsl.exe — nothing to configure, and nothing listening on a port.":G?'A machine on your tailnet with "Reachable on your tailnet" turned on in its own GitWarren. Nothing is installed onto it from here — it is already running, and Tailscale is what says you are its owner.':"Anything your own ssh can reach: a config alias, a tailnet name, user@address. GitWarren never asks for a password — your SSH agent and config do the authenticating."})]}),d.jsxs("div",{className:"flex flex-col gap-4",children:[P&&d.jsxs(Ii,{children:[d.jsx(Di,{children:"Connect by"}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsx(px,{selected:h==="ssh",label:"SSH",onSelect:()=>A("ssh")}),M&&d.jsx(px,{selected:G,label:"Tailnet",onSelect:()=>A("websocket")}),I&&d.jsx(px,{selected:K,label:"WSL",onSelect:()=>A("wsl")})]})]}),B&&(K?d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"host-distro",children:"Distribution"}),d.jsx(DV,{distros:c??[],loading:u,selected:g,onSelect:y}),d.jsx(El,{children:D}),!D&&d.jsx(Es,{children:"GitWarren runs as that distribution's own default user."})]}):d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"host-target",children:G?"Machine":"SSH host"}),d.jsx(Os,{id:"host-target",value:g,onChange:F=>y(F.target.value),placeholder:G?"pc-wsl":"user@machine",className:"font-mono text-xs","data-invalid":D?"":void 0,autoComplete:"off",spellCheck:!1}),d.jsx(El,{children:D}),!D&&d.jsx(Es,{children:G?"Its name on your tailnet. No user name — Tailscale already knows who you are.":"Include the user name: a bare tailnet name asks for your local one."})]})),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"host-label",children:"Display name"}),d.jsx(Os,{id:"host-label",value:b,onChange:F=>S(F.target.value),placeholder:g.includes("@")?g.slice(g.indexOf("@")+1):"Defaults to the host","data-invalid":U?"":void 0,autoComplete:"off"}),d.jsx(El,{children:U}),!U&&!i&&d.jsxs(Es,{children:["Leave blank to use the ",K?"distribution":"machine"," name."]})]}),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"host-editor-target",children:"Editor host"}),d.jsx(Os,{id:"host-editor-target",value:k,onChange:F=>E(F.target.value),placeholder:K?g.trim()?`wsl+${g.trim()}`:"wsl+<distribution>":g.trim()||"Same as the SSH host",className:"font-mono text-xs",autoComplete:"off",spellCheck:!1}),d.jsxs(Es,{children:["Only if your editor knows this machine by a different name. Blank means the"," ",K?"distribution above":"SSH host above","."]})]}),q&&d.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:q})]}),d.jsxs(nm,{children:[d.jsx(Ve,{type:"button",variant:"ghost",onClick:t,children:"Cancel"}),d.jsxs(Ve,{type:"submit",disabled:C,children:[C&&d.jsx(wi,{className:"animate-spin"}),i?"Save changes":"Add host"]})]})]})}function px({selected:e,label:t,onSelect:n}){return d.jsx(Ve,{type:"button",variant:e?"secondary":"ghost",size:"sm","aria-pressed":e,onClick:n,children:t})}function DV({distros:e,loading:t,selected:n,onSelect:i}){return t?d.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[d.jsx(wi,{className:"size-3 animate-spin"})," Looking for distributions…"]}):e.length===0?d.jsx("p",{className:"text-muted-foreground text-sm",children:"This machine has no WSL distributions."}):d.jsx("div",{id:"host-distro",className:"flex flex-col gap-1",children:e.map(s=>d.jsxs("button",{type:"button",disabled:s.alreadyAdded,"aria-pressed":n===s.name,onClick:()=>i(s.name),className:Te("flex items-center justify-between rounded-md border px-3 py-2 text-left text-sm",n===s.name?"border-primary bg-primary/5":"border-border",s.alreadyAdded&&"cursor-not-allowed opacity-50"),children:[d.jsx("span",{className:"font-mono text-xs",children:s.name}),d.jsx("span",{className:"text-muted-foreground text-xs",children:s.alreadyAdded?"already added":[s.isDefault?"default":null,s.running?"running":"stopped"].filter(Boolean).join(" · ")})]},s.name))})}function _V(e){return QR("alert-dialog",e)}const hm=_V;function mm({className:e,children:t,...n}){return d.jsxs(WR,{children:[d.jsx(YR,{className:Te("fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] transition-opacity duration-150","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0")}),d.jsx(JR,{className:Te("fixed left-1/2 top-1/2 z-50 w-full max-w-md -translate-x-1/2 -translate-y-1/2","rounded-lg border border-border bg-card p-5 text-card-foreground shadow-xl","transition-all duration-150","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",e),...n,children:t})]})}function pm({className:e,...t}){return d.jsx("div",{className:Te("flex flex-col gap-1.5",e),...t})}function gm({className:e,...t}){return d.jsx(e2,{className:Te("text-base font-semibold leading-none tracking-tight",e),...t})}function xm({className:e,...t}){return d.jsx(KR,{className:Te("text-sm text-muted-foreground",e),...t})}function ym({className:e,...t}){return d.jsx("div",{className:Te("mt-5 flex justify-end gap-2",e),...t})}function gE(e){return`${(e/1e6).toFixed(1)} MB`}function PV(e){if(e.kind==="error")return`Could not install on “${e.label}”`;switch(e.report.action){case"installed":return`GitWarren is on “${e.label}”`;case"upgraded":return`“${e.label}” is up to date`;case"already-current":return`“${e.label}” was already up to date`}}function LV(e){if(e.kind==="error")return e.message;const{action:t,version:n,previousVersion:i,target:s,bytes:l}=e.report;switch(t){case"installed":return`Version ${n} for ${s}, ${gE(l)} sent over the connection. The launcher at ~/.gitwarren/bin/gitwarren is what everything points at from now on, so an agent configured against it will survive every update.`;case"upgraded":return`Upgraded from ${i??"an unknown version"} to ${n} for ${s}, ${gE(l)} sent. The old version is still in ~/.gitwarren/daemon if you need to go back to it.`;case"already-current":return`${n} is already installed for ${s}, so nothing was sent. Use it anyway if you think the install there is damaged — the button reinstalls when the version matches.`}}function FV({outcome:e,onClose:t}){const n=e?.kind==="error";return d.jsx(hm,{open:e!==null,onOpenChange:i=>{i||t()},children:d.jsxs(mm,{children:[d.jsxs(pm,{children:[d.jsxs(gm,{className:"flex items-center gap-2",children:[n?d.jsx(YC,{className:"size-5 shrink-0 text-destructive"}):d.jsx(GC,{className:"size-5 shrink-0 text-success"}),e&&PV(e)]}),d.jsx(xm,{className:"break-words",children:e&&d.jsx(Xn,{text:LV(e)})})]}),d.jsx(ym,{children:d.jsx(Ve,{onClick:t,children:"Close"})})]})})}function HV({host:e,onOpenChange:t}){const{removeHost:n}=qu(),[i,s]=w.useState(!1),[l,c]=w.useState(null);async function u(){if(e){s(!0),c(null);try{await n(e.id),t(!1)}catch(m){c(m)}finally{s(!1)}}}return d.jsx(hm,{open:e!==null,onOpenChange:m=>{m||c(null),t(m)},children:d.jsxs(mm,{children:[d.jsxs(pm,{children:[d.jsxs(gm,{children:["Forget “",e?.label,"”?"]}),d.jsxs(xm,{children:["This removes the machine from this GitWarren’s list. Nothing is uninstalled: the daemon under ",d.jsx("code",{children:"~/.gitwarren"})," over there stays where it is, and an agent configured against it keeps working."]})]}),e&&d.jsx("p",{"data-selectable":!0,className:"mt-3 break-words rounded-md bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:e.target})}),l!==null&&d.jsx("p",{role:"alert",className:"mt-3 text-sm text-destructive",children:Jt(l)}),d.jsxs(ym,{children:[d.jsx(Ve,{variant:"ghost",onClick:()=>t(!1),disabled:i,children:"Cancel"}),d.jsxs(Ve,{variant:"destructive",onClick:()=>{u()},disabled:i,children:[i&&d.jsx(wi,{className:"animate-spin"}),"Forget host"]})]})]})})}const cj=w.createContext(void 0);function BV(){const e=w.useContext(cj);if(e===void 0)throw new Error(En(63));return e}const uj={...Bs,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},VV=w.forwardRef(function(t,n){const{checked:i,className:s,defaultChecked:l,"aria-labelledby":c,form:u,id:m,inputRef:h,name:p,nativeButton:g=!1,onCheckedChange:y,readOnly:b=!1,required:S=!1,disabled:k=!1,render:E,uncheckedValue:C,value:T,style:R,...N}=t,{clearErrors:I}=Vs(),{state:M,setTouched:P,setDirty:A,validityData:L,setFilled:D,setFocused:U,validationMode:q,disabled:K,name:G,validation:B}=qi(),{labelId:F}=ki(),V=K||k,Y=G??p,te=w.useRef(null),O=Ui(te,h,B.inputRef),_=w.useRef(null),Z=Or(),z=qa({id:m,implicit:!1,controlRef:_}),J=g?void 0:z,[ne,W]=Io({controlled:i,default:!!l,name:"Switch",state:"checked"});Gu(_,Z,ne,void 0,!V,p),Me(()=>{te.current&&D(te.current.checked)},[D]),ks(ne,()=>{I(Y),A(ne!==L.initialValue),D(ne),B.change(ne)});const{getButtonProps:de,buttonRef:ie}=Lo({disabled:V,native:g}),oe=m2(c,F,te,!g,J),Se={id:g?z:Z,role:"switch","aria-checked":ne,"aria-readonly":b||void 0,"aria-required":S||void 0,"aria-labelledby":oe,onFocus(){V||U(!0)},onBlur(){const Re=te.current;!Re||V||(P(!0),U(!1),q==="onBlur"&&B.commit(Re.checked))},onClick(Re){if(b||V)return;Re.preventDefault();const Ie=te.current;Ie&&fu(Ie,Re)}},ye={...B.getValidationProps(V),checked:ne,disabled:V,form:u,id:J,name:Y,required:S,style:Y?Bu:Hu,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:O,onChange(Re){if(Re.nativeEvent.defaultPrevented)return;if(b){Re.preventDefault();return}const Ie=Re.currentTarget.checked,fe=Xe(On,Re.nativeEvent);y?.(Ie,fe),!fe.isCanceled&&W(Ie)},onClick(Re){Re.stopPropagation()},onFocus(){_.current?.focus()},...T!==void 0?{value:T}:wn},xe=w.useMemo(()=>({...M,checked:ne,disabled:V,readOnly:b,required:S}),[M,ne,V,b,S]),we=jt("span",t,{state:xe,ref:[n,_,ie],props:[Se,N,de,Re=>B.getValidationProps(V,Re)],stateAttributesMapping:uj});return d.jsxs(cj.Provider,{value:xe,children:[we,!ne&&Y&&C!==void 0&&d.jsx("input",{type:"hidden",form:u,name:Y,value:C,disabled:V}),d.jsx("input",{...ye,suppressHydrationWarning:!0})]})}),UV=w.forwardRef(function(t,n){const{render:i,className:s,style:l,...c}=t,u=BV();return jt("span",t,{state:u,ref:n,stateAttributesMapping:uj,props:c})});function Wb({className:e,...t}){return d.jsx(VV,{className:Te("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent","bg-muted transition-colors data-[checked]:bg-primary","disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:d.jsx(UV,{className:Te("pointer-events-none block size-4 translate-x-0.5 rounded-full bg-background shadow-sm transition-transform","data-[checked]:translate-x-[1.125rem]")})})}function ZV(){const{data:e,mutate:t}=Db(),[n,i]=w.useState(null),s=n!==null,[l,c]=w.useState(null),u=w.useRef(null);if(!e?.available)return null;async function m(h){i(h),c(null);try{await t(Lt.hosts.setTailnetExposure({exposed:h}),{revalidate:!1})}catch(p){c(Jt(p)),t()}finally{i(null)}}return d.jsxs(kt,{className:"flex flex-col gap-3 p-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(KI,{className:"size-4 shrink-0 text-muted-foreground"}),d.jsxs("label",{htmlFor:"tailnet-exposed",className:"min-w-40 flex-1 cursor-pointer",children:[d.jsx("span",{className:"block text-sm font-medium",children:"Reachable on your tailnet"}),d.jsxs("span",{className:"block text-xs text-muted-foreground",children:["Your other machines can add this one as a host, and you can open its reviews in a browser on any device signed in as ",e.login,"."]})]}),d.jsx(Wb,{id:"tailnet-exposed",checked:e.exposed,disabled:s,onCheckedChange:h=>{m(h)}})]}),s?d.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[d.jsx(wi,{className:"size-3 shrink-0 animate-spin"}),n?"Putting this machine on your tailnet…":"Taking it off your tailnet…"]}):null,!s&&e.exposed&&e.webRoot?d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("a",{ref:u,href:e.webRoot,target:"_blank",rel:"noreferrer noopener","data-selectable":!0,className:"min-w-0 flex-1 font-mono text-xs text-primary underline underline-offset-2 hover:no-underline",children:d.jsx(Xn,{text:e.webRoot})}),d.jsx(Eb,{label:"Copy this machine's tailnet address",text:e.webRoot,source:u,className:"shrink-0"})]}):null,l?d.jsx("p",{className:"text-xs text-destructive",children:l}):null]})}function qV(){const{hosts:e,error:t,isLoading:n,isRefreshing:i,refresh:s}=a2(),{probeHost:l,installOnHost:c}=qu(),{data:u}=dn(Ut.appInfo,()=>Lt.system.appInfo()),{data:m}=Db(),h=m?.available===!0,[p,g]=w.useState(!1),[y,b]=w.useState(void 0),[S,k]=w.useState(null),[E,C]=w.useState(null),[T,R]=w.useState(null),N=w.useCallback(()=>{b(void 0),g(!0)},[]);function I(L){b(L),g(!0)}async function M(L){C({id:L.id,what:"probe"});try{await l(L.id)}catch(D){R({kind:"error",label:L.label,message:Jt(D)})}finally{C(null)}}async function P(L){C({id:L.id,what:"probe"});try{await l(L.id)}catch{}finally{C(null)}}async function A(L){C({id:L.id,what:"install"});try{const D=await c(L.id);R({kind:"done",label:L.label,report:D})}catch(D){R({kind:"error",label:L.label,message:Jt(D)})}finally{C(null)}}return Il(w.useMemo(()=>[{id:"hosts:add",label:"Add host",group:"Hosts",keys:"n",keywords:"ssh machine remote server vps wsl",icon:Bi,run:N},{id:"hosts:refresh",label:"Refresh hosts",group:"Hosts",keys:"r",keywords:"reload reachable status",icon:sr,run:()=>{s()}}],[N,s])),d.jsxs("section",{className:"flex flex-col gap-4",children:[d.jsxs("div",{children:[d.jsxs(Ve,{variant:"ghost",size:"sm",className:"-ml-2 mb-2 text-muted-foreground",onClick:()=>An({name:"repositories"}),children:[d.jsx(Cs,{}),"Repositories"]}),d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Iu,{className:"size-5 shrink-0 text-muted-foreground"}),d.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Hosts"})]}),d.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n?"Loading…":`${e?.length??0} machine${e?.length===1?"":"s"}${i?" · refreshing…":""}`})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.jsx(Ln,{label:"Re-read reachability",children:d.jsx(Ve,{variant:"outline",size:"icon",onClick:()=>{s()},disabled:n,"aria-label":"Refresh",children:d.jsx(sr,{className:i?"animate-spin":void 0})})}),d.jsxs(Ve,{onClick:N,children:[d.jsx(Bi,{}),"Add host"]})]})]})]}),h&&d.jsx(xE,{children:"This machine"}),d.jsx(ZV,{}),h&&d.jsx(xE,{children:"Other machines"}),d.jsx(N6,{onAdded:L=>{P(L)}}),n&&d.jsx(GV,{}),!n&&t!==void 0&&d.jsx(KV,{error:t,onRetry:()=>{s()}}),!n&&t===void 0&&e?.length===0&&d.jsx(YV,{onAdd:N}),!n&&t===void 0&&e&&e.length>0&&d.jsx("ul",{className:"flex flex-col gap-2",children:e.map(L=>d.jsx("li",{children:d.jsx(O6,{host:L,appVersion:u?.version,busy:E?.id===L.id?E.what:null,onProbe:D=>{M(D)},onInstall:D=>{A(D)},onEdit:I,onRemove:k})},L.id))}),d.jsx(zV,{open:p,onOpenChange:g,host:y,onAdded:L=>{P(L)}}),d.jsx(HV,{host:S,onOpenChange:L=>{L||k(null)}}),d.jsx(FV,{outcome:T,onClose:()=>R(null)})]})}function xE({children:e}){return d.jsx("h2",{className:"-mb-1 mt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e})}function GV(){return d.jsx("ul",{className:"flex flex-col gap-2","aria-busy":"true","aria-label":"Loading hosts",children:[0,1].map(e=>d.jsx("li",{children:d.jsxs(kt,{className:"flex flex-col gap-3 p-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(yt,{className:"h-4 w-32"}),d.jsx(yt,{className:"h-4 w-24"})]}),d.jsx(yt,{className:"h-3 w-56"}),d.jsx(yt,{className:"h-8 w-40 rounded-md"})]})},e))})}function YV({onAdd:e}){return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-dashed px-6 py-14 text-center",children:[d.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground",children:d.jsx(Iu,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"No other machines yet"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Add a machine you can already reach over ssh — a PC’s WSL, a VPS, a build box — and GitWarren will install itself there over the same connection. The host needs nothing but git."})]}),d.jsxs(Ve,{onClick:e,className:"mt-1",children:[d.jsx(Bi,{}),"Add your first host"]})]})}function KV({error:e,onRetry:t}){return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-destructive/40 px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-destructive/10 p-3 text-destructive",children:d.jsx(Hi,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Could not load your hosts"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:Jt(e)})]}),d.jsxs(Ve,{variant:"outline",onClick:t,className:"mt-1",children:[d.jsx(sr,{}),"Try again"]})]})}function XV(){const{mutate:e}=_s();w.useEffect(()=>nT((t,n)=>{n.offlineSince===null&&e(i=>typeof i=="string"&&(i===Ut.hosts||i.endsWith(`@${t}`)))}),[e]),w.useEffect(()=>Lt.connection.subscribe(t=>{t&&e(()=>!0)}),[e])}function JV(e){switch(e){case"darwin":return"GitWarren opens in the menu bar when you log in, with no window.";case"win32":return"GitWarren opens in the notification area when you sign in, with no window.";default:return"GitWarren opens in the system tray when you log in, with no window."}}function WV(){const{data:e}=dn(Ut.appInfo,()=>Lt.system.appInfo()),{data:t,mutate:n}=dn(Lt.capabilities.openAtLogin?Ut.openAtLogin:null,()=>Lt.system.getOpenAtLogin()),[i,s]=w.useState(!1);if(!Lt.capabilities.openAtLogin||!e||t===void 0)return null;async function l(c){s(!0);try{await n(Lt.system.setOpenAtLogin(c),{optimisticData:c,revalidate:!1})}finally{s(!1)}}return d.jsxs(kt,{className:"flex items-center gap-3 p-4",children:[d.jsx(CD,{className:"size-4 shrink-0 text-muted-foreground"}),d.jsxs("label",{htmlFor:"open-at-login",className:"flex-1 cursor-pointer",children:[d.jsx("span",{className:"block text-sm font-medium",children:"Start GitWarren at login"}),d.jsx("span",{className:"block text-xs text-muted-foreground",children:JV(e.platform)})]}),d.jsx(Wb,{id:"open-at-login",checked:t,disabled:i,onCheckedChange:c=>{l(c)}})]})}function $V(e,t){const i=t.replace(/^\/+/,"").split("/").join("\\");return`\\\\wsl.localhost\\${e}${i?`\\${i}`:""}`}function fj(e){const t=$n(),{data:n}=dn(t===void 0?null:Ut.hosts,()=>Lt.hosts.list()),{data:i}=dn(t===void 0?null:Ut.appInfo,()=>Lt.system.appInfo());if(t===void 0)return e;if(n===void 0||i===void 0)return null;const s=n.find(l=>l.instanceId===t);return s===void 0||s.kind!=="wsl"||i.platform!=="win32"?null:$V(s.target,e)}function dj({className:e,...t}){return d.jsx("textarea",{className:Te("flex min-h-20 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50","data-[invalid]:border-destructive",e),...t})}function hj(e){const t=w.useRef(!0);t.current&&(t.current=!1,e())}function QV(e,t,n,i,s,l,c,u,m,h=2){const p=Q4(n.current,{event:e,orientation:i,loopFocus:s,rtl:l,cols:h,disabledIndices:c,minIndex:u,maxIndex:m,prevIndex:t>m?u:t,stopEvent:!0});return js(n.current,p)?void 0:p}const mj=w.createContext(void 0),pj=w.createContext(void 0),gj=w.createContext(void 0),xj=w.createContext(!1),yj=w.createContext("");function Ci(){const e=w.useContext(mj);if(!e)throw new Error(En(22));return e}function bm(){const e=w.useContext(pj);if(!e)throw new Error(En(23));return e}function Xu(){const e=w.useContext(gj);if(!e)throw new Error(En(24));return e}function bj(){return w.useContext(yj)}function eU(){return w.useContext(xj)}const vj=(e,t)=>Object.is(e,t);function Si(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function tU(e,t,n){return!e||e.length===0?!1:e.some(i=>i===void 0?!1:Si(t,i,n))}function ja(e,t,n){return!e||e.length===0?-1:e.findIndex(i=>i===void 0?!1:Si(i,t,n))}function gx(e,t,n,i){const s=i&&Array.isArray(t)?t[t.length-1]:t,l=ja(e,s,n);return l===-1?null:l}function wj(e,t,n){return e.filter(i=>!Si(t,i,n))}function Cy(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function $b(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Sj(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if($b(t)){for(const n of t)for(const i of n.items)if(i&&i.value==null&&i.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function pi(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Cy(e)}function _i(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Cy(e.value):Cy(e)}function Qb(e,t,n){function i(){return pi(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??i();if(Array.isArray(t)){const s=t,l=$b(s)?s.flatMap(c=>c.items):s;if(e==null||typeof e!="object"){const c=l.find(u=>u.value===e);return c&&c.label!=null?c.label:i()}if("value"in e){const c=l.find(u=>u&&u.value===e.value);if(c&&c.label!=null)return c.label}}return i()}function kj(e,t,n){return e.reduce((i,s,l)=>(l>0&&i.push(", "),i.push(d.jsx(w.Fragment,{children:Qb(s,t,n)},l)),i),[])}const Pe={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectedValue:e=>{const{selectedValue:t,selectionMode:n}=e;return t==null?!1:n==="multiple"&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Sj(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,i=e.selectedValue;return Array.isArray(i)?i.some(s=>Si(t,s,n)):Si(t,i,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function Ej(e){return e==null?void 0:`${e}-popup`}function nU(e,t){return(n,i)=>n==null?!1:e.contains(n,i,t)}function Cj(e){return Array.isArray(e)?e.map(t=>Cj(t)).join(","):e==null?"":String(e)}const yE=new Map;function rU(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${Cj(e.locale)}|${JSON.stringify(t)}`,i=yE.get(n);if(i)return i;const s=new Intl.Collator(e.locale,t),l={contains(c,u,m){if(!u)return!0;const h=pi(c,m);for(let p=0;p<=h.length-u.length;p+=1)if(s.compare(h.slice(p,p+u.length),u)===0)return!0;return!1},startsWith(c,u,m){if(!u)return!0;const h=pi(c,m);return s.compare(h.slice(0,u.length),u)===0},endsWith(c,u,m){if(!u)return!0;const h=pi(c,m),p=u.length;return h.length>=p&&s.compare(h.slice(h.length-p),u)===0}};return yE.set(n,l),l}const iU=rU;function oU(e,t=!1){const{overflowY:n}=Fr(e);return n!=="auto"&&n!=="scroll"?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}function Tj(e,t,n=(i,s)=>i===s){return e.length===t.length&&e.every((i,s)=>n(i,t[s]))}const Rj=Symbol("none"),xx={value:Rj,index:-1};function sU(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:i=null,selectedValue:s,onSelectedValueChange:l,defaultInputValue:c,inputValue:u,open:m,defaultOpen:h=!1,selectionMode:p,onItemHighlighted:g,name:y,form:b,disabled:S=!1,readOnly:k=!1,required:E=!1,inputRef:C,grid:T=!1,items:R,filteredItems:N,filter:I,openOnInputClick:M=!0,autoHighlight:P=!1,keepHighlight:A=!1,highlightItemOnHover:L=!0,loopFocus:D=!0,itemToStringLabel:U,itemToStringValue:q,isItemEqualToValue:K=vj,virtualized:G=!1,inline:B=!1,fillInputOnItemPress:F=!0,modal:V=!1,limit:Y=-1,autoComplete:te="list",formAutoComplete:O,locale:_,submitOnItemClick:Z=!1}=e,{clearErrors:z}=Vs(),{setDirty:J,validityData:ne,setFilled:W,name:de,disabled:ie,setTouched:oe,setFocused:Se,validationMode:ye,validation:xe}=qi(),we=Uu(),Re=qa({id:t}),Ie=iU({locale:_}),[fe,be]=w.useState(!1),[Oe,je]=w.useState(null),De=w.useRef([]),Ze=w.useRef([]),qe=w.useRef(null),ge=w.useRef(null),re=w.useRef(null),le=w.useRef(null),$=w.useRef(null),Q=w.useRef(!0),he=w.useRef(!1),Ne=w.useRef(null),_e=w.useRef(null),Ge=w.useRef(null),dt=w.useRef(xx),rt=w.useRef(null),at=w.useRef([]),Nt=w.useRef(null),Je=ie||S,_t=de??y,Fe=p==="multiple",pt=p==="single",Et=u!==void 0||c!==void 0,wt=R!==void 0,tt=N!==void 0;let ht;P==="always"?ht="always":ht=P?"input-change":!1;const[et,Wt]=Io({controlled:s,default:Fe?i??Pi:i,name:"Combobox",state:"selectedValue"}),Bn=w.useMemo(()=>I===null?()=>!0:I!==void 0?I:nU(Ie,U),[I,Ie,U]),In=Jn(()=>Et?c??"":pt?pi(et,U):"").current,[nn,Sn]=Io({controlled:u,default:In,name:"Combobox",state:"inputValue"}),[Ft,Ar]=Io({controlled:m,default:h,name:"Combobox",state:"open"}),lr=$b(R),st=Oe??String(nn).trim(),Yt=pt?pi(et,U):"",Vn=pt&&!fe&&st!==""&&Yt.length===st.length&&Ie.contains(Yt,st),Dn=Vn?"":st,gr=wt&&tt&&Vn,yn=w.useMemo(()=>R?lr?R.flatMap(He=>He.items):R:Pi,[R,lr]),Zt=w.useMemo(()=>{if(N&&!gr)return N;if(!R)return Pi;if(lr){const Ue=R,Kt=[];let Vt=0;for(const rn of Ue){if(Y>-1&&Vt>=Y)break;const nr=Y>-1?Y-Vt:1/0,on=Dn===""?rn.items.slice(0,nr):[];if(Dn!=="")for(const cr of rn.items){if(on.length>=nr)break;Bn(cr,Dn,U)&&on.push(cr)}if(on.length>0){const cr={...rn,items:on};Kt.push(cr),Vt+=on.length}}return Kt}if(Dn==="")return Y>-1?yn.slice(0,Y):yn;const He=[];for(const Ue of yn){if(Y>-1&&He.length>=Y)break;Bn(Ue,Dn,U)&&He.push(Ue)}return He},[N,gr,R,lr,Dn,Y,Bn,U,yn]),Ht=w.useMemo(()=>lr?Zt.flatMap(Ue=>Ue.items):Zt,[Zt,lr]),nt=Jn(()=>{let He=null;return B&&Ft&&wt&&p!=="none"&&(He=gx(Ht,et,K,Fe)),new XT({id:Re,labelId:void 0,selectedValue:et,open:Ft,items:R,selectionMode:p,listRef:De,labelsRef:Ze,popupRef:qe,emptyRef:$,inputRef:ge,startDismissRef:re,endDismissRef:le,keyboardActiveRef:Q,chipsContainerRef:Ne,clearRef:_e,valuesRef:at,pointerDownItemRef:Nt,selectionEventRef:Ge,name:_t,form:b,disabled:Je,readOnly:k,required:E,grid:T,virtualized:G,openOnInputClick:M,itemToStringLabel:U,isItemEqualToValue:K,modal:V,autoHighlight:ht,submitOnItemClick:Z,hasInputValue:Et,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:B,activeIndex:null,selectedIndex:He,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:wn,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:p==="none",onOpenChangeComplete:un,setOpen:un,setInputValue:un,setSelectedValue:un,setIndices:un,handleSelection:un,forceMount:un,requestSubmit:un})}).current,Tr=p==="none"?nn:et,Am=w.useMemo(()=>p==="none"?Tr:Array.isArray(et)?et.map(He=>_i(He,q)):_i(et,q),[Tr,q,p,et]),Mm=Ae(g),$a=Ae(n),Uo=pe(nt,Pe.activeIndex),Qa=pe(nt,Pe.selectedIndex),Ti=pe(nt,Pe.positionerElement),ao=pe(nt,Pe.listElement),Ri=pe(nt,Pe.triggerElement),ji=pe(nt,Pe.inputElement),Un=pe(nt,Pe.inputGroupElement),ar=pe(nt,Pe.inline),Ur=pe(nt,Pe.inputInsidePopup),co=pe(nt,Pe.inputOwnsFormValue),Zo=Tn(Ri),{mounted:ef,setMounted:tf,transitionStatus:Ll}=Al(Ft),{openMethod:nf,triggerProps:qo}=t2(Ft),Fl=Ae(()=>Am);Gu(Ur?Zo:ge,Re,Tr,Fl,!Je,y);const ii=Ae(()=>{R?Ze.current=Ht.map(He=>pi(He,U)):nt.set("forceMounted",!0)}),Qn=Ae((He,Ue,Kt)=>{if(Ue===-1){if(dt.current===xx)return;dt.current=xx}else dt.current={value:He,index:Ue};Mm(He,z4(Kt,void 0,{index:Ue}))}),Zr=Ae(He=>{nt.update(He);const Ue=He.activeIndex;if(Ue===void 0)return;const Kt=He.type||On;Ue===null?Qn(void 0,-1,Kt):Qn(at.current[Ue],Ue,Kt)}),oi=Ae((He,Ue)=>{if(he.current=Ue.reason===Qi,e.onInputValueChange?.(He,Ue),!Ue.isCanceled){if(Ue.reason===au){Ft&&Oe!==null&&je(null);const Kt=Ue.event,Vt=Kt.inputType;if(Kt.type==="compositionend"||Vt!=null&&Vt!==""&&Vt!=="insertReplacementText"){const nr=He.trim()!=="";nr&&be(!0),rt.current={hasQuery:nr};const on=nt.state.listElement;if(!nt.state.virtualized&&on){const cr=qe.current;for(const yr of Oa(on.firstElementChild??on)){if(!en(yr)||(cr?!$e(cr,yr):yr.getAttribute("role")==="dialog"))break;if(oU(yr)){yr.scrollTop=0;break}}}nr&&ht&&nt.state.activeIndex==null&&(Ft||ar)&&nt.set("activeIndex",0)}}else Ue.reason===Qi&&He===""&&nt.state.inputInsidePopup&&(rt.current={hasQuery:!1,selection:!0});Sn(He)}}),uo=Ae((He,Ue)=>{if(Ft!==He&&(Ue.reason===Fu&&wt&&Ht.length===0&&!$.current&&Ue.allowPropagation(),e.onOpenChange?.(He,Ue),!Ue.isCanceled&&(He&&Ur&&!ar&&Oe!==null&&(be(!1),je(null),nn!==""&&Ue.reason!==au&&oi("",Xe(Qi,Ue.event))),!He&&fe&&(pt?(ar||je(st),st===""&&be(!1)):Fe&&(ar||je(st),Ur&&Zr({activeIndex:null}),(!Ur||ar)&&oi("",Xe(Qi,Ue.event)))),Ar(He),!He&&Ur&&(Ue.reason===Lu||Ue.reason===_h)&&(oe(!0),Se(!1),ye==="onBlur")))){const Kt=p==="none"?nn:et;xe.commit(Kt)}}),Ks=Ae((He,Ue)=>{if(l?.(He,Ue),Ue.isCanceled)return;Wt(He),(p==="none"&&qe.current&&F||pt&&!nt.state.inputInsidePopup)&&oi(pi(He,U),Xe(Ue.reason,Ue.event))}),Hl=Ae((He,Ue)=>{const Kt=Mn(He),Vt=Ge.current??He;Ge.current=null;const rn=Xe(Fd,Vt),nr=Kt?.closest("a")?.getAttribute("href");if(nr){nr.startsWith("#")&&uo(!1,rn);return}if(Fe){const on=Array.isArray(et)?et:[],yr=tU(on,Ue,K)?wj(on,Ue,K):[...on,Ue];if(Ks(yr,rn),rn.isCanceled||!(ge.current?ge.current.value.trim()!=="":!1))return;nt.state.inputInsidePopup?oi("",Xe(Qi,rn.event)):uo(!1,rn)}else{if(Ks(Ue,rn),rn.isCanceled)return;uo(!1,rn)}}),zm=Ae(()=>{const He=xe.inputRef.current?.form??nt.state.inputElement?.form;He&&typeof He.requestSubmit=="function"&&He.requestSubmit()}),xr=Ae(()=>{if(tf(!1),$a?.(!1),be(!1),je(null),Zr(p==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Fe&&ge.current&&ge.current.value!==""&&!he.current&&oi("",Xe(Qi)),pt)if(nt.state.inputInsidePopup)ge.current&&ge.current.value!==""&&oi("",Xe(Qi));else{const He=pi(et,U);ge.current&&ge.current.value!==He&&oi(He,Xe(He===""?Qi:On))}}),ec=w.useMemo(()=>ar&&Ti?{current:Ti.closest('[role="dialog"]')}:qe,[ar,Ti]);Zi({enabled:!e.actionsRef,open:Ft,ref:ec,onComplete(){Ft||xr()}}),w.useImperativeHandle(e.actionsRef,()=>({unmount:xr}),[xr]),Me(function(){if(Ft||(Nt.current=null,p==="none"))return;const Ue=wt?yn:at.current;Zr({selectedIndex:gx(Ue,et,K,Fe)})},[Ft,et,p,Fe,wt,yn,K,Zr]),Me(()=>{R&&(at.current=Ht,De.current.length=Ht.length)},[R,Ht]),Me(()=>{const He=rt.current;if(He){const cr=Ft||ar||nt.state.positionerElement?.hidden===!1;if(He.hasQuery)ht&&cr&&nt.set("activeIndex",0),rt.current=null;else if(String(nn).trim()===""&&(rt.current=null,cr)){const yr=He.selection;ht==="always"&&!yr&&nt.state.selectionMode==="none"&&nt.set("activeIndex",0),queueMicrotask(()=>{if(!nt.state.open&&!nt.state.inline||ge.current&&ge.current.value.trim()!=="")return;const Gr=nt.state.selectedValue,Xo=nt.state.selectionMode==="multiple",br=Xo&&Array.isArray(Gr)?Gr[Gr.length-1]:Gr,Yi=nt.state.selectionMode!=="none"&&br!=null;if(Yi||yr){const Zl=wt||tt?Ht:at.current;nt.set("activeIndex",Yi?gx(Zl,Gr,nt.state.isItemEqualToValue,Xo):null)}else ht==="always"&&nt.set("activeIndex",0)})}}if(!Ft&&!ar)return;const Kt=wt||tt?Ht:at.current,Vt=nt.state.activeIndex;if(Vt==null){if(ht==="always"&&Kt.length>0){nt.set("activeIndex",0);return}Qn(void 0,-1,On);return}if(Vt>=Kt.length){Qn(void 0,-1,On),nt.set("activeIndex",null);return}const rn=Kt[Vt],nr=dt.current.value,on=nr!==Rj&&Si(rn,nr,nt.state.isItemEqualToValue);(dt.current.index!==Vt||!on)&&Qn(rn,Vt,On)},[Uo,ht,Qn,tt,wt,Ht,ar,Ft,nt,nn]),Me(()=>{if(p==="none"){W(String(nn)!=="");return}W(Fe?Array.isArray(et)&&et.length>0:et!=null)},[W,p,nn,et,Fe]),w.useEffect(()=>{wt&&ht&&Ht.length===0&&Zr({activeIndex:null})},[wt,ht,Ht.length,Zr]);function rf(He){const Ue=ne.initialValue;return Array.isArray(He)&&Array.isArray(Ue)?!Tj(He,Ue,(Kt,Vt)=>Si(Kt,Vt,K)):He!==Ue}ks(st,()=>{!Ft||st===""||st===String(In)||be(!0)});function Bl(){const He=pi(et,U);nn!==He&&oi(He,Xe(On))}ks(et,()=>{p!=="none"&&(z(_t),J(rf(et)),xe.change(et),pt&&!Et&&!Ur&&Bl())}),ks(nn,()=>{p==="none"&&(z(_t),J(nn!==ne.initialValue),xe.change(nn))}),ks(R,()=>{!pt||Et||Ur||fe||Bl()});const Ni=sR({open:ar?!0:Ft,onOpenChange:uo,elements:{reference:Ur?Ri:ji,floating:Ti}}),tc=T?"grid":"listbox",Xs=Ft||ar,fo=Xs?"true":"false",Vl=w.useMemo(()=>{const He=ji?.tagName==="INPUT",Ue=ji==null||He,Kt=Ue||Xs,Vt=Ue?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Kt&&(Vt.role="combobox",Vt["aria-expanded"]=fo,Vt["aria-haspopup"]=tc,Vt["aria-controls"]=Xs?ao?.id:void 0,Vt["aria-autocomplete"]=te),{reference:Vt,floating:{role:"presentation"}}},[ji,Xs,fo,tc,ao?.id,te]),nc=pb(Ni,{enabled:!k&&!Je&&M,event:"mousedown-only",toggle:!1,touchOpenDelay:Ur?0:100,reason:A4}),Js=Bh(Ni,{enabled:!k&&!Je&&!ar,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:ar?!0:void 0,outsidePress(He){const Ue=Mn(He);return!$e(Ri,Ue)&&!$e(_e.current,Ue)&&!$e(Ne.current,Ue)&&!$e(Un,Ue)}}),Gi=aR(Ni,{enabled:!k&&!Je,id:Re,listRef:De,activeIndex:Uo,selectedIndex:Qa,virtual:!0,loopFocus:D,allowEscape:D&&!ht,focusItemOnOpen:fe||p==="none"&&!ht?!1:"auto",focusItemOnHover:L,resetOnPointerLeave:!A,orientation:T?"horizontal":void 0,rtl:we==="rtl",disabledIndices:Pi,grid:T?QV:void 0,onNavigate(He,Ue){!Ue&&!Ft||Ll==="ending"||Zr(Ue?{activeIndex:He,type:Q.current?uT:fT}:{activeIndex:He})}}),rc=w.useMemo(()=>bi(Gi.reference,{onKeyDown(He){T&&nt.state.activeIndex==null&&(He.key==="ArrowLeft"||He.key==="ArrowRight")&&He.preventBaseUIHandler()}},Js.reference,nc.reference,Vl.reference),[Gi.reference,Js.reference,nc.reference,Vl.reference,T,nt]),ic=w.useMemo(()=>bi(qh,Js.floating),[Js.floating]),Go=w.useMemo(()=>bi(Gi.floating,Vl.floating),[Gi.floating,Vl.floating]),qr=w.useMemo(()=>{const He=Gi.item;return He?{...He,onFocus:void 0}:wn},[Gi.item]);hj(()=>{nt.update({inline:B,popupProps:ic,listProps:Go,inputProps:rc,triggerProps:qo,itemProps:qr,setOpen:uo,setInputValue:oi,setSelectedValue:Ks,setIndices:Zr,handleSelection:Hl,forceMount:ii,requestSubmit:zm,onOpenChangeComplete:$a})}),Me(()=>{nt.update({id:Re,selectedValue:et,open:Ft,mounted:ef,transitionStatus:Ll,items:R,inline:B,popupProps:ic,listProps:Go,inputProps:rc,triggerProps:qo,openMethod:nf,itemProps:qr,selectionMode:p,name:_t,form:b,disabled:Je,readOnly:k,required:E,grid:T,virtualized:G,openOnInputClick:M,itemToStringLabel:U,modal:V,autoHighlight:ht,isItemEqualToValue:K,submitOnItemClick:Z,hasInputValue:Et,inputOwnsFormValue:p==="none"&&(B||!nt.state.inputInsidePopup)})},[nt,Re,et,Ft,ef,Ll,R,ic,Go,rc,qr,nf,qo,p,_t,Je,k,E,T,G,M,U,V,K,Z,Et,B,ht,b]);const oc=Ui(C,xe.inputRef),sc=w.useMemo(()=>({query:st,hasItems:wt,filteredItems:Zt,flatFilteredItems:Ht}),[st,wt,Zt,Ht]),Yo=w.useMemo(()=>Array.isArray(Tr)?"":_i(Tr,q),[Tr,q]),Ko=Fe&&Array.isArray(et)&&et.length>0,Ul=Fe||p==="none"&&co?void 0:_t,lc=w.useMemo(()=>!Fe||!Array.isArray(et)||!_t?null:et.map(He=>{const Ue=_i(He,q);return d.jsx("input",{type:"hidden",form:b,name:_t,value:Ue,disabled:Je},Ue)}),[Fe,et,b,_t,q,Je]),of=d.jsxs(w.Fragment,{children:[e.children,d.jsx("input",{...xe.getValidationProps(Je,{onFocus(){if(Ur){Ri?.focus();return}(ge.current||Ri)?.focus()},onChange(He){if(He.nativeEvent.defaultPrevented||Je||k)return;const Ue=He.currentTarget.value,Kt=Ue.toLowerCase(),Vt=Xe(On,He.nativeEvent),rn=()=>at.current.findIndex(on=>_i(on,q).toLowerCase()===Kt||pi(on,U).toLowerCase()===Kt);function nr(){if(Fe)return;if(p==="none"){oi(Ue,Vt);return}let on=rn();on===-1&&(on=at.current.findIndex((yr,Gr)=>{const Xo=Ze.current[Gr];return Xo!=null&&Xo.toLowerCase()===Kt}));const cr=on===-1?void 0:at.current[on];cr!=null&&Ks?.(cr,Vt)}pt&&(ii(),R&&rn()===-1&&nt.set("forceMounted",!0)),queueMicrotask(nr)}}),id:Re&&Ul==null?`${Re}-hidden-input`:void 0,form:b,name:Ul,autoComplete:O,disabled:Je,required:E&&!Ko,readOnly:k,value:Yo,ref:oc,style:Ul?Bu:Hu,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),lc]});return d.jsx(mj.Provider,{value:nt,children:d.jsx(pj.Provider,{value:Ni,children:d.jsx(xj.Provider,{value:wt,children:d.jsx(gj.Provider,{value:sc,children:d.jsx(yj.Provider,{value:nn,children:of})})})})})}function lU(e){const{multiple:t=!1,defaultValue:n,value:i,onValueChange:s,autoComplete:l,...c}=e;return d.jsx(sU,{...c,selectionMode:t?"multiple":"single",selectedValue:i,defaultSelectedValue:n,onSelectedValueChange:s,formAutoComplete:l})}function jj(e,t){return e??t}function aU(e){const{children:t,placeholder:n}=e,i=Ci(),s=pe(i,Pe.itemToStringLabel),l=pe(i,Pe.selectedValue),c=pe(i,Pe.items),u=pe(i,Pe.selectionMode)==="multiple",m=pe(i,Pe.hasSelectedValue),h=!m&&n!=null&&t==null,p=pe(i,Pe.hasNullItemLabel,h);let g=null;return typeof t=="function"?g=t(l):t!=null?g=t:!m&&n!=null&&!p?g=n:u&&Array.isArray(l)?g=kj(l,c,s):g=Qb(l,c,s),d.jsx(w.Fragment,{children:g})}const Nj={...fR,...Bs,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},cU=w.createContext(void 0);function uU(){return w.useContext(cU)}const Oj=w.createContext(void 0);function ev(e){const t=w.useContext(Oj);if(t===void 0&&!e)throw new Error(En(21));return t}const Aj=w.forwardRef(function(t,n){const i=Ci(),{buttonRef:s,getButtonProps:l}=Lo({native:!1}),c=Ui(n,s);function u(h){i.state.setOpen(!1,Xe(cT,h.nativeEvent,h.currentTarget))}const m=l({onClick:u});return d.jsx("span",{ref:c,...m,"aria-label":"Dismiss",tabIndex:void 0,style:Bu})});function Mj(e){const t=pe(e,Pe.mounted),n=pe(e,Pe.popupSide),i=pe(e,Pe.positionerElement);return t&&i?n:null}function vm(){return Xu().filteredItems.length===0}function fU(e){return e==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function dU(e,t){const n=e>=t-1?t-2:e;return n>=0?n:void 0}function zj(e,t,n){const i=e.state.listRef.current[t];i&&(e.state.selectionEventRef.current=n,i.click(),e.state.selectionEventRef.current=null)}const hU=w.forwardRef(function(t,n){const{render:i,className:s,disabled:l=!1,id:c,style:u,...m}=t,{state:h,disabled:p,setTouched:g,setFocused:y,validationMode:b,validation:S}=qi(),{labelId:k}=ki(),E=uU(),T=!!ev(!0),R=Ci(),N=bj(),I=Uu(),M=pe(R,Pe.required),P=pe(R,Pe.disabled),A=pe(R,Pe.readOnly),L=pe(R,Pe.name),D=pe(R,Pe.form),U=pe(R,Pe.selectionMode),q=pe(R,Pe.autoHighlight),K=pe(R,Pe.inputProps),G=pe(R,Pe.triggerProps),B=pe(R,Pe.open),F=pe(R,Pe.mounted),V=pe(R,Pe.selectedValue),Y=pe(R,Pe.id),te=pe(R,Pe.inline),O=pe(R,Pe.modal),_=!!q,Z=Mj(R),z=p||P||l,J=vm(),ne=T||te,W=!ne||O,de=Or(c??(ne?void 0:Y)),ie=T?f2:h,[oe,Se]=w.useState(null),ye=w.useRef(!1),xe=w.useRef(null),we=w.useRef(!1),Re=U==="none"&&!T,Ie=Ae(ge=>{const re=T||R.state.inline;re&&!R.state.hasInputValue&&R.state.setInputValue("",Xe(On)),R.update({inputElement:ge,inputInsidePopup:re,inputOwnsFormValue:Re})}),fe=T?m:S.getValidationProps(z,m);function be(){R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?uT:fT})}function Oe(){R.state.keyboardActiveRef.current=!1}const je={...ie,open:B,disabled:z,readOnly:A,popupSide:Z,listEmpty:J};function De(ge){if(!E)return;let re;const{highlightedChipIndex:le}=E,$=E.chipsRef.current.length,[Q,he]=fU(I);return le!==void 0?(ge.key===Q?(ge.preventDefault(),le>0?re=le-1:re=void 0):ge.key===he?(ge.preventDefault(),le<$-1?re=le+1:re=void 0):(ge.key==="Backspace"||ge.key==="Delete")&&(ge.preventDefault(),re=dU(le,V.length),be()),re):(ge.key===Q&&(ge.currentTarget.selectionStart??0)===0&&V.length>0&&(ge.preventDefault(),re=$>0?$-1:void 0),re)}const Ze=jt("input",t,{state:je,ref:[n,R.state.inputRef,Ie],props:[K,G,{value:oe??N,"aria-readonly":A||void 0,"aria-required":M||void 0,"aria-labelledby":k,disabled:z,readOnly:A,required:U==="none"?M:void 0,form:D,...Re&&L&&{name:L},id:de,onFocus(){if(y(!0),!te||!we.current)return;we.current=!1;const ge=xe.current;ge==null||!Object.hasOwn(R.state.valuesRef.current,ge)||R.state.setIndices({activeIndex:ge})},onBlur(){g(!0),y(!1);const ge=R.state.activeIndex;if(te&&ge!==null&&q!=="always"&&(xe.current=ge,we.current=!0,R.state.setIndices({activeIndex:null})),b==="onBlur"){const re=U==="none"?N:V;S.commit(re)}},onCompositionStart(ge){Wd||(ye.current=!0,Se(ge.currentTarget.value))},onCompositionEnd(ge){ye.current=!1;const re=ge.currentTarget.value;Se(null),R.state.setInputValue(re,Xe(au,ge.nativeEvent))},onChange(ge){const re=ge.nativeEvent,le=re.inputType,$=!le||le==="insertReplacementText",Q=ye.current||!$;function he(dt){A||z||!dt||!Q||(R.state.setOpen(!0,Xe(au,re)),_||be())}if(ye.current){const dt=ge.currentTarget.value;Se(dt),dt===""&&!R.state.openOnInputClick&&!R.state.inputInsidePopup&&R.state.setOpen(!1,Xe(Qi,re));const rt=dt.trim(),at=_&&rt!=="";he(rt),B&&R.state.activeIndex!==null&&!at&&be();return}const Ne=Xe(au,re);if(R.state.setInputValue(ge.currentTarget.value,Ne),Ne.isCanceled)return;const _e=ge.currentTarget.value==="",Ge=Xe(Qi,re);_e&&!R.state.inputInsidePopup&&(U==="single"&&R.state.setSelectedValue(null,Ge),R.state.openOnInputClick||R.state.setOpen(!1,Ge)),he(ge.currentTarget.value.trim()),B&&R.state.activeIndex!==null&&!_&&be()},onKeyDown(ge){if(z||A||ge.ctrlKey||ge.shiftKey||ge.altKey||ge.metaKey)return;R.state.keyboardActiveRef.current=!0;const re=ge.currentTarget,le=re.scrollWidth-re.clientWidth,$=I==="rtl";if(ge.key==="Home"){or(ge);const Ne=NS&&$?re.value.length:0;re.setSelectionRange(Ne,Ne),re.scrollLeft=0;return}if(ge.key==="End"){or(ge);const Ne=NS&&$?0:re.value.length;re.setSelectionRange(Ne,Ne),re.scrollLeft=$?-le:le;return}if(!F&&ge.key==="Escape"){const Ne=U==="multiple"&&Array.isArray(V)?V.length===0:V===null,_e=Xe(Fu,ge.nativeEvent),Ge=U==="multiple"?[]:null;R.state.setInputValue("",_e),R.state.setSelectedValue(Ge,_e),!Ne&&!R.state.inline&&!_e.isPropagationAllowed&&ge.stopPropagation();return}if(E&&ge.key==="Backspace"&&re.value===""&&E.highlightedChipIndex===void 0&&Array.isArray(V)&&V.length>0){const Ne=E.chipsRef.current.length,_e=Ne>0?Ne-1:V.length-1,Ge=V.filter((dt,rt)=>rt!==_e);be(),R.state.setSelectedValue(Ge,Xe(On,ge.nativeEvent));return}const Q=E?.highlightedChipIndex!==void 0,he=De(ge);if(E?.setHighlightedChipIndex(he),he!==void 0?E?.chipsRef.current[he]?.focus():Q&&R.state.inputRef.current?.focus(),ge.which!==229&&ge.key==="Enter"&&B){const Ne=R.state.activeIndex,_e=ge.nativeEvent;if(Ne===null){if(te)return;R.state.setOpen(!1,Xe(On,_e));return}or(ge),zj(R,Ne,_e)}},onPointerMove:Oe,onPointerDown:Oe},fe],stateAttributesMapping:Nj}),qe=T?d.jsx(_b.Provider,{value:d2,children:Ze}):Ze;return d.jsxs(w.Fragment,{children:[B&&W&&d.jsx(Aj,{ref:R.state.startDismissRef}),qe]})}),Nd=5;function Ij(e,t){const n=mU(t);return e.clientX>=n.left-Nd&&e.clientX<=n.right+Nd&&e.clientY>=n.top-Nd&&e.clientY<=n.bottom+Nd}function mU(e){const t=e.getBoundingClientRect(),n=gn(e);if(Wy)return t;const i=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(i.content!=="none"||s.content!=="none"))return t;const c=parseFloat(i.width)||0,u=parseFloat(i.height)||0,m=parseFloat(s.width)||0,h=parseFloat(s.height)||0,p=Math.max(t.width,c,m),g=Math.max(t.height,u,h),y=p-t.width,b=g-t.height;return{left:t.left-y/2,right:t.right+y/2,top:t.top-b/2,bottom:t.bottom+b/2}}const pU=w.forwardRef(function(t,n){const{render:i,className:s,nativeButton:l=!0,disabled:c=!1,id:u,style:m,...h}=t,{state:p,disabled:g,setTouched:y,setFocused:b,validationMode:S,validation:k}=qi(),{labelId:E}=ki(),C=Ci(),T=pe(C,Pe.selectionMode),R=pe(C,Pe.disabled),N=pe(C,Pe.readOnly),I=pe(C,Pe.required),M=pe(C,Pe.positionerElement),P=pe(C,Pe.listElement),A=pe(C,Pe.popupId),L=pe(C,Pe.triggerProps),D=pe(C,Pe.inputInsidePopup),U=pe(C,Pe.id),q=pe(C,Pe.labelId),K=pe(C,Pe.open),G=pe(C,Pe.selectedValue),B=pe(C,Pe.activeIndex),F=pe(C,Pe.selectedIndex),V=pe(C,Pe.hasSelectedValue),Y=bm(),te=bj(),O=kr(),_=g||R||c,Z=vm(),z=Mj(C);qa({id:D?u:void 0});const J=D?u??U:u,ne=jj(E,q);let W;K&&D?W=A??Ej(U):K&&(W=P?.id);const de=w.useRef("");function ie(fe){de.current=fe.pointerType}const{reference:oe}=cR(Y,{enabled:!K&&!N&&!R&&T==="single",listRef:C.state.labelsRef,activeIndex:B,selectedIndex:F,onMatch(fe){const be=C.state.valuesRef.current[fe];be!==void 0&&C.state.setSelectedValue(be,Xe(On))}}),{reference:Se}=pb(Y,{enabled:!N&&!R,event:"mousedown"}),{buttonRef:ye,getButtonProps:xe}=Lo({native:l,disabled:_}),we={...p,open:K,disabled:_,popupSide:z,listEmpty:Z,placeholder:T==="none"?!1:!V},Re=Ae(fe=>{C.set("triggerElement",fe)});return jt("button",t,{ref:[n,ye,Re],state:we,props:[L,Se,oe,{id:J,tabIndex:D?0:-1,role:D?"combobox":void 0,"aria-expanded":K,"aria-haspopup":D?"dialog":"listbox","aria-controls":W,"aria-required":D&&I||void 0,"aria-labelledby":ne,onPointerDown:ie,onPointerEnter:ie,onFocus(){b(!0),!(_||N)&&O.start(0,C.state.forceMount)},onBlur(fe){if(!$e(M,fe.relatedTarget)&&(y(!0),b(!1),S==="onBlur")){const be=T==="none"?te:G;k.commit(be)}},onMouseDown(fe){if(_||N||(D||Y.set("domReferenceElement",fe.currentTarget),C.state.forceMount(),de.current!=="touch"&&(C.state.inputRef.current?.focus(),D||fe.preventDefault()),K))return;const be=Dt(fe.currentTarget);function Oe(je){const De=C.state.triggerElement;if(!De)return;const Ze=Mn(je),qe=C.state.positionerElement,ge=C.state.listElement;$e(De,Ze)||$e(qe,Ze)||$e(ge,Ze)||Ij(je,De)||C.state.setOpen(!1,Xe(dT,je))}D&&be.addEventListener("mouseup",Oe,{once:!0})},onKeyDown(fe){N||(fe.key==="ArrowDown"||fe.key==="ArrowUp")&&(or(fe),C.state.setOpen(!0,Xe(ny,fe.nativeEvent)),C.state.inputRef.current?.focus())}},k.getValidationProps(_,h),xe],stateAttributesMapping:Nj})}),Dj=w.createContext(null);function gU(){return w.useContext(Dj)}function xU(e){const{children:t,items:n}=e,i=w.useMemo(()=>({items:n}),[n]);return d.jsx(Dj.Provider,{value:i,children:t})}function _j(e){const{children:t}=e,{filteredItems:n}=Xu(),i=gU(),s=i?i.items:n;return d.jsx(w.Fragment,{children:s.map(t)})}const yU=w.forwardRef(function(t,n){var i;const{render:s,className:l,style:c,children:u,...m}=t,h=Ci(),p=bm(),g=!!ev(!0),{filteredItems:y,hasItems:b}=Xu(),S=pe(h,Pe.selectionMode),k=pe(h,Pe.grid),E=pe(h,Pe.listProps),C=pe(h,Pe.virtualized),T=pe(h,Pe.forceMounted),R=S==="multiple",N=y.length===0,I=Ae(q=>{h.set("positionerElement",q)}),M=Ae(q=>{h.set("listElement",q)}),P=w.useMemo(()=>typeof u=="function"?i||(i=d.jsx(_j,{children:u})):u,[u]),A={empty:N},L=p.useState("floatingId"),D=jt("div",t,{state:A,ref:[n,M,g?null:I],props:[E,{children:P,tabIndex:-1,id:L,role:k?"grid":"listbox","aria-multiselectable":R?"true":void 0,onKeyDown(q){if(!(h.state.disabled||h.state.readOnly)&&q.key==="Enter"){const K=h.state.activeIndex;if(K==null)return;or(q),zj(h,K,q.nativeEvent)}},onKeyDownCapture(){h.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){h.state.keyboardActiveRef.current=!1}},m]});if(C)return D;const U=b&&!T?void 0:h.state.labelsRef;return d.jsx($h,{elementsRef:h.state.listRef,labelsRef:U,children:D})}),bU="",vU=200;function wU(e){const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let n=null;for(;t.nextNode();){const i=t.currentNode;i.nodeValue!==""&&(n=i)}return n}function SU(){const e=kr(),t=w.useRef(null);return w.useEffect(()=>{if(Du)return;const n=t.current;if(n==null)return;const i=wU(n);if(i==null)return;const s=i.data,l=`${s}${bU}`;return i.nodeValue=l,e.start(vU,()=>{i.nodeValue===l&&(i.nodeValue=s)}),()=>{e.clear(),i.nodeValue===l&&(i.nodeValue=s)}},[t,e]),t}const Pj=w.createContext(void 0);function kU(){const e=w.useContext(Pj);if(e===void 0)throw new Error(En(20));return e}const EU=w.forwardRef(function(t,n){const{keepMounted:i=!1,...s}=t,l=Ci(),c=pe(l,Pe.mounted),u=pe(l,Pe.forceMounted);return c||i||u?d.jsx(Pj.Provider,{value:i,children:d.jsx(db,{ref:n,...s})}):null}),CU=20;function Lj(e,t,n,i){const[s,l]=w.useState(!1);Me(()=>{if(!e||!t||n==null){l(!1);return}const c=Dt(n).documentElement.clientWidth,u=n.offsetWidth;l(c>0&&u>0&&u>=c-CU)},[e,t,n]),$R(e&&(!t||s),i)}const TU=w.forwardRef(function(t,n){const{render:i,className:s,anchor:l,positionMethod:c,side:u,align:m,sideOffset:h,alignOffset:p,collisionBoundary:g="clipping-ancestors",collisionPadding:y,arrowPadding:b,sticky:S,disableAnchorTracking:k=!1,collisionAvoidance:E=PT,style:C,...T}=t,R=Ci(),N=bm(),I=kU(),M=pe(R,Pe.modal),P=pe(R,Pe.open),A=pe(R,Pe.mounted),L=pe(R,Pe.openMethod),D=pe(R,Pe.positionerElement),U=pe(R,Pe.triggerElement),q=pe(R,Pe.inputElement),K=pe(R,Pe.inputGroupElement),G=pe(R,Pe.inputInsidePopup),B=pe(R,Pe.transitionStatus),F=vm(),Y=vb({anchor:l??(G?U:K??q),floatingRootContext:N,positionMethod:c,mounted:A,side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:g,collisionPadding:y,sticky:S,disableAnchorTracking:k,keepMounted:I,collisionAvoidance:E,lazyFlip:!0});Lj(P&&M,L==="touch",D,U);const te={open:P,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,empty:F};Me(()=>{R.set("popupSide",Y.side)},[R,Y.side]);const O=Ae(Z=>{R.set("positionerElement",Z)}),_=wb(t,te,{styles:Y.positionerStyles,transitionStatus:B,props:T,refs:[n,O],hidden:!A,inert:!P});return d.jsxs(Oj.Provider,{value:Y,children:[A&&M&&d.jsx(Ab,{inert:Xh(!P),cutout:K??q??U}),_]})}),RU={...Vu,...Fs},jU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,initialFocus:c,finalFocus:u,...m}=t,h=Ci(),p=ev(),g=bm(),y=pe(h,Pe.mounted),b=pe(h,Pe.open),S=pe(h,Pe.openMethod),k=pe(h,Pe.popupProps),E=pe(h,Pe.transitionStatus),C=pe(h,Pe.inputInsidePopup),T=pe(h,Pe.inputElement),R=pe(h,Pe.modal),N=pe(h,Pe.id),I=vm(),M=m.id??(C?Ej(N):void 0);Me(()=>(h.set("popupId",h.state.popupRef.current?.id||M),()=>{h.set("popupId",void 0)}),[h,M]),Zi({open:b,ref:h.state.popupRef,onComplete(){b&&h.state.onOpenChangeComplete(!0)}});const P={open:b,side:p.side,align:p.align,anchorHidden:p.anchorHidden,transitionStatus:E,empty:I},A=jt("div",t,{state:P,ref:[n,h.state.popupRef],props:[k,{id:M,role:C?"dialog":"presentation",onFocus(K){const G=Mn(K.nativeEvent);S!=="touch"&&($e(h.state.listElement,G)||G===K.currentTarget)&&h.state.inputRef.current?.focus()}},Kh(E),m],stateAttributesMapping:RU}),D=c===void 0?C?K=>K==="touch"?h.state.popupRef.current:T:!1:c;let U;u!=null?U=u:U=C?void 0:!1;const q=!C||R;return d.jsx(mb,{context:g,disabled:!y,modal:q,openInteractionType:S,initialFocus:D,returnFocus:U,getInsideElements:()=>[h.state.startDismissRef.current,h.state.endDismissRef.current],children:d.jsxs(w.Fragment,{children:[A,q&&d.jsx(Aj,{ref:h.state.endDismissRef})]})})}),NU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,...c}=t;return jt("span",t,{ref:n,props:[{"aria-hidden":!0,children:"▼"},c]})}),Fj=w.createContext(void 0);function OU(){const e=w.useContext(Fj);if(e===void 0)throw new Error(En(18));return e}const AU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,items:c,...u}=t,[m,h]=w.useState(),p=w.useMemo(()=>({labelId:m,setLabelId:h,items:c}),[m,h,c]),g=jt("div",t,{ref:n,props:[{role:"group","aria-labelledby":m},u]}),y=d.jsx(Fj.Provider,{value:p,children:g});return c?d.jsx(xU,{items:c,children:y}):y}),MU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,id:c,...u}=t,{setLabelId:m}=OU(),h=Or(c);return Me(()=>(m(h),()=>{m(g=>g===h?void 0:g)}),[h,m]),jt("div",t,{ref:n,props:[{id:h},u]})}),Hj=w.createContext(void 0);function Bj(){const e=w.useContext(Hj);if(!e)throw new Error(En(19));return e}const zU=w.createContext(!1);function IU(){return w.useContext(zU)}function Vj(e){const{componentProps:t,forwardedRef:n,virtualized:i,indexFromFilter:s}=e,{render:l,className:c,style:u,value:m=null,index:h,disabled:p=!1,nativeButton:g=!1,...y}=t,b=w.useRef(null),S=em({guess:!0,index:h,textRef:b}),k=Ci(),E=IU(),C=eU(),T=pe(k,Pe.selectionMode),R=pe(k,Pe.disabled),N=pe(k,Pe.readOnly),I=pe(k,Pe.isItemEqualToValue),M=R||p,P=T!=="none",A=h??s??S.index,L=A!==-1,D=pe(k,Pe.id),U=pe(k,Pe.isActive,A),q=pe(k,Pe.isSelected,m),K=pe(k,Pe.itemProps),G=w.useRef(null),B=D!=null&&L?`${D}-${A}`:void 0,F=q&&P;Me(()=>{if(!(L&&(i||h!=null)))return;const ne=k.state.listRef.current;return ne[A]=G.current,()=>{delete ne[A]}},[L,i,A,h,k]),Me(()=>{if(!L||C)return;const J=k.state.valuesRef.current;return J[A]=m,()=>{delete J[A]}},[L,C,A,m,k]),Me(()=>{if(!L||C)return;const J=k.state.selectedValue,ne=Array.isArray(J)?J[J.length-1]:J;Si(m,ne,I)&&k.set("selectedIndex",A)},[L,C,k,A,m,I]);const{getButtonProps:V,buttonRef:Y}=Lo({disabled:M,focusableWhenDisabled:!0,native:g,composite:!0}),te={disabled:M,selected:F,highlighted:U};function O(J){function ne(){k.state.handleSelection(J,m)}k.state.submitOnItemClick?(Ls.flushSync(ne),k.state.requestSubmit()):ne()}const _={id:B,role:E?"gridcell":"option","aria-selected":P?F:void 0,tabIndex:void 0,onPointerDownCapture(J){J.isPrimary&&(k.state.pointerDownItemRef.current=J.currentTarget),J.preventDefault()},onMouseDown(J){J.preventDefault()},onClick(J){M||N||O(J.nativeEvent)},onMouseUp(J){const ne=k.state.pointerDownItemRef.current===J.currentTarget;k.state.pointerDownItemRef.current=null,!(M||N||J.button!==0||ne||!U)&&O(J.nativeEvent)}},Z=jt("div",t,{ref:[Y,n,S.ref,G],state:te,props:[K,_,y,V]}),z=w.useMemo(()=>({selected:F,textRef:b}),[F,b]);return d.jsx(Hj.Provider,{value:z,children:Z})}function DU(e){const{componentProps:t,forwardedRef:n}=e,i=Ci(),s=pe(i,Pe.isItemEqualToValue),{flatFilteredItems:l}=Xu(),c=ja(l,t.value??null,s);return d.jsx(Vj,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:c})}const _U=w.memo(w.forwardRef(function(t,n){const i=Ci(),s=pe(i,Pe.virtualized);return s&&t.index==null?d.jsx(DU,{componentProps:t,forwardedRef:n}):d.jsx(Vj,{componentProps:t,forwardedRef:n,virtualized:s,indexFromFilter:void 0})})),PU=w.forwardRef(function(t,n){const{selected:i}=Bj();return t.keepMounted||i?d.jsx(LU,{...t,ref:n}):null}),LU=w.memo(w.forwardRef((e,t)=>{const{render:n,className:i,style:s,keepMounted:l,...c}=e,{selected:u}=Bj(),m=w.useRef(null),{transitionStatus:h,setMounted:p}=Al(u),y=jt("span",e,{ref:[t,m],state:{selected:u,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},c],stateAttributesMapping:Fs});return Zi({open:u,ref:m,onComplete(){u||p(!1)}}),y})),FU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,children:c,...u}=t,{filteredItems:m}=Xu(),h=Ci(),p=SU(),g=m.length===0?c:null;return jt("div",t,{ref:[n,h.state.emptyRef,p],props:[{children:g,role:"status","aria-live":"polite","aria-atomic":!0},u]})}),HU=lU,BU=aU,VU=_j;function UU({className:e,children:t,...n}){return d.jsxs(pU,{className:Te("flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent","px-3 py-1 text-left text-sm shadow-sm transition-colors","hover:bg-muted/50 disabled:cursor-not-allowed disabled:opacity-50","data-[invalid]:border-destructive",e),...n,children:[t,d.jsx(NU,{className:"shrink-0 text-muted-foreground",children:d.jsx(qC,{className:"size-4"})})]})}function ZU({className:e,children:t,minWidth:n="24rem",...i}){return d.jsx(EU,{children:d.jsx(TU,{align:"start",sideOffset:4,className:"z-50 outline-none",children:d.jsx(jU,{style:{width:`max(var(--anchor-width), ${n})`},className:Te("flex max-h-[min(28rem,var(--available-height))] max-w-[var(--available-width)] flex-col","overflow-hidden rounded-md border border-border bg-card text-card-foreground shadow-lg","transition-[opacity,transform] duration-100","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",e),...i,children:t})})})}function qU({className:e,...t}){return d.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3",children:[d.jsx(Rl,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),d.jsx(hU,{className:Te("h-9 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",e),...t})]})}function GU({className:e,...t}){return d.jsx(yU,{className:Te("min-h-0 flex-1 overflow-y-auto overscroll-contain p-1 outline-none",e),...t})}function YU({className:e,...t}){return d.jsx(FU,{className:Te("px-3 py-6 text-center text-sm text-muted-foreground empty:p-0",e),...t})}function KU({className:e,...t}){return d.jsx(AU,{className:Te("block pb-1 last:pb-0",e),...t})}function XU({className:e,...t}){return d.jsx(MU,{className:Te("px-2 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",e),...t})}function JU({className:e,children:t,...n}){return d.jsxs(_U,{className:Te("relative flex cursor-default select-none items-start gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none","data-[highlighted]:bg-muted data-[highlighted]:text-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[t,d.jsx(PU,{className:"absolute right-2 top-1.5 flex items-center text-primary",children:d.jsx(Li,{className:"size-4"})})]})}const WU=[{kind:"local-branch",label:"Branches",icon:Kx},{kind:"remote-branch",label:"Remote branches",icon:Kx},{kind:"tag",label:"Tags",icon:$C}];function bE({id:e,refs:t,value:n,onChange:i,disabled:s,invalid:l}){const[c,u]=w.useState(""),m=w.useMemo(()=>{const b=new Map;for(const S of t)b.set(S.name,S);return b},[t]),h=w.useMemo(()=>WU.map(({kind:b,label:S})=>({value:S,items:t.filter(k=>k.kind===b).map(k=>k.name)})).filter(b=>b.items.length>0),[t]),{groups:p,marks:g}=w.useMemo(()=>{const b=c.trim();if(b==="")return{groups:h,marks:new Map};const S=new Map,k=[];for(const E of h){const C=[];for(const T of E.items){const R=ch(b,T);R!==null&&(S.set(T,R.indices),C.push({name:T,score:R.score}))}C.length!==0&&(C.sort((T,R)=>R.score-T.score),k.push({value:E.value,items:C.map(T=>T.name)}))}return{groups:k,marks:S}},[h,c]),y=b=>m.get(b)?.kind==="tag"?$C:Kx;return d.jsxs(HU,{items:h,filteredItems:p,value:n,onValueChange:b=>i(typeof b=="string"?b:""),onInputValueChange:u,disabled:s,children:[d.jsx(UU,{id:e,"data-invalid":l?"":void 0,children:d.jsx("span",{className:"min-w-0 truncate font-mono text-xs",title:n||void 0,children:d.jsx(BU,{placeholder:"Pick a ref"})})}),d.jsxs(ZU,{minWidth:"26rem","aria-label":"Select a branch or tag",children:[d.jsx(qU,{placeholder:"Search branches and tags"}),d.jsx(YU,{children:"No branch or tag matches that."}),d.jsx(GU,{children:b=>d.jsxs(KU,{items:b.items,children:[d.jsx(XU,{children:b.value}),d.jsx(VU,{children:S=>{const k=m.get(S),E=y(S);return d.jsxs(JU,{value:S,children:[d.jsx(E,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground"}),d.jsx("span",{className:"min-w-0 flex-1 break-words font-mono text-xs",children:d.jsx(qR,{text:S,indices:g.get(S)??[]})}),k?.hasUncommittedChanges&&d.jsxs("span",{className:"mt-0.5 flex shrink-0 items-center gap-1 text-[0.6875rem] font-medium text-warning",title:`Uncommitted changes in ${k.checkedOutAt??"its worktree"}`,children:[d.jsx(As,{className:"size-3"}),"uncommitted"]})]},S)}})]},b.value)})]})]})}const Dl={revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1};function _l(e){return{data:e.data,error:e.error,isLoading:e.isLoading,isRefreshing:e.isValidating&&!e.isLoading,refresh:e.mutate}}function $U(e,t){const n=Wn(),i=$n();return _l(dn(Ut.reviews(e,t,i),()=>n.reviews.list({...e===void 0?{}:{repositoryId:e},...t===void 0?{}:{status:t}})))}function tv(e){const t=Wn(),n=$n();return dn(Ut.review(e,n),()=>t.reviews.open({id:e}),{revalidateOnFocus:!0,refreshInterval:15e3})}function QU(e){const t=tv(e);return _l({...t,data:t.data?.review})}function e7(e){const t=tv(e);return _l({...t,data:t.data?.threads})}function Uj(e){const t=Wn(),n=$n();return _l(dn(Ut.reviewCommits(e,n),()=>t.reviews.commits({id:e}),Dl))}const wm="all";function Sm(e,t){const n=Wn(),i=$n();return _l(dn(Ut.reviewDiff(e,t,i),()=>n.reviews.diff({id:e,changes:t}),Dl))}function t7(e,t){const n=Wn(),i=$n();return _l(dn(Ut.reviewTree(e,t,i),()=>n.reviews.tree({id:e,changes:t}),Dl))}function Zj(e,t,n){const i=Wn(),s=$n(),[l,c]=w.useState(!1),u=dn(l&&e!==null?Ut.reviewFile(e,t,n,s):null,()=>i.reviews.file({id:e,path:t,changes:n}),Dl);return{content:u.data,error:u.error,isLoading:u.isLoading,requested:l,load:w.useCallback(()=>c(!0),[])}}function n7(e,t,n,i){const s=Wn(),l=$n(),c=dn(t===null?null:Ut.reviewImage(e,t,n,i,l),()=>s.reviews.image({id:e,path:t,side:n,changes:i}),Dl);return{image:c.data,error:c.error,isLoading:c.isLoading}}function qj(){return dn(Ut.editors,()=>Lt.system.editors(),{...Dl,revalidateOnMount:!0}).data}function r7(e){const t=Wn(),n=$n();return _l(dn(e===null?null:Ut.repositoryRefs(e,n),()=>t.repositories.refs({id:e}),Dl))}const i7=[];function o7(e){const t=Wn(),{data:n,isLoading:i,mutate:s}=tv(e),l=n?.reviewedFiles??i7,c=w.useMemo(()=>new Map(l.map(m=>[m.filePath,m.contentDigest])),[l]),u=w.useCallback(async(m,h)=>{if(!n){await t.reviews.setFileReviewed({reviewId:e,filePath:m,contentDigest:h}),await s();return}const p=n.reviewedFiles.filter(y=>y.filePath!==m),g={...n,reviewedFiles:h===null?p:[...p,{reviewId:e,filePath:m,contentDigest:h,reviewedAt:new Date().toISOString()}]};await s(async()=>(await t.reviews.setFileReviewed({reviewId:e,filePath:m,contentDigest:h}),g),{optimisticData:g,revalidate:!1,rollbackOnError:!0})},[t,n,s,e]);return{digests:c,isLoading:i,setReviewed:u}}function nv(){const e=Wn(),{mutate:t}=_s(),n=w.useCallback(()=>t(i=>typeof i=="string"&&Object.values(ws).some(s=>i.startsWith(s))),[t]);return{createReview:w.useCallback(async i=>{const s=await e.reviews.create(i);return await n(),s},[e,n]),updateReview:w.useCallback(async i=>{const s=await e.reviews.update(i);return await n(),s},[e,n]),removeReview:w.useCallback(async i=>{await e.reviews.remove({id:i}),await n()},[e,n])}}function Gj({open:e,onOpenChange:t,repositoryId:n,review:i,onCreated:s}){return d.jsx(Ba,{open:e,onOpenChange:t,children:d.jsx(Va,{className:"max-w-2xl",children:e&&d.jsx(s7,{repositoryId:n,review:i,onDone:()=>t(!1),...s?{onCreated:s}:{}},i?.id??"new")})})}function s7({repositoryId:e,review:t,onDone:n,onCreated:i}){const s=t!==void 0,{createReview:l,updateReview:c}=nv(),{data:u,isLoading:m,error:h}=r7(e),[p,g]=w.useState(t?.baseRef),[y,b]=w.useState(t?.headRef),[S,k]=w.useState(t?.title??""),[E,C]=w.useState(t?.description??""),[T,R]=w.useState(!1),[N,I]=w.useState(null),M=p??u?.defaultBranch??"",P=y??u?.currentBranch??"",A=u?.refs??[],L=A.find(V=>V.name===P),D=M!==""&&Xa({baseRef:M,headRef:P});async function U(V){V.preventDefault(),R(!0),I(null);try{const Y=S.trim();if(t){const te=_a(kV,{id:t.id,...Y&&Y!==t.title?{title:Y}:{},...E!==t.description?{description:E}:{},...M!==t.baseRef?{baseRef:M}:{},...P!==t.headRef?{headRef:P}:{}});await c(te)}else{const te=_a(wV,{repositoryId:e,baseRef:M,headRef:P,...Y?{title:Y}:{},...E?{description:E}:{}}),O=await l(te);i?.(O)}n()}catch(Y){I(Y)}finally{R(!1)}}const q=wl(N,"baseRef"),K=wl(N,"headRef"),G=wl(N,"title"),B=N&&!q&&!K&&!G?Jt(N):null,F=s&&S.trim()===t.title&&E===t.description&&M===t.baseRef&&P===t.headRef;return d.jsxs("form",{onSubmit:V=>{U(V)},noValidate:!0,children:[d.jsxs(Zu,{children:[d.jsx(Ua,{children:s?"Edit review":"New review"}),d.jsx(Za,{children:"Changes are compared from where the two refs diverged, the way a pull request is. Pick the same ref twice to review only what is uncommitted on it."})]}),d.jsxs("div",{className:"flex flex-col gap-4",children:[m&&d.jsxs("div",{className:"flex items-end gap-2",children:[d.jsx(yt,{className:"h-9 flex-1"}),d.jsx(yt,{className:"mb-2 size-4"}),d.jsx(yt,{className:"h-9 flex-1"})]}),!m&&h!==void 0&&d.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:Jt(h)}),!m&&h===void 0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-end gap-2",children:[d.jsxs(Ii,{className:"min-w-0 flex-1",children:[d.jsx(Di,{htmlFor:"review-base",children:"Base"}),d.jsx(bE,{id:"review-base",refs:A,value:M,onChange:g,invalid:q!==void 0})]}),d.jsx(Th,{className:"mb-2.5 size-4 shrink-0 text-muted-foreground"}),d.jsxs(Ii,{className:"min-w-0 flex-1",children:[d.jsx(Di,{htmlFor:"review-head",children:"Compare"}),d.jsx(bE,{id:"review-head",refs:A,value:P,onChange:b,invalid:K!==void 0})]})]}),(q??K)!==void 0&&d.jsx(El,{children:q??K}),D&&d.jsxs("p",{className:`flex items-start gap-2 rounded-md px-3 py-2 text-xs ${L?.hasUncommittedChanges?"bg-warning/10 text-warning":"bg-muted/60 text-muted-foreground"}`,children:[d.jsx(As,{className:"mt-0.5 size-3.5 shrink-0"}),L?.hasUncommittedChanges?d.jsxs("span",{children:["This review is ",d.jsx("span",{className:"font-mono",children:P})," against itself, so it holds only the uncommitted work in"," ",d.jsx("span",{"data-selectable":!0,className:"font-mono",children:L.checkedOutAt}),"."]}):d.jsxs("span",{children:["This review is ",d.jsx("span",{className:"font-mono",children:P})," against itself, so it holds only uncommitted work. There is none right now — it will fill in as you edit."]})]}),!D&&L?.hasUncommittedChanges&&d.jsxs("p",{className:"flex items-start gap-2 rounded-md bg-warning/10 px-3 py-2 text-xs text-warning",children:[d.jsx(As,{className:"mt-0.5 size-3.5 shrink-0"}),d.jsxs("span",{children:[d.jsx("span",{className:"font-mono",children:L.name})," has uncommitted changes in"," ",d.jsx("span",{"data-selectable":!0,className:"font-mono",children:L.checkedOutAt}),". They will be part of this review."]})]}),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"review-title",children:"Title"}),d.jsx(Os,{id:"review-title",value:S,onChange:V=>k(V.target.value),placeholder:M&&P?SV(M,P):"Describe the change","data-invalid":G?"":void 0,autoComplete:"off"}),d.jsx(El,{children:G}),!G&&!s&&d.jsx(Es,{children:"Leave blank to name it after the two refs."})]}),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"review-description",children:"Description"}),d.jsx(dj,{id:"review-description",value:E,onChange:V=>C(V.target.value),placeholder:"What should a reviewer know before reading the diff?",rows:4}),d.jsx(Es,{children:"Optional. Shown at the top of the conversation."})]})]}),B&&d.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:B})]}),d.jsxs(nm,{children:[d.jsx(Ve,{type:"button",variant:"ghost",onClick:n,children:"Cancel"}),d.jsxs(Ve,{type:"submit",disabled:T||m||!M||!P||F,children:[T&&d.jsx(wi,{className:"animate-spin"}),s?"Save changes":"Create review"]})]})]})}const vE=[{value:"open",label:"Open"},{value:"closed",label:"Closed"},{value:"all",label:"All"}];function l7({repositoryId:e}){const t=Fo(),[n,i]=w.useState("open"),[s,l]=w.useState(!1),{data:c,error:u,isLoading:m,isRefreshing:h,refresh:p}=$U(e,n==="all"?void 0:n),g=c!==void 0&&so(u);return Il(w.useMemo(()=>[{id:"reviews:create",label:"New review",group:"Repository",keys:"n",keywords:"compare branch create open",icon:Bi,run:()=>l(!0)},{id:"reviews:refresh",label:"Refresh reviews",group:"Repository",keys:"r",keywords:"reload",icon:sr,run:()=>{p()}},...vE.map((y,b)=>({id:`reviews:filter:${y.value}`,label:`Show ${y.label.toLowerCase()} reviews`,group:"Repository",keys:String(b+1),keywords:"filter status",icon:BI,disabled:n===y.value,run:()=>i(y.value)}))],[n,p])),d.jsxs("section",{className:"flex flex-col gap-4",children:[d.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:vE.map(({value:y,label:b})=>d.jsx("button",{type:"button",onClick:()=>i(y),className:Te("rounded-sm px-2.5 py-1 text-xs font-medium transition-colors",n===y?"bg-secondary text-secondary-foreground":"text-muted-foreground hover:text-foreground"),children:b},y))}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Ln,{label:"Reload reviews",children:d.jsx(Ve,{variant:"outline",size:"icon",onClick:()=>{p()},disabled:m,"aria-label":"Refresh",children:d.jsx(sr,{className:h?"animate-spin":void 0})})}),d.jsxs(Ve,{onClick:()=>l(!0),children:[d.jsx(Bi,{}),"New review"]})]})]}),m&&d.jsx(c7,{}),!m&&u!==void 0&&!g&&d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-destructive/40 px-6 py-10 text-center",children:[d.jsx("div",{className:"rounded-full bg-destructive/10 p-3 text-destructive",children:d.jsx(Hi,{className:"size-6"})}),d.jsx("p",{className:"max-w-md text-sm text-muted-foreground",children:Jt(u)}),d.jsxs(Ve,{variant:"outline",onClick:()=>{p()},children:[d.jsx(sr,{}),"Try again"]})]}),!m&&(u===void 0||g)&&c?.length===0&&d.jsx(u7,{filter:n,onCreate:()=>l(!0)}),!m&&(u===void 0||g)&&c&&c.length>0&&d.jsx("ul",{className:"flex flex-col gap-2",children:c.map(y=>d.jsx("li",{children:d.jsx(a7,{review:y})},y.id))}),d.jsx(Gj,{open:s,onOpenChange:l,repositoryId:e,onCreated:y=>An({name:"review",reviewId:y.id,tab:"files",...t})})]})}function a7({review:e}){const t=Fo();function n(){An({name:"review",reviewId:e.id,tab:"conversation",...t})}return d.jsxs(kt,{role:"button",tabIndex:0,"data-nav-item":!0,onClick:n,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n())},className:"flex cursor-pointer items-center gap-4 p-4 transition-colors hover:border-foreground/20",children:[d.jsx(bu,{className:Te("size-4 shrink-0",e.status==="open"?"text-success":"text-muted-foreground")}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"truncate font-medium",title:e.title,children:e.title}),e.status==="closed"&&d.jsx(tn,{variant:"outline",children:"Closed"})]}),d.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 font-mono text-xs text-muted-foreground",children:[!Xa(e)&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"min-w-0 break-words",children:d.jsx(Xn,{text:e.baseRef})}),d.jsx(Th,{className:"size-3 shrink-0"})]}),d.jsx("span",{className:"min-w-0 break-words",children:d.jsx(Xn,{text:e.headRef})})]})]}),d.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",title:im(e.updatedAt),children:rm(e.updatedAt)})]})}function c7(){return d.jsx("ul",{className:"flex flex-col gap-2","aria-busy":"true","aria-label":"Loading reviews",children:[0,1].map(e=>d.jsx("li",{children:d.jsxs(kt,{className:"flex items-center gap-4 p-4",children:[d.jsx(yt,{className:"size-4 rounded-full"}),d.jsxs("div",{className:"flex-1 space-y-2",children:[d.jsx(yt,{className:"h-4 w-52"}),d.jsx(yt,{className:"h-3 w-40"})]}),d.jsx(yt,{className:"h-3 w-16"})]})},e))})}function u7({filter:e,onCreate:t}){const n=e!=="all";return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-dashed px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground",children:d.jsx(bu,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:e==="closed"?"No closed reviews":"No reviews yet"}),d.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm text-muted-foreground",children:e==="closed"?"Reviews you close are filed here instead of being deleted.":"Compare two branches to start a review. Work that is only sitting in a worktree, uncommitted, can be reviewed too."})]}),e!=="closed"&&d.jsxs(Ve,{onClick:t,className:"mt-1",children:[d.jsx(Bi,{}),n?"New review":"Create your first review"]})]})}function Yj({git:e}){return e.exists?e.isGitRepository?null:d.jsxs(tn,{variant:"destructive",title:e.error??void 0,children:[d.jsx(QC,{}),"Not a git repository"]}):d.jsxs(tn,{variant:"destructive",title:e.error??void 0,children:[d.jsx(PI,{}),"Folder missing"]})}function f7({open:e,onOpenChange:t,initialPath:n,onChoose:i}){return d.jsx(Ba,{open:e,onOpenChange:t,children:d.jsx(Va,{children:e&&d.jsx(d7,{initialPath:n,onChoose:s=>{i(s),t(!1)},onCancel:()=>t(!1)})})})}function d7({initialPath:e,onChoose:t,onCancel:n}){const i=Wn(),s=$n(),[l,c]=w.useState(e),[u,m]=w.useState(e??""),[h,p]=w.useState(!1),{data:g,error:y,isLoading:b}=dn(Ut.directory(l,s),()=>i.fs.list(l===void 0?{}:{path:l}),{revalidateOnFocus:!1,shouldRetryOnError:!1,keepPreviousData:!0});function S(T){c(T),m(T)}function k(T){T.preventDefault();const R=u.trim();c(R===""?void 0:R)}const E=(g?.entries??[]).filter(T=>h||!T.isHidden),C=(g?.entries??[]).length-E.length;return d.jsxs(d.Fragment,{children:[d.jsxs(Zu,{children:[d.jsx(Ua,{children:"Choose a folder"}),d.jsx(Za,{children:s===void 0?"Folders on this computer. A repository is marked; a subfolder of one works too.":"Folders on the machine this list belongs to. A repository is marked."})]}),d.jsxs("div",{className:"flex min-h-0 flex-col gap-3",children:[d.jsxs("form",{onSubmit:k,className:"flex gap-2",noValidate:!0,children:[d.jsx(Os,{value:u,onChange:T=>m(T.target.value),placeholder:g?.home??"/path/to/folder",className:"font-mono text-xs","aria-label":"Folder to list",autoComplete:"off",spellCheck:!1}),d.jsx(Ve,{type:"submit",variant:"outline",className:"shrink-0",children:"Go"})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:()=>{c(void 0),m("")},children:[d.jsx(XC,{}),"Home"]}),g?.parent&&d.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:()=>S(g.parent),children:[d.jsx(yI,{}),"Up"]}),d.jsx("span",{className:"flex-1"}),d.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[d.jsx(Wb,{checked:h,onCheckedChange:p}),"Hidden",C>0&&!h&&d.jsxs("span",{children:["(",C,")"]})]})]}),y!==void 0&&d.jsxs("p",{role:"alert",className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[d.jsx(Hi,{className:"mt-0.5 size-4 shrink-0"}),d.jsx(Xn,{text:Jt(y)})]}),d.jsxs("ul",{className:"h-64 overflow-y-auto rounded-md border",children:[b&&d.jsxs("li",{className:"flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground",children:[d.jsx(wi,{className:"size-4 animate-spin"}),"Reading…"]}),!b&&E.length===0&&y===void 0&&d.jsx("li",{className:"px-3 py-2 text-sm text-muted-foreground",children:C>0?"Only hidden folders in here.":"No folders in here."}),E.map(T=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>S(T.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted",children:[d.jsx(FI,{className:"size-4 shrink-0 text-muted-foreground"}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:T.name}),T.isRepository&&d.jsx(tn,{variant:"outline",className:"shrink-0",children:"repository"}),d.jsx(Do,{className:"size-4 shrink-0 text-muted-foreground"})]})},T.path))]}),g?.truncated&&d.jsx("p",{className:"text-xs text-muted-foreground",children:"Only the first folders are listed. Type a path above to go straight there."}),g&&d.jsx("p",{"data-selectable":!0,className:"break-words font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:g.path})})]}),d.jsxs(nm,{children:[d.jsx(Ve,{type:"button",variant:"ghost",onClick:n,children:"Cancel"}),d.jsx(Ve,{type:"button",disabled:!g,onClick:()=>g&&t(g.path),children:"Use this folder"})]})]})}function h7(){const e=Wn(),t=$n(),{data:n,error:i,isLoading:s,isValidating:l,mutate:c}=dn(Ut.repositories(t),()=>e.repositories.list());return{repositories:n,error:i,isLoading:s,isRefreshing:l&&!s,refresh:c}}function Kj(){const e=Wn(),t=$n(),{mutate:n}=_s(),i=w.useCallback(()=>n(Ut.repositories(t)),[t,n]);return{addRepository:w.useCallback(async s=>{const l=await e.repositories.add(s);return await i(),l},[e,i]),updateRepository:w.useCallback(async s=>{const l=await e.repositories.update(s);return await i(),l},[e,i]),removeRepository:w.useCallback(async s=>{await e.repositories.remove({id:s}),await i()},[e,i])}}function Xj({open:e,onOpenChange:t,repository:n}){return d.jsx(Ba,{open:e,onOpenChange:t,children:d.jsx(Va,{children:e&&d.jsx(m7,{repository:n,onDone:()=>t(!1)},n?.id??"new")})})}function m7({repository:e,onDone:t}){const n=e!==void 0,i=$n(),{addRepository:s,updateRepository:l}=Kj(),[c,u]=w.useState(e?.path??""),[m,h]=w.useState(e?.name??""),[p,g]=w.useState(!1),[y,b]=w.useState(!1),[S,k]=w.useState(null),E=Lt.capabilities.pickDirectory&&i===void 0;async function C(){const A=await Lt.system.pickDirectory();A&&(u(A),k(null))}function T(A){u(A),k(null)}async function R(A){A.preventDefault(),b(!0),k(null);try{if(e){const L=_a(cV,{id:e.id,name:m.trim(),...c.trim()!==e.path?{path:c.trim()}:{}});await l(L)}else{const L=m.trim(),D=_a(aV,{path:c.trim(),...L?{name:L}:{}});await s(D)}t()}catch(L){k(L)}finally{b(!1)}}const N=wl(S,"path"),I=wl(S,"name"),M=S&&!N&&!I?Jt(S):null,P=n2(c.trim());return d.jsxs("form",{onSubmit:A=>{R(A)},noValidate:!0,children:[d.jsxs(Zu,{children:[d.jsx(Ua,{children:n?"Edit repository":"Add repository"}),d.jsx(Za,{children:n?"Rename this repository, or point it at a new location if you moved it.":i===void 0?"Choose any folder inside a git repository. GitWarren stores the repository root.":"Choose a folder on that machine. GitWarren stores the repository root."})]}),d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"repository-path",children:"Repository folder"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(Os,{id:"repository-path",value:c,onChange:A=>u(A.target.value),placeholder:"/path/to/repository",className:"font-mono text-xs","data-invalid":N?"":void 0,autoComplete:"off",spellCheck:!1}),E?d.jsxs(Ve,{type:"button",variant:"outline",onClick:()=>{C()},className:"shrink-0",children:[d.jsx(Xd,{}),"Browse"]}):d.jsxs(Ve,{type:"button",variant:"outline",onClick:()=>g(!0),className:"shrink-0",children:[d.jsx(II,{}),"Browse"]})]}),d.jsx(El,{children:N}),!N&&d.jsx(Es,{children:"A subfolder works too - it resolves to the repository root."})]}),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"repository-name",children:"Display name"}),d.jsx(Os,{id:"repository-name",value:m,onChange:A=>h(A.target.value),placeholder:P||"Defaults to the folder name","data-invalid":I?"":void 0,autoComplete:"off"}),d.jsx(El,{children:I}),!I&&!n&&d.jsx(Es,{children:"Leave blank to use the folder name."})]}),M&&d.jsxs("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[M,Ky(S)==="GIT_UNAVAILABLE"&&d.jsx("span",{className:"mt-1 block text-xs opacity-80",children:"GitWarren shells out to your own git installation."})]})]}),d.jsx(f7,{open:p,onOpenChange:g,initialPath:c.trim()===""?void 0:c.trim(),onChoose:T}),d.jsxs(nm,{children:[d.jsx(Ve,{type:"button",variant:"ghost",onClick:t,children:"Cancel"}),d.jsxs(Ve,{type:"submit",disabled:y,children:[y&&d.jsx(wi,{className:"animate-spin"}),n?"Save changes":"Add repository"]})]})]})}function p7({repositoryId:e}){const t=Wn(),n=$n(),i=Fo(),[s,l]=w.useState(!1),{data:c,error:u,isLoading:m}=dn(Ut.repository(e,n),()=>t.repositories.get({id:e})),h=fj(c?.path??"");if(Il(w.useMemo(()=>c===void 0?[]:[{id:"repository:edit",label:"Edit repository",group:"Repository",hint:c.name,keys:"e",keywords:"rename settings",icon:Tl,run:()=>l(!0)},...t.capabilities.revealPath&&h!==null?[{id:"repository:reveal",label:"Show in file manager",group:"Repository",hint:c.path,keys:"o",keywords:"finder explorer folder open reveal",icon:Xd,disabled:!c.git.exists,run:()=>{t.system.revealPath(h)}}]:[]],[t,n,c,h])),m)return d.jsxs("div",{className:"flex flex-col gap-5","aria-busy":"true","aria-label":"Loading repository",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(yt,{className:"h-4 w-32"}),d.jsx(yt,{className:"h-6 w-56"}),d.jsx(yt,{className:"h-4 w-80"})]}),d.jsx(yt,{className:"h-32 w-full"})]});const p=c!==void 0&&so(u);if(!c||u!==void 0&&!p)return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-destructive/40 px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-destructive/10 p-3 text-destructive",children:d.jsx(Hi,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Repository not found"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:u===void 0?"It may have been removed.":Jt(u)})]}),d.jsxs(Ve,{variant:"outline",onClick:()=>An({name:"repositories",...i}),children:[d.jsx(Cs,{}),"Back to repositories"]})]});const g=!c.git.exists;return d.jsxs("div",{className:"flex flex-col gap-5",children:[d.jsxs("div",{children:[d.jsxs(Ve,{variant:"ghost",size:"sm",className:"-ml-2 mb-2 text-muted-foreground",onClick:()=>An({name:"repositories",...i}),children:[d.jsx(Cs,{}),"Repositories"]}),d.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h1",{className:"truncate text-xl font-semibold tracking-tight",title:c.name,children:c.name}),d.jsx(Yj,{git:c.git})]}),d.jsx("p",{"data-selectable":!0,className:"mt-1 break-words font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:c.path})})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.capabilities.revealPath&&h!==null&&d.jsx(Ln,{label:g?"Folder is missing":"Show in file manager",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":"Show in file manager",disabled:g,onClick:()=>{t.system.revealPath(h)},children:d.jsx(Xd,{})})}),d.jsx(Ln,{label:"Edit repository",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":"Edit repository",onClick:()=>l(!0),children:d.jsx(Tl,{})})})]})]})]}),d.jsx(l7,{repositoryId:c.id}),d.jsx(Xj,{open:s,onOpenChange:l,repository:c})]})}function g7({repository:e,onEdit:t,onRemove:n,alsoHere:i}){const s=Fo(),l=fj(e.path),c=!e.git.exists;function u(){An({name:"repository",repositoryId:e.id,...s})}return d.jsxs(kt,{role:"button",tabIndex:0,"data-nav-item":!0,onClick:u,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),u())},className:"flex cursor-pointer items-center gap-4 p-4 transition-colors hover:border-foreground/20",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"truncate font-medium",title:e.name,children:e.name}),d.jsx(Yj,{git:e.git})]}),d.jsx("p",{"data-selectable":!0,className:"mt-1 break-words font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:e.path})}),i&&d.jsxs("button",{type:"button",onClick:m=>{m.stopPropagation(),An(i.route)},className:"mt-1.5 flex max-w-full items-center gap-1.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:[d.jsx(rD,{className:"size-3 shrink-0"}),d.jsxs("span",{className:"truncate",children:["Also on this computer: ",i.path]})]})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-1",onClick:m=>m.stopPropagation(),onKeyDown:m=>m.stopPropagation(),role:"presentation",children:[Lt.capabilities.revealPath&&l!==null&&d.jsx(Ln,{label:c?"Folder is missing":"Show in file manager",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":"Show in file manager",disabled:c,onClick:()=>{Lt.system.revealPath(l)},children:d.jsx(Xd,{})})}),d.jsx(Ln,{label:"Edit this repository",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":`Edit ${e.name}`,onClick:()=>t(e),children:d.jsx(Tl,{})})}),d.jsx(Ln,{label:"Remove from GitWarren",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":`Remove ${e.name}`,className:"text-muted-foreground hover:text-destructive",onClick:()=>n(e),children:d.jsx(vu,{})})})]}),d.jsx(Do,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})}function x7({repository:e,onOpenChange:t}){const{removeRepository:n}=Kj(),[i,s]=w.useState(!1),[l,c]=w.useState(null);async function u(){if(e){s(!0),c(null);try{await n(e.id),t(!1)}catch(m){c(m)}finally{s(!1)}}}return d.jsx(hm,{open:e!==null,onOpenChange:m=>{m||c(null),t(m)},children:d.jsxs(mm,{children:[d.jsxs(pm,{children:[d.jsxs(gm,{children:["Remove “",e?.name,"”?"]}),d.jsx(xm,{children:"This removes the repository from GitWarren only. Nothing on disk is deleted and the working copy is left exactly as it is."})]}),e&&d.jsx("p",{"data-selectable":!0,className:"mt-3 break-words rounded-md bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:e.path})}),l!==null&&d.jsx("p",{role:"alert",className:"mt-3 text-sm text-destructive",children:Jt(l)}),d.jsxs(ym,{children:[d.jsx(Ve,{variant:"ghost",onClick:()=>t(!1),disabled:i,children:"Cancel"}),d.jsxs(Ve,{variant:"destructive",onClick:()=>{u()},disabled:i,children:[i&&d.jsx(wi,{className:"animate-spin"}),"Remove"]})]})]})})}function y7(e,t){const n=new Map;if(e===void 0||!t)return n;for(const i of t){const s=i.git.rootCommit;s===null||n.has(s)||n.set(s,{path:i.path,route:{name:"repository",repositoryId:i.id}})}return n}function Jj(){const e=$n(),{repositories:t,error:n,isLoading:i,isRefreshing:s,refresh:l}=h7(),{data:c}=dn(Ut.repositories(),()=>Lt.repositories.list()),u=w.useMemo(()=>y7(e,c),[e,c]),m=t!==void 0&&so(n),[h,p]=w.useState(!1),[g,y]=w.useState(void 0),[b,S]=w.useState(null),k=w.useCallback(()=>{y(void 0),p(!0)},[]);function E(C){y(C),p(!0)}return Il(w.useMemo(()=>[{id:"repositories:add",label:"Add repository",group:"Repositories",keys:"n",keywords:"new track clone folder",icon:Bi,run:k},{id:"repositories:refresh",label:"Refresh repositories",group:"Repositories",keys:"r",keywords:"reload git state",icon:sr,run:()=>{l()}}],[k,l])),d.jsxs("section",{className:"flex flex-col gap-4",children:[d.jsxs("header",{className:"flex items-center justify-between gap-4",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:"Repositories"}),d.jsx("p",{className:"text-sm text-muted-foreground",children:i?"Loading…":`${t?.length??0} tracked${s?" · refreshing…":""}`})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Ln,{label:"Re-read git state",children:d.jsx(Ve,{variant:"outline",size:"icon",onClick:()=>{l()},disabled:i,"aria-label":"Refresh",children:d.jsx(sr,{className:s?"animate-spin":void 0})})}),d.jsxs(Ve,{onClick:k,children:[d.jsx(Bi,{}),"Add repository"]})]})]}),i&&d.jsx(b7,{}),!i&&n!==void 0&&!m&&d.jsx(w7,{error:n,onRetry:()=>{l()}}),!i&&(n===void 0||m)&&t?.length===0&&d.jsx(v7,{onAdd:k}),!i&&(n===void 0||m)&&t&&t.length>0&&d.jsx("ul",{className:"flex flex-col gap-2",children:t.map(C=>d.jsx("li",{children:d.jsx(g7,{repository:C,onEdit:E,onRemove:S,alsoHere:C.git.rootCommit===null?void 0:u.get(C.git.rootCommit)})},C.id))}),d.jsx(Xj,{open:h,onOpenChange:p,repository:g}),d.jsx(x7,{repository:b,onOpenChange:C=>{C||S(null)}})]})}function b7(){return d.jsx("ul",{className:"flex flex-col gap-2","aria-busy":"true","aria-label":"Loading repositories",children:[0,1,2].map(e=>d.jsx("li",{children:d.jsxs(kt,{className:"flex items-center gap-4 p-4",children:[d.jsxs("div",{className:"flex-1 space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(yt,{className:"h-4 w-40"}),d.jsx(yt,{className:"h-4 w-24"})]}),d.jsx(yt,{className:"h-3 w-72"})]}),d.jsx(yt,{className:"size-9 rounded-md"})]})},e))})}function v7({onAdd:e}){return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-dashed px-6 py-14 text-center",children:[d.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground",children:d.jsx(qy,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"No repositories yet"}),d.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm text-muted-foreground",children:"Add a local git repository to start reviewing it. You can also add one from an AI agent through the MCP server."})]}),d.jsxs(Ve,{onClick:e,className:"mt-1",children:[d.jsx(Bi,{}),"Add your first repository"]})]})}function w7({error:e,onRetry:t}){const n=Ky(e);return n==="HOST_OFFLINE"?d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-dashed px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground",children:d.jsx(JC,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"This host is not answering"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:Jt(e)})]}),d.jsxs(Ve,{variant:"outline",onClick:t,className:"mt-1",children:[d.jsx(sr,{}),"Try again"]})]}):d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-destructive/40 px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-destructive/10 p-3 text-destructive",children:d.jsx(Hi,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Could not load your repositories"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:Jt(e)}),n==="GIT_UNAVAILABLE"&&d.jsx("p",{className:"mx-auto mt-2 max-w-md text-sm text-muted-foreground",children:"GitWarren uses your own git installation. Install git, or make sure it is on your PATH, then try again."})]}),d.jsxs(Ve,{variant:"outline",onClick:t,className:"mt-1",children:[d.jsx(sr,{}),"Try again"]})]})}const S7=[];function km(e){const{data:t,error:n,isLoading:i,refresh:s}=e7(e);return{threads:t??S7,error:n,isLoading:i,refresh:s}}function rv(){const e=Wn(),{mutate:t}=_s(),n=w.useCallback(()=>t(i=>typeof i=="string"&&(i.startsWith(ws.reviews)||i.startsWith(ws.review))),[t]);return{createThread:w.useCallback(async i=>{const s=await e.comments.createThread(i);return await n(),s},[e,n]),reply:w.useCallback(async i=>{const s=await e.comments.reply(i);return await n(),s},[e,n]),edit:w.useCallback(async(i,s)=>{const l=await e.comments.update({id:i,body:s});return await n(),l},[e,n]),remove:w.useCallback(async i=>{await e.comments.remove({id:i}),await n()},[e,n]),setResolved:w.useCallback(async(i,s)=>{await e.comments.setResolved({threadId:i,resolved:s}),await n()},[e,n])}}function wE({name:e,role:t,className:n}){const[i,s]=w.useState(!1),l=w.useRef(null);w.useEffect(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);async function c(){await navigator.clipboard.writeText(e),s(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>s(!1),1500)}return d.jsxs("span",{className:Te("inline-flex max-w-full items-center gap-1 rounded bg-muted py-0.5 pl-1.5 pr-0.5",n),children:[d.jsx("span",{"data-selectable":!0,className:"min-w-0 break-words",children:d.jsx(Xn,{text:e})}),d.jsx(Ln,{label:i?"Copied":`Copy ${t}`,children:d.jsx("button",{type:"button",onClick:()=>{c()},"aria-label":i?`${t} copied`:`Copy ${t}`,className:Te("flex size-5 shrink-0 items-center justify-center rounded transition-colors","text-muted-foreground hover:bg-foreground/10 hover:text-foreground"),children:i?d.jsx(Li,{className:"size-3 text-success"}):d.jsx(Kd,{className:"size-3"})})})]})}const SE="(min-width: 64rem)";function Wj(){const e=w.useCallback(t=>{const n=window.matchMedia(SE);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},[]);return w.useSyncExternalStore(e,()=>!window.matchMedia(SE).matches,()=>!1)}const Ty="gitwarren:";function k7(e){try{return window.localStorage.getItem(Ty+e)}catch{return null}}function E7(e,t){try{t===null?window.localStorage.removeItem(Ty+e):window.localStorage.setItem(Ty+e,t)}catch{}}function iv(e,t){const[n,i]=w.useState(()=>k7(e)??t),s=w.useCallback(l=>{i(l),E7(e,l)},[e]);return[n,s]}function $j(e,t){const[n,i]=iv(e,"on");return[n==="on",w.useCallback(s=>i(s?"on":"off"),[i])]}function C7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const T7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,R7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,j7={};function kE(e,t){return(j7.jsx?R7:T7).test(e)}const N7=/[ \t\n\f\r]/g;function O7(e){return typeof e=="object"?e.type==="text"?EE(e.value):!1:EE(e)}function EE(e){return e.replace(N7,"")===""}class Ju{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Ju.prototype.normal={};Ju.prototype.property={};Ju.prototype.space=void 0;function Qj(e,t){const n={},i={};for(const s of e)Object.assign(n,s.property),Object.assign(i,s.normal);return new Ju(n,i,t)}function Ry(e){return e.toLowerCase()}class Vr{constructor(t,n){this.attribute=n,this.property=t}}Vr.prototype.attribute="";Vr.prototype.booleanish=!1;Vr.prototype.boolean=!1;Vr.prototype.commaOrSpaceSeparated=!1;Vr.prototype.commaSeparated=!1;Vr.prototype.defined=!1;Vr.prototype.mustUseProperty=!1;Vr.prototype.number=!1;Vr.prototype.overloadedBoolean=!1;Vr.prototype.property="";Vr.prototype.spaceSeparated=!1;Vr.prototype.space=void 0;let A7=0;const gt=Pl(),Kn=Pl(),jy=Pl(),ze=Pl(),mn=Pl(),Cl=Pl(),ti=Pl();function Pl(){return 2**++A7}const Ny=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:Kn,commaOrSpaceSeparated:ti,commaSeparated:Cl,number:ze,overloadedBoolean:jy,spaceSeparated:mn},Symbol.toStringTag,{value:"Module"})),yx=Object.keys(Ny);class ov extends Vr{constructor(t,n,i,s){let l=-1;if(super(t,n),CE(this,"space",s),typeof i=="number")for(;++l<yx.length;){const c=yx[l];CE(this,yx[l],(i&Ny[c])===Ny[c])}}}ov.prototype.defined=!0;function CE(e,t,n){n&&(e[t]=n)}function Ja(e){const t={},n={};for(const[i,s]of Object.entries(e.properties)){const l=new ov(i,e.transform(e.attributes||{},i),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(l.mustUseProperty=!0),t[i]=l,n[Ry(i)]=i,n[Ry(l.attribute)]=i}return new Ju(t,n,e.space)}const eN=Ja({properties:{ariaActiveDescendant:null,ariaAtomic:Kn,ariaAutoComplete:null,ariaBusy:Kn,ariaChecked:Kn,ariaColCount:ze,ariaColIndex:ze,ariaColSpan:ze,ariaControls:mn,ariaCurrent:null,ariaDescribedBy:mn,ariaDetails:null,ariaDisabled:Kn,ariaDropEffect:mn,ariaErrorMessage:null,ariaExpanded:Kn,ariaFlowTo:mn,ariaGrabbed:Kn,ariaHasPopup:null,ariaHidden:Kn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:mn,ariaLevel:ze,ariaLive:null,ariaModal:Kn,ariaMultiLine:Kn,ariaMultiSelectable:Kn,ariaOrientation:null,ariaOwns:mn,ariaPlaceholder:null,ariaPosInSet:ze,ariaPressed:Kn,ariaReadOnly:Kn,ariaRelevant:null,ariaRequired:Kn,ariaRoleDescription:mn,ariaRowCount:ze,ariaRowIndex:ze,ariaRowSpan:ze,ariaSelected:Kn,ariaSetSize:ze,ariaSort:null,ariaValueMax:ze,ariaValueMin:ze,ariaValueNow:ze,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function tN(e,t){return t in e?e[t]:t}function nN(e,t){return tN(e,t.toLowerCase())}const M7=Ja({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Cl,acceptCharset:mn,accessKey:mn,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alpha:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:mn,autoFocus:gt,autoPlay:gt,blocking:mn,capture:null,charSet:null,checked:gt,cite:null,className:mn,closedBy:null,colorSpace:null,cols:ze,colSpan:ze,command:null,commandFor:null,content:null,contentEditable:Kn,controls:gt,controlsList:mn,coords:ze|Cl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:jy,draggable:Kn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:mn,height:ze,hidden:jy,high:ze,href:null,hrefLang:null,htmlFor:mn,httpEquiv:mn,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:mn,itemRef:mn,itemScope:gt,itemType:mn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:ze,manifest:null,max:null,maxLength:ze,media:null,method:null,min:null,minLength:ze,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gt,optimum:ze,pattern:null,ping:mn,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:mn,required:gt,reversed:gt,rows:ze,rowSpan:ze,sandbox:mn,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootCustomElementRegistry:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shadowRootSerializable:gt,shape:null,size:ze,sizes:null,slot:null,span:ze,spellCheck:Kn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ze,step:null,style:null,tabIndex:ze,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:Kn,width:ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:mn,axis:null,background:null,bgColor:null,border:ze,borderColor:null,bottomMargin:ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:ze,leftMargin:ze,link:null,longDesc:null,lowSrc:null,marginHeight:ze,marginWidth:ze,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:ze,rules:null,scheme:null,scrolling:Kn,standby:null,summary:null,text:null,topMargin:ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ze,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:gt,disablePictureInPicture:gt,disableRemotePlayback:gt,exportParts:Cl,part:mn,prefix:null,property:null,results:ze,security:null,unselectable:null},space:"html",transform:nN}),z7=Ja({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ti,accentHeight:ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ze,amplitude:ze,arabicForm:null,ascent:ze,attributeName:null,attributeType:null,azimuth:ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ze,by:null,calcMode:null,capHeight:ze,className:mn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ze,diffuseConstant:ze,direction:null,display:null,dur:null,divisor:ze,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ze,enableBackground:null,end:null,event:null,exponent:ze,externalResourcesRequired:null,fill:null,fillOpacity:ze,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Cl,g2:Cl,glyphName:Cl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ze,horizOriginX:ze,horizOriginY:ze,id:null,ideographic:ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ze,k:ze,k1:ze,k2:ze,k3:ze,k4:ze,kernelMatrix:ti,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ze,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ze,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ze,overlineThickness:ze,paintOrder:null,panose1:null,path:null,pathLength:ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:mn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ze,pointsAtY:ze,pointsAtZ:ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ti,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ti,rev:ti,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ti,requiredFeatures:ti,requiredFonts:ti,requiredFormats:ti,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ze,specularExponent:ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ze,strikethroughThickness:ze,string:null,stroke:null,strokeDashArray:ti,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ze,strokeOpacity:ze,strokeWidth:null,style:null,surfaceScale:ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ti,tabIndex:ze,tableValues:null,target:null,targetX:ze,targetY:ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ti,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ze,underlineThickness:ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ze,values:null,vAlphabetic:ze,vMathematical:ze,vectorEffect:null,vHanging:ze,vIdeographic:ze,version:null,vertAdvY:ze,vertOriginX:ze,vertOriginY:ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:tN}),rN=Ja({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),iN=Ja({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nN}),oN=Ja({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),I7={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},D7=/[A-Z]/g,TE=/-[a-z]/g,_7=/^data[-\w.:]+$/i;function P7(e,t){const n=Ry(t);let i=t,s=Vr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&_7.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(TE,F7);i="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!TE.test(l)){let c=l.replace(D7,L7);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=ov}return new s(i,t)}function L7(e){return"-"+e.toLowerCase()}function F7(e){return e.charAt(1).toUpperCase()}const H7=Qj([eN,M7,rN,iN,oN],"html"),sv=Qj([eN,z7,rN,iN,oN],"svg");function B7(e){return e.join(" ").trim()}var va={},bx,RE;function V7(){if(RE)return bx;RE=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,m=`
|
|
63
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const c of e.seen.entries()){const u=c[1];if(t===c[0]){l(c);continue}if(e.external){const h=e.external.registry.get(c[0])?.id;if(t!==c[0]&&h){l(c);continue}}if(e.metadataRegistry.get(c[0])?.id){l(c);continue}if(u.cycle){l(c);continue}if(u.count>1&&e.reused==="ref"){l(c);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function q2(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const i of t){if(!i||typeof i!="object")return;q2(i);const s=Object.keys(i);if(s.length!==1||s[0]!=="type")return;const l=i.type;for(const c of Array.isArray(l)?l:[l]){if(typeof c!="string")return;n.includes(c)||n.push(c)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const G2=new Set(["type","properties","required","additionalProperties"]),lE=["oneOf","anyOf"];function aE(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Sy(e){const t=[];for(const l of e){if(typeof l!="object"||l.type!=="object")return null;for(const c in l)if(!G2.has(c))return null;t.push(l)}const n={},i=new Set;for(const l of t){for(const c in l.properties){if(Object.prototype.hasOwnProperty.call(n,c))continue;const u=[];for(const h of t){const p=h.properties?.[c]??aE(h);p!=null&&(u.some(g=>JSON.stringify(g)===JSON.stringify(p))||u.push(p))}const m=u.length===1?u[0]:Sy(u)??{allOf:u};ri(n,c,m)}for(const c of l.required??[])i.add(c)}const s={type:"object",properties:n};if(i.size&&(s.required=[...i]),t.every(l=>l.additionalProperties===!1))s.additionalProperties=!1;else{const l=[];for(const c of t){const u=aE(c);u&&!l.some(m=>JSON.stringify(m)===JSON.stringify(u))&&l.push(u)}l.length===1?s.additionalProperties=l[0]:l.length>1&&(s.additionalProperties={allOf:l})}return s}function TH(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const s of G2)if(s in e)return;const n=t.filter(s=>lE.some(l=>Array.isArray(s[l])));let i=null;if(!n.length)i=Sy(t);else{const s=n[0],l=lE.find(m=>Array.isArray(s[m]));if(Object.keys(s).length!==1)return;const c=t.filter(m=>m!==s),u=s[l].map(m=>Sy([...c,m]));if(u.some(m=>!m))return;i={[l]:u}}i&&(delete e.allOf,du(e,i))}function Y2(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=u=>{const m=e.seen.get(u);if(m.ref===null)return;const h=m.def??m.schema,p={...h},g=m.ref;if(m.ref=null,g){i(g);const b=e.seen.get(g),S=b.schema;if(S.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(S)):du(h,S),du(h,p),u._zod.parent===g)for(const E in h)E==="$ref"||E==="allOf"||E in p||delete h[E];if(S.$ref&&b.def)for(const E in h)E==="$ref"||E==="allOf"||E in b.def&&JSON.stringify(h[E])===JSON.stringify(b.def[E])&&delete h[E]}const y=u._zod.parent;if(y&&y!==g){i(y);const b=e.seen.get(y);if(b?.schema.$ref&&(h.$ref=b.schema.$ref,b.def))for(const S in h)S==="$ref"||S==="allOf"||S in b.def&&JSON.stringify(h[S])===JSON.stringify(b.def[S])&&delete h[S]}e.override({zodSchema:u,jsonSchema:h,path:m.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const u of[...e.seen.entries()].reverse())i(u[0]);if(e.target!=="openapi-3.0")for(const u of e.seen.entries())q2(u[1].def??u[1].schema);for(const u of e.deferred)u();if(e.intersections.length){const u=new Map;for(const m of e.seen.values())for(const h of[m.schema,m.def]){const p=h?.allOf;if(!Array.isArray(p))continue;const g=u.get(p);g?g.push(h):u.set(p,[h])}for(const m of e.intersections)for(const h of u.get(m)??[])TH(h)}}const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(u)}du(s,n.defId?n.schema:n.def??n.schema);const l=e.metadataRegistry.get(t)?.id;l!==void 0&&s.id===l&&delete s.id;const c=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const u of e.seen.entries()){const m=u[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,ri(c,m.defId,m.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?s.$defs=c:s.definitions=c);try{const u=JSON.parse(JSON.stringify(s));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:mh(t,"input",e.processors),output:mh(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function jr(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return jr(i.element,n);if(i.type==="set")return jr(i.valueType,n);if(i.type==="lazy")return jr(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return jr(i.innerType,n);if(i.type==="intersection")return jr(i.left,n)||jr(i.right,n);if(i.type==="record"||i.type==="map")return jr(i.keyType,n)||jr(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:jr(i.in,n)||jr(i.out,n);if(i.type==="object"){for(const s in i.shape)if(jr(i.shape[s],n))return!0;return!1}if(i.type==="union"){for(const s of i.options)if(jr(s,n))return!0;return!1}if(i.type==="tuple"){for(const s of i.items)if(jr(s,n))return!0;return!!(i.rest&&jr(i.rest,n))}return!1}const RH=(e,t={})=>n=>{const i=U2({...n,processors:t});return pr(e,i),Z2(i,e),Y2(i,e)},mh=(e,t,n={})=>i=>{const{libraryOptions:s,target:l}=i??{},c=U2({...s??{},target:l,io:t,processors:n});return pr(e,c),Z2(c,e),Y2(c,e)},jH={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},NH=(e,t,n,i)=>{const s=n;s.type="string";const{minimum:l,maximum:c,format:u,patterns:m,contentEncoding:h,laxFormat:p}=e._zod.bag;if(typeof l=="number"&&(s.minLength=l),typeof c=="number"&&(s.maxLength=c),u&&(s.format=jH[u]??u,s.format===""&&delete s.format,(u==="time"||p)&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const g=[...m];g.length===1?s.pattern=g[0].source:g.length>1&&(s.allOf=[...g.map(y=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},OH=(e,t,n,i)=>{const s=n,{minimum:l,maximum:c,format:u,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof u=="string"&&u.includes("int")?s.type="integer":s.type="number";const g=typeof p=="number"&&p>=(l??Number.NEGATIVE_INFINITY),y=typeof h=="number"&&h<=(c??Number.POSITIVE_INFINITY),b=t.target==="draft-04"||t.target==="openapi-3.0";g?b?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p:typeof l=="number"&&(s.minimum=l),y?b?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h:typeof c=="number"&&(s.maximum=c),typeof m=="number"&&(Number.isFinite(m)&&m!==0?s.multipleOf=Math.abs(m):Ka(e,t,s,i,`A multipleOf divisor of ${m} cannot be represented in JSON Schema`))},AH=(e,t,n,i)=>{n.type="boolean"},MH=(e,t,n,i)=>{n.not={}},zH=(e,t,n,i)=>{},IH=(e,t,n,i)=>{const s=e._zod.def,l=p2(s.entries);if(l.length===0){n.not={};return}l.every(c=>typeof c=="number")&&(n.type="number"),l.every(c=>typeof c=="string")&&(n.type="string"),n.enum=l},DH=(e,t,n,i)=>{Ka(e,t,n,i,"Custom types cannot be represented in JSON Schema")},_H=(e,t,n,i)=>{Ka(e,t,n,i,"Transforms cannot be represented in JSON Schema")},PH=(e,t,n,i)=>{const s=n,l=e._zod.def,{minimum:c,maximum:u}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof u=="number"&&(s.maxItems=u),s.type="array",s.items=pr(l.element,t,{...i,path:[...i.path,"items"]})};function ky(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?ky(t.out):t.type==="catch"?ky(t.innerType):e._zod.optin}const LH=(e,t,n,i)=>{const s=n,l=e._zod.def,c=l.shape;if(Object.getOwnPropertySymbols(c).length&&Ka(e,t,s,i,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(const p in c)ri(s.properties,p,pr(c[p],t,{...i,path:[...i.path,"properties",p]}));const m=new Set(Object.keys(c)),h=new Set([...m].filter(p=>{const g=l.shape[p];return t.io==="input"?ky(g)===void 0:g._zod.optout===void 0}));h.size>0&&(s.required=Array.from(h)),l.catchall?._zod.def.type==="never"?s.additionalProperties=!1:l.catchall?l.catchall&&(s.additionalProperties=pr(l.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},FH=(e,t,n,i)=>{const s=e._zod.def,l=s.inclusive===!1,c=s.options.map((u,m)=>pr(u,t,{...i,path:[...i.path,l?"oneOf":"anyOf",m]}));l?n.oneOf=c:n.anyOf=c},HH=(e,t,n,i)=>{const s=e._zod.def,l=pr(s.left,t,{...i,path:[...i.path,"allOf",0]}),c=pr(s.right,t,{...i,path:[...i.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,m=[...u(l)?l.allOf:[l],...u(c)?c.allOf:[c]];n.allOf=m,t.intersections.push(m)},BH=(e,t,n,i)=>{const s=e._zod.def,l=pr(s.innerType,t,i),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=s.innerType,n.nullable=!0):n.anyOf=[l,{type:"null"}]},VH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType},Gb=Symbol();function K2(e,t,n,i,s){let l=!1;const c=JSON.stringify(e,(u,m)=>typeof m!="bigint"?m:(l=!0,null));return l?(Ka(t,n,i,s,"BigInt defaults cannot be represented in JSON Schema"),Gb):JSON.parse(c)}const UH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType;const c=K2(s.defaultValue,e,t,n,i);c!==Gb&&(n.default=c)},ZH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);if(l.ref=s.innerType,t.io!=="input")return;const c=K2(s.defaultValue,e,t,n,i);c!==Gb&&(n._prefault=c)},qH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{Ka(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=c},GH=(e,t,n,i)=>{const s=e._zod.def,l=s.in._zod.traits.has("$ZodTransform"),c=t.io==="input"?l?s.out:s.in:s.out;pr(c,t,i);const u=t.seen.get(e);u.ref=c},YH=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType,n.readOnly=!0},X2=(e,t,n,i)=>{const s=e._zod.def;pr(s.innerType,t,i);const l=t.seen.get(e);l.ref=s.innerType},cE=new WeakSet([Object.prototype,Error.prototype]);function Rd(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}const KH=(e,t)=>{k2.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);cE.has(n)||(cE.add(n),Rd(n,"format",i=>s=>TF(i,s)),Rd(n,"flatten",i=>s=>C2(i,s)),Rd(n,"addIssue",i=>s=>{i.issues.push(s),i.message=JSON.stringify(i.issues,yy,2)}),Rd(n,"addIssues",i=>s=>{i.issues.push(...s),i.message=JSON.stringify(i.issues,yy,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Ei=Ce("ZodError",KH,void 0,{Parent:Error}),XH=Vb(Ei),JH=Ub(Ei),WH=lm(Ei),$H=am(Ei),QH=NF(Ei),eB=OF(Ei),tB=AF(Ei),nB=MF(Ei),rB=zF(Ei),iB=IF(Ei),oB=DF(Ei),sB=_F(Ei);function lB(){oo.localeError||qs(A9())}function Yb(){oo.memoizer||qs({memoizer:j9()})}const Hn=Ce("ZodType",(e,t)=>(lB(),Fn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(Us(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Zs(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(nV(e,t))},superRefine(e,t){return this.check(rV(e,t))},overwrite(e){return this.check(Ya(e))},optional(){return dE(this)},exactOptional(){return UB(this)},nullable(){return hE(this)},nullish(){return dE(hE(this))},nonoptional(e){return XB(this,e)},array(){return Yu(this)},or(e){return LB([this,e])},and(e){return HB(this,e)},transform(e){return mE(this,VB(e))},default(e){return GB(this,e)},prefault(e){return KB(this,e)},catch(e){return WB(this,e)},pipe(e){return mE(this,e)},readonly(){return eV(this)},describe(e){const t=this.clone();return ou.add(t,{description:e}),t},meta(...e){if(e.length===0)return ou.get(this);const t=this.clone();return ou.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return v2(this,"~standard",{...O2(this),jsonSchema:{input:mh(this,"input"),output:mh(this,"output")}})},set"~standard"(e){Ia(this,"~standard",e)},parse:function e(t,n){return XH(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await JH(this,t,n,{callee:e})},safeParse(e,t){return WH(this,e,t)},async safeParseAsync(e,t){return $H(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ia(this,"spa",e)},encode:function e(t,n){return QH(this,t,n,{callee:e})},decode:function e(t,n){return eB(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await tB(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await nB(this,t,n,{callee:e})},safeEncode(e,t){return rB(this,e,t)},safeDecode(e,t){return iB(this,e,t)},async safeEncodeAsync(e,t){return oB(this,e,t)},async safeDecodeAsync(e,t){return sB(this,e,t)},toJSONSchema(e){return RH(this,{})(e)},get description(){return ou.get(this)?.description},get _def(){return this._zod.def}}),J2=Ce("_ZodString",(e,t)=>{qb.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(i,s,l)=>NH(e,i,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(fH(...e))},includes(...e){return this.check(mH(...e))},startsWith(...e){return this.check(pH(...e))},endsWith(...e){return this.check(gH(...e))},min(...e){return this.check(hh(...e))},max(...e){return this.check(B2(...e))},length(...e){return this.check(V2(...e))},nonempty(...e){return this.check(hh(1,...e))},lowercase(e){return this.check(dH(e))},uppercase(e){return this.check(hH(e))},trim(){return this.check(yH())},normalize(...e){return this.check(xH(...e))},toLowerCase(){return this.check(bH())},toUpperCase(){return this.check(vH())},slugify(){return this.check(wH())}}),aB=Ce("ZodString",(e,t)=>{qb.init(e,t),J2.init(e,t)},{email(e){return this.check(D9(dB,e))},url(e){return this.check(B9(mB,e))},jwt(e){return this.check(nH(NB,e))},emoji(e){return this.check(V9(pB,e))},guid(e){return this.check(_9(hB,e))},uuid(e){return this.check(P9(jd,e))},uuidv4(e){return this.check(L9(jd,e))},uuidv6(e){return this.check(F9(jd,e))},uuidv7(e){return this.check(H9(jd,e))},nanoid(e){return this.check(U9(gB,e))},cuid(e){return this.check(Z9(xB,e))},cuid2(e){return this.check(q9(yB,e))},ulid(e){return this.check(G9(bB,e))},base64(e){return this.check(Q9(TB,e))},base64url(e){return this.check(eH(RB,e))},xid(e){return this.check(Y9(vB,e))},ksuid(e){return this.check(K9(wB,e))},ipv4(e){return this.check(X9(SB,e))},ipv6(e){return this.check(J9(kB,e))},cidrv4(e){return this.check(W9(EB,e))},cidrv6(e){return this.check($9(CB,e))},e164(e){return this.check(tH(jB,e))},datetime(e){return this.check(H2(W2,e))},date(e){return this.check(rH(cB,e))},time(e){return this.check(iH(uB,e))},duration(e){return this.check(oH(fB,e))}});function Le(e){return I9(aB,e)}const Rn=Ce("ZodStringFormat",(e,t)=>{Cn.init(e,t),J2.init(e,t)}),W2=Ce("ZodISODateTime",(e,t)=>{V8.init(e,t),Rn.init(e,t)}),cB=Ce("ZodISODate",(e,t)=>{U8.init(e,t),Rn.init(e,t)}),uB=Ce("ZodISOTime",(e,t)=>{Z8.init(e,t),Rn.init(e,t)}),fB=Ce("ZodISODuration",(e,t)=>{q8.init(e,t),Rn.init(e,t)}),dB=Ce("ZodEmail",(e,t)=>{j8.init(e,t),Rn.init(e,t)}),hB=Ce("ZodGUID",(e,t)=>{T8.init(e,t),Rn.init(e,t)}),jd=Ce("ZodUUID",(e,t)=>{R8.init(e,t),Rn.init(e,t)}),mB=Ce("ZodURL",(e,t)=>{I8.init(e,t),Rn.init(e,t)}),pB=Ce("ZodEmoji",(e,t)=>{D8.init(e,t),Rn.init(e,t)}),gB=Ce("ZodNanoID",(e,t)=>{_8.init(e,t),Rn.init(e,t)}),xB=Ce("ZodCUID",(e,t)=>{P8.init(e,t),Rn.init(e,t)}),yB=Ce("ZodCUID2",(e,t)=>{L8.init(e,t),Rn.init(e,t)}),bB=Ce("ZodULID",(e,t)=>{F8.init(e,t),Rn.init(e,t)}),vB=Ce("ZodXID",(e,t)=>{H8.init(e,t),Rn.init(e,t)}),wB=Ce("ZodKSUID",(e,t)=>{B8.init(e,t),Rn.init(e,t)}),SB=Ce("ZodIPv4",(e,t)=>{G8.init(e,t),Rn.init(e,t)}),kB=Ce("ZodIPv6",(e,t)=>{K8.init(e,t),Rn.init(e,t)}),EB=Ce("ZodCIDRv4",(e,t)=>{X8.init(e,t),Rn.init(e,t)}),CB=Ce("ZodCIDRv6",(e,t)=>{W8.init(e,t),Rn.init(e,t)}),TB=Ce("ZodBase64",(e,t)=>{$8.init(e,t),Rn.init(e,t)}),RB=Ce("ZodBase64URL",(e,t)=>{e9.init(e,t),Rn.init(e,t)}),jB=Ce("ZodE164",(e,t)=>{t9.init(e,t),Rn.init(e,t)}),NB=Ce("ZodJWT",(e,t)=>{r9.init(e,t),Rn.init(e,t)}),$2=Ce("ZodNumber",(e,t)=>{D2.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(i,s,l)=>OH(e,i,s,l);const 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},{gt(e,t){return this.check(iE(e,t))},gte(e,t){return this.check(mx(e,t))},min(e,t){return this.check(mx(e,t))},lt(e,t){return this.check(rE(e,t))},lte(e,t){return this.check(hx(e,t))},max(e,t){return this.check(hx(e,t))},int(e){return this.check(uE(e))},safe(e){return this.check(uE(e))},positive(e){return this.check(iE(0,e))},nonnegative(e){return this.check(mx(0,e))},negative(e){return this.check(rE(0,e))},nonpositive(e){return this.check(hx(0,e))},multipleOf(e,t){return this.check(oE(e,t))},step(e,t){return this.check(oE(e,t))},finite(){return this}});function zn(e){return sH($2,e)}const OB=Ce("ZodNumberFormat",(e,t)=>{i9.init(e,t),$2.init(e,t)});function uE(e){return lH(OB,e)}const AB=Ce("ZodBoolean",(e,t)=>{o9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>AH(e,n,i)});function Er(e){return aH(AB,e)}const MB=Ce("ZodUnknown",(e,t)=>{s9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>zH()});function fE(){return cH(MB)}const zB=Ce("ZodNever",(e,t)=>{l9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>MH(e,n,i)});function IB(e){return uH(zB,e)}const DB=Ce("ZodArray",(e,t)=>{Yb(),a9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>PH(e,n,i,s),e.element=t.element},{min(e,t){return this.check(hh(e,t))},nonempty(e){return this.check(hh(1,e))},max(e,t){return this.check(B2(e,t))},length(e,t){return this.check(V2(e,t))},unwrap(){return this.element}});function Yu(e,t){return SH(DB,e,t)}const _B=Ce("ZodObject",(e,t)=>{Yb(),f9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>LH(e,n,i,s),yF(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ho(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:fE()})},loose(){return this.clone({...this._zod.def,catchall:fE()})},strict(){return this.clone({...this._zod.def,catchall:IB()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return lF(this,e)},safeExtend(e){return aF(this,e)},merge(e){return cF(this,e)},pick(e){return oF(this,e)},omit(e){return sF(this,e)},partial(...e){return Pk(Q2,this,e[0])},exactPartial(...e){return Pk(ej,this,e[0],"exactPartial")},required(...e){return uF(tj,this,e[0])}});function ut(e,t){const n={type:"object",shape:e??{},...ot(t)};return new _B(n)}const PB=Ce("ZodUnion",(e,t)=>{d9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>FH(e,n,i,s),e.options=t.options});function LB(e,t){return new PB({type:"union",options:e,...ot(t)})}const FB=Ce("ZodIntersection",(e,t)=>{h9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>HH(e,n,i,s)});function HB(e,t){return new FB({type:"intersection",left:e,right:t})}const Ey=Ce("ZodEnum",(e,t)=>{m9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(i,s,l)=>IH(e,i,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(i,s)=>{const l={};for(const c of i)if(n.has(c))l[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Ey({...t,checks:[],...ot(s),entries:l})},e.exclude=(i,s)=>{const l={...t.entries};for(const c of i)if(n.has(c))delete l[c];else throw new Error(`Key ${c} not found in enum`);return new Ey({...t,checks:[],...ot(s),entries:l})}});function Ho(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Ey({type:"enum",entries:n,...ot(t)})}const BB=Ce("ZodTransform",(e,t)=>{Yb(),p9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>_H(e,n,i,s),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new w2(e.constructor.name);n.addIssue=l=>{if(typeof l=="string")n.issues.push(ju(l,n.value,t));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),"input"in c||(c.input=n.value),c.inst??(c.inst=e),n.issues.push(ju(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(l=>(n.value=l,n)):(n.value=s,n)}});function VB(e){return new BB({type:"transform",transform:e})}const Q2=Ce("ZodOptional",(e,t)=>{L2.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>X2(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function dE(e){return new Q2({type:"optional",innerType:e})}const ej=Ce("ZodExactOptional",(e,t)=>{g9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>X2(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function UB(e){return new ej({type:"optional",innerType:e})}const ZB=Ce("ZodNullable",(e,t)=>{x9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>BH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function hE(e){return new ZB({type:"nullable",innerType:e})}const qB=Ce("ZodDefault",(e,t)=>{y9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>UH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function GB(e,t){return new qB({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():x2(t)}})}const YB=Ce("ZodPrefault",(e,t)=>{b9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>ZH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function KB(e,t){return new YB({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():x2(t)}})}const tj=Ce("ZodNonOptional",(e,t)=>{v9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>VH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function XB(e,t){return new tj({type:"nonoptional",innerType:e,...ot(t)})}const JB=Ce("ZodCatch",(e,t)=>{w9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>qH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function WB(e,t){return new JB({type:"catch",innerType:e,catchValue:typeof t=="function"?t:vF(t)})}const $B=Ce("ZodPipe",(e,t)=>{S9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>GH(e,n,i,s),e.in=t.in,e.out=t.out});function mE(e,t){return new $B({type:"pipe",in:e,out:t})}const QB=Ce("ZodReadonly",(e,t)=>{k9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>YH(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function eV(e){return new QB({type:"readonly",innerType:e})}const tV=Ce("ZodCustom",(e,t)=>{E9.init(e,t),Hn.init(e,t),e._zod.processJSONSchema=(n,i,s)=>DH(e,n,i,s)});function nV(e,t={}){return kH(tV,e,t)}function rV(e,t){return EH(e,t)}function vi(e){return H2(W2,e)}function pE(e,t){let n=3735928559^t,i=1103547991^t;for(let s=0;s<e.length;s+=1){const l=e.charCodeAt(s);n=Math.imul(n^l,2654435761),i=Math.imul(i^l,1597334677)}return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),4294967296*(2097151&i)+(n>>>0)}function iV(e){const t=[e.path,e.oldPath??"",e.status,e.isBinary?"binary":"text",e.isUntracked?"untracked":"tracked",e.truncated?"clipped":"whole",`${e.additions},${e.deletions}`];for(const n of e.hunks){t.push(n.header);for(const i of n.lines)t.push(`${i.type[0]}${i.content}`)}return t.join("\0")}const oV=32;function sV(e){const t=iV(e);return`${pE(t,0).toString(16)}-${pE(t,2654435769).toString(16)}`}const um=120,Gs=zn().int().positive(),nj=ut({id:Gs,path:Le(),name:Le(),createdAt:vi(),updatedAt:vi()}),lV=ut({exists:Er(),isGitRepository:Er(),branch:Le().nullable(),detachedAt:Le().nullable(),isEmpty:Er(),rootCommit:Le().nullable(),error:Le().nullable()});nj.extend({git:lV});const aV=ut({path:Le().trim().min(1,"Choose a folder inside a git repository."),name:Le().trim().min(1,"Name cannot be empty.").max(um).optional()}),cV=ut({id:Gs,name:Le().trim().min(1,"Name cannot be empty.").max(um).optional(),path:Le().trim().min(1,"Path cannot be empty.").optional()}).refine(e=>e.name!==void 0||e.path!==void 0,{message:"Provide a new name or a new path.",path:["name"]});ut({id:Gs});ut({id:Gs});const Da=255,Ku=zn().int().positive(),rj=Ho(["ssh","wsl","websocket"]),ij=Le().trim().min(1,"Enter a host to connect to, like user@machine.").max(Da).refine(e=>!e.startsWith("-"),{message:'A host cannot start with "-".'}).refine(e=>!/[\s;&|`$(){}<>'"\\]/.test(e),{message:"A host can only contain a user name, an @ and a machine name."}),uV=Le().trim().min(1,"Choose a WSL distribution.").max(Da).refine(e=>!e.startsWith("-"),{message:'A distribution name cannot start with "-".'}).refine(e=>!/[\s;&|`$(){}<>'"\\/]/.test(e),{message:"That is not a WSL distribution name."}),fV=Le().trim().min(1,"Enter the machine, like pc-wsl or pc-wsl.tail0123.ts.net.").max(Da).refine(e=>!e.startsWith("-"),{message:'A machine name cannot start with "-".'}).refine(e=>{try{return new URL(/^https?:\/\//i.test(e)?e:`http://${e}`).hostname.length>0}catch{return!1}},{message:"That is not a machine name or an address."}).refine(e=>{const t=e.replace(/^https?:\/\//i,"").split(/[:/]/)[0]?.toLowerCase()??"";return t!=="localhost"&&t!=="127.0.0.1"&&t!=="::1"},{message:"That is this computer. A host is another machine."});function dV(e){return e==="wsl"?uV:e==="websocket"?fV:ij}ut({name:Le(),isDefault:Er(),running:Er(),alreadyAdded:Er()});const hV=ut({id:Ku,instanceId:Le().nullable(),label:Le(),kind:rj,target:Le(),editorTarget:Le().nullable(),lastSeenAt:vi().nullable(),daemonVersion:Le().nullable(),createdAt:vi()}),mV=ut({connected:Er(),failures:zn().int().nonnegative(),lastError:Le().optional(),retryAfter:zn().optional()}),pV=hV.extend({state:mV}),gV=ut({target:Le().trim().min(1).max(Da),label:Le().trim().min(1,"Name cannot be empty.").max(um).optional(),kind:rj.optional(),editorTarget:Le().trim().max(Da).optional()}).superRefine((e,t)=>{const n=dV(e.kind??"ssh").safeParse(e.target);if(!n.success)for(const i of n.error.issues)t.addIssue({code:"custom",message:i.message,path:["target"]})}),xV=ut({id:Ku,label:Le().trim().min(1,"Name cannot be empty.").max(um).optional(),target:ij.optional(),editorTarget:Le().trim().max(Da).nullable().optional()}).refine(e=>e.label!==void 0||e.target!==void 0||e.editorTarget!==void 0,{message:"Provide something to change.",path:["label"]});ut({id:Ku});ut({id:Ku});ut({id:Ku,force:Er().optional()});const yV=Ho(["installed","upgraded","already-current"]);ut({action:yV,version:Le(),previousVersion:Le().nullable(),target:Le(),bytes:zn().int().nonnegative(),host:pV});const oj=200,sj=2e4,bV=255,Br=zn().int().positive(),Kb=Ho(["open","closed"]),ph=Le().trim().min(1,"Choose a branch.").max(bV,"That ref name is too long.").refine(e=>!e.startsWith("-"),{message:'A ref cannot start with "-".'}),vV=ut({id:Br,repositoryId:Gs,title:Le(),description:Le(),baseRef:Le(),headRef:Le(),status:Kb,createdAt:vi(),updatedAt:vi(),closedAt:vi().nullable()});vV.extend({repository:nj});ut({repositoryId:Gs.optional(),status:Kb.optional()});const wV=ut({repositoryId:Gs,title:Le().trim().min(1,"Title cannot be empty.").max(oj).optional(),description:Le().max(sj).optional(),baseRef:ph,headRef:ph});function Xa(e){return e.baseRef===e.headRef}function SV(e,t){return Xa({baseRef:e,headRef:t})?`Uncommitted work on ${t}`:`${t} into ${e}`}const kV=ut({id:Br,title:Le().trim().min(1,"Title cannot be empty.").max(oj).optional(),description:Le().max(sj).optional(),baseRef:ph.optional(),headRef:ph.optional(),status:Kb.optional()}).refine(e=>e.title!==void 0||e.description!==void 0||e.baseRef!==void 0||e.headRef!==void 0||e.status!==void 0,{message:"Provide at least one field to change.",path:["title"]});ut({id:Br});ut({id:Br});ut({id:Br});const EV=["committed","all","uncommitted"],fm=Ho(EV).optional().default("all");ut({id:Br,changes:fm});ut({id:Br,changes:fm});const lj=ut({id:Br,path:Le().min(1).max(4096),changes:fm});lj.extend({side:Ho(["base","head"])});lj.extend({line:zn().int().min(1).optional().default(1),editorId:Le().max(64).optional(),host:Le().max(200).optional()});ut({id:Gs});ut({reviewId:Br,filePath:Le(),contentDigest:Le(),reviewedAt:Le()});ut({reviewId:Br});ut({reviewId:Br,filePath:Le().min(1).max(4096),contentDigest:Le().min(1).max(oV).nullable()});const CV=2e4,TV=60,Xb=zn().int().positive(),dm=zn().int().positive(),aj=Ho(["base","head"]),RV=ut({kind:Ho(["human","agent"]),name:Le(),label:Le().nullable(),session:Le().nullable()}),jV=ut({url:Le(),path:Le(),alt:Le(),mimeType:Le(),byteSize:zn().int(),width:zn().int().nullable(),height:zn().int().nullable()});ut({sha:Le(),url:Le(),path:Le(),mimeType:Le(),byteSize:zn().int(),width:zn().int().nullable(),height:zn().int().nullable(),originalName:Le().nullable()});const NV=ut({id:Xb,threadId:dm,author:RV,body:Le(),attachments:Yu(jV),createdAt:vi(),updatedAt:vi()}),OV=ut({type:Ho(["context","insert","delete"]),content:Le(),oldNumber:zn().int().nullable(),newNumber:zn().int().nullable()}),AV=ut({lines:Yu(OV),clipped:Er()});ut({id:dm,reviewId:Br,filePath:Le().nullable(),side:aj.nullable(),line:zn().int().positive().nullable(),startLine:zn().int().positive().nullable(),anchorText:Le().nullable(),anchorSha:Le().nullable(),anchorSnapshot:AV.nullable(),resolvedAt:vi().nullable(),resolvedBy:Le().nullable(),createdAt:vi(),updatedAt:vi(),comments:Yu(NV)});const Jb=Le().trim().min(1,"Write something first.").max(CV,"That comment is too long.");ut({reviewId:Br});ut({reviewId:Br,body:Jb,filePath:Le().trim().min(1).optional(),side:aj.optional().default("head"),line:zn().int().positive().optional(),startLine:zn().int().positive().optional(),changes:fm}).refine(e=>e.filePath===void 0==(e.line===void 0),{message:"A line comment needs both a file and a line number.",path:["line"]}).refine(e=>e.startLine===void 0||e.line!==void 0,{message:"A range needs a line to end at.",path:["startLine"]}).refine(e=>e.startLine===void 0||e.startLine<=(e.line??0),{message:"The range has to start at or before the line it ends on.",path:["startLine"]});ut({threadId:dm,body:Jb});ut({id:Xb,body:Jb});ut({id:Xb});ut({threadId:dm,resolved:Er()});Le().trim().min(1,"A label cannot be empty.").max(TV,"That label is too long.");ut({name:Le().regex(VM,"That is not an attachment name.")});ut({name:Le(),mimeType:Le(),byteSize:zn().int(),base64:Le()});ut({host:Le().max(200).optional()});ut({path:Le().max(4096).optional()});const MV=ut({name:Le(),path:Le(),isRepository:Er(),isHidden:Er()});ut({path:Le(),parent:Le().nullable(),home:Le(),separator:Le(),entries:Yu(MV),truncated:Er()});ut({available:Er(),dnsName:Le().nullable(),login:Le().nullable(),exposed:Er(),webRoot:Le().nullable()});ut({exposed:Er()});ut({dnsName:Le(),origin:Le(),instanceId:Le(),version:Le().nullable(),alreadyAdded:Le().nullable()});function _a(e,t){const n=e.safeParse(t);if(n.success)return n.data;const i=C2(n.error),s={};for(const[c,u]of Object.entries(i.fieldErrors))u&&u.length>0&&(s[c]=u);const l=i.formErrors[0]??Object.values(s)[0]?.[0]??"The values provided are not valid.";throw new Eh("INVALID_INPUT",l,s)}function zV({open:e,onOpenChange:t,host:n,onAdded:i}){return d.jsx(Ba,{open:e,onOpenChange:t,children:d.jsx(Va,{children:e&&d.jsx(IV,{host:n,onAdded:i,onDone:()=>t(!1)},n?.id??"new")})})}function IV({host:e,onDone:t,onAdded:n}){const i=e!==void 0,{addHost:s,updateHost:l}=qu(),{distros:c,isLoading:u}=S6(!i),{data:m}=dn(i?null:Ut.tailnet,()=>Lt.hosts.tailnet()),[h,p]=w.useState(e?.kind??"ssh"),[g,y]=w.useState(e?.target??""),[b,S]=w.useState(e?.label??""),[k,E]=w.useState(e?.editorTarget??""),[C,T]=w.useState(!1),[R,N]=w.useState(null),I=!i&&c!==void 0&&c.length>0,M=!i&&m?.available===!0,P=I||M;function A(F){F!==h&&(p(F),y(""),N(null))}async function L(F){F.preventDefault(),T(!0),N(null);try{if(e){const V=_a(xV,{id:e.id,label:b.trim(),...g.trim()!==e.target?{target:g.trim()}:{},editorTarget:k.trim()||null});await l(V)}else{const V=b.trim(),Y=k.trim(),te=_a(gV,{target:g.trim(),kind:h,...V?{label:V}:{},...Y?{editorTarget:Y}:{}}),O=await s(te);t(),n?.(O);return}t()}catch(V){N(V)}finally{T(!1)}}const D=wl(R,"target"),U=wl(R,"label"),q=R&&!D&&!U?Jt(R):null,K=h==="wsl",G=h==="websocket",B=!(i&&e.kind==="wsl");return d.jsxs("form",{onSubmit:F=>{L(F)},noValidate:!0,children:[d.jsxs(Zu,{children:[d.jsx(Ua,{children:i?"Edit host":"Add host"}),d.jsx(Za,{children:i?"Rename this machine, or point it somewhere else if the address changed.":K?"A Linux distribution running on this PC. GitWarren talks to it through wsl.exe — nothing to configure, and nothing listening on a port.":G?'A machine on your tailnet with "Reachable on your tailnet" turned on in its own GitWarren. Nothing is installed onto it from here — it is already running, and Tailscale is what says you are its owner.':"Anything your own ssh can reach: a config alias, a tailnet name, user@address. GitWarren never asks for a password — your SSH agent and config do the authenticating."})]}),d.jsxs("div",{className:"flex flex-col gap-4",children:[P&&d.jsxs(Ii,{children:[d.jsx(Di,{children:"Connect by"}),d.jsxs("div",{className:"flex flex-wrap gap-2",children:[d.jsx(px,{selected:h==="ssh",label:"SSH",onSelect:()=>A("ssh")}),M&&d.jsx(px,{selected:G,label:"Tailnet",onSelect:()=>A("websocket")}),I&&d.jsx(px,{selected:K,label:"WSL",onSelect:()=>A("wsl")})]})]}),B&&(K?d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"host-distro",children:"Distribution"}),d.jsx(DV,{distros:c??[],loading:u,selected:g,onSelect:y}),d.jsx(El,{children:D}),!D&&d.jsx(Es,{children:"GitWarren runs as that distribution's own default user."})]}):d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"host-target",children:G?"Machine":"SSH host"}),d.jsx(Os,{id:"host-target",value:g,onChange:F=>y(F.target.value),placeholder:G?"pc-wsl":"user@machine",className:"font-mono text-xs","data-invalid":D?"":void 0,autoComplete:"off",spellCheck:!1}),d.jsx(El,{children:D}),!D&&d.jsx(Es,{children:G?"Its name on your tailnet. No user name — Tailscale already knows who you are.":"Include the user name: a bare tailnet name asks for your local one."})]})),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"host-label",children:"Display name"}),d.jsx(Os,{id:"host-label",value:b,onChange:F=>S(F.target.value),placeholder:g.includes("@")?g.slice(g.indexOf("@")+1):"Defaults to the host","data-invalid":U?"":void 0,autoComplete:"off"}),d.jsx(El,{children:U}),!U&&!i&&d.jsxs(Es,{children:["Leave blank to use the ",K?"distribution":"machine"," name."]})]}),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"host-editor-target",children:"Editor host"}),d.jsx(Os,{id:"host-editor-target",value:k,onChange:F=>E(F.target.value),placeholder:K?g.trim()?`wsl+${g.trim()}`:"wsl+<distribution>":g.trim()||"Same as the SSH host",className:"font-mono text-xs",autoComplete:"off",spellCheck:!1}),d.jsxs(Es,{children:["Only if your editor knows this machine by a different name. Blank means the"," ",K?"distribution above":"SSH host above","."]})]}),q&&d.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:q})]}),d.jsxs(nm,{children:[d.jsx(Ve,{type:"button",variant:"ghost",onClick:t,children:"Cancel"}),d.jsxs(Ve,{type:"submit",disabled:C,children:[C&&d.jsx(wi,{className:"animate-spin"}),i?"Save changes":"Add host"]})]})]})}function px({selected:e,label:t,onSelect:n}){return d.jsx(Ve,{type:"button",variant:e?"secondary":"ghost",size:"sm","aria-pressed":e,onClick:n,children:t})}function DV({distros:e,loading:t,selected:n,onSelect:i}){return t?d.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",children:[d.jsx(wi,{className:"size-3 animate-spin"})," Looking for distributions…"]}):e.length===0?d.jsx("p",{className:"text-muted-foreground text-sm",children:"This machine has no WSL distributions."}):d.jsx("div",{id:"host-distro",className:"flex flex-col gap-1",children:e.map(s=>d.jsxs("button",{type:"button",disabled:s.alreadyAdded,"aria-pressed":n===s.name,onClick:()=>i(s.name),className:Te("flex items-center justify-between rounded-md border px-3 py-2 text-left text-sm",n===s.name?"border-primary bg-primary/5":"border-border",s.alreadyAdded&&"cursor-not-allowed opacity-50"),children:[d.jsx("span",{className:"font-mono text-xs",children:s.name}),d.jsx("span",{className:"text-muted-foreground text-xs",children:s.alreadyAdded?"already added":[s.isDefault?"default":null,s.running?"running":"stopped"].filter(Boolean).join(" · ")})]},s.name))})}function _V(e){return QR("alert-dialog",e)}const hm=_V;function mm({className:e,children:t,...n}){return d.jsxs(WR,{children:[d.jsx(YR,{className:Te("fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] transition-opacity duration-150","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0")}),d.jsx(JR,{className:Te("fixed left-1/2 top-1/2 z-50 w-full max-w-md -translate-x-1/2 -translate-y-1/2","rounded-lg border border-border bg-card p-5 text-card-foreground shadow-xl","transition-all duration-150","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",e),...n,children:t})]})}function pm({className:e,...t}){return d.jsx("div",{className:Te("flex flex-col gap-1.5",e),...t})}function gm({className:e,...t}){return d.jsx(e2,{className:Te("text-base font-semibold leading-none tracking-tight",e),...t})}function xm({className:e,...t}){return d.jsx(KR,{className:Te("text-sm text-muted-foreground",e),...t})}function ym({className:e,...t}){return d.jsx("div",{className:Te("mt-5 flex justify-end gap-2",e),...t})}function gE(e){return`${(e/1e6).toFixed(1)} MB`}function PV(e){if(e.kind==="error")return`Could not install on “${e.label}”`;switch(e.report.action){case"installed":return`GitWarren is on “${e.label}”`;case"upgraded":return`“${e.label}” is up to date`;case"already-current":return`“${e.label}” was already up to date`}}function LV(e){if(e.kind==="error")return e.message;const{action:t,version:n,previousVersion:i,target:s,bytes:l}=e.report;switch(t){case"installed":return`Version ${n} for ${s}, ${gE(l)} sent over the connection. The launcher at ~/.gitwarren/bin/gitwarren is what everything points at from now on, so an agent configured against it will survive every update.`;case"upgraded":return`Upgraded from ${i??"an unknown version"} to ${n} for ${s}, ${gE(l)} sent. The old version is still in ~/.gitwarren/daemon if you need to go back to it.`;case"already-current":return`${n} is already installed for ${s}, so nothing was sent. Use it anyway if you think the install there is damaged — the button reinstalls when the version matches.`}}function FV({outcome:e,onClose:t}){const n=e?.kind==="error";return d.jsx(hm,{open:e!==null,onOpenChange:i=>{i||t()},children:d.jsxs(mm,{children:[d.jsxs(pm,{children:[d.jsxs(gm,{className:"flex items-center gap-2",children:[n?d.jsx(YC,{className:"size-5 shrink-0 text-destructive"}):d.jsx(GC,{className:"size-5 shrink-0 text-success"}),e&&PV(e)]}),d.jsx(xm,{className:"break-words",children:e&&d.jsx(Xn,{text:LV(e)})})]}),d.jsx(ym,{children:d.jsx(Ve,{onClick:t,children:"Close"})})]})})}function HV({host:e,onOpenChange:t}){const{removeHost:n}=qu(),[i,s]=w.useState(!1),[l,c]=w.useState(null);async function u(){if(e){s(!0),c(null);try{await n(e.id),t(!1)}catch(m){c(m)}finally{s(!1)}}}return d.jsx(hm,{open:e!==null,onOpenChange:m=>{m||c(null),t(m)},children:d.jsxs(mm,{children:[d.jsxs(pm,{children:[d.jsxs(gm,{children:["Forget “",e?.label,"”?"]}),d.jsxs(xm,{children:["This removes the machine from this GitWarren’s list. Nothing is uninstalled: the daemon under ",d.jsx("code",{children:"~/.gitwarren"})," over there stays where it is, and an agent configured against it keeps working."]})]}),e&&d.jsx("p",{"data-selectable":!0,className:"mt-3 break-words rounded-md bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:e.target})}),l!==null&&d.jsx("p",{role:"alert",className:"mt-3 text-sm text-destructive",children:Jt(l)}),d.jsxs(ym,{children:[d.jsx(Ve,{variant:"ghost",onClick:()=>t(!1),disabled:i,children:"Cancel"}),d.jsxs(Ve,{variant:"destructive",onClick:()=>{u()},disabled:i,children:[i&&d.jsx(wi,{className:"animate-spin"}),"Forget host"]})]})]})})}const cj=w.createContext(void 0);function BV(){const e=w.useContext(cj);if(e===void 0)throw new Error(En(63));return e}const uj={...Bs,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},VV=w.forwardRef(function(t,n){const{checked:i,className:s,defaultChecked:l,"aria-labelledby":c,form:u,id:m,inputRef:h,name:p,nativeButton:g=!1,onCheckedChange:y,readOnly:b=!1,required:S=!1,disabled:k=!1,render:E,uncheckedValue:C,value:T,style:R,...N}=t,{clearErrors:I}=Vs(),{state:M,setTouched:P,setDirty:A,validityData:L,setFilled:D,setFocused:U,validationMode:q,disabled:K,name:G,validation:B}=qi(),{labelId:F}=ki(),V=K||k,Y=G??p,te=w.useRef(null),O=Ui(te,h,B.inputRef),_=w.useRef(null),Z=Or(),z=qa({id:m,implicit:!1,controlRef:_}),J=g?void 0:z,[ne,W]=Io({controlled:i,default:!!l,name:"Switch",state:"checked"});Gu(_,Z,ne,void 0,!V,p),Me(()=>{te.current&&D(te.current.checked)},[D]),ks(ne,()=>{I(Y),A(ne!==L.initialValue),D(ne),B.change(ne)});const{getButtonProps:de,buttonRef:ie}=Lo({disabled:V,native:g}),oe=m2(c,F,te,!g,J),Se={id:g?z:Z,role:"switch","aria-checked":ne,"aria-readonly":b||void 0,"aria-required":S||void 0,"aria-labelledby":oe,onFocus(){V||U(!0)},onBlur(){const Re=te.current;!Re||V||(P(!0),U(!1),q==="onBlur"&&B.commit(Re.checked))},onClick(Re){if(b||V)return;Re.preventDefault();const Ie=te.current;Ie&&fu(Ie,Re)}},ye={...B.getValidationProps(V),checked:ne,disabled:V,form:u,id:J,name:Y,required:S,style:Y?Bu:Hu,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:O,onChange(Re){if(Re.nativeEvent.defaultPrevented)return;if(b){Re.preventDefault();return}const Ie=Re.currentTarget.checked,fe=Xe(On,Re.nativeEvent);y?.(Ie,fe),!fe.isCanceled&&W(Ie)},onClick(Re){Re.stopPropagation()},onFocus(){_.current?.focus()},...T!==void 0?{value:T}:wn},xe=w.useMemo(()=>({...M,checked:ne,disabled:V,readOnly:b,required:S}),[M,ne,V,b,S]),we=jt("span",t,{state:xe,ref:[n,_,ie],props:[Se,N,de,Re=>B.getValidationProps(V,Re)],stateAttributesMapping:uj});return d.jsxs(cj.Provider,{value:xe,children:[we,!ne&&Y&&C!==void 0&&d.jsx("input",{type:"hidden",form:u,name:Y,value:C,disabled:V}),d.jsx("input",{...ye,suppressHydrationWarning:!0})]})}),UV=w.forwardRef(function(t,n){const{render:i,className:s,style:l,...c}=t,u=BV();return jt("span",t,{state:u,ref:n,stateAttributesMapping:uj,props:c})});function Wb({className:e,...t}){return d.jsx(VV,{className:Te("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent","bg-muted transition-colors data-[checked]:bg-primary","disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:d.jsx(UV,{className:Te("pointer-events-none block size-4 translate-x-0.5 rounded-full bg-background shadow-sm transition-transform","data-[checked]:translate-x-[1.125rem]")})})}function ZV(){const{data:e,mutate:t}=Db(),[n,i]=w.useState(null),s=n!==null,[l,c]=w.useState(null),u=w.useRef(null);if(!e?.available)return null;async function m(h){i(h),c(null);try{await t(Lt.hosts.setTailnetExposure({exposed:h}),{revalidate:!1})}catch(p){c(Jt(p)),t()}finally{i(null)}}return d.jsxs(kt,{className:"flex flex-col gap-3 p-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(KI,{className:"size-4 shrink-0 text-muted-foreground"}),d.jsxs("label",{htmlFor:"tailnet-exposed",className:"min-w-40 flex-1 cursor-pointer",children:[d.jsx("span",{className:"block text-sm font-medium",children:"Reachable on your tailnet"}),d.jsxs("span",{className:"block text-xs text-muted-foreground",children:["Your other machines can add this one as a host, and you can open its reviews in a browser on any device signed in as ",e.login,"."]})]}),d.jsx(Wb,{id:"tailnet-exposed",checked:e.exposed,disabled:s,onCheckedChange:h=>{m(h)}})]}),s?d.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[d.jsx(wi,{className:"size-3 shrink-0 animate-spin"}),n?"Putting this machine on your tailnet…":"Taking it off your tailnet…"]}):null,!s&&e.exposed&&e.webRoot?d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("a",{ref:u,href:e.webRoot,target:"_blank",rel:"noreferrer noopener","data-selectable":!0,className:"min-w-0 flex-1 font-mono text-xs text-primary underline underline-offset-2 hover:no-underline",children:d.jsx(Xn,{text:e.webRoot})}),d.jsx(Eb,{label:"Copy this machine's tailnet address",text:e.webRoot,source:u,className:"shrink-0"})]}):null,l?d.jsx("p",{className:"text-xs text-destructive",children:l}):null]})}function qV(){const{hosts:e,error:t,isLoading:n,isRefreshing:i,refresh:s}=a2(),{probeHost:l,installOnHost:c}=qu(),{data:u}=dn(Ut.appInfo,()=>Lt.system.appInfo()),{data:m}=Db(),h=m?.available===!0,[p,g]=w.useState(!1),[y,b]=w.useState(void 0),[S,k]=w.useState(null),[E,C]=w.useState(null),[T,R]=w.useState(null),N=w.useCallback(()=>{b(void 0),g(!0)},[]);function I(L){b(L),g(!0)}async function M(L){C({id:L.id,what:"probe"});try{await l(L.id)}catch(D){R({kind:"error",label:L.label,message:Jt(D)})}finally{C(null)}}async function P(L){C({id:L.id,what:"probe"});try{await l(L.id)}catch{}finally{C(null)}}async function A(L){C({id:L.id,what:"install"});try{const D=await c(L.id);R({kind:"done",label:L.label,report:D})}catch(D){R({kind:"error",label:L.label,message:Jt(D)})}finally{C(null)}}return Il(w.useMemo(()=>[{id:"hosts:add",label:"Add host",group:"Hosts",keys:"n",keywords:"ssh machine remote server vps wsl",icon:Bi,run:N},{id:"hosts:refresh",label:"Refresh hosts",group:"Hosts",keys:"r",keywords:"reload reachable status",icon:sr,run:()=>{s()}}],[N,s])),d.jsxs("section",{className:"flex flex-col gap-4",children:[d.jsxs("div",{children:[d.jsxs(Ve,{variant:"ghost",size:"sm",className:"-ml-2 mb-2 text-muted-foreground",onClick:()=>An({name:"repositories"}),children:[d.jsx(Cs,{}),"Repositories"]}),d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Iu,{className:"size-5 shrink-0 text-muted-foreground"}),d.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:"Hosts"})]}),d.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n?"Loading…":`${e?.length??0} machine${e?.length===1?"":"s"}${i?" · refreshing…":""}`})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[d.jsx(Ln,{label:"Re-read reachability",children:d.jsx(Ve,{variant:"outline",size:"icon",onClick:()=>{s()},disabled:n,"aria-label":"Refresh",children:d.jsx(sr,{className:i?"animate-spin":void 0})})}),d.jsxs(Ve,{onClick:N,children:[d.jsx(Bi,{}),"Add host"]})]})]})]}),h&&d.jsx(xE,{children:"This machine"}),d.jsx(ZV,{}),h&&d.jsx(xE,{children:"Other machines"}),d.jsx(N6,{onAdded:L=>{P(L)}}),n&&d.jsx(GV,{}),!n&&t!==void 0&&d.jsx(KV,{error:t,onRetry:()=>{s()}}),!n&&t===void 0&&e?.length===0&&d.jsx(YV,{onAdd:N}),!n&&t===void 0&&e&&e.length>0&&d.jsx("ul",{className:"flex flex-col gap-2",children:e.map(L=>d.jsx("li",{children:d.jsx(O6,{host:L,appVersion:u?.version,busy:E?.id===L.id?E.what:null,onProbe:D=>{M(D)},onInstall:D=>{A(D)},onEdit:I,onRemove:k})},L.id))}),d.jsx(zV,{open:p,onOpenChange:g,host:y,onAdded:L=>{P(L)}}),d.jsx(HV,{host:S,onOpenChange:L=>{L||k(null)}}),d.jsx(FV,{outcome:T,onClose:()=>R(null)})]})}function xE({children:e}){return d.jsx("h2",{className:"-mb-1 mt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e})}function GV(){return d.jsx("ul",{className:"flex flex-col gap-2","aria-busy":"true","aria-label":"Loading hosts",children:[0,1].map(e=>d.jsx("li",{children:d.jsxs(kt,{className:"flex flex-col gap-3 p-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(yt,{className:"h-4 w-32"}),d.jsx(yt,{className:"h-4 w-24"})]}),d.jsx(yt,{className:"h-3 w-56"}),d.jsx(yt,{className:"h-8 w-40 rounded-md"})]})},e))})}function YV({onAdd:e}){return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-dashed px-6 py-14 text-center",children:[d.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground",children:d.jsx(Iu,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"No other machines yet"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Add a machine you can already reach over ssh — a PC’s WSL, a VPS, a build box — and GitWarren will install itself there over the same connection. The host needs nothing but git."})]}),d.jsxs(Ve,{onClick:e,className:"mt-1",children:[d.jsx(Bi,{}),"Add your first host"]})]})}function KV({error:e,onRetry:t}){return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-destructive/40 px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-destructive/10 p-3 text-destructive",children:d.jsx(Hi,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Could not load your hosts"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:Jt(e)})]}),d.jsxs(Ve,{variant:"outline",onClick:t,className:"mt-1",children:[d.jsx(sr,{}),"Try again"]})]})}function XV(){const{mutate:e}=_s();w.useEffect(()=>nT((t,n)=>{n.offlineSince===null&&e(i=>typeof i=="string"&&(i===Ut.hosts||i.endsWith(`@${t}`)))}),[e]),w.useEffect(()=>Lt.connection.subscribe(t=>{t&&e(()=>!0)}),[e])}function JV(e){switch(e){case"darwin":return"GitWarren opens in the menu bar when you log in, with no window.";case"win32":return"GitWarren opens in the notification area when you sign in, with no window.";default:return"GitWarren opens in the system tray when you log in, with no window."}}function WV(){const{data:e}=dn(Ut.appInfo,()=>Lt.system.appInfo()),{data:t,mutate:n}=dn(Lt.capabilities.openAtLogin?Ut.openAtLogin:null,()=>Lt.system.getOpenAtLogin()),[i,s]=w.useState(!1);if(!Lt.capabilities.openAtLogin||!e||t===void 0)return null;async function l(c){s(!0);try{await n(Lt.system.setOpenAtLogin(c),{optimisticData:c,revalidate:!1})}finally{s(!1)}}return d.jsxs(kt,{className:"flex items-center gap-3 p-4",children:[d.jsx(CD,{className:"size-4 shrink-0 text-muted-foreground"}),d.jsxs("label",{htmlFor:"open-at-login",className:"flex-1 cursor-pointer",children:[d.jsx("span",{className:"block text-sm font-medium",children:"Start GitWarren at login"}),d.jsx("span",{className:"block text-xs text-muted-foreground",children:JV(e.platform)})]}),d.jsx(Wb,{id:"open-at-login",checked:t,disabled:i,onCheckedChange:c=>{l(c)}})]})}function $V(e,t){const i=t.replace(/^\/+/,"").split("/").join("\\");return`\\\\wsl.localhost\\${e}${i?`\\${i}`:""}`}function fj(e){const t=$n(),{data:n}=dn(t===void 0?null:Ut.hosts,()=>Lt.hosts.list()),{data:i}=dn(t===void 0?null:Ut.appInfo,()=>Lt.system.appInfo());if(t===void 0)return e;if(n===void 0||i===void 0)return null;const s=n.find(l=>l.instanceId===t);return s===void 0||s.kind!=="wsl"||i.platform!=="win32"?null:$V(s.target,e)}function dj({className:e,...t}){return d.jsx("textarea",{className:Te("flex min-h-20 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50","data-[invalid]:border-destructive",e),...t})}function hj(e){const t=w.useRef(!0);t.current&&(t.current=!1,e())}function QV(e,t,n,i,s,l,c,u,m,h=2){const p=Q4(n.current,{event:e,orientation:i,loopFocus:s,rtl:l,cols:h,disabledIndices:c,minIndex:u,maxIndex:m,prevIndex:t>m?u:t,stopEvent:!0});return js(n.current,p)?void 0:p}const mj=w.createContext(void 0),pj=w.createContext(void 0),gj=w.createContext(void 0),xj=w.createContext(!1),yj=w.createContext("");function Ci(){const e=w.useContext(mj);if(!e)throw new Error(En(22));return e}function bm(){const e=w.useContext(pj);if(!e)throw new Error(En(23));return e}function Xu(){const e=w.useContext(gj);if(!e)throw new Error(En(24));return e}function bj(){return w.useContext(yj)}function eU(){return w.useContext(xj)}const vj=(e,t)=>Object.is(e,t);function Si(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function tU(e,t,n){return!e||e.length===0?!1:e.some(i=>i===void 0?!1:Si(t,i,n))}function ja(e,t,n){return!e||e.length===0?-1:e.findIndex(i=>i===void 0?!1:Si(i,t,n))}function gx(e,t,n,i){const s=i&&Array.isArray(t)?t[t.length-1]:t,l=ja(e,s,n);return l===-1?null:l}function wj(e,t,n){return e.filter(i=>!Si(t,i,n))}function Cy(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function $b(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Sj(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if($b(t)){for(const n of t)for(const i of n.items)if(i&&i.value==null&&i.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function pi(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Cy(e)}function _i(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Cy(e.value):Cy(e)}function Qb(e,t,n){function i(){return pi(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??i();if(Array.isArray(t)){const s=t,l=$b(s)?s.flatMap(c=>c.items):s;if(e==null||typeof e!="object"){const c=l.find(u=>u.value===e);return c&&c.label!=null?c.label:i()}if("value"in e){const c=l.find(u=>u&&u.value===e.value);if(c&&c.label!=null)return c.label}}return i()}function kj(e,t,n){return e.reduce((i,s,l)=>(l>0&&i.push(", "),i.push(d.jsx(w.Fragment,{children:Qb(s,t,n)},l)),i),[])}const Pe={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectedValue:e=>{const{selectedValue:t,selectionMode:n}=e;return t==null?!1:n==="multiple"&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Sj(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,i=e.selectedValue;return Array.isArray(i)?i.some(s=>Si(t,s,n)):Si(t,i,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function Ej(e){return e==null?void 0:`${e}-popup`}function nU(e,t){return(n,i)=>n==null?!1:e.contains(n,i,t)}function Cj(e){return Array.isArray(e)?e.map(t=>Cj(t)).join(","):e==null?"":String(e)}const yE=new Map;function rU(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${Cj(e.locale)}|${JSON.stringify(t)}`,i=yE.get(n);if(i)return i;const s=new Intl.Collator(e.locale,t),l={contains(c,u,m){if(!u)return!0;const h=pi(c,m);for(let p=0;p<=h.length-u.length;p+=1)if(s.compare(h.slice(p,p+u.length),u)===0)return!0;return!1},startsWith(c,u,m){if(!u)return!0;const h=pi(c,m);return s.compare(h.slice(0,u.length),u)===0},endsWith(c,u,m){if(!u)return!0;const h=pi(c,m),p=u.length;return h.length>=p&&s.compare(h.slice(h.length-p),u)===0}};return yE.set(n,l),l}const iU=rU;function oU(e,t=!1){const{overflowY:n}=Fr(e);return n!=="auto"&&n!=="scroll"?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}function Tj(e,t,n=(i,s)=>i===s){return e.length===t.length&&e.every((i,s)=>n(i,t[s]))}const Rj=Symbol("none"),xx={value:Rj,index:-1};function sU(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:i=null,selectedValue:s,onSelectedValueChange:l,defaultInputValue:c,inputValue:u,open:m,defaultOpen:h=!1,selectionMode:p,onItemHighlighted:g,name:y,form:b,disabled:S=!1,readOnly:k=!1,required:E=!1,inputRef:C,grid:T=!1,items:R,filteredItems:N,filter:I,openOnInputClick:M=!0,autoHighlight:P=!1,keepHighlight:A=!1,highlightItemOnHover:L=!0,loopFocus:D=!0,itemToStringLabel:U,itemToStringValue:q,isItemEqualToValue:K=vj,virtualized:G=!1,inline:B=!1,fillInputOnItemPress:F=!0,modal:V=!1,limit:Y=-1,autoComplete:te="list",formAutoComplete:O,locale:_,submitOnItemClick:Z=!1}=e,{clearErrors:z}=Vs(),{setDirty:J,validityData:ne,setFilled:W,name:de,disabled:ie,setTouched:oe,setFocused:Se,validationMode:ye,validation:xe}=qi(),we=Uu(),Re=qa({id:t}),Ie=iU({locale:_}),[fe,be]=w.useState(!1),[Oe,je]=w.useState(null),De=w.useRef([]),Ze=w.useRef([]),qe=w.useRef(null),ge=w.useRef(null),re=w.useRef(null),le=w.useRef(null),$=w.useRef(null),Q=w.useRef(!0),he=w.useRef(!1),Ne=w.useRef(null),_e=w.useRef(null),Ge=w.useRef(null),dt=w.useRef(xx),rt=w.useRef(null),at=w.useRef([]),Nt=w.useRef(null),Je=ie||S,_t=de??y,Fe=p==="multiple",pt=p==="single",Et=u!==void 0||c!==void 0,wt=R!==void 0,tt=N!==void 0;let ht;P==="always"?ht="always":ht=P?"input-change":!1;const[et,Wt]=Io({controlled:s,default:Fe?i??Pi:i,name:"Combobox",state:"selectedValue"}),Bn=w.useMemo(()=>I===null?()=>!0:I!==void 0?I:nU(Ie,U),[I,Ie,U]),In=Jn(()=>Et?c??"":pt?pi(et,U):"").current,[nn,Sn]=Io({controlled:u,default:In,name:"Combobox",state:"inputValue"}),[Ft,Ar]=Io({controlled:m,default:h,name:"Combobox",state:"open"}),lr=$b(R),st=Oe??String(nn).trim(),Yt=pt?pi(et,U):"",Vn=pt&&!fe&&st!==""&&Yt.length===st.length&&Ie.contains(Yt,st),Dn=Vn?"":st,gr=wt&&tt&&Vn,yn=w.useMemo(()=>R?lr?R.flatMap(He=>He.items):R:Pi,[R,lr]),Zt=w.useMemo(()=>{if(N&&!gr)return N;if(!R)return Pi;if(lr){const Ue=R,Kt=[];let Vt=0;for(const rn of Ue){if(Y>-1&&Vt>=Y)break;const nr=Y>-1?Y-Vt:1/0,on=Dn===""?rn.items.slice(0,nr):[];if(Dn!=="")for(const cr of rn.items){if(on.length>=nr)break;Bn(cr,Dn,U)&&on.push(cr)}if(on.length>0){const cr={...rn,items:on};Kt.push(cr),Vt+=on.length}}return Kt}if(Dn==="")return Y>-1?yn.slice(0,Y):yn;const He=[];for(const Ue of yn){if(Y>-1&&He.length>=Y)break;Bn(Ue,Dn,U)&&He.push(Ue)}return He},[N,gr,R,lr,Dn,Y,Bn,U,yn]),Ht=w.useMemo(()=>lr?Zt.flatMap(Ue=>Ue.items):Zt,[Zt,lr]),nt=Jn(()=>{let He=null;return B&&Ft&&wt&&p!=="none"&&(He=gx(Ht,et,K,Fe)),new XT({id:Re,labelId:void 0,selectedValue:et,open:Ft,items:R,selectionMode:p,listRef:De,labelsRef:Ze,popupRef:qe,emptyRef:$,inputRef:ge,startDismissRef:re,endDismissRef:le,keyboardActiveRef:Q,chipsContainerRef:Ne,clearRef:_e,valuesRef:at,pointerDownItemRef:Nt,selectionEventRef:Ge,name:_t,form:b,disabled:Je,readOnly:k,required:E,grid:T,virtualized:G,openOnInputClick:M,itemToStringLabel:U,isItemEqualToValue:K,modal:V,autoHighlight:ht,submitOnItemClick:Z,hasInputValue:Et,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:B,activeIndex:null,selectedIndex:He,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:wn,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:p==="none",onOpenChangeComplete:un,setOpen:un,setInputValue:un,setSelectedValue:un,setIndices:un,handleSelection:un,forceMount:un,requestSubmit:un})}).current,Tr=p==="none"?nn:et,Am=w.useMemo(()=>p==="none"?Tr:Array.isArray(et)?et.map(He=>_i(He,q)):_i(et,q),[Tr,q,p,et]),Mm=Ae(g),$a=Ae(n),Uo=pe(nt,Pe.activeIndex),Qa=pe(nt,Pe.selectedIndex),Ti=pe(nt,Pe.positionerElement),ao=pe(nt,Pe.listElement),Ri=pe(nt,Pe.triggerElement),ji=pe(nt,Pe.inputElement),Un=pe(nt,Pe.inputGroupElement),ar=pe(nt,Pe.inline),Ur=pe(nt,Pe.inputInsidePopup),co=pe(nt,Pe.inputOwnsFormValue),Zo=Tn(Ri),{mounted:ef,setMounted:tf,transitionStatus:Ll}=Al(Ft),{openMethod:nf,triggerProps:qo}=t2(Ft),Fl=Ae(()=>Am);Gu(Ur?Zo:ge,Re,Tr,Fl,!Je,y);const ii=Ae(()=>{R?Ze.current=Ht.map(He=>pi(He,U)):nt.set("forceMounted",!0)}),Qn=Ae((He,Ue,Kt)=>{if(Ue===-1){if(dt.current===xx)return;dt.current=xx}else dt.current={value:He,index:Ue};Mm(He,z4(Kt,void 0,{index:Ue}))}),Zr=Ae(He=>{nt.update(He);const Ue=He.activeIndex;if(Ue===void 0)return;const Kt=He.type||On;Ue===null?Qn(void 0,-1,Kt):Qn(at.current[Ue],Ue,Kt)}),oi=Ae((He,Ue)=>{if(he.current=Ue.reason===Qi,e.onInputValueChange?.(He,Ue),!Ue.isCanceled){if(Ue.reason===au){Ft&&Oe!==null&&je(null);const Kt=Ue.event,Vt=Kt.inputType;if(Kt.type==="compositionend"||Vt!=null&&Vt!==""&&Vt!=="insertReplacementText"){const nr=He.trim()!=="";nr&&be(!0),rt.current={hasQuery:nr};const on=nt.state.listElement;if(!nt.state.virtualized&&on){const cr=qe.current;for(const yr of Oa(on.firstElementChild??on)){if(!en(yr)||(cr?!$e(cr,yr):yr.getAttribute("role")==="dialog"))break;if(oU(yr)){yr.scrollTop=0;break}}}nr&&ht&&nt.state.activeIndex==null&&(Ft||ar)&&nt.set("activeIndex",0)}}else Ue.reason===Qi&&He===""&&nt.state.inputInsidePopup&&(rt.current={hasQuery:!1,selection:!0});Sn(He)}}),uo=Ae((He,Ue)=>{if(Ft!==He&&(Ue.reason===Fu&&wt&&Ht.length===0&&!$.current&&Ue.allowPropagation(),e.onOpenChange?.(He,Ue),!Ue.isCanceled&&(He&&Ur&&!ar&&Oe!==null&&(be(!1),je(null),nn!==""&&Ue.reason!==au&&oi("",Xe(Qi,Ue.event))),!He&&fe&&(pt?(ar||je(st),st===""&&be(!1)):Fe&&(ar||je(st),Ur&&Zr({activeIndex:null}),(!Ur||ar)&&oi("",Xe(Qi,Ue.event)))),Ar(He),!He&&Ur&&(Ue.reason===Lu||Ue.reason===_h)&&(oe(!0),Se(!1),ye==="onBlur")))){const Kt=p==="none"?nn:et;xe.commit(Kt)}}),Ks=Ae((He,Ue)=>{if(l?.(He,Ue),Ue.isCanceled)return;Wt(He),(p==="none"&&qe.current&&F||pt&&!nt.state.inputInsidePopup)&&oi(pi(He,U),Xe(Ue.reason,Ue.event))}),Hl=Ae((He,Ue)=>{const Kt=Mn(He),Vt=Ge.current??He;Ge.current=null;const rn=Xe(Fd,Vt),nr=Kt?.closest("a")?.getAttribute("href");if(nr){nr.startsWith("#")&&uo(!1,rn);return}if(Fe){const on=Array.isArray(et)?et:[],yr=tU(on,Ue,K)?wj(on,Ue,K):[...on,Ue];if(Ks(yr,rn),rn.isCanceled||!(ge.current?ge.current.value.trim()!=="":!1))return;nt.state.inputInsidePopup?oi("",Xe(Qi,rn.event)):uo(!1,rn)}else{if(Ks(Ue,rn),rn.isCanceled)return;uo(!1,rn)}}),zm=Ae(()=>{const He=xe.inputRef.current?.form??nt.state.inputElement?.form;He&&typeof He.requestSubmit=="function"&&He.requestSubmit()}),xr=Ae(()=>{if(tf(!1),$a?.(!1),be(!1),je(null),Zr(p==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Fe&&ge.current&&ge.current.value!==""&&!he.current&&oi("",Xe(Qi)),pt)if(nt.state.inputInsidePopup)ge.current&&ge.current.value!==""&&oi("",Xe(Qi));else{const He=pi(et,U);ge.current&&ge.current.value!==He&&oi(He,Xe(He===""?Qi:On))}}),ec=w.useMemo(()=>ar&&Ti?{current:Ti.closest('[role="dialog"]')}:qe,[ar,Ti]);Zi({enabled:!e.actionsRef,open:Ft,ref:ec,onComplete(){Ft||xr()}}),w.useImperativeHandle(e.actionsRef,()=>({unmount:xr}),[xr]),Me(function(){if(Ft||(Nt.current=null,p==="none"))return;const Ue=wt?yn:at.current;Zr({selectedIndex:gx(Ue,et,K,Fe)})},[Ft,et,p,Fe,wt,yn,K,Zr]),Me(()=>{R&&(at.current=Ht,De.current.length=Ht.length)},[R,Ht]),Me(()=>{const He=rt.current;if(He){const cr=Ft||ar||nt.state.positionerElement?.hidden===!1;if(He.hasQuery)ht&&cr&&nt.set("activeIndex",0),rt.current=null;else if(String(nn).trim()===""&&(rt.current=null,cr)){const yr=He.selection;ht==="always"&&!yr&&nt.state.selectionMode==="none"&&nt.set("activeIndex",0),queueMicrotask(()=>{if(!nt.state.open&&!nt.state.inline||ge.current&&ge.current.value.trim()!=="")return;const Gr=nt.state.selectedValue,Xo=nt.state.selectionMode==="multiple",br=Xo&&Array.isArray(Gr)?Gr[Gr.length-1]:Gr,Yi=nt.state.selectionMode!=="none"&&br!=null;if(Yi||yr){const Zl=wt||tt?Ht:at.current;nt.set("activeIndex",Yi?gx(Zl,Gr,nt.state.isItemEqualToValue,Xo):null)}else ht==="always"&&nt.set("activeIndex",0)})}}if(!Ft&&!ar)return;const Kt=wt||tt?Ht:at.current,Vt=nt.state.activeIndex;if(Vt==null){if(ht==="always"&&Kt.length>0){nt.set("activeIndex",0);return}Qn(void 0,-1,On);return}if(Vt>=Kt.length){Qn(void 0,-1,On),nt.set("activeIndex",null);return}const rn=Kt[Vt],nr=dt.current.value,on=nr!==Rj&&Si(rn,nr,nt.state.isItemEqualToValue);(dt.current.index!==Vt||!on)&&Qn(rn,Vt,On)},[Uo,ht,Qn,tt,wt,Ht,ar,Ft,nt,nn]),Me(()=>{if(p==="none"){W(String(nn)!=="");return}W(Fe?Array.isArray(et)&&et.length>0:et!=null)},[W,p,nn,et,Fe]),w.useEffect(()=>{wt&&ht&&Ht.length===0&&Zr({activeIndex:null})},[wt,ht,Ht.length,Zr]);function rf(He){const Ue=ne.initialValue;return Array.isArray(He)&&Array.isArray(Ue)?!Tj(He,Ue,(Kt,Vt)=>Si(Kt,Vt,K)):He!==Ue}ks(st,()=>{!Ft||st===""||st===String(In)||be(!0)});function Bl(){const He=pi(et,U);nn!==He&&oi(He,Xe(On))}ks(et,()=>{p!=="none"&&(z(_t),J(rf(et)),xe.change(et),pt&&!Et&&!Ur&&Bl())}),ks(nn,()=>{p==="none"&&(z(_t),J(nn!==ne.initialValue),xe.change(nn))}),ks(R,()=>{!pt||Et||Ur||fe||Bl()});const Ni=sR({open:ar?!0:Ft,onOpenChange:uo,elements:{reference:Ur?Ri:ji,floating:Ti}}),tc=T?"grid":"listbox",Xs=Ft||ar,fo=Xs?"true":"false",Vl=w.useMemo(()=>{const He=ji?.tagName==="INPUT",Ue=ji==null||He,Kt=Ue||Xs,Vt=Ue?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Kt&&(Vt.role="combobox",Vt["aria-expanded"]=fo,Vt["aria-haspopup"]=tc,Vt["aria-controls"]=Xs?ao?.id:void 0,Vt["aria-autocomplete"]=te),{reference:Vt,floating:{role:"presentation"}}},[ji,Xs,fo,tc,ao?.id,te]),nc=pb(Ni,{enabled:!k&&!Je&&M,event:"mousedown-only",toggle:!1,touchOpenDelay:Ur?0:100,reason:A4}),Js=Bh(Ni,{enabled:!k&&!Je&&!ar,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:ar?!0:void 0,outsidePress(He){const Ue=Mn(He);return!$e(Ri,Ue)&&!$e(_e.current,Ue)&&!$e(Ne.current,Ue)&&!$e(Un,Ue)}}),Gi=aR(Ni,{enabled:!k&&!Je,id:Re,listRef:De,activeIndex:Uo,selectedIndex:Qa,virtual:!0,loopFocus:D,allowEscape:D&&!ht,focusItemOnOpen:fe||p==="none"&&!ht?!1:"auto",focusItemOnHover:L,resetOnPointerLeave:!A,orientation:T?"horizontal":void 0,rtl:we==="rtl",disabledIndices:Pi,grid:T?QV:void 0,onNavigate(He,Ue){!Ue&&!Ft||Ll==="ending"||Zr(Ue?{activeIndex:He,type:Q.current?uT:fT}:{activeIndex:He})}}),rc=w.useMemo(()=>bi(Gi.reference,{onKeyDown(He){T&&nt.state.activeIndex==null&&(He.key==="ArrowLeft"||He.key==="ArrowRight")&&He.preventBaseUIHandler()}},Js.reference,nc.reference,Vl.reference),[Gi.reference,Js.reference,nc.reference,Vl.reference,T,nt]),ic=w.useMemo(()=>bi(qh,Js.floating),[Js.floating]),Go=w.useMemo(()=>bi(Gi.floating,Vl.floating),[Gi.floating,Vl.floating]),qr=w.useMemo(()=>{const He=Gi.item;return He?{...He,onFocus:void 0}:wn},[Gi.item]);hj(()=>{nt.update({inline:B,popupProps:ic,listProps:Go,inputProps:rc,triggerProps:qo,itemProps:qr,setOpen:uo,setInputValue:oi,setSelectedValue:Ks,setIndices:Zr,handleSelection:Hl,forceMount:ii,requestSubmit:zm,onOpenChangeComplete:$a})}),Me(()=>{nt.update({id:Re,selectedValue:et,open:Ft,mounted:ef,transitionStatus:Ll,items:R,inline:B,popupProps:ic,listProps:Go,inputProps:rc,triggerProps:qo,openMethod:nf,itemProps:qr,selectionMode:p,name:_t,form:b,disabled:Je,readOnly:k,required:E,grid:T,virtualized:G,openOnInputClick:M,itemToStringLabel:U,modal:V,autoHighlight:ht,isItemEqualToValue:K,submitOnItemClick:Z,hasInputValue:Et,inputOwnsFormValue:p==="none"&&(B||!nt.state.inputInsidePopup)})},[nt,Re,et,Ft,ef,Ll,R,ic,Go,rc,qr,nf,qo,p,_t,Je,k,E,T,G,M,U,V,K,Z,Et,B,ht,b]);const oc=Ui(C,xe.inputRef),sc=w.useMemo(()=>({query:st,hasItems:wt,filteredItems:Zt,flatFilteredItems:Ht}),[st,wt,Zt,Ht]),Yo=w.useMemo(()=>Array.isArray(Tr)?"":_i(Tr,q),[Tr,q]),Ko=Fe&&Array.isArray(et)&&et.length>0,Ul=Fe||p==="none"&&co?void 0:_t,lc=w.useMemo(()=>!Fe||!Array.isArray(et)||!_t?null:et.map(He=>{const Ue=_i(He,q);return d.jsx("input",{type:"hidden",form:b,name:_t,value:Ue,disabled:Je},Ue)}),[Fe,et,b,_t,q,Je]),of=d.jsxs(w.Fragment,{children:[e.children,d.jsx("input",{...xe.getValidationProps(Je,{onFocus(){if(Ur){Ri?.focus();return}(ge.current||Ri)?.focus()},onChange(He){if(He.nativeEvent.defaultPrevented||Je||k)return;const Ue=He.currentTarget.value,Kt=Ue.toLowerCase(),Vt=Xe(On,He.nativeEvent),rn=()=>at.current.findIndex(on=>_i(on,q).toLowerCase()===Kt||pi(on,U).toLowerCase()===Kt);function nr(){if(Fe)return;if(p==="none"){oi(Ue,Vt);return}let on=rn();on===-1&&(on=at.current.findIndex((yr,Gr)=>{const Xo=Ze.current[Gr];return Xo!=null&&Xo.toLowerCase()===Kt}));const cr=on===-1?void 0:at.current[on];cr!=null&&Ks?.(cr,Vt)}pt&&(ii(),R&&rn()===-1&&nt.set("forceMounted",!0)),queueMicrotask(nr)}}),id:Re&&Ul==null?`${Re}-hidden-input`:void 0,form:b,name:Ul,autoComplete:O,disabled:Je,required:E&&!Ko,readOnly:k,value:Yo,ref:oc,style:Ul?Bu:Hu,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),lc]});return d.jsx(mj.Provider,{value:nt,children:d.jsx(pj.Provider,{value:Ni,children:d.jsx(xj.Provider,{value:wt,children:d.jsx(gj.Provider,{value:sc,children:d.jsx(yj.Provider,{value:nn,children:of})})})})})}function lU(e){const{multiple:t=!1,defaultValue:n,value:i,onValueChange:s,autoComplete:l,...c}=e;return d.jsx(sU,{...c,selectionMode:t?"multiple":"single",selectedValue:i,defaultSelectedValue:n,onSelectedValueChange:s,formAutoComplete:l})}function jj(e,t){return e??t}function aU(e){const{children:t,placeholder:n}=e,i=Ci(),s=pe(i,Pe.itemToStringLabel),l=pe(i,Pe.selectedValue),c=pe(i,Pe.items),u=pe(i,Pe.selectionMode)==="multiple",m=pe(i,Pe.hasSelectedValue),h=!m&&n!=null&&t==null,p=pe(i,Pe.hasNullItemLabel,h);let g=null;return typeof t=="function"?g=t(l):t!=null?g=t:!m&&n!=null&&!p?g=n:u&&Array.isArray(l)?g=kj(l,c,s):g=Qb(l,c,s),d.jsx(w.Fragment,{children:g})}const Nj={...fR,...Bs,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},cU=w.createContext(void 0);function uU(){return w.useContext(cU)}const Oj=w.createContext(void 0);function ev(e){const t=w.useContext(Oj);if(t===void 0&&!e)throw new Error(En(21));return t}const Aj=w.forwardRef(function(t,n){const i=Ci(),{buttonRef:s,getButtonProps:l}=Lo({native:!1}),c=Ui(n,s);function u(h){i.state.setOpen(!1,Xe(cT,h.nativeEvent,h.currentTarget))}const m=l({onClick:u});return d.jsx("span",{ref:c,...m,"aria-label":"Dismiss",tabIndex:void 0,style:Bu})});function Mj(e){const t=pe(e,Pe.mounted),n=pe(e,Pe.popupSide),i=pe(e,Pe.positionerElement);return t&&i?n:null}function vm(){return Xu().filteredItems.length===0}function fU(e){return e==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function dU(e,t){const n=e>=t-1?t-2:e;return n>=0?n:void 0}function zj(e,t,n){const i=e.state.listRef.current[t];i&&(e.state.selectionEventRef.current=n,i.click(),e.state.selectionEventRef.current=null)}const hU=w.forwardRef(function(t,n){const{render:i,className:s,disabled:l=!1,id:c,style:u,...m}=t,{state:h,disabled:p,setTouched:g,setFocused:y,validationMode:b,validation:S}=qi(),{labelId:k}=ki(),E=uU(),T=!!ev(!0),R=Ci(),N=bj(),I=Uu(),M=pe(R,Pe.required),P=pe(R,Pe.disabled),A=pe(R,Pe.readOnly),L=pe(R,Pe.name),D=pe(R,Pe.form),U=pe(R,Pe.selectionMode),q=pe(R,Pe.autoHighlight),K=pe(R,Pe.inputProps),G=pe(R,Pe.triggerProps),B=pe(R,Pe.open),F=pe(R,Pe.mounted),V=pe(R,Pe.selectedValue),Y=pe(R,Pe.id),te=pe(R,Pe.inline),O=pe(R,Pe.modal),_=!!q,Z=Mj(R),z=p||P||l,J=vm(),ne=T||te,W=!ne||O,de=Or(c??(ne?void 0:Y)),ie=T?f2:h,[oe,Se]=w.useState(null),ye=w.useRef(!1),xe=w.useRef(null),we=w.useRef(!1),Re=U==="none"&&!T,Ie=Ae(ge=>{const re=T||R.state.inline;re&&!R.state.hasInputValue&&R.state.setInputValue("",Xe(On)),R.update({inputElement:ge,inputInsidePopup:re,inputOwnsFormValue:Re})}),fe=T?m:S.getValidationProps(z,m);function be(){R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?uT:fT})}function Oe(){R.state.keyboardActiveRef.current=!1}const je={...ie,open:B,disabled:z,readOnly:A,popupSide:Z,listEmpty:J};function De(ge){if(!E)return;let re;const{highlightedChipIndex:le}=E,$=E.chipsRef.current.length,[Q,he]=fU(I);return le!==void 0?(ge.key===Q?(ge.preventDefault(),le>0?re=le-1:re=void 0):ge.key===he?(ge.preventDefault(),le<$-1?re=le+1:re=void 0):(ge.key==="Backspace"||ge.key==="Delete")&&(ge.preventDefault(),re=dU(le,V.length),be()),re):(ge.key===Q&&(ge.currentTarget.selectionStart??0)===0&&V.length>0&&(ge.preventDefault(),re=$>0?$-1:void 0),re)}const Ze=jt("input",t,{state:je,ref:[n,R.state.inputRef,Ie],props:[K,G,{value:oe??N,"aria-readonly":A||void 0,"aria-required":M||void 0,"aria-labelledby":k,disabled:z,readOnly:A,required:U==="none"?M:void 0,form:D,...Re&&L&&{name:L},id:de,onFocus(){if(y(!0),!te||!we.current)return;we.current=!1;const ge=xe.current;ge==null||!Object.hasOwn(R.state.valuesRef.current,ge)||R.state.setIndices({activeIndex:ge})},onBlur(){g(!0),y(!1);const ge=R.state.activeIndex;if(te&&ge!==null&&q!=="always"&&(xe.current=ge,we.current=!0,R.state.setIndices({activeIndex:null})),b==="onBlur"){const re=U==="none"?N:V;S.commit(re)}},onCompositionStart(ge){Wd||(ye.current=!0,Se(ge.currentTarget.value))},onCompositionEnd(ge){ye.current=!1;const re=ge.currentTarget.value;Se(null),R.state.setInputValue(re,Xe(au,ge.nativeEvent))},onChange(ge){const re=ge.nativeEvent,le=re.inputType,$=!le||le==="insertReplacementText",Q=ye.current||!$;function he(dt){A||z||!dt||!Q||(R.state.setOpen(!0,Xe(au,re)),_||be())}if(ye.current){const dt=ge.currentTarget.value;Se(dt),dt===""&&!R.state.openOnInputClick&&!R.state.inputInsidePopup&&R.state.setOpen(!1,Xe(Qi,re));const rt=dt.trim(),at=_&&rt!=="";he(rt),B&&R.state.activeIndex!==null&&!at&&be();return}const Ne=Xe(au,re);if(R.state.setInputValue(ge.currentTarget.value,Ne),Ne.isCanceled)return;const _e=ge.currentTarget.value==="",Ge=Xe(Qi,re);_e&&!R.state.inputInsidePopup&&(U==="single"&&R.state.setSelectedValue(null,Ge),R.state.openOnInputClick||R.state.setOpen(!1,Ge)),he(ge.currentTarget.value.trim()),B&&R.state.activeIndex!==null&&!_&&be()},onKeyDown(ge){if(z||A||ge.ctrlKey||ge.shiftKey||ge.altKey||ge.metaKey)return;R.state.keyboardActiveRef.current=!0;const re=ge.currentTarget,le=re.scrollWidth-re.clientWidth,$=I==="rtl";if(ge.key==="Home"){or(ge);const Ne=NS&&$?re.value.length:0;re.setSelectionRange(Ne,Ne),re.scrollLeft=0;return}if(ge.key==="End"){or(ge);const Ne=NS&&$?0:re.value.length;re.setSelectionRange(Ne,Ne),re.scrollLeft=$?-le:le;return}if(!F&&ge.key==="Escape"){const Ne=U==="multiple"&&Array.isArray(V)?V.length===0:V===null,_e=Xe(Fu,ge.nativeEvent),Ge=U==="multiple"?[]:null;R.state.setInputValue("",_e),R.state.setSelectedValue(Ge,_e),!Ne&&!R.state.inline&&!_e.isPropagationAllowed&&ge.stopPropagation();return}if(E&&ge.key==="Backspace"&&re.value===""&&E.highlightedChipIndex===void 0&&Array.isArray(V)&&V.length>0){const Ne=E.chipsRef.current.length,_e=Ne>0?Ne-1:V.length-1,Ge=V.filter((dt,rt)=>rt!==_e);be(),R.state.setSelectedValue(Ge,Xe(On,ge.nativeEvent));return}const Q=E?.highlightedChipIndex!==void 0,he=De(ge);if(E?.setHighlightedChipIndex(he),he!==void 0?E?.chipsRef.current[he]?.focus():Q&&R.state.inputRef.current?.focus(),ge.which!==229&&ge.key==="Enter"&&B){const Ne=R.state.activeIndex,_e=ge.nativeEvent;if(Ne===null){if(te)return;R.state.setOpen(!1,Xe(On,_e));return}or(ge),zj(R,Ne,_e)}},onPointerMove:Oe,onPointerDown:Oe},fe],stateAttributesMapping:Nj}),qe=T?d.jsx(_b.Provider,{value:d2,children:Ze}):Ze;return d.jsxs(w.Fragment,{children:[B&&W&&d.jsx(Aj,{ref:R.state.startDismissRef}),qe]})}),Nd=5;function Ij(e,t){const n=mU(t);return e.clientX>=n.left-Nd&&e.clientX<=n.right+Nd&&e.clientY>=n.top-Nd&&e.clientY<=n.bottom+Nd}function mU(e){const t=e.getBoundingClientRect(),n=gn(e);if(Wy)return t;const i=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(i.content!=="none"||s.content!=="none"))return t;const c=parseFloat(i.width)||0,u=parseFloat(i.height)||0,m=parseFloat(s.width)||0,h=parseFloat(s.height)||0,p=Math.max(t.width,c,m),g=Math.max(t.height,u,h),y=p-t.width,b=g-t.height;return{left:t.left-y/2,right:t.right+y/2,top:t.top-b/2,bottom:t.bottom+b/2}}const pU=w.forwardRef(function(t,n){const{render:i,className:s,nativeButton:l=!0,disabled:c=!1,id:u,style:m,...h}=t,{state:p,disabled:g,setTouched:y,setFocused:b,validationMode:S,validation:k}=qi(),{labelId:E}=ki(),C=Ci(),T=pe(C,Pe.selectionMode),R=pe(C,Pe.disabled),N=pe(C,Pe.readOnly),I=pe(C,Pe.required),M=pe(C,Pe.positionerElement),P=pe(C,Pe.listElement),A=pe(C,Pe.popupId),L=pe(C,Pe.triggerProps),D=pe(C,Pe.inputInsidePopup),U=pe(C,Pe.id),q=pe(C,Pe.labelId),K=pe(C,Pe.open),G=pe(C,Pe.selectedValue),B=pe(C,Pe.activeIndex),F=pe(C,Pe.selectedIndex),V=pe(C,Pe.hasSelectedValue),Y=bm(),te=bj(),O=kr(),_=g||R||c,Z=vm(),z=Mj(C);qa({id:D?u:void 0});const J=D?u??U:u,ne=jj(E,q);let W;K&&D?W=A??Ej(U):K&&(W=P?.id);const de=w.useRef("");function ie(fe){de.current=fe.pointerType}const{reference:oe}=cR(Y,{enabled:!K&&!N&&!R&&T==="single",listRef:C.state.labelsRef,activeIndex:B,selectedIndex:F,onMatch(fe){const be=C.state.valuesRef.current[fe];be!==void 0&&C.state.setSelectedValue(be,Xe(On))}}),{reference:Se}=pb(Y,{enabled:!N&&!R,event:"mousedown"}),{buttonRef:ye,getButtonProps:xe}=Lo({native:l,disabled:_}),we={...p,open:K,disabled:_,popupSide:z,listEmpty:Z,placeholder:T==="none"?!1:!V},Re=Ae(fe=>{C.set("triggerElement",fe)});return jt("button",t,{ref:[n,ye,Re],state:we,props:[L,Se,oe,{id:J,tabIndex:D?0:-1,role:D?"combobox":void 0,"aria-expanded":K,"aria-haspopup":D?"dialog":"listbox","aria-controls":W,"aria-required":D&&I||void 0,"aria-labelledby":ne,onPointerDown:ie,onPointerEnter:ie,onFocus(){b(!0),!(_||N)&&O.start(0,C.state.forceMount)},onBlur(fe){if(!$e(M,fe.relatedTarget)&&(y(!0),b(!1),S==="onBlur")){const be=T==="none"?te:G;k.commit(be)}},onMouseDown(fe){if(_||N||(D||Y.set("domReferenceElement",fe.currentTarget),C.state.forceMount(),de.current!=="touch"&&(C.state.inputRef.current?.focus(),D||fe.preventDefault()),K))return;const be=Dt(fe.currentTarget);function Oe(je){const De=C.state.triggerElement;if(!De)return;const Ze=Mn(je),qe=C.state.positionerElement,ge=C.state.listElement;$e(De,Ze)||$e(qe,Ze)||$e(ge,Ze)||Ij(je,De)||C.state.setOpen(!1,Xe(dT,je))}D&&be.addEventListener("mouseup",Oe,{once:!0})},onKeyDown(fe){N||(fe.key==="ArrowDown"||fe.key==="ArrowUp")&&(or(fe),C.state.setOpen(!0,Xe(ny,fe.nativeEvent)),C.state.inputRef.current?.focus())}},k.getValidationProps(_,h),xe],stateAttributesMapping:Nj})}),Dj=w.createContext(null);function gU(){return w.useContext(Dj)}function xU(e){const{children:t,items:n}=e,i=w.useMemo(()=>({items:n}),[n]);return d.jsx(Dj.Provider,{value:i,children:t})}function _j(e){const{children:t}=e,{filteredItems:n}=Xu(),i=gU(),s=i?i.items:n;return d.jsx(w.Fragment,{children:s.map(t)})}const yU=w.forwardRef(function(t,n){var i;const{render:s,className:l,style:c,children:u,...m}=t,h=Ci(),p=bm(),g=!!ev(!0),{filteredItems:y,hasItems:b}=Xu(),S=pe(h,Pe.selectionMode),k=pe(h,Pe.grid),E=pe(h,Pe.listProps),C=pe(h,Pe.virtualized),T=pe(h,Pe.forceMounted),R=S==="multiple",N=y.length===0,I=Ae(q=>{h.set("positionerElement",q)}),M=Ae(q=>{h.set("listElement",q)}),P=w.useMemo(()=>typeof u=="function"?i||(i=d.jsx(_j,{children:u})):u,[u]),A={empty:N},L=p.useState("floatingId"),D=jt("div",t,{state:A,ref:[n,M,g?null:I],props:[E,{children:P,tabIndex:-1,id:L,role:k?"grid":"listbox","aria-multiselectable":R?"true":void 0,onKeyDown(q){if(!(h.state.disabled||h.state.readOnly)&&q.key==="Enter"){const K=h.state.activeIndex;if(K==null)return;or(q),zj(h,K,q.nativeEvent)}},onKeyDownCapture(){h.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){h.state.keyboardActiveRef.current=!1}},m]});if(C)return D;const U=b&&!T?void 0:h.state.labelsRef;return d.jsx($h,{elementsRef:h.state.listRef,labelsRef:U,children:D})}),bU="",vU=200;function wU(e){const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let n=null;for(;t.nextNode();){const i=t.currentNode;i.nodeValue!==""&&(n=i)}return n}function SU(){const e=kr(),t=w.useRef(null);return w.useEffect(()=>{if(Du)return;const n=t.current;if(n==null)return;const i=wU(n);if(i==null)return;const s=i.data,l=`${s}${bU}`;return i.nodeValue=l,e.start(vU,()=>{i.nodeValue===l&&(i.nodeValue=s)}),()=>{e.clear(),i.nodeValue===l&&(i.nodeValue=s)}},[t,e]),t}const Pj=w.createContext(void 0);function kU(){const e=w.useContext(Pj);if(e===void 0)throw new Error(En(20));return e}const EU=w.forwardRef(function(t,n){const{keepMounted:i=!1,...s}=t,l=Ci(),c=pe(l,Pe.mounted),u=pe(l,Pe.forceMounted);return c||i||u?d.jsx(Pj.Provider,{value:i,children:d.jsx(db,{ref:n,...s})}):null}),CU=20;function Lj(e,t,n,i){const[s,l]=w.useState(!1);Me(()=>{if(!e||!t||n==null){l(!1);return}const c=Dt(n).documentElement.clientWidth,u=n.offsetWidth;l(c>0&&u>0&&u>=c-CU)},[e,t,n]),$R(e&&(!t||s),i)}const TU=w.forwardRef(function(t,n){const{render:i,className:s,anchor:l,positionMethod:c,side:u,align:m,sideOffset:h,alignOffset:p,collisionBoundary:g="clipping-ancestors",collisionPadding:y,arrowPadding:b,sticky:S,disableAnchorTracking:k=!1,collisionAvoidance:E=PT,style:C,...T}=t,R=Ci(),N=bm(),I=kU(),M=pe(R,Pe.modal),P=pe(R,Pe.open),A=pe(R,Pe.mounted),L=pe(R,Pe.openMethod),D=pe(R,Pe.positionerElement),U=pe(R,Pe.triggerElement),q=pe(R,Pe.inputElement),K=pe(R,Pe.inputGroupElement),G=pe(R,Pe.inputInsidePopup),B=pe(R,Pe.transitionStatus),F=vm(),Y=vb({anchor:l??(G?U:K??q),floatingRootContext:N,positionMethod:c,mounted:A,side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:g,collisionPadding:y,sticky:S,disableAnchorTracking:k,keepMounted:I,collisionAvoidance:E,lazyFlip:!0});Lj(P&&M,L==="touch",D,U);const te={open:P,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,empty:F};Me(()=>{R.set("popupSide",Y.side)},[R,Y.side]);const O=Ae(Z=>{R.set("positionerElement",Z)}),_=wb(t,te,{styles:Y.positionerStyles,transitionStatus:B,props:T,refs:[n,O],hidden:!A,inert:!P});return d.jsxs(Oj.Provider,{value:Y,children:[A&&M&&d.jsx(Ab,{inert:Xh(!P),cutout:K??q??U}),_]})}),RU={...Vu,...Fs},jU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,initialFocus:c,finalFocus:u,...m}=t,h=Ci(),p=ev(),g=bm(),y=pe(h,Pe.mounted),b=pe(h,Pe.open),S=pe(h,Pe.openMethod),k=pe(h,Pe.popupProps),E=pe(h,Pe.transitionStatus),C=pe(h,Pe.inputInsidePopup),T=pe(h,Pe.inputElement),R=pe(h,Pe.modal),N=pe(h,Pe.id),I=vm(),M=m.id??(C?Ej(N):void 0);Me(()=>(h.set("popupId",h.state.popupRef.current?.id||M),()=>{h.set("popupId",void 0)}),[h,M]),Zi({open:b,ref:h.state.popupRef,onComplete(){b&&h.state.onOpenChangeComplete(!0)}});const P={open:b,side:p.side,align:p.align,anchorHidden:p.anchorHidden,transitionStatus:E,empty:I},A=jt("div",t,{state:P,ref:[n,h.state.popupRef],props:[k,{id:M,role:C?"dialog":"presentation",onFocus(K){const G=Mn(K.nativeEvent);S!=="touch"&&($e(h.state.listElement,G)||G===K.currentTarget)&&h.state.inputRef.current?.focus()}},Kh(E),m],stateAttributesMapping:RU}),D=c===void 0?C?K=>K==="touch"?h.state.popupRef.current:T:!1:c;let U;u!=null?U=u:U=C?void 0:!1;const q=!C||R;return d.jsx(mb,{context:g,disabled:!y,modal:q,openInteractionType:S,initialFocus:D,returnFocus:U,getInsideElements:()=>[h.state.startDismissRef.current,h.state.endDismissRef.current],children:d.jsxs(w.Fragment,{children:[A,q&&d.jsx(Aj,{ref:h.state.endDismissRef})]})})}),NU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,...c}=t;return jt("span",t,{ref:n,props:[{"aria-hidden":!0,children:"▼"},c]})}),Fj=w.createContext(void 0);function OU(){const e=w.useContext(Fj);if(e===void 0)throw new Error(En(18));return e}const AU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,items:c,...u}=t,[m,h]=w.useState(),p=w.useMemo(()=>({labelId:m,setLabelId:h,items:c}),[m,h,c]),g=jt("div",t,{ref:n,props:[{role:"group","aria-labelledby":m},u]}),y=d.jsx(Fj.Provider,{value:p,children:g});return c?d.jsx(xU,{items:c,children:y}):y}),MU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,id:c,...u}=t,{setLabelId:m}=OU(),h=Or(c);return Me(()=>(m(h),()=>{m(g=>g===h?void 0:g)}),[h,m]),jt("div",t,{ref:n,props:[{id:h},u]})}),Hj=w.createContext(void 0);function Bj(){const e=w.useContext(Hj);if(!e)throw new Error(En(19));return e}const zU=w.createContext(!1);function IU(){return w.useContext(zU)}function Vj(e){const{componentProps:t,forwardedRef:n,virtualized:i,indexFromFilter:s}=e,{render:l,className:c,style:u,value:m=null,index:h,disabled:p=!1,nativeButton:g=!1,...y}=t,b=w.useRef(null),S=em({guess:!0,index:h,textRef:b}),k=Ci(),E=IU(),C=eU(),T=pe(k,Pe.selectionMode),R=pe(k,Pe.disabled),N=pe(k,Pe.readOnly),I=pe(k,Pe.isItemEqualToValue),M=R||p,P=T!=="none",A=h??s??S.index,L=A!==-1,D=pe(k,Pe.id),U=pe(k,Pe.isActive,A),q=pe(k,Pe.isSelected,m),K=pe(k,Pe.itemProps),G=w.useRef(null),B=D!=null&&L?`${D}-${A}`:void 0,F=q&&P;Me(()=>{if(!(L&&(i||h!=null)))return;const ne=k.state.listRef.current;return ne[A]=G.current,()=>{delete ne[A]}},[L,i,A,h,k]),Me(()=>{if(!L||C)return;const J=k.state.valuesRef.current;return J[A]=m,()=>{delete J[A]}},[L,C,A,m,k]),Me(()=>{if(!L||C)return;const J=k.state.selectedValue,ne=Array.isArray(J)?J[J.length-1]:J;Si(m,ne,I)&&k.set("selectedIndex",A)},[L,C,k,A,m,I]);const{getButtonProps:V,buttonRef:Y}=Lo({disabled:M,focusableWhenDisabled:!0,native:g,composite:!0}),te={disabled:M,selected:F,highlighted:U};function O(J){function ne(){k.state.handleSelection(J,m)}k.state.submitOnItemClick?(Ls.flushSync(ne),k.state.requestSubmit()):ne()}const _={id:B,role:E?"gridcell":"option","aria-selected":P?F:void 0,tabIndex:void 0,onPointerDownCapture(J){J.isPrimary&&(k.state.pointerDownItemRef.current=J.currentTarget),J.preventDefault()},onMouseDown(J){J.preventDefault()},onClick(J){M||N||O(J.nativeEvent)},onMouseUp(J){const ne=k.state.pointerDownItemRef.current===J.currentTarget;k.state.pointerDownItemRef.current=null,!(M||N||J.button!==0||ne||!U)&&O(J.nativeEvent)}},Z=jt("div",t,{ref:[Y,n,S.ref,G],state:te,props:[K,_,y,V]}),z=w.useMemo(()=>({selected:F,textRef:b}),[F,b]);return d.jsx(Hj.Provider,{value:z,children:Z})}function DU(e){const{componentProps:t,forwardedRef:n}=e,i=Ci(),s=pe(i,Pe.isItemEqualToValue),{flatFilteredItems:l}=Xu(),c=ja(l,t.value??null,s);return d.jsx(Vj,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:c})}const _U=w.memo(w.forwardRef(function(t,n){const i=Ci(),s=pe(i,Pe.virtualized);return s&&t.index==null?d.jsx(DU,{componentProps:t,forwardedRef:n}):d.jsx(Vj,{componentProps:t,forwardedRef:n,virtualized:s,indexFromFilter:void 0})})),PU=w.forwardRef(function(t,n){const{selected:i}=Bj();return t.keepMounted||i?d.jsx(LU,{...t,ref:n}):null}),LU=w.memo(w.forwardRef((e,t)=>{const{render:n,className:i,style:s,keepMounted:l,...c}=e,{selected:u}=Bj(),m=w.useRef(null),{transitionStatus:h,setMounted:p}=Al(u),y=jt("span",e,{ref:[t,m],state:{selected:u,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},c],stateAttributesMapping:Fs});return Zi({open:u,ref:m,onComplete(){u||p(!1)}}),y})),FU=w.forwardRef(function(t,n){const{render:i,className:s,style:l,children:c,...u}=t,{filteredItems:m}=Xu(),h=Ci(),p=SU(),g=m.length===0?c:null;return jt("div",t,{ref:[n,h.state.emptyRef,p],props:[{children:g,role:"status","aria-live":"polite","aria-atomic":!0},u]})}),HU=lU,BU=aU,VU=_j;function UU({className:e,children:t,...n}){return d.jsxs(pU,{className:Te("flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-transparent","px-3 py-1 text-left text-sm shadow-sm transition-colors","hover:bg-muted/50 disabled:cursor-not-allowed disabled:opacity-50","data-[invalid]:border-destructive",e),...n,children:[t,d.jsx(NU,{className:"shrink-0 text-muted-foreground",children:d.jsx(qC,{className:"size-4"})})]})}function ZU({className:e,children:t,minWidth:n="24rem",...i}){return d.jsx(EU,{children:d.jsx(TU,{align:"start",sideOffset:4,className:"z-50 outline-none",children:d.jsx(jU,{style:{width:`max(var(--anchor-width), ${n})`},className:Te("flex max-h-[min(28rem,var(--available-height))] max-w-[var(--available-width)] flex-col","overflow-hidden rounded-md border border-border bg-card text-card-foreground shadow-lg","transition-[opacity,transform] duration-100","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",e),...i,children:t})})})}function qU({className:e,...t}){return d.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3",children:[d.jsx(Rl,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),d.jsx(hU,{className:Te("h-9 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",e),...t})]})}function GU({className:e,...t}){return d.jsx(yU,{className:Te("min-h-0 flex-1 overflow-y-auto overscroll-contain p-1 outline-none",e),...t})}function YU({className:e,...t}){return d.jsx(FU,{className:Te("px-3 py-6 text-center text-sm text-muted-foreground empty:p-0",e),...t})}function KU({className:e,...t}){return d.jsx(AU,{className:Te("block pb-1 last:pb-0",e),...t})}function XU({className:e,...t}){return d.jsx(MU,{className:Te("px-2 pb-1 pt-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",e),...t})}function JU({className:e,children:t,...n}){return d.jsxs(_U,{className:Te("relative flex cursor-default select-none items-start gap-2 rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none","data-[highlighted]:bg-muted data-[highlighted]:text-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[t,d.jsx(PU,{className:"absolute right-2 top-1.5 flex items-center text-primary",children:d.jsx(Li,{className:"size-4"})})]})}const WU=[{kind:"local-branch",label:"Branches",icon:Kx},{kind:"remote-branch",label:"Remote branches",icon:Kx},{kind:"tag",label:"Tags",icon:$C}];function bE({id:e,refs:t,value:n,onChange:i,disabled:s,invalid:l}){const[c,u]=w.useState(""),m=w.useMemo(()=>{const b=new Map;for(const S of t)b.set(S.name,S);return b},[t]),h=w.useMemo(()=>WU.map(({kind:b,label:S})=>({value:S,items:t.filter(k=>k.kind===b).map(k=>k.name)})).filter(b=>b.items.length>0),[t]),{groups:p,marks:g}=w.useMemo(()=>{const b=c.trim();if(b==="")return{groups:h,marks:new Map};const S=new Map,k=[];for(const E of h){const C=[];for(const T of E.items){const R=ch(b,T);R!==null&&(S.set(T,R.indices),C.push({name:T,score:R.score}))}C.length!==0&&(C.sort((T,R)=>R.score-T.score),k.push({value:E.value,items:C.map(T=>T.name)}))}return{groups:k,marks:S}},[h,c]),y=b=>m.get(b)?.kind==="tag"?$C:Kx;return d.jsxs(HU,{items:h,filteredItems:p,value:n,onValueChange:b=>i(typeof b=="string"?b:""),onInputValueChange:u,disabled:s,children:[d.jsx(UU,{id:e,"data-invalid":l?"":void 0,children:d.jsx("span",{className:"min-w-0 truncate font-mono text-xs",title:n||void 0,children:d.jsx(BU,{placeholder:"Pick a ref"})})}),d.jsxs(ZU,{minWidth:"26rem","aria-label":"Select a branch or tag",children:[d.jsx(qU,{placeholder:"Search branches and tags"}),d.jsx(YU,{children:"No branch or tag matches that."}),d.jsx(GU,{children:b=>d.jsxs(KU,{items:b.items,children:[d.jsx(XU,{children:b.value}),d.jsx(VU,{children:S=>{const k=m.get(S),E=y(S);return d.jsxs(JU,{value:S,children:[d.jsx(E,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground"}),d.jsx("span",{className:"min-w-0 flex-1 break-words font-mono text-xs",children:d.jsx(qR,{text:S,indices:g.get(S)??[]})}),k?.hasUncommittedChanges&&d.jsxs("span",{className:"mt-0.5 flex shrink-0 items-center gap-1 text-[0.6875rem] font-medium text-warning",title:`Uncommitted changes in ${k.checkedOutAt??"its worktree"}`,children:[d.jsx(As,{className:"size-3"}),"uncommitted"]})]},S)}})]},b.value)})]})]})}const Dl={revalidateOnFocus:!1,revalidateIfStale:!1,shouldRetryOnError:!1};function _l(e){return{data:e.data,error:e.error,isLoading:e.isLoading,isRefreshing:e.isValidating&&!e.isLoading,refresh:e.mutate}}function $U(e,t){const n=Wn(),i=$n();return _l(dn(Ut.reviews(e,t,i),()=>n.reviews.list({...e===void 0?{}:{repositoryId:e},...t===void 0?{}:{status:t}})))}function tv(e){const t=Wn(),n=$n();return dn(Ut.review(e,n),()=>t.reviews.open({id:e}),{revalidateOnFocus:!0,refreshInterval:15e3})}function QU(e){const t=tv(e);return _l({...t,data:t.data?.review})}function e7(e){const t=tv(e);return _l({...t,data:t.data?.threads})}function Uj(e){const t=Wn(),n=$n();return _l(dn(Ut.reviewCommits(e,n),()=>t.reviews.commits({id:e}),Dl))}const wm="all";function Sm(e,t){const n=Wn(),i=$n();return _l(dn(Ut.reviewDiff(e,t,i),()=>n.reviews.diff({id:e,changes:t}),Dl))}function t7(e,t){const n=Wn(),i=$n();return _l(dn(Ut.reviewTree(e,t,i),()=>n.reviews.tree({id:e,changes:t}),Dl))}function Zj(e,t,n){const i=Wn(),s=$n(),[l,c]=w.useState(!1),u=dn(l&&e!==null?Ut.reviewFile(e,t,n,s):null,()=>i.reviews.file({id:e,path:t,changes:n}),Dl);return{content:u.data,error:u.error,isLoading:u.isLoading,requested:l,load:w.useCallback(()=>c(!0),[])}}function n7(e,t,n,i){const s=Wn(),l=$n(),c=dn(t===null?null:Ut.reviewImage(e,t,n,i,l),()=>s.reviews.image({id:e,path:t,side:n,changes:i}),Dl);return{image:c.data,error:c.error,isLoading:c.isLoading}}function qj(){return dn(Ut.editors,()=>Lt.system.editors(),{...Dl,revalidateOnMount:!0}).data}function r7(e){const t=Wn(),n=$n();return _l(dn(e===null?null:Ut.repositoryRefs(e,n),()=>t.repositories.refs({id:e}),Dl))}const i7=[];function o7(e){const t=Wn(),{data:n,isLoading:i,mutate:s}=tv(e),l=n?.reviewedFiles??i7,c=w.useMemo(()=>new Map(l.map(m=>[m.filePath,m.contentDigest])),[l]),u=w.useCallback(async(m,h)=>{if(!n){await t.reviews.setFileReviewed({reviewId:e,filePath:m,contentDigest:h}),await s();return}const p=n.reviewedFiles.filter(y=>y.filePath!==m),g={...n,reviewedFiles:h===null?p:[...p,{reviewId:e,filePath:m,contentDigest:h,reviewedAt:new Date().toISOString()}]};await s(async()=>(await t.reviews.setFileReviewed({reviewId:e,filePath:m,contentDigest:h}),g),{optimisticData:g,revalidate:!1,rollbackOnError:!0})},[t,n,s,e]);return{digests:c,isLoading:i,setReviewed:u}}function nv(){const e=Wn(),{mutate:t}=_s(),n=w.useCallback(()=>t(i=>typeof i=="string"&&Object.values(ws).some(s=>i.startsWith(s))),[t]);return{createReview:w.useCallback(async i=>{const s=await e.reviews.create(i);return await n(),s},[e,n]),updateReview:w.useCallback(async i=>{const s=await e.reviews.update(i);return await n(),s},[e,n]),removeReview:w.useCallback(async i=>{await e.reviews.remove({id:i}),await n()},[e,n])}}function Gj({open:e,onOpenChange:t,repositoryId:n,review:i,onCreated:s}){return d.jsx(Ba,{open:e,onOpenChange:t,children:d.jsx(Va,{className:"max-w-2xl",children:e&&d.jsx(s7,{repositoryId:n,review:i,onDone:()=>t(!1),...s?{onCreated:s}:{}},i?.id??"new")})})}function s7({repositoryId:e,review:t,onDone:n,onCreated:i}){const s=t!==void 0,{createReview:l,updateReview:c}=nv(),{data:u,isLoading:m,error:h}=r7(e),[p,g]=w.useState(t?.baseRef),[y,b]=w.useState(t?.headRef),[S,k]=w.useState(t?.title??""),[E,C]=w.useState(t?.description??""),[T,R]=w.useState(!1),[N,I]=w.useState(null),M=p??u?.defaultBranch??"",P=y??u?.currentBranch??"",A=u?.refs??[],L=A.find(V=>V.name===P),D=M!==""&&Xa({baseRef:M,headRef:P});async function U(V){V.preventDefault(),R(!0),I(null);try{const Y=S.trim();if(t){const te=_a(kV,{id:t.id,...Y&&Y!==t.title?{title:Y}:{},...E!==t.description?{description:E}:{},...M!==t.baseRef?{baseRef:M}:{},...P!==t.headRef?{headRef:P}:{}});await c(te)}else{const te=_a(wV,{repositoryId:e,baseRef:M,headRef:P,...Y?{title:Y}:{},...E?{description:E}:{}}),O=await l(te);i?.(O)}n()}catch(Y){I(Y)}finally{R(!1)}}const q=wl(N,"baseRef"),K=wl(N,"headRef"),G=wl(N,"title"),B=N&&!q&&!K&&!G?Jt(N):null,F=s&&S.trim()===t.title&&E===t.description&&M===t.baseRef&&P===t.headRef;return d.jsxs("form",{onSubmit:V=>{U(V)},noValidate:!0,children:[d.jsxs(Zu,{children:[d.jsx(Ua,{children:s?"Edit review":"New review"}),d.jsx(Za,{children:"Changes are compared from where the two refs diverged, the way a pull request is. Pick the same ref twice to review only what is uncommitted on it."})]}),d.jsxs("div",{className:"flex flex-col gap-4",children:[m&&d.jsxs("div",{className:"flex items-end gap-2",children:[d.jsx(yt,{className:"h-9 flex-1"}),d.jsx(yt,{className:"mb-2 size-4"}),d.jsx(yt,{className:"h-9 flex-1"})]}),!m&&h!==void 0&&d.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:Jt(h)}),!m&&h===void 0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-end gap-2",children:[d.jsxs(Ii,{className:"min-w-0 flex-1",children:[d.jsx(Di,{htmlFor:"review-base",children:"Base"}),d.jsx(bE,{id:"review-base",refs:A,value:M,onChange:g,invalid:q!==void 0})]}),d.jsx(Th,{className:"mb-2.5 size-4 shrink-0 text-muted-foreground"}),d.jsxs(Ii,{className:"min-w-0 flex-1",children:[d.jsx(Di,{htmlFor:"review-head",children:"Compare"}),d.jsx(bE,{id:"review-head",refs:A,value:P,onChange:b,invalid:K!==void 0})]})]}),(q??K)!==void 0&&d.jsx(El,{children:q??K}),D&&d.jsxs("p",{className:`flex items-start gap-2 rounded-md px-3 py-2 text-xs ${L?.hasUncommittedChanges?"bg-warning/10 text-warning":"bg-muted/60 text-muted-foreground"}`,children:[d.jsx(As,{className:"mt-0.5 size-3.5 shrink-0"}),L?.hasUncommittedChanges?d.jsxs("span",{children:["This review is ",d.jsx("span",{className:"font-mono",children:P})," against itself, so it holds only the uncommitted work in"," ",d.jsx("span",{"data-selectable":!0,className:"font-mono",children:L.checkedOutAt}),"."]}):d.jsxs("span",{children:["This review is ",d.jsx("span",{className:"font-mono",children:P})," against itself, so it holds only uncommitted work. There is none right now — it will fill in as you edit."]})]}),!D&&L?.hasUncommittedChanges&&d.jsxs("p",{className:"flex items-start gap-2 rounded-md bg-warning/10 px-3 py-2 text-xs text-warning",children:[d.jsx(As,{className:"mt-0.5 size-3.5 shrink-0"}),d.jsxs("span",{children:[d.jsx("span",{className:"font-mono",children:L.name})," has uncommitted changes in"," ",d.jsx("span",{"data-selectable":!0,className:"font-mono",children:L.checkedOutAt}),". They will be part of this review."]})]}),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"review-title",children:"Title"}),d.jsx(Os,{id:"review-title",value:S,onChange:V=>k(V.target.value),placeholder:M&&P?SV(M,P):"Describe the change","data-invalid":G?"":void 0,autoComplete:"off"}),d.jsx(El,{children:G}),!G&&!s&&d.jsx(Es,{children:"Leave blank to name it after the two refs."})]}),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"review-description",children:"Description"}),d.jsx(dj,{id:"review-description",value:E,onChange:V=>C(V.target.value),placeholder:"What should a reviewer know before reading the diff?",rows:4}),d.jsx(Es,{children:"Optional. Shown at the top of the conversation."})]})]}),B&&d.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:B})]}),d.jsxs(nm,{children:[d.jsx(Ve,{type:"button",variant:"ghost",onClick:n,children:"Cancel"}),d.jsxs(Ve,{type:"submit",disabled:T||m||!M||!P||F,children:[T&&d.jsx(wi,{className:"animate-spin"}),s?"Save changes":"Create review"]})]})]})}const vE=[{value:"open",label:"Open"},{value:"closed",label:"Closed"},{value:"all",label:"All"}];function l7({repositoryId:e}){const t=Fo(),[n,i]=w.useState("open"),[s,l]=w.useState(!1),{data:c,error:u,isLoading:m,isRefreshing:h,refresh:p}=$U(e,n==="all"?void 0:n),g=c!==void 0&&so(u);return Il(w.useMemo(()=>[{id:"reviews:create",label:"New review",group:"Repository",keys:"n",keywords:"compare branch create open",icon:Bi,run:()=>l(!0)},{id:"reviews:refresh",label:"Refresh reviews",group:"Repository",keys:"r",keywords:"reload",icon:sr,run:()=>{p()}},...vE.map((y,b)=>({id:`reviews:filter:${y.value}`,label:`Show ${y.label.toLowerCase()} reviews`,group:"Repository",keys:String(b+1),keywords:"filter status",icon:BI,disabled:n===y.value,run:()=>i(y.value)}))],[n,p])),d.jsxs("section",{className:"flex flex-col gap-4",children:[d.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[d.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:vE.map(({value:y,label:b})=>d.jsx("button",{type:"button",onClick:()=>i(y),className:Te("rounded-sm px-2.5 py-1 text-xs font-medium transition-colors",n===y?"bg-secondary text-secondary-foreground":"text-muted-foreground hover:text-foreground"),children:b},y))}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Ln,{label:"Reload reviews",children:d.jsx(Ve,{variant:"outline",size:"icon",onClick:()=>{p()},disabled:m,"aria-label":"Refresh",children:d.jsx(sr,{className:h?"animate-spin":void 0})})}),d.jsxs(Ve,{onClick:()=>l(!0),children:[d.jsx(Bi,{}),"New review"]})]})]}),m&&d.jsx(c7,{}),!m&&u!==void 0&&!g&&d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-destructive/40 px-6 py-10 text-center",children:[d.jsx("div",{className:"rounded-full bg-destructive/10 p-3 text-destructive",children:d.jsx(Hi,{className:"size-6"})}),d.jsx("p",{className:"max-w-md text-sm text-muted-foreground",children:Jt(u)}),d.jsxs(Ve,{variant:"outline",onClick:()=>{p()},children:[d.jsx(sr,{}),"Try again"]})]}),!m&&(u===void 0||g)&&c?.length===0&&d.jsx(u7,{filter:n,onCreate:()=>l(!0)}),!m&&(u===void 0||g)&&c&&c.length>0&&d.jsx("ul",{className:"flex flex-col gap-2",children:c.map(y=>d.jsx("li",{children:d.jsx(a7,{review:y})},y.id))}),d.jsx(Gj,{open:s,onOpenChange:l,repositoryId:e,onCreated:y=>An({name:"review",reviewId:y.id,tab:"files",...t})})]})}function a7({review:e}){const t=Fo();function n(){An({name:"review",reviewId:e.id,tab:"conversation",...t})}return d.jsxs(kt,{role:"button",tabIndex:0,"data-nav-item":!0,onClick:n,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n())},className:"flex cursor-pointer items-center gap-4 p-4 transition-colors hover:border-foreground/20",children:[d.jsx(bu,{className:Te("size-4 shrink-0",e.status==="open"?"text-success":"text-muted-foreground")}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"truncate font-medium",title:e.title,children:e.title}),e.status==="closed"&&d.jsx(tn,{variant:"outline",children:"Closed"})]}),d.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 font-mono text-xs text-muted-foreground",children:[!Xa(e)&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"min-w-0 break-words",children:d.jsx(Xn,{text:e.baseRef})}),d.jsx(Th,{className:"size-3 shrink-0"})]}),d.jsx("span",{className:"min-w-0 break-words",children:d.jsx(Xn,{text:e.headRef})})]})]}),d.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",title:im(e.updatedAt),children:rm(e.updatedAt)})]})}function c7(){return d.jsx("ul",{className:"flex flex-col gap-2","aria-busy":"true","aria-label":"Loading reviews",children:[0,1].map(e=>d.jsx("li",{children:d.jsxs(kt,{className:"flex items-center gap-4 p-4",children:[d.jsx(yt,{className:"size-4 rounded-full"}),d.jsxs("div",{className:"flex-1 space-y-2",children:[d.jsx(yt,{className:"h-4 w-52"}),d.jsx(yt,{className:"h-3 w-40"})]}),d.jsx(yt,{className:"h-3 w-16"})]})},e))})}function u7({filter:e,onCreate:t}){const n=e!=="all";return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-dashed px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground",children:d.jsx(bu,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:e==="closed"?"No closed reviews":"No reviews yet"}),d.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm text-muted-foreground",children:e==="closed"?"Reviews you close are filed here instead of being deleted.":"Compare two branches to start a review. Work that is only sitting in a worktree, uncommitted, can be reviewed too."})]}),e!=="closed"&&d.jsxs(Ve,{onClick:t,className:"mt-1",children:[d.jsx(Bi,{}),n?"New review":"Create your first review"]})]})}function Yj({git:e}){return e.exists?e.isGitRepository?null:d.jsxs(tn,{variant:"destructive",title:e.error??void 0,children:[d.jsx(QC,{}),"Not a git repository"]}):d.jsxs(tn,{variant:"destructive",title:e.error??void 0,children:[d.jsx(PI,{}),"Folder missing"]})}function f7({open:e,onOpenChange:t,initialPath:n,onChoose:i}){return d.jsx(Ba,{open:e,onOpenChange:t,children:d.jsx(Va,{children:e&&d.jsx(d7,{initialPath:n,onChoose:s=>{i(s),t(!1)},onCancel:()=>t(!1)})})})}function d7({initialPath:e,onChoose:t,onCancel:n}){const i=Wn(),s=$n(),[l,c]=w.useState(e),[u,m]=w.useState(e??""),[h,p]=w.useState(!1),{data:g,error:y,isLoading:b}=dn(Ut.directory(l,s),()=>i.fs.list(l===void 0?{}:{path:l}),{revalidateOnFocus:!1,shouldRetryOnError:!1,keepPreviousData:!0});function S(T){c(T),m(T)}function k(T){T.preventDefault();const R=u.trim();c(R===""?void 0:R)}const E=(g?.entries??[]).filter(T=>h||!T.isHidden),C=(g?.entries??[]).length-E.length;return d.jsxs(d.Fragment,{children:[d.jsxs(Zu,{children:[d.jsx(Ua,{children:"Choose a folder"}),d.jsx(Za,{children:s===void 0?"Folders on this computer. A repository is marked; a subfolder of one works too.":"Folders on the machine this list belongs to. A repository is marked."})]}),d.jsxs("div",{className:"flex min-h-0 flex-col gap-3",children:[d.jsxs("form",{onSubmit:k,className:"flex gap-2",noValidate:!0,children:[d.jsx(Os,{value:u,onChange:T=>m(T.target.value),placeholder:g?.home??"/path/to/folder",className:"font-mono text-xs","aria-label":"Folder to list",autoComplete:"off",spellCheck:!1}),d.jsx(Ve,{type:"submit",variant:"outline",className:"shrink-0",children:"Go"})]}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:()=>{c(void 0),m("")},children:[d.jsx(XC,{}),"Home"]}),g?.parent&&d.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:()=>S(g.parent),children:[d.jsx(yI,{}),"Up"]}),d.jsx("span",{className:"flex-1"}),d.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[d.jsx(Wb,{checked:h,onCheckedChange:p}),"Hidden",C>0&&!h&&d.jsxs("span",{children:["(",C,")"]})]})]}),y!==void 0&&d.jsxs("p",{role:"alert",className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[d.jsx(Hi,{className:"mt-0.5 size-4 shrink-0"}),d.jsx(Xn,{text:Jt(y)})]}),d.jsxs("ul",{className:"h-64 overflow-y-auto rounded-md border",children:[b&&d.jsxs("li",{className:"flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground",children:[d.jsx(wi,{className:"size-4 animate-spin"}),"Reading…"]}),!b&&E.length===0&&y===void 0&&d.jsx("li",{className:"px-3 py-2 text-sm text-muted-foreground",children:C>0?"Only hidden folders in here.":"No folders in here."}),E.map(T=>d.jsx("li",{children:d.jsxs("button",{type:"button",onClick:()=>S(T.path),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-muted",children:[d.jsx(FI,{className:"size-4 shrink-0 text-muted-foreground"}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:T.name}),T.isRepository&&d.jsx(tn,{variant:"outline",className:"shrink-0",children:"repository"}),d.jsx(Do,{className:"size-4 shrink-0 text-muted-foreground"})]})},T.path))]}),g?.truncated&&d.jsx("p",{className:"text-xs text-muted-foreground",children:"Only the first folders are listed. Type a path above to go straight there."}),g&&d.jsx("p",{"data-selectable":!0,className:"break-words font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:g.path})})]}),d.jsxs(nm,{children:[d.jsx(Ve,{type:"button",variant:"ghost",onClick:n,children:"Cancel"}),d.jsx(Ve,{type:"button",disabled:!g,onClick:()=>g&&t(g.path),children:"Use this folder"})]})]})}function h7(){const e=Wn(),t=$n(),{data:n,error:i,isLoading:s,isValidating:l,mutate:c}=dn(Ut.repositories(t),()=>e.repositories.list());return{repositories:n,error:i,isLoading:s,isRefreshing:l&&!s,refresh:c}}function Kj(){const e=Wn(),t=$n(),{mutate:n}=_s(),i=w.useCallback(()=>n(Ut.repositories(t)),[t,n]);return{addRepository:w.useCallback(async s=>{const l=await e.repositories.add(s);return await i(),l},[e,i]),updateRepository:w.useCallback(async s=>{const l=await e.repositories.update(s);return await i(),l},[e,i]),removeRepository:w.useCallback(async s=>{await e.repositories.remove({id:s}),await i()},[e,i])}}function Xj({open:e,onOpenChange:t,repository:n}){return d.jsx(Ba,{open:e,onOpenChange:t,children:d.jsx(Va,{children:e&&d.jsx(m7,{repository:n,onDone:()=>t(!1)},n?.id??"new")})})}function m7({repository:e,onDone:t}){const n=e!==void 0,i=$n(),{addRepository:s,updateRepository:l}=Kj(),[c,u]=w.useState(e?.path??""),[m,h]=w.useState(e?.name??""),[p,g]=w.useState(!1),[y,b]=w.useState(!1),[S,k]=w.useState(null),E=Lt.capabilities.pickDirectory&&i===void 0;async function C(){const A=await Lt.system.pickDirectory();A&&(u(A),k(null))}function T(A){u(A),k(null)}async function R(A){A.preventDefault(),b(!0),k(null);try{if(e){const L=_a(cV,{id:e.id,name:m.trim(),...c.trim()!==e.path?{path:c.trim()}:{}});await l(L)}else{const L=m.trim(),D=_a(aV,{path:c.trim(),...L?{name:L}:{}});await s(D)}t()}catch(L){k(L)}finally{b(!1)}}const N=wl(S,"path"),I=wl(S,"name"),M=S&&!N&&!I?Jt(S):null,P=n2(c.trim());return d.jsxs("form",{onSubmit:A=>{R(A)},noValidate:!0,children:[d.jsxs(Zu,{children:[d.jsx(Ua,{children:n?"Edit repository":"Add repository"}),d.jsx(Za,{children:n?"Rename this repository, or point it at a new location if you moved it.":i===void 0?"Choose any folder inside a git repository. GitWarren stores the repository root.":"Choose a folder on that machine. GitWarren stores the repository root."})]}),d.jsxs("div",{className:"flex flex-col gap-4",children:[d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"repository-path",children:"Repository folder"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(Os,{id:"repository-path",value:c,onChange:A=>u(A.target.value),placeholder:"/path/to/repository",className:"font-mono text-xs","data-invalid":N?"":void 0,autoComplete:"off",spellCheck:!1}),E?d.jsxs(Ve,{type:"button",variant:"outline",onClick:()=>{C()},className:"shrink-0",children:[d.jsx(Xd,{}),"Browse"]}):d.jsxs(Ve,{type:"button",variant:"outline",onClick:()=>g(!0),className:"shrink-0",children:[d.jsx(II,{}),"Browse"]})]}),d.jsx(El,{children:N}),!N&&d.jsx(Es,{children:"A subfolder works too - it resolves to the repository root."})]}),d.jsxs(Ii,{children:[d.jsx(Di,{htmlFor:"repository-name",children:"Display name"}),d.jsx(Os,{id:"repository-name",value:m,onChange:A=>h(A.target.value),placeholder:P||"Defaults to the folder name","data-invalid":I?"":void 0,autoComplete:"off"}),d.jsx(El,{children:I}),!I&&!n&&d.jsx(Es,{children:"Leave blank to use the folder name."})]}),M&&d.jsxs("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[M,Ky(S)==="GIT_UNAVAILABLE"&&d.jsx("span",{className:"mt-1 block text-xs opacity-80",children:"GitWarren shells out to your own git installation."})]})]}),d.jsx(f7,{open:p,onOpenChange:g,initialPath:c.trim()===""?void 0:c.trim(),onChoose:T}),d.jsxs(nm,{children:[d.jsx(Ve,{type:"button",variant:"ghost",onClick:t,children:"Cancel"}),d.jsxs(Ve,{type:"submit",disabled:y,children:[y&&d.jsx(wi,{className:"animate-spin"}),n?"Save changes":"Add repository"]})]})]})}function p7({repositoryId:e}){const t=Wn(),n=$n(),i=Fo(),[s,l]=w.useState(!1),{data:c,error:u,isLoading:m}=dn(Ut.repository(e,n),()=>t.repositories.get({id:e})),h=fj(c?.path??"");if(Il(w.useMemo(()=>c===void 0?[]:[{id:"repository:edit",label:"Edit repository",group:"Repository",hint:c.name,keys:"e",keywords:"rename settings",icon:Tl,run:()=>l(!0)},...t.capabilities.revealPath&&h!==null?[{id:"repository:reveal",label:"Show in file manager",group:"Repository",hint:c.path,keys:"o",keywords:"finder explorer folder open reveal",icon:Xd,disabled:!c.git.exists,run:()=>{t.system.revealPath(h)}}]:[]],[t,c,h])),m)return d.jsxs("div",{className:"flex flex-col gap-5","aria-busy":"true","aria-label":"Loading repository",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(yt,{className:"h-4 w-32"}),d.jsx(yt,{className:"h-6 w-56"}),d.jsx(yt,{className:"h-4 w-80"})]}),d.jsx(yt,{className:"h-32 w-full"})]});const p=c!==void 0&&so(u);if(!c||u!==void 0&&!p)return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-destructive/40 px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-destructive/10 p-3 text-destructive",children:d.jsx(Hi,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Repository not found"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:u===void 0?"It may have been removed.":Jt(u)})]}),d.jsxs(Ve,{variant:"outline",onClick:()=>An({name:"repositories",...i}),children:[d.jsx(Cs,{}),"Back to repositories"]})]});const g=!c.git.exists;return d.jsxs("div",{className:"flex flex-col gap-5",children:[d.jsxs("div",{children:[d.jsxs(Ve,{variant:"ghost",size:"sm",className:"-ml-2 mb-2 text-muted-foreground",onClick:()=>An({name:"repositories",...i}),children:[d.jsx(Cs,{}),"Repositories"]}),d.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h1",{className:"truncate text-xl font-semibold tracking-tight",title:c.name,children:c.name}),d.jsx(Yj,{git:c.git})]}),d.jsx("p",{"data-selectable":!0,className:"mt-1 break-words font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:c.path})})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.capabilities.revealPath&&h!==null&&d.jsx(Ln,{label:g?"Folder is missing":"Show in file manager",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":"Show in file manager",disabled:g,onClick:()=>{t.system.revealPath(h)},children:d.jsx(Xd,{})})}),d.jsx(Ln,{label:"Edit repository",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":"Edit repository",onClick:()=>l(!0),children:d.jsx(Tl,{})})})]})]})]}),d.jsx(l7,{repositoryId:c.id}),d.jsx(Xj,{open:s,onOpenChange:l,repository:c})]})}function g7({repository:e,onEdit:t,onRemove:n,alsoHere:i}){const s=Fo(),l=fj(e.path),c=!e.git.exists;function u(){An({name:"repository",repositoryId:e.id,...s})}return d.jsxs(kt,{role:"button",tabIndex:0,"data-nav-item":!0,onClick:u,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),u())},className:"flex cursor-pointer items-center gap-4 p-4 transition-colors hover:border-foreground/20",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h3",{className:"truncate font-medium",title:e.name,children:e.name}),d.jsx(Yj,{git:e.git})]}),d.jsx("p",{"data-selectable":!0,className:"mt-1 break-words font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:e.path})}),i&&d.jsxs("button",{type:"button",onClick:m=>{m.stopPropagation(),An(i.route)},className:"mt-1.5 flex max-w-full items-center gap-1.5 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:[d.jsx(rD,{className:"size-3 shrink-0"}),d.jsxs("span",{className:"truncate",children:["Also on this computer: ",i.path]})]})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-1",onClick:m=>m.stopPropagation(),onKeyDown:m=>m.stopPropagation(),role:"presentation",children:[Lt.capabilities.revealPath&&l!==null&&d.jsx(Ln,{label:c?"Folder is missing":"Show in file manager",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":"Show in file manager",disabled:c,onClick:()=>{Lt.system.revealPath(l)},children:d.jsx(Xd,{})})}),d.jsx(Ln,{label:"Edit this repository",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":`Edit ${e.name}`,onClick:()=>t(e),children:d.jsx(Tl,{})})}),d.jsx(Ln,{label:"Remove from GitWarren",children:d.jsx(Ve,{variant:"ghost",size:"icon","aria-label":`Remove ${e.name}`,className:"text-muted-foreground hover:text-destructive",onClick:()=>n(e),children:d.jsx(vu,{})})})]}),d.jsx(Do,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})}function x7({repository:e,onOpenChange:t}){const{removeRepository:n}=Kj(),[i,s]=w.useState(!1),[l,c]=w.useState(null);async function u(){if(e){s(!0),c(null);try{await n(e.id),t(!1)}catch(m){c(m)}finally{s(!1)}}}return d.jsx(hm,{open:e!==null,onOpenChange:m=>{m||c(null),t(m)},children:d.jsxs(mm,{children:[d.jsxs(pm,{children:[d.jsxs(gm,{children:["Remove “",e?.name,"”?"]}),d.jsx(xm,{children:"This removes the repository from GitWarren only. Nothing on disk is deleted and the working copy is left exactly as it is."})]}),e&&d.jsx("p",{"data-selectable":!0,className:"mt-3 break-words rounded-md bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:d.jsx(Xn,{text:e.path})}),l!==null&&d.jsx("p",{role:"alert",className:"mt-3 text-sm text-destructive",children:Jt(l)}),d.jsxs(ym,{children:[d.jsx(Ve,{variant:"ghost",onClick:()=>t(!1),disabled:i,children:"Cancel"}),d.jsxs(Ve,{variant:"destructive",onClick:()=>{u()},disabled:i,children:[i&&d.jsx(wi,{className:"animate-spin"}),"Remove"]})]})]})})}function y7(e,t){const n=new Map;if(e===void 0||!t)return n;for(const i of t){const s=i.git.rootCommit;s===null||n.has(s)||n.set(s,{path:i.path,route:{name:"repository",repositoryId:i.id}})}return n}function Jj(){const e=$n(),{repositories:t,error:n,isLoading:i,isRefreshing:s,refresh:l}=h7(),{data:c}=dn(Ut.repositories(),()=>Lt.repositories.list()),u=w.useMemo(()=>y7(e,c),[e,c]),m=t!==void 0&&so(n),[h,p]=w.useState(!1),[g,y]=w.useState(void 0),[b,S]=w.useState(null),k=w.useCallback(()=>{y(void 0),p(!0)},[]);function E(C){y(C),p(!0)}return Il(w.useMemo(()=>[{id:"repositories:add",label:"Add repository",group:"Repositories",keys:"n",keywords:"new track clone folder",icon:Bi,run:k},{id:"repositories:refresh",label:"Refresh repositories",group:"Repositories",keys:"r",keywords:"reload git state",icon:sr,run:()=>{l()}}],[k,l])),d.jsxs("section",{className:"flex flex-col gap-4",children:[d.jsxs("header",{className:"flex items-center justify-between gap-4",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:"Repositories"}),d.jsx("p",{className:"text-sm text-muted-foreground",children:i?"Loading…":`${t?.length??0} tracked${s?" · refreshing…":""}`})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Ln,{label:"Re-read git state",children:d.jsx(Ve,{variant:"outline",size:"icon",onClick:()=>{l()},disabled:i,"aria-label":"Refresh",children:d.jsx(sr,{className:s?"animate-spin":void 0})})}),d.jsxs(Ve,{onClick:k,children:[d.jsx(Bi,{}),"Add repository"]})]})]}),i&&d.jsx(b7,{}),!i&&n!==void 0&&!m&&d.jsx(w7,{error:n,onRetry:()=>{l()}}),!i&&(n===void 0||m)&&t?.length===0&&d.jsx(v7,{onAdd:k}),!i&&(n===void 0||m)&&t&&t.length>0&&d.jsx("ul",{className:"flex flex-col gap-2",children:t.map(C=>d.jsx("li",{children:d.jsx(g7,{repository:C,onEdit:E,onRemove:S,alsoHere:C.git.rootCommit===null?void 0:u.get(C.git.rootCommit)})},C.id))}),d.jsx(Xj,{open:h,onOpenChange:p,repository:g}),d.jsx(x7,{repository:b,onOpenChange:C=>{C||S(null)}})]})}function b7(){return d.jsx("ul",{className:"flex flex-col gap-2","aria-busy":"true","aria-label":"Loading repositories",children:[0,1,2].map(e=>d.jsx("li",{children:d.jsxs(kt,{className:"flex items-center gap-4 p-4",children:[d.jsxs("div",{className:"flex-1 space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(yt,{className:"h-4 w-40"}),d.jsx(yt,{className:"h-4 w-24"})]}),d.jsx(yt,{className:"h-3 w-72"})]}),d.jsx(yt,{className:"size-9 rounded-md"})]})},e))})}function v7({onAdd:e}){return d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-dashed px-6 py-14 text-center",children:[d.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground",children:d.jsx(qy,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"No repositories yet"}),d.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm text-muted-foreground",children:"Add a local git repository to start reviewing it. You can also add one from an AI agent through the MCP server."})]}),d.jsxs(Ve,{onClick:e,className:"mt-1",children:[d.jsx(Bi,{}),"Add your first repository"]})]})}function w7({error:e,onRetry:t}){const n=Ky(e);return n==="HOST_OFFLINE"?d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-dashed px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-muted p-3 text-muted-foreground",children:d.jsx(JC,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"This host is not answering"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:Jt(e)})]}),d.jsxs(Ve,{variant:"outline",onClick:t,className:"mt-1",children:[d.jsx(sr,{}),"Try again"]})]}):d.jsxs(kt,{className:"flex flex-col items-center gap-3 border-destructive/40 px-6 py-12 text-center",children:[d.jsx("div",{className:"rounded-full bg-destructive/10 p-3 text-destructive",children:d.jsx(Hi,{className:"size-6"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"font-medium",children:"Could not load your repositories"}),d.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:Jt(e)}),n==="GIT_UNAVAILABLE"&&d.jsx("p",{className:"mx-auto mt-2 max-w-md text-sm text-muted-foreground",children:"GitWarren uses your own git installation. Install git, or make sure it is on your PATH, then try again."})]}),d.jsxs(Ve,{variant:"outline",onClick:t,className:"mt-1",children:[d.jsx(sr,{}),"Try again"]})]})}const S7=[];function km(e){const{data:t,error:n,isLoading:i,refresh:s}=e7(e);return{threads:t??S7,error:n,isLoading:i,refresh:s}}function rv(){const e=Wn(),{mutate:t}=_s(),n=w.useCallback(()=>t(i=>typeof i=="string"&&(i.startsWith(ws.reviews)||i.startsWith(ws.review))),[t]);return{createThread:w.useCallback(async i=>{const s=await e.comments.createThread(i);return await n(),s},[e,n]),reply:w.useCallback(async i=>{const s=await e.comments.reply(i);return await n(),s},[e,n]),edit:w.useCallback(async(i,s)=>{const l=await e.comments.update({id:i,body:s});return await n(),l},[e,n]),remove:w.useCallback(async i=>{await e.comments.remove({id:i}),await n()},[e,n]),setResolved:w.useCallback(async(i,s)=>{await e.comments.setResolved({threadId:i,resolved:s}),await n()},[e,n])}}function wE({name:e,role:t,className:n}){const[i,s]=w.useState(!1),l=w.useRef(null);w.useEffect(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);async function c(){await navigator.clipboard.writeText(e),s(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>s(!1),1500)}return d.jsxs("span",{className:Te("inline-flex max-w-full items-center gap-1 rounded bg-muted py-0.5 pl-1.5 pr-0.5",n),children:[d.jsx("span",{"data-selectable":!0,className:"min-w-0 break-words",children:d.jsx(Xn,{text:e})}),d.jsx(Ln,{label:i?"Copied":`Copy ${t}`,children:d.jsx("button",{type:"button",onClick:()=>{c()},"aria-label":i?`${t} copied`:`Copy ${t}`,className:Te("flex size-5 shrink-0 items-center justify-center rounded transition-colors","text-muted-foreground hover:bg-foreground/10 hover:text-foreground"),children:i?d.jsx(Li,{className:"size-3 text-success"}):d.jsx(Kd,{className:"size-3"})})})]})}const SE="(min-width: 64rem)";function Wj(){const e=w.useCallback(t=>{const n=window.matchMedia(SE);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},[]);return w.useSyncExternalStore(e,()=>!window.matchMedia(SE).matches,()=>!1)}const Ty="gitwarren:";function k7(e){try{return window.localStorage.getItem(Ty+e)}catch{return null}}function E7(e,t){try{t===null?window.localStorage.removeItem(Ty+e):window.localStorage.setItem(Ty+e,t)}catch{}}function iv(e,t){const[n,i]=w.useState(()=>k7(e)??t),s=w.useCallback(l=>{i(l),E7(e,l)},[e]);return[n,s]}function $j(e,t){const[n,i]=iv(e,"on");return[n==="on",w.useCallback(s=>i(s?"on":"off"),[i])]}function C7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const T7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,R7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,j7={};function kE(e,t){return(j7.jsx?R7:T7).test(e)}const N7=/[ \t\n\f\r]/g;function O7(e){return typeof e=="object"?e.type==="text"?EE(e.value):!1:EE(e)}function EE(e){return e.replace(N7,"")===""}class Ju{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Ju.prototype.normal={};Ju.prototype.property={};Ju.prototype.space=void 0;function Qj(e,t){const n={},i={};for(const s of e)Object.assign(n,s.property),Object.assign(i,s.normal);return new Ju(n,i,t)}function Ry(e){return e.toLowerCase()}class Vr{constructor(t,n){this.attribute=n,this.property=t}}Vr.prototype.attribute="";Vr.prototype.booleanish=!1;Vr.prototype.boolean=!1;Vr.prototype.commaOrSpaceSeparated=!1;Vr.prototype.commaSeparated=!1;Vr.prototype.defined=!1;Vr.prototype.mustUseProperty=!1;Vr.prototype.number=!1;Vr.prototype.overloadedBoolean=!1;Vr.prototype.property="";Vr.prototype.spaceSeparated=!1;Vr.prototype.space=void 0;let A7=0;const gt=Pl(),Kn=Pl(),jy=Pl(),ze=Pl(),mn=Pl(),Cl=Pl(),ti=Pl();function Pl(){return 2**++A7}const Ny=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:Kn,commaOrSpaceSeparated:ti,commaSeparated:Cl,number:ze,overloadedBoolean:jy,spaceSeparated:mn},Symbol.toStringTag,{value:"Module"})),yx=Object.keys(Ny);class ov extends Vr{constructor(t,n,i,s){let l=-1;if(super(t,n),CE(this,"space",s),typeof i=="number")for(;++l<yx.length;){const c=yx[l];CE(this,yx[l],(i&Ny[c])===Ny[c])}}}ov.prototype.defined=!0;function CE(e,t,n){n&&(e[t]=n)}function Ja(e){const t={},n={};for(const[i,s]of Object.entries(e.properties)){const l=new ov(i,e.transform(e.attributes||{},i),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(l.mustUseProperty=!0),t[i]=l,n[Ry(i)]=i,n[Ry(l.attribute)]=i}return new Ju(t,n,e.space)}const eN=Ja({properties:{ariaActiveDescendant:null,ariaAtomic:Kn,ariaAutoComplete:null,ariaBusy:Kn,ariaChecked:Kn,ariaColCount:ze,ariaColIndex:ze,ariaColSpan:ze,ariaControls:mn,ariaCurrent:null,ariaDescribedBy:mn,ariaDetails:null,ariaDisabled:Kn,ariaDropEffect:mn,ariaErrorMessage:null,ariaExpanded:Kn,ariaFlowTo:mn,ariaGrabbed:Kn,ariaHasPopup:null,ariaHidden:Kn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:mn,ariaLevel:ze,ariaLive:null,ariaModal:Kn,ariaMultiLine:Kn,ariaMultiSelectable:Kn,ariaOrientation:null,ariaOwns:mn,ariaPlaceholder:null,ariaPosInSet:ze,ariaPressed:Kn,ariaReadOnly:Kn,ariaRelevant:null,ariaRequired:Kn,ariaRoleDescription:mn,ariaRowCount:ze,ariaRowIndex:ze,ariaRowSpan:ze,ariaSelected:Kn,ariaSetSize:ze,ariaSort:null,ariaValueMax:ze,ariaValueMin:ze,ariaValueNow:ze,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function tN(e,t){return t in e?e[t]:t}function nN(e,t){return tN(e,t.toLowerCase())}const M7=Ja({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Cl,acceptCharset:mn,accessKey:mn,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alpha:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:mn,autoFocus:gt,autoPlay:gt,blocking:mn,capture:null,charSet:null,checked:gt,cite:null,className:mn,closedBy:null,colorSpace:null,cols:ze,colSpan:ze,command:null,commandFor:null,content:null,contentEditable:Kn,controls:gt,controlsList:mn,coords:ze|Cl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:jy,draggable:Kn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:mn,height:ze,hidden:jy,high:ze,href:null,hrefLang:null,htmlFor:mn,httpEquiv:mn,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:mn,itemRef:mn,itemScope:gt,itemType:mn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:ze,manifest:null,max:null,maxLength:ze,media:null,method:null,min:null,minLength:ze,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gt,optimum:ze,pattern:null,ping:mn,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:mn,required:gt,reversed:gt,rows:ze,rowSpan:ze,sandbox:mn,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootCustomElementRegistry:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shadowRootSerializable:gt,shape:null,size:ze,sizes:null,slot:null,span:ze,spellCheck:Kn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ze,step:null,style:null,tabIndex:ze,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:Kn,width:ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:mn,axis:null,background:null,bgColor:null,border:ze,borderColor:null,bottomMargin:ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:ze,leftMargin:ze,link:null,longDesc:null,lowSrc:null,marginHeight:ze,marginWidth:ze,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:ze,rules:null,scheme:null,scrolling:Kn,standby:null,summary:null,text:null,topMargin:ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ze,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:gt,disablePictureInPicture:gt,disableRemotePlayback:gt,exportParts:Cl,part:mn,prefix:null,property:null,results:ze,security:null,unselectable:null},space:"html",transform:nN}),z7=Ja({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ti,accentHeight:ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ze,amplitude:ze,arabicForm:null,ascent:ze,attributeName:null,attributeType:null,azimuth:ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ze,by:null,calcMode:null,capHeight:ze,className:mn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ze,diffuseConstant:ze,direction:null,display:null,dur:null,divisor:ze,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ze,enableBackground:null,end:null,event:null,exponent:ze,externalResourcesRequired:null,fill:null,fillOpacity:ze,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Cl,g2:Cl,glyphName:Cl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ze,horizOriginX:ze,horizOriginY:ze,id:null,ideographic:ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ze,k:ze,k1:ze,k2:ze,k3:ze,k4:ze,kernelMatrix:ti,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ze,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ze,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ze,overlineThickness:ze,paintOrder:null,panose1:null,path:null,pathLength:ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:mn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ze,pointsAtY:ze,pointsAtZ:ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ti,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ti,rev:ti,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ti,requiredFeatures:ti,requiredFonts:ti,requiredFormats:ti,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ze,specularExponent:ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ze,strikethroughThickness:ze,string:null,stroke:null,strokeDashArray:ti,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ze,strokeOpacity:ze,strokeWidth:null,style:null,surfaceScale:ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ti,tabIndex:ze,tableValues:null,target:null,targetX:ze,targetY:ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ti,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ze,underlineThickness:ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ze,values:null,vAlphabetic:ze,vMathematical:ze,vectorEffect:null,vHanging:ze,vIdeographic:ze,version:null,vertAdvY:ze,vertOriginX:ze,vertOriginY:ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:tN}),rN=Ja({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),iN=Ja({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nN}),oN=Ja({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),I7={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},D7=/[A-Z]/g,TE=/-[a-z]/g,_7=/^data[-\w.:]+$/i;function P7(e,t){const n=Ry(t);let i=t,s=Vr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&_7.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(TE,F7);i="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!TE.test(l)){let c=l.replace(D7,L7);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=ov}return new s(i,t)}function L7(e){return"-"+e.toLowerCase()}function F7(e){return e.charAt(1).toUpperCase()}const H7=Qj([eN,M7,rN,iN,oN],"html"),sv=Qj([eN,z7,rN,iN,oN],"svg");function B7(e){return e.join(" ").trim()}var va={},bx,RE;function V7(){if(RE)return bx;RE=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,m=`
|
|
64
64
|
`,h="/",p="*",g="",y="comment",b="declaration";function S(E,C){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];C=C||{};var T=1,R=1;function N(G){var B=G.match(t);B&&(T+=B.length);var F=G.lastIndexOf(m);R=~F?G.length-F:R+G.length}function I(){var G={line:T,column:R};return function(B){return B.position=new M(G),L(),B}}function M(G){this.start=G,this.end={line:T,column:R},this.source=C.source}M.prototype.content=E;function P(G){var B=new Error(C.source+":"+T+":"+R+": "+G);if(B.reason=G,B.filename=C.source,B.line=T,B.column=R,B.source=E,!C.silent)throw B}function A(G){var B=G.exec(E);if(B){var F=B[0];return N(F),E=E.slice(F.length),B}}function L(){A(n)}function D(G){var B;for(G=G||[];B=U();)B!==!1&&G.push(B);return G}function U(){var G=I();if(!(h!=E.charAt(0)||p!=E.charAt(1))){for(var B=2;g!=E.charAt(B)&&(p!=E.charAt(B)||h!=E.charAt(B+1));)++B;if(B+=2,g===E.charAt(B-1))return P("End of comment missing");var F=E.slice(2,B-2);return R+=2,N(F),E=E.slice(B),R+=2,G({type:y,comment:F})}}function q(){var G=I(),B=A(i);if(B){if(U(),!A(s))return P("property missing ':'");var F=A(l),V=G({type:b,property:k(B[0].replace(e,g)),value:F?k(F[0].replace(e,g)):g});return A(c),V}}function K(){var G=[];D(G);for(var B;B=q();)B!==!1&&(G.push(B),D(G));return G}return L(),K()}function k(E){return E?E.replace(u,g):g}return bx=S,bx}var jE;function U7(){if(jE)return va;jE=1;var e=va&&va.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(va,"__esModule",{value:!0}),va.default=n;const t=e(V7());function n(i,s){let l=null;if(!i||typeof i!="string")return l;const c=(0,t.default)(i),u=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:p}=m;u?s(h,p,m):p&&(l=l||{},l[h]=p)}),l}return va}var Qc={},NE;function Z7(){if(NE)return Qc;NE=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,l=function(h){return!h||n.test(h)||e.test(h)},c=function(h,p){return p.toUpperCase()},u=function(h,p){return"".concat(p,"-")},m=function(h,p){return p===void 0&&(p={}),l(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(s,u):h=h.replace(i,u),h.replace(t,c))};return Qc.camelCase=m,Qc}var eu,OE;function q7(){if(OE)return eu;OE=1;var e=eu&&eu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(U7()),n=Z7();function i(s,l){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(u,m){u&&m&&(c[(0,n.camelCase)(u,l)]=m)}),c}return i.default=i,eu=i,eu}var G7=q7();const Y7=By(G7),sN=lN("end"),lv=lN("start");function lN(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function K7(e){const t=lv(e),n=sN(e);if(t&&n)return{start:t,end:n}}function hu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?AE(e.position):"start"in e||"end"in e?AE(e):"line"in e||"column"in e?Oy(e):""}function Oy(e){return ME(e&&e.line)+":"+ME(e&&e.column)}function AE(e){return Oy(e&&e.start)+"-"+Oy(e&&e.end)}function ME(e){return e&&typeof e=="number"?e:1}class Cr extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let s="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?s=t:!l.cause&&t&&(c=!0,s=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof i=="string"){const m=i.indexOf(":");m===-1?l.ruleId=i:(l.source=i.slice(0,m),l.ruleId=i.slice(m+1))}if(!l.place&&l.ancestors&&l.ancestors){const m=l.ancestors[l.ancestors.length-1];m&&(l.place=m.position)}const u=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=u?u.line:void 0,this.name=hu(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Cr.prototype.file="";Cr.prototype.name="";Cr.prototype.reason="";Cr.prototype.message="";Cr.prototype.stack="";Cr.prototype.column=void 0;Cr.prototype.line=void 0;Cr.prototype.ancestors=void 0;Cr.prototype.cause=void 0;Cr.prototype.fatal=void 0;Cr.prototype.place=void 0;Cr.prototype.ruleId=void 0;Cr.prototype.source=void 0;const av={}.hasOwnProperty,X7=new Map,J7=/[A-Z]/g,W7=new Set(["table","tbody","thead","tfoot","tr"]),$7=new Set(["td","th"]),aN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Q7(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=lZ(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=sZ(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?sv:H7,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=cN(s,e,void 0);return l&&typeof l!="string"?l:s.create(e,s.Fragment,{children:l||void 0},void 0)}function cN(e,t,n){if(t.type==="element")return eZ(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return tZ(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return rZ(e,t,n);if(t.type==="mdxjsEsm")return nZ(e,t);if(t.type==="root")return iZ(e,t,n);if(t.type==="text")return oZ(e,t)}function eZ(e,t,n){const i=e.schema;let s=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=sv,e.schema=s),e.ancestors.push(t);const l=fN(e,t.tagName,!1),c=aZ(e,t);let u=uv(e,t);return W7.has(t.tagName)&&(u=u.filter(function(m){return typeof m=="string"?!O7(m):!0})),uN(e,c,l,t),cv(c,u),e.ancestors.pop(),e.schema=i,e.create(t,l,c,n)}function tZ(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Nu(e,t.position)}function nZ(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Nu(e,t.position)}function rZ(e,t,n){const i=e.schema;let s=i;t.name==="svg"&&i.space==="html"&&(s=sv,e.schema=s),e.ancestors.push(t);const l=t.name===null?e.Fragment:fN(e,t.name,!0),c=cZ(e,t),u=uv(e,t);return uN(e,c,l,t),cv(c,u),e.ancestors.pop(),e.schema=i,e.create(t,l,c,n)}function iZ(e,t,n){const i={};return cv(i,uv(e,t)),e.create(t,e.Fragment,i,n)}function oZ(e,t){return t.value}function uN(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function cv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function sZ(e,t,n){return i;function i(s,l,c,u){const h=Array.isArray(c.children)?n:t;return u?h(l,c,u):h(l,c)}}function lZ(e,t){return n;function n(i,s,l,c){const u=Array.isArray(l.children),m=lv(i);return t(s,l,c,u,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function aZ(e,t){const n={};let i,s;for(s in t.properties)if(s!=="children"&&av.call(t.properties,s)){const l=uZ(e,s,t.properties[s]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&$7.has(t.tagName)?i=u:n[c]=u}}if(i){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function cZ(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const l=i.data.estree.body[0];l.type;const c=l.expression;c.type;const u=c.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Nu(e,t.position);else{const s=i.name;let l;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const u=i.value.data.estree.body[0];u.type,l=e.evaluater.evaluateExpression(u.expression)}else Nu(e,t.position);else l=i.value===null?!0:i.value;n[s]=l}return n}function uv(e,t){const n=[];let i=-1;const s=e.passKeys?new Map:X7;for(;++i<t.children.length;){const l=t.children[i];let c;if(e.passKeys){const m=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(m){const h=s.get(m)||0;c=m+"-"+h,s.set(m,h+1)}}const u=cN(e,l,c);u!==void 0&&n.push(u)}return n}function uZ(e,t,n){const i=P7(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?C7(n):B7(n)),i.property==="style"){let s=typeof n=="object"?n:fZ(e,String(n));return e.stylePropertyNameCase==="css"&&(s=dZ(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&i.space?I7[i.property]||i.property:i.attribute,n]}}function fZ(e,t){try{return Y7(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,s=new Cr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=aN+"#cannot-parse-style-attribute",s}}function fN(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let l=-1,c;for(;++l<s.length;){const u=kE(s[l])?{type:"Identifier",name:s[l]}:{type:"Literal",value:s[l]};c=c?{type:"MemberExpression",object:c,property:u,computed:!!(l&&u.type==="Literal"),optional:!1}:u}i=c}else i=kE(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const s=i.value;return av.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(i);Nu(e)}function Nu(e,t){const n=new Cr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=aN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function dZ(e){const t={};let n;for(n in e)av.call(e,n)&&(t[hZ(n)]=e[n]);return t}function hZ(e){let t=e.replace(J7,mZ);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function mZ(e){return"-"+e.toLowerCase()}const vx={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},pZ={};function fv(e,t){const n=pZ,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return dN(e,i,s)}function dN(e,t,n){if(gZ(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return zE(e.children,t,n)}return Array.isArray(e)?zE(e,t,n):""}function zE(e,t,n){const i=[];let s=-1;for(;++s<e.length;)i[s]=dN(e[s],t,n);return i.join("")}function gZ(e){return!!(e&&typeof e=="object")}const IE=document.createElement("i");function dv(e){const t="&"+e+";";IE.innerHTML=t;const n=IE.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ni(e,t,n,i){const s=e.length;let l=0,c;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,i.length<1e4)c=Array.from(i),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);l<i.length;)c=i.slice(l,l+1e4),c.unshift(t,0),e.splice(...c),l+=1e4,t+=1e4}function gi(e,t){return e.length>0?(ni(e,e.length,0,t),e):t}const DE={}.hasOwnProperty;function hN(e){const t={};let n=-1;for(;++n<e.length;)xZ(t,e[n]);return t}function xZ(e,t){let n;for(n in t){const s=(DE.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){DE.call(s,c)||(s[c]=[]);const u=l[c];yZ(s[c],Array.isArray(u)?u:u?[u]:[])}}}function yZ(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);ni(e,0,0,i)}function mN(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Fi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Nr=Ys(/[A-Za-z]/),Sr=Ys(/[\dA-Za-z]/),bZ=Ys(/[#-'*+\--9=?A-Z^-~]/);function gh(e){return e!==null&&(e<32||e===127)}const Ay=Ys(/\d/),vZ=Ys(/[\dA-Fa-f]/),wZ=Ys(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function xn(e){return e!==null&&(e<0||e===32)}function Mt(e){return e===-2||e===-1||e===32}const Em=Ys(new RegExp("\\p{P}|\\p{S}","u")),Ol=Ys(/\s/);function Ys(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Wa(e){const t=[];let n=-1,i=0,s=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&Sr(e.charCodeAt(n+1))&&Sr(e.charCodeAt(n+2)))s=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(c=String.fromCharCode(l));else if(l>55295&&l<57344){const u=e.charCodeAt(n+1);l<56320&&u>56319&&u<57344?(c=String.fromCharCode(l,u),s=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(i,n),encodeURIComponent(c)),i=n+s+1,c=""),s&&(n+=s,s=0)}return t.join("")+e.slice(i)}function Bt(e,t,n,i){const s=i?i-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(m){return Mt(m)?(e.enter(n),u(m)):t(m)}function u(m){return Mt(m)&&l++<s?(e.consume(m),u):(e.exit(n),t(m))}}const SZ={tokenize:kZ};function kZ(e){const t=e.attempt(this.parser.constructs.contentInitial,i,s);let n;return t;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Bt(e,t,"linePrefix")}function s(u){return e.enter("paragraph"),l(u)}function l(u){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(u)}function c(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return lt(u)?(e.consume(u),e.exit("chunkText"),l):(e.consume(u),c)}}const EZ={tokenize:CZ},_E={tokenize:TZ};function CZ(e){const t=this,n=[];let i=0,s,l,c;return u;function u(R){if(i<n.length){const N=n[i];return t.containerState=N[1],e.attempt(N[0].continuation,m,h)(R)}return h(R)}function m(R){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const N=t.events.length;let I=N,M;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){M=t.events[I][1].end;break}C(i);let P=N;for(;P<t.events.length;)t.events[P][1].end={...M},P++;return ni(t.events,I+1,0,t.events.slice(N)),t.events.length=P,h(R)}return u(R)}function h(R){if(i===n.length){if(!s)return y(R);if(s.currentConstruct&&s.currentConstruct.concrete)return S(R);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_E,p,g)(R)}function p(R){return s&&T(),C(i),y(R)}function g(R){return t.parser.lazy[t.now().line]=i!==n.length,c=t.now().offset,S(R)}function y(R){return t.containerState={},e.attempt(_E,b,S)(R)}function b(R){return i++,n.push([t.currentConstruct,t.containerState]),y(R)}function S(R){if(R===null){s&&T(),C(0),e.consume(R);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:l}),k(R)}function k(R){if(R===null){E(e.exit("chunkFlow"),!0),C(0),e.consume(R);return}return lt(R)?(e.consume(R),E(e.exit("chunkFlow")),i=0,t.interrupt=void 0,u):(e.consume(R),k)}function E(R,N){const I=t.sliceStream(R);if(N&&I.push(null),R.previous=l,l&&(l.next=R),l=R,s.defineSkip(R.start),s.write(I),t.parser.lazy[R.start.line]){let M=s.events.length;for(;M--;)if(s.events[M][1].start.offset<c&&(!s.events[M][1].end||s.events[M][1].end.offset>c))return;const P=t.events.length;let A=P,L,D;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(L){D=t.events[A][1].end;break}L=!0}for(C(i),M=P;M<t.events.length;)t.events[M][1].end={...D},M++;ni(t.events,A+1,0,t.events.slice(P)),t.events.length=M}}function C(R){let N=n.length;for(;N-- >R;){const I=n[N];t.containerState=I[1],I[0].exit.call(t,e)}n.length=R}function T(){s.write([null]),l=void 0,s=void 0,t.containerState._closeFlow=void 0}}function TZ(e,t,n){return Bt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pa(e){if(e===null||xn(e)||Ol(e))return 1;if(Em(e))return 2}function Cm(e,t,n){const i=[];let s=-1;for(;++s<e.length;){const l=e[s].resolveAll;l&&!i.includes(l)&&(t=l(t,n),i.push(l))}return t}const My={name:"attention",resolveAll:RZ,tokenize:jZ};function RZ(e,t){let n=-1,i,s,l,c,u,m,h,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[i][1].end},y={...e[n][1].start};PE(g,-m),PE(y,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},u={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:m>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...u.end}},e[i][1].end={...c.start},e[n][1].start={...u.end},h=[],e[i][1].end.offset-e[i][1].start.offset&&(h=gi(h,[["enter",e[i][1],t],["exit",e[i][1],t]])),h=gi(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",l,t]]),h=gi(h,Cm(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),h=gi(h,[["exit",l,t],["enter",u,t],["exit",u,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,h=gi(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,ni(e,i-1,n-i+3,h),n=i+h.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function jZ(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,s=Pa(i);let l;return c;function c(m){return l=m,e.enter("attentionSequence"),u(m)}function u(m){if(m===l)return e.consume(m),u;const h=e.exit("attentionSequence"),p=Pa(m),g=!p||p===2&&s||n.includes(m),y=!s||s===2&&p||n.includes(i);return h._open=!!(l===42?g:g&&(s||!y)),h._close=!!(l===42?y:y&&(p||!g)),t(m)}}function PE(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const NZ={name:"autolink",tokenize:OZ};function OZ(e,t,n){let i=0;return s;function s(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return Nr(b)?(e.consume(b),c):b===64?n(b):h(b)}function c(b){return b===43||b===45||b===46||Sr(b)?(i=1,u(b)):h(b)}function u(b){return b===58?(e.consume(b),i=0,m):(b===43||b===45||b===46||Sr(b))&&i++<32?(e.consume(b),u):(i=0,h(b))}function m(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||gh(b)?n(b):(e.consume(b),m)}function h(b){return b===64?(e.consume(b),p):bZ(b)?(e.consume(b),h):n(b)}function p(b){return Sr(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),i=0,p):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Sr(b))&&i++<63){const S=b===45?y:g;return e.consume(b),S}return n(b)}}const Wu={partial:!0,tokenize:AZ};function AZ(e,t,n){return i;function i(l){return Mt(l)?Bt(e,s,"linePrefix")(l):s(l)}function s(l){return l===null||lt(l)?t(l):n(l)}}const pN={continuation:{tokenize:zZ},exit:IZ,name:"blockQuote",tokenize:MZ};function MZ(e,t,n){const i=this;return s;function s(c){if(c===62){const u=i.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),l}return n(c)}function l(c){return Mt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function zZ(e,t,n){const i=this;return s;function s(c){return Mt(c)?Bt(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(pN,t,n)(c)}}function IZ(e){e.exit("blockQuote")}const gN={name:"characterEscape",tokenize:DZ};function DZ(e,t,n){return i;function i(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),s}function s(l){return wZ(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const xN={name:"characterReference",tokenize:_Z};function _Z(e,t,n){const i=this;let s=0,l,c;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),l=31,c=Sr,p(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=vZ,p):(e.enter("characterReferenceValue"),l=7,c=Ay,p(g))}function p(g){if(g===59&&s){const y=e.exit("characterReferenceValue");return c===Sr&&!dv(i.sliceSerialize(y))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&s++<l?(e.consume(g),p):n(g)}}const LE={partial:!0,tokenize:LZ},FE={concrete:!0,name:"codeFenced",tokenize:PZ};function PZ(e,t,n){const i=this,s={partial:!0,tokenize:I};let l=0,c=0,u;return m;function m(M){return h(M)}function h(M){const P=i.events[i.events.length-1];return l=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,u=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(M)}function p(M){return M===u?(c++,e.consume(M),p):c<3?n(M):(e.exit("codeFencedFenceSequence"),Mt(M)?Bt(e,g,"whitespace")(M):g(M))}function g(M){return M===null||lt(M)?(e.exit("codeFencedFence"),i.interrupt?t(M):e.check(LE,k,N)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(M))}function y(M){return M===null||lt(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(M)):Mt(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Bt(e,b,"whitespace")(M)):M===96&&M===u?n(M):(e.consume(M),y)}function b(M){return M===null||lt(M)?g(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(M))}function S(M){return M===null||lt(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(M)):M===96&&M===u?n(M):(e.consume(M),S)}function k(M){return e.attempt(s,N,E)(M)}function E(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),C}function C(M){return l>0&&Mt(M)?Bt(e,T,"linePrefix",l+1)(M):T(M)}function T(M){return M===null||lt(M)?e.check(LE,k,N)(M):(e.enter("codeFlowValue"),R(M))}function R(M){return M===null||lt(M)?(e.exit("codeFlowValue"),T(M)):(e.consume(M),R)}function N(M){return e.exit("codeFenced"),t(M)}function I(M,P,A){let L=0;return D;function D(B){return M.enter("lineEnding"),M.consume(B),M.exit("lineEnding"),U}function U(B){return M.enter("codeFencedFence"),Mt(B)?Bt(M,q,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):q(B)}function q(B){return B===u?(M.enter("codeFencedFenceSequence"),K(B)):A(B)}function K(B){return B===u?(L++,M.consume(B),K):L>=c?(M.exit("codeFencedFenceSequence"),Mt(B)?Bt(M,G,"whitespace")(B):G(B)):A(B)}function G(B){return B===null||lt(B)?(M.exit("codeFencedFence"),P(B)):A(B)}}}function LZ(e,t,n){const i=this;return s;function s(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return i.parser.lazy[i.now().line]?n(c):t(c)}}const wx={name:"codeIndented",tokenize:HZ},FZ={partial:!0,tokenize:BZ};function HZ(e,t,n){const i=this;return s;function s(h){return e.enter("codeIndented"),Bt(e,l,"linePrefix",5)(h)}function l(h){const p=i.events[i.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):lt(h)?e.attempt(FZ,c,m)(h):(e.enter("codeFlowValue"),u(h))}function u(h){return h===null||lt(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),u)}function m(h){return e.exit("codeIndented"),t(h)}}function BZ(e,t,n){const i=this;return s;function s(c){return i.parser.lazy[i.now().line]?n(c):lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):Bt(e,l,"linePrefix",5)(c)}function l(c){const u=i.events[i.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):lt(c)?s(c):n(c)}}const VZ={name:"codeText",previous:ZZ,resolve:UZ,tokenize:qZ};function UZ(e){let t=e.length-4,n=3,i,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)s===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(s=i):(i===t||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),t-=i-s-2,i=s+2),s=void 0);return e}function ZZ(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function qZ(e,t,n){let i=0,s,l;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),i++,u):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(l=e.enter("codeTextSequence"),s=0,p(g)):lt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||lt(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function p(g){return g===96?(e.consume(g),s++,p):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(l.type="codeTextData",h(g))}}class GZ{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const s=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&tu(this.left,i),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),tu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),tu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);tu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);tu(this.left,n.reverse())}}}function tu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function yN(e){const t={};let n=-1,i,s,l,c,u,m,h;const p=new GZ(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(i=p.get(n),n&&i[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(m=i[1]._tokenizer.events,l=0,l<m.length&&m[l][1].type==="lineEndingBlank"&&(l+=2),l<m.length&&m[l][1].type==="content"))for(;++l<m.length&&m[l][1].type!=="content";)m[l][1].type==="chunkText"&&(m[l][1]._isInFirstContentOfListItem=!0,l++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,YZ(p,n)),n=t[n],h=!0);else if(i[1]._container){for(l=n,s=void 0;l--;)if(c=p.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=l);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(i[1].end={...p.get(s)[1].start},u=p.slice(s,n),u.unshift(i),p.splice(s,n-s+1,u))}}return ni(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function YZ(e,t){const n=e.get(t)[1],i=e.get(t)[2];let s=t-1;const l=[];let c=n._tokenizer;c||(c=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const u=c.events,m=[],h={};let p,g,y=-1,b=n,S=0,k=0;const E=[k];for(;b;){for(;e.get(++s)[1]!==b;);l.push(s),b._tokenizer||(p=i.sliceStream(b),b.next||p.push(null),g&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(p),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(k=y+1,E.push(k),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):E.pop(),y=E.length;y--;){const C=u.slice(E[y],E[y+1]),T=l.pop();m.push([T,T+C.length-1]),e.splice(T,2,C)}for(m.reverse(),y=-1;++y<m.length;)h[S+m[y][0]]=S+m[y][1],S+=m[y][1]-m[y][0]-1;return h}const KZ={resolve:JZ,tokenize:WZ},XZ={partial:!0,tokenize:$Z};function JZ(e){return yN(e),e}function WZ(e,t){let n;return i;function i(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(u)}function s(u){return u===null?l(u):lt(u)?e.check(XZ,c,l)(u):(e.consume(u),s)}function l(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function c(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function $Z(e,t,n){const i=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Bt(e,l,"linePrefix")}function l(c){if(c===null||lt(c))return n(c);const u=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):e.interrupt(i.parser.constructs.flow,n,t)(c)}}function bN(e,t,n,i,s,l,c,u,m){const h=m||Number.POSITIVE_INFINITY;let p=0;return g;function g(C){return C===60?(e.enter(i),e.enter(s),e.enter(l),e.consume(C),e.exit(l),y):C===null||C===32||C===41||gh(C)?n(C):(e.enter(i),e.enter(c),e.enter(u),e.enter("chunkString",{contentType:"string"}),k(C))}function y(C){return C===62?(e.enter(l),e.consume(C),e.exit(l),e.exit(s),e.exit(i),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(C))}function b(C){return C===62?(e.exit("chunkString"),e.exit(u),y(C)):C===null||C===60||lt(C)?n(C):(e.consume(C),C===92?S:b)}function S(C){return C===60||C===62||C===92?(e.consume(C),b):b(C)}function k(C){return!p&&(C===null||C===41||xn(C))?(e.exit("chunkString"),e.exit(u),e.exit(c),e.exit(i),t(C)):p<h&&C===40?(e.consume(C),p++,k):C===41?(e.consume(C),p--,k):C===null||C===32||C===40||gh(C)?n(C):(e.consume(C),C===92?E:k)}function E(C){return C===40||C===41||C===92?(e.consume(C),k):k(C)}}function vN(e,t,n,i,s,l){const c=this;let u=0,m;return h;function h(b){return e.enter(i),e.enter(s),e.consume(b),e.exit(s),e.enter(l),p}function p(b){return u>999||b===null||b===91||b===93&&!m||b===94&&!u&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(l),e.enter(s),e.consume(b),e.exit(s),e.exit(i),t):lt(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||lt(b)||u++>999?(e.exit("chunkString"),p(b)):(e.consume(b),m||(m=!Mt(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function wN(e,t,n,i,s,l){let c;return u;function u(y){return y===34||y===39||y===40?(e.enter(i),e.enter(s),e.consume(y),e.exit(s),c=y===40?41:y,m):n(y)}function m(y){return y===c?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),t):(e.enter(l),h(y))}function h(y){return y===c?(e.exit(l),m(c)):y===null?n(y):lt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Bt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===c||y===null||lt(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?g:p)}function g(y){return y===c||y===92?(e.consume(y),p):p(y)}}function mu(e,t){let n;return i;function i(s){return lt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,i):Mt(s)?Bt(e,i,n?"linePrefix":"lineSuffix")(s):t(s)}}const QZ={name:"definition",tokenize:tq},eq={partial:!0,tokenize:nq};function tq(e,t,n){const i=this;let s;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return vN.call(i,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return s=Fi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),m):n(b)}function m(b){return xn(b)?mu(e,h)(b):h(b)}function h(b){return bN(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return e.attempt(eq,g,g)(b)}function g(b){return Mt(b)?Bt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||lt(b)?(e.exit("definition"),i.parser.defined.push(s),t(b)):n(b)}}function nq(e,t,n){return i;function i(u){return xn(u)?mu(e,s)(u):n(u)}function s(u){return wN(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Mt(u)?Bt(e,c,"whitespace")(u):c(u)}function c(u){return u===null||lt(u)?t(u):n(u)}}const rq={name:"hardBreakEscape",tokenize:iq};function iq(e,t,n){return i;function i(l){return e.enter("hardBreakEscape"),e.consume(l),s}function s(l){return lt(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const oq={name:"headingAtx",resolve:sq,tokenize:lq};function sq(e,t){let n=e.length-2,i=3,s,l;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},l={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},ni(e,i,n-i+1,[["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t]])),e}function lq(e,t,n){let i=0;return s;function s(p){return e.enter("atxHeading"),l(p)}function l(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&i++<6?(e.consume(p),c):p===null||xn(p)?(e.exit("atxHeadingSequence"),u(p)):n(p)}function u(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||lt(p)?(e.exit("atxHeading"),t(p)):Mt(p)?Bt(e,u,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),u(p))}function h(p){return p===null||p===35||xn(p)?(e.exit("atxHeadingText"),u(p)):(e.consume(p),h)}}const aq=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],HE=["pre","script","style","textarea"],cq={concrete:!0,name:"htmlFlow",resolveTo:dq,tokenize:hq},uq={partial:!0,tokenize:pq},fq={partial:!0,tokenize:mq};function dq(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function hq(e,t,n){const i=this;let s,l,c,u,m;return h;function h(z){return p(z)}function p(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),g}function g(z){return z===33?(e.consume(z),y):z===47?(e.consume(z),l=!0,k):z===63?(e.consume(z),s=3,i.interrupt?t:O):Nr(z)?(e.consume(z),c=String.fromCharCode(z),E):n(z)}function y(z){return z===45?(e.consume(z),s=2,b):z===91?(e.consume(z),s=5,u=0,S):Nr(z)?(e.consume(z),s=4,i.interrupt?t:O):n(z)}function b(z){return z===45?(e.consume(z),i.interrupt?t:O):n(z)}function S(z){const J="CDATA[";return z===J.charCodeAt(u++)?(e.consume(z),u===J.length?i.interrupt?t:q:S):n(z)}function k(z){return Nr(z)?(e.consume(z),c=String.fromCharCode(z),E):n(z)}function E(z){if(z===null||z===47||z===62||xn(z)){const J=z===47,ne=c.toLowerCase();return!J&&!l&&HE.includes(ne)?(s=1,i.interrupt?t(z):q(z)):aq.includes(c.toLowerCase())?(s=6,J?(e.consume(z),C):i.interrupt?t(z):q(z)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(z):l?T(z):R(z))}return z===45||Sr(z)?(e.consume(z),c+=String.fromCharCode(z),E):n(z)}function C(z){return z===62?(e.consume(z),i.interrupt?t:q):n(z)}function T(z){return Mt(z)?(e.consume(z),T):D(z)}function R(z){return z===47?(e.consume(z),D):z===58||z===95||Nr(z)?(e.consume(z),N):Mt(z)?(e.consume(z),R):D(z)}function N(z){return z===45||z===46||z===58||z===95||Sr(z)?(e.consume(z),N):I(z)}function I(z){return z===61?(e.consume(z),M):Mt(z)?(e.consume(z),I):R(z)}function M(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),m=z,P):Mt(z)?(e.consume(z),M):A(z)}function P(z){return z===m?(e.consume(z),m=null,L):z===null||lt(z)?n(z):(e.consume(z),P)}function A(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||xn(z)?I(z):(e.consume(z),A)}function L(z){return z===47||z===62||Mt(z)?R(z):n(z)}function D(z){return z===62?(e.consume(z),U):n(z)}function U(z){return z===null||lt(z)?q(z):Mt(z)?(e.consume(z),U):n(z)}function q(z){return z===45&&s===2?(e.consume(z),F):z===60&&s===1?(e.consume(z),V):z===62&&s===4?(e.consume(z),_):z===63&&s===3?(e.consume(z),O):z===93&&s===5?(e.consume(z),te):lt(z)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(uq,Z,K)(z)):z===null||lt(z)?(e.exit("htmlFlowData"),K(z)):(e.consume(z),q)}function K(z){return e.check(fq,G,Z)(z)}function G(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),B}function B(z){return z===null||lt(z)?K(z):(e.enter("htmlFlowData"),q(z))}function F(z){return z===45?(e.consume(z),O):q(z)}function V(z){return z===47?(e.consume(z),c="",Y):q(z)}function Y(z){if(z===62){const J=c.toLowerCase();return HE.includes(J)?(e.consume(z),_):q(z)}return Nr(z)&&c.length<8?(e.consume(z),c+=String.fromCharCode(z),Y):q(z)}function te(z){return z===93?(e.consume(z),O):q(z)}function O(z){return z===62?(e.consume(z),_):z===45&&s===2?(e.consume(z),O):q(z)}function _(z){return z===null||lt(z)?(e.exit("htmlFlowData"),Z(z)):(e.consume(z),_)}function Z(z){return e.exit("htmlFlow"),t(z)}}function mq(e,t,n){const i=this;return s;function s(c){return lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):n(c)}function l(c){return i.parser.lazy[i.now().line]?n(c):t(c)}}function pq(e,t,n){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Wu,t,n)}}const gq={name:"htmlText",tokenize:xq};function xq(e,t,n){const i=this;let s,l,c;return u;function u(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),m}function m(O){return O===33?(e.consume(O),h):O===47?(e.consume(O),I):O===63?(e.consume(O),R):Nr(O)?(e.consume(O),A):n(O)}function h(O){return O===45?(e.consume(O),p):O===91?(e.consume(O),l=0,S):Nr(O)?(e.consume(O),T):n(O)}function p(O){return O===45?(e.consume(O),b):n(O)}function g(O){return O===null?n(O):O===45?(e.consume(O),y):lt(O)?(c=g,V(O)):(e.consume(O),g)}function y(O){return O===45?(e.consume(O),b):g(O)}function b(O){return O===62?F(O):O===45?y(O):g(O)}function S(O){const _="CDATA[";return O===_.charCodeAt(l++)?(e.consume(O),l===_.length?k:S):n(O)}function k(O){return O===null?n(O):O===93?(e.consume(O),E):lt(O)?(c=k,V(O)):(e.consume(O),k)}function E(O){return O===93?(e.consume(O),C):k(O)}function C(O){return O===62?F(O):O===93?(e.consume(O),C):k(O)}function T(O){return O===null||O===62?F(O):lt(O)?(c=T,V(O)):(e.consume(O),T)}function R(O){return O===null?n(O):O===63?(e.consume(O),N):lt(O)?(c=R,V(O)):(e.consume(O),R)}function N(O){return O===62?F(O):R(O)}function I(O){return Nr(O)?(e.consume(O),M):n(O)}function M(O){return O===45||Sr(O)?(e.consume(O),M):P(O)}function P(O){return lt(O)?(c=P,V(O)):Mt(O)?(e.consume(O),P):F(O)}function A(O){return O===45||Sr(O)?(e.consume(O),A):O===47||O===62||xn(O)?L(O):n(O)}function L(O){return O===47?(e.consume(O),F):O===58||O===95||Nr(O)?(e.consume(O),D):lt(O)?(c=L,V(O)):Mt(O)?(e.consume(O),L):F(O)}function D(O){return O===45||O===46||O===58||O===95||Sr(O)?(e.consume(O),D):U(O)}function U(O){return O===61?(e.consume(O),q):lt(O)?(c=U,V(O)):Mt(O)?(e.consume(O),U):L(O)}function q(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),s=O,K):lt(O)?(c=q,V(O)):Mt(O)?(e.consume(O),q):(e.consume(O),G)}function K(O){return O===s?(e.consume(O),s=void 0,B):O===null?n(O):lt(O)?(c=K,V(O)):(e.consume(O),K)}function G(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||xn(O)?L(O):(e.consume(O),G)}function B(O){return O===47||O===62||xn(O)?L(O):n(O)}function F(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),t):n(O)}function V(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),Y}function Y(O){return Mt(O)?Bt(e,te,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):te(O)}function te(O){return e.enter("htmlTextData"),c(O)}}const hv={name:"labelEnd",resolveAll:wq,resolveTo:Sq,tokenize:kq},yq={tokenize:Eq},bq={tokenize:Cq},vq={tokenize:Tq};function wq(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const s=i.type==="labelImage"?4:2;i.type="data",t+=s}}return e.length!==n.length&&ni(e,0,e.length,n),e}function Sq(e,t){let n=e.length,i=0,s,l,c,u;for(;n--;)if(s=e[n][1],l){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(l=n,s.type!=="labelLink")){i=2;break}}else s.type==="labelEnd"&&(c=n);const m={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[l][1].start},end:{...e[c][1].end}},p={type:"labelText",start:{...e[l+i+2][1].end},end:{...e[c-2][1].start}};return u=[["enter",m,t],["enter",h,t]],u=gi(u,e.slice(l+1,l+i+3)),u=gi(u,[["enter",p,t]]),u=gi(u,Cm(t.parser.constructs.insideSpan.null,e.slice(l+i+4,c-3),t)),u=gi(u,[["exit",p,t],e[c-2],e[c-1],["exit",h,t]]),u=gi(u,e.slice(c+1)),u=gi(u,[["exit",m,t]]),ni(e,l,e.length,u),e}function kq(e,t,n){const i=this;let s=i.events.length,l,c;for(;s--;)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){l=i.events[s][1];break}return u;function u(y){return l?l._inactive?g(y):(c=i.parser.defined.includes(Fi(i.sliceSerialize({start:l.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),m):n(y)}function m(y){return y===40?e.attempt(yq,p,c?p:g)(y):y===91?e.attempt(bq,p,c?h:g)(y):c?p(y):g(y)}function h(y){return e.attempt(vq,p,g)(y)}function p(y){return t(y)}function g(y){return l._balanced=!0,n(y)}}function Eq(e,t,n){return i;function i(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return xn(g)?mu(e,l)(g):l(g)}function l(g){return g===41?p(g):bN(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return xn(g)?mu(e,m)(g):p(g)}function u(g){return n(g)}function m(g){return g===34||g===39||g===40?wN(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function h(g){return xn(g)?mu(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function Cq(e,t,n){const i=this;return s;function s(u){return vN.call(i,e,l,c,"reference","referenceMarker","referenceString")(u)}function l(u){return i.parser.defined.includes(Fi(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function Tq(e,t,n){return i;function i(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),s}function s(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const Rq={name:"labelStartImage",resolveAll:hv.resolveAll,tokenize:jq};function jq(e,t,n){const i=this;return s;function s(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),l}function l(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),c):n(u)}function c(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const Nq={name:"labelStartLink",resolveAll:hv.resolveAll,tokenize:Oq};function Oq(e,t,n){const i=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),l}function l(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(c):t(c)}}const Sx={name:"lineEnding",tokenize:Aq};function Aq(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Bt(e,t,"linePrefix")}}const Zd={name:"thematicBreak",tokenize:Mq};function Mq(e,t,n){let i=0,s;return l;function l(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,u(h)}function u(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):i>=3&&(h===null||lt(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),i++,m):(e.exit("thematicBreakSequence"),Mt(h)?Bt(e,u,"whitespace")(h):u(h))}}const Pr={continuation:{tokenize:_q},exit:Lq,name:"list",tokenize:Dq},zq={partial:!0,tokenize:Fq},Iq={partial:!0,tokenize:Pq};function Dq(e,t,n){const i=this,s=i.events[i.events.length-1];let l=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return u;function u(b){const S=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:Ay(b)){if(i.containerState.type||(i.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Zd,n,h)(b):h(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(b)}return n(b)}function m(b){return Ay(b)&&++c<10?(e.consume(b),m):(!i.interrupt||c<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),h(b)):n(b)}function h(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(Wu,i.interrupt?n:p,e.attempt(zq,y,g))}function p(b){return i.containerState.initialBlankLine=!0,l++,y(b)}function g(b){return Mt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return i.containerState.size=l+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function _q(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Wu,s,l);function s(u){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Bt(e,t,"listItemIndent",i.containerState.size+1)(u)}function l(u){return i.containerState.furtherBlankLines||!Mt(u)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,c(u)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(Iq,t,c)(u))}function c(u){return i.containerState._closeFlow=!0,i.interrupt=void 0,Bt(e,e.attempt(Pr,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function Pq(e,t,n){const i=this;return Bt(e,s,"listItemIndent",i.containerState.size+1);function s(l){const c=i.events[i.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===i.containerState.size?t(l):n(l)}}function Lq(e){e.exit(this.containerState.type)}function Fq(e,t,n){const i=this;return Bt(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(l){const c=i.events[i.events.length-1];return!Mt(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const BE={name:"setextUnderline",resolveTo:Hq,tokenize:Bq};function Hq(e,t){let n=e.length,i,s,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",l?(e.splice(s,0,["enter",c,t]),e.splice(l+1,0,["exit",e[i][1],t]),e[i][1].end={...e[l][1].end}):e[i][1]=c,e.push(["exit",c,t]),e}function Bq(e,t,n){const i=this;let s;return l;function l(h){let p=i.events.length,g;for(;p--;)if(i.events[p][1].type!=="lineEnding"&&i.events[p][1].type!=="linePrefix"&&i.events[p][1].type!=="content"){g=i.events[p][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),u(h)}function u(h){return h===s?(e.consume(h),u):(e.exit("setextHeadingLineSequence"),Mt(h)?Bt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||lt(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const Vq={tokenize:Uq};function Uq(e){const t=this,n=e.attempt(Wu,i,e.attempt(this.parser.constructs.flowInitial,s,Bt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(KZ,s)),"linePrefix")));return n;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Zq={resolveAll:kN()},qq=SN("string"),Gq=SN("text");function SN(e){return{resolveAll:kN(e==="text"?Yq:void 0),tokenize:t};function t(n){const i=this,s=this.parser.constructs[e],l=n.attempt(s,c,u);return c;function c(p){return h(p)?l(p):u(p)}function u(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return h(p)?(n.exit("data"),l(p)):(n.consume(p),m)}function h(p){if(p===null)return!0;const g=s[p];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function kN(e){return t;function t(n,i){let s=-1,l;for(;++s<=n.length;)l===void 0?n[s]&&n[s][1].type==="data"&&(l=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==l+2&&(n[l][1].end=n[s-1][1].end,n.splice(l+2,s-l-2),s=l+2),l=void 0);return e?e(n,i):n}}function Yq(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],s=t.sliceStream(i);let l=s.length,c=-1,u=0,m;for(;l--;){const h=s[l];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)u++,c--;if(c)break;c=-1}else if(h===-2)m=!0,u++;else if(h!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const h={type:n===e.length||m||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:i.start._bufferIndex+c,_index:i.start._index+l,line:i.end.line,column:i.end.column-u,offset:i.end.offset-u},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const Kq={42:Pr,43:Pr,45:Pr,48:Pr,49:Pr,50:Pr,51:Pr,52:Pr,53:Pr,54:Pr,55:Pr,56:Pr,57:Pr,62:pN},Xq={91:QZ},Jq={[-2]:wx,[-1]:wx,32:wx},Wq={35:oq,42:Zd,45:[BE,Zd],60:cq,61:BE,95:Zd,96:FE,126:FE},$q={38:xN,92:gN},Qq={[-5]:Sx,[-4]:Sx,[-3]:Sx,33:Rq,38:xN,42:My,60:[NZ,gq],91:Nq,92:[rq,gN],93:hv,95:My,96:VZ},eG={null:[My,Zq]},tG={null:[42,95]},nG={null:[]},rG=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:tG,contentInitial:Xq,disable:nG,document:Kq,flow:Wq,flowInitial:Jq,insideSpan:eG,string:$q,text:Qq},Symbol.toStringTag,{value:"Module"}));function iG(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},l=[];let c=[],u=[];const m={attempt:P(I),check:P(M),consume:T,enter:R,exit:N,interrupt:P(M,{interrupt:!0})},h={code:null,containerState:{},defineSkip:k,events:[],now:S,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let p=t.tokenize.call(h,m);return t.resolveAll&&l.push(t),h;function g(U){return c=gi(c,U),E(),c[c.length-1]!==null?[]:(A(t,0),h.events=Cm(l,h.events,h),h.events)}function y(U,q){return sG(b(U),q)}function b(U){return oG(c,U)}function S(){const{_bufferIndex:U,_index:q,line:K,column:G,offset:B}=i;return{_bufferIndex:U,_index:q,line:K,column:G,offset:B}}function k(U){s[U.line]=U.column,D()}function E(){let U;for(;i._index<c.length;){const q=c[i._index];if(typeof q=="string")for(U=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===U&&i._bufferIndex<q.length;)C(q.charCodeAt(i._bufferIndex));else C(q)}}function C(U){p=p(U)}function T(U){lt(U)?(i.line++,i.column=1,i.offset+=U===-3?2:1,D()):U!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===c[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=U}function R(U,q){const K=q||{};return K.type=U,K.start=S(),h.events.push(["enter",K,h]),u.push(K),K}function N(U){const q=u.pop();return q.end=S(),h.events.push(["exit",q,h]),q}function I(U,q){A(U,q.from)}function M(U,q){q.restore()}function P(U,q){return K;function K(G,B,F){let V,Y,te,O;return Array.isArray(G)?Z(G):"tokenize"in G?Z([G]):_(G);function _(W){return de;function de(ie){const oe=ie!==null&&W[ie],Se=ie!==null&&W.null,ye=[...Array.isArray(oe)?oe:oe?[oe]:[],...Array.isArray(Se)?Se:Se?[Se]:[]];return Z(ye)(ie)}}function Z(W){return V=W,Y=0,W.length===0?F:z(W[Y])}function z(W){return de;function de(ie){return O=L(),te=W,W.partial||(h.currentConstruct=W),W.name&&h.parser.constructs.disable.null.includes(W.name)?ne():W.tokenize.call(q?Object.assign(Object.create(h),q):h,m,J,ne)(ie)}}function J(W){return U(te,O),B}function ne(W){return O.restore(),++Y<V.length?z(V[Y]):F}}}function A(U,q){U.resolveAll&&!l.includes(U)&&l.push(U),U.resolve&&ni(h.events,q,h.events.length-q,U.resolve(h.events.slice(q),h)),U.resolveTo&&(h.events=U.resolveTo(h.events,h))}function L(){const U=S(),q=h.previous,K=h.currentConstruct,G=h.events.length,B=Array.from(u);return{from:G,restore:F};function F(){i=U,h.previous=q,h.currentConstruct=K,h.events.length=G,u=B,D()}}function D(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function oG(e,t){const n=t.start._index,i=t.start._bufferIndex,s=t.end._index,l=t.end._bufferIndex;let c;if(n===s)c=[e[n].slice(i,l)];else{if(c=e.slice(n,s),i>-1){const u=c[0];typeof u=="string"?c[0]=u.slice(i):c.shift()}l>0&&c.push(e[s].slice(0,l))}return c}function sG(e,t){let n=-1;const i=[];let s;for(;++n<e.length;){const l=e[n];let c;if(typeof l=="string")c=l;else switch(l){case-5:{c="\r";break}case-4:{c=`
|
|
65
65
|
`;break}case-3:{c=`\r
|
|
66
66
|
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&s)continue;c=" ";break}default:c=String.fromCharCode(l)}s=l===-2,i.push(c)}return i.join("")}function lG(e){const i={constructs:hN([rG,...(e||{}).extensions||[]]),content:s(SZ),defined:[],document:s(EZ),flow:s(Vq),lazy:{},string:s(qq),text:s(Gq)};return i;function s(l){return c;function c(u){return iG(i,l,u)}}}function aG(e){for(;!yN(e););return e}const VE=/[\0\t\n\r]/g;function cG(){let e=1,t="",n=!0,i;return s;function s(l,c,u){const m=[];let h,p,g,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),g=0,t="",n&&(l.charCodeAt(0)===65279&&g++,n=void 0);g<l.length;){if(VE.lastIndex=g,h=VE.exec(l),y=h&&h.index!==void 0?h.index:l.length,b=l.charCodeAt(y),!h){t=l.slice(g);break}if(b===10&&g===y&&i)m.push(-3),i=void 0;else switch(i&&(m.push(-5),i=void 0),g<y&&(m.push(l.slice(g,y)),e+=y-g),b){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:i=!0,e=1}g=y+1}return u&&(i&&m.push(-5),t&&m.push(t),m.push(null)),m}}const uG=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function fG(e){return e.replace(uG,dG)}function dG(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),l=s===120||s===88;return mN(n.slice(l?2:1),l?16:10)}return dv(n)||e}const EN={}.hasOwnProperty;function hG(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),mG(n)(aG(lG(n).document().write(cG()(e,t,!0))))}function mG(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(je),autolinkProtocol:L,autolinkEmail:L,atxHeading:l(Ie),blockQuote:l(Se),characterEscape:L,characterReference:L,codeFenced:l(ye),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(ye,c),codeText:l(xe,c),codeTextData:L,data:L,codeFlowValue:L,definition:l(we),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(Re),hardBreakEscape:l(fe),hardBreakTrailing:l(fe),htmlFlow:l(be,c),htmlFlowData:L,htmlText:l(be,c),htmlTextData:L,image:l(Oe),label:c,link:l(je),listItem:l(Ze),listItemValue:y,listOrdered:l(De,g),listUnordered:l(De),paragraph:l(qe),reference:z,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(Ie),strong:l(ge),thematicBreak:l(le)},exit:{atxHeading:m(),atxHeadingSequence:I,autolink:m(),autolinkEmail:oe,autolinkProtocol:ie,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:W,characterReference:de,codeFenced:m(E),codeFencedFence:k,codeFencedFenceInfo:b,codeFencedFenceMeta:S,codeFlowValue:D,codeIndented:m(C),codeText:m(B),codeTextData:D,data:D,definition:m(),definitionDestinationString:N,definitionLabelString:T,definitionTitleString:R,emphasis:m(),hardBreakEscape:m(q),hardBreakTrailing:m(q),htmlFlow:m(K),htmlFlowData:D,htmlText:m(G),htmlTextData:D,image:m(V),label:te,labelText:Y,lineEnding:U,link:m(F),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:J,resourceDestinationString:O,resourceTitleString:_,resource:Z,setextHeading:m(A),setextHeadingLineSequence:P,setextHeadingText:M,strong:m(),thematicBreak:m()}};CN(t,(e||{}).mdastExtensions||[]);const n={};return i;function i($){let Q={type:"root",children:[]};const he={stack:[Q],tokenStack:[],config:t,enter:u,exit:h,buffer:c,resume:p,data:n},Ne=[];let _e=-1;for(;++_e<$.length;)if($[_e][1].type==="listOrdered"||$[_e][1].type==="listUnordered")if($[_e][0]==="enter")Ne.push(_e);else{const Ge=Ne.pop();_e=s($,Ge,_e)}for(_e=-1;++_e<$.length;){const Ge=t[$[_e][0]];EN.call(Ge,$[_e][1].type)&&Ge[$[_e][1].type].call(Object.assign({sliceSerialize:$[_e][2].sliceSerialize},he),$[_e][1])}if(he.tokenStack.length>0){const Ge=he.tokenStack[he.tokenStack.length-1];(Ge[1]||UE).call(he,void 0,Ge[0])}for(Q.position={start:bs($.length>0?$[0][1].start:{line:1,column:1,offset:0}),end:bs($.length>0?$[$.length-2][1].end:{line:1,column:1,offset:0})},_e=-1;++_e<t.transforms.length;)Q=t.transforms[_e](Q)||Q;return Q}function s($,Q,he){let Ne=Q-1,_e=-1,Ge=!1,dt,rt,at,Nt;for(;++Ne<=he;){const Je=$[Ne];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?_e++:_e--,Nt=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(dt&&!Nt&&!_e&&!at&&(at=Ne),Nt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Nt=void 0}if(!_e&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||_e===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(dt){let _t=Ne;for(rt=void 0;_t--;){const Fe=$[_t];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;rt&&($[rt][1].type="lineEndingBlank",Ge=!0),Fe[1].type="lineEnding",rt=_t}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}at&&(!rt||at<rt)&&(dt._spread=!0),dt.end=Object.assign({},rt?$[rt][1].start:Je[1].end),$.splice(rt||Ne,0,["exit",dt,Je[2]]),Ne++,he++}if(Je[1].type==="listItemPrefix"){const _t={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};dt=_t,$.splice(Ne,0,["enter",_t,Je[2]]),Ne++,he++,at=void 0,Nt=!0}}}return $[Q][1]._spread=Ge,he}function l($,Q){return he;function he(Ne){u.call(this,$(Ne),Ne),Q&&Q.call(this,Ne)}}function c(){this.stack.push({type:"fragment",children:[]})}function u($,Q,he){this.stack[this.stack.length-1].children.push($),this.stack.push($),this.tokenStack.push([Q,he||void 0]),$.position={start:bs(Q.start),end:void 0}}function m($){return Q;function Q(he){$&&$.call(this,he),h.call(this,he)}}function h($,Q){const he=this.stack.pop(),Ne=this.tokenStack.pop();if(Ne)Ne[0].type!==$.type&&(Q?Q.call(this,$,Ne[0]):(Ne[1]||UE).call(this,$,Ne[0]));else throw new Error("Cannot close `"+$.type+"` ("+hu({start:$.start,end:$.end})+"): it’s not open");he.position.end=bs($.end)}function p(){return fv(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y($){if(this.data.expectingFirstListItemValue){const Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize($),10),this.data.expectingFirstListItemValue=void 0}}function b(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=$}function S(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=$}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.value=$.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.value=$.replace(/(\r?\n|\r)$/g,"")}function T($){const Q=this.resume(),he=this.stack[this.stack.length-1];he.label=Q,he.identifier=Fi(this.sliceSerialize($)).toLowerCase()}function R(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.title=$}function N(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.url=$}function I($){const Q=this.stack[this.stack.length-1];if(!Q.depth){const he=this.sliceSerialize($).length;Q.depth=he}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function P($){const Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize($).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function L($){const he=this.stack[this.stack.length-1].children;let Ne=he[he.length-1];(!Ne||Ne.type!=="text")&&(Ne=re(),Ne.position={start:bs($.start),end:void 0},he.push(Ne)),this.stack.push(Ne)}function D($){const Q=this.stack.pop();Q.value+=this.sliceSerialize($),Q.position.end=bs($.end)}function U($){const Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=Q.children[Q.children.length-1];he.position.end=bs($.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Q.type)&&(L.call(this,$),D.call(this,$))}function q(){this.data.atHardBreak=!0}function K(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.value=$}function G(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.value=$}function B(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.value=$}function F(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=Q,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function V(){const $=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";$.type+="Reference",$.referenceType=Q,delete $.url,delete $.title}else delete $.identifier,delete $.label;this.data.referenceType=void 0}function Y($){const Q=this.sliceSerialize($),he=this.stack[this.stack.length-2];he.label=fG(Q),he.identifier=Fi(Q).toLowerCase()}function te(){const $=this.stack[this.stack.length-1],Q=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const Ne=$.children;he.children=Ne}else he.alt=Q}function O(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.url=$}function _(){const $=this.resume(),Q=this.stack[this.stack.length-1];Q.title=$}function Z(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function J($){const Q=this.resume(),he=this.stack[this.stack.length-1];he.label=Q,he.identifier=Fi(this.sliceSerialize($)).toLowerCase(),this.data.referenceType="full"}function ne($){this.data.characterReferenceType=$.type}function W($){const Q=this.sliceSerialize($),he=this.data.characterReferenceType;let Ne;he?(Ne=mN(Q,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ne=dv(Q);const _e=this.stack[this.stack.length-1];_e.value+=Ne}function de($){const Q=this.stack.pop();Q.position.end=bs($.end)}function ie($){D.call(this,$);const Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize($)}function oe($){D.call(this,$);const Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize($)}function Se(){return{type:"blockquote",children:[]}}function ye(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function we(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Re(){return{type:"emphasis",children:[]}}function Ie(){return{type:"heading",depth:0,children:[]}}function fe(){return{type:"break"}}function be(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function De($){return{type:"list",ordered:$.type==="listOrdered",start:null,spread:$._spread,children:[]}}function Ze($){return{type:"listItem",spread:$._spread,checked:null,children:[]}}function qe(){return{type:"paragraph",children:[]}}function ge(){return{type:"strong",children:[]}}function re(){return{type:"text",value:""}}function le(){return{type:"thematicBreak"}}}function bs(e){return{line:e.line,column:e.column,offset:e.offset}}function CN(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?CN(e,i):pG(e,i)}}function pG(e,t){let n;for(n in t)if(EN.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function UE(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+hu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+hu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+hu({start:t.start,end:t.end})+") is still open")}function gG(e){const t=this;t.parser=n;function n(i){return hG(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function xG(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function yG(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|