@director.run/cli 1.0.0 → 1.0.2
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.
|
@@ -145,5 +145,5 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
145
145
|
`,...l.current()});return/^[\t ]/.test(p)&&(p=Lc(p.charCodeAt(0))+p.slice(1)),p=p?o+" "+p:o,n.options.closeAtx&&(p+=" "+o),f(),c(),p}B9.peek=xG;function B9(e){return e.value||""}function xG(){return"<"}U9.peek=AG;function U9(e,t,n,r){const i=i6(n),l=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let c=n.enter("label");const f=n.createTracker(r);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(c=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),c(),e.title&&(c=n.enter(`title${l}`),p+=f.move(" "+i),p+=f.move(n.safe(e.title,{before:p,after:i,...f.current()})),p+=f.move(i),c()),p+=f.move(")"),o(),p}function AG(){return"!"}V9.peek=TG;function V9(e,t,n,r){const i=e.referenceType,l=n.enter("imageReference");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("![");const p=n.safe(e.alt,{before:f,after:"]",...c.current()});f+=c.move(p+"]["),o();const y=n.stack;n.stack=[],o=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...c.current()});return o(),n.stack=y,l(),i==="full"||!p||p!==g?f+=c.move(g+"]"):i==="shortcut"?f=f.slice(0,-1):f+=c.move("]"),f}function TG(){return"!"}z9.peek=_G;function z9(e,t,n){let r=e.value||"",i="`",l=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++l<n.unsafe.length;){const o=n.unsafe[l],c=n.compilePattern(o);let f;if(o.atBreak)for(;f=c.exec(r);){let p=f.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(f.index+1)}}return i+r+i}function _G(){return"`"}function Z9(e,t){const n=Z8(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}q9.peek=SG;function q9(e,t,n,r){const i=i6(n),l=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let c,f;if(Z9(e,n)){const y=n.stack;n.stack=[],c=n.enter("autolink");let g=o.move("<");return g+=o.move(n.containerPhrasing(e,{before:g,after:">",...o.current()})),g+=o.move(">"),c(),n.stack=y,g}c=n.enter("link"),f=n.enter("label");let p=o.move("[");return p+=o.move(n.containerPhrasing(e,{before:p,after:"](",...o.current()})),p+=o.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=o.move("<"),p+=o.move(n.safe(e.url,{before:p,after:">",...o.current()})),p+=o.move(">")):(f=n.enter("destinationRaw"),p+=o.move(n.safe(e.url,{before:p,after:e.title?" ":")",...o.current()}))),f(),e.title&&(f=n.enter(`title${l}`),p+=o.move(" "+i),p+=o.move(n.safe(e.title,{before:p,after:i,...o.current()})),p+=o.move(i),f()),p+=o.move(")"),c(),p}function SG(e,t,n){return Z9(e,n)?"<":"["}Y9.peek=CG;function Y9(e,t,n,r){const i=e.referenceType,l=n.enter("linkReference");let o=n.enter("label");const c=n.createTracker(r);let f=c.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...c.current()});f+=c.move(p+"]["),o();const y=n.stack;n.stack=[],o=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...c.current()});return o(),n.stack=y,l(),i==="full"||!p||p!==g?f+=c.move(g+"]"):i==="shortcut"?f=f.slice(0,-1):f+=c.move("]"),f}function CG(){return"["}function s6(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function wG(e){const t=s6(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function NG(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function $9(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function OG(e,t,n,r){const i=n.enter("list"),l=n.bulletCurrent;let o=e.ordered?NG(n):s6(n);const c=e.ordered?o==="."?")":".":wG(n);let f=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&y&&(!y.children||!y.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),$9(n)===o&&y){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(o=c),n.bulletCurrent=o;const p=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=l,i(),p}function RG(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function kG(e,t,n,r){const i=RG(n);let l=n.bulletCurrent||s6(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let o=l.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const c=n.createTracker(r);c.move(l+" ".repeat(o-l.length)),c.shift(o);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,c.current()),y);return f(),p;function y(g,x,A){return x?(A?"":" ".repeat(o))+g:(A?l:l+" ".repeat(o-l.length))+g}}function MG(e,t,n,r){const i=n.enter("paragraph"),l=n.enter("phrasing"),o=n.containerPhrasing(e,r);return l(),i(),o}const LG=kf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function DG(e,t,n,r){return(e.children.some(function(o){return LG(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function IG(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Q9.peek=PG;function Q9(e,t,n,r){const i=IG(n),l=n.enter("strong"),o=n.createTracker(r),c=o.move(i+i);let f=o.move(n.containerPhrasing(e,{after:i,before:c,...o.current()}));const p=f.charCodeAt(0),y=S1(r.before.charCodeAt(r.before.length-1),p,i);y.inside&&(f=Lc(p)+f.slice(1));const g=f.charCodeAt(f.length-1),x=S1(r.after.charCodeAt(0),g,i);x.inside&&(f=f.slice(0,-1)+Lc(g));const A=o.move(i+i);return l(),n.attentionEncodeSurroundingInfo={after:x.outside,before:y.outside},c+f+A}function PG(e,t,n){return n.options.strong||"*"}function jG(e,t,n,r){return n.safe(e.value,r)}function HG(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function FG(e,t,n){const r=($9(n)+(n.options.ruleSpaces?" ":"")).repeat(HG(n));return n.options.ruleSpaces?r.slice(0,-1):r}const G9={blockquote:oG,break:dx,code:mG,definition:gG,emphasis:F9,hardBreak:dx,heading:EG,html:B9,image:U9,imageReference:V9,inlineCode:z9,link:q9,linkReference:Y9,list:OG,listItem:kG,paragraph:MG,root:DG,strong:Q9,text:jG,thematicBreak:FG};function BG(){return{enter:{table:UG,tableData:fx,tableHeader:fx,tableRow:zG},exit:{codeText:ZG,table:VG,tableData:ap,tableHeader:ap,tableRow:ap}}}function UG(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function VG(e){this.exit(e),this.data.inTable=void 0}function zG(e){this.enter({type:"tableRow",children:[]},e)}function ap(e){this.exit(e)}function fx(e){this.enter({type:"tableCell",children:[]},e)}function ZG(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,qG));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function qG(e,t){return t==="|"?t:e}function YG(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
146
146
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:o,tableCell:f,tableRow:c}};function o(A,S,_,w){return p(y(A,_,w),A.align)}function c(A,S,_,w){const C=g(A,_,w),R=p([C]);return R.slice(0,R.indexOf(`
|
|
147
147
|
`))}function f(A,S,_,w){const C=_.enter("tableCell"),R=_.enter("phrasing"),D=_.containerPhrasing(A,{...w,before:l,after:l});return R(),C(),D}function p(A,S){return sG(A,{align:S,alignDelimiters:r,padding:n,stringLength:i})}function y(A,S,_){const w=A.children;let C=-1;const R=[],D=S.enter("table");for(;++C<w.length;)R[C]=g(w[C],S,_);return D(),R}function g(A,S,_){const w=A.children;let C=-1;const R=[],D=S.enter("tableRow");for(;++C<w.length;)R[C]=f(w[C],A,S,_);return D(),R}function x(A,S,_){let w=G9.inlineCode(A,S,_);return _.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function $G(){return{exit:{taskListCheckValueChecked:hx,taskListCheckValueUnchecked:hx,paragraph:GG}}}function QG(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:KG}}}function hx(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function GG(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let l=-1,o;for(;++l<i.length;){const c=i[l];if(c.type==="paragraph"){o=c;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function KG(e,t,n,r){const i=e.children[0],l=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",c=n.createTracker(r);l&&c.move(o);let f=G9.listItem(e,t,n,{...r,...c.current()});return l&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(y){return y+o}}function XG(){return[OQ(),KQ(),eG(),BG(),$G()]}function WG(e){return{extensions:[RQ(),XQ(e),tG(),YG(e),QG()]}}const JG={tokenize:iK,partial:!0},K9={tokenize:sK,partial:!0},X9={tokenize:lK,partial:!0},W9={tokenize:oK,partial:!0},eK={tokenize:uK,partial:!0},J9={name:"wwwAutolink",tokenize:rK,previous:tS},eS={name:"protocolAutolink",tokenize:aK,previous:nS},Fi={name:"emailAutolink",tokenize:nK,previous:rS},ai={};function tK(){return{text:ai}}let Js=48;for(;Js<123;)ai[Js]=Fi,Js++,Js===58?Js=65:Js===91&&(Js=97);ai[43]=Fi;ai[45]=Fi;ai[46]=Fi;ai[95]=Fi;ai[72]=[Fi,eS];ai[104]=[Fi,eS];ai[87]=[Fi,J9];ai[119]=[Fi,J9];function nK(e,t,n){const r=this;let i,l;return o;function o(g){return!sg(g)||!rS.call(r,r.previous)||l6(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(g))}function c(g){return sg(g)?(e.consume(g),c):g===64?(e.consume(g),f):n(g)}function f(g){return g===46?e.check(eK,y,p)(g):g===45||g===95||qn(g)?(l=!0,e.consume(g),f):y(g)}function p(g){return e.consume(g),i=!0,f}function y(g){return l&&i&&Xn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function rK(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!tS.call(r,r.previous)||l6(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(JG,e.attempt(K9,e.attempt(X9,l),n),n)(o))}function l(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function aK(e,t,n){const r=this;let i="",l=!1;return o;function o(g){return(g===72||g===104)&&nS.call(r,r.previous)&&!l6(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(g),e.consume(g),c):n(g)}function c(g){if(Xn(g)&&i.length<5)return i+=String.fromCodePoint(g),e.consume(g),c;if(g===58){const x=i.toLowerCase();if(x==="http"||x==="https")return e.consume(g),f}return n(g)}function f(g){return g===47?(e.consume(g),l?p:(l=!0,f)):n(g)}function p(g){return g===null||E1(g)||jt(g)||fl(g)||Nf(g)?n(g):e.attempt(K9,e.attempt(X9,y),n)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function iK(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),l):n(o)}function l(o){return o===null?n(o):t(o)}}function sK(e,t,n){let r,i,l;return o;function o(p){return p===46||p===95?e.check(W9,f,c)(p):p===null||jt(p)||fl(p)||p!==45&&Nf(p)?f(p):(l=!0,e.consume(p),o)}function c(p){return p===95?r=!0:(i=r,r=void 0),e.consume(p),o}function f(p){return i||r||!l?n(p):t(p)}}function lK(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?l(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(W9,t,l)(o):o===null||jt(o)||fl(o)?t(o):(e.consume(o),i)}function l(o){return o===41&&r++,e.consume(o),i}}function oK(e,t,n){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),l):c===93?(e.consume(c),i):c===60||c===null||jt(c)||fl(c)?t(c):n(c)}function i(c){return c===null||c===40||c===91||jt(c)||fl(c)?t(c):r(c)}function l(c){return Xn(c)?o(c):n(c)}function o(c){return c===59?(e.consume(c),r):Xn(c)?(e.consume(c),o):n(c)}}function uK(e,t,n){return r;function r(l){return e.consume(l),i}function i(l){return qn(l)?n(l):t(l)}}function tS(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||jt(e)}function nS(e){return!Xn(e)}function rS(e){return!(e===47||sg(e))}function sg(e){return e===43||e===45||e===46||e===95||qn(e)}function l6(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const cK={tokenize:bK,partial:!0};function dK(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:pK,continuation:{tokenize:gK},exit:yK}},text:{91:{name:"gfmFootnoteCall",tokenize:mK},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:fK,resolveTo:hK}}}}function fK(e,t,n){const r=this;let i=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const f=r.events[i][1];if(f.type==="labelImage"){o=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return c;function c(f){if(!o||!o._balanced)return n(f);const p=pa(r.sliceSerialize({start:o.end,end:r.now()}));return p.codePointAt(0)!==94||!l.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function hK(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",l,t],["enter",o,t],["exit",o,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function mK(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,o;return c;function c(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(g){if(l>999||g===93&&!o||g===null||g===91||jt(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return i.includes(pa(r.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return jt(g)||(o=!0),l++,e.consume(g),g===92?y:p}function y(g){return g===91||g===92||g===93?(e.consume(g),l++,p):p(g)}}function pK(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,o=0,c;return f;function f(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):n(S)}function y(S){if(o>999||S===93&&!c||S===null||S===91||jt(S))return n(S);if(S===93){e.exit("chunkString");const _=e.exit("gfmFootnoteDefinitionLabelString");return l=pa(r.sliceSerialize(_)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return jt(S)||(c=!0),o++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),o++,y):y(S)}function x(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),i.includes(l)||i.push(l),yt(e,A,"gfmFootnoteDefinitionWhitespace")):n(S)}function A(S){return t(S)}}function gK(e,t,n){return e.check(a0,t,e.attempt(cK,t,n))}function yK(e){e.exit("gfmFootnoteDefinition")}function bK(e,t,n){const r=this;return yt(e,i,"gfmFootnoteDefinitionIndent",5);function i(l){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(l):n(l)}}function vK(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,c){let f=-1;for(;++f<o.length;)if(o[f][0]==="enter"&&o[f][1].type==="strikethroughSequenceTemporary"&&o[f][1]._close){let p=f;for(;p--;)if(o[p][0]==="exit"&&o[p][1].type==="strikethroughSequenceTemporary"&&o[p][1]._open&&o[f][1].end.offset-o[f][1].start.offset===o[p][1].end.offset-o[p][1].start.offset){o[f][1].type="strikethroughSequence",o[p][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},o[p][1].start),end:Object.assign({},o[f][1].end)},g={type:"strikethroughText",start:Object.assign({},o[p][1].end),end:Object.assign({},o[f][1].start)},x=[["enter",y,c],["enter",o[p][1],c],["exit",o[p][1],c],["enter",g,c]],A=c.parser.constructs.insideSpan.null;A&&Dr(x,x.length,0,Of(A,o.slice(p+1,f),c)),Dr(x,x.length,0,[["exit",g,c],["enter",o[f][1],c],["exit",o[f][1],c],["exit",y,c]]),Dr(o,p-1,f-p+3,x),f=p+x.length-2;break}}for(f=-1;++f<o.length;)o[f][1].type==="strikethroughSequenceTemporary"&&(o[f][1].type="data");return o}function l(o,c,f){const p=this.previous,y=this.events;let g=0;return x;function x(S){return p===126&&y[y.length-1][1].type!=="characterEscape"?f(S):(o.enter("strikethroughSequenceTemporary"),A(S))}function A(S){const _=Fo(p);if(S===126)return g>1?f(S):(o.consume(S),g++,A);if(g<2&&!n)return f(S);const w=o.exit("strikethroughSequenceTemporary"),C=Fo(S);return w._open=!C||C===2&&!!_,w._close=!_||_===2&&!!C,c(S)}}}class EK{constructor(){this.map=[]}add(t,n,r){xK(this,t,n,r)}consume(t){if(this.map.sort(function(l,o){return l[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const l of i)t.push(l);i=r.pop()}this.map.length=0}}function xK(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function AK(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function TK(){return{flow:{null:{name:"table",tokenize:_K,resolveAll:SK}}}}function _K(e,t,n){const r=this;let i=0,l=0,o;return c;function c(B){let ne=r.events.length-1;for(;ne>-1;){const ie=r.events[ne][1].type;if(ie==="lineEnding"||ie==="linePrefix")ne--;else break}const K=ne>-1?r.events[ne][1].type:null,W=K==="tableHead"||K==="tableRow"?k:f;return W===k&&r.parser.lazy[r.now().line]?n(B):W(B)}function f(B){return e.enter("tableHead"),e.enter("tableRow"),p(B)}function p(B){return B===124||(o=!0,l+=1),y(B)}function y(B){return B===null?n(B):Ze(B)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),A):n(B):ct(B)?yt(e,y,"whitespace")(B):(l+=1,o&&(o=!1,i+=1),B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),o=!0,y):(e.enter("data"),g(B)))}function g(B){return B===null||B===124||jt(B)?(e.exit("data"),y(B)):(e.consume(B),B===92?x:g)}function x(B){return B===92||B===124?(e.consume(B),g):g(B)}function A(B){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(B):(e.enter("tableDelimiterRow"),o=!1,ct(B)?yt(e,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):S(B))}function S(B){return B===45||B===58?w(B):B===124?(o=!0,e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),_):U(B)}function _(B){return ct(B)?yt(e,w,"whitespace")(B):w(B)}function w(B){return B===58?(l+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),C):B===45?(l+=1,C(B)):B===null||Ze(B)?P(B):U(B)}function C(B){return B===45?(e.enter("tableDelimiterFiller"),R(B)):U(B)}function R(B){return B===45?(e.consume(B),R):B===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(B),e.exit("tableDelimiterMarker"),D):(e.exit("tableDelimiterFiller"),D(B))}function D(B){return ct(B)?yt(e,P,"whitespace")(B):P(B)}function P(B){return B===124?S(B):B===null||Ze(B)?!o||i!==l?U(B):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(B)):U(B)}function U(B){return n(B)}function k(B){return e.enter("tableRow"),H(B)}function H(B){return B===124?(e.enter("tableCellDivider"),e.consume(B),e.exit("tableCellDivider"),H):B===null||Ze(B)?(e.exit("tableRow"),t(B)):ct(B)?yt(e,H,"whitespace")(B):(e.enter("data"),j(B))}function j(B){return B===null||B===124||jt(B)?(e.exit("data"),H(B)):(e.consume(B),B===92?ee:j)}function ee(B){return B===92||B===124?(e.consume(B),j):j(B)}}function SK(e,t){let n=-1,r=!0,i=0,l=[0,0,0,0],o=[0,0,0,0],c=!1,f=0,p,y,g;const x=new EK;for(;++n<e.length;){const A=e[n],S=A[1];A[0]==="enter"?S.type==="tableHead"?(c=!1,f!==0&&(mx(x,t,f,p,y),y=void 0,f=0),p={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(n,0,[["enter",p,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(r=!0,g=void 0,l=[0,0,0,0],o=[0,n+1,0,0],c&&(c=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},x.add(n,0,[["enter",y,t]])),i=S.type==="tableDelimiterRow"?2:y?3:1):i&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(l[1]!==0&&(o[0]=o[1],g=Yd(x,t,l,i,void 0,g),l=[0,0,0,0]),o[2]=n)):S.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(o[0]=o[1],g=Yd(x,t,l,i,void 0,g)),l=o,o=[l[1],n,0,0])):S.type==="tableHead"?(c=!0,f=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(f=n,l[1]!==0?(o[0]=o[1],g=Yd(x,t,l,i,n,g)):o[1]!==0&&(g=Yd(x,t,o,i,n,g)),i=0):i&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(o[3]=n)}for(f!==0&&mx(x,t,f,p,y),x.consume(t.events),n=-1;++n<t.events.length;){const A=t.events[n];A[0]==="enter"&&A[1].type==="table"&&(A[1]._align=AK(t.events,n))}return e}function Yd(e,t,n,r,i,l){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(l.end=Object.assign({},_o(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const f=_o(t.events,n[1]);if(l={type:o,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const p=_o(t.events,n[2]),y=_o(t.events,n[3]),g={type:c,start:Object.assign({},p),end:Object.assign({},y)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const x=t.events[n[2]],A=t.events[n[3]];if(x[1].end=Object.assign({},A[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,_=n[3]-n[2]-1;e.add(S,_,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return i!==void 0&&(l.end=Object.assign({},_o(t.events,i)),e.add(i,0,[["exit",l,t]]),l=void 0),l}function mx(e,t,n,r,i){const l=[],o=_o(t.events,n);i&&(i.end=Object.assign({},o),l.push(["exit",i,t])),r.end=Object.assign({},o),l.push(["exit",r,t]),e.add(n+1,0,l)}function _o(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const CK={name:"tasklistCheck",tokenize:NK};function wK(){return{text:{91:CK}}}function NK(e,t,n){const r=this;return i;function i(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),l)}function l(f){return jt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),o):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),o):n(f)}function o(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(f)}function c(f){return Ze(f)?t(f):ct(f)?e.check({tokenize:OK},t,n)(f):n(f)}}function OK(e,t,n){return yt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function RK(e){return x7([tK(),dK(),vK(e),TK(),wK()])}const kK={};function aS(e){const t=this,n=e||kK,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(RK(n)),l.push(XG()),o.push(WG(n))}function MK({children:e}){return m.jsx(V7,{remarkPlugins:[aS],rehypePlugins:[D9],allowElement:t=>!!["a","p","strong","i","u","s","code"].includes(t.tagName),components:{p:({children:t})=>m.jsx(m.Fragment,{children:t}),a:({children:t,href:n})=>m.jsx("a",{className:"text-fg underline",href:n,target:"_blank",rel:"noopener noreferrer",children:t}),strong:({children:t})=>m.jsx("strong",{className:"font-[450]",children:t}),i:({children:t})=>m.jsx("i",{className:"text-fg",children:t}),u:({children:t})=>m.jsx("u",{className:"underline",children:t}),s:({children:t})=>m.jsx("s",{className:"line-through",children:t}),code:({children:t})=>m.jsx("code",{className:"rounded-md bg-accent px-1 font-mono",children:t})},children:e.replaceAll(`
|
|
148
|
-
`," ")})}function Vo({children:e,className:t}){return m.jsx("div",{className:Ae("prose",t),children:m.jsx(V7,{remarkPlugins:[aS],rehypePlugins:[D9],components:{table:({children:n})=>m.jsx("div",{className:"max-w-full overflow-x-auto overflow-y-auto",children:m.jsx("table",{children:n})})},children:e})})}function iS({readme:e}){return e?m.jsx(Vo,{className:"!max-w-none",children:e}):m.jsx(Ta,{children:m.jsx(ni,{children:"No readme found"})})}function LK({parameters:e,...t}){return e.length===0?m.jsxs(Ta,{children:[m.jsx(ni,{children:"No parameters"}),m.jsx(Ns,{children:"This MCP server does not have any parameters."})]}):m.jsx(Ka,{...t,children:e.filter((n,r,i)=>i.findIndex(l=>l.name===n.name)===r).map(n=>m.jsxs(wn,{children:[m.jsxs(dn,{children:[m.jsx(an,{className:"font-mono",children:n.name}),n.description&&m.jsx(qa,{children:n.description})]}),m.jsxs(Wn,{children:[n.required&&m.jsxs(Ut,{variant:"destructive",children:[m.jsx(na,{children:m.jsx(qx,{weight:"bold"})}),m.jsx($t,{uppercase:!0,children:"Required"})]}),n.type==="string"&&m.jsxs(Ut,{children:[m.jsx(na,{children:m.jsx(c5,{})}),m.jsx($t,{uppercase:!0,children:"String"})]})]})]},n.name))})}const px="░▒▓█",gx=e=>e.split("").map(()=>px[Math.floor(Math.random()*px.length)]).join(""),Jr=({text:e,scrambleSpeed:t=250,className:n,...r})=>{const[i,l]=h.useState(gx(e));return h.useEffect(()=>{let o;return o=setInterval(()=>{l(gx(e))},t),()=>{o&&clearInterval(o)}},[e,t]),m.jsxs("span",{className:Ae("inline-block whitespace-pre-wrap",n),...r,children:[m.jsx("span",{className:"sr-only",children:e}),m.jsx("span",{"aria-hidden":"true",suppressHydrationWarning:!0,children:i})]})};function sl(){return m.jsx("div",{className:"flex flex-col border-accent border-y-[0.5px] opacity-50",children:new Array(3).fill(0).map((e,t)=>m.jsx(DK,{},`loading-${t}`))})}function DK(){return m.jsxs(wn,{children:[m.jsxs(dn,{children:[m.jsx(an,{children:m.jsx(Jr,{text:"Loading title"})}),m.jsx(qa,{children:m.jsx(Jr,{text:"Loading subtitle"})})]}),m.jsx(Wn,{children:m.jsx(Ut,{children:m.jsx($t,{children:m.jsx(Jr,{text:"Loading badge"})})})})]})}function IK(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Hf="Switch",[PK]=gr(Hf),[jK,HK]=PK(Hf),sS=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:l,required:o,disabled:c,value:f="on",onCheckedChange:p,form:y,...g}=e,[x,A]=h.useState(null),S=Qt(t,D=>A(D)),_=h.useRef(!1),w=x?y||!!x.closest("form"):!0,[C,R]=ra({prop:i,defaultProp:l??!1,onChange:p,caller:Hf});return m.jsxs(jK,{scope:n,checked:C,disabled:c,children:[m.jsx(tt.button,{type:"button",role:"switch","aria-checked":C,"aria-required":o,"data-state":cS(C),"data-disabled":c?"":void 0,disabled:c,value:f,...g,ref:S,onClick:qe(e.onClick,D=>{R(P=>!P),w&&(_.current=D.isPropagationStopped(),_.current||D.stopPropagation())})}),w&&m.jsx(uS,{control:x,bubbles:!_.current,name:r,value:f,checked:C,required:o,disabled:c,form:y,style:{transform:"translateX(-100%)"}})]})});sS.displayName=Hf;var lS="SwitchThumb",oS=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=HK(lS,n);return m.jsx(tt.span,{"data-state":cS(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});oS.displayName=lS;var FK="SwitchBubbleInput",uS=h.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},l)=>{const o=h.useRef(null),c=Qt(o,l),f=IK(n),p=q5(t);return h.useEffect(()=>{const y=o.current;if(!y)return;const g=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(g,"checked").set;if(f!==n&&A){const S=new Event("click",{bubbles:r});A.call(y,n),y.dispatchEvent(S)}},[f,n,r]),m.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:c,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});uS.displayName=FK;function cS(e){return e?"checked":"unchecked"}var BK=sS,UK=oS;function o6({className:e,...t}){return m.jsx(BK,{"data-slot":"switch",className:Ae("peer inline-flex w-9 shrink-0 items-center rounded-full border border-fg/10 p-0.5 outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-success data-[state=unchecked]:bg-fg/20","cursor-pointer",e),...t,children:m.jsx(UK,{"data-slot":"switch-thumb",className:Ae("pointer-events-none block size-4 rounded-full bg-success-fg ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0","radix-state-[unchecked]:bg-fg/80")})})}const u0=h.forwardRef(({...e},t)=>m.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));u0.displayName="Breadcrumb";const c0=h.forwardRef(({className:e,...t},n)=>m.jsx("ol",{ref:n,className:Ae("flex flex-wrap items-center gap-1.5 break-words text-[13px] text-fg-subtle",e),...t}));c0.displayName="BreadcrumbList";const hl=h.forwardRef(({className:e,...t},n)=>m.jsx("li",{ref:n,className:Ae("inline-flex min-w-0 max-w-[16ch] items-center gap-1.5 overflow-hidden",e),...t}));hl.displayName="BreadcrumbItem";const dS=h.forwardRef(({asChild:e,className:t,...n},r)=>{const i=e?Bn:"a";return m.jsx(i,{ref:r,className:Ae("truncate font-normal text-fg transition-colors hover:text-fg-subtle",t),...n})});dS.displayName="BreadcrumbLink";const ml=h.forwardRef(({className:e,...t},n)=>m.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Ae("truncate font-medium text-fg",e),...t}));ml.displayName="BreadcrumbPage";const d0=({children:e,className:t,...n})=>m.jsx("li",{role:"presentation","aria-hidden":"true",className:Ae("[&>svg]:size-3",t),...n,children:e??m.jsx(Y1,{weight:"bold"})});d0.displayName="BreadcrumbSeparator";var Ff="Collapsible",[VK,fS]=gr(Ff),[zK,u6]=VK(Ff),hS=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:l,onOpenChange:o,...c}=e,[f,p]=ra({prop:r,defaultProp:i??!1,onChange:o,caller:Ff});return m.jsx(zK,{scope:n,disabled:l,contentId:za(),open:f,onOpenToggle:h.useCallback(()=>p(y=>!y),[p]),children:m.jsx(tt.div,{"data-state":d6(f),"data-disabled":l?"":void 0,...c,ref:t})})});hS.displayName=Ff;var mS="CollapsibleTrigger",pS=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=u6(mS,n);return m.jsx(tt.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":d6(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:qe(e.onClick,i.onOpenToggle)})});pS.displayName=mS;var c6="CollapsibleContent",gS=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=u6(c6,e.__scopeCollapsible);return m.jsx(aa,{present:n||i.open,children:({present:l})=>m.jsx(ZK,{...r,ref:t,present:l})})});gS.displayName=c6;var ZK=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...l}=e,o=u6(c6,n),[c,f]=h.useState(r),p=h.useRef(null),y=Qt(t,p),g=h.useRef(0),x=g.current,A=h.useRef(0),S=A.current,_=o.open||c,w=h.useRef(_),C=h.useRef(void 0);return h.useEffect(()=>{const R=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(R)},[]),ea(()=>{const R=p.current;if(R){C.current=C.current||{transitionDuration:R.style.transitionDuration,animationName:R.style.animationName},R.style.transitionDuration="0s",R.style.animationName="none";const D=R.getBoundingClientRect();g.current=D.height,A.current=D.width,w.current||(R.style.transitionDuration=C.current.transitionDuration,R.style.animationName=C.current.animationName),f(r)}},[o.open,r]),m.jsx(tt.div,{"data-state":d6(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!_,...l,ref:y,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":S?`${S}px`:void 0,...e.style},children:_&&i})});function d6(e){return e?"open":"closed"}var yS=hS,bS=pS,vS=gS,Sa="Accordion",qK=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[f6,YK,$K]=Fg(Sa),[Bf]=gr(Sa,[$K,fS]),h6=fS(),m6=J.forwardRef((e,t)=>{const{type:n,...r}=e,i=r,l=r;return m.jsx(f6.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?m.jsx(XK,{...l,ref:t}):m.jsx(KK,{...i,ref:t})})});m6.displayName=Sa;var[ES,QK]=Bf(Sa),[xS,GK]=Bf(Sa,{collapsible:!1}),KK=J.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:l=!1,...o}=e,[c,f]=ra({prop:n,defaultProp:r??"",onChange:i,caller:Sa});return m.jsx(ES,{scope:e.__scopeAccordion,value:J.useMemo(()=>c?[c]:[],[c]),onItemOpen:f,onItemClose:J.useCallback(()=>l&&f(""),[l,f]),children:m.jsx(xS,{scope:e.__scopeAccordion,collapsible:l,children:m.jsx(AS,{...o,ref:t})})})}),XK=J.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...l}=e,[o,c]=ra({prop:n,defaultProp:r??[],onChange:i,caller:Sa}),f=J.useCallback(y=>c((g=[])=>[...g,y]),[c]),p=J.useCallback(y=>c((g=[])=>g.filter(x=>x!==y)),[c]);return m.jsx(ES,{scope:e.__scopeAccordion,value:o,onItemOpen:f,onItemClose:p,children:m.jsx(xS,{scope:e.__scopeAccordion,collapsible:!0,children:m.jsx(AS,{...l,ref:t})})})}),[WK,Uf]=Bf(Sa),AS=J.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:l="vertical",...o}=e,c=J.useRef(null),f=Qt(c,t),p=YK(n),g=zc(i)==="ltr",x=qe(e.onKeyDown,A=>{if(!qK.includes(A.key))return;const S=A.target,_=p().filter(j=>!j.ref.current?.disabled),w=_.findIndex(j=>j.ref.current===S),C=_.length;if(w===-1)return;A.preventDefault();let R=w;const D=0,P=C-1,U=()=>{R=w+1,R>P&&(R=D)},k=()=>{R=w-1,R<D&&(R=P)};switch(A.key){case"Home":R=D;break;case"End":R=P;break;case"ArrowRight":l==="horizontal"&&(g?U():k());break;case"ArrowDown":l==="vertical"&&U();break;case"ArrowLeft":l==="horizontal"&&(g?k():U());break;case"ArrowUp":l==="vertical"&&k();break}const H=R%C;_[H].ref.current?.focus()});return m.jsx(WK,{scope:n,disabled:r,direction:i,orientation:l,children:m.jsx(f6.Slot,{scope:n,children:m.jsx(tt.div,{...o,"data-orientation":l,ref:f,onKeyDown:r?void 0:x})})})}),C1="AccordionItem",[JK,p6]=Bf(C1),g6=J.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...i}=e,l=Uf(C1,n),o=QK(C1,n),c=h6(n),f=za(),p=r&&o.value.includes(r)||!1,y=l.disabled||e.disabled;return m.jsx(JK,{scope:n,open:p,disabled:y,triggerId:f,children:m.jsx(yS,{"data-orientation":l.orientation,"data-state":SS(p),...c,...i,ref:t,disabled:y,open:p,onOpenChange:g=>{g?o.onItemOpen(r):o.onItemClose(r)}})})});g6.displayName=C1;var TS="AccordionHeader",eX=J.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=Uf(Sa,n),l=p6(TS,n);return m.jsx(tt.h3,{"data-orientation":i.orientation,"data-state":SS(l.open),"data-disabled":l.disabled?"":void 0,...r,ref:t})});eX.displayName=TS;var lg="AccordionTrigger",y6=J.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=Uf(Sa,n),l=p6(lg,n),o=GK(lg,n),c=h6(n);return m.jsx(f6.ItemSlot,{scope:n,children:m.jsx(bS,{"aria-disabled":l.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:l.triggerId,...c,...r,ref:t})})});y6.displayName=lg;var _S="AccordionContent",b6=J.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=Uf(Sa,n),l=p6(_S,n),o=h6(n);return m.jsx(vS,{role:"region","aria-labelledby":l.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});b6.displayName=_S;function SS(e){return e?"open":"closed"}const og=(e,t)=>{if(!e)return"any";const n=Array.isArray(e)?e.join(" | "):e;return t?`${n} (${t})`:n},CS=e=>!(e.oneOf||e.anyOf||e.allOf||e.properties&&Object.keys(e.properties).length>0||e.type==="array"||e.type==="object"),tX=e=>e.type!=="array"||!e.items?og(e.type,e.format):CS(e.items)?`${og(e.items.type,e.items.format)}[]`:"array",nX=(e,t)=>e.const!==void 0?String(e.const):e.properties?.type?.const!==void 0?String(e.properties.type.const):e.enum&&e.enum.length===1?String(e.enum[0]):e.title?e.title:e.description?e.description.slice(0,50)+(e.description.length>50?"...":""):!e.type&&!e.properties&&!e.oneOf&&!e.anyOf&&!e.allOf?"Any value":`Schema ${t+1}`,rX=e=>!e.type&&!e.properties&&!e.oneOf&&!e.anyOf&&!e.allOf&&!e.const&&!e.enum&&!e.items,Io=({unionType:e,schemas:t,level:n})=>{const r=i=>{switch(i){case"oneOf":return"Must match exactly one of the following schemas:";case"anyOf":return"Must match at least one of the following schemas:";case"allOf":return"Must match all of the following schemas:";default:return"Union type:"}};return m.jsxs("div",{className:"mt-4",children:[m.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[m.jsx(Ut,{className:"font-mono text-xs",children:e}),m.jsx("span",{className:"text-gray-600 text-sm",children:r(e)})]}),m.jsx(Ka,{asChild:!0,children:m.jsx(m6,{type:"multiple",children:t.map((i,l)=>{const o=nX(i,l),c=i.properties&&Object.keys(i.properties).length>0;return rX(i)?null:m.jsx(g6,{value:`option-${l}`,asChild:!0,children:m.jsxs(dg,{children:[m.jsx(fg,{name:o,required:!1,type:og(i.type,i.format),children:m.jsx(y6,{className:"flex size-6 cursor-pointer items-center justify-center rounded-lg bg-accent text-fg-subtle transition-opacity duration-200 hover:opacity-80 [&[data-state=open]>svg]:rotate-90",children:m.jsx(Y1,{weight:"bold",className:"size-4 transition-transform duration-200"})})}),m.jsxs(hg,{children:[i.description&&m.jsx(Vo,{children:i.description}),m.jsx(s1,{property:i}),m.jsx(ug,{property:i}),m.jsx(cg,{property:i}),m.jsxs(b6,{children:[c&&m.jsx(Ka,{children:Object.entries(i.properties||{}).map(([f,p])=>m.jsx(Dc,{name:f,property:p,required:Array.isArray(i.required)?i.required.includes(f):!1,level:n+1},f))}),i.oneOf&&m.jsx(Io,{unionType:"oneOf",schemas:i.oneOf,level:n+1}),i.anyOf&&m.jsx(Io,{unionType:"anyOf",schemas:i.anyOf,level:n+1}),i.allOf&&m.jsx(Io,{unionType:"allOf",schemas:i.allOf,level:n+1}),i.type==="array"&&i.items&&m.jsx(Dc,{name:"items",property:i.items,required:!1,level:n+1})]})]})]})},l)})})})]})};function s1({property:e}){if(!(e.minimum!==void 0||e.maximum!==void 0||e.minLength!==void 0||e.maxLength!==void 0||e.pattern!==void 0||e.enum!==void 0||e.const!==void 0))return null;const n=[];return e.minimum!==void 0&&n.push(["min",String(e.minimum)]),e.maximum!==void 0&&n.push(["max",String(e.maximum)]),e.minLength!==void 0&&n.push(["minLength",String(e.minLength)]),e.maxLength!==void 0&&n.push(["maxLength",String(e.maxLength)]),e.pattern&&n.push(["pattern",e.pattern]),e.enum&&n.push(["enum",e.enum.join(", ")]),e.const!==void 0&&n.push(["const",JSON.stringify(e.const)]),m.jsx("div",{className:"mb-2 text-gray-500 text-sm",children:n.map(([r,i])=>m.jsxs("div",{children:[m.jsxs("span",{className:"font-medium",children:[r,":"]})," ",i]},r))})}function ug({property:e}){return e.default?m.jsxs("div",{className:"text-gray-600 text-sm",children:[m.jsx("span",{className:"font-medium",children:"Default:"})," ",JSON.stringify(e.default)]}):null}function cg({property:e}){return e.example?m.jsxs("div",{className:"text-gray-600 text-sm",children:[m.jsx("span",{className:"font-medium",children:"Example:"})," ",JSON.stringify(e.example)]}):null}function Dc({name:e,property:t,required:n=!1,level:r=0,hideHeader:i=!1}){const l=t.properties&&Object.keys(t.properties).length>0,o=t.type==="array"&&t.items,c=o&&t.items&&!CS(t.items),f=t.oneOf||t.anyOf||t.allOf,p=()=>{if(f){const x=[];return t.oneOf&&x.push("oneOf"),t.anyOf&&x.push("anyOf"),t.allOf&&x.push("allOf"),x.join(" & ")}return tX(t)};if(l||c||f)return m.jsx(g6,{value:e,asChild:!0,children:m.jsxs(dg,{children:[!i&&m.jsx(fg,{name:e,required:n,type:p(),children:m.jsx(y6,{className:"flex size-6 cursor-pointer items-center justify-center rounded-lg bg-accent text-fg-subtle transition-opacity duration-200 hover:opacity-80 [&[data-state=open]>svg]:rotate-90",children:m.jsx(Y1,{weight:"bold",className:"size-4 transition-transform duration-200"})})}),m.jsxs(hg,{className:i?"ml-0":"ml-8",children:[t.description&&m.jsx(Vo,{children:t.description}),m.jsx(s1,{property:t}),m.jsx(ug,{property:t}),m.jsx(cg,{property:t}),o&&!c&&t.items&&m.jsx(s1,{property:t.items}),m.jsxs(b6,{children:[t.oneOf&&m.jsx(Io,{unionType:"oneOf",schemas:t.oneOf,level:r}),t.anyOf&&m.jsx(Io,{unionType:"anyOf",schemas:t.anyOf,level:r}),t.allOf&&m.jsx(Io,{unionType:"allOf",schemas:t.allOf,level:r}),l&&m.jsx(Ka,{children:Object.entries(t.properties||{}).map(([x,A])=>m.jsx(Dc,{name:`${e}.${x}`,property:A,required:!1,level:r+1},x))}),c&&t.items&&m.jsx(Dc,{name:e,property:t.items,required:!1,level:r+1,hideHeader:!0})]})]})]})});const y=t.minimum!==void 0&&t.maximum!==void 0&&t.minLength!==void 0&&t.maxLength!==void 0&&t.pattern!==void 0&&t.enum!==void 0&&t.const!==void 0,g=!t.description&&!t.default&&!t.example&&!y;return m.jsxs(dg,{children:[m.jsx(fg,{name:e,required:n,type:p()}),!g&&m.jsxs(hg,{children:[t.description&&m.jsx(Vo,{children:t.description}),m.jsx(s1,{property:t}),m.jsx(ug,{property:t}),m.jsx(cg,{property:t})]})]})}function dg({children:e,className:t,asChild:n,...r}){const i=n?Bn:"div";return m.jsx(i,{"data-slot":"property-item",className:Ae("flex flex-col border-accent border-b-[0.5px] py-3 outline-none last:border-b-0",t),...r,children:e})}function fg({children:e,className:t,name:n,required:r,type:i,...l}){return m.jsxs("div",{className:Ae("grid grid-cols-[24px_1fr_auto] gap-2",t),...l,children:[m.jsx("div",{className:"shrink-0",children:e??m.jsx("div",{className:"flex size-6 items-center justify-center",children:m.jsx(kg,{weight:"fill",className:"size-2 text-fg-subtle"})})}),m.jsx(dn,{className:"flex-row",children:m.jsx(an,{className:"font-mono",children:n})}),m.jsxs(Wn,{children:[m.jsx(Ut,{children:m.jsx($t,{uppercase:!0,children:i})}),r&&m.jsx(Ut,{children:m.jsx($t,{uppercase:!0,children:"required"})})]})]})}function hg({children:e,className:t,...n}){return m.jsx("div",{className:Ae("ml-8 flex flex-col gap-y-3",t),...n,children:e})}const aX=({schema:e})=>{const t=e.required||[];return!e.properties||Object.keys(e.properties).length===0?m.jsxs(Ta,{children:[m.jsx(ni,{children:"No parameters defined"}),m.jsx(Ns,{children:"This tool does not require any parameters."})]}):m.jsx(Ka,{asChild:!0,children:m.jsx(m6,{type:"multiple",children:Object.entries(e.properties).map(([n,r])=>m.jsx(Dc,{name:n,property:r,required:t.includes(n)},n))})})},f0=M8,iX=L8,sX=_f,wS=D8;function lX({className:e,...t}){return m.jsx(Af,{className:Ae("overlay",e),...t})}function Vf({className:e,children:t,...n}){return m.jsxs(wS,{children:[m.jsx(lX,{}),m.jsx(Tf,{className:Ae("popover fixed inset-y-1 right-1 z-50 flex w-[calc(100%-0.5rem)] flex-col overflow-hidden rounded-xl transition ease-in-out sm:max-w-xl","shadow-[0_0_10px_6px_rgba(55,50,46,0.13),_0_0_0_0.5px_rgba(55,50,46,0.25)]","radix-state-[open]:slide-in-from-right radix-state-[open]:animate-in radix-state-[open]:duration-300","radix-state-[closed]:slide-out-to-right radix-state-[closed]:animate-out radix-state-[closed]:duration-200",e),...n,children:t})]})}function zf({className:e,...t}){return m.jsx("div",{className:Ae("flex flex-1 flex-col gap-y-10 overflow-y-auto overflow-x-hidden p-6 pt-10",e),...t})}function Zf({className:e,children:t,...n}){return m.jsxs("div",{className:Ae("flex flex-row-reverse items-center justify-start gap-x-1 border-accent border-b-[0.5px] px-3 py-2",e),...n,children:[m.jsx(sX,{asChild:!0,children:m.jsxs(bt,{size:"icon",variant:"secondary",children:[m.jsx(Uc,{}),m.jsx("span",{className:"sr-only",children:"Close"})]})}),t]})}const qf=({className:e,...t})=>m.jsx("div",{className:Ae("flex flex-col gap-y-2 text-left",e),...t});function Yf({className:e,...t}){return m.jsx(I8,{className:Ae(ji({variant:"h1"}),e),...t})}function $f({className:e,...t}){return m.jsx(P8,{className:Ae(ji({variant:"p"}),"text-fg-subtle",e),...t})}function oX({tool:e,mcpName:t,onClose:n}){return m.jsx(f0,{open:!!e,onOpenChange:n,children:m.jsxs(Vf,{children:[m.jsx(Zf,{children:m.jsx(u0,{className:"grow",children:m.jsxs(c0,{children:[m.jsx(hl,{children:t}),m.jsx(d0,{}),m.jsx(ml,{children:e.name})]})})}),m.jsxs(zf,{children:[m.jsxs(qf,{children:[m.jsx(Yf,{children:e.name}),m.jsxs($f,{className:"text-sm",children:["From"," ",m.jsx("button",{className:"cursor-pointer text-fg underline",children:t})]})]}),m.jsx(Vo,{children:e.description}),m.jsx(al,{}),m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Input schema"})})}),e.inputSchema?m.jsx(aX,{schema:e.inputSchema}):m.jsxs(Ta,{children:[m.jsx(ni,{children:"No input schema"}),m.jsx(Ns,{children:"This tool does not require any parameters."})]})]})]})]})})}function v6({tools:e,toolsLoading:t,editable:n,isSaving:r,onUpdateTools:i}){const[l,o]=h.useState(null),[c,f]=h.useState(!1),[p,y]=h.useState([]);h.useEffect(()=>{c||y((e??[]).map(A=>({name:A.name,disabled:!!A.disabled,serverName:A.serverName??""})))},[e,c]);const g=p.length>0&&p.every(A=>!A.disabled),x=A=>{y(p.map(S=>({...S,disabled:!A})))};return t?m.jsx(fX,{}):!e||e.length===0?m.jsx(dX,{}):m.jsxs(m.Fragment,{children:[m.jsxs(Nt,{children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between",children:[m.jsx(Rt,{variant:"h2",className:"flex-1",asChild:!0,children:m.jsx("h2",{children:"Tools"})}),n&&!c&&m.jsx(bt,{size:"sm",onClick:()=>{y(e.map(A=>({name:A.name,disabled:!!A.disabled,serverName:A.serverName??""}))),f(!0)},children:"Edit"}),c&&m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(bt,{size:"sm",disabled:r,onClick:async()=>{p&&await i?.(p),f(!1),y([])},children:r?"Saving...":"Save"}),m.jsx(bt,{size:"sm",variant:"secondary",disabled:r,onClick:()=>{f(!1),y([])},children:m.jsx(Uc,{weight:"bold"})}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsx(o6,{id:"global-toggle",checked:g,onCheckedChange:x})})]})]}),m.jsx(Ka,{children:e.map(A=>m.jsx(uX,{tool:A,onClick:()=>o(A),draftTool:p.find(S=>S.name===A.name&&S.serverName===A.serverName),isEditing:c,isSaving:r,onDisabledChange:(S,_)=>{y(p.map(w=>w.name===S.name&&w.serverName===S.serverName?{...w,disabled:_}:w))}},`li-${A.serverName}:${A.name}`))})]}),l&&m.jsx(oX,{tool:l,mcpName:"XXXXXXXXXXX",onClose:()=>o(null)})]})}function uX({tool:e,draftTool:t,onClick:n,isEditing:r,isSaving:i,onDisabledChange:l}){const o=e.description?.replace(/\[([^\]]+)\]/g,"")||"";return m.jsxs(wn,{onClick:r?void 0:n,children:[m.jsxs(dn,{children:[m.jsx(an,{children:e.name}),o&&m.jsx(qa,{children:o})]}),t?.disabled&&!r&&m.jsx(Wn,{className:"ml-auto",children:m.jsx(Ut,{children:m.jsx($t,{uppercase:!0,children:"Disabled"})})}),r&&m.jsx(cX,{id:e.name,checked:!t?.disabled,loading:i??!1,onCheckedChange:c=>{l(e,!c)}})]})}function cX({id:e,checked:t,loading:n,onCheckedChange:r}){return n?m.jsx(Wn,{children:m.jsx(Ut,{children:m.jsx($t,{children:m.jsx(Jr,{text:"Loading"})})})}):m.jsx(o6,{id:e,checked:t,onCheckedChange:r})}function dX(){return m.jsx(m.Fragment,{children:m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",className:"flex-1",asChild:!0,children:m.jsx("h2",{children:"Tools"})})}),m.jsxs(Ta,{children:[m.jsx(ni,{children:"No items"}),m.jsx(Ns,{children:"This list is empty."})]})]})})}function fX(){return m.jsx(m.Fragment,{children:m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",className:"flex-1",asChild:!0,children:m.jsx("h2",{children:"Tools"})})}),m.jsx(sl,{})]})})}var Qf="Tabs",[hX]=gr(Qf,[Go]),NS=Go(),[mX,E6]=hX(Qf),OS=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:l,orientation:o="horizontal",dir:c,activationMode:f="automatic",...p}=e,y=zc(c),[g,x]=ra({prop:r,onChange:i,defaultProp:l??"",caller:Qf});return m.jsx(mX,{scope:n,baseId:za(),value:g,onValueChange:x,orientation:o,dir:y,activationMode:f,children:m.jsx(tt.div,{dir:y,"data-orientation":o,...p,ref:t})})});OS.displayName=Qf;var RS="TabsList",kS=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,l=E6(RS,n),o=NS(n);return m.jsx(Kg,{asChild:!0,...o,orientation:l.orientation,dir:l.dir,loop:r,children:m.jsx(tt.div,{role:"tablist","aria-orientation":l.orientation,...i,ref:t})})});kS.displayName=RS;var MS="TabsTrigger",LS=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...l}=e,o=E6(MS,n),c=NS(n),f=PS(o.baseId,r),p=jS(o.baseId,r),y=r===o.value;return m.jsx(Xg,{asChild:!0,...c,focusable:!i,active:y,children:m.jsx(tt.button,{type:"button",role:"tab","aria-selected":y,"aria-controls":p,"data-state":y?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:f,...l,ref:t,onMouseDown:qe(e.onMouseDown,g=>{!i&&g.button===0&&g.ctrlKey===!1?o.onValueChange(r):g.preventDefault()}),onKeyDown:qe(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&o.onValueChange(r)}),onFocus:qe(e.onFocus,()=>{const g=o.activationMode!=="manual";!y&&!i&&g&&o.onValueChange(r)})})})});LS.displayName=MS;var DS="TabsContent",IS=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:l,...o}=e,c=E6(DS,n),f=PS(c.baseId,r),p=jS(c.baseId,r),y=r===c.value,g=h.useRef(y);return h.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),m.jsx(aa,{present:i||y,children:({present:x})=>m.jsx(tt.div,{"data-state":y?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":f,hidden:!x,id:p,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:x&&l})})});IS.displayName=DS;function PS(e,t){return`${e}-trigger-${t}`}function jS(e,t){return`${e}-content-${t}`}var pX=OS,gX=kS,yX=LS,bX=IS;function Ya(e){return null}function x6({default:e,className:t,children:n}){const r=h.Children.toArray(n).filter(i=>h.isValidElement(i)&&i.type===Ya);return m.jsxs(pX,{"data-slot":"tabs",className:Ae("flex flex-col gap-4",t),defaultValue:e,children:[m.jsx(gX,{"data-slot":"tabs-list",className:Ae("inline-flex w-fit items-center justify-center gap-x-0.5 rounded-lg border-[0.5px] border-fg/15 bg-accent-subtle p-1 text-fg-subtle"),children:r.map(i=>m.jsxs(yX,{value:i.props.id,"data-slot":"tabs-trigger",className:Ae("inline-flex flex-1 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 py-1 font-[450] text-fg text-sm transition-[color,box-shadow]","radix-state-[active]:bg-surface radix-state-[active]:shadow-[0_3px_9px_0px_rgba(55,50,46,0.07),_0_0_0_0.5px_rgba(55,50,46,0.15)]","radix-state-[inactive]:hover:bg-surface/50 radix-state-[inactive]:hover:shadow-[0_0_0_0.5px_rgba(55,50,46,0.15)]","disabled:pointer-events-none disabled:opacity-50 has-[svg:first-child]:pl-2.5","[&_svg:not([class*='size-'])]:size-4.5 [&_svg]:pointer-events-none [&_svg]:shrink-0"),children:[i.props.icon,i.props.label]},i.props.id))}),r.map(i=>m.jsx(bX,{value:i.props.id,"data-slot":"tabs-content",className:Ae("flex-1 outline-none","rounded-xl border-[0.5px] bg-accent-subtle/20 p-6"),children:i.props.content},i.props.id))]})}function HS({entry:e}){return m.jsxs(Nt,{className:"gap-y-8",children:[m.jsx(Sf,{src:e.icon,className:"size-9"}),m.jsxs(Ot,{children:[m.jsx(Rt,{children:e.title}),m.jsx(ti,{children:e.description})]}),m.jsxs(Wn,{children:[e.isOfficial&&m.jsxs(Ut,{variant:"success",children:[m.jsx(na,{children:m.jsx(Ig,{})}),m.jsx($t,{uppercase:!0,children:"Official"})]}),e.homepage&&m.jsx(Ut,{className:"transition-opacity duration-200 hover:opacity-50",asChild:!0,children:m.jsxs("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",children:[m.jsx(na,{children:m.jsx(Zx,{weight:"bold"})}),m.jsx($t,{uppercase:!0,children:"Homepage"})]})})]}),m.jsxs(x6,{default:"readme",children:[m.jsx(Ya,{id:"readme",label:"Readme",icon:m.jsx(q1,{}),content:m.jsx(iS,{readme:e.readme})}),m.jsx(Ya,{id:"tools",label:"Tools",icon:m.jsx(Q1,{}),content:m.jsx(v6,{tools:e.tools,toolsLoading:!1})}),m.jsx(Ya,{id:"transport",label:"Transport",icon:m.jsx($1,{}),content:m.jsxs("div",{className:"flex flex-col gap-y-10",children:[m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Overview"})})}),m.jsx(qB,{entry:e})]}),m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Parameters"})})}),m.jsx(LK,{parameters:e.parameters??[]})]})]})})]})]})}var Et;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const l={};for(const o of i)l[o]=o;return l},e.getValidEnumValues=i=>{const l=e.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),o={};for(const c of l)o[c]=i[c];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(l){return i[l]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const l=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&l.push(o);return l},e.find=(i,l)=>{for(const o of i)if(l(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,l=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(l)}e.joinValues=r,e.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(Et||(Et={}));var yx;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(yx||(yx={}));const Ie=Et.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bs=e=>{switch(typeof e){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return Number.isNaN(e)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(e)?Ie.array:e===null?Ie.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ie.promise:typeof Map<"u"&&e instanceof Map?Ie.map:typeof Set<"u"&&e instanceof Set?Ie.set:typeof Date<"u"&&e instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},Oe=Et.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Di extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(l){return l.message},r={_errors:[]},i=l=>{for(const o of l.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let c=r,f=0;for(;f<o.path.length;){const p=o.path[f];f===o.path.length-1?(c[p]=c[p]||{_errors:[]},c[p]._errors.push(n(o))):c[p]=c[p]||{_errors:[]},c=c[p],f++}}};return i(this),r}static assert(t){if(!(t instanceof Di))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Et.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const l=i.path[0];n[l]=n[l]||[],n[l].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Di.create=e=>new Di(e);const mg=(e,t)=>{let n;switch(e.code){case Oe.invalid_type:e.received===Ie.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Oe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Et.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:n=`Unrecognized key(s) in object: ${Et.joinValues(e.keys,", ")}`;break;case Oe.invalid_union:n="Invalid input";break;case Oe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Et.joinValues(e.options)}`;break;case Oe.invalid_enum_value:n=`Invalid enum value. Expected ${Et.joinValues(e.options)}, received '${e.received}'`;break;case Oe.invalid_arguments:n="Invalid function arguments";break;case Oe.invalid_return_type:n="Invalid function return type";break;case Oe.invalid_date:n="Invalid date";break;case Oe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Et.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Oe.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Oe.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Oe.custom:n="Invalid input";break;case Oe.invalid_intersection_types:n="Intersection results could not be merged";break;case Oe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Oe.not_finite:n="Number must be finite";break;default:n=t.defaultError,Et.assertNever(e)}return{message:n}};let vX=mg;function EX(){return vX}const xX=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,l=[...n,...i.path||[]],o={...i,path:l};if(i.message!==void 0)return{...i,path:l,message:i.message};let c="";const f=r.filter(p=>!!p).slice().reverse();for(const p of f)c=p(o,{data:t,defaultError:c}).message;return{...i,path:l,message:c}};function Le(e,t){const n=EX(),r=xX({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===mg?void 0:mg].filter(i=>!!i)});e.common.issues.push(r)}class Jn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return $e;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const l=await i.key,o=await i.value;r.push({key:l,value:o})}return Jn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:l,value:o}=i;if(l.status==="aborted"||o.status==="aborted")return $e;l.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),l.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[l.value]=o.value)}return{status:t.value,value:r}}}const $e=Object.freeze({status:"aborted"}),uc=e=>({status:"dirty",value:e}),la=e=>({status:"valid",value:e}),bx=e=>e.status==="aborted",vx=e=>e.status==="dirty",zo=e=>e.status==="valid",w1=e=>typeof Promise<"u"&&e instanceof Promise;var Ue;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Ue||(Ue={}));class Xa{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ex=(e,t)=>{if(zo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Di(e.common.issues);return this._error=n,this._error}}};function at(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,c)=>{const{message:f}=e;return o.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??r??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:f??n??c.defaultError}},description:i}}class mt{get description(){return this._def.description}_getType(t){return bs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:bs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Jn,ctx:{common:t.parent.common,data:t.data,parsedType:bs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(w1(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:bs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Ex(r,i)}"~validate"(t){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:bs(t)};if(!this["~standard"].async)try{const r=this._parseSync({data:t,path:[],parent:n});return zo(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>zo(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:bs(t)},i=this._parse({data:t,path:r.path,parent:r}),l=await(w1(i)?i:Promise.resolve(i));return Ex(r,l)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,l)=>{const o=t(i),c=()=>l.addIssue({code:Oe.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new yl({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ri.create(this,this._def)}nullable(){return bl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $a.create(this)}promise(){return L1.create(this,this._def)}or(t){return O1.create([this,t],this._def)}and(t){return R1.create(this,t,this._def)}transform(t){return new yl({...at(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new D1({...at(this._def),innerType:this,defaultValue:n,typeName:Qe.ZodDefault})}brand(){return new VS({typeName:Qe.ZodBranded,type:this,...at(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new I1({...at(this._def),innerType:this,catchValue:n,typeName:Qe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return T6.create(this,t)}readonly(){return P1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const AX=/^c[^\s-]{8,}$/i,TX=/^[0-9a-z]+$/,_X=/^[0-9A-HJKMNP-TV-Z]{26}$/i,SX=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,CX=/^[a-z0-9_-]{21}$/i,wX=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,NX=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,OX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ip;const kX=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,MX=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,LX=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,DX=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,IX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PX=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,FS="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",jX=new RegExp(`^${FS}$`);function BS(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function HX(e){return new RegExp(`^${BS(e)}$`)}function FX(e){let t=`${FS}T${BS(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function BX(e,t){return!!((t==="v4"||!t)&&kX.test(e)||(t==="v6"||!t)&&LX.test(e))}function UX(e,t){if(!wX.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function VX(e,t){return!!((t==="v4"||!t)&&MX.test(e)||(t==="v6"||!t)&&DX.test(e))}class Ni extends mt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ie.string){const l=this._getOrReturnCtx(t);return Le(l,{code:Oe.invalid_type,expected:Ie.string,received:l.parsedType}),$e}const r=new Jn;let i;for(const l of this._def.checks)if(l.kind==="min")t.data.length<l.value&&(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),r.dirty());else if(l.kind==="max")t.data.length>l.value&&(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),r.dirty());else if(l.kind==="length"){const o=t.data.length>l.value,c=t.data.length<l.value;(o||c)&&(i=this._getOrReturnCtx(t,i),o?Le(i,{code:Oe.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):c&&Le(i,{code:Oe.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),r.dirty())}else if(l.kind==="email")OX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"email",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="emoji")ip||(ip=new RegExp(RX,"u")),ip.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"emoji",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="uuid")SX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"uuid",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="nanoid")CX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"nanoid",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="cuid")AX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"cuid",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="cuid2")TX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"cuid2",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="ulid")_X.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"ulid",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Le(i,{validation:"url",code:Oe.invalid_string,message:l.message}),r.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"regex",code:Oe.invalid_string,message:l.message}),r.dirty())):l.kind==="trim"?t.data=t.data.trim():l.kind==="includes"?t.data.includes(l.value,l.position)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),r.dirty()):l.kind==="toLowerCase"?t.data=t.data.toLowerCase():l.kind==="toUpperCase"?t.data=t.data.toUpperCase():l.kind==="startsWith"?t.data.startsWith(l.value)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:{startsWith:l.value},message:l.message}),r.dirty()):l.kind==="endsWith"?t.data.endsWith(l.value)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:{endsWith:l.value},message:l.message}),r.dirty()):l.kind==="datetime"?FX(l).test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:"datetime",message:l.message}),r.dirty()):l.kind==="date"?jX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:"date",message:l.message}),r.dirty()):l.kind==="time"?HX(l).test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:"time",message:l.message}),r.dirty()):l.kind==="duration"?NX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"duration",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="ip"?BX(t.data,l.version)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"ip",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="jwt"?UX(t.data,l.alg)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"jwt",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="cidr"?VX(t.data,l.version)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"cidr",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="base64"?IX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"base64",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="base64url"?PX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"base64url",code:Oe.invalid_string,message:l.message}),r.dirty()):Et.assertNever(l);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:Oe.invalid_string,...Ue.errToObj(r)})}_addCheck(t){return new Ni({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ue.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ue.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ue.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ue.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ue.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ue.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ue.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ue.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ue.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ue.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ue.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ue.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ue.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Ue.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Ue.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Ue.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ue.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...Ue.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ue.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ue.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ue.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ue.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ue.errToObj(n)})}nonempty(t){return this.min(1,Ue.errToObj(t))}trim(){return new Ni({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ni({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ni({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ni.create=e=>new Ni({checks:[],typeName:Qe.ZodString,coerce:e?.coerce??!1,...at(e)});function zX(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,l=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return l%o/10**i}class Ic extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ie.number){const l=this._getOrReturnCtx(t);return Le(l,{code:Oe.invalid_type,expected:Ie.number,received:l.parsedType}),$e}let r;const i=new Jn;for(const l of this._def.checks)l.kind==="int"?Et.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.invalid_type,expected:"integer",received:"float",message:l.message}),i.dirty()):l.kind==="min"?(l.inclusive?t.data<l.value:t.data<=l.value)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?t.data>l.value:t.data>=l.value)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="multipleOf"?zX(t.data,l.value)!==0&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):l.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.not_finite,message:l.message}),i.dirty()):Et.assertNever(l);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ue.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ue.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ue.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ue.toString(n))}setLimit(t,n,r,i){return new Ic({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ue.toString(i)}]})}_addCheck(t){return new Ic({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ue.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ue.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ue.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ue.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ue.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ue.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Et.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ic.create=e=>new Ic({checks:[],typeName:Qe.ZodNumber,coerce:e?.coerce||!1,...at(e)});class Pc extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ie.bigint)return this._getInvalidInput(t);let r;const i=new Jn;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?t.data<l.value:t.data<=l.value)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?t.data>l.value:t.data>=l.value)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="multipleOf"?t.data%l.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):Et.assertNever(l);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return Le(n,{code:Oe.invalid_type,expected:Ie.bigint,received:n.parsedType}),$e}gte(t,n){return this.setLimit("min",t,!0,Ue.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ue.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ue.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ue.toString(n))}setLimit(t,n,r,i){return new Pc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ue.toString(i)}]})}_addCheck(t){return new Pc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ue.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ue.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Pc.create=e=>new Pc({checks:[],typeName:Qe.ZodBigInt,coerce:e?.coerce??!1,...at(e)});class xx extends mt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ie.boolean){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.boolean,received:r.parsedType}),$e}return la(t.data)}}xx.create=e=>new xx({typeName:Qe.ZodBoolean,coerce:e?.coerce||!1,...at(e)});class N1 extends mt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ie.date){const l=this._getOrReturnCtx(t);return Le(l,{code:Oe.invalid_type,expected:Ie.date,received:l.parsedType}),$e}if(Number.isNaN(t.data.getTime())){const l=this._getOrReturnCtx(t);return Le(l,{code:Oe.invalid_date}),$e}const r=new Jn;let i;for(const l of this._def.checks)l.kind==="min"?t.data.getTime()<l.value&&(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),r.dirty()):l.kind==="max"?t.data.getTime()>l.value&&(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),r.dirty()):Et.assertNever(l);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new N1({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ue.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ue.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}N1.create=e=>new N1({checks:[],coerce:e?.coerce||!1,typeName:Qe.ZodDate,...at(e)});class Ax extends mt{_parse(t){if(this._getType(t)!==Ie.symbol){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.symbol,received:r.parsedType}),$e}return la(t.data)}}Ax.create=e=>new Ax({typeName:Qe.ZodSymbol,...at(e)});class pg extends mt{_parse(t){if(this._getType(t)!==Ie.undefined){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.undefined,received:r.parsedType}),$e}return la(t.data)}}pg.create=e=>new pg({typeName:Qe.ZodUndefined,...at(e)});class gg extends mt{_parse(t){if(this._getType(t)!==Ie.null){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.null,received:r.parsedType}),$e}return la(t.data)}}gg.create=e=>new gg({typeName:Qe.ZodNull,...at(e)});class Tx extends mt{constructor(){super(...arguments),this._any=!0}_parse(t){return la(t.data)}}Tx.create=e=>new Tx({typeName:Qe.ZodAny,...at(e)});class _x extends mt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return la(t.data)}}_x.create=e=>new _x({typeName:Qe.ZodUnknown,...at(e)});class Ss extends mt{_parse(t){const n=this._getOrReturnCtx(t);return Le(n,{code:Oe.invalid_type,expected:Ie.never,received:n.parsedType}),$e}}Ss.create=e=>new Ss({typeName:Qe.ZodNever,...at(e)});class Sx extends mt{_parse(t){if(this._getType(t)!==Ie.undefined){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.void,received:r.parsedType}),$e}return la(t.data)}}Sx.create=e=>new Sx({typeName:Qe.ZodVoid,...at(e)});class $a extends mt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ie.array)return Le(n,{code:Oe.invalid_type,expected:Ie.array,received:n.parsedType}),$e;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(o||c)&&(Le(n,{code:o?Oe.too_big:Oe.too_small,minimum:c?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Le(n,{code:Oe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Le(n,{code:Oe.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>i.type._parseAsync(new Xa(n,o,n.path,c)))).then(o=>Jn.mergeArray(r,o));const l=[...n.data].map((o,c)=>i.type._parseSync(new Xa(n,o,n.path,c)));return Jn.mergeArray(r,l)}get element(){return this._def.type}min(t,n){return new $a({...this._def,minLength:{value:t,message:Ue.toString(n)}})}max(t,n){return new $a({...this._def,maxLength:{value:t,message:Ue.toString(n)}})}length(t,n){return new $a({...this._def,exactLength:{value:t,message:Ue.toString(n)}})}nonempty(t){return this.min(1,t)}}$a.create=(e,t)=>new $a({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...at(t)});function So(e){if(e instanceof En){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ri.create(So(r))}return new En({...e._def,shape:()=>t})}else return e instanceof $a?new $a({...e._def,type:So(e.element)}):e instanceof Ri?Ri.create(So(e.unwrap())):e instanceof bl?bl.create(So(e.unwrap())):e instanceof pl?pl.create(e.items.map(t=>So(t))):e}class En extends mt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Et.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ie.object){const p=this._getOrReturnCtx(t);return Le(p,{code:Oe.invalid_type,expected:Ie.object,received:p.parsedType}),$e}const{status:r,ctx:i}=this._processInputParams(t),{shape:l,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ss&&this._def.unknownKeys==="strip"))for(const p in i.data)o.includes(p)||c.push(p);const f=[];for(const p of o){const y=l[p],g=i.data[p];f.push({key:{status:"valid",value:p},value:y._parse(new Xa(i,g,i.path,p)),alwaysSet:p in i.data})}if(this._def.catchall instanceof Ss){const p=this._def.unknownKeys;if(p==="passthrough")for(const y of c)f.push({key:{status:"valid",value:y},value:{status:"valid",value:i.data[y]}});else if(p==="strict")c.length>0&&(Le(i,{code:Oe.unrecognized_keys,keys:c}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const y of c){const g=i.data[y];f.push({key:{status:"valid",value:y},value:p._parse(new Xa(i,g,i.path,y)),alwaysSet:y in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const p=[];for(const y of f){const g=await y.key,x=await y.value;p.push({key:g,value:x,alwaysSet:y.alwaysSet})}return p}).then(p=>Jn.mergeObjectSync(r,p)):Jn.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(t){return Ue.errToObj,new En({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{const i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Ue.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new En({...this._def,unknownKeys:"strip"})}passthrough(){return new En({...this._def,unknownKeys:"passthrough"})}extend(t){return new En({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new En({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Qe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new En({...this._def,catchall:t})}pick(t){const n={};for(const r of Et.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new En({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Et.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new En({...this._def,shape:()=>n})}deepPartial(){return So(this)}partial(t){const n={};for(const r of Et.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new En({...this._def,shape:()=>n})}required(t){const n={};for(const r of Et.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let l=this.shape[r];for(;l instanceof Ri;)l=l._def.innerType;n[r]=l}return new En({...this._def,shape:()=>n})}keyof(){return US(Et.objectKeys(this.shape))}}En.create=(e,t)=>new En({shape:()=>e,unknownKeys:"strip",catchall:Ss.create(),typeName:Qe.ZodObject,...at(t)});En.strictCreate=(e,t)=>new En({shape:()=>e,unknownKeys:"strict",catchall:Ss.create(),typeName:Qe.ZodObject,...at(t)});En.lazycreate=(e,t)=>new En({shape:e,unknownKeys:"strip",catchall:Ss.create(),typeName:Qe.ZodObject,...at(t)});class O1 extends mt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(l){for(const c of l)if(c.result.status==="valid")return c.result;for(const c of l)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const o=l.map(c=>new Di(c.ctx.common.issues));return Le(n,{code:Oe.invalid_union,unionErrors:o}),$e}if(n.common.async)return Promise.all(r.map(async l=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await l._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let l;const o=[];for(const f of r){const p={...n,common:{...n.common,issues:[]},parent:null},y=f._parseSync({data:n.data,path:n.path,parent:p});if(y.status==="valid")return y;y.status==="dirty"&&!l&&(l={result:y,ctx:p}),p.common.issues.length&&o.push(p.common.issues)}if(l)return n.common.issues.push(...l.ctx.common.issues),l.result;const c=o.map(f=>new Di(f));return Le(n,{code:Oe.invalid_union,unionErrors:c}),$e}}get options(){return this._def.options}}O1.create=(e,t)=>new O1({options:e,typeName:Qe.ZodUnion,...at(t)});const Si=e=>e instanceof bg?Si(e.schema):e instanceof yl?Si(e.innerType()):e instanceof M1?[e.value]:e instanceof gl?e.options:e instanceof vg?Et.objectValues(e.enum):e instanceof D1?Si(e._def.innerType):e instanceof pg?[void 0]:e instanceof gg?[null]:e instanceof Ri?[void 0,...Si(e.unwrap())]:e instanceof bl?[null,...Si(e.unwrap())]:e instanceof VS||e instanceof P1?Si(e.unwrap()):e instanceof I1?Si(e._def.innerType):[];class A6 extends mt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ie.object)return Le(n,{code:Oe.invalid_type,expected:Ie.object,received:n.parsedType}),$e;const r=this.discriminator,i=n.data[r],l=this.optionsMap.get(i);return l?n.common.async?l._parseAsync({data:n.data,path:n.path,parent:n}):l._parseSync({data:n.data,path:n.path,parent:n}):(Le(n,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),$e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const l of n){const o=Si(l.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const c of o){if(i.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);i.set(c,l)}}return new A6({typeName:Qe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...at(r)})}}function yg(e,t){const n=bs(e),r=bs(t);if(e===t)return{valid:!0,data:e};if(n===Ie.object&&r===Ie.object){const i=Et.objectKeys(t),l=Et.objectKeys(e).filter(c=>i.indexOf(c)!==-1),o={...e,...t};for(const c of l){const f=yg(e[c],t[c]);if(!f.valid)return{valid:!1};o[c]=f.data}return{valid:!0,data:o}}else if(n===Ie.array&&r===Ie.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let l=0;l<e.length;l++){const o=e[l],c=t[l],f=yg(o,c);if(!f.valid)return{valid:!1};i.push(f.data)}return{valid:!0,data:i}}else return n===Ie.date&&r===Ie.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class R1 extends mt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(l,o)=>{if(bx(l)||bx(o))return $e;const c=yg(l.value,o.value);return c.valid?((vx(l)||vx(o))&&n.dirty(),{status:n.value,value:c.data}):(Le(r,{code:Oe.invalid_intersection_types}),$e)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([l,o])=>i(l,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}R1.create=(e,t,n)=>new R1({left:e,right:t,typeName:Qe.ZodIntersection,...at(n)});class pl extends mt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.array)return Le(r,{code:Oe.invalid_type,expected:Ie.array,received:r.parsedType}),$e;if(r.data.length<this._def.items.length)return Le(r,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$e;!this._def.rest&&r.data.length>this._def.items.length&&(Le(r,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const l=[...r.data].map((o,c)=>{const f=this._def.items[c]||this._def.rest;return f?f._parse(new Xa(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(l).then(o=>Jn.mergeArray(n,o)):Jn.mergeArray(n,l)}get items(){return this._def.items}rest(t){return new pl({...this._def,rest:t})}}pl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pl({items:e,typeName:Qe.ZodTuple,rest:null,...at(t)})};class k1 extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.object)return Le(r,{code:Oe.invalid_type,expected:Ie.object,received:r.parsedType}),$e;const i=[],l=this._def.keyType,o=this._def.valueType;for(const c in r.data)i.push({key:l._parse(new Xa(r,c,r.path,c)),value:o._parse(new Xa(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?Jn.mergeObjectAsync(n,i):Jn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof mt?new k1({keyType:t,valueType:n,typeName:Qe.ZodRecord,...at(r)}):new k1({keyType:Ni.create(),valueType:t,typeName:Qe.ZodRecord,...at(n)})}}class Cx extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.map)return Le(r,{code:Oe.invalid_type,expected:Ie.map,received:r.parsedType}),$e;const i=this._def.keyType,l=this._def.valueType,o=[...r.data.entries()].map(([c,f],p)=>({key:i._parse(new Xa(r,c,r.path,[p,"key"])),value:l._parse(new Xa(r,f,r.path,[p,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const f of o){const p=await f.key,y=await f.value;if(p.status==="aborted"||y.status==="aborted")return $e;(p.status==="dirty"||y.status==="dirty")&&n.dirty(),c.set(p.value,y.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const f of o){const p=f.key,y=f.value;if(p.status==="aborted"||y.status==="aborted")return $e;(p.status==="dirty"||y.status==="dirty")&&n.dirty(),c.set(p.value,y.value)}return{status:n.value,value:c}}}}Cx.create=(e,t,n)=>new Cx({valueType:t,keyType:e,typeName:Qe.ZodMap,...at(n)});class jc extends mt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.set)return Le(r,{code:Oe.invalid_type,expected:Ie.set,received:r.parsedType}),$e;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Le(r,{code:Oe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Le(r,{code:Oe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const l=this._def.valueType;function o(f){const p=new Set;for(const y of f){if(y.status==="aborted")return $e;y.status==="dirty"&&n.dirty(),p.add(y.value)}return{status:n.value,value:p}}const c=[...r.data.values()].map((f,p)=>l._parse(new Xa(r,f,r.path,p)));return r.common.async?Promise.all(c).then(f=>o(f)):o(c)}min(t,n){return new jc({...this._def,minSize:{value:t,message:Ue.toString(n)}})}max(t,n){return new jc({...this._def,maxSize:{value:t,message:Ue.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}jc.create=(e,t)=>new jc({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...at(t)});class bg extends mt{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}bg.create=(e,t)=>new bg({getter:e,typeName:Qe.ZodLazy,...at(t)});class M1 extends mt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Le(n,{received:n.data,code:Oe.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:t.data}}get value(){return this._def.value}}M1.create=(e,t)=>new M1({value:e,typeName:Qe.ZodLiteral,...at(t)});function US(e,t){return new gl({values:e,typeName:Qe.ZodEnum,...at(t)})}class gl extends mt{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Le(n,{expected:Et.joinValues(r),received:n.parsedType,code:Oe.invalid_type}),$e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Le(n,{received:n.data,code:Oe.invalid_enum_value,options:r}),$e}return la(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return gl.create(t,{...this._def,...n})}exclude(t,n=this._def){return gl.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}gl.create=US;class vg extends mt{_parse(t){const n=Et.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ie.string&&r.parsedType!==Ie.number){const i=Et.objectValues(n);return Le(r,{expected:Et.joinValues(i),received:r.parsedType,code:Oe.invalid_type}),$e}if(this._cache||(this._cache=new Set(Et.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Et.objectValues(n);return Le(r,{received:r.data,code:Oe.invalid_enum_value,options:i}),$e}return la(t.data)}get enum(){return this._def.values}}vg.create=(e,t)=>new vg({values:e,typeName:Qe.ZodNativeEnum,...at(t)});class L1 extends mt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ie.promise&&n.common.async===!1)return Le(n,{code:Oe.invalid_type,expected:Ie.promise,received:n.parsedType}),$e;const r=n.parsedType===Ie.promise?n.data:Promise.resolve(n.data);return la(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}L1.create=(e,t)=>new L1({type:e,typeName:Qe.ZodPromise,...at(t)});class yl extends mt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,l={addIssue:o=>{Le(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(l.addIssue=l.addIssue.bind(l),i.type==="preprocess"){const o=i.transform(r.data,l);if(r.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return $e;const f=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return f.status==="aborted"?$e:f.status==="dirty"||n.value==="dirty"?uc(f.value):f});{if(n.value==="aborted")return $e;const c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?$e:c.status==="dirty"||n.value==="dirty"?uc(c.value):c}}if(i.type==="refinement"){const o=c=>{const f=i.refinement(c,l);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?$e:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?$e:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!zo(o))return $e;const c=i.transform(o.value,l);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>zo(o)?Promise.resolve(i.transform(o.value,l)).then(c=>({status:n.value,value:c})):$e);Et.assertNever(i)}}yl.create=(e,t,n)=>new yl({schema:e,typeName:Qe.ZodEffects,effect:t,...at(n)});yl.createWithPreprocess=(e,t,n)=>new yl({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...at(n)});class Ri extends mt{_parse(t){return this._getType(t)===Ie.undefined?la(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ri.create=(e,t)=>new Ri({innerType:e,typeName:Qe.ZodOptional,...at(t)});class bl extends mt{_parse(t){return this._getType(t)===Ie.null?la(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}bl.create=(e,t)=>new bl({innerType:e,typeName:Qe.ZodNullable,...at(t)});class D1 extends mt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ie.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}D1.create=(e,t)=>new D1({innerType:e,typeName:Qe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...at(t)});class I1 extends mt{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return w1(i)?i.then(l=>({status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new Di(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Di(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}I1.create=(e,t)=>new I1({innerType:e,typeName:Qe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...at(t)});class wx extends mt{_parse(t){if(this._getType(t)!==Ie.nan){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.nan,received:r.parsedType}),$e}return{status:"valid",value:t.data}}}wx.create=e=>new wx({typeName:Qe.ZodNaN,...at(e)});class VS extends mt{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class T6 extends mt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?$e:l.status==="dirty"?(n.dirty(),uc(l.value)):this._def.out._parseAsync({data:l.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?$e:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new T6({in:t,out:n,typeName:Qe.ZodPipeline})}}class P1 extends mt{_parse(t){const n=this._def.innerType._parse(t),r=i=>(zo(i)&&(i.value=Object.freeze(i.value)),i);return w1(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}P1.create=(e,t)=>new P1({innerType:e,typeName:Qe.ZodReadonly,...at(t)});var Qe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Qe||(Qe={}));const xn=Ni.create;Ss.create;const Eg=$a.create,ga=En.create;O1.create;const ZX=A6.create;R1.create;pl.create;const zS=k1.create,ZS=M1.create;gl.create;L1.create;Ri.create;bl.create;var h0=e=>e.type==="checkbox",rl=e=>e instanceof Date,mr=e=>e==null;const qS=e=>typeof e=="object";var An=e=>!mr(e)&&!Array.isArray(e)&&qS(e)&&!rl(e),YS=e=>An(e)&&e.target?h0(e.target)?e.target.checked:e.target.value:e,qX=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,$S=(e,t)=>e.has(qX(t)),YX=e=>{const t=e.constructor&&e.constructor.prototype;return An(t)&&t.hasOwnProperty("isPrototypeOf")},_6=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Yt(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(_6&&(e instanceof Blob||r))&&(n||An(e)))if(t=n?[]:Object.create(Object.getPrototypeOf(e)),!n&&!YX(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=Yt(e[i]));else return e;return t}var Gf=e=>/^\w*$/.test(e),Bt=e=>e===void 0,Kf=e=>Array.isArray(e)?e.filter(Boolean):[],S6=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Re=(e,t,n)=>{if(!t||!An(e))return n;const r=(Gf(t)?[t]:S6(t)).reduce((i,l)=>mr(i)?i:i[l],e);return Bt(r)||r===e?Bt(e[t])?n:e[t]:r},Nr=e=>typeof e=="boolean",St=(e,t,n)=>{let r=-1;const i=Gf(t)?[t]:S6(t),l=i.length,o=l-1;for(;++r<l;){const c=i[r];let f=n;if(r!==o){const p=e[c];f=An(p)||Array.isArray(p)?p:isNaN(+i[r+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;e[c]=f,e=e[c]}};const j1={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Xr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},_i={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},C6=J.createContext(null);C6.displayName="HookFormContext";const Ca=()=>J.useContext(C6),w6=e=>{const{children:t,...n}=e;return J.createElement(C6.Provider,{value:n},t)};var QS=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const l in e)Object.defineProperty(i,l,{get:()=>{const o=l;return t._proxyFormState[o]!==Xr.all&&(t._proxyFormState[o]=!r||Xr.all),n&&(n[o]=!0),e[o]}});return i};const Xf=typeof window<"u"?J.useLayoutEffect:J.useEffect;function $X(e){const t=Ca(),{control:n=t.control,disabled:r,name:i,exact:l}=e||{},[o,c]=J.useState(n._formState),f=J.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Xf(()=>n._subscribe({name:i,formState:f.current,exact:l,callback:p=>{!r&&c({...n._formState,...p})}}),[i,r,l]),J.useEffect(()=>{f.current.isValid&&n._setValid(!0)},[n]),J.useMemo(()=>QS(o,n,f.current,!1),[o,n])}var Mr=e=>typeof e=="string",GS=(e,t,n,r,i)=>Mr(e)?(r&&t.watch.add(e),Re(n,e,i)):Array.isArray(e)?e.map(l=>(r&&t.watch.add(l),Re(n,l))):(r&&(t.watchAll=!0),n),xg=e=>mr(e)||!qS(e);function wi(e,t,n=new WeakSet){if(xg(e)||xg(t))return e===t;if(rl(e)&&rl(t))return e.getTime()===t.getTime();const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const l of r){const o=e[l];if(!i.includes(l))return!1;if(l!=="ref"){const c=t[l];if(rl(o)&&rl(c)||An(o)&&An(c)||Array.isArray(o)&&Array.isArray(c)?!wi(o,c,n):o!==c)return!1}}return!0}function KS(e){const t=Ca(),{control:n=t.control,name:r,defaultValue:i,disabled:l,exact:o,compute:c}=e||{},f=J.useRef(i),p=J.useRef(c),y=J.useRef(void 0);p.current=c;const g=J.useMemo(()=>n._getWatch(r,f.current),[n,r]),[x,A]=J.useState(p.current?p.current(g):g);return Xf(()=>n._subscribe({name:r,formState:{values:!0},exact:o,callback:S=>{if(!l){const _=GS(r,n._names,S.values||n._formValues,!1,f.current);if(p.current){const w=p.current(_);wi(w,y.current)||(A(w),y.current=w)}else A(_)}}}),[n,l,r,o]),J.useEffect(()=>n._removeUnmounted()),x}function QX(e){const t=Ca(),{name:n,disabled:r,control:i=t.control,shouldUnregister:l,defaultValue:o}=e,c=$S(i._names.array,n),f=J.useMemo(()=>Re(i._formValues,n,Re(i._defaultValues,n,o)),[i,n,o]),p=KS({control:i,name:n,defaultValue:f,exact:!0}),y=$X({control:i,name:n,exact:!0}),g=J.useRef(e),x=J.useRef(void 0),A=J.useRef(i.register(n,{...e.rules,value:p,...Nr(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const S=J.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Re(y.errors,n)},isDirty:{enumerable:!0,get:()=>!!Re(y.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Re(y.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Re(y.validatingFields,n)},error:{enumerable:!0,get:()=>Re(y.errors,n)}}),[y,n]),_=J.useCallback(D=>A.current.onChange({target:{value:YS(D),name:n},type:j1.CHANGE}),[n]),w=J.useCallback(()=>A.current.onBlur({target:{value:Re(i._formValues,n),name:n},type:j1.BLUR}),[n,i._formValues]),C=J.useCallback(D=>{const P=Re(i._fields,n);P&&D&&(P._f.ref={focus:()=>D.focus&&D.focus(),select:()=>D.select&&D.select(),setCustomValidity:U=>D.setCustomValidity(U),reportValidity:()=>D.reportValidity()})},[i._fields,n]),R=J.useMemo(()=>({name:n,value:p,...Nr(r)||y.disabled?{disabled:y.disabled||r}:{},onChange:_,onBlur:w,ref:C}),[n,r,y.disabled,_,w,C,p]);return J.useEffect(()=>{const D=i._options.shouldUnregister||l,P=x.current;P&&P!==n&&!c&&i.unregister(P),i.register(n,{...g.current.rules,...Nr(g.current.disabled)?{disabled:g.current.disabled}:{}});const U=(k,H)=>{const j=Re(i._fields,k);j&&j._f&&(j._f.mount=H)};if(U(n,!0),D){const k=Yt(Re(i._options.defaultValues,n,g.current.defaultValue));St(i._defaultValues,n,k),Bt(Re(i._formValues,n))&&St(i._formValues,n,k)}return!c&&i.register(n),x.current=n,()=>{(c?D&&!i._state.action:D)?i.unregister(n):U(n,!1)}},[n,i,c,l]),J.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),J.useMemo(()=>({field:R,formState:y,fieldState:S}),[R,y,S])}const GX=e=>e.render(QX(e));var N6=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},pr=e=>Array.isArray(e)?e:[e],Nx=()=>{let e=[];return{get observers(){return e},next:i=>{for(const l of e)l.next&&l.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(l=>l!==i)}}),unsubscribe:()=>{e=[]}}};function XS(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],l=t[r];if(i&&An(i)&&l){const o=XS(i,l);An(o)&&(n[r]=o)}else e[r]&&(n[r]=l)}return n}var Gn=e=>An(e)&&!Object.keys(e).length,O6=e=>e.type==="file",ma=e=>typeof e=="function",H1=e=>{if(!_6)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},WS=e=>e.type==="select-multiple",R6=e=>e.type==="radio",KX=e=>R6(e)||h0(e),sp=e=>H1(e)&&e.isConnected;function XX(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Bt(e)?r++:e[t[r++]];return e}function WX(e){for(const t in e)if(e.hasOwnProperty(t)&&!Bt(e[t]))return!1;return!0}function cn(e,t){const n=Array.isArray(t)?t:Gf(t)?[t]:S6(t),r=n.length===1?e:XX(e,n),i=n.length-1,l=n[i];return r&&delete r[l],i!==0&&(An(r)&&Gn(r)||Array.isArray(r)&&WX(r))&&cn(e,n.slice(0,-1)),e}var JX=e=>{for(const t in e)if(ma(e[t]))return!0;return!1};function JS(e){return Array.isArray(e)||An(e)&&!JX(e)}function Ag(e,t={}){for(const n in e)JS(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Ag(e[n],t[n])):Bt(e[n])||(t[n]=!0);return t}function Co(e,t,n){n||(n=Ag(t));for(const r in e)JS(e[r])?Bt(t)||xg(n[r])?n[r]=Ag(e[r],Array.isArray(e[r])?[]:{}):Co(e[r],mr(t)?{}:t[r],n[r]):n[r]=!wi(e[r],t[r]);return n}const Ox={value:!1,isValid:!1},Rx={value:!0,isValid:!0};var eC=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Bt(e[0].attributes.value)?Bt(e[0].value)||e[0].value===""?Rx:{value:e[0].value,isValid:!0}:Rx:Ox}return Ox},tC=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Bt(e)?e:t?e===""?NaN:e&&+e:n&&Mr(e)?new Date(e):r?r(e):e;const kx={isValid:!1,value:null};var nC=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,kx):kx;function Mx(e){const t=e.ref;return O6(t)?t.files:R6(t)?nC(e.refs).value:WS(t)?[...t.selectedOptions].map(({value:n})=>n):h0(t)?eC(e.refs).value:tC(Bt(t.value)?e.ref.value:t.value,e)}var eW=(e,t,n,r)=>{const i={};for(const l of e){const o=Re(t,l);o&&St(i,l,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},F1=e=>e instanceof RegExp,sc=e=>Bt(e)?e:F1(e)?e.source:An(e)?F1(e.value)?e.value.source:e.value:e,Oo=e=>({isOnSubmit:!e||e===Xr.onSubmit,isOnBlur:e===Xr.onBlur,isOnChange:e===Xr.onChange,isOnAll:e===Xr.all,isOnTouch:e===Xr.onTouched});const Lx="AsyncFunction";var tW=e=>!!e&&!!e.validate&&!!(ma(e.validate)&&e.validate.constructor.name===Lx||An(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Lx)),nW=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Tg=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Po=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const l=Re(e,i);if(l){const{_f:o,...c}=l;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],i)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(Po(c,t))break}else if(An(c)&&Po(c,t))break}}};function Dx(e,t,n){const r=Re(e,n);if(r||Gf(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const l=i.join("."),o=Re(t,l),c=Re(e,l);if(o&&!Array.isArray(o)&&n!==l)return{name:n};if(c&&c.type)return{name:l,error:c};if(c&&c.root&&c.root.type)return{name:`${l}.root`,error:c.root};i.pop()}return{name:n}}var rW=(e,t,n,r)=>{n(e);const{name:i,...l}=e;return Gn(l)||Object.keys(l).length>=Object.keys(t).length||Object.keys(l).find(o=>t[o]===(!r||Xr.all))},aW=(e,t,n)=>!e||!t||e===t||pr(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),iW=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,sW=(e,t)=>!Kf(Re(e,t)).length&&cn(e,t),rC=(e,t,n)=>{const r=pr(Re(e,n));return St(r,"root",t[n]),St(e,n,r),e};function Ix(e,t,n="validate"){if(Mr(e)||Array.isArray(e)&&e.every(Mr)||Nr(e)&&!e)return{type:n,message:Mr(e)?e:"",ref:t}}var To=e=>An(e)&&!F1(e)?e:{value:e,message:""},_g=async(e,t,n,r,i,l)=>{const{ref:o,refs:c,required:f,maxLength:p,minLength:y,min:g,max:x,pattern:A,validate:S,name:_,valueAsNumber:w,mount:C}=e._f,R=Re(n,_);if(!C||t.has(_))return{};const D=c?c[0]:o,P=K=>{i&&D.reportValidity&&(D.setCustomValidity(Nr(K)?"":K||""),D.reportValidity())},U={},k=R6(o),H=h0(o),j=k||H,ee=(w||O6(o))&&Bt(o.value)&&Bt(R)||H1(o)&&o.value===""||R===""||Array.isArray(R)&&!R.length,B=N6.bind(null,_,r,U),ne=(K,W,ie,he=_i.maxLength,F=_i.minLength)=>{const $=K?W:ie;U[_]={type:K?he:F,message:$,ref:o,...B(K?he:F,$)}};if(l?!Array.isArray(R)||!R.length:f&&(!j&&(ee||mr(R))||Nr(R)&&!R||H&&!eC(c).isValid||k&&!nC(c).isValid)){const{value:K,message:W}=Mr(f)?{value:!!f,message:f}:To(f);if(K&&(U[_]={type:_i.required,message:W,ref:D,...B(_i.required,W)},!r))return P(W),U}if(!ee&&(!mr(g)||!mr(x))){let K,W;const ie=To(x),he=To(g);if(!mr(R)&&!isNaN(R)){const F=o.valueAsNumber||R&&+R;mr(ie.value)||(K=F>ie.value),mr(he.value)||(W=F<he.value)}else{const F=o.valueAsDate||new Date(R),$=L=>new Date(new Date().toDateString()+" "+L),Q=o.type=="time",fe=o.type=="week";Mr(ie.value)&&R&&(K=Q?$(R)>$(ie.value):fe?R>ie.value:F>new Date(ie.value)),Mr(he.value)&&R&&(W=Q?$(R)<$(he.value):fe?R<he.value:F<new Date(he.value))}if((K||W)&&(ne(!!K,ie.message,he.message,_i.max,_i.min),!r))return P(U[_].message),U}if((p||y)&&!ee&&(Mr(R)||l&&Array.isArray(R))){const K=To(p),W=To(y),ie=!mr(K.value)&&R.length>+K.value,he=!mr(W.value)&&R.length<+W.value;if((ie||he)&&(ne(ie,K.message,W.message),!r))return P(U[_].message),U}if(A&&!ee&&Mr(R)){const{value:K,message:W}=To(A);if(F1(K)&&!R.match(K)&&(U[_]={type:_i.pattern,message:W,ref:o,...B(_i.pattern,W)},!r))return P(W),U}if(S){if(ma(S)){const K=await S(R,n),W=Ix(K,D);if(W&&(U[_]={...W,...B(_i.validate,W.message)},!r))return P(W.message),U}else if(An(S)){let K={};for(const W in S){if(!Gn(K)&&!r)break;const ie=Ix(await S[W](R,n),D,W);ie&&(K={...ie,...B(W,ie.message)},P(ie.message),r&&(U[_]=K))}if(!Gn(K)&&(U[_]={ref:D,...K},!r))return U}}return P(!0),U};const lW={mode:Xr.onSubmit,reValidateMode:Xr.onChange,shouldFocusError:!0};function oW(e={}){let t={...lW,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:ma(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=An(t.defaultValues)||An(t.values)?Yt(t.defaultValues||t.values)||{}:{},l=t.shouldUnregister?{}:Yt(i),o={action:!1,mount:!1,watch:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},f,p=0;const y={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let g={...y};const x={array:Nx(),state:Nx()},A=t.criteriaMode===Xr.all,S=q=>se=>{clearTimeout(p),p=setTimeout(q,se)},_=async q=>{if(!t.disabled&&(y.isValid||g.isValid||q)){const se=t.resolver?Gn((await H()).errors):await ee(r,!0);se!==n.isValid&&x.state.next({isValid:se})}},w=(q,se)=>{!t.disabled&&(y.isValidating||y.validatingFields||g.isValidating||g.validatingFields)&&((q||Array.from(c.mount)).forEach(ce=>{ce&&(se?St(n.validatingFields,ce,se):cn(n.validatingFields,ce))}),x.state.next({validatingFields:n.validatingFields,isValidating:!Gn(n.validatingFields)}))},C=(q,se=[],ce,ke,Te=!0,Ce=!0)=>{if(ke&&ce&&!t.disabled){if(o.action=!0,Ce&&Array.isArray(Re(r,q))){const G=ce(Re(r,q),ke.argA,ke.argB);Te&&St(r,q,G)}if(Ce&&Array.isArray(Re(n.errors,q))){const G=ce(Re(n.errors,q),ke.argA,ke.argB);Te&&St(n.errors,q,G),sW(n.errors,q)}if((y.touchedFields||g.touchedFields)&&Ce&&Array.isArray(Re(n.touchedFields,q))){const G=ce(Re(n.touchedFields,q),ke.argA,ke.argB);Te&&St(n.touchedFields,q,G)}(y.dirtyFields||g.dirtyFields)&&(n.dirtyFields=Co(i,l)),x.state.next({name:q,isDirty:ne(q,se),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else St(l,q,se)},R=(q,se)=>{St(n.errors,q,se),x.state.next({errors:n.errors})},D=q=>{n.errors=q,x.state.next({errors:n.errors,isValid:!1})},P=(q,se,ce,ke)=>{const Te=Re(r,q);if(Te){const Ce=Re(l,q,Bt(ce)?Re(i,q):ce);Bt(Ce)||ke&&ke.defaultChecked||se?St(l,q,se?Ce:Mx(Te._f)):ie(q,Ce),o.mount&&_()}},U=(q,se,ce,ke,Te)=>{let Ce=!1,G=!1;const ve={name:q};if(!t.disabled){if(!ce||ke){(y.isDirty||g.isDirty)&&(G=n.isDirty,n.isDirty=ve.isDirty=ne(),Ce=G!==ve.isDirty);const Me=wi(Re(i,q),se);G=!!Re(n.dirtyFields,q),Me?cn(n.dirtyFields,q):St(n.dirtyFields,q,!0),ve.dirtyFields=n.dirtyFields,Ce=Ce||(y.dirtyFields||g.dirtyFields)&&G!==!Me}if(ce){const Me=Re(n.touchedFields,q);Me||(St(n.touchedFields,q,ce),ve.touchedFields=n.touchedFields,Ce=Ce||(y.touchedFields||g.touchedFields)&&Me!==ce)}Ce&&Te&&x.state.next(ve)}return Ce?ve:{}},k=(q,se,ce,ke)=>{const Te=Re(n.errors,q),Ce=(y.isValid||g.isValid)&&Nr(se)&&n.isValid!==se;if(t.delayError&&ce?(f=S(()=>R(q,ce)),f(t.delayError)):(clearTimeout(p),f=null,ce?St(n.errors,q,ce):cn(n.errors,q)),(ce?!wi(Te,ce):Te)||!Gn(ke)||Ce){const G={...ke,...Ce&&Nr(se)?{isValid:se}:{},errors:n.errors,name:q};n={...n,...G},x.state.next(G)}},H=async q=>{w(q,!0);const se=await t.resolver(l,t.context,eW(q||c.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return w(q),se},j=async q=>{const{errors:se}=await H(q);if(q)for(const ce of q){const ke=Re(se,ce);ke?St(n.errors,ce,ke):cn(n.errors,ce)}else n.errors=se;return se},ee=async(q,se,ce={valid:!0})=>{for(const ke in q){const Te=q[ke];if(Te){const{_f:Ce,...G}=Te;if(Ce){const ve=c.array.has(Ce.name),Me=Te._f&&tW(Te._f);Me&&y.validatingFields&&w([Ce.name],!0);const ze=await _g(Te,c.disabled,l,A,t.shouldUseNativeValidation&&!se,ve);if(Me&&y.validatingFields&&w([Ce.name]),ze[Ce.name]&&(ce.valid=!1,se))break;!se&&(Re(ze,Ce.name)?ve?rC(n.errors,ze,Ce.name):St(n.errors,Ce.name,ze[Ce.name]):cn(n.errors,Ce.name))}!Gn(G)&&await ee(G,se,ce)}}return ce.valid},B=()=>{for(const q of c.unMount){const se=Re(r,q);se&&(se._f.refs?se._f.refs.every(ce=>!sp(ce)):!sp(se._f.ref))&&Se(q)}c.unMount=new Set},ne=(q,se)=>!t.disabled&&(q&&se&&St(l,q,se),!wi(L(),i)),K=(q,se,ce)=>GS(q,c,{...o.mount?l:Bt(se)?i:Mr(q)?{[q]:se}:se},ce,se),W=q=>Kf(Re(o.mount?l:i,q,t.shouldUnregister?Re(i,q,[]):[])),ie=(q,se,ce={})=>{const ke=Re(r,q);let Te=se;if(ke){const Ce=ke._f;Ce&&(!Ce.disabled&&St(l,q,tC(se,Ce)),Te=H1(Ce.ref)&&mr(se)?"":se,WS(Ce.ref)?[...Ce.ref.options].forEach(G=>G.selected=Te.includes(G.value)):Ce.refs?h0(Ce.ref)?Ce.refs.forEach(G=>{(!G.defaultChecked||!G.disabled)&&(Array.isArray(Te)?G.checked=!!Te.find(ve=>ve===G.value):G.checked=Te===G.value||!!Te)}):Ce.refs.forEach(G=>G.checked=G.value===Te):O6(Ce.ref)?Ce.ref.value="":(Ce.ref.value=Te,Ce.ref.type||x.state.next({name:q,values:Yt(l)})))}(ce.shouldDirty||ce.shouldTouch)&&U(q,Te,ce.shouldTouch,ce.shouldDirty,!0),ce.shouldValidate&&fe(q)},he=(q,se,ce)=>{for(const ke in se){if(!se.hasOwnProperty(ke))return;const Te=se[ke],Ce=q+"."+ke,G=Re(r,Ce);(c.array.has(q)||An(Te)||G&&!G._f)&&!rl(Te)?he(Ce,Te,ce):ie(Ce,Te,ce)}},F=(q,se,ce={})=>{const ke=Re(r,q),Te=c.array.has(q),Ce=Yt(se);St(l,q,Ce),Te?(x.array.next({name:q,values:Yt(l)}),(y.isDirty||y.dirtyFields||g.isDirty||g.dirtyFields)&&ce.shouldDirty&&x.state.next({name:q,dirtyFields:Co(i,l),isDirty:ne(q,Ce)})):ke&&!ke._f&&!mr(Ce)?he(q,Ce,ce):ie(q,Ce,ce),Tg(q,c)&&x.state.next({...n,name:q}),x.state.next({name:o.mount?q:void 0,values:Yt(l)})},$=async q=>{o.mount=!0;const se=q.target;let ce=se.name,ke=!0;const Te=Re(r,ce),Ce=Me=>{ke=Number.isNaN(Me)||rl(Me)&&isNaN(Me.getTime())||wi(Me,Re(l,ce,Me))},G=Oo(t.mode),ve=Oo(t.reValidateMode);if(Te){let Me,ze;const We=se.type?Mx(Te._f):YS(q),Vt=q.type===j1.BLUR||q.type===j1.FOCUS_OUT,Nn=!nW(Te._f)&&!t.resolver&&!Re(n.errors,ce)&&!Te._f.deps||iW(Vt,Re(n.touchedFields,ce),n.isSubmitted,ve,G),ln=Tg(ce,c,Vt);St(l,ce,We),Vt?(!se||!se.readOnly)&&(Te._f.onBlur&&Te._f.onBlur(q),f&&f(0)):Te._f.onChange&&Te._f.onChange(q);const zt=U(ce,We,Vt),_n=!Gn(zt)||ln;if(!Vt&&x.state.next({name:ce,type:q.type,values:Yt(l)}),Nn)return(y.isValid||g.isValid)&&(t.mode==="onBlur"?Vt&&_():Vt||_()),_n&&x.state.next({name:ce,...ln?{}:zt});if(!Vt&&ln&&x.state.next({...n}),t.resolver){const{errors:vt}=await H([ce]);if(Ce(We),ke){const jr=Dx(n.errors,r,ce),On=Dx(vt,r,jr.name||ce);Me=On.error,ce=On.name,ze=Gn(vt)}}else w([ce],!0),Me=(await _g(Te,c.disabled,l,A,t.shouldUseNativeValidation))[ce],w([ce]),Ce(We),ke&&(Me?ze=!1:(y.isValid||g.isValid)&&(ze=await ee(r,!0)));ke&&(Te._f.deps&&(!Array.isArray(Te._f.deps)||Te._f.deps.length>0)&&fe(Te._f.deps),k(ce,ze,Me,zt))}},Q=(q,se)=>{if(Re(n.errors,se)&&q.focus)return q.focus(),1},fe=async(q,se={})=>{let ce,ke;const Te=pr(q);if(t.resolver){const Ce=await j(Bt(q)?q:Te);ce=Gn(Ce),ke=q?!Te.some(G=>Re(Ce,G)):ce}else q?(ke=(await Promise.all(Te.map(async Ce=>{const G=Re(r,Ce);return await ee(G&&G._f?{[Ce]:G}:G)}))).every(Boolean),!(!ke&&!n.isValid)&&_()):ke=ce=await ee(r);return x.state.next({...!Mr(q)||(y.isValid||g.isValid)&&ce!==n.isValid?{}:{name:q},...t.resolver||!q?{isValid:ce}:{},errors:n.errors}),se.shouldFocus&&!ke&&Po(r,Q,q?Te:c.mount),ke},L=(q,se)=>{let ce={...o.mount?l:i};return se&&(ce=XS(se.dirtyFields?n.dirtyFields:n.touchedFields,ce)),Bt(q)?ce:Mr(q)?Re(ce,q):q.map(ke=>Re(ce,ke))},V=(q,se)=>({invalid:!!Re((se||n).errors,q),isDirty:!!Re((se||n).dirtyFields,q),error:Re((se||n).errors,q),isValidating:!!Re(n.validatingFields,q),isTouched:!!Re((se||n).touchedFields,q)}),re=q=>{q&&pr(q).forEach(se=>cn(n.errors,se)),x.state.next({errors:q?n.errors:{}})},O=(q,se,ce)=>{const ke=(Re(r,q,{_f:{}})._f||{}).ref,Te=Re(n.errors,q)||{},{ref:Ce,message:G,type:ve,...Me}=Te;St(n.errors,q,{...Me,...se,ref:ke}),x.state.next({name:q,errors:n.errors,isValid:!1}),ce&&ce.shouldFocus&&ke&&ke.focus&&ke.focus()},ue=(q,se)=>ma(q)?x.state.subscribe({next:ce=>"values"in ce&&q(K(void 0,se),ce)}):K(q,se,!0),be=q=>x.state.subscribe({next:se=>{aW(q.name,se.name,q.exact)&&rW(se,q.formState||y,Pr,q.reRenderRoot)&&q.callback({values:{...l},...n,...se,defaultValues:i})}}).unsubscribe,xe=q=>(o.mount=!0,g={...g,...q.formState},be({...q,formState:g})),Se=(q,se={})=>{for(const ce of q?pr(q):c.mount)c.mount.delete(ce),c.array.delete(ce),se.keepValue||(cn(r,ce),cn(l,ce)),!se.keepError&&cn(n.errors,ce),!se.keepDirty&&cn(n.dirtyFields,ce),!se.keepTouched&&cn(n.touchedFields,ce),!se.keepIsValidating&&cn(n.validatingFields,ce),!t.shouldUnregister&&!se.keepDefaultValue&&cn(i,ce);x.state.next({values:Yt(l)}),x.state.next({...n,...se.keepDirty?{isDirty:ne()}:{}}),!se.keepIsValid&&_()},Pe=({disabled:q,name:se})=>{(Nr(q)&&o.mount||q||c.disabled.has(se))&&(q?c.disabled.add(se):c.disabled.delete(se))},Ge=(q,se={})=>{let ce=Re(r,q);const ke=Nr(se.disabled)||Nr(t.disabled);return St(r,q,{...ce||{},_f:{...ce&&ce._f?ce._f:{ref:{name:q}},name:q,mount:!0,...se}}),c.mount.add(q),ce?Pe({disabled:Nr(se.disabled)?se.disabled:t.disabled,name:q}):P(q,!0,se.value),{...ke?{disabled:se.disabled||t.disabled}:{},...t.progressive?{required:!!se.required,min:sc(se.min),max:sc(se.max),minLength:sc(se.minLength),maxLength:sc(se.maxLength),pattern:sc(se.pattern)}:{},name:q,onChange:$,onBlur:$,ref:Te=>{if(Te){Ge(q,se),ce=Re(r,q);const Ce=Bt(Te.value)&&Te.querySelectorAll&&Te.querySelectorAll("input,select,textarea")[0]||Te,G=KX(Ce),ve=ce._f.refs||[];if(G?ve.find(Me=>Me===Ce):Ce===ce._f.ref)return;St(r,q,{_f:{...ce._f,...G?{refs:[...ve.filter(sp),Ce,...Array.isArray(Re(i,q))?[{}]:[]],ref:{type:Ce.type,name:q}}:{ref:Ce}}}),P(q,!1,void 0,Ce)}else ce=Re(r,q,{}),ce._f&&(ce._f.mount=!1),(t.shouldUnregister||se.shouldUnregister)&&!($S(c.array,q)&&o.action)&&c.unMount.add(q)}}},kt=()=>t.shouldFocusError&&Po(r,Q,c.mount),en=q=>{Nr(q)&&(x.state.next({disabled:q}),Po(r,(se,ce)=>{const ke=Re(r,ce);ke&&(se.disabled=ke._f.disabled||q,Array.isArray(ke._f.refs)&&ke._f.refs.forEach(Te=>{Te.disabled=ke._f.disabled||q}))},0,!1))},tn=(q,se)=>async ce=>{let ke;ce&&(ce.preventDefault&&ce.preventDefault(),ce.persist&&ce.persist());let Te=Yt(l);if(x.state.next({isSubmitting:!0}),t.resolver){const{errors:Ce,values:G}=await H();n.errors=Ce,Te=Yt(G)}else await ee(r);if(c.disabled.size)for(const Ce of c.disabled)cn(Te,Ce);if(cn(n.errors,"root"),Gn(n.errors)){x.state.next({errors:{}});try{await q(Te,ce)}catch(Ce){ke=Ce}}else se&&await se({...n.errors},ce),kt(),setTimeout(kt);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gn(n.errors)&&!ke,submitCount:n.submitCount+1,errors:n.errors}),ke)throw ke},br=(q,se={})=>{Re(r,q)&&(Bt(se.defaultValue)?F(q,Yt(Re(i,q))):(F(q,se.defaultValue),St(i,q,Yt(se.defaultValue))),se.keepTouched||cn(n.touchedFields,q),se.keepDirty||(cn(n.dirtyFields,q),n.isDirty=se.defaultValue?ne(q,Yt(Re(i,q))):ne()),se.keepError||(cn(n.errors,q),y.isValid&&_()),x.state.next({...n}))},Un=(q,se={})=>{const ce=q?Yt(q):i,ke=Yt(ce),Te=Gn(q),Ce=Te?i:ke;if(se.keepDefaultValues||(i=ce),!se.keepValues){if(se.keepDirtyValues){const G=new Set([...c.mount,...Object.keys(Co(i,l))]);for(const ve of Array.from(G))Re(n.dirtyFields,ve)?St(Ce,ve,Re(l,ve)):F(ve,Re(Ce,ve))}else{if(_6&&Bt(q))for(const G of c.mount){const ve=Re(r,G);if(ve&&ve._f){const Me=Array.isArray(ve._f.refs)?ve._f.refs[0]:ve._f.ref;if(H1(Me)){const ze=Me.closest("form");if(ze){ze.reset();break}}}}if(se.keepFieldsRef)for(const G of c.mount)F(G,Re(Ce,G));else r={}}l=t.shouldUnregister?se.keepDefaultValues?Yt(i):{}:Yt(Ce),x.array.next({values:{...Ce}}),x.state.next({values:{...Ce}})}c={mount:se.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!y.isValid||!!se.keepIsValid||!!se.keepDirtyValues,o.watch=!!t.shouldUnregister,x.state.next({submitCount:se.keepSubmitCount?n.submitCount:0,isDirty:Te?!1:se.keepDirty?n.isDirty:!!(se.keepDefaultValues&&!wi(q,i)),isSubmitted:se.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Te?{}:se.keepDirtyValues?se.keepDefaultValues&&l?Co(i,l):n.dirtyFields:se.keepDefaultValues&&q?Co(i,q):se.keepDirty?n.dirtyFields:{},touchedFields:se.keepTouched?n.touchedFields:{},errors:se.keepErrors?n.errors:{},isSubmitSuccessful:se.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},oa=(q,se)=>Un(ma(q)?q(l):q,se),ua=(q,se={})=>{const ce=Re(r,q),ke=ce&&ce._f;if(ke){const Te=ke.refs?ke.refs[0]:ke.ref;Te.focus&&(Te.focus(),se.shouldSelect&&ma(Te.select)&&Te.select())}},Pr=q=>{n={...n,...q}},Tn={control:{register:Ge,unregister:Se,getFieldState:V,handleSubmit:tn,setError:O,_subscribe:be,_runSchema:H,_focusError:kt,_getWatch:K,_getDirty:ne,_setValid:_,_setFieldArray:C,_setDisabledField:Pe,_setErrors:D,_getFieldArray:W,_reset:Un,_resetDefaultValues:()=>ma(t.defaultValues)&&t.defaultValues().then(q=>{oa(q,t.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:B,_disableForm:en,_subjects:x,_proxyFormState:y,get _fields(){return r},get _formValues(){return l},get _state(){return o},set _state(q){o=q},get _defaultValues(){return i},get _names(){return c},set _names(q){c=q},get _formState(){return n},get _options(){return t},set _options(q){t={...t,...q}}},subscribe:xe,trigger:fe,register:Ge,handleSubmit:tn,watch:ue,setValue:F,getValues:L,reset:oa,resetField:br,clearErrors:re,unregister:Se,setError:O,setFocus:ua,getFieldState:V};return{...Tn,formControl:Tn}}var ms=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(Math.random()*16+e)%16|0;return(t=="x"?n:n&3|8).toString(16)})},lp=(e,t,n={})=>n.shouldFocus||Bt(n.shouldFocus)?n.focusName||`${e}.${Bt(n.focusIndex)?t:n.focusIndex}.`:"",op=(e,t)=>[...e,...pr(t)],up=e=>Array.isArray(e)?e.map(()=>{}):void 0;function cp(e,t,n){return[...e.slice(0,t),...pr(n),...e.slice(t)]}var dp=(e,t,n)=>Array.isArray(e)?(Bt(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],fp=(e,t)=>[...pr(t),...pr(e)];function uW(e,t){let n=0;const r=[...e];for(const i of t)r.splice(i-n,1),n++;return Kf(r).length?r:[]}var hp=(e,t)=>Bt(t)?[]:uW(e,pr(t).sort((n,r)=>n-r)),mp=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},Px=(e,t,n)=>(e[t]=n,e);function cW(e){const t=Ca(),{control:n=t.control,name:r,keyName:i="id",shouldUnregister:l,rules:o}=e,[c,f]=J.useState(n._getFieldArray(r)),p=J.useRef(n._getFieldArray(r).map(ms)),y=J.useRef(!1);n._names.array.add(r),J.useMemo(()=>o&&c.length>=0&&n.register(r,o),[n,r,c.length,o]),Xf(()=>n._subjects.array.subscribe({next:({values:P,name:U})=>{if(U===r||!U){const k=Re(P,r);Array.isArray(k)&&(f(k),p.current=k.map(ms))}}}).unsubscribe,[n,r]);const g=J.useCallback(P=>{y.current=!0,n._setFieldArray(r,P)},[n,r]),x=(P,U)=>{const k=pr(Yt(P)),H=op(n._getFieldArray(r),k);n._names.focus=lp(r,H.length-1,U),p.current=op(p.current,k.map(ms)),g(H),f(H),n._setFieldArray(r,H,op,{argA:up(P)})},A=(P,U)=>{const k=pr(Yt(P)),H=fp(n._getFieldArray(r),k);n._names.focus=lp(r,0,U),p.current=fp(p.current,k.map(ms)),g(H),f(H),n._setFieldArray(r,H,fp,{argA:up(P)})},S=P=>{const U=hp(n._getFieldArray(r),P);p.current=hp(p.current,P),g(U),f(U),!Array.isArray(Re(n._fields,r))&&St(n._fields,r,void 0),n._setFieldArray(r,U,hp,{argA:P})},_=(P,U,k)=>{const H=pr(Yt(U)),j=cp(n._getFieldArray(r),P,H);n._names.focus=lp(r,P,k),p.current=cp(p.current,P,H.map(ms)),g(j),f(j),n._setFieldArray(r,j,cp,{argA:P,argB:up(U)})},w=(P,U)=>{const k=n._getFieldArray(r);mp(k,P,U),mp(p.current,P,U),g(k),f(k),n._setFieldArray(r,k,mp,{argA:P,argB:U},!1)},C=(P,U)=>{const k=n._getFieldArray(r);dp(k,P,U),dp(p.current,P,U),g(k),f(k),n._setFieldArray(r,k,dp,{argA:P,argB:U},!1)},R=(P,U)=>{const k=Yt(U),H=Px(n._getFieldArray(r),P,k);p.current=[...H].map((j,ee)=>!j||ee===P?ms():p.current[ee]),g(H),f([...H]),n._setFieldArray(r,H,Px,{argA:P,argB:k},!0,!1)},D=P=>{const U=pr(Yt(P));p.current=U.map(ms),g([...U]),f([...U]),n._setFieldArray(r,[...U],k=>k,{},!0,!1)};return J.useEffect(()=>{if(n._state.action=!1,Tg(r,n._names)&&n._subjects.state.next({...n._formState}),y.current&&(!Oo(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!Oo(n._options.reValidateMode).isOnSubmit)if(n._options.resolver)n._runSchema([r]).then(P=>{const U=Re(P.errors,r),k=Re(n._formState.errors,r);(k?!U&&k.type||U&&(k.type!==U.type||k.message!==U.message):U&&U.type)&&(U?St(n._formState.errors,r,U):cn(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{const P=Re(n._fields,r);P&&P._f&&!(Oo(n._options.reValidateMode).isOnSubmit&&Oo(n._options.mode).isOnSubmit)&&_g(P,n._names.disabled,n._formValues,n._options.criteriaMode===Xr.all,n._options.shouldUseNativeValidation,!0).then(U=>!Gn(U)&&n._subjects.state.next({errors:rC(n._formState.errors,U,r)}))}n._subjects.state.next({name:r,values:Yt(n._formValues)}),n._names.focus&&Po(n._fields,(P,U)=>{if(n._names.focus&&U.startsWith(n._names.focus)&&P.focus)return P.focus(),1}),n._names.focus="",n._setValid(),y.current=!1},[c,r,n]),J.useEffect(()=>(!Re(n._formValues,r)&&n._setFieldArray(r),()=>{const P=(U,k)=>{const H=Re(n._fields,U);H&&H._f&&(H._f.mount=k)};n._options.shouldUnregister||l?n.unregister(r):P(r,!1)}),[r,n,i,l]),{swap:J.useCallback(w,[g,r,n]),move:J.useCallback(C,[g,r,n]),prepend:J.useCallback(A,[g,r,n]),append:J.useCallback(x,[g,r,n]),remove:J.useCallback(S,[g,r,n]),insert:J.useCallback(_,[g,r,n]),update:J.useCallback(R,[g,r,n]),replace:J.useCallback(D,[g,r,n]),fields:J.useMemo(()=>c.map((P,U)=>({...P,[i]:p.current[U]||ms()})),[c,i])}}function aC(e={}){const t=J.useRef(void 0),n=J.useRef(void 0),[r,i]=J.useState({isDirty:!1,isValidating:!1,isLoading:ma(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ma(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!ma(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...c}=oW(e);t.current={...c,formState:r}}const l=t.current.control;return l._options=e,Xf(()=>{const o=l._subscribe({formState:l._proxyFormState,callback:()=>i({...l._formState}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),l._formState.isReady=!0,o},[l]),J.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),J.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),J.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),J.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),J.useEffect(()=>{if(l._proxyFormState.isDirty){const o=l._getDirty();o!==r.isDirty&&l._subjects.state.next({isDirty:o})}},[l,r.isDirty]),J.useEffect(()=>{e.values&&!wi(e.values,n.current)?(l._reset(e.values,{keepFieldsRef:!0,...l._options.resetOptions}),n.current=e.values,i(o=>({...o}))):l._resetDefaultValues()},[l,e.values]),J.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),t.current.formState=QS(r,l),t.current}const jx=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Re(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Sg=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?jx(r.ref,n,e):r&&r.refs&&r.refs.forEach(i=>jx(i,n,e))}},Hx=(e,t)=>{t.shouldUseNativeValidation&&Sg(e,t);const n={};for(const r in e){const i=Re(t.fields,r),l=Object.assign(e[r]||{},{ref:i&&i.ref});if(dW(t.names||Object.keys(e),r)){const o=Object.assign({},Re(n,r));St(o,"root",l),St(n,r,o)}else St(n,r,l)}return n},dW=(e,t)=>{const n=Fx(t);return e.some(r=>Fx(r).match(`^${n}\\.\\d+`))};function Fx(e){return e.replace(/\]|\[/g,"")}function iC(e,t,n){function r(c,f){var p;Object.defineProperty(c,"_zod",{value:c._zod??{},enumerable:!1}),(p=c._zod).traits??(p.traits=new Set),c._zod.traits.add(e),t(c,f);for(const y in o.prototype)y in c||Object.defineProperty(c,y,{value:o.prototype[y].bind(c)});c._zod.constr=o,c._zod.def=f}const i=n?.Parent??Object;class l extends i{}Object.defineProperty(l,"name",{value:e});function o(c){var f;const p=n?.Parent?new l:this;r(p,c),(f=p._zod).deferred??(f.deferred=[]);for(const y of p._zod.deferred)y();return p}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class fW extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const hW={};function sC(e){return hW}function mW(e,t){return typeof t=="bigint"?t.toString():t}const lC=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function $d(e){return typeof e=="string"?e:e?.message}function oC(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const i=$d(e.inst?._zod.def?.error?.(e))??$d(t?.error?.(e))??$d(n.customError?.(e))??$d(n.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}const uC=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,mW,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pW=iC("$ZodError",uC),cC=iC("$ZodError",uC,{Parent:Error}),gW=e=>(t,n,r,i)=>{const l=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},l);if(o instanceof Promise)throw new fW;if(o.issues.length){const c=new(i?.Err??e)(o.issues.map(f=>oC(f,l,sC())));throw lC(c,i?.callee),c}return o.value},yW=gW(cC),bW=e=>async(t,n,r,i)=>{const l=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},l);if(o instanceof Promise&&(o=await o),o.issues.length){const c=new(i?.Err??e)(o.issues.map(f=>oC(f,l,sC())));throw lC(c,i?.callee),c}return o.value},vW=bW(cC);function Bx(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function EW(e,t){for(var n={};e.length;){var r=e[0],i=r.code,l=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var c=r.unionErrors[0].errors[0];n[o]={message:c.message,type:c.code}}else n[o]={message:l,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(y){return y.errors.forEach(function(g){return e.push(g)})}),t){var f=n[o].types,p=f&&f[r.code];n[o]=N6(o,t,n,i,p?[].concat(p,r.message):r.message)}e.shift()}return n}function xW(e,t){for(var n={};e.length;){var r=e[0],i=r.code,l=r.message,o=r.path.join(".");if(!n[o])if(r.code==="invalid_union"&&r.errors.length>0){var c=r.errors[0][0];n[o]={message:c.message,type:c.code}}else n[o]={message:l,type:i};if(r.code==="invalid_union"&&r.errors.forEach(function(y){return y.forEach(function(g){return e.push(g)})}),t){var f=n[o].types,p=f&&f[r.code];n[o]=N6(o,t,n,i,p?[].concat(p,r.message):r.message)}e.shift()}return n}function dC(e,t,n){if(n===void 0&&(n={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(e))return function(r,i,l){try{return Promise.resolve(Bx(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(o){return l.shouldUseNativeValidation&&Sg({},l),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(c){return Array.isArray(c?.issues)})(o))return{values:{},errors:Hx(EW(o.errors,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw o}))}catch(o){return Promise.reject(o)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(e))return function(r,i,l){try{return Promise.resolve(Bx(function(){return Promise.resolve((n.mode==="sync"?yW:vW)(e,r,t)).then(function(o){return l.shouldUseNativeValidation&&Sg({},l),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(c){return c instanceof pW})(o))return{values:{},errors:Hx(xW(o.issues,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}function k6(e){return aC({...e,resolver:dC(e.schema,void 0)})}function fC({form:e,className:t,children:n,onSubmit:r}){return m.jsx(w6,{...e,children:m.jsx("form",{onSubmit:e.handleSubmit(r),className:Ae("flex w-full flex-col gap-y-8",t),children:n})})}function M6({schema:e,defaultValues:t,className:n,children:r,onSubmit:i}){const l=k6({schema:e,defaultValues:t});return m.jsx(w6,{...l,children:m.jsx("form",{onSubmit:l.handleSubmit(i),className:Ae("flex w-full flex-col gap-y-8",n),children:r})})}const hC=h.createContext({}),Wf=({...e})=>m.jsx(hC.Provider,{value:{name:e.name},children:m.jsx(GX,{...e})}),Jf=()=>{const e=h.useContext(hC),t=h.useContext(mC),{getFieldState:n,formState:r}=Ca(),i=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:l}=t;return{id:l,name:e.name,formItemId:`${l}-form-item`,formDescriptionId:`${l}-form-item-description`,formMessageId:`${l}-form-item-message`,...i}},mC=h.createContext({});function L6(e){const{className:t,...n}=e,r=h.useId();return m.jsx(mC.Provider,{value:{id:r},children:m.jsx("div",{className:Ae("flex flex-col gap-y-2",t),...n})})}function D6(e){const{className:t,...n}=e,{error:r,formItemId:i}=Jf();return m.jsx(_l,{className:Ae(r&&"text-destructive",t),htmlFor:i,...n})}function I6(e){const{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=Jf();return m.jsx(Bn,{id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function P6(e){const{className:t,...n}=e,{formDescriptionId:r}=Jf();return m.jsx("p",{id:r,className:Ae("text-fg-subtle text-xs",t),...n})}function j6(e){const{className:t,children:n,...r}=e,{error:i,formMessageId:l}=Jf(),o=i?String(i?.message??""):n;return o?m.jsx("p",{id:l,className:Ae("text-accent-red text-sm",t),...r,children:o}):null}function m0({className:e,type:t,...n}){return m.jsx("input",{type:t,className:Ae("flex h-8 w-full min-w-0 rounded-md border border-input bg-surface px-3 py-1 text-sm shadow-xs outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground/70 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",t==="search"&&"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",t==="file"&&"p-0 pr-3 text-muted-foreground/70 italic file:me-3 file:h-full file:border-0 file:border-input file:border-r file:border-solid file:bg-transparent file:px-3 file:font-medium file:text-foreground file:text-sm file:not-italic",e),...n})}function Ii({description:e,label:t,name:n,helperLabel:r,hideErrors:i=!1,...l}){const o=Ca();return m.jsx(Wf,{control:o.control,name:n,render:({field:c})=>m.jsx(L6,{children:m.jsxs("div",{className:"flex flex-col gap-1",children:[(t||r)&&m.jsxs("div",{className:"flex flex-row items-center",children:[t&&m.jsx(D6,{children:t}),r&&m.jsx(_l,{className:"ml-auto text-fg-subtle/70",children:r})]}),m.jsx(I6,{children:m.jsx(m0,{...l,...c})}),e&&m.jsx(P6,{children:e}),!i&&m.jsx(j6,{})]})})})}const pC=({className:e,children:t,...n})=>m.jsxs("div",{className:"relative flex w-full",children:[m.jsx("select",{"data-slot":"select-native",className:Ae("peer inline-flex cursor-pointer appearance-none items-center rounded-md border border-input bg-surface text-foreground text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 has-[option[disabled]:checked]:text-muted-foreground aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",n.multiple?"py-1 *:px-3 *:py-1 [&_option:checked]:bg-accent":"h-8 ps-3 pe-8",e),...n,children:t}),!n.multiple&&m.jsx("span",{className:"pointer-events-none absolute inset-y-0 end-2 flex h-full items-center justify-center text-muted-foreground/80 peer-disabled:opacity-50 peer-aria-invalid:text-destructive/80",children:m.jsx(Qx,{className:"size-3",weight:"bold","aria-hidden":"true"})})]});function Cg({className:e,description:t,label:n,name:r,helperLabel:i,hideErrors:l=!1,...o}){const c=Ca();return m.jsx(Wf,{control:c.control,name:r,render:({field:f})=>m.jsx(L6,{children:m.jsxs("div",{className:"flex flex-col gap-1",children:[(n||i)&&m.jsxs("div",{className:"flex flex-row items-center",children:[n&&m.jsx(D6,{children:n}),i&&m.jsx(_l,{className:"ml-auto text-fg-subtle/70",children:i})]}),m.jsx(I6,{children:m.jsx(pC,{className:Ae("w-full",e),...o,...f})}),t&&m.jsx(P6,{children:t}),!l&&m.jsx(j6,{})]})})})}function B1({registryEntry:e,playbooks:t,defaultPlaybookId:n,onClickCancel:r,onSubmit:i,isSubmitting:l=!1}){const o=(e.parameters??[]).filter((g,x,A)=>A.findIndex(S=>S.name===g.name)===x),c=(t??[]).filter(g=>g.servers.some(x=>x.name===e.name)).map(g=>g.id),f=t?.filter(g=>!c.includes(g.id));if(t&&t.length>0&&c.length===t.length)return m.jsx(Ta,{children:m.jsx(Ns,{children:"This MCP has already been installed on all your playbooks."})});const p=ga({...f&&f.length>0&&{playbookId:xn()},parameters:ga(o.reduce((g,x)=>(g[x.name]=xn().trim().min(1,"Required"),g),{}))}),y={...f&&f.length>0&&{playbookId:n??f[0]?.id??""},parameters:o.reduce((g,x)=>(g[x.name]="",g),{})};return m.jsxs(M6,{schema:p,defaultValues:y,className:"gap-y-0 overflow-hidden rounded-xl bg-accent-subtle shadow-[0_0_0_0.5px_rgba(55,50,46,0.15)]",onSubmit:g=>{i({playbookId:f&&f.length>0?g.playbookId:void 0,entryId:e.id,parameters:g.parameters})},children:[m.jsxs("div",{className:"flex flex-col gap-y-4 p-4",children:[f&&f.length>0&&m.jsx(Cg,{name:"playbookId",label:"Select a playbook",children:f.map(g=>m.jsx("option",{value:g.id,children:g.name},g.id))}),o.map(g=>m.jsx(Ii,{type:g.password?"password":"text",name:`parameters.${g.name}`,label:g.name,helperLabel:g.required?void 0:"Optional",description:m.jsx(MK,{children:g.description}),autoCorrect:"off",spellCheck:!1},g.name))]}),m.jsxs("div",{className:"border-fg/7 border-t-[0.5px] bg-accent px-4 py-2.5",children:[m.jsx(bt,{type:"submit",disabled:l,className:"w-full",children:l?"Installing...":"Add to playbook"}),r&&m.jsx(bt,{className:"mt-2 w-full bg-surface/50",variant:"secondary",onClick:r,disabled:l,type:"button",children:"Cancel"})]})]})}const H6=({children:e})=>m.jsx("div",{className:"flex flex-row gap-x-8",children:e}),F6=({children:e})=>m.jsx("div",{className:"flex min-w-0 grow flex-col gap-y-12 lg:gap-y-16",children:e}),B6=({children:e})=>m.jsx("div",{className:"hidden w-xs shrink-0 flex-col lg:flex",children:m.jsx("div",{className:"sticky top-0 flex flex-col gap-y-8",children:e})}),gC=M8,AW=L8,TW=D8;function _W({className:e,...t}){return m.jsx(Af,{className:Ae("overlay",e),...t})}function yC({className:e,children:t,dismissable:n=!0,...r}){return m.jsxs(TW,{children:[m.jsx(_W,{}),m.jsxs(Tf,{className:Ae("popover rounded-xl","fixed inset-x-1 top-1 z-50 grid outline-none duration-200","sm:top-12 sm:left-[50%] sm:w-full sm:max-w-md sm:translate-x-[-50%]","radix-state-[open]:fade-in-0 radix-state-[open]:zoom-in-95 radix-state-[open]:slide-in-from-top-[48%] radix-state-[open]:animate-in","radix-state-[closed]:fade-out-0 radix-state-[closed]:zoom-out-95 radix-state-[closed]:slide-out-to-top-[48%] radix-state-[closed]:animate-out",e),...r,children:[t,n&&m.jsx(_f,{className:Ae("absolute top-1 right-1 rounded-lg"),asChild:!0,children:m.jsxs(bt,{variant:"secondary",size:"icon",children:[m.jsx(Uc,{className:"size-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})}function SW({className:e,...t}){return m.jsx("div",{className:Ae("flex flex-col gap-y-1 p-5 text-start",e),...t})}function bC({className:e,...t}){return m.jsx(I8,{className:Ae(ji({variant:"h2"}),"text-fg",e),...t})}function vC({className:e,...t}){return m.jsx(P8,{className:Ae(ji({variant:"p"}),"text-fg-subtle",e),...t})}function CW({registryEntry:e,playbooks:t,onClickInstall:n,isInstalling:r,open:i,onOpenChange:l}){const o=e;return m.jsx(gC,{open:i,onOpenChange:l,children:m.jsxs(yC,{className:"!max-w-none !inset-1 !translate-0 !w-auto flex flex-col py-10",children:[m.jsxs(j8,{children:[m.jsxs(bC,{className:"pt-4",children:["Install ",o?.title]}),m.jsx(vC,{children:o?.description})]}),m.jsx(xa,{size:"xl",children:m.jsxs(H6,{children:[m.jsx(F6,{children:o&&m.jsx(HS,{entry:o})}),m.jsx(B6,{children:m.jsx("div",{className:"sticky top-0 flex flex-col gap-y-8",children:m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h3",asChild:!0,children:m.jsx("h3",{children:"Add to playbook"})})}),o&&m.jsx(B1,{registryEntry:o,playbooks:t,onSubmit:n,isSubmitting:r,onClickCancel:()=>l(!1)})]})})})]})}),m.jsx("div",{className:"-bottom-5 sticky inset-x-0 px-4 pt-4 md:hidden",children:m.jsx("div",{className:"rounded-xl bg-accent-subtle p-4 shadow-[0_0_0_0.5px_rgba(55,50,46,0.2)]",children:o&&m.jsx(B1,{registryEntry:o,playbooks:t,onSubmit:n,isSubmitting:r,onClickCancel:()=>l(!1)})})})]})})}function wW({registryEntry:e,playbooks:t,onClickInstall:n,isInstalling:r,open:i,onOpenChange:l}){return m.jsx(CW,{registryEntry:e,playbooks:t,onClickInstall:n,isInstalling:r,open:i,onOpenChange:l})}function NW({title:e="Get started",description:t="Let's get your started with MCP using Director."}){return m.jsxs(m.Fragment,{children:[m.jsx(Ef,{className:"mx-auto"}),m.jsxs(Ot,{className:"items-center gap-y-1.5 text-center",children:[m.jsx(Rt,{className:"font-medium text-2xl",children:e}),m.jsx(ti,{className:"text-base",children:t})]})]})}var EC="Toggle",xC=h.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...l}=e,[o,c]=ra({prop:n,onChange:i,defaultProp:r??!1,caller:EC});return m.jsx(tt.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...l,ref:t,onClick:qe(e.onClick,()=>{e.disabled||c(!o)})})});xC.displayName=EC;var Rs="ToggleGroup",[AC]=gr(Rs,[Go]),TC=Go(),U6=J.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const i=r;return m.jsx(OW,{...i,ref:t})}if(n==="multiple"){const i=r;return m.jsx(RW,{...i,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Rs}\``)});U6.displayName=Rs;var[_C,SC]=AC(Rs),OW=J.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...l}=e,[o,c]=ra({prop:n,defaultProp:r??"",onChange:i,caller:Rs});return m.jsx(_C,{scope:e.__scopeToggleGroup,type:"single",value:J.useMemo(()=>o?[o]:[],[o]),onItemActivate:c,onItemDeactivate:J.useCallback(()=>c(""),[c]),children:m.jsx(CC,{...l,ref:t})})}),RW=J.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...l}=e,[o,c]=ra({prop:n,defaultProp:r??[],onChange:i,caller:Rs}),f=J.useCallback(y=>c((g=[])=>[...g,y]),[c]),p=J.useCallback(y=>c((g=[])=>g.filter(x=>x!==y)),[c]);return m.jsx(_C,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:f,onItemDeactivate:p,children:m.jsx(CC,{...l,ref:t})})});U6.displayName=Rs;var[kW,MW]=AC(Rs),CC=J.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:l,dir:o,loop:c=!0,...f}=e,p=TC(n),y=zc(o),g={role:"group",dir:y,...f};return m.jsx(kW,{scope:n,rovingFocus:i,disabled:r,children:i?m.jsx(Kg,{asChild:!0,...p,orientation:l,dir:y,loop:c,children:m.jsx(tt.div,{...g,ref:t})}):m.jsx(tt.div,{...g,ref:t})})}),U1="ToggleGroupItem",wC=J.forwardRef((e,t)=>{const n=SC(U1,e.__scopeToggleGroup),r=MW(U1,e.__scopeToggleGroup),i=TC(e.__scopeToggleGroup),l=n.value.includes(e.value),o=r.disabled||e.disabled,c={...e,pressed:l,disabled:o},f=J.useRef(null);return r.rovingFocus?m.jsx(Xg,{asChild:!0,...i,focusable:!o,active:l,ref:f,children:m.jsx(Ux,{...c,ref:t})}):m.jsx(Ux,{...c,ref:t})});wC.displayName=U1;var Ux=J.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...i}=e,l=SC(U1,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},c=l.type==="single"?o:void 0;return m.jsx(xC,{...c,...i,ref:t,onPressedChange:f=>{f?l.onItemActivate(r):l.onItemDeactivate(r)}})}),LW=U6,DW=wC;function IW({selectedClient:e,onClientSelect:t,clients:n,isLoading:r,isInstalling:i,onInstall:l}){return m.jsxs("div",{className:"flex flex-col gap-y-4 p-4",children:[m.jsx(LW,{type:"single",value:e,onValueChange:o=>{t(o)},className:"group flex flex-row items-center justify-center gap-x-2",children:h.Children.toArray(n.map(o=>{const c=o.installed;return m.jsxs(DW,{value:o.id,className:Ae("group relative flex flex-1 flex-col items-center gap-y-1 overflow-hidden rounded-lg bg-accent p-3","cursor-pointer hover:bg-accent-subtle","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-accent","outline-none ring-2 ring-transparent ring-offset-2 ring-offset-surface","focus-visible:bg-accent-subtle focus-visible:ring-accent","radix-state-[on]:ring-fg"),disabled:i||r||!c,children:[m.jsx("img",{src:o.image,alt:"Claude",width:64,height:64}),m.jsx(an,{className:"font-[450] text-fg/80 capitalize",children:o.label})]},o.id)}))}),m.jsx(bt,{className:"self-end",disabled:!e||i,onClick:()=>{e&&l(e)},children:i?"Connecting…":"Connect"})]})}function PW({className:e,children:t,...n}){return m.jsx("div",{"data-slot":"get-started-list",className:Ae("flex flex-col gap-y-3",e),...n,children:t})}function Qd({className:e,children:t,title:n,status:r="not-started",...i}){return m.jsxs(yS,{"data-slot":"get-started-list-item",className:Ae("rounded-2xl",i.disabled?"bg-accent":"popover",e),...i,children:[m.jsxs(bS,{"data-slot":"get-started-list-item-trigger",tabIndex:-1,className:"group flex w-full flex-row items-center justify-between gap-x-2 py-3.5 pr-3.5 pl-3.5 text-start outline-none disabled:cursor-default",children:[(()=>{switch(r){case"completed":return m.jsx(Rg,{weight:"fill",className:"size-6 text-success-fg"});case"in-progress":return m.jsx(Kx,{weight:"fill",className:"size-6 text-fg/75"});case"not-started":return m.jsx(kg,{weight:"fill",className:"size-6 text-fg/30"})}})(),m.jsx("span",{className:"flex-1 font-[450] text-[15px] leading-6 tracking-[0.01em]",children:n})]}),m.jsx(vS,{"data-slot":"get-started-list-item-content",className:"border-t-[0.5px]",children:t})]})}function jW({searchQuery:e,onSearchQueryChange:t,registryEntries:n,onMcpSelect:r}){return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"relative z-10 px-2 pt-2",children:m.jsx(m0,{type:"text",placeholder:"Search MCP servers...",value:e,onChange:i=>t(i.target.value)})}),m.jsxs("div",{className:"grid max-h-[320px] grid-cols-1 gap-1 overflow-y-auto p-2",children:[n.sort((i,l)=>i.title.localeCompare(l.title)).map(i=>m.jsxs("div",{className:"flex cursor-pointer flex-row items-center gap-x-3 rounded-lg bg-accent-subtle/60 px-2.5 py-1.5 hover:bg-accent",onClick:()=>r(i),children:[m.jsx(Sf,{src:i.icon}),m.jsxs(dn,{children:[m.jsx(an,{children:i.title}),m.jsx(qa,{children:i.description})]})]},i.id)),n.length===0&&m.jsx(Ta,{className:"bg-accent-subtle/60",children:m.jsx(ni,{children:"No MCP servers found"})})]})]})}function HW({name:e,...t}){const n=Ca();return m.jsx(Wf,{control:n.control,name:e,render:({field:r})=>m.jsx(m0,{type:"hidden",...t,...r})})}function V6({className:e,...t}){const n="\\|/—",[r,i]=h.useState(0);return FW(()=>{i(l=>(l+1)%n.length)},100),m.jsxs("span",{className:Ae("font-mono",e),...t,children:["[",n[r],"]"]})}function FW(e,t){const n=h.useRef(e);BW(()=>{n.current=e},[e]),h.useEffect(()=>{const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}const BW=typeof window<"u"?h.useLayoutEffect:h.useEffect,UW=ga({name:xn().trim().min(1,"Required"),description:xn().trim().optional().transform(e=>e===""?void 0:e)});function VW({form:e,isPending:t,onSubmit:n}){return m.jsxs(fC,{className:"gap-y-4",form:e,onSubmit:async r=>{await n(r)},children:[m.jsx(Ii,{label:"Name",name:"name",placeholder:"My Playbook"}),m.jsx(HW,{name:"description"}),m.jsx(bt,{size:"default",className:"self-start",type:"submit",disabled:t,children:t?m.jsx(V6,{className:"text-fg-subtle"}):"Create playbook"})]})}function zW({className:e,...t}){return m.jsx("textarea",{"data-slot":"textarea",className:Ae("field-sizing-content flex min-h-19.5 w-full resize-none rounded-md border border-input bg-surface px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground/70 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",e),...t})}function z6({description:e,label:t,name:n,helperLabel:r,hideErrors:i=!1,...l}){const o=Ca();return m.jsx(Wf,{control:o.control,name:n,render:({field:c})=>m.jsx(L6,{children:m.jsxs("div",{className:"flex flex-col gap-2",children:[(t||r)&&m.jsxs("div",{className:"flex flex-row items-center",children:[t&&m.jsx(D6,{children:t}),r&&m.jsx(_l,{className:"ml-auto text-fg-subtle/70",children:r})]}),m.jsx(I6,{children:m.jsx(zW,{...l,...c})}),e&&m.jsx(P6,{children:e}),!i&&m.jsx(j6,{})]})})})}const ZW=ga({title:xn().min(1,"Title is required"),description:xn().optional(),body:xn().min(1,"Body is required")});function NC({prompt:e,onSubmit:t,isSubmitting:n=!1,onDelete:r,secondaryButton:i}){const l=aC({resolver:dC(ZW),defaultValues:{title:"",description:"",body:""},mode:"onChange"});h.useEffect(()=>{e?l.reset({title:e.title??"",description:e.description??"",body:e.body??""}):l.reset({title:"",description:"",body:""})},[e,l]);const o=l.handleSubmit(async c=>{await t(c)});return m.jsx(w6,{...l,children:m.jsxs("form",{className:"flex flex-col gap-y-3",onSubmit:o,children:[m.jsx(Ii,{name:"title",label:"Title",placeholder:"Enter title…"}),m.jsx(Ii,{name:"description",label:"Description",placeholder:"Optional short description…"}),m.jsx(z6,{name:"body",label:"Body",placeholder:"Write the prompt body…",rows:8}),m.jsxs("div",{className:"flex flex-row gap-x-2",children:[m.jsx(bt,{type:"submit",className:"grow",disabled:!l.formState.isValid||n,children:n?"Saving…":"Save"}),i,e&&r&&m.jsx(bt,{type:"button",variant:"secondary",onClick:r,children:m.jsx(Bc,{})})]})]})})}function qW(e){const{currentPlaybook:t,registryEntries:n,clientStatuses:r,isAddingPlaybookToClient:i,isCreatePlaybookLoading:l,onCreatePlaybook:o,searchQuery:c,onSearchQueryChange:f,onClickRegistryEntry:p,onAddPlaybookToClient:y,isPromptCompleted:g,onSkipPrompt:x,onPromptFormSubmit:A,isPromptSubmitting:S}=e,[_,w]=h.useState(),C=k6({schema:UW,defaultValues:{name:"",description:"A playbook for getting started"}}),R=!!t,D=(t?.servers?.length??0)>0,P=h.useMemo(()=>({create:R?"completed":"in-progress",add:R?D?"completed":"in-progress":"not-started",prompt:R&&D?g?"completed":"in-progress":"not-started",connect:R&&D&&g?"in-progress":"not-started"}),[R,D,g]);return m.jsx(xa,{size:"sm",className:"py-12 lg:py-16",children:m.jsxs(Nt,{className:"gap-y-8",children:[m.jsx(NW,{title:"Get started",description:"Let's get you set up with Director"}),m.jsxs(PW,{children:[m.jsx(Qd,{status:P.create,title:"1. Create a Playbook",disabled:P.create==="completed",open:P.create==="in-progress",children:m.jsx("div",{className:"py-4 pr-4 pl-11.5",children:m.jsx(VW,{form:C,isPending:l,onSubmit:o})})}),m.jsx(Qd,{status:P.add,title:"2. Add an MCP server",open:P.add==="in-progress",disabled:P.add!=="in-progress",children:m.jsx(jW,{searchQuery:c,onSearchQueryChange:f,registryEntries:n,onMcpSelect:p})}),m.jsx(Qd,{status:P.prompt,title:"3. Add a Prompt",open:P.prompt==="in-progress",disabled:P.prompt!=="in-progress",children:m.jsx("div",{className:"py-4 pr-4 pl-4",children:m.jsx(NC,{onSubmit:A,isSubmitting:S,secondaryButton:m.jsx(bt,{variant:"secondary",onClick:U=>{U.preventDefault(),x()},children:"Skip"})})})}),m.jsx(Qd,{status:P.connect,title:"4. Connect your client",open:P.connect==="in-progress",disabled:P.connect!=="in-progress",children:m.jsx(IW,{selectedClient:_,onClientSelect:w,clients:r,isLoading:!1,isInstalling:i,onInstall:y})})]})]})})}const OC=()=>m.jsx("div",{className:"flex h-screen w-screen items-center justify-center",children:m.jsx(Ef,{className:"size-10 animate-pulse"})}),YW=[{id:"claude",label:"Claude",image:new URL("/studio/assets/claude-icon-CCYRFsZn.png",import.meta.url).href},{id:"claude-code",label:"Claude Code",image:new URL("/studio/assets/claude-icon-CCYRFsZn.png",import.meta.url).href},{id:"cursor",label:"Cursor",image:new URL("/studio/assets/cursor-icon-DfqPZkLG.png",import.meta.url).href},{id:"vscode",label:"VSCode",image:new URL("/studio/assets/code-icon-Da0Eua6W.png",import.meta.url).href}];function RC(e){const t=gt.clients.allClients.useQuery(),n=t.isLoading,r=n?null:t.data?.map(l=>{const o=YW.find(c=>c.id===l.name);return o?{id:o.id,label:o.label,image:o.image,installed:l.installed,present:!!l.playbooks?.some(c=>c.id===e)}:null}).filter(l=>l!==null)??[];return{data:(n?null:[...r??[]])??void 0,isLoading:n}}function $W(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")}function kC(e,t){const n=gt.useUtils(),r=gt.store.addPrompt.useMutation({async onSuccess(l,o,c,f){await Promise.all([n.store.get.invalidate({playbookId:e}),n.store.getAll.invalidate(),n.store.listPrompts?.invalidate?.({playbookId:e})]),t?.onSuccess&&await t.onSuccess(l,o,c,f)},onError(l,o,c,f){t?.onError?.(l,o,c,f)}});return{createPrompt:async l=>{const o=$W(l.title);await r.mutateAsync({playbookId:e,prompt:{name:o,title:l.title,description:l.description,body:l.body}})},isPending:r.isPending}}function MC(e){const t=gt.useUtils(),n=e0.useUtils(),[r,i]=h.useState(!1),l=gt.store.addServer.useMutation({async onSuccess(c,f,p,y){if(c.connectionInfo?.status==="unauthorized"){const g=await t.store.authenticate.fetch({playbookId:f.playbookId,serverName:c.name});g.result==="REDIRECT"&&window.location.assign(g.redirectUrl);return}await t.store.getAll.invalidate(),f?.playbookId&&await t.store.get.invalidate({playbookId:f.playbookId}),e&&e.onSuccess&&await e.onSuccess(c,f,p,y)},onError(c,f,p,y){e&&e.onError&&e.onError(c,f,p,y)}});return{install:async c=>{try{i(!0);const f=await n.entries.getTransportForEntry.fetch({entryName:c.entryName,parameters:c.parameters??{}});return await l.mutateAsync({playbookId:c.playbookId,server:{name:c.entryName,transport:f}})}finally{i(!1)}},isPending:l.isPending||r}}function LC(e){return e0.entries.getEntries.useQuery({pageIndex:e.pageIndex,pageSize:e.pageSize,searchQuery:e.searchQuery},{placeholderData:t=>t})}function QW(){const e=Ir(),[t,n]=h.useState(""),[r,i]=h.useState(null),[l,o]=h.useState(!1),[c,f]=h.useState(null),[p,y]=h.useState(!1),[g,x]=h.useState(!1),{setInProgress:A}=C8();h.useEffect(()=>{A(!0)},[A]),h.useEffect(()=>{g&&A(!1)},[g,A]);const S=gt.useUtils(),_=n0(),w=LC({pageIndex:0,pageSize:20,searchQuery:t}),C=RC(r),R=e0.entries.getEntryByName.useQuery({name:c||""},{enabled:!!c&&p}),D=gt.store.create.useMutation({onSuccess:async()=>{await S.store.getAll.refetch(),Pt({title:"Playbook created",description:"This playbook was successfully created."})}}),P=gt.clients.install.useMutation({onSuccess:()=>{S.clients.allClients.invalidate(),Pt({title:"Playbook installed",description:"This playbook was successfully installed"}),x(!0)},onError:$=>{Pt({title:"Error",description:$.message})}}),{createPrompt:U,isPending:k}=kC(r||"",{onSuccess:()=>{Pt({title:"Prompt created",description:"Your prompt was successfully added to the playbook."}),o(!0)},onError:$=>{Pt({title:"Error",description:$.message})}}),{install:H,isPending:j}=MC({onError:$=>{Pt({title:"Error",description:$.message})},onSuccess:$=>{S.store.getAll.invalidate(),Pt({title:"Playbook installed",description:"This playbook was successfully installed."}),y(!1)}});h.useEffect(()=>{_.data&&_.data.length===1&&i(_.data[0].id)},[_.data]);const ee=_.data&&w.data,ne=_.data&&_.data.length>0?_.data[0]:null,K=async $=>{await D.mutateAsync({...$,servers:[]})},W=$=>{ne?.id&&P.mutate({playbookId:ne.id,clientId:$,baseUrl:hf})},ie=$=>{f($.name),y(!0)},he=async $=>{!c||!$.playbookId||await H({playbookId:$.playbookId,entryName:c,parameters:$.parameters??{}})},F=async $=>{r&&await U($)};return ee?m.jsxs(m.Fragment,{children:[m.jsx(qW,{currentPlaybook:ne,registryEntries:w.data?.entries??[],clientStatuses:C.data??[],isAddingPlaybookToClient:P.isPending,isCreatePlaybookLoading:D.isPending,onCreatePlaybook:K,searchQuery:t,onSearchQueryChange:n,onClickRegistryEntry:ie,onAddPlaybookToClient:W,isPromptCompleted:l,onSkipPrompt:()=>o(!0),onPromptFormSubmit:F,isPromptSubmitting:k}),c&&m.jsx(wW,{registryEntry:R.data,playbooks:_.data,onClickInstall:he,isInstalling:j,open:p,onOpenChange:y}),m.jsx(RB,{open:g,onClickLibrary:()=>e("/library"),onClickPlaybook:()=>e("/")})]}):m.jsx(OC,{})}function DC({sections:e}){return m.jsxs("div",{className:"flex h-full w-full shrink-0 flex-col gap-y-6 px-4 pt-6 *:last:pb-4",children:[m.jsx("div",{className:"px-2",children:m.jsx(Ef,{className:"size-6"})}),e.map((t,n)=>m.jsxs(QD,{className:Ae(t.className,n===e.length-1?"mt-auto":void 0),children:[t.label&&m.jsx(GD,{label:t.label}),t.isLoading?new Array(3).fill(0).map((r,i)=>m.jsx(Sp,{className:"bg-accent-subtle",children:m.jsx(Rr,{className:"opacity-50",children:m.jsx(Jr,{text:"Loading"})})},`loading-${i}`)):t.items.map(r=>m.jsxs(Sp,{"data-state":r.isActive?"active":"inactive",className:"cursor-pointer",onClick:r.onClick,children:[r.icon&&m.jsx(Ua,{children:r.icon}),m.jsx(Rr,{children:r.label})]},r.id))]},t.id))]})}const IC=h.createContext([]);function GW({className:e,children:t,sections:n=[],...r}){return m.jsx(IC.Provider,{value:n,children:m.jsxs("div",{"data-slot":"layout",className:Ae("flex h-screen w-screen flex-row overflow-hidden bg-bg text-fg",e),...r,children:[m.jsx("div",{"data-slot":"layout-sidebar",className:Ae("hidden w-full max-w-[220px] shrink-0 overflow-y-auto overflow-x-hidden md:flex"),children:m.jsx(DC,{sections:n})}),m.jsx("div",{"data-slot":"layout-content",className:"flex grow flex-col overflow-hidden p-2 md:pl-px",children:t})]})})}function Cs({className:e,children:t,...n}){return m.jsx("div",{className:Ae("@container/page overflow-hidden text-fg","flex grow flex-col rounded-md bg-surface shadow-[0_0_0_0.5px_rgba(55,50,46,0.2)]",e),...n,children:t})}function KW({className:e,children:t,...n}){const r=h.useContext(IC);return m.jsxs("div",{className:Ae("flex shrink-0 flex-row items-center gap-x-2","h-13 border-accent border-b-[0.5px] bg-surface px-4 md:px-8 lg:px-12",e),...n,children:[m.jsxs(f0,{children:[m.jsx(iX,{asChild:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"md:hidden",children:[m.jsx(s5,{weight:"fill",className:"!size-5 shrink-0"}),m.jsx("span",{className:"sr-only",children:"Open sidebar"})]})}),m.jsxs(wS,{children:[m.jsx(Af,{className:"overlay"}),m.jsxs(Tf,{className:Ae("fixed inset-y-0 left-0 z-50 h-full w-full max-w-[220px] bg-bg text-fg transition ease-in-out","shadow-[0_0_10px_3px_rgba(55,50,46,0.13),_0_0_0_0.5px_rgba(55,50,46,0.2)] outline-none","overflow-y-auto overflow-x-hidden","radix-state-[closed]:slide-out-to-left radix-state-[closed]:animate-out radix-state-[closed]:duration-200","radix-state-[open]:slide-in-from-left radix-state-[open]:animate-in radix-state-[open]:duration-300"),children:[m.jsxs(j8,{children:[m.jsx(O8,{children:"Navigation"}),m.jsx(R8,{children:"A sidebar containing global navigation for Director studio."})]}),m.jsx(DC,{sections:r})]})]})]}),t]})}function Pi({className:e,children:t,...n}){return m.jsx("div",{className:Ae("flex grow flex-col overflow-y-auto overflow-x-hidden py-8 md:py-12 lg:py-16",e),...n,children:t})}function ks({breadcrumbs:e,loading:t=!1,children:n}){return m.jsxs(KW,{children:[m.jsx(u0,{className:"grow",children:m.jsx(c0,{children:e.map((r,i)=>{const l=i===e.length-1,o=!!r.onClick;return m.jsxs(h.Fragment,{children:[i>0&&m.jsx(d0,{}),m.jsx(hl,{children:o?m.jsx(dS,{onClick:r.onClick,className:"cursor-pointer",children:l&&t?m.jsx(Jr,{text:r.title}):r.title}):m.jsx(ml,{children:l&&t?m.jsx(Jr,{text:r.title}):r.title})})]},r.title)})})}),n]})}const XW=ga({name:xn().trim().min(1,"Required"),description:xn().trim().optional().transform(e=>e===""?void 0:e)});function PC({children:e,onSubmit:t,defaultValues:n}){const r={name:n?.name??"",description:n?.description??""};return m.jsxs(M6,{schema:XW,defaultValues:r,onSubmit:t,children:[m.jsxs("div",{className:"flex w-full flex-col gap-y-6",children:[m.jsx(Ii,{label:"Name",name:"name",placeholder:"My playbook"}),m.jsx(z6,{label:"Description",name:"description",helperLabel:"Optional",placeholder:"A description of the playbook"})]}),e]})}function WW({isSubmitting:e=!1,children:t,className:n="self-start"}){return m.jsx(bt,{size:"lg",className:n,type:"submit",disabled:e,children:e?m.jsx(V6,{className:"text-fg-subtle"}):t})}function JW({onSubmit:e,isSubmitting:t}){return m.jsx(xa,{size:"sm",children:m.jsxs(Nt,{className:"gap-y-8",children:[m.jsxs(Ot,{children:[m.jsx(Rt,{children:"New playbook"}),m.jsx(ti,{children:"Create a new playbook."})]}),m.jsx(al,{}),m.jsx(PC,{onSubmit:async n=>{await e(n)},children:m.jsx(WW,{isSubmitting:t,children:"Create playbook"})})]})})}function eJ(e){const t=gt.useUtils(),n=gt.store.create.useMutation({async onSuccess(r,i,l,o){await t.store.getAll.refetch(),e&&e.onSuccess&&await e.onSuccess(r,i,l,o)},onError(r,i,l,o){e&&e.onError&&e.onError(r,i,l,o)}});return{createPlaybook:n.mutateAsync,isPending:n.isPending}}function tJ(){const e=Ir(),{createPlaybook:t,isPending:n}=eJ({onSuccess:i=>{Pt({title:"Playbook created",description:"This playbook was successfully created."}),e(`/${i.id}`)}}),r=async i=>{await t({...i,servers:[]})};return m.jsxs(m.Fragment,{children:[m.jsx(ks,{breadcrumbs:[{title:"New Playbooks"}]}),m.jsx(Pi,{children:m.jsx(JW,{onSubmit:r,isSubmitting:n})})]})}function nJ(){const[e,t]=h.useState(null),n=h.useCallback(async r=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(r),t(r),!0}catch(i){return console.warn("Copy failed",i),t(null),!1}},[]);return[e,n]}function jC({id:e,gatewayBaseUrl:t,onCopy:n}){const[r,i]=h.useState("http"),l={http:`${t}/${e}/mcp`,sse:`${t}/${e}/sse`,stdio:`director http2stdio ${t}/${e}/sse`};return m.jsxs("div",{className:"relative flex pt-1",children:[m.jsx("div",{className:"w-fit",children:m.jsxs(pC,{value:r,onChange:o=>i(o.target.value),className:"h-8 rounded-r-none border-[0.5px] border-fg/20 bg-accent-subtle font-medium text-[13px] text-muted-foreground shadow-none ring-0 hover:text-foreground focus-visible:border-fg/30 focus-visible:ring-0",children:[m.jsx("option",{value:"http",children:"HTTP"}),m.jsx("option",{value:"sse",children:"SSE"}),m.jsx("option",{value:"stdio",children:"STDIO"})]})}),m.jsx(m0,{autoFocus:!0,className:"-mx-px h-8 rounded-none border-[0.5px] border-fg/30 pr-0 font-medium font-mono text-[13px] shadow-none focus-visible:border-fg/30 focus-visible:ring-0",readOnly:!0,value:l[r]}),m.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-r-md border-[0.5px] border-fg/20 bg-accent-subtle",children:m.jsx(bt,{size:"icon",variant:"ghost",onClick:()=>n(l[r]),children:m.jsx(Xx,{})})})]})}function rJ({playbookId:e,gatewayBaseUrl:t,children:n,onCopy:r,...i}){return m.jsxs(gC,{...i,children:[n&&m.jsx(AW,{asChild:!0,children:n}),m.jsxs(yC,{children:[m.jsxs(SW,{children:[m.jsx(bC,{children:"Connect manually"}),m.jsx(vC,{children:"Director works with any MCP enabled product. Below you'll find endpoints for both Streamable HTTP and SSE, as well as STDIO via our CLI."})]}),m.jsx("div",{className:"border-t-[0.5px] p-5",children:m.jsx(jC,{id:e,gatewayBaseUrl:t,onCopy:r})})]})]})}function aJ({playbook:e,gatewayBaseUrl:t,clients:n,onChangeInstall:r,isLoading:i}){const[l,o]=nJ(),c=async f=>{await o(f),Pt({title:"Copied to clipboard",description:"The endpoint has been copied to your clipboard."})};return m.jsxs(Nt,{children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between",children:[m.jsx(Rt,{variant:"h3",asChild:!0,children:m.jsx("h3",{children:"Client connections"})}),m.jsx(rJ,{playbookId:e.id,gatewayBaseUrl:t,onCopy:c})]}),m.jsxs("div",{className:"overflow-hidden rounded-xl bg-accent-subtle p-4 shadow-[0_0_0_0.5px_rgba(55,50,46,0.15)]",children:[m.jsx(Vx,{children:"Connect Automatically"}),n.map(f=>m.jsx(iJ,{client:f,onChangeInstall:r,isLoading:i},f.id)),m.jsx(Vx,{children:"Connect Manually"}),m.jsx(jC,{id:e.id,gatewayBaseUrl:t,onCopy:c})]})]})}function Vx({children:e}){return m.jsx("label",{className:"font-medium font-mono text-[11px] uppercase leading-none tracking-widest peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})}function iJ({client:e,onChangeInstall:t,isLoading:n}){return m.jsxs("label",{htmlFor:e.id,className:Ae("flex cursor-pointer flex-row items-center justify-between rounded-lg bg-accent-subtle pt-2 pb-2 transition-colors duration-200 ease-in-out hover:bg-accent",!e.installed&&"opacity-50 hover:cursor-not-allowed hover:bg-accent-subtle"),children:[m.jsxs("div",{className:"flex grow flex-row items-center gap-x-1.5",children:[m.jsx("img",{src:e.image,alt:`${e.label} icon`,height:26,width:26}),m.jsx("span",{className:"font-medium text-[15px]",children:e.label})]}),m.jsx(o6,{id:e.id,checked:!!e.present,onCheckedChange:r=>{t(e.id,r)},disabled:n||!e.installed})]})}function sJ({onSettingsClick:e,onDeleteClick:t}){return m.jsxs(s8,{children:[m.jsx(l8,{asChild:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"radix-state-[open]:bg-accent-subtle",children:[m.jsx(Fc,{weight:"fill",className:"!size-4"}),m.jsx("span",{className:"sr-only",children:"Settings"})]})}),m.jsx(o8,{align:"end",children:m.jsxs(h1,{children:[m.jsxs(Ba,{onSelect:e,children:[m.jsx(Ua,{children:m.jsx(e5,{})}),m.jsx(Rr,{children:"Settings"})]}),m.jsxs(Ba,{onSelect:t,children:[m.jsx(Ua,{children:m.jsx(Bc,{})}),m.jsx(Rr,{children:"Delete"})]})]})})]})}function lJ({playbook:e,onSubmit:t,open:n,onOpenChange:r}){return m.jsx(f0,{open:n,onOpenChange:r,children:m.jsxs(Vf,{children:[m.jsx(Zf,{}),m.jsxs(zf,{children:[m.jsxs(qf,{children:[m.jsx(Yf,{children:"Settings"}),m.jsx($f,{children:"Update the name and description of the playbook."})]}),m.jsx(v_,{}),m.jsx(PC,{defaultValues:{name:e.name,description:e.description??void 0},onSubmit:t,children:m.jsx(bt,{children:"Save changes"})})]})]})})}function HC({children:e}){return m.jsxs(Cs,{className:"pointer-events-none relative select-none",children:[e,m.jsx(ks,{breadcrumbs:[{title:"Loading playbook…"}],loading:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"radix-state-[open]:bg-accent-subtle",disabled:!0,children:[m.jsx(Fc,{weight:"fill",className:"!size-4"}),m.jsx("span",{className:"sr-only",children:"Settings"})]})}),m.jsx(Pi,{"aria-hidden":!0,children:m.jsxs(xa,{size:"lg",children:[m.jsx(Nt,{children:m.jsxs(Ot,{className:"opacity-50",children:[m.jsx(Rt,{children:m.jsx(Jr,{text:"Loading playbook name"})}),m.jsx(ti,{children:m.jsx(Jr,{text:"Loading playbook description"})})]})}),m.jsx(Nt,{children:m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"Usage"})})})}),m.jsxs(Nt,{children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between opacity-50",children:[m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"MCP Servers"})}),m.jsx(bt,{disabled:!0,children:"Add"})]}),m.jsx(sl,{})]}),m.jsxs(Nt,{children:[m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"Tools"})})}),m.jsx(sl,{})]})]})})]})}function V1({children:e,title:t,description:n,open:r,onOpenChange:i,onConfirm:l}){const o=k6({schema:ga({}),defaultValues:{}});return h.useEffect(()=>{!r&&o.formState.isSubmitSuccessful&&o.reset()},[r,o.formState.isSubmitSuccessful,o.reset]),m.jsxs($_,{open:r,onOpenChange:i,children:[e&&m.jsx(AB,{asChild:!0,children:e}),m.jsxs(Q_,{children:[m.jsxs(G_,{children:[m.jsx(K_,{children:t}),m.jsx(X_,{children:n})]}),m.jsxs(SB,{children:[m.jsx(CB,{children:"Cancel"}),m.jsx(fC,{form:o,onSubmit:l,className:"sm:w-fit",children:m.jsx(bt,{type:"submit",disabled:o.formState.isSubmitting,children:o.formState.isSubmitting?m.jsx(V6,{className:"text-fg-subtle"}):"Confirm"})})]})]})]})}function oJ({open:e,onOpenChange:t,prompt:n,onSubmit:r,isSubmitting:i=!1,onClickDelete:l}){const[o,c]=h.useState(!1),f=y=>{t(y)},p=()=>{c(!0)};return m.jsxs(m.Fragment,{children:[m.jsx(f0,{open:e,onOpenChange:f,children:m.jsxs(Vf,{children:[m.jsx(Zf,{children:m.jsx(u0,{className:"grow",children:m.jsxs(c0,{children:[m.jsx(hl,{children:m.jsx(ml,{children:"Prompts"})}),m.jsx(d0,{}),m.jsx(hl,{children:m.jsxs(ml,{children:[n?"Edit":"Add"," prompt"]})})]})})}),m.jsxs(zf,{children:[m.jsxs(qf,{children:[m.jsx(Yf,{children:n?"Edit prompt":"Add a prompt"}),m.jsx($f,{className:"text-sm",children:n?"Update this reusable instruction block.":"Create a reusable instruction block for your playbook."})]}),m.jsx(al,{}),m.jsx(NC,{prompt:n,onSubmit:r,isSubmitting:i,onDelete:l?p:void 0})]})]})}),l&&m.jsx(V1,{title:"Delete prompt?",description:"Are you sure you want to delete this prompt?",open:o,onOpenChange:c,onConfirm:()=>{c(!1),l()}})]})}function uJ({prompts:e,onCreatePrompt:t,onEditPrompt:n,onDeletePrompt:r,isSavingPrompt:i=!1,...l}){const o=e??[],[c,f]=h.useState(!1),[p,y]=h.useState(null);return m.jsxs(m.Fragment,{children:[m.jsxs(Nt,{...l,children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between",children:[m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"Prompts"})}),m.jsx(bt,{size:"sm",onClick:()=>{y(null),f(!0)},children:"Add prompt"})]}),o.length===0?m.jsxs(Ta,{children:[m.jsx(ni,{children:"No prompts"}),m.jsx(Ns,{children:"Create your first prompt to reuse instructions across tools."})]}):m.jsx(Ka,{children:o.map(g=>m.jsx(cJ,{prompt:g,onClick:()=>{y(g),f(!0)}},`prompt-${g.name}`))})]}),m.jsx(oJ,{open:c,onOpenChange:f,prompt:p,isSubmitting:i,onClickDelete:p?async()=>{await r?.(p.name),f(!1)}:void 0,onSubmit:async g=>{if(p&&n){await n(p.name,g),f(!1);return}t&&(await t(g),f(!1))}})]})}function cJ({prompt:e,onClick:t}){return m.jsx(wn,{onClick:t,children:m.jsxs(dn,{children:[m.jsx(an,{children:e.title??e.name}),m.jsx(qa,{children:e.description||e.body})]})})}function wg({server:e,onClickAuthorize:t}){switch(e.connectionInfo?.status){case"connected":return m.jsxs(Ut,{variant:"success",children:[m.jsx(na,{children:m.jsx(Rg,{})}),m.jsx($t,{uppercase:!0,children:e.connectionInfo?.status||"--"})]});case"unauthorized":return m.jsxs(Ut,{variant:"destructive",className:t?"cursor-pointer outline-none transition-colors hover:bg-destructive/50 focus-visible:bg-destructive/90":void 0,onClick:n=>{n.stopPropagation(),t?.(e)},title:"Click to authorize",children:[m.jsx(na,{children:m.jsx(d5,{})}),m.jsx($t,{uppercase:!0,children:e.connectionInfo?.status||"--"})]});default:return m.jsx(Ut,{children:m.jsx($t,{uppercase:!0,children:e.connectionInfo?.status||"--"})})}}function dJ({servers:e,onClickServer:t,onClickAddServer:n,onClickAuthorize:r}){return m.jsxs(Nt,{children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between",children:[m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"Servers"})}),n&&m.jsx(bt,{size:"sm",onClick:n,children:"Add MCP server"})]}),e.length===0?m.jsxs(Ta,{children:[m.jsx(ni,{children:"No items"}),m.jsx(Ns,{children:"This list is empty."})]}):m.jsx(Ka,{children:e.map(i=>m.jsx(fJ,{server:i,onClick:t&&(()=>t(i)),onClickAuthorize:r},`li-${i.name}`))})]})}function fJ({server:e,onClick:t,onClickAuthorize:n}){return m.jsxs(wn,{onClick:t,children:[m.jsxs(dn,{children:[m.jsx(an,{children:e.name}),m.jsx(hJ,{server:e})]}),m.jsx(Wn,{children:m.jsx(wg,{server:e,onClickAuthorize:n})})]})}function hJ({server:e}){return e.type==="http"?m.jsx(qa,{children:e.url}):e.type==="stdio"?m.jsxs(qa,{children:[e.command," ",e.args.join(" ")]}):m.jsx(qa,{children:"--"})}function FC(){const[e,t]=h.useState(!1),[n,r]=h.useState(null),i=gt.useUtils();return{authenticate:async({playbookId:o,serverName:c})=>{t(!0),r(null);try{const f=await i.store.authenticate.fetch({playbookId:o,serverName:c});return f.result==="REDIRECT"&&f.redirectUrl?(window.location.assign(f.redirectUrl),!1):!0}catch(f){const p=f instanceof Error?f:new Error("Authentication failed");throw r(p),p}finally{t(!1)}},isLoading:e,error:n}}function mJ(e,t){const n=gt.useUtils(),r=gt.clients.install.useMutation({onSuccess:async(o,c)=>{await n.clients.allClients.invalidate(),t?.onSuccess&&c?.clientId&&await t.onSuccess(c.clientId,!0)},onError:async(o,c)=>{t?.onError&&c?.clientId&&await t.onError(c.clientId,!0)}}),i=gt.clients.uninstall.useMutation({onSuccess:async(o,c)=>{await n.clients.allClients.invalidate(),t?.onSuccess&&c?.clientId&&await t.onSuccess(c.clientId,!1)},onError:async(o,c)=>{t?.onError&&c?.clientId&&await t.onError(c.clientId,!1)}});return{changeInstallState:async(o,c)=>{c?await r.mutateAsync({playbookId:e,clientId:o,baseUrl:hf}):await i.mutateAsync({playbookId:e,clientId:o})},isPending:r.isPending||i.isPending}}function pJ(e,t){const n=gt.useUtils(),r=gt.store.removePrompt.useMutation({async onSuccess(l,o,c,f){await Promise.all([n.store.get.invalidate({playbookId:e}),n.store.getAll.invalidate(),n.store.listPrompts?.invalidate?.({playbookId:e})]),t?.onSuccess&&await t.onSuccess(l,o,c,f)},onError(l,o,c,f){t?.onError?.(l,o,c,f)}});return{deletePrompt:async l=>{await r.mutateAsync({playbookId:e,promptName:l})},isPending:r.isPending}}function gJ(e,t){const n=gt.useUtils(),r=gt.store.updatePrompt.useMutation({async onSuccess(l,o,c,f){await Promise.all([n.store.get.invalidate({playbookId:e}),n.store.getAll.invalidate(),n.store.listPrompts?.invalidate?.({playbookId:e})]),t?.onSuccess&&await t.onSuccess(l,o,c,f)},onError(l,o,c,f){t?.onError?.(l,o,c,f)}});return{editPrompt:async(l,o)=>{await r.mutateAsync({playbookId:e,promptName:l,prompt:{title:o.title,description:o.description,body:o.body}})},isPending:r.isPending}}function BC(e,t){const{data:n,isLoading:r,error:i}=gt.tools.list.useQuery({playbookId:e,serverName:t},{throwOnError:!1,retry:!1});return{tools:n,isToolsLoading:r,toolsError:i}}function UC(e){const{data:t,isLoading:n,error:r}=gt.store.get.useQuery({playbookId:e},{throwOnError:!1,retry:!1});return{playbook:t,isPlaybookLoading:n,playbookError:r}}function yJ(e,t){const n=gt.useUtils(),r=gt.tools.updateBatch.useMutation({onSuccess:async()=>{await n.tools.list.invalidate({playbookId:e}),t?.onSuccess&&await t.onSuccess()},onError:async l=>{t?.onError&&await t.onError(new Error(l.message))}});return{updateTools:async l=>{await r.mutateAsync({playbookId:e,tools:l})},isPending:r.isPending}}const bJ=()=>{const{playbookId:e}=df(),t=Ir(),n=gt.useUtils();if(!e)throw new Error("Playbook ID is required");const{playbook:r,isPlaybookLoading:i,playbookError:l}=UC(e),{tools:o,isToolsLoading:c}=BC(e),{data:f,isLoading:p}=RC(e),{updateTools:y,isPending:g}=yJ(e,{onSuccess:()=>{Pt({title:"Tools updated",description:"Your tools have been successfully updated."})},onError:U=>{Pt({title:"Error",description:U.message||"Failed to update tools"})}}),{changeInstallState:x,isPending:A}=mJ(e,{onSuccess:(U,k)=>{Pt({title:k?"Playbook installed":"Playbook uninstalled",description:k?"This playbook was successfully installed":"This playbook was successfully uninstalled"})},onError:(U,k)=>{Pt({title:"Error",description:k?"Failed to install this playbook":"Failed to uninstall this playbook"})}}),{createPrompt:S,isPending:_}=kC(e,{onSuccess:async()=>{await n.store.get.invalidate({playbookId:e}),Pt({title:"Prompt saved",description:"Your prompt was saved."})}}),{editPrompt:w,isPending:C}=gJ(e,{onSuccess:async()=>{await n.store.get.invalidate({playbookId:e}),Pt({title:"Prompt updated",description:"Your prompt was updated."})}}),{deletePrompt:R,isPending:D}=pJ(e,{onSuccess:async()=>{await n.store.get.invalidate({playbookId:e}),Pt({title:"Prompt deleted",description:"Your prompt was deleted."})}}),{authenticate:P}=FC();return i?m.jsx(HC,{}):l||!r?m.jsx(t0,{icon:"dead-smiley",fullScreen:!0,title:"Unexpected Error",subtitle:l?.message}):m.jsxs(m.Fragment,{children:[m.jsx(ks,{breadcrumbs:[{title:e}],children:m.jsx(vJ,{playbook:r})}),m.jsx(Pi,{children:m.jsx(xa,{size:"xl",children:m.jsxs(H6,{children:[m.jsx(F6,{children:m.jsxs(Nt,{className:"gap-y-8",children:[m.jsxs(Ot,{children:[m.jsx(Rt,{children:r.name}),m.jsx(ti,{children:r.description})]}),m.jsxs(x6,{default:"servers",children:[m.jsx(Ya,{id:"servers",label:"Servers",icon:m.jsx(Wx,{}),content:m.jsx(dJ,{servers:r.servers,onClickServer:U=>t(`/${e}/${U.name}`),onClickAddServer:()=>t("/library"),onClickAuthorize:async U=>{try{await P({playbookId:e,serverName:U.name})}catch(k){Pt({title:"Authentication failed",description:k instanceof Error?k.message:"Unknown error"})}}})}),m.jsx(Ya,{id:"tools",label:"Tools",icon:m.jsx(Q1,{}),content:m.jsx(v6,{tools:o,toolsLoading:c,editable:!0,isSaving:g,onUpdateTools:y})}),m.jsx(Ya,{id:"prompts",label:"Prompts",icon:m.jsx(a5,{}),content:m.jsx(uJ,{prompts:r.prompts??[],onCreatePrompt:S,onEditPrompt:w,onDeletePrompt:R,isSavingPrompt:_||C||D})})]})]})}),m.jsx(B6,{children:m.jsx(aJ,{playbook:r,gatewayBaseUrl:hf,clients:f??[],onChangeInstall:x,isLoading:A||p})})]})})})]})};function vJ({playbook:e}){const t=Ir(),[n,r]=h.useState(!1),[i,l]=h.useState(!1),o=gt.useUtils(),c=gt.store.update.useMutation({onSuccess:async()=>{await o.store.getAll.invalidate(),await o.store.get.invalidate({playbookId:e.id}),Pt({title:"Playbook updated",description:"This playbook was successfully updated."}),r(!1)}}),f=gt.store.delete.useMutation({onSuccess:async()=>{await o.store.getAll.invalidate(),Pt({title:"Playbook deleted",description:"This playbook was successfully deleted."}),l(!1),t("/")}}),p=async g=>{await c.mutateAsync({playbookId:e.id,attributes:g})},y=async()=>{await f.mutateAsync({playbookId:e.id})};return m.jsxs(m.Fragment,{children:[m.jsx(sJ,{onSettingsClick:()=>r(!0),onDeleteClick:()=>l(!0)}),m.jsx(lJ,{playbook:e,onSubmit:p,open:n,onOpenChange:r}),m.jsx(V1,{title:"Delete playbook?",description:"Are you sure you want to delete this playbook? This action cannot be undone.",open:i,onOpenChange:l,onConfirm:y})]})}function EJ({target:e,...t}){return m.jsx(Ka,{...t,children:m.jsx(xJ,{target:e})})}function xJ({target:e}){return e.type==="stdio"?m.jsxs(m.Fragment,{children:[m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Type"})}),m.jsxs(Ut,{className:"ml-auto",children:[m.jsx(na,{children:m.jsx(Pg,{})}),m.jsx($t,{children:"STDIO"})]})]}),m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Command"})}),m.jsx(Ut,{className:"ml-auto",children:m.jsx($t,{children:e.command})})]}),e.args.length>0&&m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Arguments"})}),m.jsx(Wn,{className:"ml-auto justify-end",children:e.args.map(t=>m.jsx(Ut,{children:m.jsx($t,{children:t})},t))})]}),e.env&&Object.keys(e.env).length>0&&m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Environment"})}),m.jsx(Wn,{className:"ml-auto justify-end",children:Object.entries(e.env).map(([t,n])=>m.jsx(Ut,{children:m.jsx($t,{children:`${t}=${n}`})},t))})]}),m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Status"})}),m.jsx(Wn,{className:"ml-auto justify-end",children:m.jsx(wg,{server:e})})]})]}):e.type==="http"?m.jsxs(m.Fragment,{children:[m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Type"})}),m.jsxs(Ut,{className:"ml-auto",children:[m.jsx(na,{children:m.jsx(Lg,{})}),m.jsx($t,{children:e.type})]})]}),m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"URL"})}),m.jsx(qa,{className:"ml-auto",children:e.url})]}),m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Status"})}),m.jsx(Wn,{className:"ml-auto justify-end",children:m.jsx(wg,{server:e})})]})]}):void 0}function AJ(e,t){const{playbook:n,isPlaybookLoading:r,playbookError:i}=UC(e),l=n?.servers.find(o=>o.name===t);if(r)return{playbook:null,playbookTarget:null,isPlaybookTargetLoading:!0,playbookTargetError:null};{const o=l?null:`Playbook target '${t}' not found`;return{playbook:n,playbookTarget:l,isPlaybookTargetLoading:r,playbookTargetError:i||o}}}function VC(e){return e0.entries.getEntryByName.useQuery({name:e.entryName??""},{enabled:!!e.entryName})}function TJ(){const[e,t]=h.useState(!1),[n,r]=h.useState(null),i=gt.useUtils(),l=gt.store.logout.useMutation();return{logout:async({playbookId:c,serverName:f})=>{t(!0),r(null);try{await l.mutateAsync({playbookId:c,serverName:f}),await i.store.get.invalidate({playbookId:c}),await i.store.getAll.invalidate()}catch(p){const y=p instanceof Error?p:new Error("Logout failed");throw r(y),y}finally{t(!1)}},isLoading:e,error:n}}function _J({playbookTarget:e,playbook:t}){const n=Ir(),[r,i]=h.useState(!1),[l,o]=h.useState(!1),c=gt.useUtils(),f=gt.store.removeServer.useMutation({onSuccess:async()=>{n(`/${t.id}`),await c.store.get.invalidate({playbookId:t.id}),await c.store.getAll.invalidate(),Pt({title:"Server deleted",description:"This server was successfully deleted."})}}),p=async()=>{await f.mutateAsync({playbookId:t.id,serverName:e.name})},{logout:y}=TJ(),{authenticate:g}=FC(),x=async()=>{await y({playbookId:t.id,serverName:e.name}),o(!1),Pt({title:"Logged out",description:"This server was successfully logged out."})};return m.jsxs(m.Fragment,{children:[m.jsxs(s8,{children:[m.jsx(l8,{asChild:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"radix-state-[open]:bg-accent-subtle",children:[m.jsx(Fc,{weight:"fill",className:"!size-4"}),m.jsx("span",{className:"sr-only",children:"Settings"})]})}),m.jsx(o8,{align:"end",children:m.jsxs(h1,{children:[e.type==="http"&&e.connectionInfo?.isAuthenticated&&m.jsxs(Ba,{children:[m.jsx(Ua,{children:m.jsx(l5,{})}),m.jsx(Rr,{onClick:()=>o(!0),children:"Logout"})]}),e.type==="http"&&!e.connectionInfo?.isAuthenticated&&m.jsx(Ba,{children:m.jsx(Rr,{onClick:async()=>{await g({playbookId:t.id,serverName:e.name})},children:"Authenticate"})}),m.jsxs(Ba,{onSelect:A=>A.preventDefault(),children:[m.jsx(Ua,{children:m.jsx(Bc,{})}),m.jsx(Rr,{onClick:()=>i(!0),children:"Delete"})]})]})})]}),m.jsx(V1,{title:"Delete this server",description:"Are you sure you want to delete this server? This action cannot be undone.",open:r,onOpenChange:i,onConfirm:p}),m.jsx(V1,{title:"Logout this server",description:"Are you sure you want to logout this server? This action cannot be undone.",open:l,onOpenChange:o,onConfirm:x})]})}function SJ(){const{playbookId:e,targetId:t}=df(),n=Ir();if(!e||!t)throw new Error("Playbook ID and target ID are required");const{playbook:r,playbookTarget:i,isPlaybookTargetLoading:l,playbookTargetError:o}=AJ(e,t),{tools:c,isToolsLoading:f}=BC(e,t),y=VC({entryName:t}).data;return l?m.jsx(HC,{}):o||!i||!r?m.jsx(t0,{icon:"dead-smiley",fullScreen:!0,title:"Unexpected Error",subtitle:o?.toString()||"Unknown error"}):m.jsxs(Cs,{children:[m.jsx(ks,{breadcrumbs:[{title:r?.name||"",onClick:()=>n(`/${e}`)},{title:i?.name}],children:m.jsx(_J,{playbookTarget:i,playbook:r})}),m.jsx(Pi,{children:m.jsxs(xa,{size:"lg",children:[m.jsxs(Nt,{className:"gap-y-8",children:[m.jsx(Sf,{src:y?.icon,className:"size-9"}),m.jsxs(Ot,{children:[m.jsx(Rt,{children:i.name}),m.jsxs(ti,{children:["Installed on"," ",m.jsx("button",{onClick:()=>n(`/${e}`),className:"cursor-pointer text-fg underline",children:r?.name})]})]}),y?.description?m.jsx(Vo,{children:y?.description}):null]}),m.jsxs(x6,{default:"tools",children:[m.jsx(Ya,{id:"readme",label:"Readme",icon:m.jsx(q1,{}),content:m.jsx(iS,{readme:y?.readme??null})}),m.jsx(Ya,{id:"tools",label:"Tools",icon:m.jsx(Q1,{}),content:m.jsx(v6,{tools:c,toolsLoading:f})}),m.jsx(Ya,{id:"properties",label:"Properties",icon:m.jsx($1,{}),content:m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Transport Configuration"})})}),m.jsx(EJ,{target:i})]})})]})]})})]})}function CJ({entry:e,playbooks:t,onClickInstall:n,onClickCancel:r,isInstalling:i=!1}){const l=(t??[]).filter(o=>o.servers.some(c=>c.name===e.name)).map(o=>o.id);return m.jsxs(m.Fragment,{children:[l.length>0&&m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h3",asChild:!0,children:m.jsx("h3",{children:"Installed on"})})}),m.jsx(Wn,{children:l.map(o=>m.jsx(Ut,{className:"cursor-pointer",children:m.jsx($t,{children:o})},o))})]}),m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h3",asChild:!0,children:m.jsx("h3",{children:"Add to playbook"})})}),m.jsx(B1,{registryEntry:e,playbooks:t,onSubmit:n,isSubmitting:i,onClickCancel:r})]})]})}function wJ({children:e}){return m.jsxs(Cs,{className:"pointer-events-none relative select-none",children:[e,m.jsx(ks,{breadcrumbs:[{title:"Library"},{title:"Loading"}],loading:!0,children:m.jsx(bt,{disabled:!0,className:"ml-auto",children:"Add to playbook"})}),m.jsx(Pi,{"aria-hidden":!0,children:m.jsxs(xa,{size:"lg",children:[m.jsxs(Nt,{className:"gap-y-6",children:[m.jsxs(Ot,{className:"opacity-50",children:[m.jsx(Rt,{children:m.jsx(Jr,{text:"Title"})}),m.jsx(ti,{children:m.jsx(Jr,{text:"Description"})})]}),m.jsxs(Wn,{children:[m.jsxs(Ut,{className:"opacity-50",children:[m.jsx(na,{children:m.jsx(u5,{weight:"bold"})}),m.jsx($t,{uppercase:!0,children:m.jsx(Jr,{text:"Badge"})})]}),m.jsxs(Ut,{className:"ml-auto opacity-50",children:[m.jsx(na,{children:m.jsx(t5,{weight:"bold"})}),m.jsx($t,{uppercase:!0,children:"Homepage"})]})]})]}),m.jsx(al,{}),m.jsxs(Nt,{children:[m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Transport"})})}),m.jsx(sl,{})]}),m.jsx(al,{}),m.jsxs(Nt,{children:[m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Parameters"})})}),m.jsx(sl,{})]}),m.jsx(al,{}),m.jsxs(Nt,{children:[m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Tools"})})}),m.jsx(sl,{})]})]})})]})}var eh="Popover",[zC]=gr(eh,[nf]),p0=nf(),[NJ,Ms]=zC(eh),ZC=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:l,modal:o=!1}=e,c=p0(t),f=h.useRef(null),[p,y]=h.useState(!1),[g,x]=ra({prop:r,defaultProp:i??!1,onChange:l,caller:eh});return m.jsx(tA,{...c,children:m.jsx(NJ,{scope:t,contentId:za(),triggerRef:f,open:g,onOpenChange:x,onOpenToggle:h.useCallback(()=>x(A=>!A),[x]),hasCustomAnchor:p,onCustomAnchorAdd:h.useCallback(()=>y(!0),[]),onCustomAnchorRemove:h.useCallback(()=>y(!1),[]),modal:o,children:n})})};ZC.displayName=eh;var qC="PopoverAnchor",OJ=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ms(qC,n),l=p0(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:c}=i;return h.useEffect(()=>(o(),()=>c()),[o,c]),m.jsx(Gg,{...l,...r,ref:t})});OJ.displayName=qC;var YC="PopoverTrigger",$C=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ms(YC,n),l=p0(n),o=Qt(t,i.triggerRef),c=m.jsx(tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":WC(i.open),...r,ref:o,onClick:qe(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:m.jsx(Gg,{asChild:!0,...l,children:c})});$C.displayName=YC;var Z6="PopoverPortal",[RJ,kJ]=zC(Z6,{forceMount:void 0}),QC=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,l=Ms(Z6,t);return m.jsx(RJ,{scope:t,forceMount:n,children:m.jsx(aa,{present:n||l.open,children:m.jsx(rf,{asChild:!0,container:i,children:r})})})};QC.displayName=Z6;var Zo="PopoverContent",GC=h.forwardRef((e,t)=>{const n=kJ(Zo,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,l=Ms(Zo,e.__scopePopover);return m.jsx(aa,{present:r||l.open,children:l.modal?m.jsx(LJ,{...i,ref:t}):m.jsx(DJ,{...i,ref:t})})});GC.displayName=Zo;var MJ=ll("PopoverContent.RemoveScroll"),LJ=h.forwardRef((e,t)=>{const n=Ms(Zo,e.__scopePopover),r=h.useRef(null),i=Qt(t,r),l=h.useRef(!1);return h.useEffect(()=>{const o=r.current;if(o)return Wg(o)},[]),m.jsx(sf,{as:MJ,allowPinchZoom:!0,children:m.jsx(KC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qe(e.onCloseAutoFocus,o=>{o.preventDefault(),l.current||n.triggerRef.current?.focus()}),onPointerDownOutside:qe(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0,p=c.button===2||f;l.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:qe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),DJ=h.forwardRef((e,t)=>{const n=Ms(Zo,e.__scopePopover),r=h.useRef(!1),i=h.useRef(!1);return m.jsx(KC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(r.current||n.triggerRef.current?.focus(),l.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=l.target;n.triggerRef.current?.contains(o)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),KC=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:y,...g}=e,x=Ms(Zo,n),A=p0(n);return Bg(),m.jsx(X1,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:l,children:m.jsx(K1,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:y,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:p,onDismiss:()=>x.onOpenChange(!1),children:m.jsx(nA,{"data-state":WC(x.open),role:"dialog",id:x.contentId,...A,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),XC="PopoverClose",IJ=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ms(XC,n);return m.jsx(tt.button,{type:"button",...r,ref:t,onClick:qe(e.onClick,()=>i.onOpenChange(!1))})});IJ.displayName=XC;var PJ="PopoverArrow",jJ=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=p0(n);return m.jsx(rA,{...i,...r,ref:t})});jJ.displayName=PJ;function WC(e){return e?"open":"closed"}var HJ=ZC,FJ=$C,BJ=QC,UJ=GC;const VJ=HJ,zJ=FJ;function ZJ({className:e,align:t="center",sideOffset:n=2,...r}){return m.jsx(BJ,{children:m.jsx(UJ,{align:t,sideOffset:n,className:Ae("popover p-2","origin-[--radix-popover-content-transform-origin]","radix-state-[closed]:fade-out-0 radix-state-[open]:fade-in-0 radix-state-[closed]:zoom-out-95 radix-state-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 radix-state-[closed]:animate-out radix-state-[open]:animate-in",e),...r})})}function qJ(){const e=Ir(),{entryName:t}=df(),[n,r]=h.useState(!1),i=VC({entryName:t}),l=n0(),{install:o,isPending:c}=MC({onError:x=>{Pt({title:"Error",description:x.message})},onSuccess:(x,A)=>{Pt({title:"Playbook installed",description:"This playbook was successfully installed."}),e(`/${A.playbookId}`)}}),f=i.isLoading||l.isLoading,p=i.data,y=async x=>{p&&x.playbookId&&t&&await o({playbookId:x.playbookId,entryName:t,parameters:x.parameters??{}})};if(h.useEffect(()=>{!f&&!p&&(Pt({title:"Library entry not found",description:"The library entry you are looking for does not exist."}),e("/library"))},[p,f,e]),f||!p)return m.jsx(wJ,{});const g=l.data??[];return m.jsxs(Cs,{children:[m.jsx(ks,{breadcrumbs:[{title:"Library",onClick:()=>e("/library")},{title:p.title}],children:m.jsxs(VJ,{open:n,onOpenChange:r,children:[m.jsx(zJ,{asChild:!0,children:m.jsx(bt,{className:"ml-auto lg:hidden",children:"Add to playbook"})}),m.jsx(ZJ,{side:"bottom",align:"end",sideOffset:8,className:"w-sm max-w-[80dvw] rounded-[20px] lg:hidden",children:m.jsx(B1,{registryEntry:p,playbooks:g,onSubmit:y,isSubmitting:c})})]})}),m.jsx(Pi,{children:m.jsx(xa,{size:"xl",children:m.jsxs(H6,{children:[m.jsx(F6,{children:m.jsx(HS,{entry:p})}),m.jsx(B6,{children:m.jsx(CJ,{entry:p,playbooks:g,onClickInstall:y,isInstalling:c})})]})})})]})}const z1=xn().trim().min(1,"Required");xn().trim().optional();const JC=xn().trim().min(1,"Required").regex(/^[a-z0-9._-]+$/,"Only lowercase ASCII letters, digits, and characters ., -, _ are allowed");function YJ({open:e,onOpenChange:t,playbooks:n,onSubmit:r,isSubmitting:i=!1,...l}){const o={playbookId:n?.[0]?.id??void 0,server:{name:"",type:"stdio",command:"",args:[],env:{}}};return m.jsx(f0,{open:e,onOpenChange:t,...l,children:m.jsxs(Vf,{children:[m.jsx(Zf,{children:m.jsx(u0,{className:"grow",children:m.jsxs(c0,{children:[m.jsx(hl,{children:m.jsx(ml,{children:"Library"})}),m.jsx(d0,{}),m.jsx(hl,{children:m.jsx(ml,{children:"Add MCP server"})})]})})}),m.jsxs(zf,{children:[m.jsxs(qf,{children:[m.jsx(Yf,{children:"Add an MCP server"}),m.jsx($f,{className:"text-sm",children:"Manually add an MCP server to one of your playbooks."})]}),m.jsx(al,{}),m.jsx($J,{defaultValues:o,playbooks:n,onSubmit:r,isSubmitting:i})]})]})})}function $J({defaultValues:e,playbooks:t,onSubmit:n,isSubmitting:r=!1}){return m.jsx(M6,{schema:JJ,defaultValues:{...e,_env:[{key:"",value:""}],_headers:[{key:"",value:""}]},onSubmit:i=>{i.server.type==="stdio"?n({playbookId:i.playbookId,server:{...i.server,command:i.server.command.split(" ")[0],args:i.server.command.split(" ").slice(1),env:i._env.reduce((l,{key:o,value:c})=>(o&&(l[o]=c),l),{})}}):i.server.type==="http"&&n({playbookId:i.playbookId,server:{...i.server,headers:i._headers.reduce((l,{key:o,value:c})=>(o&&(l[o]=c),l),{})}})},children:m.jsx(QJ,{playbooks:t,isSubmitting:r})})}function QJ({playbooks:e,isSubmitting:t=!1}){const{control:n}=Ca(),r=KS({control:n,name:"server.type",defaultValue:"stdio"});return m.jsxs(m.Fragment,{children:[e&&m.jsx(Cg,{name:"playbookId",label:"Playbook",children:e.map(i=>m.jsx("option",{value:i.id,children:i.name},i.id))}),m.jsxs("div",{className:"flex flex-row gap-x-2 [&>div]:flex-1",children:[m.jsx(Ii,{label:"Name",name:"server.name",placeholder:"Enter server name…"}),m.jsxs(Cg,{label:"Transport",name:"server.type",children:[m.jsx("option",{value:"stdio",children:"STDIO"}),m.jsx("option",{value:"http",children:"HTTP"})]})]}),r==="stdio"&&m.jsx(GJ,{}),r==="http"&&m.jsx(KJ,{}),m.jsx(bt,{type:"submit",disabled:t,children:t?"Adding...":"Add MCP Server"})]})}function GJ(){return m.jsxs("div",{className:"space-y-4",children:[m.jsx(z6,{className:"min-h-auto",label:"Command",name:"server.command",placeholder:"e.g. npx -y @modelcontextprotocol/my-server <filepath>"}),m.jsxs("div",{className:"flex flex-col gap-y-2",children:[m.jsx(_l,{children:"Environment variables"}),m.jsx(ew,{name:"_env",keyPlaceholder:"Variable name",valuePlaceholder:"Value",addSrText:"Add environment variable"})," "]})]})}function KJ(){return m.jsxs("div",{className:"space-y-4",children:[m.jsx(Ii,{label:"URL",name:"server.url",placeholder:"Enter server URL…"}),m.jsxs("div",{className:"flex flex-col gap-y-2",children:[m.jsx(_l,{children:"Headers"}),m.jsx(ew,{name:"_headers",keyPlaceholder:"Header name",valuePlaceholder:"Value",addSrText:"Add header"})]})]})}function ew({name:e,keyPlaceholder:t,valuePlaceholder:n,addSrText:r}){const{control:i}=Ca(),{fields:l,append:o,remove:c}=cW({control:i,name:e}),f=()=>{o({key:"",value:""})};return m.jsx("div",{className:"space-y-2",children:l.map((p,y)=>m.jsxs("div",{className:"flex flex-row gap-x-2 [&>div]:flex-1",children:[m.jsx(Ii,{name:`${e}.${y}.key`,placeholder:t}),m.jsx(Ii,{name:`${e}.${y}.value`,placeholder:n}),y<l.length-1?m.jsxs(bt,{className:"size-8 leading-8",type:"button",variant:"secondary",size:"icon",onClick:()=>c(y),children:[m.jsx(Bc,{}),m.jsx("div",{className:"sr-only",children:"Remove"})]}):m.jsxs(bt,{className:"size-8 leading-8",type:"button",variant:"secondary",size:"icon",onClick:f,children:[m.jsx(Dg,{}),m.jsx("div",{className:"sr-only",children:r})]})]},p.id))})}const XJ=ga({name:JC,type:ZS("stdio"),command:z1,args:Eg(xn()),env:zS(z1,xn()).optional()}),WJ=ga({name:JC,type:ZS("http"),url:z1.url(),headers:zS(z1,xn()).optional()}),JJ=ga({playbookId:xn().optional(),server:ZX("type",[XJ,WJ]),_env:Eg(ga({key:xn(),value:xn()})),_headers:Eg(ga({key:xn(),value:xn()}))});function eee({className:e,entry:t,onClick:n}){return m.jsxs("div",{className:Ae("flex h-40 cursor-pointer flex-col justify-between gap-y-6 rounded-lg bg-accent-subtle p-4 transition-colors duration-200 ease-in-out hover:bg-accent",e),onClick:n,children:[m.jsx(Sf,{src:t.icon,className:"size-8"}),m.jsxs("div",{className:"flex flex-col gap-y-1",children:[m.jsxs("div",{className:"flex items-center gap-x-1 font-[450] text-[17px]",children:[t.title," ",t.isOfficial&&m.jsx(Ig,{weight:"fill"})]}),t.description&&m.jsx("div",{className:"line-clamp-2 text-pretty text-[14px] text-fg-subtle",children:t.description})]})]})}function tee({className:e,...t}){return m.jsx("div",{className:Ae("@container grid @2xl:grid-cols-2 grid-cols-1 gap-3",e),...t})}function nee({entries:e,pagination:t,searchQuery:n,onSearchQueryChange:r,onPageChange:i,onManualAddClick:l,onEntryClick:o}){return m.jsx(xa,{size:"lg",children:m.jsxs(Nt,{className:"gap-y-6",children:[m.jsxs(Ot,{children:[m.jsx(Rt,{children:"Discover MCP servers"}),m.jsx(ti,{children:"Find MCP servers for your favourite tools and install them directly to your Director playbooks."})]}),m.jsxs("div",{className:"flex flex-col gap-y-4",children:[m.jsxs("div",{className:"flex flex-row items-center justify-between",children:[m.jsx(m0,{type:"text",placeholder:"Search MCP servers...",value:n,onChange:c=>r(c.target.value),className:"max-w-md"}),m.jsx(bt,{onClick:l,children:"Add manually"})]}),m.jsxs(tee,{children:[e.sort((c,f)=>c.title.localeCompare(f.title)).map(c=>m.jsx(eee,{entry:c,onClick:()=>o?.(c.name)},c.id)),e.length===0&&m.jsx(Ta,{className:"col-span-2",children:m.jsx(ni,{children:"No MCP servers found"})})]})]}),t.totalItems>0&&m.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[m.jsx("div",{children:m.jsxs(bt,{className:Ae(!t.hasPreviousPage&&"hidden"),variant:"secondary",onClick:()=>i(t.pageIndex-1),children:[m.jsx(zx,{})," Previous"]})}),m.jsxs("span",{className:"text-center text-fg-subtle text-sm leading-7",children:["Page ",t.pageIndex+1," of ",t.totalPages]}),m.jsx("div",{className:"flex justify-end",children:m.jsxs(bt,{className:Ae(!t.hasNextPage&&"hidden"),variant:"secondary",onClick:()=>i(t.pageIndex+1),children:["Next ",m.jsx(Og,{})]})})]})]})})}function ree({children:e}){return m.jsxs(Cs,{className:"pointer-events-none relative select-none",children:[e,m.jsx(ks,{breadcrumbs:[{title:"Loading playbook"}],loading:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"radix-state-[open]:bg-accent-subtle",disabled:!0,children:[m.jsx(Fc,{weight:"fill",className:"!size-4"}),m.jsx("span",{className:"sr-only",children:"Settings"})]})}),m.jsx(Pi,{"aria-hidden":!0,children:m.jsx(xa,{size:"lg",children:m.jsxs(Nt,{className:"gap-y-6",children:[m.jsxs(Ot,{children:[m.jsx(Rt,{children:"Discover MCP servers"}),m.jsx(ti,{children:"Find MCP servers for your favourite tools and install them directly to your Director playbooks."})]}),m.jsx(sl,{})]})})})]})}function aee(e){const t=gt.useUtils(),n=gt.store.addServer.useMutation({...e,async onSuccess(r,i,l,o){await t.store.getAll.invalidate(),await t.store.get.invalidate({playbookId:i.playbookId}),await e?.onSuccess?.(r,i,l,o)}});return{addServer:n.mutateAsync,isPending:n.isPending}}const iee=()=>{const e=Ir(),[t,n]=h.useState(0),[r,i]=h.useState(""),[l,o]=h.useState(!1),{data:c}=n0(),{data:f,isLoading:p,error:y}=LC({pageIndex:t,pageSize:20,searchQuery:r}),{addServer:g,isPending:x}=aee({onSuccess:(A,S)=>{Pt({title:"Server added",description:"The server has been added to the playbook"}),o(!1),e(`/${S.playbookId}`)},onError:()=>{Pt({title:"Failed to add server",description:"Please check Director CLI logs for more information."})}});return p?m.jsx(ree,{}):!f||y?m.jsx(Cs,{children:m.jsx(Pi,{children:m.jsx("div",{className:"inset-0 grid place-items-center",children:m.jsxs(Ta,{children:[m.jsx(ni,{children:"Something went wrong."}),m.jsx(Ns,{children:"Please try again"})]})})})}):m.jsxs(Cs,{children:[m.jsx(ks,{breadcrumbs:[{title:"Library"}]}),m.jsxs(Pi,{children:[m.jsx(nee,{entries:f.entries,pagination:f.pagination,searchQuery:r,onSearchQueryChange:i,onPageChange:n,onManualAddClick:()=>o(!0),onEntryClick:A=>e(`/library/mcp/${A}`)}),m.jsx(YJ,{open:l,onOpenChange:o,playbooks:c,onSubmit:async A=>{if(!A.playbookId){Pt({title:"No playbook selected",description:"Please select a playbook before adding a server."});return}await g({playbookId:A.playbookId,server:{name:A.server.name,transport:A.server}})},isSubmitting:x})]})]})},see=()=>{const e=Ir(),{data:t,isLoading:n,error:r}=n0(),i=n||r?.message==="Failed to fetch",l=Ja(),{setInProgress:o}=C8();return h.useEffect(()=>{o(!1)},[o]),m.jsxs(GW,{sections:[{id:"registries",label:"Registries",items:[{id:"mcp",label:"MCP",icon:m.jsx(i7,{}),isActive:l.pathname==="/library",onClick:()=>e("/library")}]},{id:"playbooks",label:"Playbooks",isLoading:i,items:t?.map(c=>({id:c.id,label:c.name,isActive:l.pathname===`/${c.id}`,onClick:()=>e(`/${c.id}`)}))||[]},{id:"actions",items:[{id:"new-playbook",label:"New Playbook",icon:m.jsx(Dg,{}),isActive:l.pathname==="/new",onClick:()=>e("/new")},{id:"documentation",label:"Documentation",icon:m.jsx(q1,{weight:"fill"}),onClick:()=>window.open("https://docs.director.run","_blank","noopener noreferrer")},{id:"github",label:"Github",icon:m.jsx(Mg,{}),onClick:()=>window.open("https://github.com/director-run/director","_blank","noopener noreferrer")}]}],children:[m.jsx(Cs,{children:m.jsx(xP,{})}),m.jsx(KA,{})]})},lee=5e3,oee=({children:e})=>{const{error:t,isLoading:n}=gt.health.useQuery(void 0,{refetchInterval:lee,retry:!1,throwOnError:!1,enabled:!0});return n?m.jsx(OC,{}):t?m.jsx(t0,{icon:"plugs",fullScreen:!0,title:"Can't connect to the backend",subtitle:"Please make sure director is running and refresh the page.",data:["# Start director","$ director serve","$ director studio"].join(`
|
|
148
|
+
`," ")})}function Vo({children:e,className:t}){return m.jsx("div",{className:Ae("prose",t),children:m.jsx(V7,{remarkPlugins:[aS],rehypePlugins:[D9],components:{table:({children:n})=>m.jsx("div",{className:"max-w-full overflow-x-auto overflow-y-auto",children:m.jsx("table",{children:n})})},children:e})})}function iS({readme:e}){return e?m.jsx(Vo,{className:"!max-w-none",children:e}):m.jsx(Ta,{children:m.jsx(ni,{children:"No readme found"})})}function LK({parameters:e,...t}){return e.length===0?m.jsxs(Ta,{children:[m.jsx(ni,{children:"No parameters"}),m.jsx(Ns,{children:"This MCP server does not have any parameters."})]}):m.jsx(Ka,{...t,children:e.filter((n,r,i)=>i.findIndex(l=>l.name===n.name)===r).map(n=>m.jsxs(wn,{children:[m.jsxs(dn,{children:[m.jsx(an,{className:"font-mono",children:n.name}),n.description&&m.jsx(qa,{children:n.description})]}),m.jsxs(Wn,{children:[n.required&&m.jsxs(Ut,{variant:"destructive",children:[m.jsx(na,{children:m.jsx(qx,{weight:"bold"})}),m.jsx($t,{uppercase:!0,children:"Required"})]}),n.type==="string"&&m.jsxs(Ut,{children:[m.jsx(na,{children:m.jsx(c5,{})}),m.jsx($t,{uppercase:!0,children:"String"})]})]})]},n.name))})}const px="░▒▓█",gx=e=>e.split("").map(()=>px[Math.floor(Math.random()*px.length)]).join(""),Jr=({text:e,scrambleSpeed:t=250,className:n,...r})=>{const[i,l]=h.useState(gx(e));return h.useEffect(()=>{let o;return o=setInterval(()=>{l(gx(e))},t),()=>{o&&clearInterval(o)}},[e,t]),m.jsxs("span",{className:Ae("inline-block whitespace-pre-wrap",n),...r,children:[m.jsx("span",{className:"sr-only",children:e}),m.jsx("span",{"aria-hidden":"true",suppressHydrationWarning:!0,children:i})]})};function sl(){return m.jsx("div",{className:"flex flex-col border-accent border-y-[0.5px] opacity-50",children:new Array(3).fill(0).map((e,t)=>m.jsx(DK,{},`loading-${t}`))})}function DK(){return m.jsxs(wn,{children:[m.jsxs(dn,{children:[m.jsx(an,{children:m.jsx(Jr,{text:"Loading title"})}),m.jsx(qa,{children:m.jsx(Jr,{text:"Loading subtitle"})})]}),m.jsx(Wn,{children:m.jsx(Ut,{children:m.jsx($t,{children:m.jsx(Jr,{text:"Loading badge"})})})})]})}function IK(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Hf="Switch",[PK]=gr(Hf),[jK,HK]=PK(Hf),sS=h.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:l,required:o,disabled:c,value:f="on",onCheckedChange:p,form:y,...g}=e,[x,A]=h.useState(null),S=Qt(t,D=>A(D)),_=h.useRef(!1),w=x?y||!!x.closest("form"):!0,[C,R]=ra({prop:i,defaultProp:l??!1,onChange:p,caller:Hf});return m.jsxs(jK,{scope:n,checked:C,disabled:c,children:[m.jsx(tt.button,{type:"button",role:"switch","aria-checked":C,"aria-required":o,"data-state":cS(C),"data-disabled":c?"":void 0,disabled:c,value:f,...g,ref:S,onClick:qe(e.onClick,D=>{R(P=>!P),w&&(_.current=D.isPropagationStopped(),_.current||D.stopPropagation())})}),w&&m.jsx(uS,{control:x,bubbles:!_.current,name:r,value:f,checked:C,required:o,disabled:c,form:y,style:{transform:"translateX(-100%)"}})]})});sS.displayName=Hf;var lS="SwitchThumb",oS=h.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=HK(lS,n);return m.jsx(tt.span,{"data-state":cS(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});oS.displayName=lS;var FK="SwitchBubbleInput",uS=h.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},l)=>{const o=h.useRef(null),c=Qt(o,l),f=IK(n),p=q5(t);return h.useEffect(()=>{const y=o.current;if(!y)return;const g=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(g,"checked").set;if(f!==n&&A){const S=new Event("click",{bubbles:r});A.call(y,n),y.dispatchEvent(S)}},[f,n,r]),m.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:c,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});uS.displayName=FK;function cS(e){return e?"checked":"unchecked"}var BK=sS,UK=oS;function o6({className:e,...t}){return m.jsx(BK,{"data-slot":"switch",className:Ae("peer inline-flex w-9 shrink-0 items-center rounded-full border border-fg/10 p-0.5 outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-success data-[state=unchecked]:bg-fg/20","cursor-pointer",e),...t,children:m.jsx(UK,{"data-slot":"switch-thumb",className:Ae("pointer-events-none block size-4 rounded-full bg-success-fg ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0","radix-state-[unchecked]:bg-fg/80")})})}const u0=h.forwardRef(({...e},t)=>m.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));u0.displayName="Breadcrumb";const c0=h.forwardRef(({className:e,...t},n)=>m.jsx("ol",{ref:n,className:Ae("flex flex-wrap items-center gap-1.5 break-words text-[13px] text-fg-subtle",e),...t}));c0.displayName="BreadcrumbList";const hl=h.forwardRef(({className:e,...t},n)=>m.jsx("li",{ref:n,className:Ae("inline-flex min-w-0 max-w-[16ch] items-center gap-1.5 overflow-hidden",e),...t}));hl.displayName="BreadcrumbItem";const dS=h.forwardRef(({asChild:e,className:t,...n},r)=>{const i=e?Bn:"a";return m.jsx(i,{ref:r,className:Ae("truncate font-normal text-fg transition-colors hover:text-fg-subtle",t),...n})});dS.displayName="BreadcrumbLink";const ml=h.forwardRef(({className:e,...t},n)=>m.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Ae("truncate font-medium text-fg",e),...t}));ml.displayName="BreadcrumbPage";const d0=({children:e,className:t,...n})=>m.jsx("li",{role:"presentation","aria-hidden":"true",className:Ae("[&>svg]:size-3",t),...n,children:e??m.jsx(Y1,{weight:"bold"})});d0.displayName="BreadcrumbSeparator";var Ff="Collapsible",[VK,fS]=gr(Ff),[zK,u6]=VK(Ff),hS=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:l,onOpenChange:o,...c}=e,[f,p]=ra({prop:r,defaultProp:i??!1,onChange:o,caller:Ff});return m.jsx(zK,{scope:n,disabled:l,contentId:za(),open:f,onOpenToggle:h.useCallback(()=>p(y=>!y),[p]),children:m.jsx(tt.div,{"data-state":d6(f),"data-disabled":l?"":void 0,...c,ref:t})})});hS.displayName=Ff;var mS="CollapsibleTrigger",pS=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=u6(mS,n);return m.jsx(tt.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":d6(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:qe(e.onClick,i.onOpenToggle)})});pS.displayName=mS;var c6="CollapsibleContent",gS=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=u6(c6,e.__scopeCollapsible);return m.jsx(aa,{present:n||i.open,children:({present:l})=>m.jsx(ZK,{...r,ref:t,present:l})})});gS.displayName=c6;var ZK=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...l}=e,o=u6(c6,n),[c,f]=h.useState(r),p=h.useRef(null),y=Qt(t,p),g=h.useRef(0),x=g.current,A=h.useRef(0),S=A.current,_=o.open||c,w=h.useRef(_),C=h.useRef(void 0);return h.useEffect(()=>{const R=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(R)},[]),ea(()=>{const R=p.current;if(R){C.current=C.current||{transitionDuration:R.style.transitionDuration,animationName:R.style.animationName},R.style.transitionDuration="0s",R.style.animationName="none";const D=R.getBoundingClientRect();g.current=D.height,A.current=D.width,w.current||(R.style.transitionDuration=C.current.transitionDuration,R.style.animationName=C.current.animationName),f(r)}},[o.open,r]),m.jsx(tt.div,{"data-state":d6(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!_,...l,ref:y,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":S?`${S}px`:void 0,...e.style},children:_&&i})});function d6(e){return e?"open":"closed"}var yS=hS,bS=pS,vS=gS,Sa="Accordion",qK=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[f6,YK,$K]=Fg(Sa),[Bf]=gr(Sa,[$K,fS]),h6=fS(),m6=J.forwardRef((e,t)=>{const{type:n,...r}=e,i=r,l=r;return m.jsx(f6.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?m.jsx(XK,{...l,ref:t}):m.jsx(KK,{...i,ref:t})})});m6.displayName=Sa;var[ES,QK]=Bf(Sa),[xS,GK]=Bf(Sa,{collapsible:!1}),KK=J.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:l=!1,...o}=e,[c,f]=ra({prop:n,defaultProp:r??"",onChange:i,caller:Sa});return m.jsx(ES,{scope:e.__scopeAccordion,value:J.useMemo(()=>c?[c]:[],[c]),onItemOpen:f,onItemClose:J.useCallback(()=>l&&f(""),[l,f]),children:m.jsx(xS,{scope:e.__scopeAccordion,collapsible:l,children:m.jsx(AS,{...o,ref:t})})})}),XK=J.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...l}=e,[o,c]=ra({prop:n,defaultProp:r??[],onChange:i,caller:Sa}),f=J.useCallback(y=>c((g=[])=>[...g,y]),[c]),p=J.useCallback(y=>c((g=[])=>g.filter(x=>x!==y)),[c]);return m.jsx(ES,{scope:e.__scopeAccordion,value:o,onItemOpen:f,onItemClose:p,children:m.jsx(xS,{scope:e.__scopeAccordion,collapsible:!0,children:m.jsx(AS,{...l,ref:t})})})}),[WK,Uf]=Bf(Sa),AS=J.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:l="vertical",...o}=e,c=J.useRef(null),f=Qt(c,t),p=YK(n),g=zc(i)==="ltr",x=qe(e.onKeyDown,A=>{if(!qK.includes(A.key))return;const S=A.target,_=p().filter(j=>!j.ref.current?.disabled),w=_.findIndex(j=>j.ref.current===S),C=_.length;if(w===-1)return;A.preventDefault();let R=w;const D=0,P=C-1,U=()=>{R=w+1,R>P&&(R=D)},k=()=>{R=w-1,R<D&&(R=P)};switch(A.key){case"Home":R=D;break;case"End":R=P;break;case"ArrowRight":l==="horizontal"&&(g?U():k());break;case"ArrowDown":l==="vertical"&&U();break;case"ArrowLeft":l==="horizontal"&&(g?k():U());break;case"ArrowUp":l==="vertical"&&k();break}const H=R%C;_[H].ref.current?.focus()});return m.jsx(WK,{scope:n,disabled:r,direction:i,orientation:l,children:m.jsx(f6.Slot,{scope:n,children:m.jsx(tt.div,{...o,"data-orientation":l,ref:f,onKeyDown:r?void 0:x})})})}),C1="AccordionItem",[JK,p6]=Bf(C1),g6=J.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...i}=e,l=Uf(C1,n),o=QK(C1,n),c=h6(n),f=za(),p=r&&o.value.includes(r)||!1,y=l.disabled||e.disabled;return m.jsx(JK,{scope:n,open:p,disabled:y,triggerId:f,children:m.jsx(yS,{"data-orientation":l.orientation,"data-state":SS(p),...c,...i,ref:t,disabled:y,open:p,onOpenChange:g=>{g?o.onItemOpen(r):o.onItemClose(r)}})})});g6.displayName=C1;var TS="AccordionHeader",eX=J.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=Uf(Sa,n),l=p6(TS,n);return m.jsx(tt.h3,{"data-orientation":i.orientation,"data-state":SS(l.open),"data-disabled":l.disabled?"":void 0,...r,ref:t})});eX.displayName=TS;var lg="AccordionTrigger",y6=J.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=Uf(Sa,n),l=p6(lg,n),o=GK(lg,n),c=h6(n);return m.jsx(f6.ItemSlot,{scope:n,children:m.jsx(bS,{"aria-disabled":l.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:l.triggerId,...c,...r,ref:t})})});y6.displayName=lg;var _S="AccordionContent",b6=J.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=Uf(Sa,n),l=p6(_S,n),o=h6(n);return m.jsx(vS,{role:"region","aria-labelledby":l.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});b6.displayName=_S;function SS(e){return e?"open":"closed"}const og=(e,t)=>{if(!e)return"any";const n=Array.isArray(e)?e.join(" | "):e;return t?`${n} (${t})`:n},CS=e=>!(e.oneOf||e.anyOf||e.allOf||e.properties&&Object.keys(e.properties).length>0||e.type==="array"||e.type==="object"),tX=e=>e.type!=="array"||!e.items?og(e.type,e.format):CS(e.items)?`${og(e.items.type,e.items.format)}[]`:"array",nX=(e,t)=>e.const!==void 0?String(e.const):e.properties?.type?.const!==void 0?String(e.properties.type.const):e.enum&&e.enum.length===1?String(e.enum[0]):e.title?e.title:e.description?e.description.slice(0,50)+(e.description.length>50?"...":""):!e.type&&!e.properties&&!e.oneOf&&!e.anyOf&&!e.allOf?"Any value":`Schema ${t+1}`,rX=e=>!e.type&&!e.properties&&!e.oneOf&&!e.anyOf&&!e.allOf&&!e.const&&!e.enum&&!e.items,Io=({unionType:e,schemas:t,level:n})=>{const r=i=>{switch(i){case"oneOf":return"Must match exactly one of the following schemas:";case"anyOf":return"Must match at least one of the following schemas:";case"allOf":return"Must match all of the following schemas:";default:return"Union type:"}};return m.jsxs("div",{className:"mt-4",children:[m.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[m.jsx(Ut,{className:"font-mono text-xs",children:e}),m.jsx("span",{className:"text-gray-600 text-sm",children:r(e)})]}),m.jsx(Ka,{asChild:!0,children:m.jsx(m6,{type:"multiple",children:t.map((i,l)=>{const o=nX(i,l),c=i.properties&&Object.keys(i.properties).length>0;return rX(i)?null:m.jsx(g6,{value:`option-${l}`,asChild:!0,children:m.jsxs(dg,{children:[m.jsx(fg,{name:o,required:!1,type:og(i.type,i.format),children:m.jsx(y6,{className:"flex size-6 cursor-pointer items-center justify-center rounded-lg bg-accent text-fg-subtle transition-opacity duration-200 hover:opacity-80 [&[data-state=open]>svg]:rotate-90",children:m.jsx(Y1,{weight:"bold",className:"size-4 transition-transform duration-200"})})}),m.jsxs(hg,{children:[i.description&&m.jsx(Vo,{children:i.description}),m.jsx(s1,{property:i}),m.jsx(ug,{property:i}),m.jsx(cg,{property:i}),m.jsxs(b6,{children:[c&&m.jsx(Ka,{children:Object.entries(i.properties||{}).map(([f,p])=>m.jsx(Dc,{name:f,property:p,required:Array.isArray(i.required)?i.required.includes(f):!1,level:n+1},f))}),i.oneOf&&m.jsx(Io,{unionType:"oneOf",schemas:i.oneOf,level:n+1}),i.anyOf&&m.jsx(Io,{unionType:"anyOf",schemas:i.anyOf,level:n+1}),i.allOf&&m.jsx(Io,{unionType:"allOf",schemas:i.allOf,level:n+1}),i.type==="array"&&i.items&&m.jsx(Dc,{name:"items",property:i.items,required:!1,level:n+1})]})]})]})},l)})})})]})};function s1({property:e}){if(!(e.minimum!==void 0||e.maximum!==void 0||e.minLength!==void 0||e.maxLength!==void 0||e.pattern!==void 0||e.enum!==void 0||e.const!==void 0))return null;const n=[];return e.minimum!==void 0&&n.push(["min",String(e.minimum)]),e.maximum!==void 0&&n.push(["max",String(e.maximum)]),e.minLength!==void 0&&n.push(["minLength",String(e.minLength)]),e.maxLength!==void 0&&n.push(["maxLength",String(e.maxLength)]),e.pattern&&n.push(["pattern",e.pattern]),e.enum&&n.push(["enum",e.enum.join(", ")]),e.const!==void 0&&n.push(["const",JSON.stringify(e.const)]),m.jsx("div",{className:"mb-2 text-gray-500 text-sm",children:n.map(([r,i])=>m.jsxs("div",{children:[m.jsxs("span",{className:"font-medium",children:[r,":"]})," ",i]},r))})}function ug({property:e}){return e.default?m.jsxs("div",{className:"text-gray-600 text-sm",children:[m.jsx("span",{className:"font-medium",children:"Default:"})," ",JSON.stringify(e.default)]}):null}function cg({property:e}){return e.example?m.jsxs("div",{className:"text-gray-600 text-sm",children:[m.jsx("span",{className:"font-medium",children:"Example:"})," ",JSON.stringify(e.example)]}):null}function Dc({name:e,property:t,required:n=!1,level:r=0,hideHeader:i=!1}){const l=t.properties&&Object.keys(t.properties).length>0,o=t.type==="array"&&t.items,c=o&&t.items&&!CS(t.items),f=t.oneOf||t.anyOf||t.allOf,p=()=>{if(f){const x=[];return t.oneOf&&x.push("oneOf"),t.anyOf&&x.push("anyOf"),t.allOf&&x.push("allOf"),x.join(" & ")}return tX(t)};if(l||c||f)return m.jsx(g6,{value:e,asChild:!0,children:m.jsxs(dg,{children:[!i&&m.jsx(fg,{name:e,required:n,type:p(),children:m.jsx(y6,{className:"flex size-6 cursor-pointer items-center justify-center rounded-lg bg-accent text-fg-subtle transition-opacity duration-200 hover:opacity-80 [&[data-state=open]>svg]:rotate-90",children:m.jsx(Y1,{weight:"bold",className:"size-4 transition-transform duration-200"})})}),m.jsxs(hg,{className:i?"ml-0":"ml-8",children:[t.description&&m.jsx(Vo,{children:t.description}),m.jsx(s1,{property:t}),m.jsx(ug,{property:t}),m.jsx(cg,{property:t}),o&&!c&&t.items&&m.jsx(s1,{property:t.items}),m.jsxs(b6,{children:[t.oneOf&&m.jsx(Io,{unionType:"oneOf",schemas:t.oneOf,level:r}),t.anyOf&&m.jsx(Io,{unionType:"anyOf",schemas:t.anyOf,level:r}),t.allOf&&m.jsx(Io,{unionType:"allOf",schemas:t.allOf,level:r}),l&&m.jsx(Ka,{children:Object.entries(t.properties||{}).map(([x,A])=>m.jsx(Dc,{name:`${e}.${x}`,property:A,required:!1,level:r+1},x))}),c&&t.items&&m.jsx(Dc,{name:e,property:t.items,required:!1,level:r+1,hideHeader:!0})]})]})]})});const y=t.minimum!==void 0&&t.maximum!==void 0&&t.minLength!==void 0&&t.maxLength!==void 0&&t.pattern!==void 0&&t.enum!==void 0&&t.const!==void 0,g=!t.description&&!t.default&&!t.example&&!y;return m.jsxs(dg,{children:[m.jsx(fg,{name:e,required:n,type:p()}),!g&&m.jsxs(hg,{children:[t.description&&m.jsx(Vo,{children:t.description}),m.jsx(s1,{property:t}),m.jsx(ug,{property:t}),m.jsx(cg,{property:t})]})]})}function dg({children:e,className:t,asChild:n,...r}){const i=n?Bn:"div";return m.jsx(i,{"data-slot":"property-item",className:Ae("flex flex-col border-accent border-b-[0.5px] py-3 outline-none last:border-b-0",t),...r,children:e})}function fg({children:e,className:t,name:n,required:r,type:i,...l}){return m.jsxs("div",{className:Ae("grid grid-cols-[24px_1fr_auto] gap-2",t),...l,children:[m.jsx("div",{className:"shrink-0",children:e??m.jsx("div",{className:"flex size-6 items-center justify-center",children:m.jsx(kg,{weight:"fill",className:"size-2 text-fg-subtle"})})}),m.jsx(dn,{className:"flex-row",children:m.jsx(an,{className:"font-mono",children:n})}),m.jsxs(Wn,{children:[m.jsx(Ut,{children:m.jsx($t,{uppercase:!0,children:i})}),r&&m.jsx(Ut,{children:m.jsx($t,{uppercase:!0,children:"required"})})]})]})}function hg({children:e,className:t,...n}){return m.jsx("div",{className:Ae("ml-8 flex flex-col gap-y-3",t),...n,children:e})}const aX=({schema:e})=>{const t=e.required||[];return!e.properties||Object.keys(e.properties).length===0?m.jsxs(Ta,{children:[m.jsx(ni,{children:"No parameters defined"}),m.jsx(Ns,{children:"This tool does not require any parameters."})]}):m.jsx(Ka,{asChild:!0,children:m.jsx(m6,{type:"multiple",children:Object.entries(e.properties).map(([n,r])=>m.jsx(Dc,{name:n,property:r,required:t.includes(n)},n))})})},f0=M8,iX=L8,sX=_f,wS=D8;function lX({className:e,...t}){return m.jsx(Af,{className:Ae("overlay",e),...t})}function Vf({className:e,children:t,...n}){return m.jsxs(wS,{children:[m.jsx(lX,{}),m.jsx(Tf,{className:Ae("popover fixed inset-y-1 right-1 z-50 flex w-[calc(100%-0.5rem)] flex-col overflow-hidden rounded-xl transition ease-in-out sm:max-w-xl","shadow-[0_0_10px_6px_rgba(55,50,46,0.13),_0_0_0_0.5px_rgba(55,50,46,0.25)]","radix-state-[open]:slide-in-from-right radix-state-[open]:animate-in radix-state-[open]:duration-300","radix-state-[closed]:slide-out-to-right radix-state-[closed]:animate-out radix-state-[closed]:duration-200",e),...n,children:t})]})}function zf({className:e,...t}){return m.jsx("div",{className:Ae("flex flex-1 flex-col gap-y-10 overflow-y-auto overflow-x-hidden p-6 pt-10",e),...t})}function Zf({className:e,children:t,...n}){return m.jsxs("div",{className:Ae("flex flex-row-reverse items-center justify-start gap-x-1 border-accent border-b-[0.5px] px-3 py-2",e),...n,children:[m.jsx(sX,{asChild:!0,children:m.jsxs(bt,{size:"icon",variant:"secondary",children:[m.jsx(Uc,{}),m.jsx("span",{className:"sr-only",children:"Close"})]})}),t]})}const qf=({className:e,...t})=>m.jsx("div",{className:Ae("flex flex-col gap-y-2 text-left",e),...t});function Yf({className:e,...t}){return m.jsx(I8,{className:Ae(ji({variant:"h1"}),e),...t})}function $f({className:e,...t}){return m.jsx(P8,{className:Ae(ji({variant:"p"}),"text-fg-subtle",e),...t})}function oX({tool:e,mcpName:t,onClose:n}){return m.jsx(f0,{open:!!e,onOpenChange:n,children:m.jsxs(Vf,{children:[m.jsx(Zf,{children:m.jsx(u0,{className:"grow",children:m.jsxs(c0,{children:[m.jsx(hl,{children:t}),m.jsx(d0,{}),m.jsx(ml,{children:e.name})]})})}),m.jsxs(zf,{children:[m.jsxs(qf,{children:[m.jsx(Yf,{children:e.name}),m.jsxs($f,{className:"text-sm",children:["From"," ",m.jsx("button",{className:"cursor-pointer text-fg underline",children:t})]})]}),m.jsx(Vo,{children:e.description}),m.jsx(al,{}),m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Input schema"})})}),e.inputSchema?m.jsx(aX,{schema:e.inputSchema}):m.jsxs(Ta,{children:[m.jsx(ni,{children:"No input schema"}),m.jsx(Ns,{children:"This tool does not require any parameters."})]})]})]})]})})}function v6({tools:e,toolsLoading:t,editable:n,isSaving:r,onUpdateTools:i}){const[l,o]=h.useState(null),[c,f]=h.useState(!1),[p,y]=h.useState([]);h.useEffect(()=>{c||y((e??[]).map(A=>({name:A.name,disabled:!!A.disabled,serverName:A.serverName??""})))},[e,c]);const g=p.length>0&&p.every(A=>!A.disabled),x=A=>{y(p.map(S=>({...S,disabled:!A})))};return t?m.jsx(fX,{}):!e||e.length===0?m.jsx(dX,{}):m.jsxs(m.Fragment,{children:[m.jsxs(Nt,{children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between",children:[m.jsx(Rt,{variant:"h2",className:"flex-1",asChild:!0,children:m.jsx("h2",{children:"Tools"})}),n&&!c&&m.jsx(bt,{size:"sm",onClick:()=>{y(e.map(A=>({name:A.name,disabled:!!A.disabled,serverName:A.serverName??""}))),f(!0)},children:"Edit"}),c&&m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(bt,{size:"sm",disabled:r,onClick:async()=>{p&&await i?.(p),f(!1),y([])},children:r?"Saving...":"Save"}),m.jsx(bt,{size:"sm",variant:"secondary",disabled:r,onClick:()=>{f(!1),y([])},children:m.jsx(Uc,{weight:"bold"})}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsx(o6,{id:"global-toggle",checked:g,onCheckedChange:x})})]})]}),m.jsx(Ka,{children:e.map(A=>m.jsx(uX,{tool:A,onClick:()=>o(A),draftTool:p.find(S=>S.name===A.name&&S.serverName===A.serverName),isEditing:c,isSaving:r,onDisabledChange:(S,_)=>{y(p.map(w=>w.name===S.name&&w.serverName===S.serverName?{...w,disabled:_}:w))}},`li-${A.serverName}:${A.name}`))})]}),l&&m.jsx(oX,{tool:l,mcpName:"XXXXXXXXXXX",onClose:()=>o(null)})]})}function uX({tool:e,draftTool:t,onClick:n,isEditing:r,isSaving:i,onDisabledChange:l}){const o=e.description?.replace(/\[([^\]]+)\]/g,"")||"";return m.jsxs(wn,{onClick:r?void 0:n,children:[m.jsxs(dn,{children:[m.jsx(an,{children:e.name}),o&&m.jsx(qa,{children:o})]}),t?.disabled&&!r&&m.jsx(Wn,{className:"ml-auto",children:m.jsx(Ut,{children:m.jsx($t,{uppercase:!0,children:"Disabled"})})}),r&&m.jsx(cX,{id:e.name,checked:!t?.disabled,loading:i??!1,onCheckedChange:c=>{l(e,!c)}})]})}function cX({id:e,checked:t,loading:n,onCheckedChange:r}){return n?m.jsx(Wn,{children:m.jsx(Ut,{children:m.jsx($t,{children:m.jsx(Jr,{text:"Loading"})})})}):m.jsx(o6,{id:e,checked:t,onCheckedChange:r})}function dX(){return m.jsx(m.Fragment,{children:m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",className:"flex-1",asChild:!0,children:m.jsx("h2",{children:"Tools"})})}),m.jsxs(Ta,{children:[m.jsx(ni,{children:"No items"}),m.jsx(Ns,{children:"This list is empty."})]})]})})}function fX(){return m.jsx(m.Fragment,{children:m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",className:"flex-1",asChild:!0,children:m.jsx("h2",{children:"Tools"})})}),m.jsx(sl,{})]})})}var Qf="Tabs",[hX]=gr(Qf,[Go]),NS=Go(),[mX,E6]=hX(Qf),OS=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:l,orientation:o="horizontal",dir:c,activationMode:f="automatic",...p}=e,y=zc(c),[g,x]=ra({prop:r,onChange:i,defaultProp:l??"",caller:Qf});return m.jsx(mX,{scope:n,baseId:za(),value:g,onValueChange:x,orientation:o,dir:y,activationMode:f,children:m.jsx(tt.div,{dir:y,"data-orientation":o,...p,ref:t})})});OS.displayName=Qf;var RS="TabsList",kS=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,l=E6(RS,n),o=NS(n);return m.jsx(Kg,{asChild:!0,...o,orientation:l.orientation,dir:l.dir,loop:r,children:m.jsx(tt.div,{role:"tablist","aria-orientation":l.orientation,...i,ref:t})})});kS.displayName=RS;var MS="TabsTrigger",LS=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...l}=e,o=E6(MS,n),c=NS(n),f=PS(o.baseId,r),p=jS(o.baseId,r),y=r===o.value;return m.jsx(Xg,{asChild:!0,...c,focusable:!i,active:y,children:m.jsx(tt.button,{type:"button",role:"tab","aria-selected":y,"aria-controls":p,"data-state":y?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:f,...l,ref:t,onMouseDown:qe(e.onMouseDown,g=>{!i&&g.button===0&&g.ctrlKey===!1?o.onValueChange(r):g.preventDefault()}),onKeyDown:qe(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&o.onValueChange(r)}),onFocus:qe(e.onFocus,()=>{const g=o.activationMode!=="manual";!y&&!i&&g&&o.onValueChange(r)})})})});LS.displayName=MS;var DS="TabsContent",IS=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:l,...o}=e,c=E6(DS,n),f=PS(c.baseId,r),p=jS(c.baseId,r),y=r===c.value,g=h.useRef(y);return h.useEffect(()=>{const x=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(x)},[]),m.jsx(aa,{present:i||y,children:({present:x})=>m.jsx(tt.div,{"data-state":y?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":f,hidden:!x,id:p,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:x&&l})})});IS.displayName=DS;function PS(e,t){return`${e}-trigger-${t}`}function jS(e,t){return`${e}-content-${t}`}var pX=OS,gX=kS,yX=LS,bX=IS;function Ya(e){return null}function x6({default:e,className:t,children:n}){const r=h.Children.toArray(n).filter(i=>h.isValidElement(i)&&i.type===Ya);return m.jsxs(pX,{"data-slot":"tabs",className:Ae("flex flex-col gap-4",t),defaultValue:e,children:[m.jsx(gX,{"data-slot":"tabs-list",className:Ae("inline-flex w-fit items-center justify-center gap-x-0.5 rounded-lg border-[0.5px] border-fg/15 bg-accent-subtle p-1 text-fg-subtle"),children:r.map(i=>m.jsxs(yX,{value:i.props.id,"data-slot":"tabs-trigger",className:Ae("inline-flex flex-1 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 py-1 font-[450] text-fg text-sm transition-[color,box-shadow]","radix-state-[active]:bg-surface radix-state-[active]:shadow-[0_3px_9px_0px_rgba(55,50,46,0.07),_0_0_0_0.5px_rgba(55,50,46,0.15)]","radix-state-[inactive]:hover:bg-surface/50 radix-state-[inactive]:hover:shadow-[0_0_0_0.5px_rgba(55,50,46,0.15)]","disabled:pointer-events-none disabled:opacity-50 has-[svg:first-child]:pl-2.5","[&_svg:not([class*='size-'])]:size-4.5 [&_svg]:pointer-events-none [&_svg]:shrink-0"),children:[i.props.icon,i.props.label]},i.props.id))}),r.map(i=>m.jsx(bX,{value:i.props.id,"data-slot":"tabs-content",className:Ae("flex-1 outline-none","rounded-xl border-[0.5px] bg-accent-subtle/20 p-6"),children:i.props.content},i.props.id))]})}function HS({entry:e}){return m.jsxs(Nt,{className:"gap-y-8",children:[m.jsx(Sf,{src:e.icon,className:"size-9"}),m.jsxs(Ot,{children:[m.jsx(Rt,{children:e.title}),m.jsx(ti,{children:e.description})]}),m.jsxs(Wn,{children:[e.isOfficial&&m.jsxs(Ut,{variant:"success",children:[m.jsx(na,{children:m.jsx(Ig,{})}),m.jsx($t,{uppercase:!0,children:"Official"})]}),e.homepage&&m.jsx(Ut,{className:"transition-opacity duration-200 hover:opacity-50",asChild:!0,children:m.jsxs("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",children:[m.jsx(na,{children:m.jsx(Zx,{weight:"bold"})}),m.jsx($t,{uppercase:!0,children:"Homepage"})]})})]}),m.jsxs(x6,{default:"readme",children:[m.jsx(Ya,{id:"readme",label:"Readme",icon:m.jsx(q1,{}),content:m.jsx(iS,{readme:e.readme})}),m.jsx(Ya,{id:"tools",label:"Tools",icon:m.jsx(Q1,{}),content:m.jsx(v6,{tools:e.tools,toolsLoading:!1})}),m.jsx(Ya,{id:"transport",label:"Transport",icon:m.jsx($1,{}),content:m.jsxs("div",{className:"flex flex-col gap-y-10",children:[m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Overview"})})}),m.jsx(qB,{entry:e})]}),m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Parameters"})})}),m.jsx(LK,{parameters:e.parameters??[]})]})]})})]})]})}var Et;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const l={};for(const o of i)l[o]=o;return l},e.getValidEnumValues=i=>{const l=e.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),o={};for(const c of l)o[c]=i[c];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(l){return i[l]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const l=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&l.push(o);return l},e.find=(i,l)=>{for(const o of i)if(l(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,l=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(l)}e.joinValues=r,e.jsonStringifyReplacer=(i,l)=>typeof l=="bigint"?l.toString():l})(Et||(Et={}));var yx;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(yx||(yx={}));const Ie=Et.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bs=e=>{switch(typeof e){case"undefined":return Ie.undefined;case"string":return Ie.string;case"number":return Number.isNaN(e)?Ie.nan:Ie.number;case"boolean":return Ie.boolean;case"function":return Ie.function;case"bigint":return Ie.bigint;case"symbol":return Ie.symbol;case"object":return Array.isArray(e)?Ie.array:e===null?Ie.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ie.promise:typeof Map<"u"&&e instanceof Map?Ie.map:typeof Set<"u"&&e instanceof Set?Ie.set:typeof Date<"u"&&e instanceof Date?Ie.date:Ie.object;default:return Ie.unknown}},Oe=Et.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Di extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(l){return l.message},r={_errors:[]},i=l=>{for(const o of l.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let c=r,f=0;for(;f<o.path.length;){const p=o.path[f];f===o.path.length-1?(c[p]=c[p]||{_errors:[]},c[p]._errors.push(n(o))):c[p]=c[p]||{_errors:[]},c=c[p],f++}}};return i(this),r}static assert(t){if(!(t instanceof Di))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Et.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const l=i.path[0];n[l]=n[l]||[],n[l].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Di.create=e=>new Di(e);const mg=(e,t)=>{let n;switch(e.code){case Oe.invalid_type:e.received===Ie.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Oe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Et.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:n=`Unrecognized key(s) in object: ${Et.joinValues(e.keys,", ")}`;break;case Oe.invalid_union:n="Invalid input";break;case Oe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Et.joinValues(e.options)}`;break;case Oe.invalid_enum_value:n=`Invalid enum value. Expected ${Et.joinValues(e.options)}, received '${e.received}'`;break;case Oe.invalid_arguments:n="Invalid function arguments";break;case Oe.invalid_return_type:n="Invalid function return type";break;case Oe.invalid_date:n="Invalid date";break;case Oe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Et.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Oe.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Oe.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Oe.custom:n="Invalid input";break;case Oe.invalid_intersection_types:n="Intersection results could not be merged";break;case Oe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Oe.not_finite:n="Number must be finite";break;default:n=t.defaultError,Et.assertNever(e)}return{message:n}};let vX=mg;function EX(){return vX}const xX=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,l=[...n,...i.path||[]],o={...i,path:l};if(i.message!==void 0)return{...i,path:l,message:i.message};let c="";const f=r.filter(p=>!!p).slice().reverse();for(const p of f)c=p(o,{data:t,defaultError:c}).message;return{...i,path:l,message:c}};function Le(e,t){const n=EX(),r=xX({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===mg?void 0:mg].filter(i=>!!i)});e.common.issues.push(r)}class Jn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return $e;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const l=await i.key,o=await i.value;r.push({key:l,value:o})}return Jn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:l,value:o}=i;if(l.status==="aborted"||o.status==="aborted")return $e;l.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),l.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[l.value]=o.value)}return{status:t.value,value:r}}}const $e=Object.freeze({status:"aborted"}),uc=e=>({status:"dirty",value:e}),la=e=>({status:"valid",value:e}),bx=e=>e.status==="aborted",vx=e=>e.status==="dirty",zo=e=>e.status==="valid",w1=e=>typeof Promise<"u"&&e instanceof Promise;var Ue;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Ue||(Ue={}));class Xa{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ex=(e,t)=>{if(zo(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Di(e.common.issues);return this._error=n,this._error}}};function at(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,c)=>{const{message:f}=e;return o.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:f??r??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:f??n??c.defaultError}},description:i}}class mt{get description(){return this._def.description}_getType(t){return bs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:bs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Jn,ctx:{common:t.parent.common,data:t.data,parsedType:bs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(w1(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:bs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return Ex(r,i)}"~validate"(t){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:bs(t)};if(!this["~standard"].async)try{const r=this._parseSync({data:t,path:[],parent:n});return zo(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>zo(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:bs(t)},i=this._parse({data:t,path:r.path,parent:r}),l=await(w1(i)?i:Promise.resolve(i));return Ex(r,l)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,l)=>{const o=t(i),c=()=>l.addIssue({code:Oe.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new yl({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ri.create(this,this._def)}nullable(){return bl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $a.create(this)}promise(){return L1.create(this,this._def)}or(t){return O1.create([this,t],this._def)}and(t){return R1.create(this,t,this._def)}transform(t){return new yl({...at(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new D1({...at(this._def),innerType:this,defaultValue:n,typeName:Qe.ZodDefault})}brand(){return new VS({typeName:Qe.ZodBranded,type:this,...at(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new I1({...at(this._def),innerType:this,catchValue:n,typeName:Qe.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return T6.create(this,t)}readonly(){return P1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const AX=/^c[^\s-]{8,}$/i,TX=/^[0-9a-z]+$/,_X=/^[0-9A-HJKMNP-TV-Z]{26}$/i,SX=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,CX=/^[a-z0-9_-]{21}$/i,wX=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,NX=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,OX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,RX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ip;const kX=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,MX=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,LX=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,DX=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,IX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PX=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,FS="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",jX=new RegExp(`^${FS}$`);function BS(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function HX(e){return new RegExp(`^${BS(e)}$`)}function FX(e){let t=`${FS}T${BS(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function BX(e,t){return!!((t==="v4"||!t)&&kX.test(e)||(t==="v6"||!t)&&LX.test(e))}function UX(e,t){if(!wX.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function VX(e,t){return!!((t==="v4"||!t)&&MX.test(e)||(t==="v6"||!t)&&DX.test(e))}class Ni extends mt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ie.string){const l=this._getOrReturnCtx(t);return Le(l,{code:Oe.invalid_type,expected:Ie.string,received:l.parsedType}),$e}const r=new Jn;let i;for(const l of this._def.checks)if(l.kind==="min")t.data.length<l.value&&(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),r.dirty());else if(l.kind==="max")t.data.length>l.value&&(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),r.dirty());else if(l.kind==="length"){const o=t.data.length>l.value,c=t.data.length<l.value;(o||c)&&(i=this._getOrReturnCtx(t,i),o?Le(i,{code:Oe.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):c&&Le(i,{code:Oe.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),r.dirty())}else if(l.kind==="email")OX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"email",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="emoji")ip||(ip=new RegExp(RX,"u")),ip.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"emoji",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="uuid")SX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"uuid",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="nanoid")CX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"nanoid",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="cuid")AX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"cuid",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="cuid2")TX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"cuid2",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="ulid")_X.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"ulid",code:Oe.invalid_string,message:l.message}),r.dirty());else if(l.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Le(i,{validation:"url",code:Oe.invalid_string,message:l.message}),r.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"regex",code:Oe.invalid_string,message:l.message}),r.dirty())):l.kind==="trim"?t.data=t.data.trim():l.kind==="includes"?t.data.includes(l.value,l.position)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),r.dirty()):l.kind==="toLowerCase"?t.data=t.data.toLowerCase():l.kind==="toUpperCase"?t.data=t.data.toUpperCase():l.kind==="startsWith"?t.data.startsWith(l.value)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:{startsWith:l.value},message:l.message}),r.dirty()):l.kind==="endsWith"?t.data.endsWith(l.value)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:{endsWith:l.value},message:l.message}),r.dirty()):l.kind==="datetime"?FX(l).test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:"datetime",message:l.message}),r.dirty()):l.kind==="date"?jX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:"date",message:l.message}),r.dirty()):l.kind==="time"?HX(l).test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.invalid_string,validation:"time",message:l.message}),r.dirty()):l.kind==="duration"?NX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"duration",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="ip"?BX(t.data,l.version)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"ip",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="jwt"?UX(t.data,l.alg)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"jwt",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="cidr"?VX(t.data,l.version)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"cidr",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="base64"?IX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"base64",code:Oe.invalid_string,message:l.message}),r.dirty()):l.kind==="base64url"?PX.test(t.data)||(i=this._getOrReturnCtx(t,i),Le(i,{validation:"base64url",code:Oe.invalid_string,message:l.message}),r.dirty()):Et.assertNever(l);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:Oe.invalid_string,...Ue.errToObj(r)})}_addCheck(t){return new Ni({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ue.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ue.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ue.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ue.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ue.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ue.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ue.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ue.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ue.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ue.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ue.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ue.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ue.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Ue.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Ue.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Ue.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ue.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...Ue.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ue.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ue.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ue.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ue.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ue.errToObj(n)})}nonempty(t){return this.min(1,Ue.errToObj(t))}trim(){return new Ni({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ni({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ni({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Ni.create=e=>new Ni({checks:[],typeName:Qe.ZodString,coerce:e?.coerce??!1,...at(e)});function zX(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,l=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return l%o/10**i}class Ic extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ie.number){const l=this._getOrReturnCtx(t);return Le(l,{code:Oe.invalid_type,expected:Ie.number,received:l.parsedType}),$e}let r;const i=new Jn;for(const l of this._def.checks)l.kind==="int"?Et.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.invalid_type,expected:"integer",received:"float",message:l.message}),i.dirty()):l.kind==="min"?(l.inclusive?t.data<l.value:t.data<=l.value)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?t.data>l.value:t.data>=l.value)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),i.dirty()):l.kind==="multipleOf"?zX(t.data,l.value)!==0&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):l.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.not_finite,message:l.message}),i.dirty()):Et.assertNever(l);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ue.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ue.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ue.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ue.toString(n))}setLimit(t,n,r,i){return new Ic({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ue.toString(i)}]})}_addCheck(t){return new Ic({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ue.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ue.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ue.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ue.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ue.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ue.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Et.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ic.create=e=>new Ic({checks:[],typeName:Qe.ZodNumber,coerce:e?.coerce||!1,...at(e)});class Pc extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ie.bigint)return this._getInvalidInput(t);let r;const i=new Jn;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?t.data<l.value:t.data<=l.value)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="max"?(l.inclusive?t.data>l.value:t.data>=l.value)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),i.dirty()):l.kind==="multipleOf"?t.data%l.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Le(r,{code:Oe.not_multiple_of,multipleOf:l.value,message:l.message}),i.dirty()):Et.assertNever(l);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return Le(n,{code:Oe.invalid_type,expected:Ie.bigint,received:n.parsedType}),$e}gte(t,n){return this.setLimit("min",t,!0,Ue.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ue.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ue.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ue.toString(n))}setLimit(t,n,r,i){return new Pc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ue.toString(i)}]})}_addCheck(t){return new Pc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ue.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ue.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ue.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ue.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ue.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Pc.create=e=>new Pc({checks:[],typeName:Qe.ZodBigInt,coerce:e?.coerce??!1,...at(e)});class xx extends mt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ie.boolean){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.boolean,received:r.parsedType}),$e}return la(t.data)}}xx.create=e=>new xx({typeName:Qe.ZodBoolean,coerce:e?.coerce||!1,...at(e)});class N1 extends mt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ie.date){const l=this._getOrReturnCtx(t);return Le(l,{code:Oe.invalid_type,expected:Ie.date,received:l.parsedType}),$e}if(Number.isNaN(t.data.getTime())){const l=this._getOrReturnCtx(t);return Le(l,{code:Oe.invalid_date}),$e}const r=new Jn;let i;for(const l of this._def.checks)l.kind==="min"?t.data.getTime()<l.value&&(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),r.dirty()):l.kind==="max"?t.data.getTime()>l.value&&(i=this._getOrReturnCtx(t,i),Le(i,{code:Oe.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),r.dirty()):Et.assertNever(l);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new N1({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ue.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ue.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}N1.create=e=>new N1({checks:[],coerce:e?.coerce||!1,typeName:Qe.ZodDate,...at(e)});class Ax extends mt{_parse(t){if(this._getType(t)!==Ie.symbol){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.symbol,received:r.parsedType}),$e}return la(t.data)}}Ax.create=e=>new Ax({typeName:Qe.ZodSymbol,...at(e)});class pg extends mt{_parse(t){if(this._getType(t)!==Ie.undefined){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.undefined,received:r.parsedType}),$e}return la(t.data)}}pg.create=e=>new pg({typeName:Qe.ZodUndefined,...at(e)});class gg extends mt{_parse(t){if(this._getType(t)!==Ie.null){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.null,received:r.parsedType}),$e}return la(t.data)}}gg.create=e=>new gg({typeName:Qe.ZodNull,...at(e)});class Tx extends mt{constructor(){super(...arguments),this._any=!0}_parse(t){return la(t.data)}}Tx.create=e=>new Tx({typeName:Qe.ZodAny,...at(e)});class _x extends mt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return la(t.data)}}_x.create=e=>new _x({typeName:Qe.ZodUnknown,...at(e)});class Ss extends mt{_parse(t){const n=this._getOrReturnCtx(t);return Le(n,{code:Oe.invalid_type,expected:Ie.never,received:n.parsedType}),$e}}Ss.create=e=>new Ss({typeName:Qe.ZodNever,...at(e)});class Sx extends mt{_parse(t){if(this._getType(t)!==Ie.undefined){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.void,received:r.parsedType}),$e}return la(t.data)}}Sx.create=e=>new Sx({typeName:Qe.ZodVoid,...at(e)});class $a extends mt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ie.array)return Le(n,{code:Oe.invalid_type,expected:Ie.array,received:n.parsedType}),$e;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(o||c)&&(Le(n,{code:o?Oe.too_big:Oe.too_small,minimum:c?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Le(n,{code:Oe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Le(n,{code:Oe.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>i.type._parseAsync(new Xa(n,o,n.path,c)))).then(o=>Jn.mergeArray(r,o));const l=[...n.data].map((o,c)=>i.type._parseSync(new Xa(n,o,n.path,c)));return Jn.mergeArray(r,l)}get element(){return this._def.type}min(t,n){return new $a({...this._def,minLength:{value:t,message:Ue.toString(n)}})}max(t,n){return new $a({...this._def,maxLength:{value:t,message:Ue.toString(n)}})}length(t,n){return new $a({...this._def,exactLength:{value:t,message:Ue.toString(n)}})}nonempty(t){return this.min(1,t)}}$a.create=(e,t)=>new $a({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...at(t)});function So(e){if(e instanceof En){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ri.create(So(r))}return new En({...e._def,shape:()=>t})}else return e instanceof $a?new $a({...e._def,type:So(e.element)}):e instanceof Ri?Ri.create(So(e.unwrap())):e instanceof bl?bl.create(So(e.unwrap())):e instanceof pl?pl.create(e.items.map(t=>So(t))):e}class En extends mt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Et.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ie.object){const p=this._getOrReturnCtx(t);return Le(p,{code:Oe.invalid_type,expected:Ie.object,received:p.parsedType}),$e}const{status:r,ctx:i}=this._processInputParams(t),{shape:l,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ss&&this._def.unknownKeys==="strip"))for(const p in i.data)o.includes(p)||c.push(p);const f=[];for(const p of o){const y=l[p],g=i.data[p];f.push({key:{status:"valid",value:p},value:y._parse(new Xa(i,g,i.path,p)),alwaysSet:p in i.data})}if(this._def.catchall instanceof Ss){const p=this._def.unknownKeys;if(p==="passthrough")for(const y of c)f.push({key:{status:"valid",value:y},value:{status:"valid",value:i.data[y]}});else if(p==="strict")c.length>0&&(Le(i,{code:Oe.unrecognized_keys,keys:c}),r.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const y of c){const g=i.data[y];f.push({key:{status:"valid",value:y},value:p._parse(new Xa(i,g,i.path,y)),alwaysSet:y in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const p=[];for(const y of f){const g=await y.key,x=await y.value;p.push({key:g,value:x,alwaysSet:y.alwaysSet})}return p}).then(p=>Jn.mergeObjectSync(r,p)):Jn.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(t){return Ue.errToObj,new En({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{const i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Ue.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new En({...this._def,unknownKeys:"strip"})}passthrough(){return new En({...this._def,unknownKeys:"passthrough"})}extend(t){return new En({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new En({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Qe.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new En({...this._def,catchall:t})}pick(t){const n={};for(const r of Et.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new En({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Et.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new En({...this._def,shape:()=>n})}deepPartial(){return So(this)}partial(t){const n={};for(const r of Et.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new En({...this._def,shape:()=>n})}required(t){const n={};for(const r of Et.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let l=this.shape[r];for(;l instanceof Ri;)l=l._def.innerType;n[r]=l}return new En({...this._def,shape:()=>n})}keyof(){return US(Et.objectKeys(this.shape))}}En.create=(e,t)=>new En({shape:()=>e,unknownKeys:"strip",catchall:Ss.create(),typeName:Qe.ZodObject,...at(t)});En.strictCreate=(e,t)=>new En({shape:()=>e,unknownKeys:"strict",catchall:Ss.create(),typeName:Qe.ZodObject,...at(t)});En.lazycreate=(e,t)=>new En({shape:e,unknownKeys:"strip",catchall:Ss.create(),typeName:Qe.ZodObject,...at(t)});class O1 extends mt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(l){for(const c of l)if(c.result.status==="valid")return c.result;for(const c of l)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const o=l.map(c=>new Di(c.ctx.common.issues));return Le(n,{code:Oe.invalid_union,unionErrors:o}),$e}if(n.common.async)return Promise.all(r.map(async l=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await l._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let l;const o=[];for(const f of r){const p={...n,common:{...n.common,issues:[]},parent:null},y=f._parseSync({data:n.data,path:n.path,parent:p});if(y.status==="valid")return y;y.status==="dirty"&&!l&&(l={result:y,ctx:p}),p.common.issues.length&&o.push(p.common.issues)}if(l)return n.common.issues.push(...l.ctx.common.issues),l.result;const c=o.map(f=>new Di(f));return Le(n,{code:Oe.invalid_union,unionErrors:c}),$e}}get options(){return this._def.options}}O1.create=(e,t)=>new O1({options:e,typeName:Qe.ZodUnion,...at(t)});const Si=e=>e instanceof bg?Si(e.schema):e instanceof yl?Si(e.innerType()):e instanceof M1?[e.value]:e instanceof gl?e.options:e instanceof vg?Et.objectValues(e.enum):e instanceof D1?Si(e._def.innerType):e instanceof pg?[void 0]:e instanceof gg?[null]:e instanceof Ri?[void 0,...Si(e.unwrap())]:e instanceof bl?[null,...Si(e.unwrap())]:e instanceof VS||e instanceof P1?Si(e.unwrap()):e instanceof I1?Si(e._def.innerType):[];class A6 extends mt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ie.object)return Le(n,{code:Oe.invalid_type,expected:Ie.object,received:n.parsedType}),$e;const r=this.discriminator,i=n.data[r],l=this.optionsMap.get(i);return l?n.common.async?l._parseAsync({data:n.data,path:n.path,parent:n}):l._parseSync({data:n.data,path:n.path,parent:n}):(Le(n,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),$e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const l of n){const o=Si(l.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const c of o){if(i.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);i.set(c,l)}}return new A6({typeName:Qe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...at(r)})}}function yg(e,t){const n=bs(e),r=bs(t);if(e===t)return{valid:!0,data:e};if(n===Ie.object&&r===Ie.object){const i=Et.objectKeys(t),l=Et.objectKeys(e).filter(c=>i.indexOf(c)!==-1),o={...e,...t};for(const c of l){const f=yg(e[c],t[c]);if(!f.valid)return{valid:!1};o[c]=f.data}return{valid:!0,data:o}}else if(n===Ie.array&&r===Ie.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let l=0;l<e.length;l++){const o=e[l],c=t[l],f=yg(o,c);if(!f.valid)return{valid:!1};i.push(f.data)}return{valid:!0,data:i}}else return n===Ie.date&&r===Ie.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class R1 extends mt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(l,o)=>{if(bx(l)||bx(o))return $e;const c=yg(l.value,o.value);return c.valid?((vx(l)||vx(o))&&n.dirty(),{status:n.value,value:c.data}):(Le(r,{code:Oe.invalid_intersection_types}),$e)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([l,o])=>i(l,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}R1.create=(e,t,n)=>new R1({left:e,right:t,typeName:Qe.ZodIntersection,...at(n)});class pl extends mt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.array)return Le(r,{code:Oe.invalid_type,expected:Ie.array,received:r.parsedType}),$e;if(r.data.length<this._def.items.length)return Le(r,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$e;!this._def.rest&&r.data.length>this._def.items.length&&(Le(r,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const l=[...r.data].map((o,c)=>{const f=this._def.items[c]||this._def.rest;return f?f._parse(new Xa(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(l).then(o=>Jn.mergeArray(n,o)):Jn.mergeArray(n,l)}get items(){return this._def.items}rest(t){return new pl({...this._def,rest:t})}}pl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pl({items:e,typeName:Qe.ZodTuple,rest:null,...at(t)})};class k1 extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.object)return Le(r,{code:Oe.invalid_type,expected:Ie.object,received:r.parsedType}),$e;const i=[],l=this._def.keyType,o=this._def.valueType;for(const c in r.data)i.push({key:l._parse(new Xa(r,c,r.path,c)),value:o._parse(new Xa(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?Jn.mergeObjectAsync(n,i):Jn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof mt?new k1({keyType:t,valueType:n,typeName:Qe.ZodRecord,...at(r)}):new k1({keyType:Ni.create(),valueType:t,typeName:Qe.ZodRecord,...at(n)})}}class Cx extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.map)return Le(r,{code:Oe.invalid_type,expected:Ie.map,received:r.parsedType}),$e;const i=this._def.keyType,l=this._def.valueType,o=[...r.data.entries()].map(([c,f],p)=>({key:i._parse(new Xa(r,c,r.path,[p,"key"])),value:l._parse(new Xa(r,f,r.path,[p,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const f of o){const p=await f.key,y=await f.value;if(p.status==="aborted"||y.status==="aborted")return $e;(p.status==="dirty"||y.status==="dirty")&&n.dirty(),c.set(p.value,y.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const f of o){const p=f.key,y=f.value;if(p.status==="aborted"||y.status==="aborted")return $e;(p.status==="dirty"||y.status==="dirty")&&n.dirty(),c.set(p.value,y.value)}return{status:n.value,value:c}}}}Cx.create=(e,t,n)=>new Cx({valueType:t,keyType:e,typeName:Qe.ZodMap,...at(n)});class jc extends mt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ie.set)return Le(r,{code:Oe.invalid_type,expected:Ie.set,received:r.parsedType}),$e;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Le(r,{code:Oe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Le(r,{code:Oe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const l=this._def.valueType;function o(f){const p=new Set;for(const y of f){if(y.status==="aborted")return $e;y.status==="dirty"&&n.dirty(),p.add(y.value)}return{status:n.value,value:p}}const c=[...r.data.values()].map((f,p)=>l._parse(new Xa(r,f,r.path,p)));return r.common.async?Promise.all(c).then(f=>o(f)):o(c)}min(t,n){return new jc({...this._def,minSize:{value:t,message:Ue.toString(n)}})}max(t,n){return new jc({...this._def,maxSize:{value:t,message:Ue.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}jc.create=(e,t)=>new jc({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...at(t)});class bg extends mt{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}bg.create=(e,t)=>new bg({getter:e,typeName:Qe.ZodLazy,...at(t)});class M1 extends mt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Le(n,{received:n.data,code:Oe.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:t.data}}get value(){return this._def.value}}M1.create=(e,t)=>new M1({value:e,typeName:Qe.ZodLiteral,...at(t)});function US(e,t){return new gl({values:e,typeName:Qe.ZodEnum,...at(t)})}class gl extends mt{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Le(n,{expected:Et.joinValues(r),received:n.parsedType,code:Oe.invalid_type}),$e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Le(n,{received:n.data,code:Oe.invalid_enum_value,options:r}),$e}return la(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return gl.create(t,{...this._def,...n})}exclude(t,n=this._def){return gl.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}gl.create=US;class vg extends mt{_parse(t){const n=Et.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ie.string&&r.parsedType!==Ie.number){const i=Et.objectValues(n);return Le(r,{expected:Et.joinValues(i),received:r.parsedType,code:Oe.invalid_type}),$e}if(this._cache||(this._cache=new Set(Et.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Et.objectValues(n);return Le(r,{received:r.data,code:Oe.invalid_enum_value,options:i}),$e}return la(t.data)}get enum(){return this._def.values}}vg.create=(e,t)=>new vg({values:e,typeName:Qe.ZodNativeEnum,...at(t)});class L1 extends mt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ie.promise&&n.common.async===!1)return Le(n,{code:Oe.invalid_type,expected:Ie.promise,received:n.parsedType}),$e;const r=n.parsedType===Ie.promise?n.data:Promise.resolve(n.data);return la(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}L1.create=(e,t)=>new L1({type:e,typeName:Qe.ZodPromise,...at(t)});class yl extends mt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,l={addIssue:o=>{Le(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(l.addIssue=l.addIssue.bind(l),i.type==="preprocess"){const o=i.transform(r.data,l);if(r.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return $e;const f=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return f.status==="aborted"?$e:f.status==="dirty"||n.value==="dirty"?uc(f.value):f});{if(n.value==="aborted")return $e;const c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?$e:c.status==="dirty"||n.value==="dirty"?uc(c.value):c}}if(i.type==="refinement"){const o=c=>{const f=i.refinement(c,l);if(r.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?$e:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?$e:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!zo(o))return $e;const c=i.transform(o.value,l);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>zo(o)?Promise.resolve(i.transform(o.value,l)).then(c=>({status:n.value,value:c})):$e);Et.assertNever(i)}}yl.create=(e,t,n)=>new yl({schema:e,typeName:Qe.ZodEffects,effect:t,...at(n)});yl.createWithPreprocess=(e,t,n)=>new yl({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...at(n)});class Ri extends mt{_parse(t){return this._getType(t)===Ie.undefined?la(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ri.create=(e,t)=>new Ri({innerType:e,typeName:Qe.ZodOptional,...at(t)});class bl extends mt{_parse(t){return this._getType(t)===Ie.null?la(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}bl.create=(e,t)=>new bl({innerType:e,typeName:Qe.ZodNullable,...at(t)});class D1 extends mt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ie.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}D1.create=(e,t)=>new D1({innerType:e,typeName:Qe.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...at(t)});class I1 extends mt{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return w1(i)?i.then(l=>({status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new Di(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Di(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}I1.create=(e,t)=>new I1({innerType:e,typeName:Qe.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...at(t)});class wx extends mt{_parse(t){if(this._getType(t)!==Ie.nan){const r=this._getOrReturnCtx(t);return Le(r,{code:Oe.invalid_type,expected:Ie.nan,received:r.parsedType}),$e}return{status:"valid",value:t.data}}}wx.create=e=>new wx({typeName:Qe.ZodNaN,...at(e)});class VS extends mt{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class T6 extends mt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?$e:l.status==="dirty"?(n.dirty(),uc(l.value)):this._def.out._parseAsync({data:l.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?$e:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new T6({in:t,out:n,typeName:Qe.ZodPipeline})}}class P1 extends mt{_parse(t){const n=this._def.innerType._parse(t),r=i=>(zo(i)&&(i.value=Object.freeze(i.value)),i);return w1(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}P1.create=(e,t)=>new P1({innerType:e,typeName:Qe.ZodReadonly,...at(t)});var Qe;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Qe||(Qe={}));const xn=Ni.create;Ss.create;const Eg=$a.create,ga=En.create;O1.create;const ZX=A6.create;R1.create;pl.create;const zS=k1.create,ZS=M1.create;gl.create;L1.create;Ri.create;bl.create;var h0=e=>e.type==="checkbox",rl=e=>e instanceof Date,mr=e=>e==null;const qS=e=>typeof e=="object";var An=e=>!mr(e)&&!Array.isArray(e)&&qS(e)&&!rl(e),YS=e=>An(e)&&e.target?h0(e.target)?e.target.checked:e.target.value:e,qX=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,$S=(e,t)=>e.has(qX(t)),YX=e=>{const t=e.constructor&&e.constructor.prototype;return An(t)&&t.hasOwnProperty("isPrototypeOf")},_6=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Yt(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(_6&&(e instanceof Blob||r))&&(n||An(e)))if(t=n?[]:Object.create(Object.getPrototypeOf(e)),!n&&!YX(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=Yt(e[i]));else return e;return t}var Gf=e=>/^\w*$/.test(e),Bt=e=>e===void 0,Kf=e=>Array.isArray(e)?e.filter(Boolean):[],S6=e=>Kf(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Re=(e,t,n)=>{if(!t||!An(e))return n;const r=(Gf(t)?[t]:S6(t)).reduce((i,l)=>mr(i)?i:i[l],e);return Bt(r)||r===e?Bt(e[t])?n:e[t]:r},Nr=e=>typeof e=="boolean",St=(e,t,n)=>{let r=-1;const i=Gf(t)?[t]:S6(t),l=i.length,o=l-1;for(;++r<l;){const c=i[r];let f=n;if(r!==o){const p=e[c];f=An(p)||Array.isArray(p)?p:isNaN(+i[r+1])?{}:[]}if(c==="__proto__"||c==="constructor"||c==="prototype")return;e[c]=f,e=e[c]}};const j1={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Xr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},_i={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},C6=J.createContext(null);C6.displayName="HookFormContext";const Ca=()=>J.useContext(C6),w6=e=>{const{children:t,...n}=e;return J.createElement(C6.Provider,{value:n},t)};var QS=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const l in e)Object.defineProperty(i,l,{get:()=>{const o=l;return t._proxyFormState[o]!==Xr.all&&(t._proxyFormState[o]=!r||Xr.all),n&&(n[o]=!0),e[o]}});return i};const Xf=typeof window<"u"?J.useLayoutEffect:J.useEffect;function $X(e){const t=Ca(),{control:n=t.control,disabled:r,name:i,exact:l}=e||{},[o,c]=J.useState(n._formState),f=J.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Xf(()=>n._subscribe({name:i,formState:f.current,exact:l,callback:p=>{!r&&c({...n._formState,...p})}}),[i,r,l]),J.useEffect(()=>{f.current.isValid&&n._setValid(!0)},[n]),J.useMemo(()=>QS(o,n,f.current,!1),[o,n])}var Mr=e=>typeof e=="string",GS=(e,t,n,r,i)=>Mr(e)?(r&&t.watch.add(e),Re(n,e,i)):Array.isArray(e)?e.map(l=>(r&&t.watch.add(l),Re(n,l))):(r&&(t.watchAll=!0),n),xg=e=>mr(e)||!qS(e);function wi(e,t,n=new WeakSet){if(xg(e)||xg(t))return e===t;if(rl(e)&&rl(t))return e.getTime()===t.getTime();const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const l of r){const o=e[l];if(!i.includes(l))return!1;if(l!=="ref"){const c=t[l];if(rl(o)&&rl(c)||An(o)&&An(c)||Array.isArray(o)&&Array.isArray(c)?!wi(o,c,n):o!==c)return!1}}return!0}function KS(e){const t=Ca(),{control:n=t.control,name:r,defaultValue:i,disabled:l,exact:o,compute:c}=e||{},f=J.useRef(i),p=J.useRef(c),y=J.useRef(void 0);p.current=c;const g=J.useMemo(()=>n._getWatch(r,f.current),[n,r]),[x,A]=J.useState(p.current?p.current(g):g);return Xf(()=>n._subscribe({name:r,formState:{values:!0},exact:o,callback:S=>{if(!l){const _=GS(r,n._names,S.values||n._formValues,!1,f.current);if(p.current){const w=p.current(_);wi(w,y.current)||(A(w),y.current=w)}else A(_)}}}),[n,l,r,o]),J.useEffect(()=>n._removeUnmounted()),x}function QX(e){const t=Ca(),{name:n,disabled:r,control:i=t.control,shouldUnregister:l,defaultValue:o}=e,c=$S(i._names.array,n),f=J.useMemo(()=>Re(i._formValues,n,Re(i._defaultValues,n,o)),[i,n,o]),p=KS({control:i,name:n,defaultValue:f,exact:!0}),y=$X({control:i,name:n,exact:!0}),g=J.useRef(e),x=J.useRef(void 0),A=J.useRef(i.register(n,{...e.rules,value:p,...Nr(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const S=J.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Re(y.errors,n)},isDirty:{enumerable:!0,get:()=>!!Re(y.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Re(y.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Re(y.validatingFields,n)},error:{enumerable:!0,get:()=>Re(y.errors,n)}}),[y,n]),_=J.useCallback(D=>A.current.onChange({target:{value:YS(D),name:n},type:j1.CHANGE}),[n]),w=J.useCallback(()=>A.current.onBlur({target:{value:Re(i._formValues,n),name:n},type:j1.BLUR}),[n,i._formValues]),C=J.useCallback(D=>{const P=Re(i._fields,n);P&&D&&(P._f.ref={focus:()=>D.focus&&D.focus(),select:()=>D.select&&D.select(),setCustomValidity:U=>D.setCustomValidity(U),reportValidity:()=>D.reportValidity()})},[i._fields,n]),R=J.useMemo(()=>({name:n,value:p,...Nr(r)||y.disabled?{disabled:y.disabled||r}:{},onChange:_,onBlur:w,ref:C}),[n,r,y.disabled,_,w,C,p]);return J.useEffect(()=>{const D=i._options.shouldUnregister||l,P=x.current;P&&P!==n&&!c&&i.unregister(P),i.register(n,{...g.current.rules,...Nr(g.current.disabled)?{disabled:g.current.disabled}:{}});const U=(k,H)=>{const j=Re(i._fields,k);j&&j._f&&(j._f.mount=H)};if(U(n,!0),D){const k=Yt(Re(i._options.defaultValues,n,g.current.defaultValue));St(i._defaultValues,n,k),Bt(Re(i._formValues,n))&&St(i._formValues,n,k)}return!c&&i.register(n),x.current=n,()=>{(c?D&&!i._state.action:D)?i.unregister(n):U(n,!1)}},[n,i,c,l]),J.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),J.useMemo(()=>({field:R,formState:y,fieldState:S}),[R,y,S])}const GX=e=>e.render(QX(e));var N6=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},pr=e=>Array.isArray(e)?e:[e],Nx=()=>{let e=[];return{get observers(){return e},next:i=>{for(const l of e)l.next&&l.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(l=>l!==i)}}),unsubscribe:()=>{e=[]}}};function XS(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],l=t[r];if(i&&An(i)&&l){const o=XS(i,l);An(o)&&(n[r]=o)}else e[r]&&(n[r]=l)}return n}var Gn=e=>An(e)&&!Object.keys(e).length,O6=e=>e.type==="file",ma=e=>typeof e=="function",H1=e=>{if(!_6)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},WS=e=>e.type==="select-multiple",R6=e=>e.type==="radio",KX=e=>R6(e)||h0(e),sp=e=>H1(e)&&e.isConnected;function XX(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Bt(e)?r++:e[t[r++]];return e}function WX(e){for(const t in e)if(e.hasOwnProperty(t)&&!Bt(e[t]))return!1;return!0}function cn(e,t){const n=Array.isArray(t)?t:Gf(t)?[t]:S6(t),r=n.length===1?e:XX(e,n),i=n.length-1,l=n[i];return r&&delete r[l],i!==0&&(An(r)&&Gn(r)||Array.isArray(r)&&WX(r))&&cn(e,n.slice(0,-1)),e}var JX=e=>{for(const t in e)if(ma(e[t]))return!0;return!1};function JS(e){return Array.isArray(e)||An(e)&&!JX(e)}function Ag(e,t={}){for(const n in e)JS(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Ag(e[n],t[n])):Bt(e[n])||(t[n]=!0);return t}function Co(e,t,n){n||(n=Ag(t));for(const r in e)JS(e[r])?Bt(t)||xg(n[r])?n[r]=Ag(e[r],Array.isArray(e[r])?[]:{}):Co(e[r],mr(t)?{}:t[r],n[r]):n[r]=!wi(e[r],t[r]);return n}const Ox={value:!1,isValid:!1},Rx={value:!0,isValid:!0};var eC=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Bt(e[0].attributes.value)?Bt(e[0].value)||e[0].value===""?Rx:{value:e[0].value,isValid:!0}:Rx:Ox}return Ox},tC=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Bt(e)?e:t?e===""?NaN:e&&+e:n&&Mr(e)?new Date(e):r?r(e):e;const kx={isValid:!1,value:null};var nC=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,kx):kx;function Mx(e){const t=e.ref;return O6(t)?t.files:R6(t)?nC(e.refs).value:WS(t)?[...t.selectedOptions].map(({value:n})=>n):h0(t)?eC(e.refs).value:tC(Bt(t.value)?e.ref.value:t.value,e)}var eW=(e,t,n,r)=>{const i={};for(const l of e){const o=Re(t,l);o&&St(i,l,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},F1=e=>e instanceof RegExp,sc=e=>Bt(e)?e:F1(e)?e.source:An(e)?F1(e.value)?e.value.source:e.value:e,Oo=e=>({isOnSubmit:!e||e===Xr.onSubmit,isOnBlur:e===Xr.onBlur,isOnChange:e===Xr.onChange,isOnAll:e===Xr.all,isOnTouch:e===Xr.onTouched});const Lx="AsyncFunction";var tW=e=>!!e&&!!e.validate&&!!(ma(e.validate)&&e.validate.constructor.name===Lx||An(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Lx)),nW=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Tg=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Po=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const l=Re(e,i);if(l){const{_f:o,...c}=l;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],i)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(Po(c,t))break}else if(An(c)&&Po(c,t))break}}};function Dx(e,t,n){const r=Re(e,n);if(r||Gf(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const l=i.join("."),o=Re(t,l),c=Re(e,l);if(o&&!Array.isArray(o)&&n!==l)return{name:n};if(c&&c.type)return{name:l,error:c};if(c&&c.root&&c.root.type)return{name:`${l}.root`,error:c.root};i.pop()}return{name:n}}var rW=(e,t,n,r)=>{n(e);const{name:i,...l}=e;return Gn(l)||Object.keys(l).length>=Object.keys(t).length||Object.keys(l).find(o=>t[o]===(!r||Xr.all))},aW=(e,t,n)=>!e||!t||e===t||pr(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),iW=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,sW=(e,t)=>!Kf(Re(e,t)).length&&cn(e,t),rC=(e,t,n)=>{const r=pr(Re(e,n));return St(r,"root",t[n]),St(e,n,r),e};function Ix(e,t,n="validate"){if(Mr(e)||Array.isArray(e)&&e.every(Mr)||Nr(e)&&!e)return{type:n,message:Mr(e)?e:"",ref:t}}var To=e=>An(e)&&!F1(e)?e:{value:e,message:""},_g=async(e,t,n,r,i,l)=>{const{ref:o,refs:c,required:f,maxLength:p,minLength:y,min:g,max:x,pattern:A,validate:S,name:_,valueAsNumber:w,mount:C}=e._f,R=Re(n,_);if(!C||t.has(_))return{};const D=c?c[0]:o,P=K=>{i&&D.reportValidity&&(D.setCustomValidity(Nr(K)?"":K||""),D.reportValidity())},U={},k=R6(o),H=h0(o),j=k||H,ee=(w||O6(o))&&Bt(o.value)&&Bt(R)||H1(o)&&o.value===""||R===""||Array.isArray(R)&&!R.length,B=N6.bind(null,_,r,U),ne=(K,W,ie,he=_i.maxLength,F=_i.minLength)=>{const $=K?W:ie;U[_]={type:K?he:F,message:$,ref:o,...B(K?he:F,$)}};if(l?!Array.isArray(R)||!R.length:f&&(!j&&(ee||mr(R))||Nr(R)&&!R||H&&!eC(c).isValid||k&&!nC(c).isValid)){const{value:K,message:W}=Mr(f)?{value:!!f,message:f}:To(f);if(K&&(U[_]={type:_i.required,message:W,ref:D,...B(_i.required,W)},!r))return P(W),U}if(!ee&&(!mr(g)||!mr(x))){let K,W;const ie=To(x),he=To(g);if(!mr(R)&&!isNaN(R)){const F=o.valueAsNumber||R&&+R;mr(ie.value)||(K=F>ie.value),mr(he.value)||(W=F<he.value)}else{const F=o.valueAsDate||new Date(R),$=L=>new Date(new Date().toDateString()+" "+L),Q=o.type=="time",fe=o.type=="week";Mr(ie.value)&&R&&(K=Q?$(R)>$(ie.value):fe?R>ie.value:F>new Date(ie.value)),Mr(he.value)&&R&&(W=Q?$(R)<$(he.value):fe?R<he.value:F<new Date(he.value))}if((K||W)&&(ne(!!K,ie.message,he.message,_i.max,_i.min),!r))return P(U[_].message),U}if((p||y)&&!ee&&(Mr(R)||l&&Array.isArray(R))){const K=To(p),W=To(y),ie=!mr(K.value)&&R.length>+K.value,he=!mr(W.value)&&R.length<+W.value;if((ie||he)&&(ne(ie,K.message,W.message),!r))return P(U[_].message),U}if(A&&!ee&&Mr(R)){const{value:K,message:W}=To(A);if(F1(K)&&!R.match(K)&&(U[_]={type:_i.pattern,message:W,ref:o,...B(_i.pattern,W)},!r))return P(W),U}if(S){if(ma(S)){const K=await S(R,n),W=Ix(K,D);if(W&&(U[_]={...W,...B(_i.validate,W.message)},!r))return P(W.message),U}else if(An(S)){let K={};for(const W in S){if(!Gn(K)&&!r)break;const ie=Ix(await S[W](R,n),D,W);ie&&(K={...ie,...B(W,ie.message)},P(ie.message),r&&(U[_]=K))}if(!Gn(K)&&(U[_]={ref:D,...K},!r))return U}}return P(!0),U};const lW={mode:Xr.onSubmit,reValidateMode:Xr.onChange,shouldFocusError:!0};function oW(e={}){let t={...lW,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:ma(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=An(t.defaultValues)||An(t.values)?Yt(t.defaultValues||t.values)||{}:{},l=t.shouldUnregister?{}:Yt(i),o={action:!1,mount:!1,watch:!1},c={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},f,p=0;const y={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let g={...y};const x={array:Nx(),state:Nx()},A=t.criteriaMode===Xr.all,S=q=>se=>{clearTimeout(p),p=setTimeout(q,se)},_=async q=>{if(!t.disabled&&(y.isValid||g.isValid||q)){const se=t.resolver?Gn((await H()).errors):await ee(r,!0);se!==n.isValid&&x.state.next({isValid:se})}},w=(q,se)=>{!t.disabled&&(y.isValidating||y.validatingFields||g.isValidating||g.validatingFields)&&((q||Array.from(c.mount)).forEach(ce=>{ce&&(se?St(n.validatingFields,ce,se):cn(n.validatingFields,ce))}),x.state.next({validatingFields:n.validatingFields,isValidating:!Gn(n.validatingFields)}))},C=(q,se=[],ce,ke,Te=!0,Ce=!0)=>{if(ke&&ce&&!t.disabled){if(o.action=!0,Ce&&Array.isArray(Re(r,q))){const G=ce(Re(r,q),ke.argA,ke.argB);Te&&St(r,q,G)}if(Ce&&Array.isArray(Re(n.errors,q))){const G=ce(Re(n.errors,q),ke.argA,ke.argB);Te&&St(n.errors,q,G),sW(n.errors,q)}if((y.touchedFields||g.touchedFields)&&Ce&&Array.isArray(Re(n.touchedFields,q))){const G=ce(Re(n.touchedFields,q),ke.argA,ke.argB);Te&&St(n.touchedFields,q,G)}(y.dirtyFields||g.dirtyFields)&&(n.dirtyFields=Co(i,l)),x.state.next({name:q,isDirty:ne(q,se),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else St(l,q,se)},R=(q,se)=>{St(n.errors,q,se),x.state.next({errors:n.errors})},D=q=>{n.errors=q,x.state.next({errors:n.errors,isValid:!1})},P=(q,se,ce,ke)=>{const Te=Re(r,q);if(Te){const Ce=Re(l,q,Bt(ce)?Re(i,q):ce);Bt(Ce)||ke&&ke.defaultChecked||se?St(l,q,se?Ce:Mx(Te._f)):ie(q,Ce),o.mount&&_()}},U=(q,se,ce,ke,Te)=>{let Ce=!1,G=!1;const ve={name:q};if(!t.disabled){if(!ce||ke){(y.isDirty||g.isDirty)&&(G=n.isDirty,n.isDirty=ve.isDirty=ne(),Ce=G!==ve.isDirty);const Me=wi(Re(i,q),se);G=!!Re(n.dirtyFields,q),Me?cn(n.dirtyFields,q):St(n.dirtyFields,q,!0),ve.dirtyFields=n.dirtyFields,Ce=Ce||(y.dirtyFields||g.dirtyFields)&&G!==!Me}if(ce){const Me=Re(n.touchedFields,q);Me||(St(n.touchedFields,q,ce),ve.touchedFields=n.touchedFields,Ce=Ce||(y.touchedFields||g.touchedFields)&&Me!==ce)}Ce&&Te&&x.state.next(ve)}return Ce?ve:{}},k=(q,se,ce,ke)=>{const Te=Re(n.errors,q),Ce=(y.isValid||g.isValid)&&Nr(se)&&n.isValid!==se;if(t.delayError&&ce?(f=S(()=>R(q,ce)),f(t.delayError)):(clearTimeout(p),f=null,ce?St(n.errors,q,ce):cn(n.errors,q)),(ce?!wi(Te,ce):Te)||!Gn(ke)||Ce){const G={...ke,...Ce&&Nr(se)?{isValid:se}:{},errors:n.errors,name:q};n={...n,...G},x.state.next(G)}},H=async q=>{w(q,!0);const se=await t.resolver(l,t.context,eW(q||c.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return w(q),se},j=async q=>{const{errors:se}=await H(q);if(q)for(const ce of q){const ke=Re(se,ce);ke?St(n.errors,ce,ke):cn(n.errors,ce)}else n.errors=se;return se},ee=async(q,se,ce={valid:!0})=>{for(const ke in q){const Te=q[ke];if(Te){const{_f:Ce,...G}=Te;if(Ce){const ve=c.array.has(Ce.name),Me=Te._f&&tW(Te._f);Me&&y.validatingFields&&w([Ce.name],!0);const ze=await _g(Te,c.disabled,l,A,t.shouldUseNativeValidation&&!se,ve);if(Me&&y.validatingFields&&w([Ce.name]),ze[Ce.name]&&(ce.valid=!1,se))break;!se&&(Re(ze,Ce.name)?ve?rC(n.errors,ze,Ce.name):St(n.errors,Ce.name,ze[Ce.name]):cn(n.errors,Ce.name))}!Gn(G)&&await ee(G,se,ce)}}return ce.valid},B=()=>{for(const q of c.unMount){const se=Re(r,q);se&&(se._f.refs?se._f.refs.every(ce=>!sp(ce)):!sp(se._f.ref))&&Se(q)}c.unMount=new Set},ne=(q,se)=>!t.disabled&&(q&&se&&St(l,q,se),!wi(L(),i)),K=(q,se,ce)=>GS(q,c,{...o.mount?l:Bt(se)?i:Mr(q)?{[q]:se}:se},ce,se),W=q=>Kf(Re(o.mount?l:i,q,t.shouldUnregister?Re(i,q,[]):[])),ie=(q,se,ce={})=>{const ke=Re(r,q);let Te=se;if(ke){const Ce=ke._f;Ce&&(!Ce.disabled&&St(l,q,tC(se,Ce)),Te=H1(Ce.ref)&&mr(se)?"":se,WS(Ce.ref)?[...Ce.ref.options].forEach(G=>G.selected=Te.includes(G.value)):Ce.refs?h0(Ce.ref)?Ce.refs.forEach(G=>{(!G.defaultChecked||!G.disabled)&&(Array.isArray(Te)?G.checked=!!Te.find(ve=>ve===G.value):G.checked=Te===G.value||!!Te)}):Ce.refs.forEach(G=>G.checked=G.value===Te):O6(Ce.ref)?Ce.ref.value="":(Ce.ref.value=Te,Ce.ref.type||x.state.next({name:q,values:Yt(l)})))}(ce.shouldDirty||ce.shouldTouch)&&U(q,Te,ce.shouldTouch,ce.shouldDirty,!0),ce.shouldValidate&&fe(q)},he=(q,se,ce)=>{for(const ke in se){if(!se.hasOwnProperty(ke))return;const Te=se[ke],Ce=q+"."+ke,G=Re(r,Ce);(c.array.has(q)||An(Te)||G&&!G._f)&&!rl(Te)?he(Ce,Te,ce):ie(Ce,Te,ce)}},F=(q,se,ce={})=>{const ke=Re(r,q),Te=c.array.has(q),Ce=Yt(se);St(l,q,Ce),Te?(x.array.next({name:q,values:Yt(l)}),(y.isDirty||y.dirtyFields||g.isDirty||g.dirtyFields)&&ce.shouldDirty&&x.state.next({name:q,dirtyFields:Co(i,l),isDirty:ne(q,Ce)})):ke&&!ke._f&&!mr(Ce)?he(q,Ce,ce):ie(q,Ce,ce),Tg(q,c)&&x.state.next({...n,name:q}),x.state.next({name:o.mount?q:void 0,values:Yt(l)})},$=async q=>{o.mount=!0;const se=q.target;let ce=se.name,ke=!0;const Te=Re(r,ce),Ce=Me=>{ke=Number.isNaN(Me)||rl(Me)&&isNaN(Me.getTime())||wi(Me,Re(l,ce,Me))},G=Oo(t.mode),ve=Oo(t.reValidateMode);if(Te){let Me,ze;const We=se.type?Mx(Te._f):YS(q),Vt=q.type===j1.BLUR||q.type===j1.FOCUS_OUT,Nn=!nW(Te._f)&&!t.resolver&&!Re(n.errors,ce)&&!Te._f.deps||iW(Vt,Re(n.touchedFields,ce),n.isSubmitted,ve,G),ln=Tg(ce,c,Vt);St(l,ce,We),Vt?(!se||!se.readOnly)&&(Te._f.onBlur&&Te._f.onBlur(q),f&&f(0)):Te._f.onChange&&Te._f.onChange(q);const zt=U(ce,We,Vt),_n=!Gn(zt)||ln;if(!Vt&&x.state.next({name:ce,type:q.type,values:Yt(l)}),Nn)return(y.isValid||g.isValid)&&(t.mode==="onBlur"?Vt&&_():Vt||_()),_n&&x.state.next({name:ce,...ln?{}:zt});if(!Vt&&ln&&x.state.next({...n}),t.resolver){const{errors:vt}=await H([ce]);if(Ce(We),ke){const jr=Dx(n.errors,r,ce),On=Dx(vt,r,jr.name||ce);Me=On.error,ce=On.name,ze=Gn(vt)}}else w([ce],!0),Me=(await _g(Te,c.disabled,l,A,t.shouldUseNativeValidation))[ce],w([ce]),Ce(We),ke&&(Me?ze=!1:(y.isValid||g.isValid)&&(ze=await ee(r,!0)));ke&&(Te._f.deps&&(!Array.isArray(Te._f.deps)||Te._f.deps.length>0)&&fe(Te._f.deps),k(ce,ze,Me,zt))}},Q=(q,se)=>{if(Re(n.errors,se)&&q.focus)return q.focus(),1},fe=async(q,se={})=>{let ce,ke;const Te=pr(q);if(t.resolver){const Ce=await j(Bt(q)?q:Te);ce=Gn(Ce),ke=q?!Te.some(G=>Re(Ce,G)):ce}else q?(ke=(await Promise.all(Te.map(async Ce=>{const G=Re(r,Ce);return await ee(G&&G._f?{[Ce]:G}:G)}))).every(Boolean),!(!ke&&!n.isValid)&&_()):ke=ce=await ee(r);return x.state.next({...!Mr(q)||(y.isValid||g.isValid)&&ce!==n.isValid?{}:{name:q},...t.resolver||!q?{isValid:ce}:{},errors:n.errors}),se.shouldFocus&&!ke&&Po(r,Q,q?Te:c.mount),ke},L=(q,se)=>{let ce={...o.mount?l:i};return se&&(ce=XS(se.dirtyFields?n.dirtyFields:n.touchedFields,ce)),Bt(q)?ce:Mr(q)?Re(ce,q):q.map(ke=>Re(ce,ke))},V=(q,se)=>({invalid:!!Re((se||n).errors,q),isDirty:!!Re((se||n).dirtyFields,q),error:Re((se||n).errors,q),isValidating:!!Re(n.validatingFields,q),isTouched:!!Re((se||n).touchedFields,q)}),re=q=>{q&&pr(q).forEach(se=>cn(n.errors,se)),x.state.next({errors:q?n.errors:{}})},O=(q,se,ce)=>{const ke=(Re(r,q,{_f:{}})._f||{}).ref,Te=Re(n.errors,q)||{},{ref:Ce,message:G,type:ve,...Me}=Te;St(n.errors,q,{...Me,...se,ref:ke}),x.state.next({name:q,errors:n.errors,isValid:!1}),ce&&ce.shouldFocus&&ke&&ke.focus&&ke.focus()},ue=(q,se)=>ma(q)?x.state.subscribe({next:ce=>"values"in ce&&q(K(void 0,se),ce)}):K(q,se,!0),be=q=>x.state.subscribe({next:se=>{aW(q.name,se.name,q.exact)&&rW(se,q.formState||y,Pr,q.reRenderRoot)&&q.callback({values:{...l},...n,...se,defaultValues:i})}}).unsubscribe,xe=q=>(o.mount=!0,g={...g,...q.formState},be({...q,formState:g})),Se=(q,se={})=>{for(const ce of q?pr(q):c.mount)c.mount.delete(ce),c.array.delete(ce),se.keepValue||(cn(r,ce),cn(l,ce)),!se.keepError&&cn(n.errors,ce),!se.keepDirty&&cn(n.dirtyFields,ce),!se.keepTouched&&cn(n.touchedFields,ce),!se.keepIsValidating&&cn(n.validatingFields,ce),!t.shouldUnregister&&!se.keepDefaultValue&&cn(i,ce);x.state.next({values:Yt(l)}),x.state.next({...n,...se.keepDirty?{isDirty:ne()}:{}}),!se.keepIsValid&&_()},Pe=({disabled:q,name:se})=>{(Nr(q)&&o.mount||q||c.disabled.has(se))&&(q?c.disabled.add(se):c.disabled.delete(se))},Ge=(q,se={})=>{let ce=Re(r,q);const ke=Nr(se.disabled)||Nr(t.disabled);return St(r,q,{...ce||{},_f:{...ce&&ce._f?ce._f:{ref:{name:q}},name:q,mount:!0,...se}}),c.mount.add(q),ce?Pe({disabled:Nr(se.disabled)?se.disabled:t.disabled,name:q}):P(q,!0,se.value),{...ke?{disabled:se.disabled||t.disabled}:{},...t.progressive?{required:!!se.required,min:sc(se.min),max:sc(se.max),minLength:sc(se.minLength),maxLength:sc(se.maxLength),pattern:sc(se.pattern)}:{},name:q,onChange:$,onBlur:$,ref:Te=>{if(Te){Ge(q,se),ce=Re(r,q);const Ce=Bt(Te.value)&&Te.querySelectorAll&&Te.querySelectorAll("input,select,textarea")[0]||Te,G=KX(Ce),ve=ce._f.refs||[];if(G?ve.find(Me=>Me===Ce):Ce===ce._f.ref)return;St(r,q,{_f:{...ce._f,...G?{refs:[...ve.filter(sp),Ce,...Array.isArray(Re(i,q))?[{}]:[]],ref:{type:Ce.type,name:q}}:{ref:Ce}}}),P(q,!1,void 0,Ce)}else ce=Re(r,q,{}),ce._f&&(ce._f.mount=!1),(t.shouldUnregister||se.shouldUnregister)&&!($S(c.array,q)&&o.action)&&c.unMount.add(q)}}},kt=()=>t.shouldFocusError&&Po(r,Q,c.mount),en=q=>{Nr(q)&&(x.state.next({disabled:q}),Po(r,(se,ce)=>{const ke=Re(r,ce);ke&&(se.disabled=ke._f.disabled||q,Array.isArray(ke._f.refs)&&ke._f.refs.forEach(Te=>{Te.disabled=ke._f.disabled||q}))},0,!1))},tn=(q,se)=>async ce=>{let ke;ce&&(ce.preventDefault&&ce.preventDefault(),ce.persist&&ce.persist());let Te=Yt(l);if(x.state.next({isSubmitting:!0}),t.resolver){const{errors:Ce,values:G}=await H();n.errors=Ce,Te=Yt(G)}else await ee(r);if(c.disabled.size)for(const Ce of c.disabled)cn(Te,Ce);if(cn(n.errors,"root"),Gn(n.errors)){x.state.next({errors:{}});try{await q(Te,ce)}catch(Ce){ke=Ce}}else se&&await se({...n.errors},ce),kt(),setTimeout(kt);if(x.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Gn(n.errors)&&!ke,submitCount:n.submitCount+1,errors:n.errors}),ke)throw ke},br=(q,se={})=>{Re(r,q)&&(Bt(se.defaultValue)?F(q,Yt(Re(i,q))):(F(q,se.defaultValue),St(i,q,Yt(se.defaultValue))),se.keepTouched||cn(n.touchedFields,q),se.keepDirty||(cn(n.dirtyFields,q),n.isDirty=se.defaultValue?ne(q,Yt(Re(i,q))):ne()),se.keepError||(cn(n.errors,q),y.isValid&&_()),x.state.next({...n}))},Un=(q,se={})=>{const ce=q?Yt(q):i,ke=Yt(ce),Te=Gn(q),Ce=Te?i:ke;if(se.keepDefaultValues||(i=ce),!se.keepValues){if(se.keepDirtyValues){const G=new Set([...c.mount,...Object.keys(Co(i,l))]);for(const ve of Array.from(G))Re(n.dirtyFields,ve)?St(Ce,ve,Re(l,ve)):F(ve,Re(Ce,ve))}else{if(_6&&Bt(q))for(const G of c.mount){const ve=Re(r,G);if(ve&&ve._f){const Me=Array.isArray(ve._f.refs)?ve._f.refs[0]:ve._f.ref;if(H1(Me)){const ze=Me.closest("form");if(ze){ze.reset();break}}}}if(se.keepFieldsRef)for(const G of c.mount)F(G,Re(Ce,G));else r={}}l=t.shouldUnregister?se.keepDefaultValues?Yt(i):{}:Yt(Ce),x.array.next({values:{...Ce}}),x.state.next({values:{...Ce}})}c={mount:se.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!y.isValid||!!se.keepIsValid||!!se.keepDirtyValues,o.watch=!!t.shouldUnregister,x.state.next({submitCount:se.keepSubmitCount?n.submitCount:0,isDirty:Te?!1:se.keepDirty?n.isDirty:!!(se.keepDefaultValues&&!wi(q,i)),isSubmitted:se.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Te?{}:se.keepDirtyValues?se.keepDefaultValues&&l?Co(i,l):n.dirtyFields:se.keepDefaultValues&&q?Co(i,q):se.keepDirty?n.dirtyFields:{},touchedFields:se.keepTouched?n.touchedFields:{},errors:se.keepErrors?n.errors:{},isSubmitSuccessful:se.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},oa=(q,se)=>Un(ma(q)?q(l):q,se),ua=(q,se={})=>{const ce=Re(r,q),ke=ce&&ce._f;if(ke){const Te=ke.refs?ke.refs[0]:ke.ref;Te.focus&&(Te.focus(),se.shouldSelect&&ma(Te.select)&&Te.select())}},Pr=q=>{n={...n,...q}},Tn={control:{register:Ge,unregister:Se,getFieldState:V,handleSubmit:tn,setError:O,_subscribe:be,_runSchema:H,_focusError:kt,_getWatch:K,_getDirty:ne,_setValid:_,_setFieldArray:C,_setDisabledField:Pe,_setErrors:D,_getFieldArray:W,_reset:Un,_resetDefaultValues:()=>ma(t.defaultValues)&&t.defaultValues().then(q=>{oa(q,t.resetOptions),x.state.next({isLoading:!1})}),_removeUnmounted:B,_disableForm:en,_subjects:x,_proxyFormState:y,get _fields(){return r},get _formValues(){return l},get _state(){return o},set _state(q){o=q},get _defaultValues(){return i},get _names(){return c},set _names(q){c=q},get _formState(){return n},get _options(){return t},set _options(q){t={...t,...q}}},subscribe:xe,trigger:fe,register:Ge,handleSubmit:tn,watch:ue,setValue:F,getValues:L,reset:oa,resetField:br,clearErrors:re,unregister:Se,setError:O,setFocus:ua,getFieldState:V};return{...Tn,formControl:Tn}}var ms=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(Math.random()*16+e)%16|0;return(t=="x"?n:n&3|8).toString(16)})},lp=(e,t,n={})=>n.shouldFocus||Bt(n.shouldFocus)?n.focusName||`${e}.${Bt(n.focusIndex)?t:n.focusIndex}.`:"",op=(e,t)=>[...e,...pr(t)],up=e=>Array.isArray(e)?e.map(()=>{}):void 0;function cp(e,t,n){return[...e.slice(0,t),...pr(n),...e.slice(t)]}var dp=(e,t,n)=>Array.isArray(e)?(Bt(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],fp=(e,t)=>[...pr(t),...pr(e)];function uW(e,t){let n=0;const r=[...e];for(const i of t)r.splice(i-n,1),n++;return Kf(r).length?r:[]}var hp=(e,t)=>Bt(t)?[]:uW(e,pr(t).sort((n,r)=>n-r)),mp=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]},Px=(e,t,n)=>(e[t]=n,e);function cW(e){const t=Ca(),{control:n=t.control,name:r,keyName:i="id",shouldUnregister:l,rules:o}=e,[c,f]=J.useState(n._getFieldArray(r)),p=J.useRef(n._getFieldArray(r).map(ms)),y=J.useRef(!1);n._names.array.add(r),J.useMemo(()=>o&&c.length>=0&&n.register(r,o),[n,r,c.length,o]),Xf(()=>n._subjects.array.subscribe({next:({values:P,name:U})=>{if(U===r||!U){const k=Re(P,r);Array.isArray(k)&&(f(k),p.current=k.map(ms))}}}).unsubscribe,[n,r]);const g=J.useCallback(P=>{y.current=!0,n._setFieldArray(r,P)},[n,r]),x=(P,U)=>{const k=pr(Yt(P)),H=op(n._getFieldArray(r),k);n._names.focus=lp(r,H.length-1,U),p.current=op(p.current,k.map(ms)),g(H),f(H),n._setFieldArray(r,H,op,{argA:up(P)})},A=(P,U)=>{const k=pr(Yt(P)),H=fp(n._getFieldArray(r),k);n._names.focus=lp(r,0,U),p.current=fp(p.current,k.map(ms)),g(H),f(H),n._setFieldArray(r,H,fp,{argA:up(P)})},S=P=>{const U=hp(n._getFieldArray(r),P);p.current=hp(p.current,P),g(U),f(U),!Array.isArray(Re(n._fields,r))&&St(n._fields,r,void 0),n._setFieldArray(r,U,hp,{argA:P})},_=(P,U,k)=>{const H=pr(Yt(U)),j=cp(n._getFieldArray(r),P,H);n._names.focus=lp(r,P,k),p.current=cp(p.current,P,H.map(ms)),g(j),f(j),n._setFieldArray(r,j,cp,{argA:P,argB:up(U)})},w=(P,U)=>{const k=n._getFieldArray(r);mp(k,P,U),mp(p.current,P,U),g(k),f(k),n._setFieldArray(r,k,mp,{argA:P,argB:U},!1)},C=(P,U)=>{const k=n._getFieldArray(r);dp(k,P,U),dp(p.current,P,U),g(k),f(k),n._setFieldArray(r,k,dp,{argA:P,argB:U},!1)},R=(P,U)=>{const k=Yt(U),H=Px(n._getFieldArray(r),P,k);p.current=[...H].map((j,ee)=>!j||ee===P?ms():p.current[ee]),g(H),f([...H]),n._setFieldArray(r,H,Px,{argA:P,argB:k},!0,!1)},D=P=>{const U=pr(Yt(P));p.current=U.map(ms),g([...U]),f([...U]),n._setFieldArray(r,[...U],k=>k,{},!0,!1)};return J.useEffect(()=>{if(n._state.action=!1,Tg(r,n._names)&&n._subjects.state.next({...n._formState}),y.current&&(!Oo(n._options.mode).isOnSubmit||n._formState.isSubmitted)&&!Oo(n._options.reValidateMode).isOnSubmit)if(n._options.resolver)n._runSchema([r]).then(P=>{const U=Re(P.errors,r),k=Re(n._formState.errors,r);(k?!U&&k.type||U&&(k.type!==U.type||k.message!==U.message):U&&U.type)&&(U?St(n._formState.errors,r,U):cn(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{const P=Re(n._fields,r);P&&P._f&&!(Oo(n._options.reValidateMode).isOnSubmit&&Oo(n._options.mode).isOnSubmit)&&_g(P,n._names.disabled,n._formValues,n._options.criteriaMode===Xr.all,n._options.shouldUseNativeValidation,!0).then(U=>!Gn(U)&&n._subjects.state.next({errors:rC(n._formState.errors,U,r)}))}n._subjects.state.next({name:r,values:Yt(n._formValues)}),n._names.focus&&Po(n._fields,(P,U)=>{if(n._names.focus&&U.startsWith(n._names.focus)&&P.focus)return P.focus(),1}),n._names.focus="",n._setValid(),y.current=!1},[c,r,n]),J.useEffect(()=>(!Re(n._formValues,r)&&n._setFieldArray(r),()=>{const P=(U,k)=>{const H=Re(n._fields,U);H&&H._f&&(H._f.mount=k)};n._options.shouldUnregister||l?n.unregister(r):P(r,!1)}),[r,n,i,l]),{swap:J.useCallback(w,[g,r,n]),move:J.useCallback(C,[g,r,n]),prepend:J.useCallback(A,[g,r,n]),append:J.useCallback(x,[g,r,n]),remove:J.useCallback(S,[g,r,n]),insert:J.useCallback(_,[g,r,n]),update:J.useCallback(R,[g,r,n]),replace:J.useCallback(D,[g,r,n]),fields:J.useMemo(()=>c.map((P,U)=>({...P,[i]:p.current[U]||ms()})),[c,i])}}function aC(e={}){const t=J.useRef(void 0),n=J.useRef(void 0),[r,i]=J.useState({isDirty:!1,isValidating:!1,isLoading:ma(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ma(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!ma(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...c}=oW(e);t.current={...c,formState:r}}const l=t.current.control;return l._options=e,Xf(()=>{const o=l._subscribe({formState:l._proxyFormState,callback:()=>i({...l._formState}),reRenderRoot:!0});return i(c=>({...c,isReady:!0})),l._formState.isReady=!0,o},[l]),J.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),J.useEffect(()=>{e.mode&&(l._options.mode=e.mode),e.reValidateMode&&(l._options.reValidateMode=e.reValidateMode)},[l,e.mode,e.reValidateMode]),J.useEffect(()=>{e.errors&&(l._setErrors(e.errors),l._focusError())},[l,e.errors]),J.useEffect(()=>{e.shouldUnregister&&l._subjects.state.next({values:l._getWatch()})},[l,e.shouldUnregister]),J.useEffect(()=>{if(l._proxyFormState.isDirty){const o=l._getDirty();o!==r.isDirty&&l._subjects.state.next({isDirty:o})}},[l,r.isDirty]),J.useEffect(()=>{e.values&&!wi(e.values,n.current)?(l._reset(e.values,{keepFieldsRef:!0,...l._options.resetOptions}),n.current=e.values,i(o=>({...o}))):l._resetDefaultValues()},[l,e.values]),J.useEffect(()=>{l._state.mount||(l._setValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),t.current.formState=QS(r,l),t.current}const jx=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Re(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Sg=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?jx(r.ref,n,e):r&&r.refs&&r.refs.forEach(i=>jx(i,n,e))}},Hx=(e,t)=>{t.shouldUseNativeValidation&&Sg(e,t);const n={};for(const r in e){const i=Re(t.fields,r),l=Object.assign(e[r]||{},{ref:i&&i.ref});if(dW(t.names||Object.keys(e),r)){const o=Object.assign({},Re(n,r));St(o,"root",l),St(n,r,o)}else St(n,r,l)}return n},dW=(e,t)=>{const n=Fx(t);return e.some(r=>Fx(r).match(`^${n}\\.\\d+`))};function Fx(e){return e.replace(/\]|\[/g,"")}function iC(e,t,n){function r(c,f){var p;Object.defineProperty(c,"_zod",{value:c._zod??{},enumerable:!1}),(p=c._zod).traits??(p.traits=new Set),c._zod.traits.add(e),t(c,f);for(const y in o.prototype)y in c||Object.defineProperty(c,y,{value:o.prototype[y].bind(c)});c._zod.constr=o,c._zod.def=f}const i=n?.Parent??Object;class l extends i{}Object.defineProperty(l,"name",{value:e});function o(c){var f;const p=n?.Parent?new l:this;r(p,c),(f=p._zod).deferred??(f.deferred=[]);for(const y of p._zod.deferred)y();return p}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class fW extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const hW={};function sC(e){return hW}function mW(e,t){return typeof t=="bigint"?t.toString():t}const lC=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function $d(e){return typeof e=="string"?e:e?.message}function oC(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const i=$d(e.inst?._zod.def?.error?.(e))??$d(t?.error?.(e))??$d(n.customError?.(e))??$d(n.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}const uC=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,mW,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pW=iC("$ZodError",uC),cC=iC("$ZodError",uC,{Parent:Error}),gW=e=>(t,n,r,i)=>{const l=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},l);if(o instanceof Promise)throw new fW;if(o.issues.length){const c=new(i?.Err??e)(o.issues.map(f=>oC(f,l,sC())));throw lC(c,i?.callee),c}return o.value},yW=gW(cC),bW=e=>async(t,n,r,i)=>{const l=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},l);if(o instanceof Promise&&(o=await o),o.issues.length){const c=new(i?.Err??e)(o.issues.map(f=>oC(f,l,sC())));throw lC(c,i?.callee),c}return o.value},vW=bW(cC);function Bx(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function EW(e,t){for(var n={};e.length;){var r=e[0],i=r.code,l=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var c=r.unionErrors[0].errors[0];n[o]={message:c.message,type:c.code}}else n[o]={message:l,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(y){return y.errors.forEach(function(g){return e.push(g)})}),t){var f=n[o].types,p=f&&f[r.code];n[o]=N6(o,t,n,i,p?[].concat(p,r.message):r.message)}e.shift()}return n}function xW(e,t){for(var n={};e.length;){var r=e[0],i=r.code,l=r.message,o=r.path.join(".");if(!n[o])if(r.code==="invalid_union"&&r.errors.length>0){var c=r.errors[0][0];n[o]={message:c.message,type:c.code}}else n[o]={message:l,type:i};if(r.code==="invalid_union"&&r.errors.forEach(function(y){return y.forEach(function(g){return e.push(g)})}),t){var f=n[o].types,p=f&&f[r.code];n[o]=N6(o,t,n,i,p?[].concat(p,r.message):r.message)}e.shift()}return n}function dC(e,t,n){if(n===void 0&&(n={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(e))return function(r,i,l){try{return Promise.resolve(Bx(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(o){return l.shouldUseNativeValidation&&Sg({},l),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(c){return Array.isArray(c?.issues)})(o))return{values:{},errors:Hx(EW(o.errors,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw o}))}catch(o){return Promise.reject(o)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(e))return function(r,i,l){try{return Promise.resolve(Bx(function(){return Promise.resolve((n.mode==="sync"?yW:vW)(e,r,t)).then(function(o){return l.shouldUseNativeValidation&&Sg({},l),{errors:{},values:n.raw?Object.assign({},r):o}})},function(o){if((function(c){return c instanceof pW})(o))return{values:{},errors:Hx(xW(o.issues,!l.shouldUseNativeValidation&&l.criteriaMode==="all"),l)};throw o}))}catch(o){return Promise.reject(o)}};throw new Error("Invalid input: not a Zod schema")}function k6(e){return aC({...e,resolver:dC(e.schema,void 0)})}function fC({form:e,className:t,children:n,onSubmit:r}){return m.jsx(w6,{...e,children:m.jsx("form",{onSubmit:e.handleSubmit(r),className:Ae("flex w-full flex-col gap-y-8",t),children:n})})}function M6({schema:e,defaultValues:t,className:n,children:r,onSubmit:i}){const l=k6({schema:e,defaultValues:t});return m.jsx(w6,{...l,children:m.jsx("form",{onSubmit:l.handleSubmit(i),className:Ae("flex w-full flex-col gap-y-8",n),children:r})})}const hC=h.createContext({}),Wf=({...e})=>m.jsx(hC.Provider,{value:{name:e.name},children:m.jsx(GX,{...e})}),Jf=()=>{const e=h.useContext(hC),t=h.useContext(mC),{getFieldState:n,formState:r}=Ca(),i=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:l}=t;return{id:l,name:e.name,formItemId:`${l}-form-item`,formDescriptionId:`${l}-form-item-description`,formMessageId:`${l}-form-item-message`,...i}},mC=h.createContext({});function L6(e){const{className:t,...n}=e,r=h.useId();return m.jsx(mC.Provider,{value:{id:r},children:m.jsx("div",{className:Ae("flex flex-col gap-y-2",t),...n})})}function D6(e){const{className:t,...n}=e,{error:r,formItemId:i}=Jf();return m.jsx(_l,{className:Ae(r&&"text-destructive",t),htmlFor:i,...n})}function I6(e){const{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=Jf();return m.jsx(Bn,{id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function P6(e){const{className:t,...n}=e,{formDescriptionId:r}=Jf();return m.jsx("p",{id:r,className:Ae("text-fg-subtle text-xs",t),...n})}function j6(e){const{className:t,children:n,...r}=e,{error:i,formMessageId:l}=Jf(),o=i?String(i?.message??""):n;return o?m.jsx("p",{id:l,className:Ae("text-accent-red text-sm",t),...r,children:o}):null}function m0({className:e,type:t,...n}){return m.jsx("input",{type:t,className:Ae("flex h-8 w-full min-w-0 rounded-md border border-input bg-surface px-3 py-1 text-sm shadow-xs outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground/70 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",t==="search"&&"[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",t==="file"&&"p-0 pr-3 text-muted-foreground/70 italic file:me-3 file:h-full file:border-0 file:border-input file:border-r file:border-solid file:bg-transparent file:px-3 file:font-medium file:text-foreground file:text-sm file:not-italic",e),...n})}function Ii({description:e,label:t,name:n,helperLabel:r,hideErrors:i=!1,...l}){const o=Ca();return m.jsx(Wf,{control:o.control,name:n,render:({field:c})=>m.jsx(L6,{children:m.jsxs("div",{className:"flex flex-col gap-1",children:[(t||r)&&m.jsxs("div",{className:"flex flex-row items-center",children:[t&&m.jsx(D6,{children:t}),r&&m.jsx(_l,{className:"ml-auto text-fg-subtle/70",children:r})]}),m.jsx(I6,{children:m.jsx(m0,{...l,...c})}),e&&m.jsx(P6,{children:e}),!i&&m.jsx(j6,{})]})})})}const pC=({className:e,children:t,...n})=>m.jsxs("div",{className:"relative flex w-full",children:[m.jsx("select",{"data-slot":"select-native",className:Ae("peer inline-flex cursor-pointer appearance-none items-center rounded-md border border-input bg-surface text-foreground text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 has-[option[disabled]:checked]:text-muted-foreground aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",n.multiple?"py-1 *:px-3 *:py-1 [&_option:checked]:bg-accent":"h-8 ps-3 pe-8",e),...n,children:t}),!n.multiple&&m.jsx("span",{className:"pointer-events-none absolute inset-y-0 end-2 flex h-full items-center justify-center text-muted-foreground/80 peer-disabled:opacity-50 peer-aria-invalid:text-destructive/80",children:m.jsx(Qx,{className:"size-3",weight:"bold","aria-hidden":"true"})})]});function Cg({className:e,description:t,label:n,name:r,helperLabel:i,hideErrors:l=!1,...o}){const c=Ca();return m.jsx(Wf,{control:c.control,name:r,render:({field:f})=>m.jsx(L6,{children:m.jsxs("div",{className:"flex flex-col gap-1",children:[(n||i)&&m.jsxs("div",{className:"flex flex-row items-center",children:[n&&m.jsx(D6,{children:n}),i&&m.jsx(_l,{className:"ml-auto text-fg-subtle/70",children:i})]}),m.jsx(I6,{children:m.jsx(pC,{className:Ae("w-full",e),...o,...f})}),t&&m.jsx(P6,{children:t}),!l&&m.jsx(j6,{})]})})})}function B1({registryEntry:e,playbooks:t,defaultPlaybookId:n,onClickCancel:r,onSubmit:i,isSubmitting:l=!1}){const o=(e.parameters??[]).filter((g,x,A)=>A.findIndex(S=>S.name===g.name)===x),c=(t??[]).filter(g=>g.servers.some(x=>x.name===e.name)).map(g=>g.id),f=t?.filter(g=>!c.includes(g.id));if(t&&t.length>0&&c.length===t.length)return m.jsx(Ta,{children:m.jsx(Ns,{children:"This MCP has already been installed on all your playbooks."})});const p=ga({...f&&f.length>0&&{playbookId:xn()},parameters:ga(o.reduce((g,x)=>(g[x.name]=xn().trim().min(1,"Required"),g),{}))}),y={...f&&f.length>0&&{playbookId:n??f[0]?.id??""},parameters:o.reduce((g,x)=>(g[x.name]="",g),{})};return m.jsxs(M6,{schema:p,defaultValues:y,className:"gap-y-0 overflow-hidden rounded-xl bg-accent-subtle shadow-[0_0_0_0.5px_rgba(55,50,46,0.15)]",onSubmit:g=>{i({playbookId:f&&f.length>0?g.playbookId:void 0,entryId:e.id,parameters:g.parameters})},children:[m.jsxs("div",{className:"flex flex-col gap-y-4 p-4",children:[f&&f.length>0&&m.jsx(Cg,{name:"playbookId",label:"Select a playbook",children:f.map(g=>m.jsx("option",{value:g.id,children:g.name},g.id))}),o.map(g=>m.jsx(Ii,{type:g.password?"password":"text",name:`parameters.${g.name}`,label:g.name,helperLabel:g.required?void 0:"Optional",description:m.jsx(MK,{children:g.description}),autoCorrect:"off",spellCheck:!1},g.name))]}),m.jsxs("div",{className:"border-fg/7 border-t-[0.5px] bg-accent px-4 py-2.5",children:[m.jsx(bt,{type:"submit",disabled:l,className:"w-full",children:l?"Installing...":"Add to playbook"}),r&&m.jsx(bt,{className:"mt-2 w-full bg-surface/50",variant:"secondary",onClick:r,disabled:l,type:"button",children:"Cancel"})]})]})}const H6=({children:e})=>m.jsx("div",{className:"flex flex-row gap-x-8",children:e}),F6=({children:e})=>m.jsx("div",{className:"flex min-w-0 grow flex-col gap-y-12 lg:gap-y-16",children:e}),B6=({children:e})=>m.jsx("div",{className:"hidden w-xs shrink-0 flex-col lg:flex",children:m.jsx("div",{className:"sticky top-0 flex flex-col gap-y-8",children:e})}),gC=M8,AW=L8,TW=D8;function _W({className:e,...t}){return m.jsx(Af,{className:Ae("overlay",e),...t})}function yC({className:e,children:t,dismissible:n=!0,...r}){return m.jsxs(TW,{children:[m.jsx(_W,{}),m.jsxs(Tf,{className:Ae("popover rounded-xl","fixed inset-x-1 top-1 z-50 grid outline-none duration-200","sm:top-12 sm:left-[50%] sm:w-full sm:max-w-md sm:translate-x-[-50%]","radix-state-[open]:fade-in-0 radix-state-[open]:zoom-in-95 radix-state-[open]:slide-in-from-top-[48%] radix-state-[open]:animate-in","radix-state-[closed]:fade-out-0 radix-state-[closed]:zoom-out-95 radix-state-[closed]:slide-out-to-top-[48%] radix-state-[closed]:animate-out",e),...r,children:[t,n&&m.jsx(_f,{className:Ae("absolute top-1 right-1 rounded-lg"),asChild:!0,children:m.jsxs(bt,{variant:"secondary",size:"icon",children:[m.jsx(Uc,{className:"size-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})}function SW({className:e,...t}){return m.jsx("div",{className:Ae("flex flex-col gap-y-1 p-5 text-start",e),...t})}function bC({className:e,...t}){return m.jsx(I8,{className:Ae(ji({variant:"h2"}),"text-fg",e),...t})}function vC({className:e,...t}){return m.jsx(P8,{className:Ae(ji({variant:"p"}),"text-fg-subtle",e),...t})}function CW({registryEntry:e,playbooks:t,onClickInstall:n,isInstalling:r,open:i,onOpenChange:l}){const o=e;return m.jsx(gC,{open:i,onOpenChange:l,children:m.jsxs(yC,{className:"!max-w-none !inset-1 !translate-0 !w-auto flex flex-col py-10",children:[m.jsxs(j8,{children:[m.jsxs(bC,{className:"pt-4",children:["Install ",o?.title]}),m.jsx(vC,{children:o?.description})]}),m.jsx(xa,{size:"xl",children:m.jsxs(H6,{children:[m.jsx(F6,{children:o&&m.jsx(HS,{entry:o})}),m.jsx(B6,{children:m.jsx("div",{className:"sticky top-0 flex flex-col gap-y-8",children:m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h3",asChild:!0,children:m.jsx("h3",{children:"Add to playbook"})})}),o&&m.jsx(B1,{registryEntry:o,playbooks:t,onSubmit:n,isSubmitting:r,onClickCancel:()=>l(!1)})]})})})]})}),m.jsx("div",{className:"-bottom-5 sticky inset-x-0 px-4 pt-4 md:hidden",children:m.jsx("div",{className:"rounded-xl bg-accent-subtle p-4 shadow-[0_0_0_0.5px_rgba(55,50,46,0.2)]",children:o&&m.jsx(B1,{registryEntry:o,playbooks:t,onSubmit:n,isSubmitting:r,onClickCancel:()=>l(!1)})})})]})})}function wW({registryEntry:e,playbooks:t,onClickInstall:n,isInstalling:r,open:i,onOpenChange:l}){return m.jsx(CW,{registryEntry:e,playbooks:t,onClickInstall:n,isInstalling:r,open:i,onOpenChange:l})}function NW({title:e="Get started",description:t="Let's get your started with MCP using Director."}){return m.jsxs(m.Fragment,{children:[m.jsx(Ef,{className:"mx-auto"}),m.jsxs(Ot,{className:"items-center gap-y-1.5 text-center",children:[m.jsx(Rt,{className:"font-medium text-2xl",children:e}),m.jsx(ti,{className:"text-base",children:t})]})]})}var EC="Toggle",xC=h.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...l}=e,[o,c]=ra({prop:n,onChange:i,defaultProp:r??!1,caller:EC});return m.jsx(tt.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...l,ref:t,onClick:qe(e.onClick,()=>{e.disabled||c(!o)})})});xC.displayName=EC;var Rs="ToggleGroup",[AC]=gr(Rs,[Go]),TC=Go(),U6=J.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const i=r;return m.jsx(OW,{...i,ref:t})}if(n==="multiple"){const i=r;return m.jsx(RW,{...i,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Rs}\``)});U6.displayName=Rs;var[_C,SC]=AC(Rs),OW=J.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...l}=e,[o,c]=ra({prop:n,defaultProp:r??"",onChange:i,caller:Rs});return m.jsx(_C,{scope:e.__scopeToggleGroup,type:"single",value:J.useMemo(()=>o?[o]:[],[o]),onItemActivate:c,onItemDeactivate:J.useCallback(()=>c(""),[c]),children:m.jsx(CC,{...l,ref:t})})}),RW=J.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...l}=e,[o,c]=ra({prop:n,defaultProp:r??[],onChange:i,caller:Rs}),f=J.useCallback(y=>c((g=[])=>[...g,y]),[c]),p=J.useCallback(y=>c((g=[])=>g.filter(x=>x!==y)),[c]);return m.jsx(_C,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:f,onItemDeactivate:p,children:m.jsx(CC,{...l,ref:t})})});U6.displayName=Rs;var[kW,MW]=AC(Rs),CC=J.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:l,dir:o,loop:c=!0,...f}=e,p=TC(n),y=zc(o),g={role:"group",dir:y,...f};return m.jsx(kW,{scope:n,rovingFocus:i,disabled:r,children:i?m.jsx(Kg,{asChild:!0,...p,orientation:l,dir:y,loop:c,children:m.jsx(tt.div,{...g,ref:t})}):m.jsx(tt.div,{...g,ref:t})})}),U1="ToggleGroupItem",wC=J.forwardRef((e,t)=>{const n=SC(U1,e.__scopeToggleGroup),r=MW(U1,e.__scopeToggleGroup),i=TC(e.__scopeToggleGroup),l=n.value.includes(e.value),o=r.disabled||e.disabled,c={...e,pressed:l,disabled:o},f=J.useRef(null);return r.rovingFocus?m.jsx(Xg,{asChild:!0,...i,focusable:!o,active:l,ref:f,children:m.jsx(Ux,{...c,ref:t})}):m.jsx(Ux,{...c,ref:t})});wC.displayName=U1;var Ux=J.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...i}=e,l=SC(U1,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},c=l.type==="single"?o:void 0;return m.jsx(xC,{...c,...i,ref:t,onPressedChange:f=>{f?l.onItemActivate(r):l.onItemDeactivate(r)}})}),LW=U6,DW=wC;function IW({selectedClient:e,onClientSelect:t,clients:n,isLoading:r,isInstalling:i,onInstall:l}){return m.jsxs("div",{className:"flex flex-col gap-y-4 p-4",children:[m.jsx(LW,{type:"single",value:e,onValueChange:o=>{t(o)},className:"group flex flex-row items-center justify-center gap-x-2",children:h.Children.toArray(n.map(o=>{const c=o.installed;return m.jsxs(DW,{value:o.id,className:Ae("group relative flex flex-1 flex-col items-center gap-y-1 overflow-hidden rounded-lg bg-accent p-3","cursor-pointer hover:bg-accent-subtle","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-accent","outline-none ring-2 ring-transparent ring-offset-2 ring-offset-surface","focus-visible:bg-accent-subtle focus-visible:ring-accent","radix-state-[on]:ring-fg"),disabled:i||r||!c,children:[m.jsx("img",{src:o.image,alt:"Claude",width:64,height:64}),m.jsx(an,{className:"font-[450] text-fg/80 capitalize",children:o.label})]},o.id)}))}),m.jsx(bt,{className:"self-end",disabled:!e||i,onClick:()=>{e&&l(e)},children:i?"Connecting…":"Connect"})]})}function PW({className:e,children:t,...n}){return m.jsx("div",{"data-slot":"get-started-list",className:Ae("flex flex-col gap-y-3",e),...n,children:t})}function Qd({className:e,children:t,title:n,status:r="not-started",...i}){return m.jsxs(yS,{"data-slot":"get-started-list-item",className:Ae("rounded-2xl",i.disabled?"bg-accent":"popover",e),...i,children:[m.jsxs(bS,{"data-slot":"get-started-list-item-trigger",tabIndex:-1,className:"group flex w-full flex-row items-center justify-between gap-x-2 py-3.5 pr-3.5 pl-3.5 text-start outline-none disabled:cursor-default",children:[(()=>{switch(r){case"completed":return m.jsx(Rg,{weight:"fill",className:"size-6 text-success-fg"});case"in-progress":return m.jsx(Kx,{weight:"fill",className:"size-6 text-fg/75"});case"not-started":return m.jsx(kg,{weight:"fill",className:"size-6 text-fg/30"})}})(),m.jsx("span",{className:"flex-1 font-[450] text-[15px] leading-6 tracking-[0.01em]",children:n})]}),m.jsx(vS,{"data-slot":"get-started-list-item-content",className:"border-t-[0.5px]",children:t})]})}function jW({searchQuery:e,onSearchQueryChange:t,registryEntries:n,onMcpSelect:r}){return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"relative z-10 px-2 pt-2",children:m.jsx(m0,{type:"text",placeholder:"Search MCP servers...",value:e,onChange:i=>t(i.target.value)})}),m.jsxs("div",{className:"grid max-h-[320px] grid-cols-1 gap-1 overflow-y-auto p-2",children:[n.sort((i,l)=>i.title.localeCompare(l.title)).map(i=>m.jsxs("div",{className:"flex cursor-pointer flex-row items-center gap-x-3 rounded-lg bg-accent-subtle/60 px-2.5 py-1.5 hover:bg-accent",onClick:()=>r(i),children:[m.jsx(Sf,{src:i.icon}),m.jsxs(dn,{children:[m.jsx(an,{children:i.title}),m.jsx(qa,{children:i.description})]})]},i.id)),n.length===0&&m.jsx(Ta,{className:"bg-accent-subtle/60",children:m.jsx(ni,{children:"No MCP servers found"})})]})]})}function HW({name:e,...t}){const n=Ca();return m.jsx(Wf,{control:n.control,name:e,render:({field:r})=>m.jsx(m0,{type:"hidden",...t,...r})})}function V6({className:e,...t}){const n="\\|/—",[r,i]=h.useState(0);return FW(()=>{i(l=>(l+1)%n.length)},100),m.jsxs("span",{className:Ae("font-mono",e),...t,children:["[",n[r],"]"]})}function FW(e,t){const n=h.useRef(e);BW(()=>{n.current=e},[e]),h.useEffect(()=>{const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}const BW=typeof window<"u"?h.useLayoutEffect:h.useEffect,UW=ga({name:xn().trim().min(1,"Required"),description:xn().trim().optional().transform(e=>e===""?void 0:e)});function VW({form:e,isPending:t,onSubmit:n}){return m.jsxs(fC,{className:"gap-y-4",form:e,onSubmit:async r=>{await n(r)},children:[m.jsx(Ii,{label:"Name",name:"name",placeholder:"My Playbook"}),m.jsx(HW,{name:"description"}),m.jsx(bt,{size:"default",className:"self-start",type:"submit",disabled:t,children:t?m.jsx(V6,{className:"text-fg-subtle"}):"Create playbook"})]})}function zW({className:e,...t}){return m.jsx("textarea",{"data-slot":"textarea",className:Ae("field-sizing-content flex min-h-19.5 w-full resize-none rounded-md border border-input bg-surface px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground/70 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",e),...t})}function z6({description:e,label:t,name:n,helperLabel:r,hideErrors:i=!1,...l}){const o=Ca();return m.jsx(Wf,{control:o.control,name:n,render:({field:c})=>m.jsx(L6,{children:m.jsxs("div",{className:"flex flex-col gap-2",children:[(t||r)&&m.jsxs("div",{className:"flex flex-row items-center",children:[t&&m.jsx(D6,{children:t}),r&&m.jsx(_l,{className:"ml-auto text-fg-subtle/70",children:r})]}),m.jsx(I6,{children:m.jsx(zW,{...l,...c})}),e&&m.jsx(P6,{children:e}),!i&&m.jsx(j6,{})]})})})}const ZW=ga({title:xn().min(1,"Title is required"),description:xn().optional(),body:xn().min(1,"Body is required")});function NC({prompt:e,onSubmit:t,isSubmitting:n=!1,onDelete:r,secondaryButton:i}){const l=aC({resolver:dC(ZW),defaultValues:{title:"",description:"",body:""},mode:"onChange"});h.useEffect(()=>{e?l.reset({title:e.title??"",description:e.description??"",body:e.body??""}):l.reset({title:"",description:"",body:""})},[e,l]);const o=l.handleSubmit(async c=>{await t(c)});return m.jsx(w6,{...l,children:m.jsxs("form",{className:"flex flex-col gap-y-3",onSubmit:o,children:[m.jsx(Ii,{name:"title",label:"Title",placeholder:"Enter title…"}),m.jsx(Ii,{name:"description",label:"Description",placeholder:"Optional short description…"}),m.jsx(z6,{name:"body",label:"Body",placeholder:"Write the prompt body…",rows:8}),m.jsxs("div",{className:"flex flex-row gap-x-2",children:[m.jsx(bt,{type:"submit",className:"grow",disabled:!l.formState.isValid||n,children:n?"Saving…":"Save"}),i,e&&r&&m.jsx(bt,{type:"button",variant:"secondary",onClick:r,children:m.jsx(Bc,{})})]})]})})}function qW(e){const{currentPlaybook:t,registryEntries:n,clientStatuses:r,isAddingPlaybookToClient:i,isCreatePlaybookLoading:l,onCreatePlaybook:o,searchQuery:c,onSearchQueryChange:f,onClickRegistryEntry:p,onAddPlaybookToClient:y,isPromptCompleted:g,onSkipPrompt:x,onPromptFormSubmit:A,isPromptSubmitting:S}=e,[_,w]=h.useState(),C=k6({schema:UW,defaultValues:{name:"",description:"A playbook for getting started"}}),R=!!t,D=(t?.servers?.length??0)>0,P=h.useMemo(()=>({create:R?"completed":"in-progress",add:R?D?"completed":"in-progress":"not-started",prompt:R&&D?g?"completed":"in-progress":"not-started",connect:R&&D&&g?"in-progress":"not-started"}),[R,D,g]);return m.jsx(xa,{size:"sm",className:"py-12 lg:py-16",children:m.jsxs(Nt,{className:"gap-y-8",children:[m.jsx(NW,{title:"Get started",description:"Let's get you set up with Director"}),m.jsxs(PW,{children:[m.jsx(Qd,{status:P.create,title:"1. Create a Playbook",disabled:P.create==="completed",open:P.create==="in-progress",children:m.jsx("div",{className:"py-4 pr-4 pl-11.5",children:m.jsx(VW,{form:C,isPending:l,onSubmit:o})})}),m.jsx(Qd,{status:P.add,title:"2. Add an MCP server",open:P.add==="in-progress",disabled:P.add!=="in-progress",children:m.jsx(jW,{searchQuery:c,onSearchQueryChange:f,registryEntries:n,onMcpSelect:p})}),m.jsx(Qd,{status:P.prompt,title:"3. Add a Prompt",open:P.prompt==="in-progress",disabled:P.prompt!=="in-progress",children:m.jsx("div",{className:"py-4 pr-4 pl-4",children:m.jsx(NC,{onSubmit:A,isSubmitting:S,secondaryButton:m.jsx(bt,{variant:"secondary",onClick:U=>{U.preventDefault(),x()},children:"Skip"})})})}),m.jsx(Qd,{status:P.connect,title:"4. Connect your client",open:P.connect==="in-progress",disabled:P.connect!=="in-progress",children:m.jsx(IW,{selectedClient:_,onClientSelect:w,clients:r,isLoading:!1,isInstalling:i,onInstall:y})})]})]})})}const OC=()=>m.jsx("div",{className:"flex h-screen w-screen items-center justify-center",children:m.jsx(Ef,{className:"size-10 animate-pulse"})}),YW=[{id:"claude",label:"Claude",image:new URL("/studio/assets/claude-icon-CCYRFsZn.png",import.meta.url).href},{id:"claude-code",label:"Claude Code",image:new URL("/studio/assets/claude-icon-CCYRFsZn.png",import.meta.url).href},{id:"cursor",label:"Cursor",image:new URL("/studio/assets/cursor-icon-DfqPZkLG.png",import.meta.url).href},{id:"vscode",label:"VSCode",image:new URL("/studio/assets/code-icon-Da0Eua6W.png",import.meta.url).href}];function RC(e){const t=gt.clients.allClients.useQuery(),n=t.isLoading,r=n?null:t.data?.map(l=>{const o=YW.find(c=>c.id===l.name);return o?{id:o.id,label:o.label,image:o.image,installed:l.installed,present:!!l.playbooks?.some(c=>c.id===e)}:null}).filter(l=>l!==null)??[];return{data:(n?null:[...r??[]])??void 0,isLoading:n}}function $W(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")}function kC(e,t){const n=gt.useUtils(),r=gt.store.addPrompt.useMutation({async onSuccess(l,o,c,f){await Promise.all([n.store.get.invalidate({playbookId:e}),n.store.getAll.invalidate(),n.store.listPrompts?.invalidate?.({playbookId:e})]),t?.onSuccess&&await t.onSuccess(l,o,c,f)},onError(l,o,c,f){t?.onError?.(l,o,c,f)}});return{createPrompt:async l=>{const o=$W(l.title);await r.mutateAsync({playbookId:e,prompt:{name:o,title:l.title,description:l.description,body:l.body}})},isPending:r.isPending}}function MC(e){const t=gt.useUtils(),n=e0.useUtils(),[r,i]=h.useState(!1),l=gt.store.addServer.useMutation({async onSuccess(c,f,p,y){if(c.connectionInfo?.status==="unauthorized"){const g=await t.store.authenticate.fetch({playbookId:f.playbookId,serverName:c.name});g.result==="REDIRECT"&&window.location.assign(g.redirectUrl);return}await t.store.getAll.invalidate(),f?.playbookId&&await t.store.get.invalidate({playbookId:f.playbookId}),e&&e.onSuccess&&await e.onSuccess(c,f,p,y)},onError(c,f,p,y){e&&e.onError&&e.onError(c,f,p,y)}});return{install:async c=>{try{i(!0);const f=await n.entries.getTransportForEntry.fetch({entryName:c.entryName,parameters:c.parameters??{}});return await l.mutateAsync({playbookId:c.playbookId,server:{name:c.entryName,transport:f}})}finally{i(!1)}},isPending:l.isPending||r}}function LC(e){return e0.entries.getEntries.useQuery({pageIndex:e.pageIndex,pageSize:e.pageSize,searchQuery:e.searchQuery},{placeholderData:t=>t})}function QW(){const e=Ir(),[t,n]=h.useState(""),[r,i]=h.useState(null),[l,o]=h.useState(!1),[c,f]=h.useState(null),[p,y]=h.useState(!1),[g,x]=h.useState(!1),{setInProgress:A}=C8();h.useEffect(()=>{A(!0)},[A]),h.useEffect(()=>{g&&A(!1)},[g,A]);const S=gt.useUtils(),_=n0(),w=LC({pageIndex:0,pageSize:20,searchQuery:t}),C=RC(r),R=e0.entries.getEntryByName.useQuery({name:c||""},{enabled:!!c&&p}),D=gt.store.create.useMutation({onSuccess:async()=>{await S.store.getAll.refetch(),Pt({title:"Playbook created",description:"This playbook was successfully created."})}}),P=gt.clients.install.useMutation({onSuccess:()=>{S.clients.allClients.invalidate(),Pt({title:"Playbook installed",description:"This playbook was successfully installed"}),x(!0)},onError:$=>{Pt({title:"Error",description:$.message})}}),{createPrompt:U,isPending:k}=kC(r||"",{onSuccess:()=>{Pt({title:"Prompt created",description:"Your prompt was successfully added to the playbook."}),o(!0)},onError:$=>{Pt({title:"Error",description:$.message})}}),{install:H,isPending:j}=MC({onError:$=>{Pt({title:"Error",description:$.message})},onSuccess:$=>{S.store.getAll.invalidate(),Pt({title:"Playbook installed",description:"This playbook was successfully installed."}),y(!1)}});h.useEffect(()=>{_.data&&_.data.length===1&&i(_.data[0].id)},[_.data]);const ee=_.data&&w.data,ne=_.data&&_.data.length>0?_.data[0]:null,K=async $=>{await D.mutateAsync({...$,servers:[]})},W=$=>{ne?.id&&P.mutate({playbookId:ne.id,clientId:$,baseUrl:hf})},ie=$=>{f($.name),y(!0)},he=async $=>{!c||!$.playbookId||await H({playbookId:$.playbookId,entryName:c,parameters:$.parameters??{}})},F=async $=>{r&&await U($)};return ee?m.jsxs(m.Fragment,{children:[m.jsx(qW,{currentPlaybook:ne,registryEntries:w.data?.entries??[],clientStatuses:C.data??[],isAddingPlaybookToClient:P.isPending,isCreatePlaybookLoading:D.isPending,onCreatePlaybook:K,searchQuery:t,onSearchQueryChange:n,onClickRegistryEntry:ie,onAddPlaybookToClient:W,isPromptCompleted:l,onSkipPrompt:()=>o(!0),onPromptFormSubmit:F,isPromptSubmitting:k}),c&&m.jsx(wW,{registryEntry:R.data,playbooks:_.data,onClickInstall:he,isInstalling:j,open:p,onOpenChange:y}),m.jsx(RB,{open:g,onClickLibrary:()=>e("/library"),onClickPlaybook:()=>e("/")})]}):m.jsx(OC,{})}function DC({sections:e}){return m.jsxs("div",{className:"flex h-full w-full shrink-0 flex-col gap-y-6 px-4 pt-6 *:last:pb-4",children:[m.jsx("div",{className:"px-2",children:m.jsx(Ef,{className:"size-6"})}),e.map((t,n)=>m.jsxs(QD,{className:Ae(t.className,n===e.length-1?"mt-auto":void 0),children:[t.label&&m.jsx(GD,{label:t.label}),t.isLoading?new Array(3).fill(0).map((r,i)=>m.jsx(Sp,{className:"bg-accent-subtle",children:m.jsx(Rr,{className:"opacity-50",children:m.jsx(Jr,{text:"Loading"})})},`loading-${i}`)):t.items.map(r=>m.jsxs(Sp,{"data-state":r.isActive?"active":"inactive",className:"cursor-pointer",onClick:r.onClick,children:[r.icon&&m.jsx(Ua,{children:r.icon}),m.jsx(Rr,{children:r.label})]},r.id))]},t.id))]})}const IC=h.createContext([]);function GW({className:e,children:t,sections:n=[],...r}){return m.jsx(IC.Provider,{value:n,children:m.jsxs("div",{"data-slot":"layout",className:Ae("flex h-screen w-screen flex-row overflow-hidden bg-bg text-fg",e),...r,children:[m.jsx("div",{"data-slot":"layout-sidebar",className:Ae("hidden w-full max-w-[220px] shrink-0 overflow-y-auto overflow-x-hidden md:flex"),children:m.jsx(DC,{sections:n})}),m.jsx("div",{"data-slot":"layout-content",className:"flex grow flex-col overflow-hidden p-2 md:pl-px",children:t})]})})}function Cs({className:e,children:t,...n}){return m.jsx("div",{className:Ae("@container/page overflow-hidden text-fg","flex grow flex-col rounded-md bg-surface shadow-[0_0_0_0.5px_rgba(55,50,46,0.2)]",e),...n,children:t})}function KW({className:e,children:t,...n}){const r=h.useContext(IC);return m.jsxs("div",{className:Ae("flex shrink-0 flex-row items-center gap-x-2","h-13 border-accent border-b-[0.5px] bg-surface px-4 md:px-8 lg:px-12",e),...n,children:[m.jsxs(f0,{children:[m.jsx(iX,{asChild:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"md:hidden",children:[m.jsx(s5,{weight:"fill",className:"!size-5 shrink-0"}),m.jsx("span",{className:"sr-only",children:"Open sidebar"})]})}),m.jsxs(wS,{children:[m.jsx(Af,{className:"overlay"}),m.jsxs(Tf,{className:Ae("fixed inset-y-0 left-0 z-50 h-full w-full max-w-[220px] bg-bg text-fg transition ease-in-out","shadow-[0_0_10px_3px_rgba(55,50,46,0.13),_0_0_0_0.5px_rgba(55,50,46,0.2)] outline-none","overflow-y-auto overflow-x-hidden","radix-state-[closed]:slide-out-to-left radix-state-[closed]:animate-out radix-state-[closed]:duration-200","radix-state-[open]:slide-in-from-left radix-state-[open]:animate-in radix-state-[open]:duration-300"),children:[m.jsxs(j8,{children:[m.jsx(O8,{children:"Navigation"}),m.jsx(R8,{children:"A sidebar containing global navigation for Director studio."})]}),m.jsx(DC,{sections:r})]})]})]}),t]})}function Pi({className:e,children:t,...n}){return m.jsx("div",{className:Ae("flex grow flex-col overflow-y-auto overflow-x-hidden py-8 md:py-12 lg:py-16",e),...n,children:t})}function ks({breadcrumbs:e,loading:t=!1,children:n}){return m.jsxs(KW,{children:[m.jsx(u0,{className:"grow",children:m.jsx(c0,{children:e.map((r,i)=>{const l=i===e.length-1,o=!!r.onClick;return m.jsxs(h.Fragment,{children:[i>0&&m.jsx(d0,{}),m.jsx(hl,{children:o?m.jsx(dS,{onClick:r.onClick,className:"cursor-pointer",children:l&&t?m.jsx(Jr,{text:r.title}):r.title}):m.jsx(ml,{children:l&&t?m.jsx(Jr,{text:r.title}):r.title})})]},r.title)})})}),n]})}const XW=ga({name:xn().trim().min(1,"Required"),description:xn().trim().optional().transform(e=>e===""?void 0:e)});function PC({children:e,onSubmit:t,defaultValues:n}){const r={name:n?.name??"",description:n?.description??""};return m.jsxs(M6,{schema:XW,defaultValues:r,onSubmit:t,children:[m.jsxs("div",{className:"flex w-full flex-col gap-y-6",children:[m.jsx(Ii,{label:"Name",name:"name",placeholder:"My playbook"}),m.jsx(z6,{label:"Description",name:"description",helperLabel:"Optional",placeholder:"A description of the playbook"})]}),e]})}function WW({isSubmitting:e=!1,children:t,className:n="self-start"}){return m.jsx(bt,{size:"lg",className:n,type:"submit",disabled:e,children:e?m.jsx(V6,{className:"text-fg-subtle"}):t})}function JW({onSubmit:e,isSubmitting:t}){return m.jsx(xa,{size:"sm",children:m.jsxs(Nt,{className:"gap-y-8",children:[m.jsxs(Ot,{children:[m.jsx(Rt,{children:"New playbook"}),m.jsx(ti,{children:"Create a new playbook."})]}),m.jsx(al,{}),m.jsx(PC,{onSubmit:async n=>{await e(n)},children:m.jsx(WW,{isSubmitting:t,children:"Create playbook"})})]})})}function eJ(e){const t=gt.useUtils(),n=gt.store.create.useMutation({async onSuccess(r,i,l,o){await t.store.getAll.refetch(),e&&e.onSuccess&&await e.onSuccess(r,i,l,o)},onError(r,i,l,o){e&&e.onError&&e.onError(r,i,l,o)}});return{createPlaybook:n.mutateAsync,isPending:n.isPending}}function tJ(){const e=Ir(),{createPlaybook:t,isPending:n}=eJ({onSuccess:i=>{Pt({title:"Playbook created",description:"This playbook was successfully created."}),e(`/${i.id}`)}}),r=async i=>{await t({...i,servers:[]})};return m.jsxs(m.Fragment,{children:[m.jsx(ks,{breadcrumbs:[{title:"New Playbooks"}]}),m.jsx(Pi,{children:m.jsx(JW,{onSubmit:r,isSubmitting:n})})]})}function nJ(){const[e,t]=h.useState(null),n=h.useCallback(async r=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(r),t(r),!0}catch(i){return console.warn("Copy failed",i),t(null),!1}},[]);return[e,n]}function jC({id:e,gatewayBaseUrl:t,onCopy:n}){const[r,i]=h.useState("http"),l={http:`${t}/${e}/mcp`,sse:`${t}/${e}/sse`,stdio:`director http2stdio ${t}/${e}/sse`};return m.jsxs("div",{className:"relative flex pt-1",children:[m.jsx("div",{className:"w-fit",children:m.jsxs(pC,{value:r,onChange:o=>i(o.target.value),className:"h-8 rounded-r-none border-[0.5px] border-fg/20 bg-accent-subtle font-medium text-[13px] text-muted-foreground shadow-none ring-0 hover:text-foreground focus-visible:border-fg/30 focus-visible:ring-0",children:[m.jsx("option",{value:"http",children:"HTTP"}),m.jsx("option",{value:"sse",children:"SSE"}),m.jsx("option",{value:"stdio",children:"STDIO"})]})}),m.jsx(m0,{autoFocus:!0,className:"-mx-px h-8 rounded-none border-[0.5px] border-fg/30 pr-0 font-medium font-mono text-[13px] shadow-none focus-visible:border-fg/30 focus-visible:ring-0",readOnly:!0,value:l[r]}),m.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-r-md border-[0.5px] border-fg/20 bg-accent-subtle",children:m.jsx(bt,{size:"icon",variant:"ghost",onClick:()=>n(l[r]),children:m.jsx(Xx,{})})})]})}function rJ({playbookId:e,gatewayBaseUrl:t,children:n,onCopy:r,...i}){return m.jsxs(gC,{...i,children:[n&&m.jsx(AW,{asChild:!0,children:n}),m.jsxs(yC,{children:[m.jsxs(SW,{children:[m.jsx(bC,{children:"Connect manually"}),m.jsx(vC,{children:"Director works with any MCP enabled product. Below you'll find endpoints for both Streamable HTTP and SSE, as well as STDIO via our CLI."})]}),m.jsx("div",{className:"border-t-[0.5px] p-5",children:m.jsx(jC,{id:e,gatewayBaseUrl:t,onCopy:r})})]})]})}function aJ({playbook:e,gatewayBaseUrl:t,clients:n,onChangeInstall:r,isLoading:i}){const[l,o]=nJ(),c=async f=>{await o(f),Pt({title:"Copied to clipboard",description:"The endpoint has been copied to your clipboard."})};return m.jsxs(Nt,{children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between",children:[m.jsx(Rt,{variant:"h3",asChild:!0,children:m.jsx("h3",{children:"Client connections"})}),m.jsx(rJ,{playbookId:e.id,gatewayBaseUrl:t,onCopy:c})]}),m.jsxs("div",{className:"overflow-hidden rounded-xl bg-accent-subtle p-4 shadow-[0_0_0_0.5px_rgba(55,50,46,0.15)]",children:[m.jsx(Vx,{children:"Connect Automatically"}),n.map(f=>m.jsx(iJ,{client:f,onChangeInstall:r,isLoading:i},f.id)),m.jsx(Vx,{children:"Connect Manually"}),m.jsx(jC,{id:e.id,gatewayBaseUrl:t,onCopy:c})]})]})}function Vx({children:e}){return m.jsx("label",{className:"font-medium font-mono text-[11px] uppercase leading-none tracking-widest peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})}function iJ({client:e,onChangeInstall:t,isLoading:n}){return m.jsxs("label",{htmlFor:e.id,className:Ae("flex cursor-pointer flex-row items-center justify-between rounded-lg bg-accent-subtle pt-2 pb-2 transition-colors duration-200 ease-in-out hover:bg-accent",!e.installed&&"opacity-50 hover:cursor-not-allowed hover:bg-accent-subtle"),children:[m.jsxs("div",{className:"flex grow flex-row items-center gap-x-1.5",children:[m.jsx("img",{src:e.image,alt:`${e.label} icon`,height:26,width:26}),m.jsx("span",{className:"font-medium text-[15px]",children:e.label})]}),m.jsx(o6,{id:e.id,checked:!!e.present,onCheckedChange:r=>{t(e.id,r)},disabled:n||!e.installed})]})}function sJ({onSettingsClick:e,onDeleteClick:t}){return m.jsxs(s8,{children:[m.jsx(l8,{asChild:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"radix-state-[open]:bg-accent-subtle",children:[m.jsx(Fc,{weight:"fill",className:"!size-4"}),m.jsx("span",{className:"sr-only",children:"Settings"})]})}),m.jsx(o8,{align:"end",children:m.jsxs(h1,{children:[m.jsxs(Ba,{onSelect:e,children:[m.jsx(Ua,{children:m.jsx(e5,{})}),m.jsx(Rr,{children:"Settings"})]}),m.jsxs(Ba,{onSelect:t,children:[m.jsx(Ua,{children:m.jsx(Bc,{})}),m.jsx(Rr,{children:"Delete"})]})]})})]})}function lJ({playbook:e,onSubmit:t,open:n,onOpenChange:r}){return m.jsx(f0,{open:n,onOpenChange:r,children:m.jsxs(Vf,{children:[m.jsx(Zf,{}),m.jsxs(zf,{children:[m.jsxs(qf,{children:[m.jsx(Yf,{children:"Settings"}),m.jsx($f,{children:"Update the name and description of the playbook."})]}),m.jsx(v_,{}),m.jsx(PC,{defaultValues:{name:e.name,description:e.description??void 0},onSubmit:t,children:m.jsx(bt,{children:"Save changes"})})]})]})})}function HC({children:e}){return m.jsxs(Cs,{className:"pointer-events-none relative select-none",children:[e,m.jsx(ks,{breadcrumbs:[{title:"Loading playbook…"}],loading:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"radix-state-[open]:bg-accent-subtle",disabled:!0,children:[m.jsx(Fc,{weight:"fill",className:"!size-4"}),m.jsx("span",{className:"sr-only",children:"Settings"})]})}),m.jsx(Pi,{"aria-hidden":!0,children:m.jsxs(xa,{size:"lg",children:[m.jsx(Nt,{children:m.jsxs(Ot,{className:"opacity-50",children:[m.jsx(Rt,{children:m.jsx(Jr,{text:"Loading playbook name"})}),m.jsx(ti,{children:m.jsx(Jr,{text:"Loading playbook description"})})]})}),m.jsx(Nt,{children:m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"Usage"})})})}),m.jsxs(Nt,{children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between opacity-50",children:[m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"MCP Servers"})}),m.jsx(bt,{disabled:!0,children:"Add"})]}),m.jsx(sl,{})]}),m.jsxs(Nt,{children:[m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"Tools"})})}),m.jsx(sl,{})]})]})})]})}function V1({children:e,title:t,description:n,open:r,onOpenChange:i,onConfirm:l}){const o=k6({schema:ga({}),defaultValues:{}});return h.useEffect(()=>{!r&&o.formState.isSubmitSuccessful&&o.reset()},[r,o.formState.isSubmitSuccessful,o.reset]),m.jsxs($_,{open:r,onOpenChange:i,children:[e&&m.jsx(AB,{asChild:!0,children:e}),m.jsxs(Q_,{children:[m.jsxs(G_,{children:[m.jsx(K_,{children:t}),m.jsx(X_,{children:n})]}),m.jsxs(SB,{children:[m.jsx(CB,{children:"Cancel"}),m.jsx(fC,{form:o,onSubmit:l,className:"sm:w-fit",children:m.jsx(bt,{type:"submit",disabled:o.formState.isSubmitting,children:o.formState.isSubmitting?m.jsx(V6,{className:"text-fg-subtle"}):"Confirm"})})]})]})]})}function oJ({open:e,onOpenChange:t,prompt:n,onSubmit:r,isSubmitting:i=!1,onClickDelete:l}){const[o,c]=h.useState(!1),f=y=>{t(y)},p=()=>{c(!0)};return m.jsxs(m.Fragment,{children:[m.jsx(f0,{open:e,onOpenChange:f,children:m.jsxs(Vf,{children:[m.jsx(Zf,{children:m.jsx(u0,{className:"grow",children:m.jsxs(c0,{children:[m.jsx(hl,{children:m.jsx(ml,{children:"Prompts"})}),m.jsx(d0,{}),m.jsx(hl,{children:m.jsxs(ml,{children:[n?"Edit":"Add"," prompt"]})})]})})}),m.jsxs(zf,{children:[m.jsxs(qf,{children:[m.jsx(Yf,{children:n?"Edit prompt":"Add a prompt"}),m.jsx($f,{className:"text-sm",children:n?"Update this reusable instruction block.":"Create a reusable instruction block for your playbook."})]}),m.jsx(al,{}),m.jsx(NC,{prompt:n,onSubmit:r,isSubmitting:i,onDelete:l?p:void 0})]})]})}),l&&m.jsx(V1,{title:"Delete prompt?",description:"Are you sure you want to delete this prompt?",open:o,onOpenChange:c,onConfirm:()=>{c(!1),l()}})]})}function uJ({prompts:e,onCreatePrompt:t,onEditPrompt:n,onDeletePrompt:r,isSavingPrompt:i=!1,...l}){const o=e??[],[c,f]=h.useState(!1),[p,y]=h.useState(null);return m.jsxs(m.Fragment,{children:[m.jsxs(Nt,{...l,children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between",children:[m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"Prompts"})}),m.jsx(bt,{size:"sm",onClick:()=>{y(null),f(!0)},children:"Add prompt"})]}),o.length===0?m.jsxs(Ta,{children:[m.jsx(ni,{children:"No prompts"}),m.jsx(Ns,{children:"Create your first prompt to reuse instructions across tools."})]}):m.jsx(Ka,{children:o.map(g=>m.jsx(cJ,{prompt:g,onClick:()=>{y(g),f(!0)}},`prompt-${g.name}`))})]}),m.jsx(oJ,{open:c,onOpenChange:f,prompt:p,isSubmitting:i,onClickDelete:p?async()=>{await r?.(p.name),f(!1)}:void 0,onSubmit:async g=>{if(p&&n){await n(p.name,g),f(!1);return}t&&(await t(g),f(!1))}})]})}function cJ({prompt:e,onClick:t}){return m.jsx(wn,{onClick:t,children:m.jsxs(dn,{children:[m.jsx(an,{children:e.title??e.name}),m.jsx(qa,{children:e.description||e.body})]})})}function wg({server:e,onClickAuthorize:t}){switch(e.connectionInfo?.status){case"connected":return m.jsxs(Ut,{variant:"success",children:[m.jsx(na,{children:m.jsx(Rg,{})}),m.jsx($t,{uppercase:!0,children:e.connectionInfo?.status||"--"})]});case"unauthorized":return m.jsxs(Ut,{variant:"destructive",className:t?"cursor-pointer outline-none transition-colors hover:bg-destructive/50 focus-visible:bg-destructive/90":void 0,onClick:n=>{n.stopPropagation(),t?.(e)},title:"Click to authorize",children:[m.jsx(na,{children:m.jsx(d5,{})}),m.jsx($t,{uppercase:!0,children:e.connectionInfo?.status||"--"})]});default:return m.jsx(Ut,{children:m.jsx($t,{uppercase:!0,children:e.connectionInfo?.status||"--"})})}}function dJ({servers:e,onClickServer:t,onClickAddServer:n,onClickAuthorize:r}){return m.jsxs(Nt,{children:[m.jsxs(Ot,{className:"flex flex-row items-center justify-between",children:[m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h2",{children:"Servers"})}),n&&m.jsx(bt,{size:"sm",onClick:n,children:"Add MCP server"})]}),e.length===0?m.jsxs(Ta,{children:[m.jsx(ni,{children:"No items"}),m.jsx(Ns,{children:"This list is empty."})]}):m.jsx(Ka,{children:e.map(i=>m.jsx(fJ,{server:i,onClick:t&&(()=>t(i)),onClickAuthorize:r},`li-${i.name}`))})]})}function fJ({server:e,onClick:t,onClickAuthorize:n}){return m.jsxs(wn,{onClick:t,children:[m.jsxs(dn,{children:[m.jsx(an,{children:e.name}),m.jsx(hJ,{server:e})]}),m.jsx(Wn,{children:m.jsx(wg,{server:e,onClickAuthorize:n})})]})}function hJ({server:e}){return e.type==="http"?m.jsx(qa,{children:e.url}):e.type==="stdio"?m.jsxs(qa,{children:[e.command," ",e.args.join(" ")]}):m.jsx(qa,{children:"--"})}function FC(){const[e,t]=h.useState(!1),[n,r]=h.useState(null),i=gt.useUtils();return{authenticate:async({playbookId:o,serverName:c})=>{t(!0),r(null);try{const f=await i.store.authenticate.fetch({playbookId:o,serverName:c});return f.result==="REDIRECT"&&f.redirectUrl?(window.location.assign(f.redirectUrl),!1):!0}catch(f){const p=f instanceof Error?f:new Error("Authentication failed");throw r(p),p}finally{t(!1)}},isLoading:e,error:n}}function mJ(e,t){const n=gt.useUtils(),r=gt.clients.install.useMutation({onSuccess:async(o,c)=>{await n.clients.allClients.invalidate(),t?.onSuccess&&c?.clientId&&await t.onSuccess(c.clientId,!0)},onError:async(o,c)=>{t?.onError&&c?.clientId&&await t.onError(c.clientId,!0)}}),i=gt.clients.uninstall.useMutation({onSuccess:async(o,c)=>{await n.clients.allClients.invalidate(),t?.onSuccess&&c?.clientId&&await t.onSuccess(c.clientId,!1)},onError:async(o,c)=>{t?.onError&&c?.clientId&&await t.onError(c.clientId,!1)}});return{changeInstallState:async(o,c)=>{c?await r.mutateAsync({playbookId:e,clientId:o,baseUrl:hf}):await i.mutateAsync({playbookId:e,clientId:o})},isPending:r.isPending||i.isPending}}function pJ(e,t){const n=gt.useUtils(),r=gt.store.removePrompt.useMutation({async onSuccess(l,o,c,f){await Promise.all([n.store.get.invalidate({playbookId:e}),n.store.getAll.invalidate(),n.store.listPrompts?.invalidate?.({playbookId:e})]),t?.onSuccess&&await t.onSuccess(l,o,c,f)},onError(l,o,c,f){t?.onError?.(l,o,c,f)}});return{deletePrompt:async l=>{await r.mutateAsync({playbookId:e,promptName:l})},isPending:r.isPending}}function gJ(e,t){const n=gt.useUtils(),r=gt.store.updatePrompt.useMutation({async onSuccess(l,o,c,f){await Promise.all([n.store.get.invalidate({playbookId:e}),n.store.getAll.invalidate(),n.store.listPrompts?.invalidate?.({playbookId:e})]),t?.onSuccess&&await t.onSuccess(l,o,c,f)},onError(l,o,c,f){t?.onError?.(l,o,c,f)}});return{editPrompt:async(l,o)=>{await r.mutateAsync({playbookId:e,promptName:l,prompt:{title:o.title,description:o.description,body:o.body}})},isPending:r.isPending}}function BC(e,t){const{data:n,isLoading:r,error:i}=gt.tools.list.useQuery({playbookId:e,serverName:t},{throwOnError:!1,retry:!1});return{tools:n,isToolsLoading:r,toolsError:i}}function UC(e){const{data:t,isLoading:n,error:r}=gt.store.get.useQuery({playbookId:e},{throwOnError:!1,retry:!1});return{playbook:t,isPlaybookLoading:n,playbookError:r}}function yJ(e,t){const n=gt.useUtils(),r=gt.tools.updateBatch.useMutation({onSuccess:async()=>{await n.tools.list.invalidate({playbookId:e}),t?.onSuccess&&await t.onSuccess()},onError:async l=>{t?.onError&&await t.onError(new Error(l.message))}});return{updateTools:async l=>{await r.mutateAsync({playbookId:e,tools:l})},isPending:r.isPending}}const bJ=()=>{const{playbookId:e}=df(),t=Ir(),n=gt.useUtils();if(!e)throw new Error("Playbook ID is required");const{playbook:r,isPlaybookLoading:i,playbookError:l}=UC(e),{tools:o,isToolsLoading:c}=BC(e),{data:f,isLoading:p}=RC(e),{updateTools:y,isPending:g}=yJ(e,{onSuccess:()=>{Pt({title:"Tools updated",description:"Your tools have been successfully updated."})},onError:U=>{Pt({title:"Error",description:U.message||"Failed to update tools"})}}),{changeInstallState:x,isPending:A}=mJ(e,{onSuccess:(U,k)=>{Pt({title:k?"Playbook installed":"Playbook uninstalled",description:k?"This playbook was successfully installed":"This playbook was successfully uninstalled"})},onError:(U,k)=>{Pt({title:"Error",description:k?"Failed to install this playbook":"Failed to uninstall this playbook"})}}),{createPrompt:S,isPending:_}=kC(e,{onSuccess:async()=>{await n.store.get.invalidate({playbookId:e}),Pt({title:"Prompt saved",description:"Your prompt was saved."})}}),{editPrompt:w,isPending:C}=gJ(e,{onSuccess:async()=>{await n.store.get.invalidate({playbookId:e}),Pt({title:"Prompt updated",description:"Your prompt was updated."})}}),{deletePrompt:R,isPending:D}=pJ(e,{onSuccess:async()=>{await n.store.get.invalidate({playbookId:e}),Pt({title:"Prompt deleted",description:"Your prompt was deleted."})}}),{authenticate:P}=FC();return i?m.jsx(HC,{}):l||!r?m.jsx(t0,{icon:"dead-smiley",fullScreen:!0,title:"Unexpected Error",subtitle:l?.message}):m.jsxs(m.Fragment,{children:[m.jsx(ks,{breadcrumbs:[{title:e}],children:m.jsx(vJ,{playbook:r})}),m.jsx(Pi,{children:m.jsx(xa,{size:"xl",children:m.jsxs(H6,{children:[m.jsx(F6,{children:m.jsxs(Nt,{className:"gap-y-8",children:[m.jsxs(Ot,{children:[m.jsx(Rt,{children:r.name}),m.jsx(ti,{children:r.description})]}),m.jsxs(x6,{default:"servers",children:[m.jsx(Ya,{id:"servers",label:"Servers",icon:m.jsx(Wx,{}),content:m.jsx(dJ,{servers:r.servers,onClickServer:U=>t(`/${e}/${U.name}`),onClickAddServer:()=>t("/library"),onClickAuthorize:async U=>{try{await P({playbookId:e,serverName:U.name})}catch(k){Pt({title:"Authentication failed",description:k instanceof Error?k.message:"Unknown error"})}}})}),m.jsx(Ya,{id:"tools",label:"Tools",icon:m.jsx(Q1,{}),content:m.jsx(v6,{tools:o,toolsLoading:c,editable:!0,isSaving:g,onUpdateTools:y})}),m.jsx(Ya,{id:"prompts",label:"Prompts",icon:m.jsx(a5,{}),content:m.jsx(uJ,{prompts:r.prompts??[],onCreatePrompt:S,onEditPrompt:w,onDeletePrompt:R,isSavingPrompt:_||C||D})})]})]})}),m.jsx(B6,{children:m.jsx(aJ,{playbook:r,gatewayBaseUrl:hf,clients:f??[],onChangeInstall:x,isLoading:A||p})})]})})})]})};function vJ({playbook:e}){const t=Ir(),[n,r]=h.useState(!1),[i,l]=h.useState(!1),o=gt.useUtils(),c=gt.store.update.useMutation({onSuccess:async()=>{await o.store.getAll.invalidate(),await o.store.get.invalidate({playbookId:e.id}),Pt({title:"Playbook updated",description:"This playbook was successfully updated."}),r(!1)}}),f=gt.store.delete.useMutation({onSuccess:async()=>{await o.store.getAll.invalidate(),Pt({title:"Playbook deleted",description:"This playbook was successfully deleted."}),l(!1),t("/")}}),p=async g=>{await c.mutateAsync({playbookId:e.id,attributes:g})},y=async()=>{await f.mutateAsync({playbookId:e.id})};return m.jsxs(m.Fragment,{children:[m.jsx(sJ,{onSettingsClick:()=>r(!0),onDeleteClick:()=>l(!0)}),m.jsx(lJ,{playbook:e,onSubmit:p,open:n,onOpenChange:r}),m.jsx(V1,{title:"Delete playbook?",description:"Are you sure you want to delete this playbook? This action cannot be undone.",open:i,onOpenChange:l,onConfirm:y})]})}function EJ({target:e,...t}){return m.jsx(Ka,{...t,children:m.jsx(xJ,{target:e})})}function xJ({target:e}){return e.type==="stdio"?m.jsxs(m.Fragment,{children:[m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Type"})}),m.jsxs(Ut,{className:"ml-auto",children:[m.jsx(na,{children:m.jsx(Pg,{})}),m.jsx($t,{children:"STDIO"})]})]}),m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Command"})}),m.jsx(Ut,{className:"ml-auto",children:m.jsx($t,{children:e.command})})]}),e.args.length>0&&m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Arguments"})}),m.jsx(Wn,{className:"ml-auto justify-end",children:e.args.map(t=>m.jsx(Ut,{children:m.jsx($t,{children:t})},t))})]}),e.env&&Object.keys(e.env).length>0&&m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Environment"})}),m.jsx(Wn,{className:"ml-auto justify-end",children:Object.entries(e.env).map(([t,n])=>m.jsx(Ut,{children:m.jsx($t,{children:`${t}=${n}`})},t))})]}),m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Status"})}),m.jsx(Wn,{className:"ml-auto justify-end",children:m.jsx(wg,{server:e})})]})]}):e.type==="http"?m.jsxs(m.Fragment,{children:[m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Type"})}),m.jsxs(Ut,{className:"ml-auto",children:[m.jsx(na,{children:m.jsx(Lg,{})}),m.jsx($t,{children:e.type})]})]}),m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"URL"})}),m.jsx(qa,{className:"ml-auto",children:e.url})]}),m.jsxs(wn,{children:[m.jsx(dn,{children:m.jsx(an,{children:"Status"})}),m.jsx(Wn,{className:"ml-auto justify-end",children:m.jsx(wg,{server:e})})]})]}):void 0}function AJ(e,t){const{playbook:n,isPlaybookLoading:r,playbookError:i}=UC(e),l=n?.servers.find(o=>o.name===t);if(r)return{playbook:null,playbookTarget:null,isPlaybookTargetLoading:!0,playbookTargetError:null};{const o=l?null:`Playbook target '${t}' not found`;return{playbook:n,playbookTarget:l,isPlaybookTargetLoading:r,playbookTargetError:i||o}}}function VC(e){return e0.entries.getEntryByName.useQuery({name:e.entryName??""},{enabled:!!e.entryName})}function TJ(){const[e,t]=h.useState(!1),[n,r]=h.useState(null),i=gt.useUtils(),l=gt.store.logout.useMutation();return{logout:async({playbookId:c,serverName:f})=>{t(!0),r(null);try{await l.mutateAsync({playbookId:c,serverName:f}),await i.store.get.invalidate({playbookId:c}),await i.store.getAll.invalidate()}catch(p){const y=p instanceof Error?p:new Error("Logout failed");throw r(y),y}finally{t(!1)}},isLoading:e,error:n}}function _J({playbookTarget:e,playbook:t}){const n=Ir(),[r,i]=h.useState(!1),[l,o]=h.useState(!1),c=gt.useUtils(),f=gt.store.removeServer.useMutation({onSuccess:async()=>{n(`/${t.id}`),await c.store.get.invalidate({playbookId:t.id}),await c.store.getAll.invalidate(),Pt({title:"Server deleted",description:"This server was successfully deleted."})}}),p=async()=>{await f.mutateAsync({playbookId:t.id,serverName:e.name})},{logout:y}=TJ(),{authenticate:g}=FC(),x=async()=>{await y({playbookId:t.id,serverName:e.name}),o(!1),Pt({title:"Logged out",description:"This server was successfully logged out."})};return m.jsxs(m.Fragment,{children:[m.jsxs(s8,{children:[m.jsx(l8,{asChild:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"radix-state-[open]:bg-accent-subtle",children:[m.jsx(Fc,{weight:"fill",className:"!size-4"}),m.jsx("span",{className:"sr-only",children:"Settings"})]})}),m.jsx(o8,{align:"end",children:m.jsxs(h1,{children:[e.type==="http"&&e.connectionInfo?.isAuthenticated&&m.jsxs(Ba,{children:[m.jsx(Ua,{children:m.jsx(l5,{})}),m.jsx(Rr,{onClick:()=>o(!0),children:"Logout"})]}),e.type==="http"&&!e.connectionInfo?.isAuthenticated&&m.jsx(Ba,{children:m.jsx(Rr,{onClick:async()=>{await g({playbookId:t.id,serverName:e.name})},children:"Authenticate"})}),m.jsxs(Ba,{onSelect:A=>A.preventDefault(),children:[m.jsx(Ua,{children:m.jsx(Bc,{})}),m.jsx(Rr,{onClick:()=>i(!0),children:"Delete"})]})]})})]}),m.jsx(V1,{title:"Delete this server",description:"Are you sure you want to delete this server? This action cannot be undone.",open:r,onOpenChange:i,onConfirm:p}),m.jsx(V1,{title:"Logout this server",description:"Are you sure you want to logout this server? This action cannot be undone.",open:l,onOpenChange:o,onConfirm:x})]})}function SJ(){const{playbookId:e,targetId:t}=df(),n=Ir();if(!e||!t)throw new Error("Playbook ID and target ID are required");const{playbook:r,playbookTarget:i,isPlaybookTargetLoading:l,playbookTargetError:o}=AJ(e,t),{tools:c,isToolsLoading:f}=BC(e,t),y=VC({entryName:t}).data;return l?m.jsx(HC,{}):o||!i||!r?m.jsx(t0,{icon:"dead-smiley",fullScreen:!0,title:"Unexpected Error",subtitle:o?.toString()||"Unknown error"}):m.jsxs(Cs,{children:[m.jsx(ks,{breadcrumbs:[{title:r?.name||"",onClick:()=>n(`/${e}`)},{title:i?.name}],children:m.jsx(_J,{playbookTarget:i,playbook:r})}),m.jsx(Pi,{children:m.jsxs(xa,{size:"lg",children:[m.jsxs(Nt,{className:"gap-y-8",children:[m.jsx(Sf,{src:y?.icon,className:"size-9"}),m.jsxs(Ot,{children:[m.jsx(Rt,{children:i.name}),m.jsxs(ti,{children:["Installed on"," ",m.jsx("button",{onClick:()=>n(`/${e}`),className:"cursor-pointer text-fg underline",children:r?.name})]})]}),y?.description?m.jsx(Vo,{children:y?.description}):null]}),m.jsxs(x6,{default:"tools",children:[m.jsx(Ya,{id:"readme",label:"Readme",icon:m.jsx(q1,{}),content:m.jsx(iS,{readme:y?.readme??null})}),m.jsx(Ya,{id:"tools",label:"Tools",icon:m.jsx(Q1,{}),content:m.jsx(v6,{tools:c,toolsLoading:f})}),m.jsx(Ya,{id:"properties",label:"Properties",icon:m.jsx($1,{}),content:m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Transport Configuration"})})}),m.jsx(EJ,{target:i})]})})]})]})})]})}function CJ({entry:e,playbooks:t,onClickInstall:n,onClickCancel:r,isInstalling:i=!1}){const l=(t??[]).filter(o=>o.servers.some(c=>c.name===e.name)).map(o=>o.id);return m.jsxs(m.Fragment,{children:[l.length>0&&m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h3",asChild:!0,children:m.jsx("h3",{children:"Installed on"})})}),m.jsx(Wn,{children:l.map(o=>m.jsx(Ut,{className:"cursor-pointer",children:m.jsx($t,{children:o})},o))})]}),m.jsxs(Nt,{children:[m.jsx(Ot,{children:m.jsx(Rt,{variant:"h3",asChild:!0,children:m.jsx("h3",{children:"Add to playbook"})})}),m.jsx(B1,{registryEntry:e,playbooks:t,onSubmit:n,isSubmitting:i,onClickCancel:r})]})]})}function wJ({children:e}){return m.jsxs(Cs,{className:"pointer-events-none relative select-none",children:[e,m.jsx(ks,{breadcrumbs:[{title:"Library"},{title:"Loading"}],loading:!0,children:m.jsx(bt,{disabled:!0,className:"ml-auto",children:"Add to playbook"})}),m.jsx(Pi,{"aria-hidden":!0,children:m.jsxs(xa,{size:"lg",children:[m.jsxs(Nt,{className:"gap-y-6",children:[m.jsxs(Ot,{className:"opacity-50",children:[m.jsx(Rt,{children:m.jsx(Jr,{text:"Title"})}),m.jsx(ti,{children:m.jsx(Jr,{text:"Description"})})]}),m.jsxs(Wn,{children:[m.jsxs(Ut,{className:"opacity-50",children:[m.jsx(na,{children:m.jsx(u5,{weight:"bold"})}),m.jsx($t,{uppercase:!0,children:m.jsx(Jr,{text:"Badge"})})]}),m.jsxs(Ut,{className:"ml-auto opacity-50",children:[m.jsx(na,{children:m.jsx(t5,{weight:"bold"})}),m.jsx($t,{uppercase:!0,children:"Homepage"})]})]})]}),m.jsx(al,{}),m.jsxs(Nt,{children:[m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Transport"})})}),m.jsx(sl,{})]}),m.jsx(al,{}),m.jsxs(Nt,{children:[m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Parameters"})})}),m.jsx(sl,{})]}),m.jsx(al,{}),m.jsxs(Nt,{children:[m.jsx(Ot,{className:"opacity-50",children:m.jsx(Rt,{variant:"h2",asChild:!0,children:m.jsx("h3",{children:"Tools"})})}),m.jsx(sl,{})]})]})})]})}var eh="Popover",[zC]=gr(eh,[nf]),p0=nf(),[NJ,Ms]=zC(eh),ZC=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:l,modal:o=!1}=e,c=p0(t),f=h.useRef(null),[p,y]=h.useState(!1),[g,x]=ra({prop:r,defaultProp:i??!1,onChange:l,caller:eh});return m.jsx(tA,{...c,children:m.jsx(NJ,{scope:t,contentId:za(),triggerRef:f,open:g,onOpenChange:x,onOpenToggle:h.useCallback(()=>x(A=>!A),[x]),hasCustomAnchor:p,onCustomAnchorAdd:h.useCallback(()=>y(!0),[]),onCustomAnchorRemove:h.useCallback(()=>y(!1),[]),modal:o,children:n})})};ZC.displayName=eh;var qC="PopoverAnchor",OJ=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ms(qC,n),l=p0(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:c}=i;return h.useEffect(()=>(o(),()=>c()),[o,c]),m.jsx(Gg,{...l,...r,ref:t})});OJ.displayName=qC;var YC="PopoverTrigger",$C=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ms(YC,n),l=p0(n),o=Qt(t,i.triggerRef),c=m.jsx(tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":WC(i.open),...r,ref:o,onClick:qe(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:m.jsx(Gg,{asChild:!0,...l,children:c})});$C.displayName=YC;var Z6="PopoverPortal",[RJ,kJ]=zC(Z6,{forceMount:void 0}),QC=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,l=Ms(Z6,t);return m.jsx(RJ,{scope:t,forceMount:n,children:m.jsx(aa,{present:n||l.open,children:m.jsx(rf,{asChild:!0,container:i,children:r})})})};QC.displayName=Z6;var Zo="PopoverContent",GC=h.forwardRef((e,t)=>{const n=kJ(Zo,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,l=Ms(Zo,e.__scopePopover);return m.jsx(aa,{present:r||l.open,children:l.modal?m.jsx(LJ,{...i,ref:t}):m.jsx(DJ,{...i,ref:t})})});GC.displayName=Zo;var MJ=ll("PopoverContent.RemoveScroll"),LJ=h.forwardRef((e,t)=>{const n=Ms(Zo,e.__scopePopover),r=h.useRef(null),i=Qt(t,r),l=h.useRef(!1);return h.useEffect(()=>{const o=r.current;if(o)return Wg(o)},[]),m.jsx(sf,{as:MJ,allowPinchZoom:!0,children:m.jsx(KC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qe(e.onCloseAutoFocus,o=>{o.preventDefault(),l.current||n.triggerRef.current?.focus()}),onPointerDownOutside:qe(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0,p=c.button===2||f;l.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:qe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),DJ=h.forwardRef((e,t)=>{const n=Ms(Zo,e.__scopePopover),r=h.useRef(!1),i=h.useRef(!1);return m.jsx(KC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(r.current||n.triggerRef.current?.focus(),l.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=l.target;n.triggerRef.current?.contains(o)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),KC=h.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:l,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:y,...g}=e,x=Ms(Zo,n),A=p0(n);return Bg(),m.jsx(X1,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:l,children:m.jsx(K1,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:y,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:p,onDismiss:()=>x.onOpenChange(!1),children:m.jsx(nA,{"data-state":WC(x.open),role:"dialog",id:x.contentId,...A,...g,ref:t,style:{...g.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),XC="PopoverClose",IJ=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ms(XC,n);return m.jsx(tt.button,{type:"button",...r,ref:t,onClick:qe(e.onClick,()=>i.onOpenChange(!1))})});IJ.displayName=XC;var PJ="PopoverArrow",jJ=h.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=p0(n);return m.jsx(rA,{...i,...r,ref:t})});jJ.displayName=PJ;function WC(e){return e?"open":"closed"}var HJ=ZC,FJ=$C,BJ=QC,UJ=GC;const VJ=HJ,zJ=FJ;function ZJ({className:e,align:t="center",sideOffset:n=2,...r}){return m.jsx(BJ,{children:m.jsx(UJ,{align:t,sideOffset:n,className:Ae("popover p-2","origin-[--radix-popover-content-transform-origin]","radix-state-[closed]:fade-out-0 radix-state-[open]:fade-in-0 radix-state-[closed]:zoom-out-95 radix-state-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 radix-state-[closed]:animate-out radix-state-[open]:animate-in",e),...r})})}function qJ(){const e=Ir(),{entryName:t}=df(),[n,r]=h.useState(!1),i=VC({entryName:t}),l=n0(),{install:o,isPending:c}=MC({onError:x=>{Pt({title:"Error",description:x.message})},onSuccess:(x,A)=>{Pt({title:"Playbook installed",description:"This playbook was successfully installed."}),e(`/${A.playbookId}`)}}),f=i.isLoading||l.isLoading,p=i.data,y=async x=>{p&&x.playbookId&&t&&await o({playbookId:x.playbookId,entryName:t,parameters:x.parameters??{}})};if(h.useEffect(()=>{!f&&!p&&(Pt({title:"Library entry not found",description:"The library entry you are looking for does not exist."}),e("/library"))},[p,f,e]),f||!p)return m.jsx(wJ,{});const g=l.data??[];return m.jsxs(Cs,{children:[m.jsx(ks,{breadcrumbs:[{title:"Library",onClick:()=>e("/library")},{title:p.title}],children:m.jsxs(VJ,{open:n,onOpenChange:r,children:[m.jsx(zJ,{asChild:!0,children:m.jsx(bt,{className:"ml-auto lg:hidden",children:"Add to playbook"})}),m.jsx(ZJ,{side:"bottom",align:"end",sideOffset:8,className:"w-sm max-w-[80dvw] rounded-[20px] lg:hidden",children:m.jsx(B1,{registryEntry:p,playbooks:g,onSubmit:y,isSubmitting:c})})]})}),m.jsx(Pi,{children:m.jsx(xa,{size:"xl",children:m.jsxs(H6,{children:[m.jsx(F6,{children:m.jsx(HS,{entry:p})}),m.jsx(B6,{children:m.jsx(CJ,{entry:p,playbooks:g,onClickInstall:y,isInstalling:c})})]})})})]})}const z1=xn().trim().min(1,"Required");xn().trim().optional();const JC=xn().trim().min(1,"Required").regex(/^[a-z0-9._-]+$/,"Only lowercase ASCII letters, digits, and characters ., -, _ are allowed");function YJ({open:e,onOpenChange:t,playbooks:n,onSubmit:r,isSubmitting:i=!1,...l}){const o={playbookId:n?.[0]?.id??void 0,server:{name:"",type:"stdio",command:"",args:[],env:{}}};return m.jsx(f0,{open:e,onOpenChange:t,...l,children:m.jsxs(Vf,{children:[m.jsx(Zf,{children:m.jsx(u0,{className:"grow",children:m.jsxs(c0,{children:[m.jsx(hl,{children:m.jsx(ml,{children:"Library"})}),m.jsx(d0,{}),m.jsx(hl,{children:m.jsx(ml,{children:"Add MCP server"})})]})})}),m.jsxs(zf,{children:[m.jsxs(qf,{children:[m.jsx(Yf,{children:"Add an MCP server"}),m.jsx($f,{className:"text-sm",children:"Manually add an MCP server to one of your playbooks."})]}),m.jsx(al,{}),m.jsx($J,{defaultValues:o,playbooks:n,onSubmit:r,isSubmitting:i})]})]})})}function $J({defaultValues:e,playbooks:t,onSubmit:n,isSubmitting:r=!1}){return m.jsx(M6,{schema:JJ,defaultValues:{...e,_env:[{key:"",value:""}],_headers:[{key:"",value:""}]},onSubmit:i=>{i.server.type==="stdio"?n({playbookId:i.playbookId,server:{...i.server,command:i.server.command.split(" ")[0],args:i.server.command.split(" ").slice(1),env:i._env.reduce((l,{key:o,value:c})=>(o&&(l[o]=c),l),{})}}):i.server.type==="http"&&n({playbookId:i.playbookId,server:{...i.server,headers:i._headers.reduce((l,{key:o,value:c})=>(o&&(l[o]=c),l),{})}})},children:m.jsx(QJ,{playbooks:t,isSubmitting:r})})}function QJ({playbooks:e,isSubmitting:t=!1}){const{control:n}=Ca(),r=KS({control:n,name:"server.type",defaultValue:"stdio"});return m.jsxs(m.Fragment,{children:[e&&m.jsx(Cg,{name:"playbookId",label:"Playbook",children:e.map(i=>m.jsx("option",{value:i.id,children:i.name},i.id))}),m.jsxs("div",{className:"flex flex-row gap-x-2 [&>div]:flex-1",children:[m.jsx(Ii,{label:"Name",name:"server.name",placeholder:"Enter server name…"}),m.jsxs(Cg,{label:"Transport",name:"server.type",children:[m.jsx("option",{value:"stdio",children:"STDIO"}),m.jsx("option",{value:"http",children:"HTTP"})]})]}),r==="stdio"&&m.jsx(GJ,{}),r==="http"&&m.jsx(KJ,{}),m.jsx(bt,{type:"submit",disabled:t,children:t?"Adding...":"Add MCP Server"})]})}function GJ(){return m.jsxs("div",{className:"space-y-4",children:[m.jsx(z6,{className:"min-h-auto",label:"Command",name:"server.command",placeholder:"e.g. npx -y @modelcontextprotocol/my-server <filepath>"}),m.jsxs("div",{className:"flex flex-col gap-y-2",children:[m.jsx(_l,{children:"Environment variables"}),m.jsx(ew,{name:"_env",keyPlaceholder:"Variable name",valuePlaceholder:"Value",addSrText:"Add environment variable"})," "]})]})}function KJ(){return m.jsxs("div",{className:"space-y-4",children:[m.jsx(Ii,{label:"URL",name:"server.url",placeholder:"Enter server URL…"}),m.jsxs("div",{className:"flex flex-col gap-y-2",children:[m.jsx(_l,{children:"Headers"}),m.jsx(ew,{name:"_headers",keyPlaceholder:"Header name",valuePlaceholder:"Value",addSrText:"Add header"})]})]})}function ew({name:e,keyPlaceholder:t,valuePlaceholder:n,addSrText:r}){const{control:i}=Ca(),{fields:l,append:o,remove:c}=cW({control:i,name:e}),f=()=>{o({key:"",value:""})};return m.jsx("div",{className:"space-y-2",children:l.map((p,y)=>m.jsxs("div",{className:"flex flex-row gap-x-2 [&>div]:flex-1",children:[m.jsx(Ii,{name:`${e}.${y}.key`,placeholder:t}),m.jsx(Ii,{name:`${e}.${y}.value`,placeholder:n}),y<l.length-1?m.jsxs(bt,{className:"size-8 leading-8",type:"button",variant:"secondary",size:"icon",onClick:()=>c(y),children:[m.jsx(Bc,{}),m.jsx("div",{className:"sr-only",children:"Remove"})]}):m.jsxs(bt,{className:"size-8 leading-8",type:"button",variant:"secondary",size:"icon",onClick:f,children:[m.jsx(Dg,{}),m.jsx("div",{className:"sr-only",children:r})]})]},p.id))})}const XJ=ga({name:JC,type:ZS("stdio"),command:z1,args:Eg(xn()),env:zS(z1,xn()).optional()}),WJ=ga({name:JC,type:ZS("http"),url:z1.url(),headers:zS(z1,xn()).optional()}),JJ=ga({playbookId:xn().optional(),server:ZX("type",[XJ,WJ]),_env:Eg(ga({key:xn(),value:xn()})),_headers:Eg(ga({key:xn(),value:xn()}))});function eee({className:e,entry:t,onClick:n}){return m.jsxs("div",{className:Ae("flex h-40 cursor-pointer flex-col justify-between gap-y-6 rounded-lg bg-accent-subtle p-4 transition-colors duration-200 ease-in-out hover:bg-accent",e),onClick:n,children:[m.jsx(Sf,{src:t.icon,className:"size-8"}),m.jsxs("div",{className:"flex flex-col gap-y-1",children:[m.jsxs("div",{className:"flex items-center gap-x-1 font-[450] text-[17px]",children:[t.title," ",t.isOfficial&&m.jsx(Ig,{weight:"fill"})]}),t.description&&m.jsx("div",{className:"line-clamp-2 text-pretty text-[14px] text-fg-subtle",children:t.description})]})]})}function tee({className:e,...t}){return m.jsx("div",{className:Ae("@container grid @2xl:grid-cols-2 grid-cols-1 gap-3",e),...t})}function nee({entries:e,pagination:t,searchQuery:n,onSearchQueryChange:r,onPageChange:i,onManualAddClick:l,onEntryClick:o}){return m.jsx(xa,{size:"lg",children:m.jsxs(Nt,{className:"gap-y-6",children:[m.jsxs(Ot,{children:[m.jsx(Rt,{children:"Discover MCP servers"}),m.jsx(ti,{children:"Find MCP servers for your favorite tools and install them directly to your Director playbooks."})]}),m.jsxs("div",{className:"flex flex-col gap-y-4",children:[m.jsxs("div",{className:"flex flex-row items-center justify-between",children:[m.jsx(m0,{type:"text",placeholder:"Search MCP servers...",value:n,onChange:c=>r(c.target.value),className:"max-w-md"}),m.jsx(bt,{onClick:l,children:"Add manually"})]}),m.jsxs(tee,{children:[e.sort((c,f)=>c.title.localeCompare(f.title)).map(c=>m.jsx(eee,{entry:c,onClick:()=>o?.(c.name)},c.id)),e.length===0&&m.jsx(Ta,{className:"col-span-2",children:m.jsx(ni,{children:"No MCP servers found"})})]})]}),t.totalItems>0&&m.jsxs("div",{className:"grid grid-cols-3 items-center gap-2",children:[m.jsx("div",{children:m.jsxs(bt,{className:Ae(!t.hasPreviousPage&&"hidden"),variant:"secondary",onClick:()=>i(t.pageIndex-1),children:[m.jsx(zx,{})," Previous"]})}),m.jsxs("span",{className:"text-center text-fg-subtle text-sm leading-7",children:["Page ",t.pageIndex+1," of ",t.totalPages]}),m.jsx("div",{className:"flex justify-end",children:m.jsxs(bt,{className:Ae(!t.hasNextPage&&"hidden"),variant:"secondary",onClick:()=>i(t.pageIndex+1),children:["Next ",m.jsx(Og,{})]})})]})]})})}function ree({children:e}){return m.jsxs(Cs,{className:"pointer-events-none relative select-none",children:[e,m.jsx(ks,{breadcrumbs:[{title:"Loading playbook"}],loading:!0,children:m.jsxs(bt,{size:"icon",variant:"ghost",className:"radix-state-[open]:bg-accent-subtle",disabled:!0,children:[m.jsx(Fc,{weight:"fill",className:"!size-4"}),m.jsx("span",{className:"sr-only",children:"Settings"})]})}),m.jsx(Pi,{"aria-hidden":!0,children:m.jsx(xa,{size:"lg",children:m.jsxs(Nt,{className:"gap-y-6",children:[m.jsxs(Ot,{children:[m.jsx(Rt,{children:"Discover MCP servers"}),m.jsx(ti,{children:"Find MCP servers for your favorite tools and install them directly to your Director playbooks."})]}),m.jsx(sl,{})]})})})]})}function aee(e){const t=gt.useUtils(),n=gt.store.addServer.useMutation({...e,async onSuccess(r,i,l,o){await t.store.getAll.invalidate(),await t.store.get.invalidate({playbookId:i.playbookId}),await e?.onSuccess?.(r,i,l,o)}});return{addServer:n.mutateAsync,isPending:n.isPending}}const iee=()=>{const e=Ir(),[t,n]=h.useState(0),[r,i]=h.useState(""),[l,o]=h.useState(!1),{data:c}=n0(),{data:f,isLoading:p,error:y}=LC({pageIndex:t,pageSize:20,searchQuery:r}),{addServer:g,isPending:x}=aee({onSuccess:(A,S)=>{Pt({title:"Server added",description:"The server has been added to the playbook"}),o(!1),e(`/${S.playbookId}`)},onError:()=>{Pt({title:"Failed to add server",description:"Please check Director CLI logs for more information."})}});return p?m.jsx(ree,{}):!f||y?m.jsx(Cs,{children:m.jsx(Pi,{children:m.jsx("div",{className:"inset-0 grid place-items-center",children:m.jsxs(Ta,{children:[m.jsx(ni,{children:"Something went wrong."}),m.jsx(Ns,{children:"Please try again"})]})})})}):m.jsxs(Cs,{children:[m.jsx(ks,{breadcrumbs:[{title:"Library"}]}),m.jsxs(Pi,{children:[m.jsx(nee,{entries:f.entries,pagination:f.pagination,searchQuery:r,onSearchQueryChange:i,onPageChange:n,onManualAddClick:()=>o(!0),onEntryClick:A=>e(`/library/mcp/${A}`)}),m.jsx(YJ,{open:l,onOpenChange:o,playbooks:c,onSubmit:async A=>{if(!A.playbookId){Pt({title:"No playbook selected",description:"Please select a playbook before adding a server."});return}await g({playbookId:A.playbookId,server:{name:A.server.name,transport:A.server}})},isSubmitting:x})]})]})},see=()=>{const e=Ir(),{data:t,isLoading:n,error:r}=n0(),i=n||r?.message==="Failed to fetch",l=Ja(),{setInProgress:o}=C8();return h.useEffect(()=>{o(!1)},[o]),m.jsxs(GW,{sections:[{id:"registries",label:"Registries",items:[{id:"mcp",label:"MCP",icon:m.jsx(i7,{}),isActive:l.pathname==="/library",onClick:()=>e("/library")}]},{id:"playbooks",label:"Playbooks",isLoading:i,items:t?.map(c=>({id:c.id,label:c.name,isActive:l.pathname===`/${c.id}`,onClick:()=>e(`/${c.id}`)}))||[]},{id:"actions",items:[{id:"new-playbook",label:"New Playbook",icon:m.jsx(Dg,{}),isActive:l.pathname==="/new",onClick:()=>e("/new")},{id:"documentation",label:"Documentation",icon:m.jsx(q1,{weight:"fill"}),onClick:()=>window.open("https://docs.director.run","_blank","noopener noreferrer")},{id:"github",label:"Github",icon:m.jsx(Mg,{}),onClick:()=>window.open("https://github.com/director-run/director","_blank","noopener noreferrer")}]}],children:[m.jsx(Cs,{children:m.jsx(xP,{})}),m.jsx(KA,{})]})},lee=5e3,oee=({children:e})=>{const{error:t,isLoading:n}=gt.health.useQuery(void 0,{refetchInterval:lee,retry:!1,throwOnError:!1,enabled:!0});return n?m.jsx(OC,{}):t?m.jsx(t0,{icon:"plugs",fullScreen:!0,title:"Can't connect to the backend",subtitle:"Please make sure director is running and refresh the page.",data:["# Start director","$ director serve","$ director studio"].join(`
|
|
149
149
|
`)}):m.jsx(m.Fragment,{children:e})},uee=()=>{const{isInitializing:e}=sj();return e?m.jsx("div",{children:"Initializing Auth..."}):m.jsxs(TP,{children:[m.jsx(Ia,{path:"/oauth/:playbookId/:targetId/callback",element:m.jsx($F,{})}),m.jsxs(Ia,{element:m.jsx(see,{}),children:[m.jsx(Ia,{path:"/library",element:m.jsx(iee,{})}),m.jsx(Ia,{path:"/library/mcp/:entryName",element:m.jsx(qJ,{})}),m.jsx(Ia,{path:"/:playbookId",element:m.jsx(bJ,{})}),m.jsx(Ia,{path:"/:playbookId/:targetId",element:m.jsx(SJ,{})}),m.jsx(Ia,{path:"/new",element:m.jsx(tJ,{})})]}),m.jsx(Ia,{path:"/get-started",element:m.jsx(QW,{})}),m.jsx(Ia,{path:"*",element:m.jsx(cee,{})})]})};RI.createRoot(document.getElementById("root")).render(m.jsx(J.StrictMode,{children:m.jsx(YF,{children:m.jsx($P,{basename:ij,children:m.jsx(FF,{gatewayUrl:hf,registryUrl:aj,children:m.jsx(oee,{children:m.jsxs(oj,{children:[m.jsx(uee,{}),m.jsx(TI,{}),m.jsx(KA,{})]})})})})})}));function cee(){const{data:e,isLoading:t}=n0();return t?m.jsx("div",{children:"Initializing Playbooks..."}):e?.length&&e.length>0?m.jsx(Ov,{to:`/${e[0].id}`,replace:!0}):m.jsx(Ov,{to:"/get-started",replace:!0})}
|