pmx-canvas 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,98 +1,98 @@
1
- var uP=Object.create;var{getPrototypeOf:yP,defineProperty:G2,getOwnPropertyNames:DP}=Object;var RP=Object.prototype.hasOwnProperty;function TP($){return this[$]}var jP,VP,CP=($,v,g)=>{var _=$!=null&&typeof $==="object";if(_){var U=v?jP??=new WeakMap:VP??=new WeakMap,z=U.get($);if(z)return z}g=$!=null?uP(yP($)):{};let J=v||!$||!$.__esModule?G2(g,"default",{value:$,enumerable:!0}):g;for(let b of DP($))if(!RP.call(J,b))G2(J,b,{get:TP.bind($,b),enumerable:!0});if(_)U.set($,J);return J};var fP=($,v)=>()=>(v||$((v={exports:{}}).exports,v),v.exports);var mP=($)=>$;function cP($,v){this[$]=mP.bind(null,v)}var ev=($,v)=>{for(var g in v)G2($,g,{get:v[g],enumerable:!0,configurable:!0,set:cP.bind(v,g)})};var sK=fP((aK)=>{Object.defineProperty(aK,"__esModule",{value:!0});var CK=/highlight-(?:text|source)-([a-z0-9]+)/;function mK($){$.addRule("highlightedCodeBlock",{filter:function(v){var g=v.firstChild;return v.nodeName==="DIV"&&CK.test(v.className)&&g&&g.nodeName==="PRE"},replacement:function(v,g,_){var U=g.className||"",z=(U.match(CK)||[null,""])[1];return`
1
+ var fP=Object.create;var{getPrototypeOf:EP,defineProperty:Y2,getOwnPropertyNames:mP}=Object;var cP=Object.prototype.hasOwnProperty;function iP($){return this[$]}var xP,hP,lP=($,v,g)=>{var _=$!=null&&typeof $==="object";if(_){var U=v?xP??=new WeakMap:hP??=new WeakMap,z=U.get($);if(z)return z}g=$!=null?fP(EP($)):{};let J=v||!$||!$.__esModule?Y2(g,"default",{value:$,enumerable:!0}):g;for(let G of mP($))if(!cP.call(J,G))Y2(J,G,{get:iP.bind($,G),enumerable:!0});if(_)U.set($,J);return J};var pP=($,v)=>()=>(v||$((v={exports:{}}).exports,v),v.exports);var oP=($)=>$;function nP($,v){this[$]=oP.bind(null,v)}var ev=($,v)=>{for(var g in v)Y2($,g,{get:v[g],enumerable:!0,configurable:!0,set:nP.bind(v,g)})};var z5=pP((_5)=>{Object.defineProperty(_5,"__esModule",{value:!0});var hO=/highlight-(?:text|source)-([a-z0-9]+)/;function pO($){$.addRule("highlightedCodeBlock",{filter:function(v){var g=v.firstChild;return v.nodeName==="DIV"&&hO.test(v.className)&&g&&g.nodeName==="PRE"},replacement:function(v,g,_){var U=g.className||"",z=(U.match(hO)||[null,""])[1];return`
2
2
 
3
3
  `+_.fence+z+`
4
4
  `+g.firstChild.textContent+`
5
5
  `+_.fence+`
6
6
 
7
- `}})}function cK($){$.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(v){return"~~"+v+"~~"}})}var OH=Array.prototype.indexOf,KH=Array.prototype.every,N6={},WH={left:":---",right:"---:",center:":---:"},x2=null,EK=null,fK=new WeakMap;function BH($){return $?($.getAttribute("align")||$.style.textAlign||"").toLowerCase():""}function iK($){return $?WH[$]:"---"}function lK($,v){var g={left:0,right:0,center:0,"":0},_="";for(var U=0;U<$.rows.length;++U){var z=$.rows[U];if(v<z.childNodes.length){var J=BH(z.childNodes[v]);if(++g[J],g[J]>g[_])_=J}}return _}N6.tableCell={filter:["th","td"],replacement:function($,v){if(p2(oK(v)))return $;return xK($,v)}};N6.tableRow={filter:"tr",replacement:function($,v){let g=oK(v);if(p2(g))return $;var _="";if(PH(v)){let J=nK(g);for(var U=0;U<J;U++){let b=U<v.childNodes.length?v.childNodes[U]:null;var z=iK(lK(g,U));_+=xK(z,b,U)}}return`
7
+ `}})}function oO($){$.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(v){return"~~"+v+"~~"}})}var LY=Array.prototype.indexOf,IY=Array.prototype.every,N6={},qY={left:":---",right:"---:",center:":---:"},a2=null,nO=null,lO=new WeakMap;function XY($){return $?($.getAttribute("align")||$.style.textAlign||"").toLowerCase():""}function tO($){return $?qY[$]:"---"}function dO($,v){var g={left:0,right:0,center:0,"":0},_="";for(var U=0;U<$.rows.length;++U){var z=$.rows[U];if(v<z.childNodes.length){var J=XY(z.childNodes[v]);if(++g[J],g[J]>g[_])_=J}}return _}N6.tableCell={filter:["th","td"],replacement:function($,v){if(e2($5(v)))return $;return aO($,v)}};N6.tableRow={filter:"tr",replacement:function($,v){let g=$5(v);if(e2(g))return $;var _="";if(FY(v)){let J=v5(g);for(var U=0;U<J;U++){let G=U<v.childNodes.length?v.childNodes[U]:null;var z=tO(dO(g,U));_+=aO(z,G,U)}}return`
8
8
  `+$+(_?`
9
- `+_:"")}};N6.table={filter:function($,v){return $.nodeName==="TABLE"},replacement:function($,v){if(pK(v,EK)){let b=v.outerHTML,O=IH(v);if(O===null||!O.classList.contains("joplin-table-wrapper"))return`
9
+ `+_:"")}};N6.table={filter:function($,v){return $.nodeName==="TABLE"},replacement:function($,v){if(eO(v,nO)){let G=v.outerHTML,K=ZY(v);if(K===null||!K.classList.contains("joplin-table-wrapper"))return`
10
10
 
11
- <div class="joplin-table-wrapper">${b}</div>
11
+ <div class="joplin-table-wrapper">${G}</div>
12
12
 
13
- `;else return b}else{if(p2(v))return $;$=$.replace(/\n+/g,`
13
+ `;else return G}else{if(e2(v))return $;$=$.replace(/\n+/g,`
14
14
  `);var g=$.trim().split(`
15
- `);if(g.length>=2)g=g[1];var _=/\| :?---/.test(g),U=nK(v),z="";if(U&&!_){z="|"+" |".repeat(U)+`
16
- |`;for(var J=0;J<U;++J)z+=" "+iK(lK(v,J))+" |"}let b=v.caption?v.caption.textContent||"":"",O=b?`${b}
15
+ `);if(g.length>=2)g=g[1];var _=/\| :?---/.test(g),U=v5(v),z="";if(U&&!_){z="|"+" |".repeat(U)+`
16
+ |`;for(var J=0;J<U;++J)z+=" "+tO(dO(v,J))+" |"}let G=v.caption?v.caption.textContent||"":"",K=G?`${G}
17
17
 
18
- `:"",K=`${z}${$}`.trimStart();return`
18
+ `:"",O=`${z}${$}`.trimStart();return`
19
19
 
20
- ${O}${K}
20
+ ${K}${O}
21
21
 
22
- `}}};N6.tableCaption={filter:["caption"],replacement:()=>""};N6.tableColgroup={filter:["colgroup","col"],replacement:()=>""};N6.tableSection={filter:["thead","tbody","tfoot"],replacement:function($){return $}};function PH($){var v=$.parentNode;return v.nodeName==="THEAD"||v.firstChild===$&&(v.nodeName==="TABLE"||kH(v))&&KH.call($.childNodes,function(g){return g.nodeName==="TH"})}function kH($){var v=$.previousSibling;return $.nodeName==="TBODY"&&(!v||v.nodeName==="THEAD"&&/^\s*$/i.test(v.textContent))}function xK($,v=null,g=null){if(g===null)g=OH.call(v.parentNode.childNodes,v);var _=" ";if(g===0)_="| ";let U=$.trim().replace(/\n\r/g,"<br>").replace(/\n/g,"<br>");U=U.replace(/\|+/g,"\\|");while(U.length<3)U+=" ";if(v)U=YH(U,v," ");return _+U+" |"}function hK($){if(!$.childNodes)return!1;for(let v=0;v<$.childNodes.length;v++){let g=$.childNodes[v];if(g.nodeName==="TABLE")return!0;if(hK(g))return!0}return!1}var h2=($,v)=>{if(!$.childNodes)return!1;for(let g=0;g<$.childNodes.length;g++){let _=$.childNodes[g];if(v==="code"&&x2&&x2(_))return!0;if(v.includes(_.nodeName))return!0;if(h2(_,v))return!0}return!1},pK=($,v)=>{let g=["UL","OL","H1","H2","H3","H4","H5","H6","HR","BLOCKQUOTE"];if(v.preserveNestedTables)g.push("TABLE");return h2($,"code")||h2($,g)};function p2($){let v=fK.get($);if(v!==void 0)return v;let g=HH($);return fK.set($,g),g}function HH($){if(!$)return!0;if(!$.rows)return!0;if($.rows.length===1&&$.rows[0].childNodes.length<=1)return!0;if(hK($))return!0;return!1}function IH($){let v=$.parentNode;while(v.nodeName!=="DIV")if(v=v.parentNode,!v)return null;return v}function oK($){let v=$.parentNode;while(v.nodeName!=="TABLE")if(v=v.parentNode,!v)return null;return v}function YH($,v,g){let _=v.getAttribute("colspan")||1;for(let U=1;U<_;U++)$+=" | "+g.repeat(3);return $}function nK($){let v=0;for(let g=0;g<$.rows.length;g++){let U=$.rows[g].childNodes.length;if(U>v)v=U}return v}function tK($){x2=$.isCodeBlock,EK=$.options,$.keep(function(g){if(g.nodeName==="TABLE"&&pK(g,$.options))return!0;return!1});for(var v in N6)$.addRule(v,N6[v])}function dK($){$.addRule("taskListItems",{filter:function(v){let g=v.parentNode,_=g.parentNode;return v.type==="checkbox"&&(g.nodeName==="LI"||g.nodeName==="LABEL"&&_&&_.nodeName==="LI")},replacement:function(v,g){return(g.checked?"[x]":"[ ]")+" "}})}function LH($){$.use([mK,cK,tK,dK])}aK.gfm=LH;aK.highlightedCodeBlock=mK;aK.strikethrough=cK;aK.tables=tK;aK.taskListItems=dK});if(typeof crypto<"u"&&typeof crypto.randomUUID!=="function")crypto.randomUUID=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let v=Math.random()*16|0;return($==="x"?v:v&3|8).toString(16)});var __,B$,vO,B2,L6,a3,UO,gO,_O,P2,O2,K2,EP,v_={},U_=[],iP=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z_=Array.isArray;function $6($,v){for(var g in v)$[g]=v[g];return $}function k2($){$&&$.parentNode&&$.parentNode.removeChild($)}function lP($,v,g){var _,U,z,J={};for(z in v)z=="key"?_=v[z]:z=="ref"?U=v[z]:J[z]=v[z];if(arguments.length>2&&(J.children=arguments.length>3?__.call(arguments,2):g),typeof $=="function"&&$.defaultProps!=null)for(z in $.defaultProps)J[z]===void 0&&(J[z]=$.defaultProps[z]);return $_($,J,_,U,null)}function $_($,v,g,_,U){var z={type:$,props:v,key:g,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:U==null?++vO:U,__i:-1,__u:0};return U==null&&B$.vnode!=null&&B$.vnode(z),z}function a$($){return $.children}function H4($,v){this.props=$,this.context=v}function I4($,v){if(v==null)return $.__?I4($.__,$.__i+1):null;for(var g;v<$.__k.length;v++)if((g=$.__k[v])!=null&&g.__e!=null)return g.__e;return typeof $.type=="function"?I4($):null}function xP($){if($.__P&&$.__d){var v=$.__v,g=v.__e,_=[],U=[],z=$6({},v);z.__v=v.__v+1,B$.vnode&&B$.vnode(z),H2($.__P,z,v,$.__n,$.__P.namespaceURI,32&v.__u?[g]:null,_,g==null?I4(v):g,!!(32&v.__u),U),z.__v=v.__v,z.__.__k[z.__i]=z,GO(_,z,U),v.__e=v.__=null,z.__e!=g&&zO(z)}}function zO($){if(($=$.__)!=null&&$.__c!=null)return $.__e=$.__c.base=null,$.__k.some(function(v){if(v!=null&&v.__e!=null)return $.__e=$.__c.base=v.__e}),zO($)}function s3($){(!$.__d&&($.__d=!0)&&L6.push($)&&!g_.__r++||a3!=B$.debounceRendering)&&((a3=B$.debounceRendering)||UO)(g_)}function g_(){try{for(var $,v=1;L6.length;)L6.length>v&&L6.sort(gO),$=L6.shift(),v=L6.length,xP($)}finally{L6.length=g_.__r=0}}function JO($,v,g,_,U,z,J,b,O,K,W){var B,k,P,X,Y,H,L,q=_&&_.__k||U_,F=v.length;for(O=hP(g,v,q,O,F),B=0;B<F;B++)(P=g.__k[B])!=null&&(k=P.__i!=-1&&q[P.__i]||v_,P.__i=B,H=H2($,P,k,U,z,J,b,O,K,W),X=P.__e,P.ref&&k.ref!=P.ref&&(k.ref&&I2(k.ref,null,P),W.push(P.ref,P.__c||X,P)),Y==null&&X!=null&&(Y=X),(L=!!(4&P.__u))||k.__k===P.__k?O=bO(P,O,$,L):typeof P.type=="function"&&H!==void 0?O=H:X&&(O=X.nextSibling),P.__u&=-7);return g.__e=Y,O}function hP($,v,g,_,U){var z,J,b,O,K,W=g.length,B=W,k=0;for($.__k=Array(U),z=0;z<U;z++)(J=v[z])!=null&&typeof J!="boolean"&&typeof J!="function"?(typeof J=="string"||typeof J=="number"||typeof J=="bigint"||J.constructor==String?J=$.__k[z]=$_(null,J,null,null,null):z_(J)?J=$.__k[z]=$_(a$,{children:J},null,null,null):J.constructor===void 0&&J.__b>0?J=$.__k[z]=$_(J.type,J.props,J.key,J.ref?J.ref:null,J.__v):$.__k[z]=J,O=z+k,J.__=$,J.__b=$.__b+1,b=null,(K=J.__i=pP(J,g,O,B))!=-1&&(B--,(b=g[K])&&(b.__u|=2)),b==null||b.__v==null?(K==-1&&(U>W?k--:U<W&&k++),typeof J.type!="function"&&(J.__u|=4)):K!=O&&(K==O-1?k--:K==O+1?k++:(K>O?k--:k++,J.__u|=4))):$.__k[z]=null;if(B)for(z=0;z<W;z++)(b=g[z])!=null&&(2&b.__u)==0&&(b.__e==_&&(_=I4(b)),KO(b,b));return _}function bO($,v,g,_){var U,z;if(typeof $.type=="function"){for(U=$.__k,z=0;U&&z<U.length;z++)U[z]&&(U[z].__=$,v=bO(U[z],v,g,_));return v}$.__e!=v&&(_&&(v&&$.type&&!v.parentNode&&(v=I4($)),g.insertBefore($.__e,v||null)),v=$.__e);do v=v&&v.nextSibling;while(v!=null&&v.nodeType==8);return v}function pP($,v,g,_){var U,z,J,b=$.key,O=$.type,K=v[g],W=K!=null&&(2&K.__u)==0;if(K===null&&b==null||W&&b==K.key&&O==K.type)return g;if(_>(W?1:0)){for(U=g-1,z=g+1;U>=0||z<v.length;)if((K=v[J=U>=0?U--:z++])!=null&&(2&K.__u)==0&&b==K.key&&O==K.type)return J}return-1}function e3($,v,g){v[0]=="-"?$.setProperty(v,g==null?"":g):$[v]=g==null?"":typeof g!="number"||iP.test(v)?g:g+"px"}function eg($,v,g,_,U){var z,J;$:if(v=="style")if(typeof g=="string")$.style.cssText=g;else{if(typeof _=="string"&&($.style.cssText=_=""),_)for(v in _)g&&v in g||e3($.style,v,"");if(g)for(v in g)_&&g[v]==_[v]||e3($.style,v,g[v])}else if(v[0]=="o"&&v[1]=="n")z=v!=(v=v.replace(_O,"$1")),J=v.toLowerCase(),v=J in $||v=="onFocusOut"||v=="onFocusIn"?J.slice(2):v.slice(2),$.l||($.l={}),$.l[v+z]=g,g?_?g.u=_.u:(g.u=P2,$.addEventListener(v,z?K2:O2,z)):$.removeEventListener(v,z?K2:O2,z);else{if(U=="http://www.w3.org/2000/svg")v=v.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(v!="width"&&v!="height"&&v!="href"&&v!="list"&&v!="form"&&v!="tabIndex"&&v!="download"&&v!="rowSpan"&&v!="colSpan"&&v!="role"&&v!="popover"&&v in $)try{$[v]=g==null?"":g;break $}catch(b){}typeof g=="function"||(g==null||g===!1&&v[4]!="-"?$.removeAttribute(v):$.setAttribute(v,v=="popover"&&g==1?"":g))}}function $O($){return function(v){if(this.l){var g=this.l[v.type+$];if(v.t==null)v.t=P2++;else if(v.t<g.u)return;return g(B$.event?B$.event(v):v)}}}function H2($,v,g,_,U,z,J,b,O,K){var W,B,k,P,X,Y,H,L,q,F,N,C,p,r,n,e=v.type;if(v.constructor!==void 0)return null;128&g.__u&&(O=!!(32&g.__u),z=[b=v.__e=g.__e]),(W=B$.__b)&&W(v);$:if(typeof e=="function")try{if(L=v.props,q=e.prototype&&e.prototype.render,F=(W=e.contextType)&&_[W.__c],N=W?F?F.props.value:W.__:_,g.__c?H=(B=v.__c=g.__c).__=B.__E:(q?v.__c=B=new e(L,N):(v.__c=B=new H4(L,N),B.constructor=e,B.render=nP),F&&F.sub(B),B.state||(B.state={}),B.__n=_,k=B.__d=!0,B.__h=[],B._sb=[]),q&&B.__s==null&&(B.__s=B.state),q&&e.getDerivedStateFromProps!=null&&(B.__s==B.state&&(B.__s=$6({},B.__s)),$6(B.__s,e.getDerivedStateFromProps(L,B.__s))),P=B.props,X=B.state,B.__v=v,k)q&&e.getDerivedStateFromProps==null&&B.componentWillMount!=null&&B.componentWillMount(),q&&B.componentDidMount!=null&&B.__h.push(B.componentDidMount);else{if(q&&e.getDerivedStateFromProps==null&&L!==P&&B.componentWillReceiveProps!=null&&B.componentWillReceiveProps(L,N),v.__v==g.__v||!B.__e&&B.shouldComponentUpdate!=null&&B.shouldComponentUpdate(L,B.__s,N)===!1){v.__v!=g.__v&&(B.props=L,B.state=B.__s,B.__d=!1),v.__e=g.__e,v.__k=g.__k,v.__k.some(function(u){u&&(u.__=v)}),U_.push.apply(B.__h,B._sb),B._sb=[],B.__h.length&&J.push(B);break $}B.componentWillUpdate!=null&&B.componentWillUpdate(L,B.__s,N),q&&B.componentDidUpdate!=null&&B.__h.push(function(){B.componentDidUpdate(P,X,Y)})}if(B.context=N,B.props=L,B.__P=$,B.__e=!1,C=B$.__r,p=0,q)B.state=B.__s,B.__d=!1,C&&C(v),W=B.render(B.props,B.state,B.context),U_.push.apply(B.__h,B._sb),B._sb=[];else do B.__d=!1,C&&C(v),W=B.render(B.props,B.state,B.context),B.state=B.__s;while(B.__d&&++p<25);B.state=B.__s,B.getChildContext!=null&&(_=$6($6({},_),B.getChildContext())),q&&!k&&B.getSnapshotBeforeUpdate!=null&&(Y=B.getSnapshotBeforeUpdate(P,X)),r=W!=null&&W.type===a$&&W.key==null?OO(W.props.children):W,b=JO($,z_(r)?r:[r],v,g,_,U,z,J,b,O,K),B.base=v.__e,v.__u&=-161,B.__h.length&&J.push(B),H&&(B.__E=B.__=null)}catch(u){if(v.__v=null,O||z!=null)if(u.then){for(v.__u|=O?160:128;b&&b.nodeType==8&&b.nextSibling;)b=b.nextSibling;z[z.indexOf(b)]=null,v.__e=b}else{for(n=z.length;n--;)k2(z[n]);W2(v)}else v.__e=g.__e,v.__k=g.__k,u.then||W2(v);B$.__e(u,v,g)}else z==null&&v.__v==g.__v?(v.__k=g.__k,v.__e=g.__e):b=v.__e=oP(g.__e,v,g,_,U,z,J,O,K);return(W=B$.diffed)&&W(v),128&v.__u?void 0:b}function W2($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(W2))}function GO($,v,g){for(var _=0;_<g.length;_++)I2(g[_],g[++_],g[++_]);B$.__c&&B$.__c(v,$),$.some(function(U){try{$=U.__h,U.__h=[],$.some(function(z){z.call(U)})}catch(z){B$.__e(z,U.__v)}})}function OO($){return typeof $!="object"||$==null||$.__b>0?$:z_($)?$.map(OO):$6({},$)}function oP($,v,g,_,U,z,J,b,O){var K,W,B,k,P,X,Y,H=g.props||v_,L=v.props,q=v.type;if(q=="svg"?U="http://www.w3.org/2000/svg":q=="math"?U="http://www.w3.org/1998/Math/MathML":U||(U="http://www.w3.org/1999/xhtml"),z!=null){for(K=0;K<z.length;K++)if((P=z[K])&&"setAttribute"in P==!!q&&(q?P.localName==q:P.nodeType==3)){$=P,z[K]=null;break}}if($==null){if(q==null)return document.createTextNode(L);$=document.createElementNS(U,q,L.is&&L),b&&(B$.__m&&B$.__m(v,z),b=!1),z=null}if(q==null)H===L||b&&$.data==L||($.data=L);else{if(z=z&&__.call($.childNodes),!b&&z!=null)for(H={},K=0;K<$.attributes.length;K++)H[(P=$.attributes[K]).name]=P.value;for(K in H)P=H[K],K=="dangerouslySetInnerHTML"?B=P:K=="children"||(K in L)||K=="value"&&("defaultValue"in L)||K=="checked"&&("defaultChecked"in L)||eg($,K,null,P,U);for(K in L)P=L[K],K=="children"?k=P:K=="dangerouslySetInnerHTML"?W=P:K=="value"?X=P:K=="checked"?Y=P:b&&typeof P!="function"||H[K]===P||eg($,K,P,H[K],U);if(W)b||B&&(W.__html==B.__html||W.__html==$.innerHTML)||($.innerHTML=W.__html),v.__k=[];else if(B&&($.innerHTML=""),JO(v.type=="template"?$.content:$,z_(k)?k:[k],v,g,_,q=="foreignObject"?"http://www.w3.org/1999/xhtml":U,z,J,z?z[0]:g.__k&&I4(g,0),b,O),z!=null)for(K=z.length;K--;)k2(z[K]);b||(K="value",q=="progress"&&X==null?$.removeAttribute("value"):X!=null&&(X!==$[K]||q=="progress"&&!X||q=="option"&&X!=H[K])&&eg($,K,X,H[K],U),K="checked",Y!=null&&Y!=$[K]&&eg($,K,Y,H[K],U))}return $}function I2($,v,g){try{if(typeof $=="function"){var _=typeof $.__u=="function";_&&$.__u(),_&&v==null||($.__u=$(v))}else $.current=v}catch(U){B$.__e(U,g)}}function KO($,v,g){var _,U;if(B$.unmount&&B$.unmount($),(_=$.ref)&&(_.current&&_.current!=$.__e||I2(_,null,v)),(_=$.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(z){B$.__e(z,v)}_.base=_.__P=null}if(_=$.__k)for(U=0;U<_.length;U++)_[U]&&KO(_[U],v,g||typeof $.type!="function");g||k2($.__e),$.__c=$.__=$.__e=void 0}function nP($,v,g){return this.constructor($,g)}function WO($,v,g){var _,U,z,J;v==document&&(v=document.documentElement),B$.__&&B$.__($,v),U=(_=typeof g=="function")?null:g&&g.__k||v.__k,z=[],J=[],H2(v,$=(!_&&g||v).__k=lP(a$,null,[$]),U||v_,v_,v.namespaceURI,!_&&g?[g]:U?null:v.firstChild?__.call(v.childNodes):null,z,!_&&g?g:U?U.__e:v.firstChild,_,J),GO(z,$,J)}__=U_.slice,B$={__e:function($,v,g,_){for(var U,z,J;v=v.__;)if((U=v.__c)&&!U.__)try{if((z=U.constructor)&&z.getDerivedStateFromError!=null&&(U.setState(z.getDerivedStateFromError($)),J=U.__d),U.componentDidCatch!=null&&(U.componentDidCatch($,_||{}),J=U.__d),J)return U.__E=U}catch(b){$=b}throw $}},vO=0,B2=function($){return $!=null&&$.constructor===void 0},H4.prototype.setState=function($,v){var g;g=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$6({},this.state),typeof $=="function"&&($=$($6({},g),this.props)),$&&$6(g,$),$!=null&&this.__v&&(v&&this._sb.push(v),s3(this))},H4.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),s3(this))},H4.prototype.render=a$,L6=[],UO=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,gO=function($,v){return $.__v.__b-v.__v.__b},g_.__r=0,_O=/(PointerCapture)$|Capture$/i,P2=0,O2=$O(!1),K2=$O(!0),EP=0;var Y4,f$,Y2,BO,yU=0,XO=[],E$=B$,PO=E$.__b,kO=E$.__r,HO=E$.diffed,IO=E$.__c,YO=E$.unmount,LO=E$.__;function b_($,v){E$.__h&&E$.__h(f$,$,yU||v),yU=0;var g=f$.__H||(f$.__H={__:[],__h:[]});return $>=g.__.length&&g.__.push({}),g.__[$]}function o($){return yU=1,tP(wO,$)}function tP($,v,g){var _=b_(Y4++,2);if(_.t=$,!_.__c&&(_.__=[g?g(v):wO(void 0,v),function(b){var O=_.__N?_.__N[0]:_.__[0],K=_.t(O,b);O!==K&&(_.__N=[K,_.__[1]],_.__c.setState({}))}],_.__c=f$,!f$.__f)){var U=function(b,O,K){if(!_.__c.__H)return!0;var W=_.__c.__H.__.filter(function(k){return k.__c});if(W.every(function(k){return!k.__N}))return!z||z.call(this,b,O,K);var B=_.__c.props!==b;return W.some(function(k){if(k.__N){var P=k.__[0];k.__=k.__N,k.__N=void 0,P!==k.__[0]&&(B=!0)}}),z&&z.call(this,b,O,K)||B};f$.__f=!0;var{shouldComponentUpdate:z,componentWillUpdate:J}=f$;f$.componentWillUpdate=function(b,O,K){if(this.__e){var W=z;z=void 0,U(b,O,K),z=W}J&&J.call(this,b,O,K)},f$.shouldComponentUpdate=U}return _.__N||_.__}function m($,v){var g=b_(Y4++,3);!E$.__s&&q2(g.__H,v)&&(g.__=$,g.u=v,f$.__H.__h.push(g))}function G_($,v){var g=b_(Y4++,4);!E$.__s&&q2(g.__H,v)&&(g.__=$,g.u=v,f$.__h.push(g))}function y($){return yU=5,n$(function(){return{current:$}},[])}function n$($,v){var g=b_(Y4++,7);return q2(g.__H,v)&&(g.__=$(),g.__H=v,g.__h=$),g.__}function Q($,v){return yU=8,n$(function(){return $},v)}function dP(){for(var $;$=XO.shift();){var v=$.__H;if($.__P&&v)try{v.__h.some(J_),v.__h.some(L2),v.__h=[]}catch(g){v.__h=[],E$.__e(g,$.__v)}}}E$.__b=function($){f$=null,PO&&PO($)},E$.__=function($,v){$&&v.__k&&v.__k.__m&&($.__m=v.__k.__m),LO&&LO($,v)},E$.__r=function($){kO&&kO($),Y4=0;var v=(f$=$.__c).__H;v&&(Y2===f$?(v.__h=[],f$.__h=[],v.__.some(function(g){g.__N&&(g.__=g.__N),g.u=g.__N=void 0})):(v.__h.some(J_),v.__h.some(L2),v.__h=[],Y4=0)),Y2=f$},E$.diffed=function($){HO&&HO($);var v=$.__c;v&&v.__H&&(v.__H.__h.length&&(XO.push(v)!==1&&BO===E$.requestAnimationFrame||((BO=E$.requestAnimationFrame)||aP)(dP)),v.__H.__.some(function(g){g.u&&(g.__H=g.u),g.u=void 0})),Y2=f$=null},E$.__c=function($,v){v.some(function(g){try{g.__h.some(J_),g.__h=g.__h.filter(function(_){return!_.__||L2(_)})}catch(_){v.some(function(U){U.__h&&(U.__h=[])}),v=[],E$.__e(_,g.__v)}}),IO&&IO($,v)},E$.unmount=function($){YO&&YO($);var v,g=$.__c;g&&g.__H&&(g.__H.__.some(function(_){try{J_(_)}catch(U){v=U}}),g.__H=void 0,v&&E$.__e(v,g.__v))};var qO=typeof requestAnimationFrame=="function";function aP($){var v,g=function(){clearTimeout(_),qO&&cancelAnimationFrame(v),setTimeout($)},_=setTimeout(g,35);qO&&(v=requestAnimationFrame(g))}function J_($){var v=f$,g=$.__c;typeof g=="function"&&($.__c=void 0,g()),f$=v}function L2($){var v=f$;$.__c=$.__(),f$=v}function q2($,v){return!$||$.length!==v.length||v.some(function(g,_){return g!==$[_]})}function wO($,v){return typeof v=="function"?v($):v}var sP=Symbol.for("preact-signals");function B_(){if(!(v6>1)){var $,v=!1;(function(){var U=K_;K_=void 0;while(U!==void 0){if(U.S.v===U.v)U.S.i=U.i;U=U.o}})();while(DU!==void 0){var g=DU;DU=void 0,O_++;while(g!==void 0){var _=g.u;if(g.u=void 0,g.f&=-3,!(8&g.f)&&ZO(g))try{g.c()}catch(U){if(!v)$=U,v=!0}g=_}}if(O_=0,v6--,v)throw $}else v6--}function U6($){if(v6>0)return $();X2=++eP,v6++;try{return $()}finally{B_()}}var X$=void 0;function w2($){var v=X$;X$=void 0;try{return $()}finally{X$=v}}var FO,DU=void 0,v6=0,O_=0,eP=0,X2=0,K_=void 0,W_=0;function AO($){if(X$!==void 0){var v=$.n;if(v===void 0||v.t!==X$){if(v={i:0,S:$,p:X$.s,n:void 0,t:X$,e:void 0,x:void 0,r:v},X$.s!==void 0)X$.s.n=v;if(X$.s=v,$.n=v,32&X$.f)$.S(v);return v}else if(v.i===-1){if(v.i=0,v.n!==void 0){if(v.n.p=v.p,v.p!==void 0)v.p.n=v.n;v.p=X$.s,v.n=void 0,X$.s.n=v,X$.s=v}return v}}}function o$($,v){this.v=$,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}o$.prototype.brand=sP;o$.prototype.h=function(){return!0};o$.prototype.S=function($){var v=this,g=this.t;if(g!==$&&$.e===void 0)if($.x=g,this.t=$,g!==void 0)g.e=$;else w2(function(){var _;(_=v.W)==null||_.call(v)})};o$.prototype.U=function($){var v=this;if(this.t!==void 0){var{e:g,x:_}=$;if(g!==void 0)g.x=_,$.e=void 0;if(_!==void 0)_.e=g,$.x=void 0;if($===this.t){if(this.t=_,_===void 0)w2(function(){var U;(U=v.Z)==null||U.call(v)})}}};o$.prototype.subscribe=function($){var v=this;return q6(function(){var g=v.value,_=X$;X$=void 0;try{$(g)}finally{X$=_}},{name:"sub"})};o$.prototype.valueOf=function(){return this.value};o$.prototype.toString=function(){return this.value+""};o$.prototype.toJSON=function(){return this.value};o$.prototype.peek=function(){var $=X$;X$=void 0;try{return this.value}finally{X$=$}};Object.defineProperty(o$.prototype,"value",{get:function(){var $=AO(this);if($!==void 0)$.i=this.i;return this.v},set:function($){if($!==this.v){if(O_>100)throw Error("Cycle detected");(function(g){if(v6!==0&&O_===0){if(g.l!==X2)g.l=X2,K_={S:g,v:g.v,i:g.i,o:K_}}})(this),this.v=$,this.i++,W_++,v6++;try{for(var v=this.t;v!==void 0;v=v.x)v.t.N()}finally{B_()}}}});function O$($,v){return new o$($,v)}function ZO($){for(var v=$.s;v!==void 0;v=v.n)if(v.S.i!==v.i||!v.S.h()||v.S.i!==v.i)return!0;return!1}function MO($){for(var v=$.s;v!==void 0;v=v.n){var g=v.S.n;if(g!==void 0)v.r=g;if(v.S.n=v,v.i=-1,v.n===void 0){$.s=v;break}}}function QO($){var v=$.s,g=void 0;while(v!==void 0){var _=v.p;if(v.i===-1){if(v.S.U(v),_!==void 0)_.n=v.n;if(v.n!==void 0)v.n.p=_}else g=v;if(v.S.n=v.r,v.r!==void 0)v.r=void 0;v=_}$.s=g}function s6($,v){o$.call(this,void 0),this.x=$,this.s=void 0,this.g=W_-1,this.f=4,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}s6.prototype=new o$;s6.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32)return!0;if(this.f&=-5,this.g===W_)return!0;if(this.g=W_,this.f|=1,this.i>0&&!ZO(this))return this.f&=-2,!0;var $=X$;try{MO(this),X$=this;var v=this.x();if(16&this.f||this.v!==v||this.i===0)this.v=v,this.f&=-17,this.i++}catch(g){this.v=g,this.f|=16,this.i++}return X$=$,QO(this),this.f&=-2,!0};s6.prototype.S=function($){if(this.t===void 0){this.f|=36;for(var v=this.s;v!==void 0;v=v.n)v.S.S(v)}o$.prototype.S.call(this,$)};s6.prototype.U=function($){if(this.t!==void 0){if(o$.prototype.U.call(this,$),this.t===void 0){this.f&=-33;for(var v=this.s;v!==void 0;v=v.n)v.S.U(v)}}};s6.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var $=this.t;$!==void 0;$=$.x)$.t.N()}};Object.defineProperty(s6.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var $=AO(this);if(this.h(),$!==void 0)$.i=this.i;if(16&this.f)throw this.v;return this.v}});function e6($,v){return new s6($,v)}function SO($){var v=$.m;if($.m=void 0,typeof v=="function"){v6++;var g=X$;X$=void 0;try{v()}catch(_){throw $.f&=-2,$.f|=8,F2($),_}finally{X$=g,B_()}}}function F2($){for(var v=$.s;v!==void 0;v=v.n)v.S.U(v);$.x=void 0,$.s=void 0,SO($)}function $k($){if(X$!==this)throw Error("Out-of-order effect");if(QO(this),X$=$,this.f&=-2,8&this.f)F2(this);B_()}function L4($,v){if(this.x=$,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=v==null?void 0:v.name,FO)FO.push(this)}L4.prototype.c=function(){var $=this.S();try{if(8&this.f)return;if(this.x===void 0)return;var v=this.x();if(typeof v=="function")this.m=v}finally{$()}};L4.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,SO(this),MO(this),v6++;var $=X$;return X$=this,$k.bind(this,$)};L4.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=DU,DU=this};L4.prototype.d=function(){if(this.f|=8,!(1&this.f))F2(this)};L4.prototype.dispose=function(){this.d()};function q6($,v){var g=new L4($,v);try{g.c()}catch(U){throw g.d(),U}var _=g.d.bind(g);return _[Symbol.dispose]=_,_}var A2,Z2,P_,vk=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,NO=[],rO=[];q6(function(){A2=this.N})();function q4($,v){B$[$]=v.bind(null,B$[$]||function(){})}function k_($){if(P_){var v=P_;P_=void 0,v()}P_=$&&$.S()}function uO($){var v=this,g=$.data,_=gk(g);_.value=g;var U=n$(function(){var b=v,O=v.__v;while(O=O.__)if(O.__c){O.__c.__$f|=4;break}var K=e6(function(){var P=_.value.value;return P===0?0:P===!0?"":P||""}),W=e6(function(){return!Array.isArray(K.value)&&!B2(K.value)}),B=q6(function(){if(this.N=yO,W.value){var P=K.value;if(b.__v&&b.__v.__e&&b.__v.__e.nodeType===3)b.__v.__e.data=P}}),k=v.__$u.d;return v.__$u.d=function(){B(),k.call(this)},[W,K]},[]),z=U[0],J=U[1];return z.value?J.peek():J.value}uO.displayName="ReactiveTextNode";Object.defineProperties(o$.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:uO},props:{configurable:!0,get:function(){var $=this;return{data:{get value(){return $.value}}}}},__b:{configurable:!0,value:1}});q4("__b",function($,v){if(typeof v.type=="string"){var g,_=v.props;for(var U in _)if(U!=="children"){var z=_[U];if(z instanceof o$){if(!g)v.__np=g={};g[U]=z,_[U]=z.peek()}}}$(v)});q4("__r",function($,v){if($(v),v.type!==a$){k_();var g,_=v.__c;if(_){if(_.__$f&=-2,(g=_.__$u)===void 0)_.__$u=g=function(U,z){var J;return q6(function(){J=this},{name:z}),J.c=U,J}(function(){var U;if(vk)(U=g.y)==null||U.call(g);_.__$f|=1,_.setState({})},typeof v.type=="function"?v.type.displayName||v.type.name:"")}Z2=_,k_(g)}});q4("__e",function($,v,g,_){k_(),Z2=void 0,$(v,g,_)});q4("diffed",function($,v){k_(),Z2=void 0;var g;if(typeof v.type=="string"&&(g=v.__e)){var{__np:_,props:U}=v;if(_){var z=g.U;if(z)for(var J in z){var b=z[J];if(b!==void 0&&!(J in _))b.d(),z[J]=void 0}else z={},g.U=z;for(var O in _){var K=z[O],W=_[O];if(K===void 0)K=Uk(g,O,W),z[O]=K;else K.o(W,U)}for(var B in _)U[B]=_[B]}}$(v)});function Uk($,v,g,_){var U=v in $&&$.ownerSVGElement===void 0,z=O$(g),J=g.peek();return{o:function(b,O){z.value=b,J=b.peek()},d:q6(function(){this.N=yO;var b=z.value.value;if(J!==b)if(J=void 0,U)$[v]=b;else if(b!=null&&(b!==!1||v[4]==="-"))$.setAttribute(v,b);else $.removeAttribute(v);else J=void 0})}}q4("unmount",function($,v){if(typeof v.type=="string"){var g=v.__e;if(g){var _=g.U;if(_){g.U=void 0;for(var U in _){var z=_[U];if(z)z.d()}}}v.__np=void 0}else{var J=v.__c;if(J){var b=J.__$u;if(b)J.__$u=void 0,b.d()}}$(v)});q4("__h",function($,v,g,_){if(_<3||_===9)v.__$f|=2;$(v,g,_)});H4.prototype.shouldComponentUpdate=function($,v){if(this.__R)return!0;var g=this.__$u,_=g&&g.s!==void 0;for(var U in v)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var z=2&this.__$f;if(!(_||z||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(_||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var J in $)if(J!=="__source"&&$[J]!==this.props[J])return!0;for(var b in this.props)if(!(b in $))return!0;return!1};function gk($,v){return n$(function(){return O$($,v)},[])}var _k=typeof requestAnimationFrame>"u"?setTimeout:function($){var v=function(){clearTimeout(g),cancelAnimationFrame(_),$()},g=setTimeout(v,35),_=requestAnimationFrame(v)},zk=function($){queueMicrotask(function(){queueMicrotask($)})};function Jk(){U6(function(){var $;while($=NO.shift())A2.call($)})}function bk(){if(NO.push(this)===1)(B$.requestAnimationFrame||_k)(Jk)}function Gk(){U6(function(){var $;while($=rO.shift())A2.call($)})}function yO(){if(rO.push(this)===1)(B$.requestAnimationFrame||zk)(Gk)}function DO($,v){var g=y($);g.current=$,m(function(){return q6(function(){return this.N=bk,g.current()},v)},[])}var H_=O$(null),RU=O$([]),w4=O$(new Set),F4=O$(new Set),I_=O$([]),Y_=O$(new Set),X6=O$(!1),X4=O$(0);function RO(){H_.value=null,RU.value=[],w4.value=new Set,F4.value=new Set,I_.value=[],Y_.value=new Set,X6.value=!1,X4.value=0}function L_(){X6.value=!0,X4.value=0}function q_(){X6.value=!1}function TO($,v,g){w4.value=new Set($),F4.value=new Set(v),I_.value=g}function X_($){H_.value=$}function jO($,v=6){if(RU.value=[$,...RU.value].slice(0,v),!X6.value)X4.value=Math.min(99,X4.value+1)}function w_($){Y_.value=new Set($)}var s$={markdown:"MD","mcp-app":"APP",webpage:"WEB","json-render":"UI",graph:"GRAPH",prompt:"ASK",response:"ANS",status:"STATUS",context:"CONTEXT",ledger:"LOG",trace:"TRACE",file:"FILE",image:"IMG",html:"HTML",group:"GROUP"},F_=new Set(["markdown","mcp-app","webpage","json-render","graph","context","ledger","file","image","html"]);function VO($){return $.type==="mcp-app"&&$.data.mode==="ext-app"&&$.data.serverName==="Excalidraw"&&$.data.toolName==="create_view"}function CO($){if($.length===0)return null;let{POSITIVE_INFINITY:v,POSITIVE_INFINITY:g,NEGATIVE_INFINITY:_,NEGATIVE_INFINITY:U}=Number;for(let z of $)v=Math.min(v,z.position.x),g=Math.min(g,z.position.y),_=Math.max(_,z.position.x+z.size.width),U=Math.max(U,z.position.y+z.size.height);if(!Number.isFinite(v)||!Number.isFinite(g))return null;return{x:v-40,y:g-40-32,width:_-v+80,height:U-g+80+32}}function Ok($){let v=$.filter((O)=>!O.pinned&&O.dockPosition===null),g=new Map(v.map((O)=>[O.id,O])),_=new Map,U=[],z=new Map;for(let O of v){if(O.type==="group")continue;let K=typeof O.data.parentGroup==="string"?O.data.parentGroup:"",W=K?g.get(K):void 0;if(!W||W.type!=="group")continue;if(!z.has(K))z.set(K,[]);z.get(K).push(O)}let J=v.filter((O)=>O.type==="group").sort((O,K)=>O.position.y-K.position.y||O.position.x-K.position.x);for(let O of J){let K=z.get(O.id)??[];if(K.length===0){let P=`unit:${O.id}`;U.push({id:P,memberIds:[O.id],origin:{...O.position},size:{...O.size},sortKey:{x:O.position.x,y:O.position.y}}),_.set(O.id,P);continue}let W=K.map((P)=>({position:P.position,size:P.size})),B=CO(W);if(!B)continue;let k=`group:${O.id}`;U.push({id:k,memberIds:K.map((P)=>P.id),origin:{x:B.x,y:B.y},size:{width:B.width,height:B.height},sortKey:{x:B.x,y:B.y},groupId:O.id}),_.set(O.id,k);for(let P of K)_.set(P.id,k)}let b=v.filter((O)=>!_.has(O.id)).sort((O,K)=>O.position.y-K.position.y||O.position.x-K.position.x);for(let O of b){let K=`unit:${O.id}`;U.push({id:K,memberIds:[O.id],origin:{...O.position},size:{...O.size},sortKey:{x:O.position.x,y:O.position.y}}),_.set(O.id,K)}return{units:U,nodesById:g,nodeToUnit:_}}function Kk($,v,g){let _=new Map,U=new Map,z=new Map,J=new Map;for(let b of $)_.set(b.id,new Set),U.set(b.id,new Set),z.set(b.id,0),J.set(b.id,0);for(let b of g){let O=v.get(b.from),K=v.get(b.to);if(!O||!K||O===K)continue;if(!_.get(O).has(K))_.get(O).add(K),J.set(O,(J.get(O)??0)+1),z.set(K,(z.get(K)??0)+1);U.get(O).add(K),U.get(K).add(O)}return{outgoing:_,undirected:U,indegree:z,outdegree:J}}function Wk($,v){let g=new Map($.map((z)=>[z.id,z])),_=new Set,U=[];for(let z of $){if(_.has(z.id))continue;let J=[z.id],b=[];_.add(z.id);while(J.length>0){let K=J.pop();b.push(K);for(let W of v.get(K)??[]){if(_.has(W))continue;_.add(W),J.push(W)}}let O=b.map((K)=>g.get(K)).filter((K)=>K!==void 0).sort((K,W)=>K.sortKey.y-W.sortKey.y||K.sortKey.x-W.sortKey.x);U.push(O)}return U.sort((z,J)=>z[0].sortKey.y-J[0].sortKey.y||z[0].sortKey.x-J[0].sortKey.x)}function Bk($){let v=new Map,g=0,_=0,U=0,z=0,J=Math.max(900,Math.ceil(Math.sqrt($.reduce((b,O)=>b+O.size.width*O.size.height,0))));for(let b of $){if(g>0&&g+b.size.width>J)g=0,_+=U+72,U=0;v.set(b.id,{x:g,y:_}),g+=b.size.width+96,U=Math.max(U,b.size.height),z=Math.max(z,g-96)}return{positions:v,size:{width:Math.max(0,z),height:_+U},sortKey:$[0].sortKey}}function Pk($,v,g,_,U){if($.length===1)return{positions:new Map([[$[0].id,{x:0,y:0}]]),size:{...$[0].size},sortKey:$[0].sortKey};let z=new Set($.map((q)=>q.id)),J=$.filter((q)=>(_.get(q.id)??0)===0&&(U.get(q.id)??0)>0).sort((q,F)=>q.sortKey.x-F.sortKey.x||q.sortKey.y-F.sortKey.y),b=J.length>0?J:[$.slice().sort((q,F)=>q.sortKey.x-F.sortKey.x||q.sortKey.y-F.sortKey.y)[0]],O=new Map,K=b.map((q)=>q.id);for(let q of b)O.set(q.id,0);while(K.length>0){let q=K.shift(),F=O.get(q)??0;for(let N of g.get(q)??[]){if(!z.has(N)||O.has(N))continue;O.set(N,F+1),K.push(N)}}let W=0;for(let q of $){if(O.has(q.id))continue;O.set(q.id,W),W+=1}let B=new Map;for(let q of $){let F=O.get(q.id)??0;if(!B.has(F))B.set(F,[]);B.get(F).push(q)}let k=Array.from(B.keys()).sort((q,F)=>q-F);for(let q of k)B.get(q).sort((F,N)=>F.sortKey.y-N.sortKey.y||F.sortKey.x-N.sortKey.x);let P=new Map,X=new Map,Y=0;for(let q of k){let F=B.get(q),N=F.reduce((p,r,n)=>p+r.size.height+(n>0?72:0),0),C=Math.max(...F.map((p)=>p.size.width));P.set(q,N),X.set(q,C),Y=Math.max(Y,N)}let H=new Map,L=0;for(let q of k){let F=B.get(q),N=P.get(q)??0,C=X.get(q)??0,p=Math.max(0,(Y-N)/2);for(let r of F)H.set(r.id,{x:L,y:p}),p+=r.size.height+72;L+=C+96}return{positions:H,size:{width:Math.max(0,L-96),height:Y},sortKey:$[0].sortKey}}function kk($){let v=new Map,g=40,_=80,U=0;for(let z of $){if(g>40&&g+z.size.width>3200)g=40,_+=U+180,U=0;for(let[J,b]of z.positions.entries())v.set(J,{x:g+b.x,y:_+b.y});g+=z.size.width+220,U=Math.max(U,z.size.height)}return v}function M2($,v,g){let{units:_,nodesById:U,nodeToUnit:z}=Ok($),J=new Map,b=new Map;if(_.length===0)return{nodePositions:J,groupBounds:b};let{outgoing:O,undirected:K,indegree:W,outdegree:B}=Kk(_,z,v),k=Wk(_,K).map((X)=>g==="graph"?Pk(X,O,K,W,B):Bk(X)),P=kk(k);for(let X of _){let Y=P.get(X.id);if(!Y)continue;let H=Y.x-X.origin.x,L=Y.y-X.origin.y;if(X.groupId){let N=[];for(let p of X.memberIds){let r=U.get(p);if(!r)continue;let n={x:r.position.x+H,y:r.position.y+L};J.set(p,n),N.push({position:n,size:r.size})}let C=CO(N);if(C)b.set(X.groupId,C);continue}let q=X.memberIds[0],F=U.get(q);if(!F)continue;J.set(q,{x:F.position.x+H,y:F.position.y+L})}return{nodePositions:J,groupBounds:b}}function Q2($,v){console.error(`[intent-bridge] ${$} failed`,v)}async function m$($,v,g,_){try{return await(await fetch(v,_)).json()}catch(U){return Q2($,U),g}}async function Hk($,v,g){try{return{ok:(await fetch(v,g)).ok}}catch(_){return Q2($,_),{ok:!1}}}async function fO($,v,g){try{await fetch(v,g)}catch(_){Q2($,_)}}async function mO($,v={}){return m$("sendIntent","/api/workbench/intent",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})})}async function S2($){let g=`Veto: do not ${$.label?.trim()||`${$.kind} intent`}${$.reason?` — ${$.reason}`:""}.`;if((await m$("vetoGhostIntent",`/api/canvas/ax/intent/${encodeURIComponent($.id)}`,{ok:!1,cleared:!1},{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({vetoed:!0})})).cleared!==!0)return!1;return await fO("vetoGhostSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:g,source:"browser"})}),!0}async function g6($){return(await m$("renderMarkdown","/api/render",{},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:$})})).html??""}async function TU($){return m$("fetchFile",`/api/file?path=${encodeURIComponent($)}`,{content:""})}async function cO($,v){return m$("saveFile","/api/file/save",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$,content:v})})}async function A_($){return Hk("openWorkbenchFile","/api/workbench/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})})}async function Z_($){return m$("saveCanvasTheme","/api/canvas/theme",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:$})})}async function EO(){return[]}async function jU($,v,g,_,U){if(!$.trim())return{ok:!1,error:"Prompt text is required"};return m$("submitCanvasPrompt","/api/canvas/prompt",{ok:!1,error:"Network error"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$,...v?{position:v}:{},...g?{parentNodeId:g}:{},..._&&_.length>0?{contextNodeIds:_}:{},...U?{threadNodeId:U}:{}})})}async function iO($,v){return jU(v,void 0,void 0,void 0,$)}async function lO($,v={}){await fO("pushCanvasUpdate","/api/canvas/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function A4($,v,g,_){return m$("createEdgeFromClient","/api/canvas/edge",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:$,to:v,type:g,label:_})})}async function Ev($){return m$("createNodeFromClient","/api/canvas/node",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function Zv($,v){return m$("updateNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}async function M_($,v){return m$("refreshWebpageNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}/refresh`,{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v?{url:v}:{})})}async function Q_($){return m$("removeNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"DELETE"})}async function xO(){return m$("fetchAxSurfaceState","/api/canvas/ax/surface-snapshot",null)}async function hO($,v){return m$("openNodeInSystemBrowserRequest","/api/canvas/open-external",{ok:!1,opened:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:$,url:v})})}async function S_($){return m$("submitAxInteractionFromClient","/api/canvas/ax/interaction",{ok:!1,code:"request-failed",error:"Request failed"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceSurface:"native-node",...$,source:"browser"})})}async function pO($,v={}){return m$("updateViewportFromClient","/api/canvas/viewport",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function N_($){return m$("createGroupFromClient","/api/canvas/group",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function oO($){return m$("ungroupFromClient","/api/canvas/group/ungroup",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupId:$})})}async function nO(){return m$("listSnapshots","/api/canvas/snapshots?all=true",[])}async function tO($){return m$("saveSnapshot","/api/canvas/snapshots",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})})}async function dO($){return m$("restoreSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"POST"})}async function aO($){return m$("deleteSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"DELETE"})}function VU($,v){console.error(`[canvas-store] ${$} failed`,v)}var P$=O$({x:0,y:0,scale:1}),T=O$(new Map),c$=O$(new Map),M4=O$(new Map),D$=O$(null),lv=O$("connecting"),$4=O$(""),u_=O$(!1),T$=O$("dark"),F6=O$(!1),A6=O$(null),j$=O$(null),iv=O$(null),Mv=null,Z4,sO=100,Ik=2500,y_=O$(null),uv=O$(null),Z6=O$(null),i$=O$(new Set),R$=O$(new Set);function vK($,v){if(!$)return new Set;let g=new Set;for(let _ of v.values()){if(_.from===$)g.add(_.to);if(_.to===$)g.add(_.from)}return g}var UK=e6(()=>vK(D$.value,c$.value));function eO($,v){let g=new Set;for(let _ of $)if(v.has(_))g.add(_);return g}function $K($,v){if($.size!==v.size)return!1;for(let g of $)if(!v.has(g))return!1;return!0}function gK($){let v=new Set(i$.value);if(v.has($))v.delete($);else v.add($);i$.value=v}function _K($){i$.value=new Set($)}function jv(){if(i$.value.size===0)return;i$.value=new Set}function Q4($){let v=new Set(R$.value);if(v.has($))v.delete($);else v.add($);R$.value=v,t$(),D_(v)}function zK($){let v=new Set(R$.value);for(let g of $)v.add(g);R$.value=v,t$(),D_(v)}function JK(){if(R$.value.size===0)return;R$.value=new Set,t$(),D_(new Set)}function bK($){R$.value=new Set($)}function GK(){let $=R$.value;if($.size===0)return[];return Array.from($).map((v)=>T.value.get(v)).filter((v)=>v!==void 0)}function D_($){fetch("/api/canvas/context-pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeIds:Array.from($)})}).catch((v)=>{VU("syncContextPinsToServer",v)})}var r_=1;function _6($){U6(()=>{let v=new Map(T.value);if($.zIndex>=r_)r_=$.zIndex+1;v.set($.id,$),T.value=v,D$.value=$.id})}function Pv($,v){r2($,v)}function r2($,v,g={}){let _=T.value.get($);if(!_)return;let U=new Map(T.value);if(_.type==="group"&&v.position&&g.skipGroupChildTranslation!==!0){let J=v.position.x-_.position.x,b=v.position.y-_.position.y;if(J!==0||b!==0){let O=Array.isArray(_.data.children)?_.data.children.filter((K)=>typeof K==="string"):[];for(let K of O){let W=U.get(K);if(!W||W.type==="group")continue;U.set(K,{...W,position:{x:W.position.x+J,y:W.position.y+b}})}}}U.set($,{..._,...v}),T.value=U;let z=U.get($)?.data.appCheckpoint?.updatedAt;if(iv.value===$&&z!==void 0&&z!==Z4)N2($)}function v$($,v){let g=T.value.get($);if(!g)return;Pv($,{data:{...g.data,...v}})}function S4($){Yk($);let v=new Map(T.value);if(v.delete($),T.value=v,D$.value===$)D$.value=null;if(j$.value===$)j$.value=null;if(i$.value.has($)){let g=new Set(i$.value);g.delete($),i$.value=g}if(R$.value.has($)){let g=new Set(R$.value);g.delete($),R$.value=g,D_(g)}}function R_($){let v=new Map(c$.value);v.set($.id,$),c$.value=v}function OK($){let v=new Map(c$.value);v.delete($),c$.value=v}function Yk($){let v=!1,g=new Map(c$.value);for(let[_,U]of g)if(U.from===$||U.to===$)g.delete(_),v=!0;if(v)c$.value=g}function Lk($){let v=new Map(M4.value);if(!v.delete($))return;M4.value=v}async function u2($){try{return{ok:(await fetch("/api/canvas/annotation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).ok}}catch(v){return VU("createAnnotationFromClient",v),{ok:!1}}}async function KK($){try{let v=await fetch(`/api/canvas/annotation/${encodeURIComponent($)}`,{method:"DELETE"});if(v.ok)Lk($);return{ok:v.ok}}catch(v){return VU("removeAnnotationFromClient",v),{ok:!1}}}function N4($,v){if(!T.value.get($))return;Pv($,{size:v})}function M6($){if(!T.value.get($))return;Pv($,{zIndex:r_++}),D$.value=$}function Q6($){let v=T.value.get($);if(!v)return;Pv($,{collapsed:!v.collapsed})}function WK(){for(let $ of T.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)Pv($.id,{collapsed:!0})}var T_=e6(()=>{for(let $ of T.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)return!0;return!1});function y2($,v){if(!T.value.get($))return;Pv($,{dockPosition:v}),t$()}function r4($){let v=T.value.get($);if(!v)return;let g=P$.value,_=(window.innerWidth/2-g.x)/g.scale,U=(window.innerHeight/2-g.y)/g.scale;Pv($,{dockPosition:null,position:{x:_-v.size.width/2,y:U-v.size.height/2}}),t$()}function BK($){P$.value={...P$.value,...$}}function PK($){P$.value=$}function kK($){HK($)}function HK($,v={}){P$.value=$,t$(v),pO($,v)}function IK($,v={}){let g=new Map,_=1;for(let B of $.nodes)if(g.set(B.id,B),B.zIndex>=_)_=B.zIndex+1;let U=$.edges.filter((B)=>g.has(B.from)&&g.has(B.to)),z=new Map;for(let B of U)z.set(B.id,B);let J=new Map;for(let B of $.annotations??[])J.set(B.id,B);let b=D$.value!==null&&g.has(D$.value)?D$.value:null,O=j$.value!==null&&g.has(j$.value)?j$.value:null,K=eO(i$.value,g),W=eO(R$.value,g);U6(()=>{if(v.applyViewport===!0&&$.viewport)P$.value=$.viewport;if(r_=_,T.value=g,c$.value=z,M4.value=J,D$.value=b,j$.value=O,!$K(i$.value,K))i$.value=K;if(!$K(R$.value,W))R$.value=W})}var w6=null;function qk($){return 1-(1-$)**3}function xv($,v=300,g={}){if(w6!==null)cancelAnimationFrame(w6);let _={...P$.value},U=performance.now();function z(J){let b=J-U,O=Math.min(1,b/v),K=qk(O);if(P$.value={x:_.x+($.x-_.x)*K,y:_.y+($.y-_.y)*K,scale:_.scale+($.scale-_.scale)*K},O<1)w6=requestAnimationFrame(z);else w6=null,HK($,g)}w6=requestAnimationFrame(z)}function u4(){if(w6!==null)cancelAnimationFrame(w6),w6=null}var YK="pmx-canvas-layout";function t$($={}){try{let v=Array.from(T.value.values()),g=v.map((U)=>({id:U.id,position:U.position,size:U.size,collapsed:U.collapsed,dockPosition:U.dockPosition})),_={viewport:P$.value,nodes:v.map((U)=>({id:U.id,type:U.type,position:U.position,size:U.size,collapsed:U.collapsed,pinned:U.pinned,dockPosition:U.dockPosition})),edges:Array.from(c$.value.values()).map((U)=>({id:U.id,from:U.from,to:U.to,type:U.type,label:U.label,style:U.style,animated:U.animated})),contextPinnedNodeIds:Array.from(R$.value)};localStorage.setItem(YK,JSON.stringify(_)),lO(g,$)}catch(v){VU("persistLayout",v)}}function D2(){try{let $=localStorage.getItem(YK);if(!$)return null;let v=JSON.parse($),g=Array.isArray(v.nodes)?v.nodes:[];if(g.length===0)return null;let _=new Map;for(let U of g){if(typeof U.id!=="string"||U.id.length===0)continue;_.set(U.id,{...U.position?{position:U.position}:{},...U.size?{size:U.size}:{},...U.collapsed!==void 0?{collapsed:U.collapsed}:{},...U.pinned!==void 0?{pinned:U.pinned}:{},...U.dockPosition!==void 0?{dockPosition:U.dockPosition}:{}})}return _.size>0?_:null}catch($){return VU("restoreLayout",$),null}}function j_($,v){let g=Array.from(T.value.values());if(g.length===0)return;let{POSITIVE_INFINITY:_,POSITIVE_INFINITY:U,NEGATIVE_INFINITY:z,NEGATIVE_INFINITY:J}=Number;for(let P of g)_=Math.min(_,P.position.x),U=Math.min(U,P.position.y),z=Math.max(z,P.position.x+P.size.width),J=Math.max(J,P.position.y+P.size.height);let b=60,O=z-_+b*2,K=J-U+b*2,W=Math.min(1,Math.min($/O,v/K)),B=(_+z)/2,k=(U+J)/2;xv({x:$/2-B*W,y:v/2-k*W,scale:W})}function Lv($,v={}){let g=T.value.get($);if(!g)return;let _=P$.value,U=g.position.x+g.size.width/2,z=g.position.y+g.size.height/2;xv({x:window.innerWidth/2-U*_.scale,y:window.innerHeight/2-z*_.scale,scale:_.scale},300,v),M6($)}function LK($=1){let v=Array.from(T.value.keys());if(v.length===0)return;let _=((D$.value?v.indexOf(D$.value):-1)+$+v.length)%v.length,U=v[_];M6(U),Lv(U)}function qK($){let v=D$.value;if(!v)return;let g=T.value.get(v);if(!g)return;let _=vK(v,c$.value);if(_.size===0)return;let U=g.position.x+g.size.width/2,z=g.position.y+g.size.height/2,J=null,b=-1/0;for(let O of _){let K=T.value.get(O);if(!K)continue;let W=K.position.x+K.size.width/2,B=K.position.y+K.size.height/2,k=W-U,P=B-z,X=Math.sqrt(k*k+P*P);if(X<1)continue;let Y;switch($){case"up":Y=-P;break;case"down":Y=P;break;case"left":Y=-k;break;case"right":Y=k;break}if(Y<=0)continue;let H=Y/X-X*0.001;if(H>b)b=H,J=O}if(J)Lv(J)}function z6($){if(!T.value.get($))return;if(Mv!==null)clearTimeout(Mv),Mv=null;iv.value=null,Z4=void 0,M6($),j$.value=$}function N2($){if(Mv!==null)clearTimeout(Mv),Mv=null;if(j$.value===$)j$.value=null;if(iv.value===$)iv.value=null;Z4=void 0}function v4(){let $=j$.value,v=$?T.value.get($):void 0;if($&&v&&VO(v)){let g=$,_=Date.now();if(iv.value=g,Z4=v.data.appCheckpoint?.updatedAt,Mv!==null)clearTimeout(Mv);let U=()=>{let J=T.value.get(g)?.data.appCheckpoint?.updatedAt;if(J!==void 0&&J!==Z4){N2(g);return}if(Date.now()-_>=Ik){N2(g);return}Mv=setTimeout(U,sO)};Mv=setTimeout(U,sO);return}if(Mv!==null)clearTimeout(Mv),Mv=null;iv.value=null,Z4=void 0,j$.value=null}function V_(){let $=M2(Array.from(T.value.values()),Array.from(c$.value.values()),"grid");if($.nodePositions.size===0&&$.groupBounds.size===0)return;U6(()=>{for(let[v,g]of $.nodePositions.entries())Pv(v,{position:g});for(let[v,g]of $.groupBounds.entries())r2(v,{position:{x:g.x,y:g.y},size:{width:g.width,height:g.height}},{skipGroupChildTranslation:!0})}),t$()}function C_(){let $=M2(Array.from(T.value.values()),Array.from(c$.value.values()),"graph");if($.nodePositions.size===0&&$.groupBounds.size===0)return;U6(()=>{for(let[v,g]of $.nodePositions.entries())Pv(v,{position:g});for(let[v,g]of $.groupBounds.entries())r2(v,{position:{x:g.x,y:g.y},size:{width:g.width,height:g.height}},{skipGroupChildTranslation:!0})}),t$()}var Xk=0;function G($,v,g,_,U,z){v||(v={});var J,b,O=v;if("ref"in O)for(b in O={},v)b=="ref"?J=v[b]:O[b]=v[b];var K={type:$,props:O,key:g,ref:J,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Xk,__i:-1,__u:0,__source:U,__self:z};if(typeof $=="function"&&(J=$.defaultProps))for(b in J)O[b]===void 0&&(O[b]=J[b]);return B$.vnode&&B$.vnode(K),K}function wk($){return new Date($).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function Fk(){WK(),L_()}function XK(){let $=RU.value;if($.length===0)return null;let v=X6.value,g=X4.value;if(!v&&T_.value)return null;if(!v)return G("button",{type:"button",class:"attention-history-tab",onClick:Fk,"aria-label":g>0?`Recent updates — ${g} new`:"Recent updates",title:g>0?`${g} new updates since last viewed`:"Recent updates",children:[G("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("span",{class:"attention-history-tab-label",children:"Updates"},void 0,!1,void 0,this),g>0&&G("span",{class:"attention-history-tab-badge","aria-hidden":"true",children:g>9?"9+":g},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("aside",{class:"attention-history","aria-label":"Recent semantic changes",children:[G("div",{class:"attention-history-header",children:[G("div",{class:"attention-history-header-text",children:[G("span",{class:"attention-history-title",children:"Recent Updates"},void 0,!1,void 0,this),G("span",{class:"attention-history-subtitle",children:"Focus and meaning shifts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("button",{type:"button",class:"attention-history-close",onClick:q_,"aria-label":"Collapse changes panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"attention-history-list",children:$.map((_)=>G("article",{class:`attention-history-entry attention-tone-${_.tone}`,children:[G("div",{class:"attention-history-meta",children:[G("span",{class:"attention-history-kind",children:_.title},void 0,!1,void 0,this),G("time",{class:"attention-history-time",dateTime:new Date(_.createdAt).toISOString(),children:wk(_.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("p",{class:"attention-history-detail",children:_.detail},void 0,!1,void 0,this)]},_.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wK(){let $=H_.value;if(!$)return null;return G("button",{type:"button",class:`attention-toast attention-tone-${$.tone}`,onClick:L_,"aria-label":`${$.title} — open change history`,title:$.detail||$.title,children:[G("span",{class:"attention-toast-dot","aria-hidden":"true"},void 0,!1,void 0,this),G("span",{class:"attention-toast-title",children:$.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ak=700,Zk=1600;function Mk($){return $.replace(/\r\n?/g,`
22
+ `}}};N6.tableCaption={filter:["caption"],replacement:()=>""};N6.tableColgroup={filter:["colgroup","col"],replacement:()=>""};N6.tableSection={filter:["thead","tbody","tfoot"],replacement:function($){return $}};function FY($){var v=$.parentNode;return v.nodeName==="THEAD"||v.firstChild===$&&(v.nodeName==="TABLE"||wY(v))&&IY.call($.childNodes,function(g){return g.nodeName==="TH"})}function wY($){var v=$.previousSibling;return $.nodeName==="TBODY"&&(!v||v.nodeName==="THEAD"&&/^\s*$/i.test(v.textContent))}function aO($,v=null,g=null){if(g===null)g=LY.call(v.parentNode.childNodes,v);var _=" ";if(g===0)_="| ";let U=$.trim().replace(/\n\r/g,"<br>").replace(/\n/g,"<br>");U=U.replace(/\|+/g,"\\|");while(U.length<3)U+=" ";if(v)U=QY(U,v," ");return _+U+" |"}function sO($){if(!$.childNodes)return!1;for(let v=0;v<$.childNodes.length;v++){let g=$.childNodes[v];if(g.nodeName==="TABLE")return!0;if(sO(g))return!0}return!1}var s2=($,v)=>{if(!$.childNodes)return!1;for(let g=0;g<$.childNodes.length;g++){let _=$.childNodes[g];if(v==="code"&&a2&&a2(_))return!0;if(v.includes(_.nodeName))return!0;if(s2(_,v))return!0}return!1},eO=($,v)=>{let g=["UL","OL","H1","H2","H3","H4","H5","H6","HR","BLOCKQUOTE"];if(v.preserveNestedTables)g.push("TABLE");return s2($,"code")||s2($,g)};function e2($){let v=lO.get($);if(v!==void 0)return v;let g=AY($);return lO.set($,g),g}function AY($){if(!$)return!0;if(!$.rows)return!0;if($.rows.length===1&&$.rows[0].childNodes.length<=1)return!0;if(sO($))return!0;return!1}function ZY($){let v=$.parentNode;while(v.nodeName!=="DIV")if(v=v.parentNode,!v)return null;return v}function $5($){let v=$.parentNode;while(v.nodeName!=="TABLE")if(v=v.parentNode,!v)return null;return v}function QY($,v,g){let _=v.getAttribute("colspan")||1;for(let U=1;U<_;U++)$+=" | "+g.repeat(3);return $}function v5($){let v=0;for(let g=0;g<$.rows.length;g++){let U=$.rows[g].childNodes.length;if(U>v)v=U}return v}function U5($){a2=$.isCodeBlock,nO=$.options,$.keep(function(g){if(g.nodeName==="TABLE"&&eO(g,$.options))return!0;return!1});for(var v in N6)$.addRule(v,N6[v])}function g5($){$.addRule("taskListItems",{filter:function(v){let g=v.parentNode,_=g.parentNode;return v.type==="checkbox"&&(g.nodeName==="LI"||g.nodeName==="LABEL"&&_&&_.nodeName==="LI")},replacement:function(v,g){return(g.checked?"[x]":"[ ]")+" "}})}function MY($){$.use([pO,oO,U5,g5])}_5.gfm=MY;_5.highlightedCodeBlock=pO;_5.strikethrough=oO;_5.tables=U5;_5.taskListItems=g5});if(typeof crypto<"u"&&typeof crypto.randomUUID!=="function")crypto.randomUUID=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let v=Math.random()*16|0;return($==="x"?v:v&3|8).toString(16)});var G_,P$,bK,q2,I6,_K,KK,OK,WK,X2,H2,L2,tP,__={},z_=[],dP=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,b_=Array.isArray;function $6($,v){for(var g in v)$[g]=v[g];return $}function F2($){$&&$.parentNode&&$.parentNode.removeChild($)}function aP($,v,g){var _,U,z,J={};for(z in v)z=="key"?_=v[z]:z=="ref"?U=v[z]:J[z]=v[z];if(arguments.length>2&&(J.children=arguments.length>3?G_.call(arguments,2):g),typeof $=="function"&&$.defaultProps!=null)for(z in $.defaultProps)J[z]===void 0&&(J[z]=$.defaultProps[z]);return g_($,J,_,U,null)}function g_($,v,g,_,U){var z={type:$,props:v,key:g,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:U==null?++bK:U,__i:-1,__u:0};return U==null&&P$.vnode!=null&&P$.vnode(z),z}function e$($){return $.children}function L4($,v){this.props=$,this.context=v}function I4($,v){if(v==null)return $.__?I4($.__,$.__i+1):null;for(var g;v<$.__k.length;v++)if((g=$.__k[v])!=null&&g.__e!=null)return g.__e;return typeof $.type=="function"?I4($):null}function sP($){if($.__P&&$.__d){var v=$.__v,g=v.__e,_=[],U=[],z=$6({},v);z.__v=v.__v+1,P$.vnode&&P$.vnode(z),w2($.__P,z,v,$.__n,$.__P.namespaceURI,32&v.__u?[g]:null,_,g==null?I4(v):g,!!(32&v.__u),U),z.__v=v.__v,z.__.__k[z.__i]=z,YK(_,z,U),v.__e=v.__=null,z.__e!=g&&BK(z)}}function BK($){if(($=$.__)!=null&&$.__c!=null)return $.__e=$.__c.base=null,$.__k.some(function(v){if(v!=null&&v.__e!=null)return $.__e=$.__c.base=v.__e}),BK($)}function zK($){(!$.__d&&($.__d=!0)&&I6.push($)&&!J_.__r++||_K!=P$.debounceRendering)&&((_K=P$.debounceRendering)||KK)(J_)}function J_(){try{for(var $,v=1;I6.length;)I6.length>v&&I6.sort(OK),$=I6.shift(),v=I6.length,sP($)}finally{I6.length=J_.__r=0}}function PK($,v,g,_,U,z,J,G,K,O,W){var B,k,P,X,L,Y,I,q=_&&_.__k||z_,w=v.length;for(K=eP(g,v,q,K,w),B=0;B<w;B++)(P=g.__k[B])!=null&&(k=P.__i!=-1&&q[P.__i]||__,P.__i=B,Y=w2($,P,k,U,z,J,G,K,O,W),X=P.__e,P.ref&&k.ref!=P.ref&&(k.ref&&A2(k.ref,null,P),W.push(P.ref,P.__c||X,P)),L==null&&X!=null&&(L=X),(I=!!(4&P.__u))||k.__k===P.__k?K=kK(P,K,$,I):typeof P.type=="function"&&Y!==void 0?K=Y:X&&(K=X.nextSibling),P.__u&=-7);return g.__e=L,K}function eP($,v,g,_,U){var z,J,G,K,O,W=g.length,B=W,k=0;for($.__k=Array(U),z=0;z<U;z++)(J=v[z])!=null&&typeof J!="boolean"&&typeof J!="function"?(typeof J=="string"||typeof J=="number"||typeof J=="bigint"||J.constructor==String?J=$.__k[z]=g_(null,J,null,null,null):b_(J)?J=$.__k[z]=g_(e$,{children:J},null,null,null):J.constructor===void 0&&J.__b>0?J=$.__k[z]=g_(J.type,J.props,J.key,J.ref?J.ref:null,J.__v):$.__k[z]=J,K=z+k,J.__=$,J.__b=$.__b+1,G=null,(O=J.__i=$k(J,g,K,B))!=-1&&(B--,(G=g[O])&&(G.__u|=2)),G==null||G.__v==null?(O==-1&&(U>W?k--:U<W&&k++),typeof J.type!="function"&&(J.__u|=4)):O!=K&&(O==K-1?k--:O==K+1?k++:(O>K?k--:k++,J.__u|=4))):$.__k[z]=null;if(B)for(z=0;z<W;z++)(G=g[z])!=null&&(2&G.__u)==0&&(G.__e==_&&(_=I4(G)),LK(G,G));return _}function kK($,v,g,_){var U,z;if(typeof $.type=="function"){for(U=$.__k,z=0;U&&z<U.length;z++)U[z]&&(U[z].__=$,v=kK(U[z],v,g,_));return v}$.__e!=v&&(_&&(v&&$.type&&!v.parentNode&&(v=I4($)),g.insertBefore($.__e,v||null)),v=$.__e);do v=v&&v.nextSibling;while(v!=null&&v.nodeType==8);return v}function $k($,v,g,_){var U,z,J,G=$.key,K=$.type,O=v[g],W=O!=null&&(2&O.__u)==0;if(O===null&&G==null||W&&G==O.key&&K==O.type)return g;if(_>(W?1:0)){for(U=g-1,z=g+1;U>=0||z<v.length;)if((O=v[J=U>=0?U--:z++])!=null&&(2&O.__u)==0&&G==O.key&&K==O.type)return J}return-1}function JK($,v,g){v[0]=="-"?$.setProperty(v,g==null?"":g):$[v]=g==null?"":typeof g!="number"||dP.test(v)?g:g+"px"}function U_($,v,g,_,U){var z,J;$:if(v=="style")if(typeof g=="string")$.style.cssText=g;else{if(typeof _=="string"&&($.style.cssText=_=""),_)for(v in _)g&&v in g||JK($.style,v,"");if(g)for(v in g)_&&g[v]==_[v]||JK($.style,v,g[v])}else if(v[0]=="o"&&v[1]=="n")z=v!=(v=v.replace(WK,"$1")),J=v.toLowerCase(),v=J in $||v=="onFocusOut"||v=="onFocusIn"?J.slice(2):v.slice(2),$.l||($.l={}),$.l[v+z]=g,g?_?g.u=_.u:(g.u=X2,$.addEventListener(v,z?L2:H2,z)):$.removeEventListener(v,z?L2:H2,z);else{if(U=="http://www.w3.org/2000/svg")v=v.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(v!="width"&&v!="height"&&v!="href"&&v!="list"&&v!="form"&&v!="tabIndex"&&v!="download"&&v!="rowSpan"&&v!="colSpan"&&v!="role"&&v!="popover"&&v in $)try{$[v]=g==null?"":g;break $}catch(G){}typeof g=="function"||(g==null||g===!1&&v[4]!="-"?$.removeAttribute(v):$.setAttribute(v,v=="popover"&&g==1?"":g))}}function GK($){return function(v){if(this.l){var g=this.l[v.type+$];if(v.t==null)v.t=X2++;else if(v.t<g.u)return;return g(P$.event?P$.event(v):v)}}}function w2($,v,g,_,U,z,J,G,K,O){var W,B,k,P,X,L,Y,I,q,w,S,C,o,y,n,e=v.type;if(v.constructor!==void 0)return null;128&g.__u&&(K=!!(32&g.__u),z=[G=v.__e=g.__e]),(W=P$.__b)&&W(v);$:if(typeof e=="function")try{if(I=v.props,q=e.prototype&&e.prototype.render,w=(W=e.contextType)&&_[W.__c],S=W?w?w.props.value:W.__:_,g.__c?Y=(B=v.__c=g.__c).__=B.__E:(q?v.__c=B=new e(I,S):(v.__c=B=new L4(I,S),B.constructor=e,B.render=Uk),w&&w.sub(B),B.state||(B.state={}),B.__n=_,k=B.__d=!0,B.__h=[],B._sb=[]),q&&B.__s==null&&(B.__s=B.state),q&&e.getDerivedStateFromProps!=null&&(B.__s==B.state&&(B.__s=$6({},B.__s)),$6(B.__s,e.getDerivedStateFromProps(I,B.__s))),P=B.props,X=B.state,B.__v=v,k)q&&e.getDerivedStateFromProps==null&&B.componentWillMount!=null&&B.componentWillMount(),q&&B.componentDidMount!=null&&B.__h.push(B.componentDidMount);else{if(q&&e.getDerivedStateFromProps==null&&I!==P&&B.componentWillReceiveProps!=null&&B.componentWillReceiveProps(I,S),v.__v==g.__v||!B.__e&&B.shouldComponentUpdate!=null&&B.shouldComponentUpdate(I,B.__s,S)===!1){v.__v!=g.__v&&(B.props=I,B.state=B.__s,B.__d=!1),v.__e=g.__e,v.__k=g.__k,v.__k.some(function(D){D&&(D.__=v)}),z_.push.apply(B.__h,B._sb),B._sb=[],B.__h.length&&J.push(B);break $}B.componentWillUpdate!=null&&B.componentWillUpdate(I,B.__s,S),q&&B.componentDidUpdate!=null&&B.__h.push(function(){B.componentDidUpdate(P,X,L)})}if(B.context=S,B.props=I,B.__P=$,B.__e=!1,C=P$.__r,o=0,q)B.state=B.__s,B.__d=!1,C&&C(v),W=B.render(B.props,B.state,B.context),z_.push.apply(B.__h,B._sb),B._sb=[];else do B.__d=!1,C&&C(v),W=B.render(B.props,B.state,B.context),B.state=B.__s;while(B.__d&&++o<25);B.state=B.__s,B.getChildContext!=null&&(_=$6($6({},_),B.getChildContext())),q&&!k&&B.getSnapshotBeforeUpdate!=null&&(L=B.getSnapshotBeforeUpdate(P,X)),y=W!=null&&W.type===e$&&W.key==null?HK(W.props.children):W,G=PK($,b_(y)?y:[y],v,g,_,U,z,J,G,K,O),B.base=v.__e,v.__u&=-161,B.__h.length&&J.push(B),Y&&(B.__E=B.__=null)}catch(D){if(v.__v=null,K||z!=null)if(D.then){for(v.__u|=K?160:128;G&&G.nodeType==8&&G.nextSibling;)G=G.nextSibling;z[z.indexOf(G)]=null,v.__e=G}else{for(n=z.length;n--;)F2(z[n]);I2(v)}else v.__e=g.__e,v.__k=g.__k,D.then||I2(v);P$.__e(D,v,g)}else z==null&&v.__v==g.__v?(v.__k=g.__k,v.__e=g.__e):G=v.__e=vk(g.__e,v,g,_,U,z,J,K,O);return(W=P$.diffed)&&W(v),128&v.__u?void 0:G}function I2($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(I2))}function YK($,v,g){for(var _=0;_<g.length;_++)A2(g[_],g[++_],g[++_]);P$.__c&&P$.__c(v,$),$.some(function(U){try{$=U.__h,U.__h=[],$.some(function(z){z.call(U)})}catch(z){P$.__e(z,U.__v)}})}function HK($){return typeof $!="object"||$==null||$.__b>0?$:b_($)?$.map(HK):$6({},$)}function vk($,v,g,_,U,z,J,G,K){var O,W,B,k,P,X,L,Y=g.props||__,I=v.props,q=v.type;if(q=="svg"?U="http://www.w3.org/2000/svg":q=="math"?U="http://www.w3.org/1998/Math/MathML":U||(U="http://www.w3.org/1999/xhtml"),z!=null){for(O=0;O<z.length;O++)if((P=z[O])&&"setAttribute"in P==!!q&&(q?P.localName==q:P.nodeType==3)){$=P,z[O]=null;break}}if($==null){if(q==null)return document.createTextNode(I);$=document.createElementNS(U,q,I.is&&I),G&&(P$.__m&&P$.__m(v,z),G=!1),z=null}if(q==null)Y===I||G&&$.data==I||($.data=I);else{if(z=z&&G_.call($.childNodes),!G&&z!=null)for(Y={},O=0;O<$.attributes.length;O++)Y[(P=$.attributes[O]).name]=P.value;for(O in Y)P=Y[O],O=="dangerouslySetInnerHTML"?B=P:O=="children"||(O in I)||O=="value"&&("defaultValue"in I)||O=="checked"&&("defaultChecked"in I)||U_($,O,null,P,U);for(O in I)P=I[O],O=="children"?k=P:O=="dangerouslySetInnerHTML"?W=P:O=="value"?X=P:O=="checked"?L=P:G&&typeof P!="function"||Y[O]===P||U_($,O,P,Y[O],U);if(W)G||B&&(W.__html==B.__html||W.__html==$.innerHTML)||($.innerHTML=W.__html),v.__k=[];else if(B&&($.innerHTML=""),PK(v.type=="template"?$.content:$,b_(k)?k:[k],v,g,_,q=="foreignObject"?"http://www.w3.org/1999/xhtml":U,z,J,z?z[0]:g.__k&&I4(g,0),G,K),z!=null)for(O=z.length;O--;)F2(z[O]);G||(O="value",q=="progress"&&X==null?$.removeAttribute("value"):X!=null&&(X!==$[O]||q=="progress"&&!X||q=="option"&&X!=Y[O])&&U_($,O,X,Y[O],U),O="checked",L!=null&&L!=$[O]&&U_($,O,L,Y[O],U))}return $}function A2($,v,g){try{if(typeof $=="function"){var _=typeof $.__u=="function";_&&$.__u(),_&&v==null||($.__u=$(v))}else $.current=v}catch(U){P$.__e(U,g)}}function LK($,v,g){var _,U;if(P$.unmount&&P$.unmount($),(_=$.ref)&&(_.current&&_.current!=$.__e||A2(_,null,v)),(_=$.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(z){P$.__e(z,v)}_.base=_.__P=null}if(_=$.__k)for(U=0;U<_.length;U++)_[U]&&LK(_[U],v,g||typeof $.type!="function");g||F2($.__e),$.__c=$.__=$.__e=void 0}function Uk($,v,g){return this.constructor($,g)}function IK($,v,g){var _,U,z,J;v==document&&(v=document.documentElement),P$.__&&P$.__($,v),U=(_=typeof g=="function")?null:g&&g.__k||v.__k,z=[],J=[],w2(v,$=(!_&&g||v).__k=aP(e$,null,[$]),U||__,__,v.namespaceURI,!_&&g?[g]:U?null:v.firstChild?G_.call(v.childNodes):null,z,!_&&g?g:U?U.__e:v.firstChild,_,J),YK(z,$,J)}G_=z_.slice,P$={__e:function($,v,g,_){for(var U,z,J;v=v.__;)if((U=v.__c)&&!U.__)try{if((z=U.constructor)&&z.getDerivedStateFromError!=null&&(U.setState(z.getDerivedStateFromError($)),J=U.__d),U.componentDidCatch!=null&&(U.componentDidCatch($,_||{}),J=U.__d),J)return U.__E=U}catch(G){$=G}throw $}},bK=0,q2=function($){return $!=null&&$.constructor===void 0},L4.prototype.setState=function($,v){var g;g=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$6({},this.state),typeof $=="function"&&($=$($6({},g),this.props)),$&&$6(g,$),$!=null&&this.__v&&(v&&this._sb.push(v),zK(this))},L4.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),zK(this))},L4.prototype.render=e$,I6=[],KK=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,OK=function($,v){return $.__v.__b-v.__v.__b},J_.__r=0,WK=/(PointerCapture)$|Capture$/i,X2=0,H2=GK(!1),L2=GK(!0),tP=0;var q4,f$,Z2,qK,TU=0,SK=[],c$=P$,XK=c$.__b,FK=c$.__r,wK=c$.diffed,AK=c$.__c,ZK=c$.unmount,QK=c$.__;function O_($,v){c$.__h&&c$.__h(f$,$,TU||v),TU=0;var g=f$.__H||(f$.__H={__:[],__h:[]});return $>=g.__.length&&g.__.push({}),g.__[$]}function h($){return TU=1,gk(NK,$)}function gk($,v,g){var _=O_(q4++,2);if(_.t=$,!_.__c&&(_.__=[g?g(v):NK(void 0,v),function(G){var K=_.__N?_.__N[0]:_.__[0],O=_.t(K,G);K!==O&&(_.__N=[O,_.__[1]],_.__c.setState({}))}],_.__c=f$,!f$.__f)){var U=function(G,K,O){if(!_.__c.__H)return!0;var W=_.__c.__H.__.filter(function(k){return k.__c});if(W.every(function(k){return!k.__N}))return!z||z.call(this,G,K,O);var B=_.__c.props!==G;return W.some(function(k){if(k.__N){var P=k.__[0];k.__=k.__N,k.__N=void 0,P!==k.__[0]&&(B=!0)}}),z&&z.call(this,G,K,O)||B};f$.__f=!0;var{shouldComponentUpdate:z,componentWillUpdate:J}=f$;f$.componentWillUpdate=function(G,K,O){if(this.__e){var W=z;z=void 0,U(G,K,O),z=W}J&&J.call(this,G,K,O)},f$.shouldComponentUpdate=U}return _.__N||_.__}function E($,v){var g=O_(q4++,3);!c$.__s&&M2(g.__H,v)&&(g.__=$,g.u=v,f$.__H.__h.push(g))}function W_($,v){var g=O_(q4++,4);!c$.__s&&M2(g.__H,v)&&(g.__=$,g.u=v,f$.__h.push(g))}function R($){return TU=5,t$(function(){return{current:$}},[])}function t$($,v){var g=O_(q4++,7);return M2(g.__H,v)&&(g.__=$(),g.__H=v,g.__h=$),g.__}function M($,v){return TU=8,t$(function(){return $},v)}function _k(){for(var $;$=SK.shift();){var v=$.__H;if($.__P&&v)try{v.__h.some(K_),v.__h.some(Q2),v.__h=[]}catch(g){v.__h=[],c$.__e(g,$.__v)}}}c$.__b=function($){f$=null,XK&&XK($)},c$.__=function($,v){$&&v.__k&&v.__k.__m&&($.__m=v.__k.__m),QK&&QK($,v)},c$.__r=function($){FK&&FK($),q4=0;var v=(f$=$.__c).__H;v&&(Z2===f$?(v.__h=[],f$.__h=[],v.__.some(function(g){g.__N&&(g.__=g.__N),g.u=g.__N=void 0})):(v.__h.some(K_),v.__h.some(Q2),v.__h=[],q4=0)),Z2=f$},c$.diffed=function($){wK&&wK($);var v=$.__c;v&&v.__H&&(v.__H.__h.length&&(SK.push(v)!==1&&qK===c$.requestAnimationFrame||((qK=c$.requestAnimationFrame)||zk)(_k)),v.__H.__.some(function(g){g.u&&(g.__H=g.u),g.u=void 0})),Z2=f$=null},c$.__c=function($,v){v.some(function(g){try{g.__h.some(K_),g.__h=g.__h.filter(function(_){return!_.__||Q2(_)})}catch(_){v.some(function(U){U.__h&&(U.__h=[])}),v=[],c$.__e(_,g.__v)}}),AK&&AK($,v)},c$.unmount=function($){ZK&&ZK($);var v,g=$.__c;g&&g.__H&&(g.__H.__.some(function(_){try{K_(_)}catch(U){v=U}}),g.__H=void 0,v&&c$.__e(v,g.__v))};var MK=typeof requestAnimationFrame=="function";function zk($){var v,g=function(){clearTimeout(_),MK&&cancelAnimationFrame(v),setTimeout($)},_=setTimeout(g,35);MK&&(v=requestAnimationFrame(g))}function K_($){var v=f$,g=$.__c;typeof g=="function"&&($.__c=void 0,g()),f$=v}function Q2($){var v=f$;$.__c=$.__(),f$=v}function M2($,v){return!$||$.length!==v.length||v.some(function(g,_){return g!==$[_]})}function NK($,v){return typeof v=="function"?v($):v}var Jk=Symbol.for("preact-signals");function Y_(){if(!(v6>1)){var $,v=!1;(function(){var U=P_;P_=void 0;while(U!==void 0){if(U.S.v===U.v)U.S.i=U.i;U=U.o}})();while(jU!==void 0){var g=jU;jU=void 0,B_++;while(g!==void 0){var _=g.u;if(g.u=void 0,g.f&=-3,!(8&g.f)&&RK(g))try{g.c()}catch(U){if(!v)$=U,v=!0}g=_}}if(B_=0,v6--,v)throw $}else v6--}function U6($){if(v6>0)return $();S2=++Gk,v6++;try{return $()}finally{Y_()}}var X$=void 0;function N2($){var v=X$;X$=void 0;try{return $()}finally{X$=v}}var yK,jU=void 0,v6=0,B_=0,Gk=0,S2=0,P_=void 0,k_=0;function DK($){if(X$!==void 0){var v=$.n;if(v===void 0||v.t!==X$){if(v={i:0,S:$,p:X$.s,n:void 0,t:X$,e:void 0,x:void 0,r:v},X$.s!==void 0)X$.s.n=v;if(X$.s=v,$.n=v,32&X$.f)$.S(v);return v}else if(v.i===-1){if(v.i=0,v.n!==void 0){if(v.n.p=v.p,v.p!==void 0)v.p.n=v.n;v.p=X$.s,v.n=void 0,X$.s.n=v,X$.s=v}return v}}}function o$($,v){this.v=$,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}o$.prototype.brand=Jk;o$.prototype.h=function(){return!0};o$.prototype.S=function($){var v=this,g=this.t;if(g!==$&&$.e===void 0)if($.x=g,this.t=$,g!==void 0)g.e=$;else N2(function(){var _;(_=v.W)==null||_.call(v)})};o$.prototype.U=function($){var v=this;if(this.t!==void 0){var{e:g,x:_}=$;if(g!==void 0)g.x=_,$.e=void 0;if(_!==void 0)_.e=g,$.x=void 0;if($===this.t){if(this.t=_,_===void 0)N2(function(){var U;(U=v.Z)==null||U.call(v)})}}};o$.prototype.subscribe=function($){var v=this;return q6(function(){var g=v.value,_=X$;X$=void 0;try{$(g)}finally{X$=_}},{name:"sub"})};o$.prototype.valueOf=function(){return this.value};o$.prototype.toString=function(){return this.value+""};o$.prototype.toJSON=function(){return this.value};o$.prototype.peek=function(){var $=X$;X$=void 0;try{return this.value}finally{X$=$}};Object.defineProperty(o$.prototype,"value",{get:function(){var $=DK(this);if($!==void 0)$.i=this.i;return this.v},set:function($){if($!==this.v){if(B_>100)throw Error("Cycle detected");(function(g){if(v6!==0&&B_===0){if(g.l!==S2)g.l=S2,P_={S:g,v:g.v,i:g.i,o:P_}}})(this),this.v=$,this.i++,k_++,v6++;try{for(var v=this.t;v!==void 0;v=v.x)v.t.N()}finally{Y_()}}}});function z$($,v){return new o$($,v)}function RK($){for(var v=$.s;v!==void 0;v=v.n)if(v.S.i!==v.i||!v.S.h()||v.S.i!==v.i)return!0;return!1}function uK($){for(var v=$.s;v!==void 0;v=v.n){var g=v.S.n;if(g!==void 0)v.r=g;if(v.S.n=v,v.i=-1,v.n===void 0){$.s=v;break}}}function TK($){var v=$.s,g=void 0;while(v!==void 0){var _=v.p;if(v.i===-1){if(v.S.U(v),_!==void 0)_.n=v.n;if(v.n!==void 0)v.n.p=_}else g=v;if(v.S.n=v.r,v.r!==void 0)v.r=void 0;v=_}$.s=g}function $4($,v){o$.call(this,void 0),this.x=$,this.s=void 0,this.g=k_-1,this.f=4,this.W=v==null?void 0:v.watched,this.Z=v==null?void 0:v.unwatched,this.name=v==null?void 0:v.name}$4.prototype=new o$;$4.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32)return!0;if(this.f&=-5,this.g===k_)return!0;if(this.g=k_,this.f|=1,this.i>0&&!RK(this))return this.f&=-2,!0;var $=X$;try{uK(this),X$=this;var v=this.x();if(16&this.f||this.v!==v||this.i===0)this.v=v,this.f&=-17,this.i++}catch(g){this.v=g,this.f|=16,this.i++}return X$=$,TK(this),this.f&=-2,!0};$4.prototype.S=function($){if(this.t===void 0){this.f|=36;for(var v=this.s;v!==void 0;v=v.n)v.S.S(v)}o$.prototype.S.call(this,$)};$4.prototype.U=function($){if(this.t!==void 0){if(o$.prototype.U.call(this,$),this.t===void 0){this.f&=-33;for(var v=this.s;v!==void 0;v=v.n)v.S.U(v)}}};$4.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var $=this.t;$!==void 0;$=$.x)$.t.N()}};Object.defineProperty($4.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var $=DK(this);if(this.h(),$!==void 0)$.i=this.i;if(16&this.f)throw this.v;return this.v}});function v4($,v){return new $4($,v)}function jK($){var v=$.m;if($.m=void 0,typeof v=="function"){v6++;var g=X$;X$=void 0;try{v()}catch(_){throw $.f&=-2,$.f|=8,y2($),_}finally{X$=g,Y_()}}}function y2($){for(var v=$.s;v!==void 0;v=v.n)v.S.U(v);$.x=void 0,$.s=void 0,jK($)}function bk($){if(X$!==this)throw Error("Out-of-order effect");if(TK(this),X$=$,this.f&=-2,8&this.f)y2(this);Y_()}function X4($,v){if(this.x=$,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=v==null?void 0:v.name,yK)yK.push(this)}X4.prototype.c=function(){var $=this.S();try{if(8&this.f)return;if(this.x===void 0)return;var v=this.x();if(typeof v=="function")this.m=v}finally{$()}};X4.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,jK(this),uK(this),v6++;var $=X$;return X$=this,bk.bind(this,$)};X4.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=jU,jU=this};X4.prototype.d=function(){if(this.f|=8,!(1&this.f))y2(this)};X4.prototype.dispose=function(){this.d()};function q6($,v){var g=new X4($,v);try{g.c()}catch(U){throw g.d(),U}var _=g.d.bind(g);return _[Symbol.dispose]=_,_}var D2,R2,H_,Kk=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,rK=[],VK=[];q6(function(){D2=this.N})();function F4($,v){P$[$]=v.bind(null,P$[$]||function(){})}function L_($){if(H_){var v=H_;H_=void 0,v()}H_=$&&$.S()}function CK($){var v=this,g=$.data,_=Wk(g);_.value=g;var U=t$(function(){var G=v,K=v.__v;while(K=K.__)if(K.__c){K.__c.__$f|=4;break}var O=v4(function(){var P=_.value.value;return P===0?0:P===!0?"":P||""}),W=v4(function(){return!Array.isArray(O.value)&&!q2(O.value)}),B=q6(function(){if(this.N=fK,W.value){var P=O.value;if(G.__v&&G.__v.__e&&G.__v.__e.nodeType===3)G.__v.__e.data=P}}),k=v.__$u.d;return v.__$u.d=function(){B(),k.call(this)},[W,O]},[]),z=U[0],J=U[1];return z.value?J.peek():J.value}CK.displayName="ReactiveTextNode";Object.defineProperties(o$.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:CK},props:{configurable:!0,get:function(){var $=this;return{data:{get value(){return $.value}}}}},__b:{configurable:!0,value:1}});F4("__b",function($,v){if(typeof v.type=="string"){var g,_=v.props;for(var U in _)if(U!=="children"){var z=_[U];if(z instanceof o$){if(!g)v.__np=g={};g[U]=z,_[U]=z.peek()}}}$(v)});F4("__r",function($,v){if($(v),v.type!==e$){L_();var g,_=v.__c;if(_){if(_.__$f&=-2,(g=_.__$u)===void 0)_.__$u=g=function(U,z){var J;return q6(function(){J=this},{name:z}),J.c=U,J}(function(){var U;if(Kk)(U=g.y)==null||U.call(g);_.__$f|=1,_.setState({})},typeof v.type=="function"?v.type.displayName||v.type.name:"")}R2=_,L_(g)}});F4("__e",function($,v,g,_){L_(),R2=void 0,$(v,g,_)});F4("diffed",function($,v){L_(),R2=void 0;var g;if(typeof v.type=="string"&&(g=v.__e)){var{__np:_,props:U}=v;if(_){var z=g.U;if(z)for(var J in z){var G=z[J];if(G!==void 0&&!(J in _))G.d(),z[J]=void 0}else z={},g.U=z;for(var K in _){var O=z[K],W=_[K];if(O===void 0)O=Ok(g,K,W),z[K]=O;else O.o(W,U)}for(var B in _)U[B]=_[B]}}$(v)});function Ok($,v,g,_){var U=v in $&&$.ownerSVGElement===void 0,z=z$(g),J=g.peek();return{o:function(G,K){z.value=G,J=G.peek()},d:q6(function(){this.N=fK;var G=z.value.value;if(J!==G)if(J=void 0,U)$[v]=G;else if(G!=null&&(G!==!1||v[4]==="-"))$.setAttribute(v,G);else $.removeAttribute(v);else J=void 0})}}F4("unmount",function($,v){if(typeof v.type=="string"){var g=v.__e;if(g){var _=g.U;if(_){g.U=void 0;for(var U in _){var z=_[U];if(z)z.d()}}}v.__np=void 0}else{var J=v.__c;if(J){var G=J.__$u;if(G)J.__$u=void 0,G.d()}}$(v)});F4("__h",function($,v,g,_){if(_<3||_===9)v.__$f|=2;$(v,g,_)});L4.prototype.shouldComponentUpdate=function($,v){if(this.__R)return!0;var g=this.__$u,_=g&&g.s!==void 0;for(var U in v)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var z=2&this.__$f;if(!(_||z||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(_||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var J in $)if(J!=="__source"&&$[J]!==this.props[J])return!0;for(var G in this.props)if(!(G in $))return!0;return!1};function Wk($,v){return t$(function(){return z$($,v)},[])}var Bk=typeof requestAnimationFrame>"u"?setTimeout:function($){var v=function(){clearTimeout(g),cancelAnimationFrame(_),$()},g=setTimeout(v,35),_=requestAnimationFrame(v)},Pk=function($){queueMicrotask(function(){queueMicrotask($)})};function kk(){U6(function(){var $;while($=rK.shift())D2.call($)})}function Yk(){if(rK.push(this)===1)(P$.requestAnimationFrame||Bk)(kk)}function Hk(){U6(function(){var $;while($=VK.shift())D2.call($)})}function fK(){if(VK.push(this)===1)(P$.requestAnimationFrame||Pk)(Hk)}function EK($,v){var g=R($);g.current=$,E(function(){return q6(function(){return this.N=Yk,g.current()},v)},[])}var I_=z$(null),rU=z$([]),A4=z$(new Set),Z4=z$(new Set),q_=z$([]),X_=z$(new Set),X6=z$(!1),w4=z$(0);function mK(){I_.value=null,rU.value=[],A4.value=new Set,Z4.value=new Set,q_.value=[],X_.value=new Set,X6.value=!1,w4.value=0}function F_(){X6.value=!0,w4.value=0}function w_(){X6.value=!1}function cK($,v,g){A4.value=new Set($),Z4.value=new Set(v),q_.value=g}function A_($){I_.value=$}function iK($,v=6){if(rU.value=[$,...rU.value].slice(0,v),!X6.value)w4.value=Math.min(99,w4.value+1)}function Z_($){X_.value=new Set($)}var $v={markdown:"MD","mcp-app":"APP",webpage:"WEB","json-render":"UI",graph:"GRAPH",prompt:"ASK",response:"ANS",status:"STATUS",context:"CONTEXT",ledger:"LOG",trace:"TRACE",file:"FILE",image:"IMG",html:"HTML",group:"GROUP"},Q_=new Set(["markdown","mcp-app","webpage","json-render","graph","context","ledger","file","image","html"]);function xK($){return $.type==="mcp-app"&&$.data.mode==="ext-app"&&$.data.serverName==="Excalidraw"&&$.data.toolName==="create_view"}function hK($){if($.length===0)return null;let{POSITIVE_INFINITY:v,POSITIVE_INFINITY:g,NEGATIVE_INFINITY:_,NEGATIVE_INFINITY:U}=Number;for(let z of $)v=Math.min(v,z.position.x),g=Math.min(g,z.position.y),_=Math.max(_,z.position.x+z.size.width),U=Math.max(U,z.position.y+z.size.height);if(!Number.isFinite(v)||!Number.isFinite(g))return null;return{x:v-40,y:g-40-32,width:_-v+80,height:U-g+80+32}}function Lk($){let v=$.filter((K)=>!K.pinned&&K.dockPosition===null),g=new Map(v.map((K)=>[K.id,K])),_=new Map,U=[],z=new Map;for(let K of v){if(K.type==="group")continue;let O=typeof K.data.parentGroup==="string"?K.data.parentGroup:"",W=O?g.get(O):void 0;if(!W||W.type!=="group")continue;if(!z.has(O))z.set(O,[]);z.get(O).push(K)}let J=v.filter((K)=>K.type==="group").sort((K,O)=>K.position.y-O.position.y||K.position.x-O.position.x);for(let K of J){let O=z.get(K.id)??[];if(O.length===0){let P=`unit:${K.id}`;U.push({id:P,memberIds:[K.id],origin:{...K.position},size:{...K.size},sortKey:{x:K.position.x,y:K.position.y}}),_.set(K.id,P);continue}let W=O.map((P)=>({position:P.position,size:P.size})),B=hK(W);if(!B)continue;let k=`group:${K.id}`;U.push({id:k,memberIds:O.map((P)=>P.id),origin:{x:B.x,y:B.y},size:{width:B.width,height:B.height},sortKey:{x:B.x,y:B.y},groupId:K.id}),_.set(K.id,k);for(let P of O)_.set(P.id,k)}let G=v.filter((K)=>!_.has(K.id)).sort((K,O)=>K.position.y-O.position.y||K.position.x-O.position.x);for(let K of G){let O=`unit:${K.id}`;U.push({id:O,memberIds:[K.id],origin:{...K.position},size:{...K.size},sortKey:{x:K.position.x,y:K.position.y}}),_.set(K.id,O)}return{units:U,nodesById:g,nodeToUnit:_}}function Ik($,v,g){let _=new Map,U=new Map,z=new Map,J=new Map;for(let G of $)_.set(G.id,new Set),U.set(G.id,new Set),z.set(G.id,0),J.set(G.id,0);for(let G of g){let K=v.get(G.from),O=v.get(G.to);if(!K||!O||K===O)continue;if(!_.get(K).has(O))_.get(K).add(O),J.set(K,(J.get(K)??0)+1),z.set(O,(z.get(O)??0)+1);U.get(K).add(O),U.get(O).add(K)}return{outgoing:_,undirected:U,indegree:z,outdegree:J}}function qk($,v){let g=new Map($.map((z)=>[z.id,z])),_=new Set,U=[];for(let z of $){if(_.has(z.id))continue;let J=[z.id],G=[];_.add(z.id);while(J.length>0){let O=J.pop();G.push(O);for(let W of v.get(O)??[]){if(_.has(W))continue;_.add(W),J.push(W)}}let K=G.map((O)=>g.get(O)).filter((O)=>O!==void 0).sort((O,W)=>O.sortKey.y-W.sortKey.y||O.sortKey.x-W.sortKey.x);U.push(K)}return U.sort((z,J)=>z[0].sortKey.y-J[0].sortKey.y||z[0].sortKey.x-J[0].sortKey.x)}function Xk($){let v=new Map,g=0,_=0,U=0,z=0,J=Math.max(900,Math.ceil(Math.sqrt($.reduce((G,K)=>G+K.size.width*K.size.height,0))));for(let G of $){if(g>0&&g+G.size.width>J)g=0,_+=U+72,U=0;v.set(G.id,{x:g,y:_}),g+=G.size.width+96,U=Math.max(U,G.size.height),z=Math.max(z,g-96)}return{positions:v,size:{width:Math.max(0,z),height:_+U},sortKey:$[0].sortKey}}function Fk($,v,g,_,U){if($.length===1)return{positions:new Map([[$[0].id,{x:0,y:0}]]),size:{...$[0].size},sortKey:$[0].sortKey};let z=new Set($.map((q)=>q.id)),J=$.filter((q)=>(_.get(q.id)??0)===0&&(U.get(q.id)??0)>0).sort((q,w)=>q.sortKey.x-w.sortKey.x||q.sortKey.y-w.sortKey.y),G=J.length>0?J:[$.slice().sort((q,w)=>q.sortKey.x-w.sortKey.x||q.sortKey.y-w.sortKey.y)[0]],K=new Map,O=G.map((q)=>q.id);for(let q of G)K.set(q.id,0);while(O.length>0){let q=O.shift(),w=K.get(q)??0;for(let S of g.get(q)??[]){if(!z.has(S)||K.has(S))continue;K.set(S,w+1),O.push(S)}}let W=0;for(let q of $){if(K.has(q.id))continue;K.set(q.id,W),W+=1}let B=new Map;for(let q of $){let w=K.get(q.id)??0;if(!B.has(w))B.set(w,[]);B.get(w).push(q)}let k=Array.from(B.keys()).sort((q,w)=>q-w);for(let q of k)B.get(q).sort((w,S)=>w.sortKey.y-S.sortKey.y||w.sortKey.x-S.sortKey.x);let P=new Map,X=new Map,L=0;for(let q of k){let w=B.get(q),S=w.reduce((o,y,n)=>o+y.size.height+(n>0?72:0),0),C=Math.max(...w.map((o)=>o.size.width));P.set(q,S),X.set(q,C),L=Math.max(L,S)}let Y=new Map,I=0;for(let q of k){let w=B.get(q),S=P.get(q)??0,C=X.get(q)??0,o=Math.max(0,(L-S)/2);for(let y of w)Y.set(y.id,{x:I,y:o}),o+=y.size.height+72;I+=C+96}return{positions:Y,size:{width:Math.max(0,I-96),height:L},sortKey:$[0].sortKey}}function wk($){let v=new Map,g=40,_=80,U=0;for(let z of $){if(g>40&&g+z.size.width>3200)g=40,_+=U+180,U=0;for(let[J,G]of z.positions.entries())v.set(J,{x:g+G.x,y:_+G.y});g+=z.size.width+220,U=Math.max(U,z.size.height)}return v}function u2($,v,g){let{units:_,nodesById:U,nodeToUnit:z}=Lk($),J=new Map,G=new Map;if(_.length===0)return{nodePositions:J,groupBounds:G};let{outgoing:K,undirected:O,indegree:W,outdegree:B}=Ik(_,z,v),k=qk(_,O).map((X)=>g==="graph"?Fk(X,K,O,W,B):Xk(X)),P=wk(k);for(let X of _){let L=P.get(X.id);if(!L)continue;let Y=L.x-X.origin.x,I=L.y-X.origin.y;if(X.groupId){let S=[];for(let o of X.memberIds){let y=U.get(o);if(!y)continue;let n={x:y.position.x+Y,y:y.position.y+I};J.set(o,n),S.push({position:n,size:y.size})}let C=hK(S);if(C)G.set(X.groupId,C);continue}let q=X.memberIds[0],w=U.get(q);if(!w)continue;J.set(q,{x:w.position.x+Y,y:w.position.y+I})}return{nodePositions:J,groupBounds:G}}function T2($,v){console.error(`[intent-bridge] ${$} failed`,v)}async function E$($,v,g,_){try{return await(await fetch(v,_)).json()}catch(U){return T2($,U),g}}async function Ak($,v,g){try{return{ok:(await fetch(v,g)).ok}}catch(_){return T2($,_),{ok:!1}}}async function lK($,v,g){try{await fetch(v,g)}catch(_){T2($,_)}}async function pK($,v={}){return E$("sendIntent","/api/workbench/intent",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})})}async function j2($){let g=`Veto: do not ${$.label?.trim()||`${$.kind} intent`}${$.reason?` — ${$.reason}`:""}.`;if((await E$("vetoGhostIntent",`/api/canvas/ax/intent/${encodeURIComponent($.id)}`,{ok:!1,cleared:!1},{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({vetoed:!0})})).cleared!==!0)return!1;return await lK("vetoGhostSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:g,source:"browser"})}),!0}async function g6($){return(await E$("renderMarkdown","/api/render",{},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:$})})).html??""}async function VU($){return E$("fetchFile",`/api/file?path=${encodeURIComponent($)}`,{content:""})}async function oK($,v){return E$("saveFile","/api/file/save",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$,content:v})})}async function M_($){return Ak("openWorkbenchFile","/api/workbench/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})})}async function S_($){return E$("saveCanvasTheme","/api/canvas/theme",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:$})})}async function nK(){return[]}async function CU($,v,g,_,U){if(!$.trim())return{ok:!1,error:"Prompt text is required"};return E$("submitCanvasPrompt","/api/canvas/prompt",{ok:!1,error:"Network error"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$,...v?{position:v}:{},...g?{parentNodeId:g}:{},..._&&_.length>0?{contextNodeIds:_}:{},...U?{threadNodeId:U}:{}})})}async function tK($,v){return CU(v,void 0,void 0,void 0,$)}async function dK($,v={}){await lK("pushCanvasUpdate","/api/canvas/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function Q4($,v,g,_){return E$("createEdgeFromClient","/api/canvas/edge",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:$,to:v,type:g,label:_})})}async function cv($){return E$("createNodeFromClient","/api/canvas/node",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function Zv($,v){return E$("updateNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}async function N_($,v){return E$("refreshWebpageNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}/refresh`,{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v?{url:v}:{})})}async function y_($){return E$("removeNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"DELETE"})}async function aK(){return E$("fetchAxSurfaceState","/api/canvas/ax/surface-snapshot",null)}async function sK($,v){return E$("openNodeInSystemBrowserRequest","/api/canvas/open-external",{ok:!1,opened:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:$,url:v})})}async function D_($){return E$("submitAxInteractionFromClient","/api/canvas/ax/interaction",{ok:!1,code:"request-failed",error:"Request failed"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceSurface:"native-node",...$,source:"browser"})})}async function eK($,v={}){return E$("updateViewportFromClient","/api/canvas/viewport",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function R_($){return E$("createGroupFromClient","/api/canvas/group",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function $O($){return E$("ungroupFromClient","/api/canvas/group/ungroup",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupId:$})})}async function vO(){return E$("listSnapshots","/api/canvas/snapshots?all=true",[])}async function UO($){return E$("saveSnapshot","/api/canvas/snapshots",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})})}async function gO($){return E$("restoreSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"POST"})}async function _O($){return E$("deleteSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"DELETE"})}function fU($,v){console.error(`[canvas-store] ${$} failed`,v)}var k$=z$({x:0,y:0,scale:1}),j=z$(new Map),m$=z$(new Map),S4=z$(new Map),u$=z$(null),xv=z$("connecting"),EU=z$(0),U4=z$(""),T_=z$(!1),j$=z$("dark"),w6=z$(!1),A6=z$(null),r$=z$(null),iv=z$(null),Qv=null,M4,zO=100,Zk=2500,j_=z$(null),Dv=z$(null),Z6=z$(null),i$=z$(new Set),T$=z$(new Set);function bO($,v){if(!$)return new Set;let g=new Set;for(let _ of v.values()){if(_.from===$)g.add(_.to);if(_.to===$)g.add(_.from)}return g}var KO=v4(()=>bO(u$.value,m$.value));function JO($,v){let g=new Set;for(let _ of $)if(v.has(_))g.add(_);return g}function GO($,v){if($.size!==v.size)return!1;for(let g of $)if(!v.has(g))return!1;return!0}function OO($){let v=new Set(i$.value);if(v.has($))v.delete($);else v.add($);i$.value=v}function WO($){i$.value=new Set($)}function rv(){if(i$.value.size===0)return;i$.value=new Set}function N4($){let v=new Set(T$.value);if(v.has($))v.delete($);else v.add($);T$.value=v,d$(),r_(v)}function BO($){let v=new Set(T$.value);for(let g of $)v.add(g);T$.value=v,d$(),r_(v)}function PO(){if(T$.value.size===0)return;T$.value=new Set,d$(),r_(new Set)}function kO($){T$.value=new Set($)}function YO(){let $=T$.value;if($.size===0)return[];return Array.from($).map((v)=>j.value.get(v)).filter((v)=>v!==void 0)}function r_($){fetch("/api/canvas/context-pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeIds:Array.from($)})}).catch((v)=>{fU("syncContextPinsToServer",v)})}var u_=1;function _6($){U6(()=>{let v=new Map(j.value);if($.zIndex>=u_)u_=$.zIndex+1;v.set($.id,$),j.value=v,u$.value=$.id})}function Pv($,v){V2($,v)}function V2($,v,g={}){let _=j.value.get($);if(!_)return;let U=new Map(j.value);if(_.type==="group"&&v.position&&g.skipGroupChildTranslation!==!0){let J=v.position.x-_.position.x,G=v.position.y-_.position.y;if(J!==0||G!==0){let K=Array.isArray(_.data.children)?_.data.children.filter((O)=>typeof O==="string"):[];for(let O of K){let W=U.get(O);if(!W||W.type==="group")continue;U.set(O,{...W,position:{x:W.position.x+J,y:W.position.y+G}})}}}U.set($,{..._,...v}),j.value=U;let z=U.get($)?.data.appCheckpoint?.updatedAt;if(iv.value===$&&z!==void 0&&z!==M4)r2($)}function v$($,v){let g=j.value.get($);if(!g)return;Pv($,{data:{...g.data,...v}})}function y4($){Qk($);let v=new Map(j.value);if(v.delete($),j.value=v,u$.value===$)u$.value=null;if(r$.value===$)r$.value=null;if(i$.value.has($)){let g=new Set(i$.value);g.delete($),i$.value=g}if(T$.value.has($)){let g=new Set(T$.value);g.delete($),T$.value=g,r_(g)}}function V_($){let v=new Map(m$.value);v.set($.id,$),m$.value=v}function HO($){let v=new Map(m$.value);v.delete($),m$.value=v}function Qk($){let v=!1,g=new Map(m$.value);for(let[_,U]of g)if(U.from===$||U.to===$)g.delete(_),v=!0;if(v)m$.value=g}function Mk($){let v=new Map(S4.value);if(!v.delete($))return;S4.value=v}async function C2($){try{return{ok:(await fetch("/api/canvas/annotation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).ok}}catch(v){return fU("createAnnotationFromClient",v),{ok:!1}}}async function LO($){try{let v=await fetch(`/api/canvas/annotation/${encodeURIComponent($)}`,{method:"DELETE"});if(v.ok)Mk($);return{ok:v.ok}}catch(v){return fU("removeAnnotationFromClient",v),{ok:!1}}}function D4($,v){if(!j.value.get($))return;Pv($,{size:v})}function Q6($){if(!j.value.get($))return;Pv($,{zIndex:u_++}),u$.value=$}function M6($){let v=j.value.get($);if(!v)return;Pv($,{collapsed:!v.collapsed})}function IO(){for(let $ of j.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)Pv($.id,{collapsed:!0})}var C_=v4(()=>{for(let $ of j.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)return!0;return!1});function f2($,v){if(!j.value.get($))return;Pv($,{dockPosition:v}),d$()}function R4($){let v=j.value.get($);if(!v)return;let g=k$.value,_=(window.innerWidth/2-g.x)/g.scale,U=(window.innerHeight/2-g.y)/g.scale;Pv($,{dockPosition:null,position:{x:_-v.size.width/2,y:U-v.size.height/2}}),d$()}function qO($){k$.value={...k$.value,...$}}function XO($){k$.value=$}function FO($){wO($)}function wO($,v={}){k$.value=$,d$(v),eK($,v)}function AO($,v={}){let g=new Map,_=1;for(let B of $.nodes)if(g.set(B.id,B),B.zIndex>=_)_=B.zIndex+1;let U=$.edges.filter((B)=>g.has(B.from)&&g.has(B.to)),z=new Map;for(let B of U)z.set(B.id,B);let J=new Map;for(let B of $.annotations??[])J.set(B.id,B);let G=u$.value!==null&&g.has(u$.value)?u$.value:null,K=r$.value!==null&&g.has(r$.value)?r$.value:null,O=JO(i$.value,g),W=JO(T$.value,g);U6(()=>{if(v.applyViewport===!0&&$.viewport)k$.value=$.viewport;if(u_=_,j.value=g,m$.value=z,S4.value=J,u$.value=G,r$.value=K,!GO(i$.value,O))i$.value=O;if(!GO(T$.value,W))T$.value=W})}var F6=null;function Sk($){return 1-(1-$)**3}function hv($,v=300,g={}){if(F6!==null)cancelAnimationFrame(F6);let _={...k$.value},U=performance.now();function z(J){let G=J-U,K=Math.min(1,G/v),O=Sk(K);if(k$.value={x:_.x+($.x-_.x)*O,y:_.y+($.y-_.y)*O,scale:_.scale+($.scale-_.scale)*O},K<1)F6=requestAnimationFrame(z);else F6=null,wO($,g)}F6=requestAnimationFrame(z)}function u4(){if(F6!==null)cancelAnimationFrame(F6),F6=null}var ZO="pmx-canvas-layout";function d$($={}){try{let v=Array.from(j.value.values()),g=v.map((U)=>({id:U.id,position:U.position,size:U.size,collapsed:U.collapsed,dockPosition:U.dockPosition})),_={viewport:k$.value,nodes:v.map((U)=>({id:U.id,type:U.type,position:U.position,size:U.size,collapsed:U.collapsed,pinned:U.pinned,dockPosition:U.dockPosition})),edges:Array.from(m$.value.values()).map((U)=>({id:U.id,from:U.from,to:U.to,type:U.type,label:U.label,style:U.style,animated:U.animated})),contextPinnedNodeIds:Array.from(T$.value)};localStorage.setItem(ZO,JSON.stringify(_)),dK(g,$)}catch(v){fU("persistLayout",v)}}function E2(){try{let $=localStorage.getItem(ZO);if(!$)return null;let v=JSON.parse($),g=Array.isArray(v.nodes)?v.nodes:[];if(g.length===0)return null;let _=new Map;for(let U of g){if(typeof U.id!=="string"||U.id.length===0)continue;_.set(U.id,{...U.position?{position:U.position}:{},...U.size?{size:U.size}:{},...U.collapsed!==void 0?{collapsed:U.collapsed}:{},...U.pinned!==void 0?{pinned:U.pinned}:{},...U.dockPosition!==void 0?{dockPosition:U.dockPosition}:{}})}return _.size>0?_:null}catch($){return fU("restoreLayout",$),null}}function f_($,v){let g=Array.from(j.value.values());if(g.length===0)return;let{POSITIVE_INFINITY:_,POSITIVE_INFINITY:U,NEGATIVE_INFINITY:z,NEGATIVE_INFINITY:J}=Number;for(let P of g)_=Math.min(_,P.position.x),U=Math.min(U,P.position.y),z=Math.max(z,P.position.x+P.size.width),J=Math.max(J,P.position.y+P.size.height);let G=60,K=z-_+G*2,O=J-U+G*2,W=Math.min(1,Math.min($/K,v/O)),B=(_+z)/2,k=(U+J)/2;hv({x:$/2-B*W,y:v/2-k*W,scale:W})}function Iv($,v={}){let g=j.value.get($);if(!g)return;let _=k$.value,U=g.position.x+g.size.width/2,z=g.position.y+g.size.height/2;hv({x:window.innerWidth/2-U*_.scale,y:window.innerHeight/2-z*_.scale,scale:_.scale},300,v),Q6($)}function QO($=1){let v=Array.from(j.value.keys());if(v.length===0)return;let _=((u$.value?v.indexOf(u$.value):-1)+$+v.length)%v.length,U=v[_];Q6(U),Iv(U)}function MO($){let v=u$.value;if(!v)return;let g=j.value.get(v);if(!g)return;let _=bO(v,m$.value);if(_.size===0)return;let U=g.position.x+g.size.width/2,z=g.position.y+g.size.height/2,J=null,G=-1/0;for(let K of _){let O=j.value.get(K);if(!O)continue;let W=O.position.x+O.size.width/2,B=O.position.y+O.size.height/2,k=W-U,P=B-z,X=Math.sqrt(k*k+P*P);if(X<1)continue;let L;switch($){case"up":L=-P;break;case"down":L=P;break;case"left":L=-k;break;case"right":L=k;break}if(L<=0)continue;let Y=L/X-X*0.001;if(Y>G)G=Y,J=K}if(J)Iv(J)}function z6($){if(!j.value.get($))return;if(Qv!==null)clearTimeout(Qv),Qv=null;iv.value=null,M4=void 0,Q6($),r$.value=$}function r2($){if(Qv!==null)clearTimeout(Qv),Qv=null;if(r$.value===$)r$.value=null;if(iv.value===$)iv.value=null;M4=void 0}function g4(){let $=r$.value,v=$?j.value.get($):void 0;if($&&v&&xK(v)){let g=$,_=Date.now();if(iv.value=g,M4=v.data.appCheckpoint?.updatedAt,Qv!==null)clearTimeout(Qv);let U=()=>{let J=j.value.get(g)?.data.appCheckpoint?.updatedAt;if(J!==void 0&&J!==M4){r2(g);return}if(Date.now()-_>=Zk){r2(g);return}Qv=setTimeout(U,zO)};Qv=setTimeout(U,zO);return}if(Qv!==null)clearTimeout(Qv),Qv=null;iv.value=null,M4=void 0,r$.value=null}function E_(){let $=u2(Array.from(j.value.values()),Array.from(m$.value.values()),"grid");if($.nodePositions.size===0&&$.groupBounds.size===0)return;U6(()=>{for(let[v,g]of $.nodePositions.entries())Pv(v,{position:g});for(let[v,g]of $.groupBounds.entries())V2(v,{position:{x:g.x,y:g.y},size:{width:g.width,height:g.height}},{skipGroupChildTranslation:!0})}),d$()}function m_(){let $=u2(Array.from(j.value.values()),Array.from(m$.value.values()),"graph");if($.nodePositions.size===0&&$.groupBounds.size===0)return;U6(()=>{for(let[v,g]of $.nodePositions.entries())Pv(v,{position:g});for(let[v,g]of $.groupBounds.entries())V2(v,{position:{x:g.x,y:g.y},size:{width:g.width,height:g.height}},{skipGroupChildTranslation:!0})}),d$()}var Nk=0;function b($,v,g,_,U,z){v||(v={});var J,G,K=v;if("ref"in K)for(G in K={},v)G=="ref"?J=v[G]:K[G]=v[G];var O={type:$,props:K,key:g,ref:J,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nk,__i:-1,__u:0,__source:U,__self:z};if(typeof $=="function"&&(J=$.defaultProps))for(G in J)K[G]===void 0&&(K[G]=J[G]);return P$.vnode&&P$.vnode(O),O}function yk($){return new Date($).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function Dk(){IO(),F_()}function SO(){let $=rU.value;if($.length===0)return null;let v=X6.value,g=w4.value;if(!v&&C_.value)return null;if(!v)return b("button",{type:"button",class:"attention-history-tab",onClick:Dk,"aria-label":g>0?`Recent updates — ${g} new`:"Recent updates",title:g>0?`${g} new updates since last viewed`:"Recent updates",children:[b("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("span",{class:"attention-history-tab-label",children:"Updates"},void 0,!1,void 0,this),g>0&&b("span",{class:"attention-history-tab-badge","aria-hidden":"true",children:g>9?"9+":g},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return b("aside",{class:"attention-history","aria-label":"Recent semantic changes",children:[b("div",{class:"attention-history-header",children:[b("div",{class:"attention-history-header-text",children:[b("span",{class:"attention-history-title",children:"Recent Updates"},void 0,!1,void 0,this),b("span",{class:"attention-history-subtitle",children:"Focus and meaning shifts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("button",{type:"button",class:"attention-history-close",onClick:w_,"aria-label":"Collapse changes panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"attention-history-list",children:$.map((_)=>b("article",{class:`attention-history-entry attention-tone-${_.tone}`,children:[b("div",{class:"attention-history-meta",children:[b("span",{class:"attention-history-kind",children:_.title},void 0,!1,void 0,this),b("time",{class:"attention-history-time",dateTime:new Date(_.createdAt).toISOString(),children:yk(_.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("p",{class:"attention-history-detail",children:_.detail},void 0,!1,void 0,this)]},_.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function NO(){let $=I_.value;if(!$)return null;return b("button",{type:"button",class:`attention-toast attention-tone-${$.tone}`,onClick:F_,"aria-label":`${$.title} — open change history`,title:$.detail||$.title,children:[b("span",{class:"attention-toast-dot","aria-hidden":"true"},void 0,!1,void 0,this),b("span",{class:"attention-toast-title",children:$.title},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Rk=700,uk=1600;function Tk($){return $.replace(/\r\n?/g,`
23
23
  `).replace(/[ \t\f\v]+/g," ").replace(/\n\s+/g,`
24
24
  `).replace(/\s+\n/g,`
25
25
  `).replace(/\n{3,}/g,`
26
26
 
27
- `).trim()}function qv($,v){if(v<=0)return"";let g=Mk($);if(g.length<=v)return g;if(v<=1)return g.slice(0,v);return`${g.slice(0,Math.max(0,v-1)).trimEnd()}…`}function f_($,v){if(typeof $==="string")return qv($,v);if($===null||$===void 0)return"";try{return qv(JSON.stringify($),v)}catch{return""}}function Qk($,v){let g=[],_=typeof $.url==="string"?$.url:"",U=typeof $.pageTitle==="string"?$.pageTitle:"",z=typeof $.description==="string"?$.description:"",J=typeof $.status==="string"?$.status:"",b=typeof $.statusCode==="number"?$.statusCode:null,O=typeof $.error==="string"?$.error:"",K=typeof $.content==="string"?$.content:typeof $.excerpt==="string"?$.excerpt:"";if(_)g.push(`URL: ${_}`);if(U)g.push(`Title: ${U}`);if(z)g.push(`Description: ${z}`);if(J||b!==null)g.push(`Fetch: ${J||"unknown"}${b!==null?` (${b})`:""}`);if(O)g.push(`Error: ${O}`);let W=g.join(`
28
- `),B=Math.max(0,v-W.length-(W?2:0)),k=B>0?qv(K,B):"";if(W&&k)return`${W}
27
+ `).trim()}function qv($,v){if(v<=0)return"";let g=Tk($);if(g.length<=v)return g;if(v<=1)return g.slice(0,v);return`${g.slice(0,Math.max(0,v-1)).trimEnd()}…`}function c_($,v){if(typeof $==="string")return qv($,v);if($===null||$===void 0)return"";try{return qv(JSON.stringify($),v)}catch{return""}}function jk($,v){let g=[],_=typeof $.url==="string"?$.url:"",U=typeof $.pageTitle==="string"?$.pageTitle:"",z=typeof $.description==="string"?$.description:"",J=typeof $.status==="string"?$.status:"",G=typeof $.statusCode==="number"?$.statusCode:null,K=typeof $.error==="string"?$.error:"",O=typeof $.content==="string"?$.content:typeof $.excerpt==="string"?$.excerpt:"";if(_)g.push(`URL: ${_}`);if(U)g.push(`Title: ${U}`);if(z)g.push(`Description: ${z}`);if(J||G!==null)g.push(`Fetch: ${J||"unknown"}${G!==null?` (${G})`:""}`);if(K)g.push(`Error: ${K}`);let W=g.join(`
28
+ `),B=Math.max(0,v-W.length-(W?2:0)),k=B>0?qv(O,B):"";if(W&&k)return`${W}
29
29
 
30
- ${k}`;if(W)return qv(W,v);return qv(K,v)}function Sk($){if($===null||$===void 0)return"";if(typeof $!=="object"||Array.isArray($))return"";let v=$.elements;if(Array.isArray(v))return`Diagram elements: ${v.length}`;let g=Object.keys($).sort();return g.length>0?`Input keys: ${g.join(", ")}`:""}function Nk($,v){let g=[],_=typeof $.title==="string"?$.title:"",U=typeof $.mode==="string"?$.mode:"",z=typeof $.hostMode==="string"?$.hostMode:"",J=typeof $.serverName==="string"?$.serverName:"",b=typeof $.toolName==="string"?$.toolName:"",O=typeof $.resourceUri==="string"?$.resourceUri:"",K=typeof $.path==="string"?$.path:"",W=typeof $.url==="string"?$.url:"",B=typeof $.sessionStatus==="string"?$.sessionStatus:"",k=Sk($.toolInput);if(_)g.push(`App: ${_}`);if(U||z)g.push(`Mode: ${[U,z].filter(Boolean).join(" / ")}`);if(J||b)g.push(`Source: ${[J,b].filter(Boolean).join(" / ")}`);if(O)g.push(`Resource: ${O}`);if(K)g.push(`Path: ${K}`);if(W)g.push(`URL: ${W}`);if(B)g.push(`Session: ${B}`);if(k)g.push(k);if(g.length===0)return"MCP App node";return qv(g.join(`
31
- `),v)}function rk($,v){let g=[],_=typeof $.content==="string"?$.content:"",U=typeof $.title==="string"?$.title:"",z=typeof $.path==="string"?$.path:"",J=typeof $.url==="string"?$.url:"",b=typeof $.projectPath==="string"?$.projectPath:"",O=typeof $.artifactBytes==="number"?$.artifactBytes:null,K=typeof $.sourceFileCount==="number"?$.sourceFileCount:null,W=Array.isArray($.sourceFiles)?$.sourceFiles.filter((k)=>typeof k==="string"):[],B=Array.isArray($.deps)?$.deps.filter((k)=>typeof k==="string"):[];if(_)g.push(_);if(!_&&U)g.push(`Web artifact: ${U}`);if(W.length>0&&!_.includes("Source files:")){let k=K!==null?Math.max(0,K-W.length):0;g.push(`Source files: ${W.join(", ")}${k>0?`, +${k} more`:""}`)}if(O!==null&&!_.includes("Artifact bytes:"))g.push(`Artifact bytes: ${O}`);if(B.length>0&&!_.includes("Dependencies:"))g.push(`Dependencies: ${B.join(", ")}`);if(z)g.push(`Path: ${z}`);if(b)g.push(`Project: ${b}`);if(J)g.push(`URL: ${J}`);return g.length>0?qv(g.join(`
32
- `),v):"Web artifact node"}function uk($,v){let g=[],_=typeof $.htmlPrimitive==="string"?$.htmlPrimitive:"",U=typeof $.description==="string"?$.description:"",z=$.primitiveData;if(_)g.push(`HTML primitive: ${_}`);if(U)g.push(U);if(z!==void 0)g.push(`Data: ${f_(z,v)}`);return qv(g.join(`
33
- `),v)}function FK($,v={}){let g=v.defaultTextLength??Ak,_=v.webpageTextLength??Zk;switch($.type){case"markdown":{let U=$.data.rendered||$.data.content||"";return qv(U,g)}case"mcp-app":{if($.data.viewerType==="web-artifact")return rk($.data,g);let U=$.data.chartConfig;if(U){let z=U.title||"Untitled chart",J=U.type||"unknown",b=Array.isArray(U.labels)?U.labels.join(", "):"";return qv(`Chart: ${z} (${J}). Labels: ${b}`,g)}return Nk($.data,g)}case"webpage":return Qk($.data,_);case"json-render":case"graph":{let U=$.data.graphConfig;if(U)return qv(`Graph: ${JSON.stringify(U)}`,g);return f_($.data.spec??{},g)}case"html":{if(typeof $.data.agentSummary==="string")return qv($.data.agentSummary,g);if(typeof $.data.htmlPrimitive==="string")return uk($.data,g);return f_({title:$.data.title,description:$.data.description,summary:$.data.summary,contentSummary:$.data.contentSummary,embeddedNodeIds:$.data.embeddedNodeIds,embeddedUrls:$.data.embeddedUrls},g)}case"prompt":case"response":{let U=$.data.text||$.data.content||"";return qv(U,g)}case"file":{let U=typeof $.data.path==="string"?$.data.path:"",z=typeof $.data.fileContent==="string"?$.data.fileContent:typeof $.data.content==="string"?$.data.content:"",J=U?`Path: ${U}
30
+ ${k}`;if(W)return qv(W,v);return qv(O,v)}function rk($){if($===null||$===void 0)return"";if(typeof $!=="object"||Array.isArray($))return"";let v=$.elements;if(Array.isArray(v))return`Diagram elements: ${v.length}`;let g=Object.keys($).sort();return g.length>0?`Input keys: ${g.join(", ")}`:""}function Vk($,v){let g=[],_=typeof $.title==="string"?$.title:"",U=typeof $.mode==="string"?$.mode:"",z=typeof $.hostMode==="string"?$.hostMode:"",J=typeof $.serverName==="string"?$.serverName:"",G=typeof $.toolName==="string"?$.toolName:"",K=typeof $.resourceUri==="string"?$.resourceUri:"",O=typeof $.path==="string"?$.path:"",W=typeof $.url==="string"?$.url:"",B=typeof $.sessionStatus==="string"?$.sessionStatus:"",k=rk($.toolInput);if(_)g.push(`App: ${_}`);if(U||z)g.push(`Mode: ${[U,z].filter(Boolean).join(" / ")}`);if(J||G)g.push(`Source: ${[J,G].filter(Boolean).join(" / ")}`);if(K)g.push(`Resource: ${K}`);if(O)g.push(`Path: ${O}`);if(W)g.push(`URL: ${W}`);if(B)g.push(`Session: ${B}`);if(k)g.push(k);if(g.length===0)return"MCP App node";return qv(g.join(`
31
+ `),v)}function Ck($,v){let g=[],_=typeof $.content==="string"?$.content:"",U=typeof $.title==="string"?$.title:"",z=typeof $.path==="string"?$.path:"",J=typeof $.url==="string"?$.url:"",G=typeof $.projectPath==="string"?$.projectPath:"",K=typeof $.artifactBytes==="number"?$.artifactBytes:null,O=typeof $.sourceFileCount==="number"?$.sourceFileCount:null,W=Array.isArray($.sourceFiles)?$.sourceFiles.filter((k)=>typeof k==="string"):[],B=Array.isArray($.deps)?$.deps.filter((k)=>typeof k==="string"):[];if(_)g.push(_);if(!_&&U)g.push(`Web artifact: ${U}`);if(W.length>0&&!_.includes("Source files:")){let k=O!==null?Math.max(0,O-W.length):0;g.push(`Source files: ${W.join(", ")}${k>0?`, +${k} more`:""}`)}if(K!==null&&!_.includes("Artifact bytes:"))g.push(`Artifact bytes: ${K}`);if(B.length>0&&!_.includes("Dependencies:"))g.push(`Dependencies: ${B.join(", ")}`);if(z)g.push(`Path: ${z}`);if(G)g.push(`Project: ${G}`);if(J)g.push(`URL: ${J}`);return g.length>0?qv(g.join(`
32
+ `),v):"Web artifact node"}function fk($,v){let g=[],_=typeof $.htmlPrimitive==="string"?$.htmlPrimitive:"",U=typeof $.description==="string"?$.description:"",z=$.primitiveData;if(_)g.push(`HTML primitive: ${_}`);if(U)g.push(U);if(z!==void 0)g.push(`Data: ${c_(z,v)}`);return qv(g.join(`
33
+ `),v)}function yO($,v={}){let g=v.defaultTextLength??Rk,_=v.webpageTextLength??uk;switch($.type){case"markdown":{let U=$.data.rendered||$.data.content||"";return qv(U,g)}case"mcp-app":{if($.data.viewerType==="web-artifact")return Ck($.data,g);let U=$.data.chartConfig;if(U){let z=U.title||"Untitled chart",J=U.type||"unknown",G=Array.isArray(U.labels)?U.labels.join(", "):"";return qv(`Chart: ${z} (${J}). Labels: ${G}`,g)}return Vk($.data,g)}case"webpage":return jk($.data,_);case"json-render":case"graph":{let U=$.data.graphConfig;if(U)return qv(`Graph: ${JSON.stringify(U)}`,g);return c_($.data.spec??{},g)}case"html":{if(typeof $.data.agentSummary==="string")return qv($.data.agentSummary,g);if(typeof $.data.htmlPrimitive==="string")return fk($.data,g);return c_({title:$.data.title,description:$.data.description,summary:$.data.summary,contentSummary:$.data.contentSummary,embeddedNodeIds:$.data.embeddedNodeIds,embeddedUrls:$.data.embeddedUrls},g)}case"prompt":case"response":{let U=$.data.text||$.data.content||"";return qv(U,g)}case"file":{let U=typeof $.data.path==="string"?$.data.path:"",z=typeof $.data.fileContent==="string"?$.data.fileContent:typeof $.data.content==="string"?$.data.content:"",J=U?`Path: ${U}
34
34
 
35
- `:"",b=Math.max(0,g-J.length);return`${J}${qv(z,b)}`.trim()}default:return f_($.data,g)}}function yk($,v){let g=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,U=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2;return Math.sqrt((g-U)**2+(_-z)**2)}function Dk($,v){let g=$.position.x+$.size.width,_=$.position.y+$.size.height,U=v.position.x+v.size.width,z=v.position.y+v.size.height,J=Math.max(0,Math.max($.position.x,v.position.x)-Math.min(g,U)),b=Math.max(0,Math.max($.position.y,v.position.y)-Math.min(_,z));return Math.sqrt(J**2+b**2)}function Rk($){let v=[...$],g=100;return v.sort((_,U)=>{let z=Math.floor(_.position.y/100),J=Math.floor(U.position.y/100);if(z!==J)return z-J;return _.position.x-U.position.x}),v}function Tk($){let v=$.find((U)=>U.data.title&&typeof U.data.title==="string");if(v&&$.length<=3)return $.filter((z)=>z.data.title).map((z)=>z.data.title).slice(0,3).join(", ");let g={};for(let U of $)g[U.type]=(g[U.type]??0)+1;let _=Object.entries(g).map(([U,z])=>z===1?U:`${z} ${U}`);if(v)return`${v.data.title} + ${_.join(", ")}`;return _.join(", ")}function jk($,v){return $.x<=v.x+v.width&&$.x+$.width>=v.x&&$.y<=v.y+v.height&&$.y+$.height>=v.y}function Vk($,v){let g=v.filter((U)=>jk($.bounds,{x:U.position.x,y:U.position.y,width:U.size.width,height:U.size.height})),_=g.map((U)=>typeof U.data.title==="string"&&U.data.title.length>0?U.data.title:U.id);return{id:$.id,label:$.label??$.text??null,bounds:$.bounds,targetNodeIds:g.map((U)=>U.id),targetNodeTitles:_,target:_.length>0?_.join(", "):"empty canvas region"}}function Ck($,v=200){if($.length===0)return[];let g=new Map,_=(O)=>{while(g.get(O)!==O){let K=g.get(O);g.set(O,g.get(K)),O=K}return O},U=(O,K)=>{let W=_(O),B=_(K);if(W!==B)g.set(W,B)};for(let O of $)g.set(O.id,O.id);for(let O=0;O<$.length;O++)for(let K=O+1;K<$.length;K++)if(Dk($[O],$[K])<=v)U($[O].id,$[K].id);let z=new Map;for(let O of $){let K=_(O.id);if(!z.has(K))z.set(K,[]);z.get(K).push(O)}let J=[],b=0;for(let[,O]of z){if(O.length<2)continue;let K=O.map((L)=>L.position.x),W=O.map((L)=>L.position.y),B=O.map((L)=>L.position.x+L.size.width),k=O.map((L)=>L.position.y+L.size.height),P=Math.min(...K),X=Math.min(...W),Y=Math.max(...B),H=Math.max(...k);J.push({id:`cluster-${b++}`,nodeIds:O.map((L)=>L.id),label:Tk(O),centroid:{x:Math.round((P+Y)/2),y:Math.round((X+H)/2)},bounds:{x:P,y:X,width:Y-P,height:H-X}})}return J.sort((O,K)=>{let W=Math.floor(O.centroid.y/200),B=Math.floor(K.centroid.y/200);if(W!==B)return W-B;return O.centroid.x-K.centroid.x}),J}function fk($,v,g=5,_=600){let U=$.filter((J)=>v.has(J.id)),z=$.filter((J)=>!v.has(J.id));return U.map((J)=>{let b=z.map((O)=>({node:O,distance:yk(J,O)})).filter((O)=>O.distance<=_).sort((O,K)=>O.distance-K.distance).slice(0,g);return{pinnedNodeId:J.id,pinnedNodeTitle:J.data.title??null,neighbors:b.map((O)=>({id:O.node.id,type:O.node.type,title:O.node.data.title??null,distance:Math.round(O.distance)}))}})}function CU($,v,g,_=[]){let U=Ck($),z=new Map;for(let K of U)for(let W of K.nodeIds)z.set(W,K.id);let b=Rk($).map((K,W)=>({id:K.id,type:K.type,title:K.data.title??null,content:FK(K,{defaultTextLength:320,webpageTextLength:640})||null,clusterId:z.get(K.id)??null,readingOrder:W})),O=fk($,g);return{totalNodes:$.length,clusters:U,nodesInReadingOrder:b,pinnedNeighborhoods:O,annotations:_.map((K)=>Vk(K,$))}}function y4($){if(!$)return null;let v=$.data.title;return typeof v==="string"&&v.trim().length>0?v.trim():null}function m_($,v){return{id:$?.id??v,title:y4($),nodeType:$?.type??"markdown"}}function AK($,v){return{id:$.id,edgeType:$.type,fromId:$.from,toId:$.to,fromTitle:y4(v.get($.from)),toTitle:y4(v.get($.to))}}function c_($){return new Map($.map((v)=>[v.id,v]))}function ZK($){return new Map($.map((v)=>[v.id,v]))}function Vv($){return Array.from($).sort((v,g)=>v.localeCompare(g))}function R2($,v){if($.length!==v.length)return!1;for(let g=0;g<$.length;g++)if($[g]!==v[g])return!1;return!0}function T2($){if(!$||$.type!=="group")return[];let v=$.data.children;if(!Array.isArray(v))return[];return v.filter((g)=>typeof g==="string").sort((g,_)=>g.localeCompare(_))}function MK($){let v=new Map;for(let g of $.clusters){let _=[...g.nodeIds].sort((U,z)=>U.localeCompare(z));for(let U of _)v.set(U,_.filter((z)=>z!==U))}return v}function QK($){let v=new Map;for(let g of $.pinnedNeighborhoods)v.set(g.pinnedNodeId,g.neighbors.map((_)=>_.id).sort((_,U)=>_.localeCompare(U)));return v}function mk($,v){let g=Vv(Array.from(v).filter((U)=>!$.has(U))),_=Vv(Array.from($).filter((U)=>!v.has(U)));return{added:g,removed:_}}function SK($){let v=$&&typeof $==="object"?$:{};return{timestamp:typeof v.timestamp==="string"?v.timestamp:void 0,sessionId:typeof v.sessionId==="string"?v.sessionId:void 0}}function ck($,v,g){if(!$||!g)return{layout:$,pinnedNodeIds:[],primaryFocusNodeIds:[],secondaryFocusNodeIds:[],regions:[],spatial:g};let _=c_($.nodes),U=Vv(v).filter((O)=>_.has(O)),z=new Set(U),J=new Set,b=[];for(let O of g.pinnedNeighborhoods){if(!z.has(O.pinnedNodeId))continue;let K=Vv([O.pinnedNodeId,...O.neighbors.map((W)=>W.id)]).filter((W,B,k)=>k.indexOf(W)===B&&_.has(W));for(let W of K)if(!z.has(W))J.add(W);b.push({id:`region-${O.pinnedNodeId}`,primaryNodeId:O.pinnedNodeId,nodeIds:K})}if(b.length===0&&U.length>0)for(let O of U)b.push({id:`region-${O}`,primaryNodeId:O,nodeIds:[O]});return{layout:$,pinnedNodeIds:U,primaryFocusNodeIds:U,secondaryFocusNodeIds:Vv(J),regions:b,spatial:g}}class E_{currentLayout=null;currentPins=new Set;previousSpatial=null;setInitialPins($){this.currentPins=new Set($)}getAttentionSnapshot(){return ck(this.currentLayout,this.currentPins,this.previousSpatial)}handleMessage($){if($.event==="context-pins-changed")return this.handleContextPinsChanged($.data);if($.event==="canvas-layout-update")return this.handleLayoutUpdate($.data);return[]}handleContextPinsChanged($){let v=$&&typeof $==="object"?$:{},g=Array.isArray(v.nodeIds)?v.nodeIds.filter((K)=>typeof K==="string"):[],_=SK($),U=new Set(g),{added:z,removed:J}=mk(this.currentPins,U);if(this.currentPins=U,!this.currentLayout)return[];let b=c_(this.currentLayout.nodes),O={added:z.map((K)=>m_(b.get(K),K)),removed:J.map((K)=>m_(b.get(K),K))};if(this.previousSpatial=CU(this.currentLayout.nodes,this.currentLayout.edges,this.currentPins,this.currentLayout.annotations??[]),O.added.length===0&&O.removed.length===0)return[];return[{type:"context-pin",..._,...O}]}handleLayoutUpdate($){let v=$&&typeof $==="object"?$:{},g=v.layout&&typeof v.layout==="object"?v.layout:null;if(!g)return[];let _=SK($);if(!this.currentLayout)return this.currentLayout=g,this.previousSpatial=CU(g.nodes,g.edges,this.currentPins,g.annotations??[]),[];let U=this.currentLayout,z=this.previousSpatial??CU(U.nodes,U.edges,this.currentPins,U.annotations??[]),J=CU(g.nodes,g.edges,this.currentPins,g.annotations??[]),b=[],O=c_(U.nodes),K=c_(g.nodes),W=ZK(U.edges),B=ZK(g.edges),k=Vv(Array.from(B.keys()).filter((L)=>!W.has(L))).map((L)=>B.get(L)).filter((L)=>L!==void 0);if(k.length>0)b.push({type:"connect",..._,edges:k.map((L)=>AK(L,K))});let P=Vv(Array.from(O.keys()).filter((L)=>!K.has(L))),X=Vv(Array.from(W.keys()).filter((L)=>!B.has(L)));if(P.length>0||X.length>0)b.push({type:"remove",..._,nodes:P.map((L)=>m_(O.get(L),L)),edges:X.map((L)=>W.get(L)).filter((L)=>L!==void 0).map((L)=>AK(L,O))});let Y=this.buildGroupEvent(O,K,_);if(Y)b.push(Y);let H=this.buildMoveEndEvent(U,g,O,K,z,J,_);if(H)b.push(H);return this.currentLayout=g,this.previousSpatial=J,b}buildGroupEvent($,v,g){let _=Vv(Array.from($.values()).filter((b)=>b.type==="group").map((b)=>b.id)),U=Vv(Array.from(v.values()).filter((b)=>b.type==="group").map((b)=>b.id)),z=U.filter((b)=>!_.includes(b)).map((b)=>{let O=v.get(b),K=T2(O);return{id:b,title:y4(O),childCount:K.length}}),J=[];for(let b of U.filter((O)=>_.includes(O))){let O=T2($.get(b)),K=T2(v.get(b));if(R2(O,K))continue;J.push({id:b,title:y4(v.get(b)),addedChildIds:K.filter((W)=>!O.includes(W)),removedChildIds:O.filter((W)=>!K.includes(W)),childCount:K.length})}if(z.length===0&&J.length===0)return null;return{type:"group",...g,created:z,updated:J}}buildMoveEndEvent($,v,g,_,U,z,J){let b=Vv(Array.from(_.keys()).filter((H)=>{let L=g.get(H),q=_.get(H);if(!L||!q)return!1;return L.position.x!==q.position.x||L.position.y!==q.position.y}));if(b.length===0)return null;let O=MK(U),K=MK(z),W=QK(U),B=QK(z),k=new Map,P=(H,L)=>{let q=k.get(H)??new Set;q.add(L),k.set(H,q)};for(let H of b){let L=O.get(H)??[],q=K.get(H)??[];if(!R2(L,q))if(L.length===0&&q.length>0)P(H,"joined cluster");else if(L.length>0&&q.length===0)P(H,"left cluster");else P(H,"cluster changed")}let X=new Set([...W.keys(),...B.keys()]);for(let H of X){let L=W.get(H)??[],q=B.get(H)??[];if(R2(L,q))continue;let F=y4(_.get(H)??g.get(H))??H,N=q.filter((p)=>!L.includes(p)),C=L.filter((p)=>!q.includes(p));for(let p of N)if(b.includes(p))P(p,`entered pinned neighborhood of "${F}"`);for(let p of C)if(b.includes(p))P(p,`left pinned neighborhood of "${F}"`);if(b.includes(H))P(H,"pinned neighborhood changed")}let Y=b.filter((H)=>(k.get(H)?.size??0)>0).map((H)=>{let L=_.get(H);return{...m_(L,H),reasons:Array.from(k.get(H)??[]).sort((q,F)=>q.localeCompare(F))}});if(Y.length===0)return null;return{type:"move-end",...J,nodes:Y}}}var f2=new E_,m2=[],fU=null,D4=null,j2="",V2=0;function rK($,v){return globalThis.setTimeout($,v)}function C2($){if($===null)return;globalThis.clearTimeout($)}function Ek($){if(typeof globalThis.requestAnimationFrame==="function"){globalThis.requestAnimationFrame(()=>$());return}$()}function S6($,v){return $&&$.trim().length>0?$.trim():v}function J6($,v=3){if($.length===0)return"";if($.length<=v)return $.join(", ");return`${$.slice(0,v).join(", ")} +${$.length-v}`}function ik($){return Array.from(new Set(Array.from($).filter((v)=>v.length>0)))}function Cv($,v,g,_,U=Date.now()){return{id:`${$}-${U}-${Math.random().toString(36).slice(2,8)}`,tone:$,title:v,detail:g,nodeIds:ik(_),createdAt:U}}function NK($){if($==="joined cluster")return"joined a nearby cluster";if($==="left cluster")return"moved away from its cluster";if($==="cluster changed")return"shifted into a different cluster";if($==="pinned neighborhood changed")return"changed the local focus field";let v=/^entered pinned neighborhood of "(.+)"$/.exec($);if(v)return`moved into focus around ${v[1]}`;let g=/^left pinned neighborhood of "(.+)"$/.exec($);if(g)return`moved out of focus around ${g[1]}`;return $}function lk($){let v=$.added.map((U)=>S6(U.title,U.id)),g=$.removed.map((U)=>S6(U.title,U.id));if(v.length===0&&g.length===0)return null;let _="";if(v.length>0&&g.length===0)_=`Now in focus: ${J6(v)}`;else if(g.length>0&&v.length===0)_=`Removed from focus: ${J6(g)}`;else{let U=[];if(v.length>0)U.push(`${J6(v)} added`);if(g.length>0)U.push(`${J6(g)} removed`);_=U.join(" · ")}return Cv("context","Context updated",_,[...$.added.map((U)=>U.id),...$.removed.map((U)=>U.id)],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function xk($){if($.edges.length===0)return null;if($.edges.length===1){let v=$.edges[0];return Cv("relationship","Relationship added",`${S6(v.fromTitle,v.fromId)} linked to ${S6(v.toTitle,v.toId)}`,[v.fromId,v.toId],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return Cv("relationship","Relationships added",`${$.edges.length} connections changed the board structure`,$.edges.flatMap((v)=>[v.fromId,v.toId]),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function hk($){if($.nodes.length===0&&$.edges.length===0)return null;let v=$.nodes.map((_)=>S6(_.title,_.id)),g=[];if(v.length>0)g.push(J6(v));if($.edges.length>0)g.push(`${$.edges.length} relationship${$.edges.length===1?"":"s"}`);return Cv("remove","Items removed",g.join(" · "),[...$.nodes.map((_)=>_.id),...$.edges.flatMap((_)=>[_.fromId,_.toId])],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function pk($){if($.created.length>0){let v=$.created.map((g)=>S6(g.title,g.id));return Cv("group",$.created.length===1?"Group created":"Groups created",$.created.length===1?`${v[0]} now frames ${$.created[0].childCount} items`:J6(v),$.created.map((g)=>g.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}if($.updated.length>0){let v=$.updated.map((g)=>S6(g.title,g.id));return Cv("group",$.updated.length===1?"Group updated":"Groups updated",$.updated.length===1?`${v[0]} now holds ${$.updated[0].childCount} items`:J6(v),$.updated.map((g)=>g.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return null}function ok($){if($.nodes.length===0)return null;let v=$.nodes.flatMap((z)=>z.reasons),g=$.nodes.map((z)=>S6(z.title,z.id)),_=$.timestamp?Date.parse($.timestamp)||Date.now():Date.now();if(v.some((z)=>z.includes("pinned neighborhood"))){if($.nodes.length===1)return Cv("neighborhood","Neighborhood changed",`${g[0]} ${NK($.nodes[0].reasons[0])}`,$.nodes.map((z)=>z.id),_);return Cv("neighborhood","Neighborhood changed",J6(g),$.nodes.map((z)=>z.id),_)}let U=v.filter((z)=>z.includes("cluster"));if(U.length>0){let z=U.every((J)=>J==="joined cluster");if($.nodes.length===1)return Cv("cluster",z?"Cluster formed":"Cluster changed",`${g[0]} ${NK($.nodes[0].reasons[0])}`,$.nodes.map((J)=>J.id),_);return Cv("cluster",z?"Cluster formed":"Cluster changed",J6(g),$.nodes.map((J)=>J.id),_)}return null}function nk($){switch($.type){case"context-pin":return lk($);case"connect":return xk($);case"remove":return hk($);case"group":return pk($);case"move-end":return ok($)}}function tk(){let $=f2.getAttentionSnapshot();TO($.primaryFocusNodeIds,$.secondaryFocusNodeIds,$.regions)}function uK(){if(fU!==null)return;let $=m2.shift()??null;if(!$){X_(null);return}X_($);let v=Math.max(1800,Math.min(2800,1600+$.detail.length*18));fU=rK(()=>{fU=null,X_(null),uK()},v)}function yK($){m2.push($),uK()}function R4($,v,g="",_=[]){yK(Cv($,v,g,_))}function dk($){if(C2(D4),D4=null,w_([]),$.length===0)return;Ek(()=>{w_($),D4=rK(()=>{D4=null,w_([])},900)})}function ak($){let v=`${$.tone}:${$.title}:${$.detail}`,g=$.createdAt;if(v===j2&&g-V2<1200)return!0;return j2=v,V2=g,!1}function c2(){C2(fU),C2(D4),fU=null,D4=null,m2=[],j2="",V2=0,f2=new E_,RO()}function E2($){let v=f2.handleMessage($).map((g)=>nk(g)).filter((g)=>g!==null);tk();for(let g of v){if(ak(g))continue;jO(g),yK(g),dk(g.nodeIds)}}async function i_($,v,g,_){let U=await S_({type:v,sourceNodeId:$.id,sourceSurface:"native-node",...g?{payload:g}:{}});if(U.ok)R4("context",_,"",[$.id]);else R4("remove","AX action failed",U.error??U.code??"Unknown error",[$.id])}var DK={padding:"3px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",flexShrink:0};function sk($){let v=$.title||$.label||$.key||"Context",g=$.summary?.trim()||"Available in startup context.",_=$.pathDisplay||$.path||"",U=$.category==="profile"?"Operator":$.category==="planning"||$.category==="memory"?"Product":$.category?$.category.charAt(0).toUpperCase()+$.category.slice(1):void 0,z=$.sourceKind==="global"?"Global":"Workspace",J=$.state==="missing"?"Missing":$.state==="stale"?"Stale":$.state==="invalid"?"Invalid":"Loaded";return{title:v,summary:g,pathDisplay:_,category:U,sourceKind:z,status:J,required:$.required===!0}}function fv($){return typeof $==="string"?$.trim():""}function ek($){return $.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function $H($){let v=fv($.title),g=fv($.content),_=ek(fv($.rendered)),U=g||_,z=fv($.path);if(!v&&!U&&!z)return null;return{title:v||"Context",summary:U,path:z}}function vH($){let v=fv($.data.title)||$.id,g=fv($.data.content)||fv($.data.excerpt)||fv($.data.description)||fv($.data.pageTitle)||"",_=fv($.data.path)||fv($.data.url);return{id:$.id,title:v,summary:g,kind:s$[$.type]??$.type,path:_}}function RK($){if($===null||!Number.isFinite($)||$<0)return"0";if($>=1e6)return`${($/1e6).toFixed(1)}m`;if($>=1000)return`${($/1000).toFixed(1)}k`;return`${Math.round($)}`}function UH($){if($>=0.95)return"var(--c-danger)";if($>=0.85)return"var(--c-warn)";if($>=0.7)return"var(--c-warn)";return"var(--c-accent)"}function U4({node:$,expanded:v=!1,pinnedNodes:g=[]}){let _=$.data.cards??[],U=$.data.auxTabs??[],z=g.map(vH),J=z.length>0,b=typeof $.data.currentTokens==="number"?$.data.currentTokens:null,O=typeof $.data.tokenLimit==="number"?$.data.tokenLimit:null,K=typeof $.data.utilization==="number"?$.data.utilization:null,W=typeof $.data.messagesLength==="number"?$.data.messagesLength:null,B=K!==null?Math.max(0,Math.min(100,Math.round(K*100))):null,k=UH(K??0),P=!J&&_.length===0&&U.length===0?$H($.data):null,X=async(Y)=>{let H=typeof Y.path==="string"?Y.path.trim():"";if(!H)return;await A_(H)};return G("div",{style:{display:"flex",flexDirection:"column",gap:v?"10px":"6px",fontSize:v?"14px":"12px",maxWidth:v?"760px":void 0,margin:v?"0 auto":void 0,width:v?"100%":void 0,padding:v?"8px 0":void 0},children:[G("div",{style:{display:"flex",justifyContent:"flex-end"},children:G("button",{type:"button",class:"ax-node-action",title:"Point the agent at this node — sets it as the agent's current AX focus so the agent pulls it into context to work on next (a one-click alternative to manually pinning).",style:DK,onClick:(Y)=>{Y.stopPropagation(),i_($,"ax.focus.set",void 0,"Focus set")},children:"Set focus"},void 0,!1,void 0,this)},void 0,!1,void 0,this),O!==null&&O>0&&G("div",{style:{marginBottom:"8px"},children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:"Token Usage"},void 0,!1,void 0,this),G("div",{style:{height:"6px",background:"var(--c-surface-hover)",borderRadius:"3px",overflow:"hidden",marginBottom:"4px"},children:G("div",{style:{height:"100%",width:`${Math.min(100,(K??0)*100)}%`,background:k,borderRadius:"3px",transition:"width 0.3s ease"}},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{style:{fontSize:"11px",color:"var(--c-muted)"},children:[B,"% — ",RK(b)," / ",RK(O)," tokens",W!==null&&G(a$,{children:[" · ",W," messages"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Pinned Context (",z.length,")"]},void 0,!0,void 0,this),z.map((Y)=>G("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:Y.title},void 0,!1,void 0,this),Y.summary&&G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px",whiteSpace:"pre-wrap"},children:Y.summary},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:Y.kind},void 0,!1,void 0,this)},void 0,!1,void 0,this),Y.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:Y.path},void 0,!1,void 0,this),Y.path.startsWith("/")&&G("button",{type:"button",onClick:()=>void A_(Y.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},Y.id,!0,void 0,this))]},void 0,!0,void 0,this),!J&&_.length>0&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Context (",_.length,")"]},void 0,!0,void 0,this),_.map((Y)=>{let H=sk(Y);return G("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:H.title},void 0,!1,void 0,this),G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px"},children:H.summary},void 0,!1,void 0,this),H.pathDisplay&&G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all"},children:H.pathDisplay},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:[G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-accent-10)",color:"var(--c-accent)",borderRadius:"3px",display:"inline-block"},children:H.status},void 0,!1,void 0,this),H.category&&G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:H.category},void 0,!1,void 0,this),G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:H.sourceKind},void 0,!1,void 0,this),H.required&&G("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-warn-12)",color:"var(--c-warn-alt)",borderRadius:"3px",display:"inline-block"},children:"Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y.path&&G("div",{style:{marginTop:"6px"},children:G("button",{type:"button",onClick:()=>void X(Y),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},Y.key??H.pathDisplay??H.title,!0,void 0,this)})]},void 0,!0,void 0,this),!J&&U.length>0&&G("div",{children:[G("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px",marginTop:_.length>0?"8px":0},children:["References (",U.length,")"]},void 0,!0,void 0,this),U.map((Y)=>G("a",{href:Y.url,target:"_blank",rel:"noopener noreferrer",style:{display:"block",padding:"4px 8px",color:"var(--c-accent)",fontSize:"11px",textDecoration:"none",borderRadius:"4px",marginBottom:"2px",wordBreak:"break-all"},children:[Y.url,Y.reason&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",marginLeft:"6px"},children:["(",Y.reason,")"]},void 0,!0,void 0,this)]},Y.id,!0,void 0,this))]},void 0,!0,void 0,this),P&&G("div",{style:{padding:"8px 10px",background:"var(--c-surface-subtle)",borderRadius:"6px",borderLeft:"2px solid var(--c-accent)"},children:[G("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"4px"},children:P.title},void 0,!1,void 0,this),P.summary&&G("div",{style:{color:"var(--c-text-soft)",fontSize:"11px",lineHeight:1.5,whiteSpace:"pre-wrap"},children:P.summary},void 0,!1,void 0,this),P.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:P.path},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>void A_(P.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!J&&!P&&_.length===0&&U.length===0&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:"No context loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function gH($){let v=$.split(".").pop()?.toLowerCase()??"";return{ts:"TypeScript",tsx:"TSX",js:"JavaScript",jsx:"JSX",py:"Python",rs:"Rust",go:"Go",rb:"Ruby",java:"Java",kt:"Kotlin",swift:"Swift",c:"C",cpp:"C++",h:"C/C++",css:"CSS",html:"HTML",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",toml:"TOML",sql:"SQL",sh:"Shell",bash:"Shell",xml:"XML",graphql:"GraphQL",proto:"Protobuf"}[v]??(v.toUpperCase()||"Text")}function l_({node:$,expanded:v=!1}){let g=$.data.path||$.data.content||"",_=$.data.title||g.split("/").pop()||"File",U=$.data.fileContent,z=$.data.updatedAt,J=$.data.lineCount,[b,O]=o(U??""),[K,W]=o(!U&&!!g),[B,k]=o(null);m(()=>{if(!g)return;if(U!==void 0){O(U),W(!1);return}let L=!1;return W(!0),k(null),TU(g).then(({content:q})=>{if(L)return;if(!q&&q!==""){k("File not found"),W(!1);return}O(q),W(!1);let F=q.split(`
36
- `).length;v$($.id,{fileContent:q,lineCount:F}),Zv($.id,{data:{fileContent:q,lineCount:F}})}).catch(()=>{if(!L)k("Failed to load file"),W(!1)}),()=>{L=!0}},[g,U]),m(()=>{if(U!==void 0&&U!==b)O(U)},[U]);let P=Q(()=>{if(!g)return;W(!0),k(null),v$($.id,{fileContent:void 0}),Zv($.id,{data:{fileContent:void 0}}),TU(g).then(({content:L})=>{O(L),W(!1);let q=L.split(`
37
- `).length,F=new Date().toISOString();v$($.id,{fileContent:L,lineCount:q,updatedAt:F}),Zv($.id,{data:{fileContent:L,lineCount:q,updatedAt:F}})}).catch(()=>{k("Failed to reload"),W(!1)})},[g,$.id]),X=gH(g),Y=b.split(`
38
- `),H=`${String(Y.length).length+1}ch`;if(!g)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No file path set"},void 0,!1,void 0,this);return G("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:"var(--mono)",fontSize:v?"13px":"11px"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[G("span",{style:{fontSize:"9px",padding:"1px 5px",background:"var(--c-accent-12)",color:"var(--c-accent)",borderRadius:"3px",fontWeight:600},children:X},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-text-soft)",fontSize:v?"12px":"10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},title:g,children:g},void 0,!1,void 0,this),J!==void 0&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:[J," lines"]},void 0,!0,void 0,this),z&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:new Date(z).toLocaleTimeString()},void 0,!1,void 0,this),G("button",{type:"button",class:"ax-node-action",title:"Mark this file as AX evidence",onClick:(L)=>{L.stopPropagation(),i_($,"ax.evidence.add",{kind:"file",title:g.split("/").pop()||g,ref:g},"Marked as evidence")},style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"⊕"},void 0,!1,void 0,this),G("button",{type:"button",onClick:P,title:"Reload file",style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"↻"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,overflow:"auto",padding:"8px 0",background:v?"var(--c-panel-soft)":void 0,borderRadius:v?"0 0 8px 8px":void 0},children:[K&&G("div",{style:{color:"var(--c-dim)",padding:"12px",fontStyle:"italic"},children:"Loading…"},void 0,!1,void 0,this),B&&G("div",{style:{color:"var(--c-danger)",padding:"12px"},children:B},void 0,!1,void 0,this),!K&&!B&&G("pre",{style:{margin:0,lineHeight:"1.55",tabSize:2},children:Y.map((L,q)=>G("div",{style:{display:"flex",minHeight:"1.55em"},children:[G("span",{style:{width:H,minWidth:H,textAlign:"right",color:"var(--c-dim)",paddingRight:"12px",paddingLeft:"10px",userSelect:"none",flexShrink:0,opacity:0.6},children:q+1},void 0,!1,void 0,this),G("code",{style:{color:"var(--c-text)",whiteSpace:"pre",paddingRight:"10px"},children:L||`
39
- `},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var _H=new Set(["title","__type","content","strictSize","arrangeLocked"]);function T4({node:$}){let v=$.data,_=(typeof v.content==="string"?v.content:"").split(/\r\n|\r|\n|\\n/).map((z)=>z.trimEnd()).filter((z)=>z.length>0),U=Object.entries(v).filter(([z])=>!_H.has(z));if(_.length===0&&U.length===0)return G("div",{style:{color:"var(--c-dim)",fontSize:"12px",fontStyle:"italic"},children:"No ledger data"},void 0,!1,void 0,this);return G("div",{style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px"},children:[_.length>0&&G("div",{style:{display:"flex",flexDirection:"column"},children:_.map((z,J)=>G("div",{style:{padding:"3px 0",borderBottom:J<_.length-1?"1px solid rgba(45,55,90,0.3)":"none",color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:z},J,!1,void 0,this))},void 0,!1,void 0,this),U.map(([z,J])=>G("div",{style:{display:"flex",justifyContent:"space-between",gap:"8px",padding:"3px 0",borderBottom:"1px solid rgba(45,55,90,0.3)"},children:[G("span",{style:{color:"var(--c-muted)",fontSize:"11px",flexShrink:0},children:z.replace(/([A-Z])/g," $1").replace(/^./,(b)=>b.toUpperCase())},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",textAlign:"right",wordBreak:"break-word"},children:typeof J==="object"?JSON.stringify(J):String(J??"—")},void 0,!1,void 0,this)]},z,!0,void 0,this))]},void 0,!0,void 0,this)}var i2=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Qv=i2?"⌘":"Ctrl";function x_($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.slice(g,_),J=U.slice(Math.max(0,g-v.length),g),b=U.slice(_,_+v.length);if(J===v&&b===v){let O=U.slice(0,g-v.length)+z+U.slice(_+v.length);hv($,O,g-v.length,_-v.length);return}if(z){let O=U.slice(0,g)+v+z+v+U.slice(_);hv($,O,g+v.length,_+v.length)}else{let O=U.slice(0,g)+v+v+U.slice(_);hv($,O,g+v.length,g+v.length)}}function mU($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.lastIndexOf(`
35
+ `:"",G=Math.max(0,g-J.length);return`${J}${qv(z,G)}`.trim()}default:return c_($.data,g)}}function Ek($,v){let g=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,U=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2;return Math.sqrt((g-U)**2+(_-z)**2)}function mk($,v){let g=$.position.x+$.size.width,_=$.position.y+$.size.height,U=v.position.x+v.size.width,z=v.position.y+v.size.height,J=Math.max(0,Math.max($.position.x,v.position.x)-Math.min(g,U)),G=Math.max(0,Math.max($.position.y,v.position.y)-Math.min(_,z));return Math.sqrt(J**2+G**2)}function ck($){let v=[...$],g=100;return v.sort((_,U)=>{let z=Math.floor(_.position.y/100),J=Math.floor(U.position.y/100);if(z!==J)return z-J;return _.position.x-U.position.x}),v}function ik($){let v=$.find((U)=>U.data.title&&typeof U.data.title==="string");if(v&&$.length<=3)return $.filter((z)=>z.data.title).map((z)=>z.data.title).slice(0,3).join(", ");let g={};for(let U of $)g[U.type]=(g[U.type]??0)+1;let _=Object.entries(g).map(([U,z])=>z===1?U:`${z} ${U}`);if(v)return`${v.data.title} + ${_.join(", ")}`;return _.join(", ")}function xk($,v){return $.x<=v.x+v.width&&$.x+$.width>=v.x&&$.y<=v.y+v.height&&$.y+$.height>=v.y}function hk($,v){let g=v.filter((U)=>xk($.bounds,{x:U.position.x,y:U.position.y,width:U.size.width,height:U.size.height})),_=g.map((U)=>typeof U.data.title==="string"&&U.data.title.length>0?U.data.title:U.id);return{id:$.id,label:$.label??$.text??null,bounds:$.bounds,targetNodeIds:g.map((U)=>U.id),targetNodeTitles:_,target:_.length>0?_.join(", "):"empty canvas region"}}function lk($,v=200){if($.length===0)return[];let g=new Map,_=(K)=>{while(g.get(K)!==K){let O=g.get(K);g.set(K,g.get(O)),K=O}return K},U=(K,O)=>{let W=_(K),B=_(O);if(W!==B)g.set(W,B)};for(let K of $)g.set(K.id,K.id);for(let K=0;K<$.length;K++)for(let O=K+1;O<$.length;O++)if(mk($[K],$[O])<=v)U($[K].id,$[O].id);let z=new Map;for(let K of $){let O=_(K.id);if(!z.has(O))z.set(O,[]);z.get(O).push(K)}let J=[],G=0;for(let[,K]of z){if(K.length<2)continue;let O=K.map((I)=>I.position.x),W=K.map((I)=>I.position.y),B=K.map((I)=>I.position.x+I.size.width),k=K.map((I)=>I.position.y+I.size.height),P=Math.min(...O),X=Math.min(...W),L=Math.max(...B),Y=Math.max(...k);J.push({id:`cluster-${G++}`,nodeIds:K.map((I)=>I.id),label:ik(K),centroid:{x:Math.round((P+L)/2),y:Math.round((X+Y)/2)},bounds:{x:P,y:X,width:L-P,height:Y-X}})}return J.sort((K,O)=>{let W=Math.floor(K.centroid.y/200),B=Math.floor(O.centroid.y/200);if(W!==B)return W-B;return K.centroid.x-O.centroid.x}),J}function pk($,v,g=5,_=600){let U=$.filter((J)=>v.has(J.id)),z=$.filter((J)=>!v.has(J.id));return U.map((J)=>{let G=z.map((K)=>({node:K,distance:Ek(J,K)})).filter((K)=>K.distance<=_).sort((K,O)=>K.distance-O.distance).slice(0,g);return{pinnedNodeId:J.id,pinnedNodeTitle:J.data.title??null,neighbors:G.map((K)=>({id:K.node.id,type:K.node.type,title:K.node.data.title??null,distance:Math.round(K.distance)}))}})}function mU($,v,g,_=[]){let U=lk($),z=new Map;for(let O of U)for(let W of O.nodeIds)z.set(W,O.id);let G=ck($).map((O,W)=>({id:O.id,type:O.type,title:O.data.title??null,content:yO(O,{defaultTextLength:320,webpageTextLength:640})||null,clusterId:z.get(O.id)??null,readingOrder:W})),K=pk($,g);return{totalNodes:$.length,clusters:U,nodesInReadingOrder:G,pinnedNeighborhoods:K,annotations:_.map((O)=>hk(O,$))}}function T4($){if(!$)return null;let v=$.data.title;return typeof v==="string"&&v.trim().length>0?v.trim():null}function i_($,v){return{id:$?.id??v,title:T4($),nodeType:$?.type??"markdown"}}function DO($,v){return{id:$.id,edgeType:$.type,fromId:$.from,toId:$.to,fromTitle:T4(v.get($.from)),toTitle:T4(v.get($.to))}}function x_($){return new Map($.map((v)=>[v.id,v]))}function RO($){return new Map($.map((v)=>[v.id,v]))}function Vv($){return Array.from($).sort((v,g)=>v.localeCompare(g))}function m2($,v){if($.length!==v.length)return!1;for(let g=0;g<$.length;g++)if($[g]!==v[g])return!1;return!0}function c2($){if(!$||$.type!=="group")return[];let v=$.data.children;if(!Array.isArray(v))return[];return v.filter((g)=>typeof g==="string").sort((g,_)=>g.localeCompare(_))}function uO($){let v=new Map;for(let g of $.clusters){let _=[...g.nodeIds].sort((U,z)=>U.localeCompare(z));for(let U of _)v.set(U,_.filter((z)=>z!==U))}return v}function TO($){let v=new Map;for(let g of $.pinnedNeighborhoods)v.set(g.pinnedNodeId,g.neighbors.map((_)=>_.id).sort((_,U)=>_.localeCompare(U)));return v}function ok($,v){let g=Vv(Array.from(v).filter((U)=>!$.has(U))),_=Vv(Array.from($).filter((U)=>!v.has(U)));return{added:g,removed:_}}function jO($){let v=$&&typeof $==="object"?$:{};return{timestamp:typeof v.timestamp==="string"?v.timestamp:void 0,sessionId:typeof v.sessionId==="string"?v.sessionId:void 0}}function nk($,v,g){if(!$||!g)return{layout:$,pinnedNodeIds:[],primaryFocusNodeIds:[],secondaryFocusNodeIds:[],regions:[],spatial:g};let _=x_($.nodes),U=Vv(v).filter((K)=>_.has(K)),z=new Set(U),J=new Set,G=[];for(let K of g.pinnedNeighborhoods){if(!z.has(K.pinnedNodeId))continue;let O=Vv([K.pinnedNodeId,...K.neighbors.map((W)=>W.id)]).filter((W,B,k)=>k.indexOf(W)===B&&_.has(W));for(let W of O)if(!z.has(W))J.add(W);G.push({id:`region-${K.pinnedNodeId}`,primaryNodeId:K.pinnedNodeId,nodeIds:O})}if(G.length===0&&U.length>0)for(let K of U)G.push({id:`region-${K}`,primaryNodeId:K,nodeIds:[K]});return{layout:$,pinnedNodeIds:U,primaryFocusNodeIds:U,secondaryFocusNodeIds:Vv(J),regions:G,spatial:g}}class h_{currentLayout=null;currentPins=new Set;previousSpatial=null;setInitialPins($){this.currentPins=new Set($)}getAttentionSnapshot(){return nk(this.currentLayout,this.currentPins,this.previousSpatial)}handleMessage($){if($.event==="context-pins-changed")return this.handleContextPinsChanged($.data);if($.event==="canvas-layout-update")return this.handleLayoutUpdate($.data);return[]}handleContextPinsChanged($){let v=$&&typeof $==="object"?$:{},g=Array.isArray(v.nodeIds)?v.nodeIds.filter((O)=>typeof O==="string"):[],_=jO($),U=new Set(g),{added:z,removed:J}=ok(this.currentPins,U);if(this.currentPins=U,!this.currentLayout)return[];let G=x_(this.currentLayout.nodes),K={added:z.map((O)=>i_(G.get(O),O)),removed:J.map((O)=>i_(G.get(O),O))};if(this.previousSpatial=mU(this.currentLayout.nodes,this.currentLayout.edges,this.currentPins,this.currentLayout.annotations??[]),K.added.length===0&&K.removed.length===0)return[];return[{type:"context-pin",..._,...K}]}handleLayoutUpdate($){let v=$&&typeof $==="object"?$:{},g=v.layout&&typeof v.layout==="object"?v.layout:null;if(!g)return[];let _=jO($);if(!this.currentLayout)return this.currentLayout=g,this.previousSpatial=mU(g.nodes,g.edges,this.currentPins,g.annotations??[]),[];let U=this.currentLayout,z=this.previousSpatial??mU(U.nodes,U.edges,this.currentPins,U.annotations??[]),J=mU(g.nodes,g.edges,this.currentPins,g.annotations??[]),G=[],K=x_(U.nodes),O=x_(g.nodes),W=RO(U.edges),B=RO(g.edges),k=Vv(Array.from(B.keys()).filter((I)=>!W.has(I))).map((I)=>B.get(I)).filter((I)=>I!==void 0);if(k.length>0)G.push({type:"connect",..._,edges:k.map((I)=>DO(I,O))});let P=Vv(Array.from(K.keys()).filter((I)=>!O.has(I))),X=Vv(Array.from(W.keys()).filter((I)=>!B.has(I)));if(P.length>0||X.length>0)G.push({type:"remove",..._,nodes:P.map((I)=>i_(K.get(I),I)),edges:X.map((I)=>W.get(I)).filter((I)=>I!==void 0).map((I)=>DO(I,K))});let L=this.buildGroupEvent(K,O,_);if(L)G.push(L);let Y=this.buildMoveEndEvent(U,g,K,O,z,J,_);if(Y)G.push(Y);return this.currentLayout=g,this.previousSpatial=J,G}buildGroupEvent($,v,g){let _=Vv(Array.from($.values()).filter((G)=>G.type==="group").map((G)=>G.id)),U=Vv(Array.from(v.values()).filter((G)=>G.type==="group").map((G)=>G.id)),z=U.filter((G)=>!_.includes(G)).map((G)=>{let K=v.get(G),O=c2(K);return{id:G,title:T4(K),childCount:O.length}}),J=[];for(let G of U.filter((K)=>_.includes(K))){let K=c2($.get(G)),O=c2(v.get(G));if(m2(K,O))continue;J.push({id:G,title:T4(v.get(G)),addedChildIds:O.filter((W)=>!K.includes(W)),removedChildIds:K.filter((W)=>!O.includes(W)),childCount:O.length})}if(z.length===0&&J.length===0)return null;return{type:"group",...g,created:z,updated:J}}buildMoveEndEvent($,v,g,_,U,z,J){let G=Vv(Array.from(_.keys()).filter((Y)=>{let I=g.get(Y),q=_.get(Y);if(!I||!q)return!1;return I.position.x!==q.position.x||I.position.y!==q.position.y}));if(G.length===0)return null;let K=uO(U),O=uO(z),W=TO(U),B=TO(z),k=new Map,P=(Y,I)=>{let q=k.get(Y)??new Set;q.add(I),k.set(Y,q)};for(let Y of G){let I=K.get(Y)??[],q=O.get(Y)??[];if(!m2(I,q))if(I.length===0&&q.length>0)P(Y,"joined cluster");else if(I.length>0&&q.length===0)P(Y,"left cluster");else P(Y,"cluster changed")}let X=new Set([...W.keys(),...B.keys()]);for(let Y of X){let I=W.get(Y)??[],q=B.get(Y)??[];if(m2(I,q))continue;let w=T4(_.get(Y)??g.get(Y))??Y,S=q.filter((o)=>!I.includes(o)),C=I.filter((o)=>!q.includes(o));for(let o of S)if(G.includes(o))P(o,`entered pinned neighborhood of "${w}"`);for(let o of C)if(G.includes(o))P(o,`left pinned neighborhood of "${w}"`);if(G.includes(Y))P(Y,"pinned neighborhood changed")}let L=G.filter((Y)=>(k.get(Y)?.size??0)>0).map((Y)=>{let I=_.get(Y);return{...i_(I,Y),reasons:Array.from(k.get(Y)??[]).sort((q,w)=>q.localeCompare(w))}});if(L.length===0)return null;return{type:"move-end",...J,nodes:L}}}var l2=new h_,p2=[],cU=null,j4=null,i2="",x2=0;function VO($,v){return globalThis.setTimeout($,v)}function h2($){if($===null)return;globalThis.clearTimeout($)}function tk($){if(typeof globalThis.requestAnimationFrame==="function"){globalThis.requestAnimationFrame(()=>$());return}$()}function S6($,v){return $&&$.trim().length>0?$.trim():v}function J6($,v=3){if($.length===0)return"";if($.length<=v)return $.join(", ");return`${$.slice(0,v).join(", ")} +${$.length-v}`}function dk($){return Array.from(new Set(Array.from($).filter((v)=>v.length>0)))}function Cv($,v,g,_,U=Date.now()){return{id:`${$}-${U}-${Math.random().toString(36).slice(2,8)}`,tone:$,title:v,detail:g,nodeIds:dk(_),createdAt:U}}function rO($){if($==="joined cluster")return"joined a nearby cluster";if($==="left cluster")return"moved away from its cluster";if($==="cluster changed")return"shifted into a different cluster";if($==="pinned neighborhood changed")return"changed the local focus field";let v=/^entered pinned neighborhood of "(.+)"$/.exec($);if(v)return`moved into focus around ${v[1]}`;let g=/^left pinned neighborhood of "(.+)"$/.exec($);if(g)return`moved out of focus around ${g[1]}`;return $}function ak($){let v=$.added.map((U)=>S6(U.title,U.id)),g=$.removed.map((U)=>S6(U.title,U.id));if(v.length===0&&g.length===0)return null;let _="";if(v.length>0&&g.length===0)_=`Now in focus: ${J6(v)}`;else if(g.length>0&&v.length===0)_=`Removed from focus: ${J6(g)}`;else{let U=[];if(v.length>0)U.push(`${J6(v)} added`);if(g.length>0)U.push(`${J6(g)} removed`);_=U.join(" · ")}return Cv("context","Context updated",_,[...$.added.map((U)=>U.id),...$.removed.map((U)=>U.id)],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function sk($){if($.edges.length===0)return null;if($.edges.length===1){let v=$.edges[0];return Cv("relationship","Relationship added",`${S6(v.fromTitle,v.fromId)} linked to ${S6(v.toTitle,v.toId)}`,[v.fromId,v.toId],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return Cv("relationship","Relationships added",`${$.edges.length} connections changed the board structure`,$.edges.flatMap((v)=>[v.fromId,v.toId]),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function ek($){if($.nodes.length===0&&$.edges.length===0)return null;let v=$.nodes.map((_)=>S6(_.title,_.id)),g=[];if(v.length>0)g.push(J6(v));if($.edges.length>0)g.push(`${$.edges.length} relationship${$.edges.length===1?"":"s"}`);return Cv("remove","Items removed",g.join(" · "),[...$.nodes.map((_)=>_.id),...$.edges.flatMap((_)=>[_.fromId,_.toId])],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function $Y($){if($.created.length>0){let v=$.created.map((g)=>S6(g.title,g.id));return Cv("group",$.created.length===1?"Group created":"Groups created",$.created.length===1?`${v[0]} now frames ${$.created[0].childCount} items`:J6(v),$.created.map((g)=>g.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}if($.updated.length>0){let v=$.updated.map((g)=>S6(g.title,g.id));return Cv("group",$.updated.length===1?"Group updated":"Groups updated",$.updated.length===1?`${v[0]} now holds ${$.updated[0].childCount} items`:J6(v),$.updated.map((g)=>g.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return null}function vY($){if($.nodes.length===0)return null;let v=$.nodes.flatMap((z)=>z.reasons),g=$.nodes.map((z)=>S6(z.title,z.id)),_=$.timestamp?Date.parse($.timestamp)||Date.now():Date.now();if(v.some((z)=>z.includes("pinned neighborhood"))){if($.nodes.length===1)return Cv("neighborhood","Neighborhood changed",`${g[0]} ${rO($.nodes[0].reasons[0])}`,$.nodes.map((z)=>z.id),_);return Cv("neighborhood","Neighborhood changed",J6(g),$.nodes.map((z)=>z.id),_)}let U=v.filter((z)=>z.includes("cluster"));if(U.length>0){let z=U.every((J)=>J==="joined cluster");if($.nodes.length===1)return Cv("cluster",z?"Cluster formed":"Cluster changed",`${g[0]} ${rO($.nodes[0].reasons[0])}`,$.nodes.map((J)=>J.id),_);return Cv("cluster",z?"Cluster formed":"Cluster changed",J6(g),$.nodes.map((J)=>J.id),_)}return null}function UY($){switch($.type){case"context-pin":return ak($);case"connect":return sk($);case"remove":return ek($);case"group":return $Y($);case"move-end":return vY($)}}function gY(){let $=l2.getAttentionSnapshot();cK($.primaryFocusNodeIds,$.secondaryFocusNodeIds,$.regions)}function CO(){if(cU!==null)return;let $=p2.shift()??null;if(!$){A_(null);return}A_($);let v=Math.max(1800,Math.min(2800,1600+$.detail.length*18));cU=VO(()=>{cU=null,A_(null),CO()},v)}function fO($){p2.push($),CO()}function r4($,v,g="",_=[]){fO(Cv($,v,g,_))}function _Y($){if(h2(j4),j4=null,Z_([]),$.length===0)return;tk(()=>{Z_($),j4=VO(()=>{j4=null,Z_([])},900)})}function zY($){let v=`${$.tone}:${$.title}:${$.detail}`,g=$.createdAt;if(v===i2&&g-x2<1200)return!0;return i2=v,x2=g,!1}function o2(){h2(cU),h2(j4),cU=null,j4=null,p2=[],i2="",x2=0,l2=new h_,mK()}function n2($){let v=l2.handleMessage($).map((g)=>UY(g)).filter((g)=>g!==null);gY();for(let g of v){if(zY(g))continue;iK(g),fO(g),_Y(g.nodeIds)}}async function l_($,v,g,_){let U=await D_({type:v,sourceNodeId:$.id,sourceSurface:"native-node",...g?{payload:g}:{}});if(U.ok)r4("context",_,"",[$.id]);else r4("remove","AX action failed",U.error??U.code??"Unknown error",[$.id])}var EO={padding:"3px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",flexShrink:0};function JY($){let v=$.title||$.label||$.key||"Context",g=$.summary?.trim()||"Available in startup context.",_=$.pathDisplay||$.path||"",U=$.category==="profile"?"Operator":$.category==="planning"||$.category==="memory"?"Product":$.category?$.category.charAt(0).toUpperCase()+$.category.slice(1):void 0,z=$.sourceKind==="global"?"Global":"Workspace",J=$.state==="missing"?"Missing":$.state==="stale"?"Stale":$.state==="invalid"?"Invalid":"Loaded";return{title:v,summary:g,pathDisplay:_,category:U,sourceKind:z,status:J,required:$.required===!0}}function fv($){return typeof $==="string"?$.trim():""}function GY($){return $.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function bY($){let v=fv($.title),g=fv($.content),_=GY(fv($.rendered)),U=g||_,z=fv($.path);if(!v&&!U&&!z)return null;return{title:v||"Context",summary:U,path:z}}function KY($){let v=fv($.data.title)||$.id,g=fv($.data.content)||fv($.data.excerpt)||fv($.data.description)||fv($.data.pageTitle)||"",_=fv($.data.path)||fv($.data.url);return{id:$.id,title:v,summary:g,kind:$v[$.type]??$.type,path:_}}function mO($){if($===null||!Number.isFinite($)||$<0)return"0";if($>=1e6)return`${($/1e6).toFixed(1)}m`;if($>=1000)return`${($/1000).toFixed(1)}k`;return`${Math.round($)}`}function OY($){if($>=0.95)return"var(--c-danger)";if($>=0.85)return"var(--c-warn)";if($>=0.7)return"var(--c-warn)";return"var(--c-accent)"}function _4({node:$,expanded:v=!1,pinnedNodes:g=[]}){let _=$.data.cards??[],U=$.data.auxTabs??[],z=g.map(KY),J=z.length>0,G=typeof $.data.currentTokens==="number"?$.data.currentTokens:null,K=typeof $.data.tokenLimit==="number"?$.data.tokenLimit:null,O=typeof $.data.utilization==="number"?$.data.utilization:null,W=typeof $.data.messagesLength==="number"?$.data.messagesLength:null,B=O!==null?Math.max(0,Math.min(100,Math.round(O*100))):null,k=OY(O??0),P=!J&&_.length===0&&U.length===0?bY($.data):null,X=async(L)=>{let Y=typeof L.path==="string"?L.path.trim():"";if(!Y)return;await M_(Y)};return b("div",{style:{display:"flex",flexDirection:"column",gap:v?"10px":"6px",fontSize:v?"14px":"12px",maxWidth:v?"760px":void 0,margin:v?"0 auto":void 0,width:v?"100%":void 0,padding:v?"8px 0":void 0},children:[b("div",{style:{display:"flex",justifyContent:"flex-end"},children:b("button",{type:"button",class:"ax-node-action",title:"Point the agent at this node — sets it as the agent's current AX focus so the agent pulls it into context to work on next (a one-click alternative to manually pinning).",style:EO,onClick:(L)=>{L.stopPropagation(),l_($,"ax.focus.set",void 0,"Focus set")},children:"Set focus"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K!==null&&K>0&&b("div",{style:{marginBottom:"8px"},children:[b("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:"Token Usage"},void 0,!1,void 0,this),b("div",{style:{height:"6px",background:"var(--c-surface-hover)",borderRadius:"3px",overflow:"hidden",marginBottom:"4px"},children:b("div",{style:{height:"100%",width:`${Math.min(100,(O??0)*100)}%`,background:k,borderRadius:"3px",transition:"width 0.3s ease"}},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("div",{style:{fontSize:"11px",color:"var(--c-muted)"},children:[B,"% — ",mO(G)," / ",mO(K)," tokens",W!==null&&b(e$,{children:[" · ",W," messages"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),J&&b("div",{children:[b("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Pinned Context (",z.length,")"]},void 0,!0,void 0,this),z.map((L)=>b("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[b("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:L.title},void 0,!1,void 0,this),L.summary&&b("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px",whiteSpace:"pre-wrap"},children:L.summary},void 0,!1,void 0,this),b("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:b("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:L.kind},void 0,!1,void 0,this)},void 0,!1,void 0,this),L.path&&b("div",{style:{marginTop:"6px"},children:[b("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:L.path},void 0,!1,void 0,this),L.path.startsWith("/")&&b("button",{type:"button",onClick:()=>void M_(L.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},L.id,!0,void 0,this))]},void 0,!0,void 0,this),!J&&_.length>0&&b("div",{children:[b("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px"},children:["Context (",_.length,")"]},void 0,!0,void 0,this),_.map((L)=>{let Y=JY(L);return b("div",{style:{padding:"6px 8px",background:"var(--c-surface-subtle)",borderRadius:"6px",marginBottom:"4px",borderLeft:"2px solid var(--c-accent)"},children:[b("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"2px"},children:Y.title},void 0,!1,void 0,this),b("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px"},children:Y.summary},void 0,!1,void 0,this),Y.pathDisplay&&b("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all"},children:Y.pathDisplay},void 0,!1,void 0,this),b("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"},children:[b("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-accent-10)",color:"var(--c-accent)",borderRadius:"3px",display:"inline-block"},children:Y.status},void 0,!1,void 0,this),Y.category&&b("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:Y.category},void 0,!1,void 0,this),b("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-surface-hover)",color:"var(--c-text-soft)",borderRadius:"3px",display:"inline-block"},children:Y.sourceKind},void 0,!1,void 0,this),Y.required&&b("span",{style:{fontSize:"9px",padding:"1px 4px",background:"var(--c-warn-12)",color:"var(--c-warn-alt)",borderRadius:"3px",display:"inline-block"},children:"Required"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L.path&&b("div",{style:{marginTop:"6px"},children:b("button",{type:"button",onClick:()=>void X(L),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},L.key??Y.pathDisplay??Y.title,!0,void 0,this)})]},void 0,!0,void 0,this),!J&&U.length>0&&b("div",{children:[b("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--c-muted)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"6px",marginTop:_.length>0?"8px":0},children:["References (",U.length,")"]},void 0,!0,void 0,this),U.map((L)=>b("a",{href:L.url,target:"_blank",rel:"noopener noreferrer",style:{display:"block",padding:"4px 8px",color:"var(--c-accent)",fontSize:"11px",textDecoration:"none",borderRadius:"4px",marginBottom:"2px",wordBreak:"break-all"},children:[L.url,L.reason&&b("span",{style:{color:"var(--c-dim)",fontSize:"10px",marginLeft:"6px"},children:["(",L.reason,")"]},void 0,!0,void 0,this)]},L.id,!0,void 0,this))]},void 0,!0,void 0,this),P&&b("div",{style:{padding:"8px 10px",background:"var(--c-surface-subtle)",borderRadius:"6px",borderLeft:"2px solid var(--c-accent)"},children:[b("div",{style:{fontWeight:600,color:"var(--c-text)",marginBottom:"4px"},children:P.title},void 0,!1,void 0,this),P.summary&&b("div",{style:{color:"var(--c-text-soft)",fontSize:"11px",lineHeight:1.5,whiteSpace:"pre-wrap"},children:P.summary},void 0,!1,void 0,this),P.path&&b("div",{style:{marginTop:"6px"},children:[b("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:P.path},void 0,!1,void 0,this),b("button",{type:"button",onClick:()=>void M_(P.path),style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-accent-12)",border:"1px solid var(--c-accent-25)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Open in canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!J&&!P&&_.length===0&&U.length===0&&b("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:"No context loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function WY($){let v=$.split(".").pop()?.toLowerCase()??"";return{ts:"TypeScript",tsx:"TSX",js:"JavaScript",jsx:"JSX",py:"Python",rs:"Rust",go:"Go",rb:"Ruby",java:"Java",kt:"Kotlin",swift:"Swift",c:"C",cpp:"C++",h:"C/C++",css:"CSS",html:"HTML",json:"JSON",yaml:"YAML",yml:"YAML",md:"Markdown",toml:"TOML",sql:"SQL",sh:"Shell",bash:"Shell",xml:"XML",graphql:"GraphQL",proto:"Protobuf"}[v]??(v.toUpperCase()||"Text")}function p_({node:$,expanded:v=!1}){let g=$.data.path||$.data.content||"",_=$.data.title||g.split("/").pop()||"File",U=$.data.fileContent,z=$.data.updatedAt,J=$.data.lineCount,[G,K]=h(U??""),[O,W]=h(!U&&!!g),[B,k]=h(null);E(()=>{if(!g)return;if(U!==void 0){K(U),W(!1);return}let I=!1;return W(!0),k(null),VU(g).then(({content:q})=>{if(I)return;if(!q&&q!==""){k("File not found"),W(!1);return}K(q),W(!1);let w=q.split(`
36
+ `).length;v$($.id,{fileContent:q,lineCount:w}),Zv($.id,{data:{fileContent:q,lineCount:w}})}).catch(()=>{if(!I)k("Failed to load file"),W(!1)}),()=>{I=!0}},[g,U]),E(()=>{if(U!==void 0&&U!==G)K(U)},[U]);let P=M(()=>{if(!g)return;W(!0),k(null),v$($.id,{fileContent:void 0}),Zv($.id,{data:{fileContent:void 0}}),VU(g).then(({content:I})=>{K(I),W(!1);let q=I.split(`
37
+ `).length,w=new Date().toISOString();v$($.id,{fileContent:I,lineCount:q,updatedAt:w}),Zv($.id,{data:{fileContent:I,lineCount:q,updatedAt:w}})}).catch(()=>{k("Failed to reload"),W(!1)})},[g,$.id]),X=WY(g),L=G.split(`
38
+ `),Y=`${String(L.length).length+1}ch`;if(!g)return b("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No file path set"},void 0,!1,void 0,this);return b("div",{style:{display:"flex",flexDirection:"column",height:"100%",fontFamily:"var(--mono)",fontSize:v?"13px":"11px"},children:[b("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 10px",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[b("span",{style:{fontSize:"9px",padding:"1px 5px",background:"var(--c-accent-12)",color:"var(--c-accent)",borderRadius:"3px",fontWeight:600},children:X},void 0,!1,void 0,this),b("span",{style:{color:"var(--c-text-soft)",fontSize:v?"12px":"10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},title:g,children:g},void 0,!1,void 0,this),J!==void 0&&b("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:[J," lines"]},void 0,!0,void 0,this),z&&b("span",{style:{color:"var(--c-dim)",fontSize:"10px",flexShrink:0},children:new Date(z).toLocaleTimeString()},void 0,!1,void 0,this),b("button",{type:"button",class:"ax-node-action",title:"Mark this file as AX evidence",onClick:(I)=>{I.stopPropagation(),l_($,"ax.evidence.add",{kind:"file",title:g.split("/").pop()||g,ref:g},"Marked as evidence")},style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"⊕"},void 0,!1,void 0,this),b("button",{type:"button",onClick:P,title:"Reload file",style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 4px",fontSize:"12px",flexShrink:0},children:"↻"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{style:{flex:1,overflow:"auto",padding:"8px 0",background:v?"var(--c-panel-soft)":void 0,borderRadius:v?"0 0 8px 8px":void 0},children:[O&&b("div",{style:{color:"var(--c-dim)",padding:"12px",fontStyle:"italic"},children:"Loading…"},void 0,!1,void 0,this),B&&b("div",{style:{color:"var(--c-danger)",padding:"12px"},children:B},void 0,!1,void 0,this),!O&&!B&&b("pre",{style:{margin:0,lineHeight:"1.55",tabSize:2},children:L.map((I,q)=>b("div",{style:{display:"flex",minHeight:"1.55em"},children:[b("span",{style:{width:Y,minWidth:Y,textAlign:"right",color:"var(--c-dim)",paddingRight:"12px",paddingLeft:"10px",userSelect:"none",flexShrink:0,opacity:0.6},children:q+1},void 0,!1,void 0,this),b("code",{style:{color:"var(--c-text)",whiteSpace:"pre",paddingRight:"10px"},children:I||`
39
+ `},void 0,!1,void 0,this)]},q,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var BY=new Set(["title","__type","content","strictSize","arrangeLocked"]);function V4({node:$}){let v=$.data,_=(typeof v.content==="string"?v.content:"").split(/\r\n|\r|\n|\\n/).map((z)=>z.trimEnd()).filter((z)=>z.length>0),U=Object.entries(v).filter(([z])=>!BY.has(z));if(_.length===0&&U.length===0)return b("div",{style:{color:"var(--c-dim)",fontSize:"12px",fontStyle:"italic"},children:"No ledger data"},void 0,!1,void 0,this);return b("div",{style:{display:"flex",flexDirection:"column",gap:"4px",fontSize:"12px"},children:[_.length>0&&b("div",{style:{display:"flex",flexDirection:"column"},children:_.map((z,J)=>b("div",{style:{padding:"3px 0",borderBottom:J<_.length-1?"1px solid rgba(45,55,90,0.3)":"none",color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:z},J,!1,void 0,this))},void 0,!1,void 0,this),U.map(([z,J])=>b("div",{style:{display:"flex",justifyContent:"space-between",gap:"8px",padding:"3px 0",borderBottom:"1px solid rgba(45,55,90,0.3)"},children:[b("span",{style:{color:"var(--c-muted)",fontSize:"11px",flexShrink:0},children:z.replace(/([A-Z])/g," $1").replace(/^./,(G)=>G.toUpperCase())},void 0,!1,void 0,this),b("span",{style:{color:"var(--c-text)",fontFamily:"var(--mono)",fontSize:"11px",textAlign:"right",wordBreak:"break-word"},children:typeof J==="object"?JSON.stringify(J):String(J??"—")},void 0,!1,void 0,this)]},z,!0,void 0,this))]},void 0,!0,void 0,this)}var t2=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Mv=t2?"⌘":"Ctrl";function o_($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.slice(g,_),J=U.slice(Math.max(0,g-v.length),g),G=U.slice(_,_+v.length);if(J===v&&G===v){let K=U.slice(0,g-v.length)+z+U.slice(_+v.length);lv($,K,g-v.length,_-v.length);return}if(z){let K=U.slice(0,g)+v+z+v+U.slice(_);lv($,K,g+v.length,_+v.length)}else{let K=U.slice(0,g)+v+v+U.slice(_);lv($,K,g+v.length,g+v.length)}}function iU($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.lastIndexOf(`
40
40
  `,g-1)+1,J=U.indexOf(`
41
- `,_),b=J===-1?U.length:J,O=U.slice(z,b);if(O.startsWith(v)){let W=U.slice(0,z)+O.slice(v.length)+U.slice(b);hv($,W,Math.max(z,g-v.length),Math.max(z,_-v.length));return}let K=U.slice(0,z)+v+U.slice(z);hv($,K,g+v.length,_+v.length)}function zH($){let{selectionStart:v,selectionEnd:g,value:_}=$,U=_.slice(v,g);if(U){let z=_.slice(0,v)+`[${U}](url)`+_.slice(g),J=v+U.length+3;hv($,z,J,J+3)}else{let z=_.slice(0,v)+"[text](url)"+_.slice(g);hv($,z,v+1,v+5)}}function JH($){let{selectionStart:v,selectionEnd:g,value:_}=$,U=_.slice(v,g),z="```";if(U){let J=_.slice(0,v)+`\`\`\`
41
+ `,_),G=J===-1?U.length:J,K=U.slice(z,G);if(K.startsWith(v)){let W=U.slice(0,z)+K.slice(v.length)+U.slice(G);lv($,W,Math.max(z,g-v.length),Math.max(z,_-v.length));return}let O=U.slice(0,z)+v+U.slice(z);lv($,O,g+v.length,_+v.length)}function PY($){let{selectionStart:v,selectionEnd:g,value:_}=$,U=_.slice(v,g);if(U){let z=_.slice(0,v)+`[${U}](url)`+_.slice(g),J=v+U.length+3;lv($,z,J,J+3)}else{let z=_.slice(0,v)+"[text](url)"+_.slice(g);lv($,z,v+1,v+5)}}function kY($){let{selectionStart:v,selectionEnd:g,value:_}=$,U=_.slice(v,g),z="```";if(U){let J=_.slice(0,v)+`\`\`\`
42
42
  ${U}
43
- \`\`\``+_.slice(g);hv($,J,v+3+1,v+3+1+U.length)}else{let J=_.slice(0,v)+"```\n\n```"+_.slice(g);hv($,J,v+3+1,v+3+1)}}function TK($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.lastIndexOf(`
43
+ \`\`\``+_.slice(g);lv($,J,v+3+1,v+3+1+U.length)}else{let J=_.slice(0,v)+"```\n\n```"+_.slice(g);lv($,J,v+3+1,v+3+1)}}function cO($,v){let{selectionStart:g,selectionEnd:_,value:U}=$,z=U.lastIndexOf(`
44
44
  `,g-1)+1,J=U.indexOf(`
45
- `,_),b=J===-1?U.length:J,O=U.slice(z,b).split(`
46
- `),K=g,W=_,B=O.map((P,X)=>{if(v){if(P.startsWith(" ")){if(X===0)K=Math.max(z,K-2);return W-=2,P.slice(2)}else if(P.startsWith("\t")){if(X===0)K=Math.max(z,K-1);return W-=1,P.slice(1)}return P}else{if(X===0)K+=2;return W+=2," "+P}}),k=U.slice(0,z)+B.join(`
47
- `)+U.slice(b);hv($,k,K,W)}function hv($,v,g,_){let U=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;if(U)U.call($,v);else $.value=v;$.selectionStart=g,$.selectionEnd=_,$.dispatchEvent(new Event("input",{bubbles:!0}))}var h_=[{key:"bold",label:"Bold",icon:"B",shortcut:"b",action:($)=>x_($,"**")},{key:"italic",label:"Italic",icon:"I",shortcut:"i",action:($)=>x_($,"_")},{key:"strike",label:"Strikethrough",icon:"S",shortcut:"u",action:($)=>x_($,"~~")},{key:"code",label:"Inline code",icon:"`",shortcut:"e",action:($)=>x_($,"`")},{key:"link",label:"Link",icon:"\uD83D\uDD17",shortcut:"k",action:zH},{key:"h1",label:"Heading 1",icon:"H1",action:($)=>mU($,"# ")},{key:"h2",label:"Heading 2",icon:"H2",action:($)=>mU($,"## ")},{key:"quote",label:"Blockquote",icon:"❝",action:($)=>mU($,"> ")},{key:"ul",label:"Bullet list",icon:"•",action:($)=>mU($,"- ")},{key:"ol",label:"Numbered list",icon:"1.",action:($)=>mU($,"1. ")},{key:"codeblock",label:"Code block",icon:"{ }",action:JH}];function jK($,v){if(!($.metaKey||$.ctrlKey))return!1;let g=h_.find((_)=>_.shortcut===$.key);if(!g)return!1;return $.preventDefault(),g.action(v),!0}function VK($){if($.selectionStart===$.selectionEnd)return null;let v=document.createElement("div"),g=getComputedStyle($),_=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","wordSpacing","textIndent","whiteSpace","wordWrap","overflowWrap","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxSizing","width"];for(let W of _)v.style[W]=g[W];v.style.position="absolute",v.style.visibility="hidden",v.style.overflow="hidden",v.style.height="auto",v.style.top="0",v.style.left="0";let U=$.value,z=document.createTextNode(U.slice(0,$.selectionStart)),J=document.createElement("span");J.textContent=U.slice($.selectionStart,$.selectionEnd)||".",v.appendChild(z),v.appendChild(J),v.appendChild(document.createTextNode(U.slice($.selectionEnd))),document.body.appendChild(v);let b=J.getBoundingClientRect(),O=v.getBoundingClientRect(),K=$.getBoundingClientRect();return document.body.removeChild(v),{top:K.top+(b.top-O.top)-$.scrollTop,left:K.left+(b.left-O.left)-$.scrollLeft,width:b.width}}var bH=h_.filter(($)=>$.shortcut),GH=h_.filter(($)=>!$.shortcut);function l2({textareaRef:$}){let[v,g]=o(!1),[_,U]=o({top:0,left:0}),z=y(null),J=y(null),b=Q(()=>{let W=$.current;if(!W||W.selectionStart===W.selectionEnd){g(!1);return}let B=VK(W);if(!B){g(!1);return}let k=380,P=Math.max(8,Math.min(B.left+B.width/2-k/2,window.innerWidth-k-8));U({top:B.top-40,left:P}),g(!0)},[$]);m(()=>{let W=$.current;if(!W)return;let B=()=>{if(J.current)clearTimeout(J.current);J.current=setTimeout(b,50)},k=()=>{J.current=setTimeout(()=>g(!1),200)},P=(X)=>{if(X.shiftKey||X.key.startsWith("Arrow"))B()};return W.addEventListener("select",B),W.addEventListener("mouseup",B),W.addEventListener("keyup",P),W.addEventListener("blur",k),()=>{if(W.removeEventListener("select",B),W.removeEventListener("mouseup",B),W.removeEventListener("keyup",P),W.removeEventListener("blur",k),J.current)clearTimeout(J.current)}},[$,b]);let O=Q((W)=>{let B=$.current;if(B)W.action(B),B.focus()},[$]);if(!v)return null;let K=i2?"⌘":"Ctrl";return G("div",{ref:z,class:"md-format-bar",style:{top:`${_.top}px`,left:`${_.left}px`},onMouseDown:(W)=>W.preventDefault(),children:[bH.map((W)=>G("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:`${W.label} (${K}+${W.shortcut.toUpperCase()})`,onClick:()=>O(W),children:W.icon},W.key,!1,void 0,this)),G("div",{class:"md-format-divider"},void 0,!1,void 0,this),GH.map((W)=>G("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:W.label,onClick:()=>O(W),children:W.icon},W.key,!1,void 0,this))]},void 0,!0,void 0,this)}var k5=CP(sK(),1);function ZH($){for(var v=1;v<arguments.length;v++){var g=arguments[v];for(var _ in g)if(Object.prototype.hasOwnProperty.call(g,_))$[_]=g[_]}return $}function d2($,v){return Array(v+1).join($)}function v5($){return $.replace(/^\n*/,"")}function U5($){var v=$.length;while(v>0&&$[v-1]===`
48
- `)v--;return $.substring(0,v)}function g5($){return U5(v5($))}var MH=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function a2($){return s2($,MH)}var _5=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function z5($){return s2($,_5)}function QH($){return b5($,_5)}var J5=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function SH($){return s2($,J5)}function NH($){return b5($,J5)}function s2($,v){return v.indexOf($.nodeName)>=0}function b5($,v){return $.getElementsByTagName&&v.some(function(g){return $.getElementsByTagName(g).length})}var rH=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function G5($){return rH.reduce(function(v,g){return v.replace(g[0],g[1])},$)}var Gv={};Gv.paragraph={filter:"p",replacement:function($){return`
45
+ `,_),G=J===-1?U.length:J,K=U.slice(z,G).split(`
46
+ `),O=g,W=_,B=K.map((P,X)=>{if(v){if(P.startsWith(" ")){if(X===0)O=Math.max(z,O-2);return W-=2,P.slice(2)}else if(P.startsWith("\t")){if(X===0)O=Math.max(z,O-1);return W-=1,P.slice(1)}return P}else{if(X===0)O+=2;return W+=2," "+P}}),k=U.slice(0,z)+B.join(`
47
+ `)+U.slice(G);lv($,k,O,W)}function lv($,v,g,_){let U=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;if(U)U.call($,v);else $.value=v;$.selectionStart=g,$.selectionEnd=_,$.dispatchEvent(new Event("input",{bubbles:!0}))}var n_=[{key:"bold",label:"Bold",icon:"B",shortcut:"b",action:($)=>o_($,"**")},{key:"italic",label:"Italic",icon:"I",shortcut:"i",action:($)=>o_($,"_")},{key:"strike",label:"Strikethrough",icon:"S",shortcut:"u",action:($)=>o_($,"~~")},{key:"code",label:"Inline code",icon:"`",shortcut:"e",action:($)=>o_($,"`")},{key:"link",label:"Link",icon:"\uD83D\uDD17",shortcut:"k",action:PY},{key:"h1",label:"Heading 1",icon:"H1",action:($)=>iU($,"# ")},{key:"h2",label:"Heading 2",icon:"H2",action:($)=>iU($,"## ")},{key:"quote",label:"Blockquote",icon:"❝",action:($)=>iU($,"> ")},{key:"ul",label:"Bullet list",icon:"•",action:($)=>iU($,"- ")},{key:"ol",label:"Numbered list",icon:"1.",action:($)=>iU($,"1. ")},{key:"codeblock",label:"Code block",icon:"{ }",action:kY}];function iO($,v){if(!($.metaKey||$.ctrlKey))return!1;let g=n_.find((_)=>_.shortcut===$.key);if(!g)return!1;return $.preventDefault(),g.action(v),!0}function xO($){if($.selectionStart===$.selectionEnd)return null;let v=document.createElement("div"),g=getComputedStyle($),_=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","wordSpacing","textIndent","whiteSpace","wordWrap","overflowWrap","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxSizing","width"];for(let W of _)v.style[W]=g[W];v.style.position="absolute",v.style.visibility="hidden",v.style.overflow="hidden",v.style.height="auto",v.style.top="0",v.style.left="0";let U=$.value,z=document.createTextNode(U.slice(0,$.selectionStart)),J=document.createElement("span");J.textContent=U.slice($.selectionStart,$.selectionEnd)||".",v.appendChild(z),v.appendChild(J),v.appendChild(document.createTextNode(U.slice($.selectionEnd))),document.body.appendChild(v);let G=J.getBoundingClientRect(),K=v.getBoundingClientRect(),O=$.getBoundingClientRect();return document.body.removeChild(v),{top:O.top+(G.top-K.top)-$.scrollTop,left:O.left+(G.left-K.left)-$.scrollLeft,width:G.width}}var YY=n_.filter(($)=>$.shortcut),HY=n_.filter(($)=>!$.shortcut);function d2({textareaRef:$}){let[v,g]=h(!1),[_,U]=h({top:0,left:0}),z=R(null),J=R(null),G=M(()=>{let W=$.current;if(!W||W.selectionStart===W.selectionEnd){g(!1);return}let B=xO(W);if(!B){g(!1);return}let k=380,P=Math.max(8,Math.min(B.left+B.width/2-k/2,window.innerWidth-k-8));U({top:B.top-40,left:P}),g(!0)},[$]);E(()=>{let W=$.current;if(!W)return;let B=()=>{if(J.current)clearTimeout(J.current);J.current=setTimeout(G,50)},k=()=>{J.current=setTimeout(()=>g(!1),200)},P=(X)=>{if(X.shiftKey||X.key.startsWith("Arrow"))B()};return W.addEventListener("select",B),W.addEventListener("mouseup",B),W.addEventListener("keyup",P),W.addEventListener("blur",k),()=>{if(W.removeEventListener("select",B),W.removeEventListener("mouseup",B),W.removeEventListener("keyup",P),W.removeEventListener("blur",k),J.current)clearTimeout(J.current)}},[$,G]);let K=M((W)=>{let B=$.current;if(B)W.action(B),B.focus()},[$]);if(!v)return null;let O=t2?"⌘":"Ctrl";return b("div",{ref:z,class:"md-format-bar",style:{top:`${_.top}px`,left:`${_.left}px`},onMouseDown:(W)=>W.preventDefault(),children:[YY.map((W)=>b("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:`${W.label} (${O}+${W.shortcut.toUpperCase()})`,onClick:()=>K(W),children:W.icon},W.key,!1,void 0,this)),b("div",{class:"md-format-divider"},void 0,!1,void 0,this),HY.map((W)=>b("button",{type:"button",class:`md-format-btn md-format-btn-${W.key}`,title:W.label,onClick:()=>K(W),children:W.icon},W.key,!1,void 0,this))]},void 0,!0,void 0,this)}var F5=lP(z5(),1);function uY($){for(var v=1;v<arguments.length;v++){var g=arguments[v];for(var _ in g)if(Object.prototype.hasOwnProperty.call(g,_))$[_]=g[_]}return $}function gz($,v){return Array(v+1).join($)}function b5($){return $.replace(/^\n*/,"")}function K5($){var v=$.length;while(v>0&&$[v-1]===`
48
+ `)v--;return $.substring(0,v)}function O5($){return K5(b5($))}var TY=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function _z($){return zz($,TY)}var W5=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function B5($){return zz($,W5)}function jY($){return k5($,W5)}var P5=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function rY($){return zz($,P5)}function VY($){return k5($,P5)}function zz($,v){return v.indexOf($.nodeName)>=0}function k5($,v){return $.getElementsByTagName&&v.some(function(g){return $.getElementsByTagName(g).length})}var CY=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Y5($){return CY.reduce(function(v,g){return v.replace(g[0],g[1])},$)}var Kv={};Kv.paragraph={filter:"p",replacement:function($){return`
49
49
 
50
50
  `+$+`
51
51
 
52
- `}};Gv.lineBreak={filter:"br",replacement:function($,v,g){return g.br+`
53
- `}};Gv.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function($,v,g){var _=Number(v.nodeName.charAt(1));if(g.headingStyle==="setext"&&_<3){var U=d2(_===1?"=":"-",$.length);return`
52
+ `}};Kv.lineBreak={filter:"br",replacement:function($,v,g){return g.br+`
53
+ `}};Kv.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function($,v,g){var _=Number(v.nodeName.charAt(1));if(g.headingStyle==="setext"&&_<3){var U=gz(_===1?"=":"-",$.length);return`
54
54
 
55
55
  `+$+`
56
56
  `+U+`
57
57
 
58
58
  `}else return`
59
59
 
60
- `+d2("#",_)+" "+$+`
60
+ `+gz("#",_)+" "+$+`
61
61
 
62
- `}};Gv.blockquote={filter:"blockquote",replacement:function($){return $=g5($).replace(/^/gm,"> "),`
62
+ `}};Kv.blockquote={filter:"blockquote",replacement:function($){return $=O5($).replace(/^/gm,"> "),`
63
63
 
64
64
  `+$+`
65
65
 
66
- `}};Gv.list={filter:["ul","ol"],replacement:function($,v){var g=v.parentNode;if(g.nodeName==="LI"&&g.lastElementChild===v)return`
66
+ `}};Kv.list={filter:["ul","ol"],replacement:function($,v){var g=v.parentNode;if(g.nodeName==="LI"&&g.lastElementChild===v)return`
67
67
  `+$;else return`
68
68
 
69
69
  `+$+`
70
70
 
71
- `}};Gv.listItem={filter:"li",replacement:function($,v,g){var _=g.bulletListMarker+" ",U=v.parentNode;if(U.nodeName==="OL"){var z=U.getAttribute("start"),J=Array.prototype.indexOf.call(U.children,v);_=(z?Number(z)+J:J+1)+". "}var b=/\n$/.test($);return $=g5($)+(b?`
71
+ `}};Kv.listItem={filter:"li",replacement:function($,v,g){var _=g.bulletListMarker+" ",U=v.parentNode;if(U.nodeName==="OL"){var z=U.getAttribute("start"),J=Array.prototype.indexOf.call(U.children,v);_=(z?Number(z)+J:J+1)+". "}var G=/\n$/.test($);return $=O5($)+(G?`
72
72
  `:""),$=$.replace(/\n/gm,`
73
73
  `+" ".repeat(_.length)),_+$+(v.nextSibling?`
74
- `:"")}};Gv.indentedCodeBlock={filter:function($,v){return v.codeBlockStyle==="indented"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,g){return`
74
+ `:"")}};Kv.indentedCodeBlock={filter:function($,v){return v.codeBlockStyle==="indented"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,g){return`
75
75
 
76
76
  `+v.firstChild.textContent.replace(/\n/g,`
77
77
  `)+`
78
78
 
79
- `}};Gv.fencedCodeBlock={filter:function($,v){return v.codeBlockStyle==="fenced"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,g){var _=v.firstChild.getAttribute("class")||"",U=(_.match(/language-(\S+)/)||[null,""])[1],z=v.firstChild.textContent,J=g.fence.charAt(0),b=3,O=new RegExp("^"+J+"{3,}","gm"),K;while(K=O.exec(z))if(K[0].length>=b)b=K[0].length+1;var W=d2(J,b);return`
79
+ `}};Kv.fencedCodeBlock={filter:function($,v){return v.codeBlockStyle==="fenced"&&$.nodeName==="PRE"&&$.firstChild&&$.firstChild.nodeName==="CODE"},replacement:function($,v,g){var _=v.firstChild.getAttribute("class")||"",U=(_.match(/language-(\S+)/)||[null,""])[1],z=v.firstChild.textContent,J=g.fence.charAt(0),G=3,K=new RegExp("^"+J+"{3,}","gm"),O;while(O=K.exec(z))if(O[0].length>=G)G=O[0].length+1;var W=gz(J,G);return`
80
80
 
81
81
  `+W+U+`
82
82
  `+z.replace(/\n$/,"")+`
83
83
  `+W+`
84
84
 
85
- `}};Gv.horizontalRule={filter:"hr",replacement:function($,v,g){return`
85
+ `}};Kv.horizontalRule={filter:"hr",replacement:function($,v,g){return`
86
86
 
87
87
  `+g.hr+`
88
88
 
89
- `}};Gv.inlineLink={filter:function($,v){return v.linkStyle==="inlined"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v){var g=e2(v.getAttribute("href")),_=$z(p_(v.getAttribute("title"))),U=_?' "'+_+'"':"";return"["+$+"]("+g+U+")"}};Gv.referenceLink={filter:function($,v){return v.linkStyle==="referenced"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v,g){var _=e2(v.getAttribute("href")),U=p_(v.getAttribute("title"));if(U)U=' "'+$z(U)+'"';var z,J;switch(g.linkReferenceStyle){case"collapsed":z="["+$+"][]",J="["+$+"]: "+_+U;break;case"shortcut":z="["+$+"]",J="["+$+"]: "+_+U;break;default:var b=this.references.length+1;z="["+$+"]["+b+"]",J="["+b+"]: "+_+U}return this.references.push(J),z},references:[],append:function($){var v="";if(this.references.length)v=`
89
+ `}};Kv.inlineLink={filter:function($,v){return v.linkStyle==="inlined"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v){var g=Jz(v.getAttribute("href")),_=Gz(t_(v.getAttribute("title"))),U=_?' "'+_+'"':"";return"["+$+"]("+g+U+")"}};Kv.referenceLink={filter:function($,v){return v.linkStyle==="referenced"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v,g){var _=Jz(v.getAttribute("href")),U=t_(v.getAttribute("title"));if(U)U=' "'+Gz(U)+'"';var z,J;switch(g.linkReferenceStyle){case"collapsed":z="["+$+"][]",J="["+$+"]: "+_+U;break;case"shortcut":z="["+$+"]",J="["+$+"]: "+_+U;break;default:var G=this.references.length+1;z="["+$+"]["+G+"]",J="["+G+"]: "+_+U}return this.references.push(J),z},references:[],append:function($){var v="";if(this.references.length)v=`
90
90
 
91
91
  `+this.references.join(`
92
92
  `)+`
93
93
 
94
- `,this.references=[];return v}};Gv.emphasis={filter:["em","i"],replacement:function($,v,g){if(!$.trim())return"";return g.emDelimiter+$+g.emDelimiter}};Gv.strong={filter:["strong","b"],replacement:function($,v,g){if(!$.trim())return"";return g.strongDelimiter+$+g.strongDelimiter}};Gv.code={filter:function($){var v=$.previousSibling||$.nextSibling,g=$.parentNode.nodeName==="PRE"&&!v;return $.nodeName==="CODE"&&!g},replacement:function($){if(!$)return"";$=$.replace(/\r?\n|\r/g," ");var v=/^`|^ .*?[^ ].* $|`$/.test($)?" ":"",g="`",_=$.match(/`+/gm)||[];while(_.indexOf(g)!==-1)g=g+"`";return g+v+$+v+g}};Gv.image={filter:"img",replacement:function($,v){var g=G5(p_(v.getAttribute("alt"))),_=e2(v.getAttribute("src")||""),U=p_(v.getAttribute("title")),z=U?' "'+$z(U)+'"':"";return _?"!["+g+"]("+_+z+")":""}};function p_($){return $?$.replace(/(\n+\s*)+/g,`
95
- `):""}function e2($){var v=$.replace(/([<>()])/g,"\\$1");return v.indexOf(" ")>=0?"<"+v+">":v}function $z($){return $.replace(/"/g,"\\\"")}function O5($){this.options=$,this._keep=[],this._remove=[],this.blankRule={replacement:$.blankReplacement},this.keepReplacement=$.keepReplacement,this.defaultRule={replacement:$.defaultReplacement},this.array=[];for(var v in $.rules)this.array.push($.rules[v])}O5.prototype={add:function($,v){this.array.unshift(v)},keep:function($){this._keep.unshift({filter:$,replacement:this.keepReplacement})},remove:function($){this._remove.unshift({filter:$,replacement:function(){return""}})},forNode:function($){if($.isBlank)return this.blankRule;var v;if(v=o2(this.array,$,this.options))return v;if(v=o2(this._keep,$,this.options))return v;if(v=o2(this._remove,$,this.options))return v;return this.defaultRule},forEach:function($){for(var v=0;v<this.array.length;v++)$(this.array[v],v)}};function o2($,v,g){for(var _=0;_<$.length;_++){var U=$[_];if(uH(U,v,g))return U}return}function uH($,v,g){var _=$.filter;if(typeof _==="string"){if(_===v.nodeName.toLowerCase())return!0}else if(Array.isArray(_)){if(_.indexOf(v.nodeName.toLowerCase())>-1)return!0}else if(typeof _==="function"){if(_.call($,v,g))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function yH($){var{element:v,isBlock:g,isVoid:_}=$,U=$.isPre||function(B){return B.nodeName==="PRE"};if(!v.firstChild||U(v))return;var z=null,J=!1,b=null,O=eK(b,v,U);while(O!==v){if(O.nodeType===3||O.nodeType===4){var K=O.data.replace(/[ \r\n\t]+/g," ");if((!z||/ $/.test(z.data))&&!J&&K[0]===" ")K=K.substr(1);if(!K){O=n2(O);continue}O.data=K,z=O}else if(O.nodeType===1){if(g(O)||O.nodeName==="BR"){if(z)z.data=z.data.replace(/ $/,"");z=null,J=!1}else if(_(O)||U(O))z=null,J=!0;else if(z)J=!1}else{O=n2(O);continue}var W=eK(b,O,U);b=O,O=W}if(z){if(z.data=z.data.replace(/ $/,""),!z.data)n2(z)}}function n2($){var v=$.nextSibling||$.parentNode;return $.parentNode.removeChild($),v}function eK($,v,g){if($&&$.parentNode===v||g(v))return v.nextSibling||v.parentNode;return v.firstChild||v.nextSibling||v.parentNode}var vz=typeof window<"u"?window:{};function DH(){var $=vz.DOMParser,v=!1;try{if(new $().parseFromString("","text/html"))v=!0}catch(g){}return v}function RH(){var $=function(){};if(TH())$.prototype.parseFromString=function(v){var g=new window.ActiveXObject("htmlfile");return g.designMode="on",g.open(),g.write(v),g.close(),g};else $.prototype.parseFromString=function(v){var g=document.implementation.createHTMLDocument("");return g.open(),g.write(v),g.close(),g};return $}function TH(){var $=!1;try{document.implementation.createHTMLDocument("").open()}catch(v){if(vz.ActiveXObject)$=!0}return $}var jH=DH()?vz.DOMParser:RH();function VH($,v){var g;if(typeof $==="string"){var _=CH().parseFromString('<x-turndown id="turndown-root">'+$+"</x-turndown>","text/html");g=_.getElementById("turndown-root")}else g=$.cloneNode(!0);return yH({element:g,isBlock:a2,isVoid:z5,isPre:v.preformattedCode?fH:null}),g}var t2;function CH(){return t2=t2||new jH,t2}function fH($){return $.nodeName==="PRE"||$.nodeName==="CODE"}function mH($,v){return $.isBlock=a2($),$.isCode=$.nodeName==="CODE"||$.parentNode.isCode,$.isBlank=cH($),$.flankingWhitespace=EH($,v),$}function cH($){return!z5($)&&!SH($)&&/^\s*$/i.test($.textContent)&&!QH($)&&!NH($)}function EH($,v){if($.isBlock||v.preformattedCode&&$.isCode)return{leading:"",trailing:""};var g=iH($.textContent);if(g.leadingAscii&&$5("left",$,v))g.leading=g.leadingNonAscii;if(g.trailingAscii&&$5("right",$,v))g.trailing=g.trailingNonAscii;return{leading:g.leading,trailing:g.trailing}}function iH($){var v=$.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:v[1],leadingAscii:v[2],leadingNonAscii:v[3],trailing:v[4],trailingNonAscii:v[5],trailingAscii:v[6]}}function $5($,v,g){var _,U,z;if($==="left")_=v.previousSibling,U=/ $/;else _=v.nextSibling,U=/^ /;if(_){if(_.nodeType===3)z=U.test(_.nodeValue);else if(g.preformattedCode&&_.nodeName==="CODE")z=!1;else if(_.nodeType===1&&!a2(_))z=U.test(_.textContent)}return z}var lH=Array.prototype.reduce;function cU($){if(!(this instanceof cU))return new cU($);var v={rules:Gv,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(g,_){return _.isBlock?`
94
+ `,this.references=[];return v}};Kv.emphasis={filter:["em","i"],replacement:function($,v,g){if(!$.trim())return"";return g.emDelimiter+$+g.emDelimiter}};Kv.strong={filter:["strong","b"],replacement:function($,v,g){if(!$.trim())return"";return g.strongDelimiter+$+g.strongDelimiter}};Kv.code={filter:function($){var v=$.previousSibling||$.nextSibling,g=$.parentNode.nodeName==="PRE"&&!v;return $.nodeName==="CODE"&&!g},replacement:function($){if(!$)return"";$=$.replace(/\r?\n|\r/g," ");var v=/^`|^ .*?[^ ].* $|`$/.test($)?" ":"",g="`",_=$.match(/`+/gm)||[];while(_.indexOf(g)!==-1)g=g+"`";return g+v+$+v+g}};Kv.image={filter:"img",replacement:function($,v){var g=Y5(t_(v.getAttribute("alt"))),_=Jz(v.getAttribute("src")||""),U=t_(v.getAttribute("title")),z=U?' "'+Gz(U)+'"':"";return _?"!["+g+"]("+_+z+")":""}};function t_($){return $?$.replace(/(\n+\s*)+/g,`
95
+ `):""}function Jz($){var v=$.replace(/([<>()])/g,"\\$1");return v.indexOf(" ")>=0?"<"+v+">":v}function Gz($){return $.replace(/"/g,"\\\"")}function H5($){this.options=$,this._keep=[],this._remove=[],this.blankRule={replacement:$.blankReplacement},this.keepReplacement=$.keepReplacement,this.defaultRule={replacement:$.defaultReplacement},this.array=[];for(var v in $.rules)this.array.push($.rules[v])}H5.prototype={add:function($,v){this.array.unshift(v)},keep:function($){this._keep.unshift({filter:$,replacement:this.keepReplacement})},remove:function($){this._remove.unshift({filter:$,replacement:function(){return""}})},forNode:function($){if($.isBlank)return this.blankRule;var v;if(v=$z(this.array,$,this.options))return v;if(v=$z(this._keep,$,this.options))return v;if(v=$z(this._remove,$,this.options))return v;return this.defaultRule},forEach:function($){for(var v=0;v<this.array.length;v++)$(this.array[v],v)}};function $z($,v,g){for(var _=0;_<$.length;_++){var U=$[_];if(fY(U,v,g))return U}return}function fY($,v,g){var _=$.filter;if(typeof _==="string"){if(_===v.nodeName.toLowerCase())return!0}else if(Array.isArray(_)){if(_.indexOf(v.nodeName.toLowerCase())>-1)return!0}else if(typeof _==="function"){if(_.call($,v,g))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function EY($){var{element:v,isBlock:g,isVoid:_}=$,U=$.isPre||function(B){return B.nodeName==="PRE"};if(!v.firstChild||U(v))return;var z=null,J=!1,G=null,K=J5(G,v,U);while(K!==v){if(K.nodeType===3||K.nodeType===4){var O=K.data.replace(/[ \r\n\t]+/g," ");if((!z||/ $/.test(z.data))&&!J&&O[0]===" ")O=O.substr(1);if(!O){K=vz(K);continue}K.data=O,z=K}else if(K.nodeType===1){if(g(K)||K.nodeName==="BR"){if(z)z.data=z.data.replace(/ $/,"");z=null,J=!1}else if(_(K)||U(K))z=null,J=!0;else if(z)J=!1}else{K=vz(K);continue}var W=J5(G,K,U);G=K,K=W}if(z){if(z.data=z.data.replace(/ $/,""),!z.data)vz(z)}}function vz($){var v=$.nextSibling||$.parentNode;return $.parentNode.removeChild($),v}function J5($,v,g){if($&&$.parentNode===v||g(v))return v.nextSibling||v.parentNode;return v.firstChild||v.nextSibling||v.parentNode}var bz=typeof window<"u"?window:{};function mY(){var $=bz.DOMParser,v=!1;try{if(new $().parseFromString("","text/html"))v=!0}catch(g){}return v}function cY(){var $=function(){};if(iY())$.prototype.parseFromString=function(v){var g=new window.ActiveXObject("htmlfile");return g.designMode="on",g.open(),g.write(v),g.close(),g};else $.prototype.parseFromString=function(v){var g=document.implementation.createHTMLDocument("");return g.open(),g.write(v),g.close(),g};return $}function iY(){var $=!1;try{document.implementation.createHTMLDocument("").open()}catch(v){if(bz.ActiveXObject)$=!0}return $}var xY=mY()?bz.DOMParser:cY();function hY($,v){var g;if(typeof $==="string"){var _=lY().parseFromString('<x-turndown id="turndown-root">'+$+"</x-turndown>","text/html");g=_.getElementById("turndown-root")}else g=$.cloneNode(!0);return EY({element:g,isBlock:_z,isVoid:B5,isPre:v.preformattedCode?pY:null}),g}var Uz;function lY(){return Uz=Uz||new xY,Uz}function pY($){return $.nodeName==="PRE"||$.nodeName==="CODE"}function oY($,v){return $.isBlock=_z($),$.isCode=$.nodeName==="CODE"||$.parentNode.isCode,$.isBlank=nY($),$.flankingWhitespace=tY($,v),$}function nY($){return!B5($)&&!rY($)&&/^\s*$/i.test($.textContent)&&!jY($)&&!VY($)}function tY($,v){if($.isBlock||v.preformattedCode&&$.isCode)return{leading:"",trailing:""};var g=dY($.textContent);if(g.leadingAscii&&G5("left",$,v))g.leading=g.leadingNonAscii;if(g.trailingAscii&&G5("right",$,v))g.trailing=g.trailingNonAscii;return{leading:g.leading,trailing:g.trailing}}function dY($){var v=$.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:v[1],leadingAscii:v[2],leadingNonAscii:v[3],trailing:v[4],trailingNonAscii:v[5],trailingAscii:v[6]}}function G5($,v,g){var _,U,z;if($==="left")_=v.previousSibling,U=/ $/;else _=v.nextSibling,U=/^ /;if(_){if(_.nodeType===3)z=U.test(_.nodeValue);else if(g.preformattedCode&&_.nodeName==="CODE")z=!1;else if(_.nodeType===1&&!_z(_))z=U.test(_.textContent)}return z}var aY=Array.prototype.reduce;function xU($){if(!(this instanceof xU))return new xU($);var v={rules:Kv,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(g,_){return _.isBlock?`
96
96
 
97
97
  `:""},keepReplacement:function(g,_){return _.isBlock?`
98
98
 
@@ -102,54 +102,54 @@ ${U}
102
102
 
103
103
  `+g+`
104
104
 
105
- `:g}};this.options=ZH({},v,$),this.rules=new O5(this.options)}cU.prototype={turndown:function($){if(!pH($))throw TypeError($+" is not a string, or an element/document/fragment node.");if($==="")return"";var v=K5.call(this,new VH($,this.options));return xH.call(this,v)},use:function($){if(Array.isArray($))for(var v=0;v<$.length;v++)this.use($[v]);else if(typeof $==="function")$(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function($,v){return this.rules.add($,v),this},keep:function($){return this.rules.keep($),this},remove:function($){return this.rules.remove($),this},escape:function($){return G5($)}};function K5($){var v=this;return lH.call($.childNodes,function(g,_){_=new mH(_,v.options);var U="";if(_.nodeType===3)U=_.isCode?_.nodeValue:v.escape(_.nodeValue);else if(_.nodeType===1)U=hH.call(v,_);return W5(g,U)},"")}function xH($){var v=this;return this.rules.forEach(function(g){if(typeof g.append==="function")$=W5($,g.append(v.options))}),$.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function hH($){var v=this.rules.forNode($),g=K5.call(this,$),_=$.flankingWhitespace;if(_.leading||_.trailing)g=g.trim();return _.leading+v.replacement(g,$,this.options)+_.trailing}function W5($,v){var g=U5($),_=v5(v),U=Math.max($.length-g.length,v.length-_.length),z=`
105
+ `:g}};this.options=uY({},v,$),this.rules=new H5(this.options)}xU.prototype={turndown:function($){if(!$H($))throw TypeError($+" is not a string, or an element/document/fragment node.");if($==="")return"";var v=L5.call(this,new hY($,this.options));return sY.call(this,v)},use:function($){if(Array.isArray($))for(var v=0;v<$.length;v++)this.use($[v]);else if(typeof $==="function")$(this);else throw TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function($,v){return this.rules.add($,v),this},keep:function($){return this.rules.keep($),this},remove:function($){return this.rules.remove($),this},escape:function($){return Y5($)}};function L5($){var v=this;return aY.call($.childNodes,function(g,_){_=new oY(_,v.options);var U="";if(_.nodeType===3)U=_.isCode?_.nodeValue:v.escape(_.nodeValue);else if(_.nodeType===1)U=eY.call(v,_);return I5(g,U)},"")}function sY($){var v=this;return this.rules.forEach(function(g){if(typeof g.append==="function")$=I5($,g.append(v.options))}),$.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function eY($){var v=this.rules.forNode($),g=L5.call(this,$),_=$.flankingWhitespace;if(_.leading||_.trailing)g=g.trim();return _.leading+v.replacement(g,$,this.options)+_.trailing}function I5($,v){var g=K5($),_=b5(v),U=Math.max($.length-g.length,v.length-_.length),z=`
106
106
 
107
- `.substring(0,U);return g+z+_}function pH($){return $!=null&&(typeof $==="string"||$.nodeType&&($.nodeType===1||$.nodeType===9||$.nodeType===11))}function o_(){let $=window.prompt("Link URL:");if(!$)return;let v=$.trim().toLowerCase();if(v.startsWith("javascript:")||v.startsWith("data:"))return;document.execCommand("createLink",!1,$)}function B5(){let $=window.getSelection();if(!$||$.rangeCount===0)return;let v=$.getRangeAt(0);if(v.collapsed)return;let g=v.toString(),_=document.createElement("code");_.textContent=g,v.deleteContents(),v.insertNode(_);let U=document.createRange();U.setStartAfter(_),U.setEndAfter(_),$.removeAllRanges(),$.addRange(U)}var n_=8,oH=[{kind:"exec",command:"bold",icon:"B",title:"Bold (⌘B)"},{kind:"exec",command:"italic",icon:"I",title:"Italic (⌘I)"},{kind:"exec",command:"strikeThrough",icon:"S",title:"Strikethrough"},{kind:"code",icon:"{ }",title:"Inline code",dividerBefore:!0},{kind:"block",tag:"H1",icon:"H1",title:"Heading 1",dividerBefore:!0},{kind:"block",tag:"H2",icon:"H2",title:"Heading 2"},{kind:"block",tag:"H3",icon:"H3",title:"Heading 3"},{kind:"block",tag:"P",icon:"¶",title:"Paragraph"},{kind:"block",tag:"BLOCKQUOTE",icon:"❝",title:"Quote",dividerBefore:!0},{kind:"exec",command:"insertUnorderedList",icon:"•",title:"Bullet list"},{kind:"exec",command:"insertOrderedList",icon:"1.",title:"Numbered list"},{kind:"link",icon:"\uD83D\uDD17",title:"Link (⌘K)",dividerBefore:!0}];function nH($){switch($.kind){case"exec":document.execCommand($.command);return;case"block":document.execCommand("formatBlock",!1,$.tag);return;case"code":B5();return;case"link":o_();return}}function P5({hostRef:$,onChange:v}){let[g,_]=o(!1),[U,z]=o({top:0,left:0}),[J,b]=o(0),O=y(null),K=y(null),W=Q(()=>{let P=$.current;if(!P){_(!1);return}let X=window.getSelection();if(!X||X.rangeCount===0||X.isCollapsed){_(!1);return}let Y=X.getRangeAt(0);if(!P.contains(Y.commonAncestorContainer)){_(!1);return}let H=Y.getBoundingClientRect();if(H.width===0&&H.height===0){_(!1);return}let L=J||420,q=Math.max(n_,Math.min(H.left+H.width/2-L/2,window.innerWidth-L-n_)),F=Math.max(n_,H.top-n_-36);z({top:F,left:q}),_(!0)},[$,J]),B=Q(()=>{if(K.current!==null)return;K.current=requestAnimationFrame(()=>{K.current=null,W()})},[W]);m(()=>{return document.addEventListener("selectionchange",B),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{if(document.removeEventListener("selectionchange",B),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),K.current!==null)cancelAnimationFrame(K.current)}},[B]),G_(()=>{if(!g)return;let P=O.current;if(!P)return;let X=P.getBoundingClientRect().width;if(X&&Math.abs(X-J)>1)b(X)},[g,J]);let k=Q((P)=>{nH(P),v(),W()},[v,W]);if(!g)return null;return G("div",{ref:O,class:"md-inline-format-bar",style:{top:`${U.top}px`,left:`${U.left}px`},onMouseDown:(P)=>P.preventDefault(),children:oH.flatMap((P,X)=>{let Y=G("button",{type:"button",class:"md-inline-format-btn",title:P.title,onClick:()=>k(P),children:P.icon},`btn-${X}`,!1,void 0,this);return P.dividerBefore?[G("span",{class:"md-inline-format-divider"},`div-${X}`,!1,void 0,this),Y]:[Y]})},void 0,!1,void 0,this)}var Uz=null;function tH(){if(Uz)return Uz;let $=new cU({headingStyle:"atx",codeBlockStyle:"fenced",emDelimiter:"*",bulletListMarker:"-"});return $.use(k5.gfm),Uz=$,$}function H5({initialHtml:$,className:v,onChange:g,onSave:_}){let U=y(null),z=y($);m(()=>{let B=U.current;if(!B)return;B.innerHTML=z.current},[]);let J=Q(()=>{let B=U.current;if(!B)return"";return tH().turndown(B.innerHTML)},[]),b=Q(()=>{g(J())},[g,J]),O=Q(()=>{_?.(J())},[_,J]),K=Q((B)=>{if(!(B.metaKey||B.ctrlKey))return;if(B.key==="s"){B.preventDefault(),O();return}if(B.key==="b"){B.preventDefault(),document.execCommand("bold"),b();return}if(B.key==="i"){B.preventDefault(),document.execCommand("italic"),b();return}if(B.key==="k")B.preventDefault(),o_(),b()},[b,O]),W=Q((B)=>{let k=B.clipboardData?.getData("text/plain");if(k==null)return;B.preventDefault(),document.execCommand("insertText",!1,k),b()},[b]);return G(a$,{children:[G("div",{ref:U,class:v,contentEditable:!0,spellcheck:!1,onInput:b,onKeyDown:K,onPaste:W,onBlur:O},void 0,!1,void 0,this),G(P5,{hostRef:U,onChange:b},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function gz({html:$,className:v,style:g}){let _=y(null);return m(()=>{let U=_.current;if(!U)return;if(U.replaceChildren(),!$)return;let z=document.createElement("template");z.innerHTML=$,U.append(z.content.cloneNode(!0))},[$]),G("div",{ref:_,class:v,style:g},void 0,!1,void 0,this)}function t_({node:$,expanded:v=!1}){let g=$.data.path,[_,U]=o(""),[z,J]=o(""),[b,O]=o(!1),[K,W]=o(!1),[B,k]=o(!1),[P,X]=o(!1),Y=y(null),H=y(null),L=y(""),q=y(null),F=$.data.reviewActive;m(()=>{let S=!1;return(async()=>{let U$;if(g){let i=await TU(g);if(S)return;U$=i.content}else if($.data.content)U$=$.data.content;else{O(!0);return}U(U$);let c=await g6(U$);if(S)return;J(c),O(!0),v$($.id,{content:U$,rendered:c})})(),()=>{S=!0}},[g,$.id,$.data.content]);let N=Q(async(S)=>{let U$=S.target.value;U(U$),X(!0);let c=await g6(U$);J(c)},[]),C=Q(async(S)=>{if(!g){let c=await g6(S);J(c),X(!1),v$($.id,{content:S,rendered:c}),await Zv($.id,{content:S,data:{rendered:c}});return}k(!0);let U$=await cO(g,S);if(k(!1),U$.ok){let c=await g6(S);J(c),X(!1),v$($.id,{content:S,rendered:c,savedAt:U$.updatedAt}),await Zv($.id,{content:S,data:{rendered:c,savedAt:U$.updatedAt}})}},[g,$.id]),p=Q(async()=>{if(!P)return;await C(_)},[P,_,C]),r=Q((S)=>{if((S.metaKey||S.ctrlKey)&&S.key==="s"){S.preventDefault(),p();return}let U$=Y.current;if(U$&&jK(S,U$))return;if(U$&&S.key==="Tab")S.preventDefault(),TK(U$,S.shiftKey)},[p]);q.current=C;let n=Q((S)=>{if(U(S),X(!0),L.current=S,H.current!==null)window.clearTimeout(H.current);H.current=window.setTimeout(()=>{H.current=null,C(S)},800)},[C]),e=Q((S)=>{if(U(S),L.current=S,H.current!==null)window.clearTimeout(H.current),H.current=null;C(S)},[C]);m(()=>{return()=>{if(H.current===null)return;window.clearTimeout(H.current),H.current=null;let S=q.current;if(S)S(L.current)}},[$.id]);let u=F?G("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-ok-10)",color:"var(--c-ok)",borderBottom:"1px solid var(--c-ok-20)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:"Review active"},void 0,!1,void 0,this):null;if(K&&v)return G("div",{class:"md-editor-expanded",onKeyDown:r,children:[G("div",{class:"md-editor-toolbar",children:[G("button",{type:"button",class:"md-toolbar-btn",onClick:()=>W(!1),children:"← Back to document"},void 0,!1,void 0,this),G("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[g&&G("span",{class:"md-toolbar-path",children:g.split("/").pop()},void 0,!1,void 0,this),G("button",{type:"button",class:`md-toolbar-btn${P?" md-toolbar-btn-primary":""}`,onClick:p,disabled:!P||B,children:B?"Saving…":P?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"md-editor-split",children:[G("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[G("textarea",{ref:Y,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),G(l2,{textareaRef:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(gz,{html:z,className:"md-preview"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(K)return G("div",{class:"md-editor-split",style:{height:"100%"},onKeyDown:r,children:[G("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[G("textarea",{ref:Y,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),G(l2,{textareaRef:Y},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(gz,{html:z,className:"md-preview"},void 0,!1,void 0,this),G("div",{style:{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},children:[G("button",{type:"button",onClick:()=>W(!1),style:{padding:"4px 10px",fontSize:"11px",background:"var(--c-input-bg)",border:"1px solid var(--c-line)",borderRadius:"6px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Document"},void 0,!1,void 0,this),G("button",{type:"button",onClick:p,disabled:!P||B,style:{padding:"4px 10px",fontSize:"11px",background:P?"var(--c-accent-25)":"var(--c-input-bg)",border:`1px solid ${P?"var(--c-accent)":"var(--c-line)"}`,borderRadius:"6px",color:P?"var(--c-text)":"var(--c-dim)",cursor:P?"pointer":"default"},children:B?"Saving…":P?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(v)return G("div",{style:{height:"100%",position:"relative"},children:[u,G("div",{class:"md-reader",children:b?G(H5,{initialHtml:z||"<p><br></p>",className:"md-reader-content md-reader-editable",onChange:n,onSave:e},$.id,!1,void 0,this):G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"24px"},children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("button",{type:"button",class:"md-edit-fab",onClick:()=>W(!0),children:"</> Source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{height:"100%",position:"relative"},children:[u,G(gz,{html:z,style:{padding:z?"0":"12px",color:z?void 0:"var(--c-dim)"}},void 0,!1,void 0,this),!b&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Loading…"},void 0,!1,void 0,this),b&&!z&&G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Empty node"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>z6($.id),style:{position:"absolute",top:"4px",right:"4px",padding:"3px 8px",fontSize:"10px",background:"var(--c-panel-overlay)",border:"1px solid var(--c-line)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",opacity:0.7},onMouseEnter:(S)=>{S.target.style.opacity="1"},onMouseLeave:(S)=>{S.target.style.opacity="0.7"},children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var d_="pmx-canvas-ax",a_="pmx-canvas-ax-ack",pv="pmx-canvas-html-node",_z="pmx-canvas-ext-app-alive";var I5=37;function dH($){return $.type==="html"||$.type==="json-render"||$.type==="graph"||$.type==="mcp-app"||$.type==="webpage"}function aH($){if($.type==="html")return $.data.presentation!==!0;if($.type==="json-render"||$.type==="graph")return!0;if($.type==="mcp-app")return $.data.viewerType==="web-artifact";return!1}function Y5($){return $.collapsed===!0||$.dockPosition!=null||$.data.strictSize===!0||$.data.userResized===!0||$.type==="group"}function zz($){return!Y5($)&&!dH($)}function L5($,v){if(!zz($)||v<=0)return null;return Math.min(v+37,600)}function Jz($){return aH($)&&!Y5($)}function q5($,v){if(!Jz($)||v<=0)return null;let g=Math.min(v+37+24,1400);return g>$.size.height+8?g:null}var I={};ev(I,{xor:()=>s7,xid:()=>A7,void:()=>n7,uuidv7:()=>H7,uuidv6:()=>k7,uuidv4:()=>P7,uuid:()=>B7,util:()=>j,url:()=>I7,uppercase:()=>o4,unknown:()=>Q$,union:()=>A$,undefined:()=>p7,ulid:()=>F7,uint64:()=>x7,uint32:()=>E7,tuple:()=>YG,trim:()=>e4,treeifyError:()=>Lz,transform:()=>F0,toUpperCase:()=>vU,toLowerCase:()=>$U,toJSONSchema:()=>d1,templateLiteral:()=>OW,symbol:()=>h7,superRefine:()=>lG,success:()=>JW,stringbool:()=>IW,stringFormat:()=>T7,string:()=>Z,strictObject:()=>a7,startsWith:()=>t4,slugify:()=>UU,size:()=>b4,setErrorMap:()=>XL,set:()=>UW,safeParseAsync:()=>tb,safeParse:()=>nb,safeEncodeAsync:()=>UG,safeEncode:()=>$G,safeDecodeAsync:()=>gG,safeDecode:()=>vG,registry:()=>w1,regexes:()=>Dv,regex:()=>h4,refine:()=>iG,record:()=>N$,readonly:()=>VG,property:()=>p1,promise:()=>KW,prettifyError:()=>qz,preprocess:()=>Zg,prefault:()=>rG,positive:()=>i1,pipe:()=>Ig,partialRecord:()=>e7,parseAsync:()=>ob,parse:()=>pb,overwrite:()=>mv,optional:()=>y$,object:()=>x,number:()=>Y$,nullish:()=>zW,nullable:()=>Hg,null:()=>WU,normalize:()=>s4,nonpositive:()=>x1,nonoptional:()=>uG,nonnegative:()=>h1,never:()=>w0,negative:()=>l1,nativeEnum:()=>gW,nanoid:()=>q7,nan:()=>bW,multipleOf:()=>R6,minSize:()=>dv,minLength:()=>G6,mime:()=>a4,meta:()=>kW,maxSize:()=>T6,maxLength:()=>G4,map:()=>vW,mac:()=>Q7,lte:()=>Nv,lt:()=>nv,lowercase:()=>p4,looseRecord:()=>$W,looseObject:()=>$v,locales:()=>Kg,literal:()=>t,length:()=>O4,lazy:()=>mG,ksuid:()=>Z7,keyof:()=>d7,jwt:()=>R7,json:()=>YW,iso:()=>f6,ipv6:()=>S7,ipv4:()=>M7,intersection:()=>BU,int64:()=>l7,int32:()=>c7,int:()=>U0,instanceof:()=>HW,includes:()=>n4,httpUrl:()=>Y7,hostname:()=>j7,hex:()=>V7,hash:()=>C7,guid:()=>W7,gte:()=>Hv,gt:()=>tv,globalRegistry:()=>e$,getErrorMap:()=>wL,function:()=>WW,fromJSONSchema:()=>qW,formatError:()=>dU,float64:()=>m7,float32:()=>f7,flattenError:()=>tU,file:()=>_W,exactOptional:()=>ZG,enum:()=>vv,endsWith:()=>d4,encodeAsync:()=>sb,encode:()=>db,emoji:()=>L7,email:()=>K7,e164:()=>D7,discriminatedUnion:()=>wg,describe:()=>PW,decodeAsync:()=>eb,decode:()=>ab,date:()=>t7,custom:()=>S0,cuid2:()=>w7,cuid:()=>X7,core:()=>O6,config:()=>l$,coerce:()=>hG,codec:()=>GW,clone:()=>kv,cidrv6:()=>r7,cidrv4:()=>N7,check:()=>BW,catch:()=>RG,boolean:()=>x$,bigint:()=>i7,base64url:()=>y7,base64:()=>u7,array:()=>J$,any:()=>o7,_function:()=>WW,_default:()=>SG,_ZodString:()=>g0,ZodXor:()=>PG,ZodXID:()=>K0,ZodVoid:()=>WG,ZodUnknown:()=>OG,ZodUnion:()=>Xg,ZodUndefined:()=>JG,ZodUUID:()=>av,ZodURL:()=>Yg,ZodULID:()=>O0,ZodType:()=>_$,ZodTuple:()=>IG,ZodTransform:()=>FG,ZodTemplateLiteral:()=>CG,ZodSymbol:()=>zG,ZodSuccess:()=>yG,ZodStringFormat:()=>M$,ZodString:()=>JU,ZodSet:()=>qG,ZodRecord:()=>Fg,ZodRealError:()=>Fv,ZodReadonly:()=>jG,ZodPromise:()=>cG,ZodPrefault:()=>NG,ZodPipe:()=>M0,ZodOptional:()=>A0,ZodObject:()=>qg,ZodNumberFormat:()=>K4,ZodNumber:()=>GU,ZodNullable:()=>MG,ZodNull:()=>bG,ZodNonOptional:()=>Z0,ZodNever:()=>KG,ZodNanoID:()=>J0,ZodNaN:()=>TG,ZodMap:()=>LG,ZodMAC:()=>_G,ZodLiteral:()=>XG,ZodLazy:()=>fG,ZodKSUID:()=>W0,ZodJWT:()=>q0,ZodIssueCode:()=>qL,ZodIntersection:()=>HG,ZodISOTime:()=>$0,ZodISODuration:()=>v0,ZodISODateTime:()=>s1,ZodISODate:()=>e1,ZodIPv6:()=>P0,ZodIPv4:()=>B0,ZodGUID:()=>kg,ZodFunction:()=>EG,ZodFirstPartyTypeKind:()=>xG,ZodFile:()=>wG,ZodExactOptional:()=>AG,ZodError:()=>YL,ZodEnum:()=>zU,ZodEmoji:()=>z0,ZodEmail:()=>_0,ZodE164:()=>L0,ZodDiscriminatedUnion:()=>kG,ZodDefault:()=>QG,ZodDate:()=>Lg,ZodCustomStringFormat:()=>bU,ZodCustom:()=>Ag,ZodCodec:()=>Q0,ZodCatch:()=>DG,ZodCUID2:()=>G0,ZodCUID:()=>b0,ZodCIDRv6:()=>H0,ZodCIDRv4:()=>k0,ZodBoolean:()=>OU,ZodBigIntFormat:()=>X0,ZodBigInt:()=>KU,ZodBase64URL:()=>Y0,ZodBase64:()=>I0,ZodArray:()=>BG,ZodAny:()=>GG,TimePrecision:()=>w9,NEVER:()=>bz,$output:()=>H9,$input:()=>I9,$brand:()=>Gz});var O6={};ev(O6,{version:()=>BJ,util:()=>j,treeifyError:()=>Lz,toJSONSchema:()=>d1,toDotPath:()=>M5,safeParseAsync:()=>eU,safeParse:()=>E4,safeEncodeAsync:()=>D5,safeEncode:()=>u5,safeDecodeAsync:()=>R5,safeDecode:()=>y5,registry:()=>w1,regexes:()=>Dv,process:()=>w$,prettifyError:()=>qz,parseAsync:()=>sU,parse:()=>aU,meta:()=>vb,locales:()=>Kg,isValidJWT:()=>s5,isValidBase64URL:()=>a5,isValidBase64:()=>TJ,initializeContext:()=>j6,globalRegistry:()=>e$,globalConfig:()=>EU,formatError:()=>dU,flattenError:()=>tU,finalize:()=>C6,extractDefs:()=>V6,encodeAsync:()=>N5,encode:()=>Q5,describe:()=>$b,decodeAsync:()=>r5,decode:()=>S5,createToJSONSchemaMethod:()=>gb,createStandardJSONSchemaMethod:()=>_U,config:()=>l$,clone:()=>kv,_xor:()=>oY,_xid:()=>D1,_void:()=>h9,_uuidv7:()=>Q1,_uuidv6:()=>M1,_uuidv4:()=>Z1,_uuid:()=>A1,_url:()=>Bg,_uppercase:()=>o4,_unknown:()=>l9,_union:()=>pY,_undefined:()=>c9,_ulid:()=>y1,_uint64:()=>f9,_uint32:()=>D9,_tuple:()=>dY,_trim:()=>e4,_transform:()=>gL,_toUpperCase:()=>vU,_toLowerCase:()=>$U,_templateLiteral:()=>BL,_symbol:()=>m9,_superRefine:()=>e9,_success:()=>GL,_stringbool:()=>Ub,_stringFormat:()=>gU,_string:()=>L9,_startsWith:()=>t4,_slugify:()=>UU,_size:()=>b4,_set:()=>eY,_safeParseAsync:()=>i4,_safeParse:()=>c4,_safeEncodeAsync:()=>J1,_safeEncode:()=>_1,_safeDecodeAsync:()=>b1,_safeDecode:()=>z1,_regex:()=>h4,_refine:()=>s9,_record:()=>aY,_readonly:()=>WL,_property:()=>p1,_promise:()=>kL,_positive:()=>i1,_pipe:()=>KL,_parseAsync:()=>m4,_parse:()=>f4,_overwrite:()=>mv,_optional:()=>_L,_number:()=>Q9,_nullable:()=>zL,_null:()=>E9,_normalize:()=>s4,_nonpositive:()=>x1,_nonoptional:()=>bL,_nonnegative:()=>h1,_never:()=>x9,_negative:()=>l1,_nativeEnum:()=>vL,_nanoid:()=>N1,_nan:()=>n9,_multipleOf:()=>R6,_minSize:()=>dv,_minLength:()=>G6,_min:()=>Hv,_mime:()=>a4,_maxSize:()=>T6,_maxLength:()=>G4,_max:()=>Nv,_map:()=>sY,_mac:()=>X9,_lte:()=>Nv,_lt:()=>nv,_lowercase:()=>p4,_literal:()=>UL,_length:()=>O4,_lazy:()=>PL,_ksuid:()=>R1,_jwt:()=>E1,_isoTime:()=>Z9,_isoDuration:()=>M9,_isoDateTime:()=>F9,_isoDate:()=>A9,_ipv6:()=>j1,_ipv4:()=>T1,_intersection:()=>tY,_int64:()=>C9,_int32:()=>y9,_int:()=>N9,_includes:()=>n4,_guid:()=>Wg,_gte:()=>Hv,_gt:()=>tv,_float64:()=>u9,_float32:()=>r9,_file:()=>d9,_enum:()=>$L,_endsWith:()=>d4,_encodeAsync:()=>U1,_encode:()=>$1,_emoji:()=>S1,_email:()=>F1,_e164:()=>c1,_discriminatedUnion:()=>nY,_default:()=>JL,_decodeAsync:()=>g1,_decode:()=>v1,_date:()=>p9,_custom:()=>a9,_cuid2:()=>u1,_cuid:()=>r1,_coercedString:()=>q9,_coercedNumber:()=>S9,_coercedDate:()=>o9,_coercedBoolean:()=>T9,_coercedBigint:()=>V9,_cidrv6:()=>C1,_cidrv4:()=>V1,_check:()=>b7,_catch:()=>OL,_boolean:()=>R9,_bigint:()=>j9,_base64url:()=>m1,_base64:()=>f1,_array:()=>t9,_any:()=>i9,TimePrecision:()=>w9,NEVER:()=>bz,JSONSchemaGenerator:()=>Eb,JSONSchema:()=>G7,Doc:()=>W1,$output:()=>H9,$input:()=>I9,$constructor:()=>w,$brand:()=>Gz,$ZodXor:()=>sJ,$ZodXID:()=>AJ,$ZodVoid:()=>nJ,$ZodUnknown:()=>pJ,$ZodUnion:()=>_g,$ZodUndefined:()=>lJ,$ZodUUID:()=>HJ,$ZodURL:()=>YJ,$ZodULID:()=>FJ,$ZodType:()=>$$,$ZodTuple:()=>q1,$ZodTransform:()=>b8,$ZodTemplateLiteral:()=>L8,$ZodSymbol:()=>iJ,$ZodSuccess:()=>P8,$ZodStringFormat:()=>Z$,$ZodString:()=>J4,$ZodSet:()=>g8,$ZodRegistry:()=>Y9,$ZodRecord:()=>v8,$ZodRealError:()=>wv,$ZodReadonly:()=>Y8,$ZodPromise:()=>X8,$ZodPrefault:()=>W8,$ZodPipe:()=>I8,$ZodOptional:()=>X1,$ZodObjectJIT:()=>aJ,$ZodObject:()=>v7,$ZodNumberFormat:()=>cJ,$ZodNumber:()=>Y1,$ZodNullable:()=>O8,$ZodNull:()=>xJ,$ZodNonOptional:()=>B8,$ZodNever:()=>oJ,$ZodNanoID:()=>qJ,$ZodNaN:()=>H8,$ZodMap:()=>U8,$ZodMAC:()=>yJ,$ZodLiteral:()=>z8,$ZodLazy:()=>w8,$ZodKSUID:()=>ZJ,$ZodJWT:()=>fJ,$ZodIntersection:()=>$8,$ZodISOTime:()=>SJ,$ZodISODuration:()=>NJ,$ZodISODateTime:()=>MJ,$ZodISODate:()=>QJ,$ZodIPv6:()=>uJ,$ZodIPv4:()=>rJ,$ZodGUID:()=>kJ,$ZodFunction:()=>q8,$ZodFile:()=>J8,$ZodExactOptional:()=>G8,$ZodError:()=>nU,$ZodEnum:()=>_8,$ZodEncodeError:()=>g4,$ZodEmoji:()=>LJ,$ZodEmail:()=>IJ,$ZodE164:()=>CJ,$ZodDiscriminatedUnion:()=>eJ,$ZodDefault:()=>K8,$ZodDate:()=>tJ,$ZodCustomStringFormat:()=>mJ,$ZodCustom:()=>F8,$ZodCodec:()=>zg,$ZodCheckUpperCase:()=>zJ,$ZodCheckStringFormat:()=>l4,$ZodCheckStartsWith:()=>bJ,$ZodCheckSizeEquals:()=>ez,$ZodCheckRegex:()=>gJ,$ZodCheckProperty:()=>OJ,$ZodCheckOverwrite:()=>WJ,$ZodCheckNumberFormat:()=>tz,$ZodCheckMultipleOf:()=>nz,$ZodCheckMinSize:()=>sz,$ZodCheckMinLength:()=>vJ,$ZodCheckMimeType:()=>KJ,$ZodCheckMaxSize:()=>az,$ZodCheckMaxLength:()=>$J,$ZodCheckLowerCase:()=>_J,$ZodCheckLessThan:()=>O1,$ZodCheckLengthEquals:()=>UJ,$ZodCheckIncludes:()=>JJ,$ZodCheckGreaterThan:()=>K1,$ZodCheckEndsWith:()=>GJ,$ZodCheckBigIntFormat:()=>dz,$ZodCheck:()=>S$,$ZodCatch:()=>k8,$ZodCUID2:()=>wJ,$ZodCUID:()=>XJ,$ZodCIDRv6:()=>RJ,$ZodCIDRv4:()=>DJ,$ZodBoolean:()=>gg,$ZodBigIntFormat:()=>EJ,$ZodBigInt:()=>L1,$ZodBase64URL:()=>VJ,$ZodBase64:()=>jJ,$ZodAsyncError:()=>ov,$ZodArray:()=>dJ,$ZodAny:()=>hJ});var bz=Object.freeze({status:"aborted"});function w($,v,g){function _(b,O){if(!b._zod)Object.defineProperty(b,"_zod",{value:{def:O,constr:J,traits:new Set},enumerable:!1});if(b._zod.traits.has($))return;b._zod.traits.add($),v(b,O);let K=J.prototype,W=Object.keys(K);for(let B=0;B<W.length;B++){let k=W[B];if(!(k in b))b[k]=K[k].bind(b)}}let U=g?.Parent??Object;class z extends U{}Object.defineProperty(z,"name",{value:$});function J(b){var O;let K=g?.Parent?new z:this;_(K,b),(O=K._zod).deferred??(O.deferred=[]);for(let W of K._zod.deferred)W();return K}return Object.defineProperty(J,"init",{value:_}),Object.defineProperty(J,Symbol.hasInstance,{value:(b)=>{if(g?.Parent&&b instanceof g.Parent)return!0;return b?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}var Gz=Symbol("zod_brand");class ov extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class g4 extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}var EU={};function l$($){if($)Object.assign(EU,$);return EU}var j={};ev(j,{unwrapMessage:()=>iU,uint8ArrayToHex:()=>FI,uint8ArrayToBase64url:()=>XI,uint8ArrayToBase64:()=>F5,stringifyPrimitive:()=>D,slugify:()=>Wz,shallowClone:()=>Pz,safeExtend:()=>kI,required:()=>YI,randomString:()=>bI,propertyKeyTypes:()=>hU,promiseAllObject:()=>JI,primitiveTypes:()=>kz,prefixIssues:()=>Sv,pick:()=>WI,partial:()=>II,parsedType:()=>R,optionalKeys:()=>Hz,omit:()=>BI,objectClone:()=>gI,numKeys:()=>GI,nullish:()=>r6,normalizeParams:()=>V,mergeDefs:()=>b6,merge:()=>HI,jsonStringifyReplacer:()=>j4,joinValues:()=>A,issue:()=>C4,isPlainObject:()=>y6,isObject:()=>_4,hexToUint8Array:()=>wI,getSizableOrigin:()=>pU,getParsedType:()=>OI,getLengthableOrigin:()=>oU,getEnumValues:()=>lU,getElementAtPath:()=>zI,floatSafeRemainder:()=>Kz,finalizeIssue:()=>Xv,extend:()=>PI,escapeRegex:()=>yv,esc:()=>s_,defineLazy:()=>z$,createTransparentProxy:()=>KI,cloneDef:()=>_I,clone:()=>kv,cleanRegex:()=>xU,cleanEnum:()=>LI,captureStackTrace:()=>e_,cached:()=>V4,base64urlToUint8Array:()=>qI,base64ToUint8Array:()=>w5,assignProp:()=>u6,assertNotEqual:()=>eH,assertNever:()=>vI,assertIs:()=>$I,assertEqual:()=>sH,assert:()=>UI,allowsEval:()=>Bz,aborted:()=>D6,NUMBER_FORMAT_RANGES:()=>Iz,Class:()=>A5,BIGINT_FORMAT_RANGES:()=>Yz});function sH($){return $}function eH($){return $}function $I($){}function vI($){throw Error("Unexpected value in exhaustive check")}function UI($){}function lU($){let v=Object.values($).filter((_)=>typeof _==="number");return Object.entries($).filter(([_,U])=>v.indexOf(+_)===-1).map(([_,U])=>U)}function A($,v="|"){return $.map((g)=>D(g)).join(v)}function j4($,v){if(typeof v==="bigint")return v.toString();return v}function V4($){return{get value(){{let g=$();return Object.defineProperty(this,"value",{value:g}),g}throw Error("cached value already set")}}}function r6($){return $===null||$===void 0}function xU($){let v=$.startsWith("^")?1:0,g=$.endsWith("$")?$.length-1:$.length;return $.slice(v,g)}function Kz($,v){let g=($.toString().split(".")[1]||"").length,_=v.toString(),U=(_.split(".")[1]||"").length;if(U===0&&/\d?e-\d?/.test(_)){let O=_.match(/\d?e-(\d?)/);if(O?.[1])U=Number.parseInt(O[1])}let z=g>U?g:U,J=Number.parseInt($.toFixed(z).replace(".","")),b=Number.parseInt(v.toFixed(z).replace(".",""));return J%b/10**z}var X5=Symbol("evaluating");function z$($,v,g){let _=void 0;Object.defineProperty($,v,{get(){if(_===X5)return;if(_===void 0)_=X5,_=g();return _},set(U){Object.defineProperty($,v,{value:U})},configurable:!0})}function gI($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function u6($,v,g){Object.defineProperty($,v,{value:g,writable:!0,enumerable:!0,configurable:!0})}function b6(...$){let v={};for(let g of $){let _=Object.getOwnPropertyDescriptors(g);Object.assign(v,_)}return Object.defineProperties({},v)}function _I($){return b6($._zod.def)}function zI($,v){if(!v)return $;return v.reduce((g,_)=>g?.[_],$)}function JI($){let v=Object.keys($),g=v.map((_)=>$[_]);return Promise.all(g).then((_)=>{let U={};for(let z=0;z<v.length;z++)U[v[z]]=_[z];return U})}function bI($=10){let g="";for(let _=0;_<$;_++)g+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return g}function s_($){return JSON.stringify($)}function Wz($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var e_="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function _4($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var Bz=V4(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function y6($){if(_4($)===!1)return!1;let v=$.constructor;if(v===void 0)return!0;if(typeof v!=="function")return!0;let g=v.prototype;if(_4(g)===!1)return!1;if(Object.prototype.hasOwnProperty.call(g,"isPrototypeOf")===!1)return!1;return!0}function Pz($){if(y6($))return{...$};if(Array.isArray($))return[...$];return $}function GI($){let v=0;for(let g in $)if(Object.prototype.hasOwnProperty.call($,g))v++;return v}var OI=($)=>{let v=typeof $;switch(v){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${v}`)}},hU=new Set(["string","number","symbol"]),kz=new Set(["string","number","bigint","boolean","symbol","undefined"]);function yv($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kv($,v,g){let _=new $._zod.constr(v??$._zod.def);if(!v||g?.parent)_._zod.parent=$;return _}function V($){let v=$;if(!v)return{};if(typeof v==="string")return{error:()=>v};if(v?.message!==void 0){if(v?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");v.error=v.message}if(delete v.message,typeof v.error==="string")return{...v,error:()=>v.error};return v}function KI($){let v;return new Proxy({},{get(g,_,U){return v??(v=$()),Reflect.get(v,_,U)},set(g,_,U,z){return v??(v=$()),Reflect.set(v,_,U,z)},has(g,_){return v??(v=$()),Reflect.has(v,_)},deleteProperty(g,_){return v??(v=$()),Reflect.deleteProperty(v,_)},ownKeys(g){return v??(v=$()),Reflect.ownKeys(v)},getOwnPropertyDescriptor(g,_){return v??(v=$()),Reflect.getOwnPropertyDescriptor(v,_)},defineProperty(g,_,U){return v??(v=$()),Reflect.defineProperty(v,_,U)}})}function D($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function Hz($){return Object.keys($).filter((v)=>{return $[v]._zod.optin==="optional"&&$[v]._zod.optout==="optional"})}var Iz={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Yz={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function WI($,v){let g=$._zod.def,_=g.checks;if(_&&_.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let z=b6($._zod.def,{get shape(){let J={};for(let b in v){if(!(b in g.shape))throw Error(`Unrecognized key: "${b}"`);if(!v[b])continue;J[b]=g.shape[b]}return u6(this,"shape",J),J},checks:[]});return kv($,z)}function BI($,v){let g=$._zod.def,_=g.checks;if(_&&_.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let z=b6($._zod.def,{get shape(){let J={...$._zod.def.shape};for(let b in v){if(!(b in g.shape))throw Error(`Unrecognized key: "${b}"`);if(!v[b])continue;delete J[b]}return u6(this,"shape",J),J},checks:[]});return kv($,z)}function PI($,v){if(!y6(v))throw Error("Invalid input to extend: expected a plain object");let g=$._zod.def.checks;if(g&&g.length>0){let z=$._zod.def.shape;for(let J in v)if(Object.getOwnPropertyDescriptor(z,J)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let U=b6($._zod.def,{get shape(){let z={...$._zod.def.shape,...v};return u6(this,"shape",z),z}});return kv($,U)}function kI($,v){if(!y6(v))throw Error("Invalid input to safeExtend: expected a plain object");let g=b6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v};return u6(this,"shape",_),_}});return kv($,g)}function HI($,v){let g=b6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v._zod.def.shape};return u6(this,"shape",_),_},get catchall(){return v._zod.def.catchall},checks:[]});return kv($,g)}function II($,v,g){let U=v._zod.def.checks;if(U&&U.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let J=b6(v._zod.def,{get shape(){let b=v._zod.def.shape,O={...b};if(g)for(let K in g){if(!(K in b))throw Error(`Unrecognized key: "${K}"`);if(!g[K])continue;O[K]=$?new $({type:"optional",innerType:b[K]}):b[K]}else for(let K in b)O[K]=$?new $({type:"optional",innerType:b[K]}):b[K];return u6(this,"shape",O),O},checks:[]});return kv(v,J)}function YI($,v,g){let _=b6(v._zod.def,{get shape(){let U=v._zod.def.shape,z={...U};if(g)for(let J in g){if(!(J in z))throw Error(`Unrecognized key: "${J}"`);if(!g[J])continue;z[J]=new $({type:"nonoptional",innerType:U[J]})}else for(let J in U)z[J]=new $({type:"nonoptional",innerType:U[J]});return u6(this,"shape",z),z}});return kv(v,_)}function D6($,v=0){if($.aborted===!0)return!0;for(let g=v;g<$.issues.length;g++)if($.issues[g]?.continue!==!0)return!0;return!1}function Sv($,v){return v.map((g)=>{var _;return(_=g).path??(_.path=[]),g.path.unshift($),g})}function iU($){return typeof $==="string"?$:$?.message}function Xv($,v,g){let _={...$,path:$.path??[]};if(!$.message){let U=iU($.inst?._zod.def?.error?.($))??iU(v?.error?.($))??iU(g.customError?.($))??iU(g.localeError?.($))??"Invalid input";_.message=U}if(delete _.inst,delete _.continue,!v?.reportInput)delete _.input;return _}function pU($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function oU($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function R($){let v=typeof $;switch(v){case"number":return Number.isNaN($)?"nan":"number";case"object":{if($===null)return"null";if(Array.isArray($))return"array";let g=$;if(g&&Object.getPrototypeOf(g)!==Object.prototype&&"constructor"in g&&g.constructor)return g.constructor.name}}return v}function C4(...$){let[v,g,_]=$;if(typeof v==="string")return{message:v,code:"custom",input:g,inst:_};return{...v}}function LI($){return Object.entries($).filter(([v,g])=>{return Number.isNaN(Number.parseInt(v,10))}).map((v)=>v[1])}function w5($){let v=atob($),g=new Uint8Array(v.length);for(let _=0;_<v.length;_++)g[_]=v.charCodeAt(_);return g}function F5($){let v="";for(let g=0;g<$.length;g++)v+=String.fromCharCode($[g]);return btoa(v)}function qI($){let v=$.replace(/-/g,"+").replace(/_/g,"/"),g="=".repeat((4-v.length%4)%4);return w5(v+g)}function XI($){return F5($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wI($){let v=$.replace(/^0x/,"");if(v.length%2!==0)throw Error("Invalid hex string length");let g=new Uint8Array(v.length/2);for(let _=0;_<v.length;_+=2)g[_/2]=Number.parseInt(v.slice(_,_+2),16);return g}function FI($){return Array.from($).map((v)=>v.toString(16).padStart(2,"0")).join("")}class A5{constructor(...$){}}var Z5=($,v)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:v,enumerable:!1}),$.message=JSON.stringify(v,j4,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},nU=w("$ZodError",Z5),wv=w("$ZodError",Z5,{Parent:Error});function tU($,v=(g)=>g.message){let g={},_=[];for(let U of $.issues)if(U.path.length>0)g[U.path[0]]=g[U.path[0]]||[],g[U.path[0]].push(v(U));else _.push(v(U));return{formErrors:_,fieldErrors:g}}function dU($,v=(g)=>g.message){let g={_errors:[]},_=(U)=>{for(let z of U.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((J)=>_({issues:J}));else if(z.code==="invalid_key")_({issues:z.issues});else if(z.code==="invalid_element")_({issues:z.issues});else if(z.path.length===0)g._errors.push(v(z));else{let J=g,b=0;while(b<z.path.length){let O=z.path[b];if(b!==z.path.length-1)J[O]=J[O]||{_errors:[]};else J[O]=J[O]||{_errors:[]},J[O]._errors.push(v(z));J=J[O],b++}}};return _($),g}function Lz($,v=(g)=>g.message){let g={errors:[]},_=(U,z=[])=>{var J,b;for(let O of U.issues)if(O.code==="invalid_union"&&O.errors.length)O.errors.map((K)=>_({issues:K},O.path));else if(O.code==="invalid_key")_({issues:O.issues},O.path);else if(O.code==="invalid_element")_({issues:O.issues},O.path);else{let K=[...z,...O.path];if(K.length===0){g.errors.push(v(O));continue}let W=g,B=0;while(B<K.length){let k=K[B],P=B===K.length-1;if(typeof k==="string")W.properties??(W.properties={}),(J=W.properties)[k]??(J[k]={errors:[]}),W=W.properties[k];else W.items??(W.items=[]),(b=W.items)[k]??(b[k]={errors:[]}),W=W.items[k];if(P)W.errors.push(v(O));B++}}};return _($),g}function M5($){let v=[],g=$.map((_)=>typeof _==="object"?_.key:_);for(let _ of g)if(typeof _==="number")v.push(`[${_}]`);else if(typeof _==="symbol")v.push(`[${JSON.stringify(String(_))}]`);else if(/[^\w$]/.test(_))v.push(`[${JSON.stringify(_)}]`);else{if(v.length)v.push(".");v.push(_)}return v.join("")}function qz($){let v=[],g=[...$.issues].sort((_,U)=>(_.path??[]).length-(U.path??[]).length);for(let _ of g)if(v.push(`✖ ${_.message}`),_.path?.length)v.push(` → at ${M5(_.path)}`);return v.join(`
108
- `)}var f4=($)=>(v,g,_,U)=>{let z=_?Object.assign(_,{async:!1}):{async:!1},J=v._zod.run({value:g,issues:[]},z);if(J instanceof Promise)throw new ov;if(J.issues.length){let b=new(U?.Err??$)(J.issues.map((O)=>Xv(O,z,l$())));throw e_(b,U?.callee),b}return J.value},aU=f4(wv),m4=($)=>async(v,g,_,U)=>{let z=_?Object.assign(_,{async:!0}):{async:!0},J=v._zod.run({value:g,issues:[]},z);if(J instanceof Promise)J=await J;if(J.issues.length){let b=new(U?.Err??$)(J.issues.map((O)=>Xv(O,z,l$())));throw e_(b,U?.callee),b}return J.value},sU=m4(wv),c4=($)=>(v,g,_)=>{let U=_?{..._,async:!1}:{async:!1},z=v._zod.run({value:g,issues:[]},U);if(z instanceof Promise)throw new ov;return z.issues.length?{success:!1,error:new($??nU)(z.issues.map((J)=>Xv(J,U,l$())))}:{success:!0,data:z.value}},E4=c4(wv),i4=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{async:!0}):{async:!0},z=v._zod.run({value:g,issues:[]},U);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((J)=>Xv(J,U,l$())))}:{success:!0,data:z.value}},eU=i4(wv),$1=($)=>(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return f4($)(v,g,U)},Q5=$1(wv),v1=($)=>(v,g,_)=>{return f4($)(v,g,_)},S5=v1(wv),U1=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return m4($)(v,g,U)},N5=U1(wv),g1=($)=>async(v,g,_)=>{return m4($)(v,g,_)},r5=g1(wv),_1=($)=>(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return c4($)(v,g,U)},u5=_1(wv),z1=($)=>(v,g,_)=>{return c4($)(v,g,_)},y5=z1(wv),J1=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return i4($)(v,g,U)},D5=J1(wv),b1=($)=>async(v,g,_)=>{return i4($)(v,g,_)},R5=b1(wv);var Dv={};ev(Dv,{xid:()=>Az,uuid7:()=>SI,uuid6:()=>QI,uuid4:()=>MI,uuid:()=>z4,uppercase:()=>oz,unicodeEmail:()=>T5,undefined:()=>hz,ulid:()=>Fz,time:()=>fz,string:()=>cz,sha512_hex:()=>nI,sha512_base64url:()=>dI,sha512_base64:()=>tI,sha384_hex:()=>hI,sha384_base64url:()=>oI,sha384_base64:()=>pI,sha256_hex:()=>iI,sha256_base64url:()=>xI,sha256_base64:()=>lI,sha1_hex:()=>mI,sha1_base64url:()=>EI,sha1_base64:()=>cI,rfc5322Email:()=>rI,number:()=>$g,null:()=>xz,nanoid:()=>Mz,md5_hex:()=>VI,md5_base64url:()=>fI,md5_base64:()=>CI,mac:()=>Dz,lowercase:()=>pz,ksuid:()=>Zz,ipv6:()=>yz,ipv4:()=>uz,integer:()=>iz,idnEmail:()=>uI,html5Email:()=>NI,hostname:()=>RI,hex:()=>jI,guid:()=>Sz,extendedDuration:()=>ZI,emoji:()=>rz,email:()=>Nz,e164:()=>Vz,duration:()=>Qz,domain:()=>TI,datetime:()=>mz,date:()=>Cz,cuid2:()=>wz,cuid:()=>Xz,cidrv6:()=>Tz,cidrv4:()=>Rz,browserEmail:()=>yI,boolean:()=>lz,bigint:()=>Ez,base64url:()=>G1,base64:()=>jz});var Xz=/^[cC][^\s-]{8,}$/,wz=/^[0-9a-z]+$/,Fz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Az=/^[0-9a-vA-V]{20}$/,Zz=/^[A-Za-z0-9]{27}$/,Mz=/^[a-zA-Z0-9_-]{21}$/,Qz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ZI=/^[-+]?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)?)??$/,Sz=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,z4=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},MI=z4(4),QI=z4(6),SI=z4(7),Nz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,NI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,rI=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,T5=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,uI=T5,yI=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,DI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function rz(){return new RegExp(DI,"u")}var uz=/^(?:(?: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])$/,yz=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Dz=($)=>{let v=yv($??":");return new RegExp(`^(?:[0-9A-F]{2}${v}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${v}){5}[0-9a-f]{2}$`)},Rz=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Tz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,G1=/^[A-Za-z0-9_-]*$/,RI=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,TI=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Vz=/^\+[1-9]\d{6,14}$/,j5="(?:(?:\\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])))",Cz=new RegExp(`^${j5}$`);function V5($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function fz($){return new RegExp(`^${V5($)}$`)}function mz($){let v=V5({precision:$.precision}),g=["Z"];if($.local)g.push("");if($.offset)g.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let _=`${v}(?:${g.join("|")})`;return new RegExp(`^${j5}T(?:${_})$`)}var cz=($)=>{let v=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${v}$`)},Ez=/^-?\d+n?$/,iz=/^-?\d+$/,$g=/^-?\d+(?:\.\d+)?$/,lz=/^(?:true|false)$/i,xz=/^null$/i;var hz=/^undefined$/i;var pz=/^[^A-Z]*$/,oz=/^[^a-z]*$/,jI=/^[0-9a-fA-F]*$/;function vg($,v){return new RegExp(`^[A-Za-z0-9+/]{${$}}${v}$`)}function Ug($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var VI=/^[0-9a-fA-F]{32}$/,CI=vg(22,"=="),fI=Ug(22),mI=/^[0-9a-fA-F]{40}$/,cI=vg(27,"="),EI=Ug(27),iI=/^[0-9a-fA-F]{64}$/,lI=vg(43,"="),xI=Ug(43),hI=/^[0-9a-fA-F]{96}$/,pI=vg(64,""),oI=Ug(64),nI=/^[0-9a-fA-F]{128}$/,tI=vg(86,"=="),dI=Ug(86);var S$=w("$ZodCheck",($,v)=>{var g;$._zod??($._zod={}),$._zod.def=v,(g=$._zod).onattach??(g.onattach=[])}),f5={number:"number",bigint:"bigint",object:"date"},O1=w("$ZodCheckLessThan",($,v)=>{S$.init($,v);let g=f5[typeof v.value];$._zod.onattach.push((_)=>{let U=_._zod.bag,z=(v.inclusive?U.maximum:U.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(v.value<z)if(v.inclusive)U.maximum=v.value;else U.exclusiveMaximum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value<=v.value:_.value<v.value)return;_.issues.push({origin:g,code:"too_big",maximum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),K1=w("$ZodCheckGreaterThan",($,v)=>{S$.init($,v);let g=f5[typeof v.value];$._zod.onattach.push((_)=>{let U=_._zod.bag,z=(v.inclusive?U.minimum:U.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(v.value>z)if(v.inclusive)U.minimum=v.value;else U.exclusiveMinimum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value>=v.value:_.value>v.value)return;_.issues.push({origin:g,code:"too_small",minimum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),nz=w("$ZodCheckMultipleOf",($,v)=>{S$.init($,v),$._zod.onattach.push((g)=>{var _;(_=g._zod.bag).multipleOf??(_.multipleOf=v.value)}),$._zod.check=(g)=>{if(typeof g.value!==typeof v.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof g.value==="bigint"?g.value%v.value===BigInt(0):Kz(g.value,v.value)===0)return;g.issues.push({origin:typeof g.value,code:"not_multiple_of",divisor:v.value,input:g.value,inst:$,continue:!v.abort})}}),tz=w("$ZodCheckNumberFormat",($,v)=>{S$.init($,v),v.format=v.format||"float64";let g=v.format?.includes("int"),_=g?"int":"number",[U,z]=Iz[v.format];$._zod.onattach.push((J)=>{let b=J._zod.bag;if(b.format=v.format,b.minimum=U,b.maximum=z,g)b.pattern=iz}),$._zod.check=(J)=>{let b=J.value;if(g){if(!Number.isInteger(b)){J.issues.push({expected:_,format:v.format,code:"invalid_type",continue:!1,input:b,inst:$});return}if(!Number.isSafeInteger(b)){if(b>0)J.issues.push({input:b,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});else J.issues.push({input:b,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});return}}if(b<U)J.issues.push({origin:"number",input:b,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!v.abort});if(b>z)J.issues.push({origin:"number",input:b,code:"too_big",maximum:z,inclusive:!0,inst:$,continue:!v.abort})}}),dz=w("$ZodCheckBigIntFormat",($,v)=>{S$.init($,v);let[g,_]=Yz[v.format];$._zod.onattach.push((U)=>{let z=U._zod.bag;z.format=v.format,z.minimum=g,z.maximum=_}),$._zod.check=(U)=>{let z=U.value;if(z<g)U.issues.push({origin:"bigint",input:z,code:"too_small",minimum:g,inclusive:!0,inst:$,continue:!v.abort});if(z>_)U.issues.push({origin:"bigint",input:z,code:"too_big",maximum:_,inclusive:!0,inst:$,continue:!v.abort})}}),az=w("$ZodCheckMaxSize",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<U)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let U=_.value;if(U.size<=v.maximum)return;_.issues.push({origin:pU(U),code:"too_big",maximum:v.maximum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),sz=w("$ZodCheckMinSize",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>U)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let U=_.value;if(U.size>=v.minimum)return;_.issues.push({origin:pU(U),code:"too_small",minimum:v.minimum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),ez=w("$ZodCheckSizeEquals",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.minimum=v.size,U.maximum=v.size,U.size=v.size}),$._zod.check=(_)=>{let U=_.value,z=U.size;if(z===v.size)return;let J=z>v.size;_.issues.push({origin:pU(U),...J?{code:"too_big",maximum:v.size}:{code:"too_small",minimum:v.size},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),$J=w("$ZodCheckMaxLength",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<U)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let U=_.value;if(U.length<=v.maximum)return;let J=oU(U);_.issues.push({origin:J,code:"too_big",maximum:v.maximum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),vJ=w("$ZodCheckMinLength",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>U)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let U=_.value;if(U.length>=v.minimum)return;let J=oU(U);_.issues.push({origin:J,code:"too_small",minimum:v.minimum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),UJ=w("$ZodCheckLengthEquals",($,v)=>{var g;S$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!r6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.minimum=v.length,U.maximum=v.length,U.length=v.length}),$._zod.check=(_)=>{let U=_.value,z=U.length;if(z===v.length)return;let J=oU(U),b=z>v.length;_.issues.push({origin:J,...b?{code:"too_big",maximum:v.length}:{code:"too_small",minimum:v.length},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),l4=w("$ZodCheckStringFormat",($,v)=>{var g,_;if(S$.init($,v),$._zod.onattach.push((U)=>{let z=U._zod.bag;if(z.format=v.format,v.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(v.pattern)}),v.pattern)(g=$._zod).check??(g.check=(U)=>{if(v.pattern.lastIndex=0,v.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:v.format,input:U.value,...v.pattern?{pattern:v.pattern.toString()}:{},inst:$,continue:!v.abort})});else(_=$._zod).check??(_.check=()=>{})}),gJ=w("$ZodCheckRegex",($,v)=>{l4.init($,v),$._zod.check=(g)=>{if(v.pattern.lastIndex=0,v.pattern.test(g.value))return;g.issues.push({origin:"string",code:"invalid_format",format:"regex",input:g.value,pattern:v.pattern.toString(),inst:$,continue:!v.abort})}}),_J=w("$ZodCheckLowerCase",($,v)=>{v.pattern??(v.pattern=pz),l4.init($,v)}),zJ=w("$ZodCheckUpperCase",($,v)=>{v.pattern??(v.pattern=oz),l4.init($,v)}),JJ=w("$ZodCheckIncludes",($,v)=>{S$.init($,v);let g=yv(v.includes),_=new RegExp(typeof v.position==="number"?`^.{${v.position}}${g}`:g);v.pattern=_,$._zod.onattach.push((U)=>{let z=U._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(_)}),$._zod.check=(U)=>{if(U.value.includes(v.includes,v.position))return;U.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:v.includes,input:U.value,inst:$,continue:!v.abort})}}),bJ=w("$ZodCheckStartsWith",($,v)=>{S$.init($,v);let g=new RegExp(`^${yv(v.prefix)}.*`);v.pattern??(v.pattern=g),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(g)}),$._zod.check=(_)=>{if(_.value.startsWith(v.prefix))return;_.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:v.prefix,input:_.value,inst:$,continue:!v.abort})}}),GJ=w("$ZodCheckEndsWith",($,v)=>{S$.init($,v);let g=new RegExp(`.*${yv(v.suffix)}$`);v.pattern??(v.pattern=g),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(g)}),$._zod.check=(_)=>{if(_.value.endsWith(v.suffix))return;_.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:v.suffix,input:_.value,inst:$,continue:!v.abort})}});function C5($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues))}var OJ=w("$ZodCheckProperty",($,v)=>{S$.init($,v),$._zod.check=(g)=>{let _=v.schema._zod.run({value:g.value[v.property],issues:[]},{});if(_ instanceof Promise)return _.then((U)=>C5(U,g,v.property));C5(_,g,v.property);return}}),KJ=w("$ZodCheckMimeType",($,v)=>{S$.init($,v);let g=new Set(v.mime);$._zod.onattach.push((_)=>{_._zod.bag.mime=v.mime}),$._zod.check=(_)=>{if(g.has(_.value.type))return;_.issues.push({code:"invalid_value",values:v.mime,input:_.value.type,inst:$,continue:!v.abort})}}),WJ=w("$ZodCheckOverwrite",($,v)=>{S$.init($,v),$._zod.check=(g)=>{g.value=v.tx(g.value)}});class W1{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let g=$.split(`
107
+ `.substring(0,U);return g+z+_}function $H($){return $!=null&&(typeof $==="string"||$.nodeType&&($.nodeType===1||$.nodeType===9||$.nodeType===11))}function d_(){let $=window.prompt("Link URL:");if(!$)return;let v=$.trim().toLowerCase();if(v.startsWith("javascript:")||v.startsWith("data:"))return;document.execCommand("createLink",!1,$)}function q5(){let $=window.getSelection();if(!$||$.rangeCount===0)return;let v=$.getRangeAt(0);if(v.collapsed)return;let g=v.toString(),_=document.createElement("code");_.textContent=g,v.deleteContents(),v.insertNode(_);let U=document.createRange();U.setStartAfter(_),U.setEndAfter(_),$.removeAllRanges(),$.addRange(U)}var a_=8,vH=[{kind:"exec",command:"bold",icon:"B",title:"Bold (⌘B)"},{kind:"exec",command:"italic",icon:"I",title:"Italic (⌘I)"},{kind:"exec",command:"strikeThrough",icon:"S",title:"Strikethrough"},{kind:"code",icon:"{ }",title:"Inline code",dividerBefore:!0},{kind:"block",tag:"H1",icon:"H1",title:"Heading 1",dividerBefore:!0},{kind:"block",tag:"H2",icon:"H2",title:"Heading 2"},{kind:"block",tag:"H3",icon:"H3",title:"Heading 3"},{kind:"block",tag:"P",icon:"¶",title:"Paragraph"},{kind:"block",tag:"BLOCKQUOTE",icon:"❝",title:"Quote",dividerBefore:!0},{kind:"exec",command:"insertUnorderedList",icon:"•",title:"Bullet list"},{kind:"exec",command:"insertOrderedList",icon:"1.",title:"Numbered list"},{kind:"link",icon:"\uD83D\uDD17",title:"Link (⌘K)",dividerBefore:!0}];function UH($){switch($.kind){case"exec":document.execCommand($.command);return;case"block":document.execCommand("formatBlock",!1,$.tag);return;case"code":q5();return;case"link":d_();return}}function X5({hostRef:$,onChange:v}){let[g,_]=h(!1),[U,z]=h({top:0,left:0}),[J,G]=h(0),K=R(null),O=R(null),W=M(()=>{let P=$.current;if(!P){_(!1);return}let X=window.getSelection();if(!X||X.rangeCount===0||X.isCollapsed){_(!1);return}let L=X.getRangeAt(0);if(!P.contains(L.commonAncestorContainer)){_(!1);return}let Y=L.getBoundingClientRect();if(Y.width===0&&Y.height===0){_(!1);return}let I=J||420,q=Math.max(a_,Math.min(Y.left+Y.width/2-I/2,window.innerWidth-I-a_)),w=Math.max(a_,Y.top-a_-36);z({top:w,left:q}),_(!0)},[$,J]),B=M(()=>{if(O.current!==null)return;O.current=requestAnimationFrame(()=>{O.current=null,W()})},[W]);E(()=>{return document.addEventListener("selectionchange",B),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),()=>{if(document.removeEventListener("selectionchange",B),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),O.current!==null)cancelAnimationFrame(O.current)}},[B]),W_(()=>{if(!g)return;let P=K.current;if(!P)return;let X=P.getBoundingClientRect().width;if(X&&Math.abs(X-J)>1)G(X)},[g,J]);let k=M((P)=>{UH(P),v(),W()},[v,W]);if(!g)return null;return b("div",{ref:K,class:"md-inline-format-bar",style:{top:`${U.top}px`,left:`${U.left}px`},onMouseDown:(P)=>P.preventDefault(),children:vH.flatMap((P,X)=>{let L=b("button",{type:"button",class:"md-inline-format-btn",title:P.title,onClick:()=>k(P),children:P.icon},`btn-${X}`,!1,void 0,this);return P.dividerBefore?[b("span",{class:"md-inline-format-divider"},`div-${X}`,!1,void 0,this),L]:[L]})},void 0,!1,void 0,this)}var Kz=null;function gH(){if(Kz)return Kz;let $=new xU({headingStyle:"atx",codeBlockStyle:"fenced",emDelimiter:"*",bulletListMarker:"-"});return $.use(F5.gfm),Kz=$,$}function w5({initialHtml:$,className:v,onChange:g,onSave:_}){let U=R(null),z=R($);E(()=>{let B=U.current;if(!B)return;B.innerHTML=z.current},[]);let J=M(()=>{let B=U.current;if(!B)return"";return gH().turndown(B.innerHTML)},[]),G=M(()=>{g(J())},[g,J]),K=M(()=>{_?.(J())},[_,J]),O=M((B)=>{if(!(B.metaKey||B.ctrlKey))return;if(B.key==="s"){B.preventDefault(),K();return}if(B.key==="b"){B.preventDefault(),document.execCommand("bold"),G();return}if(B.key==="i"){B.preventDefault(),document.execCommand("italic"),G();return}if(B.key==="k")B.preventDefault(),d_(),G()},[G,K]),W=M((B)=>{let k=B.clipboardData?.getData("text/plain");if(k==null)return;B.preventDefault(),document.execCommand("insertText",!1,k),G()},[G]);return b(e$,{children:[b("div",{ref:U,class:v,contentEditable:!0,spellcheck:!1,onInput:G,onKeyDown:O,onPaste:W,onBlur:K},void 0,!1,void 0,this),b(X5,{hostRef:U,onChange:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Oz({html:$,className:v,style:g}){let _=R(null);return E(()=>{let U=_.current;if(!U)return;if(U.replaceChildren(),!$)return;let z=document.createElement("template");z.innerHTML=$,U.append(z.content.cloneNode(!0))},[$]),b("div",{ref:_,class:v,style:g},void 0,!1,void 0,this)}function s_({node:$,expanded:v=!1}){let g=$.data.path,[_,U]=h(""),[z,J]=h(""),[G,K]=h(!1),[O,W]=h(!1),[B,k]=h(!1),[P,X]=h(!1),L=R(null),Y=R(null),I=R(""),q=R(null),w=$.data.reviewActive;E(()=>{let N=!1;return(async()=>{let U$;if(g){let i=await VU(g);if(N)return;U$=i.content}else if($.data.content)U$=$.data.content;else{K(!0);return}U(U$);let m=await g6(U$);if(N)return;J(m),K(!0),v$($.id,{content:U$,rendered:m})})(),()=>{N=!0}},[g,$.id,$.data.content]);let S=M(async(N)=>{let U$=N.target.value;U(U$),X(!0);let m=await g6(U$);J(m)},[]),C=M(async(N)=>{if(!g){let m=await g6(N);J(m),X(!1),v$($.id,{content:N,rendered:m}),await Zv($.id,{content:N,data:{rendered:m}});return}k(!0);let U$=await oK(g,N);if(k(!1),U$.ok){let m=await g6(N);J(m),X(!1),v$($.id,{content:N,rendered:m,savedAt:U$.updatedAt}),await Zv($.id,{content:N,data:{rendered:m,savedAt:U$.updatedAt}})}},[g,$.id]),o=M(async()=>{if(!P)return;await C(_)},[P,_,C]),y=M((N)=>{if((N.metaKey||N.ctrlKey)&&N.key==="s"){N.preventDefault(),o();return}let U$=L.current;if(U$&&iO(N,U$))return;if(U$&&N.key==="Tab")N.preventDefault(),cO(U$,N.shiftKey)},[o]);q.current=C;let n=M((N)=>{if(U(N),X(!0),I.current=N,Y.current!==null)window.clearTimeout(Y.current);Y.current=window.setTimeout(()=>{Y.current=null,C(N)},800)},[C]),e=M((N)=>{if(U(N),I.current=N,Y.current!==null)window.clearTimeout(Y.current),Y.current=null;C(N)},[C]);E(()=>{return()=>{if(Y.current===null)return;window.clearTimeout(Y.current),Y.current=null;let N=q.current;if(N)N(I.current)}},[$.id]);let D=w?b("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-ok-10)",color:"var(--c-ok)",borderBottom:"1px solid var(--c-ok-20)",textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600},children:"Review active"},void 0,!1,void 0,this):null;if(O&&v)return b("div",{class:"md-editor-expanded",onKeyDown:y,children:[b("div",{class:"md-editor-toolbar",children:[b("button",{type:"button",class:"md-toolbar-btn",onClick:()=>W(!1),children:"← Back to document"},void 0,!1,void 0,this),b("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[g&&b("span",{class:"md-toolbar-path",children:g.split("/").pop()},void 0,!1,void 0,this),b("button",{type:"button",class:`md-toolbar-btn${P?" md-toolbar-btn-primary":""}`,onClick:o,disabled:!P||B,children:B?"Saving…":P?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"md-editor-split",children:[b("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[b("textarea",{ref:L,value:_,onInput:S,spellcheck:!1},void 0,!1,void 0,this),b(d2,{textareaRef:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b(Oz,{html:z,className:"md-preview"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(O)return b("div",{class:"md-editor-split",style:{height:"100%"},onKeyDown:y,children:[b("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[b("textarea",{ref:L,value:_,onInput:S,spellcheck:!1},void 0,!1,void 0,this),b(d2,{textareaRef:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b(Oz,{html:z,className:"md-preview"},void 0,!1,void 0,this),b("div",{style:{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},children:[b("button",{type:"button",onClick:()=>W(!1),style:{padding:"4px 10px",fontSize:"11px",background:"var(--c-input-bg)",border:"1px solid var(--c-line)",borderRadius:"6px",color:"var(--c-text-soft)",cursor:"pointer"},children:"Document"},void 0,!1,void 0,this),b("button",{type:"button",onClick:o,disabled:!P||B,style:{padding:"4px 10px",fontSize:"11px",background:P?"var(--c-accent-25)":"var(--c-input-bg)",border:`1px solid ${P?"var(--c-accent)":"var(--c-line)"}`,borderRadius:"6px",color:P?"var(--c-text)":"var(--c-dim)",cursor:P?"pointer":"default"},children:B?"Saving…":P?"Save":"Saved"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(v)return b("div",{style:{height:"100%",position:"relative"},children:[D,b("div",{class:"md-reader",children:G?b(w5,{initialHtml:z||"<p><br></p>",className:"md-reader-content md-reader-editable",onChange:n,onSave:e},$.id,!1,void 0,this):b("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"24px"},children:"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("button",{type:"button",class:"md-edit-fab",onClick:()=>W(!0),children:"</> Source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return b("div",{style:{height:"100%",position:"relative"},children:[D,b(Oz,{html:z,style:{padding:z?"0":"12px",color:z?void 0:"var(--c-dim)"}},void 0,!1,void 0,this),!G&&b("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Loading…"},void 0,!1,void 0,this),G&&!z&&b("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"Empty node"},void 0,!1,void 0,this),b("button",{type:"button",onClick:()=>z6($.id),style:{position:"absolute",top:"4px",right:"4px",padding:"3px 8px",fontSize:"10px",background:"var(--c-panel-overlay)",border:"1px solid var(--c-line)",borderRadius:"4px",color:"var(--c-text-soft)",cursor:"pointer",opacity:0.7},onMouseEnter:(N)=>{N.target.style.opacity="1"},onMouseLeave:(N)=>{N.target.style.opacity="0.7"},children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var e_="pmx-canvas-ax",$1="pmx-canvas-ax-ack",pv="pmx-canvas-html-node",Wz="pmx-canvas-ext-app-alive";var A5=37;function _H($){return $.type==="html"||$.type==="json-render"||$.type==="graph"||$.type==="mcp-app"||$.type==="webpage"}function zH($){if($.type==="html")return $.data.presentation!==!0;if($.type==="json-render"||$.type==="graph")return!0;if($.type==="mcp-app")return $.data.viewerType==="web-artifact";return!1}function Z5($){return $.collapsed===!0||$.dockPosition!=null||$.data.strictSize===!0||$.data.userResized===!0||$.type==="group"}function Bz($){return!Z5($)&&!_H($)}function Q5($,v){if(!Bz($)||v<=0)return null;return Math.min(v+37,600)}function Pz($){return zH($)&&!Z5($)}function M5($,v){if(!Pz($)||v<=0)return null;let g=Math.min(v+37+24,1400);return g>$.size.height+8?g:null}var H={};ev(H,{xor:()=>zW,xid:()=>D7,void:()=>vW,uuidv7:()=>w7,uuidv6:()=>F7,uuidv4:()=>X7,uuid:()=>q7,util:()=>r,url:()=>A7,uppercase:()=>t4,unknown:()=>M$,union:()=>A$,undefined:()=>e7,ulid:()=>y7,uint64:()=>a7,uint32:()=>n7,tuple:()=>Z3,trim:()=>vU,treeifyError:()=>Qz,transform:()=>Q0,toUpperCase:()=>gU,toLowerCase:()=>UU,toJSONSchema:()=>e1,templateLiteral:()=>HW,symbol:()=>s7,superRefine:()=>d3,success:()=>PW,stringbool:()=>AW,stringFormat:()=>c7,string:()=>Z,strictObject:()=>_W,startsWith:()=>a4,slugify:()=>_U,size:()=>K4,setErrorMap:()=>NI,set:()=>KW,safeParseAsync:()=>U3,safeParse:()=>v3,safeEncodeAsync:()=>K3,safeEncode:()=>G3,safeDecodeAsync:()=>O3,safeDecode:()=>b3,registry:()=>Z1,regexes:()=>uv,regex:()=>o4,refine:()=>t3,record:()=>y$,readonly:()=>x3,property:()=>t1,promise:()=>LW,prettifyError:()=>Mz,preprocess:()=>Sg,prefault:()=>V3,positive:()=>l1,pipe:()=>qg,partialRecord:()=>JW,parseAsync:()=>$3,parse:()=>eG,overwrite:()=>Ev,optional:()=>R$,object:()=>l,number:()=>L$,nullish:()=>BW,nullable:()=>Ig,null:()=>PU,normalize:()=>$U,nonpositive:()=>o1,nonoptional:()=>C3,nonnegative:()=>n1,never:()=>Z0,negative:()=>p1,nativeEnum:()=>OW,nanoid:()=>M7,nan:()=>kW,multipleOf:()=>T6,minSize:()=>dv,minLength:()=>b6,mime:()=>e4,meta:()=>FW,maxSize:()=>j6,maxLength:()=>O4,map:()=>bW,mac:()=>T7,lte:()=>Nv,lt:()=>nv,lowercase:()=>n4,looseRecord:()=>GW,looseObject:()=>Uv,locales:()=>Pg,literal:()=>t,length:()=>W4,lazy:()=>p3,ksuid:()=>R7,keyof:()=>gW,jwt:()=>m7,json:()=>ZW,iso:()=>f6,ipv6:()=>j7,ipv4:()=>u7,intersection:()=>kU,int64:()=>d7,int32:()=>o7,int:()=>z0,instanceof:()=>wW,includes:()=>d4,httpUrl:()=>Z7,hostname:()=>i7,hex:()=>x7,hash:()=>h7,guid:()=>I7,gte:()=>Yv,gt:()=>tv,globalRegistry:()=>vv,getErrorMap:()=>yI,function:()=>IW,fromJSONSchema:()=>MW,formatError:()=>eU,float64:()=>p7,float32:()=>l7,flattenError:()=>sU,file:()=>WW,exactOptional:()=>R3,enum:()=>gv,endsWith:()=>s4,encodeAsync:()=>z3,encode:()=>g3,emoji:()=>Q7,email:()=>L7,e164:()=>E7,discriminatedUnion:()=>Zg,describe:()=>XW,decodeAsync:()=>J3,decode:()=>_3,date:()=>UW,custom:()=>D0,cuid2:()=>N7,cuid:()=>S7,core:()=>K6,config:()=>x$,coerce:()=>s3,codec:()=>YW,clone:()=>kv,cidrv6:()=>V7,cidrv4:()=>r7,check:()=>qW,catch:()=>m3,boolean:()=>h$,bigint:()=>t7,base64url:()=>f7,base64:()=>C7,array:()=>G$,any:()=>$W,_function:()=>IW,_default:()=>j3,_ZodString:()=>J0,ZodXor:()=>X3,ZodXID:()=>P0,ZodVoid:()=>I3,ZodUnknown:()=>H3,ZodUnion:()=>Ag,ZodUndefined:()=>P3,ZodUUID:()=>av,ZodURL:()=>Xg,ZodULID:()=>B0,ZodType:()=>_$,ZodTuple:()=>A3,ZodTransform:()=>y3,ZodTemplateLiteral:()=>h3,ZodSymbol:()=>B3,ZodSuccess:()=>f3,ZodStringFormat:()=>Q$,ZodString:()=>bU,ZodSet:()=>M3,ZodRecord:()=>Qg,ZodRealError:()=>wv,ZodReadonly:()=>i3,ZodPromise:()=>o3,ZodPrefault:()=>r3,ZodPipe:()=>N0,ZodOptional:()=>M0,ZodObject:()=>wg,ZodNumberFormat:()=>B4,ZodNumber:()=>OU,ZodNullable:()=>u3,ZodNull:()=>k3,ZodNonOptional:()=>S0,ZodNever:()=>L3,ZodNanoID:()=>K0,ZodNaN:()=>c3,ZodMap:()=>Q3,ZodMAC:()=>W3,ZodLiteral:()=>S3,ZodLazy:()=>l3,ZodKSUID:()=>k0,ZodJWT:()=>w0,ZodIssueCode:()=>SI,ZodIntersection:()=>w3,ZodISOTime:()=>g0,ZodISODuration:()=>_0,ZodISODateTime:()=>v0,ZodISODate:()=>U0,ZodIPv6:()=>H0,ZodIPv4:()=>Y0,ZodGUID:()=>Lg,ZodFunction:()=>n3,ZodFirstPartyTypeKind:()=>a3,ZodFile:()=>N3,ZodExactOptional:()=>D3,ZodError:()=>QI,ZodEnum:()=>GU,ZodEmoji:()=>b0,ZodEmail:()=>G0,ZodE164:()=>F0,ZodDiscriminatedUnion:()=>F3,ZodDefault:()=>T3,ZodDate:()=>Fg,ZodCustomStringFormat:()=>KU,ZodCustom:()=>Mg,ZodCodec:()=>y0,ZodCatch:()=>E3,ZodCUID2:()=>W0,ZodCUID:()=>O0,ZodCIDRv6:()=>I0,ZodCIDRv4:()=>L0,ZodBoolean:()=>WU,ZodBigIntFormat:()=>A0,ZodBigInt:()=>BU,ZodBase64URL:()=>X0,ZodBase64:()=>q0,ZodArray:()=>q3,ZodAny:()=>Y3,TimePrecision:()=>N9,NEVER:()=>kz,$output:()=>w9,$input:()=>A9,$brand:()=>Yz});var K6={};ev(K6,{version:()=>qJ,util:()=>r,treeifyError:()=>Qz,toJSONSchema:()=>e1,toDotPath:()=>u5,safeParseAsync:()=>Ug,safeParse:()=>x4,safeEncodeAsync:()=>E5,safeEncode:()=>C5,safeDecodeAsync:()=>m5,safeDecode:()=>f5,registry:()=>Z1,regexes:()=>uv,process:()=>F$,prettifyError:()=>Mz,parseAsync:()=>vg,parse:()=>$g,meta:()=>bG,locales:()=>Pg,isValidJWT:()=>z7,isValidBase64URL:()=>_7,isValidBase64:()=>cJ,initializeContext:()=>r6,globalRegistry:()=>vv,globalConfig:()=>hU,formatError:()=>eU,flattenError:()=>sU,finalize:()=>C6,extractDefs:()=>V6,encodeAsync:()=>r5,encode:()=>T5,describe:()=>GG,decodeAsync:()=>V5,decode:()=>j5,createToJSONSchemaMethod:()=>OG,createStandardJSONSchemaMethod:()=>JU,config:()=>x$,clone:()=>kv,_xor:()=>vI,_xid:()=>r1,_void:()=>s9,_uuidv7:()=>y1,_uuidv6:()=>N1,_uuidv4:()=>S1,_uuid:()=>M1,_url:()=>Yg,_uppercase:()=>t4,_unknown:()=>d9,_union:()=>$I,_undefined:()=>o9,_ulid:()=>j1,_uint64:()=>l9,_uint32:()=>E9,_tuple:()=>_I,_trim:()=>vU,_transform:()=>WI,_toUpperCase:()=>gU,_toLowerCase:()=>UU,_templateLiteral:()=>XI,_symbol:()=>p9,_superRefine:()=>JG,_success:()=>HI,_stringbool:()=>KG,_stringFormat:()=>zU,_string:()=>Q9,_startsWith:()=>a4,_slugify:()=>_U,_size:()=>K4,_set:()=>GI,_safeParseAsync:()=>h4,_safeParse:()=>i4,_safeEncodeAsync:()=>K1,_safeEncode:()=>G1,_safeDecodeAsync:()=>O1,_safeDecode:()=>b1,_regex:()=>o4,_refine:()=>zG,_record:()=>zI,_readonly:()=>qI,_property:()=>t1,_promise:()=>wI,_positive:()=>l1,_pipe:()=>II,_parseAsync:()=>c4,_parse:()=>m4,_overwrite:()=>Ev,_optional:()=>BI,_number:()=>T9,_nullable:()=>PI,_null:()=>n9,_normalize:()=>$U,_nonpositive:()=>o1,_nonoptional:()=>YI,_nonnegative:()=>n1,_never:()=>a9,_negative:()=>p1,_nativeEnum:()=>KI,_nanoid:()=>R1,_nan:()=>vG,_multipleOf:()=>T6,_minSize:()=>dv,_minLength:()=>b6,_min:()=>Yv,_mime:()=>e4,_maxSize:()=>j6,_maxLength:()=>O4,_max:()=>Nv,_map:()=>JI,_mac:()=>S9,_lte:()=>Nv,_lt:()=>nv,_lowercase:()=>n4,_literal:()=>OI,_length:()=>W4,_lazy:()=>FI,_ksuid:()=>V1,_jwt:()=>h1,_isoTime:()=>R9,_isoDuration:()=>u9,_isoDateTime:()=>y9,_isoDate:()=>D9,_ipv6:()=>f1,_ipv4:()=>C1,_intersection:()=>gI,_int64:()=>h9,_int32:()=>f9,_int:()=>r9,_includes:()=>d4,_guid:()=>kg,_gte:()=>Yv,_gt:()=>tv,_float64:()=>C9,_float32:()=>V9,_file:()=>gG,_enum:()=>bI,_endsWith:()=>s4,_encodeAsync:()=>z1,_encode:()=>g1,_emoji:()=>D1,_email:()=>Q1,_e164:()=>x1,_discriminatedUnion:()=>UI,_default:()=>kI,_decodeAsync:()=>J1,_decode:()=>_1,_date:()=>e9,_custom:()=>_G,_cuid2:()=>T1,_cuid:()=>u1,_coercedString:()=>M9,_coercedNumber:()=>j9,_coercedDate:()=>$G,_coercedBoolean:()=>c9,_coercedBigint:()=>x9,_cidrv6:()=>m1,_cidrv4:()=>E1,_check:()=>k7,_catch:()=>LI,_boolean:()=>m9,_bigint:()=>i9,_base64url:()=>i1,_base64:()=>c1,_array:()=>UG,_any:()=>t9,TimePrecision:()=>N9,NEVER:()=>kz,JSONSchemaGenerator:()=>nG,JSONSchema:()=>Y7,Doc:()=>k1,$output:()=>w9,$input:()=>A9,$constructor:()=>F,$brand:()=>Yz,$ZodXor:()=>z8,$ZodXID:()=>DJ,$ZodVoid:()=>v8,$ZodUnknown:()=>eJ,$ZodUnion:()=>Gg,$ZodUndefined:()=>dJ,$ZodUUID:()=>wJ,$ZodURL:()=>ZJ,$ZodULID:()=>yJ,$ZodType:()=>$$,$ZodTuple:()=>w1,$ZodTransform:()=>k8,$ZodTemplateLiteral:()=>Q8,$ZodSymbol:()=>tJ,$ZodSuccess:()=>X8,$ZodStringFormat:()=>Z$,$ZodString:()=>b4,$ZodSet:()=>O8,$ZodRegistry:()=>Z9,$ZodRecord:()=>b8,$ZodRealError:()=>Fv,$ZodReadonly:()=>Z8,$ZodPromise:()=>S8,$ZodPrefault:()=>I8,$ZodPipe:()=>A8,$ZodOptional:()=>A1,$ZodObjectJIT:()=>_8,$ZodObject:()=>b7,$ZodNumberFormat:()=>oJ,$ZodNumber:()=>X1,$ZodNullable:()=>H8,$ZodNull:()=>aJ,$ZodNonOptional:()=>q8,$ZodNever:()=>$8,$ZodNanoID:()=>MJ,$ZodNaN:()=>w8,$ZodMap:()=>K8,$ZodMAC:()=>fJ,$ZodLiteral:()=>B8,$ZodLazy:()=>N8,$ZodKSUID:()=>RJ,$ZodJWT:()=>lJ,$ZodIntersection:()=>G8,$ZodISOTime:()=>jJ,$ZodISODuration:()=>rJ,$ZodISODateTime:()=>uJ,$ZodISODate:()=>TJ,$ZodIPv6:()=>CJ,$ZodIPv4:()=>VJ,$ZodGUID:()=>FJ,$ZodFunction:()=>M8,$ZodFile:()=>P8,$ZodExactOptional:()=>Y8,$ZodError:()=>aU,$ZodEnum:()=>W8,$ZodEncodeError:()=>z4,$ZodEmoji:()=>QJ,$ZodEmail:()=>AJ,$ZodE164:()=>hJ,$ZodDiscriminatedUnion:()=>J8,$ZodDefault:()=>L8,$ZodDate:()=>U8,$ZodCustomStringFormat:()=>pJ,$ZodCustom:()=>y8,$ZodCodec:()=>bg,$ZodCheckUpperCase:()=>BJ,$ZodCheckStringFormat:()=>l4,$ZodCheckStartsWith:()=>kJ,$ZodCheckSizeEquals:()=>JJ,$ZodCheckRegex:()=>OJ,$ZodCheckProperty:()=>HJ,$ZodCheckOverwrite:()=>IJ,$ZodCheckNumberFormat:()=>UJ,$ZodCheckMultipleOf:()=>vJ,$ZodCheckMinSize:()=>zJ,$ZodCheckMinLength:()=>bJ,$ZodCheckMimeType:()=>LJ,$ZodCheckMaxSize:()=>_J,$ZodCheckMaxLength:()=>GJ,$ZodCheckLowerCase:()=>WJ,$ZodCheckLessThan:()=>B1,$ZodCheckLengthEquals:()=>KJ,$ZodCheckIncludes:()=>PJ,$ZodCheckGreaterThan:()=>P1,$ZodCheckEndsWith:()=>YJ,$ZodCheckBigIntFormat:()=>gJ,$ZodCheck:()=>N$,$ZodCatch:()=>F8,$ZodCUID2:()=>NJ,$ZodCUID:()=>SJ,$ZodCIDRv6:()=>mJ,$ZodCIDRv4:()=>EJ,$ZodBoolean:()=>Jg,$ZodBigIntFormat:()=>nJ,$ZodBigInt:()=>F1,$ZodBase64URL:()=>xJ,$ZodBase64:()=>iJ,$ZodAsyncError:()=>ov,$ZodArray:()=>g8,$ZodAny:()=>sJ});var kz=Object.freeze({status:"aborted"});function F($,v,g){function _(G,K){if(!G._zod)Object.defineProperty(G,"_zod",{value:{def:K,constr:J,traits:new Set},enumerable:!1});if(G._zod.traits.has($))return;G._zod.traits.add($),v(G,K);let O=J.prototype,W=Object.keys(O);for(let B=0;B<W.length;B++){let k=W[B];if(!(k in G))G[k]=O[k].bind(G)}}let U=g?.Parent??Object;class z extends U{}Object.defineProperty(z,"name",{value:$});function J(G){var K;let O=g?.Parent?new z:this;_(O,G),(K=O._zod).deferred??(K.deferred=[]);for(let W of O._zod.deferred)W();return O}return Object.defineProperty(J,"init",{value:_}),Object.defineProperty(J,Symbol.hasInstance,{value:(G)=>{if(g?.Parent&&G instanceof g.Parent)return!0;return G?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}var Yz=Symbol("zod_brand");class ov extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class z4 extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}var hU={};function x$($){if($)Object.assign(hU,$);return hU}var r={};ev(r,{unwrapMessage:()=>lU,uint8ArrayToHex:()=>DH,uint8ArrayToBase64url:()=>NH,uint8ArrayToBase64:()=>y5,stringifyPrimitive:()=>u,slugify:()=>Iz,shallowClone:()=>Xz,safeExtend:()=>wH,required:()=>QH,randomString:()=>YH,propertyKeyTypes:()=>nU,promiseAllObject:()=>kH,primitiveTypes:()=>Fz,prefixIssues:()=>Sv,pick:()=>qH,partial:()=>ZH,parsedType:()=>T,optionalKeys:()=>wz,omit:()=>XH,objectClone:()=>WH,numKeys:()=>HH,nullish:()=>y6,normalizeParams:()=>V,mergeDefs:()=>G6,merge:()=>AH,jsonStringifyReplacer:()=>C4,joinValues:()=>A,issue:()=>E4,isPlainObject:()=>R6,isObject:()=>J4,hexToUint8Array:()=>yH,getSizableOrigin:()=>tU,getParsedType:()=>LH,getLengthableOrigin:()=>dU,getEnumValues:()=>pU,getElementAtPath:()=>PH,floatSafeRemainder:()=>Lz,finalizeIssue:()=>Xv,extend:()=>FH,escapeRegex:()=>Rv,esc:()=>v1,defineLazy:()=>J$,createTransparentProxy:()=>IH,cloneDef:()=>BH,clone:()=>kv,cleanRegex:()=>oU,cleanEnum:()=>MH,captureStackTrace:()=>U1,cached:()=>f4,base64urlToUint8Array:()=>SH,base64ToUint8Array:()=>N5,assignProp:()=>D6,assertNotEqual:()=>GH,assertNever:()=>KH,assertIs:()=>bH,assertEqual:()=>JH,assert:()=>OH,allowsEval:()=>qz,aborted:()=>u6,NUMBER_FORMAT_RANGES:()=>Az,Class:()=>D5,BIGINT_FORMAT_RANGES:()=>Zz});function JH($){return $}function GH($){return $}function bH($){}function KH($){throw Error("Unexpected value in exhaustive check")}function OH($){}function pU($){let v=Object.values($).filter((_)=>typeof _==="number");return Object.entries($).filter(([_,U])=>v.indexOf(+_)===-1).map(([_,U])=>U)}function A($,v="|"){return $.map((g)=>u(g)).join(v)}function C4($,v){if(typeof v==="bigint")return v.toString();return v}function f4($){return{get value(){{let g=$();return Object.defineProperty(this,"value",{value:g}),g}throw Error("cached value already set")}}}function y6($){return $===null||$===void 0}function oU($){let v=$.startsWith("^")?1:0,g=$.endsWith("$")?$.length-1:$.length;return $.slice(v,g)}function Lz($,v){let g=($.toString().split(".")[1]||"").length,_=v.toString(),U=(_.split(".")[1]||"").length;if(U===0&&/\d?e-\d?/.test(_)){let K=_.match(/\d?e-(\d?)/);if(K?.[1])U=Number.parseInt(K[1])}let z=g>U?g:U,J=Number.parseInt($.toFixed(z).replace(".","")),G=Number.parseInt(v.toFixed(z).replace(".",""));return J%G/10**z}var S5=Symbol("evaluating");function J$($,v,g){let _=void 0;Object.defineProperty($,v,{get(){if(_===S5)return;if(_===void 0)_=S5,_=g();return _},set(U){Object.defineProperty($,v,{value:U})},configurable:!0})}function WH($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function D6($,v,g){Object.defineProperty($,v,{value:g,writable:!0,enumerable:!0,configurable:!0})}function G6(...$){let v={};for(let g of $){let _=Object.getOwnPropertyDescriptors(g);Object.assign(v,_)}return Object.defineProperties({},v)}function BH($){return G6($._zod.def)}function PH($,v){if(!v)return $;return v.reduce((g,_)=>g?.[_],$)}function kH($){let v=Object.keys($),g=v.map((_)=>$[_]);return Promise.all(g).then((_)=>{let U={};for(let z=0;z<v.length;z++)U[v[z]]=_[z];return U})}function YH($=10){let g="";for(let _=0;_<$;_++)g+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return g}function v1($){return JSON.stringify($)}function Iz($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var U1="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function J4($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var qz=f4(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function R6($){if(J4($)===!1)return!1;let v=$.constructor;if(v===void 0)return!0;if(typeof v!=="function")return!0;let g=v.prototype;if(J4(g)===!1)return!1;if(Object.prototype.hasOwnProperty.call(g,"isPrototypeOf")===!1)return!1;return!0}function Xz($){if(R6($))return{...$};if(Array.isArray($))return[...$];return $}function HH($){let v=0;for(let g in $)if(Object.prototype.hasOwnProperty.call($,g))v++;return v}var LH=($)=>{let v=typeof $;switch(v){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray($))return"array";if($===null)return"null";if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return"promise";if(typeof Map<"u"&&$ instanceof Map)return"map";if(typeof Set<"u"&&$ instanceof Set)return"set";if(typeof Date<"u"&&$ instanceof Date)return"date";if(typeof File<"u"&&$ instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${v}`)}},nU=new Set(["string","number","symbol"]),Fz=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Rv($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kv($,v,g){let _=new $._zod.constr(v??$._zod.def);if(!v||g?.parent)_._zod.parent=$;return _}function V($){let v=$;if(!v)return{};if(typeof v==="string")return{error:()=>v};if(v?.message!==void 0){if(v?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");v.error=v.message}if(delete v.message,typeof v.error==="string")return{...v,error:()=>v.error};return v}function IH($){let v;return new Proxy({},{get(g,_,U){return v??(v=$()),Reflect.get(v,_,U)},set(g,_,U,z){return v??(v=$()),Reflect.set(v,_,U,z)},has(g,_){return v??(v=$()),Reflect.has(v,_)},deleteProperty(g,_){return v??(v=$()),Reflect.deleteProperty(v,_)},ownKeys(g){return v??(v=$()),Reflect.ownKeys(v)},getOwnPropertyDescriptor(g,_){return v??(v=$()),Reflect.getOwnPropertyDescriptor(v,_)},defineProperty(g,_,U){return v??(v=$()),Reflect.defineProperty(v,_,U)}})}function u($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function wz($){return Object.keys($).filter((v)=>{return $[v]._zod.optin==="optional"&&$[v]._zod.optout==="optional"})}var Az={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Zz={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function qH($,v){let g=$._zod.def,_=g.checks;if(_&&_.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let z=G6($._zod.def,{get shape(){let J={};for(let G in v){if(!(G in g.shape))throw Error(`Unrecognized key: "${G}"`);if(!v[G])continue;J[G]=g.shape[G]}return D6(this,"shape",J),J},checks:[]});return kv($,z)}function XH($,v){let g=$._zod.def,_=g.checks;if(_&&_.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let z=G6($._zod.def,{get shape(){let J={...$._zod.def.shape};for(let G in v){if(!(G in g.shape))throw Error(`Unrecognized key: "${G}"`);if(!v[G])continue;delete J[G]}return D6(this,"shape",J),J},checks:[]});return kv($,z)}function FH($,v){if(!R6(v))throw Error("Invalid input to extend: expected a plain object");let g=$._zod.def.checks;if(g&&g.length>0){let z=$._zod.def.shape;for(let J in v)if(Object.getOwnPropertyDescriptor(z,J)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let U=G6($._zod.def,{get shape(){let z={...$._zod.def.shape,...v};return D6(this,"shape",z),z}});return kv($,U)}function wH($,v){if(!R6(v))throw Error("Invalid input to safeExtend: expected a plain object");let g=G6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v};return D6(this,"shape",_),_}});return kv($,g)}function AH($,v){let g=G6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v._zod.def.shape};return D6(this,"shape",_),_},get catchall(){return v._zod.def.catchall},checks:[]});return kv($,g)}function ZH($,v,g){let U=v._zod.def.checks;if(U&&U.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let J=G6(v._zod.def,{get shape(){let G=v._zod.def.shape,K={...G};if(g)for(let O in g){if(!(O in G))throw Error(`Unrecognized key: "${O}"`);if(!g[O])continue;K[O]=$?new $({type:"optional",innerType:G[O]}):G[O]}else for(let O in G)K[O]=$?new $({type:"optional",innerType:G[O]}):G[O];return D6(this,"shape",K),K},checks:[]});return kv(v,J)}function QH($,v,g){let _=G6(v._zod.def,{get shape(){let U=v._zod.def.shape,z={...U};if(g)for(let J in g){if(!(J in z))throw Error(`Unrecognized key: "${J}"`);if(!g[J])continue;z[J]=new $({type:"nonoptional",innerType:U[J]})}else for(let J in U)z[J]=new $({type:"nonoptional",innerType:U[J]});return D6(this,"shape",z),z}});return kv(v,_)}function u6($,v=0){if($.aborted===!0)return!0;for(let g=v;g<$.issues.length;g++)if($.issues[g]?.continue!==!0)return!0;return!1}function Sv($,v){return v.map((g)=>{var _;return(_=g).path??(_.path=[]),g.path.unshift($),g})}function lU($){return typeof $==="string"?$:$?.message}function Xv($,v,g){let _={...$,path:$.path??[]};if(!$.message){let U=lU($.inst?._zod.def?.error?.($))??lU(v?.error?.($))??lU(g.customError?.($))??lU(g.localeError?.($))??"Invalid input";_.message=U}if(delete _.inst,delete _.continue,!v?.reportInput)delete _.input;return _}function tU($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function dU($){if(Array.isArray($))return"array";if(typeof $==="string")return"string";return"unknown"}function T($){let v=typeof $;switch(v){case"number":return Number.isNaN($)?"nan":"number";case"object":{if($===null)return"null";if(Array.isArray($))return"array";let g=$;if(g&&Object.getPrototypeOf(g)!==Object.prototype&&"constructor"in g&&g.constructor)return g.constructor.name}}return v}function E4(...$){let[v,g,_]=$;if(typeof v==="string")return{message:v,code:"custom",input:g,inst:_};return{...v}}function MH($){return Object.entries($).filter(([v,g])=>{return Number.isNaN(Number.parseInt(v,10))}).map((v)=>v[1])}function N5($){let v=atob($),g=new Uint8Array(v.length);for(let _=0;_<v.length;_++)g[_]=v.charCodeAt(_);return g}function y5($){let v="";for(let g=0;g<$.length;g++)v+=String.fromCharCode($[g]);return btoa(v)}function SH($){let v=$.replace(/-/g,"+").replace(/_/g,"/"),g="=".repeat((4-v.length%4)%4);return N5(v+g)}function NH($){return y5($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function yH($){let v=$.replace(/^0x/,"");if(v.length%2!==0)throw Error("Invalid hex string length");let g=new Uint8Array(v.length/2);for(let _=0;_<v.length;_+=2)g[_/2]=Number.parseInt(v.slice(_,_+2),16);return g}function DH($){return Array.from($).map((v)=>v.toString(16).padStart(2,"0")).join("")}class D5{constructor(...$){}}var R5=($,v)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:v,enumerable:!1}),$.message=JSON.stringify(v,C4,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},aU=F("$ZodError",R5),Fv=F("$ZodError",R5,{Parent:Error});function sU($,v=(g)=>g.message){let g={},_=[];for(let U of $.issues)if(U.path.length>0)g[U.path[0]]=g[U.path[0]]||[],g[U.path[0]].push(v(U));else _.push(v(U));return{formErrors:_,fieldErrors:g}}function eU($,v=(g)=>g.message){let g={_errors:[]},_=(U)=>{for(let z of U.issues)if(z.code==="invalid_union"&&z.errors.length)z.errors.map((J)=>_({issues:J}));else if(z.code==="invalid_key")_({issues:z.issues});else if(z.code==="invalid_element")_({issues:z.issues});else if(z.path.length===0)g._errors.push(v(z));else{let J=g,G=0;while(G<z.path.length){let K=z.path[G];if(G!==z.path.length-1)J[K]=J[K]||{_errors:[]};else J[K]=J[K]||{_errors:[]},J[K]._errors.push(v(z));J=J[K],G++}}};return _($),g}function Qz($,v=(g)=>g.message){let g={errors:[]},_=(U,z=[])=>{var J,G;for(let K of U.issues)if(K.code==="invalid_union"&&K.errors.length)K.errors.map((O)=>_({issues:O},K.path));else if(K.code==="invalid_key")_({issues:K.issues},K.path);else if(K.code==="invalid_element")_({issues:K.issues},K.path);else{let O=[...z,...K.path];if(O.length===0){g.errors.push(v(K));continue}let W=g,B=0;while(B<O.length){let k=O[B],P=B===O.length-1;if(typeof k==="string")W.properties??(W.properties={}),(J=W.properties)[k]??(J[k]={errors:[]}),W=W.properties[k];else W.items??(W.items=[]),(G=W.items)[k]??(G[k]={errors:[]}),W=W.items[k];if(P)W.errors.push(v(K));B++}}};return _($),g}function u5($){let v=[],g=$.map((_)=>typeof _==="object"?_.key:_);for(let _ of g)if(typeof _==="number")v.push(`[${_}]`);else if(typeof _==="symbol")v.push(`[${JSON.stringify(String(_))}]`);else if(/[^\w$]/.test(_))v.push(`[${JSON.stringify(_)}]`);else{if(v.length)v.push(".");v.push(_)}return v.join("")}function Mz($){let v=[],g=[...$.issues].sort((_,U)=>(_.path??[]).length-(U.path??[]).length);for(let _ of g)if(v.push(`✖ ${_.message}`),_.path?.length)v.push(` → at ${u5(_.path)}`);return v.join(`
108
+ `)}var m4=($)=>(v,g,_,U)=>{let z=_?Object.assign(_,{async:!1}):{async:!1},J=v._zod.run({value:g,issues:[]},z);if(J instanceof Promise)throw new ov;if(J.issues.length){let G=new(U?.Err??$)(J.issues.map((K)=>Xv(K,z,x$())));throw U1(G,U?.callee),G}return J.value},$g=m4(Fv),c4=($)=>async(v,g,_,U)=>{let z=_?Object.assign(_,{async:!0}):{async:!0},J=v._zod.run({value:g,issues:[]},z);if(J instanceof Promise)J=await J;if(J.issues.length){let G=new(U?.Err??$)(J.issues.map((K)=>Xv(K,z,x$())));throw U1(G,U?.callee),G}return J.value},vg=c4(Fv),i4=($)=>(v,g,_)=>{let U=_?{..._,async:!1}:{async:!1},z=v._zod.run({value:g,issues:[]},U);if(z instanceof Promise)throw new ov;return z.issues.length?{success:!1,error:new($??aU)(z.issues.map((J)=>Xv(J,U,x$())))}:{success:!0,data:z.value}},x4=i4(Fv),h4=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{async:!0}):{async:!0},z=v._zod.run({value:g,issues:[]},U);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((J)=>Xv(J,U,x$())))}:{success:!0,data:z.value}},Ug=h4(Fv),g1=($)=>(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return m4($)(v,g,U)},T5=g1(Fv),_1=($)=>(v,g,_)=>{return m4($)(v,g,_)},j5=_1(Fv),z1=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return c4($)(v,g,U)},r5=z1(Fv),J1=($)=>async(v,g,_)=>{return c4($)(v,g,_)},V5=J1(Fv),G1=($)=>(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return i4($)(v,g,U)},C5=G1(Fv),b1=($)=>(v,g,_)=>{return i4($)(v,g,_)},f5=b1(Fv),K1=($)=>async(v,g,_)=>{let U=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return h4($)(v,g,U)},E5=K1(Fv),O1=($)=>async(v,g,_)=>{return h4($)(v,g,_)},m5=O1(Fv);var uv={};ev(uv,{xid:()=>Dz,uuid7:()=>rH,uuid6:()=>jH,uuid4:()=>TH,uuid:()=>G4,uppercase:()=>$J,unicodeEmail:()=>c5,undefined:()=>sz,ulid:()=>yz,time:()=>lz,string:()=>oz,sha512_hex:()=>UL,sha512_base64url:()=>_L,sha512_base64:()=>gL,sha384_hex:()=>eH,sha384_base64url:()=>vL,sha384_base64:()=>$L,sha256_hex:()=>dH,sha256_base64url:()=>sH,sha256_base64:()=>aH,sha1_hex:()=>oH,sha1_base64url:()=>tH,sha1_base64:()=>nH,rfc5322Email:()=>CH,number:()=>gg,null:()=>az,nanoid:()=>uz,md5_hex:()=>hH,md5_base64url:()=>pH,md5_base64:()=>lH,mac:()=>Ez,lowercase:()=>ez,ksuid:()=>Rz,ipv6:()=>fz,ipv4:()=>Cz,integer:()=>tz,idnEmail:()=>fH,html5Email:()=>VH,hostname:()=>cH,hex:()=>xH,guid:()=>jz,extendedDuration:()=>uH,emoji:()=>Vz,email:()=>rz,e164:()=>xz,duration:()=>Tz,domain:()=>iH,datetime:()=>pz,date:()=>hz,cuid2:()=>Nz,cuid:()=>Sz,cidrv6:()=>cz,cidrv4:()=>mz,browserEmail:()=>EH,boolean:()=>dz,bigint:()=>nz,base64url:()=>W1,base64:()=>iz});var Sz=/^[cC][^\s-]{8,}$/,Nz=/^[0-9a-z]+$/,yz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Dz=/^[0-9a-vA-V]{20}$/,Rz=/^[A-Za-z0-9]{27}$/,uz=/^[a-zA-Z0-9_-]{21}$/,Tz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uH=/^[-+]?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)?)??$/,jz=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,G4=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},TH=G4(4),jH=G4(6),rH=G4(7),rz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,VH=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,CH=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,c5=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,fH=c5,EH=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,mH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Vz(){return new RegExp(mH,"u")}var Cz=/^(?:(?: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])$/,fz=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Ez=($)=>{let v=Rv($??":");return new RegExp(`^(?:[0-9A-F]{2}${v}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${v}){5}[0-9a-f]{2}$`)},mz=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,cz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,iz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,W1=/^[A-Za-z0-9_-]*$/,cH=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,iH=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,xz=/^\+[1-9]\d{6,14}$/,i5="(?:(?:\\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])))",hz=new RegExp(`^${i5}$`);function x5($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function lz($){return new RegExp(`^${x5($)}$`)}function pz($){let v=x5({precision:$.precision}),g=["Z"];if($.local)g.push("");if($.offset)g.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let _=`${v}(?:${g.join("|")})`;return new RegExp(`^${i5}T(?:${_})$`)}var oz=($)=>{let v=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${v}$`)},nz=/^-?\d+n?$/,tz=/^-?\d+$/,gg=/^-?\d+(?:\.\d+)?$/,dz=/^(?:true|false)$/i,az=/^null$/i;var sz=/^undefined$/i;var ez=/^[^A-Z]*$/,$J=/^[^a-z]*$/,xH=/^[0-9a-fA-F]*$/;function _g($,v){return new RegExp(`^[A-Za-z0-9+/]{${$}}${v}$`)}function zg($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var hH=/^[0-9a-fA-F]{32}$/,lH=_g(22,"=="),pH=zg(22),oH=/^[0-9a-fA-F]{40}$/,nH=_g(27,"="),tH=zg(27),dH=/^[0-9a-fA-F]{64}$/,aH=_g(43,"="),sH=zg(43),eH=/^[0-9a-fA-F]{96}$/,$L=_g(64,""),vL=zg(64),UL=/^[0-9a-fA-F]{128}$/,gL=_g(86,"=="),_L=zg(86);var N$=F("$ZodCheck",($,v)=>{var g;$._zod??($._zod={}),$._zod.def=v,(g=$._zod).onattach??(g.onattach=[])}),l5={number:"number",bigint:"bigint",object:"date"},B1=F("$ZodCheckLessThan",($,v)=>{N$.init($,v);let g=l5[typeof v.value];$._zod.onattach.push((_)=>{let U=_._zod.bag,z=(v.inclusive?U.maximum:U.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(v.value<z)if(v.inclusive)U.maximum=v.value;else U.exclusiveMaximum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value<=v.value:_.value<v.value)return;_.issues.push({origin:g,code:"too_big",maximum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),P1=F("$ZodCheckGreaterThan",($,v)=>{N$.init($,v);let g=l5[typeof v.value];$._zod.onattach.push((_)=>{let U=_._zod.bag,z=(v.inclusive?U.minimum:U.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(v.value>z)if(v.inclusive)U.minimum=v.value;else U.exclusiveMinimum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value>=v.value:_.value>v.value)return;_.issues.push({origin:g,code:"too_small",minimum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),vJ=F("$ZodCheckMultipleOf",($,v)=>{N$.init($,v),$._zod.onattach.push((g)=>{var _;(_=g._zod.bag).multipleOf??(_.multipleOf=v.value)}),$._zod.check=(g)=>{if(typeof g.value!==typeof v.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof g.value==="bigint"?g.value%v.value===BigInt(0):Lz(g.value,v.value)===0)return;g.issues.push({origin:typeof g.value,code:"not_multiple_of",divisor:v.value,input:g.value,inst:$,continue:!v.abort})}}),UJ=F("$ZodCheckNumberFormat",($,v)=>{N$.init($,v),v.format=v.format||"float64";let g=v.format?.includes("int"),_=g?"int":"number",[U,z]=Az[v.format];$._zod.onattach.push((J)=>{let G=J._zod.bag;if(G.format=v.format,G.minimum=U,G.maximum=z,g)G.pattern=tz}),$._zod.check=(J)=>{let G=J.value;if(g){if(!Number.isInteger(G)){J.issues.push({expected:_,format:v.format,code:"invalid_type",continue:!1,input:G,inst:$});return}if(!Number.isSafeInteger(G)){if(G>0)J.issues.push({input:G,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});else J.issues.push({input:G,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:$,origin:_,inclusive:!0,continue:!v.abort});return}}if(G<U)J.issues.push({origin:"number",input:G,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!v.abort});if(G>z)J.issues.push({origin:"number",input:G,code:"too_big",maximum:z,inclusive:!0,inst:$,continue:!v.abort})}}),gJ=F("$ZodCheckBigIntFormat",($,v)=>{N$.init($,v);let[g,_]=Zz[v.format];$._zod.onattach.push((U)=>{let z=U._zod.bag;z.format=v.format,z.minimum=g,z.maximum=_}),$._zod.check=(U)=>{let z=U.value;if(z<g)U.issues.push({origin:"bigint",input:z,code:"too_small",minimum:g,inclusive:!0,inst:$,continue:!v.abort});if(z>_)U.issues.push({origin:"bigint",input:z,code:"too_big",maximum:_,inclusive:!0,inst:$,continue:!v.abort})}}),_J=F("$ZodCheckMaxSize",($,v)=>{var g;N$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<U)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let U=_.value;if(U.size<=v.maximum)return;_.issues.push({origin:tU(U),code:"too_big",maximum:v.maximum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),zJ=F("$ZodCheckMinSize",($,v)=>{var g;N$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>U)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let U=_.value;if(U.size>=v.minimum)return;_.issues.push({origin:tU(U),code:"too_small",minimum:v.minimum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),JJ=F("$ZodCheckSizeEquals",($,v)=>{var g;N$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y6(U)&&U.size!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.minimum=v.size,U.maximum=v.size,U.size=v.size}),$._zod.check=(_)=>{let U=_.value,z=U.size;if(z===v.size)return;let J=z>v.size;_.issues.push({origin:tU(U),...J?{code:"too_big",maximum:v.size}:{code:"too_small",minimum:v.size},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),GJ=F("$ZodCheckMaxLength",($,v)=>{var g;N$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<U)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let U=_.value;if(U.length<=v.maximum)return;let J=dU(U);_.issues.push({origin:J,code:"too_big",maximum:v.maximum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),bJ=F("$ZodCheckMinLength",($,v)=>{var g;N$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>U)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let U=_.value;if(U.length>=v.minimum)return;let J=dU(U);_.issues.push({origin:J,code:"too_small",minimum:v.minimum,inclusive:!0,input:U,inst:$,continue:!v.abort})}}),KJ=F("$ZodCheckLengthEquals",($,v)=>{var g;N$.init($,v),(g=$._zod.def).when??(g.when=(_)=>{let U=_.value;return!y6(U)&&U.length!==void 0}),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.minimum=v.length,U.maximum=v.length,U.length=v.length}),$._zod.check=(_)=>{let U=_.value,z=U.length;if(z===v.length)return;let J=dU(U),G=z>v.length;_.issues.push({origin:J,...G?{code:"too_big",maximum:v.length}:{code:"too_small",minimum:v.length},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),l4=F("$ZodCheckStringFormat",($,v)=>{var g,_;if(N$.init($,v),$._zod.onattach.push((U)=>{let z=U._zod.bag;if(z.format=v.format,v.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(v.pattern)}),v.pattern)(g=$._zod).check??(g.check=(U)=>{if(v.pattern.lastIndex=0,v.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:v.format,input:U.value,...v.pattern?{pattern:v.pattern.toString()}:{},inst:$,continue:!v.abort})});else(_=$._zod).check??(_.check=()=>{})}),OJ=F("$ZodCheckRegex",($,v)=>{l4.init($,v),$._zod.check=(g)=>{if(v.pattern.lastIndex=0,v.pattern.test(g.value))return;g.issues.push({origin:"string",code:"invalid_format",format:"regex",input:g.value,pattern:v.pattern.toString(),inst:$,continue:!v.abort})}}),WJ=F("$ZodCheckLowerCase",($,v)=>{v.pattern??(v.pattern=ez),l4.init($,v)}),BJ=F("$ZodCheckUpperCase",($,v)=>{v.pattern??(v.pattern=$J),l4.init($,v)}),PJ=F("$ZodCheckIncludes",($,v)=>{N$.init($,v);let g=Rv(v.includes),_=new RegExp(typeof v.position==="number"?`^.{${v.position}}${g}`:g);v.pattern=_,$._zod.onattach.push((U)=>{let z=U._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(_)}),$._zod.check=(U)=>{if(U.value.includes(v.includes,v.position))return;U.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:v.includes,input:U.value,inst:$,continue:!v.abort})}}),kJ=F("$ZodCheckStartsWith",($,v)=>{N$.init($,v);let g=new RegExp(`^${Rv(v.prefix)}.*`);v.pattern??(v.pattern=g),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(g)}),$._zod.check=(_)=>{if(_.value.startsWith(v.prefix))return;_.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:v.prefix,input:_.value,inst:$,continue:!v.abort})}}),YJ=F("$ZodCheckEndsWith",($,v)=>{N$.init($,v);let g=new RegExp(`.*${Rv(v.suffix)}$`);v.pattern??(v.pattern=g),$._zod.onattach.push((_)=>{let U=_._zod.bag;U.patterns??(U.patterns=new Set),U.patterns.add(g)}),$._zod.check=(_)=>{if(_.value.endsWith(v.suffix))return;_.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:v.suffix,input:_.value,inst:$,continue:!v.abort})}});function h5($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues))}var HJ=F("$ZodCheckProperty",($,v)=>{N$.init($,v),$._zod.check=(g)=>{let _=v.schema._zod.run({value:g.value[v.property],issues:[]},{});if(_ instanceof Promise)return _.then((U)=>h5(U,g,v.property));h5(_,g,v.property);return}}),LJ=F("$ZodCheckMimeType",($,v)=>{N$.init($,v);let g=new Set(v.mime);$._zod.onattach.push((_)=>{_._zod.bag.mime=v.mime}),$._zod.check=(_)=>{if(g.has(_.value.type))return;_.issues.push({code:"invalid_value",values:v.mime,input:_.value.type,inst:$,continue:!v.abort})}}),IJ=F("$ZodCheckOverwrite",($,v)=>{N$.init($,v),$._zod.check=(g)=>{g.value=v.tx(g.value)}});class k1{constructor($=[]){if(this.content=[],this.indent=0,this)this.args=$}indented($){this.indent+=1,$(this),this.indent-=1}write($){if(typeof $==="function"){$(this,{execution:"sync"}),$(this,{execution:"async"});return}let g=$.split(`
109
109
  `).filter((z)=>z),_=Math.min(...g.map((z)=>z.length-z.trimStart().length)),U=g.map((z)=>z.slice(_)).map((z)=>" ".repeat(this.indent*2)+z);for(let z of U)this.content.push(z)}compile(){let $=Function,v=this?.args,_=[...(this?.content??[""]).map((U)=>` ${U}`)];return new $(...v,_.join(`
110
- `))}}var BJ={major:4,minor:3,patch:6};var $$=w("$ZodType",($,v)=>{var g;$??($={}),$._zod.def=v,$._zod.bag=$._zod.bag||{},$._zod.version=BJ;let _=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))_.unshift($);for(let U of _)for(let z of U._zod.onattach)z($);if(_.length===0)(g=$._zod).deferred??(g.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(J,b,O)=>{let K=D6(J),W;for(let B of b){if(B._zod.def.when){if(!B._zod.def.when(J))continue}else if(K)continue;let k=J.issues.length,P=B._zod.check(J);if(P instanceof Promise&&O?.async===!1)throw new ov;if(W||P instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await P,J.issues.length===k)return;if(!K)K=D6(J,k)});else{if(J.issues.length===k)continue;if(!K)K=D6(J,k)}}if(W)return W.then(()=>{return J});return J},z=(J,b,O)=>{if(D6(J))return J.aborted=!0,J;let K=U(b,_,O);if(K instanceof Promise){if(O.async===!1)throw new ov;return K.then((W)=>$._zod.parse(W,O))}return $._zod.parse(K,O)};$._zod.run=(J,b)=>{if(b.skipChecks)return $._zod.parse(J,b);if(b.direction==="backward"){let K=$._zod.parse({value:J.value,issues:[]},{...b,skipChecks:!0});if(K instanceof Promise)return K.then((W)=>{return z(W,J,b)});return z(K,J,b)}let O=$._zod.parse(J,b);if(O instanceof Promise){if(b.async===!1)throw new ov;return O.then((K)=>U(K,_,b))}return U(O,_,b)}}z$($,"~standard",()=>({validate:(U)=>{try{let z=E4($,U);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return eU($,U).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),J4=w("$ZodString",($,v)=>{$$.init($,v),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??cz($._zod.bag),$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=String(g.value)}catch(U){}if(typeof g.value==="string")return g;return g.issues.push({expected:"string",code:"invalid_type",input:g.value,inst:$}),g}}),Z$=w("$ZodStringFormat",($,v)=>{l4.init($,v),J4.init($,v)}),kJ=w("$ZodGUID",($,v)=>{v.pattern??(v.pattern=Sz),Z$.init($,v)}),HJ=w("$ZodUUID",($,v)=>{if(v.version){let _={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[v.version];if(_===void 0)throw Error(`Invalid UUID version: "${v.version}"`);v.pattern??(v.pattern=z4(_))}else v.pattern??(v.pattern=z4());Z$.init($,v)}),IJ=w("$ZodEmail",($,v)=>{v.pattern??(v.pattern=Nz),Z$.init($,v)}),YJ=w("$ZodURL",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{try{let _=g.value.trim(),U=new URL(_);if(v.hostname){if(v.hostname.lastIndex=0,!v.hostname.test(U.hostname))g.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:v.hostname.source,input:g.value,inst:$,continue:!v.abort})}if(v.protocol){if(v.protocol.lastIndex=0,!v.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))g.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:v.protocol.source,input:g.value,inst:$,continue:!v.abort})}if(v.normalize)g.value=U.href;else g.value=_;return}catch(_){g.issues.push({code:"invalid_format",format:"url",input:g.value,inst:$,continue:!v.abort})}}}),LJ=w("$ZodEmoji",($,v)=>{v.pattern??(v.pattern=rz()),Z$.init($,v)}),qJ=w("$ZodNanoID",($,v)=>{v.pattern??(v.pattern=Mz),Z$.init($,v)}),XJ=w("$ZodCUID",($,v)=>{v.pattern??(v.pattern=Xz),Z$.init($,v)}),wJ=w("$ZodCUID2",($,v)=>{v.pattern??(v.pattern=wz),Z$.init($,v)}),FJ=w("$ZodULID",($,v)=>{v.pattern??(v.pattern=Fz),Z$.init($,v)}),AJ=w("$ZodXID",($,v)=>{v.pattern??(v.pattern=Az),Z$.init($,v)}),ZJ=w("$ZodKSUID",($,v)=>{v.pattern??(v.pattern=Zz),Z$.init($,v)}),MJ=w("$ZodISODateTime",($,v)=>{v.pattern??(v.pattern=mz(v)),Z$.init($,v)}),QJ=w("$ZodISODate",($,v)=>{v.pattern??(v.pattern=Cz),Z$.init($,v)}),SJ=w("$ZodISOTime",($,v)=>{v.pattern??(v.pattern=fz(v)),Z$.init($,v)}),NJ=w("$ZodISODuration",($,v)=>{v.pattern??(v.pattern=Qz),Z$.init($,v)}),rJ=w("$ZodIPv4",($,v)=>{v.pattern??(v.pattern=uz),Z$.init($,v),$._zod.bag.format="ipv4"}),uJ=w("$ZodIPv6",($,v)=>{v.pattern??(v.pattern=yz),Z$.init($,v),$._zod.bag.format="ipv6",$._zod.check=(g)=>{try{new URL(`http://[${g.value}]`)}catch{g.issues.push({code:"invalid_format",format:"ipv6",input:g.value,inst:$,continue:!v.abort})}}}),yJ=w("$ZodMAC",($,v)=>{v.pattern??(v.pattern=Dz(v.delimiter)),Z$.init($,v),$._zod.bag.format="mac"}),DJ=w("$ZodCIDRv4",($,v)=>{v.pattern??(v.pattern=Rz),Z$.init($,v)}),RJ=w("$ZodCIDRv6",($,v)=>{v.pattern??(v.pattern=Tz),Z$.init($,v),$._zod.check=(g)=>{let _=g.value.split("/");try{if(_.length!==2)throw Error();let[U,z]=_;if(!z)throw Error();let J=Number(z);if(`${J}`!==z)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${U}]`)}catch{g.issues.push({code:"invalid_format",format:"cidrv6",input:g.value,inst:$,continue:!v.abort})}}});function TJ($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var jJ=w("$ZodBase64",($,v)=>{v.pattern??(v.pattern=jz),Z$.init($,v),$._zod.bag.contentEncoding="base64",$._zod.check=(g)=>{if(TJ(g.value))return;g.issues.push({code:"invalid_format",format:"base64",input:g.value,inst:$,continue:!v.abort})}});function a5($){if(!G1.test($))return!1;let v=$.replace(/[-_]/g,(_)=>_==="-"?"+":"/"),g=v.padEnd(Math.ceil(v.length/4)*4,"=");return TJ(g)}var VJ=w("$ZodBase64URL",($,v)=>{v.pattern??(v.pattern=G1),Z$.init($,v),$._zod.bag.contentEncoding="base64url",$._zod.check=(g)=>{if(a5(g.value))return;g.issues.push({code:"invalid_format",format:"base64url",input:g.value,inst:$,continue:!v.abort})}}),CJ=w("$ZodE164",($,v)=>{v.pattern??(v.pattern=Vz),Z$.init($,v)});function s5($,v=null){try{let g=$.split(".");if(g.length!==3)return!1;let[_]=g;if(!_)return!1;let U=JSON.parse(atob(_));if("typ"in U&&U?.typ!=="JWT")return!1;if(!U.alg)return!1;if(v&&(!("alg"in U)||U.alg!==v))return!1;return!0}catch{return!1}}var fJ=w("$ZodJWT",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{if(s5(g.value,v.alg))return;g.issues.push({code:"invalid_format",format:"jwt",input:g.value,inst:$,continue:!v.abort})}}),mJ=w("$ZodCustomStringFormat",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{if(v.fn(g.value))return;g.issues.push({code:"invalid_format",format:v.format,input:g.value,inst:$,continue:!v.abort})}}),Y1=w("$ZodNumber",($,v)=>{$$.init($,v),$._zod.pattern=$._zod.bag.pattern??$g,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=Number(g.value)}catch(J){}let U=g.value;if(typeof U==="number"&&!Number.isNaN(U)&&Number.isFinite(U))return g;let z=typeof U==="number"?Number.isNaN(U)?"NaN":!Number.isFinite(U)?"Infinity":void 0:void 0;return g.issues.push({expected:"number",code:"invalid_type",input:U,inst:$,...z?{received:z}:{}}),g}}),cJ=w("$ZodNumberFormat",($,v)=>{tz.init($,v),Y1.init($,v)}),gg=w("$ZodBoolean",($,v)=>{$$.init($,v),$._zod.pattern=lz,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=Boolean(g.value)}catch(z){}let U=g.value;if(typeof U==="boolean")return g;return g.issues.push({expected:"boolean",code:"invalid_type",input:U,inst:$}),g}}),L1=w("$ZodBigInt",($,v)=>{$$.init($,v),$._zod.pattern=Ez,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=BigInt(g.value)}catch(U){}if(typeof g.value==="bigint")return g;return g.issues.push({expected:"bigint",code:"invalid_type",input:g.value,inst:$}),g}}),EJ=w("$ZodBigIntFormat",($,v)=>{dz.init($,v),L1.init($,v)}),iJ=w("$ZodSymbol",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(typeof U==="symbol")return g;return g.issues.push({expected:"symbol",code:"invalid_type",input:U,inst:$}),g}}),lJ=w("$ZodUndefined",($,v)=>{$$.init($,v),$._zod.pattern=hz,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(g,_)=>{let U=g.value;if(typeof U>"u")return g;return g.issues.push({expected:"undefined",code:"invalid_type",input:U,inst:$}),g}}),xJ=w("$ZodNull",($,v)=>{$$.init($,v),$._zod.pattern=xz,$._zod.values=new Set([null]),$._zod.parse=(g,_)=>{let U=g.value;if(U===null)return g;return g.issues.push({expected:"null",code:"invalid_type",input:U,inst:$}),g}}),hJ=w("$ZodAny",($,v)=>{$$.init($,v),$._zod.parse=(g)=>g}),pJ=w("$ZodUnknown",($,v)=>{$$.init($,v),$._zod.parse=(g)=>g}),oJ=w("$ZodNever",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{return g.issues.push({expected:"never",code:"invalid_type",input:g.value,inst:$}),g}}),nJ=w("$ZodVoid",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(typeof U>"u")return g;return g.issues.push({expected:"void",code:"invalid_type",input:U,inst:$}),g}}),tJ=w("$ZodDate",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=new Date(g.value)}catch(b){}let U=g.value,z=U instanceof Date;if(z&&!Number.isNaN(U.getTime()))return g;return g.issues.push({expected:"date",code:"invalid_type",input:U,...z?{received:"Invalid Date"}:{},inst:$}),g}});function c5($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues));v.value[g]=$.value}var dJ=w("$ZodArray",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!Array.isArray(U))return g.issues.push({expected:"array",code:"invalid_type",input:U,inst:$}),g;g.value=Array(U.length);let z=[];for(let J=0;J<U.length;J++){let b=U[J],O=v.element._zod.run({value:b,issues:[]},_);if(O instanceof Promise)z.push(O.then((K)=>c5(K,g,J)));else c5(O,g,J)}if(z.length)return Promise.all(z).then(()=>g);return g}});function I1($,v,g,_,U){if($.issues.length){if(U&&!(g in _))return;v.issues.push(...Sv(g,$.issues))}if($.value===void 0){if(g in _)v.value[g]=void 0}else v.value[g]=$.value}function e5($){let v=Object.keys($.shape);for(let _ of v)if(!$.shape?.[_]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${_}": expected a Zod schema`);let g=Hz($.shape);return{...$,keys:v,keySet:new Set(v),numKeys:v.length,optionalKeys:new Set(g)}}function $7($,v,g,_,U,z){let J=[],b=U.keySet,O=U.catchall._zod,K=O.def.type,W=O.optout==="optional";for(let B in v){if(b.has(B))continue;if(K==="never"){J.push(B);continue}let k=O.run({value:v[B],issues:[]},_);if(k instanceof Promise)$.push(k.then((P)=>I1(P,g,B,v,W)));else I1(k,g,B,v,W)}if(J.length)g.issues.push({code:"unrecognized_keys",keys:J,input:v,inst:z});if(!$.length)return g;return Promise.all($).then(()=>{return g})}var v7=w("$ZodObject",($,v)=>{if($$.init($,v),!Object.getOwnPropertyDescriptor(v,"shape")?.get){let b=v.shape;Object.defineProperty(v,"shape",{get:()=>{let O={...b};return Object.defineProperty(v,"shape",{value:O}),O}})}let _=V4(()=>e5(v));z$($._zod,"propValues",()=>{let b=v.shape,O={};for(let K in b){let W=b[K]._zod;if(W.values){O[K]??(O[K]=new Set);for(let B of W.values)O[K].add(B)}}return O});let U=_4,z=v.catchall,J;$._zod.parse=(b,O)=>{J??(J=_.value);let K=b.value;if(!U(K))return b.issues.push({expected:"object",code:"invalid_type",input:K,inst:$}),b;b.value={};let W=[],B=J.shape;for(let k of J.keys){let P=B[k],X=P._zod.optout==="optional",Y=P._zod.run({value:K[k],issues:[]},O);if(Y instanceof Promise)W.push(Y.then((H)=>I1(H,b,k,K,X)));else I1(Y,b,k,K,X)}if(!z)return W.length?Promise.all(W).then(()=>b):b;return $7(W,K,b,O,_.value,$)}}),aJ=w("$ZodObjectJIT",($,v)=>{v7.init($,v);let g=$._zod.parse,_=V4(()=>e5(v)),U=(k)=>{let P=new W1(["shape","payload","ctx"]),X=_.value,Y=(F)=>{let N=s_(F);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};P.write("const input = payload.value;");let H=Object.create(null),L=0;for(let F of X.keys)H[F]=`key_${L++}`;P.write("const newResult = {};");for(let F of X.keys){let N=H[F],C=s_(F),r=k[F]?._zod?.optout==="optional";if(P.write(`const ${N} = ${Y(F)};`),r)P.write(`
111
- if (${N}.issues.length) {
110
+ `))}}var qJ={major:4,minor:3,patch:6};var $$=F("$ZodType",($,v)=>{var g;$??($={}),$._zod.def=v,$._zod.bag=$._zod.bag||{},$._zod.version=qJ;let _=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))_.unshift($);for(let U of _)for(let z of U._zod.onattach)z($);if(_.length===0)(g=$._zod).deferred??(g.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(J,G,K)=>{let O=u6(J),W;for(let B of G){if(B._zod.def.when){if(!B._zod.def.when(J))continue}else if(O)continue;let k=J.issues.length,P=B._zod.check(J);if(P instanceof Promise&&K?.async===!1)throw new ov;if(W||P instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await P,J.issues.length===k)return;if(!O)O=u6(J,k)});else{if(J.issues.length===k)continue;if(!O)O=u6(J,k)}}if(W)return W.then(()=>{return J});return J},z=(J,G,K)=>{if(u6(J))return J.aborted=!0,J;let O=U(G,_,K);if(O instanceof Promise){if(K.async===!1)throw new ov;return O.then((W)=>$._zod.parse(W,K))}return $._zod.parse(O,K)};$._zod.run=(J,G)=>{if(G.skipChecks)return $._zod.parse(J,G);if(G.direction==="backward"){let O=$._zod.parse({value:J.value,issues:[]},{...G,skipChecks:!0});if(O instanceof Promise)return O.then((W)=>{return z(W,J,G)});return z(O,J,G)}let K=$._zod.parse(J,G);if(K instanceof Promise){if(G.async===!1)throw new ov;return K.then((O)=>U(O,_,G))}return U(K,_,G)}}J$($,"~standard",()=>({validate:(U)=>{try{let z=x4($,U);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return Ug($,U).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),b4=F("$ZodString",($,v)=>{$$.init($,v),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??oz($._zod.bag),$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=String(g.value)}catch(U){}if(typeof g.value==="string")return g;return g.issues.push({expected:"string",code:"invalid_type",input:g.value,inst:$}),g}}),Z$=F("$ZodStringFormat",($,v)=>{l4.init($,v),b4.init($,v)}),FJ=F("$ZodGUID",($,v)=>{v.pattern??(v.pattern=jz),Z$.init($,v)}),wJ=F("$ZodUUID",($,v)=>{if(v.version){let _={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[v.version];if(_===void 0)throw Error(`Invalid UUID version: "${v.version}"`);v.pattern??(v.pattern=G4(_))}else v.pattern??(v.pattern=G4());Z$.init($,v)}),AJ=F("$ZodEmail",($,v)=>{v.pattern??(v.pattern=rz),Z$.init($,v)}),ZJ=F("$ZodURL",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{try{let _=g.value.trim(),U=new URL(_);if(v.hostname){if(v.hostname.lastIndex=0,!v.hostname.test(U.hostname))g.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:v.hostname.source,input:g.value,inst:$,continue:!v.abort})}if(v.protocol){if(v.protocol.lastIndex=0,!v.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))g.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:v.protocol.source,input:g.value,inst:$,continue:!v.abort})}if(v.normalize)g.value=U.href;else g.value=_;return}catch(_){g.issues.push({code:"invalid_format",format:"url",input:g.value,inst:$,continue:!v.abort})}}}),QJ=F("$ZodEmoji",($,v)=>{v.pattern??(v.pattern=Vz()),Z$.init($,v)}),MJ=F("$ZodNanoID",($,v)=>{v.pattern??(v.pattern=uz),Z$.init($,v)}),SJ=F("$ZodCUID",($,v)=>{v.pattern??(v.pattern=Sz),Z$.init($,v)}),NJ=F("$ZodCUID2",($,v)=>{v.pattern??(v.pattern=Nz),Z$.init($,v)}),yJ=F("$ZodULID",($,v)=>{v.pattern??(v.pattern=yz),Z$.init($,v)}),DJ=F("$ZodXID",($,v)=>{v.pattern??(v.pattern=Dz),Z$.init($,v)}),RJ=F("$ZodKSUID",($,v)=>{v.pattern??(v.pattern=Rz),Z$.init($,v)}),uJ=F("$ZodISODateTime",($,v)=>{v.pattern??(v.pattern=pz(v)),Z$.init($,v)}),TJ=F("$ZodISODate",($,v)=>{v.pattern??(v.pattern=hz),Z$.init($,v)}),jJ=F("$ZodISOTime",($,v)=>{v.pattern??(v.pattern=lz(v)),Z$.init($,v)}),rJ=F("$ZodISODuration",($,v)=>{v.pattern??(v.pattern=Tz),Z$.init($,v)}),VJ=F("$ZodIPv4",($,v)=>{v.pattern??(v.pattern=Cz),Z$.init($,v),$._zod.bag.format="ipv4"}),CJ=F("$ZodIPv6",($,v)=>{v.pattern??(v.pattern=fz),Z$.init($,v),$._zod.bag.format="ipv6",$._zod.check=(g)=>{try{new URL(`http://[${g.value}]`)}catch{g.issues.push({code:"invalid_format",format:"ipv6",input:g.value,inst:$,continue:!v.abort})}}}),fJ=F("$ZodMAC",($,v)=>{v.pattern??(v.pattern=Ez(v.delimiter)),Z$.init($,v),$._zod.bag.format="mac"}),EJ=F("$ZodCIDRv4",($,v)=>{v.pattern??(v.pattern=mz),Z$.init($,v)}),mJ=F("$ZodCIDRv6",($,v)=>{v.pattern??(v.pattern=cz),Z$.init($,v),$._zod.check=(g)=>{let _=g.value.split("/");try{if(_.length!==2)throw Error();let[U,z]=_;if(!z)throw Error();let J=Number(z);if(`${J}`!==z)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${U}]`)}catch{g.issues.push({code:"invalid_format",format:"cidrv6",input:g.value,inst:$,continue:!v.abort})}}});function cJ($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var iJ=F("$ZodBase64",($,v)=>{v.pattern??(v.pattern=iz),Z$.init($,v),$._zod.bag.contentEncoding="base64",$._zod.check=(g)=>{if(cJ(g.value))return;g.issues.push({code:"invalid_format",format:"base64",input:g.value,inst:$,continue:!v.abort})}});function _7($){if(!W1.test($))return!1;let v=$.replace(/[-_]/g,(_)=>_==="-"?"+":"/"),g=v.padEnd(Math.ceil(v.length/4)*4,"=");return cJ(g)}var xJ=F("$ZodBase64URL",($,v)=>{v.pattern??(v.pattern=W1),Z$.init($,v),$._zod.bag.contentEncoding="base64url",$._zod.check=(g)=>{if(_7(g.value))return;g.issues.push({code:"invalid_format",format:"base64url",input:g.value,inst:$,continue:!v.abort})}}),hJ=F("$ZodE164",($,v)=>{v.pattern??(v.pattern=xz),Z$.init($,v)});function z7($,v=null){try{let g=$.split(".");if(g.length!==3)return!1;let[_]=g;if(!_)return!1;let U=JSON.parse(atob(_));if("typ"in U&&U?.typ!=="JWT")return!1;if(!U.alg)return!1;if(v&&(!("alg"in U)||U.alg!==v))return!1;return!0}catch{return!1}}var lJ=F("$ZodJWT",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{if(z7(g.value,v.alg))return;g.issues.push({code:"invalid_format",format:"jwt",input:g.value,inst:$,continue:!v.abort})}}),pJ=F("$ZodCustomStringFormat",($,v)=>{Z$.init($,v),$._zod.check=(g)=>{if(v.fn(g.value))return;g.issues.push({code:"invalid_format",format:v.format,input:g.value,inst:$,continue:!v.abort})}}),X1=F("$ZodNumber",($,v)=>{$$.init($,v),$._zod.pattern=$._zod.bag.pattern??gg,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=Number(g.value)}catch(J){}let U=g.value;if(typeof U==="number"&&!Number.isNaN(U)&&Number.isFinite(U))return g;let z=typeof U==="number"?Number.isNaN(U)?"NaN":!Number.isFinite(U)?"Infinity":void 0:void 0;return g.issues.push({expected:"number",code:"invalid_type",input:U,inst:$,...z?{received:z}:{}}),g}}),oJ=F("$ZodNumberFormat",($,v)=>{UJ.init($,v),X1.init($,v)}),Jg=F("$ZodBoolean",($,v)=>{$$.init($,v),$._zod.pattern=dz,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=Boolean(g.value)}catch(z){}let U=g.value;if(typeof U==="boolean")return g;return g.issues.push({expected:"boolean",code:"invalid_type",input:U,inst:$}),g}}),F1=F("$ZodBigInt",($,v)=>{$$.init($,v),$._zod.pattern=nz,$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=BigInt(g.value)}catch(U){}if(typeof g.value==="bigint")return g;return g.issues.push({expected:"bigint",code:"invalid_type",input:g.value,inst:$}),g}}),nJ=F("$ZodBigIntFormat",($,v)=>{gJ.init($,v),F1.init($,v)}),tJ=F("$ZodSymbol",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(typeof U==="symbol")return g;return g.issues.push({expected:"symbol",code:"invalid_type",input:U,inst:$}),g}}),dJ=F("$ZodUndefined",($,v)=>{$$.init($,v),$._zod.pattern=sz,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(g,_)=>{let U=g.value;if(typeof U>"u")return g;return g.issues.push({expected:"undefined",code:"invalid_type",input:U,inst:$}),g}}),aJ=F("$ZodNull",($,v)=>{$$.init($,v),$._zod.pattern=az,$._zod.values=new Set([null]),$._zod.parse=(g,_)=>{let U=g.value;if(U===null)return g;return g.issues.push({expected:"null",code:"invalid_type",input:U,inst:$}),g}}),sJ=F("$ZodAny",($,v)=>{$$.init($,v),$._zod.parse=(g)=>g}),eJ=F("$ZodUnknown",($,v)=>{$$.init($,v),$._zod.parse=(g)=>g}),$8=F("$ZodNever",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{return g.issues.push({expected:"never",code:"invalid_type",input:g.value,inst:$}),g}}),v8=F("$ZodVoid",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(typeof U>"u")return g;return g.issues.push({expected:"void",code:"invalid_type",input:U,inst:$}),g}}),U8=F("$ZodDate",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(v.coerce)try{g.value=new Date(g.value)}catch(G){}let U=g.value,z=U instanceof Date;if(z&&!Number.isNaN(U.getTime()))return g;return g.issues.push({expected:"date",code:"invalid_type",input:U,...z?{received:"Invalid Date"}:{},inst:$}),g}});function o5($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues));v.value[g]=$.value}var g8=F("$ZodArray",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!Array.isArray(U))return g.issues.push({expected:"array",code:"invalid_type",input:U,inst:$}),g;g.value=Array(U.length);let z=[];for(let J=0;J<U.length;J++){let G=U[J],K=v.element._zod.run({value:G,issues:[]},_);if(K instanceof Promise)z.push(K.then((O)=>o5(O,g,J)));else o5(K,g,J)}if(z.length)return Promise.all(z).then(()=>g);return g}});function q1($,v,g,_,U){if($.issues.length){if(U&&!(g in _))return;v.issues.push(...Sv(g,$.issues))}if($.value===void 0){if(g in _)v.value[g]=void 0}else v.value[g]=$.value}function J7($){let v=Object.keys($.shape);for(let _ of v)if(!$.shape?.[_]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${_}": expected a Zod schema`);let g=wz($.shape);return{...$,keys:v,keySet:new Set(v),numKeys:v.length,optionalKeys:new Set(g)}}function G7($,v,g,_,U,z){let J=[],G=U.keySet,K=U.catchall._zod,O=K.def.type,W=K.optout==="optional";for(let B in v){if(G.has(B))continue;if(O==="never"){J.push(B);continue}let k=K.run({value:v[B],issues:[]},_);if(k instanceof Promise)$.push(k.then((P)=>q1(P,g,B,v,W)));else q1(k,g,B,v,W)}if(J.length)g.issues.push({code:"unrecognized_keys",keys:J,input:v,inst:z});if(!$.length)return g;return Promise.all($).then(()=>{return g})}var b7=F("$ZodObject",($,v)=>{if($$.init($,v),!Object.getOwnPropertyDescriptor(v,"shape")?.get){let G=v.shape;Object.defineProperty(v,"shape",{get:()=>{let K={...G};return Object.defineProperty(v,"shape",{value:K}),K}})}let _=f4(()=>J7(v));J$($._zod,"propValues",()=>{let G=v.shape,K={};for(let O in G){let W=G[O]._zod;if(W.values){K[O]??(K[O]=new Set);for(let B of W.values)K[O].add(B)}}return K});let U=J4,z=v.catchall,J;$._zod.parse=(G,K)=>{J??(J=_.value);let O=G.value;if(!U(O))return G.issues.push({expected:"object",code:"invalid_type",input:O,inst:$}),G;G.value={};let W=[],B=J.shape;for(let k of J.keys){let P=B[k],X=P._zod.optout==="optional",L=P._zod.run({value:O[k],issues:[]},K);if(L instanceof Promise)W.push(L.then((Y)=>q1(Y,G,k,O,X)));else q1(L,G,k,O,X)}if(!z)return W.length?Promise.all(W).then(()=>G):G;return G7(W,O,G,K,_.value,$)}}),_8=F("$ZodObjectJIT",($,v)=>{b7.init($,v);let g=$._zod.parse,_=f4(()=>J7(v)),U=(k)=>{let P=new k1(["shape","payload","ctx"]),X=_.value,L=(w)=>{let S=v1(w);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};P.write("const input = payload.value;");let Y=Object.create(null),I=0;for(let w of X.keys)Y[w]=`key_${I++}`;P.write("const newResult = {};");for(let w of X.keys){let S=Y[w],C=v1(w),y=k[w]?._zod?.optout==="optional";if(P.write(`const ${S} = ${L(w)};`),y)P.write(`
111
+ if (${S}.issues.length) {
112
112
  if (${C} in input) {
113
- payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
113
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
114
114
  ...iss,
115
115
  path: iss.path ? [${C}, ...iss.path] : [${C}]
116
116
  })));
117
117
  }
118
118
  }
119
119
 
120
- if (${N}.value === undefined) {
120
+ if (${S}.value === undefined) {
121
121
  if (${C} in input) {
122
122
  newResult[${C}] = undefined;
123
123
  }
124
124
  } else {
125
- newResult[${C}] = ${N}.value;
125
+ newResult[${C}] = ${S}.value;
126
126
  }
127
127
 
128
128
  `);else P.write(`
129
- if (${N}.issues.length) {
130
- payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
129
+ if (${S}.issues.length) {
130
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
131
131
  ...iss,
132
132
  path: iss.path ? [${C}, ...iss.path] : [${C}]
133
133
  })));
134
134
  }
135
135
 
136
- if (${N}.value === undefined) {
136
+ if (${S}.value === undefined) {
137
137
  if (${C} in input) {
138
138
  newResult[${C}] = undefined;
139
139
  }
140
140
  } else {
141
- newResult[${C}] = ${N}.value;
141
+ newResult[${C}] = ${S}.value;
142
142
  }
143
143
 
144
- `)}P.write("payload.value = newResult;"),P.write("return payload;");let q=P.compile();return(F,N)=>q(k,F,N)},z,J=_4,b=!EU.jitless,K=b&&Bz.value,W=v.catchall,B;$._zod.parse=(k,P)=>{B??(B=_.value);let X=k.value;if(!J(X))return k.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),k;if(b&&K&&P?.async===!1&&P.jitless!==!0){if(!z)z=U(v.shape);if(k=z(k,P),!W)return k;return $7([],X,k,P,B,$)}return g(k,P)}});function E5($,v,g,_){for(let z of $)if(z.issues.length===0)return v.value=z.value,v;let U=$.filter((z)=>!D6(z));if(U.length===1)return v.value=U[0].value,U[0];return v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:$.map((z)=>z.issues.map((J)=>Xv(J,_,l$())))}),v}var _g=w("$ZodUnion",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),z$($._zod,"optout",()=>v.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),z$($._zod,"values",()=>{if(v.options.every((U)=>U._zod.values))return new Set(v.options.flatMap((U)=>Array.from(U._zod.values)));return}),z$($._zod,"pattern",()=>{if(v.options.every((U)=>U._zod.pattern)){let U=v.options.map((z)=>z._zod.pattern);return new RegExp(`^(${U.map((z)=>xU(z.source)).join("|")})$`)}return});let g=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(U,z)=>{if(g)return _(U,z);let J=!1,b=[];for(let O of v.options){let K=O._zod.run({value:U.value,issues:[]},z);if(K instanceof Promise)b.push(K),J=!0;else{if(K.issues.length===0)return K;b.push(K)}}if(!J)return E5(b,U,$,z);return Promise.all(b).then((O)=>{return E5(O,U,$,z)})}});function i5($,v,g,_){let U=$.filter((z)=>z.issues.length===0);if(U.length===1)return v.value=U[0].value,v;if(U.length===0)v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:$.map((z)=>z.issues.map((J)=>Xv(J,_,l$())))});else v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:[],inclusive:!1});return v}var sJ=w("$ZodXor",($,v)=>{_g.init($,v),v.inclusive=!1;let g=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(U,z)=>{if(g)return _(U,z);let J=!1,b=[];for(let O of v.options){let K=O._zod.run({value:U.value,issues:[]},z);if(K instanceof Promise)b.push(K),J=!0;else b.push(K)}if(!J)return i5(b,U,$,z);return Promise.all(b).then((O)=>{return i5(O,U,$,z)})}}),eJ=w("$ZodDiscriminatedUnion",($,v)=>{v.inclusive=!1,_g.init($,v);let g=$._zod.parse;z$($._zod,"propValues",()=>{let U={};for(let z of v.options){let J=z._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(z)}"`);for(let[b,O]of Object.entries(J)){if(!U[b])U[b]=new Set;for(let K of O)U[b].add(K)}}return U});let _=V4(()=>{let U=v.options,z=new Map;for(let J of U){let b=J._zod.propValues?.[v.discriminator];if(!b||b.size===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(J)}"`);for(let O of b){if(z.has(O))throw Error(`Duplicate discriminator value "${String(O)}"`);z.set(O,J)}}return z});$._zod.parse=(U,z)=>{let J=U.value;if(!_4(J))return U.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),U;let b=_.value.get(J?.[v.discriminator]);if(b)return b._zod.run(U,z);if(v.unionFallback)return g(U,z);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:v.discriminator,input:J,path:[v.discriminator],inst:$}),U}}),$8=w("$ZodIntersection",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value,z=v.left._zod.run({value:U,issues:[]},_),J=v.right._zod.run({value:U,issues:[]},_);if(z instanceof Promise||J instanceof Promise)return Promise.all([z,J]).then(([O,K])=>{return l5(g,O,K)});return l5(g,z,J)}});function PJ($,v){if($===v)return{valid:!0,data:$};if($ instanceof Date&&v instanceof Date&&+$===+v)return{valid:!0,data:$};if(y6($)&&y6(v)){let g=Object.keys(v),_=Object.keys($).filter((z)=>g.indexOf(z)!==-1),U={...$,...v};for(let z of _){let J=PJ($[z],v[z]);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};U[z]=J.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(v)){if($.length!==v.length)return{valid:!1,mergeErrorPath:[]};let g=[];for(let _=0;_<$.length;_++){let U=$[_],z=v[_],J=PJ(U,z);if(!J.valid)return{valid:!1,mergeErrorPath:[_,...J.mergeErrorPath]};g.push(J.data)}return{valid:!0,data:g}}return{valid:!1,mergeErrorPath:[]}}function l5($,v,g){let _=new Map,U;for(let b of v.issues)if(b.code==="unrecognized_keys"){U??(U=b);for(let O of b.keys){if(!_.has(O))_.set(O,{});_.get(O).l=!0}}else $.issues.push(b);for(let b of g.issues)if(b.code==="unrecognized_keys")for(let O of b.keys){if(!_.has(O))_.set(O,{});_.get(O).r=!0}else $.issues.push(b);let z=[..._].filter(([,b])=>b.l&&b.r).map(([b])=>b);if(z.length&&U)$.issues.push({...U,keys:z});if(D6($))return $;let J=PJ(v.value,g.value);if(!J.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var q1=w("$ZodTuple",($,v)=>{$$.init($,v);let g=v.items;$._zod.parse=(_,U)=>{let z=_.value;if(!Array.isArray(z))return _.issues.push({input:z,inst:$,expected:"tuple",code:"invalid_type"}),_;_.value=[];let J=[],b=[...g].reverse().findIndex((W)=>W._zod.optin!=="optional"),O=b===-1?0:g.length-b;if(!v.rest){let W=z.length>g.length,B=z.length<O-1;if(W||B)return _.issues.push({...W?{code:"too_big",maximum:g.length,inclusive:!0}:{code:"too_small",minimum:g.length},input:z,inst:$,origin:"array"}),_}let K=-1;for(let W of g){if(K++,K>=z.length){if(K>=O)continue}let B=W._zod.run({value:z[K],issues:[]},U);if(B instanceof Promise)J.push(B.then((k)=>B1(k,_,K)));else B1(B,_,K)}if(v.rest){let W=z.slice(g.length);for(let B of W){K++;let k=v.rest._zod.run({value:B,issues:[]},U);if(k instanceof Promise)J.push(k.then((P)=>B1(P,_,K)));else B1(k,_,K)}}if(J.length)return Promise.all(J).then(()=>_);return _}});function B1($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues));v.value[g]=$.value}var v8=w("$ZodRecord",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!y6(U))return g.issues.push({expected:"record",code:"invalid_type",input:U,inst:$}),g;let z=[],J=v.keyType._zod.values;if(J){g.value={};let b=new Set;for(let K of J)if(typeof K==="string"||typeof K==="number"||typeof K==="symbol"){b.add(typeof K==="number"?K.toString():K);let W=v.valueType._zod.run({value:U[K],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)g.issues.push(...Sv(K,B.issues));g.value[K]=B.value}));else{if(W.issues.length)g.issues.push(...Sv(K,W.issues));g.value[K]=W.value}}let O;for(let K in U)if(!b.has(K))O=O??[],O.push(K);if(O&&O.length>0)g.issues.push({code:"unrecognized_keys",input:U,inst:$,keys:O})}else{g.value={};for(let b of Reflect.ownKeys(U)){if(b==="__proto__")continue;let O=v.keyType._zod.run({value:b,issues:[]},_);if(O instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof b==="string"&&$g.test(b)&&O.issues.length){let B=v.keyType._zod.run({value:Number(b),issues:[]},_);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)O=B}if(O.issues.length){if(v.mode==="loose")g.value[b]=U[b];else g.issues.push({code:"invalid_key",origin:"record",issues:O.issues.map((B)=>Xv(B,_,l$())),input:b,path:[b],inst:$});continue}let W=v.valueType._zod.run({value:U[b],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)g.issues.push(...Sv(b,B.issues));g.value[O.value]=B.value}));else{if(W.issues.length)g.issues.push(...Sv(b,W.issues));g.value[O.value]=W.value}}}if(z.length)return Promise.all(z).then(()=>g);return g}}),U8=w("$ZodMap",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!(U instanceof Map))return g.issues.push({expected:"map",code:"invalid_type",input:U,inst:$}),g;let z=[];g.value=new Map;for(let[J,b]of U){let O=v.keyType._zod.run({value:J,issues:[]},_),K=v.valueType._zod.run({value:b,issues:[]},_);if(O instanceof Promise||K instanceof Promise)z.push(Promise.all([O,K]).then(([W,B])=>{x5(W,B,g,J,U,$,_)}));else x5(O,K,g,J,U,$,_)}if(z.length)return Promise.all(z).then(()=>g);return g}});function x5($,v,g,_,U,z,J){if($.issues.length)if(hU.has(typeof _))g.issues.push(...Sv(_,$.issues));else g.issues.push({code:"invalid_key",origin:"map",input:U,inst:z,issues:$.issues.map((b)=>Xv(b,J,l$()))});if(v.issues.length)if(hU.has(typeof _))g.issues.push(...Sv(_,v.issues));else g.issues.push({origin:"map",code:"invalid_element",input:U,inst:z,key:_,issues:v.issues.map((b)=>Xv(b,J,l$()))});g.value.set($.value,v.value)}var g8=w("$ZodSet",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!(U instanceof Set))return g.issues.push({input:U,inst:$,expected:"set",code:"invalid_type"}),g;let z=[];g.value=new Set;for(let J of U){let b=v.valueType._zod.run({value:J,issues:[]},_);if(b instanceof Promise)z.push(b.then((O)=>h5(O,g)));else h5(b,g)}if(z.length)return Promise.all(z).then(()=>g);return g}});function h5($,v){if($.issues.length)v.issues.push(...$.issues);v.value.add($.value)}var _8=w("$ZodEnum",($,v)=>{$$.init($,v);let g=lU(v.entries),_=new Set(g);$._zod.values=_,$._zod.pattern=new RegExp(`^(${g.filter((U)=>hU.has(typeof U)).map((U)=>typeof U==="string"?yv(U):U.toString()).join("|")})$`),$._zod.parse=(U,z)=>{let J=U.value;if(_.has(J))return U;return U.issues.push({code:"invalid_value",values:g,input:J,inst:$}),U}}),z8=w("$ZodLiteral",($,v)=>{if($$.init($,v),v.values.length===0)throw Error("Cannot create literal schema with no valid values");let g=new Set(v.values);$._zod.values=g,$._zod.pattern=new RegExp(`^(${v.values.map((_)=>typeof _==="string"?yv(_):_?yv(_.toString()):String(_)).join("|")})$`),$._zod.parse=(_,U)=>{let z=_.value;if(g.has(z))return _;return _.issues.push({code:"invalid_value",values:v.values,input:z,inst:$}),_}}),J8=w("$ZodFile",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(U instanceof File)return g;return g.issues.push({expected:"file",code:"invalid_type",input:U,inst:$}),g}}),b8=w("$ZodTransform",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new g4($.constructor.name);let U=v.transform(g.value,g);if(_.async)return(U instanceof Promise?U:Promise.resolve(U)).then((J)=>{return g.value=J,g});if(U instanceof Promise)throw new ov;return g.value=U,g}});function p5($,v){if($.issues.length&&v===void 0)return{issues:[],value:void 0};return $}var X1=w("$ZodOptional",($,v)=>{$$.init($,v),$._zod.optin="optional",$._zod.optout="optional",z$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,void 0]):void 0}),z$($._zod,"pattern",()=>{let g=v.innerType._zod.pattern;return g?new RegExp(`^(${xU(g.source)})?$`):void 0}),$._zod.parse=(g,_)=>{if(v.innerType._zod.optin==="optional"){let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>p5(z,g.value));return p5(U,g.value)}if(g.value===void 0)return g;return v.innerType._zod.run(g,_)}}),G8=w("$ZodExactOptional",($,v)=>{X1.init($,v),z$($._zod,"values",()=>v.innerType._zod.values),z$($._zod,"pattern",()=>v.innerType._zod.pattern),$._zod.parse=(g,_)=>{return v.innerType._zod.run(g,_)}}),O8=w("$ZodNullable",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.innerType._zod.optin),z$($._zod,"optout",()=>v.innerType._zod.optout),z$($._zod,"pattern",()=>{let g=v.innerType._zod.pattern;return g?new RegExp(`^(${xU(g.source)}|null)$`):void 0}),z$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,null]):void 0}),$._zod.parse=(g,_)=>{if(g.value===null)return g;return v.innerType._zod.run(g,_)}}),K8=w("$ZodDefault",($,v)=>{$$.init($,v),$._zod.optin="optional",z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);if(g.value===void 0)return g.value=v.defaultValue,g;let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>o5(z,v));return o5(U,v)}});function o5($,v){if($.value===void 0)$.value=v.defaultValue;return $}var W8=w("$ZodPrefault",($,v)=>{$$.init($,v),$._zod.optin="optional",z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);if(g.value===void 0)g.value=v.defaultValue;return v.innerType._zod.run(g,_)}}),B8=w("$ZodNonOptional",($,v)=>{$$.init($,v),z$($._zod,"values",()=>{let g=v.innerType._zod.values;return g?new Set([...g].filter((_)=>_!==void 0)):void 0}),$._zod.parse=(g,_)=>{let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>n5(z,$));return n5(U,$)}});function n5($,v){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:v});return $}var P8=w("$ZodSuccess",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new g4("ZodSuccess");let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>{return g.value=z.issues.length===0,g});return g.value=U.issues.length===0,g}}),k8=w("$ZodCatch",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.innerType._zod.optin),z$($._zod,"optout",()=>v.innerType._zod.optout),z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>{if(g.value=z.value,z.issues.length)g.value=v.catchValue({...g,error:{issues:z.issues.map((J)=>Xv(J,_,l$()))},input:g.value}),g.issues=[];return g});if(g.value=U.value,U.issues.length)g.value=v.catchValue({...g,error:{issues:U.issues.map((z)=>Xv(z,_,l$()))},input:g.value}),g.issues=[];return g}}),H8=w("$ZodNaN",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(typeof g.value!=="number"||!Number.isNaN(g.value))return g.issues.push({input:g.value,inst:$,expected:"nan",code:"invalid_type"}),g;return g}}),I8=w("$ZodPipe",($,v)=>{$$.init($,v),z$($._zod,"values",()=>v.in._zod.values),z$($._zod,"optin",()=>v.in._zod.optin),z$($._zod,"optout",()=>v.out._zod.optout),z$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(g,_)=>{if(_.direction==="backward"){let z=v.out._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>P1(J,v.in,_));return P1(z,v.in,_)}let U=v.in._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>P1(z,v.out,_));return P1(U,v.out,_)}});function P1($,v,g){if($.issues.length)return $.aborted=!0,$;return v._zod.run({value:$.value,issues:$.issues},g)}var zg=w("$ZodCodec",($,v)=>{$$.init($,v),z$($._zod,"values",()=>v.in._zod.values),z$($._zod,"optin",()=>v.in._zod.optin),z$($._zod,"optout",()=>v.out._zod.optout),z$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(g,_)=>{if((_.direction||"forward")==="forward"){let z=v.in._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>k1(J,v,_));return k1(z,v,_)}else{let z=v.out._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>k1(J,v,_));return k1(z,v,_)}}});function k1($,v,g){if($.issues.length)return $.aborted=!0,$;if((g.direction||"forward")==="forward"){let U=v.transform($.value,$);if(U instanceof Promise)return U.then((z)=>H1($,z,v.out,g));return H1($,U,v.out,g)}else{let U=v.reverseTransform($.value,$);if(U instanceof Promise)return U.then((z)=>H1($,z,v.in,g));return H1($,U,v.in,g)}}function H1($,v,g,_){if($.issues.length)return $.aborted=!0,$;return g._zod.run({value:v,issues:$.issues},_)}var Y8=w("$ZodReadonly",($,v)=>{$$.init($,v),z$($._zod,"propValues",()=>v.innerType._zod.propValues),z$($._zod,"values",()=>v.innerType._zod.values),z$($._zod,"optin",()=>v.innerType?._zod?.optin),z$($._zod,"optout",()=>v.innerType?._zod?.optout),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then(t5);return t5(U)}});function t5($){return $.value=Object.freeze($.value),$}var L8=w("$ZodTemplateLiteral",($,v)=>{$$.init($,v);let g=[];for(let _ of v.parts)if(typeof _==="object"&&_!==null){if(!_._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[..._._zod.traits].shift()}`);let U=_._zod.pattern instanceof RegExp?_._zod.pattern.source:_._zod.pattern;if(!U)throw Error(`Invalid template literal part: ${_._zod.traits}`);let z=U.startsWith("^")?1:0,J=U.endsWith("$")?U.length-1:U.length;g.push(U.slice(z,J))}else if(_===null||kz.has(typeof _))g.push(yv(`${_}`));else throw Error(`Invalid template literal part: ${_}`);$._zod.pattern=new RegExp(`^${g.join("")}$`),$._zod.parse=(_,U)=>{if(typeof _.value!=="string")return _.issues.push({input:_.value,inst:$,expected:"string",code:"invalid_type"}),_;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(_.value))return _.issues.push({input:_.value,inst:$,code:"invalid_format",format:v.format??"template_literal",pattern:$._zod.pattern.source}),_;return _}}),q8=w("$ZodFunction",($,v)=>{return $$.init($,v),$._def=v,$._zod.def=v,$.implement=(g)=>{if(typeof g!=="function")throw Error("implement() must be called with a function");return function(..._){let U=$._def.input?aU($._def.input,_):_,z=Reflect.apply(g,this,U);if($._def.output)return aU($._def.output,z);return z}},$.implementAsync=(g)=>{if(typeof g!=="function")throw Error("implementAsync() must be called with a function");return async function(..._){let U=$._def.input?await sU($._def.input,_):_,z=await Reflect.apply(g,this,U);if($._def.output)return await sU($._def.output,z);return z}},$._zod.parse=(g,_)=>{if(typeof g.value!=="function")return g.issues.push({code:"invalid_type",expected:"function",input:g.value,inst:$}),g;if($._def.output&&$._def.output._zod.def.type==="promise")g.value=$.implementAsync(g.value);else g.value=$.implement(g.value);return g},$.input=(...g)=>{let _=$.constructor;if(Array.isArray(g[0]))return new _({type:"function",input:new q1({type:"tuple",items:g[0],rest:g[1]}),output:$._def.output});return new _({type:"function",input:g[0],output:$._def.output})},$.output=(g)=>{return new $.constructor({type:"function",input:$._def.input,output:g})},$}),X8=w("$ZodPromise",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{return Promise.resolve(g.value).then((U)=>v.innerType._zod.run({value:U,issues:[]},_))}}),w8=w("$ZodLazy",($,v)=>{$$.init($,v),z$($._zod,"innerType",()=>v.getter()),z$($._zod,"pattern",()=>$._zod.innerType?._zod?.pattern),z$($._zod,"propValues",()=>$._zod.innerType?._zod?.propValues),z$($._zod,"optin",()=>$._zod.innerType?._zod?.optin??void 0),z$($._zod,"optout",()=>$._zod.innerType?._zod?.optout??void 0),$._zod.parse=(g,_)=>{return $._zod.innerType._zod.run(g,_)}}),F8=w("$ZodCustom",($,v)=>{S$.init($,v),$$.init($,v),$._zod.parse=(g,_)=>{return g},$._zod.check=(g)=>{let _=g.value,U=v.fn(_);if(U instanceof Promise)return U.then((z)=>d5(z,g,_,$));d5(U,g,_,$);return}});function d5($,v,g,_){if(!$){let U={code:"custom",input:g,inst:_,path:[..._._zod.def.path??[]],continue:!_._zod.def.abort};if(_._zod.def.params)U.params=_._zod.def.params;v.issues.push(C4(U))}}var Kg={};ev(Kg,{zhTW:()=>P9,zhCN:()=>B9,yo:()=>k9,vi:()=>W9,uz:()=>K9,ur:()=>O9,uk:()=>Og,ua:()=>G9,tr:()=>b9,th:()=>J9,ta:()=>z9,sv:()=>_9,sl:()=>g9,ru:()=>U9,pt:()=>v9,ps:()=>e8,pl:()=>$9,ota:()=>s8,no:()=>a8,nl:()=>d8,ms:()=>t8,mk:()=>n8,lt:()=>o8,ko:()=>p8,km:()=>bg,kh:()=>h8,ka:()=>x8,ja:()=>l8,it:()=>i8,is:()=>E8,id:()=>c8,hy:()=>m8,hu:()=>f8,he:()=>C8,frCA:()=>V8,fr:()=>j8,fi:()=>T8,fa:()=>R8,es:()=>D8,eo:()=>y8,en:()=>Jg,de:()=>u8,da:()=>r8,cs:()=>N8,ca:()=>S8,bg:()=>Q8,be:()=>M8,az:()=>Z8,ar:()=>A8});var sI=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function v(U){return $[U]??null}let g={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${U.expected}، ولكن تم إدخال ${b}`;return`مدخلات غير مقبولة: يفترض إدخال ${z}، ولكن تم إدخال ${b}`}case"invalid_value":if(U.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${D(U.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return` أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${z} ${U.maximum.toString()} ${J.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${z} ${U.minimum.toString()} ${J.unit}`;return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${U.prefix}"`;if(z.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${z.suffix}"`;if(z.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${z.includes}"`;if(z.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${z.pattern}`;return`${g[z.format]??U.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${U.divisor}`;case"unrecognized_keys":return`معرف${U.keys.length>1?"ات":""} غريب${U.keys.length>1?"ة":""}: ${A(U.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${U.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${U.origin}`;default:return"مدخل غير مقبول"}}};function A8(){return{localeError:sI()}}var eI=()=>{let $={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function v(U){return $[U]??null}let g={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Yanlış dəyər: gözlənilən instanceof ${U.expected}, daxil olan ${b}`;return`Yanlış dəyər: gözlənilən ${z}, daxil olan ${b}`}case"invalid_value":if(U.values.length===1)return`Yanlış dəyər: gözlənilən ${D(U.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${z}${U.maximum.toString()} ${J.unit??"element"}`;return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Çox kiçik: gözlənilən ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`Çox kiçik: gözlənilən ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Yanlış mətn: "${z.prefix}" ilə başlamalıdır`;if(z.format==="ends_with")return`Yanlış mətn: "${z.suffix}" ilə bitməlidir`;if(z.format==="includes")return`Yanlış mətn: "${z.includes}" daxil olmalıdır`;if(z.format==="regex")return`Yanlış mətn: ${z.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${g[z.format]??U.format}`}case"not_multiple_of":return`Yanlış ədəd: ${U.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${U.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function Z8(){return{localeError:eI()}}function U7($,v,g,_){let U=Math.abs($),z=U%10,J=U%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return g;return _}var $Y=()=>{let $={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function v(U){return $[U]??null}let g={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},_={nan:"NaN",number:"лік",array:"масіў"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Няправільны ўвод: чакаўся instanceof ${U.expected}, атрымана ${b}`;return`Няправільны ўвод: чакаўся ${z}, атрымана ${b}`}case"invalid_value":if(U.values.length===1)return`Няправільны ўвод: чакалася ${D(U.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let b=Number(U.maximum),O=U7(b,J.unit.one,J.unit.few,J.unit.many);return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна ${J.verb} ${z}${U.maximum.toString()} ${O}`}return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна быць ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let b=Number(U.minimum),O=U7(b,J.unit.one,J.unit.few,J.unit.many);return`Занадта малы: чакалася, што ${U.origin} павінна ${J.verb} ${z}${U.minimum.toString()} ${O}`}return`Занадта малы: чакалася, што ${U.origin} павінна быць ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${z.prefix}"`;if(z.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${z.suffix}"`;if(z.format==="includes")return`Няправільны радок: павінен змяшчаць "${z.includes}"`;if(z.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${z.pattern}`;return`Няправільны ${g[z.format]??U.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${U.keys.length>1?"ключы":"ключ"}: ${A(U.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${U.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${U.origin}`;default:return"Няправільны ўвод"}}};function M8(){return{localeError:$Y()}}var vY=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function v(U){return $[U]??null}let g={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},_={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Невалиден вход: очакван instanceof ${U.expected}, получен ${b}`;return`Невалиден вход: очакван ${z}, получен ${b}`}case"invalid_value":if(U.values.length===1)return`Невалиден вход: очакван ${D(U.values[0])}`;return`Невалидна опция: очаквано едно от ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Твърде голямо: очаква се ${U.origin??"стойност"} да съдържа ${z}${U.maximum.toString()} ${J.unit??"елемента"}`;return`Твърде голямо: очаква се ${U.origin??"стойност"} да бъде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Твърде малко: очаква се ${U.origin} да съдържа ${z}${U.minimum.toString()} ${J.unit}`;return`Твърде малко: очаква се ${U.origin} да бъде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Невалиден низ: трябва да започва с "${z.prefix}"`;if(z.format==="ends_with")return`Невалиден низ: трябва да завършва с "${z.suffix}"`;if(z.format==="includes")return`Невалиден низ: трябва да включва "${z.includes}"`;if(z.format==="regex")return`Невалиден низ: трябва да съвпада с ${z.pattern}`;let J="Невалиден";if(z.format==="emoji")J="Невалидно";if(z.format==="datetime")J="Невалидно";if(z.format==="date")J="Невалидна";if(z.format==="time")J="Невалидно";if(z.format==="duration")J="Невалидна";return`${J} ${g[z.format]??U.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${U.divisor}`;case"unrecognized_keys":return`Неразпознат${U.keys.length>1?"и":""} ключ${U.keys.length>1?"ове":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${U.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${U.origin}`;default:return"Невалиден вход"}}};function Q8(){return{localeError:vY()}}var UY=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function v(U){return $[U]??null}let g={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Tipus invàlid: s'esperava instanceof ${U.expected}, s'ha rebut ${b}`;return`Tipus invàlid: s'esperava ${z}, s'ha rebut ${b}`}case"invalid_value":if(U.values.length===1)return`Valor invàlid: s'esperava ${D(U.values[0])}`;return`Opció invàlida: s'esperava una de ${A(U.values," o ")}`;case"too_big":{let z=U.inclusive?"com a màxim":"menys de",J=v(U.origin);if(J)return`Massa gran: s'esperava que ${U.origin??"el valor"} contingués ${z} ${U.maximum.toString()} ${J.unit??"elements"}`;return`Massa gran: s'esperava que ${U.origin??"el valor"} fos ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"com a mínim":"més de",J=v(U.origin);if(J)return`Massa petit: s'esperava que ${U.origin} contingués ${z} ${U.minimum.toString()} ${J.unit}`;return`Massa petit: s'esperava que ${U.origin} fos ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Format invàlid: ha de començar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format invàlid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format invàlid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${z.pattern}`;return`Format invàlid per a ${g[z.format]??U.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${U.divisor}`;case"unrecognized_keys":return`Clau${U.keys.length>1?"s":""} no reconeguda${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${U.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${U.origin}`;default:return"Entrada invàlida"}}};function S8(){return{localeError:UY()}}var gY=()=>{let $={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function v(U){return $[U]??null}let g={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},_={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Neplatný vstup: očekáváno instanceof ${U.expected}, obdrženo ${b}`;return`Neplatný vstup: očekáváno ${z}, obdrženo ${b}`}case"invalid_value":if(U.values.length===1)return`Neplatný vstup: očekáváno ${D(U.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí mít ${z}${U.maximum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí být ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí mít ${z}${U.minimum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí být ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Neplatný řetězec: musí začínat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatný řetězec: musí končit na "${z.suffix}"`;if(z.format==="includes")return`Neplatný řetězec: musí obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${z.pattern}`;return`Neplatný formát ${g[z.format]??U.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${U.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${A(U.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${U.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${U.origin}`;default:return"Neplatný vstup"}}};function N8(){return{localeError:gY()}}var _Y=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function v(U){return $[U]??null}let g={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ugyldigt input: forventede instanceof ${U.expected}, fik ${b}`;return`Ugyldigt input: forventede ${z}, fik ${b}`}case"invalid_value":if(U.values.length===1)return`Ugyldig værdi: forventede ${D(U.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),b=_[U.origin]??U.origin;if(J)return`For stor: forventede ${b??"value"} ${J.verb} ${z} ${U.maximum.toString()} ${J.unit??"elementer"}`;return`For stor: forventede ${b??"value"} havde ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),b=_[U.origin]??U.origin;if(J)return`For lille: forventede ${b} ${J.verb} ${z} ${U.minimum.toString()} ${J.unit}`;return`For lille: forventede ${b} havde ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ugyldig streng: skal starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: skal ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: skal indeholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: skal matche mønsteret ${z.pattern}`;return`Ugyldig ${g[z.format]??U.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${U.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${U.origin}`;default:return"Ugyldigt input"}}};function r8(){return{localeError:_Y()}}var zY=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function v(U){return $[U]??null}let g={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},_={nan:"NaN",number:"Zahl",array:"Array"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ungültige Eingabe: erwartet instanceof ${U.expected}, erhalten ${b}`;return`Ungültige Eingabe: erwartet ${z}, erhalten ${b}`}case"invalid_value":if(U.values.length===1)return`Ungültige Eingabe: erwartet ${D(U.values[0])}`;return`Ungültige Option: erwartet eine von ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${z}${U.maximum.toString()} ${J.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${z}${U.maximum.toString()} ist`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Zu klein: erwartet, dass ${U.origin} ${z}${U.minimum.toString()} ${J.unit} hat`;return`Zu klein: erwartet, dass ${U.origin} ${z}${U.minimum.toString()} ist`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ungültiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ungültiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ungültiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ungültiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ungültig: ${g[z.format]??U.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${U.divisor} sein`;case"unrecognized_keys":return`${U.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${U.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${U.origin}`;default:return"Ungültige Eingabe"}}};function u8(){return{localeError:zY()}}var JY=()=>{let $={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function v(U){return $[U]??null}let g={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;return`Invalid input: expected ${z}, received ${b}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${D(U.values[0])}`;return`Invalid option: expected one of ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Too big: expected ${U.origin??"value"} to have ${z}${U.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${U.origin??"value"} to be ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Too small: expected ${U.origin} to have ${z}${U.minimum.toString()} ${J.unit}`;return`Too small: expected ${U.origin} to be ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Invalid string: must start with "${z.prefix}"`;if(z.format==="ends_with")return`Invalid string: must end with "${z.suffix}"`;if(z.format==="includes")return`Invalid string: must include "${z.includes}"`;if(z.format==="regex")return`Invalid string: must match pattern ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${U.divisor}`;case"unrecognized_keys":return`Unrecognized key${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Invalid key in ${U.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${U.origin}`;default:return"Invalid input"}}};function Jg(){return{localeError:JY()}}var bY=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function v(U){return $[U]??null}let g={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},_={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Nevalida enigo: atendiĝis instanceof ${U.expected}, riceviĝis ${b}`;return`Nevalida enigo: atendiĝis ${z}, riceviĝis ${b}`}case"invalid_value":if(U.values.length===1)return`Nevalida enigo: atendiĝis ${D(U.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${z}${U.maximum.toString()} ${J.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Tro malgranda: atendiĝis ke ${U.origin} havu ${z}${U.minimum.toString()} ${J.unit}`;return`Tro malgranda: atendiĝis ke ${U.origin} estu ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${z.prefix}"`;if(z.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${z.suffix}"`;if(z.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${z.includes}"`;if(z.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${z.pattern}`;return`Nevalida ${g[z.format]??U.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${U.divisor}`;case"unrecognized_keys":return`Nekonata${U.keys.length>1?"j":""} ŝlosilo${U.keys.length>1?"j":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${U.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${U.origin}`;default:return"Nevalida enigo"}}};function y8(){return{localeError:bY()}}var GY=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function v(U){return $[U]??null}let g={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrada inválida: se esperaba instanceof ${U.expected}, recibido ${b}`;return`Entrada inválida: se esperaba ${z}, recibido ${b}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: se esperaba ${D(U.values[0])}`;return`Opción inválida: se esperaba una de ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),b=_[U.origin]??U.origin;if(J)return`Demasiado grande: se esperaba que ${b??"valor"} tuviera ${z}${U.maximum.toString()} ${J.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${b??"valor"} fuera ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),b=_[U.origin]??U.origin;if(J)return`Demasiado pequeño: se esperaba que ${b} tuviera ${z}${U.minimum.toString()} ${J.unit}`;return`Demasiado pequeño: se esperaba que ${b} fuera ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Cadena inválida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inválida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inválida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${z.pattern}`;return`Inválido ${g[z.format]??U.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Llave${U.keys.length>1?"s":""} desconocida${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Llave inválida en ${_[U.origin]??U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${_[U.origin]??U.origin}`;default:return"Entrada inválida"}}};function D8(){return{localeError:GY()}}var OY=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function v(U){return $[U]??null}let g={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},_={nan:"NaN",number:"عدد",array:"آرایه"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ورودی نامعتبر: می‌بایست instanceof ${U.expected} می‌بود، ${b} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${z} می‌بود، ${b} دریافت شد`}case"invalid_value":if(U.values.length===1)return`ورودی نامعتبر: می‌بایست ${D(U.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${A(U.values,"|")} می‌بود`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${z}${U.maximum.toString()} ${J.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${z}${U.maximum.toString()} باشد`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`خیلی کوچک: ${U.origin} باید ${z}${U.minimum.toString()} ${J.unit} باشد`;return`خیلی کوچک: ${U.origin} باید ${z}${U.minimum.toString()} باشد`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`رشته نامعتبر: باید با "${z.prefix}" شروع شود`;if(z.format==="ends_with")return`رشته نامعتبر: باید با "${z.suffix}" تمام شود`;if(z.format==="includes")return`رشته نامعتبر: باید شامل "${z.includes}" باشد`;if(z.format==="regex")return`رشته نامعتبر: باید با الگوی ${z.pattern} مطابقت داشته باشد`;return`${g[z.format]??U.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${U.divisor} باشد`;case"unrecognized_keys":return`کلید${U.keys.length>1?"های":""} ناشناس: ${A(U.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${U.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${U.origin}`;default:return"ورودی نامعتبر"}}};function R8(){return{localeError:OY()}}var KY=()=>{let $={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function v(U){return $[U]??null}let g={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Virheellinen tyyppi: odotettiin instanceof ${U.expected}, oli ${b}`;return`Virheellinen tyyppi: odotettiin ${z}, oli ${b}`}case"invalid_value":if(U.values.length===1)return`Virheellinen syöte: täytyy olla ${D(U.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Liian suuri: ${J.subject} täytyy olla ${z}${U.maximum.toString()} ${J.unit}`.trim();return`Liian suuri: arvon täytyy olla ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Liian pieni: ${J.subject} täytyy olla ${z}${U.minimum.toString()} ${J.unit}`.trim();return`Liian pieni: arvon täytyy olla ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen syöte: täytyy sisältää "${z.includes}"`;if(z.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${z.pattern}`;return`Virheellinen ${g[z.format]??U.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${U.divisor} monikerta`;case"unrecognized_keys":return`${U.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${A(U.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function T8(){return{localeError:KY()}}var WY=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(U){return $[U]??null}let g={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN",number:"nombre",array:"tableau"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : instanceof ${U.expected} attendu, ${b} reçu`;return`Entrée invalide : ${z} attendu, ${b} reçu`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : ${D(U.values[0])} attendu`;return`Option invalide : une valeur parmi ${A(U.values,"|")} attendue`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Trop grand : ${U.origin??"valeur"} doit ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"élément(s)"}`;return`Trop grand : ${U.origin??"valeur"} doit être ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Trop petit : ${U.origin} doit ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Trop petit : ${U.origin} doit être ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${z.pattern}`;return`${g[z.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${A(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function j8(){return{localeError:WY()}}var BY=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(U){return $[U]??null}let g={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : attendu instanceof ${U.expected}, reçu ${b}`;return`Entrée invalide : attendu ${z}, reçu ${b}`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : attendu ${D(U.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"≤":"<",J=v(U.origin);if(J)return`Trop grand : attendu que ${U.origin??"la valeur"} ait ${z}${U.maximum.toString()} ${J.unit}`;return`Trop grand : attendu que ${U.origin??"la valeur"} soit ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"≥":">",J=v(U.origin);if(J)return`Trop petit : attendu que ${U.origin} ait ${z}${U.minimum.toString()} ${J.unit}`;return`Trop petit : attendu que ${U.origin} soit ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au motif ${z.pattern}`;return`${g[z.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${A(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function V8(){return{localeError:BY()}}var PY=()=>{let $={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},v={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},g=(K)=>K?$[K]:void 0,_=(K)=>{let W=g(K);if(W)return W.label;return K??$.unknown.label},U=(K)=>`ה${_(K)}`,z=(K)=>{return(g(K)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},J=(K)=>{if(!K)return null;return v[K]??null},b={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},O={nan:"NaN"};return(K)=>{switch(K.code){case"invalid_type":{let W=K.expected,B=O[W??""]??_(W),k=R(K.input),P=O[k]??$[k]?.label??k;if(/^[A-Z]/.test(K.expected))return`קלט לא תקין: צריך להיות instanceof ${K.expected}, התקבל ${P}`;return`קלט לא תקין: צריך להיות ${B}, התקבל ${P}`}case"invalid_value":{if(K.values.length===1)return`ערך לא תקין: הערך חייב להיות ${D(K.values[0])}`;let W=K.values.map((P)=>D(P));if(K.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${W[0]} או ${W[1]}`;let B=W[W.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${W.slice(0,-1).join(", ")} או ${B}`}case"too_big":{let W=J(K.origin),B=U(K.origin??"value");if(K.origin==="string")return`${W?.longLabel??"ארוך"} מדי: ${B} צריכה להכיל ${K.maximum.toString()} ${W?.unit??""} ${K.inclusive?"או פחות":"לכל היותר"}`.trim();if(K.origin==="number"){let X=K.inclusive?`קטן או שווה ל-${K.maximum}`:`קטן מ-${K.maximum}`;return`גדול מדי: ${B} צריך להיות ${X}`}if(K.origin==="array"||K.origin==="set"){let X=K.origin==="set"?"צריכה":"צריך",Y=K.inclusive?`${K.maximum} ${W?.unit??""} או פחות`:`פחות מ-${K.maximum} ${W?.unit??""}`;return`גדול מדי: ${B} ${X} להכיל ${Y}`.trim()}let k=K.inclusive?"<=":"<",P=z(K.origin??"value");if(W?.unit)return`${W.longLabel} מדי: ${B} ${P} ${k}${K.maximum.toString()} ${W.unit}`;return`${W?.longLabel??"גדול"} מדי: ${B} ${P} ${k}${K.maximum.toString()}`}case"too_small":{let W=J(K.origin),B=U(K.origin??"value");if(K.origin==="string")return`${W?.shortLabel??"קצר"} מדי: ${B} צריכה להכיל ${K.minimum.toString()} ${W?.unit??""} ${K.inclusive?"או יותר":"לפחות"}`.trim();if(K.origin==="number"){let X=K.inclusive?`גדול או שווה ל-${K.minimum}`:`גדול מ-${K.minimum}`;return`קטן מדי: ${B} צריך להיות ${X}`}if(K.origin==="array"||K.origin==="set"){let X=K.origin==="set"?"צריכה":"צריך";if(K.minimum===1&&K.inclusive){let H=K.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${B} ${X} להכיל ${H}`}let Y=K.inclusive?`${K.minimum} ${W?.unit??""} או יותר`:`יותר מ-${K.minimum} ${W?.unit??""}`;return`קטן מדי: ${B} ${X} להכיל ${Y}`.trim()}let k=K.inclusive?">=":">",P=z(K.origin??"value");if(W?.unit)return`${W.shortLabel} מדי: ${B} ${P} ${k}${K.minimum.toString()} ${W.unit}`;return`${W?.shortLabel??"קטן"} מדי: ${B} ${P} ${k}${K.minimum.toString()}`}case"invalid_format":{let W=K;if(W.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${W.prefix}"`;if(W.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${W.suffix}"`;if(W.format==="includes")return`המחרוזת חייבת לכלול "${W.includes}"`;if(W.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${W.pattern}`;let B=b[W.format],k=B?.label??W.format,X=(B?.gender??"m")==="f"?"תקינה":"תקין";return`${k} לא ${X}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${K.divisor}`;case"unrecognized_keys":return`מפתח${K.keys.length>1?"ות":""} לא מזוה${K.keys.length>1?"ים":"ה"}: ${A(K.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${U(K.origin??"array")}`;default:return"קלט לא תקין"}}};function C8(){return{localeError:PY()}}var kY=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function v(U){return $[U]??null}let g={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},_={nan:"NaN",number:"szám",array:"tömb"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Érvénytelen bemenet: a várt érték instanceof ${U.expected}, a kapott érték ${b}`;return`Érvénytelen bemenet: a várt érték ${z}, a kapott érték ${b}`}case"invalid_value":if(U.values.length===1)return`Érvénytelen bemenet: a várt érték ${D(U.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Túl nagy: ${U.origin??"érték"} mérete túl nagy ${z}${U.maximum.toString()} ${J.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${U.origin??"érték"} túl nagy: ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Túl kicsi: a bemeneti érték ${U.origin} mérete túl kicsi ${z}${U.minimum.toString()} ${J.unit}`;return`Túl kicsi: a bemeneti érték ${U.origin} túl kicsi ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Érvénytelen string: "${z.prefix}" értékkel kell kezdődnie`;if(z.format==="ends_with")return`Érvénytelen string: "${z.suffix}" értékkel kell végződnie`;if(z.format==="includes")return`Érvénytelen string: "${z.includes}" értéket kell tartalmaznia`;if(z.format==="regex")return`Érvénytelen string: ${z.pattern} mintának kell megfelelnie`;return`Érvénytelen ${g[z.format]??U.format}`}case"not_multiple_of":return`Érvénytelen szám: ${U.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${U.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${U.origin}`;default:return"Érvénytelen bemenet"}}};function f8(){return{localeError:kY()}}function g7($,v,g){return Math.abs($)===1?v:g}function x4($){if(!$)return"";let v=["ա","ե","ը","ի","ո","ու","օ"],g=$[$.length-1];return $+(v.includes(g)?"ն":"ը")}var HY=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function v(U){return $[U]??null}let g={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},_={nan:"NaN",number:"թիվ",array:"զանգված"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${U.expected}, ստացվել է ${b}`;return`Սխալ մուտքագրում․ սպասվում էր ${z}, ստացվել է ${b}`}case"invalid_value":if(U.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${D(U.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let b=Number(U.maximum),O=g7(b,J.unit.one,J.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${x4(U.origin??"արժեք")} կունենա ${z}${U.maximum.toString()} ${O}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${x4(U.origin??"արժեք")} լինի ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let b=Number(U.minimum),O=g7(b,J.unit.one,J.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${x4(U.origin)} կունենա ${z}${U.minimum.toString()} ${O}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${x4(U.origin)} լինի ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${z.prefix}"-ով`;if(z.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${z.suffix}"-ով`;if(z.format==="includes")return`Սխալ տող․ պետք է պարունակի "${z.includes}"`;if(z.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${z.pattern} ձևաչափին`;return`Սխալ ${g[z.format]??U.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${U.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${U.keys.length>1?"ներ":""}. ${A(U.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${x4(U.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${x4(U.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function m8(){return{localeError:HY()}}var IY=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function v(U){return $[U]??null}let g={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input tidak valid: diharapkan instanceof ${U.expected}, diterima ${b}`;return`Input tidak valid: diharapkan ${z}, diterima ${b}`}case"invalid_value":if(U.values.length===1)return`Input tidak valid: diharapkan ${D(U.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Terlalu besar: diharapkan ${U.origin??"value"} memiliki ${z}${U.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: diharapkan ${U.origin??"value"} menjadi ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Terlalu kecil: diharapkan ${U.origin} memiliki ${z}${U.minimum.toString()} ${J.unit}`;return`Terlalu kecil: diharapkan ${U.origin} menjadi ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${g[z.format]??U.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${U.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${U.origin}`;default:return"Input tidak valid"}}};function c8(){return{localeError:IY()}}var YY=()=>{let $={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function v(U){return $[U]??null}let g={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},_={nan:"NaN",number:"númer",array:"fylki"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Rangt gildi: Þú slóst inn ${b} þar sem á að vera instanceof ${U.expected}`;return`Rangt gildi: Þú slóst inn ${b} þar sem á að vera ${z}`}case"invalid_value":if(U.values.length===1)return`Rangt gildi: gert ráð fyrir ${D(U.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} hafi ${z}${U.maximum.toString()} ${J.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} sé ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Of lítið: gert er ráð fyrir að ${U.origin} hafi ${z}${U.minimum.toString()} ${J.unit}`;return`Of lítið: gert er ráð fyrir að ${U.origin} sé ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ógildur strengur: verður að byrja á "${z.prefix}"`;if(z.format==="ends_with")return`Ógildur strengur: verður að enda á "${z.suffix}"`;if(z.format==="includes")return`Ógildur strengur: verður að innihalda "${z.includes}"`;if(z.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${z.pattern}`;return`Rangt ${g[z.format]??U.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${U.divisor}`;case"unrecognized_keys":return`Óþekkt ${U.keys.length>1?"ir lyklar":"ur lykill"}: ${A(U.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${U.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${U.origin}`;default:return"Rangt gildi"}}};function E8(){return{localeError:YY()}}var LY=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function v(U){return $[U]??null}let g={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"numero",array:"vettore"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input non valido: atteso instanceof ${U.expected}, ricevuto ${b}`;return`Input non valido: atteso ${z}, ricevuto ${b}`}case"invalid_value":if(U.values.length===1)return`Input non valido: atteso ${D(U.values[0])}`;return`Opzione non valida: atteso uno tra ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Troppo grande: ${U.origin??"valore"} deve avere ${z}${U.maximum.toString()} ${J.unit??"elementi"}`;return`Troppo grande: ${U.origin??"valore"} deve essere ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Troppo piccolo: ${U.origin} deve avere ${z}${U.minimum.toString()} ${J.unit}`;return`Troppo piccolo: ${U.origin} deve essere ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${U.divisor}`;case"unrecognized_keys":return`Chiav${U.keys.length>1?"i":"e"} non riconosciut${U.keys.length>1?"e":"a"}: ${A(U.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${U.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${U.origin}`;default:return"Input non valido"}}};function i8(){return{localeError:LY()}}var qY=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function v(U){return $[U]??null}let g={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},_={nan:"NaN",number:"数値",array:"配列"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`無効な入力: instanceof ${U.expected}が期待されましたが、${b}が入力されました`;return`無効な入力: ${z}が期待されましたが、${b}が入力されました`}case"invalid_value":if(U.values.length===1)return`無効な入力: ${D(U.values[0])}が期待されました`;return`無効な選択: ${A(U.values,"、")}のいずれかである必要があります`;case"too_big":{let z=U.inclusive?"以下である":"より小さい",J=v(U.origin);if(J)return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${J.unit??"要素"}${z}必要があります`;return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${z}必要があります`}case"too_small":{let z=U.inclusive?"以上である":"より大きい",J=v(U.origin);if(J)return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${J.unit}${z}必要があります`;return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${z}必要があります`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`無効な文字列: "${z.prefix}"で始まる必要があります`;if(z.format==="ends_with")return`無効な文字列: "${z.suffix}"で終わる必要があります`;if(z.format==="includes")return`無効な文字列: "${z.includes}"を含む必要があります`;if(z.format==="regex")return`無効な文字列: パターン${z.pattern}に一致する必要があります`;return`無効な${g[z.format]??U.format}`}case"not_multiple_of":return`無効な数値: ${U.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${U.keys.length>1?"群":""}: ${A(U.keys,"、")}`;case"invalid_key":return`${U.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${U.origin}内の無効な値`;default:return"無効な入力"}}};function l8(){return{localeError:qY()}}var XY=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function v(U){return $[U]??null}let g={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},_={nan:"NaN",number:"რიცხვი",string:"სტრინგი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${U.expected}, მიღებული ${b}`;return`არასწორი შეყვანა: მოსალოდნელი ${z}, მიღებული ${b}`}case"invalid_value":if(U.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${D(U.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${A(U.values,"|")}-დან`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} იყოს ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} იყოს ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${z.prefix}"-ით`;if(z.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${z.suffix}"-ით`;if(z.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${z.includes}"-ს`;if(z.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${z.pattern}`;return`არასწორი ${g[z.format]??U.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${U.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${U.keys.length>1?"ები":"ი"}: ${A(U.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${U.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${U.origin}-ში`;default:return"არასწორი შეყვანა"}}};function x8(){return{localeError:XY()}}var wY=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function v(U){return $[U]??null}let g={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},_={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${U.expected} ប៉ុន្តែទទួលបាន ${b}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${z} ប៉ុន្តែទទួលបាន ${b}`}case"invalid_value":if(U.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${D(U.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${z} ${U.maximum.toString()} ${J.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`តូចពេក៖ ត្រូវការ ${U.origin} ${z} ${U.minimum.toString()} ${J.unit}`;return`តូចពេក៖ ត្រូវការ ${U.origin} ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${z.prefix}"`;if(z.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${z.suffix}"`;if(z.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${z.includes}"`;if(z.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${z.pattern}`;return`មិនត្រឹមត្រូវ៖ ${g[z.format]??U.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${U.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${A(U.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function bg(){return{localeError:wY()}}function h8(){return bg()}var FY=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function v(U){return $[U]??null}let g={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`잘못된 입력: 예상 타입은 instanceof ${U.expected}, 받은 타입은 ${b}입니다`;return`잘못된 입력: 예상 타입은 ${z}, 받은 타입은 ${b}입니다`}case"invalid_value":if(U.values.length===1)return`잘못된 입력: 값은 ${D(U.values[0])} 이어야 합니다`;return`잘못된 옵션: ${A(U.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let z=U.inclusive?"이하":"미만",J=z==="미만"?"이어야 합니다":"여야 합니다",b=v(U.origin),O=b?.unit??"요소";if(b)return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()}${O} ${z}${J}`;return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()} ${z}${J}`}case"too_small":{let z=U.inclusive?"이상":"초과",J=z==="이상"?"이어야 합니다":"여야 합니다",b=v(U.origin),O=b?.unit??"요소";if(b)return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()}${O} ${z}${J}`;return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()} ${z}${J}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`잘못된 문자열: "${z.prefix}"(으)로 시작해야 합니다`;if(z.format==="ends_with")return`잘못된 문자열: "${z.suffix}"(으)로 끝나야 합니다`;if(z.format==="includes")return`잘못된 문자열: "${z.includes}"을(를) 포함해야 합니다`;if(z.format==="regex")return`잘못된 문자열: 정규식 ${z.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${g[z.format]??U.format}`}case"not_multiple_of":return`잘못된 숫자: ${U.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${A(U.keys,", ")}`;case"invalid_key":return`잘못된 키: ${U.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${U.origin}`;default:return"잘못된 입력"}}};function p8(){return{localeError:FY()}}var Gg=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function _7($){let v=Math.abs($),g=v%10,_=v%100;if(_>=11&&_<=19||g===0)return"many";if(g===1)return"one";return"few"}var AY=()=>{let $={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function v(U,z,J,b){let O=$[U]??null;if(O===null)return O;return{unit:O.unit[z],verb:O.verb[b][J?"inclusive":"notInclusive"]}}let g={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},_={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Gautas tipas ${b}, o tikėtasi - instanceof ${U.expected}`;return`Gautas tipas ${b}, o tikėtasi - ${z}`}case"invalid_value":if(U.values.length===1)return`Privalo būti ${D(U.values[0])}`;return`Privalo būti vienas iš ${A(U.values,"|")} pasirinkimų`;case"too_big":{let z=_[U.origin]??U.origin,J=v(U.origin,_7(Number(U.maximum)),U.inclusive??!1,"smaller");if(J?.verb)return`${Gg(z??U.origin??"reikšmė")} ${J.verb} ${U.maximum.toString()} ${J.unit??"elementų"}`;let b=U.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Gg(z??U.origin??"reikšmė")} turi būti ${b} ${U.maximum.toString()} ${J?.unit}`}case"too_small":{let z=_[U.origin]??U.origin,J=v(U.origin,_7(Number(U.minimum)),U.inclusive??!1,"bigger");if(J?.verb)return`${Gg(z??U.origin??"reikšmė")} ${J.verb} ${U.minimum.toString()} ${J.unit??"elementų"}`;let b=U.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Gg(z??U.origin??"reikšmė")} turi būti ${b} ${U.minimum.toString()} ${J?.unit}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Eilutė privalo prasidėti "${z.prefix}"`;if(z.format==="ends_with")return`Eilutė privalo pasibaigti "${z.suffix}"`;if(z.format==="includes")return`Eilutė privalo įtraukti "${z.includes}"`;if(z.format==="regex")return`Eilutė privalo atitikti ${z.pattern}`;return`Neteisingas ${g[z.format]??U.format}`}case"not_multiple_of":return`Skaičius privalo būti ${U.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${U.keys.length>1?"i":"as"} rakt${U.keys.length>1?"ai":"as"}: ${A(U.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let z=_[U.origin]??U.origin;return`${Gg(z??U.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function o8(){return{localeError:AY()}}var ZY=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function v(U){return $[U]??null}let g={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},_={nan:"NaN",number:"број",array:"низа"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Грешен внес: се очекува instanceof ${U.expected}, примено ${b}`;return`Грешен внес: се очекува ${z}, примено ${b}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${D(U.values[0])}`;return`Грешана опција: се очекува една ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Премногу голем: се очекува ${U.origin??"вредноста"} да има ${z}${U.maximum.toString()} ${J.unit??"елементи"}`;return`Премногу голем: се очекува ${U.origin??"вредноста"} да биде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Премногу мал: се очекува ${U.origin} да има ${z}${U.minimum.toString()} ${J.unit}`;return`Премногу мал: се очекува ${U.origin} да биде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неважечка низа: мора да започнува со "${z.prefix}"`;if(z.format==="ends_with")return`Неважечка низа: мора да завршува со "${z.suffix}"`;if(z.format==="includes")return`Неважечка низа: мора да вклучува "${z.includes}"`;if(z.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${A(U.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${U.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${U.origin}`;default:return"Грешен внес"}}};function n8(){return{localeError:ZY()}}var MY=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function v(U){return $[U]??null}let g={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"nombor"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input tidak sah: dijangka instanceof ${U.expected}, diterima ${b}`;return`Input tidak sah: dijangka ${z}, diterima ${b}`}case"invalid_value":if(U.values.length===1)return`Input tidak sah: dijangka ${D(U.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Terlalu besar: dijangka ${U.origin??"nilai"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: dijangka ${U.origin??"nilai"} adalah ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Terlalu kecil: dijangka ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Terlalu kecil: dijangka ${U.origin} adalah ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${g[z.format]??U.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${A(U.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${U.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${U.origin}`;default:return"Input tidak sah"}}};function t8(){return{localeError:MY()}}var QY=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function v(U){return $[U]??null}let g={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},_={nan:"NaN",number:"getal"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ongeldige invoer: verwacht instanceof ${U.expected}, ontving ${b}`;return`Ongeldige invoer: verwacht ${z}, ontving ${b}`}case"invalid_value":if(U.values.length===1)return`Ongeldige invoer: verwacht ${D(U.values[0])}`;return`Ongeldige optie: verwacht één van ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),b=U.origin==="date"?"laat":U.origin==="string"?"lang":"groot";if(J)return`Te ${b}: verwacht dat ${U.origin??"waarde"} ${z}${U.maximum.toString()} ${J.unit??"elementen"} ${J.verb}`;return`Te ${b}: verwacht dat ${U.origin??"waarde"} ${z}${U.maximum.toString()} is`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),b=U.origin==="date"?"vroeg":U.origin==="string"?"kort":"klein";if(J)return`Te ${b}: verwacht dat ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ${J.verb}`;return`Te ${b}: verwacht dat ${U.origin} ${z}${U.minimum.toString()} is`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${g[z.format]??U.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${U.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${U.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${U.origin}`;default:return"Ongeldige invoer"}}};function d8(){return{localeError:QY()}}var SY=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function v(U){return $[U]??null}let g={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"tall",array:"liste"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ugyldig input: forventet instanceof ${U.expected}, fikk ${b}`;return`Ugyldig input: forventet ${z}, fikk ${b}`}case"invalid_value":if(U.values.length===1)return`Ugyldig verdi: forventet ${D(U.values[0])}`;return`Ugyldig valg: forventet en av ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`For stor(t): forventet ${U.origin??"value"} til å ha ${z}${U.maximum.toString()} ${J.unit??"elementer"}`;return`For stor(t): forventet ${U.origin??"value"} til å ha ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`For lite(n): forventet ${U.origin} til å ha ${z}${U.minimum.toString()} ${J.unit}`;return`For lite(n): forventet ${U.origin} til å ha ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ugyldig streng: må starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: må ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: må inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: må matche mønsteret ${z.pattern}`;return`Ugyldig ${g[z.format]??U.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${U.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${U.origin}`;default:return"Ugyldig input"}}};function a8(){return{localeError:SY()}}var NY=()=>{let $={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function v(U){return $[U]??null}let g={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},_={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Fâsit giren: umulan instanceof ${U.expected}, alınan ${b}`;return`Fâsit giren: umulan ${z}, alınan ${b}`}case"invalid_value":if(U.values.length===1)return`Fâsit giren: umulan ${D(U.values[0])}`;return`Fâsit tercih: mûteberler ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Fazla büyük: ${U.origin??"value"}, ${z}${U.maximum.toString()} ${J.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${U.origin??"value"}, ${z}${U.maximum.toString()} olmalıydı.`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Fazla küçük: ${U.origin}, ${z}${U.minimum.toString()} ${J.unit} sahip olmalıydı.`;return`Fazla küçük: ${U.origin}, ${z}${U.minimum.toString()} olmalıydı.`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Fâsit metin: "${z.prefix}" ile başlamalı.`;if(z.format==="ends_with")return`Fâsit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`Fâsit metin: "${z.includes}" ihtivâ etmeli.`;if(z.format==="regex")return`Fâsit metin: ${z.pattern} nakşına uymalı.`;return`Fâsit ${g[z.format]??U.format}`}case"not_multiple_of":return`Fâsit sayı: ${U.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${U.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function s8(){return{localeError:NY()}}var rY=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function v(U){return $[U]??null}let g={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},_={nan:"NaN",number:"عدد",array:"ارې"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ناسم ورودي: باید instanceof ${U.expected} وای, مګر ${b} ترلاسه شو`;return`ناسم ورودي: باید ${z} وای, مګر ${b} ترلاسه شو`}case"invalid_value":if(U.values.length===1)return`ناسم ورودي: باید ${D(U.values[0])} وای`;return`ناسم انتخاب: باید یو له ${A(U.values,"|")} څخه وای`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ډیر لوی: ${U.origin??"ارزښت"} باید ${z}${U.maximum.toString()} ${J.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${U.origin??"ارزښت"} باید ${z}${U.maximum.toString()} وي`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`ډیر کوچنی: ${U.origin} باید ${z}${U.minimum.toString()} ${J.unit} ولري`;return`ډیر کوچنی: ${U.origin} باید ${z}${U.minimum.toString()} وي`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`ناسم متن: باید د "${z.prefix}" سره پیل شي`;if(z.format==="ends_with")return`ناسم متن: باید د "${z.suffix}" سره پای ته ورسيږي`;if(z.format==="includes")return`ناسم متن: باید "${z.includes}" ولري`;if(z.format==="regex")return`ناسم متن: باید د ${z.pattern} سره مطابقت ولري`;return`${g[z.format]??U.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${U.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${U.keys.length>1?"کلیډونه":"کلیډ"}: ${A(U.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${U.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${U.origin} کې`;default:return"ناسمه ورودي"}}};function e8(){return{localeError:rY()}}var uY=()=>{let $={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function v(U){return $[U]??null}let g={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},_={nan:"NaN",number:"liczba",array:"tablica"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${U.expected}, otrzymano ${b}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${z}, otrzymano ${b}`}case"invalid_value":if(U.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${D(U.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Za duża wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${z}${U.maximum.toString()} ${J.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Za mała wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${z}${U.minimum.toString()} ${J.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${z.suffix}"`;if(z.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${z.includes}"`;if(z.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${z.pattern}`;return`Nieprawidłow(y/a/e) ${g[z.format]??U.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${U.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${U.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${U.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function $9(){return{localeError:uY()}}var yY=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function v(U){return $[U]??null}let g={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",number:"número",null:"nulo"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Tipo inválido: esperado instanceof ${U.expected}, recebido ${b}`;return`Tipo inválido: esperado ${z}, recebido ${b}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: esperado ${D(U.values[0])}`;return`Opção inválida: esperada uma das ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Muito grande: esperado que ${U.origin??"valor"} tivesse ${z}${U.maximum.toString()} ${J.unit??"elementos"}`;return`Muito grande: esperado que ${U.origin??"valor"} fosse ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Muito pequeno: esperado que ${U.origin} tivesse ${z}${U.minimum.toString()} ${J.unit}`;return`Muito pequeno: esperado que ${U.origin} fosse ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Texto inválido: deve começar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inválido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inválido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inválido: deve corresponder ao padrão ${z.pattern}`;return`${g[z.format]??U.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Chave${U.keys.length>1?"s":""} desconhecida${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Chave inválida em ${U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${U.origin}`;default:return"Campo inválido"}}};function v9(){return{localeError:yY()}}function z7($,v,g,_){let U=Math.abs($),z=U%10,J=U%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return g;return _}var DY=()=>{let $={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function v(U){return $[U]??null}let g={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},_={nan:"NaN",number:"число",array:"массив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Неверный ввод: ожидалось instanceof ${U.expected}, получено ${b}`;return`Неверный ввод: ожидалось ${z}, получено ${b}`}case"invalid_value":if(U.values.length===1)return`Неверный ввод: ожидалось ${D(U.values[0])}`;return`Неверный вариант: ожидалось одно из ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let b=Number(U.maximum),O=z7(b,J.unit.one,J.unit.few,J.unit.many);return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет иметь ${z}${U.maximum.toString()} ${O}`}return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let b=Number(U.minimum),O=z7(b,J.unit.one,J.unit.few,J.unit.many);return`Слишком маленькое значение: ожидалось, что ${U.origin} будет иметь ${z}${U.minimum.toString()} ${O}`}return`Слишком маленькое значение: ожидалось, что ${U.origin} будет ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неверная строка: должна начинаться с "${z.prefix}"`;if(z.format==="ends_with")return`Неверная строка: должна заканчиваться на "${z.suffix}"`;if(z.format==="includes")return`Неверная строка: должна содержать "${z.includes}"`;if(z.format==="regex")return`Неверная строка: должна соответствовать шаблону ${z.pattern}`;return`Неверный ${g[z.format]??U.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспознанн${U.keys.length>1?"ые":"ый"} ключ${U.keys.length>1?"и":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${U.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${U.origin}`;default:return"Неверные входные данные"}}};function U9(){return{localeError:DY()}}var RY=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function v(U){return $[U]??null}let g={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},_={nan:"NaN",number:"število",array:"tabela"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Neveljaven vnos: pričakovano instanceof ${U.expected}, prejeto ${b}`;return`Neveljaven vnos: pričakovano ${z}, prejeto ${b}`}case"invalid_value":if(U.values.length===1)return`Neveljaven vnos: pričakovano ${D(U.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} imelo ${z}${U.maximum.toString()} ${J.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Premajhno: pričakovano, da bo ${U.origin} imelo ${z}${U.minimum.toString()} ${J.unit}`;return`Premajhno: pričakovano, da bo ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Neveljaven niz: mora se začeti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se končati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${g[z.format]??U.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${U.divisor}`;case"unrecognized_keys":return`Neprepoznan${U.keys.length>1?"i ključi":" ključ"}: ${A(U.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${U.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${U.origin}`;default:return"Neveljaven vnos"}}};function g9(){return{localeError:RY()}}var TY=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function v(U){return $[U]??null}let g={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},_={nan:"NaN",number:"antal",array:"lista"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ogiltig inmatning: förväntat instanceof ${U.expected}, fick ${b}`;return`Ogiltig inmatning: förväntat ${z}, fick ${b}`}case"invalid_value":if(U.values.length===1)return`Ogiltig inmatning: förväntat ${D(U.values[0])}`;return`Ogiltigt val: förväntade en av ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`För stor(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.maximum.toString()} ${J.unit??"element"}`;return`För stor(t): förväntat ${U.origin??"värdet"} att ha ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.minimum.toString()} ${J.unit}`;return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ogiltig sträng: måste börja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig sträng: måste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig sträng: måste innehålla "${z.includes}"`;if(z.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${z.pattern}"`;return`Ogiltig(t) ${g[z.format]??U.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${U.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${U.origin??"värdet"}`;default:return"Ogiltig input"}}};function _9(){return{localeError:TY()}}var jY=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function v(U){return $[U]??null}let g={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${U.expected}, பெறப்பட்டது ${b}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${z}, பெறப்பட்டது ${b}`}case"invalid_value":if(U.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${D(U.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${A(U.values,"|")} இல் ஒன்று`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${z}${U.maximum.toString()} ${J.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${z}${U.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${z}${U.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`தவறான சரம்: "${z.prefix}" இல் தொடங்க வேண்டும்`;if(z.format==="ends_with")return`தவறான சரம்: "${z.suffix}" இல் முடிவடைய வேண்டும்`;if(z.format==="includes")return`தவறான சரம்: "${z.includes}" ஐ உள்ளடக்க வேண்டும்`;if(z.format==="regex")return`தவறான சரம்: ${z.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${g[z.format]??U.format}`}case"not_multiple_of":return`தவறான எண்: ${U.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${U.keys.length>1?"கள்":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${U.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function z9(){return{localeError:jY()}}var VY=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function v(U){return $[U]??null}let g={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},_={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${U.expected} แต่ได้รับ ${b}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${z} แต่ได้รับ ${b}`}case"invalid_value":if(U.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${D(U.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"ไม่เกิน":"น้อยกว่า",J=v(U.origin);if(J)return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${z} ${U.maximum.toString()} ${J.unit??"รายการ"}`;return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"อย่างน้อย":"มากกว่า",J=v(U.origin);if(J)return`น้อยกว่ากำหนด: ${U.origin} ควรมี${z} ${U.minimum.toString()} ${J.unit}`;return`น้อยกว่ากำหนด: ${U.origin} ควรมี${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${z.prefix}"`;if(z.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${z.suffix}"`;if(z.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${z.includes}" อยู่ในข้อความ`;if(z.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${z.pattern}`;return`รูปแบบไม่ถูกต้อง: ${g[z.format]??U.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${U.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${A(U.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${U.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${U.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function J9(){return{localeError:VY()}}var CY=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function v(U){return $[U]??null}let g={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Geçersiz değer: beklenen instanceof ${U.expected}, alınan ${b}`;return`Geçersiz değer: beklenen ${z}, alınan ${b}`}case"invalid_value":if(U.values.length===1)return`Geçersiz değer: beklenen ${D(U.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Çok büyük: beklenen ${U.origin??"değer"} ${z}${U.maximum.toString()} ${J.unit??"öğe"}`;return`Çok büyük: beklenen ${U.origin??"değer"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Çok küçük: beklenen ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`Çok küçük: beklenen ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Geçersiz metin: "${z.prefix}" ile başlamalı`;if(z.format==="ends_with")return`Geçersiz metin: "${z.suffix}" ile bitmeli`;if(z.format==="includes")return`Geçersiz metin: "${z.includes}" içermeli`;if(z.format==="regex")return`Geçersiz metin: ${z.pattern} desenine uymalı`;return`Geçersiz ${g[z.format]??U.format}`}case"not_multiple_of":return`Geçersiz sayı: ${U.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${U.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function b9(){return{localeError:CY()}}var fY=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function v(U){return $[U]??null}let g={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},_={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Неправильні вхідні дані: очікується instanceof ${U.expected}, отримано ${b}`;return`Неправильні вхідні дані: очікується ${z}, отримано ${b}`}case"invalid_value":if(U.values.length===1)return`Неправильні вхідні дані: очікується ${D(U.values[0])}`;return`Неправильна опція: очікується одне з ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Занадто велике: очікується, що ${U.origin??"значення"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"елементів"}`;return`Занадто велике: очікується, що ${U.origin??"значення"} буде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Занадто мале: очікується, що ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Занадто мале: очікується, що ${U.origin} буде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неправильний рядок: повинен починатися з "${z.prefix}"`;if(z.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${z.suffix}"`;if(z.format==="includes")return`Неправильний рядок: повинен містити "${z.includes}"`;if(z.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${z.pattern}`;return`Неправильний ${g[z.format]??U.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${U.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${U.keys.length>1?"і":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${U.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${U.origin}`;default:return"Неправильні вхідні дані"}}};function Og(){return{localeError:fY()}}function G9(){return Og()}var mY=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function v(U){return $[U]??null}let g={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},_={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`غلط ان پٹ: instanceof ${U.expected} متوقع تھا، ${b} موصول ہوا`;return`غلط ان پٹ: ${z} متوقع تھا، ${b} موصول ہوا`}case"invalid_value":if(U.values.length===1)return`غلط ان پٹ: ${D(U.values[0])} متوقع تھا`;return`غلط آپشن: ${A(U.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`بہت بڑا: ${U.origin??"ویلیو"} کے ${z}${U.maximum.toString()} ${J.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${U.origin??"ویلیو"} کا ${z}${U.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`بہت چھوٹا: ${U.origin} کے ${z}${U.minimum.toString()} ${J.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${U.origin} کا ${z}${U.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`غلط سٹرنگ: "${z.prefix}" سے شروع ہونا چاہیے`;if(z.format==="ends_with")return`غلط سٹرنگ: "${z.suffix}" پر ختم ہونا چاہیے`;if(z.format==="includes")return`غلط سٹرنگ: "${z.includes}" شامل ہونا چاہیے`;if(z.format==="regex")return`غلط سٹرنگ: پیٹرن ${z.pattern} سے میچ ہونا چاہیے`;return`غلط ${g[z.format]??U.format}`}case"not_multiple_of":return`غلط نمبر: ${U.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${U.keys.length>1?"ز":""}: ${A(U.keys,"، ")}`;case"invalid_key":return`${U.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${U.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function O9(){return{localeError:mY()}}var cY=()=>{let $={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"}};function v(U){return $[U]??null}let g={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},_={nan:"NaN",number:"raqam",array:"massiv"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${U.expected}, qabul qilingan ${b}`;return`Noto‘g‘ri kirish: kutilgan ${z}, qabul qilingan ${b}`}case"invalid_value":if(U.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${D(U.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Juda katta: kutilgan ${U.origin??"qiymat"} ${z}${U.maximum.toString()} ${J.unit} ${J.verb}`;return`Juda katta: kutilgan ${U.origin??"qiymat"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Juda kichik: kutilgan ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ${J.verb}`;return`Juda kichik: kutilgan ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Noto‘g‘ri satr: "${z.prefix}" bilan boshlanishi kerak`;if(z.format==="ends_with")return`Noto‘g‘ri satr: "${z.suffix}" bilan tugashi kerak`;if(z.format==="includes")return`Noto‘g‘ri satr: "${z.includes}" ni o‘z ichiga olishi kerak`;if(z.format==="regex")return`Noto‘g‘ri satr: ${z.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${g[z.format]??U.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${U.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${U.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function K9(){return{localeError:cY()}}var EY=()=>{let $={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function v(U){return $[U]??null}let g={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},_={nan:"NaN",number:"số",array:"mảng"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${U.expected}, nhận được ${b}`;return`Đầu vào không hợp lệ: mong đợi ${z}, nhận được ${b}`}case"invalid_value":if(U.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${D(U.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"phần tử"}`;return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Quá nhỏ: mong đợi ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Quá nhỏ: mong đợi ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${z.prefix}"`;if(z.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${z.suffix}"`;if(z.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${z.includes}"`;if(z.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${z.pattern}`;return`${g[z.format]??U.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${U.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${A(U.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${U.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${U.origin}`;default:return"Đầu vào không hợp lệ"}}};function W9(){return{localeError:EY()}}var iY=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function v(U){return $[U]??null}let g={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},_={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`无效输入:期望 instanceof ${U.expected},实际接收 ${b}`;return`无效输入:期望 ${z},实际接收 ${b}`}case"invalid_value":if(U.values.length===1)return`无效输入:期望 ${D(U.values[0])}`;return`无效选项:期望以下之一 ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`数值过大:期望 ${U.origin??"值"} ${z}${U.maximum.toString()} ${J.unit??"个元素"}`;return`数值过大:期望 ${U.origin??"值"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`数值过小:期望 ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`数值过小:期望 ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`无效字符串:必须以 "${z.prefix}" 开头`;if(z.format==="ends_with")return`无效字符串:必须以 "${z.suffix}" 结尾`;if(z.format==="includes")return`无效字符串:必须包含 "${z.includes}"`;if(z.format==="regex")return`无效字符串:必须满足正则表达式 ${z.pattern}`;return`无效${g[z.format]??U.format}`}case"not_multiple_of":return`无效数字:必须是 ${U.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${U.origin} 中包含无效值(value)`;default:return"无效输入"}}};function B9(){return{localeError:iY()}}var lY=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function v(U){return $[U]??null}let g={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`無效的輸入值:預期為 instanceof ${U.expected},但收到 ${b}`;return`無效的輸入值:預期為 ${z},但收到 ${b}`}case"invalid_value":if(U.values.length===1)return`無效的輸入值:預期為 ${D(U.values[0])}`;return`無效的選項:預期為以下其中之一 ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`數值過大:預期 ${U.origin??"值"} 應為 ${z}${U.maximum.toString()} ${J.unit??"個元素"}`;return`數值過大:預期 ${U.origin??"值"} 應為 ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`數值過小:預期 ${U.origin} 應為 ${z}${U.minimum.toString()} ${J.unit}`;return`數值過小:預期 ${U.origin} 應為 ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`無效的字串:必須以 "${z.prefix}" 開頭`;if(z.format==="ends_with")return`無效的字串:必須以 "${z.suffix}" 結尾`;if(z.format==="includes")return`無效的字串:必須包含 "${z.includes}"`;if(z.format==="regex")return`無效的字串:必須符合格式 ${z.pattern}`;return`無效的 ${g[z.format]??U.format}`}case"not_multiple_of":return`無效的數字:必須為 ${U.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${U.keys.length>1?"們":""}:${A(U.keys,"、")}`;case"invalid_key":return`${U.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${U.origin} 中有無效的值`;default:return"無效的輸入值"}}};function P9(){return{localeError:lY()}}var xY=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function v(U){return $[U]??null}let g={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},_={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=R(U.input),b=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${U.expected}, àmọ̀ a rí ${b}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${z}, àmọ̀ a rí ${b}`}case"invalid_value":if(U.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${D(U.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${U.origin??"iye"} ${J.verb} ${z}${U.maximum} ${J.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${z}${U.maximum}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Kéré ju: a ní láti jẹ́ pé ${U.origin} ${J.verb} ${z}${U.minimum} ${J.unit}`;return`Kéré ju: a ní láti jẹ́ ${z}${U.minimum}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${z.prefix}"`;if(z.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${z.suffix}"`;if(z.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${z.includes}"`;if(z.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${z.pattern}`;return`Aṣìṣe: ${g[z.format]??U.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${U.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${A(U.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${U.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${U.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function k9(){return{localeError:xY()}}var J7,H9=Symbol("ZodOutput"),I9=Symbol("ZodInput");class Y9{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...v){let g=v[0];if(this._map.set($,g),g&&typeof g==="object"&&"id"in g)this._idmap.set(g.id,$);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove($){let v=this._map.get($);if(v&&typeof v==="object"&&"id"in v)this._idmap.delete(v.id);return this._map.delete($),this}get($){let v=$._zod.parent;if(v){let g={...this.get(v)??{}};delete g.id;let _={...g,...this._map.get($)};return Object.keys(_).length?_:void 0}return this._map.get($)}has($){return this._map.has($)}}function w1(){return new Y9}(J7=globalThis).__zod_globalRegistry??(J7.__zod_globalRegistry=w1());var e$=globalThis.__zod_globalRegistry;function L9($,v){return new $({type:"string",...V(v)})}function q9($,v){return new $({type:"string",coerce:!0,...V(v)})}function F1($,v){return new $({type:"string",format:"email",check:"string_format",abort:!1,...V(v)})}function Wg($,v){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...V(v)})}function A1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...V(v)})}function Z1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...V(v)})}function M1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...V(v)})}function Q1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...V(v)})}function Bg($,v){return new $({type:"string",format:"url",check:"string_format",abort:!1,...V(v)})}function S1($,v){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...V(v)})}function N1($,v){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...V(v)})}function r1($,v){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...V(v)})}function u1($,v){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...V(v)})}function y1($,v){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...V(v)})}function D1($,v){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...V(v)})}function R1($,v){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...V(v)})}function T1($,v){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...V(v)})}function j1($,v){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...V(v)})}function X9($,v){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...V(v)})}function V1($,v){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...V(v)})}function C1($,v){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...V(v)})}function f1($,v){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...V(v)})}function m1($,v){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...V(v)})}function c1($,v){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...V(v)})}function E1($,v){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...V(v)})}var w9={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function F9($,v){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...V(v)})}function A9($,v){return new $({type:"string",format:"date",check:"string_format",...V(v)})}function Z9($,v){return new $({type:"string",format:"time",check:"string_format",precision:null,...V(v)})}function M9($,v){return new $({type:"string",format:"duration",check:"string_format",...V(v)})}function Q9($,v){return new $({type:"number",checks:[],...V(v)})}function S9($,v){return new $({type:"number",coerce:!0,checks:[],...V(v)})}function N9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...V(v)})}function r9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...V(v)})}function u9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...V(v)})}function y9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...V(v)})}function D9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...V(v)})}function R9($,v){return new $({type:"boolean",...V(v)})}function T9($,v){return new $({type:"boolean",coerce:!0,...V(v)})}function j9($,v){return new $({type:"bigint",...V(v)})}function V9($,v){return new $({type:"bigint",coerce:!0,...V(v)})}function C9($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...V(v)})}function f9($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...V(v)})}function m9($,v){return new $({type:"symbol",...V(v)})}function c9($,v){return new $({type:"undefined",...V(v)})}function E9($,v){return new $({type:"null",...V(v)})}function i9($){return new $({type:"any"})}function l9($){return new $({type:"unknown"})}function x9($,v){return new $({type:"never",...V(v)})}function h9($,v){return new $({type:"void",...V(v)})}function p9($,v){return new $({type:"date",...V(v)})}function o9($,v){return new $({type:"date",coerce:!0,...V(v)})}function n9($,v){return new $({type:"nan",...V(v)})}function nv($,v){return new O1({check:"less_than",...V(v),value:$,inclusive:!1})}function Nv($,v){return new O1({check:"less_than",...V(v),value:$,inclusive:!0})}function tv($,v){return new K1({check:"greater_than",...V(v),value:$,inclusive:!1})}function Hv($,v){return new K1({check:"greater_than",...V(v),value:$,inclusive:!0})}function i1($){return tv(0,$)}function l1($){return nv(0,$)}function x1($){return Nv(0,$)}function h1($){return Hv(0,$)}function R6($,v){return new nz({check:"multiple_of",...V(v),value:$})}function T6($,v){return new az({check:"max_size",...V(v),maximum:$})}function dv($,v){return new sz({check:"min_size",...V(v),minimum:$})}function b4($,v){return new ez({check:"size_equals",...V(v),size:$})}function G4($,v){return new $J({check:"max_length",...V(v),maximum:$})}function G6($,v){return new vJ({check:"min_length",...V(v),minimum:$})}function O4($,v){return new UJ({check:"length_equals",...V(v),length:$})}function h4($,v){return new gJ({check:"string_format",format:"regex",...V(v),pattern:$})}function p4($){return new _J({check:"string_format",format:"lowercase",...V($)})}function o4($){return new zJ({check:"string_format",format:"uppercase",...V($)})}function n4($,v){return new JJ({check:"string_format",format:"includes",...V(v),includes:$})}function t4($,v){return new bJ({check:"string_format",format:"starts_with",...V(v),prefix:$})}function d4($,v){return new GJ({check:"string_format",format:"ends_with",...V(v),suffix:$})}function p1($,v,g){return new OJ({check:"property",property:$,schema:v,...V(g)})}function a4($,v){return new KJ({check:"mime_type",mime:$,...V(v)})}function mv($){return new WJ({check:"overwrite",tx:$})}function s4($){return mv((v)=>v.normalize($))}function e4(){return mv(($)=>$.trim())}function $U(){return mv(($)=>$.toLowerCase())}function vU(){return mv(($)=>$.toUpperCase())}function UU(){return mv(($)=>Wz($))}function t9($,v,g){return new $({type:"array",element:v,...V(g)})}function pY($,v,g){return new $({type:"union",options:v,...V(g)})}function oY($,v,g){return new $({type:"union",options:v,inclusive:!1,...V(g)})}function nY($,v,g,_){return new $({type:"union",options:g,discriminator:v,...V(_)})}function tY($,v,g){return new $({type:"intersection",left:v,right:g})}function dY($,v,g,_){let U=g instanceof $$;return new $({type:"tuple",items:v,rest:U?g:null,...V(U?_:g)})}function aY($,v,g,_){return new $({type:"record",keyType:v,valueType:g,...V(_)})}function sY($,v,g,_){return new $({type:"map",keyType:v,valueType:g,...V(_)})}function eY($,v,g){return new $({type:"set",valueType:v,...V(g)})}function $L($,v,g){let _=Array.isArray(v)?Object.fromEntries(v.map((U)=>[U,U])):v;return new $({type:"enum",entries:_,...V(g)})}function vL($,v,g){return new $({type:"enum",entries:v,...V(g)})}function UL($,v,g){return new $({type:"literal",values:Array.isArray(v)?v:[v],...V(g)})}function d9($,v){return new $({type:"file",...V(v)})}function gL($,v){return new $({type:"transform",transform:v})}function _L($,v){return new $({type:"optional",innerType:v})}function zL($,v){return new $({type:"nullable",innerType:v})}function JL($,v,g){return new $({type:"default",innerType:v,get defaultValue(){return typeof g==="function"?g():Pz(g)}})}function bL($,v,g){return new $({type:"nonoptional",innerType:v,...V(g)})}function GL($,v){return new $({type:"success",innerType:v})}function OL($,v,g){return new $({type:"catch",innerType:v,catchValue:typeof g==="function"?g:()=>g})}function KL($,v,g){return new $({type:"pipe",in:v,out:g})}function WL($,v){return new $({type:"readonly",innerType:v})}function BL($,v,g){return new $({type:"template_literal",parts:v,...V(g)})}function PL($,v){return new $({type:"lazy",getter:v})}function kL($,v){return new $({type:"promise",innerType:v})}function a9($,v,g){let _=V(g);return _.abort??(_.abort=!0),new $({type:"custom",check:"custom",fn:v,..._})}function s9($,v,g){return new $({type:"custom",check:"custom",fn:v,...V(g)})}function e9($){let v=b7((g)=>{return g.addIssue=(_)=>{if(typeof _==="string")g.issues.push(C4(_,g.value,v._zod.def));else{let U=_;if(U.fatal)U.continue=!1;U.code??(U.code="custom"),U.input??(U.input=g.value),U.inst??(U.inst=v),U.continue??(U.continue=!v._zod.def.abort),g.issues.push(C4(U))}},$(g.value,g)});return v}function b7($,v){let g=new S$({check:"custom",...V(v)});return g._zod.check=$,g}function $b($){let v=new S$({check:"describe"});return v._zod.onattach=[(g)=>{let _=e$.get(g)??{};e$.add(g,{..._,description:$})}],v._zod.check=()=>{},v}function vb($){let v=new S$({check:"meta"});return v._zod.onattach=[(g)=>{let _=e$.get(g)??{};e$.add(g,{..._,...$})}],v._zod.check=()=>{},v}function Ub($,v){let g=V(v),_=g.truthy??["true","1","yes","on","y","enabled"],U=g.falsy??["false","0","no","off","n","disabled"];if(g.case!=="sensitive")_=_.map((P)=>typeof P==="string"?P.toLowerCase():P),U=U.map((P)=>typeof P==="string"?P.toLowerCase():P);let z=new Set(_),J=new Set(U),b=$.Codec??zg,O=$.Boolean??gg,W=new($.String??J4)({type:"string",error:g.error}),B=new O({type:"boolean",error:g.error}),k=new b({type:"pipe",in:W,out:B,transform:(P,X)=>{let Y=P;if(g.case!=="sensitive")Y=Y.toLowerCase();if(z.has(Y))return!0;else if(J.has(Y))return!1;else return X.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...J],input:X.value,inst:k,continue:!1}),{}},reverseTransform:(P,X)=>{if(P===!0)return _[0]||"true";else return U[0]||"false"},error:g.error});return k}function gU($,v,g,_={}){let U=V(_),z={...V(_),check:"string_format",type:"string",format:v,fn:typeof g==="function"?g:(b)=>g.test(b),...U};if(g instanceof RegExp)z.pattern=g;return new $(z)}function j6($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";return{processors:$.processors??{},metadataRegistry:$?.metadata??e$,target:v,unrepresentable:$?.unrepresentable??"throw",override:$?.override??(()=>{}),io:$?.io??"output",counter:0,seen:new Map,cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0}}function w$($,v,g={path:[],schemaPath:[]}){var _;let U=$._zod.def,z=v.seen.get($);if(z){if(z.count++,g.schemaPath.includes($))z.cycle=g.path;return z.schema}let J={schema:{},count:1,cycle:void 0,path:g.path};v.seen.set($,J);let b=$._zod.toJSONSchema?.();if(b)J.schema=b;else{let W={...g,schemaPath:[...g.schemaPath,$],path:g.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(v,J.schema,W);else{let k=J.schema,P=v.processors[U.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${U.type}`);P($,v,k,W)}let B=$._zod.parent;if(B){if(!J.ref)J.ref=B;w$(B,v,W),v.seen.get(B).isParent=!0}}let O=v.metadataRegistry.get($);if(O)Object.assign(J.schema,O);if(v.io==="input"&&Iv($))delete J.schema.examples,delete J.schema.default;if(v.io==="input"&&J.schema._prefault)(_=J.schema).default??(_.default=J.schema._prefault);return delete J.schema._prefault,v.seen.get($).schema}function V6($,v){let g=$.seen.get(v);if(!g)throw Error("Unprocessed schema. This is a bug in Zod.");let _=new Map;for(let J of $.seen.entries()){let b=$.metadataRegistry.get(J[0])?.id;if(b){let O=_.get(b);if(O&&O!==J[0])throw Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);_.set(b,J[0])}}let U=(J)=>{let b=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let B=$.external.registry.get(J[0])?.id,k=$.external.uri??((X)=>X);if(B)return{ref:k(B)};let P=J[1].defId??J[1].schema.id??`schema${$.counter++}`;return J[1].defId=P,{defId:P,ref:`${k("__shared")}#/${b}/${P}`}}if(J[1]===g)return{ref:"#"};let K=`${"#"}/${b}/`,W=J[1].schema.id??`__schema${$.counter++}`;return{defId:W,ref:K+W}},z=(J)=>{if(J[1].schema.$ref)return;let b=J[1],{ref:O,defId:K}=U(J);if(b.def={...b.schema},K)b.defId=K;let W=b.schema;for(let B in W)delete W[B];W.$ref=O};if($.cycles==="throw")for(let J of $.seen.entries()){let b=J[1];if(b.cycle)throw Error(`Cycle detected: #/${b.cycle?.join("/")}/<root>
144
+ `)}P.write("payload.value = newResult;"),P.write("return payload;");let q=P.compile();return(w,S)=>q(k,w,S)},z,J=J4,G=!hU.jitless,O=G&&qz.value,W=v.catchall,B;$._zod.parse=(k,P)=>{B??(B=_.value);let X=k.value;if(!J(X))return k.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),k;if(G&&O&&P?.async===!1&&P.jitless!==!0){if(!z)z=U(v.shape);if(k=z(k,P),!W)return k;return G7([],X,k,P,B,$)}return g(k,P)}});function n5($,v,g,_){for(let z of $)if(z.issues.length===0)return v.value=z.value,v;let U=$.filter((z)=>!u6(z));if(U.length===1)return v.value=U[0].value,U[0];return v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:$.map((z)=>z.issues.map((J)=>Xv(J,_,x$())))}),v}var Gg=F("$ZodUnion",($,v)=>{$$.init($,v),J$($._zod,"optin",()=>v.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),J$($._zod,"optout",()=>v.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),J$($._zod,"values",()=>{if(v.options.every((U)=>U._zod.values))return new Set(v.options.flatMap((U)=>Array.from(U._zod.values)));return}),J$($._zod,"pattern",()=>{if(v.options.every((U)=>U._zod.pattern)){let U=v.options.map((z)=>z._zod.pattern);return new RegExp(`^(${U.map((z)=>oU(z.source)).join("|")})$`)}return});let g=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(U,z)=>{if(g)return _(U,z);let J=!1,G=[];for(let K of v.options){let O=K._zod.run({value:U.value,issues:[]},z);if(O instanceof Promise)G.push(O),J=!0;else{if(O.issues.length===0)return O;G.push(O)}}if(!J)return n5(G,U,$,z);return Promise.all(G).then((K)=>{return n5(K,U,$,z)})}});function t5($,v,g,_){let U=$.filter((z)=>z.issues.length===0);if(U.length===1)return v.value=U[0].value,v;if(U.length===0)v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:$.map((z)=>z.issues.map((J)=>Xv(J,_,x$())))});else v.issues.push({code:"invalid_union",input:v.value,inst:g,errors:[],inclusive:!1});return v}var z8=F("$ZodXor",($,v)=>{Gg.init($,v),v.inclusive=!1;let g=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(U,z)=>{if(g)return _(U,z);let J=!1,G=[];for(let K of v.options){let O=K._zod.run({value:U.value,issues:[]},z);if(O instanceof Promise)G.push(O),J=!0;else G.push(O)}if(!J)return t5(G,U,$,z);return Promise.all(G).then((K)=>{return t5(K,U,$,z)})}}),J8=F("$ZodDiscriminatedUnion",($,v)=>{v.inclusive=!1,Gg.init($,v);let g=$._zod.parse;J$($._zod,"propValues",()=>{let U={};for(let z of v.options){let J=z._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(z)}"`);for(let[G,K]of Object.entries(J)){if(!U[G])U[G]=new Set;for(let O of K)U[G].add(O)}}return U});let _=f4(()=>{let U=v.options,z=new Map;for(let J of U){let G=J._zod.propValues?.[v.discriminator];if(!G||G.size===0)throw Error(`Invalid discriminated union option at index "${v.options.indexOf(J)}"`);for(let K of G){if(z.has(K))throw Error(`Duplicate discriminator value "${String(K)}"`);z.set(K,J)}}return z});$._zod.parse=(U,z)=>{let J=U.value;if(!J4(J))return U.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),U;let G=_.value.get(J?.[v.discriminator]);if(G)return G._zod.run(U,z);if(v.unionFallback)return g(U,z);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:v.discriminator,input:J,path:[v.discriminator],inst:$}),U}}),G8=F("$ZodIntersection",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value,z=v.left._zod.run({value:U,issues:[]},_),J=v.right._zod.run({value:U,issues:[]},_);if(z instanceof Promise||J instanceof Promise)return Promise.all([z,J]).then(([K,O])=>{return d5(g,K,O)});return d5(g,z,J)}});function XJ($,v){if($===v)return{valid:!0,data:$};if($ instanceof Date&&v instanceof Date&&+$===+v)return{valid:!0,data:$};if(R6($)&&R6(v)){let g=Object.keys(v),_=Object.keys($).filter((z)=>g.indexOf(z)!==-1),U={...$,...v};for(let z of _){let J=XJ($[z],v[z]);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};U[z]=J.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(v)){if($.length!==v.length)return{valid:!1,mergeErrorPath:[]};let g=[];for(let _=0;_<$.length;_++){let U=$[_],z=v[_],J=XJ(U,z);if(!J.valid)return{valid:!1,mergeErrorPath:[_,...J.mergeErrorPath]};g.push(J.data)}return{valid:!0,data:g}}return{valid:!1,mergeErrorPath:[]}}function d5($,v,g){let _=new Map,U;for(let G of v.issues)if(G.code==="unrecognized_keys"){U??(U=G);for(let K of G.keys){if(!_.has(K))_.set(K,{});_.get(K).l=!0}}else $.issues.push(G);for(let G of g.issues)if(G.code==="unrecognized_keys")for(let K of G.keys){if(!_.has(K))_.set(K,{});_.get(K).r=!0}else $.issues.push(G);let z=[..._].filter(([,G])=>G.l&&G.r).map(([G])=>G);if(z.length&&U)$.issues.push({...U,keys:z});if(u6($))return $;let J=XJ(v.value,g.value);if(!J.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var w1=F("$ZodTuple",($,v)=>{$$.init($,v);let g=v.items;$._zod.parse=(_,U)=>{let z=_.value;if(!Array.isArray(z))return _.issues.push({input:z,inst:$,expected:"tuple",code:"invalid_type"}),_;_.value=[];let J=[],G=[...g].reverse().findIndex((W)=>W._zod.optin!=="optional"),K=G===-1?0:g.length-G;if(!v.rest){let W=z.length>g.length,B=z.length<K-1;if(W||B)return _.issues.push({...W?{code:"too_big",maximum:g.length,inclusive:!0}:{code:"too_small",minimum:g.length},input:z,inst:$,origin:"array"}),_}let O=-1;for(let W of g){if(O++,O>=z.length){if(O>=K)continue}let B=W._zod.run({value:z[O],issues:[]},U);if(B instanceof Promise)J.push(B.then((k)=>Y1(k,_,O)));else Y1(B,_,O)}if(v.rest){let W=z.slice(g.length);for(let B of W){O++;let k=v.rest._zod.run({value:B,issues:[]},U);if(k instanceof Promise)J.push(k.then((P)=>Y1(P,_,O)));else Y1(k,_,O)}}if(J.length)return Promise.all(J).then(()=>_);return _}});function Y1($,v,g){if($.issues.length)v.issues.push(...Sv(g,$.issues));v.value[g]=$.value}var b8=F("$ZodRecord",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!R6(U))return g.issues.push({expected:"record",code:"invalid_type",input:U,inst:$}),g;let z=[],J=v.keyType._zod.values;if(J){g.value={};let G=new Set;for(let O of J)if(typeof O==="string"||typeof O==="number"||typeof O==="symbol"){G.add(typeof O==="number"?O.toString():O);let W=v.valueType._zod.run({value:U[O],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)g.issues.push(...Sv(O,B.issues));g.value[O]=B.value}));else{if(W.issues.length)g.issues.push(...Sv(O,W.issues));g.value[O]=W.value}}let K;for(let O in U)if(!G.has(O))K=K??[],K.push(O);if(K&&K.length>0)g.issues.push({code:"unrecognized_keys",input:U,inst:$,keys:K})}else{g.value={};for(let G of Reflect.ownKeys(U)){if(G==="__proto__")continue;let K=v.keyType._zod.run({value:G,issues:[]},_);if(K instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof G==="string"&&gg.test(G)&&K.issues.length){let B=v.keyType._zod.run({value:Number(G),issues:[]},_);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(B.issues.length===0)K=B}if(K.issues.length){if(v.mode==="loose")g.value[G]=U[G];else g.issues.push({code:"invalid_key",origin:"record",issues:K.issues.map((B)=>Xv(B,_,x$())),input:G,path:[G],inst:$});continue}let W=v.valueType._zod.run({value:U[G],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)g.issues.push(...Sv(G,B.issues));g.value[K.value]=B.value}));else{if(W.issues.length)g.issues.push(...Sv(G,W.issues));g.value[K.value]=W.value}}}if(z.length)return Promise.all(z).then(()=>g);return g}}),K8=F("$ZodMap",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!(U instanceof Map))return g.issues.push({expected:"map",code:"invalid_type",input:U,inst:$}),g;let z=[];g.value=new Map;for(let[J,G]of U){let K=v.keyType._zod.run({value:J,issues:[]},_),O=v.valueType._zod.run({value:G,issues:[]},_);if(K instanceof Promise||O instanceof Promise)z.push(Promise.all([K,O]).then(([W,B])=>{a5(W,B,g,J,U,$,_)}));else a5(K,O,g,J,U,$,_)}if(z.length)return Promise.all(z).then(()=>g);return g}});function a5($,v,g,_,U,z,J){if($.issues.length)if(nU.has(typeof _))g.issues.push(...Sv(_,$.issues));else g.issues.push({code:"invalid_key",origin:"map",input:U,inst:z,issues:$.issues.map((G)=>Xv(G,J,x$()))});if(v.issues.length)if(nU.has(typeof _))g.issues.push(...Sv(_,v.issues));else g.issues.push({origin:"map",code:"invalid_element",input:U,inst:z,key:_,issues:v.issues.map((G)=>Xv(G,J,x$()))});g.value.set($.value,v.value)}var O8=F("$ZodSet",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(!(U instanceof Set))return g.issues.push({input:U,inst:$,expected:"set",code:"invalid_type"}),g;let z=[];g.value=new Set;for(let J of U){let G=v.valueType._zod.run({value:J,issues:[]},_);if(G instanceof Promise)z.push(G.then((K)=>s5(K,g)));else s5(G,g)}if(z.length)return Promise.all(z).then(()=>g);return g}});function s5($,v){if($.issues.length)v.issues.push(...$.issues);v.value.add($.value)}var W8=F("$ZodEnum",($,v)=>{$$.init($,v);let g=pU(v.entries),_=new Set(g);$._zod.values=_,$._zod.pattern=new RegExp(`^(${g.filter((U)=>nU.has(typeof U)).map((U)=>typeof U==="string"?Rv(U):U.toString()).join("|")})$`),$._zod.parse=(U,z)=>{let J=U.value;if(_.has(J))return U;return U.issues.push({code:"invalid_value",values:g,input:J,inst:$}),U}}),B8=F("$ZodLiteral",($,v)=>{if($$.init($,v),v.values.length===0)throw Error("Cannot create literal schema with no valid values");let g=new Set(v.values);$._zod.values=g,$._zod.pattern=new RegExp(`^(${v.values.map((_)=>typeof _==="string"?Rv(_):_?Rv(_.toString()):String(_)).join("|")})$`),$._zod.parse=(_,U)=>{let z=_.value;if(g.has(z))return _;return _.issues.push({code:"invalid_value",values:v.values,input:z,inst:$}),_}}),P8=F("$ZodFile",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{let U=g.value;if(U instanceof File)return g;return g.issues.push({expected:"file",code:"invalid_type",input:U,inst:$}),g}}),k8=F("$ZodTransform",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new z4($.constructor.name);let U=v.transform(g.value,g);if(_.async)return(U instanceof Promise?U:Promise.resolve(U)).then((J)=>{return g.value=J,g});if(U instanceof Promise)throw new ov;return g.value=U,g}});function e5($,v){if($.issues.length&&v===void 0)return{issues:[],value:void 0};return $}var A1=F("$ZodOptional",($,v)=>{$$.init($,v),$._zod.optin="optional",$._zod.optout="optional",J$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,void 0]):void 0}),J$($._zod,"pattern",()=>{let g=v.innerType._zod.pattern;return g?new RegExp(`^(${oU(g.source)})?$`):void 0}),$._zod.parse=(g,_)=>{if(v.innerType._zod.optin==="optional"){let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>e5(z,g.value));return e5(U,g.value)}if(g.value===void 0)return g;return v.innerType._zod.run(g,_)}}),Y8=F("$ZodExactOptional",($,v)=>{A1.init($,v),J$($._zod,"values",()=>v.innerType._zod.values),J$($._zod,"pattern",()=>v.innerType._zod.pattern),$._zod.parse=(g,_)=>{return v.innerType._zod.run(g,_)}}),H8=F("$ZodNullable",($,v)=>{$$.init($,v),J$($._zod,"optin",()=>v.innerType._zod.optin),J$($._zod,"optout",()=>v.innerType._zod.optout),J$($._zod,"pattern",()=>{let g=v.innerType._zod.pattern;return g?new RegExp(`^(${oU(g.source)}|null)$`):void 0}),J$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,null]):void 0}),$._zod.parse=(g,_)=>{if(g.value===null)return g;return v.innerType._zod.run(g,_)}}),L8=F("$ZodDefault",($,v)=>{$$.init($,v),$._zod.optin="optional",J$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);if(g.value===void 0)return g.value=v.defaultValue,g;let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>$7(z,v));return $7(U,v)}});function $7($,v){if($.value===void 0)$.value=v.defaultValue;return $}var I8=F("$ZodPrefault",($,v)=>{$$.init($,v),$._zod.optin="optional",J$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);if(g.value===void 0)g.value=v.defaultValue;return v.innerType._zod.run(g,_)}}),q8=F("$ZodNonOptional",($,v)=>{$$.init($,v),J$($._zod,"values",()=>{let g=v.innerType._zod.values;return g?new Set([...g].filter((_)=>_!==void 0)):void 0}),$._zod.parse=(g,_)=>{let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>v7(z,$));return v7(U,$)}});function v7($,v){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:v});return $}var X8=F("$ZodSuccess",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new z4("ZodSuccess");let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>{return g.value=z.issues.length===0,g});return g.value=U.issues.length===0,g}}),F8=F("$ZodCatch",($,v)=>{$$.init($,v),J$($._zod,"optin",()=>v.innerType._zod.optin),J$($._zod,"optout",()=>v.innerType._zod.optout),J$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>{if(g.value=z.value,z.issues.length)g.value=v.catchValue({...g,error:{issues:z.issues.map((J)=>Xv(J,_,x$()))},input:g.value}),g.issues=[];return g});if(g.value=U.value,U.issues.length)g.value=v.catchValue({...g,error:{issues:U.issues.map((z)=>Xv(z,_,x$()))},input:g.value}),g.issues=[];return g}}),w8=F("$ZodNaN",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{if(typeof g.value!=="number"||!Number.isNaN(g.value))return g.issues.push({input:g.value,inst:$,expected:"nan",code:"invalid_type"}),g;return g}}),A8=F("$ZodPipe",($,v)=>{$$.init($,v),J$($._zod,"values",()=>v.in._zod.values),J$($._zod,"optin",()=>v.in._zod.optin),J$($._zod,"optout",()=>v.out._zod.optout),J$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(g,_)=>{if(_.direction==="backward"){let z=v.out._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>H1(J,v.in,_));return H1(z,v.in,_)}let U=v.in._zod.run(g,_);if(U instanceof Promise)return U.then((z)=>H1(z,v.out,_));return H1(U,v.out,_)}});function H1($,v,g){if($.issues.length)return $.aborted=!0,$;return v._zod.run({value:$.value,issues:$.issues},g)}var bg=F("$ZodCodec",($,v)=>{$$.init($,v),J$($._zod,"values",()=>v.in._zod.values),J$($._zod,"optin",()=>v.in._zod.optin),J$($._zod,"optout",()=>v.out._zod.optout),J$($._zod,"propValues",()=>v.in._zod.propValues),$._zod.parse=(g,_)=>{if((_.direction||"forward")==="forward"){let z=v.in._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>L1(J,v,_));return L1(z,v,_)}else{let z=v.out._zod.run(g,_);if(z instanceof Promise)return z.then((J)=>L1(J,v,_));return L1(z,v,_)}}});function L1($,v,g){if($.issues.length)return $.aborted=!0,$;if((g.direction||"forward")==="forward"){let U=v.transform($.value,$);if(U instanceof Promise)return U.then((z)=>I1($,z,v.out,g));return I1($,U,v.out,g)}else{let U=v.reverseTransform($.value,$);if(U instanceof Promise)return U.then((z)=>I1($,z,v.in,g));return I1($,U,v.in,g)}}function I1($,v,g,_){if($.issues.length)return $.aborted=!0,$;return g._zod.run({value:v,issues:$.issues},_)}var Z8=F("$ZodReadonly",($,v)=>{$$.init($,v),J$($._zod,"propValues",()=>v.innerType._zod.propValues),J$($._zod,"values",()=>v.innerType._zod.values),J$($._zod,"optin",()=>v.innerType?._zod?.optin),J$($._zod,"optout",()=>v.innerType?._zod?.optout),$._zod.parse=(g,_)=>{if(_.direction==="backward")return v.innerType._zod.run(g,_);let U=v.innerType._zod.run(g,_);if(U instanceof Promise)return U.then(U7);return U7(U)}});function U7($){return $.value=Object.freeze($.value),$}var Q8=F("$ZodTemplateLiteral",($,v)=>{$$.init($,v);let g=[];for(let _ of v.parts)if(typeof _==="object"&&_!==null){if(!_._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[..._._zod.traits].shift()}`);let U=_._zod.pattern instanceof RegExp?_._zod.pattern.source:_._zod.pattern;if(!U)throw Error(`Invalid template literal part: ${_._zod.traits}`);let z=U.startsWith("^")?1:0,J=U.endsWith("$")?U.length-1:U.length;g.push(U.slice(z,J))}else if(_===null||Fz.has(typeof _))g.push(Rv(`${_}`));else throw Error(`Invalid template literal part: ${_}`);$._zod.pattern=new RegExp(`^${g.join("")}$`),$._zod.parse=(_,U)=>{if(typeof _.value!=="string")return _.issues.push({input:_.value,inst:$,expected:"string",code:"invalid_type"}),_;if($._zod.pattern.lastIndex=0,!$._zod.pattern.test(_.value))return _.issues.push({input:_.value,inst:$,code:"invalid_format",format:v.format??"template_literal",pattern:$._zod.pattern.source}),_;return _}}),M8=F("$ZodFunction",($,v)=>{return $$.init($,v),$._def=v,$._zod.def=v,$.implement=(g)=>{if(typeof g!=="function")throw Error("implement() must be called with a function");return function(..._){let U=$._def.input?$g($._def.input,_):_,z=Reflect.apply(g,this,U);if($._def.output)return $g($._def.output,z);return z}},$.implementAsync=(g)=>{if(typeof g!=="function")throw Error("implementAsync() must be called with a function");return async function(..._){let U=$._def.input?await vg($._def.input,_):_,z=await Reflect.apply(g,this,U);if($._def.output)return await vg($._def.output,z);return z}},$._zod.parse=(g,_)=>{if(typeof g.value!=="function")return g.issues.push({code:"invalid_type",expected:"function",input:g.value,inst:$}),g;if($._def.output&&$._def.output._zod.def.type==="promise")g.value=$.implementAsync(g.value);else g.value=$.implement(g.value);return g},$.input=(...g)=>{let _=$.constructor;if(Array.isArray(g[0]))return new _({type:"function",input:new w1({type:"tuple",items:g[0],rest:g[1]}),output:$._def.output});return new _({type:"function",input:g[0],output:$._def.output})},$.output=(g)=>{return new $.constructor({type:"function",input:$._def.input,output:g})},$}),S8=F("$ZodPromise",($,v)=>{$$.init($,v),$._zod.parse=(g,_)=>{return Promise.resolve(g.value).then((U)=>v.innerType._zod.run({value:U,issues:[]},_))}}),N8=F("$ZodLazy",($,v)=>{$$.init($,v),J$($._zod,"innerType",()=>v.getter()),J$($._zod,"pattern",()=>$._zod.innerType?._zod?.pattern),J$($._zod,"propValues",()=>$._zod.innerType?._zod?.propValues),J$($._zod,"optin",()=>$._zod.innerType?._zod?.optin??void 0),J$($._zod,"optout",()=>$._zod.innerType?._zod?.optout??void 0),$._zod.parse=(g,_)=>{return $._zod.innerType._zod.run(g,_)}}),y8=F("$ZodCustom",($,v)=>{N$.init($,v),$$.init($,v),$._zod.parse=(g,_)=>{return g},$._zod.check=(g)=>{let _=g.value,U=v.fn(_);if(U instanceof Promise)return U.then((z)=>g7(z,g,_,$));g7(U,g,_,$);return}});function g7($,v,g,_){if(!$){let U={code:"custom",input:g,inst:_,path:[..._._zod.def.path??[]],continue:!_._zod.def.abort};if(_._zod.def.params)U.params=_._zod.def.params;v.issues.push(E4(U))}}var Pg={};ev(Pg,{zhTW:()=>X9,zhCN:()=>q9,yo:()=>F9,vi:()=>I9,uz:()=>L9,ur:()=>H9,uk:()=>Bg,ua:()=>Y9,tr:()=>k9,th:()=>P9,ta:()=>B9,sv:()=>W9,sl:()=>O9,ru:()=>K9,pt:()=>b9,ps:()=>J9,pl:()=>G9,ota:()=>z9,no:()=>_9,nl:()=>g9,ms:()=>U9,mk:()=>v9,lt:()=>$9,ko:()=>e8,km:()=>Og,kh:()=>s8,ka:()=>a8,ja:()=>d8,it:()=>t8,is:()=>n8,id:()=>o8,hy:()=>p8,hu:()=>l8,he:()=>h8,frCA:()=>x8,fr:()=>i8,fi:()=>c8,fa:()=>m8,es:()=>E8,eo:()=>f8,en:()=>Kg,de:()=>C8,da:()=>V8,cs:()=>r8,ca:()=>j8,bg:()=>T8,be:()=>u8,az:()=>R8,ar:()=>D8});var JL=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function v(U){return $[U]??null}let g={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${U.expected}، ولكن تم إدخال ${G}`;return`مدخلات غير مقبولة: يفترض إدخال ${z}، ولكن تم إدخال ${G}`}case"invalid_value":if(U.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${u(U.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return` أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${z} ${U.maximum.toString()} ${J.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${U.origin??"القيمة"} ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${z} ${U.minimum.toString()} ${J.unit}`;return`أصغر من اللازم: يفترض لـ ${U.origin} أن يكون ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${U.prefix}"`;if(z.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${z.suffix}"`;if(z.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${z.includes}"`;if(z.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${z.pattern}`;return`${g[z.format]??U.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${U.divisor}`;case"unrecognized_keys":return`معرف${U.keys.length>1?"ات":""} غريب${U.keys.length>1?"ة":""}: ${A(U.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${U.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${U.origin}`;default:return"مدخل غير مقبول"}}};function D8(){return{localeError:JL()}}var GL=()=>{let $={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function v(U){return $[U]??null}let g={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Yanlış dəyər: gözlənilən instanceof ${U.expected}, daxil olan ${G}`;return`Yanlış dəyər: gözlənilən ${z}, daxil olan ${G}`}case"invalid_value":if(U.values.length===1)return`Yanlış dəyər: gözlənilən ${u(U.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${z}${U.maximum.toString()} ${J.unit??"element"}`;return`Çox böyük: gözlənilən ${U.origin??"dəyər"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Çox kiçik: gözlənilən ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`Çox kiçik: gözlənilən ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Yanlış mətn: "${z.prefix}" ilə başlamalıdır`;if(z.format==="ends_with")return`Yanlış mətn: "${z.suffix}" ilə bitməlidir`;if(z.format==="includes")return`Yanlış mətn: "${z.includes}" daxil olmalıdır`;if(z.format==="regex")return`Yanlış mətn: ${z.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${g[z.format]??U.format}`}case"not_multiple_of":return`Yanlış ədəd: ${U.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${U.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function R8(){return{localeError:GL()}}function K7($,v,g,_){let U=Math.abs($),z=U%10,J=U%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return g;return _}var bL=()=>{let $={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function v(U){return $[U]??null}let g={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},_={nan:"NaN",number:"лік",array:"масіў"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Няправільны ўвод: чакаўся instanceof ${U.expected}, атрымана ${G}`;return`Няправільны ўвод: чакаўся ${z}, атрымана ${G}`}case"invalid_value":if(U.values.length===1)return`Няправільны ўвод: чакалася ${u(U.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let G=Number(U.maximum),K=K7(G,J.unit.one,J.unit.few,J.unit.many);return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна ${J.verb} ${z}${U.maximum.toString()} ${K}`}return`Занадта вялікі: чакалася, што ${U.origin??"значэнне"} павінна быць ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let G=Number(U.minimum),K=K7(G,J.unit.one,J.unit.few,J.unit.many);return`Занадта малы: чакалася, што ${U.origin} павінна ${J.verb} ${z}${U.minimum.toString()} ${K}`}return`Занадта малы: чакалася, што ${U.origin} павінна быць ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${z.prefix}"`;if(z.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${z.suffix}"`;if(z.format==="includes")return`Няправільны радок: павінен змяшчаць "${z.includes}"`;if(z.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${z.pattern}`;return`Няправільны ${g[z.format]??U.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${U.keys.length>1?"ключы":"ключ"}: ${A(U.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${U.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${U.origin}`;default:return"Няправільны ўвод"}}};function u8(){return{localeError:bL()}}var KL=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function v(U){return $[U]??null}let g={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},_={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Невалиден вход: очакван instanceof ${U.expected}, получен ${G}`;return`Невалиден вход: очакван ${z}, получен ${G}`}case"invalid_value":if(U.values.length===1)return`Невалиден вход: очакван ${u(U.values[0])}`;return`Невалидна опция: очаквано едно от ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Твърде голямо: очаква се ${U.origin??"стойност"} да съдържа ${z}${U.maximum.toString()} ${J.unit??"елемента"}`;return`Твърде голямо: очаква се ${U.origin??"стойност"} да бъде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Твърде малко: очаква се ${U.origin} да съдържа ${z}${U.minimum.toString()} ${J.unit}`;return`Твърде малко: очаква се ${U.origin} да бъде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Невалиден низ: трябва да започва с "${z.prefix}"`;if(z.format==="ends_with")return`Невалиден низ: трябва да завършва с "${z.suffix}"`;if(z.format==="includes")return`Невалиден низ: трябва да включва "${z.includes}"`;if(z.format==="regex")return`Невалиден низ: трябва да съвпада с ${z.pattern}`;let J="Невалиден";if(z.format==="emoji")J="Невалидно";if(z.format==="datetime")J="Невалидно";if(z.format==="date")J="Невалидна";if(z.format==="time")J="Невалидно";if(z.format==="duration")J="Невалидна";return`${J} ${g[z.format]??U.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${U.divisor}`;case"unrecognized_keys":return`Неразпознат${U.keys.length>1?"и":""} ключ${U.keys.length>1?"ове":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${U.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${U.origin}`;default:return"Невалиден вход"}}};function T8(){return{localeError:KL()}}var OL=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function v(U){return $[U]??null}let g={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Tipus invàlid: s'esperava instanceof ${U.expected}, s'ha rebut ${G}`;return`Tipus invàlid: s'esperava ${z}, s'ha rebut ${G}`}case"invalid_value":if(U.values.length===1)return`Valor invàlid: s'esperava ${u(U.values[0])}`;return`Opció invàlida: s'esperava una de ${A(U.values," o ")}`;case"too_big":{let z=U.inclusive?"com a màxim":"menys de",J=v(U.origin);if(J)return`Massa gran: s'esperava que ${U.origin??"el valor"} contingués ${z} ${U.maximum.toString()} ${J.unit??"elements"}`;return`Massa gran: s'esperava que ${U.origin??"el valor"} fos ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"com a mínim":"més de",J=v(U.origin);if(J)return`Massa petit: s'esperava que ${U.origin} contingués ${z} ${U.minimum.toString()} ${J.unit}`;return`Massa petit: s'esperava que ${U.origin} fos ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Format invàlid: ha de començar amb "${z.prefix}"`;if(z.format==="ends_with")return`Format invàlid: ha d'acabar amb "${z.suffix}"`;if(z.format==="includes")return`Format invàlid: ha d'incloure "${z.includes}"`;if(z.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${z.pattern}`;return`Format invàlid per a ${g[z.format]??U.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${U.divisor}`;case"unrecognized_keys":return`Clau${U.keys.length>1?"s":""} no reconeguda${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${U.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${U.origin}`;default:return"Entrada invàlida"}}};function j8(){return{localeError:OL()}}var WL=()=>{let $={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function v(U){return $[U]??null}let g={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},_={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Neplatný vstup: očekáváno instanceof ${U.expected}, obdrženo ${G}`;return`Neplatný vstup: očekáváno ${z}, obdrženo ${G}`}case"invalid_value":if(U.values.length===1)return`Neplatný vstup: očekáváno ${u(U.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí mít ${z}${U.maximum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš velká: ${U.origin??"hodnota"} musí být ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí mít ${z}${U.minimum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš malá: ${U.origin??"hodnota"} musí být ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Neplatný řetězec: musí začínat na "${z.prefix}"`;if(z.format==="ends_with")return`Neplatný řetězec: musí končit na "${z.suffix}"`;if(z.format==="includes")return`Neplatný řetězec: musí obsahovat "${z.includes}"`;if(z.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${z.pattern}`;return`Neplatný formát ${g[z.format]??U.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${U.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${A(U.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${U.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${U.origin}`;default:return"Neplatný vstup"}}};function r8(){return{localeError:WL()}}var BL=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function v(U){return $[U]??null}let g={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ugyldigt input: forventede instanceof ${U.expected}, fik ${G}`;return`Ugyldigt input: forventede ${z}, fik ${G}`}case"invalid_value":if(U.values.length===1)return`Ugyldig værdi: forventede ${u(U.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),G=_[U.origin]??U.origin;if(J)return`For stor: forventede ${G??"value"} ${J.verb} ${z} ${U.maximum.toString()} ${J.unit??"elementer"}`;return`For stor: forventede ${G??"value"} havde ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),G=_[U.origin]??U.origin;if(J)return`For lille: forventede ${G} ${J.verb} ${z} ${U.minimum.toString()} ${J.unit}`;return`For lille: forventede ${G} havde ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ugyldig streng: skal starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: skal ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: skal indeholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: skal matche mønsteret ${z.pattern}`;return`Ugyldig ${g[z.format]??U.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${U.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${U.origin}`;default:return"Ugyldigt input"}}};function V8(){return{localeError:BL()}}var PL=()=>{let $={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function v(U){return $[U]??null}let g={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},_={nan:"NaN",number:"Zahl",array:"Array"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ungültige Eingabe: erwartet instanceof ${U.expected}, erhalten ${G}`;return`Ungültige Eingabe: erwartet ${z}, erhalten ${G}`}case"invalid_value":if(U.values.length===1)return`Ungültige Eingabe: erwartet ${u(U.values[0])}`;return`Ungültige Option: erwartet eine von ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${z}${U.maximum.toString()} ${J.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${U.origin??"Wert"} ${z}${U.maximum.toString()} ist`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Zu klein: erwartet, dass ${U.origin} ${z}${U.minimum.toString()} ${J.unit} hat`;return`Zu klein: erwartet, dass ${U.origin} ${z}${U.minimum.toString()} ist`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ungültiger String: muss mit "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ungültiger String: muss mit "${z.suffix}" enden`;if(z.format==="includes")return`Ungültiger String: muss "${z.includes}" enthalten`;if(z.format==="regex")return`Ungültiger String: muss dem Muster ${z.pattern} entsprechen`;return`Ungültig: ${g[z.format]??U.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${U.divisor} sein`;case"unrecognized_keys":return`${U.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${U.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${U.origin}`;default:return"Ungültige Eingabe"}}};function C8(){return{localeError:PL()}}var kL=()=>{let $={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function v(U){return $[U]??null}let g={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;return`Invalid input: expected ${z}, received ${G}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${u(U.values[0])}`;return`Invalid option: expected one of ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Too big: expected ${U.origin??"value"} to have ${z}${U.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${U.origin??"value"} to be ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Too small: expected ${U.origin} to have ${z}${U.minimum.toString()} ${J.unit}`;return`Too small: expected ${U.origin} to be ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Invalid string: must start with "${z.prefix}"`;if(z.format==="ends_with")return`Invalid string: must end with "${z.suffix}"`;if(z.format==="includes")return`Invalid string: must include "${z.includes}"`;if(z.format==="regex")return`Invalid string: must match pattern ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${U.divisor}`;case"unrecognized_keys":return`Unrecognized key${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Invalid key in ${U.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${U.origin}`;default:return"Invalid input"}}};function Kg(){return{localeError:kL()}}var YL=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function v(U){return $[U]??null}let g={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},_={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Nevalida enigo: atendiĝis instanceof ${U.expected}, riceviĝis ${G}`;return`Nevalida enigo: atendiĝis ${z}, riceviĝis ${G}`}case"invalid_value":if(U.values.length===1)return`Nevalida enigo: atendiĝis ${u(U.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${z}${U.maximum.toString()} ${J.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${U.origin??"valoro"} havu ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Tro malgranda: atendiĝis ke ${U.origin} havu ${z}${U.minimum.toString()} ${J.unit}`;return`Tro malgranda: atendiĝis ke ${U.origin} estu ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${z.prefix}"`;if(z.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${z.suffix}"`;if(z.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${z.includes}"`;if(z.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${z.pattern}`;return`Nevalida ${g[z.format]??U.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${U.divisor}`;case"unrecognized_keys":return`Nekonata${U.keys.length>1?"j":""} ŝlosilo${U.keys.length>1?"j":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${U.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${U.origin}`;default:return"Nevalida enigo"}}};function f8(){return{localeError:YL()}}var HL=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function v(U){return $[U]??null}let g={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrada inválida: se esperaba instanceof ${U.expected}, recibido ${G}`;return`Entrada inválida: se esperaba ${z}, recibido ${G}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: se esperaba ${u(U.values[0])}`;return`Opción inválida: se esperaba una de ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),G=_[U.origin]??U.origin;if(J)return`Demasiado grande: se esperaba que ${G??"valor"} tuviera ${z}${U.maximum.toString()} ${J.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${G??"valor"} fuera ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),G=_[U.origin]??U.origin;if(J)return`Demasiado pequeño: se esperaba que ${G} tuviera ${z}${U.minimum.toString()} ${J.unit}`;return`Demasiado pequeño: se esperaba que ${G} fuera ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Cadena inválida: debe comenzar con "${z.prefix}"`;if(z.format==="ends_with")return`Cadena inválida: debe terminar en "${z.suffix}"`;if(z.format==="includes")return`Cadena inválida: debe incluir "${z.includes}"`;if(z.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${z.pattern}`;return`Inválido ${g[z.format]??U.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Llave${U.keys.length>1?"s":""} desconocida${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Llave inválida en ${_[U.origin]??U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${_[U.origin]??U.origin}`;default:return"Entrada inválida"}}};function E8(){return{localeError:HL()}}var LL=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function v(U){return $[U]??null}let g={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},_={nan:"NaN",number:"عدد",array:"آرایه"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ورودی نامعتبر: می‌بایست instanceof ${U.expected} می‌بود، ${G} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${z} می‌بود، ${G} دریافت شد`}case"invalid_value":if(U.values.length===1)return`ورودی نامعتبر: می‌بایست ${u(U.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${A(U.values,"|")} می‌بود`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${z}${U.maximum.toString()} ${J.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${U.origin??"مقدار"} باید ${z}${U.maximum.toString()} باشد`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`خیلی کوچک: ${U.origin} باید ${z}${U.minimum.toString()} ${J.unit} باشد`;return`خیلی کوچک: ${U.origin} باید ${z}${U.minimum.toString()} باشد`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`رشته نامعتبر: باید با "${z.prefix}" شروع شود`;if(z.format==="ends_with")return`رشته نامعتبر: باید با "${z.suffix}" تمام شود`;if(z.format==="includes")return`رشته نامعتبر: باید شامل "${z.includes}" باشد`;if(z.format==="regex")return`رشته نامعتبر: باید با الگوی ${z.pattern} مطابقت داشته باشد`;return`${g[z.format]??U.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${U.divisor} باشد`;case"unrecognized_keys":return`کلید${U.keys.length>1?"های":""} ناشناس: ${A(U.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${U.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${U.origin}`;default:return"ورودی نامعتبر"}}};function m8(){return{localeError:LL()}}var IL=()=>{let $={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function v(U){return $[U]??null}let g={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Virheellinen tyyppi: odotettiin instanceof ${U.expected}, oli ${G}`;return`Virheellinen tyyppi: odotettiin ${z}, oli ${G}`}case"invalid_value":if(U.values.length===1)return`Virheellinen syöte: täytyy olla ${u(U.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Liian suuri: ${J.subject} täytyy olla ${z}${U.maximum.toString()} ${J.unit}`.trim();return`Liian suuri: arvon täytyy olla ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Liian pieni: ${J.subject} täytyy olla ${z}${U.minimum.toString()} ${J.unit}`.trim();return`Liian pieni: arvon täytyy olla ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${z.prefix}"`;if(z.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${z.suffix}"`;if(z.format==="includes")return`Virheellinen syöte: täytyy sisältää "${z.includes}"`;if(z.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${z.pattern}`;return`Virheellinen ${g[z.format]??U.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${U.divisor} monikerta`;case"unrecognized_keys":return`${U.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${A(U.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function c8(){return{localeError:IL()}}var qL=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(U){return $[U]??null}let g={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN",number:"nombre",array:"tableau"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : instanceof ${U.expected} attendu, ${G} reçu`;return`Entrée invalide : ${z} attendu, ${G} reçu`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : ${u(U.values[0])} attendu`;return`Option invalide : une valeur parmi ${A(U.values,"|")} attendue`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Trop grand : ${U.origin??"valeur"} doit ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"élément(s)"}`;return`Trop grand : ${U.origin??"valeur"} doit être ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Trop petit : ${U.origin} doit ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Trop petit : ${U.origin} doit être ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${z.pattern}`;return`${g[z.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${A(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function i8(){return{localeError:qL()}}var XL=()=>{let $={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function v(U){return $[U]??null}let g={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Entrée invalide : attendu instanceof ${U.expected}, reçu ${G}`;return`Entrée invalide : attendu ${z}, reçu ${G}`}case"invalid_value":if(U.values.length===1)return`Entrée invalide : attendu ${u(U.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"≤":"<",J=v(U.origin);if(J)return`Trop grand : attendu que ${U.origin??"la valeur"} ait ${z}${U.maximum.toString()} ${J.unit}`;return`Trop grand : attendu que ${U.origin??"la valeur"} soit ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"≥":">",J=v(U.origin);if(J)return`Trop petit : attendu que ${U.origin} ait ${z}${U.minimum.toString()} ${J.unit}`;return`Trop petit : attendu que ${U.origin} soit ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chaîne invalide : doit commencer par "${z.prefix}"`;if(z.format==="ends_with")return`Chaîne invalide : doit se terminer par "${z.suffix}"`;if(z.format==="includes")return`Chaîne invalide : doit inclure "${z.includes}"`;if(z.format==="regex")return`Chaîne invalide : doit correspondre au motif ${z.pattern}`;return`${g[z.format]??U.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${U.divisor}`;case"unrecognized_keys":return`Clé${U.keys.length>1?"s":""} non reconnue${U.keys.length>1?"s":""} : ${A(U.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${U.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${U.origin}`;default:return"Entrée invalide"}}};function x8(){return{localeError:XL()}}var FL=()=>{let $={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},v={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},g=(O)=>O?$[O]:void 0,_=(O)=>{let W=g(O);if(W)return W.label;return O??$.unknown.label},U=(O)=>`ה${_(O)}`,z=(O)=>{return(g(O)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות"},J=(O)=>{if(!O)return null;return v[O]??null},G={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},K={nan:"NaN"};return(O)=>{switch(O.code){case"invalid_type":{let W=O.expected,B=K[W??""]??_(W),k=T(O.input),P=K[k]??$[k]?.label??k;if(/^[A-Z]/.test(O.expected))return`קלט לא תקין: צריך להיות instanceof ${O.expected}, התקבל ${P}`;return`קלט לא תקין: צריך להיות ${B}, התקבל ${P}`}case"invalid_value":{if(O.values.length===1)return`ערך לא תקין: הערך חייב להיות ${u(O.values[0])}`;let W=O.values.map((P)=>u(P));if(O.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${W[0]} או ${W[1]}`;let B=W[W.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${W.slice(0,-1).join(", ")} או ${B}`}case"too_big":{let W=J(O.origin),B=U(O.origin??"value");if(O.origin==="string")return`${W?.longLabel??"ארוך"} מדי: ${B} צריכה להכיל ${O.maximum.toString()} ${W?.unit??""} ${O.inclusive?"או פחות":"לכל היותר"}`.trim();if(O.origin==="number"){let X=O.inclusive?`קטן או שווה ל-${O.maximum}`:`קטן מ-${O.maximum}`;return`גדול מדי: ${B} צריך להיות ${X}`}if(O.origin==="array"||O.origin==="set"){let X=O.origin==="set"?"צריכה":"צריך",L=O.inclusive?`${O.maximum} ${W?.unit??""} או פחות`:`פחות מ-${O.maximum} ${W?.unit??""}`;return`גדול מדי: ${B} ${X} להכיל ${L}`.trim()}let k=O.inclusive?"<=":"<",P=z(O.origin??"value");if(W?.unit)return`${W.longLabel} מדי: ${B} ${P} ${k}${O.maximum.toString()} ${W.unit}`;return`${W?.longLabel??"גדול"} מדי: ${B} ${P} ${k}${O.maximum.toString()}`}case"too_small":{let W=J(O.origin),B=U(O.origin??"value");if(O.origin==="string")return`${W?.shortLabel??"קצר"} מדי: ${B} צריכה להכיל ${O.minimum.toString()} ${W?.unit??""} ${O.inclusive?"או יותר":"לפחות"}`.trim();if(O.origin==="number"){let X=O.inclusive?`גדול או שווה ל-${O.minimum}`:`גדול מ-${O.minimum}`;return`קטן מדי: ${B} צריך להיות ${X}`}if(O.origin==="array"||O.origin==="set"){let X=O.origin==="set"?"צריכה":"צריך";if(O.minimum===1&&O.inclusive){let Y=O.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${B} ${X} להכיל ${Y}`}let L=O.inclusive?`${O.minimum} ${W?.unit??""} או יותר`:`יותר מ-${O.minimum} ${W?.unit??""}`;return`קטן מדי: ${B} ${X} להכיל ${L}`.trim()}let k=O.inclusive?">=":">",P=z(O.origin??"value");if(W?.unit)return`${W.shortLabel} מדי: ${B} ${P} ${k}${O.minimum.toString()} ${W.unit}`;return`${W?.shortLabel??"קטן"} מדי: ${B} ${P} ${k}${O.minimum.toString()}`}case"invalid_format":{let W=O;if(W.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${W.prefix}"`;if(W.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${W.suffix}"`;if(W.format==="includes")return`המחרוזת חייבת לכלול "${W.includes}"`;if(W.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${W.pattern}`;let B=G[W.format],k=B?.label??W.format,X=(B?.gender??"m")==="f"?"תקינה":"תקין";return`${k} לא ${X}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${O.divisor}`;case"unrecognized_keys":return`מפתח${O.keys.length>1?"ות":""} לא מזוה${O.keys.length>1?"ים":"ה"}: ${A(O.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${U(O.origin??"array")}`;default:return"קלט לא תקין"}}};function h8(){return{localeError:FL()}}var wL=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function v(U){return $[U]??null}let g={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},_={nan:"NaN",number:"szám",array:"tömb"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Érvénytelen bemenet: a várt érték instanceof ${U.expected}, a kapott érték ${G}`;return`Érvénytelen bemenet: a várt érték ${z}, a kapott érték ${G}`}case"invalid_value":if(U.values.length===1)return`Érvénytelen bemenet: a várt érték ${u(U.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Túl nagy: ${U.origin??"érték"} mérete túl nagy ${z}${U.maximum.toString()} ${J.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${U.origin??"érték"} túl nagy: ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Túl kicsi: a bemeneti érték ${U.origin} mérete túl kicsi ${z}${U.minimum.toString()} ${J.unit}`;return`Túl kicsi: a bemeneti érték ${U.origin} túl kicsi ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Érvénytelen string: "${z.prefix}" értékkel kell kezdődnie`;if(z.format==="ends_with")return`Érvénytelen string: "${z.suffix}" értékkel kell végződnie`;if(z.format==="includes")return`Érvénytelen string: "${z.includes}" értéket kell tartalmaznia`;if(z.format==="regex")return`Érvénytelen string: ${z.pattern} mintának kell megfelelnie`;return`Érvénytelen ${g[z.format]??U.format}`}case"not_multiple_of":return`Érvénytelen szám: ${U.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${U.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${U.origin}`;default:return"Érvénytelen bemenet"}}};function l8(){return{localeError:wL()}}function O7($,v,g){return Math.abs($)===1?v:g}function p4($){if(!$)return"";let v=["ա","ե","ը","ի","ո","ու","օ"],g=$[$.length-1];return $+(v.includes(g)?"ն":"ը")}var AL=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function v(U){return $[U]??null}let g={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},_={nan:"NaN",number:"թիվ",array:"զանգված"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${U.expected}, ստացվել է ${G}`;return`Սխալ մուտքագրում․ սպասվում էր ${z}, ստացվել է ${G}`}case"invalid_value":if(U.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${u(U.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let G=Number(U.maximum),K=O7(G,J.unit.one,J.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${p4(U.origin??"արժեք")} կունենա ${z}${U.maximum.toString()} ${K}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${p4(U.origin??"արժեք")} լինի ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let G=Number(U.minimum),K=O7(G,J.unit.one,J.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${p4(U.origin)} կունենա ${z}${U.minimum.toString()} ${K}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${p4(U.origin)} լինի ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${z.prefix}"-ով`;if(z.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${z.suffix}"-ով`;if(z.format==="includes")return`Սխալ տող․ պետք է պարունակի "${z.includes}"`;if(z.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${z.pattern} ձևաչափին`;return`Սխալ ${g[z.format]??U.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${U.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${U.keys.length>1?"ներ":""}. ${A(U.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${p4(U.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${p4(U.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function p8(){return{localeError:AL()}}var ZL=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function v(U){return $[U]??null}let g={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input tidak valid: diharapkan instanceof ${U.expected}, diterima ${G}`;return`Input tidak valid: diharapkan ${z}, diterima ${G}`}case"invalid_value":if(U.values.length===1)return`Input tidak valid: diharapkan ${u(U.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Terlalu besar: diharapkan ${U.origin??"value"} memiliki ${z}${U.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: diharapkan ${U.origin??"value"} menjadi ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Terlalu kecil: diharapkan ${U.origin} memiliki ${z}${U.minimum.toString()} ${J.unit}`;return`Terlalu kecil: diharapkan ${U.origin} menjadi ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`String tidak valid: harus dimulai dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak valid: harus berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak valid: harus menyertakan "${z.includes}"`;if(z.format==="regex")return`String tidak valid: harus sesuai pola ${z.pattern}`;return`${g[z.format]??U.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${U.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${U.origin}`;default:return"Input tidak valid"}}};function o8(){return{localeError:ZL()}}var QL=()=>{let $={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function v(U){return $[U]??null}let g={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},_={nan:"NaN",number:"númer",array:"fylki"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Rangt gildi: Þú slóst inn ${G} þar sem á að vera instanceof ${U.expected}`;return`Rangt gildi: Þú slóst inn ${G} þar sem á að vera ${z}`}case"invalid_value":if(U.values.length===1)return`Rangt gildi: gert ráð fyrir ${u(U.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} hafi ${z}${U.maximum.toString()} ${J.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${U.origin??"gildi"} sé ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Of lítið: gert er ráð fyrir að ${U.origin} hafi ${z}${U.minimum.toString()} ${J.unit}`;return`Of lítið: gert er ráð fyrir að ${U.origin} sé ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ógildur strengur: verður að byrja á "${z.prefix}"`;if(z.format==="ends_with")return`Ógildur strengur: verður að enda á "${z.suffix}"`;if(z.format==="includes")return`Ógildur strengur: verður að innihalda "${z.includes}"`;if(z.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${z.pattern}`;return`Rangt ${g[z.format]??U.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${U.divisor}`;case"unrecognized_keys":return`Óþekkt ${U.keys.length>1?"ir lyklar":"ur lykill"}: ${A(U.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${U.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${U.origin}`;default:return"Rangt gildi"}}};function n8(){return{localeError:QL()}}var ML=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function v(U){return $[U]??null}let g={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"numero",array:"vettore"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input non valido: atteso instanceof ${U.expected}, ricevuto ${G}`;return`Input non valido: atteso ${z}, ricevuto ${G}`}case"invalid_value":if(U.values.length===1)return`Input non valido: atteso ${u(U.values[0])}`;return`Opzione non valida: atteso uno tra ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Troppo grande: ${U.origin??"valore"} deve avere ${z}${U.maximum.toString()} ${J.unit??"elementi"}`;return`Troppo grande: ${U.origin??"valore"} deve essere ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Troppo piccolo: ${U.origin} deve avere ${z}${U.minimum.toString()} ${J.unit}`;return`Troppo piccolo: ${U.origin} deve essere ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Stringa non valida: deve iniziare con "${z.prefix}"`;if(z.format==="ends_with")return`Stringa non valida: deve terminare con "${z.suffix}"`;if(z.format==="includes")return`Stringa non valida: deve includere "${z.includes}"`;if(z.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${U.divisor}`;case"unrecognized_keys":return`Chiav${U.keys.length>1?"i":"e"} non riconosciut${U.keys.length>1?"e":"a"}: ${A(U.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${U.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${U.origin}`;default:return"Input non valido"}}};function t8(){return{localeError:ML()}}var SL=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function v(U){return $[U]??null}let g={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},_={nan:"NaN",number:"数値",array:"配列"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`無効な入力: instanceof ${U.expected}が期待されましたが、${G}が入力されました`;return`無効な入力: ${z}が期待されましたが、${G}が入力されました`}case"invalid_value":if(U.values.length===1)return`無効な入力: ${u(U.values[0])}が期待されました`;return`無効な選択: ${A(U.values,"、")}のいずれかである必要があります`;case"too_big":{let z=U.inclusive?"以下である":"より小さい",J=v(U.origin);if(J)return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${J.unit??"要素"}${z}必要があります`;return`大きすぎる値: ${U.origin??"値"}は${U.maximum.toString()}${z}必要があります`}case"too_small":{let z=U.inclusive?"以上である":"より大きい",J=v(U.origin);if(J)return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${J.unit}${z}必要があります`;return`小さすぎる値: ${U.origin}は${U.minimum.toString()}${z}必要があります`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`無効な文字列: "${z.prefix}"で始まる必要があります`;if(z.format==="ends_with")return`無効な文字列: "${z.suffix}"で終わる必要があります`;if(z.format==="includes")return`無効な文字列: "${z.includes}"を含む必要があります`;if(z.format==="regex")return`無効な文字列: パターン${z.pattern}に一致する必要があります`;return`無効な${g[z.format]??U.format}`}case"not_multiple_of":return`無効な数値: ${U.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${U.keys.length>1?"群":""}: ${A(U.keys,"、")}`;case"invalid_key":return`${U.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${U.origin}内の無効な値`;default:return"無効な入力"}}};function d8(){return{localeError:SL()}}var NL=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function v(U){return $[U]??null}let g={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},_={nan:"NaN",number:"რიცხვი",string:"სტრინგი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${U.expected}, მიღებული ${G}`;return`არასწორი შეყვანა: მოსალოდნელი ${z}, მიღებული ${G}`}case"invalid_value":if(U.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${u(U.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${A(U.values,"|")}-დან`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${U.origin??"მნიშვნელობა"} იყოს ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${U.origin} იყოს ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`არასწორი სტრინგი: უნდა იწყებოდეს "${z.prefix}"-ით`;if(z.format==="ends_with")return`არასწორი სტრინგი: უნდა მთავრდებოდეს "${z.suffix}"-ით`;if(z.format==="includes")return`არასწორი სტრინგი: უნდა შეიცავდეს "${z.includes}"-ს`;if(z.format==="regex")return`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${z.pattern}`;return`არასწორი ${g[z.format]??U.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${U.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${U.keys.length>1?"ები":"ი"}: ${A(U.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${U.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${U.origin}-ში`;default:return"არასწორი შეყვანა"}}};function a8(){return{localeError:NL()}}var yL=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function v(U){return $[U]??null}let g={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},_={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${U.expected} ប៉ុន្តែទទួលបាន ${G}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${z} ប៉ុន្តែទទួលបាន ${G}`}case"invalid_value":if(U.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${u(U.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${z} ${U.maximum.toString()} ${J.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${U.origin??"តម្លៃ"} ${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`តូចពេក៖ ត្រូវការ ${U.origin} ${z} ${U.minimum.toString()} ${J.unit}`;return`តូចពេក៖ ត្រូវការ ${U.origin} ${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${z.prefix}"`;if(z.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${z.suffix}"`;if(z.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${z.includes}"`;if(z.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${z.pattern}`;return`មិនត្រឹមត្រូវ៖ ${g[z.format]??U.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${U.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${A(U.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${U.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Og(){return{localeError:yL()}}function s8(){return Og()}var DL=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function v(U){return $[U]??null}let g={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`잘못된 입력: 예상 타입은 instanceof ${U.expected}, 받은 타입은 ${G}입니다`;return`잘못된 입력: 예상 타입은 ${z}, 받은 타입은 ${G}입니다`}case"invalid_value":if(U.values.length===1)return`잘못된 입력: 값은 ${u(U.values[0])} 이어야 합니다`;return`잘못된 옵션: ${A(U.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let z=U.inclusive?"이하":"미만",J=z==="미만"?"이어야 합니다":"여야 합니다",G=v(U.origin),K=G?.unit??"요소";if(G)return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()}${K} ${z}${J}`;return`${U.origin??"값"}이 너무 큽니다: ${U.maximum.toString()} ${z}${J}`}case"too_small":{let z=U.inclusive?"이상":"초과",J=z==="이상"?"이어야 합니다":"여야 합니다",G=v(U.origin),K=G?.unit??"요소";if(G)return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()}${K} ${z}${J}`;return`${U.origin??"값"}이 너무 작습니다: ${U.minimum.toString()} ${z}${J}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`잘못된 문자열: "${z.prefix}"(으)로 시작해야 합니다`;if(z.format==="ends_with")return`잘못된 문자열: "${z.suffix}"(으)로 끝나야 합니다`;if(z.format==="includes")return`잘못된 문자열: "${z.includes}"을(를) 포함해야 합니다`;if(z.format==="regex")return`잘못된 문자열: 정규식 ${z.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${g[z.format]??U.format}`}case"not_multiple_of":return`잘못된 숫자: ${U.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${A(U.keys,", ")}`;case"invalid_key":return`잘못된 키: ${U.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${U.origin}`;default:return"잘못된 입력"}}};function e8(){return{localeError:DL()}}var Wg=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function W7($){let v=Math.abs($),g=v%10,_=v%100;if(_>=11&&_<=19||g===0)return"many";if(g===1)return"one";return"few"}var RL=()=>{let $={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function v(U,z,J,G){let K=$[U]??null;if(K===null)return K;return{unit:K.unit[z],verb:K.verb[G][J?"inclusive":"notInclusive"]}}let g={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},_={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Gautas tipas ${G}, o tikėtasi - instanceof ${U.expected}`;return`Gautas tipas ${G}, o tikėtasi - ${z}`}case"invalid_value":if(U.values.length===1)return`Privalo būti ${u(U.values[0])}`;return`Privalo būti vienas iš ${A(U.values,"|")} pasirinkimų`;case"too_big":{let z=_[U.origin]??U.origin,J=v(U.origin,W7(Number(U.maximum)),U.inclusive??!1,"smaller");if(J?.verb)return`${Wg(z??U.origin??"reikšmė")} ${J.verb} ${U.maximum.toString()} ${J.unit??"elementų"}`;let G=U.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Wg(z??U.origin??"reikšmė")} turi būti ${G} ${U.maximum.toString()} ${J?.unit}`}case"too_small":{let z=_[U.origin]??U.origin,J=v(U.origin,W7(Number(U.minimum)),U.inclusive??!1,"bigger");if(J?.verb)return`${Wg(z??U.origin??"reikšmė")} ${J.verb} ${U.minimum.toString()} ${J.unit??"elementų"}`;let G=U.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Wg(z??U.origin??"reikšmė")} turi būti ${G} ${U.minimum.toString()} ${J?.unit}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Eilutė privalo prasidėti "${z.prefix}"`;if(z.format==="ends_with")return`Eilutė privalo pasibaigti "${z.suffix}"`;if(z.format==="includes")return`Eilutė privalo įtraukti "${z.includes}"`;if(z.format==="regex")return`Eilutė privalo atitikti ${z.pattern}`;return`Neteisingas ${g[z.format]??U.format}`}case"not_multiple_of":return`Skaičius privalo būti ${U.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${U.keys.length>1?"i":"as"} rakt${U.keys.length>1?"ai":"as"}: ${A(U.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let z=_[U.origin]??U.origin;return`${Wg(z??U.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function $9(){return{localeError:RL()}}var uL=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function v(U){return $[U]??null}let g={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},_={nan:"NaN",number:"број",array:"низа"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Грешен внес: се очекува instanceof ${U.expected}, примено ${G}`;return`Грешен внес: се очекува ${z}, примено ${G}`}case"invalid_value":if(U.values.length===1)return`Invalid input: expected ${u(U.values[0])}`;return`Грешана опција: се очекува една ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Премногу голем: се очекува ${U.origin??"вредноста"} да има ${z}${U.maximum.toString()} ${J.unit??"елементи"}`;return`Премногу голем: се очекува ${U.origin??"вредноста"} да биде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Премногу мал: се очекува ${U.origin} да има ${z}${U.minimum.toString()} ${J.unit}`;return`Премногу мал: се очекува ${U.origin} да биде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неважечка низа: мора да започнува со "${z.prefix}"`;if(z.format==="ends_with")return`Неважечка низа: мора да завршува со "${z.suffix}"`;if(z.format==="includes")return`Неважечка низа: мора да вклучува "${z.includes}"`;if(z.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${z.pattern}`;return`Invalid ${g[z.format]??U.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${A(U.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${U.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${U.origin}`;default:return"Грешен внес"}}};function v9(){return{localeError:uL()}}var TL=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function v(U){return $[U]??null}let g={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"nombor"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Input tidak sah: dijangka instanceof ${U.expected}, diterima ${G}`;return`Input tidak sah: dijangka ${z}, diterima ${G}`}case"invalid_value":if(U.values.length===1)return`Input tidak sah: dijangka ${u(U.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Terlalu besar: dijangka ${U.origin??"nilai"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: dijangka ${U.origin??"nilai"} adalah ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Terlalu kecil: dijangka ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Terlalu kecil: dijangka ${U.origin} adalah ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`String tidak sah: mesti bermula dengan "${z.prefix}"`;if(z.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${z.suffix}"`;if(z.format==="includes")return`String tidak sah: mesti mengandungi "${z.includes}"`;if(z.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${z.pattern}`;return`${g[z.format]??U.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${U.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${A(U.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${U.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${U.origin}`;default:return"Input tidak sah"}}};function U9(){return{localeError:TL()}}var jL=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function v(U){return $[U]??null}let g={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},_={nan:"NaN",number:"getal"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ongeldige invoer: verwacht instanceof ${U.expected}, ontving ${G}`;return`Ongeldige invoer: verwacht ${z}, ontving ${G}`}case"invalid_value":if(U.values.length===1)return`Ongeldige invoer: verwacht ${u(U.values[0])}`;return`Ongeldige optie: verwacht één van ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin),G=U.origin==="date"?"laat":U.origin==="string"?"lang":"groot";if(J)return`Te ${G}: verwacht dat ${U.origin??"waarde"} ${z}${U.maximum.toString()} ${J.unit??"elementen"} ${J.verb}`;return`Te ${G}: verwacht dat ${U.origin??"waarde"} ${z}${U.maximum.toString()} is`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin),G=U.origin==="date"?"vroeg":U.origin==="string"?"kort":"klein";if(J)return`Te ${G}: verwacht dat ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ${J.verb}`;return`Te ${G}: verwacht dat ${U.origin} ${z}${U.minimum.toString()} is`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ongeldige tekst: moet met "${z.prefix}" beginnen`;if(z.format==="ends_with")return`Ongeldige tekst: moet op "${z.suffix}" eindigen`;if(z.format==="includes")return`Ongeldige tekst: moet "${z.includes}" bevatten`;if(z.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${z.pattern}`;return`Ongeldig: ${g[z.format]??U.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${U.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${U.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${U.origin}`;default:return"Ongeldige invoer"}}};function g9(){return{localeError:jL()}}var rL=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function v(U){return $[U]??null}let g={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"tall",array:"liste"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ugyldig input: forventet instanceof ${U.expected}, fikk ${G}`;return`Ugyldig input: forventet ${z}, fikk ${G}`}case"invalid_value":if(U.values.length===1)return`Ugyldig verdi: forventet ${u(U.values[0])}`;return`Ugyldig valg: forventet en av ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`For stor(t): forventet ${U.origin??"value"} til å ha ${z}${U.maximum.toString()} ${J.unit??"elementer"}`;return`For stor(t): forventet ${U.origin??"value"} til å ha ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`For lite(n): forventet ${U.origin} til å ha ${z}${U.minimum.toString()} ${J.unit}`;return`For lite(n): forventet ${U.origin} til å ha ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ugyldig streng: må starte med "${z.prefix}"`;if(z.format==="ends_with")return`Ugyldig streng: må ende med "${z.suffix}"`;if(z.format==="includes")return`Ugyldig streng: må inneholde "${z.includes}"`;if(z.format==="regex")return`Ugyldig streng: må matche mønsteret ${z.pattern}`;return`Ugyldig ${g[z.format]??U.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${U.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${U.origin}`;default:return"Ugyldig input"}}};function _9(){return{localeError:rL()}}var VL=()=>{let $={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function v(U){return $[U]??null}let g={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},_={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Fâsit giren: umulan instanceof ${U.expected}, alınan ${G}`;return`Fâsit giren: umulan ${z}, alınan ${G}`}case"invalid_value":if(U.values.length===1)return`Fâsit giren: umulan ${u(U.values[0])}`;return`Fâsit tercih: mûteberler ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Fazla büyük: ${U.origin??"value"}, ${z}${U.maximum.toString()} ${J.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${U.origin??"value"}, ${z}${U.maximum.toString()} olmalıydı.`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Fazla küçük: ${U.origin}, ${z}${U.minimum.toString()} ${J.unit} sahip olmalıydı.`;return`Fazla küçük: ${U.origin}, ${z}${U.minimum.toString()} olmalıydı.`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Fâsit metin: "${z.prefix}" ile başlamalı.`;if(z.format==="ends_with")return`Fâsit metin: "${z.suffix}" ile bitmeli.`;if(z.format==="includes")return`Fâsit metin: "${z.includes}" ihtivâ etmeli.`;if(z.format==="regex")return`Fâsit metin: ${z.pattern} nakşına uymalı.`;return`Fâsit ${g[z.format]??U.format}`}case"not_multiple_of":return`Fâsit sayı: ${U.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${U.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function z9(){return{localeError:VL()}}var CL=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function v(U){return $[U]??null}let g={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},_={nan:"NaN",number:"عدد",array:"ارې"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ناسم ورودي: باید instanceof ${U.expected} وای, مګر ${G} ترلاسه شو`;return`ناسم ورودي: باید ${z} وای, مګر ${G} ترلاسه شو`}case"invalid_value":if(U.values.length===1)return`ناسم ورودي: باید ${u(U.values[0])} وای`;return`ناسم انتخاب: باید یو له ${A(U.values,"|")} څخه وای`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`ډیر لوی: ${U.origin??"ارزښت"} باید ${z}${U.maximum.toString()} ${J.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${U.origin??"ارزښت"} باید ${z}${U.maximum.toString()} وي`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`ډیر کوچنی: ${U.origin} باید ${z}${U.minimum.toString()} ${J.unit} ولري`;return`ډیر کوچنی: ${U.origin} باید ${z}${U.minimum.toString()} وي`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`ناسم متن: باید د "${z.prefix}" سره پیل شي`;if(z.format==="ends_with")return`ناسم متن: باید د "${z.suffix}" سره پای ته ورسيږي`;if(z.format==="includes")return`ناسم متن: باید "${z.includes}" ولري`;if(z.format==="regex")return`ناسم متن: باید د ${z.pattern} سره مطابقت ولري`;return`${g[z.format]??U.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${U.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${U.keys.length>1?"کلیډونه":"کلیډ"}: ${A(U.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${U.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${U.origin} کې`;default:return"ناسمه ورودي"}}};function J9(){return{localeError:CL()}}var fL=()=>{let $={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function v(U){return $[U]??null}let g={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},_={nan:"NaN",number:"liczba",array:"tablica"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${U.expected}, otrzymano ${G}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${z}, otrzymano ${G}`}case"invalid_value":if(U.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${u(U.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Za duża wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${z}${U.maximum.toString()} ${J.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Za mała wartość: oczekiwano, że ${U.origin??"wartość"} będzie mieć ${z}${U.minimum.toString()} ${J.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${U.origin??"wartość"} będzie wynosić ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${z.prefix}"`;if(z.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${z.suffix}"`;if(z.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${z.includes}"`;if(z.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${z.pattern}`;return`Nieprawidłow(y/a/e) ${g[z.format]??U.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${U.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${U.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${U.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function G9(){return{localeError:fL()}}var EL=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function v(U){return $[U]??null}let g={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},_={nan:"NaN",number:"número",null:"nulo"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Tipo inválido: esperado instanceof ${U.expected}, recebido ${G}`;return`Tipo inválido: esperado ${z}, recebido ${G}`}case"invalid_value":if(U.values.length===1)return`Entrada inválida: esperado ${u(U.values[0])}`;return`Opção inválida: esperada uma das ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Muito grande: esperado que ${U.origin??"valor"} tivesse ${z}${U.maximum.toString()} ${J.unit??"elementos"}`;return`Muito grande: esperado que ${U.origin??"valor"} fosse ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Muito pequeno: esperado que ${U.origin} tivesse ${z}${U.minimum.toString()} ${J.unit}`;return`Muito pequeno: esperado que ${U.origin} fosse ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Texto inválido: deve começar com "${z.prefix}"`;if(z.format==="ends_with")return`Texto inválido: deve terminar com "${z.suffix}"`;if(z.format==="includes")return`Texto inválido: deve incluir "${z.includes}"`;if(z.format==="regex")return`Texto inválido: deve corresponder ao padrão ${z.pattern}`;return`${g[z.format]??U.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${U.divisor}`;case"unrecognized_keys":return`Chave${U.keys.length>1?"s":""} desconhecida${U.keys.length>1?"s":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Chave inválida em ${U.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${U.origin}`;default:return"Campo inválido"}}};function b9(){return{localeError:EL()}}function B7($,v,g,_){let U=Math.abs($),z=U%10,J=U%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return g;return _}var mL=()=>{let $={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function v(U){return $[U]??null}let g={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},_={nan:"NaN",number:"число",array:"массив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Неверный ввод: ожидалось instanceof ${U.expected}, получено ${G}`;return`Неверный ввод: ожидалось ${z}, получено ${G}`}case"invalid_value":if(U.values.length===1)return`Неверный ввод: ожидалось ${u(U.values[0])}`;return`Неверный вариант: ожидалось одно из ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J){let G=Number(U.maximum),K=B7(G,J.unit.one,J.unit.few,J.unit.many);return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет иметь ${z}${U.maximum.toString()} ${K}`}return`Слишком большое значение: ожидалось, что ${U.origin??"значение"} будет ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J){let G=Number(U.minimum),K=B7(G,J.unit.one,J.unit.few,J.unit.many);return`Слишком маленькое значение: ожидалось, что ${U.origin} будет иметь ${z}${U.minimum.toString()} ${K}`}return`Слишком маленькое значение: ожидалось, что ${U.origin} будет ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неверная строка: должна начинаться с "${z.prefix}"`;if(z.format==="ends_with")return`Неверная строка: должна заканчиваться на "${z.suffix}"`;if(z.format==="includes")return`Неверная строка: должна содержать "${z.includes}"`;if(z.format==="regex")return`Неверная строка: должна соответствовать шаблону ${z.pattern}`;return`Неверный ${g[z.format]??U.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${U.divisor}`;case"unrecognized_keys":return`Нераспознанн${U.keys.length>1?"ые":"ый"} ключ${U.keys.length>1?"и":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${U.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${U.origin}`;default:return"Неверные входные данные"}}};function K9(){return{localeError:mL()}}var cL=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function v(U){return $[U]??null}let g={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},_={nan:"NaN",number:"število",array:"tabela"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Neveljaven vnos: pričakovano instanceof ${U.expected}, prejeto ${G}`;return`Neveljaven vnos: pričakovano ${z}, prejeto ${G}`}case"invalid_value":if(U.values.length===1)return`Neveljaven vnos: pričakovano ${u(U.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} imelo ${z}${U.maximum.toString()} ${J.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${U.origin??"vrednost"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Premajhno: pričakovano, da bo ${U.origin} imelo ${z}${U.minimum.toString()} ${J.unit}`;return`Premajhno: pričakovano, da bo ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Neveljaven niz: mora se začeti z "${z.prefix}"`;if(z.format==="ends_with")return`Neveljaven niz: mora se končati z "${z.suffix}"`;if(z.format==="includes")return`Neveljaven niz: mora vsebovati "${z.includes}"`;if(z.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${z.pattern}`;return`Neveljaven ${g[z.format]??U.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${U.divisor}`;case"unrecognized_keys":return`Neprepoznan${U.keys.length>1?"i ključi":" ključ"}: ${A(U.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${U.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${U.origin}`;default:return"Neveljaven vnos"}}};function O9(){return{localeError:cL()}}var iL=()=>{let $={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function v(U){return $[U]??null}let g={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},_={nan:"NaN",number:"antal",array:"lista"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ogiltig inmatning: förväntat instanceof ${U.expected}, fick ${G}`;return`Ogiltig inmatning: förväntat ${z}, fick ${G}`}case"invalid_value":if(U.values.length===1)return`Ogiltig inmatning: förväntat ${u(U.values[0])}`;return`Ogiltigt val: förväntade en av ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`För stor(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.maximum.toString()} ${J.unit??"element"}`;return`För stor(t): förväntat ${U.origin??"värdet"} att ha ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.minimum.toString()} ${J.unit}`;return`För lite(t): förväntade ${U.origin??"värdet"} att ha ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ogiltig sträng: måste börja med "${z.prefix}"`;if(z.format==="ends_with")return`Ogiltig sträng: måste sluta med "${z.suffix}"`;if(z.format==="includes")return`Ogiltig sträng: måste innehålla "${z.includes}"`;if(z.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${z.pattern}"`;return`Ogiltig(t) ${g[z.format]??U.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${U.divisor}`;case"unrecognized_keys":return`${U.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${A(U.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${U.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${U.origin??"värdet"}`;default:return"Ogiltig input"}}};function W9(){return{localeError:iL()}}var xL=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function v(U){return $[U]??null}let g={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},_={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${U.expected}, பெறப்பட்டது ${G}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${z}, பெறப்பட்டது ${G}`}case"invalid_value":if(U.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${u(U.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${A(U.values,"|")} இல் ஒன்று`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${z}${U.maximum.toString()} ${J.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${U.origin??"மதிப்பு"} ${z}${U.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${U.origin} ${z}${U.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`தவறான சரம்: "${z.prefix}" இல் தொடங்க வேண்டும்`;if(z.format==="ends_with")return`தவறான சரம்: "${z.suffix}" இல் முடிவடைய வேண்டும்`;if(z.format==="includes")return`தவறான சரம்: "${z.includes}" ஐ உள்ளடக்க வேண்டும்`;if(z.format==="regex")return`தவறான சரம்: ${z.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${g[z.format]??U.format}`}case"not_multiple_of":return`தவறான எண்: ${U.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${U.keys.length>1?"கள்":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${U.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function B9(){return{localeError:xL()}}var hL=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function v(U){return $[U]??null}let g={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},_={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${U.expected} แต่ได้รับ ${G}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${z} แต่ได้รับ ${G}`}case"invalid_value":if(U.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${u(U.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"ไม่เกิน":"น้อยกว่า",J=v(U.origin);if(J)return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${z} ${U.maximum.toString()} ${J.unit??"รายการ"}`;return`เกินกำหนด: ${U.origin??"ค่า"} ควรมี${z} ${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?"อย่างน้อย":"มากกว่า",J=v(U.origin);if(J)return`น้อยกว่ากำหนด: ${U.origin} ควรมี${z} ${U.minimum.toString()} ${J.unit}`;return`น้อยกว่ากำหนด: ${U.origin} ควรมี${z} ${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${z.prefix}"`;if(z.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${z.suffix}"`;if(z.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${z.includes}" อยู่ในข้อความ`;if(z.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${z.pattern}`;return`รูปแบบไม่ถูกต้อง: ${g[z.format]??U.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${U.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${A(U.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${U.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${U.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function P9(){return{localeError:hL()}}var lL=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function v(U){return $[U]??null}let g={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Geçersiz değer: beklenen instanceof ${U.expected}, alınan ${G}`;return`Geçersiz değer: beklenen ${z}, alınan ${G}`}case"invalid_value":if(U.values.length===1)return`Geçersiz değer: beklenen ${u(U.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Çok büyük: beklenen ${U.origin??"değer"} ${z}${U.maximum.toString()} ${J.unit??"öğe"}`;return`Çok büyük: beklenen ${U.origin??"değer"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Çok küçük: beklenen ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`Çok küçük: beklenen ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Geçersiz metin: "${z.prefix}" ile başlamalı`;if(z.format==="ends_with")return`Geçersiz metin: "${z.suffix}" ile bitmeli`;if(z.format==="includes")return`Geçersiz metin: "${z.includes}" içermeli`;if(z.format==="regex")return`Geçersiz metin: ${z.pattern} desenine uymalı`;return`Geçersiz ${g[z.format]??U.format}`}case"not_multiple_of":return`Geçersiz sayı: ${U.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${U.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function k9(){return{localeError:lL()}}var pL=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function v(U){return $[U]??null}let g={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},_={nan:"NaN",number:"число",array:"масив"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Неправильні вхідні дані: очікується instanceof ${U.expected}, отримано ${G}`;return`Неправильні вхідні дані: очікується ${z}, отримано ${G}`}case"invalid_value":if(U.values.length===1)return`Неправильні вхідні дані: очікується ${u(U.values[0])}`;return`Неправильна опція: очікується одне з ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Занадто велике: очікується, що ${U.origin??"значення"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"елементів"}`;return`Занадто велике: очікується, що ${U.origin??"значення"} буде ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Занадто мале: очікується, що ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Занадто мале: очікується, що ${U.origin} буде ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Неправильний рядок: повинен починатися з "${z.prefix}"`;if(z.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${z.suffix}"`;if(z.format==="includes")return`Неправильний рядок: повинен містити "${z.includes}"`;if(z.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${z.pattern}`;return`Неправильний ${g[z.format]??U.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${U.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${U.keys.length>1?"і":""}: ${A(U.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${U.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${U.origin}`;default:return"Неправильні вхідні дані"}}};function Bg(){return{localeError:pL()}}function Y9(){return Bg()}var oL=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function v(U){return $[U]??null}let g={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},_={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`غلط ان پٹ: instanceof ${U.expected} متوقع تھا، ${G} موصول ہوا`;return`غلط ان پٹ: ${z} متوقع تھا، ${G} موصول ہوا`}case"invalid_value":if(U.values.length===1)return`غلط ان پٹ: ${u(U.values[0])} متوقع تھا`;return`غلط آپشن: ${A(U.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`بہت بڑا: ${U.origin??"ویلیو"} کے ${z}${U.maximum.toString()} ${J.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${U.origin??"ویلیو"} کا ${z}${U.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`بہت چھوٹا: ${U.origin} کے ${z}${U.minimum.toString()} ${J.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${U.origin} کا ${z}${U.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`غلط سٹرنگ: "${z.prefix}" سے شروع ہونا چاہیے`;if(z.format==="ends_with")return`غلط سٹرنگ: "${z.suffix}" پر ختم ہونا چاہیے`;if(z.format==="includes")return`غلط سٹرنگ: "${z.includes}" شامل ہونا چاہیے`;if(z.format==="regex")return`غلط سٹرنگ: پیٹرن ${z.pattern} سے میچ ہونا چاہیے`;return`غلط ${g[z.format]??U.format}`}case"not_multiple_of":return`غلط نمبر: ${U.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${U.keys.length>1?"ز":""}: ${A(U.keys,"، ")}`;case"invalid_key":return`${U.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${U.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function H9(){return{localeError:oL()}}var nL=()=>{let $={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"}};function v(U){return $[U]??null}let g={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},_={nan:"NaN",number:"raqam",array:"massiv"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${U.expected}, qabul qilingan ${G}`;return`Noto‘g‘ri kirish: kutilgan ${z}, qabul qilingan ${G}`}case"invalid_value":if(U.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${u(U.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Juda katta: kutilgan ${U.origin??"qiymat"} ${z}${U.maximum.toString()} ${J.unit} ${J.verb}`;return`Juda katta: kutilgan ${U.origin??"qiymat"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Juda kichik: kutilgan ${U.origin} ${z}${U.minimum.toString()} ${J.unit} ${J.verb}`;return`Juda kichik: kutilgan ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Noto‘g‘ri satr: "${z.prefix}" bilan boshlanishi kerak`;if(z.format==="ends_with")return`Noto‘g‘ri satr: "${z.suffix}" bilan tugashi kerak`;if(z.format==="includes")return`Noto‘g‘ri satr: "${z.includes}" ni o‘z ichiga olishi kerak`;if(z.format==="regex")return`Noto‘g‘ri satr: ${z.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${g[z.format]??U.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${U.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${U.keys.length>1?"lar":""}: ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${U.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function L9(){return{localeError:nL()}}var tL=()=>{let $={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function v(U){return $[U]??null}let g={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},_={nan:"NaN",number:"số",array:"mảng"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${U.expected}, nhận được ${G}`;return`Đầu vào không hợp lệ: mong đợi ${z}, nhận được ${G}`}case"invalid_value":if(U.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${u(U.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${J.verb} ${z}${U.maximum.toString()} ${J.unit??"phần tử"}`;return`Quá lớn: mong đợi ${U.origin??"giá trị"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Quá nhỏ: mong đợi ${U.origin} ${J.verb} ${z}${U.minimum.toString()} ${J.unit}`;return`Quá nhỏ: mong đợi ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${z.prefix}"`;if(z.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${z.suffix}"`;if(z.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${z.includes}"`;if(z.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${z.pattern}`;return`${g[z.format]??U.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${U.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${A(U.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${U.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${U.origin}`;default:return"Đầu vào không hợp lệ"}}};function I9(){return{localeError:tL()}}var dL=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function v(U){return $[U]??null}let g={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},_={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`无效输入:期望 instanceof ${U.expected},实际接收 ${G}`;return`无效输入:期望 ${z},实际接收 ${G}`}case"invalid_value":if(U.values.length===1)return`无效输入:期望 ${u(U.values[0])}`;return`无效选项:期望以下之一 ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`数值过大:期望 ${U.origin??"值"} ${z}${U.maximum.toString()} ${J.unit??"个元素"}`;return`数值过大:期望 ${U.origin??"值"} ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`数值过小:期望 ${U.origin} ${z}${U.minimum.toString()} ${J.unit}`;return`数值过小:期望 ${U.origin} ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`无效字符串:必须以 "${z.prefix}" 开头`;if(z.format==="ends_with")return`无效字符串:必须以 "${z.suffix}" 结尾`;if(z.format==="includes")return`无效字符串:必须包含 "${z.includes}"`;if(z.format==="regex")return`无效字符串:必须满足正则表达式 ${z.pattern}`;return`无效${g[z.format]??U.format}`}case"not_multiple_of":return`无效数字:必须是 ${U.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${A(U.keys,", ")}`;case"invalid_key":return`${U.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${U.origin} 中包含无效值(value)`;default:return"无效输入"}}};function q9(){return{localeError:dL()}}var aL=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function v(U){return $[U]??null}let g={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},_={nan:"NaN"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`無效的輸入值:預期為 instanceof ${U.expected},但收到 ${G}`;return`無效的輸入值:預期為 ${z},但收到 ${G}`}case"invalid_value":if(U.values.length===1)return`無效的輸入值:預期為 ${u(U.values[0])}`;return`無效的選項:預期為以下其中之一 ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`數值過大:預期 ${U.origin??"值"} 應為 ${z}${U.maximum.toString()} ${J.unit??"個元素"}`;return`數值過大:預期 ${U.origin??"值"} 應為 ${z}${U.maximum.toString()}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`數值過小:預期 ${U.origin} 應為 ${z}${U.minimum.toString()} ${J.unit}`;return`數值過小:預期 ${U.origin} 應為 ${z}${U.minimum.toString()}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`無效的字串:必須以 "${z.prefix}" 開頭`;if(z.format==="ends_with")return`無效的字串:必須以 "${z.suffix}" 結尾`;if(z.format==="includes")return`無效的字串:必須包含 "${z.includes}"`;if(z.format==="regex")return`無效的字串:必須符合格式 ${z.pattern}`;return`無效的 ${g[z.format]??U.format}`}case"not_multiple_of":return`無效的數字:必須為 ${U.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${U.keys.length>1?"們":""}:${A(U.keys,"、")}`;case"invalid_key":return`${U.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${U.origin} 中有無效的值`;default:return"無效的輸入值"}}};function X9(){return{localeError:aL()}}var sL=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function v(U){return $[U]??null}let g={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},_={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(U)=>{switch(U.code){case"invalid_type":{let z=_[U.expected]??U.expected,J=T(U.input),G=_[J]??J;if(/^[A-Z]/.test(U.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${U.expected}, àmọ̀ a rí ${G}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${z}, àmọ̀ a rí ${G}`}case"invalid_value":if(U.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${u(U.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${A(U.values,"|")}`;case"too_big":{let z=U.inclusive?"<=":"<",J=v(U.origin);if(J)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${U.origin??"iye"} ${J.verb} ${z}${U.maximum} ${J.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${z}${U.maximum}`}case"too_small":{let z=U.inclusive?">=":">",J=v(U.origin);if(J)return`Kéré ju: a ní láti jẹ́ pé ${U.origin} ${J.verb} ${z}${U.minimum} ${J.unit}`;return`Kéré ju: a ní láti jẹ́ ${z}${U.minimum}`}case"invalid_format":{let z=U;if(z.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${z.prefix}"`;if(z.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${z.suffix}"`;if(z.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${z.includes}"`;if(z.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${z.pattern}`;return`Aṣìṣe: ${g[z.format]??U.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${U.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${A(U.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${U.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${U.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function F9(){return{localeError:sL()}}var P7,w9=Symbol("ZodOutput"),A9=Symbol("ZodInput");class Z9{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...v){let g=v[0];if(this._map.set($,g),g&&typeof g==="object"&&"id"in g)this._idmap.set(g.id,$);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove($){let v=this._map.get($);if(v&&typeof v==="object"&&"id"in v)this._idmap.delete(v.id);return this._map.delete($),this}get($){let v=$._zod.parent;if(v){let g={...this.get(v)??{}};delete g.id;let _={...g,...this._map.get($)};return Object.keys(_).length?_:void 0}return this._map.get($)}has($){return this._map.has($)}}function Z1(){return new Z9}(P7=globalThis).__zod_globalRegistry??(P7.__zod_globalRegistry=Z1());var vv=globalThis.__zod_globalRegistry;function Q9($,v){return new $({type:"string",...V(v)})}function M9($,v){return new $({type:"string",coerce:!0,...V(v)})}function Q1($,v){return new $({type:"string",format:"email",check:"string_format",abort:!1,...V(v)})}function kg($,v){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...V(v)})}function M1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...V(v)})}function S1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...V(v)})}function N1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...V(v)})}function y1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...V(v)})}function Yg($,v){return new $({type:"string",format:"url",check:"string_format",abort:!1,...V(v)})}function D1($,v){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...V(v)})}function R1($,v){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...V(v)})}function u1($,v){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...V(v)})}function T1($,v){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...V(v)})}function j1($,v){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...V(v)})}function r1($,v){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...V(v)})}function V1($,v){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...V(v)})}function C1($,v){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...V(v)})}function f1($,v){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...V(v)})}function S9($,v){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...V(v)})}function E1($,v){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...V(v)})}function m1($,v){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...V(v)})}function c1($,v){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...V(v)})}function i1($,v){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...V(v)})}function x1($,v){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...V(v)})}function h1($,v){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...V(v)})}var N9={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function y9($,v){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...V(v)})}function D9($,v){return new $({type:"string",format:"date",check:"string_format",...V(v)})}function R9($,v){return new $({type:"string",format:"time",check:"string_format",precision:null,...V(v)})}function u9($,v){return new $({type:"string",format:"duration",check:"string_format",...V(v)})}function T9($,v){return new $({type:"number",checks:[],...V(v)})}function j9($,v){return new $({type:"number",coerce:!0,checks:[],...V(v)})}function r9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...V(v)})}function V9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...V(v)})}function C9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...V(v)})}function f9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...V(v)})}function E9($,v){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...V(v)})}function m9($,v){return new $({type:"boolean",...V(v)})}function c9($,v){return new $({type:"boolean",coerce:!0,...V(v)})}function i9($,v){return new $({type:"bigint",...V(v)})}function x9($,v){return new $({type:"bigint",coerce:!0,...V(v)})}function h9($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...V(v)})}function l9($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...V(v)})}function p9($,v){return new $({type:"symbol",...V(v)})}function o9($,v){return new $({type:"undefined",...V(v)})}function n9($,v){return new $({type:"null",...V(v)})}function t9($){return new $({type:"any"})}function d9($){return new $({type:"unknown"})}function a9($,v){return new $({type:"never",...V(v)})}function s9($,v){return new $({type:"void",...V(v)})}function e9($,v){return new $({type:"date",...V(v)})}function $G($,v){return new $({type:"date",coerce:!0,...V(v)})}function vG($,v){return new $({type:"nan",...V(v)})}function nv($,v){return new B1({check:"less_than",...V(v),value:$,inclusive:!1})}function Nv($,v){return new B1({check:"less_than",...V(v),value:$,inclusive:!0})}function tv($,v){return new P1({check:"greater_than",...V(v),value:$,inclusive:!1})}function Yv($,v){return new P1({check:"greater_than",...V(v),value:$,inclusive:!0})}function l1($){return tv(0,$)}function p1($){return nv(0,$)}function o1($){return Nv(0,$)}function n1($){return Yv(0,$)}function T6($,v){return new vJ({check:"multiple_of",...V(v),value:$})}function j6($,v){return new _J({check:"max_size",...V(v),maximum:$})}function dv($,v){return new zJ({check:"min_size",...V(v),minimum:$})}function K4($,v){return new JJ({check:"size_equals",...V(v),size:$})}function O4($,v){return new GJ({check:"max_length",...V(v),maximum:$})}function b6($,v){return new bJ({check:"min_length",...V(v),minimum:$})}function W4($,v){return new KJ({check:"length_equals",...V(v),length:$})}function o4($,v){return new OJ({check:"string_format",format:"regex",...V(v),pattern:$})}function n4($){return new WJ({check:"string_format",format:"lowercase",...V($)})}function t4($){return new BJ({check:"string_format",format:"uppercase",...V($)})}function d4($,v){return new PJ({check:"string_format",format:"includes",...V(v),includes:$})}function a4($,v){return new kJ({check:"string_format",format:"starts_with",...V(v),prefix:$})}function s4($,v){return new YJ({check:"string_format",format:"ends_with",...V(v),suffix:$})}function t1($,v,g){return new HJ({check:"property",property:$,schema:v,...V(g)})}function e4($,v){return new LJ({check:"mime_type",mime:$,...V(v)})}function Ev($){return new IJ({check:"overwrite",tx:$})}function $U($){return Ev((v)=>v.normalize($))}function vU(){return Ev(($)=>$.trim())}function UU(){return Ev(($)=>$.toLowerCase())}function gU(){return Ev(($)=>$.toUpperCase())}function _U(){return Ev(($)=>Iz($))}function UG($,v,g){return new $({type:"array",element:v,...V(g)})}function $I($,v,g){return new $({type:"union",options:v,...V(g)})}function vI($,v,g){return new $({type:"union",options:v,inclusive:!1,...V(g)})}function UI($,v,g,_){return new $({type:"union",options:g,discriminator:v,...V(_)})}function gI($,v,g){return new $({type:"intersection",left:v,right:g})}function _I($,v,g,_){let U=g instanceof $$;return new $({type:"tuple",items:v,rest:U?g:null,...V(U?_:g)})}function zI($,v,g,_){return new $({type:"record",keyType:v,valueType:g,...V(_)})}function JI($,v,g,_){return new $({type:"map",keyType:v,valueType:g,...V(_)})}function GI($,v,g){return new $({type:"set",valueType:v,...V(g)})}function bI($,v,g){let _=Array.isArray(v)?Object.fromEntries(v.map((U)=>[U,U])):v;return new $({type:"enum",entries:_,...V(g)})}function KI($,v,g){return new $({type:"enum",entries:v,...V(g)})}function OI($,v,g){return new $({type:"literal",values:Array.isArray(v)?v:[v],...V(g)})}function gG($,v){return new $({type:"file",...V(v)})}function WI($,v){return new $({type:"transform",transform:v})}function BI($,v){return new $({type:"optional",innerType:v})}function PI($,v){return new $({type:"nullable",innerType:v})}function kI($,v,g){return new $({type:"default",innerType:v,get defaultValue(){return typeof g==="function"?g():Xz(g)}})}function YI($,v,g){return new $({type:"nonoptional",innerType:v,...V(g)})}function HI($,v){return new $({type:"success",innerType:v})}function LI($,v,g){return new $({type:"catch",innerType:v,catchValue:typeof g==="function"?g:()=>g})}function II($,v,g){return new $({type:"pipe",in:v,out:g})}function qI($,v){return new $({type:"readonly",innerType:v})}function XI($,v,g){return new $({type:"template_literal",parts:v,...V(g)})}function FI($,v){return new $({type:"lazy",getter:v})}function wI($,v){return new $({type:"promise",innerType:v})}function _G($,v,g){let _=V(g);return _.abort??(_.abort=!0),new $({type:"custom",check:"custom",fn:v,..._})}function zG($,v,g){return new $({type:"custom",check:"custom",fn:v,...V(g)})}function JG($){let v=k7((g)=>{return g.addIssue=(_)=>{if(typeof _==="string")g.issues.push(E4(_,g.value,v._zod.def));else{let U=_;if(U.fatal)U.continue=!1;U.code??(U.code="custom"),U.input??(U.input=g.value),U.inst??(U.inst=v),U.continue??(U.continue=!v._zod.def.abort),g.issues.push(E4(U))}},$(g.value,g)});return v}function k7($,v){let g=new N$({check:"custom",...V(v)});return g._zod.check=$,g}function GG($){let v=new N$({check:"describe"});return v._zod.onattach=[(g)=>{let _=vv.get(g)??{};vv.add(g,{..._,description:$})}],v._zod.check=()=>{},v}function bG($){let v=new N$({check:"meta"});return v._zod.onattach=[(g)=>{let _=vv.get(g)??{};vv.add(g,{..._,...$})}],v._zod.check=()=>{},v}function KG($,v){let g=V(v),_=g.truthy??["true","1","yes","on","y","enabled"],U=g.falsy??["false","0","no","off","n","disabled"];if(g.case!=="sensitive")_=_.map((P)=>typeof P==="string"?P.toLowerCase():P),U=U.map((P)=>typeof P==="string"?P.toLowerCase():P);let z=new Set(_),J=new Set(U),G=$.Codec??bg,K=$.Boolean??Jg,W=new($.String??b4)({type:"string",error:g.error}),B=new K({type:"boolean",error:g.error}),k=new G({type:"pipe",in:W,out:B,transform:(P,X)=>{let L=P;if(g.case!=="sensitive")L=L.toLowerCase();if(z.has(L))return!0;else if(J.has(L))return!1;else return X.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...J],input:X.value,inst:k,continue:!1}),{}},reverseTransform:(P,X)=>{if(P===!0)return _[0]||"true";else return U[0]||"false"},error:g.error});return k}function zU($,v,g,_={}){let U=V(_),z={...V(_),check:"string_format",type:"string",format:v,fn:typeof g==="function"?g:(G)=>g.test(G),...U};if(g instanceof RegExp)z.pattern=g;return new $(z)}function r6($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";return{processors:$.processors??{},metadataRegistry:$?.metadata??vv,target:v,unrepresentable:$?.unrepresentable??"throw",override:$?.override??(()=>{}),io:$?.io??"output",counter:0,seen:new Map,cycles:$?.cycles??"ref",reused:$?.reused??"inline",external:$?.external??void 0}}function F$($,v,g={path:[],schemaPath:[]}){var _;let U=$._zod.def,z=v.seen.get($);if(z){if(z.count++,g.schemaPath.includes($))z.cycle=g.path;return z.schema}let J={schema:{},count:1,cycle:void 0,path:g.path};v.seen.set($,J);let G=$._zod.toJSONSchema?.();if(G)J.schema=G;else{let W={...g,schemaPath:[...g.schemaPath,$],path:g.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(v,J.schema,W);else{let k=J.schema,P=v.processors[U.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${U.type}`);P($,v,k,W)}let B=$._zod.parent;if(B){if(!J.ref)J.ref=B;F$(B,v,W),v.seen.get(B).isParent=!0}}let K=v.metadataRegistry.get($);if(K)Object.assign(J.schema,K);if(v.io==="input"&&Hv($))delete J.schema.examples,delete J.schema.default;if(v.io==="input"&&J.schema._prefault)(_=J.schema).default??(_.default=J.schema._prefault);return delete J.schema._prefault,v.seen.get($).schema}function V6($,v){let g=$.seen.get(v);if(!g)throw Error("Unprocessed schema. This is a bug in Zod.");let _=new Map;for(let J of $.seen.entries()){let G=$.metadataRegistry.get(J[0])?.id;if(G){let K=_.get(G);if(K&&K!==J[0])throw Error(`Duplicate schema id "${G}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);_.set(G,J[0])}}let U=(J)=>{let G=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let B=$.external.registry.get(J[0])?.id,k=$.external.uri??((X)=>X);if(B)return{ref:k(B)};let P=J[1].defId??J[1].schema.id??`schema${$.counter++}`;return J[1].defId=P,{defId:P,ref:`${k("__shared")}#/${G}/${P}`}}if(J[1]===g)return{ref:"#"};let O=`${"#"}/${G}/`,W=J[1].schema.id??`__schema${$.counter++}`;return{defId:W,ref:O+W}},z=(J)=>{if(J[1].schema.$ref)return;let G=J[1],{ref:K,defId:O}=U(J);if(G.def={...G.schema},O)G.defId=O;let W=G.schema;for(let B in W)delete W[B];W.$ref=K};if($.cycles==="throw")for(let J of $.seen.entries()){let G=J[1];if(G.cycle)throw Error(`Cycle detected: #/${G.cycle?.join("/")}/<root>
145
145
 
146
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of $.seen.entries()){let b=J[1];if(v===J[0]){z(J);continue}if($.external){let K=$.external.registry.get(J[0])?.id;if(v!==J[0]&&K){z(J);continue}}if($.metadataRegistry.get(J[0])?.id){z(J);continue}if(b.cycle){z(J);continue}if(b.count>1){if($.reused==="ref"){z(J);continue}}}}function C6($,v){let g=$.seen.get(v);if(!g)throw Error("Unprocessed schema. This is a bug in Zod.");let _=(J)=>{let b=$.seen.get(J);if(b.ref===null)return;let O=b.def??b.schema,K={...O},W=b.ref;if(b.ref=null,W){_(W);let k=$.seen.get(W),P=k.schema;if(P.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))O.allOf=O.allOf??[],O.allOf.push(P);else Object.assign(O,P);if(Object.assign(O,K),J._zod.parent===W)for(let Y in O){if(Y==="$ref"||Y==="allOf")continue;if(!(Y in K))delete O[Y]}if(P.$ref&&k.def)for(let Y in O){if(Y==="$ref"||Y==="allOf")continue;if(Y in k.def&&JSON.stringify(O[Y])===JSON.stringify(k.def[Y]))delete O[Y]}}let B=J._zod.parent;if(B&&B!==W){_(B);let k=$.seen.get(B);if(k?.schema.$ref){if(O.$ref=k.schema.$ref,k.def)for(let P in O){if(P==="$ref"||P==="allOf")continue;if(P in k.def&&JSON.stringify(O[P])===JSON.stringify(k.def[P]))delete O[P]}}}$.override({zodSchema:J,jsonSchema:O,path:b.path??[]})};for(let J of[...$.seen.entries()].reverse())_(J[0]);let U={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let J=$.external.registry.get(v)?.id;if(!J)throw Error("Schema is missing an `id` property");U.$id=$.external.uri(J)}Object.assign(U,g.def??g.schema);let z=$.external?.defs??{};for(let J of $.seen.entries()){let b=J[1];if(b.def&&b.defId)z[b.defId]=b.def}if($.external);else if(Object.keys(z).length>0)if($.target==="draft-2020-12")U.$defs=z;else U.definitions=z;try{let J=JSON.parse(JSON.stringify(U));return Object.defineProperty(J,"~standard",{value:{...v["~standard"],jsonSchema:{input:_U(v,"input",$.processors),output:_U(v,"output",$.processors)}},enumerable:!1,writable:!1}),J}catch(J){throw Error("Error converting schema to JSON.")}}function Iv($,v){let g=v??{seen:new Set};if(g.seen.has($))return!1;g.seen.add($);let _=$._zod.def;if(_.type==="transform")return!0;if(_.type==="array")return Iv(_.element,g);if(_.type==="set")return Iv(_.valueType,g);if(_.type==="lazy")return Iv(_.getter(),g);if(_.type==="promise"||_.type==="optional"||_.type==="nonoptional"||_.type==="nullable"||_.type==="readonly"||_.type==="default"||_.type==="prefault")return Iv(_.innerType,g);if(_.type==="intersection")return Iv(_.left,g)||Iv(_.right,g);if(_.type==="record"||_.type==="map")return Iv(_.keyType,g)||Iv(_.valueType,g);if(_.type==="pipe")return Iv(_.in,g)||Iv(_.out,g);if(_.type==="object"){for(let U in _.shape)if(Iv(_.shape[U],g))return!0;return!1}if(_.type==="union"){for(let U of _.options)if(Iv(U,g))return!0;return!1}if(_.type==="tuple"){for(let U of _.items)if(Iv(U,g))return!0;if(_.rest&&Iv(_.rest,g))return!0;return!1}return!1}var gb=($,v={})=>(g)=>{let _=j6({...g,processors:v});return w$($,_),V6(_,$),C6(_,$)},_U=($,v,g={})=>(_)=>{let{libraryOptions:U,target:z}=_??{},J=j6({...U??{},target:z,io:v,processors:g});return w$($,J),V6(J,$),C6(J,$)};var HL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_b=($,v,g,_)=>{let U=g;U.type="string";let{minimum:z,maximum:J,format:b,patterns:O,contentEncoding:K}=$._zod.bag;if(typeof z==="number")U.minLength=z;if(typeof J==="number")U.maxLength=J;if(b){if(U.format=HL[b]??b,U.format==="")delete U.format;if(b==="time")delete U.format}if(K)U.contentEncoding=K;if(O&&O.size>0){let W=[...O];if(W.length===1)U.pattern=W[0].source;else if(W.length>1)U.allOf=[...W.map((B)=>({...v.target==="draft-07"||v.target==="draft-04"||v.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},zb=($,v,g,_)=>{let U=g,{minimum:z,maximum:J,format:b,multipleOf:O,exclusiveMaximum:K,exclusiveMinimum:W}=$._zod.bag;if(typeof b==="string"&&b.includes("int"))U.type="integer";else U.type="number";if(typeof W==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")U.minimum=W,U.exclusiveMinimum=!0;else U.exclusiveMinimum=W;if(typeof z==="number"){if(U.minimum=z,typeof W==="number"&&v.target!=="draft-04")if(W>=z)delete U.minimum;else delete U.exclusiveMinimum}if(typeof K==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")U.maximum=K,U.exclusiveMaximum=!0;else U.exclusiveMaximum=K;if(typeof J==="number"){if(U.maximum=J,typeof K==="number"&&v.target!=="draft-04")if(K<=J)delete U.maximum;else delete U.exclusiveMaximum}if(typeof O==="number")U.multipleOf=O},Jb=($,v,g,_)=>{g.type="boolean"},bb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},Gb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},Ob=($,v,g,_)=>{if(v.target==="openapi-3.0")g.type="string",g.nullable=!0,g.enum=[null];else g.type="null"},Kb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Wb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},Bb=($,v,g,_)=>{g.not={}},Pb=($,v,g,_)=>{},kb=($,v,g,_)=>{},Hb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},Ib=($,v,g,_)=>{let U=$._zod.def,z=lU(U.entries);if(z.every((J)=>typeof J==="number"))g.type="number";if(z.every((J)=>typeof J==="string"))g.type="string";g.enum=z},Yb=($,v,g,_)=>{let U=$._zod.def,z=[];for(let J of U.values)if(J===void 0){if(v.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof J==="bigint")if(v.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else z.push(Number(J));else z.push(J);if(z.length===0);else if(z.length===1){let J=z[0];if(g.type=J===null?"null":typeof J,v.target==="draft-04"||v.target==="openapi-3.0")g.enum=[J];else g.const=J}else{if(z.every((J)=>typeof J==="number"))g.type="number";if(z.every((J)=>typeof J==="string"))g.type="string";if(z.every((J)=>typeof J==="boolean"))g.type="boolean";if(z.every((J)=>J===null))g.type="null";g.enum=z}},Lb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},qb=($,v,g,_)=>{let U=g,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");U.type="string",U.pattern=z.source},Xb=($,v,g,_)=>{let U=g,z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:J,maximum:b,mime:O}=$._zod.bag;if(J!==void 0)z.minLength=J;if(b!==void 0)z.maxLength=b;if(O)if(O.length===1)z.contentMediaType=O[0],Object.assign(U,z);else Object.assign(U,z),U.anyOf=O.map((K)=>({contentMediaType:K}));else Object.assign(U,z)},wb=($,v,g,_)=>{g.type="boolean"},Fb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},Ab=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},Zb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Mb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Qb=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Sb=($,v,g,_)=>{let U=g,z=$._zod.def,{minimum:J,maximum:b}=$._zod.bag;if(typeof J==="number")U.minItems=J;if(typeof b==="number")U.maxItems=b;U.type="array",U.items=w$(z.element,v,{..._,path:[..._.path,"items"]})},Nb=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="object",U.properties={};let J=z.shape;for(let K in J)U.properties[K]=w$(J[K],v,{..._,path:[..._.path,"properties",K]});let b=new Set(Object.keys(J)),O=new Set([...b].filter((K)=>{let W=z.shape[K]._zod;if(v.io==="input")return W.optin===void 0;else return W.optout===void 0}));if(O.size>0)U.required=Array.from(O);if(z.catchall?._zod.def.type==="never")U.additionalProperties=!1;else if(!z.catchall){if(v.io==="output")U.additionalProperties=!1}else if(z.catchall)U.additionalProperties=w$(z.catchall,v,{..._,path:[..._.path,"additionalProperties"]})},n1=($,v,g,_)=>{let U=$._zod.def,z=U.inclusive===!1,J=U.options.map((b,O)=>w$(b,v,{..._,path:[..._.path,z?"oneOf":"anyOf",O]}));if(z)g.oneOf=J;else g.anyOf=J},rb=($,v,g,_)=>{let U=$._zod.def,z=w$(U.left,v,{..._,path:[..._.path,"allOf",0]}),J=w$(U.right,v,{..._,path:[..._.path,"allOf",1]}),b=(K)=>("allOf"in K)&&Object.keys(K).length===1,O=[...b(z)?z.allOf:[z],...b(J)?J.allOf:[J]];g.allOf=O},ub=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="array";let J=v.target==="draft-2020-12"?"prefixItems":"items",b=v.target==="draft-2020-12"?"items":v.target==="openapi-3.0"?"items":"additionalItems",O=z.items.map((k,P)=>w$(k,v,{..._,path:[..._.path,J,P]})),K=z.rest?w$(z.rest,v,{..._,path:[..._.path,b,...v.target==="openapi-3.0"?[z.items.length]:[]]}):null;if(v.target==="draft-2020-12"){if(U.prefixItems=O,K)U.items=K}else if(v.target==="openapi-3.0"){if(U.items={anyOf:O},K)U.items.anyOf.push(K);if(U.minItems=O.length,!K)U.maxItems=O.length}else if(U.items=O,K)U.additionalItems=K;let{minimum:W,maximum:B}=$._zod.bag;if(typeof W==="number")U.minItems=W;if(typeof B==="number")U.maxItems=B},yb=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="object";let J=z.keyType,O=J._zod.bag?.patterns;if(z.mode==="loose"&&O&&O.size>0){let W=w$(z.valueType,v,{..._,path:[..._.path,"patternProperties","*"]});U.patternProperties={};for(let B of O)U.patternProperties[B.source]=W}else{if(v.target==="draft-07"||v.target==="draft-2020-12")U.propertyNames=w$(z.keyType,v,{..._,path:[..._.path,"propertyNames"]});U.additionalProperties=w$(z.valueType,v,{..._,path:[..._.path,"additionalProperties"]})}let K=J._zod.values;if(K){let W=[...K].filter((B)=>typeof B==="string"||typeof B==="number");if(W.length>0)U.required=W}},Db=($,v,g,_)=>{let U=$._zod.def,z=w$(U.innerType,v,_),J=v.seen.get($);if(v.target==="openapi-3.0")J.ref=U.innerType,g.nullable=!0;else g.anyOf=[z,{type:"null"}]},Rb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},Tb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType,g.default=JSON.parse(JSON.stringify(U.defaultValue))},jb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);if(z.ref=U.innerType,v.io==="input")g._prefault=JSON.parse(JSON.stringify(U.defaultValue))},Vb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType;let J;try{J=U.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}g.default=J},Cb=($,v,g,_)=>{let U=$._zod.def,z=v.io==="input"?U.in._zod.def.type==="transform"?U.out:U.in:U.out;w$(z,v,_);let J=v.seen.get($);J.ref=z},fb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType,g.readOnly=!0},mb=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},t1=($,v,g,_)=>{let U=$._zod.def;w$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},cb=($,v,g,_)=>{let U=$._zod.innerType;w$(U,v,_);let z=v.seen.get($);z.ref=U},o1={string:_b,number:zb,boolean:Jb,bigint:bb,symbol:Gb,null:Ob,undefined:Kb,void:Wb,never:Bb,any:Pb,unknown:kb,date:Hb,enum:Ib,literal:Yb,nan:Lb,template_literal:qb,file:Xb,success:wb,custom:Fb,function:Ab,transform:Zb,map:Mb,set:Qb,array:Sb,object:Nb,union:n1,intersection:rb,tuple:ub,record:yb,nullable:Db,nonoptional:Rb,default:Tb,prefault:jb,catch:Vb,pipe:Cb,readonly:fb,promise:mb,optional:t1,lazy:cb};function d1($,v){if("_idmap"in $){let _=$,U=j6({...v,processors:o1}),z={};for(let O of _._idmap.entries()){let[K,W]=O;w$(W,U)}let J={},b={registry:_,uri:v?.uri,defs:z};U.external=b;for(let O of _._idmap.entries()){let[K,W]=O;V6(U,W),J[K]=C6(U,W)}if(Object.keys(z).length>0){let O=U.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[O]:z}}return{schemas:J}}let g=j6({...v,processors:o1});return w$($,g),V6(g,$),C6(g,$)}class Eb{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter($){this.ctx.counter=$}get seen(){return this.ctx.seen}constructor($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";this.ctx=j6({processors:o1,target:v,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,v={path:[],schemaPath:[]}){return w$($,this.ctx,v)}emit($,v){if(v){if(v.cycles)this.ctx.cycles=v.cycles;if(v.reused)this.ctx.reused=v.reused;if(v.external)this.ctx.external=v.external}V6(this.ctx,$);let g=C6(this.ctx,$),{"~standard":_,...U}=g;return U}}var G7={};var Pg={};ev(Pg,{xor:()=>s7,xid:()=>A7,void:()=>n7,uuidv7:()=>H7,uuidv6:()=>k7,uuidv4:()=>P7,uuid:()=>B7,url:()=>I7,unknown:()=>Q$,union:()=>A$,undefined:()=>p7,ulid:()=>F7,uint64:()=>x7,uint32:()=>E7,tuple:()=>YG,transform:()=>F0,templateLiteral:()=>OW,symbol:()=>h7,superRefine:()=>lG,success:()=>JW,stringbool:()=>IW,stringFormat:()=>T7,string:()=>Z,strictObject:()=>a7,set:()=>UW,refine:()=>iG,record:()=>N$,readonly:()=>VG,promise:()=>KW,preprocess:()=>Zg,prefault:()=>rG,pipe:()=>Ig,partialRecord:()=>e7,optional:()=>y$,object:()=>x,number:()=>Y$,nullish:()=>zW,nullable:()=>Hg,null:()=>WU,nonoptional:()=>uG,never:()=>w0,nativeEnum:()=>gW,nanoid:()=>q7,nan:()=>bW,meta:()=>kW,map:()=>vW,mac:()=>Q7,looseRecord:()=>$W,looseObject:()=>$v,literal:()=>t,lazy:()=>mG,ksuid:()=>Z7,keyof:()=>d7,jwt:()=>R7,json:()=>YW,ipv6:()=>S7,ipv4:()=>M7,intersection:()=>BU,int64:()=>l7,int32:()=>c7,int:()=>U0,instanceof:()=>HW,httpUrl:()=>Y7,hostname:()=>j7,hex:()=>V7,hash:()=>C7,guid:()=>W7,function:()=>WW,float64:()=>m7,float32:()=>f7,file:()=>_W,exactOptional:()=>ZG,enum:()=>vv,emoji:()=>L7,email:()=>K7,e164:()=>D7,discriminatedUnion:()=>wg,describe:()=>PW,date:()=>t7,custom:()=>S0,cuid2:()=>w7,cuid:()=>X7,codec:()=>GW,cidrv6:()=>r7,cidrv4:()=>N7,check:()=>BW,catch:()=>RG,boolean:()=>x$,bigint:()=>i7,base64url:()=>y7,base64:()=>u7,array:()=>J$,any:()=>o7,_function:()=>WW,_default:()=>SG,_ZodString:()=>g0,ZodXor:()=>PG,ZodXID:()=>K0,ZodVoid:()=>WG,ZodUnknown:()=>OG,ZodUnion:()=>Xg,ZodUndefined:()=>JG,ZodUUID:()=>av,ZodURL:()=>Yg,ZodULID:()=>O0,ZodType:()=>_$,ZodTuple:()=>IG,ZodTransform:()=>FG,ZodTemplateLiteral:()=>CG,ZodSymbol:()=>zG,ZodSuccess:()=>yG,ZodStringFormat:()=>M$,ZodString:()=>JU,ZodSet:()=>qG,ZodRecord:()=>Fg,ZodReadonly:()=>jG,ZodPromise:()=>cG,ZodPrefault:()=>NG,ZodPipe:()=>M0,ZodOptional:()=>A0,ZodObject:()=>qg,ZodNumberFormat:()=>K4,ZodNumber:()=>GU,ZodNullable:()=>MG,ZodNull:()=>bG,ZodNonOptional:()=>Z0,ZodNever:()=>KG,ZodNanoID:()=>J0,ZodNaN:()=>TG,ZodMap:()=>LG,ZodMAC:()=>_G,ZodLiteral:()=>XG,ZodLazy:()=>fG,ZodKSUID:()=>W0,ZodJWT:()=>q0,ZodIntersection:()=>HG,ZodIPv6:()=>P0,ZodIPv4:()=>B0,ZodGUID:()=>kg,ZodFunction:()=>EG,ZodFile:()=>wG,ZodExactOptional:()=>AG,ZodEnum:()=>zU,ZodEmoji:()=>z0,ZodEmail:()=>_0,ZodE164:()=>L0,ZodDiscriminatedUnion:()=>kG,ZodDefault:()=>QG,ZodDate:()=>Lg,ZodCustomStringFormat:()=>bU,ZodCustom:()=>Ag,ZodCodec:()=>Q0,ZodCatch:()=>DG,ZodCUID2:()=>G0,ZodCUID:()=>b0,ZodCIDRv6:()=>H0,ZodCIDRv4:()=>k0,ZodBoolean:()=>OU,ZodBigIntFormat:()=>X0,ZodBigInt:()=>KU,ZodBase64URL:()=>Y0,ZodBase64:()=>I0,ZodArray:()=>BG,ZodAny:()=>GG});var a1={};ev(a1,{uppercase:()=>o4,trim:()=>e4,toUpperCase:()=>vU,toLowerCase:()=>$U,startsWith:()=>t4,slugify:()=>UU,size:()=>b4,regex:()=>h4,property:()=>p1,positive:()=>i1,overwrite:()=>mv,normalize:()=>s4,nonpositive:()=>x1,nonnegative:()=>h1,negative:()=>l1,multipleOf:()=>R6,minSize:()=>dv,minLength:()=>G6,mime:()=>a4,maxSize:()=>T6,maxLength:()=>G4,lte:()=>Nv,lt:()=>nv,lowercase:()=>p4,length:()=>O4,includes:()=>n4,gte:()=>Hv,gt:()=>tv,endsWith:()=>d4});var f6={};ev(f6,{time:()=>xb,duration:()=>hb,datetime:()=>ib,date:()=>lb,ZodISOTime:()=>$0,ZodISODuration:()=>v0,ZodISODateTime:()=>s1,ZodISODate:()=>e1});var s1=w("ZodISODateTime",($,v)=>{MJ.init($,v),M$.init($,v)});function ib($){return F9(s1,$)}var e1=w("ZodISODate",($,v)=>{QJ.init($,v),M$.init($,v)});function lb($){return A9(e1,$)}var $0=w("ZodISOTime",($,v)=>{SJ.init($,v),M$.init($,v)});function xb($){return Z9($0,$)}var v0=w("ZodISODuration",($,v)=>{NJ.init($,v),M$.init($,v)});function hb($){return M9(v0,$)}var O7=($,v)=>{nU.init($,v),$.name="ZodError",Object.defineProperties($,{format:{value:(g)=>dU($,g)},flatten:{value:(g)=>tU($,g)},addIssue:{value:(g)=>{$.issues.push(g),$.message=JSON.stringify($.issues,j4,2)}},addIssues:{value:(g)=>{$.issues.push(...g),$.message=JSON.stringify($.issues,j4,2)}},isEmpty:{get(){return $.issues.length===0}}})},YL=w("ZodError",O7),Fv=w("ZodError",O7,{Parent:Error});var pb=f4(Fv),ob=m4(Fv),nb=c4(Fv),tb=i4(Fv),db=$1(Fv),ab=v1(Fv),sb=U1(Fv),eb=g1(Fv),$G=_1(Fv),vG=z1(Fv),UG=J1(Fv),gG=b1(Fv);var _$=w("ZodType",($,v)=>{return $$.init($,v),Object.assign($["~standard"],{jsonSchema:{input:_U($,"input"),output:_U($,"output")}}),$.toJSONSchema=gb($,{}),$.def=v,$.type=v.type,Object.defineProperty($,"_def",{value:v}),$.check=(...g)=>{return $.clone(j.mergeDefs(v,{checks:[...v.checks??[],...g.map((_)=>typeof _==="function"?{_zod:{check:_,def:{check:"custom"},onattach:[]}}:_)]}),{parent:!0})},$.with=$.check,$.clone=(g,_)=>kv($,g,_),$.brand=()=>$,$.register=(g,_)=>{return g.add($,_),$},$.parse=(g,_)=>pb($,g,_,{callee:$.parse}),$.safeParse=(g,_)=>nb($,g,_),$.parseAsync=async(g,_)=>ob($,g,_,{callee:$.parseAsync}),$.safeParseAsync=async(g,_)=>tb($,g,_),$.spa=$.safeParseAsync,$.encode=(g,_)=>db($,g,_),$.decode=(g,_)=>ab($,g,_),$.encodeAsync=async(g,_)=>sb($,g,_),$.decodeAsync=async(g,_)=>eb($,g,_),$.safeEncode=(g,_)=>$G($,g,_),$.safeDecode=(g,_)=>vG($,g,_),$.safeEncodeAsync=async(g,_)=>UG($,g,_),$.safeDecodeAsync=async(g,_)=>gG($,g,_),$.refine=(g,_)=>$.check(iG(g,_)),$.superRefine=(g)=>$.check(lG(g)),$.overwrite=(g)=>$.check(mv(g)),$.optional=()=>y$($),$.exactOptional=()=>ZG($),$.nullable=()=>Hg($),$.nullish=()=>y$(Hg($)),$.nonoptional=(g)=>uG($,g),$.array=()=>J$($),$.or=(g)=>A$([$,g]),$.and=(g)=>BU($,g),$.transform=(g)=>Ig($,F0(g)),$.default=(g)=>SG($,g),$.prefault=(g)=>rG($,g),$.catch=(g)=>RG($,g),$.pipe=(g)=>Ig($,g),$.readonly=()=>VG($),$.describe=(g)=>{let _=$.clone();return e$.add(_,{description:g}),_},Object.defineProperty($,"description",{get(){return e$.get($)?.description},configurable:!0}),$.meta=(...g)=>{if(g.length===0)return e$.get($);let _=$.clone();return e$.add(_,g[0]),_},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$.apply=(g)=>g($),$}),g0=w("_ZodString",($,v)=>{J4.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>_b($,_,U,z);let g=$._zod.bag;$.format=g.format??null,$.minLength=g.minimum??null,$.maxLength=g.maximum??null,$.regex=(..._)=>$.check(h4(..._)),$.includes=(..._)=>$.check(n4(..._)),$.startsWith=(..._)=>$.check(t4(..._)),$.endsWith=(..._)=>$.check(d4(..._)),$.min=(..._)=>$.check(G6(..._)),$.max=(..._)=>$.check(G4(..._)),$.length=(..._)=>$.check(O4(..._)),$.nonempty=(..._)=>$.check(G6(1,..._)),$.lowercase=(_)=>$.check(p4(_)),$.uppercase=(_)=>$.check(o4(_)),$.trim=()=>$.check(e4()),$.normalize=(..._)=>$.check(s4(..._)),$.toLowerCase=()=>$.check($U()),$.toUpperCase=()=>$.check(vU()),$.slugify=()=>$.check(UU())}),JU=w("ZodString",($,v)=>{J4.init($,v),g0.init($,v),$.email=(g)=>$.check(F1(_0,g)),$.url=(g)=>$.check(Bg(Yg,g)),$.jwt=(g)=>$.check(E1(q0,g)),$.emoji=(g)=>$.check(S1(z0,g)),$.guid=(g)=>$.check(Wg(kg,g)),$.uuid=(g)=>$.check(A1(av,g)),$.uuidv4=(g)=>$.check(Z1(av,g)),$.uuidv6=(g)=>$.check(M1(av,g)),$.uuidv7=(g)=>$.check(Q1(av,g)),$.nanoid=(g)=>$.check(N1(J0,g)),$.guid=(g)=>$.check(Wg(kg,g)),$.cuid=(g)=>$.check(r1(b0,g)),$.cuid2=(g)=>$.check(u1(G0,g)),$.ulid=(g)=>$.check(y1(O0,g)),$.base64=(g)=>$.check(f1(I0,g)),$.base64url=(g)=>$.check(m1(Y0,g)),$.xid=(g)=>$.check(D1(K0,g)),$.ksuid=(g)=>$.check(R1(W0,g)),$.ipv4=(g)=>$.check(T1(B0,g)),$.ipv6=(g)=>$.check(j1(P0,g)),$.cidrv4=(g)=>$.check(V1(k0,g)),$.cidrv6=(g)=>$.check(C1(H0,g)),$.e164=(g)=>$.check(c1(L0,g)),$.datetime=(g)=>$.check(ib(g)),$.date=(g)=>$.check(lb(g)),$.time=(g)=>$.check(xb(g)),$.duration=(g)=>$.check(hb(g))});function Z($){return L9(JU,$)}var M$=w("ZodStringFormat",($,v)=>{Z$.init($,v),g0.init($,v)}),_0=w("ZodEmail",($,v)=>{IJ.init($,v),M$.init($,v)});function K7($){return F1(_0,$)}var kg=w("ZodGUID",($,v)=>{kJ.init($,v),M$.init($,v)});function W7($){return Wg(kg,$)}var av=w("ZodUUID",($,v)=>{HJ.init($,v),M$.init($,v)});function B7($){return A1(av,$)}function P7($){return Z1(av,$)}function k7($){return M1(av,$)}function H7($){return Q1(av,$)}var Yg=w("ZodURL",($,v)=>{YJ.init($,v),M$.init($,v)});function I7($){return Bg(Yg,$)}function Y7($){return Bg(Yg,{protocol:/^https?$/,hostname:Dv.domain,...j.normalizeParams($)})}var z0=w("ZodEmoji",($,v)=>{LJ.init($,v),M$.init($,v)});function L7($){return S1(z0,$)}var J0=w("ZodNanoID",($,v)=>{qJ.init($,v),M$.init($,v)});function q7($){return N1(J0,$)}var b0=w("ZodCUID",($,v)=>{XJ.init($,v),M$.init($,v)});function X7($){return r1(b0,$)}var G0=w("ZodCUID2",($,v)=>{wJ.init($,v),M$.init($,v)});function w7($){return u1(G0,$)}var O0=w("ZodULID",($,v)=>{FJ.init($,v),M$.init($,v)});function F7($){return y1(O0,$)}var K0=w("ZodXID",($,v)=>{AJ.init($,v),M$.init($,v)});function A7($){return D1(K0,$)}var W0=w("ZodKSUID",($,v)=>{ZJ.init($,v),M$.init($,v)});function Z7($){return R1(W0,$)}var B0=w("ZodIPv4",($,v)=>{rJ.init($,v),M$.init($,v)});function M7($){return T1(B0,$)}var _G=w("ZodMAC",($,v)=>{yJ.init($,v),M$.init($,v)});function Q7($){return X9(_G,$)}var P0=w("ZodIPv6",($,v)=>{uJ.init($,v),M$.init($,v)});function S7($){return j1(P0,$)}var k0=w("ZodCIDRv4",($,v)=>{DJ.init($,v),M$.init($,v)});function N7($){return V1(k0,$)}var H0=w("ZodCIDRv6",($,v)=>{RJ.init($,v),M$.init($,v)});function r7($){return C1(H0,$)}var I0=w("ZodBase64",($,v)=>{jJ.init($,v),M$.init($,v)});function u7($){return f1(I0,$)}var Y0=w("ZodBase64URL",($,v)=>{VJ.init($,v),M$.init($,v)});function y7($){return m1(Y0,$)}var L0=w("ZodE164",($,v)=>{CJ.init($,v),M$.init($,v)});function D7($){return c1(L0,$)}var q0=w("ZodJWT",($,v)=>{fJ.init($,v),M$.init($,v)});function R7($){return E1(q0,$)}var bU=w("ZodCustomStringFormat",($,v)=>{mJ.init($,v),M$.init($,v)});function T7($,v,g={}){return gU(bU,$,v,g)}function j7($){return gU(bU,"hostname",Dv.hostname,$)}function V7($){return gU(bU,"hex",Dv.hex,$)}function C7($,v){let g=v?.enc??"hex",_=`${$}_${g}`,U=Dv[_];if(!U)throw Error(`Unrecognized hash format: ${_}`);return gU(bU,_,U,v)}var GU=w("ZodNumber",($,v)=>{Y1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>zb($,_,U,z),$.gt=(_,U)=>$.check(tv(_,U)),$.gte=(_,U)=>$.check(Hv(_,U)),$.min=(_,U)=>$.check(Hv(_,U)),$.lt=(_,U)=>$.check(nv(_,U)),$.lte=(_,U)=>$.check(Nv(_,U)),$.max=(_,U)=>$.check(Nv(_,U)),$.int=(_)=>$.check(U0(_)),$.safe=(_)=>$.check(U0(_)),$.positive=(_)=>$.check(tv(0,_)),$.nonnegative=(_)=>$.check(Hv(0,_)),$.negative=(_)=>$.check(nv(0,_)),$.nonpositive=(_)=>$.check(Nv(0,_)),$.multipleOf=(_,U)=>$.check(R6(_,U)),$.step=(_,U)=>$.check(R6(_,U)),$.finite=()=>$;let g=$._zod.bag;$.minValue=Math.max(g.minimum??Number.NEGATIVE_INFINITY,g.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(g.maximum??Number.POSITIVE_INFINITY,g.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(g.format??"").includes("int")||Number.isSafeInteger(g.multipleOf??0.5),$.isFinite=!0,$.format=g.format??null});function Y$($){return Q9(GU,$)}var K4=w("ZodNumberFormat",($,v)=>{cJ.init($,v),GU.init($,v)});function U0($){return N9(K4,$)}function f7($){return r9(K4,$)}function m7($){return u9(K4,$)}function c7($){return y9(K4,$)}function E7($){return D9(K4,$)}var OU=w("ZodBoolean",($,v)=>{gg.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Jb($,g,_,U)});function x$($){return R9(OU,$)}var KU=w("ZodBigInt",($,v)=>{L1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>bb($,_,U,z),$.gte=(_,U)=>$.check(Hv(_,U)),$.min=(_,U)=>$.check(Hv(_,U)),$.gt=(_,U)=>$.check(tv(_,U)),$.gte=(_,U)=>$.check(Hv(_,U)),$.min=(_,U)=>$.check(Hv(_,U)),$.lt=(_,U)=>$.check(nv(_,U)),$.lte=(_,U)=>$.check(Nv(_,U)),$.max=(_,U)=>$.check(Nv(_,U)),$.positive=(_)=>$.check(tv(BigInt(0),_)),$.negative=(_)=>$.check(nv(BigInt(0),_)),$.nonpositive=(_)=>$.check(Nv(BigInt(0),_)),$.nonnegative=(_)=>$.check(Hv(BigInt(0),_)),$.multipleOf=(_,U)=>$.check(R6(_,U));let g=$._zod.bag;$.minValue=g.minimum??null,$.maxValue=g.maximum??null,$.format=g.format??null});function i7($){return j9(KU,$)}var X0=w("ZodBigIntFormat",($,v)=>{EJ.init($,v),KU.init($,v)});function l7($){return C9(X0,$)}function x7($){return f9(X0,$)}var zG=w("ZodSymbol",($,v)=>{iJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Gb($,g,_,U)});function h7($){return m9(zG,$)}var JG=w("ZodUndefined",($,v)=>{lJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Kb($,g,_,U)});function p7($){return c9(JG,$)}var bG=w("ZodNull",($,v)=>{xJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Ob($,g,_,U)});function WU($){return E9(bG,$)}var GG=w("ZodAny",($,v)=>{hJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Pb($,g,_,U)});function o7(){return i9(GG)}var OG=w("ZodUnknown",($,v)=>{pJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>kb($,g,_,U)});function Q$(){return l9(OG)}var KG=w("ZodNever",($,v)=>{oJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Bb($,g,_,U)});function w0($){return x9(KG,$)}var WG=w("ZodVoid",($,v)=>{nJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Wb($,g,_,U)});function n7($){return h9(WG,$)}var Lg=w("ZodDate",($,v)=>{tJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>Hb($,_,U,z),$.min=(_,U)=>$.check(Hv(_,U)),$.max=(_,U)=>$.check(Nv(_,U));let g=$._zod.bag;$.minDate=g.minimum?new Date(g.minimum):null,$.maxDate=g.maximum?new Date(g.maximum):null});function t7($){return p9(Lg,$)}var BG=w("ZodArray",($,v)=>{dJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Sb($,g,_,U),$.element=v.element,$.min=(g,_)=>$.check(G6(g,_)),$.nonempty=(g)=>$.check(G6(1,g)),$.max=(g,_)=>$.check(G4(g,_)),$.length=(g,_)=>$.check(O4(g,_)),$.unwrap=()=>$.element});function J$($,v){return t9(BG,$,v)}function d7($){let v=$._zod.def.shape;return vv(Object.keys(v))}var qg=w("ZodObject",($,v)=>{aJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Nb($,g,_,U),j.defineLazy($,"shape",()=>{return v.shape}),$.keyof=()=>vv(Object.keys($._zod.def.shape)),$.catchall=(g)=>$.clone({...$._zod.def,catchall:g}),$.passthrough=()=>$.clone({...$._zod.def,catchall:Q$()}),$.loose=()=>$.clone({...$._zod.def,catchall:Q$()}),$.strict=()=>$.clone({...$._zod.def,catchall:w0()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(g)=>{return j.extend($,g)},$.safeExtend=(g)=>{return j.safeExtend($,g)},$.merge=(g)=>j.merge($,g),$.pick=(g)=>j.pick($,g),$.omit=(g)=>j.omit($,g),$.partial=(...g)=>j.partial(A0,$,g[0]),$.required=(...g)=>j.required(Z0,$,g[0])});function x($,v){let g={type:"object",shape:$??{},...j.normalizeParams(v)};return new qg(g)}function a7($,v){return new qg({type:"object",shape:$,catchall:w0(),...j.normalizeParams(v)})}function $v($,v){return new qg({type:"object",shape:$,catchall:Q$(),...j.normalizeParams(v)})}var Xg=w("ZodUnion",($,v)=>{_g.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>n1($,g,_,U),$.options=v.options});function A$($,v){return new Xg({type:"union",options:$,...j.normalizeParams(v)})}var PG=w("ZodXor",($,v)=>{Xg.init($,v),sJ.init($,v),$._zod.processJSONSchema=(g,_,U)=>n1($,g,_,U),$.options=v.options});function s7($,v){return new PG({type:"union",options:$,inclusive:!1,...j.normalizeParams(v)})}var kG=w("ZodDiscriminatedUnion",($,v)=>{Xg.init($,v),eJ.init($,v)});function wg($,v,g){return new kG({type:"union",options:v,discriminator:$,...j.normalizeParams(g)})}var HG=w("ZodIntersection",($,v)=>{$8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>rb($,g,_,U)});function BU($,v){return new HG({type:"intersection",left:$,right:v})}var IG=w("ZodTuple",($,v)=>{q1.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>ub($,g,_,U),$.rest=(g)=>$.clone({...$._zod.def,rest:g})});function YG($,v,g){let _=v instanceof $$,U=_?g:v;return new IG({type:"tuple",items:$,rest:_?v:null,...j.normalizeParams(U)})}var Fg=w("ZodRecord",($,v)=>{v8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>yb($,g,_,U),$.keyType=v.keyType,$.valueType=v.valueType});function N$($,v,g){return new Fg({type:"record",keyType:$,valueType:v,...j.normalizeParams(g)})}function e7($,v,g){let _=kv($);return _._zod.values=void 0,new Fg({type:"record",keyType:_,valueType:v,...j.normalizeParams(g)})}function $W($,v,g){return new Fg({type:"record",keyType:$,valueType:v,mode:"loose",...j.normalizeParams(g)})}var LG=w("ZodMap",($,v)=>{U8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Mb($,g,_,U),$.keyType=v.keyType,$.valueType=v.valueType,$.min=(...g)=>$.check(dv(...g)),$.nonempty=(g)=>$.check(dv(1,g)),$.max=(...g)=>$.check(T6(...g)),$.size=(...g)=>$.check(b4(...g))});function vW($,v,g){return new LG({type:"map",keyType:$,valueType:v,...j.normalizeParams(g)})}var qG=w("ZodSet",($,v)=>{g8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Qb($,g,_,U),$.min=(...g)=>$.check(dv(...g)),$.nonempty=(g)=>$.check(dv(1,g)),$.max=(...g)=>$.check(T6(...g)),$.size=(...g)=>$.check(b4(...g))});function UW($,v){return new qG({type:"set",valueType:$,...j.normalizeParams(v)})}var zU=w("ZodEnum",($,v)=>{_8.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>Ib($,_,U,z),$.enum=v.entries,$.options=Object.values(v.entries);let g=new Set(Object.keys(v.entries));$.extract=(_,U)=>{let z={};for(let J of _)if(g.has(J))z[J]=v.entries[J];else throw Error(`Key ${J} not found in enum`);return new zU({...v,checks:[],...j.normalizeParams(U),entries:z})},$.exclude=(_,U)=>{let z={...v.entries};for(let J of _)if(g.has(J))delete z[J];else throw Error(`Key ${J} not found in enum`);return new zU({...v,checks:[],...j.normalizeParams(U),entries:z})}});function vv($,v){let g=Array.isArray($)?Object.fromEntries($.map((_)=>[_,_])):$;return new zU({type:"enum",entries:g,...j.normalizeParams(v)})}function gW($,v){return new zU({type:"enum",entries:$,...j.normalizeParams(v)})}var XG=w("ZodLiteral",($,v)=>{z8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Yb($,g,_,U),$.values=new Set(v.values),Object.defineProperty($,"value",{get(){if(v.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return v.values[0]}})});function t($,v){return new XG({type:"literal",values:Array.isArray($)?$:[$],...j.normalizeParams(v)})}var wG=w("ZodFile",($,v)=>{J8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Xb($,g,_,U),$.min=(g,_)=>$.check(dv(g,_)),$.max=(g,_)=>$.check(T6(g,_)),$.mime=(g,_)=>$.check(a4(Array.isArray(g)?g:[g],_))});function _W($){return d9(wG,$)}var FG=w("ZodTransform",($,v)=>{b8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Zb($,g,_,U),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new g4($.constructor.name);g.addIssue=(z)=>{if(typeof z==="string")g.issues.push(j.issue(z,g.value,v));else{let J=z;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=g.value),J.inst??(J.inst=$),g.issues.push(j.issue(J))}};let U=v.transform(g.value,g);if(U instanceof Promise)return U.then((z)=>{return g.value=z,g});return g.value=U,g}});function F0($){return new FG({type:"transform",transform:$})}var A0=w("ZodOptional",($,v)=>{X1.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>t1($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function y$($){return new A0({type:"optional",innerType:$})}var AG=w("ZodExactOptional",($,v)=>{G8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>t1($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function ZG($){return new AG({type:"optional",innerType:$})}var MG=w("ZodNullable",($,v)=>{O8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Db($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function Hg($){return new MG({type:"nullable",innerType:$})}function zW($){return y$(Hg($))}var QG=w("ZodDefault",($,v)=>{K8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Tb($,g,_,U),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function SG($,v){return new QG({type:"default",innerType:$,get defaultValue(){return typeof v==="function"?v():j.shallowClone(v)}})}var NG=w("ZodPrefault",($,v)=>{W8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>jb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function rG($,v){return new NG({type:"prefault",innerType:$,get defaultValue(){return typeof v==="function"?v():j.shallowClone(v)}})}var Z0=w("ZodNonOptional",($,v)=>{B8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Rb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function uG($,v){return new Z0({type:"nonoptional",innerType:$,...j.normalizeParams(v)})}var yG=w("ZodSuccess",($,v)=>{P8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>wb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function JW($){return new yG({type:"success",innerType:$})}var DG=w("ZodCatch",($,v)=>{k8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Vb($,g,_,U),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function RG($,v){return new DG({type:"catch",innerType:$,catchValue:typeof v==="function"?v:()=>v})}var TG=w("ZodNaN",($,v)=>{H8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Lb($,g,_,U)});function bW($){return n9(TG,$)}var M0=w("ZodPipe",($,v)=>{I8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Cb($,g,_,U),$.in=v.in,$.out=v.out});function Ig($,v){return new M0({type:"pipe",in:$,out:v})}var Q0=w("ZodCodec",($,v)=>{M0.init($,v),zg.init($,v)});function GW($,v,g){return new Q0({type:"pipe",in:$,out:v,transform:g.decode,reverseTransform:g.encode})}var jG=w("ZodReadonly",($,v)=>{Y8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>fb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function VG($){return new jG({type:"readonly",innerType:$})}var CG=w("ZodTemplateLiteral",($,v)=>{L8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>qb($,g,_,U)});function OW($,v){return new CG({type:"template_literal",parts:$,...j.normalizeParams(v)})}var fG=w("ZodLazy",($,v)=>{w8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>cb($,g,_,U),$.unwrap=()=>$._zod.def.getter()});function mG($){return new fG({type:"lazy",getter:$})}var cG=w("ZodPromise",($,v)=>{X8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>mb($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function KW($){return new cG({type:"promise",innerType:$})}var EG=w("ZodFunction",($,v)=>{q8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Ab($,g,_,U)});function WW($){return new EG({type:"function",input:Array.isArray($?.input)?YG($?.input):$?.input??J$(Q$()),output:$?.output??Q$()})}var Ag=w("ZodCustom",($,v)=>{F8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>Fb($,g,_,U)});function BW($){let v=new S$({check:"custom"});return v._zod.check=$,v}function S0($,v){return a9(Ag,$??(()=>!0),v)}function iG($,v={}){return s9(Ag,$,v)}function lG($){return e9($)}var PW=$b,kW=vb;function HW($,v={}){let g=new Ag({type:"custom",check:"custom",fn:(_)=>_ instanceof $,abort:!0,...j.normalizeParams(v)});return g._zod.bag.Class=$,g._zod.check=(_)=>{if(!(_.value instanceof $))_.issues.push({code:"invalid_type",expected:$.name,input:_.value,inst:g,path:[...g._zod.def.path??[]]})},g}var IW=(...$)=>Ub({Codec:Q0,Boolean:OU,String:JU},...$);function YW($){let v=mG(()=>{return A$([Z($),Y$(),x$(),WU(),J$(v),N$(Z(),v)])});return v}function Zg($,v){return Ig(F0($),v)}var qL={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function XL($){l$({customError:$})}function wL(){return l$().customError}var xG;(function($){})(xG||(xG={}));var E={...Pg,...a1,iso:f6},FL=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function AL($,v){let g=$.$schema;if(g==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(g==="http://json-schema.org/draft-07/schema#")return"draft-7";if(g==="http://json-schema.org/draft-04/schema#")return"draft-4";return v??"draft-2020-12"}function ZL($,v){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let g=$.slice(1).split("/").filter(Boolean);if(g.length===0)return v.rootSchema;let _=v.version==="draft-2020-12"?"$defs":"definitions";if(g[0]===_){let U=g[1];if(!U||!v.defs[U])throw Error(`Reference not found: ${$}`);return v.defs[U]}throw Error(`Reference not found: ${$}`)}function LW($,v){if($.not!==void 0){if(typeof $.not==="object"&&Object.keys($.not).length===0)return E.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if($.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if($.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if($.if!==void 0||$.then!==void 0||$.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if($.dependentSchemas!==void 0||$.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if($.$ref){let U=$.$ref;if(v.refs.has(U))return v.refs.get(U);if(v.processing.has(U))return E.lazy(()=>{if(!v.refs.has(U))throw Error(`Circular reference not resolved: ${U}`);return v.refs.get(U)});v.processing.add(U);let z=ZL(U,v),J=Ov(z,v);return v.refs.set(U,J),v.processing.delete(U),J}if($.enum!==void 0){let U=$.enum;if(v.version==="openapi-3.0"&&$.nullable===!0&&U.length===1&&U[0]===null)return E.null();if(U.length===0)return E.never();if(U.length===1)return E.literal(U[0]);if(U.every((J)=>typeof J==="string"))return E.enum(U);let z=U.map((J)=>E.literal(J));if(z.length<2)return z[0];return E.union([z[0],z[1],...z.slice(2)])}if($.const!==void 0)return E.literal($.const);let g=$.type;if(Array.isArray(g)){let U=g.map((z)=>{let J={...$,type:z};return LW(J,v)});if(U.length===0)return E.never();if(U.length===1)return U[0];return E.union(U)}if(!g)return E.any();let _;switch(g){case"string":{let U=E.string();if($.format){let z=$.format;if(z==="email")U=U.check(E.email());else if(z==="uri"||z==="uri-reference")U=U.check(E.url());else if(z==="uuid"||z==="guid")U=U.check(E.uuid());else if(z==="date-time")U=U.check(E.iso.datetime());else if(z==="date")U=U.check(E.iso.date());else if(z==="time")U=U.check(E.iso.time());else if(z==="duration")U=U.check(E.iso.duration());else if(z==="ipv4")U=U.check(E.ipv4());else if(z==="ipv6")U=U.check(E.ipv6());else if(z==="mac")U=U.check(E.mac());else if(z==="cidr")U=U.check(E.cidrv4());else if(z==="cidr-v6")U=U.check(E.cidrv6());else if(z==="base64")U=U.check(E.base64());else if(z==="base64url")U=U.check(E.base64url());else if(z==="e164")U=U.check(E.e164());else if(z==="jwt")U=U.check(E.jwt());else if(z==="emoji")U=U.check(E.emoji());else if(z==="nanoid")U=U.check(E.nanoid());else if(z==="cuid")U=U.check(E.cuid());else if(z==="cuid2")U=U.check(E.cuid2());else if(z==="ulid")U=U.check(E.ulid());else if(z==="xid")U=U.check(E.xid());else if(z==="ksuid")U=U.check(E.ksuid())}if(typeof $.minLength==="number")U=U.min($.minLength);if(typeof $.maxLength==="number")U=U.max($.maxLength);if($.pattern)U=U.regex(new RegExp($.pattern));_=U;break}case"number":case"integer":{let U=g==="integer"?E.number().int():E.number();if(typeof $.minimum==="number")U=U.min($.minimum);if(typeof $.maximum==="number")U=U.max($.maximum);if(typeof $.exclusiveMinimum==="number")U=U.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")U=U.gt($.minimum);if(typeof $.exclusiveMaximum==="number")U=U.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")U=U.lt($.maximum);if(typeof $.multipleOf==="number")U=U.multipleOf($.multipleOf);_=U;break}case"boolean":{_=E.boolean();break}case"null":{_=E.null();break}case"object":{let U={},z=$.properties||{},J=new Set($.required||[]);for(let[O,K]of Object.entries(z)){let W=Ov(K,v);U[O]=J.has(O)?W:W.optional()}if($.propertyNames){let O=Ov($.propertyNames,v),K=$.additionalProperties&&typeof $.additionalProperties==="object"?Ov($.additionalProperties,v):E.any();if(Object.keys(U).length===0){_=E.record(O,K);break}let W=E.object(U).passthrough(),B=E.looseRecord(O,K);_=E.intersection(W,B);break}if($.patternProperties){let O=$.patternProperties,K=Object.keys(O),W=[];for(let k of K){let P=Ov(O[k],v),X=E.string().regex(new RegExp(k));W.push(E.looseRecord(X,P))}let B=[];if(Object.keys(U).length>0)B.push(E.object(U).passthrough());if(B.push(...W),B.length===0)_=E.object({}).passthrough();else if(B.length===1)_=B[0];else{let k=E.intersection(B[0],B[1]);for(let P=2;P<B.length;P++)k=E.intersection(k,B[P]);_=k}break}let b=E.object(U);if($.additionalProperties===!1)_=b.strict();else if(typeof $.additionalProperties==="object")_=b.catchall(Ov($.additionalProperties,v));else _=b.passthrough();break}case"array":{let{prefixItems:U,items:z}=$;if(U&&Array.isArray(U)){let J=U.map((O)=>Ov(O,v)),b=z&&typeof z==="object"&&!Array.isArray(z)?Ov(z,v):void 0;if(b)_=E.tuple(J).rest(b);else _=E.tuple(J);if(typeof $.minItems==="number")_=_.check(E.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(E.maxLength($.maxItems))}else if(Array.isArray(z)){let J=z.map((O)=>Ov(O,v)),b=$.additionalItems&&typeof $.additionalItems==="object"?Ov($.additionalItems,v):void 0;if(b)_=E.tuple(J).rest(b);else _=E.tuple(J);if(typeof $.minItems==="number")_=_.check(E.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(E.maxLength($.maxItems))}else if(z!==void 0){let J=Ov(z,v),b=E.array(J);if(typeof $.minItems==="number")b=b.min($.minItems);if(typeof $.maxItems==="number")b=b.max($.maxItems);_=b}else _=E.array(E.any());break}default:throw Error(`Unsupported type: ${g}`)}if($.description)_=_.describe($.description);if($.default!==void 0)_=_.default($.default);return _}function Ov($,v){if(typeof $==="boolean")return $?E.any():E.never();let g=LW($,v),_=$.type||$.enum!==void 0||$.const!==void 0;if($.anyOf&&Array.isArray($.anyOf)){let b=$.anyOf.map((K)=>Ov(K,v)),O=E.union(b);g=_?E.intersection(g,O):O}if($.oneOf&&Array.isArray($.oneOf)){let b=$.oneOf.map((K)=>Ov(K,v)),O=E.xor(b);g=_?E.intersection(g,O):O}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)g=_?g:E.any();else{let b=_?g:Ov($.allOf[0],v),O=_?0:1;for(let K=O;K<$.allOf.length;K++)b=E.intersection(b,Ov($.allOf[K],v));g=b}if($.nullable===!0&&v.version==="openapi-3.0")g=E.nullable(g);if($.readOnly===!0)g=E.readonly(g);let U={},z=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let b of z)if(b in $)U[b]=$[b];let J=["contentEncoding","contentMediaType","contentSchema"];for(let b of J)if(b in $)U[b]=$[b];for(let b of Object.keys($))if(!FL.has(b))U[b]=$[b];if(Object.keys(U).length>0)v.registry.add(g,U);return g}function qW($,v){if(typeof $==="boolean")return $?E.any():E.never();let g=AL($,v?.defaultTarget),_=$.$defs||$.definitions||{},U={version:g,defs:_,refs:new Map,processing:new Set,rootSchema:$,registry:v?.registry??e$};return Ov($,U)}var hG={};ev(hG,{string:()=>ML,number:()=>QL,date:()=>rL,boolean:()=>SL,bigint:()=>NL});function ML($){return q9(JU,$)}function QL($){return S9(GU,$)}function SL($){return T9(OU,$)}function NL($){return V9(KU,$)}function rL($){return o9(Lg,$)}l$(Jg());var m6="io.modelcontextprotocol/related-task",r0="2.0",Uv=S0(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),XW=A$([Z(),Y$().int()]),wW=Z(),sS=$v({ttl:A$([Y$(),WU()]).optional(),pollInterval:Y$().optional()}),uL=x({ttl:Y$().optional()}),yL=x({taskId:Z()}),pG=$v({progressToken:XW.optional(),[m6]:yL.optional()}),rv=x({_meta:pG.optional()}),Mg=rv.extend({task:uL.optional()}),FW=($)=>Mg.safeParse($).success,gv=x({method:Z(),params:rv.loose().optional()}),Rv=x({_meta:pG.optional()}),Tv=x({method:Z(),params:Rv.loose().optional()}),_v=$v({_meta:pG.optional()}),kU=A$([Z(),Y$().int()]),AW=x({jsonrpc:t(r0),id:kU,...gv.shape}).strict(),oG=($)=>AW.safeParse($).success,ZW=x({jsonrpc:t(r0),...Tv.shape}).strict(),MW=($)=>ZW.safeParse($).success,nG=x({jsonrpc:t(r0),id:kU,result:_v}).strict(),Qg=($)=>nG.safeParse($).success;var F$;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(F$||(F$={}));var tG=x({jsonrpc:t(r0),id:kU.optional(),error:x({code:Y$().int(),message:Z(),data:Q$().optional()})}).strict();var QW=($)=>tG.safeParse($).success;var SW=A$([AW,ZW,nG,tG]),eS=A$([nG,tG]),u0=_v.strict(),DL=Rv.extend({requestId:kU.optional(),reason:Z().optional()}),y0=Tv.extend({method:t("notifications/cancelled"),params:DL}),RL=x({src:Z(),mimeType:Z().optional(),sizes:J$(Z()).optional(),theme:vv(["light","dark"]).optional()}),Sg=x({icons:J$(RL).optional()}),PU=x({name:Z(),title:Z().optional()}),Ng=PU.extend({...PU.shape,...Sg.shape,version:Z(),websiteUrl:Z().optional(),description:Z().optional()}),TL=BU(x({applyDefaults:x$().optional()}),N$(Z(),Q$())),jL=Zg(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},BU(x({form:TL.optional(),url:Uv.optional()}),N$(Z(),Q$()).optional())),VL=$v({list:Uv.optional(),cancel:Uv.optional(),requests:$v({sampling:$v({createMessage:Uv.optional()}).optional(),elicitation:$v({create:Uv.optional()}).optional()}).optional()}),CL=$v({list:Uv.optional(),cancel:Uv.optional(),requests:$v({tools:$v({call:Uv.optional()}).optional()}).optional()}),fL=x({experimental:N$(Z(),Uv).optional(),sampling:x({context:Uv.optional(),tools:Uv.optional()}).optional(),elicitation:jL.optional(),roots:x({listChanged:x$().optional()}).optional(),tasks:VL.optional()}),mL=rv.extend({protocolVersion:Z(),capabilities:fL,clientInfo:Ng}),cL=gv.extend({method:t("initialize"),params:mL});var EL=x({experimental:N$(Z(),Uv).optional(),logging:Uv.optional(),completions:Uv.optional(),prompts:x({listChanged:x$().optional()}).optional(),resources:x({subscribe:x$().optional(),listChanged:x$().optional()}).optional(),tools:x({listChanged:x$().optional()}).optional(),tasks:CL.optional()}),iL=_v.extend({protocolVersion:Z(),capabilities:EL,serverInfo:Ng,instructions:Z().optional()}),lL=Tv.extend({method:t("notifications/initialized"),params:Rv.optional()});var c6=gv.extend({method:t("ping"),params:rv.optional()}),xL=x({progress:Y$(),total:y$(Y$()),message:y$(Z())}),hL=x({...Rv.shape,...xL.shape,progressToken:XW}),D0=Tv.extend({method:t("notifications/progress"),params:hL}),pL=rv.extend({cursor:wW.optional()}),rg=gv.extend({params:pL.optional()}),ug=_v.extend({nextCursor:wW.optional()}),oL=vv(["working","input_required","completed","failed","cancelled"]),yg=x({taskId:Z(),status:oL,ttl:A$([Y$(),WU()]),createdAt:Z(),lastUpdatedAt:Z(),pollInterval:y$(Y$()),statusMessage:y$(Z())}),R0=_v.extend({task:yg}),nL=Rv.merge(yg),Dg=Tv.extend({method:t("notifications/tasks/status"),params:nL}),T0=gv.extend({method:t("tasks/get"),params:rv.extend({taskId:Z()})}),j0=_v.merge(yg),V0=gv.extend({method:t("tasks/result"),params:rv.extend({taskId:Z()})}),$N=_v.loose(),C0=rg.extend({method:t("tasks/list")}),f0=ug.extend({tasks:J$(yg)}),m0=gv.extend({method:t("tasks/cancel"),params:rv.extend({taskId:Z()})}),NW=_v.merge(yg),rW=x({uri:Z(),mimeType:y$(Z()),_meta:N$(Z(),Q$()).optional()}),uW=rW.extend({text:Z()}),dG=Z().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),yW=rW.extend({blob:dG}),Rg=vv(["user","assistant"]),HU=x({audience:J$(Rg).optional(),priority:Y$().min(0).max(1).optional(),lastModified:f6.datetime({offset:!0}).optional()}),DW=x({...PU.shape,...Sg.shape,uri:Z(),description:y$(Z()),mimeType:y$(Z()),annotations:HU.optional(),_meta:y$($v({}))}),tL=x({...PU.shape,...Sg.shape,uriTemplate:Z(),description:y$(Z()),mimeType:y$(Z()),annotations:HU.optional(),_meta:y$($v({}))}),aG=rg.extend({method:t("resources/list")}),Tg=ug.extend({resources:J$(DW)}),sG=rg.extend({method:t("resources/templates/list")}),eG=ug.extend({resourceTemplates:J$(tL)}),$3=rv.extend({uri:Z()}),dL=$3,v3=gv.extend({method:t("resources/read"),params:dL}),jg=_v.extend({contents:J$(A$([uW,yW]))}),U3=Tv.extend({method:t("notifications/resources/list_changed"),params:Rv.optional()}),aL=$3,sL=gv.extend({method:t("resources/subscribe"),params:aL}),eL=$3,$q=gv.extend({method:t("resources/unsubscribe"),params:eL}),vq=Rv.extend({uri:Z()}),Uq=Tv.extend({method:t("notifications/resources/updated"),params:vq}),gq=x({name:Z(),description:y$(Z()),required:y$(x$())}),_q=x({...PU.shape,...Sg.shape,description:y$(Z()),arguments:y$(J$(gq)),_meta:y$($v({}))}),g3=rg.extend({method:t("prompts/list")}),_3=ug.extend({prompts:J$(_q)}),zq=rv.extend({name:Z(),arguments:N$(Z(),Z()).optional()}),Jq=gv.extend({method:t("prompts/get"),params:zq}),z3=x({type:t("text"),text:Z(),annotations:HU.optional(),_meta:N$(Z(),Q$()).optional()}),J3=x({type:t("image"),data:dG,mimeType:Z(),annotations:HU.optional(),_meta:N$(Z(),Q$()).optional()}),b3=x({type:t("audio"),data:dG,mimeType:Z(),annotations:HU.optional(),_meta:N$(Z(),Q$()).optional()}),bq=x({type:t("tool_use"),name:Z(),id:Z(),input:N$(Z(),Q$()),_meta:N$(Z(),Q$()).optional()}),G3=x({type:t("resource"),resource:A$([uW,yW]),annotations:HU.optional(),_meta:N$(Z(),Q$()).optional()}),O3=DW.extend({type:t("resource_link")}),IU=A$([z3,J3,b3,O3,G3]),Gq=x({role:Rg,content:IU}),Oq=_v.extend({description:Z().optional(),messages:J$(Gq)}),K3=Tv.extend({method:t("notifications/prompts/list_changed"),params:Rv.optional()}),Kq=x({title:Z().optional(),readOnlyHint:x$().optional(),destructiveHint:x$().optional(),idempotentHint:x$().optional(),openWorldHint:x$().optional()}),Wq=x({taskSupport:vv(["required","optional","forbidden"]).optional()}),c0=x({...PU.shape,...Sg.shape,description:Z().optional(),inputSchema:x({type:t("object"),properties:N$(Z(),Uv).optional(),required:J$(Z()).optional()}).catchall(Q$()),outputSchema:x({type:t("object"),properties:N$(Z(),Uv).optional(),required:J$(Z()).optional()}).catchall(Q$()).optional(),annotations:Kq.optional(),execution:Wq.optional(),_meta:N$(Z(),Q$()).optional()}),Vg=rg.extend({method:t("tools/list")}),Bq=ug.extend({tools:J$(c0)}),E6=_v.extend({content:J$(IU).default([]),structuredContent:N$(Z(),Q$()).optional(),isError:x$().optional()}),vN=E6.or(_v.extend({toolResult:Q$()})),Pq=Mg.extend({name:Z(),arguments:N$(Z(),Q$()).optional()}),Cg=gv.extend({method:t("tools/call"),params:Pq}),W3=Tv.extend({method:t("notifications/tools/list_changed"),params:Rv.optional()}),UN=x({autoRefresh:x$().default(!0),debounceMs:Y$().int().nonnegative().default(300)}),RW=vv(["debug","info","notice","warning","error","critical","alert","emergency"]),kq=rv.extend({level:RW}),Hq=gv.extend({method:t("logging/setLevel"),params:kq}),Iq=Rv.extend({level:RW,logger:Z().optional(),data:Q$()}),B3=Tv.extend({method:t("notifications/message"),params:Iq}),Yq=x({name:Z().optional()}),Lq=x({hints:J$(Yq).optional(),costPriority:Y$().min(0).max(1).optional(),speedPriority:Y$().min(0).max(1).optional(),intelligencePriority:Y$().min(0).max(1).optional()}),qq=x({mode:vv(["auto","required","none"]).optional()}),Xq=x({type:t("tool_result"),toolUseId:Z().describe("The unique identifier for the corresponding tool call."),content:J$(IU).default([]),structuredContent:x({}).loose().optional(),isError:x$().optional(),_meta:N$(Z(),Q$()).optional()}),wq=wg("type",[z3,J3,b3]),N0=wg("type",[z3,J3,b3,bq,Xq]),Fq=x({role:Rg,content:A$([N0,J$(N0)]),_meta:N$(Z(),Q$()).optional()}),Aq=Mg.extend({messages:J$(Fq),modelPreferences:Lq.optional(),systemPrompt:Z().optional(),includeContext:vv(["none","thisServer","allServers"]).optional(),temperature:Y$().optional(),maxTokens:Y$().int(),stopSequences:J$(Z()).optional(),metadata:Uv.optional(),tools:J$(c0).optional(),toolChoice:qq.optional()}),Zq=gv.extend({method:t("sampling/createMessage"),params:Aq}),Mq=_v.extend({model:Z(),stopReason:y$(vv(["endTurn","stopSequence","maxTokens"]).or(Z())),role:Rg,content:wq}),Qq=_v.extend({model:Z(),stopReason:y$(vv(["endTurn","stopSequence","maxTokens","toolUse"]).or(Z())),role:Rg,content:A$([N0,J$(N0)])}),Sq=x({type:t("boolean"),title:Z().optional(),description:Z().optional(),default:x$().optional()}),Nq=x({type:t("string"),title:Z().optional(),description:Z().optional(),minLength:Y$().optional(),maxLength:Y$().optional(),format:vv(["email","uri","date","date-time"]).optional(),default:Z().optional()}),rq=x({type:vv(["number","integer"]),title:Z().optional(),description:Z().optional(),minimum:Y$().optional(),maximum:Y$().optional(),default:Y$().optional()}),uq=x({type:t("string"),title:Z().optional(),description:Z().optional(),enum:J$(Z()),default:Z().optional()}),yq=x({type:t("string"),title:Z().optional(),description:Z().optional(),oneOf:J$(x({const:Z(),title:Z()})),default:Z().optional()}),Dq=x({type:t("string"),title:Z().optional(),description:Z().optional(),enum:J$(Z()),enumNames:J$(Z()).optional(),default:Z().optional()}),Rq=A$([uq,yq]),Tq=x({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:Y$().optional(),maxItems:Y$().optional(),items:x({type:t("string"),enum:J$(Z())}),default:J$(Z()).optional()}),jq=x({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:Y$().optional(),maxItems:Y$().optional(),items:x({anyOf:J$(x({const:Z(),title:Z()}))}),default:J$(Z()).optional()}),Vq=A$([Tq,jq]),Cq=A$([Dq,Rq,Vq]),fq=A$([Cq,Sq,Nq,rq]),mq=Mg.extend({mode:t("form").optional(),message:Z(),requestedSchema:x({type:t("object"),properties:N$(Z(),fq),required:J$(Z()).optional()})}),cq=Mg.extend({mode:t("url"),message:Z(),elicitationId:Z(),url:Z().url()}),Eq=A$([mq,cq]),iq=gv.extend({method:t("elicitation/create"),params:Eq}),lq=Rv.extend({elicitationId:Z()}),xq=Tv.extend({method:t("notifications/elicitation/complete"),params:lq}),hq=_v.extend({action:vv(["accept","decline","cancel"]),content:Zg(($)=>$===null?void 0:$,N$(Z(),A$([Z(),Y$(),x$(),J$(Z())])).optional())}),pq=x({type:t("ref/resource"),uri:Z()});var oq=x({type:t("ref/prompt"),name:Z()}),nq=rv.extend({ref:A$([oq,pq]),argument:x({name:Z(),value:Z()}),context:x({arguments:N$(Z(),Z()).optional()}).optional()}),tq=gv.extend({method:t("completion/complete"),params:nq});var dq=_v.extend({completion:$v({values:J$(Z()).max(100),total:y$(Y$().int()),hasMore:y$(x$())})}),aq=x({uri:Z().startsWith("file://"),name:Z().optional(),_meta:N$(Z(),Q$()).optional()}),sq=gv.extend({method:t("roots/list"),params:rv.optional()}),eq=_v.extend({roots:J$(aq)}),$X=Tv.extend({method:t("notifications/roots/list_changed"),params:Rv.optional()}),gN=A$([c6,cL,tq,Hq,Jq,g3,aG,sG,v3,sL,$q,Cg,Vg,T0,V0,C0,m0]),_N=A$([y0,D0,lL,$X,Dg]),zN=A$([u0,Mq,Qq,hq,eq,j0,f0,R0]),JN=A$([c6,Zq,iq,sq,T0,V0,C0,m0]),bN=A$([y0,D0,B3,Uq,U3,W3,K3,Dg,xq]),GN=A$([u0,iL,dq,Oq,_3,Tg,eG,jg,E6,Bq,j0,f0,R0]);class k$ extends Error{constructor($,v,g){super(`MCP error ${$}: ${v}`);this.code=$,this.data=g,this.name="McpError"}static fromError($,v,g){if($===F$.UrlElicitationRequired&&g){let _=g;if(_.elicitations)return new TW(_.elicitations,v)}return new k$($,v,g)}}class TW extends k${constructor($,v=`URL elicitation${$.length>1?"s":""} required`){super(F$.UrlElicitationRequired,v,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function E0($){return!!$._zod}function i0($,v){if(E0($))return E4($,v);return $.safeParse(v)}function jW($){if(!$)return;let v;if(E0($))v=$._zod?.def?.shape;else v=$.shape;if(!v)return;if(typeof v==="function")try{return v()}catch{return}return v}function VW($){if(E0($)){let z=$._zod?.def;if(z){if(z.value!==void 0)return z.value;if(Array.isArray(z.values)&&z.values.length>0)return z.values[0]}}let g=$._def;if(g){if(g.value!==void 0)return g.value;if(Array.isArray(g.values)&&g.values.length>0)return g.values[0]}let _=$.value;if(_!==void 0)return _;return}function i6($){return $==="completed"||$==="failed"||$==="cancelled"}var vX=Symbol("Let zodToJsonSchema decide on which parser to use");var pN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function P3($){let g=jW($)?.method;if(!g)throw Error("Schema is missing a method literal");let _=VW(g);if(typeof _!=="string")throw Error("Schema method literal must be a string");return _}function k3($,v){let g=i0($,v);if(!g.success)throw g.error;return g.data}var bX=60000;class mg{constructor($){if(this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(y0,(v)=>{this._oncancel(v)}),this.setNotificationHandler(D0,(v)=>{this._onprogress(v)}),this.setRequestHandler(c6,(v)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(T0,async(v,g)=>{let _=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!_)throw new k$(F$.InvalidParams,"Failed to retrieve task: Task not found");return{..._}}),this.setRequestHandler(V0,async(v,g)=>{let _=async()=>{let U=v.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(U,g.sessionId)){if(J.type==="response"||J.type==="error"){let b=J.message,O=b.id,K=this._requestResolvers.get(O);if(K)if(this._requestResolvers.delete(O),J.type==="response")K(b);else{let W=b,B=new k$(W.error.code,W.error.message,W.error.data);K(B)}else{let W=J.type==="response"?"Response":"Error";this._onerror(Error(`${W} handler missing for request ${O}`))}continue}await this._transport?.send(J.message,{relatedRequestId:g.requestId})}}let z=await this._taskStore.getTask(U,g.sessionId);if(!z)throw new k$(F$.InvalidParams,`Task not found: ${U}`);if(!i6(z.status))return await this._waitForTaskUpdate(U,g.signal),await _();if(i6(z.status)){let J=await this._taskStore.getTaskResult(U,g.sessionId);return this._clearTaskQueue(U),{...J,_meta:{...J._meta,[m6]:{taskId:U}}}}return await _()};return await _()}),this.setRequestHandler(C0,async(v,g)=>{try{let{tasks:_,nextCursor:U}=await this._taskStore.listTasks(v.params?.cursor,g.sessionId);return{tasks:_,nextCursor:U,_meta:{}}}catch(_){throw new k$(F$.InvalidParams,`Failed to list tasks: ${_ instanceof Error?_.message:String(_)}`)}}),this.setRequestHandler(m0,async(v,g)=>{try{let _=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!_)throw new k$(F$.InvalidParams,`Task not found: ${v.params.taskId}`);if(i6(_.status))throw new k$(F$.InvalidParams,`Cannot cancel task in terminal status: ${_.status}`);await this._taskStore.updateTaskStatus(v.params.taskId,"cancelled","Client cancelled task execution.",g.sessionId),this._clearTaskQueue(v.params.taskId);let U=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!U)throw new k$(F$.InvalidParams,`Task not found after cancellation: ${v.params.taskId}`);return{_meta:{},...U}}catch(_){if(_ instanceof k$)throw _;throw new k$(F$.InvalidRequest,`Failed to cancel task: ${_ instanceof Error?_.message:String(_)}`)}})}async _oncancel($){if(!$.params.requestId)return;this._requestHandlerAbortControllers.get($.params.requestId)?.abort($.params.reason)}_setupTimeout($,v,g,_,U=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(_,v),startTime:Date.now(),timeout:v,maxTotalTimeout:g,resetTimeoutOnProgress:U,onTimeout:_})}_resetTimeout($){let v=this._timeoutInfo.get($);if(!v)return!1;let g=Date.now()-v.startTime;if(v.maxTotalTimeout&&g>=v.maxTotalTimeout)throw this._timeoutInfo.delete($),k$.fromError(F$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:g});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout($){let v=this._timeoutInfo.get($);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete($)}async connect($){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=$;let v=this.transport?.onclose;this._transport.onclose=()=>{v?.(),this._onclose()};let g=this.transport?.onerror;this._transport.onerror=(U)=>{g?.(U),this._onerror(U)};let _=this._transport?.onmessage;this._transport.onmessage=(U,z)=>{if(_?.(U,z),Qg(U)||QW(U))this._onresponse(U);else if(oG(U))this._onrequest(U,z);else if(MW(U))this._onnotification(U);else this._onerror(Error(`Unknown message type: ${JSON.stringify(U)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let g of this._timeoutInfo.values())clearTimeout(g.timeoutId);this._timeoutInfo.clear();for(let g of this._requestHandlerAbortControllers.values())g.abort();this._requestHandlerAbortControllers.clear();let v=k$.fromError(F$.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let g of $.values())g(v)}_onerror($){this.onerror?.($)}_onnotification($){let v=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(v===void 0)return;Promise.resolve().then(()=>v($)).catch((g)=>this._onerror(Error(`Uncaught error in notification handler: ${g}`)))}_onrequest($,v){let g=this._requestHandlers.get($.method)??this.fallbackRequestHandler,_=this._transport,U=$.params?._meta?.[m6]?.taskId;if(g===void 0){let K={jsonrpc:"2.0",id:$.id,error:{code:F$.MethodNotFound,message:"Method not found"}};if(U&&this._taskMessageQueue)this._enqueueTaskMessage(U,{type:"error",message:K,timestamp:Date.now()},_?.sessionId).catch((W)=>this._onerror(Error(`Failed to enqueue error response: ${W}`)));else _?.send(K).catch((W)=>this._onerror(Error(`Failed to send an error response: ${W}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set($.id,z);let J=FW($.params)?$.params.task:void 0,b=this._taskStore?this.requestTaskStore($,_?.sessionId):void 0,O={signal:z.signal,sessionId:_?.sessionId,_meta:$.params?._meta,sendNotification:async(K)=>{if(z.signal.aborted)return;let W={relatedRequestId:$.id};if(U)W.relatedTask={taskId:U};await this.notification(K,W)},sendRequest:async(K,W,B)=>{if(z.signal.aborted)throw new k$(F$.ConnectionClosed,"Request was cancelled");let k={...B,relatedRequestId:$.id};if(U&&!k.relatedTask)k.relatedTask={taskId:U};let P=k.relatedTask?.taskId??U;if(P&&b)await b.updateTaskStatus(P,"input_required");return await this.request(K,W,k)},authInfo:v?.authInfo,requestId:$.id,requestInfo:v?.requestInfo,taskId:U,taskStore:b,taskRequestedTtl:J?.ttl,closeSSEStream:v?.closeSSEStream,closeStandaloneSSEStream:v?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability($.method)}).then(()=>g($,O)).then(async(K)=>{if(z.signal.aborted)return;let W={result:K,jsonrpc:"2.0",id:$.id};if(U&&this._taskMessageQueue)await this._enqueueTaskMessage(U,{type:"response",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)},async(K)=>{if(z.signal.aborted)return;let W={jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(K.code)?K.code:F$.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(U&&this._taskMessageQueue)await this._enqueueTaskMessage(U,{type:"error",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).finally(()=>{if(this._requestHandlerAbortControllers.get($.id)===z)this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:v,...g}=$.params,_=Number(v),U=this._progressHandlers.get(_);if(!U){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let z=this._responseHandlers.get(_),J=this._timeoutInfo.get(_);if(J&&z&&J.resetTimeoutOnProgress)try{this._resetTimeout(_)}catch(b){this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),z(b);return}U(g)}_onresponse($){let v=Number($.id),g=this._requestResolvers.get(v);if(g){if(this._requestResolvers.delete(v),Qg($))g($);else{let z=new k$($.error.code,$.error.message,$.error.data);g(z)}return}let _=this._responseHandlers.get(v);if(_===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}this._responseHandlers.delete(v),this._cleanupTimeout(v);let U=!1;if(Qg($)&&$.result&&typeof $.result==="object"){let z=$.result;if(z.task&&typeof z.task==="object"){let J=z.task;if(typeof J.taskId==="string")U=!0,this._taskProgressTokens.set(J.taskId,v)}}if(!U)this._progressHandlers.delete(v);if(Qg($))_($);else{let z=k$.fromError($.error.code,$.error.message,$.error.data);_(z)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream($,v,g){let{task:_}=g??{};if(!_){try{yield{type:"result",result:await this.request($,v,g)}}catch(z){yield{type:"error",error:z instanceof k$?z:new k$(F$.InternalError,String(z))}}return}let U;try{let z=await this.request($,R0,g);if(z.task)U=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new k$(F$.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:U},g);if(yield{type:"taskStatus",task:J},i6(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:U},v,g)};else if(J.status==="failed")yield{type:"error",error:new k$(F$.InternalError,`Task ${U} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new k$(F$.InternalError,`Task ${U} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:U},v,g)};return}let b=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((O)=>setTimeout(O,b)),g?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof k$?z:new k$(F$.InternalError,String(z))}}}request($,v,g){let{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z,task:J,relatedTask:b}=g??{};return new Promise((O,K)=>{let W=(L)=>{K(L)};if(!this._transport){W(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),J)this.assertTaskCapability($.method)}catch(L){W(L);return}g?.signal?.throwIfAborted();let B=this._requestMessageId++,k={...$,jsonrpc:"2.0",id:B};if(g?.onprogress)this._progressHandlers.set(B,g.onprogress),k.params={...$.params,_meta:{...$.params?._meta||{},progressToken:B}};if(J)k.params={...k.params,task:J};if(b)k.params={...k.params,_meta:{...k.params?._meta||{},[m6]:b}};let P=(L)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(L)}},{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z}).catch((F)=>this._onerror(Error(`Failed to send cancellation: ${F}`)));let q=L instanceof k$?L:new k$(F$.RequestTimeout,String(L));K(q)};this._responseHandlers.set(B,(L)=>{if(g?.signal?.aborted)return;if(L instanceof Error)return K(L);try{let q=i0(v,L.result);if(!q.success)K(q.error);else O(q.data)}catch(q){K(q)}}),g?.signal?.addEventListener("abort",()=>{P(g?.signal?.reason)});let X=g?.timeout??bX,Y=()=>P(k$.fromError(F$.RequestTimeout,"Request timed out",{timeout:X}));this._setupTimeout(B,X,g?.maxTotalTimeout,Y,g?.resetTimeoutOnProgress??!1);let H=b?.taskId;if(H){let L=(q)=>{let F=this._responseHandlers.get(B);if(F)F(q);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,L),this._enqueueTaskMessage(H,{type:"request",message:k,timestamp:Date.now()}).catch((q)=>{this._cleanupTimeout(B),K(q)})}else this._transport.send(k,{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z}).catch((L)=>{this._cleanupTimeout(B),K(L)})})}async getTask($,v){return this.request({method:"tasks/get",params:$},j0,v)}async getTaskResult($,v,g){return this.request({method:"tasks/result",params:$},v,g)}async listTasks($,v){return this.request({method:"tasks/list",params:$},f0,v)}async cancelTask($,v){return this.request({method:"tasks/cancel",params:$},NW,v)}async notification($,v){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let g=v?.relatedTask?.taskId;if(g){let J={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[m6]:v.relatedTask}}};await this._enqueueTaskMessage(g,{type:"notification",message:J,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes($.method)&&!$.params&&!v?.relatedRequestId&&!v?.relatedTask){if(this._pendingDebouncedNotifications.has($.method))return;this._pendingDebouncedNotifications.add($.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete($.method),!this._transport)return;let J={...$,jsonrpc:"2.0"};if(v?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[m6]:v.relatedTask}}};this._transport?.send(J,v).catch((b)=>this._onerror(b))});return}let z={...$,jsonrpc:"2.0"};if(v?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[m6]:v.relatedTask}}};await this._transport.send(z,v)}setRequestHandler($,v){let g=P3($);this.assertRequestHandlerCapability(g),this._requestHandlers.set(g,(_,U)=>{let z=k3($,_);return Promise.resolve(v(z,U))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,v){let g=P3($);this._notificationHandlers.set(g,(_)=>{let U=k3($,_);return Promise.resolve(v(U))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let v=this._taskProgressTokens.get($);if(v!==void 0)this._progressHandlers.delete(v),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,v,g){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let _=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue($,v,g,_)}async _clearTaskQueue($,v){if(this._taskMessageQueue){let g=await this._taskMessageQueue.dequeueAll($,v);for(let _ of g)if(_.type==="request"&&oG(_.message)){let U=_.message.id,z=this._requestResolvers.get(U);if(z)z(new k$(F$.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(U);else this._onerror(Error(`Resolver missing for request ${U} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,v){let g=this._options?.defaultTaskPollInterval??1000;try{let _=await this._taskStore?.getTask($);if(_?.pollInterval)g=_.pollInterval}catch{}return new Promise((_,U)=>{if(v.aborted){U(new k$(F$.InvalidRequest,"Request cancelled"));return}let z=setTimeout(_,g);v.addEventListener("abort",()=>{clearTimeout(z),U(new k$(F$.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,v){let g=this._taskStore;if(!g)throw Error("No task store configured");return{createTask:async(_)=>{if(!$)throw Error("No request provided");return await g.createTask(_,$.id,{method:$.method,params:$.params},v)},getTask:async(_)=>{let U=await g.getTask(_,v);if(!U)throw new k$(F$.InvalidParams,"Failed to retrieve task: Task not found");return U},storeTaskResult:async(_,U,z)=>{await g.storeTaskResult(_,U,z,v);let J=await g.getTask(_,v);if(J){let b=Dg.parse({method:"notifications/tasks/status",params:J});if(await this.notification(b),i6(J.status))this._cleanupTaskProgressHandler(_)}},getTaskResult:(_)=>{return g.getTaskResult(_,v)},updateTaskStatus:async(_,U,z)=>{let J=await g.getTask(_,v);if(!J)throw new k$(F$.InvalidParams,`Task "${_}" not found - it may have been cleaned up`);if(i6(J.status))throw new k$(F$.InvalidParams,`Cannot update task "${_}" from terminal status "${J.status}" to "${U}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await g.updateTaskStatus(_,U,z,v);let b=await g.getTask(_,v);if(b){let O=Dg.parse({method:"notifications/tasks/status",params:b});if(await this.notification(O),i6(b.status))this._cleanupTaskProgressHandler(_)}},listTasks:(_)=>{return g.listTasks(_,v)}}}}var H3="2026-01-26";var GX="ui/notifications/tool-input-partial";var OX=I.union([I.literal("light"),I.literal("dark")]).describe("Color theme preference for the host environment."),cg=I.union([I.literal("inline"),I.literal("fullscreen"),I.literal("pip")]).describe("Display mode for UI presentation."),KX=I.union([I.literal("--color-background-primary"),I.literal("--color-background-secondary"),I.literal("--color-background-tertiary"),I.literal("--color-background-inverse"),I.literal("--color-background-ghost"),I.literal("--color-background-info"),I.literal("--color-background-danger"),I.literal("--color-background-success"),I.literal("--color-background-warning"),I.literal("--color-background-disabled"),I.literal("--color-text-primary"),I.literal("--color-text-secondary"),I.literal("--color-text-tertiary"),I.literal("--color-text-inverse"),I.literal("--color-text-ghost"),I.literal("--color-text-info"),I.literal("--color-text-danger"),I.literal("--color-text-success"),I.literal("--color-text-warning"),I.literal("--color-text-disabled"),I.literal("--color-border-primary"),I.literal("--color-border-secondary"),I.literal("--color-border-tertiary"),I.literal("--color-border-inverse"),I.literal("--color-border-ghost"),I.literal("--color-border-info"),I.literal("--color-border-danger"),I.literal("--color-border-success"),I.literal("--color-border-warning"),I.literal("--color-border-disabled"),I.literal("--color-ring-primary"),I.literal("--color-ring-secondary"),I.literal("--color-ring-inverse"),I.literal("--color-ring-info"),I.literal("--color-ring-danger"),I.literal("--color-ring-success"),I.literal("--color-ring-warning"),I.literal("--font-sans"),I.literal("--font-mono"),I.literal("--font-weight-normal"),I.literal("--font-weight-medium"),I.literal("--font-weight-semibold"),I.literal("--font-weight-bold"),I.literal("--font-text-xs-size"),I.literal("--font-text-sm-size"),I.literal("--font-text-md-size"),I.literal("--font-text-lg-size"),I.literal("--font-heading-xs-size"),I.literal("--font-heading-sm-size"),I.literal("--font-heading-md-size"),I.literal("--font-heading-lg-size"),I.literal("--font-heading-xl-size"),I.literal("--font-heading-2xl-size"),I.literal("--font-heading-3xl-size"),I.literal("--font-text-xs-line-height"),I.literal("--font-text-sm-line-height"),I.literal("--font-text-md-line-height"),I.literal("--font-text-lg-line-height"),I.literal("--font-heading-xs-line-height"),I.literal("--font-heading-sm-line-height"),I.literal("--font-heading-md-line-height"),I.literal("--font-heading-lg-line-height"),I.literal("--font-heading-xl-line-height"),I.literal("--font-heading-2xl-line-height"),I.literal("--font-heading-3xl-line-height"),I.literal("--border-radius-xs"),I.literal("--border-radius-sm"),I.literal("--border-radius-md"),I.literal("--border-radius-lg"),I.literal("--border-radius-xl"),I.literal("--border-radius-full"),I.literal("--border-width-regular"),I.literal("--shadow-hairline"),I.literal("--shadow-sm"),I.literal("--shadow-md"),I.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),WX=I.record(KX.describe(`Style variables for theming MCP apps.
146
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of $.seen.entries()){let G=J[1];if(v===J[0]){z(J);continue}if($.external){let O=$.external.registry.get(J[0])?.id;if(v!==J[0]&&O){z(J);continue}}if($.metadataRegistry.get(J[0])?.id){z(J);continue}if(G.cycle){z(J);continue}if(G.count>1){if($.reused==="ref"){z(J);continue}}}}function C6($,v){let g=$.seen.get(v);if(!g)throw Error("Unprocessed schema. This is a bug in Zod.");let _=(J)=>{let G=$.seen.get(J);if(G.ref===null)return;let K=G.def??G.schema,O={...K},W=G.ref;if(G.ref=null,W){_(W);let k=$.seen.get(W),P=k.schema;if(P.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))K.allOf=K.allOf??[],K.allOf.push(P);else Object.assign(K,P);if(Object.assign(K,O),J._zod.parent===W)for(let L in K){if(L==="$ref"||L==="allOf")continue;if(!(L in O))delete K[L]}if(P.$ref&&k.def)for(let L in K){if(L==="$ref"||L==="allOf")continue;if(L in k.def&&JSON.stringify(K[L])===JSON.stringify(k.def[L]))delete K[L]}}let B=J._zod.parent;if(B&&B!==W){_(B);let k=$.seen.get(B);if(k?.schema.$ref){if(K.$ref=k.schema.$ref,k.def)for(let P in K){if(P==="$ref"||P==="allOf")continue;if(P in k.def&&JSON.stringify(K[P])===JSON.stringify(k.def[P]))delete K[P]}}}$.override({zodSchema:J,jsonSchema:K,path:G.path??[]})};for(let J of[...$.seen.entries()].reverse())_(J[0]);let U={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let J=$.external.registry.get(v)?.id;if(!J)throw Error("Schema is missing an `id` property");U.$id=$.external.uri(J)}Object.assign(U,g.def??g.schema);let z=$.external?.defs??{};for(let J of $.seen.entries()){let G=J[1];if(G.def&&G.defId)z[G.defId]=G.def}if($.external);else if(Object.keys(z).length>0)if($.target==="draft-2020-12")U.$defs=z;else U.definitions=z;try{let J=JSON.parse(JSON.stringify(U));return Object.defineProperty(J,"~standard",{value:{...v["~standard"],jsonSchema:{input:JU(v,"input",$.processors),output:JU(v,"output",$.processors)}},enumerable:!1,writable:!1}),J}catch(J){throw Error("Error converting schema to JSON.")}}function Hv($,v){let g=v??{seen:new Set};if(g.seen.has($))return!1;g.seen.add($);let _=$._zod.def;if(_.type==="transform")return!0;if(_.type==="array")return Hv(_.element,g);if(_.type==="set")return Hv(_.valueType,g);if(_.type==="lazy")return Hv(_.getter(),g);if(_.type==="promise"||_.type==="optional"||_.type==="nonoptional"||_.type==="nullable"||_.type==="readonly"||_.type==="default"||_.type==="prefault")return Hv(_.innerType,g);if(_.type==="intersection")return Hv(_.left,g)||Hv(_.right,g);if(_.type==="record"||_.type==="map")return Hv(_.keyType,g)||Hv(_.valueType,g);if(_.type==="pipe")return Hv(_.in,g)||Hv(_.out,g);if(_.type==="object"){for(let U in _.shape)if(Hv(_.shape[U],g))return!0;return!1}if(_.type==="union"){for(let U of _.options)if(Hv(U,g))return!0;return!1}if(_.type==="tuple"){for(let U of _.items)if(Hv(U,g))return!0;if(_.rest&&Hv(_.rest,g))return!0;return!1}return!1}var OG=($,v={})=>(g)=>{let _=r6({...g,processors:v});return F$($,_),V6(_,$),C6(_,$)},JU=($,v,g={})=>(_)=>{let{libraryOptions:U,target:z}=_??{},J=r6({...U??{},target:z,io:v,processors:g});return F$($,J),V6(J,$),C6(J,$)};var AI={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},WG=($,v,g,_)=>{let U=g;U.type="string";let{minimum:z,maximum:J,format:G,patterns:K,contentEncoding:O}=$._zod.bag;if(typeof z==="number")U.minLength=z;if(typeof J==="number")U.maxLength=J;if(G){if(U.format=AI[G]??G,U.format==="")delete U.format;if(G==="time")delete U.format}if(O)U.contentEncoding=O;if(K&&K.size>0){let W=[...K];if(W.length===1)U.pattern=W[0].source;else if(W.length>1)U.allOf=[...W.map((B)=>({...v.target==="draft-07"||v.target==="draft-04"||v.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},BG=($,v,g,_)=>{let U=g,{minimum:z,maximum:J,format:G,multipleOf:K,exclusiveMaximum:O,exclusiveMinimum:W}=$._zod.bag;if(typeof G==="string"&&G.includes("int"))U.type="integer";else U.type="number";if(typeof W==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")U.minimum=W,U.exclusiveMinimum=!0;else U.exclusiveMinimum=W;if(typeof z==="number"){if(U.minimum=z,typeof W==="number"&&v.target!=="draft-04")if(W>=z)delete U.minimum;else delete U.exclusiveMinimum}if(typeof O==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")U.maximum=O,U.exclusiveMaximum=!0;else U.exclusiveMaximum=O;if(typeof J==="number"){if(U.maximum=J,typeof O==="number"&&v.target!=="draft-04")if(O<=J)delete U.maximum;else delete U.exclusiveMaximum}if(typeof K==="number")U.multipleOf=K},PG=($,v,g,_)=>{g.type="boolean"},kG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},YG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},HG=($,v,g,_)=>{if(v.target==="openapi-3.0")g.type="string",g.nullable=!0,g.enum=[null];else g.type="null"},LG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},IG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},qG=($,v,g,_)=>{g.not={}},XG=($,v,g,_)=>{},FG=($,v,g,_)=>{},wG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},AG=($,v,g,_)=>{let U=$._zod.def,z=pU(U.entries);if(z.every((J)=>typeof J==="number"))g.type="number";if(z.every((J)=>typeof J==="string"))g.type="string";g.enum=z},ZG=($,v,g,_)=>{let U=$._zod.def,z=[];for(let J of U.values)if(J===void 0){if(v.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof J==="bigint")if(v.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else z.push(Number(J));else z.push(J);if(z.length===0);else if(z.length===1){let J=z[0];if(g.type=J===null?"null":typeof J,v.target==="draft-04"||v.target==="openapi-3.0")g.enum=[J];else g.const=J}else{if(z.every((J)=>typeof J==="number"))g.type="number";if(z.every((J)=>typeof J==="string"))g.type="string";if(z.every((J)=>typeof J==="boolean"))g.type="boolean";if(z.every((J)=>J===null))g.type="null";g.enum=z}},QG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},MG=($,v,g,_)=>{let U=g,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");U.type="string",U.pattern=z.source},SG=($,v,g,_)=>{let U=g,z={type:"string",format:"binary",contentEncoding:"binary"},{minimum:J,maximum:G,mime:K}=$._zod.bag;if(J!==void 0)z.minLength=J;if(G!==void 0)z.maxLength=G;if(K)if(K.length===1)z.contentMediaType=K[0],Object.assign(U,z);else Object.assign(U,z),U.anyOf=K.map((O)=>({contentMediaType:O}));else Object.assign(U,z)},NG=($,v,g,_)=>{g.type="boolean"},yG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},DG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},RG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},uG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},TG=($,v,g,_)=>{if(v.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},jG=($,v,g,_)=>{let U=g,z=$._zod.def,{minimum:J,maximum:G}=$._zod.bag;if(typeof J==="number")U.minItems=J;if(typeof G==="number")U.maxItems=G;U.type="array",U.items=F$(z.element,v,{..._,path:[..._.path,"items"]})},rG=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="object",U.properties={};let J=z.shape;for(let O in J)U.properties[O]=F$(J[O],v,{..._,path:[..._.path,"properties",O]});let G=new Set(Object.keys(J)),K=new Set([...G].filter((O)=>{let W=z.shape[O]._zod;if(v.io==="input")return W.optin===void 0;else return W.optout===void 0}));if(K.size>0)U.required=Array.from(K);if(z.catchall?._zod.def.type==="never")U.additionalProperties=!1;else if(!z.catchall){if(v.io==="output")U.additionalProperties=!1}else if(z.catchall)U.additionalProperties=F$(z.catchall,v,{..._,path:[..._.path,"additionalProperties"]})},a1=($,v,g,_)=>{let U=$._zod.def,z=U.inclusive===!1,J=U.options.map((G,K)=>F$(G,v,{..._,path:[..._.path,z?"oneOf":"anyOf",K]}));if(z)g.oneOf=J;else g.anyOf=J},VG=($,v,g,_)=>{let U=$._zod.def,z=F$(U.left,v,{..._,path:[..._.path,"allOf",0]}),J=F$(U.right,v,{..._,path:[..._.path,"allOf",1]}),G=(O)=>("allOf"in O)&&Object.keys(O).length===1,K=[...G(z)?z.allOf:[z],...G(J)?J.allOf:[J]];g.allOf=K},CG=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="array";let J=v.target==="draft-2020-12"?"prefixItems":"items",G=v.target==="draft-2020-12"?"items":v.target==="openapi-3.0"?"items":"additionalItems",K=z.items.map((k,P)=>F$(k,v,{..._,path:[..._.path,J,P]})),O=z.rest?F$(z.rest,v,{..._,path:[..._.path,G,...v.target==="openapi-3.0"?[z.items.length]:[]]}):null;if(v.target==="draft-2020-12"){if(U.prefixItems=K,O)U.items=O}else if(v.target==="openapi-3.0"){if(U.items={anyOf:K},O)U.items.anyOf.push(O);if(U.minItems=K.length,!O)U.maxItems=K.length}else if(U.items=K,O)U.additionalItems=O;let{minimum:W,maximum:B}=$._zod.bag;if(typeof W==="number")U.minItems=W;if(typeof B==="number")U.maxItems=B},fG=($,v,g,_)=>{let U=g,z=$._zod.def;U.type="object";let J=z.keyType,K=J._zod.bag?.patterns;if(z.mode==="loose"&&K&&K.size>0){let W=F$(z.valueType,v,{..._,path:[..._.path,"patternProperties","*"]});U.patternProperties={};for(let B of K)U.patternProperties[B.source]=W}else{if(v.target==="draft-07"||v.target==="draft-2020-12")U.propertyNames=F$(z.keyType,v,{..._,path:[..._.path,"propertyNames"]});U.additionalProperties=F$(z.valueType,v,{..._,path:[..._.path,"additionalProperties"]})}let O=J._zod.values;if(O){let W=[...O].filter((B)=>typeof B==="string"||typeof B==="number");if(W.length>0)U.required=W}},EG=($,v,g,_)=>{let U=$._zod.def,z=F$(U.innerType,v,_),J=v.seen.get($);if(v.target==="openapi-3.0")J.ref=U.innerType,g.nullable=!0;else g.anyOf=[z,{type:"null"}]},mG=($,v,g,_)=>{let U=$._zod.def;F$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},cG=($,v,g,_)=>{let U=$._zod.def;F$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType,g.default=JSON.parse(JSON.stringify(U.defaultValue))},iG=($,v,g,_)=>{let U=$._zod.def;F$(U.innerType,v,_);let z=v.seen.get($);if(z.ref=U.innerType,v.io==="input")g._prefault=JSON.parse(JSON.stringify(U.defaultValue))},xG=($,v,g,_)=>{let U=$._zod.def;F$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType;let J;try{J=U.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}g.default=J},hG=($,v,g,_)=>{let U=$._zod.def,z=v.io==="input"?U.in._zod.def.type==="transform"?U.out:U.in:U.out;F$(z,v,_);let J=v.seen.get($);J.ref=z},lG=($,v,g,_)=>{let U=$._zod.def;F$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType,g.readOnly=!0},pG=($,v,g,_)=>{let U=$._zod.def;F$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},s1=($,v,g,_)=>{let U=$._zod.def;F$(U.innerType,v,_);let z=v.seen.get($);z.ref=U.innerType},oG=($,v,g,_)=>{let U=$._zod.innerType;F$(U,v,_);let z=v.seen.get($);z.ref=U},d1={string:WG,number:BG,boolean:PG,bigint:kG,symbol:YG,null:HG,undefined:LG,void:IG,never:qG,any:XG,unknown:FG,date:wG,enum:AG,literal:ZG,nan:QG,template_literal:MG,file:SG,success:NG,custom:yG,function:DG,transform:RG,map:uG,set:TG,array:jG,object:rG,union:a1,intersection:VG,tuple:CG,record:fG,nullable:EG,nonoptional:mG,default:cG,prefault:iG,catch:xG,pipe:hG,readonly:lG,promise:pG,optional:s1,lazy:oG};function e1($,v){if("_idmap"in $){let _=$,U=r6({...v,processors:d1}),z={};for(let K of _._idmap.entries()){let[O,W]=K;F$(W,U)}let J={},G={registry:_,uri:v?.uri,defs:z};U.external=G;for(let K of _._idmap.entries()){let[O,W]=K;V6(U,W),J[O]=C6(U,W)}if(Object.keys(z).length>0){let K=U.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[K]:z}}return{schemas:J}}let g=r6({...v,processors:d1});return F$($,g),V6(g,$),C6(g,$)}class nG{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter($){this.ctx.counter=$}get seen(){return this.ctx.seen}constructor($){let v=$?.target??"draft-2020-12";if(v==="draft-4")v="draft-04";if(v==="draft-7")v="draft-07";this.ctx=r6({processors:d1,target:v,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,v={path:[],schemaPath:[]}){return F$($,this.ctx,v)}emit($,v){if(v){if(v.cycles)this.ctx.cycles=v.cycles;if(v.reused)this.ctx.reused=v.reused;if(v.external)this.ctx.external=v.external}V6(this.ctx,$);let g=C6(this.ctx,$),{"~standard":_,...U}=g;return U}}var Y7={};var Hg={};ev(Hg,{xor:()=>zW,xid:()=>D7,void:()=>vW,uuidv7:()=>w7,uuidv6:()=>F7,uuidv4:()=>X7,uuid:()=>q7,url:()=>A7,unknown:()=>M$,union:()=>A$,undefined:()=>e7,ulid:()=>y7,uint64:()=>a7,uint32:()=>n7,tuple:()=>Z3,transform:()=>Q0,templateLiteral:()=>HW,symbol:()=>s7,superRefine:()=>d3,success:()=>PW,stringbool:()=>AW,stringFormat:()=>c7,string:()=>Z,strictObject:()=>_W,set:()=>KW,refine:()=>t3,record:()=>y$,readonly:()=>x3,promise:()=>LW,preprocess:()=>Sg,prefault:()=>V3,pipe:()=>qg,partialRecord:()=>JW,optional:()=>R$,object:()=>l,number:()=>L$,nullish:()=>BW,nullable:()=>Ig,null:()=>PU,nonoptional:()=>C3,never:()=>Z0,nativeEnum:()=>OW,nanoid:()=>M7,nan:()=>kW,meta:()=>FW,map:()=>bW,mac:()=>T7,looseRecord:()=>GW,looseObject:()=>Uv,literal:()=>t,lazy:()=>p3,ksuid:()=>R7,keyof:()=>gW,jwt:()=>m7,json:()=>ZW,ipv6:()=>j7,ipv4:()=>u7,intersection:()=>kU,int64:()=>d7,int32:()=>o7,int:()=>z0,instanceof:()=>wW,httpUrl:()=>Z7,hostname:()=>i7,hex:()=>x7,hash:()=>h7,guid:()=>I7,function:()=>IW,float64:()=>p7,float32:()=>l7,file:()=>WW,exactOptional:()=>R3,enum:()=>gv,emoji:()=>Q7,email:()=>L7,e164:()=>E7,discriminatedUnion:()=>Zg,describe:()=>XW,date:()=>UW,custom:()=>D0,cuid2:()=>N7,cuid:()=>S7,codec:()=>YW,cidrv6:()=>V7,cidrv4:()=>r7,check:()=>qW,catch:()=>m3,boolean:()=>h$,bigint:()=>t7,base64url:()=>f7,base64:()=>C7,array:()=>G$,any:()=>$W,_function:()=>IW,_default:()=>j3,_ZodString:()=>J0,ZodXor:()=>X3,ZodXID:()=>P0,ZodVoid:()=>I3,ZodUnknown:()=>H3,ZodUnion:()=>Ag,ZodUndefined:()=>P3,ZodUUID:()=>av,ZodURL:()=>Xg,ZodULID:()=>B0,ZodType:()=>_$,ZodTuple:()=>A3,ZodTransform:()=>y3,ZodTemplateLiteral:()=>h3,ZodSymbol:()=>B3,ZodSuccess:()=>f3,ZodStringFormat:()=>Q$,ZodString:()=>bU,ZodSet:()=>M3,ZodRecord:()=>Qg,ZodReadonly:()=>i3,ZodPromise:()=>o3,ZodPrefault:()=>r3,ZodPipe:()=>N0,ZodOptional:()=>M0,ZodObject:()=>wg,ZodNumberFormat:()=>B4,ZodNumber:()=>OU,ZodNullable:()=>u3,ZodNull:()=>k3,ZodNonOptional:()=>S0,ZodNever:()=>L3,ZodNanoID:()=>K0,ZodNaN:()=>c3,ZodMap:()=>Q3,ZodMAC:()=>W3,ZodLiteral:()=>S3,ZodLazy:()=>l3,ZodKSUID:()=>k0,ZodJWT:()=>w0,ZodIntersection:()=>w3,ZodIPv6:()=>H0,ZodIPv4:()=>Y0,ZodGUID:()=>Lg,ZodFunction:()=>n3,ZodFile:()=>N3,ZodExactOptional:()=>D3,ZodEnum:()=>GU,ZodEmoji:()=>b0,ZodEmail:()=>G0,ZodE164:()=>F0,ZodDiscriminatedUnion:()=>F3,ZodDefault:()=>T3,ZodDate:()=>Fg,ZodCustomStringFormat:()=>KU,ZodCustom:()=>Mg,ZodCodec:()=>y0,ZodCatch:()=>E3,ZodCUID2:()=>W0,ZodCUID:()=>O0,ZodCIDRv6:()=>I0,ZodCIDRv4:()=>L0,ZodBoolean:()=>WU,ZodBigIntFormat:()=>A0,ZodBigInt:()=>BU,ZodBase64URL:()=>X0,ZodBase64:()=>q0,ZodArray:()=>q3,ZodAny:()=>Y3});var $0={};ev($0,{uppercase:()=>t4,trim:()=>vU,toUpperCase:()=>gU,toLowerCase:()=>UU,startsWith:()=>a4,slugify:()=>_U,size:()=>K4,regex:()=>o4,property:()=>t1,positive:()=>l1,overwrite:()=>Ev,normalize:()=>$U,nonpositive:()=>o1,nonnegative:()=>n1,negative:()=>p1,multipleOf:()=>T6,minSize:()=>dv,minLength:()=>b6,mime:()=>e4,maxSize:()=>j6,maxLength:()=>O4,lte:()=>Nv,lt:()=>nv,lowercase:()=>n4,length:()=>W4,includes:()=>d4,gte:()=>Yv,gt:()=>tv,endsWith:()=>s4});var f6={};ev(f6,{time:()=>aG,duration:()=>sG,datetime:()=>tG,date:()=>dG,ZodISOTime:()=>g0,ZodISODuration:()=>_0,ZodISODateTime:()=>v0,ZodISODate:()=>U0});var v0=F("ZodISODateTime",($,v)=>{uJ.init($,v),Q$.init($,v)});function tG($){return y9(v0,$)}var U0=F("ZodISODate",($,v)=>{TJ.init($,v),Q$.init($,v)});function dG($){return D9(U0,$)}var g0=F("ZodISOTime",($,v)=>{jJ.init($,v),Q$.init($,v)});function aG($){return R9(g0,$)}var _0=F("ZodISODuration",($,v)=>{rJ.init($,v),Q$.init($,v)});function sG($){return u9(_0,$)}var H7=($,v)=>{aU.init($,v),$.name="ZodError",Object.defineProperties($,{format:{value:(g)=>eU($,g)},flatten:{value:(g)=>sU($,g)},addIssue:{value:(g)=>{$.issues.push(g),$.message=JSON.stringify($.issues,C4,2)}},addIssues:{value:(g)=>{$.issues.push(...g),$.message=JSON.stringify($.issues,C4,2)}},isEmpty:{get(){return $.issues.length===0}}})},QI=F("ZodError",H7),wv=F("ZodError",H7,{Parent:Error});var eG=m4(wv),$3=c4(wv),v3=i4(wv),U3=h4(wv),g3=g1(wv),_3=_1(wv),z3=z1(wv),J3=J1(wv),G3=G1(wv),b3=b1(wv),K3=K1(wv),O3=O1(wv);var _$=F("ZodType",($,v)=>{return $$.init($,v),Object.assign($["~standard"],{jsonSchema:{input:JU($,"input"),output:JU($,"output")}}),$.toJSONSchema=OG($,{}),$.def=v,$.type=v.type,Object.defineProperty($,"_def",{value:v}),$.check=(...g)=>{return $.clone(r.mergeDefs(v,{checks:[...v.checks??[],...g.map((_)=>typeof _==="function"?{_zod:{check:_,def:{check:"custom"},onattach:[]}}:_)]}),{parent:!0})},$.with=$.check,$.clone=(g,_)=>kv($,g,_),$.brand=()=>$,$.register=(g,_)=>{return g.add($,_),$},$.parse=(g,_)=>eG($,g,_,{callee:$.parse}),$.safeParse=(g,_)=>v3($,g,_),$.parseAsync=async(g,_)=>$3($,g,_,{callee:$.parseAsync}),$.safeParseAsync=async(g,_)=>U3($,g,_),$.spa=$.safeParseAsync,$.encode=(g,_)=>g3($,g,_),$.decode=(g,_)=>_3($,g,_),$.encodeAsync=async(g,_)=>z3($,g,_),$.decodeAsync=async(g,_)=>J3($,g,_),$.safeEncode=(g,_)=>G3($,g,_),$.safeDecode=(g,_)=>b3($,g,_),$.safeEncodeAsync=async(g,_)=>K3($,g,_),$.safeDecodeAsync=async(g,_)=>O3($,g,_),$.refine=(g,_)=>$.check(t3(g,_)),$.superRefine=(g)=>$.check(d3(g)),$.overwrite=(g)=>$.check(Ev(g)),$.optional=()=>R$($),$.exactOptional=()=>R3($),$.nullable=()=>Ig($),$.nullish=()=>R$(Ig($)),$.nonoptional=(g)=>C3($,g),$.array=()=>G$($),$.or=(g)=>A$([$,g]),$.and=(g)=>kU($,g),$.transform=(g)=>qg($,Q0(g)),$.default=(g)=>j3($,g),$.prefault=(g)=>V3($,g),$.catch=(g)=>m3($,g),$.pipe=(g)=>qg($,g),$.readonly=()=>x3($),$.describe=(g)=>{let _=$.clone();return vv.add(_,{description:g}),_},Object.defineProperty($,"description",{get(){return vv.get($)?.description},configurable:!0}),$.meta=(...g)=>{if(g.length===0)return vv.get($);let _=$.clone();return vv.add(_,g[0]),_},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$.apply=(g)=>g($),$}),J0=F("_ZodString",($,v)=>{b4.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>WG($,_,U,z);let g=$._zod.bag;$.format=g.format??null,$.minLength=g.minimum??null,$.maxLength=g.maximum??null,$.regex=(..._)=>$.check(o4(..._)),$.includes=(..._)=>$.check(d4(..._)),$.startsWith=(..._)=>$.check(a4(..._)),$.endsWith=(..._)=>$.check(s4(..._)),$.min=(..._)=>$.check(b6(..._)),$.max=(..._)=>$.check(O4(..._)),$.length=(..._)=>$.check(W4(..._)),$.nonempty=(..._)=>$.check(b6(1,..._)),$.lowercase=(_)=>$.check(n4(_)),$.uppercase=(_)=>$.check(t4(_)),$.trim=()=>$.check(vU()),$.normalize=(..._)=>$.check($U(..._)),$.toLowerCase=()=>$.check(UU()),$.toUpperCase=()=>$.check(gU()),$.slugify=()=>$.check(_U())}),bU=F("ZodString",($,v)=>{b4.init($,v),J0.init($,v),$.email=(g)=>$.check(Q1(G0,g)),$.url=(g)=>$.check(Yg(Xg,g)),$.jwt=(g)=>$.check(h1(w0,g)),$.emoji=(g)=>$.check(D1(b0,g)),$.guid=(g)=>$.check(kg(Lg,g)),$.uuid=(g)=>$.check(M1(av,g)),$.uuidv4=(g)=>$.check(S1(av,g)),$.uuidv6=(g)=>$.check(N1(av,g)),$.uuidv7=(g)=>$.check(y1(av,g)),$.nanoid=(g)=>$.check(R1(K0,g)),$.guid=(g)=>$.check(kg(Lg,g)),$.cuid=(g)=>$.check(u1(O0,g)),$.cuid2=(g)=>$.check(T1(W0,g)),$.ulid=(g)=>$.check(j1(B0,g)),$.base64=(g)=>$.check(c1(q0,g)),$.base64url=(g)=>$.check(i1(X0,g)),$.xid=(g)=>$.check(r1(P0,g)),$.ksuid=(g)=>$.check(V1(k0,g)),$.ipv4=(g)=>$.check(C1(Y0,g)),$.ipv6=(g)=>$.check(f1(H0,g)),$.cidrv4=(g)=>$.check(E1(L0,g)),$.cidrv6=(g)=>$.check(m1(I0,g)),$.e164=(g)=>$.check(x1(F0,g)),$.datetime=(g)=>$.check(tG(g)),$.date=(g)=>$.check(dG(g)),$.time=(g)=>$.check(aG(g)),$.duration=(g)=>$.check(sG(g))});function Z($){return Q9(bU,$)}var Q$=F("ZodStringFormat",($,v)=>{Z$.init($,v),J0.init($,v)}),G0=F("ZodEmail",($,v)=>{AJ.init($,v),Q$.init($,v)});function L7($){return Q1(G0,$)}var Lg=F("ZodGUID",($,v)=>{FJ.init($,v),Q$.init($,v)});function I7($){return kg(Lg,$)}var av=F("ZodUUID",($,v)=>{wJ.init($,v),Q$.init($,v)});function q7($){return M1(av,$)}function X7($){return S1(av,$)}function F7($){return N1(av,$)}function w7($){return y1(av,$)}var Xg=F("ZodURL",($,v)=>{ZJ.init($,v),Q$.init($,v)});function A7($){return Yg(Xg,$)}function Z7($){return Yg(Xg,{protocol:/^https?$/,hostname:uv.domain,...r.normalizeParams($)})}var b0=F("ZodEmoji",($,v)=>{QJ.init($,v),Q$.init($,v)});function Q7($){return D1(b0,$)}var K0=F("ZodNanoID",($,v)=>{MJ.init($,v),Q$.init($,v)});function M7($){return R1(K0,$)}var O0=F("ZodCUID",($,v)=>{SJ.init($,v),Q$.init($,v)});function S7($){return u1(O0,$)}var W0=F("ZodCUID2",($,v)=>{NJ.init($,v),Q$.init($,v)});function N7($){return T1(W0,$)}var B0=F("ZodULID",($,v)=>{yJ.init($,v),Q$.init($,v)});function y7($){return j1(B0,$)}var P0=F("ZodXID",($,v)=>{DJ.init($,v),Q$.init($,v)});function D7($){return r1(P0,$)}var k0=F("ZodKSUID",($,v)=>{RJ.init($,v),Q$.init($,v)});function R7($){return V1(k0,$)}var Y0=F("ZodIPv4",($,v)=>{VJ.init($,v),Q$.init($,v)});function u7($){return C1(Y0,$)}var W3=F("ZodMAC",($,v)=>{fJ.init($,v),Q$.init($,v)});function T7($){return S9(W3,$)}var H0=F("ZodIPv6",($,v)=>{CJ.init($,v),Q$.init($,v)});function j7($){return f1(H0,$)}var L0=F("ZodCIDRv4",($,v)=>{EJ.init($,v),Q$.init($,v)});function r7($){return E1(L0,$)}var I0=F("ZodCIDRv6",($,v)=>{mJ.init($,v),Q$.init($,v)});function V7($){return m1(I0,$)}var q0=F("ZodBase64",($,v)=>{iJ.init($,v),Q$.init($,v)});function C7($){return c1(q0,$)}var X0=F("ZodBase64URL",($,v)=>{xJ.init($,v),Q$.init($,v)});function f7($){return i1(X0,$)}var F0=F("ZodE164",($,v)=>{hJ.init($,v),Q$.init($,v)});function E7($){return x1(F0,$)}var w0=F("ZodJWT",($,v)=>{lJ.init($,v),Q$.init($,v)});function m7($){return h1(w0,$)}var KU=F("ZodCustomStringFormat",($,v)=>{pJ.init($,v),Q$.init($,v)});function c7($,v,g={}){return zU(KU,$,v,g)}function i7($){return zU(KU,"hostname",uv.hostname,$)}function x7($){return zU(KU,"hex",uv.hex,$)}function h7($,v){let g=v?.enc??"hex",_=`${$}_${g}`,U=uv[_];if(!U)throw Error(`Unrecognized hash format: ${_}`);return zU(KU,_,U,v)}var OU=F("ZodNumber",($,v)=>{X1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>BG($,_,U,z),$.gt=(_,U)=>$.check(tv(_,U)),$.gte=(_,U)=>$.check(Yv(_,U)),$.min=(_,U)=>$.check(Yv(_,U)),$.lt=(_,U)=>$.check(nv(_,U)),$.lte=(_,U)=>$.check(Nv(_,U)),$.max=(_,U)=>$.check(Nv(_,U)),$.int=(_)=>$.check(z0(_)),$.safe=(_)=>$.check(z0(_)),$.positive=(_)=>$.check(tv(0,_)),$.nonnegative=(_)=>$.check(Yv(0,_)),$.negative=(_)=>$.check(nv(0,_)),$.nonpositive=(_)=>$.check(Nv(0,_)),$.multipleOf=(_,U)=>$.check(T6(_,U)),$.step=(_,U)=>$.check(T6(_,U)),$.finite=()=>$;let g=$._zod.bag;$.minValue=Math.max(g.minimum??Number.NEGATIVE_INFINITY,g.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(g.maximum??Number.POSITIVE_INFINITY,g.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(g.format??"").includes("int")||Number.isSafeInteger(g.multipleOf??0.5),$.isFinite=!0,$.format=g.format??null});function L$($){return T9(OU,$)}var B4=F("ZodNumberFormat",($,v)=>{oJ.init($,v),OU.init($,v)});function z0($){return r9(B4,$)}function l7($){return V9(B4,$)}function p7($){return C9(B4,$)}function o7($){return f9(B4,$)}function n7($){return E9(B4,$)}var WU=F("ZodBoolean",($,v)=>{Jg.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>PG($,g,_,U)});function h$($){return m9(WU,$)}var BU=F("ZodBigInt",($,v)=>{F1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>kG($,_,U,z),$.gte=(_,U)=>$.check(Yv(_,U)),$.min=(_,U)=>$.check(Yv(_,U)),$.gt=(_,U)=>$.check(tv(_,U)),$.gte=(_,U)=>$.check(Yv(_,U)),$.min=(_,U)=>$.check(Yv(_,U)),$.lt=(_,U)=>$.check(nv(_,U)),$.lte=(_,U)=>$.check(Nv(_,U)),$.max=(_,U)=>$.check(Nv(_,U)),$.positive=(_)=>$.check(tv(BigInt(0),_)),$.negative=(_)=>$.check(nv(BigInt(0),_)),$.nonpositive=(_)=>$.check(Nv(BigInt(0),_)),$.nonnegative=(_)=>$.check(Yv(BigInt(0),_)),$.multipleOf=(_,U)=>$.check(T6(_,U));let g=$._zod.bag;$.minValue=g.minimum??null,$.maxValue=g.maximum??null,$.format=g.format??null});function t7($){return i9(BU,$)}var A0=F("ZodBigIntFormat",($,v)=>{nJ.init($,v),BU.init($,v)});function d7($){return h9(A0,$)}function a7($){return l9(A0,$)}var B3=F("ZodSymbol",($,v)=>{tJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>YG($,g,_,U)});function s7($){return p9(B3,$)}var P3=F("ZodUndefined",($,v)=>{dJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>LG($,g,_,U)});function e7($){return o9(P3,$)}var k3=F("ZodNull",($,v)=>{aJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>HG($,g,_,U)});function PU($){return n9(k3,$)}var Y3=F("ZodAny",($,v)=>{sJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>XG($,g,_,U)});function $W(){return t9(Y3)}var H3=F("ZodUnknown",($,v)=>{eJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>FG($,g,_,U)});function M$(){return d9(H3)}var L3=F("ZodNever",($,v)=>{$8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>qG($,g,_,U)});function Z0($){return a9(L3,$)}var I3=F("ZodVoid",($,v)=>{v8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>IG($,g,_,U)});function vW($){return s9(I3,$)}var Fg=F("ZodDate",($,v)=>{U8.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>wG($,_,U,z),$.min=(_,U)=>$.check(Yv(_,U)),$.max=(_,U)=>$.check(Nv(_,U));let g=$._zod.bag;$.minDate=g.minimum?new Date(g.minimum):null,$.maxDate=g.maximum?new Date(g.maximum):null});function UW($){return e9(Fg,$)}var q3=F("ZodArray",($,v)=>{g8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>jG($,g,_,U),$.element=v.element,$.min=(g,_)=>$.check(b6(g,_)),$.nonempty=(g)=>$.check(b6(1,g)),$.max=(g,_)=>$.check(O4(g,_)),$.length=(g,_)=>$.check(W4(g,_)),$.unwrap=()=>$.element});function G$($,v){return UG(q3,$,v)}function gW($){let v=$._zod.def.shape;return gv(Object.keys(v))}var wg=F("ZodObject",($,v)=>{_8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>rG($,g,_,U),r.defineLazy($,"shape",()=>{return v.shape}),$.keyof=()=>gv(Object.keys($._zod.def.shape)),$.catchall=(g)=>$.clone({...$._zod.def,catchall:g}),$.passthrough=()=>$.clone({...$._zod.def,catchall:M$()}),$.loose=()=>$.clone({...$._zod.def,catchall:M$()}),$.strict=()=>$.clone({...$._zod.def,catchall:Z0()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(g)=>{return r.extend($,g)},$.safeExtend=(g)=>{return r.safeExtend($,g)},$.merge=(g)=>r.merge($,g),$.pick=(g)=>r.pick($,g),$.omit=(g)=>r.omit($,g),$.partial=(...g)=>r.partial(M0,$,g[0]),$.required=(...g)=>r.required(S0,$,g[0])});function l($,v){let g={type:"object",shape:$??{},...r.normalizeParams(v)};return new wg(g)}function _W($,v){return new wg({type:"object",shape:$,catchall:Z0(),...r.normalizeParams(v)})}function Uv($,v){return new wg({type:"object",shape:$,catchall:M$(),...r.normalizeParams(v)})}var Ag=F("ZodUnion",($,v)=>{Gg.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>a1($,g,_,U),$.options=v.options});function A$($,v){return new Ag({type:"union",options:$,...r.normalizeParams(v)})}var X3=F("ZodXor",($,v)=>{Ag.init($,v),z8.init($,v),$._zod.processJSONSchema=(g,_,U)=>a1($,g,_,U),$.options=v.options});function zW($,v){return new X3({type:"union",options:$,inclusive:!1,...r.normalizeParams(v)})}var F3=F("ZodDiscriminatedUnion",($,v)=>{Ag.init($,v),J8.init($,v)});function Zg($,v,g){return new F3({type:"union",options:v,discriminator:$,...r.normalizeParams(g)})}var w3=F("ZodIntersection",($,v)=>{G8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>VG($,g,_,U)});function kU($,v){return new w3({type:"intersection",left:$,right:v})}var A3=F("ZodTuple",($,v)=>{w1.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>CG($,g,_,U),$.rest=(g)=>$.clone({...$._zod.def,rest:g})});function Z3($,v,g){let _=v instanceof $$,U=_?g:v;return new A3({type:"tuple",items:$,rest:_?v:null,...r.normalizeParams(U)})}var Qg=F("ZodRecord",($,v)=>{b8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>fG($,g,_,U),$.keyType=v.keyType,$.valueType=v.valueType});function y$($,v,g){return new Qg({type:"record",keyType:$,valueType:v,...r.normalizeParams(g)})}function JW($,v,g){let _=kv($);return _._zod.values=void 0,new Qg({type:"record",keyType:_,valueType:v,...r.normalizeParams(g)})}function GW($,v,g){return new Qg({type:"record",keyType:$,valueType:v,mode:"loose",...r.normalizeParams(g)})}var Q3=F("ZodMap",($,v)=>{K8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>uG($,g,_,U),$.keyType=v.keyType,$.valueType=v.valueType,$.min=(...g)=>$.check(dv(...g)),$.nonempty=(g)=>$.check(dv(1,g)),$.max=(...g)=>$.check(j6(...g)),$.size=(...g)=>$.check(K4(...g))});function bW($,v,g){return new Q3({type:"map",keyType:$,valueType:v,...r.normalizeParams(g)})}var M3=F("ZodSet",($,v)=>{O8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>TG($,g,_,U),$.min=(...g)=>$.check(dv(...g)),$.nonempty=(g)=>$.check(dv(1,g)),$.max=(...g)=>$.check(j6(...g)),$.size=(...g)=>$.check(K4(...g))});function KW($,v){return new M3({type:"set",valueType:$,...r.normalizeParams(v)})}var GU=F("ZodEnum",($,v)=>{W8.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,U,z)=>AG($,_,U,z),$.enum=v.entries,$.options=Object.values(v.entries);let g=new Set(Object.keys(v.entries));$.extract=(_,U)=>{let z={};for(let J of _)if(g.has(J))z[J]=v.entries[J];else throw Error(`Key ${J} not found in enum`);return new GU({...v,checks:[],...r.normalizeParams(U),entries:z})},$.exclude=(_,U)=>{let z={...v.entries};for(let J of _)if(g.has(J))delete z[J];else throw Error(`Key ${J} not found in enum`);return new GU({...v,checks:[],...r.normalizeParams(U),entries:z})}});function gv($,v){let g=Array.isArray($)?Object.fromEntries($.map((_)=>[_,_])):$;return new GU({type:"enum",entries:g,...r.normalizeParams(v)})}function OW($,v){return new GU({type:"enum",entries:$,...r.normalizeParams(v)})}var S3=F("ZodLiteral",($,v)=>{B8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>ZG($,g,_,U),$.values=new Set(v.values),Object.defineProperty($,"value",{get(){if(v.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return v.values[0]}})});function t($,v){return new S3({type:"literal",values:Array.isArray($)?$:[$],...r.normalizeParams(v)})}var N3=F("ZodFile",($,v)=>{P8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>SG($,g,_,U),$.min=(g,_)=>$.check(dv(g,_)),$.max=(g,_)=>$.check(j6(g,_)),$.mime=(g,_)=>$.check(e4(Array.isArray(g)?g:[g],_))});function WW($){return gG(N3,$)}var y3=F("ZodTransform",($,v)=>{k8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>RG($,g,_,U),$._zod.parse=(g,_)=>{if(_.direction==="backward")throw new z4($.constructor.name);g.addIssue=(z)=>{if(typeof z==="string")g.issues.push(r.issue(z,g.value,v));else{let J=z;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=g.value),J.inst??(J.inst=$),g.issues.push(r.issue(J))}};let U=v.transform(g.value,g);if(U instanceof Promise)return U.then((z)=>{return g.value=z,g});return g.value=U,g}});function Q0($){return new y3({type:"transform",transform:$})}var M0=F("ZodOptional",($,v)=>{A1.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>s1($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function R$($){return new M0({type:"optional",innerType:$})}var D3=F("ZodExactOptional",($,v)=>{Y8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>s1($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function R3($){return new D3({type:"optional",innerType:$})}var u3=F("ZodNullable",($,v)=>{H8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>EG($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function Ig($){return new u3({type:"nullable",innerType:$})}function BW($){return R$(Ig($))}var T3=F("ZodDefault",($,v)=>{L8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>cG($,g,_,U),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function j3($,v){return new T3({type:"default",innerType:$,get defaultValue(){return typeof v==="function"?v():r.shallowClone(v)}})}var r3=F("ZodPrefault",($,v)=>{I8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>iG($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function V3($,v){return new r3({type:"prefault",innerType:$,get defaultValue(){return typeof v==="function"?v():r.shallowClone(v)}})}var S0=F("ZodNonOptional",($,v)=>{q8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>mG($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function C3($,v){return new S0({type:"nonoptional",innerType:$,...r.normalizeParams(v)})}var f3=F("ZodSuccess",($,v)=>{X8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>NG($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function PW($){return new f3({type:"success",innerType:$})}var E3=F("ZodCatch",($,v)=>{F8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>xG($,g,_,U),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function m3($,v){return new E3({type:"catch",innerType:$,catchValue:typeof v==="function"?v:()=>v})}var c3=F("ZodNaN",($,v)=>{w8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>QG($,g,_,U)});function kW($){return vG(c3,$)}var N0=F("ZodPipe",($,v)=>{A8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>hG($,g,_,U),$.in=v.in,$.out=v.out});function qg($,v){return new N0({type:"pipe",in:$,out:v})}var y0=F("ZodCodec",($,v)=>{N0.init($,v),bg.init($,v)});function YW($,v,g){return new y0({type:"pipe",in:$,out:v,transform:g.decode,reverseTransform:g.encode})}var i3=F("ZodReadonly",($,v)=>{Z8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>lG($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function x3($){return new i3({type:"readonly",innerType:$})}var h3=F("ZodTemplateLiteral",($,v)=>{Q8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>MG($,g,_,U)});function HW($,v){return new h3({type:"template_literal",parts:$,...r.normalizeParams(v)})}var l3=F("ZodLazy",($,v)=>{N8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>oG($,g,_,U),$.unwrap=()=>$._zod.def.getter()});function p3($){return new l3({type:"lazy",getter:$})}var o3=F("ZodPromise",($,v)=>{S8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>pG($,g,_,U),$.unwrap=()=>$._zod.def.innerType});function LW($){return new o3({type:"promise",innerType:$})}var n3=F("ZodFunction",($,v)=>{M8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>DG($,g,_,U)});function IW($){return new n3({type:"function",input:Array.isArray($?.input)?Z3($?.input):$?.input??G$(M$()),output:$?.output??M$()})}var Mg=F("ZodCustom",($,v)=>{y8.init($,v),_$.init($,v),$._zod.processJSONSchema=(g,_,U)=>yG($,g,_,U)});function qW($){let v=new N$({check:"custom"});return v._zod.check=$,v}function D0($,v){return _G(Mg,$??(()=>!0),v)}function t3($,v={}){return zG(Mg,$,v)}function d3($){return JG($)}var XW=GG,FW=bG;function wW($,v={}){let g=new Mg({type:"custom",check:"custom",fn:(_)=>_ instanceof $,abort:!0,...r.normalizeParams(v)});return g._zod.bag.Class=$,g._zod.check=(_)=>{if(!(_.value instanceof $))_.issues.push({code:"invalid_type",expected:$.name,input:_.value,inst:g,path:[...g._zod.def.path??[]]})},g}var AW=(...$)=>KG({Codec:y0,Boolean:WU,String:bU},...$);function ZW($){let v=p3(()=>{return A$([Z($),L$(),h$(),PU(),G$(v),y$(Z(),v)])});return v}function Sg($,v){return qg(Q0($),v)}var SI={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function NI($){x$({customError:$})}function yI(){return x$().customError}var a3;(function($){})(a3||(a3={}));var c={...Hg,...$0,iso:f6},DI=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function RI($,v){let g=$.$schema;if(g==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(g==="http://json-schema.org/draft-07/schema#")return"draft-7";if(g==="http://json-schema.org/draft-04/schema#")return"draft-4";return v??"draft-2020-12"}function uI($,v){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let g=$.slice(1).split("/").filter(Boolean);if(g.length===0)return v.rootSchema;let _=v.version==="draft-2020-12"?"$defs":"definitions";if(g[0]===_){let U=g[1];if(!U||!v.defs[U])throw Error(`Reference not found: ${$}`);return v.defs[U]}throw Error(`Reference not found: ${$}`)}function QW($,v){if($.not!==void 0){if(typeof $.not==="object"&&Object.keys($.not).length===0)return c.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if($.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if($.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if($.if!==void 0||$.then!==void 0||$.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if($.dependentSchemas!==void 0||$.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if($.$ref){let U=$.$ref;if(v.refs.has(U))return v.refs.get(U);if(v.processing.has(U))return c.lazy(()=>{if(!v.refs.has(U))throw Error(`Circular reference not resolved: ${U}`);return v.refs.get(U)});v.processing.add(U);let z=uI(U,v),J=Ov(z,v);return v.refs.set(U,J),v.processing.delete(U),J}if($.enum!==void 0){let U=$.enum;if(v.version==="openapi-3.0"&&$.nullable===!0&&U.length===1&&U[0]===null)return c.null();if(U.length===0)return c.never();if(U.length===1)return c.literal(U[0]);if(U.every((J)=>typeof J==="string"))return c.enum(U);let z=U.map((J)=>c.literal(J));if(z.length<2)return z[0];return c.union([z[0],z[1],...z.slice(2)])}if($.const!==void 0)return c.literal($.const);let g=$.type;if(Array.isArray(g)){let U=g.map((z)=>{let J={...$,type:z};return QW(J,v)});if(U.length===0)return c.never();if(U.length===1)return U[0];return c.union(U)}if(!g)return c.any();let _;switch(g){case"string":{let U=c.string();if($.format){let z=$.format;if(z==="email")U=U.check(c.email());else if(z==="uri"||z==="uri-reference")U=U.check(c.url());else if(z==="uuid"||z==="guid")U=U.check(c.uuid());else if(z==="date-time")U=U.check(c.iso.datetime());else if(z==="date")U=U.check(c.iso.date());else if(z==="time")U=U.check(c.iso.time());else if(z==="duration")U=U.check(c.iso.duration());else if(z==="ipv4")U=U.check(c.ipv4());else if(z==="ipv6")U=U.check(c.ipv6());else if(z==="mac")U=U.check(c.mac());else if(z==="cidr")U=U.check(c.cidrv4());else if(z==="cidr-v6")U=U.check(c.cidrv6());else if(z==="base64")U=U.check(c.base64());else if(z==="base64url")U=U.check(c.base64url());else if(z==="e164")U=U.check(c.e164());else if(z==="jwt")U=U.check(c.jwt());else if(z==="emoji")U=U.check(c.emoji());else if(z==="nanoid")U=U.check(c.nanoid());else if(z==="cuid")U=U.check(c.cuid());else if(z==="cuid2")U=U.check(c.cuid2());else if(z==="ulid")U=U.check(c.ulid());else if(z==="xid")U=U.check(c.xid());else if(z==="ksuid")U=U.check(c.ksuid())}if(typeof $.minLength==="number")U=U.min($.minLength);if(typeof $.maxLength==="number")U=U.max($.maxLength);if($.pattern)U=U.regex(new RegExp($.pattern));_=U;break}case"number":case"integer":{let U=g==="integer"?c.number().int():c.number();if(typeof $.minimum==="number")U=U.min($.minimum);if(typeof $.maximum==="number")U=U.max($.maximum);if(typeof $.exclusiveMinimum==="number")U=U.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")U=U.gt($.minimum);if(typeof $.exclusiveMaximum==="number")U=U.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")U=U.lt($.maximum);if(typeof $.multipleOf==="number")U=U.multipleOf($.multipleOf);_=U;break}case"boolean":{_=c.boolean();break}case"null":{_=c.null();break}case"object":{let U={},z=$.properties||{},J=new Set($.required||[]);for(let[K,O]of Object.entries(z)){let W=Ov(O,v);U[K]=J.has(K)?W:W.optional()}if($.propertyNames){let K=Ov($.propertyNames,v),O=$.additionalProperties&&typeof $.additionalProperties==="object"?Ov($.additionalProperties,v):c.any();if(Object.keys(U).length===0){_=c.record(K,O);break}let W=c.object(U).passthrough(),B=c.looseRecord(K,O);_=c.intersection(W,B);break}if($.patternProperties){let K=$.patternProperties,O=Object.keys(K),W=[];for(let k of O){let P=Ov(K[k],v),X=c.string().regex(new RegExp(k));W.push(c.looseRecord(X,P))}let B=[];if(Object.keys(U).length>0)B.push(c.object(U).passthrough());if(B.push(...W),B.length===0)_=c.object({}).passthrough();else if(B.length===1)_=B[0];else{let k=c.intersection(B[0],B[1]);for(let P=2;P<B.length;P++)k=c.intersection(k,B[P]);_=k}break}let G=c.object(U);if($.additionalProperties===!1)_=G.strict();else if(typeof $.additionalProperties==="object")_=G.catchall(Ov($.additionalProperties,v));else _=G.passthrough();break}case"array":{let{prefixItems:U,items:z}=$;if(U&&Array.isArray(U)){let J=U.map((K)=>Ov(K,v)),G=z&&typeof z==="object"&&!Array.isArray(z)?Ov(z,v):void 0;if(G)_=c.tuple(J).rest(G);else _=c.tuple(J);if(typeof $.minItems==="number")_=_.check(c.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(c.maxLength($.maxItems))}else if(Array.isArray(z)){let J=z.map((K)=>Ov(K,v)),G=$.additionalItems&&typeof $.additionalItems==="object"?Ov($.additionalItems,v):void 0;if(G)_=c.tuple(J).rest(G);else _=c.tuple(J);if(typeof $.minItems==="number")_=_.check(c.minLength($.minItems));if(typeof $.maxItems==="number")_=_.check(c.maxLength($.maxItems))}else if(z!==void 0){let J=Ov(z,v),G=c.array(J);if(typeof $.minItems==="number")G=G.min($.minItems);if(typeof $.maxItems==="number")G=G.max($.maxItems);_=G}else _=c.array(c.any());break}default:throw Error(`Unsupported type: ${g}`)}if($.description)_=_.describe($.description);if($.default!==void 0)_=_.default($.default);return _}function Ov($,v){if(typeof $==="boolean")return $?c.any():c.never();let g=QW($,v),_=$.type||$.enum!==void 0||$.const!==void 0;if($.anyOf&&Array.isArray($.anyOf)){let G=$.anyOf.map((O)=>Ov(O,v)),K=c.union(G);g=_?c.intersection(g,K):K}if($.oneOf&&Array.isArray($.oneOf)){let G=$.oneOf.map((O)=>Ov(O,v)),K=c.xor(G);g=_?c.intersection(g,K):K}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)g=_?g:c.any();else{let G=_?g:Ov($.allOf[0],v),K=_?0:1;for(let O=K;O<$.allOf.length;O++)G=c.intersection(G,Ov($.allOf[O],v));g=G}if($.nullable===!0&&v.version==="openapi-3.0")g=c.nullable(g);if($.readOnly===!0)g=c.readonly(g);let U={},z=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let G of z)if(G in $)U[G]=$[G];let J=["contentEncoding","contentMediaType","contentSchema"];for(let G of J)if(G in $)U[G]=$[G];for(let G of Object.keys($))if(!DI.has(G))U[G]=$[G];if(Object.keys(U).length>0)v.registry.add(g,U);return g}function MW($,v){if(typeof $==="boolean")return $?c.any():c.never();let g=RI($,v?.defaultTarget),_=$.$defs||$.definitions||{},U={version:g,defs:_,refs:new Map,processing:new Set,rootSchema:$,registry:v?.registry??vv};return Ov($,U)}var s3={};ev(s3,{string:()=>TI,number:()=>jI,date:()=>CI,boolean:()=>rI,bigint:()=>VI});function TI($){return M9(bU,$)}function jI($){return j9(OU,$)}function rI($){return c9(WU,$)}function VI($){return x9(BU,$)}function CI($){return $G(Fg,$)}x$(Kg());var E6="io.modelcontextprotocol/related-task",u0="2.0",_v=D0(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),SW=A$([Z(),L$().int()]),NW=Z(),WN=Uv({ttl:A$([L$(),PU()]).optional(),pollInterval:L$().optional()}),fI=l({ttl:L$().optional()}),EI=l({taskId:Z()}),e3=Uv({progressToken:SW.optional(),[E6]:EI.optional()}),yv=l({_meta:e3.optional()}),Ng=yv.extend({task:fI.optional()}),yW=($)=>Ng.safeParse($).success,zv=l({method:Z(),params:yv.loose().optional()}),Tv=l({_meta:e3.optional()}),jv=l({method:Z(),params:Tv.loose().optional()}),Jv=Uv({_meta:e3.optional()}),HU=A$([Z(),L$().int()]),DW=l({jsonrpc:t(u0),id:HU,...zv.shape}).strict(),$b=($)=>DW.safeParse($).success,RW=l({jsonrpc:t(u0),...jv.shape}).strict(),uW=($)=>RW.safeParse($).success,vb=l({jsonrpc:t(u0),id:HU,result:Jv}).strict(),yg=($)=>vb.safeParse($).success;var w$;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(w$||(w$={}));var Ub=l({jsonrpc:t(u0),id:HU.optional(),error:l({code:L$().int(),message:Z(),data:M$().optional()})}).strict();var TW=($)=>Ub.safeParse($).success;var jW=A$([DW,RW,vb,Ub]),BN=A$([vb,Ub]),T0=Jv.strict(),mI=Tv.extend({requestId:HU.optional(),reason:Z().optional()}),j0=jv.extend({method:t("notifications/cancelled"),params:mI}),cI=l({src:Z(),mimeType:Z().optional(),sizes:G$(Z()).optional(),theme:gv(["light","dark"]).optional()}),Dg=l({icons:G$(cI).optional()}),YU=l({name:Z(),title:Z().optional()}),Rg=YU.extend({...YU.shape,...Dg.shape,version:Z(),websiteUrl:Z().optional(),description:Z().optional()}),iI=kU(l({applyDefaults:h$().optional()}),y$(Z(),M$())),xI=Sg(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},kU(l({form:iI.optional(),url:_v.optional()}),y$(Z(),M$()).optional())),hI=Uv({list:_v.optional(),cancel:_v.optional(),requests:Uv({sampling:Uv({createMessage:_v.optional()}).optional(),elicitation:Uv({create:_v.optional()}).optional()}).optional()}),lI=Uv({list:_v.optional(),cancel:_v.optional(),requests:Uv({tools:Uv({call:_v.optional()}).optional()}).optional()}),pI=l({experimental:y$(Z(),_v).optional(),sampling:l({context:_v.optional(),tools:_v.optional()}).optional(),elicitation:xI.optional(),roots:l({listChanged:h$().optional()}).optional(),tasks:hI.optional()}),oI=yv.extend({protocolVersion:Z(),capabilities:pI,clientInfo:Rg}),nI=zv.extend({method:t("initialize"),params:oI});var tI=l({experimental:y$(Z(),_v).optional(),logging:_v.optional(),completions:_v.optional(),prompts:l({listChanged:h$().optional()}).optional(),resources:l({subscribe:h$().optional(),listChanged:h$().optional()}).optional(),tools:l({listChanged:h$().optional()}).optional(),tasks:lI.optional()}),dI=Jv.extend({protocolVersion:Z(),capabilities:tI,serverInfo:Rg,instructions:Z().optional()}),aI=jv.extend({method:t("notifications/initialized"),params:Tv.optional()});var m6=zv.extend({method:t("ping"),params:yv.optional()}),sI=l({progress:L$(),total:R$(L$()),message:R$(Z())}),eI=l({...Tv.shape,...sI.shape,progressToken:SW}),r0=jv.extend({method:t("notifications/progress"),params:eI}),$q=yv.extend({cursor:NW.optional()}),ug=zv.extend({params:$q.optional()}),Tg=Jv.extend({nextCursor:NW.optional()}),vq=gv(["working","input_required","completed","failed","cancelled"]),jg=l({taskId:Z(),status:vq,ttl:A$([L$(),PU()]),createdAt:Z(),lastUpdatedAt:Z(),pollInterval:R$(L$()),statusMessage:R$(Z())}),V0=Jv.extend({task:jg}),Uq=Tv.merge(jg),rg=jv.extend({method:t("notifications/tasks/status"),params:Uq}),C0=zv.extend({method:t("tasks/get"),params:yv.extend({taskId:Z()})}),f0=Jv.merge(jg),E0=zv.extend({method:t("tasks/result"),params:yv.extend({taskId:Z()})}),PN=Jv.loose(),m0=ug.extend({method:t("tasks/list")}),c0=Tg.extend({tasks:G$(jg)}),i0=zv.extend({method:t("tasks/cancel"),params:yv.extend({taskId:Z()})}),rW=Jv.merge(jg),VW=l({uri:Z(),mimeType:R$(Z()),_meta:y$(Z(),M$()).optional()}),CW=VW.extend({text:Z()}),gb=Z().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),fW=VW.extend({blob:gb}),Vg=gv(["user","assistant"]),LU=l({audience:G$(Vg).optional(),priority:L$().min(0).max(1).optional(),lastModified:f6.datetime({offset:!0}).optional()}),EW=l({...YU.shape,...Dg.shape,uri:Z(),description:R$(Z()),mimeType:R$(Z()),annotations:LU.optional(),_meta:R$(Uv({}))}),gq=l({...YU.shape,...Dg.shape,uriTemplate:Z(),description:R$(Z()),mimeType:R$(Z()),annotations:LU.optional(),_meta:R$(Uv({}))}),_b=ug.extend({method:t("resources/list")}),Cg=Tg.extend({resources:G$(EW)}),zb=ug.extend({method:t("resources/templates/list")}),Jb=Tg.extend({resourceTemplates:G$(gq)}),Gb=yv.extend({uri:Z()}),_q=Gb,bb=zv.extend({method:t("resources/read"),params:_q}),fg=Jv.extend({contents:G$(A$([CW,fW]))}),Kb=jv.extend({method:t("notifications/resources/list_changed"),params:Tv.optional()}),zq=Gb,Jq=zv.extend({method:t("resources/subscribe"),params:zq}),Gq=Gb,bq=zv.extend({method:t("resources/unsubscribe"),params:Gq}),Kq=Tv.extend({uri:Z()}),Oq=jv.extend({method:t("notifications/resources/updated"),params:Kq}),Wq=l({name:Z(),description:R$(Z()),required:R$(h$())}),Bq=l({...YU.shape,...Dg.shape,description:R$(Z()),arguments:R$(G$(Wq)),_meta:R$(Uv({}))}),Ob=ug.extend({method:t("prompts/list")}),Wb=Tg.extend({prompts:G$(Bq)}),Pq=yv.extend({name:Z(),arguments:y$(Z(),Z()).optional()}),kq=zv.extend({method:t("prompts/get"),params:Pq}),Bb=l({type:t("text"),text:Z(),annotations:LU.optional(),_meta:y$(Z(),M$()).optional()}),Pb=l({type:t("image"),data:gb,mimeType:Z(),annotations:LU.optional(),_meta:y$(Z(),M$()).optional()}),kb=l({type:t("audio"),data:gb,mimeType:Z(),annotations:LU.optional(),_meta:y$(Z(),M$()).optional()}),Yq=l({type:t("tool_use"),name:Z(),id:Z(),input:y$(Z(),M$()),_meta:y$(Z(),M$()).optional()}),Yb=l({type:t("resource"),resource:A$([CW,fW]),annotations:LU.optional(),_meta:y$(Z(),M$()).optional()}),Hb=EW.extend({type:t("resource_link")}),IU=A$([Bb,Pb,kb,Hb,Yb]),Hq=l({role:Vg,content:IU}),Lq=Jv.extend({description:Z().optional(),messages:G$(Hq)}),Lb=jv.extend({method:t("notifications/prompts/list_changed"),params:Tv.optional()}),Iq=l({title:Z().optional(),readOnlyHint:h$().optional(),destructiveHint:h$().optional(),idempotentHint:h$().optional(),openWorldHint:h$().optional()}),qq=l({taskSupport:gv(["required","optional","forbidden"]).optional()}),x0=l({...YU.shape,...Dg.shape,description:Z().optional(),inputSchema:l({type:t("object"),properties:y$(Z(),_v).optional(),required:G$(Z()).optional()}).catchall(M$()),outputSchema:l({type:t("object"),properties:y$(Z(),_v).optional(),required:G$(Z()).optional()}).catchall(M$()).optional(),annotations:Iq.optional(),execution:qq.optional(),_meta:y$(Z(),M$()).optional()}),Eg=ug.extend({method:t("tools/list")}),Xq=Tg.extend({tools:G$(x0)}),c6=Jv.extend({content:G$(IU).default([]),structuredContent:y$(Z(),M$()).optional(),isError:h$().optional()}),kN=c6.or(Jv.extend({toolResult:M$()})),Fq=Ng.extend({name:Z(),arguments:y$(Z(),M$()).optional()}),mg=zv.extend({method:t("tools/call"),params:Fq}),Ib=jv.extend({method:t("notifications/tools/list_changed"),params:Tv.optional()}),YN=l({autoRefresh:h$().default(!0),debounceMs:L$().int().nonnegative().default(300)}),mW=gv(["debug","info","notice","warning","error","critical","alert","emergency"]),wq=yv.extend({level:mW}),Aq=zv.extend({method:t("logging/setLevel"),params:wq}),Zq=Tv.extend({level:mW,logger:Z().optional(),data:M$()}),qb=jv.extend({method:t("notifications/message"),params:Zq}),Qq=l({name:Z().optional()}),Mq=l({hints:G$(Qq).optional(),costPriority:L$().min(0).max(1).optional(),speedPriority:L$().min(0).max(1).optional(),intelligencePriority:L$().min(0).max(1).optional()}),Sq=l({mode:gv(["auto","required","none"]).optional()}),Nq=l({type:t("tool_result"),toolUseId:Z().describe("The unique identifier for the corresponding tool call."),content:G$(IU).default([]),structuredContent:l({}).loose().optional(),isError:h$().optional(),_meta:y$(Z(),M$()).optional()}),yq=Zg("type",[Bb,Pb,kb]),R0=Zg("type",[Bb,Pb,kb,Yq,Nq]),Dq=l({role:Vg,content:A$([R0,G$(R0)]),_meta:y$(Z(),M$()).optional()}),Rq=Ng.extend({messages:G$(Dq),modelPreferences:Mq.optional(),systemPrompt:Z().optional(),includeContext:gv(["none","thisServer","allServers"]).optional(),temperature:L$().optional(),maxTokens:L$().int(),stopSequences:G$(Z()).optional(),metadata:_v.optional(),tools:G$(x0).optional(),toolChoice:Sq.optional()}),uq=zv.extend({method:t("sampling/createMessage"),params:Rq}),Tq=Jv.extend({model:Z(),stopReason:R$(gv(["endTurn","stopSequence","maxTokens"]).or(Z())),role:Vg,content:yq}),jq=Jv.extend({model:Z(),stopReason:R$(gv(["endTurn","stopSequence","maxTokens","toolUse"]).or(Z())),role:Vg,content:A$([R0,G$(R0)])}),rq=l({type:t("boolean"),title:Z().optional(),description:Z().optional(),default:h$().optional()}),Vq=l({type:t("string"),title:Z().optional(),description:Z().optional(),minLength:L$().optional(),maxLength:L$().optional(),format:gv(["email","uri","date","date-time"]).optional(),default:Z().optional()}),Cq=l({type:gv(["number","integer"]),title:Z().optional(),description:Z().optional(),minimum:L$().optional(),maximum:L$().optional(),default:L$().optional()}),fq=l({type:t("string"),title:Z().optional(),description:Z().optional(),enum:G$(Z()),default:Z().optional()}),Eq=l({type:t("string"),title:Z().optional(),description:Z().optional(),oneOf:G$(l({const:Z(),title:Z()})),default:Z().optional()}),mq=l({type:t("string"),title:Z().optional(),description:Z().optional(),enum:G$(Z()),enumNames:G$(Z()).optional(),default:Z().optional()}),cq=A$([fq,Eq]),iq=l({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:L$().optional(),maxItems:L$().optional(),items:l({type:t("string"),enum:G$(Z())}),default:G$(Z()).optional()}),xq=l({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:L$().optional(),maxItems:L$().optional(),items:l({anyOf:G$(l({const:Z(),title:Z()}))}),default:G$(Z()).optional()}),hq=A$([iq,xq]),lq=A$([mq,cq,hq]),pq=A$([lq,rq,Vq,Cq]),oq=Ng.extend({mode:t("form").optional(),message:Z(),requestedSchema:l({type:t("object"),properties:y$(Z(),pq),required:G$(Z()).optional()})}),nq=Ng.extend({mode:t("url"),message:Z(),elicitationId:Z(),url:Z().url()}),tq=A$([oq,nq]),dq=zv.extend({method:t("elicitation/create"),params:tq}),aq=Tv.extend({elicitationId:Z()}),sq=jv.extend({method:t("notifications/elicitation/complete"),params:aq}),eq=Jv.extend({action:gv(["accept","decline","cancel"]),content:Sg(($)=>$===null?void 0:$,y$(Z(),A$([Z(),L$(),h$(),G$(Z())])).optional())}),$X=l({type:t("ref/resource"),uri:Z()});var vX=l({type:t("ref/prompt"),name:Z()}),UX=yv.extend({ref:A$([vX,$X]),argument:l({name:Z(),value:Z()}),context:l({arguments:y$(Z(),Z()).optional()}).optional()}),gX=zv.extend({method:t("completion/complete"),params:UX});var _X=Jv.extend({completion:Uv({values:G$(Z()).max(100),total:R$(L$().int()),hasMore:R$(h$())})}),zX=l({uri:Z().startsWith("file://"),name:Z().optional(),_meta:y$(Z(),M$()).optional()}),JX=zv.extend({method:t("roots/list"),params:yv.optional()}),GX=Jv.extend({roots:G$(zX)}),bX=jv.extend({method:t("notifications/roots/list_changed"),params:Tv.optional()}),HN=A$([m6,nI,gX,Aq,kq,Ob,_b,zb,bb,Jq,bq,mg,Eg,C0,E0,m0,i0]),LN=A$([j0,r0,aI,bX,rg]),IN=A$([T0,Tq,jq,eq,GX,f0,c0,V0]),qN=A$([m6,uq,dq,JX,C0,E0,m0,i0]),XN=A$([j0,r0,qb,Oq,Kb,Ib,Lb,rg,sq]),FN=A$([T0,dI,_X,Lq,Wb,Cg,Jb,fg,c6,Xq,f0,c0,V0]);class Y$ extends Error{constructor($,v,g){super(`MCP error ${$}: ${v}`);this.code=$,this.data=g,this.name="McpError"}static fromError($,v,g){if($===w$.UrlElicitationRequired&&g){let _=g;if(_.elicitations)return new cW(_.elicitations,v)}return new Y$($,v,g)}}class cW extends Y${constructor($,v=`URL elicitation${$.length>1?"s":""} required`){super(w$.UrlElicitationRequired,v,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function h0($){return!!$._zod}function l0($,v){if(h0($))return x4($,v);return $.safeParse(v)}function iW($){if(!$)return;let v;if(h0($))v=$._zod?.def?.shape;else v=$.shape;if(!v)return;if(typeof v==="function")try{return v()}catch{return}return v}function xW($){if(h0($)){let z=$._zod?.def;if(z){if(z.value!==void 0)return z.value;if(Array.isArray(z.values)&&z.values.length>0)return z.values[0]}}let g=$._def;if(g){if(g.value!==void 0)return g.value;if(Array.isArray(g.values)&&g.values.length>0)return g.values[0]}let _=$.value;if(_!==void 0)return _;return}function i6($){return $==="completed"||$==="failed"||$==="cancelled"}var KX=Symbol("Let zodToJsonSchema decide on which parser to use");var zy=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Xb($){let g=iW($)?.method;if(!g)throw Error("Schema is missing a method literal");let _=xW(g);if(typeof _!=="string")throw Error("Schema method literal must be a string");return _}function Fb($,v){let g=l0($,v);if(!g.success)throw g.error;return g.data}var YX=60000;class ig{constructor($){if(this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(j0,(v)=>{this._oncancel(v)}),this.setNotificationHandler(r0,(v)=>{this._onprogress(v)}),this.setRequestHandler(m6,(v)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(C0,async(v,g)=>{let _=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!_)throw new Y$(w$.InvalidParams,"Failed to retrieve task: Task not found");return{..._}}),this.setRequestHandler(E0,async(v,g)=>{let _=async()=>{let U=v.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(U,g.sessionId)){if(J.type==="response"||J.type==="error"){let G=J.message,K=G.id,O=this._requestResolvers.get(K);if(O)if(this._requestResolvers.delete(K),J.type==="response")O(G);else{let W=G,B=new Y$(W.error.code,W.error.message,W.error.data);O(B)}else{let W=J.type==="response"?"Response":"Error";this._onerror(Error(`${W} handler missing for request ${K}`))}continue}await this._transport?.send(J.message,{relatedRequestId:g.requestId})}}let z=await this._taskStore.getTask(U,g.sessionId);if(!z)throw new Y$(w$.InvalidParams,`Task not found: ${U}`);if(!i6(z.status))return await this._waitForTaskUpdate(U,g.signal),await _();if(i6(z.status)){let J=await this._taskStore.getTaskResult(U,g.sessionId);return this._clearTaskQueue(U),{...J,_meta:{...J._meta,[E6]:{taskId:U}}}}return await _()};return await _()}),this.setRequestHandler(m0,async(v,g)=>{try{let{tasks:_,nextCursor:U}=await this._taskStore.listTasks(v.params?.cursor,g.sessionId);return{tasks:_,nextCursor:U,_meta:{}}}catch(_){throw new Y$(w$.InvalidParams,`Failed to list tasks: ${_ instanceof Error?_.message:String(_)}`)}}),this.setRequestHandler(i0,async(v,g)=>{try{let _=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!_)throw new Y$(w$.InvalidParams,`Task not found: ${v.params.taskId}`);if(i6(_.status))throw new Y$(w$.InvalidParams,`Cannot cancel task in terminal status: ${_.status}`);await this._taskStore.updateTaskStatus(v.params.taskId,"cancelled","Client cancelled task execution.",g.sessionId),this._clearTaskQueue(v.params.taskId);let U=await this._taskStore.getTask(v.params.taskId,g.sessionId);if(!U)throw new Y$(w$.InvalidParams,`Task not found after cancellation: ${v.params.taskId}`);return{_meta:{},...U}}catch(_){if(_ instanceof Y$)throw _;throw new Y$(w$.InvalidRequest,`Failed to cancel task: ${_ instanceof Error?_.message:String(_)}`)}})}async _oncancel($){if(!$.params.requestId)return;this._requestHandlerAbortControllers.get($.params.requestId)?.abort($.params.reason)}_setupTimeout($,v,g,_,U=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(_,v),startTime:Date.now(),timeout:v,maxTotalTimeout:g,resetTimeoutOnProgress:U,onTimeout:_})}_resetTimeout($){let v=this._timeoutInfo.get($);if(!v)return!1;let g=Date.now()-v.startTime;if(v.maxTotalTimeout&&g>=v.maxTotalTimeout)throw this._timeoutInfo.delete($),Y$.fromError(w$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:g});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout($){let v=this._timeoutInfo.get($);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete($)}async connect($){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=$;let v=this.transport?.onclose;this._transport.onclose=()=>{v?.(),this._onclose()};let g=this.transport?.onerror;this._transport.onerror=(U)=>{g?.(U),this._onerror(U)};let _=this._transport?.onmessage;this._transport.onmessage=(U,z)=>{if(_?.(U,z),yg(U)||TW(U))this._onresponse(U);else if($b(U))this._onrequest(U,z);else if(uW(U))this._onnotification(U);else this._onerror(Error(`Unknown message type: ${JSON.stringify(U)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let g of this._timeoutInfo.values())clearTimeout(g.timeoutId);this._timeoutInfo.clear();for(let g of this._requestHandlerAbortControllers.values())g.abort();this._requestHandlerAbortControllers.clear();let v=Y$.fromError(w$.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let g of $.values())g(v)}_onerror($){this.onerror?.($)}_onnotification($){let v=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(v===void 0)return;Promise.resolve().then(()=>v($)).catch((g)=>this._onerror(Error(`Uncaught error in notification handler: ${g}`)))}_onrequest($,v){let g=this._requestHandlers.get($.method)??this.fallbackRequestHandler,_=this._transport,U=$.params?._meta?.[E6]?.taskId;if(g===void 0){let O={jsonrpc:"2.0",id:$.id,error:{code:w$.MethodNotFound,message:"Method not found"}};if(U&&this._taskMessageQueue)this._enqueueTaskMessage(U,{type:"error",message:O,timestamp:Date.now()},_?.sessionId).catch((W)=>this._onerror(Error(`Failed to enqueue error response: ${W}`)));else _?.send(O).catch((W)=>this._onerror(Error(`Failed to send an error response: ${W}`)));return}let z=new AbortController;this._requestHandlerAbortControllers.set($.id,z);let J=yW($.params)?$.params.task:void 0,G=this._taskStore?this.requestTaskStore($,_?.sessionId):void 0,K={signal:z.signal,sessionId:_?.sessionId,_meta:$.params?._meta,sendNotification:async(O)=>{if(z.signal.aborted)return;let W={relatedRequestId:$.id};if(U)W.relatedTask={taskId:U};await this.notification(O,W)},sendRequest:async(O,W,B)=>{if(z.signal.aborted)throw new Y$(w$.ConnectionClosed,"Request was cancelled");let k={...B,relatedRequestId:$.id};if(U&&!k.relatedTask)k.relatedTask={taskId:U};let P=k.relatedTask?.taskId??U;if(P&&G)await G.updateTaskStatus(P,"input_required");return await this.request(O,W,k)},authInfo:v?.authInfo,requestId:$.id,requestInfo:v?.requestInfo,taskId:U,taskStore:G,taskRequestedTtl:J?.ttl,closeSSEStream:v?.closeSSEStream,closeStandaloneSSEStream:v?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability($.method)}).then(()=>g($,K)).then(async(O)=>{if(z.signal.aborted)return;let W={result:O,jsonrpc:"2.0",id:$.id};if(U&&this._taskMessageQueue)await this._enqueueTaskMessage(U,{type:"response",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)},async(O)=>{if(z.signal.aborted)return;let W={jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(O.code)?O.code:w$.InternalError,message:O.message??"Internal error",...O.data!==void 0&&{data:O.data}}};if(U&&this._taskMessageQueue)await this._enqueueTaskMessage(U,{type:"error",message:W,timestamp:Date.now()},_?.sessionId);else await _?.send(W)}).catch((O)=>this._onerror(Error(`Failed to send response: ${O}`))).finally(()=>{if(this._requestHandlerAbortControllers.get($.id)===z)this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:v,...g}=$.params,_=Number(v),U=this._progressHandlers.get(_);if(!U){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let z=this._responseHandlers.get(_),J=this._timeoutInfo.get(_);if(J&&z&&J.resetTimeoutOnProgress)try{this._resetTimeout(_)}catch(G){this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),z(G);return}U(g)}_onresponse($){let v=Number($.id),g=this._requestResolvers.get(v);if(g){if(this._requestResolvers.delete(v),yg($))g($);else{let z=new Y$($.error.code,$.error.message,$.error.data);g(z)}return}let _=this._responseHandlers.get(v);if(_===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}this._responseHandlers.delete(v),this._cleanupTimeout(v);let U=!1;if(yg($)&&$.result&&typeof $.result==="object"){let z=$.result;if(z.task&&typeof z.task==="object"){let J=z.task;if(typeof J.taskId==="string")U=!0,this._taskProgressTokens.set(J.taskId,v)}}if(!U)this._progressHandlers.delete(v);if(yg($))_($);else{let z=Y$.fromError($.error.code,$.error.message,$.error.data);_(z)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream($,v,g){let{task:_}=g??{};if(!_){try{yield{type:"result",result:await this.request($,v,g)}}catch(z){yield{type:"error",error:z instanceof Y$?z:new Y$(w$.InternalError,String(z))}}return}let U;try{let z=await this.request($,V0,g);if(z.task)U=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new Y$(w$.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:U},g);if(yield{type:"taskStatus",task:J},i6(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:U},v,g)};else if(J.status==="failed")yield{type:"error",error:new Y$(w$.InternalError,`Task ${U} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new Y$(w$.InternalError,`Task ${U} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:U},v,g)};return}let G=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((K)=>setTimeout(K,G)),g?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof Y$?z:new Y$(w$.InternalError,String(z))}}}request($,v,g){let{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z,task:J,relatedTask:G}=g??{};return new Promise((K,O)=>{let W=(I)=>{O(I)};if(!this._transport){W(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),J)this.assertTaskCapability($.method)}catch(I){W(I);return}g?.signal?.throwIfAborted();let B=this._requestMessageId++,k={...$,jsonrpc:"2.0",id:B};if(g?.onprogress)this._progressHandlers.set(B,g.onprogress),k.params={...$.params,_meta:{...$.params?._meta||{},progressToken:B}};if(J)k.params={...k.params,task:J};if(G)k.params={...k.params,_meta:{...k.params?._meta||{},[E6]:G}};let P=(I)=>{this._responseHandlers.delete(B),this._progressHandlers.delete(B),this._cleanupTimeout(B),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:B,reason:String(I)}},{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));let q=I instanceof Y$?I:new Y$(w$.RequestTimeout,String(I));O(q)};this._responseHandlers.set(B,(I)=>{if(g?.signal?.aborted)return;if(I instanceof Error)return O(I);try{let q=l0(v,I.result);if(!q.success)O(q.error);else K(q.data)}catch(q){O(q)}}),g?.signal?.addEventListener("abort",()=>{P(g?.signal?.reason)});let X=g?.timeout??YX,L=()=>P(Y$.fromError(w$.RequestTimeout,"Request timed out",{timeout:X}));this._setupTimeout(B,X,g?.maxTotalTimeout,L,g?.resetTimeoutOnProgress??!1);let Y=G?.taskId;if(Y){let I=(q)=>{let w=this._responseHandlers.get(B);if(w)w(q);else this._onerror(Error(`Response handler missing for side-channeled request ${B}`))};this._requestResolvers.set(B,I),this._enqueueTaskMessage(Y,{type:"request",message:k,timestamp:Date.now()}).catch((q)=>{this._cleanupTimeout(B),O(q)})}else this._transport.send(k,{relatedRequestId:_,resumptionToken:U,onresumptiontoken:z}).catch((I)=>{this._cleanupTimeout(B),O(I)})})}async getTask($,v){return this.request({method:"tasks/get",params:$},f0,v)}async getTaskResult($,v,g){return this.request({method:"tasks/result",params:$},v,g)}async listTasks($,v){return this.request({method:"tasks/list",params:$},c0,v)}async cancelTask($,v){return this.request({method:"tasks/cancel",params:$},rW,v)}async notification($,v){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let g=v?.relatedTask?.taskId;if(g){let J={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[E6]:v.relatedTask}}};await this._enqueueTaskMessage(g,{type:"notification",message:J,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes($.method)&&!$.params&&!v?.relatedRequestId&&!v?.relatedTask){if(this._pendingDebouncedNotifications.has($.method))return;this._pendingDebouncedNotifications.add($.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete($.method),!this._transport)return;let J={...$,jsonrpc:"2.0"};if(v?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[E6]:v.relatedTask}}};this._transport?.send(J,v).catch((G)=>this._onerror(G))});return}let z={...$,jsonrpc:"2.0"};if(v?.relatedTask)z={...z,params:{...z.params,_meta:{...z.params?._meta||{},[E6]:v.relatedTask}}};await this._transport.send(z,v)}setRequestHandler($,v){let g=Xb($);this.assertRequestHandlerCapability(g),this._requestHandlers.set(g,(_,U)=>{let z=Fb($,_);return Promise.resolve(v(z,U))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,v){let g=Xb($);this._notificationHandlers.set(g,(_)=>{let U=Fb($,_);return Promise.resolve(v(U))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let v=this._taskProgressTokens.get($);if(v!==void 0)this._progressHandlers.delete(v),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,v,g){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let _=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue($,v,g,_)}async _clearTaskQueue($,v){if(this._taskMessageQueue){let g=await this._taskMessageQueue.dequeueAll($,v);for(let _ of g)if(_.type==="request"&&$b(_.message)){let U=_.message.id,z=this._requestResolvers.get(U);if(z)z(new Y$(w$.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(U);else this._onerror(Error(`Resolver missing for request ${U} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,v){let g=this._options?.defaultTaskPollInterval??1000;try{let _=await this._taskStore?.getTask($);if(_?.pollInterval)g=_.pollInterval}catch{}return new Promise((_,U)=>{if(v.aborted){U(new Y$(w$.InvalidRequest,"Request cancelled"));return}let z=setTimeout(_,g);v.addEventListener("abort",()=>{clearTimeout(z),U(new Y$(w$.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,v){let g=this._taskStore;if(!g)throw Error("No task store configured");return{createTask:async(_)=>{if(!$)throw Error("No request provided");return await g.createTask(_,$.id,{method:$.method,params:$.params},v)},getTask:async(_)=>{let U=await g.getTask(_,v);if(!U)throw new Y$(w$.InvalidParams,"Failed to retrieve task: Task not found");return U},storeTaskResult:async(_,U,z)=>{await g.storeTaskResult(_,U,z,v);let J=await g.getTask(_,v);if(J){let G=rg.parse({method:"notifications/tasks/status",params:J});if(await this.notification(G),i6(J.status))this._cleanupTaskProgressHandler(_)}},getTaskResult:(_)=>{return g.getTaskResult(_,v)},updateTaskStatus:async(_,U,z)=>{let J=await g.getTask(_,v);if(!J)throw new Y$(w$.InvalidParams,`Task "${_}" not found - it may have been cleaned up`);if(i6(J.status))throw new Y$(w$.InvalidParams,`Cannot update task "${_}" from terminal status "${J.status}" to "${U}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await g.updateTaskStatus(_,U,z,v);let G=await g.getTask(_,v);if(G){let K=rg.parse({method:"notifications/tasks/status",params:G});if(await this.notification(K),i6(G.status))this._cleanupTaskProgressHandler(_)}},listTasks:(_)=>{return g.listTasks(_,v)}}}}var wb="2026-01-26";var HX="ui/notifications/tool-input-partial";var LX=H.union([H.literal("light"),H.literal("dark")]).describe("Color theme preference for the host environment."),xg=H.union([H.literal("inline"),H.literal("fullscreen"),H.literal("pip")]).describe("Display mode for UI presentation."),IX=H.union([H.literal("--color-background-primary"),H.literal("--color-background-secondary"),H.literal("--color-background-tertiary"),H.literal("--color-background-inverse"),H.literal("--color-background-ghost"),H.literal("--color-background-info"),H.literal("--color-background-danger"),H.literal("--color-background-success"),H.literal("--color-background-warning"),H.literal("--color-background-disabled"),H.literal("--color-text-primary"),H.literal("--color-text-secondary"),H.literal("--color-text-tertiary"),H.literal("--color-text-inverse"),H.literal("--color-text-ghost"),H.literal("--color-text-info"),H.literal("--color-text-danger"),H.literal("--color-text-success"),H.literal("--color-text-warning"),H.literal("--color-text-disabled"),H.literal("--color-border-primary"),H.literal("--color-border-secondary"),H.literal("--color-border-tertiary"),H.literal("--color-border-inverse"),H.literal("--color-border-ghost"),H.literal("--color-border-info"),H.literal("--color-border-danger"),H.literal("--color-border-success"),H.literal("--color-border-warning"),H.literal("--color-border-disabled"),H.literal("--color-ring-primary"),H.literal("--color-ring-secondary"),H.literal("--color-ring-inverse"),H.literal("--color-ring-info"),H.literal("--color-ring-danger"),H.literal("--color-ring-success"),H.literal("--color-ring-warning"),H.literal("--font-sans"),H.literal("--font-mono"),H.literal("--font-weight-normal"),H.literal("--font-weight-medium"),H.literal("--font-weight-semibold"),H.literal("--font-weight-bold"),H.literal("--font-text-xs-size"),H.literal("--font-text-sm-size"),H.literal("--font-text-md-size"),H.literal("--font-text-lg-size"),H.literal("--font-heading-xs-size"),H.literal("--font-heading-sm-size"),H.literal("--font-heading-md-size"),H.literal("--font-heading-lg-size"),H.literal("--font-heading-xl-size"),H.literal("--font-heading-2xl-size"),H.literal("--font-heading-3xl-size"),H.literal("--font-text-xs-line-height"),H.literal("--font-text-sm-line-height"),H.literal("--font-text-md-line-height"),H.literal("--font-text-lg-line-height"),H.literal("--font-heading-xs-line-height"),H.literal("--font-heading-sm-line-height"),H.literal("--font-heading-md-line-height"),H.literal("--font-heading-lg-line-height"),H.literal("--font-heading-xl-line-height"),H.literal("--font-heading-2xl-line-height"),H.literal("--font-heading-3xl-line-height"),H.literal("--border-radius-xs"),H.literal("--border-radius-sm"),H.literal("--border-radius-md"),H.literal("--border-radius-lg"),H.literal("--border-radius-xl"),H.literal("--border-radius-full"),H.literal("--border-width-regular"),H.literal("--shadow-hairline"),H.literal("--shadow-sm"),H.literal("--shadow-md"),H.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),qX=H.record(IX.describe(`Style variables for theming MCP apps.
147
147
 
148
148
  Individual style keys are optional - hosts may provide any subset of these values.
149
149
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
150
150
 
151
151
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
152
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),I.union([I.string(),I.undefined()]).describe(`Style variables for theming MCP apps.
152
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),H.union([H.string(),H.undefined()]).describe(`Style variables for theming MCP apps.
153
153
 
154
154
  Individual style keys are optional - hosts may provide any subset of these values.
155
155
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -161,10 +161,10 @@ Individual style keys are optional - hosts may provide any subset of these value
161
161
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
162
162
 
163
163
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
164
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),BX=I.object({method:I.literal("ui/open-link"),params:I.object({url:I.string().describe("URL to open in the host's browser")})}),PX=I.object({isError:I.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),kX=I.object({isError:I.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),HX=I.object({isError:I.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),IX=I.object({method:I.literal("ui/notifications/sandbox-proxy-ready"),params:I.object({})}),I3=I.object({connectDomains:I.array(I.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
164
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),XX=H.object({method:H.literal("ui/open-link"),params:H.object({url:H.string().describe("URL to open in the host's browser")})}),FX=H.object({isError:H.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),wX=H.object({isError:H.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),AX=H.object({isError:H.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),ZX=H.object({method:H.literal("ui/notifications/sandbox-proxy-ready"),params:H.object({})}),Ab=H.object({connectDomains:H.array(H.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
165
165
 
166
166
  - Maps to CSP \`connect-src\` directive
167
- - Empty or omitted → no network connections (secure default)`),resourceDomains:I.array(I.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:I.array(I.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:I.array(I.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Y3=I.object({camera:I.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:I.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:I.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:I.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),YX=I.object({method:I.literal("ui/notifications/size-changed"),params:I.object({width:I.number().optional().describe("New width in pixels."),height:I.number().optional().describe("New height in pixels.")})}),LX=I.object({method:I.literal("ui/notifications/tool-input"),params:I.object({arguments:I.record(I.string(),I.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),qX=I.object({method:I.literal("ui/notifications/tool-input-partial"),params:I.object({arguments:I.record(I.string(),I.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),XX=I.object({method:I.literal("ui/notifications/tool-cancelled"),params:I.object({reason:I.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),wX=I.object({fonts:I.string().optional()}),FX=I.object({variables:WX.optional().describe("CSS variables for theming the app."),css:wX.optional().describe("CSS blocks that apps can inject.")}),AX=I.object({method:I.literal("ui/resource-teardown"),params:I.object({})}),ZX=I.record(I.string(),I.unknown()),CW=I.object({text:I.object({}).optional().describe("Host supports text content blocks."),image:I.object({}).optional().describe("Host supports image content blocks."),audio:I.object({}).optional().describe("Host supports audio content blocks."),resource:I.object({}).optional().describe("Host supports resource content blocks."),resourceLink:I.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:I.object({}).optional().describe("Host supports structured content.")}),MX=I.object({method:I.literal("ui/notifications/request-teardown"),params:I.object({}).optional()}),QX=I.object({experimental:I.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:I.object({}).optional().describe("Host supports opening external URLs."),downloadFile:I.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:I.object({listChanged:I.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:I.object({listChanged:I.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:I.object({}).optional().describe("Host accepts log messages."),sandbox:I.object({permissions:Y3.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:I3.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:CW.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:CW.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),SX=I.object({experimental:I.object({}).optional().describe("Experimental features (structure TBD)."),tools:I.object({listChanged:I.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:I.array(cg).optional().describe("Display modes the app supports.")}),NX=I.object({method:I.literal("ui/notifications/initialized"),params:I.object({}).optional()}),ny=I.object({csp:I3.optional().describe("Content Security Policy configuration for UI resources."),permissions:Y3.optional().describe("Sandbox permissions requested by the UI resource."),domain:I.string().optional().describe(`Dedicated origin for view sandbox.
167
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:H.array(H.string()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:H.array(H.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:H.array(H.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Zb=H.object({camera:H.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:H.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:H.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:H.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),QX=H.object({method:H.literal("ui/notifications/size-changed"),params:H.object({width:H.number().optional().describe("New width in pixels."),height:H.number().optional().describe("New height in pixels.")})}),MX=H.object({method:H.literal("ui/notifications/tool-input"),params:H.object({arguments:H.record(H.string(),H.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),SX=H.object({method:H.literal("ui/notifications/tool-input-partial"),params:H.object({arguments:H.record(H.string(),H.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),NX=H.object({method:H.literal("ui/notifications/tool-cancelled"),params:H.object({reason:H.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),yX=H.object({fonts:H.string().optional()}),DX=H.object({variables:qX.optional().describe("CSS variables for theming the app."),css:yX.optional().describe("CSS blocks that apps can inject.")}),RX=H.object({method:H.literal("ui/resource-teardown"),params:H.object({})}),uX=H.record(H.string(),H.unknown()),hW=H.object({text:H.object({}).optional().describe("Host supports text content blocks."),image:H.object({}).optional().describe("Host supports image content blocks."),audio:H.object({}).optional().describe("Host supports audio content blocks."),resource:H.object({}).optional().describe("Host supports resource content blocks."),resourceLink:H.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:H.object({}).optional().describe("Host supports structured content.")}),TX=H.object({method:H.literal("ui/notifications/request-teardown"),params:H.object({}).optional()}),jX=H.object({experimental:H.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:H.object({}).optional().describe("Host supports opening external URLs."),downloadFile:H.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:H.object({listChanged:H.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:H.object({listChanged:H.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:H.object({}).optional().describe("Host accepts log messages."),sandbox:H.object({permissions:Zb.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Ab.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:hW.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:hW.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),rX=H.object({experimental:H.object({}).optional().describe("Experimental features (structure TBD)."),tools:H.object({listChanged:H.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:H.array(xg).optional().describe("Display modes the app supports.")}),VX=H.object({method:H.literal("ui/notifications/initialized"),params:H.object({}).optional()}),Gu=H.object({csp:Ab.optional().describe("Content Security Policy configuration for UI resources."),permissions:Zb.optional().describe("Sandbox permissions requested by the UI resource."),domain:H.string().optional().describe(`Dedicated origin for view sandbox.
168
168
 
169
169
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
170
170
 
@@ -172,16 +172,16 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
172
172
  - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
173
173
  - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
174
174
 
175
- If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:I.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
175
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:H.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
176
176
 
177
177
  Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
178
178
 
179
179
  - \`true\`: request visible border + background
180
180
  - \`false\`: request no visible border + background
181
- - omitted: host decides border`)}),fW=I.object({method:I.literal("ui/request-display-mode"),params:I.object({mode:cg.describe("The display mode being requested.")})}),rX=I.object({mode:cg.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),uX=I.union([I.literal("model"),I.literal("app")]).describe("Tool visibility scope - who can access the tool."),ty=I.object({resourceUri:I.string().optional(),visibility:I.array(uX).optional().describe(`Who can access this tool. Default: ["model", "app"]
181
+ - omitted: host decides border`)}),lW=H.object({method:H.literal("ui/request-display-mode"),params:H.object({mode:xg.describe("The display mode being requested.")})}),CX=H.object({mode:xg.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),fX=H.union([H.literal("model"),H.literal("app")]).describe("Tool visibility scope - who can access the tool."),bu=H.object({resourceUri:H.string().optional(),visibility:H.array(fX).optional().describe(`Who can access this tool. Default: ["model", "app"]
182
182
  - "model": Tool visible to and callable by the agent
183
- - "app": Tool callable by the app from this server only`)}),dy=I.object({mimeTypes:I.array(I.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),yX=I.object({method:I.literal("ui/download-file"),params:I.object({contents:I.array(I.union([G3,O3])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),DX=I.object({method:I.literal("ui/message"),params:I.object({role:I.literal("user").describe('Message role, currently only "user" is supported.'),content:I.array(IU).describe("Message content blocks (text, image, etc.).")})}),ay=I.object({method:I.literal("ui/notifications/sandbox-resource-ready"),params:I.object({html:I.string().describe("HTML content to load into the inner iframe."),sandbox:I.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:I3.optional().describe("CSP configuration from resource metadata."),permissions:Y3.optional().describe("Sandbox permissions from resource metadata.")})}),RX=I.object({method:I.literal("ui/notifications/tool-result"),params:E6.describe("Standard MCP tool execution result.")}),mW=I.object({toolInfo:I.object({id:kU.optional().describe("JSON-RPC id of the tools/call request."),tool:c0.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:OX.optional().describe("Current color theme preference."),styles:FX.optional().describe("Style configuration for theming the app."),displayMode:cg.optional().describe("How the UI is currently displayed."),availableDisplayModes:I.array(cg).optional().describe("Display modes the host supports."),containerDimensions:I.union([I.object({height:I.number().describe("Fixed container height in pixels.")}),I.object({maxHeight:I.union([I.number(),I.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(I.union([I.object({width:I.number().describe("Fixed container width in pixels.")}),I.object({maxWidth:I.union([I.number(),I.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
184
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:I.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:I.string().optional().describe("User's timezone in IANA format."),userAgent:I.string().optional().describe("Host application identifier."),platform:I.union([I.literal("web"),I.literal("desktop"),I.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:I.object({touch:I.boolean().optional().describe("Whether the device supports touch input."),hover:I.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:I.object({top:I.number().describe("Top safe area inset in pixels."),right:I.number().describe("Right safe area inset in pixels."),bottom:I.number().describe("Bottom safe area inset in pixels."),left:I.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),TX=I.object({method:I.literal("ui/notifications/host-context-changed"),params:mW.describe("Partial context update containing only changed fields.")}),jX=I.object({method:I.literal("ui/update-model-context"),params:I.object({content:I.array(IU).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:I.record(I.string(),I.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),VX=I.object({method:I.literal("ui/initialize"),params:I.object({appInfo:Ng.describe("App identification (name and version)."),appCapabilities:SX.describe("Features and capabilities this app provides."),protocolVersion:I.string().describe("Protocol version this app supports.")})}),CX=I.object({protocolVersion:I.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ng.describe("Host application identification and version."),hostCapabilities:QX.describe("Features and capabilities provided by the host."),hostContext:mW.describe("Rich context about the host environment.")}).passthrough();class l0{eventTarget;eventSource;messageListener;constructor($=window.parent,v){this.eventTarget=$,this.eventSource=v,this.messageListener=(g)=>{if(v&&g.source!==this.eventSource){console.debug("Ignoring message from unknown source",g);return}let _=SW.safeParse(g.data);if(_.success)console.debug("Parsed message",_.data),this.onmessage?.(_.data);else if(g.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",_.error.message,g);else console.error("Failed to parse message",_.error.message,g),this.onerror?.(Error("Invalid JSON-RPC message received: "+_.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send($,v){if($.method!==GX)console.debug("Sending message",$);this.eventTarget.postMessage($,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}class fX extends mg{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor($,v={},g={autoResize:!0}){super(g);this._appInfo=$,this._capabilities=v,this.options=g,this.setRequestHandler(c6,(_)=>{return console.log("Received ping:",_.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput($){this.setNotificationHandler(LX,(v)=>$(v.params))}set ontoolinputpartial($){this.setNotificationHandler(qX,(v)=>$(v.params))}set ontoolresult($){this.setNotificationHandler(RX,(v)=>$(v.params))}set ontoolcancelled($){this.setNotificationHandler(XX,(v)=>$(v.params))}set onhostcontextchanged($){this.setNotificationHandler(TX,(v)=>{this._hostContext={...this._hostContext,...v.params},$(v.params)})}set onteardown($){this.setRequestHandler(AX,(v,g)=>$(v.params,g))}set oncalltool($){this.setRequestHandler(Cg,(v,g)=>$(v.params,g))}set onlisttools($){this.setRequestHandler(Vg,(v,g)=>$(v.params,g))}assertCapabilityForMethod($){}assertRequestHandlerCapability($){switch($){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${$})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${$} registered`)}}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool($,v){if(typeof $==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${$}"). Did you mean: callServerTool({ name: "${$}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:$},E6,v)}async readServerResource($,v){return await this.request({method:"resources/read",params:$},jg,v)}async listServerResources($,v){return await this.request({method:"resources/list",params:$},Tg,v)}sendMessage($,v){return this.request({method:"ui/message",params:$},HX,v)}sendLog($){return this.notification({method:"notifications/message",params:$})}updateModelContext($,v){return this.request({method:"ui/update-model-context",params:$},u0,v)}openLink($,v){return this.request({method:"ui/open-link",params:$},PX,v)}sendOpenLink=this.openLink;downloadFile($,v){return this.request({method:"ui/download-file",params:$},kX,v)}requestTeardown($={}){return this.notification({method:"ui/notifications/request-teardown",params:$})}requestDisplayMode($,v){return this.request({method:"ui/request-display-mode",params:$},rX,v)}sendSizeChanged($){return this.notification({method:"ui/notifications/size-changed",params:$})}setupSizeChangedNotifications(){let $=!1,v=0,g=0,_=()=>{if($)return;$=!0,requestAnimationFrame(()=>{$=!1;let z=document.documentElement,J=z.style.width,b=z.style.height;z.style.width="fit-content",z.style.height="max-content";let O=z.getBoundingClientRect();z.style.width=J,z.style.height=b;let K=window.innerWidth-z.clientWidth,W=Math.ceil(O.width+K),B=Math.ceil(O.height);if(W!==v||B!==g)v=W,g=B,this.sendSizeChanged({width:W,height:B})})};_();let U=new ResizeObserver(_);return U.observe(document.documentElement),U.observe(document.body),()=>U.disconnect()}async connect($=new l0(window.parent,window.parent),v){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect($);try{let g=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:H3}},CX,v);if(g===void 0)throw Error(`Server sent invalid initialize result: ${g}`);if(this._hostCapabilities=g.hostCapabilities,this._hostInfo=g.hostInfo,this._hostContext=g.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(g){throw this.close(),g}}}function cW($){if(!$)return"";let v=[];if($.camera)v.push("camera");if($.microphone)v.push("microphone");if($.geolocation)v.push("geolocation");if($.clipboardWrite)v.push("clipboard-write");return v.join("; ")}var mX=[H3];class L3 extends mg{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor($,v,g,_){super(_);this._client=$,this._hostInfo=v,this._capabilities=g,this._hostContext=_?.hostContext||{},this.setRequestHandler(VX,(U)=>this._oninitialize(U)),this.setRequestHandler(c6,(U,z)=>{return this.onping?.(U.params,z),{}}),this.setRequestHandler(fW,(U)=>{return{mode:this._hostContext.displayMode??"inline"}})}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange($){this.setNotificationHandler(YX,(v)=>$(v.params))}set onsandboxready($){this.setNotificationHandler(IX,(v)=>$(v.params))}set oninitialized($){this.setNotificationHandler(NX,(v)=>$(v.params))}set onmessage($){this.setRequestHandler(DX,async(v,g)=>{return $(v.params,g)})}set onopenlink($){this.setRequestHandler(BX,async(v,g)=>{return $(v.params,g)})}set ondownloadfile($){this.setRequestHandler(yX,async(v,g)=>{return $(v.params,g)})}set onrequestteardown($){this.setNotificationHandler(MX,(v)=>$(v.params))}set onrequestdisplaymode($){this.setRequestHandler(fW,async(v,g)=>{return $(v.params,g)})}set onloggingmessage($){this.setNotificationHandler(B3,async(v)=>{$(v.params)})}set onupdatemodelcontext($){this.setRequestHandler(jX,async(v,g)=>{return $(v.params,g)})}set oncalltool($){this.setRequestHandler(Cg,async(v,g)=>{return $(v.params,g)})}sendToolListChanged($={}){return this.notification({method:"notifications/tools/list_changed",params:$})}set onlistresources($){this.setRequestHandler(aG,async(v,g)=>{return $(v.params,g)})}set onlistresourcetemplates($){this.setRequestHandler(sG,async(v,g)=>{return $(v.params,g)})}set onreadresource($){this.setRequestHandler(v3,async(v,g)=>{return $(v.params,g)})}sendResourceListChanged($={}){return this.notification({method:"notifications/resources/list_changed",params:$})}set onlistprompts($){this.setRequestHandler(g3,async(v,g)=>{return $(v.params,g)})}sendPromptListChanged($={}){return this.notification({method:"notifications/prompts/list_changed",params:$})}assertCapabilityForMethod($){}assertRequestHandlerCapability($){}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize($){let v=$.params.protocolVersion;return this._appCapabilities=$.params.appCapabilities,this._appInfo=$.params.appInfo,{protocolVersion:mX.includes(v)?v:H3,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext($){let v={},g=!1;for(let _ of Object.keys($)){let U=this._hostContext[_],z=$[_];if(cX(U,z))continue;v[_]=z,g=!0}if(g)this._hostContext=$,this.sendHostContextChange(v)}sendHostContextChange($){return this.notification({method:"ui/notifications/host-context-changed",params:$})}sendToolInput($){return this.notification({method:"ui/notifications/tool-input",params:$})}sendToolInputPartial($){return this.notification({method:"ui/notifications/tool-input-partial",params:$})}sendToolResult($){return this.notification({method:"ui/notifications/tool-result",params:$})}sendToolCancelled($){return this.notification({method:"ui/notifications/tool-cancelled",params:$})}sendSandboxResourceReady($){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:$})}teardownResource($,v){return this.request({method:"ui/resource-teardown",params:$},ZX,v)}sendResourceTeardown=this.teardownResource;async connect($){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._client){let v=this._client.getServerCapabilities();if(!v)throw Error("Client server capabilities not available");if(v.tools){if(this.oncalltool=async(g,_)=>{return this._client.request({method:"tools/call",params:g},E6,{signal:_.signal})},v.tools.listChanged)this._client.setNotificationHandler(W3,(g)=>this.sendToolListChanged(g.params))}if(v.resources){if(this.onlistresources=async(g,_)=>{return this._client.request({method:"resources/list",params:g},Tg,{signal:_.signal})},this.onlistresourcetemplates=async(g,_)=>{return this._client.request({method:"resources/templates/list",params:g},eG,{signal:_.signal})},this.onreadresource=async(g,_)=>{return this._client.request({method:"resources/read",params:g},jg,{signal:_.signal})},v.resources.listChanged)this._client.setNotificationHandler(U3,(g)=>this.sendResourceListChanged(g.params))}if(v.prompts){if(this.onlistprompts=async(g,_)=>{return this._client.request({method:"prompts/list",params:g},_3,{signal:_.signal})},v.prompts.listChanged)this._client.setNotificationHandler(K3,(g)=>this.sendPromptListChanged(g.params))}}return super.connect($)}}function cX($,v){return JSON.stringify($)===JSON.stringify(v)}function q3($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function EX($){return q3($)&&Array.isArray($.content)&&$.content.every((v)=>q3(v)&&typeof v.type==="string")}function iX(...$){for(let v of $)if(typeof v==="string"){if(v.trim().length>0)return v}return}function lX($){if(typeof $==="string")return $;if($===void 0)return;try{return JSON.stringify($)}catch(v){return console.debug("[ext-app-tool-result] stringify failed",v),String($)}}function X3($){let v=$.success===!1;if(EX($.result))return{...$.result,isError:$.result.isError===!0||v};let g=q3($.result)?$.result:null,_=iX($.detailedContent,$.content,g?.detailedContent,g?.content,g?.textResultForLlm,g?.text,g?.message,typeof $.result==="string"?$.result:void 0,$.error)??lX($.result);return{content:_?[{type:"text",text:_}]:[],isError:v}}function EW($,v){if($===v)return!0;if($.isError!==v.isError)return!1;try{let g=JSON.stringify($),_=JSON.stringify(v);if(g===void 0||_===void 0)return!1;if(Math.abs(g.length-_.length)>2000000)return!1;return g===_}catch{return!1}}function iW($,v){switch($){case"html":return typeof v.html==="string"&&v.html.length>0||typeof v.content==="string"&&v.content.length>0;case"json-render":case"graph":return!0;case"mcp-app":return v.viewerType==="web-artifact"&&typeof v.path==="string"&&v.path.length>0||typeof v.url==="string"&&v.url.length>0;case"webpage":return typeof v.url==="string"&&v.url.length>0;default:return!1}}var w3="allow-scripts allow-popups allow-popups-to-escape-sandbox";function lW($){return Boolean($)&&typeof $==="object"&&$!==null&&!Array.isArray($)&&"ok"in $&&typeof $.ok==="boolean"}async function xX($,v){let g=await fetch("/api/canvas/frame-documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:$,sandbox:v})}),_=await g.json();if(!g.ok||!lW(_)||!_.ok||typeof _.url!=="string"){let U=lW(_)&&_.error?_.error:`Frame document request failed with HTTP ${g.status}`;throw Error(U)}return _.url}function xW($,v){let[g,_]=o(null);return m(()=>{if(_(null),!$)return;let U=!1;return xX($,v).then((z)=>{if(!U)_(z)}).catch((z)=>{console.error("[iframe-document] failed to create frame document:",z)}),()=>{U=!0}},[$,v]),n$(()=>({attributes:g?{src:g}:{},ready:Boolean(g),key:g??""}),[g])}function YU($){let{enabled:v,token:g,nodeId:_,sourceSurface:U,iframeRef:z}=$;m(()=>{if(!v||!g)return;function J(b){if(b.source!==z.current?.contentWindow)return;let O=b.data;if(!O||O.source!==d_||O.token!==g||O.nodeId!==_)return;let K=O.interaction;if(!K||typeof K.type!=="string")return;let W=K.type;S_({type:W,sourceNodeId:_,sourceSurface:U,...K.payload&&typeof K.payload==="object"?{payload:K.payload}:{}}).then((B)=>{if(B.ok)R4("context","AX interaction",W,[_]);else R4("remove","AX interaction rejected",B.error??B.code??"",[_]);z.current?.contentWindow?.postMessage({source:a_,token:g,...O.correlationId?{correlationId:O.correlationId}:{},interaction:{type:W},result:B},"*")})}return window.addEventListener("message",J),()=>window.removeEventListener("message",J)},[v,g,_,U])}async function W4($,v){let _=await(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})).json();if(!_.ok)throw Error(_.error??`Request failed: ${$}`);return _.result}function F3($){return/AppleWebKit/.test($)&&!/Chrome|Chromium|CriOS|Edg|Android/.test($)}var hX=1000,pX=7000;function B4($,v){if(typeof window>"u")return;let g=window;if(g.__PMX_EXTAPP_LOG??=[],g.__PMX_EXTAPP_LOG.length<500)g.__PMX_EXTAPP_LOG.push({t:Date.now(),nodeId:$,event:v});oX({t:Date.now(),nodeId:$,event:v})}var hW=[],A3=null;function oX($){if(hW.push({...$,...typeof document<"u"?{visibility:document.visibilityState}:{}}),A3)return;A3=setTimeout(()=>{A3=null;let v=hW.splice(0);if(v.length===0)return;fetch("/api/canvas/debug/ext-app-recovery",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:v})}).catch(()=>{})},1500)}var pW=Promise.resolve();function nX($){pW=pW.then(async()=>{if(!$.remount())return;await $.awaitBoot(),await new Promise((v)=>setTimeout(v,hX))}).catch(()=>{})}function tX($,v){return v?$==="done":$==="ready"||$==="done"}function dX($,v){let g=typeof $.data.html==="string"?$.data.html:"",_=typeof $.data.serverName==="string"?$.data.serverName:"",U=typeof $.data.appSessionId==="string"?$.data.appSessionId:"",z=typeof $.data.sessionStatus==="string"?$.data.sessionStatus:"";return`${$.id}:${v}:${_}:${U}:${z}:${g}`}function aX($,v){if($==="fullscreen")return{nextMode:"fullscreen",shouldExpand:!v,shouldCollapse:!1};if($==="inline")return{nextMode:"inline",shouldExpand:!1,shouldCollapse:v};return{nextMode:$,shouldExpand:!1,shouldCollapse:!1}}async function oW($,v,g){if(await $.sendToolInput({arguments:v}),g)await $.sendToolResult(g)}function sX($){return typeof $==="string"&&$.trim().length>0?$.trim():w3}function eX($,v){return`<script data-pmx-canvas-ax-bridge>
183
+ - "app": Tool callable by the app from this server only`)}),Ku=H.object({mimeTypes:H.array(H.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),EX=H.object({method:H.literal("ui/download-file"),params:H.object({contents:H.array(H.union([Yb,Hb])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),mX=H.object({method:H.literal("ui/message"),params:H.object({role:H.literal("user").describe('Message role, currently only "user" is supported.'),content:H.array(IU).describe("Message content blocks (text, image, etc.).")})}),Ou=H.object({method:H.literal("ui/notifications/sandbox-resource-ready"),params:H.object({html:H.string().describe("HTML content to load into the inner iframe."),sandbox:H.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ab.optional().describe("CSP configuration from resource metadata."),permissions:Zb.optional().describe("Sandbox permissions from resource metadata.")})}),cX=H.object({method:H.literal("ui/notifications/tool-result"),params:c6.describe("Standard MCP tool execution result.")}),pW=H.object({toolInfo:H.object({id:HU.optional().describe("JSON-RPC id of the tools/call request."),tool:x0.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:LX.optional().describe("Current color theme preference."),styles:DX.optional().describe("Style configuration for theming the app."),displayMode:xg.optional().describe("How the UI is currently displayed."),availableDisplayModes:H.array(xg).optional().describe("Display modes the host supports."),containerDimensions:H.union([H.object({height:H.number().describe("Fixed container height in pixels.")}),H.object({maxHeight:H.union([H.number(),H.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(H.union([H.object({width:H.number().describe("Fixed container width in pixels.")}),H.object({maxWidth:H.union([H.number(),H.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
184
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:H.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:H.string().optional().describe("User's timezone in IANA format."),userAgent:H.string().optional().describe("Host application identifier."),platform:H.union([H.literal("web"),H.literal("desktop"),H.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:H.object({touch:H.boolean().optional().describe("Whether the device supports touch input."),hover:H.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:H.object({top:H.number().describe("Top safe area inset in pixels."),right:H.number().describe("Right safe area inset in pixels."),bottom:H.number().describe("Bottom safe area inset in pixels."),left:H.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),iX=H.object({method:H.literal("ui/notifications/host-context-changed"),params:pW.describe("Partial context update containing only changed fields.")}),xX=H.object({method:H.literal("ui/update-model-context"),params:H.object({content:H.array(IU).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:H.record(H.string(),H.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),hX=H.object({method:H.literal("ui/initialize"),params:H.object({appInfo:Rg.describe("App identification (name and version)."),appCapabilities:rX.describe("Features and capabilities this app provides."),protocolVersion:H.string().describe("Protocol version this app supports.")})}),lX=H.object({protocolVersion:H.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Rg.describe("Host application identification and version."),hostCapabilities:jX.describe("Features and capabilities provided by the host."),hostContext:pW.describe("Rich context about the host environment.")}).passthrough();class p0{eventTarget;eventSource;messageListener;constructor($=window.parent,v){this.eventTarget=$,this.eventSource=v,this.messageListener=(g)=>{if(v&&g.source!==this.eventSource){console.debug("Ignoring message from unknown source",g);return}let _=jW.safeParse(g.data);if(_.success)console.debug("Parsed message",_.data),this.onmessage?.(_.data);else if(g.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",_.error.message,g);else console.error("Failed to parse message",_.error.message,g),this.onerror?.(Error("Invalid JSON-RPC message received: "+_.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send($,v){if($.method!==HX)console.debug("Sending message",$);this.eventTarget.postMessage($,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}class pX extends ig{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor($,v={},g={autoResize:!0}){super(g);this._appInfo=$,this._capabilities=v,this.options=g,this.setRequestHandler(m6,(_)=>{return console.log("Received ping:",_.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput($){this.setNotificationHandler(MX,(v)=>$(v.params))}set ontoolinputpartial($){this.setNotificationHandler(SX,(v)=>$(v.params))}set ontoolresult($){this.setNotificationHandler(cX,(v)=>$(v.params))}set ontoolcancelled($){this.setNotificationHandler(NX,(v)=>$(v.params))}set onhostcontextchanged($){this.setNotificationHandler(iX,(v)=>{this._hostContext={...this._hostContext,...v.params},$(v.params)})}set onteardown($){this.setRequestHandler(RX,(v,g)=>$(v.params,g))}set oncalltool($){this.setRequestHandler(mg,(v,g)=>$(v.params,g))}set onlisttools($){this.setRequestHandler(Eg,(v,g)=>$(v.params,g))}assertCapabilityForMethod($){}assertRequestHandlerCapability($){switch($){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${$})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${$} registered`)}}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool($,v){if(typeof $==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${$}"). Did you mean: callServerTool({ name: "${$}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:$},c6,v)}async readServerResource($,v){return await this.request({method:"resources/read",params:$},fg,v)}async listServerResources($,v){return await this.request({method:"resources/list",params:$},Cg,v)}sendMessage($,v){return this.request({method:"ui/message",params:$},AX,v)}sendLog($){return this.notification({method:"notifications/message",params:$})}updateModelContext($,v){return this.request({method:"ui/update-model-context",params:$},T0,v)}openLink($,v){return this.request({method:"ui/open-link",params:$},FX,v)}sendOpenLink=this.openLink;downloadFile($,v){return this.request({method:"ui/download-file",params:$},wX,v)}requestTeardown($={}){return this.notification({method:"ui/notifications/request-teardown",params:$})}requestDisplayMode($,v){return this.request({method:"ui/request-display-mode",params:$},CX,v)}sendSizeChanged($){return this.notification({method:"ui/notifications/size-changed",params:$})}setupSizeChangedNotifications(){let $=!1,v=0,g=0,_=()=>{if($)return;$=!0,requestAnimationFrame(()=>{$=!1;let z=document.documentElement,J=z.style.width,G=z.style.height;z.style.width="fit-content",z.style.height="max-content";let K=z.getBoundingClientRect();z.style.width=J,z.style.height=G;let O=window.innerWidth-z.clientWidth,W=Math.ceil(K.width+O),B=Math.ceil(K.height);if(W!==v||B!==g)v=W,g=B,this.sendSizeChanged({width:W,height:B})})};_();let U=new ResizeObserver(_);return U.observe(document.documentElement),U.observe(document.body),()=>U.disconnect()}async connect($=new p0(window.parent,window.parent),v){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect($);try{let g=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:wb}},lX,v);if(g===void 0)throw Error(`Server sent invalid initialize result: ${g}`);if(this._hostCapabilities=g.hostCapabilities,this._hostInfo=g.hostInfo,this._hostContext=g.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(g){throw this.close(),g}}}function oW($){if(!$)return"";let v=[];if($.camera)v.push("camera");if($.microphone)v.push("microphone");if($.geolocation)v.push("geolocation");if($.clipboardWrite)v.push("clipboard-write");return v.join("; ")}var oX=[wb];class Qb extends ig{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor($,v,g,_){super(_);this._client=$,this._hostInfo=v,this._capabilities=g,this._hostContext=_?.hostContext||{},this.setRequestHandler(hX,(U)=>this._oninitialize(U)),this.setRequestHandler(m6,(U,z)=>{return this.onping?.(U.params,z),{}}),this.setRequestHandler(lW,(U)=>{return{mode:this._hostContext.displayMode??"inline"}})}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange($){this.setNotificationHandler(QX,(v)=>$(v.params))}set onsandboxready($){this.setNotificationHandler(ZX,(v)=>$(v.params))}set oninitialized($){this.setNotificationHandler(VX,(v)=>$(v.params))}set onmessage($){this.setRequestHandler(mX,async(v,g)=>{return $(v.params,g)})}set onopenlink($){this.setRequestHandler(XX,async(v,g)=>{return $(v.params,g)})}set ondownloadfile($){this.setRequestHandler(EX,async(v,g)=>{return $(v.params,g)})}set onrequestteardown($){this.setNotificationHandler(TX,(v)=>$(v.params))}set onrequestdisplaymode($){this.setRequestHandler(lW,async(v,g)=>{return $(v.params,g)})}set onloggingmessage($){this.setNotificationHandler(qb,async(v)=>{$(v.params)})}set onupdatemodelcontext($){this.setRequestHandler(xX,async(v,g)=>{return $(v.params,g)})}set oncalltool($){this.setRequestHandler(mg,async(v,g)=>{return $(v.params,g)})}sendToolListChanged($={}){return this.notification({method:"notifications/tools/list_changed",params:$})}set onlistresources($){this.setRequestHandler(_b,async(v,g)=>{return $(v.params,g)})}set onlistresourcetemplates($){this.setRequestHandler(zb,async(v,g)=>{return $(v.params,g)})}set onreadresource($){this.setRequestHandler(bb,async(v,g)=>{return $(v.params,g)})}sendResourceListChanged($={}){return this.notification({method:"notifications/resources/list_changed",params:$})}set onlistprompts($){this.setRequestHandler(Ob,async(v,g)=>{return $(v.params,g)})}sendPromptListChanged($={}){return this.notification({method:"notifications/prompts/list_changed",params:$})}assertCapabilityForMethod($){}assertRequestHandlerCapability($){}assertNotificationCapability($){}assertTaskCapability($){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability($){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize($){let v=$.params.protocolVersion;return this._appCapabilities=$.params.appCapabilities,this._appInfo=$.params.appInfo,{protocolVersion:oX.includes(v)?v:wb,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext($){let v={},g=!1;for(let _ of Object.keys($)){let U=this._hostContext[_],z=$[_];if(nX(U,z))continue;v[_]=z,g=!0}if(g)this._hostContext=$,this.sendHostContextChange(v)}sendHostContextChange($){return this.notification({method:"ui/notifications/host-context-changed",params:$})}sendToolInput($){return this.notification({method:"ui/notifications/tool-input",params:$})}sendToolInputPartial($){return this.notification({method:"ui/notifications/tool-input-partial",params:$})}sendToolResult($){return this.notification({method:"ui/notifications/tool-result",params:$})}sendToolCancelled($){return this.notification({method:"ui/notifications/tool-cancelled",params:$})}sendSandboxResourceReady($){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:$})}teardownResource($,v){return this.request({method:"ui/resource-teardown",params:$},uX,v)}sendResourceTeardown=this.teardownResource;async connect($){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._client){let v=this._client.getServerCapabilities();if(!v)throw Error("Client server capabilities not available");if(v.tools){if(this.oncalltool=async(g,_)=>{return this._client.request({method:"tools/call",params:g},c6,{signal:_.signal})},v.tools.listChanged)this._client.setNotificationHandler(Ib,(g)=>this.sendToolListChanged(g.params))}if(v.resources){if(this.onlistresources=async(g,_)=>{return this._client.request({method:"resources/list",params:g},Cg,{signal:_.signal})},this.onlistresourcetemplates=async(g,_)=>{return this._client.request({method:"resources/templates/list",params:g},Jb,{signal:_.signal})},this.onreadresource=async(g,_)=>{return this._client.request({method:"resources/read",params:g},fg,{signal:_.signal})},v.resources.listChanged)this._client.setNotificationHandler(Kb,(g)=>this.sendResourceListChanged(g.params))}if(v.prompts){if(this.onlistprompts=async(g,_)=>{return this._client.request({method:"prompts/list",params:g},Wb,{signal:_.signal})},v.prompts.listChanged)this._client.setNotificationHandler(Lb,(g)=>this.sendPromptListChanged(g.params))}}return super.connect($)}}function nX($,v){return JSON.stringify($)===JSON.stringify(v)}function Mb($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function tX($){return Mb($)&&Array.isArray($.content)&&$.content.every((v)=>Mb(v)&&typeof v.type==="string")}function dX(...$){for(let v of $)if(typeof v==="string"){if(v.trim().length>0)return v}return}function aX($){if(typeof $==="string")return $;if($===void 0)return;try{return JSON.stringify($)}catch(v){return console.debug("[ext-app-tool-result] stringify failed",v),String($)}}function Sb($){let v=$.success===!1;if(tX($.result))return{...$.result,isError:$.result.isError===!0||v};let g=Mb($.result)?$.result:null,_=dX($.detailedContent,$.content,g?.detailedContent,g?.content,g?.textResultForLlm,g?.text,g?.message,typeof $.result==="string"?$.result:void 0,$.error)??aX($.result);return{content:_?[{type:"text",text:_}]:[],isError:v}}function nW($,v){if($===v)return!0;if($.isError!==v.isError)return!1;try{let g=JSON.stringify($),_=JSON.stringify(v);if(g===void 0||_===void 0)return!1;if(Math.abs(g.length-_.length)>2000000)return!1;return g===_}catch{return!1}}function tW($,v){switch($){case"html":return typeof v.html==="string"&&v.html.length>0||typeof v.content==="string"&&v.content.length>0;case"json-render":case"graph":return!0;case"mcp-app":return v.viewerType==="web-artifact"&&typeof v.path==="string"&&v.path.length>0||typeof v.url==="string"&&v.url.length>0;case"webpage":return typeof v.url==="string"&&v.url.length>0;default:return!1}}var Nb="allow-scripts allow-popups allow-popups-to-escape-sandbox";var sX="/api/canvas/iframe-probe",eX=3000,W6=z$(null);function $F(){let $=new URLSearchParams(window.location.search).get("iframe-mode");return $==="srcdoc"||$==="src"?$:null}function vF($=eX){return new Promise((v)=>{let g=document.createElement("iframe");g.setAttribute("data-pmx-iframe-probe",""),g.style.cssText="position:fixed;width:1px;height:1px;left:-9999px;border:none",g.setAttribute("sandbox","allow-scripts");let _=(z)=>{window.clearTimeout(U),g.remove(),v(z)},U=window.setTimeout(()=>_(!1),$);g.addEventListener("load",()=>_(!0)),g.addEventListener("error",()=>_(!1)),g.src=sX,(document.body??document.documentElement).appendChild(g)})}var o0=null;function UF(){try{return window.self!==window.top}catch{return!0}}function dW($={}){if(W6.value)return Promise.resolve(W6.value);if(o0)return o0;let v=$F();if(v)return W6.value=v,Promise.resolve(v);if(!($.embedded??UF()))return W6.value="src",Promise.resolve("src");return o0=vF().then((g)=>{let _=g?"src":"srcdoc";return W6.value=_,_}),o0}function n0($){let v=5381;for(let g=0;g<$.length;g+=1)v=(v<<5)+v+$.charCodeAt(g)|0;return(v>>>0).toString(36)}function yb($,v={}){let g=new URLSearchParams;if(g.set("theme",v.theme??j$.value),v.themeToken)g.set("themeToken",v.themeToken);if(v.present)g.set("present","1");if(v.presentToken)g.set("presentToken",v.presentToken);if(v.v)g.set("v",v.v);if(v.axToken)g.set("axToken",v.axToken);if(v.frameToken)g.set("frameToken",v.frameToken);return`/api/canvas/surface/${encodeURIComponent($)}?${g.toString()}`}function t0($){return tW($.type,$.data)}async function d0($){let v=yb($.id);if(!(await sK($.id,v)).opened)window.open(v,"_blank","noopener")}function aW($){return Boolean($)&&typeof $==="object"&&$!==null&&!Array.isArray($)&&"ok"in $&&typeof $.ok==="boolean"}async function gF($,v){let g=await fetch("/api/canvas/frame-documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:$,sandbox:v})}),_=await g.json();if(!g.ok||!aW(_)||!_.ok||typeof _.url!=="string"){let U=aW(_)&&_.error?_.error:`Frame document request failed with HTTP ${g.status}`;throw Error(U)}return _.url}function sW($,v){let g=W6.value,[_,U]=h(null),[z,J]=h(0),G=R(0);E(()=>{if(U(null),!$||g!=="src")return;let O=!1;return G.current=EU.value,gF($,v).then((W)=>{if(!O)U(W)}).catch((W)=>{console.error("[iframe-document] failed to create frame document:",W)}),()=>{O=!0}},[$,v,g,z]);let K=EU.value;return E(()=>{if(g!=="src"||K===G.current)return;if(!_){J((W)=>W+1);return}let O=!1;return fetch(_,{method:"HEAD"}).then((W)=>{if(O)return;if(W.ok){G.current=K;return}J((B)=>B+1)}).catch(()=>{}),()=>{O=!0}},[K,_,g]),t$(()=>{if(g==="srcdoc"&&$)return{attributes:{srcdoc:$},ready:!0,key:`srcdoc-${n0($)}`};return{attributes:_?{src:_}:{},ready:Boolean(_),key:_??""}},[_,g,$])}function qU($){let{enabled:v,token:g,nodeId:_,sourceSurface:U,iframeRef:z}=$;E(()=>{if(!v||!g)return;function J(G){if(G.source!==z.current?.contentWindow)return;let K=G.data;if(!K||K.source!==e_||K.token!==g||K.nodeId!==_)return;let O=K.interaction;if(!O||typeof O.type!=="string")return;let W=O.type;D_({type:W,sourceNodeId:_,sourceSurface:U,...O.payload&&typeof O.payload==="object"?{payload:O.payload}:{}}).then((B)=>{if(B.ok)r4("context","AX interaction",W,[_]);else r4("remove","AX interaction rejected",B.error??B.code??"",[_]);z.current?.contentWindow?.postMessage({source:$1,token:g,...K.correlationId?{correlationId:K.correlationId}:{},interaction:{type:W},result:B},"*")})}return window.addEventListener("message",J),()=>window.removeEventListener("message",J)},[v,g,_,U])}async function P4($,v){let _=await(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})).json();if(!_.ok)throw Error(_.error??`Request failed: ${$}`);return _.result}function a0($){return/AppleWebKit/.test($)&&!/Chrome|Chromium|CriOS|Edg|Android/.test($)}var _B=1000,_F=7000;function x6($,v){if(typeof window>"u")return;let g=window;if(g.__PMX_EXTAPP_LOG??=[],g.__PMX_EXTAPP_LOG.length<500)g.__PMX_EXTAPP_LOG.push({t:Date.now(),nodeId:$,event:v});zF({t:Date.now(),nodeId:$,event:v})}var eW=[],Db=null;function zF($){if(eW.push({...$,...typeof document<"u"?{visibility:document.visibilityState}:{}}),Db)return;Db=setTimeout(()=>{Db=null;let v=eW.splice(0);if(v.length===0)return;fetch("/api/canvas/debug/ext-app-recovery",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entries:v})}).catch(()=>{})},1500)}var $B=Promise.resolve();function JF($){$B=$B.then(async()=>{if(!$.remount())return;await $.awaitBoot(),await new Promise((v)=>setTimeout(v,_B))}).catch(()=>{})}function GF($,v){return v?$==="done":$==="ready"||$==="done"}function bF($,v){let g=typeof $.data.html==="string"?$.data.html:"",_=typeof $.data.serverName==="string"?$.data.serverName:"",U=typeof $.data.appSessionId==="string"?$.data.appSessionId:"",z=typeof $.data.sessionStatus==="string"?$.data.sessionStatus:"";return`${$.id}:${v}:${_}:${U}:${z}:${g}`}function KF($,v){if($==="fullscreen")return{nextMode:"fullscreen",shouldExpand:!v,shouldCollapse:!1};if($==="inline")return{nextMode:"inline",shouldExpand:!1,shouldCollapse:v};return{nextMode:$,shouldExpand:!1,shouldCollapse:!1}}async function vB($,v,g){if(await $.sendToolInput({arguments:v}),g)await $.sendToolResult(g)}function OF($){return typeof $==="string"&&$.trim().length>0?$.trim():Nb}function WF($,v){return`<script data-pmx-canvas-ax-bridge>
185
185
  (function () {
186
186
  const PMX_AX_TOKEN = ${JSON.stringify($)};
187
187
  const PMX_AX_NODE_ID = ${JSON.stringify(v)};
@@ -199,7 +199,7 @@ container holding the app. Specify either width or maxWidth, and either height o
199
199
  }, 10000);
200
200
  pending.set(correlationId, function (result) { clearTimeout(timer); resolve(result); });
201
201
  window.parent.postMessage({
202
- source: '${d_}',
202
+ source: '${e_}',
203
203
  token: PMX_AX_TOKEN,
204
204
  nodeId: PMX_AX_NODE_ID,
205
205
  correlationId: correlationId,
@@ -212,7 +212,7 @@ container holding the app. Specify either width or maxWidth, and either height o
212
212
  };
213
213
  window.addEventListener('message', function (event) {
214
214
  const m = event.data;
215
- if (!m || m.source !== '${a_}' || m.token !== PMX_AX_TOKEN) return;
215
+ if (!m || m.source !== '${$1}' || m.token !== PMX_AX_TOKEN) return;
216
216
  const result = m.result || { ok: false };
217
217
  const resolver = m.correlationId ? pending.get(m.correlationId) : undefined;
218
218
  if (resolver) { pending.delete(m.correlationId); resolver(result); }
@@ -222,7 +222,7 @@ container holding the app. Specify either width or maxWidth, and either height o
222
222
  try { window.dispatchEvent(new CustomEvent('pmx-ax-ack', { detail: { result: result, interaction: m.interaction || null } })); } catch (e) {}
223
223
  });
224
224
  })();
225
- </script>`}function $w($,v){return`<script data-pmx-canvas-boot-beacon>
226
- window.parent.postMessage({ source: '${_z}', token: ${JSON.stringify($)}, nodeId: ${JSON.stringify(v)} }, '*');
227
- </script>`}function nW(){return"<style data-pmx-canvas-ext-app-base>html, body { background: transparent !important; }</style>"}function tW($,v){if(!v)return $;let g=/<head\b[^>]*>/i.exec($);if(g?.index!==void 0){let U=g.index+g[0].length;return`${$.slice(0,U)}${v}${$.slice(U)}`}let _=/<body\b[^>]*>/i.exec($);if(_?.index!==void 0){let U=_.index+_[0].length;return`${$.slice(0,U)}${v}${$.slice(U)}`}return`${v}${$}`}function LU($,v){if(Number.isFinite($)&&$>0)return Math.round($);if(Number.isFinite(v)&&v>0)return Math.round(v);return 1}function Z3($,v){let g=$?.getBoundingClientRect();return{width:LU($?.clientWidth??0,LU(g?.width??0,v.width)),height:LU($?.clientHeight??0,LU(g?.height??0,v.height))}}function vw($,v){return typeof $==="number"&&Number.isFinite($)&&$>0&&!v}function Uw($,v){return Math.max(LU($,1),LU(v,1))}function dW({node:$,expanded:v=!1}){let g=y(null),_=y(null),U=y(null),z=y(null),J=y({}),b=y(void 0),O=y(!1),K=y(void 0),W=y(null),B=y(!1),k=y(null),P=y(!1),X=y(0),Y=y(!1),H=y(!1),L=y([]),q=y(!1),F=y(!1),N=y(!1),[C,p]=o("loading"),[r,n]=o(null),[e,u]=o(0),S=$.data.html,U$=$.data.serverName,c=$.data.appSessionId,i=$.data.toolInput??{},H$=$.data.toolResult,q$=$.data.toolName??"ext-app",h$=$.data.toolDefinition,M=$.data.toolCallId,h=typeof M==="string"||typeof M==="number"?M:void 0,s=$.data.resourceMeta,d=$.data.sessionStatus,b$=$.data.sessionError,g$=$.size.height,l=$.id,f=dX($,e),a=H$!=null,G$=sX(null),V$=$.data.axCapabilities?.enabled===!0&&typeof S==="string"&&S.length>0,C$=n$(()=>`ax-${crypto.randomUUID()}`,[]),Kv=V$?eX(C$,l):"",Wv=typeof S==="string"&&S.length>0?$w(C$,l):"",k6=xW(tW(S??"",nW()+Wv+Kv),G$);m(()=>{function W$(r$){if(r$.source!==g.current?.contentWindow)return;let p$=r$.data;if(!p$||p$.source!==_z||p$.token!==C$||p$.nodeId!==l)return;H.current=!0}return window.addEventListener("message",W$),()=>window.removeEventListener("message",W$)},[C$,l]),YU({enabled:V$,token:C$,nodeId:l,sourceSurface:"mcp-app",iframeRef:g});let dg=3,H6=(W$)=>{if(X.current>=dg){B4(l,`remount-cap-hit (${W$})`);return}if(q.current)return;X.current+=1,q.current=!0,B4(l,`remount-queued #${X.current} (${W$})`),nX({remount:()=>{if(q.current=!1,N.current||j$.value===l)return B4(l,"remount-skipped"),!1;return F.current=typeof document<"u"&&document.visibilityState==="hidden",B4(l,`remount-run #${X.current}`),p("loading"),u((r$)=>r$+1),!0},awaitBoot:()=>new Promise((r$)=>{let p$=window.setTimeout(bv,pX);function bv(){window.clearTimeout(p$),r$()}L.current.push(bv)})})};m(()=>{if(v||P.current)return;if(!tX(C,a))return;if(typeof navigator>"u"||typeof window>"u")return;if(!F3(navigator.userAgent))return;P.current=!0,H6("post-boot-repaint")},[C,a]),m(()=>{if(v)return;if(typeof document>"u"||typeof navigator>"u"||typeof window>"u")return;if(!F3(navigator.userAgent))return;function W$(){if(document.visibilityState!=="visible")return;if(!F.current||N.current)return;F.current=!1,X.current=0,B4(l,"visible-again-rearm"),H6("visible-after-hidden-boot")}return document.addEventListener("visibilitychange",W$),()=>document.removeEventListener("visibilitychange",W$)},[v,l]);let ag=6000;m(()=>{if(v)return;if(typeof navigator>"u"||typeof window>"u")return;if(!F3(navigator.userAgent))return;if(!k6.ready)return;let W$=window.setTimeout(()=>{if(Y.current||H.current||N.current)return;H6("boot-watchdog")},ag);return()=>window.clearTimeout(W$)},[f,k6.ready,v]),m(()=>()=>{N.current=!0;for(let W$ of L.current.splice(0))W$()},[]);let sv=(W$)=>W$==="light"?"light":"dark",Av=v||j$.value===l;J.current=i,b.current=H$;let uU=d==="error"?b$??"Saved app session is unavailable. Reopen the app to restore interactivity.":"Reconnecting saved app session...",J2=(W$)=>{let r$=b.current;if(!W$||!B.current||!r$)return null;if(K.current===r$)return null;if(K.current&&EW(K.current,r$))return K.current=r$,null;if(W.current)return W.current;let p$=W$.sendToolResult(r$).then(()=>{K.current=r$,O.current=!0,p("done")}).catch((bv)=>{let I6=bv instanceof Error?bv.message:String(bv);throw n(`Tool result delivery failed: ${I6}`),bv}).finally(()=>{W.current=null});return W.current=p$,p$};if(m(()=>{if(!S||!k6.ready)return;let W$=g.current;if(!W$)return;let r$=!1,p$=null,bv=null,I6=null,t6=null;O.current=!1,K.current=void 0,W.current=null,B.current=!1,Y.current=!1,H.current=!1;let sg=()=>{if(!p$)return;clearTimeout(p$),p$=null};return(async()=>{if(!S)return;let Y6=W$.contentWindow;if(!Y6)throw Error("Ext-app iframe window is unavailable");let d6=(I$=j$.value===l?"fullscreen":"inline")=>({theme:sv(T$.value),platform:"web",containerDimensions:Z3(W$,{width:$.size.width,height:g$}),displayMode:I$,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,...h$?{toolInfo:{id:h,tool:h$}}:{}}),rP=()=>{if(I6!==null)return;I6=requestAnimationFrame(()=>{if(I6=null,r$||!B.current)return;u$.setHostContext?.(d6())})},n3=()=>{if(t6!==null)return;t6=requestAnimationFrame(()=>{t6=requestAnimationFrame(()=>{if(t6=null,r$||!B.current)return;u$.sendHostContextChange?.(d6())})})},u$=new L3(null,{name:"PMX Canvas",version:"1.0.0"},{openLinks:{},serverTools:{listChanged:!1},serverResources:{listChanged:!1},logging:{},updateModelContext:{text:{},structuredContent:{}}},{hostContext:d6(Av?"fullscreen":"inline")});u$.onsizechange=async({height:I$})=>{if(vw(I$,j$.value===l)){let Bv=Z3(W$.parentElement??W$,{width:$.size.width,height:g$}),cv=Uw(I$,Bv.height);W$.style.height=`${cv}px`;let a6=T.value.get(l)?.size??$.size,d3=Math.max(a6.height,cv+I5);if(Math.abs(d3-a6.height)>8){if(N4(l,{width:a6.width,height:d3}),z.current!==null)window.clearTimeout(z.current);z.current=window.setTimeout(()=>{t$({recordHistory:!1}),z.current=null},0)}}return{}},u$.onopenlink=async({url:I$})=>{return window.open(I$,"_blank","noopener"),{}},u$.onsandboxready=async()=>{await u$.sendSandboxResourceReady({html:tW(S,nW()),sandbox:w3,...s?.csp?{csp:s.csp}:{},...s?.permissions?{permissions:s.permissions}:{}})},u$.onrequestdisplaymode=async({mode:I$})=>{let{nextMode:Bv,shouldExpand:cv,shouldCollapse:a6}=aX(I$,Av);if(cv)z6(l);else if(a6)v4();return{mode:Bv}},u$.oncalltool=async(I$)=>{if(!c)throw Error(uU);try{let Bv=await W4("/api/ext-app/call-tool",{sessionId:c,nodeId:l,serverName:U$,toolName:I$.name,arguments:I$.arguments??{}});return n(null),Bv}catch(Bv){let cv=Bv instanceof Error?Bv.message:String(Bv);throw n(`Tool call failed: ${cv}`),Bv}},u$.setRequestHandler(Vg,async()=>{if(!c)return{tools:[]};return W4("/api/ext-app/list-tools",{sessionId:c})}),u$.onlistresources=async()=>c?W4("/api/ext-app/list-resources",{sessionId:c}):{resources:[]},u$.onlistresourcetemplates=async()=>c?W4("/api/ext-app/list-resource-templates",{sessionId:c}):{resourceTemplates:[]},u$.onreadresource=async(I$)=>{if(!c)throw Error(uU);return W4("/api/ext-app/read-resource",{sessionId:c,uri:I$.uri})},u$.onlistprompts=async()=>c?W4("/api/ext-app/list-prompts",{sessionId:c}):{prompts:[]},u$.onupdatemodelcontext=async(I$)=>{if(!c)return{};return await W4("/api/ext-app/model-context",{nodeId:l,...Array.isArray(I$.content)?{content:I$.content}:{},...I$.structuredContent&&typeof I$.structuredContent==="object"?{structuredContent:I$.structuredContent}:{}}),{}};let b2=new l0(Y6,Y6);if(u$.oninitialized=()=>{if(r$)return;sg(),B.current=!0,Y.current=!0,B4(l,"initialized"),p("ready"),n(null),Promise.resolve(u$.sendHostContextChange(d6(Av?"fullscreen":"inline"))).then(()=>oW(u$,J.current,void 0)).then(()=>J2(u$)).then(()=>{B4(l,"settled");for(let I$ of L.current.splice(0))I$();n3()}).catch((I$)=>{let Bv=I$ instanceof Error?I$.message:String(I$);n(`Bridge bootstrap failed: ${Bv}`)})},p$=setTimeout(()=>{if(r$||B.current)return;let I$=b.current,Bv=d6(Av?"fullscreen":"inline");B.current=!0,u$.setHostContext?.(Bv),Promise.resolve(u$.sendHostContextChange(Bv)).then(()=>oW(u$,J.current,I$)).then(()=>{if(O.current=Boolean(I$),I$)K.current=I$;p(I$?"done":"ready"),n(null),n3()}).catch((cv)=>{let a6=cv instanceof Error?cv.message:String(cv);n(`Bridge bootstrap fallback failed: ${a6}`)})},1200),await u$.connect(b2),r$){sg(),await b2.close();return}if(_.current=u$,U.current=b2,bv=new ResizeObserver(rP),bv.observe(W$),W$.parentElement)bv.observe(W$.parentElement);let t3=!0;k.current=T$.subscribe((I$)=>{if(t3){t3=!1;return}if(r$)return;u$.setHostContext?.({...d6(),theme:sv(I$)}),u$.sendHostContextChange?.(d6())}),J2(u$)})().catch((Y6)=>{sg(),console.error("[ext-app] Bridge init failed:",Y6),n(Y6?.message??"Bridge initialization failed")}),()=>{if(r$=!0,sg(),bv?.disconnect(),bv=null,I6!==null)cancelAnimationFrame(I6),I6=null;if(t6!==null)cancelAnimationFrame(t6),t6=null;if(B.current=!1,W.current=null,k.current?.(),k.current=null,z.current!==null)window.clearTimeout(z.current),z.current=null;if(_.current=null,U.current)U.current.close().catch((Y6)=>{console.error("[ext-app] transport close failed:",Y6)}),U.current=null}},[f,k6.key]),m(()=>{if(H$&&_.current&&(C==="ready"||C==="done"))J2(_.current)},[H$,C]),m(()=>{let W$=_.current;if(g.current)g.current.style.height="100%";if(!W$||!B.current)return;let r$=null,p$=null;return r$=requestAnimationFrame(()=>{r$=null,p$=requestAnimationFrame(()=>{if(p$=null,!B.current)return;let bv={theme:sv(T$.value),platform:"web",containerDimensions:Z3(g.current,{width:$.size.width,height:g$}),displayMode:Av?"fullscreen":"inline",locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone};W$.setHostContext?.(bv),W$.sendHostContextChange?.(bv)})}),()=>{if(r$!==null)cancelAnimationFrame(r$);if(p$!==null)cancelAnimationFrame(p$)}},[Av,g$]),!S)return G("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--c-muted)",fontSize:"13px",flexDirection:"column",gap:"8px"},children:[G("div",{style:{opacity:0.6},children:["Loading ",q$," viewer..."]},void 0,!0,void 0,this),G("div",{style:{width:"24px",height:"24px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),G("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{flex:1,width:"100%",height:"100%",minWidth:0,minHeight:0,display:"flex",flexDirection:"column"},children:[d&&d!=="ready"&&G("div",{style:{padding:"6px 10px",fontSize:"11px",background:d==="error"?"var(--c-danger-12)":"var(--c-warn-10)",color:d==="error"?"var(--c-danger)":"var(--c-warn)",borderBottom:`1px solid ${d==="error"?"var(--c-danger-12)":"var(--c-warn-15)"}`},children:uU},void 0,!1,void 0,this),r&&G("div",{style:{padding:"6px 10px",fontSize:"11px",background:"var(--c-danger-12)",color:"var(--c-danger)",borderBottom:"1px solid var(--c-danger-12)",display:"flex",alignItems:"center",gap:"6px"},children:[G("span",{children:"⚠"},void 0,!1,void 0,this),G("span",{style:{flex:1},children:r},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>{n(null),p("loading"),u((W$)=>W$+1)},style:{background:"var(--c-surface-hover)",border:"1px solid var(--c-danger-12)",borderRadius:"3px",color:"var(--c-danger)",cursor:"pointer",fontSize:"10px",padding:"1px 6px"},children:"Retry"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>n(null),style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,position:"relative",display:"flex",minHeight:0,height:"100%"},children:[G("iframe",{ref:g,...k6.attributes,sandbox:G$,allow:cW(s?.permissions),style:{flex:1,width:"100%",height:"100%",minHeight:0,border:"none",background:"var(--c-panel)",pointerEvents:Av&&C!=="loading"?"auto":"none"},title:`Ext App: ${q$}`},f,!1,void 0,this),C==="loading"&&!r&&G("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",background:"var(--c-panel)",color:"var(--c-muted)",fontSize:"12px",pointerEvents:"none"},children:[G("div",{style:{width:"22px",height:"22px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),G("div",{children:["Connecting to ",q$,"..."]},void 0,!0,void 0,this),G("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!Av&&G("button",{type:"button",onClick:(W$)=>{W$.stopPropagation(),z6(l)},class:"ext-app-preview-catcher",title:"Click to open",style:{position:"absolute",top:0,right:"56px",bottom:"56px",left:0,background:"transparent",border:"none",padding:0,margin:0,cursor:"zoom-in"},"aria-label":"Open full view to edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function x0($,v,g){let _=y($);_.current=$;let U=y(null);m(()=>{if(!g)return;function z(J){if(J.source!==v.current?.contentWindow)return;let b=J.data;if(!b||b.source!=="pmx-canvas-frame"||b.type!=="content-height"||b.token!==g)return;let O=_.current,K=typeof b.height==="number"?b.height:0,W=q5(O,K);if(W===null)return;if(N4(O.id,{width:O.size.width,height:W}),U.current!==null)window.clearTimeout(U.current);U.current=window.setTimeout(()=>{t$({recordHistory:!1}),U.current=null},300)}return window.addEventListener("message",z),()=>{if(window.removeEventListener("message",z),U.current!==null)window.clearTimeout(U.current),U.current=null}},[$.id,g])}function gw($,v,g,_,U,z,J){if(!$)return $;try{let b=new URL($,window.location.origin);if(b.searchParams.set("theme",T$.value==="light"?"light":"dark"),v)b.searchParams.set("display","expanded");if(typeof g==="number")b.searchParams.set("v",String(g));if(_)b.searchParams.set("axToken",_);if(U)b.searchParams.set("axNodeId",U);if(z)b.searchParams.set("frameToken",z);if(J)b.searchParams.set("fit","content");return b.toString()}catch{return $}}function _w($,v=window.location.origin){if(!$)return!1;try{let g=new URL(v).origin,_=new URL($,g);return _.origin===g&&_.pathname.startsWith("/api/canvas/frame-documents/")}catch{return!1}}function l6({node:$,expanded:v=!1}){if($.data.mode==="ext-app")return G(dW,{node:$,expanded:v},void 0,!1,void 0,this);return G(zw,{node:$,expanded:v},void 0,!1,void 0,this)}function zw({node:$,expanded:v}){let g=y(null),_=$.type==="mcp-app"&&$.data.viewerType==="web-artifact",U=$.type==="json-render"||$.type==="graph",z=$.data.axCapabilities?.enabled,b=(U||_)&&(_?z===!0:z!==!1),O=_?"mcp-app":"json-render",K=n$(()=>b?`ax-${crypto.randomUUID()}`:"",[b]),W=Jz($)&&!v,B=n$(()=>W?`frame-${crypto.randomUUID()}`:"",[W]);x0($,g,B),YU({enabled:b&&Boolean(K),token:K,nodeId:$.id,sourceSurface:O,iframeRef:g});let k=A6.value,P=()=>{if(!b||!K||k==null)return;g.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:K,state:k},"*")};m(P,[b,K,k]);let X=typeof $.data.specVersion==="number"?$.data.specVersion:void 0,Y=gw($.data.url||"",v,X,K||void 0,b?$.id:void 0,B||void 0,W),H=$.data.sourceServer||"",L=$.data.hostMode||"hosted",q=$.data.fallbackReason,F=$.data.trustedDomain===!0||_w(Y);if(L==="fallback")return G("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[G("div",{style:{color:"var(--c-warn)",display:"flex",alignItems:"center",gap:"6px"},children:[G("span",{children:"⚠"},void 0,!1,void 0,this),G("span",{children:"Cannot embed — opened externally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q&&G("div",{style:{color:"var(--c-muted)",fontSize:"11px"},children:["Reason: ",q]},void 0,!0,void 0,this),G("a",{href:Y,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all"},children:Y},void 0,!1,void 0,this),H&&G("div",{style:{color:"var(--c-dim)",fontSize:"10px"},children:["Source: ",H]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return G("div",{style:{height:"100%",display:"flex",flexDirection:"column",...v?{flex:1,minHeight:0,width:"100%"}:{}},children:[!F&&G("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-warn-10)",color:"var(--c-warn)",borderBottom:"1px solid var(--c-warn-15)"},children:"Unverified domain"},void 0,!1,void 0,this),G("iframe",{ref:g,src:Y,class:"mcp-app-frame",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",allow:"clipboard-read; clipboard-write",loading:"lazy",onLoad:P,style:{flex:1,minHeight:0,width:"100%"},title:`MCP App: ${H}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Eg=null;function d$($){return getComputedStyle(document.documentElement).getPropertyValue($).trim()}function h0(){if(Eg)return Eg;return Eg={bg:d$("--c-bg"),panel:d$("--c-panel"),panelSoft:d$("--c-panel-soft"),line:d$("--c-line"),text:d$("--c-text"),textSoft:d$("--c-text-soft"),muted:d$("--c-muted"),dim:d$("--c-dim"),accent:d$("--c-accent"),ok:d$("--c-ok"),warn:d$("--c-warn"),warnAlt:d$("--c-warn-alt"),danger:d$("--c-danger"),purple:d$("--c-purple"),thinking:d$("--c-thinking"),subagent:d$("--c-subagent"),font:d$("--font"),mono:d$("--mono")},Eg}function qU(){Eg=null}var p0={idle:"var(--c-muted)",running:"var(--c-accent)",planning:"var(--c-thinking)",thinking:"var(--c-thinking)",drafting:"var(--c-accent)",tooling:"var(--c-accent)",review:"var(--c-ok)","waiting-approval":"var(--c-warn)",waiting:"var(--c-warn-alt)"};function M3($){let v=typeof $.data.phase==="string"&&$.data.phase.trim().length>0?$.data.phase.trim():"";if(v)return v;let g=typeof $.data.content==="string"&&$.data.content.trim().length>0?$.data.content.trim():"";if(g)return g;return(typeof $.data.status==="string"&&$.data.status.trim().length>0?$.data.status.trim():"")||"idle"}function XU({node:$}){let v=M3($),g=$.data.detail||"",_=$.data.message||"",U=$.data.level||"ok",z=$.data.activeTool,J=$.data.subagent,b=p0[v]??"var(--c-muted)",O=v!=="idle";return G("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[G("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:b,boxShadow:O?`0 0 8px ${b}`:"none",animation:O?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),G("span",{style:{fontWeight:600,color:b,textTransform:"uppercase",letterSpacing:"0.05em"},children:v},void 0,!1,void 0,this),g&&G("span",{style:{color:"var(--c-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&G("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-warn)"},children:[G("span",{style:{fontSize:"10px"},children:"⚙"},void 0,!1,void 0,this),G("span",{style:{fontFamily:"var(--mono)",fontSize:"11px"},children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J&&J.state!=="completed"&&G("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-subagent)"},children:[G("span",{style:{fontSize:"10px"},children:"⠉"},void 0,!1,void 0,this),G("span",{children:J.name},void 0,!1,void 0,this),G("span",{style:{color:"var(--c-muted)",fontSize:"10px"},children:["(",J.state,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_&&G("div",{style:{color:U==="warn"?"var(--c-warn)":U==="error"?"var(--c-danger)":"var(--c-muted)",lineHeight:1.4},children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wU($){return typeof $==="string"&&$.trim().length>0?$.trim():null}function aW($){if(typeof $==="string"){let U=wU($);return U?{title:"Evidence warning",detail:U}:null}if(!$||typeof $!=="object")return null;let v=$,g=wU(v.title)??"Evidence warning",_=wU(v.detail);return _?{title:g,detail:_}:null}function Jw($){let v=[],g=aW($.data.warning);if(g)v.push(g);let _=$.data.warnings;if(Array.isArray(_))for(let z of _){let J=aW(z);if(J)v.push(J)}let U=wU($.data.validationStatus)?.toLowerCase();if(U==="failed"||U==="invalid")v.push({title:"Image failed validation",detail:wU($.data.validationMessage)??"Review this image before using it as evidence."});return v}function bw($){let v=[$.data.title,$.data.caption,$.data.alt,$.data.src,$.data.path].map((g)=>wU(g)?.toLowerCase()??"").join(" ");if(v.length===0)return!1;return["login","log in","sign in","signin","password","2fa","mfa","authenticate","authentication","sso"].some((g)=>v.includes(g))}function sW($){let v=Jw($);if(v.length>0)return v;if(bw($))return[{title:"Captured login page",detail:"This image looks like an auth screen. Treat it as environment context, not product evidence."}];return[]}function o0({node:$,expanded:v=!1}){let g=$.data.src||"",_=$.data.alt||$.data.title||"Image",U=$.data.caption||"",z=sW($),J=g.startsWith("data:")||g.startsWith("http://")||g.startsWith("https://")?g:`/api/canvas/image/${$.id}`,[b,O]=o(!1),[K,W]=o(!1),[B,k]=o(1),[P,X]=o({x:0,y:0}),[Y,H]=o({w:0,h:0}),L=y(null),q=y(!1),F=y({x:0,y:0}),N=Q((c)=>{let i=c.target;H({w:i.naturalWidth,h:i.naturalHeight}),O(!0),W(!1)},[]),C=Q(()=>{W(!0),O(!1)},[]);m(()=>{k(1),X({x:0,y:0})},[g]);let p=Q((c)=>{c.preventDefault(),c.stopPropagation();let i=c.deltaY>0?0.9:1.1;k((H$)=>Math.max(0.25,Math.min(10,H$*i)))},[]),r=Q((c)=>{if(B<=1)return;c.stopPropagation(),q.current=!0,F.current={x:c.clientX,y:c.clientY},c.target.setPointerCapture(c.pointerId)},[B]),n=Q((c)=>{if(!q.current)return;let i=c.clientX-F.current.x,H$=c.clientY-F.current.y;F.current={x:c.clientX,y:c.clientY},X((q$)=>({x:q$.x+i,y:q$.y+H$}))},[]),e=Q(()=>{q.current=!1},[]),u=Q(()=>{k(1),X({x:0,y:0})},[]);if(!g)return G("div",{class:"image-node-empty",children:[G("div",{class:"image-node-empty-icon",children:"\uD83D\uDDBC"},void 0,!1,void 0,this),G("div",{class:"image-node-empty-text",children:"No image source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let S=Y.w>0?`${Y.w}×${Y.h}`:"",U$=Math.round(B*100);return G("div",{class:`image-node ${v?"image-node-expanded":""}`,ref:L,children:[z.length>0&&G("div",{class:"image-node-warning-stack",children:z.map((c)=>G("div",{class:"image-node-warning",children:[G("span",{class:"image-node-warning-title",children:c.title},void 0,!1,void 0,this),G("span",{class:"image-node-warning-detail",children:c.detail},void 0,!1,void 0,this)]},`${c.title}-${c.detail}`,!0,void 0,this))},void 0,!1,void 0,this),G("div",{class:"image-node-viewport",onWheel:p,onPointerDown:r,onPointerMove:n,onPointerUp:e,style:{cursor:B>1?"grab":"default"},children:[!b&&!K&&G("div",{class:"image-node-loading",children:"Loading…"},void 0,!1,void 0,this),K&&G("div",{class:"image-node-error",children:[G("div",{class:"image-node-error-icon",children:"⚠"},void 0,!1,void 0,this),G("div",{children:"Failed to load image"},void 0,!1,void 0,this),G("div",{class:"image-node-error-path",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("img",{src:J,alt:_,onLoad:N,onError:C,draggable:!1,style:{transform:`translate(${P.x}px, ${P.y}px) scale(${B})`,opacity:b?1:0,display:K?"none":"block"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(U||S||B!==1)&&G("div",{class:"image-node-footer",children:[U&&G("span",{class:"image-node-caption",children:U},void 0,!1,void 0,this),G("span",{class:"image-node-meta",children:[S&&G("span",{children:S},void 0,!1,void 0,this),B!==1&&G("button",{type:"button",class:"image-node-zoom-reset",onClick:u,title:"Reset zoom",children:[U$,"% ↺"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function eW({node:$}){let v=$.data.children??[],g=T.value,_=v.filter((b)=>g.has(b)),U=_.length,z={};for(let b of _){let O=g.get(b);if(O)z[O.type]=(z[O.type]??0)+1}let J=Object.entries(z).map(([b,O])=>`${O} ${b}`).join(", ");return G("div",{class:"group-node-body",children:[G("div",{class:"group-summary",children:[G("span",{class:"group-child-count",children:[U," node",U!==1?"s":""]},void 0,!0,void 0,this),J&&G("span",{class:"group-type-summary",children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U===0&&G("div",{class:"group-empty-hint",children:"Drag nodes here or use the selection bar to group nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Gw($){try{return new URL($).host}catch{return $}}function Ow($){if(!$)return null;let v=new Date($);return Number.isNaN(v.getTime())?null:v.toLocaleString()}function n0({node:$,expanded:v=!1}){let g=typeof $.data.url==="string"?$.data.url:"",_=typeof $.data.pageTitle==="string"?$.data.pageTitle:"",U=typeof $.data.description==="string"?$.data.description:"",z=typeof $.data.excerpt==="string"?$.data.excerpt:typeof $.data.content==="string"?$.data.content:"",J=typeof $.data.status==="string"?$.data.status:"idle",b=typeof $.data.error==="string"?$.data.error:"",O=Ow(typeof $.data.fetchedAt==="string"?$.data.fetchedAt:void 0),K=typeof $.data.statusCode==="number"?$.data.statusCode:null,W=typeof $.data.imageUrl==="string"?$.data.imageUrl:"",B=$.data.frameBlocked===!0,k=typeof $.data.frameBlockedReason==="string"?$.data.frameBlockedReason:"",[P,X]=o(!1),[Y,H]=o(v);m(()=>{if(v)H(!0)},[v]);let L=Q(async()=>{if(!g||P)return;X(!0);try{await M_($.id)}finally{X(!1)}},[$.id,P,g]);if(!g)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No webpage URL set"},void 0,!1,void 0,this);let q=J==="ready"?"var(--c-ok)":J==="error"?"var(--c-danger)":"var(--c-warn)";return G("div",{style:{display:"flex",flexDirection:"column",gap:"12px",height:"100%"},children:[G("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[G("div",{style:{minWidth:0,flex:1},children:[G("div",{style:{fontSize:"12px",color:"var(--c-muted)"},children:Gw(g)},void 0,!1,void 0,this),G("div",{style:{fontSize:v?"18px":"15px",fontWeight:700,color:"var(--c-text)"},children:_||$.data.title||g},void 0,!1,void 0,this),G("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all",textDecoration:"none"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"999px",background:"rgba(255,255,255,0.04)",color:q,fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.04em",flexShrink:0},children:[G("span",{style:{width:"7px",height:"7px",borderRadius:"999px",background:q}},void 0,!1,void 0,this),J]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(U||W)&&G("div",{style:{display:"grid",gridTemplateColumns:W&&v?"160px 1fr":"1fr",gap:"12px",alignItems:"start"},children:[W&&v&&G("img",{src:W,alt:_||"Webpage preview image",style:{width:"160px",height:"96px",objectFit:"cover",borderRadius:"10px",border:"1px solid var(--c-line)",background:"var(--c-panel-soft)"}},void 0,!1,void 0,this),U&&G("p",{style:{margin:0,color:"var(--c-text-soft)",lineHeight:1.5,fontSize:v?"14px":"12px"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[G("button",{type:"button",onClick:L,disabled:P,style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:P?"progress":"pointer",fontSize:"12px"},children:P||J==="fetching"?"Refreshing…":"Refresh"},void 0,!1,void 0,this),v&&!B&&G("button",{type:"button",onClick:()=>H((F)=>!F),style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:Y?"Hide live preview":"Show live preview"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>window.open(g,"_blank","noopener"),style:{border:"1px solid var(--c-line)",background:"transparent",color:"var(--c-accent)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:"Open in browser"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&B&&G("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[G("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview unavailable. This site refuses embedding, so PMX Canvas cannot show it inline."},void 0,!1,void 0,this),G("div",{style:{padding:"20px",color:"var(--c-text-soft)",lineHeight:1.6,fontSize:"13px"},children:k||"The remote site blocks iframe embedding."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&Y&&!B&&G("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[G("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview (best effort). If this stays blank, the site likely blocks framing. The cached text snapshot below still works."},void 0,!1,void 0,this),G("iframe",{class:"webpage-node-iframe",title:_||$.data.title||g,src:g,loading:"lazy",referrerPolicy:"no-referrer",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts",style:{display:"block",width:"100%",height:v?"320px":"180px",border:"none",background:"#fff"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(O||K!==null)&&G("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",color:"var(--c-muted)",fontSize:"11px"},children:[O&&G("span",{children:["Fetched ",O]},void 0,!0,void 0,this),K!==null&&G("span",{children:["HTTP ",K]},void 0,!0,void 0,this),B&&G("span",{children:"Preview blocked by site"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&G("div",{style:{color:"var(--c-danger)",fontSize:"12px",lineHeight:1.5},children:b},void 0,!1,void 0,this),G("div",{style:{flex:1,minHeight:0,overflow:"auto",border:"1px solid var(--c-line)",borderRadius:"10px",background:"var(--c-panel-soft)",padding:v?"14px":"10px"},children:z?G("div",{style:{whiteSpace:"pre-wrap",lineHeight:1.55,color:"var(--c-text)",fontSize:v?"14px":"12px"},children:z},void 0,!1,void 0,this):G("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:J==="error"?"No cached page text available.":"Waiting for page text..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function $B($){let v=5381;for(let g=0;g<$.length;g+=1)v=(v<<5)+v+$.charCodeAt(g)|0;return(v>>>0).toString(36)}function Q3($,v={}){let g=new URLSearchParams;if(g.set("theme",v.theme??T$.value),v.themeToken)g.set("themeToken",v.themeToken);if(v.present)g.set("present","1");if(v.presentToken)g.set("presentToken",v.presentToken);if(v.v)g.set("v",v.v);if(v.axToken)g.set("axToken",v.axToken);if(v.frameToken)g.set("frameToken",v.frameToken);return`/api/canvas/surface/${encodeURIComponent($)}?${g.toString()}`}function t0($){return iW($.type,$.data)}async function d0($){let v=Q3($.id);if(!(await hO($.id,v)).opened)window.open(v,"_blank","noopener")}function vB($){return $.type==="html"&&$.data.presentation===!0}function ig({node:$,expanded:v=!1,presentation:g=!1,presentationExitToken:_,autoFocus:U=!1}){let z=y(null),J=T$.value,b=n$(()=>`theme-${crypto.randomUUID()}`,[]),O=n$(()=>`ax-${crypto.randomUUID()}`,[]),K=n$(()=>`frame-${crypto.randomUUID()}`,[]),W=typeof $.data.html==="string"?$.data.html:typeof $.data.content==="string"?$.data.content:"",B=n$(()=>$B(W),[W]),k=n$(()=>W?Q3($.id,{theme:J,themeToken:b,present:g,presentToken:_,v:B,axToken:O,frameToken:K}):"",[W,g,_,b,B,$.id,O,K]);x0($,z,v?"":K),YU({enabled:!0,token:O,nodeId:$.id,sourceSurface:"html-node",iframeRef:z}),m(()=>{if(z.current?.contentWindow?.postMessage({source:pv,type:"theme-update",token:b,theme:J},"*"),U)z.current?.focus()},[J,b]);let P=$.data.axCapabilities,X=P?.enabled===!0&&(!Array.isArray(P.allowed)||P.allowed.length>0),Y=A6.value;m(()=>{if(!X||Y==null)return;z.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:O,state:Y},"*")},[X,Y,O]),m(()=>{if(!U)return;let L=window.setTimeout(()=>z.current?.focus(),0);return()=>window.clearTimeout(L)},[U,k]);let H=()=>{if(z.current?.contentWindow?.postMessage({source:pv,type:"theme-update",token:b,theme:J},"*"),X&&A6.value!=null)z.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:O,state:A6.value},"*");if(U)z.current?.focus()};if(!W)return G("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No HTML content set"},void 0,!1,void 0,this);return G("iframe",{ref:z,class:g?"html-node-frame html-node-frame-presentation":"html-node-frame",title:typeof $.data.title==="string"?$.data.title:"HTML node",sandbox:"allow-scripts",src:k,tabIndex:U?0:void 0,onLoad:H,style:{width:"100%",height:"100%",minHeight:g?0:v?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:g?0:"6px",display:"block"}},void 0,!1,void 0,this)}var S3=null;async function UB(){if(!S3)S3=await EO();return S3}function gB($,v){if(!$)return null;let g=$.toLowerCase(),_=v.find((z)=>z.name.toLowerCase()===g);if(_)return _.name;let U=v.filter((z)=>z.name.toLowerCase().startsWith(g));return U.length===1?U[0].name:null}function Kw($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function Ww({html:$}){let v=y(null);return m(()=>{let g=v.current;if(!g)return;if(g.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,g.append(_.content.cloneNode(!0))},[$]),G("div",{ref:v},void 0,!1,void 0,this)}function Bw($,v){return`${$.role}:${$.status??"none"}:${v}:${$.text}`}function _B({count:$}){if($===0)return null;return G("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-accent)",background:"rgba(70,182,255,0.08)",borderRadius:"var(--radius-sm)",flexShrink:0},children:["✦"," ",$," context node",$!==1?"s":""," attached"]},void 0,!0,void 0,this)}function zB({message:$,onDismiss:v}){if(!$)return null;return G("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-danger)",background:"rgba(255,80,80,0.08)",borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[G("span",{style:{flex:1},children:$},void 0,!1,void 0,this),G("button",{type:"button",onClick:v,style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function a0({node:$,expanded:v=!1}){let g=Array.isArray($.data.turns)?$.data.turns:[],_=g.length===0,U=$.data.text||"",z=$.data.status||"draft",J=_?z:$.data.threadStatus||"draft",b=J==="draft",O=J==="pending"||J==="sending",K=J==="streaming",W=J==="answered",[B,k]=o(""),[P,X]=o(""),[Y,H]=o(null),[L,q]=o(new Map),F=y(null),N=y(null),C=g[g.length-1],p=`${g.length}:${C?.role??""}:${C?.status??""}:${Math.floor((C?.text?.length??0)/200)}`;m(()=>{if(v&&b&&F.current)F.current.focus()},[v,b]),m(()=>{if(!p)return;if(N.current)N.current.scrollTo({top:N.current.scrollHeight,behavior:"smooth"})},[p]);let r=y(null),n=y(g);n.current=g,m(()=>{let i=g.some((q$)=>q$.role==="assistant"&&q$.status==="streaming"),H$=()=>{let q$=!1,M=n.current.map((h,s)=>({turn:h,index:s})).filter(({turn:h})=>h.role==="assistant"&&h.text);if(M.length===0)return;return Promise.all(M.map(async({turn:h,index:s})=>{let d=await g6(h.text);return{index:s,html:Kw(d)}})).then((h)=>{if(q$)return;let s=new Map;for(let d of h)s.set(d.index,d.html);q(s)}),()=>{q$=!0}};if(!i){if(r.current)clearTimeout(r.current),r.current=null;return H$()}if(r.current)clearTimeout(r.current);return r.current=setTimeout(()=>{r.current=null,H$()},400),()=>{if(r.current)clearTimeout(r.current),r.current=null}},[g]);let e=Q(async()=>{let i=B.trim();if(!i)return;let H$=B;H(null),v$($.id,{turns:[{role:"user",text:i,status:"pending"}],threadStatus:"pending",text:i}),k("");let q$=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds:void 0;if(!(await jU(i,$.position,$.id,q$,$.id)).ok)v$($.id,{turns:[],threadStatus:"draft",text:"",status:"draft"}),k(H$),H("Failed to send prompt. Your draft has been restored.")},[B,$.id,$.position,$.data.contextNodeIds]),u=Q(async()=>{let i=P.trim();if(!i)return;let H$=P;H(null);let q$=Array.isArray($.data.turns)?[...$.data.turns]:[];if(q$.push({role:"user",text:i,status:"pending"}),v$($.id,{turns:q$,threadStatus:"pending"}),X(""),!(await iO($.id,i)).ok)q$.pop(),v$($.id,{turns:q$,threadStatus:"answered"}),X(H$),H("Failed to send reply. Your draft has been restored.")},[P,$.id,$.data.turns]),S=Q((i)=>{if(i.key==="Enter"&&(i.metaKey||i.ctrlKey)){i.preventDefault(),e();return}if(i.key==="Tab"&&B.startsWith("/")){i.preventDefault();let H$=B.slice(1).split(/\s/)[0];if(H$)UB().then((q$)=>{let h$=gB(H$,q$);if(h$)k(`/${h$}`)})}},[e,B]),U$=Q((i)=>{if(i.key==="Enter"&&(i.metaKey||i.ctrlKey)){i.preventDefault(),u();return}if(i.key==="Tab"&&P.startsWith("/")){i.preventDefault();let H$=P.slice(1).split(/\s/)[0];if(H$)UB().then((q$)=>{let h$=gB(H$,q$);if(h$)X(`/${h$}`)})}},[u,P]),c=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds.length:0;if(b&&g.length===0)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},children:[G(_B,{count:c},void 0,!1,void 0,this),G(zB,{message:Y,onDismiss:()=>H(null)},void 0,!1,void 0,this),G("textarea",{ref:F,value:B,onInput:(i)=>k(i.target.value),onKeyDown:S,placeholder:"Ask the agent something…",spellcheck:!1,style:{flex:1,resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"13px",lineHeight:"1.5",padding:"8px 10px",outline:"none"}},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter to send"]},void 0,!0,void 0,this),G("button",{type:"button",onClick:e,disabled:!B.trim(),style:{padding:"5px 14px",fontSize:"12px",fontWeight:600,background:B.trim()?"var(--c-accent)":"var(--c-line)",color:B.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:B.trim()?"pointer":"default"},children:"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(_)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[G("div",{style:{flex:1,padding:"2px 0",fontSize:"13px",lineHeight:"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto"},children:U},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px"},children:G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:O?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:O?"Sending…":W?"Answered":z},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[G(_B,{count:c},void 0,!1,void 0,this),G(zB,{message:Y,onDismiss:()=>H(null)},void 0,!1,void 0,this),G("div",{ref:N,style:{flex:1,overflow:"auto",minHeight:0},children:g.map((i,H$)=>G("div",{children:[H$>0&&G("div",{class:"thread-turn-divider"},void 0,!1,void 0,this),i.role==="user"?G("div",{class:"thread-turn-user",children:[G("div",{class:"thread-turn-role",children:[G("span",{class:"status-dot"},void 0,!1,void 0,this),"You"]},void 0,!0,void 0,this),G("div",{style:{fontSize:v?"15px":"13px",lineHeight:v?"1.7":"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i.text},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("div",{class:"thread-turn-assistant",children:[G("div",{class:"thread-turn-role",children:[G("span",{class:`status-dot${i.status==="streaming"?" pulsing":""}`},void 0,!1,void 0,this),"PMX"]},void 0,!0,void 0,this),i.status==="streaming"&&!i.text&&G("div",{style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-ok), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px"}},void 0,!1,void 0,this),G("div",{class:v?"md-reader-content":void 0,style:{fontSize:v?void 0:"13px",lineHeight:v?void 0:"1.55",opacity:i.text?1:0.4},children:L.get(H$)?G(a$,{children:[G(Ww,{html:L.get(H$)??""},void 0,!1,void 0,this),i.status==="streaming"&&G("span",{class:"streaming-cursor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G("div",{style:{color:"var(--c-muted)",fontStyle:"italic"},children:i.status==="streaming"?"Waiting for response…":i.text||"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},Bw(i,H$),!0,void 0,this))},void 0,!1,void 0,this),G("div",{style:{flexShrink:0,borderTop:"1px solid var(--c-line)",marginTop:"4px",paddingTop:"6px"},children:[G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:W?"6px":0},children:[G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:K?"var(--c-accent)":O?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:K?"Streaming…":O?"Sending…":W?"Answered":J},void 0,!1,void 0,this),G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:[g.length," turn",g.length!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W&&G("div",{class:"thread-reply-area",children:[G("textarea",{value:P,onInput:(i)=>X(i.target.value),onKeyDown:U$,placeholder:"Reply…",spellcheck:!1,rows:2,style:{width:"100%",resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"12px",lineHeight:"1.5",padding:"6px 8px",outline:"none"}},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"4px"},children:[G("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter"]},void 0,!0,void 0,this),G("button",{type:"button",onClick:u,disabled:!P.trim(),style:{padding:"3px 10px",fontSize:"11px",fontWeight:600,background:P.trim()?"var(--c-accent)":"var(--c-line)",color:P.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:P.trim()?"pointer":"default"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Pw($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function kw({html:$}){let v=y(null);return m(()=>{let g=v.current;if(!g)return;if(g.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,g.append(_.content.cloneNode(!0))},[$]),G("div",{ref:v},void 0,!1,void 0,this)}function s0({node:$,expanded:v=!1}){let g=$.data.content||"",_=$.data.status||"streaming",[U,z]=o(""),J=_==="streaming",b=_==="complete";m(()=>{if(!g){z("");return}let K=!1;return g6(g).then((W)=>{if(!K)z(Pw(W))}),()=>{K=!0}},[g]);let O=Q(()=>{jU("",{x:$.position.x,y:$.position.y+$.size.height+24},$.id)},[$]);return G("div",{class:"response-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[J&&G("div",{class:"response-streaming-bar",style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-accent), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px",flexShrink:0}},void 0,!1,void 0,this),G("div",{class:v?"md-reader":void 0,style:{flex:1,overflow:"auto",minHeight:0,opacity:g?1:0.4,transition:"opacity 0.2s ease"},children:U?G("div",{class:v?"md-reader-content":void 0,children:G(kw,{html:U},void 0,!1,void 0,this)},void 0,!1,void 0,this):G("div",{style:{color:"var(--c-muted)",fontStyle:"italic",fontSize:"13px"},children:J?"Waiting for response…":"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px",flexShrink:0},children:[G("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:J?"var(--c-accent)":b?"var(--c-ok)":"var(--c-muted)"},children:J?"Streaming…":b?"Complete":_},void 0,!1,void 0,this),b&&G("button",{type:"button",onClick:O,style:{padding:"3px 10px",fontSize:"11px",background:"rgba(70,182,255,0.1)",border:"1px solid rgba(70,182,255,0.3)",borderRadius:"var(--radius-sm)",color:"var(--c-accent)",cursor:"pointer"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function JB($){return{toolName:$.toolName||$.title||"unknown",category:$.category||"other",status:$.status||"running",duration:$.duration||"",resultSummary:$.resultSummary||$.content||"",error:$.error||""}}var bB={mcp:"var(--c-accent)",file:"var(--c-warn)",subagent:"var(--c-purple)",other:"var(--c-muted)"},Hw={running:"⠋",success:"✓",failed:"✕"},Iw={running:"var(--c-accent)",success:"var(--c-ok)",failed:"var(--c-danger)"};function e0({node:$}){let{toolName:v,category:g,status:_,duration:U,resultSummary:z,error:J}=JB($.data),b=bB[g]??bB.other,O=Hw[_]??"◌",K=Iw[_]??"var(--c-muted)",W=_==="running",B=J?J.slice(0,30):z.length>30?`${z.slice(0,28)}…`:z;return G("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 12px",height:"100%",overflow:"hidden"},children:[G("span",{style:{fontSize:"14px",color:K,flexShrink:0,animation:W?"pulse 1.5s infinite":"none"},children:O},void 0,!1,void 0,this),G("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[G("div",{style:{fontFamily:"var(--mono)",fontSize:"11px",fontWeight:600,color:b,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:v},void 0,!1,void 0,this),B&&G("div",{style:{fontSize:"10px",color:J?"var(--c-danger)":"var(--c-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3},children:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&G("span",{style:{fontSize:"9px",padding:"1px 5px",borderRadius:"3px",background:"rgba(255,255,255,0.06)",color:"var(--c-muted)",flexShrink:0,whiteSpace:"nowrap"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function r3($){let v=T.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function Yw($){let v=$.map((O)=>r3(O)).filter((O)=>O!==null);if(v.length===0)return null;let g=Math.min(...v.map((O)=>O.left)),_=Math.min(...v.map((O)=>O.top)),U=Math.max(...v.map((O)=>O.left+O.width)),z=Math.max(...v.map((O)=>O.top+O.height)),J=54,b=46;return{left:g-J,top:_-b,width:U-g+J*2,height:z-_+b*2}}function N3($,v){return{left:`${$.left}px`,top:`${$.top}px`,width:`${$.width}px`,height:`${$.height}px`,borderRadius:`${v}px`}}function GB(){let $=Array.from(w4.value),v=Array.from(F4.value),g=I_.value;if($.length===0&&v.length===0)return null;return G("div",{class:"attention-field-layer","aria-hidden":"true",children:[g.map((_)=>{let U=Yw(_.nodeIds);if(!U)return null;return G("div",{class:"attention-field-region",style:N3(U,42)},_.id,!1,void 0,this)}),v.map((_)=>{let U=r3(_);if(!U)return null;return G("div",{class:"attention-field-node attention-field-secondary",style:N3({left:U.left-18,top:U.top-18,width:U.width+36,height:U.height+36},28)},`secondary-${_}`,!1,void 0,this)}),$.map((_)=>{let U=r3(_);if(!U)return null;return G("div",{class:"attention-field-node attention-field-primary",style:N3({left:U.left-24,top:U.top-24,width:U.width+48,height:U.height+48},30)},`primary-${_}`,!1,void 0,this)})]},void 0,!0,void 0,this)}var Yv=O$(new Map),FU=O$(null),Lw=480,qw=320,lg=new Map,W6=null;function u3($){Yv.value=$,ww()}function y3($){let v=lg.get($);if(v)clearTimeout(v),lg.delete($)}function OB($){y3($.id);let v=new Map(Yv.value);v.set($.id,{...$,phase:"forming"}),u3(v)}function Xw($){if(y3($),!Yv.value.has($))return;let v=new Map(Yv.value);v.delete($),u3(v)}function KB($,v,g,_){let U=Yv.value.get($);if(!U||U.phase===v)return;let z=new Map(Yv.value);z.set($,{...U,phase:v,..._?{settledNodeId:_}:{}}),u3(z),y3($),lg.set($,setTimeout(()=>Xw($),g))}function WB($,v){KB($,"settling",Lw,v)}function D3($){KB($,"dissolving",qw)}function R3(){for(let $ of lg.values())clearTimeout($);if(lg.clear(),W6)clearInterval(W6),W6=null;FU.value=null,Yv.value=new Map}function ww(){if(W6||Yv.value.size===0)return;W6=setInterval(()=>{let $=Date.now();for(let v of Yv.value.values())if(v.phase==="forming"&&v.expiresAt<=$)D3(v.id);if(Yv.value.size===0&&W6)clearInterval(W6),W6=null},1000),W6.unref?.()}var Fw={fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"};function L$({size:$=16,children:v,...g}){return G("svg",{width:$,height:$,viewBox:"0 0 16 16",...Fw,...g,children:v},void 0,!1,void 0,this)}function kB($){return G(L$,{...$,children:[G("polyline",{points:"1 5 1 1 5 1"},void 0,!1,void 0,this),G("polyline",{points:"11 1 15 1 15 5"},void 0,!1,void 0,this),G("polyline",{points:"15 11 15 15 11 15"},void 0,!1,void 0,this),G("polyline",{points:"5 15 1 15 1 11"},void 0,!1,void 0,this),G("rect",{x:"4",y:"4",width:"8",height:"8",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function HB($){return G(L$,{...$,children:[G("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"4.5",x2:"8",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"9.5",x2:"8",y2:"11.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8",x2:"6.5",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"9.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IB($){return G(L$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),G("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this),G("line",{x1:"7",y1:"5",x2:"7",y2:"9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function YB($){return G(L$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),G("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function LB($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"1.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("rect",{x:"9.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"4",x2:"9.5",y2:"4"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"12",x2:"9.5",y2:"12"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6.5",x2:"4",y2:"9.5"},void 0,!1,void 0,this),G("line",{x1:"12",y1:"6.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qB($){return G(L$,{...$,children:[G("rect",{x:"1",y:"2",width:"14",height:"12",rx:"1.5"},void 0,!1,void 0,this),G("rect",{x:"8",y:"7",width:"6",height:"6",rx:"1",fill:"currentColor","fill-opacity":"0.2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function XB($){return G(L$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"1",x2:"8",y2:"3"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"13",x2:"8",y2:"15"},void 0,!1,void 0,this),G("line",{x1:"1",y1:"8",x2:"3",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"13",y1:"8",x2:"15",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"3.05",y1:"3.05",x2:"4.46",y2:"4.46"},void 0,!1,void 0,this),G("line",{x1:"11.54",y1:"11.54",x2:"12.95",y2:"12.95"},void 0,!1,void 0,this),G("line",{x1:"3.05",y1:"12.95",x2:"4.46",y2:"11.54"},void 0,!1,void 0,this),G("line",{x1:"11.54",y1:"4.46",x2:"12.95",y2:"3.05"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function wB($){return G(L$,{...$,children:G("path",{d:"M13 9.5A5.5 5.5 0 1 1 6.5 3 4.5 4.5 0 0 0 13 9.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function FB($){return G(L$,{...$,children:[G("path",{d:"M3 13l2.8-.7L13 5.1 10.9 3 3.7 10.2 3 13Z"},void 0,!1,void 0,this),G("path",{d:"M9.8 4.1l2.1 2.1"},void 0,!1,void 0,this),G("path",{d:"M2.5 14h11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AB($){return G(L$,{...$,children:[G("path",{d:"M3 10.5 8.5 5a2 2 0 0 1 2.8 0l1.7 1.7a2 2 0 0 1 0 2.8L8.5 14H5.8L3 11.2Z"},void 0,!1,void 0,this),G("path",{d:"M7.5 6 12 10.5"},void 0,!1,void 0,this),G("path",{d:"M8.5 14H14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZB($){return G(L$,{...$,children:[G("path",{d:"M3 4h10"},void 0,!1,void 0,this),G("path",{d:"M8 4v8"},void 0,!1,void 0,this),G("path",{d:"M6 12h4"},void 0,!1,void 0,this),G("path",{d:"M4.5 4 4 6"},void 0,!1,void 0,this),G("path",{d:"M11.5 4 12 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MB($){return G(L$,{...$,children:[G("rect",{x:"1",y:"4",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M5.5 4 L6.5 2.5 H9.5 L10.5 4"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"9",r:"2.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QB($){return G(L$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"0.8",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SB($){return G(L$,{...$,children:[G("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),G("line",{x1:"5.5",y1:"5.5",x2:"10.5",y2:"10.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"5.5",x2:"5.5",y2:"10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function NB($){return G(L$,{...$,children:[G("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),G("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rB($){return G(L$,{...$,children:[G("rect",{x:"1",y:"3",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6",x2:"5",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"7.5",y1:"6",x2:"8.5",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"11",y1:"6",x2:"12",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"10",x2:"12",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function uB({size:$=22,class:v}){return G("svg",{width:$,height:$,viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",class:v,"aria-hidden":"true",children:[G("rect",{x:"8",y:"8",width:"48",height:"48",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.35"},void 0,!1,void 0,this),G("rect",{x:"16",y:"16",width:"32",height:"32",rx:"5",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.6"},void 0,!1,void 0,this),G("rect",{x:"24",y:"24",width:"16",height:"16",rx:"3",fill:"none",stroke:"currentColor","stroke-width":"2.2"},void 0,!1,void 0,this),G("rect",{x:"29",y:"29",width:"6",height:"6",rx:"1",fill:"currentColor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function BB($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"6",x2:"10",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"8.5",x2:"8",y2:"8.5"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"11",x2:"11",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Aw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M4 13.5 L5.5 11.5 L8 11.5"},void 0,!1,void 0,this),G("polyline",{points:"5 6 7 8 5 10"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"10",x2:"11",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Zw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M12 13.5 L10.5 11.5 L8 11.5"},void 0,!1,void 0,this),G("circle",{cx:"5",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"11",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Mw($){return G(L$,{...$,children:[G("path",{d:"M3 1.5h6l3.5 3.5v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V2.5a1 1 0 0 1 1-1z"},void 0,!1,void 0,this),G("polyline",{points:"9 1.5 9 5 12.5 5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8.5",x2:"10.5",y2:"8.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"11",x2:"9",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Qw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"5.5",cy:"6.5",r:"1.2"},void 0,!1,void 0,this),G("path",{d:"M1.8 12 L6 8.5 L9 11 L11.5 9 L14.2 12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function PB($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"1.5",y1:"5.5",x2:"14.5",y2:"5.5"},void 0,!1,void 0,this),G("circle",{cx:"3.3",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"5",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"6.7",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"8",x2:"12",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"4",y1:"10",x2:"10",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Sw($){return G(L$,{...$,children:[G("rect",{x:"2",y:"4",width:"12",height:"10",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"2",y1:"6.5",x2:"14",y2:"6.5"},void 0,!1,void 0,this),G("path",{d:"M11 1.5 L11 4"},void 0,!1,void 0,this),G("circle",{cx:"11",cy:"4",r:"1.6",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Nw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"1.5","stroke-dasharray":"2 1.5"},void 0,!1,void 0,this),G("rect",{x:"4",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),G("rect",{x:"8.5",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),G("rect",{x:"6.25",y:"8.5",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function uw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M3.5 10.5 L6 6.5 L8.5 9.5 L12.5 5"},void 0,!1,void 0,this),G("circle",{cx:"12.5",cy:"5",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function yw($){return G(L$,{...$,children:[G("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"5.5",x2:"11.5",y2:"5.5"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"4.5",y1:"10.5",x2:"8",y2:"10.5"},void 0,!1,void 0,this),G("line",{x1:"6.5",y1:"2",x2:"6.5",y2:"14",opacity:"0.45"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Dw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"2"},void 0,!1,void 0,this),G("path",{d:"M4 11 L4 6 L6 8.5 L8 6 L8 11"},void 0,!1,void 0,this),G("path",{d:"M10 11 L10 6 L12.5 11 L12.5 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Rw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("polyline",{points:"10 5 13 5 13 8"},void 0,!1,void 0,this),G("line",{x1:"13",y1:"5",x2:"8",y2:"10"},void 0,!1,void 0,this),G("path",{d:"M6 6 L3.5 6 L3.5 11.5 L10 11.5 L10 9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Tw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("path",{d:"M7 5.5 C 5.5 5.5 5.5 8 4 8 C 5.5 8 5.5 10.5 7 10.5"},void 0,!1,void 0,this),G("path",{d:"M9 5.5 C 10.5 5.5 10.5 8 12 8 C 10.5 8 10.5 10.5 9 10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function jw($){return G(L$,{...$,children:[G("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),G("line",{x1:"5.2",y1:"6",x2:"8",y2:"8"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"8",x2:"10.8",y2:"6"},void 0,!1,void 0,this),G("line",{x1:"8",y1:"8",x2:"8",y2:"11"},void 0,!1,void 0,this),G("circle",{cx:"5.2",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"10.8",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),G("circle",{cx:"8",cy:"11",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function xg($){switch($){case"markdown":return BB;case"prompt":return Aw;case"response":return Zw;case"file":return Mw;case"image":return Qw;case"webpage":return PB;case"context":return Sw;case"group":return Nw;case"status":return rw;case"trace":return uw;case"ledger":return yw;case"mcp-app":return Dw;case"ext-app":return Rw;case"json-render":return Tw;case"graph":return jw;case"html":return PB;default:return BB}}var yB={width:260,height:150},Vw={markdown:{width:300,height:170},status:{width:280,height:110},context:{width:300,height:200},trace:{width:220,height:64},file:{width:300,height:190},image:{width:260,height:200},webpage:{width:320,height:210},html:{width:320,height:210},group:{width:340,height:210},graph:{width:320,height:210},"json-render":{width:320,height:210},"mcp-app":{width:340,height:230}};function j3($){return!!$&&$ in s$}function B6($){if(!$)return null;let v=T.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function T3($){return{x:$.left+$.width/2,y:$.top+$.height/2}}function hg($){if(typeof $.confidence!=="number")return 0.82;return 0.4+Math.max(0,Math.min(1,$.confidence))*0.55}function DB($,v){let g=Math.max(40,Math.abs(v.x-$.x)/2);return`M ${$.x} ${$.y} C ${$.x+g} ${$.y}, ${v.x-g} ${v.y}, ${v.x} ${v.y}`}function V3({intent:$}){let v=j3($.nodeType)?xg($.nodeType):null,g=$.label||$.kind,_=typeof $.confidence==="number"?`${Math.round($.confidence*100)}%`:null;return G("div",{class:"intent-info",onMouseEnter:()=>FU.value=$.id,onMouseLeave:()=>{if(FU.value===$.id)FU.value=null},children:[G("div",{class:"intent-chip",children:[typeof $.seq==="number"&&G("span",{class:"intent-seq",children:$.seq},void 0,!1,void 0,this),v&&G("span",{class:"intent-chip-icon","aria-hidden":"true",children:G(v,{size:12},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"intent-chip-label",children:g},void 0,!1,void 0,this),_&&G("span",{class:"intent-confidence",children:_},void 0,!1,void 0,this),$.phase==="forming"&&G("button",{type:"button",class:"intent-veto",title:"Veto this move (Esc)","aria-label":"Veto this move",onClick:(U)=>{U.stopPropagation(),S2($)},children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.reason&&G("div",{class:"intent-reason",children:$.reason},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function RB({intent:$,rect:v}){let g=j3($.nodeType)?xg($.nodeType):null,_=j3($.nodeType)?s$[$.nodeType]:"Node";return G("div",{class:`intent-ghost intent-ghost-box is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:hg($)},children:[G("div",{class:"intent-ghost-titlebar",children:[G("span",{class:"intent-ghost-icon","aria-hidden":"true",children:g?G(g,{size:13},void 0,!1,void 0,this):"◇"},void 0,!1,void 0,this),G("span",{class:"intent-ghost-badge",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(V3,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function TB({intent:$,rect:v,variant:g}){return G("div",{class:`intent-ghost intent-ghost-${g} is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:hg($)},children:[g==="edit"&&G("div",{class:"intent-edit-bar"},void 0,!1,void 0,this),G(V3,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Cw($){let v=$.phase==="settling"?B6($.settledNodeId):null;switch($.kind){case"create":{if(!$.position)return null;let g=$.nodeType&&Vw[$.nodeType]||yB,_=v??{left:$.position.x,top:$.position.y,...g};return G(RB,{intent:$,rect:_},$.id,!1,void 0,this)}case"move":{if(!$.position)return null;let _=B6($.nodeId)??yB,U=v??{left:$.position.x,top:$.position.y,width:_.width,height:_.height};return G(RB,{intent:$,rect:U},$.id,!1,void 0,this)}case"remove":{let g=v??B6($.nodeId);if(!g)return null;return G(TB,{intent:$,rect:g,variant:"remove"},$.id,!1,void 0,this)}case"edit":{let g=v??B6($.nodeId);if(!g)return null;return G(TB,{intent:$,rect:g,variant:"edit"},$.id,!1,void 0,this)}case"connect":{if(!$.edge)return null;let g=B6($.edge.from),_=B6($.edge.to);if(!g||!_)return null;let U={x:(g.left+g.width/2+_.left+_.width/2)/2,y:(g.top+g.height/2+_.top+_.height/2)/2},z={left:U.x-110,top:U.y-18,width:220,height:36};return G("div",{class:`intent-ghost intent-ghost-connect is-${$.phase}`,"data-intent-id":$.id,style:{left:`${z.left}px`,top:`${z.top}px`,width:`${z.width}px`,opacity:hg($)},children:G(V3,{intent:$},void 0,!1,void 0,this)},$.id,!1,void 0,this)}default:return null}}function jB(){let $=Array.from(Yv.value.values());if(m(()=>{function v(g){if(g.key!=="Escape")return;let _=FU.value;if(!_)return;let U=Yv.value.get(_);if(!U||U.phase!=="forming")return;g.stopImmediatePropagation(),g.preventDefault(),S2(U)}return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[]),$.length===0)return null;return G("div",{class:"intent-layer",children:[G("svg",{class:"intent-line-layer",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[G("defs",{children:G("marker",{id:"intent-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:G("path",{d:"M0,0 L6,3 L0,6 Z",class:"intent-arrow-head"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.map((v)=>{if(v.kind==="connect"&&v.edge){let g=B6(v.edge.from),_=B6(v.edge.to);if(!g||!_)return null;return G("path",{d:DB(T3(g),T3(_)),class:`intent-edge type-${v.edge.type}`,style:{opacity:hg(v)}},`line-${v.id}`,!1,void 0,this)}if(v.kind==="move"&&v.position){let g=B6(v.nodeId);if(!g)return null;let _=g,U={x:v.position.x+_.width/2,y:v.position.y+_.height/2};return G("path",{d:DB(T3(g),U),class:"intent-trail",markerEnd:"url(#intent-arrow)",style:{opacity:hg(v)}},`line-${v.id}`,!1,void 0,this)}return null})]},void 0,!0,void 0,this),$.map(Cw)]},void 0,!0,void 0,this)}var AU=8,P4=O$(null),ZU=[],MU=[],fB=null;function VB($){let v=$?.data.parentGroup;return typeof v==="string"&&v.length>0?v:null}function CB($){if(!$||!Array.isArray($.data.children))return[];return $.data.children.filter((v)=>typeof v==="string")}function fw($,v){let g=new Map(v.map((b)=>[b.id,b])),_=new Set([$]),U=g.get($);if(!U)return _;let z=VB(U);while(z&&!_.has(z))_.add(z),z=VB(g.get(z));if(U.type!=="group")return _;let J=[...CB(U)];while(J.length>0){let b=J.pop();if(!b||_.has(b))continue;_.add(b);let O=g.get(b);if(O?.type==="group")J.push(...CB(O))}return _}function mB($,v){ZU=[],MU=[],fB=$;let g=Array.from(v),_=fw($,g);for(let U of g){if(_.has(U.id)||U.dockPosition!==null)continue;let z=U.position.x,J=U.position.x+U.size.width,b=U.position.x+U.size.width/2,O=U.position.y,K=U.position.y+U.size.height,W=U.position.y+U.size.height/2;ZU.push({val:z,minY:O,maxY:K}),ZU.push({val:J,minY:O,maxY:K}),ZU.push({val:b,minY:O,maxY:K}),MU.push({val:O,minX:z,maxX:J}),MU.push({val:K,minX:z,maxX:J}),MU.push({val:W,minX:z,maxX:J})}}function cB(){ZU=[],MU=[],fB=null}function EB($,v,g,_){let U=[$,$+g/2,$+g],z=[v,v+_/2,v+_],J=[0,g/2,g],b=[0,_/2,_],O=null,K=AU+1,W=null;for(let Y=0;Y<3;Y++){let H=U[Y];for(let L of ZU){let q=Math.abs(H-L.val);if(q<K)K=q,O=L.val-J[Y],W={axis:"x",pos:L.val,from:Math.min(L.minY,v),to:Math.max(L.maxY,v+_)}}}let B=null,k=AU+1,P=null;for(let Y=0;Y<3;Y++){let H=z[Y];for(let L of MU){let q=Math.abs(H-L.val);if(q<k)k=q,B=L.val-b[Y],P={axis:"y",pos:L.val,from:Math.min(L.minX,$),to:Math.max(L.maxX,$+g)}}}let X=[];if(W&&K<=AU)X.push(W);if(P&&k<=AU)X.push(P);return{x:O!==null&&K<=AU?O:$,y:B!==null&&k<=AU?B:v,guides:X}}function iB({nodeId:$,viewport:v,onMove:g,onDragEnd:_}){let U=y(!1),z=y({x:0,y:0}),J=y({x:0,y:0});return Q((O,K,W)=>{O.stopPropagation(),O.preventDefault(),U.current=!0,document.documentElement.classList.add("is-node-dragging"),window.getSelection()?.removeAllRanges(),z.current={x:O.clientX,y:O.clientY},J.current={x:K,y:W};let B=null,k=null,P=()=>{if(k=null,!U.current||!B)return;let H=B;B=null;let L=v.value.scale,q=(H.x-z.current.x)/L,F=(H.y-z.current.y)/L;g($,J.current.x+q,J.current.y+F)},X=(H)=>{if(!U.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(P)},Y=()=>{if(k!==null)window.cancelAnimationFrame(k),P();U.current=!1,document.documentElement.classList.remove("is-node-dragging"),document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",Y),document.removeEventListener("pointercancel",Y),_()};document.addEventListener("pointermove",X),document.addEventListener("pointerup",Y),document.addEventListener("pointercancel",Y)},[$,v,g,_])}var mw=200,cw=100;function lB({nodeId:$,viewport:v,onResize:g,onResizeEnd:_}){let U=y(!1),z=y({x:0,y:0}),J=y({w:0,h:0});return Q((O,K,W)=>{O.stopPropagation(),O.preventDefault(),U.current=!0,z.current={x:O.clientX,y:O.clientY},J.current={w:K,h:W},document.documentElement.classList.add("is-node-resizing");let B=null,k=null,P=()=>{if(k=null,!U.current||!B)return;let H=B;B=null;let L=v.value.scale,q=(H.x-z.current.x)/L,F=(H.y-z.current.y)/L;g($,Math.max(mw,J.current.w+q),Math.max(cw,J.current.h+F))},X=(H)=>{if(!U.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(P)},Y=()=>{if(k!==null)window.cancelAnimationFrame(k),P();U.current=!1,document.documentElement.classList.remove("is-node-resizing"),document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",Y),document.removeEventListener("pointercancel",Y),_()};document.addEventListener("pointermove",X),document.addEventListener("pointerup",Y),document.addEventListener("pointercancel",Y)},[$,v,g,_])}function xB({node:$,children:v,onContextMenu:g}){let _=D$.value===$.id,U=i$.value.has($.id),z=R$.value.has($.id),J=w4.value.has($.id),b=!J&&F4.value.has($.id),O=Y_.value.has($.id),K=!_&&UK.value.has($.id),W=Z6.value,B=W!==null&&W.has($.id),k=W!==null&&!W.has($.id),[P,X]=o(!1),Y=y(null),H=Q((f,a,G$)=>{let K$=EB(a,G$,$.size.width,$.size.height),V$=T.value.get(f);if(V$?.position.x===K$.x&&V$.position.y===K$.y){P4.value=K$.guides.length>0?K$.guides:null;return}Pv(f,{position:{x:K$.x,y:K$.y}}),P4.value=K$.guides.length>0?K$.guides:null},[$.size.width,$.size.height]),L=Q(()=>{cB(),P4.value=null,t$()},[]),q=iB({nodeId:$.id,viewport:P$,onMove:H,onDragEnd:L}),F=Q((f,a,G$)=>{let K$=T.value.get(f);if(K$?.size.width===a&&K$.size.height===G$)return;Pv(f,{size:{width:a,height:G$}})},[]),N=Q(()=>{v$($.id,{userResized:!0}),Zv($.id,{data:{userResized:!0}}),t$()},[$.id]),C=lB({nodeId:$.id,viewport:P$,onResize:F,onResizeEnd:N}),p=Q((f)=>{if(P)return;M6($.id),mB($.id,T.value.values()),q(f,$.position.x,$.position.y)},[$.id,$.position.x,$.position.y,q,P]),r=Q((f)=>{if(f.stopPropagation(),f.shiftKey){gK($.id);return}M6($.id)},[$.id]),n=Q((f)=>{if(g)g(f,$.id)},[g,$.id]),e=Q((f)=>{f.stopPropagation(),X(!0),requestAnimationFrame(()=>Y.current?.focus())},[]),u=$.data.title||s$[$.type],S=Q((f)=>{let a=f.trim();if(a&&a!==u)v$($.id,{title:a}),Zv($.id,{title:a});X(!1)},[$.id,u]),U$=y(null),c=y(!1),i=y(null);m(()=>{if(c.current||!zz($))return;let f=U$.current;if(!f)return;let a=new ResizeObserver(()=>{if(c.current){a.disconnect();return}let G$=f.scrollHeight,K$=L5($,G$);if(K$===null)return;if(Math.abs(K$-$.size.height)>8){if(N4($.id,{width:$.size.width,height:K$}),i.current!==null)window.clearTimeout(i.current);i.current=window.setTimeout(()=>{t$({recordHistory:!1}),i.current=null},0)}c.current=!0,a.disconnect()});return a.observe(f),()=>{if(a.disconnect(),i.current!==null)window.clearTimeout(i.current),i.current=null}},[$.id,$.type,$.data.mode,$.data.strictSize,$.collapsed,$.dockPosition,$.size.width,$.size.height]);let H$=$.pinned,q$=$.type==="trace",h$=q$&&$.data.status==="running",M=$.type==="group",h=$.data.strictSize===!0,s=Math.max(P$.value.scale,0.01),d=s<1?Math.min(2.2,1/s):1,b$=M&&$.data.color?$.data.color:void 0,g$={left:`${$.position.x}px`,top:`${$.position.y}px`,width:`${$.size.width}px`,height:$.collapsed?"auto":`${$.size.height}px`,zIndex:$.zIndex,"--node-chrome-scale":d.toFixed(3),...b$?{"--group-color":b$}:{}},l=["canvas-node",_?"active":"",K?"neighbor":"",B?"search-match":"",k?"search-dimmed":"",U?"selected":"",z?"context-pinned":"",J?"attention-focus-primary":"",b?"attention-focus-secondary":"",O?"attention-pulse":"",H$?"pinned":"",q$?"trace-node":"",h$?"trace-running":"",M?"group-node":"",h?"strict-size":""].filter(Boolean).join(" ");return G("div",{class:l,style:g$,onPointerDown:r,onContextMenu:n,children:[G("div",{class:"node-titlebar",onPointerDown:p,children:[G("span",{class:"node-type-icon","aria-hidden":"true",children:(()=>{let f=xg($.type);return G(f,{size:Math.round(14*d)},void 0,!1,void 0,this)})()},void 0,!1,void 0,this),G("span",{class:"node-type-badge",children:s$[$.type]},void 0,!1,void 0,this),P?G("input",{ref:Y,class:"node-title-input",value:u,onBlur:(f)=>S(f.target.value),onKeyDown:(f)=>{if(f.key==="Enter")S(f.target.value);if(f.key==="Escape")X(!1)},onClick:(f)=>f.stopPropagation()},void 0,!1,void 0,this):G("span",{class:"node-title",onDblClick:e,title:"Double-click to rename",children:u},void 0,!1,void 0,this),G("div",{class:"node-controls",children:[H$&&G("span",{class:"pin-indicator",title:"Pinned",children:"⊙"},void 0,!1,void 0,this),G("button",{type:"button",class:`ctx-pin-btn${z?" ctx-pin-active":""}`,onClick:(f)=>{f.stopPropagation(),Q4($.id)},title:z?"Remove from context":"Add to context",children:"✦"},void 0,!1,void 0,this),t0($)&&G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),d0($)},title:"Open as site",children:"↗"},void 0,!1,void 0,this),F_.has($.type)&&G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),z6($.id)},title:"Expand (focus mode)",children:"⤢"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),Q6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),S4($.id),Q_($.id)},title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&G("div",{ref:U$,class:"node-body",children:v},void 0,!1,void 0,this),!$.collapsed&&G("div",{class:"node-resize-handle",onPointerDown:(f)=>C(f,$.size.width,$.size.height)},void 0,!1,void 0,this),["top","right","bottom","left"].map((f)=>G("div",{class:`node-port node-port-${f}`,onPointerDown:(a)=>{a.stopPropagation(),a.preventDefault();let G$=$.position.x+$.size.width/2,K$=$.position.y+$.size.height/2,V$=$.size.width/2,C$=$.size.height/2,Kv,Wv;switch(f){case"top":Kv=G$,Wv=K$-C$;break;case"bottom":Kv=G$,Wv=K$+C$;break;case"left":Kv=G$-V$,Wv=K$;break;case"right":Kv=G$+V$,Wv=K$;break}uv.value={fromId:$.id,fromX:Kv,fromY:Wv,cursorX:Kv,cursorY:Wv}}},f,!1,void 0,this))]},void 0,!0,void 0,this)}var Ew={relation:"var(--c-muted)","depends-on":"var(--c-warn)",flow:"var(--c-accent)",references:"var(--c-dim)"},iw=new Set(["depends-on","flow"]);function lw($){if($.style==="dashed")return"8 4";if($.style==="dotted")return"3 3";if($.type==="references"&&!$.style)return"8 4";return}function hB($,v){let g=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,U=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2,J=U-g,b=z-_,O=$.size.width/2,K=$.size.height/2,W=Math.abs(b/(J||0.001)),B=K/(O||0.001);if(W>B){let P=b>0?1:-1;return{x:g+K/W*(J>0?1:-1),y:_+K*P}}let k=J>0?1:-1;return{x:g+O*k,y:_+W*O*(b>0?1:-1)}}function xw($,v,g,_,U,z,J,b){return{x:0.125*$+0.375*g+0.375*U+0.125*J,y:0.125*v+0.375*_+0.375*z+0.125*b}}function hw({edge:$,fromNode:v,toNode:g,focused:_,dimmed:U}){let z=hB(v,g),J=hB(g,v),b=J.x-z.x,O=J.y-z.y,K=Math.sqrt(b*b+O*O),W=Math.min(K*0.25,80),B=b/(K||1),k=O/(K||1),P=z.x+B*W,X=z.y+k*W,Y=J.x-B*W,H=J.y-k*W,L=`M ${z.x} ${z.y} C ${P} ${X}, ${Y} ${H}, ${J.x} ${J.y}`,q=Ew[$.type],F=iw.has($.type),N=lw($),C=$.label?xw(z.x,z.y,P,X,Y,H,J.x,J.y):null,p=`edge-path-${$.id}`;return G("g",{children:[G("path",{d:L,fill:"none",stroke:"transparent","stroke-width":"12",style:{cursor:"pointer"}},void 0,!1,void 0,this),_&&G("path",{d:L,fill:"none",stroke:q,"stroke-width":"6","stroke-dasharray":N,opacity:"0.15",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),G("path",{id:p,d:L,fill:"none",stroke:q,"stroke-width":_?2.5:1.5,"stroke-dasharray":N,"marker-end":F?"url(#edge-arrow)":void 0,opacity:U?0.2:_?1:0.75,style:{transition:"opacity 0.2s, stroke-width 0.2s"}},void 0,!1,void 0,this),$.animated&&G("circle",{r:"3",fill:q,opacity:"0.9",children:G("animateMotion",{dur:"2s",repeatCount:"indefinite",children:G("mpath",{href:`#${p}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),C&&$.label&&G("g",{transform:`translate(${C.x}, ${C.y})`,children:[G("rect",{class:"edge-label-bg",x:-($.label.length*3.5+8),y:"-10",width:$.label.length*7+16,height:"20",rx:"4"},void 0,!1,void 0,this),G("text",{class:"edge-label","text-anchor":"middle","dominant-baseline":"central",fill:"var(--c-text)","font-size":"11",children:$.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function pB({nodes:$,edges:v}){let g=$.value,_=Array.from(v.value.values()),U=D$.value,z=U!==null,J=Z6.value,b=J!==null;if(_.length===0)return null;let O=96,K=Array.from(g.values()),W=Math.min(...K.map((H)=>H.position.x))-O,B=Math.min(...K.map((H)=>H.position.y))-O,k=Math.max(...K.map((H)=>H.position.x+H.size.width))+O,P=Math.max(...K.map((H)=>H.position.y+H.size.height))+O,X=Math.max(1,k-W),Y=Math.max(1,P-B);return G("svg",{"aria-label":"Canvas connections",role:"img",viewBox:`${W} ${B} ${X} ${Y}`,width:X,height:Y,style:{position:"absolute",top:`${B}px`,left:`${W}px`,pointerEvents:"none",overflow:"visible"},children:[G("title",{children:"Canvas connections"},void 0,!1,void 0,this),G("defs",{children:G("marker",{id:"edge-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:G("path",{d:"M 0 1 L 10 5 L 0 9 z",fill:"currentColor",opacity:"0.75"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),_.map((H)=>{let L=g.get(H.from),q=g.get(H.to);if(!L||!q)return null;let F=z&&(H.from===U||H.to===U),N=b&&!(J.has(H.from)||J.has(H.to));return G(hw,{edge:H,fromNode:L,toNode:q,focused:F,dimmed:z&&!F||N},H.id,!1,void 0,this)}),uv.value&&(()=>{let H=uv.value,L=H.cursorX-H.fromX,q=H.cursorY-H.fromY,F=Math.sqrt(L*L+q*q),N=Math.min(F*0.25,80),C=L/(F||1),p=q/(F||1),r=`M ${H.fromX} ${H.fromY} C ${H.fromX+C*N} ${H.fromY+p*N}, ${H.cursorX-C*N} ${H.cursorY-p*N}, ${H.cursorX} ${H.cursorY}`;return G("g",{children:[G("path",{d:r,fill:"none",stroke:"var(--c-accent)","stroke-width":"6",opacity:"0.1",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),G("path",{d:r,fill:"none",stroke:"var(--c-accent)","stroke-width":"2","stroke-dasharray":"6 4",opacity:"0.8"},void 0,!1,void 0,this),G("circle",{cx:H.cursorX,cy:H.cursorY,r:"5",fill:"var(--c-accent)",opacity:"0.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})()]},void 0,!0,void 0,this)}function pw($){let[v,...g]=$;if(!v)return"";return g.reduce((_,U)=>`${_} L ${U.x} ${U.y}`,`M ${v.x} ${v.y}`)}function C3({annotations:$}){if($.length===0)return null;return G("svg",{class:"annotation-layer","aria-hidden":"true",children:$.map((v)=>{let g=v.color==="currentColor"?"var(--c-annotation)":v.color;if(v.type==="text"){let _=v.points[0];if(!_||!v.text)return null;return G("text",{x:_.x,y:_.y,fill:g,"font-size":v.width,"font-family":"var(--font)","font-weight":"700",opacity:"0.95",children:v.text},v.id,!1,void 0,this)}return G("path",{d:pw(v.points),fill:"none",stroke:g,"stroke-width":v.width,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0.9"},v.id,!1,void 0,this)})},void 0,!1,void 0,this)}var ow=0.1,nw=4,oB=1;function nB($){return Math.min(nw,Math.max(ow,$))}function tB({viewport:$,onViewportChange:v,onViewportCommit:g,disabled:_=!1}){let U=y(null),z=y(!1),J=y({x:0,y:0}),b=y(0),O=y(null),K=Q((H)=>{if(O.current!==null)window.clearTimeout(O.current);O.current=window.setTimeout(()=>{O.current=null,g(H)},140)},[g]),W=Q((H)=>{if(_)return;H.preventDefault();let L=$.value;if(H.ctrlKey||H.metaKey){let q=U.current?.getBoundingClientRect();if(!q)return;let F=H.clientX-q.left,N=H.clientY-q.top,C=-H.deltaY*0.002,p=nB(L.scale*(1+C)),r=p/L.scale,n={x:F-r*(F-L.x),y:N-r*(N-L.y),scale:p};v(n),K(n)}else{let q={x:L.x-H.deltaX*oB,y:L.y-H.deltaY*oB,scale:L.scale};v(q),K(q)}},[_,$,v,K]),B=Q((H)=>{if(_)return;let L=U.current;if(!L||H.target!==L)return;z.current=!0,J.current={x:H.clientX,y:H.clientY},L.setPointerCapture(H.pointerId)},[_]),k=Q((H)=>{if(!z.current)return;if(_)return;let L=H.clientX-J.current.x,q=H.clientY-J.current.y;J.current={x:H.clientX,y:H.clientY};let F=$.value;v({x:F.x+L,y:F.y+q,scale:F.scale})},[_,$,v]),P=Q(()=>{if(z.current)g($.value);z.current=!1},[g,$]),X=Q((H)=>{if(_)return;if(H.touches.length!==2){b.current=0;return}H.preventDefault();let L=H.touches[0],q=H.touches[1],F=Math.hypot(q.clientX-L.clientX,q.clientY-L.clientY),N=(L.clientX+q.clientX)/2,C=(L.clientY+q.clientY)/2;if(b.current>0){let p=$.value,r=U.current?.getBoundingClientRect();if(!r)return;let n=N-r.left,e=C-r.top,u=F/b.current,S=nB(p.scale*u),U$=S/p.scale,c={x:n-U$*(n-p.x),y:e-U$*(e-p.y),scale:S};v(c),K(c)}b.current=F},[_,$,v,K]),Y=Q(()=>{if(O.current!==null)window.clearTimeout(O.current),O.current=null;g($.value),b.current=0},[g,$]);return m(()=>{let H=U.current;if(!H)return;return H.addEventListener("wheel",W,{passive:!1}),H.addEventListener("pointerdown",B),H.addEventListener("pointermove",k),H.addEventListener("pointerup",P),H.addEventListener("pointercancel",P),H.addEventListener("touchmove",X,{passive:!1}),H.addEventListener("touchend",Y),()=>{if(O.current!==null)window.clearTimeout(O.current);H.removeEventListener("wheel",W),H.removeEventListener("pointerdown",B),H.removeEventListener("pointermove",k),H.removeEventListener("pointerup",P),H.removeEventListener("pointercancel",P),H.removeEventListener("touchmove",X),H.removeEventListener("touchend",Y)}},[W,B,k,P,X,Y]),U}function tw($){switch($.type){case"markdown":return G(t_,{node:$},void 0,!1,void 0,this);case"mcp-app":return G(l6,{node:$},void 0,!1,void 0,this);case"webpage":return G(n0,{node:$},void 0,!1,void 0,this);case"json-render":return G(l6,{node:$},void 0,!1,void 0,this);case"graph":return G(l6,{node:$},void 0,!1,void 0,this);case"prompt":return G(a0,{node:$},void 0,!1,void 0,this);case"response":return G(s0,{node:$},void 0,!1,void 0,this);case"status":return G(XU,{node:$},void 0,!1,void 0,this);case"context":return G(U4,{node:$},void 0,!1,void 0,this);case"ledger":return G(T4,{node:$},void 0,!1,void 0,this);case"trace":return G(e0,{node:$},void 0,!1,void 0,this);case"file":return G(l_,{node:$},void 0,!1,void 0,this);case"image":return G(o0,{node:$},void 0,!1,void 0,this);case"html":return G(ig,{node:$},void 0,!1,void 0,this);case"group":return G(eW,{node:$},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function dw($,v,g){let _=g.x-v.x,U=g.y-v.y,z=_*_+U*U;if(z===0)return Math.hypot($.x-v.x,$.y-v.y);let J=Math.max(0,Math.min(1,(($.x-v.x)*_+($.y-v.y)*U)/z));return Math.hypot($.x-(v.x+J*_),$.y-(v.y+J*U))}function aw($,v,g){for(let _=$.length-1;_>=0;_--){let U=$[_];if(!U)continue;let z=g+U.width;if(v.x<U.bounds.x-z||v.x>U.bounds.x+U.bounds.width+z||v.y<U.bounds.y-z||v.y>U.bounds.y+U.bounds.height+z)continue;if(U.type==="text")return U;for(let J=1;J<U.points.length;J++){let b=U.points[J-1],O=U.points[J];if(b&&O&&dw(v,b,O)<=g+U.width/2)return U}}return null}var f3="currentColor",dB=4,aB=24,sw=14,ew=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]),$F=new Set(["md","mdx","markdown"]),sB={width:520,height:420};function vF($){let v=$.trim();if(!v||/\s/.test(v))return null;let g=/^[a-z][a-z0-9+.-]*:/i.test(v)?v:`https://${v}`;try{let _=new URL(g);if(_.protocol!=="http:"&&_.protocol!=="https:")return null;return _.toString()}catch{return null}}function m3($){let v=$.trim();if(!v)return[];let g=v.includes(`
228
- `)?v.split(/\r?\n/):v.split(/\s+/),_=new Set,U=[];for(let z of g){let J=z.trim();if(!J||J.startsWith("#"))continue;let b=vF(J);if(!b||_.has(b))continue;_.add(b),U.push(b)}return U}function UF($){let v=m3($.getData("text/uri-list"));if(v.length>0)return v;return m3($.getData("text/plain"))}function gF($){if(!$)return!1;return $.types.includes("text/uri-list")||$.types.includes("text/plain")}function eB($){if(!($ instanceof HTMLElement))return!1;return Boolean($.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]'))}function _F($){let v=$.split(".").pop()?.toLowerCase()??"";if(ew.has(v))return"image";if($F.has(v))return"markdown";return"file"}function zF($,v){let g=[],_=0;for(let U of $){if(U.dockPosition!==null)continue;if(v&&U.id===v)continue;if(U.type==="group")g.splice(_++,0,U);else g.push(U)}return g}function $P({onNodeContextMenu:$,onCanvasContextMenu:v,annotationMode:g=!1,annotationTool:_=null}){let U=P$.value,z=y(!1),J=y(!1),b=y([]),[O,K]=o(null),[W,B]=o(null),[k,P]=o(null),X=y(null),[Y,H]=o(!1),L=y(0),q=y(null),F=tB({viewport:P$,disabled:g,onViewportChange:(M)=>{if(z.current||g)return;u4(),BK(M)},onViewportCommit:(M)=>{if(z.current||g)return;u4(),kK(M)}}),N=Q((M)=>{X.current=M,P(M)},[]),C=Q(async(M,h,s)=>{if(M.length===0)return;let{width:d,height:b$}=sB,g$=24,l=Math.ceil(Math.sqrt(M.length)),f=Math.ceil(M.length/l),a=l*d+Math.max(0,l-1)*g$,G$=f*b$+Math.max(0,f-1)*g$;for(let K$=0;K$<M.length;K$++){let V$=K$%l,C$=Math.floor(K$/l),Kv=h-a/2+V$*(d+g$),Wv=s-G$/2+C$*(b$+g$);await Ev({type:"webpage",content:M[K$],x:Kv,y:Wv,width:d,height:b$})}},[]),p=Q((M)=>{let h=F.current;if(!h)return;if(_==="eraser"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation();let f=h.getBoundingClientRect(),a=P$.value,G$={x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale},K$=aw(Array.from(M4.value.values()),G$,sw/a.scale);if(K$)KK(K$.id);return}if(_==="text"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation(),D$.value=null,jv();let f=h.getBoundingClientRect(),a=P$.value;N({x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale,value:""});return}if(_==="pen"){if((M.target instanceof Element?M.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;M.preventDefault(),M.stopPropagation(),D$.value=null,jv(),J.current=!0;let f=h.getBoundingClientRect(),a=P$.value,G$={x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale};b.current=[G$],B({id:"draft-annotation",type:"freehand",points:[G$],bounds:{x:0,y:0,width:0,height:0},color:f3,width:dB,createdAt:""}),h.setPointerCapture(M.pointerId);return}if(M.target!==h)return;if(!M.shiftKey){if(!q.current)D$.value=null,jv();return}M.preventDefault(),M.stopPropagation(),z.current=!0;let s=h.getBoundingClientRect(),d=M.clientX-s.left,b$=M.clientY-s.top,g$={startX:d,startY:b$,currentX:d,currentY:b$};q.current=g$,K(g$),h.setPointerCapture(M.pointerId)},[_,F]),r=Q((M)=>{if(J.current){let d=F.current;if(!d)return;let b$=d.getBoundingClientRect(),g$=P$.value,l={x:(M.clientX-b$.left-g$.x)/g$.scale,y:(M.clientY-b$.top-g$.y)/g$.scale},f=b.current.at(-1);if(f&&Math.hypot(l.x-f.x,l.y-f.y)<2)return;b.current=[...b.current,l],B((a)=>a?{...a,points:b.current}:null);return}if(!z.current||!q.current)return;let h=F.current?.getBoundingClientRect();if(!h)return;let s={...q.current,currentX:M.clientX-h.left,currentY:M.clientY-h.top};q.current=s,K(s)},[F]),n=Q((M)=>{if(J.current){J.current=!1;let l=b.current;if(b.current=[],B(null),l.length>=2)u2({points:l,color:f3,width:dB});let f=F.current;if(f?.hasPointerCapture(M.pointerId))f.releasePointerCapture(M.pointerId);return}let h=q.current;if(!z.current||!h)return;z.current=!1,q.current=null;let s=Math.min(h.startX,h.currentX),d=Math.max(h.startX,h.currentX),b$=Math.min(h.startY,h.currentY),g$=Math.max(h.startY,h.currentY);if(d-s>5||g$-b$>5){let l=P$.value,f=(s-l.x)/l.scale,a=(d-l.x)/l.scale,G$=(b$-l.y)/l.scale,K$=(g$-l.y)/l.scale,V$=[];for(let C$ of T.value.values()){if(C$.dockPosition!==null)continue;let Kv=C$.position.x,Wv=C$.position.y;if(Kv+C$.size.width>f&&Kv<a&&Wv+C$.size.height>G$&&Wv<K$)V$.push(C$.id)}if(V$.length>0)_K(V$)}K(null)},[]);m(()=>{if(g)return;if(!J.current&&!W&&!k)return;J.current=!1,b.current=[],B(null),N(null)},[g,W,N,k]);let e=Q(()=>{let M=X.current;if(!M)return;let h=M.value.trim();if(N(null),!h)return;let s={x:M.x,y:M.y};u2({type:"text",points:[s],color:f3,width:aB,text:h})},[N]);m(()=>{if(_!=="text"&&k)N(null)},[_,N,k]),m(()=>{function M(s){if(!uv.value)return;let d=F.current;if(!d)return;let b$=d.getBoundingClientRect(),g$=P$.value;uv.value={...uv.value,cursorX:(s.clientX-b$.left-g$.x)/g$.scale,cursorY:(s.clientY-b$.top-g$.y)/g$.scale}}function h(s){let d=uv.value;if(!d)return;uv.value=null;let b$=F.current;if(!b$)return;let g$=b$.getBoundingClientRect(),l=P$.value,f=(s.clientX-g$.left-l.x)/l.scale,a=(s.clientY-g$.top-l.y)/l.scale;for(let G$ of T.value.values()){if(G$.id===d.fromId||G$.dockPosition!==null)continue;if(f>=G$.position.x&&f<=G$.position.x+G$.size.width&&a>=G$.position.y&&a<=G$.position.y+G$.size.height){A4(d.fromId,G$.id,"relation");return}}}return document.addEventListener("pointermove",M),document.addEventListener("pointerup",h),()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",h)}},[F]);let u=Q((M)=>{if(g)return;let h=F.current;if(!h||M.target!==h)return;let s=h.getBoundingClientRect(),d=P$.value,b$=(M.clientX-s.left-d.x)/d.scale,g$=(M.clientY-s.top-d.y)/d.scale,l=520,f=360;Ev({type:"markdown",title:"New note",x:b$-l/2,y:g$-f/2,width:l,height:f})},[g,F]),S=Q((M)=>{if(g)return;if(!v)return;let h=F.current;if(!h)return;if((M.target instanceof Element?M.target:null)?.closest(".canvas-node"))return;let d=h.getBoundingClientRect(),b$=P$.value,g$=(M.clientX-d.left-b$.x)/b$.scale,l=(M.clientY-d.top-b$.y)/b$.scale;v(M,g$,l)},[g,F,v]),U$=Q((M)=>{if(M.preventDefault(),L.current++,M.dataTransfer?.types.includes("Files")||gF(M.dataTransfer))H(!0)},[]),c=Q((M)=>{if(M.preventDefault(),M.dataTransfer)M.dataTransfer.dropEffect="copy"},[]),i=Q((M)=>{if(M.preventDefault(),L.current--,L.current<=0)L.current=0,H(!1)},[]),H$=Q(async(M)=>{M.preventDefault(),H(!1),L.current=0;let h=F.current;if(!h||!M.dataTransfer)return;let s=h.getBoundingClientRect(),d=P$.value,b$=(M.clientX-s.left-d.x)/d.scale,g$=(M.clientY-s.top-d.y)/d.scale,l=Array.from(M.dataTransfer.files);if(l.length===0){let V$=UF(M.dataTransfer);await C(V$,b$,g$);return}let f=400,a=300,G$=20,K$=Math.ceil(Math.sqrt(l.length));for(let V$=0;V$<l.length;V$++){let C$=l[V$],Kv=V$%K$,Wv=Math.floor(V$/K$),k6=b$-K$*(f+G$)/2+Kv*(f+G$),dg=g$-a/2+Wv*(a+G$),H6=_F(C$.name),ag=C$.name;if(H6==="image"){let sv=new FileReader,Av=await new Promise((uU)=>{sv.onload=()=>uU(sv.result),sv.readAsDataURL(C$)});await Ev({type:"image",title:ag,content:Av,x:k6,y:dg,width:f,height:a})}else{let sv=await C$.text(),Av=H6==="markdown"||H6==="file";await Ev({type:H6,title:ag,content:sv,x:k6,y:dg,width:Av?720:f,height:Av?500:a})}}},[F,C]);m(()=>{let M=async(h)=>{if(h.defaultPrevented)return;if(eB(h.target instanceof Element?h.target:null))return;if(eB(document.activeElement))return;let s=h.clipboardData?.getData("text/plain")??"",d=m3(s);if(d.length===0)return;let b$=F.current;if(!b$)return;h.preventDefault();let g$=b$.getBoundingClientRect(),l=P$.value,f=(g$.width/2-l.x)/l.scale,a=(g$.height/2-l.y)/l.scale;await C(d,f,a)};return document.addEventListener("paste",M),()=>{document.removeEventListener("paste",M)}},[F,C]);let q$=zF(T.value.values(),j$.value),h$=null;if(O){let M=Math.min(O.startX,O.currentX),h=Math.min(O.startY,O.currentY),s=Math.abs(O.currentX-O.startX),d=Math.abs(O.currentY-O.startY);h$={position:"absolute",left:`${M}px`,top:`${h}px`,width:`${s}px`,height:`${d}px`,pointerEvents:"none"}}return G("div",{class:"canvas-viewport",ref:F,tabIndex:0,onPointerDown:p,onPointerMove:r,onPointerUp:n,onContextMenu:S,onDblClick:u,onDragEnter:U$,onDragOver:c,onDragLeave:i,onDrop:H$,style:{width:"100%",height:"100%",position:"relative",overflow:"hidden",cursor:_==="eraser"?"cell":_==="text"?"text":g||uv.value||z.current?"crosshair":"grab"},children:[G("div",{style:{transform:`matrix(${U.scale}, 0, 0, ${U.scale}, ${U.x}, ${U.y})`,transformOrigin:"0 0",willChange:"transform",position:"absolute",top:0,left:0},children:[G(GB,{},void 0,!1,void 0,this),G(jB,{},void 0,!1,void 0,this),G(pB,{nodes:T,edges:c$},void 0,!1,void 0,this),G(C3,{annotations:Array.from(M4.value.values())},void 0,!1,void 0,this),W&&W.points.length>=2&&G(C3,{annotations:[W]},void 0,!1,void 0,this),q$.map((M)=>G(xB,{node:M,onContextMenu:$,children:tw(M)},M.id,!1,void 0,this)),P4.value&&G("svg",{class:"snap-guides-svg",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},children:P4.value.map((M,h)=>M.axis==="x"?G("line",{x1:M.pos,y1:M.from-20,x2:M.pos,y2:M.to+20,class:"snap-guide-line"},h,!1,void 0,this):G("line",{x1:M.from-20,y1:M.pos,x2:M.to+20,y2:M.pos,class:"snap-guide-line"},h,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&G("div",{class:`annotation-capture-layer${_==="eraser"?" erasing":""}${_==="text"?" text":""}`,"aria-hidden":"true"},void 0,!1,void 0,this),k&&G("input",{class:"annotation-text-input",value:k.value,autoFocus:!0,style:{left:`${k.x*U.scale+U.x}px`,top:`${k.y*U.scale+U.y}px`,fontSize:`${aB*U.scale}px`},onInput:(M)=>N({...k,value:M.target.value}),onBlur:e,onPointerDown:(M)=>M.stopPropagation(),onKeyDown:(M)=>{if(M.key==="Enter")M.preventDefault(),e();if(M.key==="Escape")M.preventDefault(),N(null)}},void 0,!1,void 0,this),h$&&G("div",{class:"lasso-rect",style:h$},void 0,!1,void 0,this),Y&&G("div",{class:"drop-zone-overlay",children:G("div",{class:"drop-zone-indicator",children:[G("div",{class:"drop-zone-icon",children:"+"},void 0,!1,void 0,this),G("div",{class:"drop-zone-label",children:"Drop files or URLs to add to canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function JF($,v){let g=$.toLowerCase(),_=v.toLowerCase(),U=[],z=0,J=0,b=-1;for(let O=0;O<_.length&&z<g.length;O++)if(_[O]===g[z]){if(U.push(O),J+=b===O-1?10:1,O===0||_[O-1]===" "||_[O-1]==="-"||_[O-1]==="_")J+=5;b=O,z++}return{match:z===g.length,score:J,indices:U}}function bF($,v){if(v.length===0)return $;let g=[],_=0;for(let U of v){if(U>_)g.push($.slice(_,U));g.push(G("mark",{children:$[U]},U,!1,void 0,this)),_=U+1}if(_<$.length)g.push($.slice(_));return g}var c3={md:"markdown",app:"mcp-app",web:"webpage",ui:"json-render",chart:"graph",ctx:"context",log:"ledger"};function GF($){let v=$.toLowerCase().trim();if(v.startsWith("type:")){let g=v.slice(5).trim(),U=Object.keys(s$).find((J)=>J.startsWith(g));if(U)return{typeFilter:U,remaining:""};let z=c3[g];if(z)return{typeFilter:z,remaining:""}}if(c3[v])return{typeFilter:c3[v],remaining:""};return{typeFilter:null,remaining:$}}function vP({onClose:$,onToggleMinimap:v}){let[g,_]=o(""),[U,z]=o(0),J=y(null),b=y(null);m(()=>{setTimeout(()=>J.current?.focus(),30)},[]);let O=Q(()=>{let Y=[];for(let L of T.value.values()){let q=L.data.title||s$[L.type],F=L.data.content||L.data.path||"";Y.push({id:`node:${L.id}`,kind:"node",label:q,description:F.length>80?F.slice(0,80)+"...":F||void 0,badge:s$[L.type],nodeType:L.type,action:()=>{Lv(L.id),$()}})}let H=[{label:"New note (markdown node)",badge:"CREATE",action:()=>{Ev({type:"markdown",title:"New note",width:520,height:360}),$()}},{label:"Fit all nodes",badge:"VIEW",action:()=>{j_(window.innerWidth,window.innerHeight),$()}},{label:"Auto-arrange (grid)",badge:"LAYOUT",action:()=>{V_(),$()}},{label:"Auto-arrange (graph-aware)",badge:"LAYOUT",action:()=>{C_(),$()}},{label:"Toggle minimap",badge:"VIEW",action:()=>{v(),$()}},{label:"Toggle theme (dark/light)",badge:"THEME",action:()=>{let L=T$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",L),qU(),T$.value=L,Z_(L),$()}}];for(let L of H)Y.push({id:`action:${L.label}`,kind:"action",label:L.label,badge:L.badge,badgeClass:"command-palette-badge--action",action:L.action});return Y},[$,v]),{typeFilter:K,remaining:W}=GF(g),B=O(),k;if(!g.trim())k=B.map((Y)=>({...Y,score:0,indices:[]}));else{k=[];for(let Y of B){if(K){if(Y.kind!=="node"||Y.nodeType!==K)continue;if(!W){k.push({...Y,score:0,indices:[]});continue}}let H=JF(W||g,Y.label);if(H.match)k.push({...Y,score:H.score,indices:H.indices})}k.sort((Y,H)=>H.score-Y.score)}m(()=>{if(!g.trim()){Z6.value=null;return}let Y=new Set;for(let H of k)if(H.kind==="node")Y.add(H.id.slice(5));Z6.value=Y.size>0?Y:null},[g,k]),m(()=>{return()=>{Z6.value=null}},[]);let P=Math.min(U,Math.max(0,k.length-1)),X=Q((Y)=>{if(Y.key==="ArrowDown")Y.preventDefault(),z((H)=>Math.min(H+1,k.length-1));else if(Y.key==="ArrowUp")Y.preventDefault(),z((H)=>Math.max(H-1,0));else if(Y.key==="Enter"){if(Y.preventDefault(),k[P])k[P].action()}else if(Y.key==="Escape")Y.preventDefault(),Y.stopPropagation(),$()},[k,P,$]);return m(()=>{let Y=b.current;if(!Y)return;Y.children[P]?.scrollIntoView({block:"nearest"})},[P]),m(()=>{z(0)},[g]),G("div",{class:"command-palette-backdrop",onMouseDown:$,children:G("div",{class:"command-palette",onMouseDown:(Y)=>Y.stopPropagation(),children:[G("input",{ref:J,type:"text",class:"command-palette-input",value:g,onInput:(Y)=>_(Y.target.value),onKeyDown:X,placeholder:`Search nodes and actions... (${Qv}+K)`},void 0,!1,void 0,this),G("div",{class:"command-palette-hint",children:[G("span",{children:[G("kbd",{children:"↑"},void 0,!1,void 0,this),G("kbd",{children:"↓"},void 0,!1,void 0,this)," navigate"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"↵"},void 0,!1,void 0,this)," select"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"esc"},void 0,!1,void 0,this)," close"]},void 0,!0,void 0,this),G("span",{children:[G("kbd",{children:"type:"},void 0,!1,void 0,this)," filter by type"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"command-palette-results",ref:b,children:[k.length===0&&G("div",{class:"command-palette-empty",children:"No matching nodes or actions"},void 0,!1,void 0,this),k.map((Y,H)=>G("button",{type:"button",class:`command-palette-item${H===P?" selected":""}`,onMouseEnter:()=>z(H),onClick:()=>Y.action(),children:[G("span",{class:`command-palette-badge${Y.badgeClass?` ${Y.badgeClass}`:""}`,children:Y.badge},void 0,!1,void 0,this),G("span",{class:"command-palette-label",children:Y.indices.length>0?bF(Y.label,Y.indices):Y.label},void 0,!1,void 0,this),Y.description&&G("span",{class:"command-palette-desc",children:Y.description},void 0,!1,void 0,this)]},Y.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function UP(){let[$,v]=o(null),g=Q((z,J)=>{z.preventDefault(),z.stopPropagation(),v({kind:"node",x:z.clientX,y:z.clientY,nodeId:J})},[]),_=Q((z,J,b)=>{z.preventDefault(),z.stopPropagation(),v({kind:"canvas",x:z.clientX,y:z.clientY,canvasX:J,canvasY:b})},[]),U=Q(()=>v(null),[]);return m(()=>{if(!$)return;let z=()=>v(null),J=(b)=>{if(b.key==="Escape")v(null)};return document.addEventListener("click",z),document.addEventListener("keydown",J),()=>{document.removeEventListener("click",z),document.removeEventListener("keydown",J)}},[$]),{menu:$,openNodeMenu:g,openCanvasMenu:_,closeMenu:U}}var OF="#4bbcFF",KF=[{label:"Blue",value:"#3b82f6"},{label:"Green",value:"#22c55e"},{label:"Yellow",value:"#eab308"},{label:"Red",value:"#ef4444"},{label:"Gray",value:"#6b7280"},{label:"Purple",value:"#a855f7"}];function gP({menu:$,onClose:v}){let g;if($.kind==="node"){let b=T.value.get($.nodeId);if(!b)return null;g=IF(b)}else g=HF($.canvasX,$.canvasY);let _=new Map,U=g.some((b)=>b.render)?g.length*32+168:g.length*32+8,z=Math.min($.x,Math.max(12,window.innerWidth-240)),J=Math.min($.y,Math.max(12,window.innerHeight-U));return G("div",{class:"context-menu",style:{position:"fixed",left:`${z}px`,top:`${J}px`,zIndex:1e4},onPointerDown:(b)=>b.stopPropagation(),onClick:(b)=>b.stopPropagation(),children:g.map((b)=>{let O=b.separator?"separator":b.render?"custom":`${b.label??"item"}:${b.shortcut??""}`,K=(_.get(O)??0)+1;_.set(O,K);let W=`${O}:${K}`;if(b.separator)return G("div",{class:"context-menu-separator"},W,!1,void 0,this);if(b.render)return G("div",{class:"context-menu-custom",children:b.render(v)},W,!1,void 0,this);return G("button",{type:"button",class:"context-menu-item",onClick:()=>{b.action?.(),v()},children:[G("span",{class:"context-menu-label",children:b.label},void 0,!1,void 0,this),b.shortcut&&G("span",{class:"context-menu-shortcut",children:b.shortcut},void 0,!1,void 0,this)]},W,!0,void 0,this)})},void 0,!1,void 0,this)}function WF($){return(typeof $.data.path==="string"?$.data.path.trim():"")||null}function $2($){let v=$.trim().toLowerCase(),g=v.match(/^#([0-9a-f]{3})$/);if(g){let[_,U,z]=g[1].split("");return`#${_}${_}${U}${U}${z}${z}`}return v}function _P($){if(typeof $.data.color!=="string"||!$.data.color.trim())return null;return $2($.data.color)}function BF($){let v=_P($);return v&&/^#[0-9a-f]{6}$/.test(v)?v:$2(OF)}function E3($,v){let g=v?$2(v):null;Pv($.id,{data:{...$.data,color:g}}),Zv($.id,{data:{color:g}})}function PF($,v){let g=_P($);return G("div",{class:"context-menu-section",children:[G("div",{class:"context-menu-section-header",children:[G("span",{class:"context-menu-section-label",children:"Group color"},void 0,!1,void 0,this),G("button",{type:"button",class:"context-menu-reset",onClick:()=>{E3($,null),v()},children:"Theme default"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-menu-color-grid",children:KF.map((_)=>{let U=$2(_.value);return G("button",{type:"button",class:`context-menu-color-swatch${g===U?" active":""}`,"aria-label":`Set group color to ${_.label}`,title:_.label,style:{"--swatch-color":_.value},onClick:()=>{E3($,_.value),v()},children:[G("span",{class:"context-menu-color-dot",style:{"--swatch-color":_.value}},void 0,!1,void 0,this),G("span",{children:_.label},void 0,!1,void 0,this)]},_.value,!0,void 0,this)})},void 0,!1,void 0,this),G("label",{class:"context-menu-color-custom",children:[G("span",{children:"Custom"},void 0,!1,void 0,this),G("input",{type:"color",class:"context-menu-color-input","aria-label":"Custom group color",value:BF($),onClick:(_)=>_.stopPropagation(),onInput:(_)=>{E3($,_.currentTarget.value),v()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function l3($,v,g,_){return{x:$-g/2,y:v-_/2}}function kF($,v){return $.trim().replace(/[?#].*$/,"").split("/").filter(Boolean).at(-1)||v}async function i3($){let v=window.prompt($.promptLabel,$.placeholder??"");if(!v)return;let g=v.trim();if(!g)return;let _=l3($.canvasX,$.canvasY,$.width,$.height);if(!(await Ev({type:$.type,...$.type!=="webpage"?{title:kF(g,$.titleFallback)}:{},content:g,x:_.x,y:_.y,width:$.width,height:$.height})).ok)window.alert($.errorMessage)}function HF($,v){return[{label:"New note",action:()=>{let U=l3($,v,520,360);Ev({type:"markdown",title:"New note",x:U.x,y:U.y,width:520,height:360})}},{label:"Open webpage...",action:()=>{i3({promptLabel:"Webpage URL:",type:"webpage",canvasX:$,canvasY:v,width:520,height:420,placeholder:"https://example.com",titleFallback:"Webpage",errorMessage:"Could not create webpage node. Enter a valid http(s) URL."})}},{label:"Open file...",action:()=>{i3({promptLabel:"Workspace path or absolute file path:",type:"file",canvasX:$,canvasY:v,width:720,height:500,placeholder:"src/server/server.ts",titleFallback:"File",errorMessage:"Could not create file node. Check the path and try again."})}},{label:"Open image...",action:()=>{i3({promptLabel:"Image path, URL, or data URI:",type:"image",canvasX:$,canvasY:v,width:480,height:360,placeholder:"artifacts/architecture.png",titleFallback:"Image",errorMessage:"Could not create image node. Check the image source and try again."})}},{separator:!0},{label:"New group",action:()=>{let U=l3($,v,600,400);N_({title:"Group",x:U.x,y:U.y,width:600,height:400})}}]}function IF($){let v=[],g=WF($);if(v.push({label:"Focus",action:()=>Lv($.id)}),F_.has($.type))v.push({label:"Expand",shortcut:"⤢",action:()=>z6($.id)});v.push({label:$.collapsed?"Expand":"Collapse",action:()=>Q6($.id)});let _=R$.value.has($.id);v.push({label:_?"Unpin from context":"Pin as context",action:()=>Q4($.id)}),v.push({label:$.pinned?"Unlock position":"Lock position (no auto-arrange)",action:()=>{let J=!$.pinned;Pv($.id,{pinned:J}),Zv($.id,{pinned:J}),t$()}});let U=y_.value;if(U&&U.from!==$.id){let J=T.value.get(U.from),b=J?(J.data.title||J.id).slice(0,20):U.from;v.push({label:`Connect from "${b}"`,action:()=>{A4(U.from,$.id,"relation"),y_.value=null}})}v.push({label:U?"Connect from here (replace)":"Connect from here",action:()=>{y_.value={from:$.id}}});let z=Array.from(c$.value.values()).filter((J)=>J.from===$.id||J.to===$.id).length;if(z>0)v.push({label:`${z} edge${z!==1?"s":""} connected`});if(v.push({separator:!0}),($.type==="markdown"||$.type==="file"||$.type==="image")&&g)v.push({label:"Open in browser",action:()=>{window.open(`/artifact?path=${encodeURIComponent(g)}`,"_blank","noopener")}}),v.push({label:"Copy path",action:()=>{navigator.clipboard.writeText(g)}});if($.type==="mcp-app"||$.type==="json-render"||$.type==="graph")if($.data.chartConfig){let J=$.data.chartConfig.title||"chart";v.push({label:"Copy chart data",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.chartConfig,null,2))}})}else{let J=$.data.url;if(v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank")}}),v.push({label:"Focus in TUI",action:()=>mO("mcp-app-focus",{url:J})}),$.type==="json-render"||$.type==="graph")v.push({label:"Copy spec",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.spec??$.data.graphConfig??{},null,2))}})}if($.type==="webpage"){let J=typeof $.data.url==="string"?$.data.url:"";v.push({label:"Refresh webpage",action:()=>{M_($.id)}}),v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank","noopener")}}),v.push({label:"Copy URL",action:()=>{if(J)navigator.clipboard.writeText(J)}})}if($.type==="group"){let J=$.data.children??[];if(v.push({separator:!0}),v.push({render:(b)=>PF($,b)}),J.length>0)v.push({label:`Ungroup (${J.length} node${J.length!==1?"s":""})`,action:()=>oO($.id)})}if($.type==="status"||$.type==="ledger")if(v.push({separator:!0}),$.dockPosition!==null)v.push({label:"Undock to canvas",action:()=>r4($.id)});else v.push({label:"Dock left of toolbar",action:()=>y2($.id,"left")}),v.push({label:"Dock right of toolbar",action:()=>y2($.id,"right")});return v.push({separator:!0}),v.push({label:"Close",action:()=>{S4($.id),Q_($.id)}}),v}function zP(){let $=R$.value.size;if($===0||X6.value||T_.value)return null;return G("div",{class:"context-pin-bar",children:[G("span",{class:"context-pin-bar-count",children:["✦"," ",$," node",$!==1?"s":""," in context"]},void 0,!0,void 0,this),G("button",{type:"button",class:"context-pin-bar-btn context-pin-bar-clear",onClick:JK,title:"Clear all context pins",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function JP({node:$}){let v=M3($),g=$.data.activeTool,_=$.data.subagent,U=p0[v]??"var(--c-muted)";return G("span",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1,minWidth:0},children:[G("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:U,animation:v!=="idle"?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),G("span",{style:{color:U,fontSize:"10px",textTransform:"uppercase",fontWeight:600},children:v},void 0,!1,void 0,this),g&&G("span",{style:{color:"var(--c-warn)",fontSize:"10px",fontFamily:"var(--mono)"},children:["⚙ ",g]},void 0,!0,void 0,this),_&&_.state!=="completed"&&G("span",{style:{color:"var(--c-subagent)",fontSize:"10px"},children:["⠉ ",_.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function YF($){switch($.type){case"status":return G(XU,{node:$},void 0,!1,void 0,this);case"ledger":return G(T4,{node:$},void 0,!1,void 0,this);case"context":return G(U4,{node:$},void 0,!1,void 0,this);default:return null}}function LF($){let v=Array.isArray($.data.cards)?$.data.cards:[],g=Array.isArray($.data.auxTabs)?$.data.auxTabs:[];return v.length+g.length}function qF({node:$}){let v=GK(),g=v.length>0?v.length:LF($),_=g>0,U=$.collapsed===!0,z=()=>{q_(),Q6($.id)};if(U)return G("div",{class:"docked-node docked-node--collapsed","data-docked-node":"true",children:G("div",{class:"docked-node-header",children:[G("span",{class:"node-type-badge",children:"Context"},void 0,!1,void 0,this),_&&G("span",{class:"docked-node-count","aria-hidden":"true",children:g>99?"99+":g},void 0,!1,void 0,this),G("div",{class:"docked-node-controls",children:[G("button",{type:"button",onClick:(J)=>{J.stopPropagation(),z()},title:_?`${g} item${g===1?"":"s"} in agent context — expand`:"Expand agent context","aria-label":_?`Context — ${g} item${g===1?"":"s"}`:"Expand agent context",children:"▸"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(J)=>{J.stopPropagation(),r4($.id)},title:"Undock to canvas","aria-label":"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return G("aside",{class:"context-dock-panel","data-docked-node":"true","aria-label":"Agent context",children:[G("div",{class:"context-dock-header",children:[G("div",{class:"context-dock-header-text",children:[G("span",{class:"context-dock-title",children:"Context"},void 0,!1,void 0,this),G("span",{class:"context-dock-subtitle",children:_?`${g} item${g===1?"":"s"} in agent context`:"Active agent context"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-dock-controls",children:[G("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),r4($.id)},"aria-label":"Undock to canvas",title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this),G("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),Q6($.id)},"aria-label":"Collapse context panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"context-dock-body",children:G(U4,{node:$,pinnedNodes:v},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function x3({node:$}){if($.type==="context")return G(qF,{node:$},void 0,!1,void 0,this);return G("div",{class:`docked-node${$.collapsed?" docked-node--collapsed":""}`,"data-docked-node":"true",children:[G("div",{class:"docked-node-header",children:[G("span",{class:"node-type-badge",children:s$[$.type]??$.type},void 0,!1,void 0,this),$.type==="status"&&$.collapsed&&G(JP,{node:$},void 0,!1,void 0,this),G("div",{class:"docked-node-controls",children:[G("button",{type:"button",onClick:(v)=>{v.stopPropagation(),Q6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(v)=>{v.stopPropagation(),r4($.id)},title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&G("div",{class:"docked-node-body",children:YF($)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function bP($,v){switch($.type){case"markdown":return G(t_,{node:$,expanded:v},void 0,!1,void 0,this);case"mcp-app":return G(l6,{node:$,expanded:v},void 0,!1,void 0,this);case"webpage":return G(n0,{node:$,expanded:v},void 0,!1,void 0,this);case"json-render":return G(l6,{node:$,expanded:v},void 0,!1,void 0,this);case"graph":return G(l6,{node:$,expanded:v},void 0,!1,void 0,this);case"prompt":return G(a0,{node:$},void 0,!1,void 0,this);case"response":return G(s0,{node:$,expanded:v},void 0,!1,void 0,this);case"status":return G(XU,{node:$},void 0,!1,void 0,this);case"context":return G(U4,{node:$,expanded:v},void 0,!1,void 0,this);case"ledger":return G(T4,{node:$},void 0,!1,void 0,this);case"trace":return G(e0,{node:$},void 0,!1,void 0,this);case"file":return G(l_,{node:$,expanded:v},void 0,!1,void 0,this);case"image":return G(o0,{node:$,expanded:v},void 0,!1,void 0,this);case"html":return G(ig,{node:$,expanded:v},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function GP($){switch($.type){case"markdown":return $.data.content||"";case"file":return $.data.fileContent||"";case"webpage":return $.data.content||"";case"html":return $.data.html||$.data.content||"";case"json-render":case"graph":return JSON.stringify($.data.spec??$.data.graphConfig??{},null,2);default:return""}}function XF($){if(!$)return 0;return $.split(/\s+/).filter(Boolean).length}function wF($,v){return $!==null&&typeof $==="object"&&$.source===pv&&$.type==="presentation-exit"&&$.token===v}function FF($){return $==="ArrowRight"||$==="PageDown"||$===" "||$==="ArrowLeft"||$==="PageUp"||$==="Home"||$==="End"}function OP($){return $ instanceof HTMLElement&&Boolean($.closest(".html-presentation-exit"))}function KP(){let $=j$.value,v=$?T.value.get($):void 0,[g,_]=o(!1),[U,z]=o(!1),[J,b]=o(""),O=y(null),K=y(null),W=Q(()=>{z(!1),v4()},[]),B=Q(()=>{b(`presentation-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),z(!0)},[]),k=Q((u)=>{document.querySelector(".html-presentation-overlay iframe.html-node-frame-presentation")?.contentWindow?.postMessage({source:pv,token:J,...u},"*")},[J]),P=Q(()=>{z(!1)},[]),X=Q((u)=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),z(!1);return}if(u.key==="Tab"&&!OP(u.target)){u.preventDefault(),u.stopPropagation(),K.current?.focus();return}if((u.key===" "||u.key==="Enter")&&OP(u.target))return;if(!FF(u.key))return;u.preventDefault(),u.stopPropagation(),k({type:"presentation-key",key:u.key})},[k]),Y=Q((u)=>{if(u.target.classList.contains("expanded-overlay-backdrop"))v4()},[]),H=Q(()=>{if(!v)return;let u=GP(v);if(!u)return;navigator.clipboard.writeText(u).then(()=>{_(!0),setTimeout(()=>_(!1),1500)})},[v]),L=Q(()=>{if(!$)return;Q4($)},[$]);if(m(()=>{z(!1)},[$]),G_(()=>{if(!U)return;let u=()=>{let c=O.current;if(!c||c.contains(document.activeElement))return;c.focus()},S=[0,50,150].map((c)=>window.setTimeout(u,c)),U$=(c)=>{if(!wF(c.data,J))return;z(!1)};return document.addEventListener("keydown",X,!0),window.addEventListener("message",U$),()=>{S.forEach((c)=>{window.clearTimeout(c)}),document.removeEventListener("keydown",X,!0),window.removeEventListener("message",U$)}},[X,J,U]),!v)return null;let q=v.data.title||v.data.path?.split("/").pop()||s$[v.type],F=GP(v),N=XF(F),C=$?R$.value.has($):!1,p=F.length>0,r=iv.value===$,n=v.type==="mcp-app"||v.type==="webpage"||v.type==="json-render"||v.type==="graph",e=vB(v);return G("div",{class:"expanded-overlay-backdrop",onPointerDown:Y,style:{position:"fixed",inset:0,zIndex:10001,background:"rgba(10,14,30,0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"32px",pointerEvents:r?"none":"auto"},children:G("div",{class:"expanded-overlay-panel",style:{flex:1,maxWidth:"1200px",display:"flex",flexDirection:"column",background:"var(--c-panel)",border:`1px solid ${C?"var(--c-warn)":"var(--c-accent)"}`,borderRadius:"var(--radius)",boxShadow:`0 0 0 1px ${C?"var(--c-warn)":"var(--c-accent)"}, 0 24px 80px rgba(0,0,0,0.6)`,overflow:"hidden"},children:[G("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 16px",background:"var(--c-panel-glass)",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[G("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",background:"var(--c-accent-12)",color:"var(--c-accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:s$[v.type]},void 0,!1,void 0,this),G("span",{style:{flex:1,fontSize:"13px",fontWeight:600,color:"var(--c-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:q},void 0,!1,void 0,this),G("div",{class:"expanded-actions",children:[G("button",{type:"button",class:`expanded-action-btn ${C?"expanded-action-active":""}`,onClick:L,title:C?"Remove from context":"Pin as context",children:C?"✦ In context":"✦ Pin as context"},void 0,!1,void 0,this),p&&G("button",{type:"button",class:"expanded-action-btn",onClick:H,title:"Copy content to clipboard",children:g?"Copied!":"Copy"},void 0,!1,void 0,this),t0(v)&&G("button",{type:"button",class:"expanded-action-btn",onClick:()=>void d0(v),title:"Open as a full-page site in the system browser",children:"Open as site"},void 0,!1,void 0,this),e&&G("button",{type:"button",class:"expanded-action-btn expanded-action-primary",onClick:B,title:"Present this HTML node fullscreen",children:"Present"},void 0,!1,void 0,this),N>0&&G("span",{class:"expanded-meta",children:[N.toLocaleString()," word",N!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("span",{style:{fontSize:"10px",color:r?"var(--c-warn)":"var(--c-muted)"},children:r?"Saving edits...":"Esc to close"},void 0,!1,void 0,this),G("button",{type:"button",onClick:W,style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 6px",fontSize:"16px",lineHeight:1,borderRadius:"4px"},onMouseEnter:(u)=>{u.target.style.color="var(--c-text)"},onMouseLeave:(u)=>{u.target.style.color="var(--c-muted)"},title:"Close (Esc)",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{style:{flex:1,overflow:"auto",padding:"16px",minHeight:0,...n?{display:"flex",flexDirection:"column"}:{}},children:n?G("div",{style:{flex:1,minHeight:0,display:"flex"},children:bP(v,!0)},void 0,!1,void 0,this):bP(v,!0)},void 0,!1,void 0,this),e&&U&&G("div",{ref:O,class:"html-presentation-overlay",role:"dialog","aria-modal":"true","aria-label":`Present ${q}`,tabIndex:-1,onKeyDownCapture:X,children:[G("button",{ref:K,type:"button",class:"html-presentation-exit",onClick:P,title:"Exit presentation (Esc)","aria-label":"Exit presentation",children:"Exit presentation"},void 0,!1,void 0,this),G("div",{class:"html-presentation-stage",children:G(ig,{node:v,expanded:!0,presentation:!0,presentationExitToken:J},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var QU=180,SU=120,v2=20;function AF(){let $=h0();return{markdown:$.accent,"mcp-app":$.ok,webpage:$.warn,"json-render":$.ok,graph:$.purple,prompt:$.accent,response:$.ok,status:$.warn,context:$.muted,ledger:$.dim,trace:$.purple,file:$.accent,image:$.ok,html:$.warn,group:$.dim}}function ZF(){let $=h0();return{relation:$.muted,"depends-on":$.warn,flow:$.accent,references:$.dim}}function WP($,v,g,_){let U=Array.from($.values()),z=0,J=0,b=1000,O=800;if(U.length>0){z=Number.POSITIVE_INFINITY,J=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(let H of U)z=Math.min(z,H.position.x),J=Math.min(J,H.position.y),b=Math.max(b,H.position.x+H.size.width),O=Math.max(O,H.position.y+H.size.height)}let K=-v.x/v.scale,W=-v.y/v.scale,B=K+g/v.scale,k=W+_/v.scale,P={minX:Math.min(z,K)-v2,minY:Math.min(J,W)-v2,maxX:Math.max(b,B)+v2,maxY:Math.max(O,k)+v2},X=P.maxX-P.minX||1,Y=P.maxY-P.minY||1;return{bounds:P,scale:Math.min(QU/X,SU/Y)}}function BP({viewport:$,nodes:v,edges:g,onNavigate:_,containerWidth:U,containerHeight:z}){let J=y(null),b=y(!1),O=y(null),K=y(null),W=Q(()=>{let Y=J.current;if(!Y)return;let H=Y.getContext("2d");if(!H)return;let L=v.value,q=g.value,F=$.value,N=window.devicePixelRatio||1;Y.width=QU*N,Y.height=SU*N,H.scale(N,N),H.clearRect(0,0,QU,SU);let C=h0();H.fillStyle=C.panel+"d9",H.fillRect(0,0,QU,SU);let p=WP(L,F,U,z);O.current=p;let{bounds:r,scale:n}=p,e=(M)=>(M-r.minX)*n,u=(M)=>(M-r.minY)*n,S=Array.from(L.values()),U$=AF();for(let M of S)H.fillStyle=U$[M.type]??C.muted,H.globalAlpha=0.6,H.fillRect(e(M.position.x),u(M.position.y),Math.max(4,M.size.width*n),Math.max(3,M.size.height*n));let c=ZF();for(let M of q.values()){let h=L.get(M.from),s=L.get(M.to);if(!h||!s)continue;let d=e(h.position.x+h.size.width/2),b$=u(h.position.y+h.size.height/2),g$=e(s.position.x+s.size.width/2),l=u(s.position.y+s.size.height/2);H.beginPath(),H.moveTo(d,b$),H.lineTo(g$,l),H.strokeStyle=c[M.type]??C.muted,H.globalAlpha=0.3,H.lineWidth=0.5,H.stroke()}let i=-F.x/F.scale,H$=-F.y/F.scale,q$=U/F.scale,h$=z/F.scale;H.globalAlpha=1,H.strokeStyle=C.accent,H.lineWidth=1.5,H.strokeRect(e(i),u(H$),q$*n,h$*n)},[v,g,$,U,z]),B=y(W);B.current=W;let k=Q(()=>{if(K.current!==null)return;K.current=window.requestAnimationFrame(()=>{K.current=null,B.current()})},[]);DO(()=>{T$.value,v.value,g.value,$.value,k()}),m(()=>{k()},[U,z,k]),m(()=>()=>{if(K.current!==null)window.cancelAnimationFrame(K.current),K.current=null},[]);let P=Q((Y)=>{let H=J.current;if(!H)return;let L=H.getBoundingClientRect(),q=Y.clientX-L.left,F=Y.clientY-L.top,N=O.current??WP(v.value,$.value,U,z);O.current=N;let{bounds:C,scale:p}=N,r=$.value,n=U/r.scale,e=z/r.scale,u=q/p+C.minX,S=F/p+C.minY;_(-(u-n/2)*r.scale,-(S-e/2)*r.scale)},[v,$,U,z,_]),X=Q((Y)=>{Y.stopPropagation(),b.current=!0,P(Y);let H=(q)=>{if(b.current)P(q)},L=()=>{b.current=!1,document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",L)};document.addEventListener("pointermove",H),document.addEventListener("pointerup",L)},[P]);return G("div",{style:{position:"fixed",bottom:"16px",right:"16px",zIndex:9998,border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",overflow:"hidden",boxShadow:"0 4px 16px var(--c-shadow)"},children:G("canvas",{ref:J,width:QU,height:SU,style:{width:`${QU}px`,height:`${SU}px`,display:"block",cursor:"pointer"},onPointerDown:X},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function PP(){let $=i$.value.size,v=Q(()=>{let U=Array.from(i$.value);if(U.length===0)return;zK(U),jv()},[]),g=Q(()=>{let U=Array.from(i$.value);if(U.length===0)return;N_({title:"Group",childIds:U}),jv()},[]),_=Q(()=>{let U=Array.from(i$.value);for(let z=0;z<U.length;z++)for(let J=z+1;J<U.length;J++)A4(U[z],U[J],"relation");jv()},[]);if($===0)return null;return G("div",{class:"selection-bar",children:[G("span",{class:"selection-bar-count",children:["✦"," ",$," node",$!==1?"s":""," selected"]},void 0,!0,void 0,this),G("button",{type:"button",class:"selection-bar-btn selection-bar-pin-ctx",onClick:v,children:"Pin as context"},void 0,!1,void 0,this),$>=2&&G("button",{type:"button",class:"selection-bar-btn",onClick:g,children:"Group"},void 0,!1,void 0,this),$>=2&&G("button",{type:"button",class:"selection-bar-btn",onClick:_,children:"Connect"},void 0,!1,void 0,this),G("button",{type:"button",class:"selection-bar-btn selection-bar-clear",onClick:jv,title:"Clear selection",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var MF=[{title:"Navigation",shortcuts:[{keys:`${Qv}+K`,desc:"Command palette — search nodes & actions"},{keys:"Tab / Shift+Tab",desc:"Cycle through nodes"},{keys:"← ↑ → ↓",desc:"Walk graph along edges (when node focused)"},{keys:`${Qv}+0`,desc:"Reset viewport to origin"},{keys:`${Qv}++ / ${Qv}+−`,desc:"Zoom in / out"}]},{title:"Creation",shortcuts:[{keys:"Double-click",desc:"Create new markdown note on canvas"},{keys:"Drag port → node",desc:"Connect two nodes (hover to reveal ports)"}]},{title:"Selection",shortcuts:[{keys:"Click",desc:"Focus node (highlights neighbors & edges)"},{keys:"Shift+Click",desc:"Toggle node in multi-selection"},{keys:"Shift+Drag",desc:"Lasso select multiple nodes"},{keys:"Esc",desc:"Clear selection / close overlay"}]},{title:"View",shortcuts:[{keys:"?",desc:"Toggle this shortcut overlay"},{keys:"Minimap",desc:"Click/drag to navigate (toggle in toolbar)"},{keys:"Right-click",desc:"Context menu — dock, focus, connect"}]}];function kP({onClose:$}){return G("div",{class:"shortcut-overlay-backdrop",onMouseDown:$,children:G("div",{class:"shortcut-overlay",onMouseDown:(v)=>v.stopPropagation(),children:[G("div",{class:"shortcut-overlay-header",children:[G("span",{class:"shortcut-overlay-title",children:"Keyboard Shortcuts"},void 0,!1,void 0,this),G("span",{class:"shortcut-overlay-hint",children:["Press ",G("kbd",{children:"?"},void 0,!1,void 0,this)," or ",G("kbd",{children:"Esc"},void 0,!1,void 0,this)," to close"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"shortcut-overlay-body",children:MF.map((v)=>G("div",{class:"shortcut-group",children:[G("div",{class:"shortcut-group-title",children:v.title},void 0,!1,void 0,this),v.shortcuts.map((g)=>G("div",{class:"shortcut-row",children:[G("kbd",{class:"shortcut-keys",children:g.keys},void 0,!1,void 0,this),G("span",{class:"shortcut-desc",children:g.desc},void 0,!1,void 0,this)]},g.keys,!0,void 0,this))]},v.title,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function QF($){let v=Date.now()-new Date($).getTime(),g=Math.floor(v/60000);if(g<1)return"just now";if(g<60)return`${g}m ago`;let _=Math.floor(g/60);if(_<24)return`${_}h ago`;return`${Math.floor(_/24)}d ago`}function HP({open:$,onClose:v,anchorRef:g}){let[_,U]=o([]),[z,J]=o(!1),[b,O]=o(!1),[K,W]=o(null),[B,k]=o(""),[P,X]=o(null),Y=y(null),H=y(null);m(()=>{if(!$)return;J(!0),nO().then((r)=>{U(r),J(!1)})},[$]),m(()=>{if($)setTimeout(()=>H.current?.focus(),50)},[$]),m(()=>{if(!$)return;let r=(n)=>{let e=Y.current,u=g.current;if(e&&!e.contains(n.target)&&u&&!u.contains(n.target))v()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[$,v]),m(()=>{if(!$)return;let r=(n)=>{if(n.key==="Escape")v()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[$,v]);let L=Q(async()=>{let r=B.trim();if(!r)return;O(!0);let n=await tO(r);if(O(!1),n.ok&&n.snapshot)U((e)=>[n.snapshot,...e]),k("")},[B]),q=Q(async(r)=>{X(null),W(r);let n=await dO(r);if(W(null),n.ok)v()},[v]),F=Q(async(r)=>{if((await aO(r)).ok)U((e)=>e.filter((u)=>u.id!==r));X(null)},[]);if(!$)return null;let N=g.current?.getBoundingClientRect(),C=N?Math.max(8,N.left-120):100,p=N?N.bottom+8:48;return G("div",{ref:Y,class:"snapshot-panel",style:{left:`${C}px`,top:`${p}px`},children:[G("div",{class:"snapshot-panel-header",children:[G("span",{class:"snapshot-panel-title",children:"Snapshots"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-panel-close",onClick:v,title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-save-form",children:[G("input",{ref:H,type:"text",class:"snapshot-name-input",value:B,onInput:(r)=>k(r.target.value),onKeyDown:(r)=>{if(r.key==="Enter")L()},placeholder:"Snapshot name...",maxLength:80,disabled:b},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-save-btn",onClick:L,disabled:!B.trim()||b,children:b?"...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-restore-note",children:"Restoring replaces the current canvas. You can undo it if needed."},void 0,!1,void 0,this),G("div",{class:"snapshot-list",children:[z&&G("div",{class:"snapshot-empty",children:"Loading..."},void 0,!1,void 0,this),!z&&_.length===0&&G("div",{class:"snapshot-empty",children:"No snapshots yet. Save one to capture the current canvas state."},void 0,!1,void 0,this),!z&&_.map((r)=>G("div",{class:"snapshot-item",children:[G("div",{class:"snapshot-item-info",children:[G("span",{class:"snapshot-item-name",children:r.name},void 0,!1,void 0,this),G("span",{class:"snapshot-item-meta",children:[r.nodeCount," node",r.nodeCount!==1?"s":"",r.edgeCount>0?` · ${r.edgeCount} edge${r.edgeCount!==1?"s":""}`:""," · ",QF(r.createdAt)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"snapshot-item-actions",children:P?.id===r.id?G(a$,{children:[G("button",{type:"button",class:`snapshot-action-btn ${P.action==="delete"?"snapshot-action-confirm":"snapshot-action-restore"}`,onClick:()=>P.action==="delete"?F(r.id):q(r.id),title:P.action==="delete"?"Confirm delete":"Confirm restore",disabled:K!==null,children:P.action==="delete"?"Delete":K===r.id?"Restoring...":"Confirm"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-action-btn",onClick:()=>X(null),title:"Cancel",disabled:K!==null,children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):G(a$,{children:[G("button",{type:"button",class:"snapshot-action-btn snapshot-action-restore",onClick:()=>X({id:r.id,action:"restore"}),title:"Restore this snapshot",disabled:K!==null,children:K===r.id?"Restoring...":"Restore"},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-action-btn snapshot-action-delete",onClick:()=>X({id:r.id,action:"delete"}),title:"Delete this snapshot",disabled:K!==null,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},r.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function IP($,v,g,_,U){return $.x<_.position.x+_.size.width+U&&$.x+v+U>_.position.x&&$.y<_.position.y+_.size.height+U&&$.y+g+U>_.position.y}function SF($,v,g,_,U){return _.some((z)=>IP($,v,g,z,U))}function NF($,v,g,_,U){return _.find((z)=>IP($,v,g,z,U))}function U2($,v,g,_=24){if($.length===0)return{x:40,y:80};let U=$[$.length-1],z={x:U.position.x+U.size.width+_,y:U.position.y};if(!SF(z,v,g,$,_))return z;let J=40,b=80,O=3000,K=b;for(let B=0;B<20;B++){let k=J;while(k+v<O){let Y=NF({x:k,y:K},v,g,$,_);if(!Y)return{x:k,y:K};k=Y.position.x+Y.size.width+_}K=$.filter((Y)=>Y.position.y<=K+g+_&&Y.position.y+Y.size.height+_>K).reduce((Y,H)=>Math.max(Y,H.position.y+H.size.height),K)+_}let W=$.reduce((B,k)=>Math.max(B,k.position.y+k.size.height),0);return{x:J,y:W+_}}var x6={status:{x:40,y:80,w:300,h:120},markdown:{x:380,y:80,w:720,h:600},context:{x:1130,y:80,w:320,h:400},"mcp-app":{x:380,y:720,w:960,h:600},webpage:{x:380,y:80,w:520,h:420},"json-render":{x:380,y:720,w:840,h:620},graph:{x:380,y:720,w:760,h:520},ledger:{x:1130,y:520,w:320,h:280},trace:{x:40,y:900,w:200,h:56},file:{x:380,y:80,w:720,h:600},image:{x:380,y:80,w:720,h:520},html:{x:380,y:80,w:720,h:640},group:{x:220,y:60,w:840,h:560},prompt:{x:380,y:1260,w:520,h:400},response:{x:380,y:1480,w:720,h:400}};function pg($,v,g,_={}){let U=x6[v];return{id:$,type:v,position:_.position??{x:U.x,y:U.y},size:_.size??{width:U.w,height:U.h},zIndex:v==="status"?0:1,collapsed:!1,pinned:!1,dockPosition:_.dockPosition??null,data:g}}var k4=null,_2=null,h3=0,h6=null,rF=3000,uF=2000,yF=5000,og=!1,P6=null,NU=null,o6=0,p6=null;function DF(){if(typeof location>"u")return null;let $=new URLSearchParams(location.search).get("transport");return $==="poll"||$==="sse"?$:null}var rU=new Map;function ng($){let v=0;for(let g=0;g<$.length;g++)v=(v<<5)-v+$.charCodeAt(g)|0;return Math.abs(v).toString(36)}function z2($){if(!_2)return $;let v=_2.get($.id);if(!v)return $;return{...$,position:v.position??$.position,size:v.size??$.size,collapsed:v.collapsed??$.collapsed,pinned:v.pinned??$.pinned,dockPosition:v.dockPosition!==void 0?v.dockPosition:$.dockPosition}}function tg($,v,g,_=null){return z2(pg($,v,g,{dockPosition:_}))}function RF(){return U2([...T.value.values()],x6.markdown.w,x6.markdown.h)}function n6(){if(!T.value.has("status-main"))_6(tg("status-main","status",{phase:"idle",message:"",elapsed:0},"left"))}function TF($,v){let g=`md-${ng($)}`;if(T.value.get(g))v$(g,{path:$,title:v}),D$.value=g;else{let U=RF(),z=tg(g,"markdown",{path:$,title:v,content:"",rendered:""});if(z.position=U,_6(z),!z.dockPosition)Lv(g)}}function jF($){if(T.value.get("context-main"))v$("context-main",{cards:$});else if($.length>0){let _=tg("context-main","context",{cards:$});_6(_)}}function VF($){let v=$.url,g=`mcp-${ng(v)}`;if(T.value.get(g))v$(g,$);else _6(tg(g,"mcp-app",$)),Lv(g)}function CF($){let v=$.toolCallId,_=(typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null)??(v.startsWith("ext-app-")?v:`ext-app-${v}`);if(T.value.get(_)){v$(_,$);return}let{serverName:z,toolName:J}=$;if(z&&J){for(let[H,L]of T.value.entries())if(L.type==="mcp-app"&&L.data.mode==="ext-app"&&L.data.serverName===z&&L.data.toolName===J&&!L.data.toolResult){v$(H,{...$});return}}let{_x:b,_y:O,_width:K,_height:W}=$,B=x6["mcp-app"],k=K??B.w,P=W??B.h,X=b===void 0||O===void 0?U2([...T.value.values()],k,P):null,Y=z2(pg(_,"mcp-app",{mode:"ext-app",...$},{position:{x:b??X?.x??B.x,y:O??X?.y??B.y},size:{width:k,height:P}}));if(_6(Y),!Y.dockPosition)Lv(_,{recordHistory:!1})}function fF($){let v=$.startsWith("ext-app-")?$:`ext-app-${$}`;if(T.value.has(v))return v;let g=`ext-app-${$}`;if(g!==v&&T.value.has(g))return g;for(let[_,U]of T.value.entries())if(U.type==="mcp-app"&&U.data.mode==="ext-app"&&U.data.toolCallId===$)return _;return null}function qP($){let v=typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null;if(v&&T.value.has(v))return v;if(typeof $.toolCallId!=="string"||!$.toolCallId)return null;return fF($.toolCallId)}function XP($,v){if(typeof $!=="string"||!$)return null;if(typeof v!=="string"||!v)return null;let g=null;for(let[_,U]of T.value.entries())if(U.type==="mcp-app"&&U.data.mode==="ext-app"&&U.data.serverName===$&&U.data.toolName===v&&!U.data.toolResult){if(g)return null;g=_}return g}function wP($){if(T.value.get("ledger-main"))v$("ledger-main",$);else{let _=tg("ledger-main","ledger",$,"right");_.collapsed=!0,_6(_)}}function FP($){if(!($==="dark"||$==="light"||$==="high-contrast"))return;if(document.documentElement.setAttribute("data-theme",$),qU(),T$.value!==$)T$.value=$}function mF($){return $==="markdown"||$==="mcp-app"||$==="webpage"||$==="json-render"||$==="graph"||$==="prompt"||$==="response"||$==="status"||$==="context"||$==="ledger"||$==="trace"||$==="file"||$==="image"||$==="html"||$==="group"}function cF($){return $==="relation"||$==="depends-on"||$==="flow"||$==="references"}function p3($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.x!=="number"||typeof v.y!=="number")return null;return{x:v.x,y:v.y}}function AP($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.width!=="number"||typeof v.height!=="number")return null;return{width:v.width,height:v.height}}function EF($){let v=p3($),g=AP($);return v&&g?{...v,...g}:null}function iF($){if(typeof $.id!=="string"||!$.id)return null;if(!mF($.type))return null;let v=p3($.position),g=AP($.size);if(!v||!g)return null;let _=$.dockPosition==="left"||$.dockPosition==="right"?$.dockPosition:null,U=$.data&&typeof $.data==="object"?Object.fromEntries(Object.entries($.data)):{};return{id:$.id,type:$.type,position:v,size:g,zIndex:typeof $.zIndex==="number"?$.zIndex:1,collapsed:$.collapsed===!0,pinned:$.pinned===!0,dockPosition:_,data:U}}function lF($){if(typeof $.id!=="string"||!$.id)return null;if(typeof $.from!=="string"||!$.from)return null;if(typeof $.to!=="string"||!$.to)return null;if(!cF($.type))return null;return{id:$.id,from:$.from,to:$.to,type:$.type,...typeof $.label==="string"?{label:$.label}:{},...$.style==="solid"||$.style==="dashed"||$.style==="dotted"?{style:$.style}:{},...$.animated===!0?{animated:!0}:{}}}function xF($){if(typeof $.id!=="string"||!$.id)return null;if($.type!=="freehand"&&$.type!=="text")return null;if(!Array.isArray($.points))return null;let v=$.points.map((_)=>p3(_)).filter((_)=>_!==null),g=EF($.bounds);if(v.length<($.type==="text"?1:2)||!g)return null;return{id:$.id,type:$.type,points:v,bounds:g,color:typeof $.color==="string"?$.color:"#f97316",width:typeof $.width==="number"?$.width:4,...typeof $.text==="string"?{text:$.text}:{},...typeof $.label==="string"?{label:$.label}:{},createdAt:typeof $.createdAt==="string"?$.createdAt:""}}function hF($){if($4.value=$.sessionId||"",lv.value="connected",typeof $.theme==="string")FP($.theme);if($.ledgerSummary)wP($.ledgerSummary)}function pF($){if(typeof $.path!=="string"||!$.path)return;let v=$.path,g=(typeof $.title==="string"?$.title:"")||v.split("/").pop()||"Untitled";if(TF(v,g),$.ledgerSummary)wP($.ledgerSummary)}function oF($){n6(),v$("status-main",{message:typeof $.message==="string"?$.message:String($.message??""),level:$.level??"ok",source:$.source})}function nF($){n6(),v$("status-main",{phase:$.phase,detail:$.detail})}function tF($){let v=$.cards??[];jF(v)}function dF($){if(typeof $.url==="string"&&$.url)VF({url:$.url,sourceServer:$.sourceServer,sourceTool:$.sourceTool,inferredType:$.inferredType,trustedDomain:$.trustedDomain,hostMode:$.hostMode??"hosted"})}function aF($){let v=$.sessions??[];for(let g of v){let _=g.url;if(!_)continue;let U=`mcp-${ng(_)}`;if(T.value.has(U))v$(U,{sessionState:g.state,lastSeenAt:g.lastSeenAt})}}function sF($){if(typeof $.url==="string"&&$.url){let v=`mcp-${ng($.url)}`;if(T.value.has(v))v$(v,{hostMode:"fallback",fallbackReason:$.reasonCode})}}function eF($){let g=T.value.get("context-main");if(!g)return;let _=(g.data.auxTabs??[]).concat($);v$("context-main",{auxTabs:_})}function $A($){if(T.value.has("context-main"))if($.mode==="all")v$("context-main",{auxTabs:[]});else{let _=T.value.get("context-main");if(!_)return;let U=(_.data.auxTabs??[]).filter((z)=>z.id!==$.id);v$("context-main",{auxTabs:U})}}function vA($){n6(),v$("status-main",{phase:"idle",lastCompletion:{tokenCount:$.tokenCount,artifactCount:$.artifactCount}})}function UA($){n6(),v$("status-main",{phase:"tooling",detail:`${$.name}`,activeTool:$.name})}function gA($){n6(),v$("status-main",{activeTool:null})}function _A($){if($.state==="active"&&$.path){let g=`md-${ng($.path)}`;if(T.value.has(g))v$(g,{reviewActive:!0})}}function zA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;CF({toolCallId:$.toolCallId,...typeof $.nodeId==="string"&&$.nodeId.length>0?{nodeId:$.nodeId}:{},title:$.title,html:$.html,toolInput:$.toolInput,serverName:$.serverName,toolName:$.toolName,appSessionId:$.appSessionId,resourceUri:$.resourceUri,toolDefinition:$.toolDefinition,resourceMeta:$.resourceMeta,hostMode:"hosted",trustedDomain:!0,...$.chartConfig?{chartConfig:$.chartConfig}:{},...typeof $.x==="number"&&{_x:$.x},...typeof $.y==="number"&&{_y:$.y},...typeof $.width==="number"&&{_width:$.width},...typeof $.height==="number"&&{_height:$.height}})}function JA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=qP($)??XP($.serverName,$.toolName);if(!v)return;if(T.value.has(v))v$(v,{html:$.html})}function bA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=qP($)??XP($.serverName,$.toolName);if(!v)return;if(T.value.has(v)){if($.success===!1){S4(v);return}v$(v,{toolResult:X3({result:$.result,success:typeof $.success==="boolean"?$.success:void 0,error:typeof $.error==="string"?$.error:void 0,content:typeof $.content==="string"?$.content:void 0,detailedContent:typeof $.detailedContent==="string"?$.detailedContent:void 0})})}}function GA($){n6(),v$("status-main",{subagent:{state:$.state,name:$.agentDisplayName??$.agentName}})}function OA($){let v=$.nodeId;if(!v)return;let g=$.text||"",_=$.position,U=$.parentNodeId,z=$.contextNodeIds;if($.threadNodeId&&T.value.has($.threadNodeId)){let J=$.threadNodeId,b=T.value.get(J);if(!b)return;let O=Array.isArray(b.data.turns)?[...b.data.turns]:[],K=O[O.length-1];if(!K||K.role!=="user"||K.text!==g)O.push({role:"user",text:g,status:"pending"});v$(J,{turns:O,threadStatus:"pending"});return}if(!T.value.has(v)){let J=_??x6.prompt;_6(z2(pg(v,"prompt",{text:g,turns:g?[{role:"user",text:g,status:"pending"}]:[],threadStatus:g?"pending":"draft",status:g?"pending":"draft",parentNodeId:U,contextNodeIds:z},{position:{x:J.x,y:J.y}}))),Lv(v)}if(U&&T.value.has(U))R_({id:`edge-${U}-${v}`,from:U,to:v,type:"flow",style:"dashed"})}function KA($){let{nodeId:v,status:g}=$;if(v&&T.value.has(v))v$(v,{status:g})}function WA($){let{responseNodeId:v,promptNodeId:g}=$;if(!v)return;let _=g?T.value.get(g):void 0;if(_&&Array.isArray(_.data.turns)){rU.set(v,g);let z=[..._.data.turns];z.push({role:"assistant",text:"",status:"streaming"}),v$(g,{turns:z,threadStatus:"streaming",_activeResponseId:v}),Lv(g);return}let U=_?{x:_.position.x,y:_.position.y+_.size.height+24}:{x:x6.response.x,y:x6.response.y};if(!T.value.has(v))_6(z2(pg(v,"response",{content:"",status:"streaming",promptNodeId:g},{position:U})));if(g)R_({id:`edge-${g}-${v}`,from:g,to:v,type:"flow",animated:!0});Lv(v)}function BA($){let v=$.responseNodeId;if(!v)return;let g=rU.get(v);if(g){let _=T.value.get(g);if(_&&Array.isArray(_.data.turns)){let U=[..._.data.turns],z=U[U.length-1];if(z&&z.role==="assistant")z.text=$.content,z.status="streaming";v$(g,{turns:U,threadStatus:"streaming"})}return}if(!T.value.has(v))return;v$(v,{content:$.content,status:"streaming"})}function PA($){let v=$.responseNodeId;if(!v)return;let g=rU.get(v);if(g){let z=T.value.get(g);if(z&&Array.isArray(z.data.turns)){let J=[...z.data.turns],b=J[J.length-1];if(b&&b.role==="assistant")b.text=$.content,b.status="complete";v$(g,{turns:J,threadStatus:"answered",_activeResponseId:void 0})}rU.delete(v);return}if(!T.value.has(v))return;v$(v,{content:$.content,status:"complete"});let U=T.value.get(v)?.data.promptNodeId;if(U){let z=`edge-${U}-${v}`,J=c$.value.get(z);if(J)OK(z),R_({...J,animated:!1})}}function kA($){let v=$.layout;if(!v?.nodes)return;let g=!F6.value;F6.value=!0;let _=v.nodes.map(iF).filter((b)=>b!==null),U=Array.isArray(v.edges)?v.edges.map(lF).filter((b)=>b!==null):Array.from(c$.value.values()),z=Array.isArray(v.annotations)?v.annotations.map(xF).filter((b)=>b!==null):void 0,J=v.viewport?{x:typeof v.viewport.x==="number"?v.viewport.x:0,y:typeof v.viewport.y==="number"?v.viewport.y:0,scale:typeof v.viewport.scale==="number"?v.viewport.scale:1}:void 0;u4(),IK({...J?{viewport:J}:{},nodes:_,edges:U,...z?{annotations:z}:{}},{applyViewport:g}),E2({event:"canvas-layout-update",data:$})}function HA($){if($<=1)return 500;if($===2)return 1000;return Math.min(2500,1500+($-3)*500)}function IA($){let v=$.nodeId;if(v&&T.value.has(v)){if($.noPan===!0){M6(v);return}Lv(v)}}function YA($){let v=$.viewport;if(!v)return;let g=typeof v.x==="number"?v.x:0,_=typeof v.y==="number"?v.y:0,U=typeof v.scale==="number"?v.scale:1;u4(),PK({x:g,y:_,scale:U})}function LA($){if(T.value.get("context-main"))v$("context-main",{currentTokens:$.currentTokens,tokenLimit:$.tokenLimit,messagesLength:$.messagesLength,utilization:$.utilization,nearLimit:$.nearLimit})}function qA($){u_.value=$.enabled===!0}function XA($){if(typeof $.theme==="string")FP($.theme)}function wA($){let v=Array.isArray($.nodeIds)?$.nodeIds.filter((g)=>typeof g==="string"):[];bK(v),E2({event:"context-pins-changed",data:$})}var g2=null;function YP(){if(g2)clearTimeout(g2);g2=setTimeout(()=>{g2=null,xO().then(($)=>{A6.value=$})},150)}function FA($){let v=$.intent;if(!v||typeof v.id!=="string"||typeof v.kind!=="string"||typeof v.expiresAt!=="number")return;OB(v)}function AA($){let v=typeof $.id==="string"?$.id:"";if(!v)return;if($.settled===!0)WB(v,typeof $.nodeId==="string"?$.nodeId:void 0);else D3(v)}var ZP={connected:hF,"workbench-open":pF,"canvas-status":oF,"execution-phase":nF,"context-cards":tF,"mcp-app-candidate":dF,"mcp-app-host-snapshot":aF,"mcp-app-host-fallback":sF,"aux-open":eF,"aux-close":$A,"assistant-complete":vA,"tool-start":UA,"tool-complete":gA,"review-state":_A,"subagent-status":GA,"ext-app-open":zA,"ext-app-update":JA,"ext-app-result":bA,"context-pins-changed":wA,"canvas-layout-update":kA,"canvas-focus-node":IA,"canvas-viewport-update":YA,"context-usage":LA,"trace-state":qA,"theme-changed":XA,"canvas-prompt-created":OA,"canvas-prompt-status":KA,"canvas-response-start":WA,"canvas-response-delta":BA,"canvas-response-complete":PA,"ax-state-changed":YP,"ax-event-created":YP,"ax-intent":FA,"ax-intent-clear":AA};function MP($,v){let g=ZP[$];if(!g)return;let _=g;try{_(v)}catch(U){console.warn(`[sse-bridge] Handler for "${$}" failed:`,U)}}function LP(){og=!0,o6+=1;let $=o6;lv.value="connecting";let v=null,g=!1,_=async()=>{if($!==o6)return;try{let U=new URLSearchParams;if(NU!==null)U.set("since",String(NU));let z=$4.value;if(z)U.set("session",z);let J=U.toString(),b=await fetch(`/api/workbench/poll${J?`?${J}`:""}`);if($!==o6)return;if(!b.ok)throw Error(`poll failed with HTTP ${b.status}`);let O=await b.json();if($!==o6)return;if(!O.ok)throw Error("poll returned ok: false");let K=v;if(v=O.sessionId??null,K!==null&&O.sessionId&&K!==O.sessionId&&!O.snapshot){NU=null,P6=setTimeout(()=>void _(),0);return}if(O.snapshot&&g)_2=D2(),n6(),F6.value=!1,c2(),R3(),rU.clear();for(let W of O.events)MP(W.event,W.payload);g=!0,NU=O.seq,lv.value="connected",P6=setTimeout(()=>void _(),uF)}catch(U){if($!==o6)return;console.warn("[sse-bridge] poll transport error:",U),lv.value="disconnected",P6=setTimeout(()=>void _(),yF)}};return _(),()=>{if(o6+=1,og=!1,NU=null,P6)clearTimeout(P6),P6=null}}function o3(){if(_2=D2(),n6(),F6.value=!1,c2(),R3(),rU.clear(),h6)clearTimeout(h6),h6=null;let $=DF();if($==="poll"||og)return LP();let v=$4.value,g=v?`/api/workbench/events?session=${v}`:"/api/workbench/events";lv.value="connecting";let _=new EventSource(g);k4=_;let U=!1;if(p6)clearTimeout(p6);if(p6=null,$!=="sse")p6=setTimeout(()=>{if(p6=null,U||k4!==_)return;console.warn("[sse-bridge] No SSE event within watchdog window — switching to polling transport."),_.close(),k4=null,LP()},rF);for(let[z]of Object.entries(ZP))_.addEventListener(z,(J)=>{U=!0;try{MP(z,JSON.parse(J.data))}catch(b){console.warn(`[sse-bridge] Failed to parse "${z}" event:`,b)}});return _.onopen=()=>{if(k4!==_)return;h3=0,lv.value="connected"},_.onerror=()=>{if(k4!==_)return;lv.value="disconnected",_.close(),k4=null,h3+=1,h6=setTimeout(()=>{h6=null,o3()},HA(h3))},()=>{if(h6)clearTimeout(h6),h6=null;if(p6)clearTimeout(p6),p6=null;if(og){if(o6+=1,og=!1,NU=null,P6)clearTimeout(P6),P6=null}_.close(),k4=null}}function ZA($,v){console.error(`[app] ${$} failed`,v)}function QP($,v={}){fetch(`/api/workbench/intent?_ts=${Date.now()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})}).catch((g)=>{ZA("sendIntent",g)})}function Jv({label:$,detail:v,shortcut:g,align:_="center",children:U}){return G("span",{class:`toolbar-tooltip-anchor toolbar-tooltip-anchor-${_}`,children:[U,G("span",{class:"toolbar-tooltip",role:"tooltip",children:[G("span",{class:"toolbar-tooltip-label",children:$},void 0,!1,void 0,this),(v||g)&&G("span",{class:"toolbar-tooltip-meta",children:[v&&G("span",{children:v},void 0,!1,void 0,this),g&&G("kbd",{class:"toolbar-tooltip-shortcut",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function MA({minimapVisible:$,onToggleMinimap:v,snapshotOpen:g,onToggleSnapshot:_,snapshotBtnRef:U,onOpenPalette:z,onOpenShortcuts:J,annotationTool:b,onToggleAnnotationMode:O,onToggleAnnotationEraser:K,onToggleTextAnnotation:W}){let B=lv.value,k=F6.value,P=P$.value,X=T.value.size,Y=c$.value.size,H=u_.value,L=Array.from(T.value.values()).filter((C)=>C.type==="trace").length,q=B==="connected"&&!k?"syncing":B,F=q.charAt(0).toUpperCase()+q.slice(1),N=k?[`${X} node${X!==1?"s":""}`,...Y>0?[`${Y} edge${Y!==1?"s":""}`]:[],...L>0?[`${L} trace${L!==1?"s":""}`]:H?["trace armed"]:[]].join(" · "):"Syncing canvas…";return G("div",{class:"toolbar-group",children:[G("div",{class:"canvas-toolbar",children:[G(Jv,{label:"PMX Canvas",detail:"Focus Field · spatial workbench for coding agents",align:"start",children:G("span",{class:"canvas-brand","aria-label":"PMX Canvas",children:G(uB,{size:22},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Canvas status",detail:k?F:"Syncing canvas from server",align:"start",children:G("span",{class:`connection-dot ${B}`,"aria-label":`Canvas status: ${q}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"11px",color:"var(--c-muted)"},children:$4.value?$4.value.slice(0,12):"…"},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Fit canvas",detail:"Frame every node on screen",children:G("button",{type:"button",onClick:()=>j_(window.innerWidth,window.innerHeight),"aria-label":"Fit canvas",children:G(kB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Reset view",shortcut:`${Qv}+0`,children:G("button",{type:"button",onClick:()=>xv({x:0,y:0,scale:1},250),"aria-label":"Reset view",children:G(HB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Zoom in",shortcut:`${Qv}++`,children:G("button",{type:"button",onClick:()=>xv({...P,scale:Math.min(4,P.scale*1.25)},150),"aria-label":"Zoom in",children:G(IB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Zoom out",shortcut:`${Qv}+-`,children:G("button",{type:"button",onClick:()=>xv({...P,scale:Math.max(0.1,P.scale/1.25)},150),"aria-label":"Zoom out",children:G(YB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)",minWidth:"36px",textAlign:"center"},children:[Math.round(P.scale*100),"%"]},void 0,!0,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Arrange layout",detail:Y>0?"Graph-aware layout for connected nodes":"Grid layout for loose nodes",children:G("button",{type:"button",onClick:()=>Y>0?C_():V_(),"aria-label":"Arrange layout",children:G(LB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:$?"Hide minimap":"Show minimap",detail:"Quickly navigate large canvases",children:G("button",{type:"button",onClick:v,"aria-label":$?"Hide minimap":"Show minimap",style:{color:$?"var(--c-accent)":void 0},children:G(qB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:`Switch to ${T$.value==="dark"?"light":"dark"} theme`,detail:`Current theme: ${T$.value}`,children:G("button",{type:"button",onClick:()=>{let C=T$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",C),qU(),T$.value=C,Z_(C)},"aria-label":`Switch to ${T$.value==="dark"?"light":"dark"} theme`,children:T$.value==="dark"?G(XB,{},void 0,!1,void 0,this):G(wB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Snapshots",detail:"Capture and restore canvas states",align:"end",children:G("button",{ref:U,type:"button",onClick:_,"aria-label":"Snapshots",style:{color:g?"var(--c-accent)":void 0},children:G(MB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"canvas-toolbar",children:[G(Jv,{label:H?"Disable trace":"Enable trace",detail:H?"Stop collecting new trace nodes":"Capture agent execution on the canvas",children:G("button",{type:"button",onClick:()=>QP("trace-toggle",{enabled:!H}),"aria-label":H?"Disable trace":"Enable trace",style:{color:H?"var(--c-purple)":void 0},children:G(QB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),(H||L>0)&&G(Jv,{label:"Clear trace",detail:L>0?`Remove ${L} trace node${L===1?"":"s"}`:"Trace is enabled but still empty",children:G("button",{type:"button",onClick:()=>QP("trace-clear"),"aria-label":"Clear trace",children:G(SB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:b==="pen"?"Stop annotating":"Annotate canvas",detail:"Draw directly on the canvas for human-visible markup",children:G("button",{type:"button",onClick:O,"aria-label":b==="pen"?"Stop annotating":"Annotate canvas","aria-pressed":b==="pen",style:{color:b==="pen"?"var(--c-accent)":void 0},children:G(FB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:b==="eraser"?"Stop erasing":"Erase annotations",detail:"Click a drawn annotation to remove it",children:G("button",{type:"button",onClick:K,"aria-label":b==="eraser"?"Stop erasing":"Erase annotations","aria-pressed":b==="eraser",style:{color:b==="eraser"?"var(--c-accent)":void 0},children:G(AB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:b==="text"?"Stop text annotations":"Text annotations",detail:"Click anywhere to type an intent note",children:G("button",{type:"button",onClick:W,"aria-label":b==="text"?"Stop text annotations":"Text annotations","aria-pressed":b==="text",style:{color:b==="text"?"var(--c-accent)":void 0},children:G(ZB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("div",{class:"separator"},void 0,!1,void 0,this),G(Jv,{label:"Search nodes and actions",shortcut:`${Qv}+K`,children:G("button",{type:"button",onClick:z,"aria-label":"Search nodes and actions",children:G(NB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Keyboard shortcuts",shortcut:"?",align:"end",children:G("button",{type:"button",onClick:J,"aria-label":"Keyboard shortcuts",children:G(rB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)"},children:N},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function QA({onOpenPalette:$}){return G("div",{class:"welcome-card",children:[G("div",{class:"welcome-icon",children:"◇"},void 0,!1,void 0,this),G("div",{class:"welcome-title",children:"Shape What The Agent Sees"},void 0,!1,void 0,this),G("div",{class:"welcome-subtitle",children:"Lay out notes, files, and evidence. Bring related nodes together. Pin what matters. The board will reflect the active focus."},void 0,!1,void 0,this),G("div",{class:"welcome-hints",children:[G("button",{type:"button",class:"welcome-hint",onClick:$,children:[G("kbd",{children:[Qv,"+K"]},void 0,!0,void 0,this),G("span",{children:"Create a note"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"Drop files"},void 0,!1,void 0,this),G("span",{children:"Add evidence to the board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"✦"},void 0,!1,void 0,this),G("span",{children:"Pin important nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-hint",children:[G("kbd",{children:"Move nearby"},void 0,!1,void 0,this),G("span",{children:"Shape the focus field"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),G("div",{class:"welcome-footer",children:"The canvas is a shared attention surface, not just an editor."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SP(){let[$,v]=o(!0),[g,_]=o(!1),[U,z]=o(!1),[J,b]=o(!1),[O,K]=o(null),W=y(null),{menu:B,openNodeMenu:k,openCanvasMenu:P,closeMenu:X}=UP(),Y=F6.value,H=Q(()=>v((u)=>!u),[]),L=Q(()=>_((u)=>!u),[]),q=Q(()=>_(!1),[]),F=Q(()=>K((u)=>u==="pen"?null:"pen"),[]),N=Q(()=>K((u)=>u==="eraser"?null:"eraser"),[]),C=Q(()=>K((u)=>u==="text"?null:"text"),[]),p=Q((u,S)=>{xv({x:u,y:S,scale:P$.value.scale},200)},[]);m(()=>{return o3()},[]),m(()=>{let u=(S)=>{let U$=S.metaKey||S.ctrlKey;if(U$&&S.key==="k"){S.preventDefault(),z((i)=>!i);return}if(S.key==="Escape"&&O){S.preventDefault(),K(null);return}if(S.key==="Escape"&&j$.value&&!iv.value){S.preventDefault(),v4();return}if(S.key==="Escape"&&U){S.preventDefault(),z(!1);return}if(S.key==="Escape"&&J){S.preventDefault(),b(!1);return}let c=S.target?.tagName;if(c==="INPUT"||c==="TEXTAREA")return;if(S.key==="?"||S.key==="/"&&S.shiftKey){S.preventDefault(),b((i)=>!i);return}if(U$&&S.key==="0")S.preventDefault(),xv({x:0,y:0,scale:1},250);else if(U$&&(S.key==="="||S.key==="+")){S.preventDefault();let i=P$.value;xv({...i,scale:Math.min(4,i.scale*1.25)},150)}else if(U$&&S.key==="-"){S.preventDefault();let i=P$.value;xv({...i,scale:Math.max(0.1,i.scale/1.25)},150)}else if(S.key==="Escape"){if(i$.value.size>0){jv();return}D$.value=null,X()}else if(S.key==="Tab")S.preventDefault(),LK(S.shiftKey?-1:1);else if(D$.value&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(S.key)){S.preventDefault();let i=S.key.replace("Arrow","").toLowerCase();qK(i)}};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[O,X,U,J]),m(()=>{if(!Y)return;let u=window.__pmxCanvasBootstrapReady;if(typeof u==="function")u()},[Y]);let r=Array.from(T.value.values()),n=r.filter((u)=>u.dockPosition==="left"),e=r.filter((u)=>u.dockPosition==="right").sort((u,S)=>{let U$={context:0,ledger:1};return(U$[u.type]??2)-(U$[S.type]??2)});return G("div",{style:{width:"100%",height:"100%",position:"relative"},children:[G("div",{class:"hud-layer",children:[G("div",{class:"hud-left",children:n.map((u)=>G(x3,{node:u},u.id,!1,void 0,this))},void 0,!1,void 0,this),G(MA,{minimapVisible:$,onToggleMinimap:H,snapshotOpen:g,onToggleSnapshot:L,snapshotBtnRef:W,onOpenPalette:()=>z(!0),onOpenShortcuts:()=>b((u)=>!u),annotationTool:O,onToggleAnnotationMode:F,onToggleAnnotationEraser:N,onToggleTextAnnotation:C},void 0,!1,void 0,this),G("div",{class:"hud-right",children:e.map((u)=>G(x3,{node:u},u.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(wK,{},void 0,!1,void 0,this),G(XK,{},void 0,!1,void 0,this),G($P,{onNodeContextMenu:k,onCanvasContextMenu:P,annotationMode:O!==null,annotationTool:O},void 0,!1,void 0,this),Y&&r.filter((u)=>!u.dockPosition).length===0&&Yv.value.size===0&&G(QA,{onOpenPalette:()=>z(!0)},void 0,!1,void 0,this),i$.value.size>0&&G(PP,{},void 0,!1,void 0,this),R$.value.size>0&&G(zP,{},void 0,!1,void 0,this),j$.value&&G(KP,{},void 0,!1,void 0,this),G(HP,{open:g,onClose:q,anchorRef:W},void 0,!1,void 0,this),$&&G(BP,{viewport:P$,nodes:T,edges:c$,onNavigate:p,containerWidth:window.innerWidth,containerHeight:window.innerHeight},void 0,!1,void 0,this),B&&G(gP,{menu:B,onClose:X},void 0,!1,void 0,this),U&&G(vP,{onClose:()=>z(!1),onToggleMinimap:H},void 0,!1,void 0,this),J&&G(kP,{onClose:()=>b(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var NP=document.getElementById("app");if(NP)WO(G(SP,{},void 0,!1,void 0,this),NP);
225
+ </script>`}function BF($,v){return`<script data-pmx-canvas-boot-beacon>
226
+ window.parent.postMessage({ source: '${Wz}', token: ${JSON.stringify($)}, nodeId: ${JSON.stringify(v)} }, '*');
227
+ </script>`}function UB(){return"<style data-pmx-canvas-ext-app-base>html, body { background: transparent !important; }</style>"}function gB($,v){if(!v)return $;let g=/<head\b[^>]*>/i.exec($);if(g?.index!==void 0){let U=g.index+g[0].length;return`${$.slice(0,U)}${v}${$.slice(U)}`}let _=/<body\b[^>]*>/i.exec($);if(_?.index!==void 0){let U=_.index+_[0].length;return`${$.slice(0,U)}${v}${$.slice(U)}`}return`${v}${$}`}function XU($,v){if(Number.isFinite($)&&$>0)return Math.round($);if(Number.isFinite(v)&&v>0)return Math.round(v);return 1}function Rb($,v){let g=$?.getBoundingClientRect();return{width:XU($?.clientWidth??0,XU(g?.width??0,v.width)),height:XU($?.clientHeight??0,XU(g?.height??0,v.height))}}function PF($,v){return typeof $==="number"&&Number.isFinite($)&&$>0&&!v}function kF($,v){return Math.max(XU($,1),XU(v,1))}function zB({node:$,expanded:v=!1}){let g=R(null),_=R(null),U=R(null),z=R(null),J=R({}),G=R(void 0),K=R(!1),O=R(void 0),W=R(null),B=R(!1),k=R(null),P=R(!1),X=R(0),L=R(!1),Y=R(!1),I=R([]),q=R(!1),w=R(!1),S=R(!1),[C,o]=h("loading"),[y,n]=h(null),[e,D]=h(0),N=$.data.html,U$=$.data.serverName,m=$.data.appSessionId,i=$.data.toolInput??{},H$=$.data.toolResult,q$=$.data.toolName??"ext-app",l$=$.data.toolDefinition,Q=$.data.toolCallId,p=typeof Q==="string"||typeof Q==="number"?Q:void 0,s=$.data.resourceMeta,d=$.data.sessionStatus,b$=$.data.sessionError,g$=$.size.height,x=$.id,f=bF($,e),a=H$!=null,O$=OF(null),V$=$.data.axCapabilities?.enabled===!0&&typeof N==="string"&&N.length>0,C$=t$(()=>`ax-${crypto.randomUUID()}`,[]),Wv=V$?WF(C$,x):"",Bv=typeof N==="string"&&N.length>0?BF(C$,x):"",Y6=sW(gB(N??"",UB()+Bv+Wv),O$);E(()=>{function B$(S$){if(S$.source!==g.current?.contentWindow)return;let p$=S$.data;if(!p$||p$.source!==Wz||p$.token!==C$||p$.nodeId!==x)return;Y.current=!0}return window.addEventListener("message",B$),()=>window.removeEventListener("message",B$)},[C$,x]),qU({enabled:V$,token:C$,nodeId:x,sourceSurface:"mcp-app",iframeRef:g});let eg=3,H6=(B$)=>{if(X.current>=eg){x6(x,`remount-cap-hit (${B$})`);return}if(q.current)return;X.current+=1,q.current=!0,x6(x,`remount-queued #${X.current} (${B$})`),JF({remount:()=>{if(q.current=!1,S.current||r$.value===x)return x6(x,"remount-skipped"),!1;return w.current=typeof document<"u"&&document.visibilityState==="hidden",x6(x,`remount-run #${X.current}`),o("loading"),D((S$)=>S$+1),!0},awaitBoot:()=>new Promise((S$)=>{let p$=window.setTimeout(n$,_F);function n$(){window.clearTimeout(p$),S$()}I.current.push(n$)})})};E(()=>{if(v||P.current)return;if(!GF(C,a))return;if(typeof navigator>"u"||typeof window>"u")return;if(!a0(navigator.userAgent))return;P.current=!0,H6("post-boot-repaint")},[C,a]),E(()=>{if(v)return;if(typeof document>"u"||typeof navigator>"u"||typeof window>"u")return;if(!a0(navigator.userAgent))return;function B$(){if(document.visibilityState!=="visible")return;if(!w.current||S.current)return;w.current=!1,X.current=0,x6(x,"visible-again-rearm"),H6("visible-after-hidden-boot")}return document.addEventListener("visibilitychange",B$),()=>document.removeEventListener("visibilitychange",B$)},[v,x]);let $_=6000;E(()=>{if(v)return;if(typeof navigator>"u"||typeof window>"u")return;if(!a0(navigator.userAgent))return;if(!Y6.ready)return;let B$=window.setTimeout(()=>{if(L.current||Y.current||S.current)return;H6("boot-watchdog")},$_);return()=>window.clearTimeout(B$)},[f,Y6.ready,v]),E(()=>()=>{S.current=!0;for(let B$ of I.current.splice(0))B$()},[]);let sv=(B$)=>B$==="light"?"light":"dark",Av=v||r$.value===x;J.current=i,G.current=H$;let uU=d==="error"?b$??"Saved app session is unavailable. Reopen the app to restore interactivity.":"Reconnecting saved app session...",P2=(B$)=>{let S$=G.current;if(!B$||!B.current||!S$)return null;if(O.current===S$)return null;if(O.current&&nW(O.current,S$))return O.current=S$,null;if(W.current)return W.current;let p$=B$.sendToolResult(S$).then(()=>{O.current=S$,K.current=!0,o("done")}).catch((n$)=>{let d6=n$ instanceof Error?n$.message:String(n$);throw n(`Tool result delivery failed: ${d6}`),n$}).finally(()=>{W.current=null});return W.current=p$,p$};if(E(()=>{if(!N||!Y6.ready)return;let B$=g.current;if(!B$)return;let S$=!1,p$=null,n$=null,d6=null,H4=null,a6=null;K.current=!1,O.current=void 0,W.current=null,B.current=!1,L.current=!1,Y.current=!1;let v_=()=>{if(!p$)return;clearTimeout(p$),p$=null};return(async()=>{if(!N)return;let L6=B$.contentWindow;if(!L6)throw Error("Ext-app iframe window is unavailable");let s6=(K$=r$.value===x?"fullscreen":"inline")=>({theme:sv(j$.value),platform:"web",containerDimensions:Rb(B$,{width:$.size.width,height:g$}),displayMode:K$,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,...l$?{toolInfo:{id:p,tool:l$}}:{}}),CP=()=>{if(H4!==null)return;H4=requestAnimationFrame(()=>{if(H4=null,S$||!B.current)return;D$.setHostContext?.(s6())})},$K=()=>{if(a6!==null)return;a6=requestAnimationFrame(()=>{a6=requestAnimationFrame(()=>{if(a6=null,S$||!B.current)return;D$.sendHostContextChange?.(s6())})})},vK=()=>{if(!a0(navigator.userAgent))return;if(n$)clearTimeout(n$);n$=setTimeout(()=>{n$=null;let K$=g.current;if(S$||!K$)return;let s$=K$.style.height;K$.style.height="calc(100% - 1px)",requestAnimationFrame(()=>{requestAnimationFrame(()=>{K$.style.height=s$,x6(x,"repaint-nudge")})})},_B+200)},D$=new Qb(null,{name:"PMX Canvas",version:"1.0.0"},{openLinks:{},serverTools:{listChanged:!1},serverResources:{listChanged:!1},logging:{},updateModelContext:{text:{},structuredContent:{}}},{hostContext:s6(Av?"fullscreen":"inline")});D$.onsizechange=async({height:K$})=>{if(PF(K$,r$.value===x)){let s$=Rb(B$.parentElement??B$,{width:$.size.width,height:g$}),mv=kF(K$,s$.height);B$.style.height=`${mv}px`;let e6=j.value.get(x)?.size??$.size,gK=Math.max(e6.height,mv+A5);if(Math.abs(gK-e6.height)>8){if(D4(x,{width:e6.width,height:gK}),z.current!==null)window.clearTimeout(z.current);z.current=window.setTimeout(()=>{d$({recordHistory:!1}),z.current=null},0)}}return{}},D$.onopenlink=async({url:K$})=>{return window.open(K$,"_blank","noopener"),{}},D$.onsandboxready=async()=>{await D$.sendSandboxResourceReady({html:gB(N,UB()),sandbox:Nb,...s?.csp?{csp:s.csp}:{},...s?.permissions?{permissions:s.permissions}:{}})},D$.onrequestdisplaymode=async({mode:K$})=>{let{nextMode:s$,shouldExpand:mv,shouldCollapse:e6}=KF(K$,Av);if(mv)z6(x);else if(e6)g4();return{mode:s$}},D$.oncalltool=async(K$)=>{if(!m)throw Error(uU);try{let s$=await P4("/api/ext-app/call-tool",{sessionId:m,nodeId:x,serverName:U$,toolName:K$.name,arguments:K$.arguments??{}});return n(null),s$}catch(s$){let mv=s$ instanceof Error?s$.message:String(s$);throw n(`Tool call failed: ${mv}`),s$}},D$.setRequestHandler(Eg,async()=>{if(!m)return{tools:[]};return P4("/api/ext-app/list-tools",{sessionId:m})}),D$.onlistresources=async()=>m?P4("/api/ext-app/list-resources",{sessionId:m}):{resources:[]},D$.onlistresourcetemplates=async()=>m?P4("/api/ext-app/list-resource-templates",{sessionId:m}):{resourceTemplates:[]},D$.onreadresource=async(K$)=>{if(!m)throw Error(uU);return P4("/api/ext-app/read-resource",{sessionId:m,uri:K$.uri})},D$.onlistprompts=async()=>m?P4("/api/ext-app/list-prompts",{sessionId:m}):{prompts:[]},D$.onupdatemodelcontext=async(K$)=>{if(!m)return{};return await P4("/api/ext-app/model-context",{nodeId:x,...Array.isArray(K$.content)?{content:K$.content}:{},...K$.structuredContent&&typeof K$.structuredContent==="object"?{structuredContent:K$.structuredContent}:{}}),{}};let k2=new p0(L6,L6);if(D$.oninitialized=()=>{if(S$)return;v_(),B.current=!0,L.current=!0,x6(x,"initialized"),o("ready"),n(null),Promise.resolve(D$.sendHostContextChange(s6(Av?"fullscreen":"inline"))).then(()=>vB(D$,J.current,void 0)).then(()=>P2(D$)).then(()=>{x6(x,"settled");for(let K$ of I.current.splice(0))K$();$K(),vK()}).catch((K$)=>{let s$=K$ instanceof Error?K$.message:String(K$);n(`Bridge bootstrap failed: ${s$}`)})},p$=setTimeout(()=>{if(S$||B.current)return;let K$=G.current,s$=s6(Av?"fullscreen":"inline");B.current=!0,D$.setHostContext?.(s$),Promise.resolve(D$.sendHostContextChange(s$)).then(()=>vB(D$,J.current,K$)).then(()=>{if(K.current=Boolean(K$),K$)O.current=K$;o(K$?"done":"ready"),n(null),$K(),vK()}).catch((mv)=>{let e6=mv instanceof Error?mv.message:String(mv);n(`Bridge bootstrap fallback failed: ${e6}`)})},1200),await D$.connect(k2),S$){v_(),await k2.close();return}if(_.current=D$,U.current=k2,d6=new ResizeObserver(CP),d6.observe(B$),B$.parentElement)d6.observe(B$.parentElement);let UK=!0;k.current=j$.subscribe((K$)=>{if(UK){UK=!1;return}if(S$)return;D$.setHostContext?.({...s6(),theme:sv(K$)}),D$.sendHostContextChange?.(s6())}),P2(D$)})().catch((L6)=>{v_(),console.error("[ext-app] Bridge init failed:",L6),n(L6?.message??"Bridge initialization failed")}),()=>{if(S$=!0,v_(),n$)clearTimeout(n$),n$=null;if(d6?.disconnect(),d6=null,H4!==null)cancelAnimationFrame(H4),H4=null;if(a6!==null)cancelAnimationFrame(a6),a6=null;if(B.current=!1,W.current=null,k.current?.(),k.current=null,z.current!==null)window.clearTimeout(z.current),z.current=null;if(_.current=null,U.current)U.current.close().catch((L6)=>{console.error("[ext-app] transport close failed:",L6)}),U.current=null}},[f,Y6.key]),E(()=>{if(H$&&_.current&&(C==="ready"||C==="done"))P2(_.current)},[H$,C]),E(()=>{let B$=_.current;if(g.current)g.current.style.height="100%";if(!B$||!B.current)return;let S$=null,p$=null;return S$=requestAnimationFrame(()=>{S$=null,p$=requestAnimationFrame(()=>{if(p$=null,!B.current)return;let n$={theme:sv(j$.value),platform:"web",containerDimensions:Rb(g.current,{width:$.size.width,height:g$}),displayMode:Av?"fullscreen":"inline",locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone};B$.setHostContext?.(n$),B$.sendHostContextChange?.(n$)})}),()=>{if(S$!==null)cancelAnimationFrame(S$);if(p$!==null)cancelAnimationFrame(p$)}},[Av,g$]),!N)return b("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--c-muted)",fontSize:"13px",flexDirection:"column",gap:"8px"},children:[b("div",{style:{opacity:0.6},children:["Loading ",q$," viewer..."]},void 0,!0,void 0,this),b("div",{style:{width:"24px",height:"24px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),b("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return b("div",{style:{flex:1,width:"100%",height:"100%",minWidth:0,minHeight:0,display:"flex",flexDirection:"column"},children:[d&&d!=="ready"&&b("div",{style:{padding:"6px 10px",fontSize:"11px",background:d==="error"?"var(--c-danger-12)":"var(--c-warn-10)",color:d==="error"?"var(--c-danger)":"var(--c-warn)",borderBottom:`1px solid ${d==="error"?"var(--c-danger-12)":"var(--c-warn-15)"}`},children:uU},void 0,!1,void 0,this),y&&b("div",{style:{padding:"6px 10px",fontSize:"11px",background:"var(--c-danger-12)",color:"var(--c-danger)",borderBottom:"1px solid var(--c-danger-12)",display:"flex",alignItems:"center",gap:"6px"},children:[b("span",{children:"⚠"},void 0,!1,void 0,this),b("span",{style:{flex:1},children:y},void 0,!1,void 0,this),b("button",{type:"button",onClick:()=>{n(null),o("loading"),D((B$)=>B$+1)},style:{background:"var(--c-surface-hover)",border:"1px solid var(--c-danger-12)",borderRadius:"3px",color:"var(--c-danger)",cursor:"pointer",fontSize:"10px",padding:"1px 6px"},children:"Retry"},void 0,!1,void 0,this),b("button",{type:"button",onClick:()=>n(null),style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{style:{flex:1,position:"relative",display:"flex",minHeight:0,height:"100%"},children:[b("iframe",{ref:g,...Y6.attributes,sandbox:O$,allow:oW(s?.permissions),style:{flex:1,width:"100%",height:"100%",minHeight:0,border:"none",background:"var(--c-panel)",pointerEvents:Av&&C!=="loading"?"auto":"none"},title:`Ext App: ${q$}`},f,!1,void 0,this),C==="loading"&&!y&&b("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"10px",background:"var(--c-panel)",color:"var(--c-muted)",fontSize:"12px",pointerEvents:"none"},children:[b("div",{style:{width:"22px",height:"22px",border:"2px solid var(--c-line)",borderTopColor:"var(--c-muted)",borderRadius:"50%",animation:"spin 1s linear infinite"}},void 0,!1,void 0,this),b("div",{children:["Connecting to ",q$,"..."]},void 0,!0,void 0,this),b("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!Av&&b("button",{type:"button",onClick:(B$)=>{B$.stopPropagation(),z6(x)},class:"ext-app-preview-catcher",title:"Click to open",style:{position:"absolute",top:0,right:"56px",bottom:"56px",left:0,background:"transparent",border:"none",padding:0,margin:0,cursor:"zoom-in"},"aria-label":"Open full view to edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function s0($,v,g){let _=R($);_.current=$;let U=R(null);E(()=>{if(!g)return;function z(J){if(J.source!==v.current?.contentWindow)return;let G=J.data;if(!G||G.source!=="pmx-canvas-frame"||G.type!=="content-height"||G.token!==g)return;let K=_.current,O=typeof G.height==="number"?G.height:0,W=M5(K,O);if(W===null)return;if(D4(K.id,{width:K.size.width,height:W}),U.current!==null)window.clearTimeout(U.current);U.current=window.setTimeout(()=>{d$({recordHistory:!1}),U.current=null},300)}return window.addEventListener("message",z),()=>{if(window.removeEventListener("message",z),U.current!==null)window.clearTimeout(U.current),U.current=null}},[$.id,g])}function YF($){try{return new URL($,window.location.origin).origin===window.location.origin}catch{return!1}}function e0($){let v=W6.value,[g,_]=h(null),U=Boolean($)&&YF($),z=v==="srcdoc"&&U;if(E(()=>{if(!z)return;let J=!1;return fetch($,{credentials:"same-origin"}).then((G)=>G.ok?G.text():Promise.reject(Error(`HTTP ${G.status}`))).then((G)=>{if(!J)_({url:$,html:G})}).catch((G)=>{if(console.error("[surface-frame] srcdoc fetch failed, falling back to src:",$,G),!J)_({url:$,html:""})}),()=>{J=!0}},[z,$]),!$)return{};if(!z)return v===null&&U?{}:{src:$};if(g)return g.html?{srcdoc:g.html}:{src:g.url};return{}}function HF($,v,g,_,U,z,J){if(!$)return $;try{let G=new URL($,window.location.origin);if(G.searchParams.set("theme",j$.value==="light"?"light":"dark"),v)G.searchParams.set("display","expanded");if(typeof g==="number")G.searchParams.set("v",String(g));if(_)G.searchParams.set("axToken",_);if(U)G.searchParams.set("axNodeId",U);if(z)G.searchParams.set("frameToken",z);if(J)G.searchParams.set("fit","content");return G.toString()}catch{return $}}function LF($,v=window.location.origin){if(!$)return!1;try{let g=new URL(v).origin,_=new URL($,g);return _.origin===g&&_.pathname.startsWith("/api/canvas/frame-documents/")}catch{return!1}}function h6({node:$,expanded:v=!1}){if($.data.mode==="ext-app")return b(zB,{node:$,expanded:v},void 0,!1,void 0,this);return b(IF,{node:$,expanded:v},void 0,!1,void 0,this)}function IF({node:$,expanded:v}){let g=R(null),_=$.type==="mcp-app"&&$.data.viewerType==="web-artifact",U=$.type==="json-render"||$.type==="graph",z=$.data.axCapabilities?.enabled,G=(U||_)&&(_?z===!0:z!==!1),K=_?"mcp-app":"json-render",O=t$(()=>G?`ax-${crypto.randomUUID()}`:"",[G]),W=Pz($)&&!v,B=t$(()=>W?`frame-${crypto.randomUUID()}`:"",[W]);s0($,g,B),qU({enabled:G&&Boolean(O),token:O,nodeId:$.id,sourceSurface:K,iframeRef:g});let k=A6.value,P=()=>{if(!G||!O||k==null)return;g.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:O,state:k},"*")};E(P,[G,O,k]);let X=typeof $.data.specVersion==="number"?$.data.specVersion:void 0,L=HF($.data.url||"",v,X,O||void 0,G?$.id:void 0,B||void 0,W),Y=e0(L),I=$.data.sourceServer||"",q=$.data.hostMode||"hosted",w=$.data.fallbackReason,S=$.data.trustedDomain===!0||LF(L);if(q==="fallback")return b("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[b("div",{style:{color:"var(--c-warn)",display:"flex",alignItems:"center",gap:"6px"},children:[b("span",{children:"⚠"},void 0,!1,void 0,this),b("span",{children:"Cannot embed — opened externally"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w&&b("div",{style:{color:"var(--c-muted)",fontSize:"11px"},children:["Reason: ",w]},void 0,!0,void 0,this),b("a",{href:L,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all"},children:L},void 0,!1,void 0,this),I&&b("div",{style:{color:"var(--c-dim)",fontSize:"10px"},children:["Source: ",I]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return b("div",{style:{height:"100%",display:"flex",flexDirection:"column",...v?{flex:1,minHeight:0,width:"100%"}:{}},children:[!S&&b("div",{style:{padding:"4px 8px",fontSize:"10px",background:"var(--c-warn-10)",color:"var(--c-warn)",borderBottom:"1px solid var(--c-warn-15)"},children:"Unverified domain"},void 0,!1,void 0,this),b("iframe",{ref:g,...Y,class:"mcp-app-frame",sandbox:"allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",allow:"clipboard-read; clipboard-write",loading:"lazy",onLoad:P,style:{flex:1,minHeight:0,width:"100%"},title:`MCP App: ${I}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var hg=null;function a$($){return getComputedStyle(document.documentElement).getPropertyValue($).trim()}function $2(){if(hg)return hg;return hg={bg:a$("--c-bg"),panel:a$("--c-panel"),panelSoft:a$("--c-panel-soft"),line:a$("--c-line"),text:a$("--c-text"),textSoft:a$("--c-text-soft"),muted:a$("--c-muted"),dim:a$("--c-dim"),accent:a$("--c-accent"),ok:a$("--c-ok"),warn:a$("--c-warn"),warnAlt:a$("--c-warn-alt"),danger:a$("--c-danger"),purple:a$("--c-purple"),thinking:a$("--c-thinking"),subagent:a$("--c-subagent"),font:a$("--font"),mono:a$("--mono")},hg}function FU(){hg=null}var v2={idle:"var(--c-muted)",running:"var(--c-accent)",planning:"var(--c-thinking)",thinking:"var(--c-thinking)",drafting:"var(--c-accent)",tooling:"var(--c-accent)",review:"var(--c-ok)","waiting-approval":"var(--c-warn)",waiting:"var(--c-warn-alt)"};function ub($){let v=typeof $.data.phase==="string"&&$.data.phase.trim().length>0?$.data.phase.trim():"";if(v)return v;let g=typeof $.data.content==="string"&&$.data.content.trim().length>0?$.data.content.trim():"";if(g)return g;return(typeof $.data.status==="string"&&$.data.status.trim().length>0?$.data.status.trim():"")||"idle"}function wU({node:$}){let v=ub($),g=$.data.detail||"",_=$.data.message||"",U=$.data.level||"ok",z=$.data.activeTool,J=$.data.subagent,G=v2[v]??"var(--c-muted)",K=v!=="idle";return b("div",{style:{display:"flex",flexDirection:"column",gap:"8px",fontSize:"12px"},children:[b("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[b("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:G,boxShadow:K?`0 0 8px ${G}`:"none",animation:K?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),b("span",{style:{fontWeight:600,color:G,textTransform:"uppercase",letterSpacing:"0.05em"},children:v},void 0,!1,void 0,this),g&&b("span",{style:{color:"var(--c-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z&&b("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-warn)"},children:[b("span",{style:{fontSize:"10px"},children:"⚙"},void 0,!1,void 0,this),b("span",{style:{fontFamily:"var(--mono)",fontSize:"11px"},children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this),J&&J.state!=="completed"&&b("div",{style:{display:"flex",alignItems:"center",gap:"6px",color:"var(--c-subagent)"},children:[b("span",{style:{fontSize:"10px"},children:"⠉"},void 0,!1,void 0,this),b("span",{children:J.name},void 0,!1,void 0,this),b("span",{style:{color:"var(--c-muted)",fontSize:"10px"},children:["(",J.state,")"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),_&&b("div",{style:{color:U==="warn"?"var(--c-warn)":U==="error"?"var(--c-danger)":"var(--c-muted)",lineHeight:1.4},children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AU($){return typeof $==="string"&&$.trim().length>0?$.trim():null}function JB($){if(typeof $==="string"){let U=AU($);return U?{title:"Evidence warning",detail:U}:null}if(!$||typeof $!=="object")return null;let v=$,g=AU(v.title)??"Evidence warning",_=AU(v.detail);return _?{title:g,detail:_}:null}function qF($){let v=[],g=JB($.data.warning);if(g)v.push(g);let _=$.data.warnings;if(Array.isArray(_))for(let z of _){let J=JB(z);if(J)v.push(J)}let U=AU($.data.validationStatus)?.toLowerCase();if(U==="failed"||U==="invalid")v.push({title:"Image failed validation",detail:AU($.data.validationMessage)??"Review this image before using it as evidence."});return v}function XF($){let v=[$.data.title,$.data.caption,$.data.alt,$.data.src,$.data.path].map((g)=>AU(g)?.toLowerCase()??"").join(" ");if(v.length===0)return!1;return["login","log in","sign in","signin","password","2fa","mfa","authenticate","authentication","sso"].some((g)=>v.includes(g))}function GB($){let v=qF($);if(v.length>0)return v;if(XF($))return[{title:"Captured login page",detail:"This image looks like an auth screen. Treat it as environment context, not product evidence."}];return[]}function U2({node:$,expanded:v=!1}){let g=$.data.src||"",_=$.data.alt||$.data.title||"Image",U=$.data.caption||"",z=GB($),J=g.startsWith("data:")||g.startsWith("http://")||g.startsWith("https://")?g:`/api/canvas/image/${$.id}`,[G,K]=h(!1),[O,W]=h(!1),[B,k]=h(1),[P,X]=h({x:0,y:0}),[L,Y]=h({w:0,h:0}),I=R(null),q=R(!1),w=R({x:0,y:0}),S=M((m)=>{let i=m.target;Y({w:i.naturalWidth,h:i.naturalHeight}),K(!0),W(!1)},[]),C=M(()=>{W(!0),K(!1)},[]);E(()=>{k(1),X({x:0,y:0})},[g]);let o=M((m)=>{m.preventDefault(),m.stopPropagation();let i=m.deltaY>0?0.9:1.1;k((H$)=>Math.max(0.25,Math.min(10,H$*i)))},[]),y=M((m)=>{if(B<=1)return;m.stopPropagation(),q.current=!0,w.current={x:m.clientX,y:m.clientY},m.target.setPointerCapture(m.pointerId)},[B]),n=M((m)=>{if(!q.current)return;let i=m.clientX-w.current.x,H$=m.clientY-w.current.y;w.current={x:m.clientX,y:m.clientY},X((q$)=>({x:q$.x+i,y:q$.y+H$}))},[]),e=M(()=>{q.current=!1},[]),D=M(()=>{k(1),X({x:0,y:0})},[]);if(!g)return b("div",{class:"image-node-empty",children:[b("div",{class:"image-node-empty-icon",children:"\uD83D\uDDBC"},void 0,!1,void 0,this),b("div",{class:"image-node-empty-text",children:"No image source"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let N=L.w>0?`${L.w}×${L.h}`:"",U$=Math.round(B*100);return b("div",{class:`image-node ${v?"image-node-expanded":""}`,ref:I,children:[z.length>0&&b("div",{class:"image-node-warning-stack",children:z.map((m)=>b("div",{class:"image-node-warning",children:[b("span",{class:"image-node-warning-title",children:m.title},void 0,!1,void 0,this),b("span",{class:"image-node-warning-detail",children:m.detail},void 0,!1,void 0,this)]},`${m.title}-${m.detail}`,!0,void 0,this))},void 0,!1,void 0,this),b("div",{class:"image-node-viewport",onWheel:o,onPointerDown:y,onPointerMove:n,onPointerUp:e,style:{cursor:B>1?"grab":"default"},children:[!G&&!O&&b("div",{class:"image-node-loading",children:"Loading…"},void 0,!1,void 0,this),O&&b("div",{class:"image-node-error",children:[b("div",{class:"image-node-error-icon",children:"⚠"},void 0,!1,void 0,this),b("div",{children:"Failed to load image"},void 0,!1,void 0,this),b("div",{class:"image-node-error-path",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("img",{src:J,alt:_,onLoad:S,onError:C,draggable:!1,style:{transform:`translate(${P.x}px, ${P.y}px) scale(${B})`,opacity:G?1:0,display:O?"none":"block"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(U||N||B!==1)&&b("div",{class:"image-node-footer",children:[U&&b("span",{class:"image-node-caption",children:U},void 0,!1,void 0,this),b("span",{class:"image-node-meta",children:[N&&b("span",{children:N},void 0,!1,void 0,this),B!==1&&b("button",{type:"button",class:"image-node-zoom-reset",onClick:D,title:"Reset zoom",children:[U$,"% ↺"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function bB({node:$}){let v=$.data.children??[],g=j.value,_=v.filter((G)=>g.has(G)),U=_.length,z={};for(let G of _){let K=g.get(G);if(K)z[K.type]=(z[K.type]??0)+1}let J=Object.entries(z).map(([G,K])=>`${K} ${G}`).join(", ");return b("div",{class:"group-node-body",children:[b("div",{class:"group-summary",children:[b("span",{class:"group-child-count",children:[U," node",U!==1?"s":""]},void 0,!0,void 0,this),J&&b("span",{class:"group-type-summary",children:J},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U===0&&b("div",{class:"group-empty-hint",children:"Drag nodes here or use the selection bar to group nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FF($){try{return new URL($).host}catch{return $}}function wF($){if(!$)return null;let v=new Date($);return Number.isNaN(v.getTime())?null:v.toLocaleString()}function g2({node:$,expanded:v=!1}){let g=typeof $.data.url==="string"?$.data.url:"",_=typeof $.data.pageTitle==="string"?$.data.pageTitle:"",U=typeof $.data.description==="string"?$.data.description:"",z=typeof $.data.excerpt==="string"?$.data.excerpt:typeof $.data.content==="string"?$.data.content:"",J=typeof $.data.status==="string"?$.data.status:"idle",G=typeof $.data.error==="string"?$.data.error:"",K=wF(typeof $.data.fetchedAt==="string"?$.data.fetchedAt:void 0),O=typeof $.data.statusCode==="number"?$.data.statusCode:null,W=typeof $.data.imageUrl==="string"?$.data.imageUrl:"",B=$.data.frameBlocked===!0,k=typeof $.data.frameBlockedReason==="string"?$.data.frameBlockedReason:"",[P,X]=h(!1),[L,Y]=h(v);E(()=>{if(v)Y(!0)},[v]);let I=M(async()=>{if(!g||P)return;X(!0);try{await N_($.id)}finally{X(!1)}},[$.id,P,g]);if(!g)return b("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No webpage URL set"},void 0,!1,void 0,this);let q=J==="ready"?"var(--c-ok)":J==="error"?"var(--c-danger)":"var(--c-warn)";return b("div",{style:{display:"flex",flexDirection:"column",gap:"12px",height:"100%"},children:[b("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"12px"},children:[b("div",{style:{minWidth:0,flex:1},children:[b("div",{style:{fontSize:"12px",color:"var(--c-muted)"},children:FF(g)},void 0,!1,void 0,this),b("div",{style:{fontSize:v?"18px":"15px",fontWeight:700,color:"var(--c-text)"},children:_||$.data.title||g},void 0,!1,void 0,this),b("a",{href:g,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all",textDecoration:"none"},children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"999px",background:"rgba(255,255,255,0.04)",color:q,fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.04em",flexShrink:0},children:[b("span",{style:{width:"7px",height:"7px",borderRadius:"999px",background:q}},void 0,!1,void 0,this),J]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(U||W)&&b("div",{style:{display:"grid",gridTemplateColumns:W&&v?"160px 1fr":"1fr",gap:"12px",alignItems:"start"},children:[W&&v&&b("img",{src:W,alt:_||"Webpage preview image",style:{width:"160px",height:"96px",objectFit:"cover",borderRadius:"10px",border:"1px solid var(--c-line)",background:"var(--c-panel-soft)"}},void 0,!1,void 0,this),U&&b("p",{style:{margin:0,color:"var(--c-text-soft)",lineHeight:1.5,fontSize:v?"14px":"12px"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:[b("button",{type:"button",onClick:I,disabled:P,style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:P?"progress":"pointer",fontSize:"12px"},children:P||J==="fetching"?"Refreshing…":"Refresh"},void 0,!1,void 0,this),v&&!B&&b("button",{type:"button",onClick:()=>Y((w)=>!w),style:{border:"1px solid var(--c-line)",background:"var(--c-panel-soft)",color:"var(--c-text)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:L?"Hide live preview":"Show live preview"},void 0,!1,void 0,this),b("button",{type:"button",onClick:()=>window.open(g,"_blank","noopener"),style:{border:"1px solid var(--c-line)",background:"transparent",color:"var(--c-accent)",borderRadius:"8px",padding:"6px 10px",cursor:"pointer",fontSize:"12px"},children:"Open in browser"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&B&&b("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[b("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview unavailable. This site refuses embedding, so PMX Canvas cannot show it inline."},void 0,!1,void 0,this),b("div",{style:{padding:"20px",color:"var(--c-text-soft)",lineHeight:1.6,fontSize:"13px"},children:k||"The remote site blocks iframe embedding."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),v&&L&&!B&&b("div",{style:{border:"1px solid var(--c-line)",borderRadius:"12px",overflow:"hidden",background:"var(--c-panel-soft)"},children:[b("div",{style:{padding:"8px 12px",fontSize:"11px",color:"var(--c-muted)",borderBottom:"1px solid var(--c-line)",background:"rgba(255,255,255,0.03)"},children:"Live preview (best effort). If this stays blank, the site likely blocks framing. The cached text snapshot below still works."},void 0,!1,void 0,this),b("iframe",{class:"webpage-node-iframe",title:_||$.data.title||g,src:g,loading:"lazy",referrerPolicy:"no-referrer",sandbox:"allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts",style:{display:"block",width:"100%",height:v?"320px":"180px",border:"none",background:"#fff"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(K||O!==null)&&b("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",color:"var(--c-muted)",fontSize:"11px"},children:[K&&b("span",{children:["Fetched ",K]},void 0,!0,void 0,this),O!==null&&b("span",{children:["HTTP ",O]},void 0,!0,void 0,this),B&&b("span",{children:"Preview blocked by site"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&b("div",{style:{color:"var(--c-danger)",fontSize:"12px",lineHeight:1.5},children:G},void 0,!1,void 0,this),b("div",{style:{flex:1,minHeight:0,overflow:"auto",border:"1px solid var(--c-line)",borderRadius:"10px",background:"var(--c-panel-soft)",padding:v?"14px":"10px"},children:z?b("div",{style:{whiteSpace:"pre-wrap",lineHeight:1.55,color:"var(--c-text)",fontSize:v?"14px":"12px"},children:z},void 0,!1,void 0,this):b("div",{style:{color:"var(--c-dim)",fontStyle:"italic"},children:J==="error"?"No cached page text available.":"Waiting for page text..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function KB($){return $.type==="html"&&$.data.presentation===!0}function lg({node:$,expanded:v=!1,presentation:g=!1,presentationExitToken:_,autoFocus:U=!1}){let z=R(null),J=j$.value,G=t$(()=>`theme-${crypto.randomUUID()}`,[]),K=t$(()=>`ax-${crypto.randomUUID()}`,[]),O=t$(()=>`frame-${crypto.randomUUID()}`,[]),W=typeof $.data.html==="string"?$.data.html:typeof $.data.content==="string"?$.data.content:"",B=t$(()=>n0(W),[W]),k=t$(()=>W?yb($.id,{theme:J,themeToken:G,present:g,presentToken:_,v:B,axToken:K,frameToken:O}):"",[W,g,_,G,B,$.id,K,O]),P=e0(k);s0($,z,v?"":O),qU({enabled:!0,token:K,nodeId:$.id,sourceSurface:"html-node",iframeRef:z}),E(()=>{if(z.current?.contentWindow?.postMessage({source:pv,type:"theme-update",token:G,theme:J},"*"),U)z.current?.focus()},[J,G]);let X=$.data.axCapabilities,L=X?.enabled===!0&&(!Array.isArray(X.allowed)||X.allowed.length>0),Y=A6.value;E(()=>{if(!L||Y==null)return;z.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:K,state:Y},"*")},[L,Y,K]),E(()=>{if(!U)return;let q=window.setTimeout(()=>z.current?.focus(),0);return()=>window.clearTimeout(q)},[U,k]);let I=()=>{if(z.current?.contentWindow?.postMessage({source:pv,type:"theme-update",token:G,theme:J},"*"),L&&A6.value!=null)z.current?.contentWindow?.postMessage({source:pv,type:"ax-update",token:K,state:A6.value},"*");if(U)z.current?.focus()};if(!W)return b("div",{style:{color:"var(--c-dim)",fontStyle:"italic",padding:"12px"},children:"No HTML content set"},void 0,!1,void 0,this);return b("iframe",{ref:z,class:g?"html-node-frame html-node-frame-presentation":"html-node-frame",title:typeof $.data.title==="string"?$.data.title:"HTML node",sandbox:"allow-scripts",...P,tabIndex:U?0:void 0,onLoad:I,style:{width:"100%",height:"100%",minHeight:g?0:v?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:g?0:"6px",display:"block"}},void 0,!1,void 0,this)}var Tb=null;async function OB(){if(!Tb)Tb=await nK();return Tb}function WB($,v){if(!$)return null;let g=$.toLowerCase(),_=v.find((z)=>z.name.toLowerCase()===g);if(_)return _.name;let U=v.filter((z)=>z.name.toLowerCase().startsWith(g));return U.length===1?U[0].name:null}function AF($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function ZF({html:$}){let v=R(null);return E(()=>{let g=v.current;if(!g)return;if(g.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,g.append(_.content.cloneNode(!0))},[$]),b("div",{ref:v},void 0,!1,void 0,this)}function QF($,v){return`${$.role}:${$.status??"none"}:${v}:${$.text}`}function BB({count:$}){if($===0)return null;return b("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-accent)",background:"rgba(70,182,255,0.08)",borderRadius:"var(--radius-sm)",flexShrink:0},children:["✦"," ",$," context node",$!==1?"s":""," attached"]},void 0,!0,void 0,this)}function PB({message:$,onDismiss:v}){if(!$)return null;return b("div",{style:{padding:"4px 8px",fontSize:"11px",color:"var(--c-danger)",background:"rgba(255,80,80,0.08)",borderRadius:"var(--radius-sm)",display:"flex",alignItems:"center",gap:"6px",flexShrink:0},children:[b("span",{style:{flex:1},children:$},void 0,!1,void 0,this),b("button",{type:"button",onClick:v,style:{background:"none",border:"none",color:"var(--c-danger)",cursor:"pointer",fontSize:"13px",padding:"0 2px"},children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _2({node:$,expanded:v=!1}){let g=Array.isArray($.data.turns)?$.data.turns:[],_=g.length===0,U=$.data.text||"",z=$.data.status||"draft",J=_?z:$.data.threadStatus||"draft",G=J==="draft",K=J==="pending"||J==="sending",O=J==="streaming",W=J==="answered",[B,k]=h(""),[P,X]=h(""),[L,Y]=h(null),[I,q]=h(new Map),w=R(null),S=R(null),C=g[g.length-1],o=`${g.length}:${C?.role??""}:${C?.status??""}:${Math.floor((C?.text?.length??0)/200)}`;E(()=>{if(v&&G&&w.current)w.current.focus()},[v,G]),E(()=>{if(!o)return;if(S.current)S.current.scrollTo({top:S.current.scrollHeight,behavior:"smooth"})},[o]);let y=R(null),n=R(g);n.current=g,E(()=>{let i=g.some((q$)=>q$.role==="assistant"&&q$.status==="streaming"),H$=()=>{let q$=!1,Q=n.current.map((p,s)=>({turn:p,index:s})).filter(({turn:p})=>p.role==="assistant"&&p.text);if(Q.length===0)return;return Promise.all(Q.map(async({turn:p,index:s})=>{let d=await g6(p.text);return{index:s,html:AF(d)}})).then((p)=>{if(q$)return;let s=new Map;for(let d of p)s.set(d.index,d.html);q(s)}),()=>{q$=!0}};if(!i){if(y.current)clearTimeout(y.current),y.current=null;return H$()}if(y.current)clearTimeout(y.current);return y.current=setTimeout(()=>{y.current=null,H$()},400),()=>{if(y.current)clearTimeout(y.current),y.current=null}},[g]);let e=M(async()=>{let i=B.trim();if(!i)return;let H$=B;Y(null),v$($.id,{turns:[{role:"user",text:i,status:"pending"}],threadStatus:"pending",text:i}),k("");let q$=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds:void 0;if(!(await CU(i,$.position,$.id,q$,$.id)).ok)v$($.id,{turns:[],threadStatus:"draft",text:"",status:"draft"}),k(H$),Y("Failed to send prompt. Your draft has been restored.")},[B,$.id,$.position,$.data.contextNodeIds]),D=M(async()=>{let i=P.trim();if(!i)return;let H$=P;Y(null);let q$=Array.isArray($.data.turns)?[...$.data.turns]:[];if(q$.push({role:"user",text:i,status:"pending"}),v$($.id,{turns:q$,threadStatus:"pending"}),X(""),!(await tK($.id,i)).ok)q$.pop(),v$($.id,{turns:q$,threadStatus:"answered"}),X(H$),Y("Failed to send reply. Your draft has been restored.")},[P,$.id,$.data.turns]),N=M((i)=>{if(i.key==="Enter"&&(i.metaKey||i.ctrlKey)){i.preventDefault(),e();return}if(i.key==="Tab"&&B.startsWith("/")){i.preventDefault();let H$=B.slice(1).split(/\s/)[0];if(H$)OB().then((q$)=>{let l$=WB(H$,q$);if(l$)k(`/${l$}`)})}},[e,B]),U$=M((i)=>{if(i.key==="Enter"&&(i.metaKey||i.ctrlKey)){i.preventDefault(),D();return}if(i.key==="Tab"&&P.startsWith("/")){i.preventDefault();let H$=P.slice(1).split(/\s/)[0];if(H$)OB().then((q$)=>{let l$=WB(H$,q$);if(l$)X(`/${l$}`)})}},[D,P]),m=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds.length:0;if(G&&g.length===0)return b("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},children:[b(BB,{count:m},void 0,!1,void 0,this),b(PB,{message:L,onDismiss:()=>Y(null)},void 0,!1,void 0,this),b("textarea",{ref:w,value:B,onInput:(i)=>k(i.target.value),onKeyDown:N,placeholder:"Ask the agent something…",spellcheck:!1,style:{flex:1,resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"13px",lineHeight:"1.5",padding:"8px 10px",outline:"none"}},void 0,!1,void 0,this),b("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[b("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter to send"]},void 0,!0,void 0,this),b("button",{type:"button",onClick:e,disabled:!B.trim(),style:{padding:"5px 14px",fontSize:"12px",fontWeight:600,background:B.trim()?"var(--c-accent)":"var(--c-line)",color:B.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:B.trim()?"pointer":"default"},children:"Send"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);if(_)return b("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[b("div",{style:{flex:1,padding:"2px 0",fontSize:"13px",lineHeight:"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto"},children:U},void 0,!1,void 0,this),b("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px"},children:b("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:K?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:K?"Sending…":W?"Answered":z},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return b("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[b(BB,{count:m},void 0,!1,void 0,this),b(PB,{message:L,onDismiss:()=>Y(null)},void 0,!1,void 0,this),b("div",{ref:S,style:{flex:1,overflow:"auto",minHeight:0},children:g.map((i,H$)=>b("div",{children:[H$>0&&b("div",{class:"thread-turn-divider"},void 0,!1,void 0,this),i.role==="user"?b("div",{class:"thread-turn-user",children:[b("div",{class:"thread-turn-role",children:[b("span",{class:"status-dot"},void 0,!1,void 0,this),"You"]},void 0,!0,void 0,this),b("div",{style:{fontSize:v?"15px":"13px",lineHeight:v?"1.7":"1.55",color:"var(--c-text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i.text},void 0,!1,void 0,this)]},void 0,!0,void 0,this):b("div",{class:"thread-turn-assistant",children:[b("div",{class:"thread-turn-role",children:[b("span",{class:`status-dot${i.status==="streaming"?" pulsing":""}`},void 0,!1,void 0,this),"PMX"]},void 0,!0,void 0,this),i.status==="streaming"&&!i.text&&b("div",{style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-ok), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px"}},void 0,!1,void 0,this),b("div",{class:v?"md-reader-content":void 0,style:{fontSize:v?void 0:"13px",lineHeight:v?void 0:"1.55",opacity:i.text?1:0.4},children:I.get(H$)?b(e$,{children:[b(ZF,{html:I.get(H$)??""},void 0,!1,void 0,this),i.status==="streaming"&&b("span",{class:"streaming-cursor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):b("div",{style:{color:"var(--c-muted)",fontStyle:"italic"},children:i.status==="streaming"?"Waiting for response…":i.text||"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},QF(i,H$),!0,void 0,this))},void 0,!1,void 0,this),b("div",{style:{flexShrink:0,borderTop:"1px solid var(--c-line)",marginTop:"4px",paddingTop:"6px"},children:[b("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:W?"6px":0},children:[b("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:O?"var(--c-accent)":K?"var(--c-warn)":W?"var(--c-ok)":"var(--c-muted)"},children:O?"Streaming…":K?"Sending…":W?"Answered":J},void 0,!1,void 0,this),b("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:[g.length," turn",g.length!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W&&b("div",{class:"thread-reply-area",children:[b("textarea",{value:P,onInput:(i)=>X(i.target.value),onKeyDown:U$,placeholder:"Reply…",spellcheck:!1,rows:2,style:{width:"100%",resize:"none",background:"rgba(10,14,30,0.4)",border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",color:"var(--c-text)",fontFamily:"var(--font)",fontSize:"12px",lineHeight:"1.5",padding:"6px 8px",outline:"none"}},void 0,!1,void 0,this),b("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"4px"},children:[b("span",{style:{fontSize:"10px",color:"var(--c-muted)"},children:["⌘","+Enter"]},void 0,!0,void 0,this),b("button",{type:"button",onClick:D,disabled:!P.trim(),style:{padding:"3px 10px",fontSize:"11px",fontWeight:600,background:P.trim()?"var(--c-accent)":"var(--c-line)",color:P.trim()?"var(--c-contrast-fg)":"var(--c-muted)",border:"none",borderRadius:"var(--radius-sm)",cursor:P.trim()?"pointer":"default"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function MF($){return $.replace(/<script[\s>][\s\S]*?<\/script>/gi,"").replace(/<iframe[\s>][\s\S]*?<\/iframe>/gi,"").replace(/<object[\s>][\s\S]*?<\/object>/gi,"").replace(/<embed[\s>][\s\S]*?(?:\/>|<\/embed>)/gi,"").replace(/<link[\s>][\s\S]*?(?:\/>|<\/link>)/gi,"").replace(/\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/href\s*=\s*"javascript:[^"]*"/gi,'href="#"').replace(/href\s*=\s*'javascript:[^']*'/gi,"href='#'")}function SF({html:$}){let v=R(null);return E(()=>{let g=v.current;if(!g)return;if(g.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,g.append(_.content.cloneNode(!0))},[$]),b("div",{ref:v},void 0,!1,void 0,this)}function z2({node:$,expanded:v=!1}){let g=$.data.content||"",_=$.data.status||"streaming",[U,z]=h(""),J=_==="streaming",G=_==="complete";E(()=>{if(!g){z("");return}let O=!1;return g6(g).then((W)=>{if(!O)z(MF(W))}),()=>{O=!0}},[g]);let K=M(()=>{CU("",{x:$.position.x,y:$.position.y+$.size.height+24},$.id)},[$]);return b("div",{class:"response-node-inner",style:{display:"flex",flexDirection:"column",height:"100%"},children:[J&&b("div",{class:"response-streaming-bar",style:{height:"2px",background:"linear-gradient(90deg, transparent, var(--c-accent), transparent)",animation:"response-stream-pulse 1.5s ease-in-out infinite",borderRadius:"1px",marginBottom:"4px",flexShrink:0}},void 0,!1,void 0,this),b("div",{class:v?"md-reader":void 0,style:{flex:1,overflow:"auto",minHeight:0,opacity:g?1:0.4,transition:"opacity 0.2s ease"},children:U?b("div",{class:v?"md-reader-content":void 0,children:b(SF,{html:U},void 0,!1,void 0,this)},void 0,!1,void 0,this):b("div",{style:{color:"var(--c-muted)",fontStyle:"italic",fontSize:"13px"},children:J?"Waiting for response…":"Empty response"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",paddingTop:"6px",borderTop:"1px solid var(--c-line)",marginTop:"4px",flexShrink:0},children:[b("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,color:J?"var(--c-accent)":G?"var(--c-ok)":"var(--c-muted)"},children:J?"Streaming…":G?"Complete":_},void 0,!1,void 0,this),G&&b("button",{type:"button",onClick:K,style:{padding:"3px 10px",fontSize:"11px",background:"rgba(70,182,255,0.1)",border:"1px solid rgba(70,182,255,0.3)",borderRadius:"var(--radius-sm)",color:"var(--c-accent)",cursor:"pointer"},children:"Reply"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function kB($){return{toolName:$.toolName||$.title||"unknown",category:$.category||"other",status:$.status||"running",duration:$.duration||"",resultSummary:$.resultSummary||$.content||"",error:$.error||""}}var YB={mcp:"var(--c-accent)",file:"var(--c-warn)",subagent:"var(--c-purple)",other:"var(--c-muted)"},NF={running:"⠋",success:"✓",failed:"✕"},yF={running:"var(--c-accent)",success:"var(--c-ok)",failed:"var(--c-danger)"};function J2({node:$}){let{toolName:v,category:g,status:_,duration:U,resultSummary:z,error:J}=kB($.data),G=YB[g]??YB.other,K=NF[_]??"◌",O=yF[_]??"var(--c-muted)",W=_==="running",B=J?J.slice(0,30):z.length>30?`${z.slice(0,28)}…`:z;return b("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"0 12px",height:"100%",overflow:"hidden"},children:[b("span",{style:{fontSize:"14px",color:O,flexShrink:0,animation:W?"pulse 1.5s infinite":"none"},children:K},void 0,!1,void 0,this),b("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[b("div",{style:{fontFamily:"var(--mono)",fontSize:"11px",fontWeight:600,color:G,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:v},void 0,!1,void 0,this),B&&b("div",{style:{fontSize:"10px",color:J?"var(--c-danger)":"var(--c-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3},children:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&b("span",{style:{fontSize:"9px",padding:"1px 5px",borderRadius:"3px",background:"rgba(255,255,255,0.06)",color:"var(--c-muted)",flexShrink:0,whiteSpace:"nowrap"},children:U},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rb($){let v=j.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function DF($){let v=$.map((K)=>rb(K)).filter((K)=>K!==null);if(v.length===0)return null;let g=Math.min(...v.map((K)=>K.left)),_=Math.min(...v.map((K)=>K.top)),U=Math.max(...v.map((K)=>K.left+K.width)),z=Math.max(...v.map((K)=>K.top+K.height)),J=54,G=46;return{left:g-J,top:_-G,width:U-g+J*2,height:z-_+G*2}}function jb($,v){return{left:`${$.left}px`,top:`${$.top}px`,width:`${$.width}px`,height:`${$.height}px`,borderRadius:`${v}px`}}function HB(){let $=Array.from(A4.value),v=Array.from(Z4.value),g=q_.value;if($.length===0&&v.length===0)return null;return b("div",{class:"attention-field-layer","aria-hidden":"true",children:[g.map((_)=>{let U=DF(_.nodeIds);if(!U)return null;return b("div",{class:"attention-field-region",style:jb(U,42)},_.id,!1,void 0,this)}),v.map((_)=>{let U=rb(_);if(!U)return null;return b("div",{class:"attention-field-node attention-field-secondary",style:jb({left:U.left-18,top:U.top-18,width:U.width+36,height:U.height+36},28)},`secondary-${_}`,!1,void 0,this)}),$.map((_)=>{let U=rb(_);if(!U)return null;return b("div",{class:"attention-field-node attention-field-primary",style:jb({left:U.left-24,top:U.top-24,width:U.width+48,height:U.height+48},30)},`primary-${_}`,!1,void 0,this)})]},void 0,!0,void 0,this)}var Lv=z$(new Map),ZU=z$(null),RF=480,uF=320,pg=new Map,B6=null;function Vb($){Lv.value=$,jF()}function Cb($){let v=pg.get($);if(v)clearTimeout(v),pg.delete($)}function LB($){Cb($.id);let v=new Map(Lv.value);v.set($.id,{...$,phase:"forming"}),Vb(v)}function TF($){if(Cb($),!Lv.value.has($))return;let v=new Map(Lv.value);v.delete($),Vb(v)}function IB($,v,g,_){let U=Lv.value.get($);if(!U||U.phase===v)return;let z=new Map(Lv.value);z.set($,{...U,phase:v,..._?{settledNodeId:_}:{}}),Vb(z),Cb($),pg.set($,setTimeout(()=>TF($),g))}function qB($,v){IB($,"settling",RF,v)}function fb($){IB($,"dissolving",uF)}function Eb(){for(let $ of pg.values())clearTimeout($);if(pg.clear(),B6)clearInterval(B6),B6=null;ZU.value=null,Lv.value=new Map}function jF(){if(B6||Lv.value.size===0)return;B6=setInterval(()=>{let $=Date.now();for(let v of Lv.value.values())if(v.phase==="forming"&&v.expiresAt<=$)fb(v.id);if(Lv.value.size===0&&B6)clearInterval(B6),B6=null},1000),B6.unref?.()}var rF={fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"};function I$({size:$=16,children:v,...g}){return b("svg",{width:$,height:$,viewBox:"0 0 16 16",...rF,...g,children:v},void 0,!1,void 0,this)}function wB($){return b(I$,{...$,children:[b("polyline",{points:"1 5 1 1 5 1"},void 0,!1,void 0,this),b("polyline",{points:"11 1 15 1 15 5"},void 0,!1,void 0,this),b("polyline",{points:"15 11 15 15 11 15"},void 0,!1,void 0,this),b("polyline",{points:"5 15 1 15 1 11"},void 0,!1,void 0,this),b("rect",{x:"4",y:"4",width:"8",height:"8",rx:"1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function AB($){return b(I$,{...$,children:[b("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"},void 0,!1,void 0,this),b("line",{x1:"8",y1:"4.5",x2:"8",y2:"6.5"},void 0,!1,void 0,this),b("line",{x1:"8",y1:"9.5",x2:"8",y2:"11.5"},void 0,!1,void 0,this),b("line",{x1:"4.5",y1:"8",x2:"6.5",y2:"8"},void 0,!1,void 0,this),b("line",{x1:"9.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),b("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ZB($){return b(I$,{...$,children:[b("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),b("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),b("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this),b("line",{x1:"7",y1:"5",x2:"7",y2:"9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QB($){return b(I$,{...$,children:[b("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),b("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this),b("line",{x1:"5",y1:"7",x2:"9",y2:"7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MB($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),b("rect",{x:"9.5",y:"1.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),b("rect",{x:"1.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),b("rect",{x:"9.5",y:"9.5",width:"5",height:"5",rx:"1"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"4",x2:"9.5",y2:"4"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"12",x2:"9.5",y2:"12"},void 0,!1,void 0,this),b("line",{x1:"4",y1:"6.5",x2:"4",y2:"9.5"},void 0,!1,void 0,this),b("line",{x1:"12",y1:"6.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SB($){return b(I$,{...$,children:[b("rect",{x:"1",y:"2",width:"14",height:"12",rx:"1.5"},void 0,!1,void 0,this),b("rect",{x:"8",y:"7",width:"6",height:"6",rx:"1",fill:"currentColor","fill-opacity":"0.2"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function NB($){return b(I$,{...$,children:[b("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),b("line",{x1:"8",y1:"1",x2:"8",y2:"3"},void 0,!1,void 0,this),b("line",{x1:"8",y1:"13",x2:"8",y2:"15"},void 0,!1,void 0,this),b("line",{x1:"1",y1:"8",x2:"3",y2:"8"},void 0,!1,void 0,this),b("line",{x1:"13",y1:"8",x2:"15",y2:"8"},void 0,!1,void 0,this),b("line",{x1:"3.05",y1:"3.05",x2:"4.46",y2:"4.46"},void 0,!1,void 0,this),b("line",{x1:"11.54",y1:"11.54",x2:"12.95",y2:"12.95"},void 0,!1,void 0,this),b("line",{x1:"3.05",y1:"12.95",x2:"4.46",y2:"11.54"},void 0,!1,void 0,this),b("line",{x1:"11.54",y1:"4.46",x2:"12.95",y2:"3.05"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function yB($){return b(I$,{...$,children:b("path",{d:"M13 9.5A5.5 5.5 0 1 1 6.5 3 4.5 4.5 0 0 0 13 9.5Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function DB($){return b(I$,{...$,children:[b("path",{d:"M3 13l2.8-.7L13 5.1 10.9 3 3.7 10.2 3 13Z"},void 0,!1,void 0,this),b("path",{d:"M9.8 4.1l2.1 2.1"},void 0,!1,void 0,this),b("path",{d:"M2.5 14h11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function RB($){return b(I$,{...$,children:[b("path",{d:"M3 10.5 8.5 5a2 2 0 0 1 2.8 0l1.7 1.7a2 2 0 0 1 0 2.8L8.5 14H5.8L3 11.2Z"},void 0,!1,void 0,this),b("path",{d:"M7.5 6 12 10.5"},void 0,!1,void 0,this),b("path",{d:"M8.5 14H14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function uB($){return b(I$,{...$,children:[b("path",{d:"M3 4h10"},void 0,!1,void 0,this),b("path",{d:"M8 4v8"},void 0,!1,void 0,this),b("path",{d:"M6 12h4"},void 0,!1,void 0,this),b("path",{d:"M4.5 4 4 6"},void 0,!1,void 0,this),b("path",{d:"M11.5 4 12 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function TB($){return b(I$,{...$,children:[b("rect",{x:"1",y:"4",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),b("path",{d:"M5.5 4 L6.5 2.5 H9.5 L10.5 4"},void 0,!1,void 0,this),b("circle",{cx:"8",cy:"9",r:"2.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function jB($){return b(I$,{...$,children:[b("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),b("circle",{cx:"8",cy:"8",r:"3"},void 0,!1,void 0,this),b("circle",{cx:"8",cy:"8",r:"0.8",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rB($){return b(I$,{...$,children:[b("circle",{cx:"8",cy:"8",r:"6"},void 0,!1,void 0,this),b("line",{x1:"5.5",y1:"5.5",x2:"10.5",y2:"10.5"},void 0,!1,void 0,this),b("line",{x1:"10.5",y1:"5.5",x2:"5.5",y2:"10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function VB($){return b(I$,{...$,children:[b("circle",{cx:"7",cy:"7",r:"4.5"},void 0,!1,void 0,this),b("line",{x1:"10.5",y1:"10.5",x2:"14.5",y2:"14.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function CB($){return b(I$,{...$,children:[b("rect",{x:"1",y:"3",width:"14",height:"10",rx:"1.5"},void 0,!1,void 0,this),b("line",{x1:"4",y1:"6",x2:"5",y2:"6"},void 0,!1,void 0,this),b("line",{x1:"7.5",y1:"6",x2:"8.5",y2:"6"},void 0,!1,void 0,this),b("line",{x1:"11",y1:"6",x2:"12",y2:"6"},void 0,!1,void 0,this),b("line",{x1:"4",y1:"10",x2:"12",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function fB({size:$=22,class:v}){return b("svg",{width:$,height:$,viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",class:v,"aria-hidden":"true",children:[b("rect",{x:"8",y:"8",width:"48",height:"48",rx:"7",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.35"},void 0,!1,void 0,this),b("rect",{x:"16",y:"16",width:"32",height:"32",rx:"5",fill:"none",stroke:"currentColor","stroke-width":"2.2",opacity:"0.6"},void 0,!1,void 0,this),b("rect",{x:"24",y:"24",width:"16",height:"16",rx:"3",fill:"none",stroke:"currentColor","stroke-width":"2.2"},void 0,!1,void 0,this),b("rect",{x:"29",y:"29",width:"6",height:"6",rx:"1",fill:"currentColor"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function XB($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("line",{x1:"4",y1:"6",x2:"10",y2:"6"},void 0,!1,void 0,this),b("line",{x1:"4",y1:"8.5",x2:"8",y2:"8.5"},void 0,!1,void 0,this),b("line",{x1:"4",y1:"11",x2:"11",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function VF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),b("path",{d:"M4 13.5 L5.5 11.5 L8 11.5"},void 0,!1,void 0,this),b("polyline",{points:"5 6 7 8 5 10"},void 0,!1,void 0,this),b("line",{x1:"8",y1:"10",x2:"11",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function CF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"9",rx:"1.5"},void 0,!1,void 0,this),b("path",{d:"M12 13.5 L10.5 11.5 L8 11.5"},void 0,!1,void 0,this),b("circle",{cx:"5",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("circle",{cx:"8",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("circle",{cx:"11",cy:"7",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function fF($){return b(I$,{...$,children:[b("path",{d:"M3 1.5h6l3.5 3.5v8a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V2.5a1 1 0 0 1 1-1z"},void 0,!1,void 0,this),b("polyline",{points:"9 1.5 9 5 12.5 5"},void 0,!1,void 0,this),b("line",{x1:"4.5",y1:"8.5",x2:"10.5",y2:"8.5"},void 0,!1,void 0,this),b("line",{x1:"4.5",y1:"11",x2:"9",y2:"11"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function EF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("circle",{cx:"5.5",cy:"6.5",r:"1.2"},void 0,!1,void 0,this),b("path",{d:"M1.8 12 L6 8.5 L9 11 L11.5 9 L14.2 12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FB($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("line",{x1:"1.5",y1:"5.5",x2:"14.5",y2:"5.5"},void 0,!1,void 0,this),b("circle",{cx:"3.3",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("circle",{cx:"5",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("circle",{cx:"6.7",cy:"4",r:"0.5",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("line",{x1:"4",y1:"8",x2:"12",y2:"8"},void 0,!1,void 0,this),b("line",{x1:"4",y1:"10",x2:"10",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function mF($){return b(I$,{...$,children:[b("rect",{x:"2",y:"4",width:"12",height:"10",rx:"1.5"},void 0,!1,void 0,this),b("line",{x1:"2",y1:"6.5",x2:"14",y2:"6.5"},void 0,!1,void 0,this),b("path",{d:"M11 1.5 L11 4"},void 0,!1,void 0,this),b("circle",{cx:"11",cy:"4",r:"1.6",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function cF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"1.5","stroke-dasharray":"2 1.5"},void 0,!1,void 0,this),b("rect",{x:"4",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),b("rect",{x:"8.5",y:"4",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this),b("rect",{x:"6.25",y:"8.5",width:"3.5",height:"3.5",rx:"0.6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function iF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("circle",{cx:"4.5",cy:"8",r:"1.1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"6.5",x2:"12.5",y2:"6.5"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"8",x2:"11",y2:"8"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"9.5",x2:"12",y2:"9.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function xF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("path",{d:"M3.5 10.5 L6 6.5 L8.5 9.5 L12.5 5"},void 0,!1,void 0,this),b("circle",{cx:"12.5",cy:"5",r:"0.9",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function hF($){return b(I$,{...$,children:[b("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1.5"},void 0,!1,void 0,this),b("line",{x1:"4.5",y1:"5.5",x2:"11.5",y2:"5.5"},void 0,!1,void 0,this),b("line",{x1:"4.5",y1:"8",x2:"11.5",y2:"8"},void 0,!1,void 0,this),b("line",{x1:"4.5",y1:"10.5",x2:"8",y2:"10.5"},void 0,!1,void 0,this),b("line",{x1:"6.5",y1:"2",x2:"6.5",y2:"14",opacity:"0.45"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function lF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"2"},void 0,!1,void 0,this),b("path",{d:"M4 11 L4 6 L6 8.5 L8 6 L8 11"},void 0,!1,void 0,this),b("path",{d:"M10 11 L10 6 L12.5 11 L12.5 6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function pF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("polyline",{points:"10 5 13 5 13 8"},void 0,!1,void 0,this),b("line",{x1:"13",y1:"5",x2:"8",y2:"10"},void 0,!1,void 0,this),b("path",{d:"M6 6 L3.5 6 L3.5 11.5 L10 11.5 L10 9"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function oF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("path",{d:"M7 5.5 C 5.5 5.5 5.5 8 4 8 C 5.5 8 5.5 10.5 7 10.5"},void 0,!1,void 0,this),b("path",{d:"M9 5.5 C 10.5 5.5 10.5 8 12 8 C 10.5 8 10.5 10.5 9 10.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function nF($){return b(I$,{...$,children:[b("rect",{x:"1.5",y:"2.5",width:"13",height:"11",rx:"1.5"},void 0,!1,void 0,this),b("line",{x1:"5.2",y1:"6",x2:"8",y2:"8"},void 0,!1,void 0,this),b("line",{x1:"8",y1:"8",x2:"10.8",y2:"6"},void 0,!1,void 0,this),b("line",{x1:"8",y1:"8",x2:"8",y2:"11"},void 0,!1,void 0,this),b("circle",{cx:"5.2",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("circle",{cx:"10.8",cy:"6",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("circle",{cx:"8",cy:"8",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this),b("circle",{cx:"8",cy:"11",r:"1",fill:"currentColor",stroke:"none"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function og($){switch($){case"markdown":return XB;case"prompt":return VF;case"response":return CF;case"file":return fF;case"image":return EF;case"webpage":return FB;case"context":return mF;case"group":return cF;case"status":return iF;case"trace":return xF;case"ledger":return hF;case"mcp-app":return lF;case"ext-app":return pF;case"json-render":return oF;case"graph":return nF;case"html":return FB;default:return XB}}var EB={width:260,height:150},tF={markdown:{width:300,height:170},status:{width:280,height:110},context:{width:300,height:200},trace:{width:220,height:64},file:{width:300,height:190},image:{width:260,height:200},webpage:{width:320,height:210},html:{width:320,height:210},group:{width:340,height:210},graph:{width:320,height:210},"json-render":{width:320,height:210},"mcp-app":{width:340,height:230}};function cb($){return!!$&&$ in $v}function P6($){if(!$)return null;let v=j.value.get($);if(!v||v.dockPosition!==null)return null;return{left:v.position.x,top:v.position.y,width:v.size.width,height:v.size.height}}function mb($){return{x:$.left+$.width/2,y:$.top+$.height/2}}function ng($){if(typeof $.confidence!=="number")return 0.82;return 0.4+Math.max(0,Math.min(1,$.confidence))*0.55}function mB($,v){let g=Math.max(40,Math.abs(v.x-$.x)/2);return`M ${$.x} ${$.y} C ${$.x+g} ${$.y}, ${v.x-g} ${v.y}, ${v.x} ${v.y}`}function ib({intent:$}){let v=cb($.nodeType)?og($.nodeType):null,g=$.label||$.kind,_=typeof $.confidence==="number"?`${Math.round($.confidence*100)}%`:null;return b("div",{class:"intent-info",onMouseEnter:()=>ZU.value=$.id,onMouseLeave:()=>{if(ZU.value===$.id)ZU.value=null},children:[b("div",{class:"intent-chip",children:[typeof $.seq==="number"&&b("span",{class:"intent-seq",children:$.seq},void 0,!1,void 0,this),v&&b("span",{class:"intent-chip-icon","aria-hidden":"true",children:b(v,{size:12},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("span",{class:"intent-chip-label",children:g},void 0,!1,void 0,this),_&&b("span",{class:"intent-confidence",children:_},void 0,!1,void 0,this),$.phase==="forming"&&b("button",{type:"button",class:"intent-veto",title:"Veto this move (Esc)","aria-label":"Veto this move",onClick:(U)=>{U.stopPropagation(),j2($)},children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.reason&&b("div",{class:"intent-reason",children:$.reason},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function cB({intent:$,rect:v}){let g=cb($.nodeType)?og($.nodeType):null,_=cb($.nodeType)?$v[$.nodeType]:"Node";return b("div",{class:`intent-ghost intent-ghost-box is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:ng($)},children:[b("div",{class:"intent-ghost-titlebar",children:[b("span",{class:"intent-ghost-icon","aria-hidden":"true",children:g?b(g,{size:13},void 0,!1,void 0,this):"◇"},void 0,!1,void 0,this),b("span",{class:"intent-ghost-badge",children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b(ib,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function iB({intent:$,rect:v,variant:g}){return b("div",{class:`intent-ghost intent-ghost-${g} is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:ng($)},children:[g==="edit"&&b("div",{class:"intent-edit-bar"},void 0,!1,void 0,this),b(ib,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function dF($){let v=$.phase==="settling"?P6($.settledNodeId):null;switch($.kind){case"create":{if(!$.position)return null;let g=$.nodeType&&tF[$.nodeType]||EB,_=v??{left:$.position.x,top:$.position.y,...g};return b(cB,{intent:$,rect:_},$.id,!1,void 0,this)}case"move":{if(!$.position)return null;let _=P6($.nodeId)??EB,U=v??{left:$.position.x,top:$.position.y,width:_.width,height:_.height};return b(cB,{intent:$,rect:U},$.id,!1,void 0,this)}case"remove":{let g=v??P6($.nodeId);if(!g)return null;return b(iB,{intent:$,rect:g,variant:"remove"},$.id,!1,void 0,this)}case"edit":{let g=v??P6($.nodeId);if(!g)return null;return b(iB,{intent:$,rect:g,variant:"edit"},$.id,!1,void 0,this)}case"connect":{if(!$.edge)return null;let g=P6($.edge.from),_=P6($.edge.to);if(!g||!_)return null;let U={x:(g.left+g.width/2+_.left+_.width/2)/2,y:(g.top+g.height/2+_.top+_.height/2)/2},z={left:U.x-110,top:U.y-18,width:220,height:36};return b("div",{class:`intent-ghost intent-ghost-connect is-${$.phase}`,"data-intent-id":$.id,style:{left:`${z.left}px`,top:`${z.top}px`,width:`${z.width}px`,opacity:ng($)},children:b(ib,{intent:$},void 0,!1,void 0,this)},$.id,!1,void 0,this)}default:return null}}function xB(){let $=Array.from(Lv.value.values());if(E(()=>{function v(g){if(g.key!=="Escape")return;let _=ZU.value;if(!_)return;let U=Lv.value.get(_);if(!U||U.phase!=="forming")return;g.stopImmediatePropagation(),g.preventDefault(),j2(U)}return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[]),$.length===0)return null;return b("div",{class:"intent-layer",children:[b("svg",{class:"intent-line-layer",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[b("defs",{children:b("marker",{id:"intent-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:b("path",{d:"M0,0 L6,3 L0,6 Z",class:"intent-arrow-head"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),$.map((v)=>{if(v.kind==="connect"&&v.edge){let g=P6(v.edge.from),_=P6(v.edge.to);if(!g||!_)return null;return b("path",{d:mB(mb(g),mb(_)),class:`intent-edge type-${v.edge.type}`,style:{opacity:ng(v)}},`line-${v.id}`,!1,void 0,this)}if(v.kind==="move"&&v.position){let g=P6(v.nodeId);if(!g)return null;let _=g,U={x:v.position.x+_.width/2,y:v.position.y+_.height/2};return b("path",{d:mB(mb(g),U),class:"intent-trail",markerEnd:"url(#intent-arrow)",style:{opacity:ng(v)}},`line-${v.id}`,!1,void 0,this)}return null})]},void 0,!0,void 0,this),$.map(dF)]},void 0,!0,void 0,this)}var QU=8,k4=z$(null),MU=[],SU=[],pB=null;function hB($){let v=$?.data.parentGroup;return typeof v==="string"&&v.length>0?v:null}function lB($){if(!$||!Array.isArray($.data.children))return[];return $.data.children.filter((v)=>typeof v==="string")}function aF($,v){let g=new Map(v.map((G)=>[G.id,G])),_=new Set([$]),U=g.get($);if(!U)return _;let z=hB(U);while(z&&!_.has(z))_.add(z),z=hB(g.get(z));if(U.type!=="group")return _;let J=[...lB(U)];while(J.length>0){let G=J.pop();if(!G||_.has(G))continue;_.add(G);let K=g.get(G);if(K?.type==="group")J.push(...lB(K))}return _}function oB($,v){MU=[],SU=[],pB=$;let g=Array.from(v),_=aF($,g);for(let U of g){if(_.has(U.id)||U.dockPosition!==null)continue;let z=U.position.x,J=U.position.x+U.size.width,G=U.position.x+U.size.width/2,K=U.position.y,O=U.position.y+U.size.height,W=U.position.y+U.size.height/2;MU.push({val:z,minY:K,maxY:O}),MU.push({val:J,minY:K,maxY:O}),MU.push({val:G,minY:K,maxY:O}),SU.push({val:K,minX:z,maxX:J}),SU.push({val:O,minX:z,maxX:J}),SU.push({val:W,minX:z,maxX:J})}}function nB(){MU=[],SU=[],pB=null}function tB($,v,g,_){let U=[$,$+g/2,$+g],z=[v,v+_/2,v+_],J=[0,g/2,g],G=[0,_/2,_],K=null,O=QU+1,W=null;for(let L=0;L<3;L++){let Y=U[L];for(let I of MU){let q=Math.abs(Y-I.val);if(q<O)O=q,K=I.val-J[L],W={axis:"x",pos:I.val,from:Math.min(I.minY,v),to:Math.max(I.maxY,v+_)}}}let B=null,k=QU+1,P=null;for(let L=0;L<3;L++){let Y=z[L];for(let I of SU){let q=Math.abs(Y-I.val);if(q<k)k=q,B=I.val-G[L],P={axis:"y",pos:I.val,from:Math.min(I.minX,$),to:Math.max(I.maxX,$+g)}}}let X=[];if(W&&O<=QU)X.push(W);if(P&&k<=QU)X.push(P);return{x:K!==null&&O<=QU?K:$,y:B!==null&&k<=QU?B:v,guides:X}}function dB({nodeId:$,viewport:v,onMove:g,onDragEnd:_}){let U=R(!1),z=R({x:0,y:0}),J=R({x:0,y:0});return M((K,O,W)=>{K.stopPropagation(),K.preventDefault(),U.current=!0,document.documentElement.classList.add("is-node-dragging"),window.getSelection()?.removeAllRanges(),z.current={x:K.clientX,y:K.clientY},J.current={x:O,y:W};let B=null,k=null,P=()=>{if(k=null,!U.current||!B)return;let Y=B;B=null;let I=v.value.scale,q=(Y.x-z.current.x)/I,w=(Y.y-z.current.y)/I;g($,J.current.x+q,J.current.y+w)},X=(Y)=>{if(!U.current)return;if(B={x:Y.clientX,y:Y.clientY},k!==null)return;k=window.requestAnimationFrame(P)},L=()=>{if(k!==null)window.cancelAnimationFrame(k),P();U.current=!1,document.documentElement.classList.remove("is-node-dragging"),document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",L),document.removeEventListener("pointercancel",L),_()};document.addEventListener("pointermove",X),document.addEventListener("pointerup",L),document.addEventListener("pointercancel",L)},[$,v,g,_])}var sF=200,eF=100;function aB({nodeId:$,viewport:v,onResize:g,onResizeEnd:_}){let U=R(!1),z=R({x:0,y:0}),J=R({w:0,h:0});return M((K,O,W)=>{K.stopPropagation(),K.preventDefault(),U.current=!0,z.current={x:K.clientX,y:K.clientY},J.current={w:O,h:W},document.documentElement.classList.add("is-node-resizing");let B=null,k=null,P=()=>{if(k=null,!U.current||!B)return;let Y=B;B=null;let I=v.value.scale,q=(Y.x-z.current.x)/I,w=(Y.y-z.current.y)/I;g($,Math.max(sF,J.current.w+q),Math.max(eF,J.current.h+w))},X=(Y)=>{if(!U.current)return;if(B={x:Y.clientX,y:Y.clientY},k!==null)return;k=window.requestAnimationFrame(P)},L=()=>{if(k!==null)window.cancelAnimationFrame(k),P();U.current=!1,document.documentElement.classList.remove("is-node-resizing"),document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",L),document.removeEventListener("pointercancel",L),_()};document.addEventListener("pointermove",X),document.addEventListener("pointerup",L),document.addEventListener("pointercancel",L)},[$,v,g,_])}function sB({node:$,children:v,onContextMenu:g}){let _=u$.value===$.id,U=i$.value.has($.id),z=T$.value.has($.id),J=A4.value.has($.id),G=!J&&Z4.value.has($.id),K=X_.value.has($.id),O=!_&&KO.value.has($.id),W=Z6.value,B=W!==null&&W.has($.id),k=W!==null&&!W.has($.id),[P,X]=h(!1),L=R(null),Y=M((f,a,O$)=>{let W$=tB(a,O$,$.size.width,$.size.height),V$=j.value.get(f);if(V$?.position.x===W$.x&&V$.position.y===W$.y){k4.value=W$.guides.length>0?W$.guides:null;return}Pv(f,{position:{x:W$.x,y:W$.y}}),k4.value=W$.guides.length>0?W$.guides:null},[$.size.width,$.size.height]),I=M(()=>{nB(),k4.value=null,d$()},[]),q=dB({nodeId:$.id,viewport:k$,onMove:Y,onDragEnd:I}),w=M((f,a,O$)=>{let W$=j.value.get(f);if(W$?.size.width===a&&W$.size.height===O$)return;Pv(f,{size:{width:a,height:O$}})},[]),S=M(()=>{v$($.id,{userResized:!0}),Zv($.id,{data:{userResized:!0}}),d$()},[$.id]),C=aB({nodeId:$.id,viewport:k$,onResize:w,onResizeEnd:S}),o=M((f)=>{if(P)return;Q6($.id),oB($.id,j.value.values()),q(f,$.position.x,$.position.y)},[$.id,$.position.x,$.position.y,q,P]),y=M((f)=>{if(f.stopPropagation(),f.shiftKey){OO($.id);return}Q6($.id)},[$.id]),n=M((f)=>{if(g)g(f,$.id)},[g,$.id]),e=M((f)=>{f.stopPropagation(),X(!0),requestAnimationFrame(()=>L.current?.focus())},[]),D=$.data.title||$v[$.type],N=M((f)=>{let a=f.trim();if(a&&a!==D)v$($.id,{title:a}),Zv($.id,{title:a});X(!1)},[$.id,D]),U$=R(null),m=R(!1),i=R(null);E(()=>{if(m.current||!Bz($))return;let f=U$.current;if(!f)return;let a=new ResizeObserver(()=>{if(m.current){a.disconnect();return}let O$=f.scrollHeight,W$=Q5($,O$);if(W$===null)return;if(Math.abs(W$-$.size.height)>8){if(D4($.id,{width:$.size.width,height:W$}),i.current!==null)window.clearTimeout(i.current);i.current=window.setTimeout(()=>{d$({recordHistory:!1}),i.current=null},0)}m.current=!0,a.disconnect()});return a.observe(f),()=>{if(a.disconnect(),i.current!==null)window.clearTimeout(i.current),i.current=null}},[$.id,$.type,$.data.mode,$.data.strictSize,$.collapsed,$.dockPosition,$.size.width,$.size.height]);let H$=$.pinned,q$=$.type==="trace",l$=q$&&$.data.status==="running",Q=$.type==="group",p=$.data.strictSize===!0,s=Math.max(k$.value.scale,0.01),d=s<1?Math.min(2.2,1/s):1,b$=Q&&$.data.color?$.data.color:void 0,g$={left:`${$.position.x}px`,top:`${$.position.y}px`,width:`${$.size.width}px`,height:$.collapsed?"auto":`${$.size.height}px`,zIndex:$.zIndex,"--node-chrome-scale":d.toFixed(3),...b$?{"--group-color":b$}:{}},x=["canvas-node",_?"active":"",O?"neighbor":"",B?"search-match":"",k?"search-dimmed":"",U?"selected":"",z?"context-pinned":"",J?"attention-focus-primary":"",G?"attention-focus-secondary":"",K?"attention-pulse":"",H$?"pinned":"",q$?"trace-node":"",l$?"trace-running":"",Q?"group-node":"",p?"strict-size":""].filter(Boolean).join(" ");return b("div",{class:x,style:g$,onPointerDown:y,onContextMenu:n,children:[b("div",{class:"node-titlebar",onPointerDown:o,children:[b("span",{class:"node-type-icon","aria-hidden":"true",children:(()=>{let f=og($.type);return b(f,{size:Math.round(14*d)},void 0,!1,void 0,this)})()},void 0,!1,void 0,this),b("span",{class:"node-type-badge",children:$v[$.type]},void 0,!1,void 0,this),P?b("input",{ref:L,class:"node-title-input",value:D,onBlur:(f)=>N(f.target.value),onKeyDown:(f)=>{if(f.key==="Enter")N(f.target.value);if(f.key==="Escape")X(!1)},onClick:(f)=>f.stopPropagation()},void 0,!1,void 0,this):b("span",{class:"node-title",onDblClick:e,title:"Double-click to rename",children:D},void 0,!1,void 0,this),b("div",{class:"node-controls",children:[H$&&b("span",{class:"pin-indicator",title:"Pinned",children:"⊙"},void 0,!1,void 0,this),b("button",{type:"button",class:`ctx-pin-btn${z?" ctx-pin-active":""}`,onClick:(f)=>{f.stopPropagation(),N4($.id)},title:z?"Remove from context":"Add to context",children:"✦"},void 0,!1,void 0,this),t0($)&&b("button",{type:"button",onClick:(f)=>{f.stopPropagation(),d0($)},title:"Open as site",children:"↗"},void 0,!1,void 0,this),Q_.has($.type)&&b("button",{type:"button",onClick:(f)=>{f.stopPropagation(),z6($.id)},title:"Expand (focus mode)",children:"⤢"},void 0,!1,void 0,this),b("button",{type:"button",onClick:(f)=>{f.stopPropagation(),M6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),b("button",{type:"button",onClick:(f)=>{f.stopPropagation(),y4($.id),y_($.id)},title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&b("div",{ref:U$,class:"node-body",children:v},void 0,!1,void 0,this),!$.collapsed&&b("div",{class:"node-resize-handle",onPointerDown:(f)=>C(f,$.size.width,$.size.height)},void 0,!1,void 0,this),["top","right","bottom","left"].map((f)=>b("div",{class:`node-port node-port-${f}`,onPointerDown:(a)=>{a.stopPropagation(),a.preventDefault();let O$=$.position.x+$.size.width/2,W$=$.position.y+$.size.height/2,V$=$.size.width/2,C$=$.size.height/2,Wv,Bv;switch(f){case"top":Wv=O$,Bv=W$-C$;break;case"bottom":Wv=O$,Bv=W$+C$;break;case"left":Wv=O$-V$,Bv=W$;break;case"right":Wv=O$+V$,Bv=W$;break}Dv.value={fromId:$.id,fromX:Wv,fromY:Bv,cursorX:Wv,cursorY:Bv}}},f,!1,void 0,this))]},void 0,!0,void 0,this)}var $w={relation:"var(--c-muted)","depends-on":"var(--c-warn)",flow:"var(--c-accent)",references:"var(--c-dim)"},vw=new Set(["depends-on","flow"]);function Uw($){if($.style==="dashed")return"8 4";if($.style==="dotted")return"3 3";if($.type==="references"&&!$.style)return"8 4";return}function eB($,v){let g=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,U=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2,J=U-g,G=z-_,K=$.size.width/2,O=$.size.height/2,W=Math.abs(G/(J||0.001)),B=O/(K||0.001);if(W>B){let P=G>0?1:-1;return{x:g+O/W*(J>0?1:-1),y:_+O*P}}let k=J>0?1:-1;return{x:g+K*k,y:_+W*K*(G>0?1:-1)}}function gw($,v,g,_,U,z,J,G){return{x:0.125*$+0.375*g+0.375*U+0.125*J,y:0.125*v+0.375*_+0.375*z+0.125*G}}function _w({edge:$,fromNode:v,toNode:g,focused:_,dimmed:U}){let z=eB(v,g),J=eB(g,v),G=J.x-z.x,K=J.y-z.y,O=Math.sqrt(G*G+K*K),W=Math.min(O*0.25,80),B=G/(O||1),k=K/(O||1),P=z.x+B*W,X=z.y+k*W,L=J.x-B*W,Y=J.y-k*W,I=`M ${z.x} ${z.y} C ${P} ${X}, ${L} ${Y}, ${J.x} ${J.y}`,q=$w[$.type],w=vw.has($.type),S=Uw($),C=$.label?gw(z.x,z.y,P,X,L,Y,J.x,J.y):null,o=`edge-path-${$.id}`;return b("g",{children:[b("path",{d:I,fill:"none",stroke:"transparent","stroke-width":"12",style:{cursor:"pointer"}},void 0,!1,void 0,this),_&&b("path",{d:I,fill:"none",stroke:q,"stroke-width":"6","stroke-dasharray":S,opacity:"0.15",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),b("path",{id:o,d:I,fill:"none",stroke:q,"stroke-width":_?2.5:1.5,"stroke-dasharray":S,"marker-end":w?"url(#edge-arrow)":void 0,opacity:U?0.2:_?1:0.75,style:{transition:"opacity 0.2s, stroke-width 0.2s"}},void 0,!1,void 0,this),$.animated&&b("circle",{r:"3",fill:q,opacity:"0.9",children:b("animateMotion",{dur:"2s",repeatCount:"indefinite",children:b("mpath",{href:`#${o}`},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),C&&$.label&&b("g",{transform:`translate(${C.x}, ${C.y})`,children:[b("rect",{class:"edge-label-bg",x:-($.label.length*3.5+8),y:"-10",width:$.label.length*7+16,height:"20",rx:"4"},void 0,!1,void 0,this),b("text",{class:"edge-label","text-anchor":"middle","dominant-baseline":"central",fill:"var(--c-text)","font-size":"11",children:$.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $P({nodes:$,edges:v}){let g=$.value,_=Array.from(v.value.values()),U=u$.value,z=U!==null,J=Z6.value,G=J!==null;if(_.length===0)return null;let K=96,O=Array.from(g.values()),W=Math.min(...O.map((Y)=>Y.position.x))-K,B=Math.min(...O.map((Y)=>Y.position.y))-K,k=Math.max(...O.map((Y)=>Y.position.x+Y.size.width))+K,P=Math.max(...O.map((Y)=>Y.position.y+Y.size.height))+K,X=Math.max(1,k-W),L=Math.max(1,P-B);return b("svg",{"aria-label":"Canvas connections",role:"img",viewBox:`${W} ${B} ${X} ${L}`,width:X,height:L,style:{position:"absolute",top:`${B}px`,left:`${W}px`,pointerEvents:"none",overflow:"visible"},children:[b("title",{children:"Canvas connections"},void 0,!1,void 0,this),b("defs",{children:b("marker",{id:"edge-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:b("path",{d:"M 0 1 L 10 5 L 0 9 z",fill:"currentColor",opacity:"0.75"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),_.map((Y)=>{let I=g.get(Y.from),q=g.get(Y.to);if(!I||!q)return null;let w=z&&(Y.from===U||Y.to===U),S=G&&!(J.has(Y.from)||J.has(Y.to));return b(_w,{edge:Y,fromNode:I,toNode:q,focused:w,dimmed:z&&!w||S},Y.id,!1,void 0,this)}),Dv.value&&(()=>{let Y=Dv.value,I=Y.cursorX-Y.fromX,q=Y.cursorY-Y.fromY,w=Math.sqrt(I*I+q*q),S=Math.min(w*0.25,80),C=I/(w||1),o=q/(w||1),y=`M ${Y.fromX} ${Y.fromY} C ${Y.fromX+C*S} ${Y.fromY+o*S}, ${Y.cursorX-C*S} ${Y.cursorY-o*S}, ${Y.cursorX} ${Y.cursorY}`;return b("g",{children:[b("path",{d:y,fill:"none",stroke:"var(--c-accent)","stroke-width":"6",opacity:"0.1",style:{filter:"blur(3px)"}},void 0,!1,void 0,this),b("path",{d:y,fill:"none",stroke:"var(--c-accent)","stroke-width":"2","stroke-dasharray":"6 4",opacity:"0.8"},void 0,!1,void 0,this),b("circle",{cx:Y.cursorX,cy:Y.cursorY,r:"5",fill:"var(--c-accent)",opacity:"0.5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)})()]},void 0,!0,void 0,this)}function zw($){let[v,...g]=$;if(!v)return"";return g.reduce((_,U)=>`${_} L ${U.x} ${U.y}`,`M ${v.x} ${v.y}`)}function xb({annotations:$}){if($.length===0)return null;return b("svg",{class:"annotation-layer","aria-hidden":"true",children:$.map((v)=>{let g=v.color==="currentColor"?"var(--c-annotation)":v.color;if(v.type==="text"){let _=v.points[0];if(!_||!v.text)return null;return b("text",{x:_.x,y:_.y,fill:g,"font-size":v.width,"font-family":"var(--font)","font-weight":"700",opacity:"0.95",children:v.text},v.id,!1,void 0,this)}return b("path",{d:zw(v.points),fill:"none",stroke:g,"stroke-width":v.width,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0.9"},v.id,!1,void 0,this)})},void 0,!1,void 0,this)}var Jw=0.1,Gw=4,vP=1;function UP($){return Math.min(Gw,Math.max(Jw,$))}function gP({viewport:$,onViewportChange:v,onViewportCommit:g,disabled:_=!1}){let U=R(null),z=R(!1),J=R({x:0,y:0}),G=R(0),K=R(null),O=M((Y)=>{if(K.current!==null)window.clearTimeout(K.current);K.current=window.setTimeout(()=>{K.current=null,g(Y)},140)},[g]),W=M((Y)=>{if(_)return;Y.preventDefault();let I=$.value;if(Y.ctrlKey||Y.metaKey){let q=U.current?.getBoundingClientRect();if(!q)return;let w=Y.clientX-q.left,S=Y.clientY-q.top,C=-Y.deltaY*0.002,o=UP(I.scale*(1+C)),y=o/I.scale,n={x:w-y*(w-I.x),y:S-y*(S-I.y),scale:o};v(n),O(n)}else{let q={x:I.x-Y.deltaX*vP,y:I.y-Y.deltaY*vP,scale:I.scale};v(q),O(q)}},[_,$,v,O]),B=M((Y)=>{if(_)return;let I=U.current;if(!I||Y.target!==I)return;z.current=!0,J.current={x:Y.clientX,y:Y.clientY},I.setPointerCapture(Y.pointerId)},[_]),k=M((Y)=>{if(!z.current)return;if(_)return;let I=Y.clientX-J.current.x,q=Y.clientY-J.current.y;J.current={x:Y.clientX,y:Y.clientY};let w=$.value;v({x:w.x+I,y:w.y+q,scale:w.scale})},[_,$,v]),P=M(()=>{if(z.current)g($.value);z.current=!1},[g,$]),X=M((Y)=>{if(_)return;if(Y.touches.length!==2){G.current=0;return}Y.preventDefault();let I=Y.touches[0],q=Y.touches[1],w=Math.hypot(q.clientX-I.clientX,q.clientY-I.clientY),S=(I.clientX+q.clientX)/2,C=(I.clientY+q.clientY)/2;if(G.current>0){let o=$.value,y=U.current?.getBoundingClientRect();if(!y)return;let n=S-y.left,e=C-y.top,D=w/G.current,N=UP(o.scale*D),U$=N/o.scale,m={x:n-U$*(n-o.x),y:e-U$*(e-o.y),scale:N};v(m),O(m)}G.current=w},[_,$,v,O]),L=M(()=>{if(K.current!==null)window.clearTimeout(K.current),K.current=null;g($.value),G.current=0},[g,$]);return E(()=>{let Y=U.current;if(!Y)return;return Y.addEventListener("wheel",W,{passive:!1}),Y.addEventListener("pointerdown",B),Y.addEventListener("pointermove",k),Y.addEventListener("pointerup",P),Y.addEventListener("pointercancel",P),Y.addEventListener("touchmove",X,{passive:!1}),Y.addEventListener("touchend",L),()=>{if(K.current!==null)window.clearTimeout(K.current);Y.removeEventListener("wheel",W),Y.removeEventListener("pointerdown",B),Y.removeEventListener("pointermove",k),Y.removeEventListener("pointerup",P),Y.removeEventListener("pointercancel",P),Y.removeEventListener("touchmove",X),Y.removeEventListener("touchend",L)}},[W,B,k,P,X,L]),U}function bw($){switch($.type){case"markdown":return b(s_,{node:$},void 0,!1,void 0,this);case"mcp-app":return b(h6,{node:$},void 0,!1,void 0,this);case"webpage":return b(g2,{node:$},void 0,!1,void 0,this);case"json-render":return b(h6,{node:$},void 0,!1,void 0,this);case"graph":return b(h6,{node:$},void 0,!1,void 0,this);case"prompt":return b(_2,{node:$},void 0,!1,void 0,this);case"response":return b(z2,{node:$},void 0,!1,void 0,this);case"status":return b(wU,{node:$},void 0,!1,void 0,this);case"context":return b(_4,{node:$},void 0,!1,void 0,this);case"ledger":return b(V4,{node:$},void 0,!1,void 0,this);case"trace":return b(J2,{node:$},void 0,!1,void 0,this);case"file":return b(p_,{node:$},void 0,!1,void 0,this);case"image":return b(U2,{node:$},void 0,!1,void 0,this);case"html":return b(lg,{node:$},void 0,!1,void 0,this);case"group":return b(bB,{node:$},void 0,!1,void 0,this);default:return b("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function Kw($,v,g){let _=g.x-v.x,U=g.y-v.y,z=_*_+U*U;if(z===0)return Math.hypot($.x-v.x,$.y-v.y);let J=Math.max(0,Math.min(1,(($.x-v.x)*_+($.y-v.y)*U)/z));return Math.hypot($.x-(v.x+J*_),$.y-(v.y+J*U))}function Ow($,v,g){for(let _=$.length-1;_>=0;_--){let U=$[_];if(!U)continue;let z=g+U.width;if(v.x<U.bounds.x-z||v.x>U.bounds.x+U.bounds.width+z||v.y<U.bounds.y-z||v.y>U.bounds.y+U.bounds.height+z)continue;if(U.type==="text")return U;for(let J=1;J<U.points.length;J++){let G=U.points[J-1],K=U.points[J];if(G&&K&&Kw(v,G,K)<=g+U.width/2)return U}}return null}var hb="currentColor",_P=4,zP=24,Ww=14,Bw=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]),Pw=new Set(["md","mdx","markdown"]),JP={width:520,height:420};function kw($){let v=$.trim();if(!v||/\s/.test(v))return null;let g=/^[a-z][a-z0-9+.-]*:/i.test(v)?v:`https://${v}`;try{let _=new URL(g);if(_.protocol!=="http:"&&_.protocol!=="https:")return null;return _.toString()}catch{return null}}function lb($){let v=$.trim();if(!v)return[];let g=v.includes(`
228
+ `)?v.split(/\r?\n/):v.split(/\s+/),_=new Set,U=[];for(let z of g){let J=z.trim();if(!J||J.startsWith("#"))continue;let G=kw(J);if(!G||_.has(G))continue;_.add(G),U.push(G)}return U}function Yw($){let v=lb($.getData("text/uri-list"));if(v.length>0)return v;return lb($.getData("text/plain"))}function Hw($){if(!$)return!1;return $.types.includes("text/uri-list")||$.types.includes("text/plain")}function GP($){if(!($ instanceof HTMLElement))return!1;return Boolean($.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]'))}function Lw($){let v=$.split(".").pop()?.toLowerCase()??"";if(Bw.has(v))return"image";if(Pw.has(v))return"markdown";return"file"}function Iw($,v){let g=[],_=0;for(let U of $){if(U.dockPosition!==null)continue;if(v&&U.id===v)continue;if(U.type==="group")g.splice(_++,0,U);else g.push(U)}return g}function bP({onNodeContextMenu:$,onCanvasContextMenu:v,annotationMode:g=!1,annotationTool:_=null}){let U=k$.value,z=R(!1),J=R(!1),G=R([]),[K,O]=h(null),[W,B]=h(null),[k,P]=h(null),X=R(null),[L,Y]=h(!1),I=R(0),q=R(null),w=gP({viewport:k$,disabled:g,onViewportChange:(Q)=>{if(z.current||g)return;u4(),qO(Q)},onViewportCommit:(Q)=>{if(z.current||g)return;u4(),FO(Q)}}),S=M((Q)=>{X.current=Q,P(Q)},[]),C=M(async(Q,p,s)=>{if(Q.length===0)return;let{width:d,height:b$}=JP,g$=24,x=Math.ceil(Math.sqrt(Q.length)),f=Math.ceil(Q.length/x),a=x*d+Math.max(0,x-1)*g$,O$=f*b$+Math.max(0,f-1)*g$;for(let W$=0;W$<Q.length;W$++){let V$=W$%x,C$=Math.floor(W$/x),Wv=p-a/2+V$*(d+g$),Bv=s-O$/2+C$*(b$+g$);await cv({type:"webpage",content:Q[W$],x:Wv,y:Bv,width:d,height:b$})}},[]),o=M((Q)=>{let p=w.current;if(!p)return;if(_==="eraser"){if((Q.target instanceof Element?Q.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;Q.preventDefault(),Q.stopPropagation();let f=p.getBoundingClientRect(),a=k$.value,O$={x:(Q.clientX-f.left-a.x)/a.scale,y:(Q.clientY-f.top-a.y)/a.scale},W$=Ow(Array.from(S4.value.values()),O$,Ww/a.scale);if(W$)LO(W$.id);return}if(_==="text"){if((Q.target instanceof Element?Q.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;Q.preventDefault(),Q.stopPropagation(),u$.value=null,rv();let f=p.getBoundingClientRect(),a=k$.value;S({x:(Q.clientX-f.left-a.x)/a.scale,y:(Q.clientY-f.top-a.y)/a.scale,value:""});return}if(_==="pen"){if((Q.target instanceof Element?Q.target:null)?.closest(".hud-layer, .snapshot-panel, .context-menu, .command-palette"))return;Q.preventDefault(),Q.stopPropagation(),u$.value=null,rv(),J.current=!0;let f=p.getBoundingClientRect(),a=k$.value,O$={x:(Q.clientX-f.left-a.x)/a.scale,y:(Q.clientY-f.top-a.y)/a.scale};G.current=[O$],B({id:"draft-annotation",type:"freehand",points:[O$],bounds:{x:0,y:0,width:0,height:0},color:hb,width:_P,createdAt:""}),p.setPointerCapture(Q.pointerId);return}if(Q.target!==p)return;if(!Q.shiftKey){if(!q.current)u$.value=null,rv();return}Q.preventDefault(),Q.stopPropagation(),z.current=!0;let s=p.getBoundingClientRect(),d=Q.clientX-s.left,b$=Q.clientY-s.top,g$={startX:d,startY:b$,currentX:d,currentY:b$};q.current=g$,O(g$),p.setPointerCapture(Q.pointerId)},[_,w]),y=M((Q)=>{if(J.current){let d=w.current;if(!d)return;let b$=d.getBoundingClientRect(),g$=k$.value,x={x:(Q.clientX-b$.left-g$.x)/g$.scale,y:(Q.clientY-b$.top-g$.y)/g$.scale},f=G.current.at(-1);if(f&&Math.hypot(x.x-f.x,x.y-f.y)<2)return;G.current=[...G.current,x],B((a)=>a?{...a,points:G.current}:null);return}if(!z.current||!q.current)return;let p=w.current?.getBoundingClientRect();if(!p)return;let s={...q.current,currentX:Q.clientX-p.left,currentY:Q.clientY-p.top};q.current=s,O(s)},[w]),n=M((Q)=>{if(J.current){J.current=!1;let x=G.current;if(G.current=[],B(null),x.length>=2)C2({points:x,color:hb,width:_P});let f=w.current;if(f?.hasPointerCapture(Q.pointerId))f.releasePointerCapture(Q.pointerId);return}let p=q.current;if(!z.current||!p)return;z.current=!1,q.current=null;let s=Math.min(p.startX,p.currentX),d=Math.max(p.startX,p.currentX),b$=Math.min(p.startY,p.currentY),g$=Math.max(p.startY,p.currentY);if(d-s>5||g$-b$>5){let x=k$.value,f=(s-x.x)/x.scale,a=(d-x.x)/x.scale,O$=(b$-x.y)/x.scale,W$=(g$-x.y)/x.scale,V$=[];for(let C$ of j.value.values()){if(C$.dockPosition!==null)continue;let Wv=C$.position.x,Bv=C$.position.y;if(Wv+C$.size.width>f&&Wv<a&&Bv+C$.size.height>O$&&Bv<W$)V$.push(C$.id)}if(V$.length>0)WO(V$)}O(null)},[]);E(()=>{if(g)return;if(!J.current&&!W&&!k)return;J.current=!1,G.current=[],B(null),S(null)},[g,W,S,k]);let e=M(()=>{let Q=X.current;if(!Q)return;let p=Q.value.trim();if(S(null),!p)return;let s={x:Q.x,y:Q.y};C2({type:"text",points:[s],color:hb,width:zP,text:p})},[S]);E(()=>{if(_!=="text"&&k)S(null)},[_,S,k]),E(()=>{function Q(s){if(!Dv.value)return;let d=w.current;if(!d)return;let b$=d.getBoundingClientRect(),g$=k$.value;Dv.value={...Dv.value,cursorX:(s.clientX-b$.left-g$.x)/g$.scale,cursorY:(s.clientY-b$.top-g$.y)/g$.scale}}function p(s){let d=Dv.value;if(!d)return;Dv.value=null;let b$=w.current;if(!b$)return;let g$=b$.getBoundingClientRect(),x=k$.value,f=(s.clientX-g$.left-x.x)/x.scale,a=(s.clientY-g$.top-x.y)/x.scale;for(let O$ of j.value.values()){if(O$.id===d.fromId||O$.dockPosition!==null)continue;if(f>=O$.position.x&&f<=O$.position.x+O$.size.width&&a>=O$.position.y&&a<=O$.position.y+O$.size.height){Q4(d.fromId,O$.id,"relation");return}}}return document.addEventListener("pointermove",Q),document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointermove",Q),document.removeEventListener("pointerup",p)}},[w]);let D=M((Q)=>{if(g)return;let p=w.current;if(!p||Q.target!==p)return;let s=p.getBoundingClientRect(),d=k$.value,b$=(Q.clientX-s.left-d.x)/d.scale,g$=(Q.clientY-s.top-d.y)/d.scale,x=520,f=360;cv({type:"markdown",title:"New note",x:b$-x/2,y:g$-f/2,width:x,height:f})},[g,w]),N=M((Q)=>{if(g)return;if(!v)return;let p=w.current;if(!p)return;if((Q.target instanceof Element?Q.target:null)?.closest(".canvas-node"))return;let d=p.getBoundingClientRect(),b$=k$.value,g$=(Q.clientX-d.left-b$.x)/b$.scale,x=(Q.clientY-d.top-b$.y)/b$.scale;v(Q,g$,x)},[g,w,v]),U$=M((Q)=>{if(Q.preventDefault(),I.current++,Q.dataTransfer?.types.includes("Files")||Hw(Q.dataTransfer))Y(!0)},[]),m=M((Q)=>{if(Q.preventDefault(),Q.dataTransfer)Q.dataTransfer.dropEffect="copy"},[]),i=M((Q)=>{if(Q.preventDefault(),I.current--,I.current<=0)I.current=0,Y(!1)},[]),H$=M(async(Q)=>{Q.preventDefault(),Y(!1),I.current=0;let p=w.current;if(!p||!Q.dataTransfer)return;let s=p.getBoundingClientRect(),d=k$.value,b$=(Q.clientX-s.left-d.x)/d.scale,g$=(Q.clientY-s.top-d.y)/d.scale,x=Array.from(Q.dataTransfer.files);if(x.length===0){let V$=Yw(Q.dataTransfer);await C(V$,b$,g$);return}let f=400,a=300,O$=20,W$=Math.ceil(Math.sqrt(x.length));for(let V$=0;V$<x.length;V$++){let C$=x[V$],Wv=V$%W$,Bv=Math.floor(V$/W$),Y6=b$-W$*(f+O$)/2+Wv*(f+O$),eg=g$-a/2+Bv*(a+O$),H6=Lw(C$.name),$_=C$.name;if(H6==="image"){let sv=new FileReader,Av=await new Promise((uU)=>{sv.onload=()=>uU(sv.result),sv.readAsDataURL(C$)});await cv({type:"image",title:$_,content:Av,x:Y6,y:eg,width:f,height:a})}else{let sv=await C$.text(),Av=H6==="markdown"||H6==="file";await cv({type:H6,title:$_,content:sv,x:Y6,y:eg,width:Av?720:f,height:Av?500:a})}}},[w,C]);E(()=>{let Q=async(p)=>{if(p.defaultPrevented)return;if(GP(p.target instanceof Element?p.target:null))return;if(GP(document.activeElement))return;let s=p.clipboardData?.getData("text/plain")??"",d=lb(s);if(d.length===0)return;let b$=w.current;if(!b$)return;p.preventDefault();let g$=b$.getBoundingClientRect(),x=k$.value,f=(g$.width/2-x.x)/x.scale,a=(g$.height/2-x.y)/x.scale;await C(d,f,a)};return document.addEventListener("paste",Q),()=>{document.removeEventListener("paste",Q)}},[w,C]);let q$=Iw(j.value.values(),r$.value),l$=null;if(K){let Q=Math.min(K.startX,K.currentX),p=Math.min(K.startY,K.currentY),s=Math.abs(K.currentX-K.startX),d=Math.abs(K.currentY-K.startY);l$={position:"absolute",left:`${Q}px`,top:`${p}px`,width:`${s}px`,height:`${d}px`,pointerEvents:"none"}}return b("div",{class:"canvas-viewport",ref:w,tabIndex:0,onPointerDown:o,onPointerMove:y,onPointerUp:n,onContextMenu:N,onDblClick:D,onDragEnter:U$,onDragOver:m,onDragLeave:i,onDrop:H$,style:{width:"100%",height:"100%",position:"relative",overflow:"hidden",cursor:_==="eraser"?"cell":_==="text"?"text":g||Dv.value||z.current?"crosshair":"grab"},children:[b("div",{style:{transform:`matrix(${U.scale}, 0, 0, ${U.scale}, ${U.x}, ${U.y})`,transformOrigin:"0 0",willChange:"transform",position:"absolute",top:0,left:0},children:[b(HB,{},void 0,!1,void 0,this),b(xB,{},void 0,!1,void 0,this),b($P,{nodes:j,edges:m$},void 0,!1,void 0,this),b(xb,{annotations:Array.from(S4.value.values())},void 0,!1,void 0,this),W&&W.points.length>=2&&b(xb,{annotations:[W]},void 0,!1,void 0,this),q$.map((Q)=>b(sB,{node:Q,onContextMenu:$,children:bw(Q)},Q.id,!1,void 0,this)),k4.value&&b("svg",{class:"snap-guides-svg",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},children:k4.value.map((Q,p)=>Q.axis==="x"?b("line",{x1:Q.pos,y1:Q.from-20,x2:Q.pos,y2:Q.to+20,class:"snap-guide-line"},p,!1,void 0,this):b("line",{x1:Q.from-20,y1:Q.pos,x2:Q.to+20,y2:Q.pos,class:"snap-guide-line"},p,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&b("div",{class:`annotation-capture-layer${_==="eraser"?" erasing":""}${_==="text"?" text":""}`,"aria-hidden":"true"},void 0,!1,void 0,this),k&&b("input",{class:"annotation-text-input",value:k.value,autoFocus:!0,style:{left:`${k.x*U.scale+U.x}px`,top:`${k.y*U.scale+U.y}px`,fontSize:`${zP*U.scale}px`},onInput:(Q)=>S({...k,value:Q.target.value}),onBlur:e,onPointerDown:(Q)=>Q.stopPropagation(),onKeyDown:(Q)=>{if(Q.key==="Enter")Q.preventDefault(),e();if(Q.key==="Escape")Q.preventDefault(),S(null)}},void 0,!1,void 0,this),l$&&b("div",{class:"lasso-rect",style:l$},void 0,!1,void 0,this),L&&b("div",{class:"drop-zone-overlay",children:b("div",{class:"drop-zone-indicator",children:[b("div",{class:"drop-zone-icon",children:"+"},void 0,!1,void 0,this),b("div",{class:"drop-zone-label",children:"Drop files or URLs to add to canvas"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function qw($,v){let g=$.toLowerCase(),_=v.toLowerCase(),U=[],z=0,J=0,G=-1;for(let K=0;K<_.length&&z<g.length;K++)if(_[K]===g[z]){if(U.push(K),J+=G===K-1?10:1,K===0||_[K-1]===" "||_[K-1]==="-"||_[K-1]==="_")J+=5;G=K,z++}return{match:z===g.length,score:J,indices:U}}function Xw($,v){if(v.length===0)return $;let g=[],_=0;for(let U of v){if(U>_)g.push($.slice(_,U));g.push(b("mark",{children:$[U]},U,!1,void 0,this)),_=U+1}if(_<$.length)g.push($.slice(_));return g}var pb={md:"markdown",app:"mcp-app",web:"webpage",ui:"json-render",chart:"graph",ctx:"context",log:"ledger"};function Fw($){let v=$.toLowerCase().trim();if(v.startsWith("type:")){let g=v.slice(5).trim(),U=Object.keys($v).find((J)=>J.startsWith(g));if(U)return{typeFilter:U,remaining:""};let z=pb[g];if(z)return{typeFilter:z,remaining:""}}if(pb[v])return{typeFilter:pb[v],remaining:""};return{typeFilter:null,remaining:$}}function KP({onClose:$,onToggleMinimap:v}){let[g,_]=h(""),[U,z]=h(0),J=R(null),G=R(null);E(()=>{setTimeout(()=>J.current?.focus(),30)},[]);let K=M(()=>{let L=[];for(let I of j.value.values()){let q=I.data.title||$v[I.type],w=I.data.content||I.data.path||"";L.push({id:`node:${I.id}`,kind:"node",label:q,description:w.length>80?w.slice(0,80)+"...":w||void 0,badge:$v[I.type],nodeType:I.type,action:()=>{Iv(I.id),$()}})}let Y=[{label:"New note (markdown node)",badge:"CREATE",action:()=>{cv({type:"markdown",title:"New note",width:520,height:360}),$()}},{label:"Fit all nodes",badge:"VIEW",action:()=>{f_(window.innerWidth,window.innerHeight),$()}},{label:"Auto-arrange (grid)",badge:"LAYOUT",action:()=>{E_(),$()}},{label:"Auto-arrange (graph-aware)",badge:"LAYOUT",action:()=>{m_(),$()}},{label:"Toggle minimap",badge:"VIEW",action:()=>{v(),$()}},{label:"Toggle theme (dark/light)",badge:"THEME",action:()=>{let I=j$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",I),FU(),j$.value=I,S_(I),$()}}];for(let I of Y)L.push({id:`action:${I.label}`,kind:"action",label:I.label,badge:I.badge,badgeClass:"command-palette-badge--action",action:I.action});return L},[$,v]),{typeFilter:O,remaining:W}=Fw(g),B=K(),k;if(!g.trim())k=B.map((L)=>({...L,score:0,indices:[]}));else{k=[];for(let L of B){if(O){if(L.kind!=="node"||L.nodeType!==O)continue;if(!W){k.push({...L,score:0,indices:[]});continue}}let Y=qw(W||g,L.label);if(Y.match)k.push({...L,score:Y.score,indices:Y.indices})}k.sort((L,Y)=>Y.score-L.score)}E(()=>{if(!g.trim()){Z6.value=null;return}let L=new Set;for(let Y of k)if(Y.kind==="node")L.add(Y.id.slice(5));Z6.value=L.size>0?L:null},[g,k]),E(()=>{return()=>{Z6.value=null}},[]);let P=Math.min(U,Math.max(0,k.length-1)),X=M((L)=>{if(L.key==="ArrowDown")L.preventDefault(),z((Y)=>Math.min(Y+1,k.length-1));else if(L.key==="ArrowUp")L.preventDefault(),z((Y)=>Math.max(Y-1,0));else if(L.key==="Enter"){if(L.preventDefault(),k[P])k[P].action()}else if(L.key==="Escape")L.preventDefault(),L.stopPropagation(),$()},[k,P,$]);return E(()=>{let L=G.current;if(!L)return;L.children[P]?.scrollIntoView({block:"nearest"})},[P]),E(()=>{z(0)},[g]),b("div",{class:"command-palette-backdrop",onMouseDown:$,children:b("div",{class:"command-palette",onMouseDown:(L)=>L.stopPropagation(),children:[b("input",{ref:J,type:"text",class:"command-palette-input",value:g,onInput:(L)=>_(L.target.value),onKeyDown:X,placeholder:`Search nodes and actions... (${Mv}+K)`},void 0,!1,void 0,this),b("div",{class:"command-palette-hint",children:[b("span",{children:[b("kbd",{children:"↑"},void 0,!1,void 0,this),b("kbd",{children:"↓"},void 0,!1,void 0,this)," navigate"]},void 0,!0,void 0,this),b("span",{children:[b("kbd",{children:"↵"},void 0,!1,void 0,this)," select"]},void 0,!0,void 0,this),b("span",{children:[b("kbd",{children:"esc"},void 0,!1,void 0,this)," close"]},void 0,!0,void 0,this),b("span",{children:[b("kbd",{children:"type:"},void 0,!1,void 0,this)," filter by type"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"command-palette-results",ref:G,children:[k.length===0&&b("div",{class:"command-palette-empty",children:"No matching nodes or actions"},void 0,!1,void 0,this),k.map((L,Y)=>b("button",{type:"button",class:`command-palette-item${Y===P?" selected":""}`,onMouseEnter:()=>z(Y),onClick:()=>L.action(),children:[b("span",{class:`command-palette-badge${L.badgeClass?` ${L.badgeClass}`:""}`,children:L.badge},void 0,!1,void 0,this),b("span",{class:"command-palette-label",children:L.indices.length>0?Xw(L.label,L.indices):L.label},void 0,!1,void 0,this),L.description&&b("span",{class:"command-palette-desc",children:L.description},void 0,!1,void 0,this)]},L.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function OP(){let[$,v]=h(null),g=M((z,J)=>{z.preventDefault(),z.stopPropagation(),v({kind:"node",x:z.clientX,y:z.clientY,nodeId:J})},[]),_=M((z,J,G)=>{z.preventDefault(),z.stopPropagation(),v({kind:"canvas",x:z.clientX,y:z.clientY,canvasX:J,canvasY:G})},[]),U=M(()=>v(null),[]);return E(()=>{if(!$)return;let z=()=>v(null),J=(G)=>{if(G.key==="Escape")v(null)};return document.addEventListener("click",z),document.addEventListener("keydown",J),()=>{document.removeEventListener("click",z),document.removeEventListener("keydown",J)}},[$]),{menu:$,openNodeMenu:g,openCanvasMenu:_,closeMenu:U}}var ww="#4bbcFF",Aw=[{label:"Blue",value:"#3b82f6"},{label:"Green",value:"#22c55e"},{label:"Yellow",value:"#eab308"},{label:"Red",value:"#ef4444"},{label:"Gray",value:"#6b7280"},{label:"Purple",value:"#a855f7"}];function WP({menu:$,onClose:v}){let g;if($.kind==="node"){let G=j.value.get($.nodeId);if(!G)return null;g=yw(G)}else g=Nw($.canvasX,$.canvasY);let _=new Map,U=g.some((G)=>G.render)?g.length*32+168:g.length*32+8,z=Math.min($.x,Math.max(12,window.innerWidth-240)),J=Math.min($.y,Math.max(12,window.innerHeight-U));return b("div",{class:"context-menu",style:{position:"fixed",left:`${z}px`,top:`${J}px`,zIndex:1e4},onPointerDown:(G)=>G.stopPropagation(),onClick:(G)=>G.stopPropagation(),children:g.map((G)=>{let K=G.separator?"separator":G.render?"custom":`${G.label??"item"}:${G.shortcut??""}`,O=(_.get(K)??0)+1;_.set(K,O);let W=`${K}:${O}`;if(G.separator)return b("div",{class:"context-menu-separator"},W,!1,void 0,this);if(G.render)return b("div",{class:"context-menu-custom",children:G.render(v)},W,!1,void 0,this);return b("button",{type:"button",class:"context-menu-item",onClick:()=>{G.action?.(),v()},children:[b("span",{class:"context-menu-label",children:G.label},void 0,!1,void 0,this),G.shortcut&&b("span",{class:"context-menu-shortcut",children:G.shortcut},void 0,!1,void 0,this)]},W,!0,void 0,this)})},void 0,!1,void 0,this)}function Zw($){return(typeof $.data.path==="string"?$.data.path.trim():"")||null}function G2($){let v=$.trim().toLowerCase(),g=v.match(/^#([0-9a-f]{3})$/);if(g){let[_,U,z]=g[1].split("");return`#${_}${_}${U}${U}${z}${z}`}return v}function BP($){if(typeof $.data.color!=="string"||!$.data.color.trim())return null;return G2($.data.color)}function Qw($){let v=BP($);return v&&/^#[0-9a-f]{6}$/.test(v)?v:G2(ww)}function ob($,v){let g=v?G2(v):null;Pv($.id,{data:{...$.data,color:g}}),Zv($.id,{data:{color:g}})}function Mw($,v){let g=BP($);return b("div",{class:"context-menu-section",children:[b("div",{class:"context-menu-section-header",children:[b("span",{class:"context-menu-section-label",children:"Group color"},void 0,!1,void 0,this),b("button",{type:"button",class:"context-menu-reset",onClick:()=>{ob($,null),v()},children:"Theme default"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"context-menu-color-grid",children:Aw.map((_)=>{let U=G2(_.value);return b("button",{type:"button",class:`context-menu-color-swatch${g===U?" active":""}`,"aria-label":`Set group color to ${_.label}`,title:_.label,style:{"--swatch-color":_.value},onClick:()=>{ob($,_.value),v()},children:[b("span",{class:"context-menu-color-dot",style:{"--swatch-color":_.value}},void 0,!1,void 0,this),b("span",{children:_.label},void 0,!1,void 0,this)]},_.value,!0,void 0,this)})},void 0,!1,void 0,this),b("label",{class:"context-menu-color-custom",children:[b("span",{children:"Custom"},void 0,!1,void 0,this),b("input",{type:"color",class:"context-menu-color-input","aria-label":"Custom group color",value:Qw($),onClick:(_)=>_.stopPropagation(),onInput:(_)=>{ob($,_.currentTarget.value),v()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function tb($,v,g,_){return{x:$-g/2,y:v-_/2}}function Sw($,v){return $.trim().replace(/[?#].*$/,"").split("/").filter(Boolean).at(-1)||v}async function nb($){let v=window.prompt($.promptLabel,$.placeholder??"");if(!v)return;let g=v.trim();if(!g)return;let _=tb($.canvasX,$.canvasY,$.width,$.height);if(!(await cv({type:$.type,...$.type!=="webpage"?{title:Sw(g,$.titleFallback)}:{},content:g,x:_.x,y:_.y,width:$.width,height:$.height})).ok)window.alert($.errorMessage)}function Nw($,v){return[{label:"New note",action:()=>{let U=tb($,v,520,360);cv({type:"markdown",title:"New note",x:U.x,y:U.y,width:520,height:360})}},{label:"Open webpage...",action:()=>{nb({promptLabel:"Webpage URL:",type:"webpage",canvasX:$,canvasY:v,width:520,height:420,placeholder:"https://example.com",titleFallback:"Webpage",errorMessage:"Could not create webpage node. Enter a valid http(s) URL."})}},{label:"Open file...",action:()=>{nb({promptLabel:"Workspace path or absolute file path:",type:"file",canvasX:$,canvasY:v,width:720,height:500,placeholder:"src/server/server.ts",titleFallback:"File",errorMessage:"Could not create file node. Check the path and try again."})}},{label:"Open image...",action:()=>{nb({promptLabel:"Image path, URL, or data URI:",type:"image",canvasX:$,canvasY:v,width:480,height:360,placeholder:"artifacts/architecture.png",titleFallback:"Image",errorMessage:"Could not create image node. Check the image source and try again."})}},{separator:!0},{label:"New group",action:()=>{let U=tb($,v,600,400);R_({title:"Group",x:U.x,y:U.y,width:600,height:400})}}]}function yw($){let v=[],g=Zw($);if(v.push({label:"Focus",action:()=>Iv($.id)}),Q_.has($.type))v.push({label:"Expand",shortcut:"⤢",action:()=>z6($.id)});v.push({label:$.collapsed?"Expand":"Collapse",action:()=>M6($.id)});let _=T$.value.has($.id);v.push({label:_?"Unpin from context":"Pin as context",action:()=>N4($.id)}),v.push({label:$.pinned?"Unlock position":"Lock position (no auto-arrange)",action:()=>{let J=!$.pinned;Pv($.id,{pinned:J}),Zv($.id,{pinned:J}),d$()}});let U=j_.value;if(U&&U.from!==$.id){let J=j.value.get(U.from),G=J?(J.data.title||J.id).slice(0,20):U.from;v.push({label:`Connect from "${G}"`,action:()=>{Q4(U.from,$.id,"relation"),j_.value=null}})}v.push({label:U?"Connect from here (replace)":"Connect from here",action:()=>{j_.value={from:$.id}}});let z=Array.from(m$.value.values()).filter((J)=>J.from===$.id||J.to===$.id).length;if(z>0)v.push({label:`${z} edge${z!==1?"s":""} connected`});if(v.push({separator:!0}),($.type==="markdown"||$.type==="file"||$.type==="image")&&g)v.push({label:"Open in browser",action:()=>{window.open(`/artifact?path=${encodeURIComponent(g)}`,"_blank","noopener")}}),v.push({label:"Copy path",action:()=>{navigator.clipboard.writeText(g)}});if($.type==="mcp-app"||$.type==="json-render"||$.type==="graph")if($.data.chartConfig){let J=$.data.chartConfig.title||"chart";v.push({label:"Copy chart data",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.chartConfig,null,2))}})}else{let J=$.data.url;if(v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank")}}),v.push({label:"Focus in TUI",action:()=>pK("mcp-app-focus",{url:J})}),$.type==="json-render"||$.type==="graph")v.push({label:"Copy spec",action:()=>{navigator.clipboard.writeText(JSON.stringify($.data.spec??$.data.graphConfig??{},null,2))}})}if($.type==="webpage"){let J=typeof $.data.url==="string"?$.data.url:"";v.push({label:"Refresh webpage",action:()=>{N_($.id)}}),v.push({label:"Open in browser",action:()=>{if(J)window.open(J,"_blank","noopener")}}),v.push({label:"Copy URL",action:()=>{if(J)navigator.clipboard.writeText(J)}})}if($.type==="group"){let J=$.data.children??[];if(v.push({separator:!0}),v.push({render:(G)=>Mw($,G)}),J.length>0)v.push({label:`Ungroup (${J.length} node${J.length!==1?"s":""})`,action:()=>$O($.id)})}if($.type==="status"||$.type==="ledger")if(v.push({separator:!0}),$.dockPosition!==null)v.push({label:"Undock to canvas",action:()=>R4($.id)});else v.push({label:"Dock left of toolbar",action:()=>f2($.id,"left")}),v.push({label:"Dock right of toolbar",action:()=>f2($.id,"right")});return v.push({separator:!0}),v.push({label:"Close",action:()=>{y4($.id),y_($.id)}}),v}function PP(){let $=T$.value.size;if($===0||X6.value||C_.value)return null;return b("div",{class:"context-pin-bar",children:[b("span",{class:"context-pin-bar-count",children:["✦"," ",$," node",$!==1?"s":""," in context"]},void 0,!0,void 0,this),b("button",{type:"button",class:"context-pin-bar-btn context-pin-bar-clear",onClick:PO,title:"Clear all context pins",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function kP({node:$}){let v=ub($),g=$.data.activeTool,_=$.data.subagent,U=v2[v]??"var(--c-muted)";return b("span",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1,minWidth:0},children:[b("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:U,animation:v!=="idle"?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),b("span",{style:{color:U,fontSize:"10px",textTransform:"uppercase",fontWeight:600},children:v},void 0,!1,void 0,this),g&&b("span",{style:{color:"var(--c-warn)",fontSize:"10px",fontFamily:"var(--mono)"},children:["⚙ ",g]},void 0,!0,void 0,this),_&&_.state!=="completed"&&b("span",{style:{color:"var(--c-subagent)",fontSize:"10px"},children:["⠉ ",_.name]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Dw($){switch($.type){case"status":return b(wU,{node:$},void 0,!1,void 0,this);case"ledger":return b(V4,{node:$},void 0,!1,void 0,this);case"context":return b(_4,{node:$},void 0,!1,void 0,this);default:return null}}function Rw($){let v=Array.isArray($.data.cards)?$.data.cards:[],g=Array.isArray($.data.auxTabs)?$.data.auxTabs:[];return v.length+g.length}function uw({node:$}){let v=YO(),g=v.length>0?v.length:Rw($),_=g>0,U=$.collapsed===!0,z=()=>{w_(),M6($.id)};if(U)return b("div",{class:"docked-node docked-node--collapsed","data-docked-node":"true",children:b("div",{class:"docked-node-header",children:[b("span",{class:"node-type-badge",children:"Context"},void 0,!1,void 0,this),_&&b("span",{class:"docked-node-count","aria-hidden":"true",children:g>99?"99+":g},void 0,!1,void 0,this),b("div",{class:"docked-node-controls",children:[b("button",{type:"button",onClick:(J)=>{J.stopPropagation(),z()},title:_?`${g} item${g===1?"":"s"} in agent context — expand`:"Expand agent context","aria-label":_?`Context — ${g} item${g===1?"":"s"}`:"Expand agent context",children:"▸"},void 0,!1,void 0,this),b("button",{type:"button",onClick:(J)=>{J.stopPropagation(),R4($.id)},title:"Undock to canvas","aria-label":"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return b("aside",{class:"context-dock-panel","data-docked-node":"true","aria-label":"Agent context",children:[b("div",{class:"context-dock-header",children:[b("div",{class:"context-dock-header-text",children:[b("span",{class:"context-dock-title",children:"Context"},void 0,!1,void 0,this),b("span",{class:"context-dock-subtitle",children:_?`${g} item${g===1?"":"s"} in agent context`:"Active agent context"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"context-dock-controls",children:[b("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),R4($.id)},"aria-label":"Undock to canvas",title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this),b("button",{type:"button",class:"context-dock-icon-button",onClick:(J)=>{J.stopPropagation(),M6($.id)},"aria-label":"Collapse context panel",title:"Collapse",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"context-dock-body",children:b(_4,{node:$,pinnedNodes:v},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function db({node:$}){if($.type==="context")return b(uw,{node:$},void 0,!1,void 0,this);return b("div",{class:`docked-node${$.collapsed?" docked-node--collapsed":""}`,"data-docked-node":"true",children:[b("div",{class:"docked-node-header",children:[b("span",{class:"node-type-badge",children:$v[$.type]??$.type},void 0,!1,void 0,this),$.type==="status"&&$.collapsed&&b(kP,{node:$},void 0,!1,void 0,this),b("div",{class:"docked-node-controls",children:[b("button",{type:"button",onClick:(v)=>{v.stopPropagation(),M6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),b("button",{type:"button",onClick:(v)=>{v.stopPropagation(),R4($.id)},title:"Undock to canvas",children:"⊙"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!$.collapsed&&b("div",{class:"docked-node-body",children:Dw($)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function YP($,v){switch($.type){case"markdown":return b(s_,{node:$,expanded:v},void 0,!1,void 0,this);case"mcp-app":return b(h6,{node:$,expanded:v},void 0,!1,void 0,this);case"webpage":return b(g2,{node:$,expanded:v},void 0,!1,void 0,this);case"json-render":return b(h6,{node:$,expanded:v},void 0,!1,void 0,this);case"graph":return b(h6,{node:$,expanded:v},void 0,!1,void 0,this);case"prompt":return b(_2,{node:$},void 0,!1,void 0,this);case"response":return b(z2,{node:$,expanded:v},void 0,!1,void 0,this);case"status":return b(wU,{node:$},void 0,!1,void 0,this);case"context":return b(_4,{node:$,expanded:v},void 0,!1,void 0,this);case"ledger":return b(V4,{node:$},void 0,!1,void 0,this);case"trace":return b(J2,{node:$},void 0,!1,void 0,this);case"file":return b(p_,{node:$,expanded:v},void 0,!1,void 0,this);case"image":return b(U2,{node:$,expanded:v},void 0,!1,void 0,this);case"html":return b(lg,{node:$,expanded:v},void 0,!1,void 0,this);default:return b("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function HP($){switch($.type){case"markdown":return $.data.content||"";case"file":return $.data.fileContent||"";case"webpage":return $.data.content||"";case"html":return $.data.html||$.data.content||"";case"json-render":case"graph":return JSON.stringify($.data.spec??$.data.graphConfig??{},null,2);default:return""}}function Tw($){if(!$)return 0;return $.split(/\s+/).filter(Boolean).length}function jw($,v){return $!==null&&typeof $==="object"&&$.source===pv&&$.type==="presentation-exit"&&$.token===v}function rw($){return $==="ArrowRight"||$==="PageDown"||$===" "||$==="ArrowLeft"||$==="PageUp"||$==="Home"||$==="End"}function LP($){return $ instanceof HTMLElement&&Boolean($.closest(".html-presentation-exit"))}function IP(){let $=r$.value,v=$?j.value.get($):void 0,[g,_]=h(!1),[U,z]=h(!1),[J,G]=h(""),K=R(null),O=R(null),W=M(()=>{z(!1),g4()},[]),B=M(()=>{G(`presentation-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),z(!0)},[]),k=M((D)=>{document.querySelector(".html-presentation-overlay iframe.html-node-frame-presentation")?.contentWindow?.postMessage({source:pv,token:J,...D},"*")},[J]),P=M(()=>{z(!1)},[]),X=M((D)=>{if(D.key==="Escape"){D.preventDefault(),D.stopPropagation(),z(!1);return}if(D.key==="Tab"&&!LP(D.target)){D.preventDefault(),D.stopPropagation(),O.current?.focus();return}if((D.key===" "||D.key==="Enter")&&LP(D.target))return;if(!rw(D.key))return;D.preventDefault(),D.stopPropagation(),k({type:"presentation-key",key:D.key})},[k]),L=M((D)=>{if(D.target.classList.contains("expanded-overlay-backdrop"))g4()},[]),Y=M(()=>{if(!v)return;let D=HP(v);if(!D)return;navigator.clipboard.writeText(D).then(()=>{_(!0),setTimeout(()=>_(!1),1500)})},[v]),I=M(()=>{if(!$)return;N4($)},[$]);if(E(()=>{z(!1)},[$]),W_(()=>{if(!U)return;let D=()=>{let m=K.current;if(!m||m.contains(document.activeElement))return;m.focus()},N=[0,50,150].map((m)=>window.setTimeout(D,m)),U$=(m)=>{if(!jw(m.data,J))return;z(!1)};return document.addEventListener("keydown",X,!0),window.addEventListener("message",U$),()=>{N.forEach((m)=>{window.clearTimeout(m)}),document.removeEventListener("keydown",X,!0),window.removeEventListener("message",U$)}},[X,J,U]),!v)return null;let q=v.data.title||v.data.path?.split("/").pop()||$v[v.type],w=HP(v),S=Tw(w),C=$?T$.value.has($):!1,o=w.length>0,y=iv.value===$,n=v.type==="mcp-app"||v.type==="webpage"||v.type==="json-render"||v.type==="graph",e=KB(v);return b("div",{class:"expanded-overlay-backdrop",onPointerDown:L,style:{position:"fixed",inset:0,zIndex:10001,background:"rgba(10,14,30,0.85)",backdropFilter:"blur(8px)",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"32px",pointerEvents:y?"none":"auto"},children:b("div",{class:"expanded-overlay-panel",style:{flex:1,maxWidth:"1200px",display:"flex",flexDirection:"column",background:"var(--c-panel)",border:`1px solid ${C?"var(--c-warn)":"var(--c-accent)"}`,borderRadius:"var(--radius)",boxShadow:`0 0 0 1px ${C?"var(--c-warn)":"var(--c-accent)"}, 0 24px 80px rgba(0,0,0,0.6)`,overflow:"hidden"},children:[b("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 16px",background:"var(--c-panel-glass)",borderBottom:"1px solid var(--c-line)",flexShrink:0},children:[b("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",background:"var(--c-accent-12)",color:"var(--c-accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:$v[v.type]},void 0,!1,void 0,this),b("span",{style:{flex:1,fontSize:"13px",fontWeight:600,color:"var(--c-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:q},void 0,!1,void 0,this),b("div",{class:"expanded-actions",children:[b("button",{type:"button",class:`expanded-action-btn ${C?"expanded-action-active":""}`,onClick:I,title:C?"Remove from context":"Pin as context",children:C?"✦ In context":"✦ Pin as context"},void 0,!1,void 0,this),o&&b("button",{type:"button",class:"expanded-action-btn",onClick:Y,title:"Copy content to clipboard",children:g?"Copied!":"Copy"},void 0,!1,void 0,this),t0(v)&&b("button",{type:"button",class:"expanded-action-btn",onClick:()=>void d0(v),title:"Open as a full-page site in the system browser",children:"Open as site"},void 0,!1,void 0,this),e&&b("button",{type:"button",class:"expanded-action-btn expanded-action-primary",onClick:B,title:"Present this HTML node fullscreen",children:"Present"},void 0,!1,void 0,this),S>0&&b("span",{class:"expanded-meta",children:[S.toLocaleString()," word",S!==1?"s":""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b("span",{style:{fontSize:"10px",color:y?"var(--c-warn)":"var(--c-muted)"},children:y?"Saving edits...":"Esc to close"},void 0,!1,void 0,this),b("button",{type:"button",onClick:W,style:{background:"none",border:"none",color:"var(--c-muted)",cursor:"pointer",padding:"2px 6px",fontSize:"16px",lineHeight:1,borderRadius:"4px"},onMouseEnter:(D)=>{D.target.style.color="var(--c-text)"},onMouseLeave:(D)=>{D.target.style.color="var(--c-muted)"},title:"Close (Esc)",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{style:{flex:1,overflow:"auto",padding:"16px",minHeight:0,...n?{display:"flex",flexDirection:"column"}:{}},children:n?b("div",{style:{flex:1,minHeight:0,display:"flex"},children:YP(v,!0)},void 0,!1,void 0,this):YP(v,!0)},void 0,!1,void 0,this),e&&U&&b("div",{ref:K,class:"html-presentation-overlay",role:"dialog","aria-modal":"true","aria-label":`Present ${q}`,tabIndex:-1,onKeyDownCapture:X,children:[b("button",{ref:O,type:"button",class:"html-presentation-exit",onClick:P,title:"Exit presentation (Esc)","aria-label":"Exit presentation",children:"Exit presentation"},void 0,!1,void 0,this),b("div",{class:"html-presentation-stage",children:b(lg,{node:v,expanded:!0,presentation:!0,presentationExitToken:J},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var NU=180,yU=120,b2=20;function Vw(){let $=$2();return{markdown:$.accent,"mcp-app":$.ok,webpage:$.warn,"json-render":$.ok,graph:$.purple,prompt:$.accent,response:$.ok,status:$.warn,context:$.muted,ledger:$.dim,trace:$.purple,file:$.accent,image:$.ok,html:$.warn,group:$.dim}}function Cw(){let $=$2();return{relation:$.muted,"depends-on":$.warn,flow:$.accent,references:$.dim}}function qP($,v,g,_){let U=Array.from($.values()),z=0,J=0,G=1000,K=800;if(U.length>0){z=Number.POSITIVE_INFINITY,J=Number.POSITIVE_INFINITY,G=Number.NEGATIVE_INFINITY,K=Number.NEGATIVE_INFINITY;for(let Y of U)z=Math.min(z,Y.position.x),J=Math.min(J,Y.position.y),G=Math.max(G,Y.position.x+Y.size.width),K=Math.max(K,Y.position.y+Y.size.height)}let O=-v.x/v.scale,W=-v.y/v.scale,B=O+g/v.scale,k=W+_/v.scale,P={minX:Math.min(z,O)-b2,minY:Math.min(J,W)-b2,maxX:Math.max(G,B)+b2,maxY:Math.max(K,k)+b2},X=P.maxX-P.minX||1,L=P.maxY-P.minY||1;return{bounds:P,scale:Math.min(NU/X,yU/L)}}function XP({viewport:$,nodes:v,edges:g,onNavigate:_,containerWidth:U,containerHeight:z}){let J=R(null),G=R(!1),K=R(null),O=R(null),W=M(()=>{let L=J.current;if(!L)return;let Y=L.getContext("2d");if(!Y)return;let I=v.value,q=g.value,w=$.value,S=window.devicePixelRatio||1;L.width=NU*S,L.height=yU*S,Y.scale(S,S),Y.clearRect(0,0,NU,yU);let C=$2();Y.fillStyle=C.panel+"d9",Y.fillRect(0,0,NU,yU);let o=qP(I,w,U,z);K.current=o;let{bounds:y,scale:n}=o,e=(Q)=>(Q-y.minX)*n,D=(Q)=>(Q-y.minY)*n,N=Array.from(I.values()),U$=Vw();for(let Q of N)Y.fillStyle=U$[Q.type]??C.muted,Y.globalAlpha=0.6,Y.fillRect(e(Q.position.x),D(Q.position.y),Math.max(4,Q.size.width*n),Math.max(3,Q.size.height*n));let m=Cw();for(let Q of q.values()){let p=I.get(Q.from),s=I.get(Q.to);if(!p||!s)continue;let d=e(p.position.x+p.size.width/2),b$=D(p.position.y+p.size.height/2),g$=e(s.position.x+s.size.width/2),x=D(s.position.y+s.size.height/2);Y.beginPath(),Y.moveTo(d,b$),Y.lineTo(g$,x),Y.strokeStyle=m[Q.type]??C.muted,Y.globalAlpha=0.3,Y.lineWidth=0.5,Y.stroke()}let i=-w.x/w.scale,H$=-w.y/w.scale,q$=U/w.scale,l$=z/w.scale;Y.globalAlpha=1,Y.strokeStyle=C.accent,Y.lineWidth=1.5,Y.strokeRect(e(i),D(H$),q$*n,l$*n)},[v,g,$,U,z]),B=R(W);B.current=W;let k=M(()=>{if(O.current!==null)return;O.current=window.requestAnimationFrame(()=>{O.current=null,B.current()})},[]);EK(()=>{j$.value,v.value,g.value,$.value,k()}),E(()=>{k()},[U,z,k]),E(()=>()=>{if(O.current!==null)window.cancelAnimationFrame(O.current),O.current=null},[]);let P=M((L)=>{let Y=J.current;if(!Y)return;let I=Y.getBoundingClientRect(),q=L.clientX-I.left,w=L.clientY-I.top,S=K.current??qP(v.value,$.value,U,z);K.current=S;let{bounds:C,scale:o}=S,y=$.value,n=U/y.scale,e=z/y.scale,D=q/o+C.minX,N=w/o+C.minY;_(-(D-n/2)*y.scale,-(N-e/2)*y.scale)},[v,$,U,z,_]),X=M((L)=>{L.stopPropagation(),G.current=!0,P(L);let Y=(q)=>{if(G.current)P(q)},I=()=>{G.current=!1,document.removeEventListener("pointermove",Y),document.removeEventListener("pointerup",I)};document.addEventListener("pointermove",Y),document.addEventListener("pointerup",I)},[P]);return b("div",{style:{position:"fixed",bottom:"16px",right:"16px",zIndex:9998,border:"1px solid var(--c-line)",borderRadius:"var(--radius-sm)",overflow:"hidden",boxShadow:"0 4px 16px var(--c-shadow)"},children:b("canvas",{ref:J,width:NU,height:yU,style:{width:`${NU}px`,height:`${yU}px`,display:"block",cursor:"pointer"},onPointerDown:X},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function FP(){let $=i$.value.size,v=M(()=>{let U=Array.from(i$.value);if(U.length===0)return;BO(U),rv()},[]),g=M(()=>{let U=Array.from(i$.value);if(U.length===0)return;R_({title:"Group",childIds:U}),rv()},[]),_=M(()=>{let U=Array.from(i$.value);for(let z=0;z<U.length;z++)for(let J=z+1;J<U.length;J++)Q4(U[z],U[J],"relation");rv()},[]);if($===0)return null;return b("div",{class:"selection-bar",children:[b("span",{class:"selection-bar-count",children:["✦"," ",$," node",$!==1?"s":""," selected"]},void 0,!0,void 0,this),b("button",{type:"button",class:"selection-bar-btn selection-bar-pin-ctx",onClick:v,children:"Pin as context"},void 0,!1,void 0,this),$>=2&&b("button",{type:"button",class:"selection-bar-btn",onClick:g,children:"Group"},void 0,!1,void 0,this),$>=2&&b("button",{type:"button",class:"selection-bar-btn",onClick:_,children:"Connect"},void 0,!1,void 0,this),b("button",{type:"button",class:"selection-bar-btn selection-bar-clear",onClick:rv,title:"Clear selection",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var fw=[{title:"Navigation",shortcuts:[{keys:`${Mv}+K`,desc:"Command palette — search nodes & actions"},{keys:"Tab / Shift+Tab",desc:"Cycle through nodes"},{keys:"← ↑ → ↓",desc:"Walk graph along edges (when node focused)"},{keys:`${Mv}+0`,desc:"Reset viewport to origin"},{keys:`${Mv}++ / ${Mv}+−`,desc:"Zoom in / out"}]},{title:"Creation",shortcuts:[{keys:"Double-click",desc:"Create new markdown note on canvas"},{keys:"Drag port → node",desc:"Connect two nodes (hover to reveal ports)"}]},{title:"Selection",shortcuts:[{keys:"Click",desc:"Focus node (highlights neighbors & edges)"},{keys:"Shift+Click",desc:"Toggle node in multi-selection"},{keys:"Shift+Drag",desc:"Lasso select multiple nodes"},{keys:"Esc",desc:"Clear selection / close overlay"}]},{title:"View",shortcuts:[{keys:"?",desc:"Toggle this shortcut overlay"},{keys:"Minimap",desc:"Click/drag to navigate (toggle in toolbar)"},{keys:"Right-click",desc:"Context menu — dock, focus, connect"}]}];function wP({onClose:$}){return b("div",{class:"shortcut-overlay-backdrop",onMouseDown:$,children:b("div",{class:"shortcut-overlay",onMouseDown:(v)=>v.stopPropagation(),children:[b("div",{class:"shortcut-overlay-header",children:[b("span",{class:"shortcut-overlay-title",children:"Keyboard Shortcuts"},void 0,!1,void 0,this),b("span",{class:"shortcut-overlay-hint",children:["Press ",b("kbd",{children:"?"},void 0,!1,void 0,this)," or ",b("kbd",{children:"Esc"},void 0,!1,void 0,this)," to close"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"shortcut-overlay-body",children:fw.map((v)=>b("div",{class:"shortcut-group",children:[b("div",{class:"shortcut-group-title",children:v.title},void 0,!1,void 0,this),v.shortcuts.map((g)=>b("div",{class:"shortcut-row",children:[b("kbd",{class:"shortcut-keys",children:g.keys},void 0,!1,void 0,this),b("span",{class:"shortcut-desc",children:g.desc},void 0,!1,void 0,this)]},g.keys,!0,void 0,this))]},v.title,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Ew($){let v=Date.now()-new Date($).getTime(),g=Math.floor(v/60000);if(g<1)return"just now";if(g<60)return`${g}m ago`;let _=Math.floor(g/60);if(_<24)return`${_}h ago`;return`${Math.floor(_/24)}d ago`}function AP({open:$,onClose:v,anchorRef:g}){let[_,U]=h([]),[z,J]=h(!1),[G,K]=h(!1),[O,W]=h(null),[B,k]=h(""),[P,X]=h(null),L=R(null),Y=R(null);E(()=>{if(!$)return;J(!0),vO().then((y)=>{U(y),J(!1)})},[$]),E(()=>{if($)setTimeout(()=>Y.current?.focus(),50)},[$]),E(()=>{if(!$)return;let y=(n)=>{let e=L.current,D=g.current;if(e&&!e.contains(n.target)&&D&&!D.contains(n.target))v()};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[$,v]),E(()=>{if(!$)return;let y=(n)=>{if(n.key==="Escape")v()};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[$,v]);let I=M(async()=>{let y=B.trim();if(!y)return;K(!0);let n=await UO(y);if(K(!1),n.ok&&n.snapshot)U((e)=>[n.snapshot,...e]),k("")},[B]),q=M(async(y)=>{X(null),W(y);let n=await gO(y);if(W(null),n.ok)v()},[v]),w=M(async(y)=>{if((await _O(y)).ok)U((e)=>e.filter((D)=>D.id!==y));X(null)},[]);if(!$)return null;let S=g.current?.getBoundingClientRect(),C=S?Math.max(8,S.left-120):100,o=S?S.bottom+8:48;return b("div",{ref:L,class:"snapshot-panel",style:{left:`${C}px`,top:`${o}px`},children:[b("div",{class:"snapshot-panel-header",children:[b("span",{class:"snapshot-panel-title",children:"Snapshots"},void 0,!1,void 0,this),b("button",{type:"button",class:"snapshot-panel-close",onClick:v,title:"Close",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"snapshot-save-form",children:[b("input",{ref:Y,type:"text",class:"snapshot-name-input",value:B,onInput:(y)=>k(y.target.value),onKeyDown:(y)=>{if(y.key==="Enter")I()},placeholder:"Snapshot name...",maxLength:80,disabled:G},void 0,!1,void 0,this),b("button",{type:"button",class:"snapshot-save-btn",onClick:I,disabled:!B.trim()||G,children:G?"...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"snapshot-restore-note",children:"Restoring replaces the current canvas. You can undo it if needed."},void 0,!1,void 0,this),b("div",{class:"snapshot-list",children:[z&&b("div",{class:"snapshot-empty",children:"Loading..."},void 0,!1,void 0,this),!z&&_.length===0&&b("div",{class:"snapshot-empty",children:"No snapshots yet. Save one to capture the current canvas state."},void 0,!1,void 0,this),!z&&_.map((y)=>b("div",{class:"snapshot-item",children:[b("div",{class:"snapshot-item-info",children:[b("span",{class:"snapshot-item-name",children:y.name},void 0,!1,void 0,this),b("span",{class:"snapshot-item-meta",children:[y.nodeCount," node",y.nodeCount!==1?"s":"",y.edgeCount>0?` · ${y.edgeCount} edge${y.edgeCount!==1?"s":""}`:""," · ",Ew(y.createdAt)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"snapshot-item-actions",children:P?.id===y.id?b(e$,{children:[b("button",{type:"button",class:`snapshot-action-btn ${P.action==="delete"?"snapshot-action-confirm":"snapshot-action-restore"}`,onClick:()=>P.action==="delete"?w(y.id):q(y.id),title:P.action==="delete"?"Confirm delete":"Confirm restore",disabled:O!==null,children:P.action==="delete"?"Delete":O===y.id?"Restoring...":"Confirm"},void 0,!1,void 0,this),b("button",{type:"button",class:"snapshot-action-btn",onClick:()=>X(null),title:"Cancel",disabled:O!==null,children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):b(e$,{children:[b("button",{type:"button",class:"snapshot-action-btn snapshot-action-restore",onClick:()=>X({id:y.id,action:"restore"}),title:"Restore this snapshot",disabled:O!==null,children:O===y.id?"Restoring...":"Restore"},void 0,!1,void 0,this),b("button",{type:"button",class:"snapshot-action-btn snapshot-action-delete",onClick:()=>X({id:y.id,action:"delete"}),title:"Delete this snapshot",disabled:O!==null,children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},y.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ZP($,v,g,_,U){return $.x<_.position.x+_.size.width+U&&$.x+v+U>_.position.x&&$.y<_.position.y+_.size.height+U&&$.y+g+U>_.position.y}function mw($,v,g,_,U){return _.some((z)=>ZP($,v,g,z,U))}function cw($,v,g,_,U){return _.find((z)=>ZP($,v,g,z,U))}function K2($,v,g,_=24){if($.length===0)return{x:40,y:80};let U=$[$.length-1],z={x:U.position.x+U.size.width+_,y:U.position.y};if(!mw(z,v,g,$,_))return z;let J=40,G=80,K=3000,O=G;for(let B=0;B<20;B++){let k=J;while(k+v<K){let L=cw({x:k,y:O},v,g,$,_);if(!L)return{x:k,y:O};k=L.position.x+L.size.width+_}O=$.filter((L)=>L.position.y<=O+g+_&&L.position.y+L.size.height+_>O).reduce((L,Y)=>Math.max(L,Y.position.y+Y.size.height),O)+_}let W=$.reduce((B,k)=>Math.max(B,k.position.y+k.size.height),0);return{x:J,y:W+_}}var l6={status:{x:40,y:80,w:300,h:120},markdown:{x:380,y:80,w:720,h:600},context:{x:1130,y:80,w:320,h:400},"mcp-app":{x:380,y:720,w:960,h:600},webpage:{x:380,y:80,w:520,h:420},"json-render":{x:380,y:720,w:840,h:620},graph:{x:380,y:720,w:760,h:520},ledger:{x:1130,y:520,w:320,h:280},trace:{x:40,y:900,w:200,h:56},file:{x:380,y:80,w:720,h:600},image:{x:380,y:80,w:720,h:520},html:{x:380,y:80,w:720,h:640},group:{x:220,y:60,w:840,h:560},prompt:{x:380,y:1260,w:520,h:400},response:{x:380,y:1480,w:720,h:400}};function tg($,v,g,_={}){let U=l6[v];return{id:$,type:v,position:_.position??{x:U.x,y:U.y},size:_.size??{width:U.w,height:U.h},zIndex:v==="status"?0:1,collapsed:!1,pinned:!1,dockPosition:_.dockPosition??null,data:g}}var Y4=null,W2=null,ab=0,p6=null,iw=3000,xw=2000,hw=5000,dg=!1,k6=null,DU=null,n6=0,o6=null;function lw(){if(typeof location>"u")return null;let $=new URLSearchParams(location.search).get("transport");return $==="poll"||$==="sse"?$:null}var RU=new Map;function ag($){let v=0;for(let g=0;g<$.length;g++)v=(v<<5)-v+$.charCodeAt(g)|0;return Math.abs(v).toString(36)}function B2($){if(!W2)return $;let v=W2.get($.id);if(!v)return $;return{...$,position:v.position??$.position,size:v.size??$.size,collapsed:v.collapsed??$.collapsed,pinned:v.pinned??$.pinned,dockPosition:v.dockPosition!==void 0?v.dockPosition:$.dockPosition}}function sg($,v,g,_=null){return B2(tg($,v,g,{dockPosition:_}))}function pw(){return K2([...j.value.values()],l6.markdown.w,l6.markdown.h)}function t6(){if(!j.value.has("status-main"))_6(sg("status-main","status",{phase:"idle",message:"",elapsed:0},"left"))}function ow($,v){let g=`md-${ag($)}`;if(j.value.get(g))v$(g,{path:$,title:v}),u$.value=g;else{let U=pw(),z=sg(g,"markdown",{path:$,title:v,content:"",rendered:""});if(z.position=U,_6(z),!z.dockPosition)Iv(g)}}function nw($){if(j.value.get("context-main"))v$("context-main",{cards:$});else if($.length>0){let _=sg("context-main","context",{cards:$});_6(_)}}function tw($){let v=$.url,g=`mcp-${ag(v)}`;if(j.value.get(g))v$(g,$);else _6(sg(g,"mcp-app",$)),Iv(g)}function dw($){let v=$.toolCallId,_=(typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null)??(v.startsWith("ext-app-")?v:`ext-app-${v}`);if(j.value.get(_)){v$(_,$);return}let{serverName:z,toolName:J}=$;if(z&&J){for(let[Y,I]of j.value.entries())if(I.type==="mcp-app"&&I.data.mode==="ext-app"&&I.data.serverName===z&&I.data.toolName===J&&!I.data.toolResult){v$(Y,{...$});return}}let{_x:G,_y:K,_width:O,_height:W}=$,B=l6["mcp-app"],k=O??B.w,P=W??B.h,X=G===void 0||K===void 0?K2([...j.value.values()],k,P):null,L=B2(tg(_,"mcp-app",{mode:"ext-app",...$},{position:{x:G??X?.x??B.x,y:K??X?.y??B.y},size:{width:k,height:P}}));if(_6(L),!L.dockPosition)Iv(_,{recordHistory:!1})}function aw($){let v=$.startsWith("ext-app-")?$:`ext-app-${$}`;if(j.value.has(v))return v;let g=`ext-app-${$}`;if(g!==v&&j.value.has(g))return g;for(let[_,U]of j.value.entries())if(U.type==="mcp-app"&&U.data.mode==="ext-app"&&U.data.toolCallId===$)return _;return null}function SP($){let v=typeof $.nodeId==="string"&&$.nodeId.length>0?$.nodeId:null;if(v&&j.value.has(v))return v;if(typeof $.toolCallId!=="string"||!$.toolCallId)return null;return aw($.toolCallId)}function NP($,v){if(typeof $!=="string"||!$)return null;if(typeof v!=="string"||!v)return null;let g=null;for(let[_,U]of j.value.entries())if(U.type==="mcp-app"&&U.data.mode==="ext-app"&&U.data.serverName===$&&U.data.toolName===v&&!U.data.toolResult){if(g)return null;g=_}return g}function yP($){if(j.value.get("ledger-main"))v$("ledger-main",$);else{let _=sg("ledger-main","ledger",$,"right");_.collapsed=!0,_6(_)}}function DP($){if(!($==="dark"||$==="light"||$==="high-contrast"))return;if(document.documentElement.setAttribute("data-theme",$),FU(),j$.value!==$)j$.value=$}function sw($){return $==="markdown"||$==="mcp-app"||$==="webpage"||$==="json-render"||$==="graph"||$==="prompt"||$==="response"||$==="status"||$==="context"||$==="ledger"||$==="trace"||$==="file"||$==="image"||$==="html"||$==="group"}function ew($){return $==="relation"||$==="depends-on"||$==="flow"||$==="references"}function sb($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.x!=="number"||typeof v.y!=="number")return null;return{x:v.x,y:v.y}}function RP($){if(!$||typeof $!=="object")return null;let v=$;if(typeof v.width!=="number"||typeof v.height!=="number")return null;return{width:v.width,height:v.height}}function $A($){let v=sb($),g=RP($);return v&&g?{...v,...g}:null}function vA($){if(typeof $.id!=="string"||!$.id)return null;if(!sw($.type))return null;let v=sb($.position),g=RP($.size);if(!v||!g)return null;let _=$.dockPosition==="left"||$.dockPosition==="right"?$.dockPosition:null,U=$.data&&typeof $.data==="object"?Object.fromEntries(Object.entries($.data)):{};return{id:$.id,type:$.type,position:v,size:g,zIndex:typeof $.zIndex==="number"?$.zIndex:1,collapsed:$.collapsed===!0,pinned:$.pinned===!0,dockPosition:_,data:U}}function UA($){if(typeof $.id!=="string"||!$.id)return null;if(typeof $.from!=="string"||!$.from)return null;if(typeof $.to!=="string"||!$.to)return null;if(!ew($.type))return null;return{id:$.id,from:$.from,to:$.to,type:$.type,...typeof $.label==="string"?{label:$.label}:{},...$.style==="solid"||$.style==="dashed"||$.style==="dotted"?{style:$.style}:{},...$.animated===!0?{animated:!0}:{}}}function gA($){if(typeof $.id!=="string"||!$.id)return null;if($.type!=="freehand"&&$.type!=="text")return null;if(!Array.isArray($.points))return null;let v=$.points.map((_)=>sb(_)).filter((_)=>_!==null),g=$A($.bounds);if(v.length<($.type==="text"?1:2)||!g)return null;return{id:$.id,type:$.type,points:v,bounds:g,color:typeof $.color==="string"?$.color:"#f97316",width:typeof $.width==="number"?$.width:4,...typeof $.text==="string"?{text:$.text}:{},...typeof $.label==="string"?{label:$.label}:{},createdAt:typeof $.createdAt==="string"?$.createdAt:""}}function _A($){if(U4.value=$.sessionId||"",xv.value="connected",EU.value+=1,typeof $.theme==="string")DP($.theme);if($.ledgerSummary)yP($.ledgerSummary)}function zA($){if(typeof $.path!=="string"||!$.path)return;let v=$.path,g=(typeof $.title==="string"?$.title:"")||v.split("/").pop()||"Untitled";if(ow(v,g),$.ledgerSummary)yP($.ledgerSummary)}function JA($){t6(),v$("status-main",{message:typeof $.message==="string"?$.message:String($.message??""),level:$.level??"ok",source:$.source})}function GA($){t6(),v$("status-main",{phase:$.phase,detail:$.detail})}function bA($){let v=$.cards??[];nw(v)}function KA($){if(typeof $.url==="string"&&$.url)tw({url:$.url,sourceServer:$.sourceServer,sourceTool:$.sourceTool,inferredType:$.inferredType,trustedDomain:$.trustedDomain,hostMode:$.hostMode??"hosted"})}function OA($){let v=$.sessions??[];for(let g of v){let _=g.url;if(!_)continue;let U=`mcp-${ag(_)}`;if(j.value.has(U))v$(U,{sessionState:g.state,lastSeenAt:g.lastSeenAt})}}function WA($){if(typeof $.url==="string"&&$.url){let v=`mcp-${ag($.url)}`;if(j.value.has(v))v$(v,{hostMode:"fallback",fallbackReason:$.reasonCode})}}function BA($){let g=j.value.get("context-main");if(!g)return;let _=(g.data.auxTabs??[]).concat($);v$("context-main",{auxTabs:_})}function PA($){if(j.value.has("context-main"))if($.mode==="all")v$("context-main",{auxTabs:[]});else{let _=j.value.get("context-main");if(!_)return;let U=(_.data.auxTabs??[]).filter((z)=>z.id!==$.id);v$("context-main",{auxTabs:U})}}function kA($){t6(),v$("status-main",{phase:"idle",lastCompletion:{tokenCount:$.tokenCount,artifactCount:$.artifactCount}})}function YA($){t6(),v$("status-main",{phase:"tooling",detail:`${$.name}`,activeTool:$.name})}function HA($){t6(),v$("status-main",{activeTool:null})}function LA($){if($.state==="active"&&$.path){let g=`md-${ag($.path)}`;if(j.value.has(g))v$(g,{reviewActive:!0})}}function IA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;dw({toolCallId:$.toolCallId,...typeof $.nodeId==="string"&&$.nodeId.length>0?{nodeId:$.nodeId}:{},title:$.title,html:$.html,toolInput:$.toolInput,serverName:$.serverName,toolName:$.toolName,appSessionId:$.appSessionId,resourceUri:$.resourceUri,toolDefinition:$.toolDefinition,resourceMeta:$.resourceMeta,hostMode:"hosted",trustedDomain:!0,...$.chartConfig?{chartConfig:$.chartConfig}:{},...typeof $.x==="number"&&{_x:$.x},...typeof $.y==="number"&&{_y:$.y},...typeof $.width==="number"&&{_width:$.width},...typeof $.height==="number"&&{_height:$.height}})}function qA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=SP($)??NP($.serverName,$.toolName);if(!v)return;if(j.value.has(v))v$(v,{html:$.html})}function XA($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=SP($)??NP($.serverName,$.toolName);if(!v)return;if(j.value.has(v)){if($.success===!1){y4(v);return}v$(v,{toolResult:Sb({result:$.result,success:typeof $.success==="boolean"?$.success:void 0,error:typeof $.error==="string"?$.error:void 0,content:typeof $.content==="string"?$.content:void 0,detailedContent:typeof $.detailedContent==="string"?$.detailedContent:void 0})})}}function FA($){t6(),v$("status-main",{subagent:{state:$.state,name:$.agentDisplayName??$.agentName}})}function wA($){let v=$.nodeId;if(!v)return;let g=$.text||"",_=$.position,U=$.parentNodeId,z=$.contextNodeIds;if($.threadNodeId&&j.value.has($.threadNodeId)){let J=$.threadNodeId,G=j.value.get(J);if(!G)return;let K=Array.isArray(G.data.turns)?[...G.data.turns]:[],O=K[K.length-1];if(!O||O.role!=="user"||O.text!==g)K.push({role:"user",text:g,status:"pending"});v$(J,{turns:K,threadStatus:"pending"});return}if(!j.value.has(v)){let J=_??l6.prompt;_6(B2(tg(v,"prompt",{text:g,turns:g?[{role:"user",text:g,status:"pending"}]:[],threadStatus:g?"pending":"draft",status:g?"pending":"draft",parentNodeId:U,contextNodeIds:z},{position:{x:J.x,y:J.y}}))),Iv(v)}if(U&&j.value.has(U))V_({id:`edge-${U}-${v}`,from:U,to:v,type:"flow",style:"dashed"})}function AA($){let{nodeId:v,status:g}=$;if(v&&j.value.has(v))v$(v,{status:g})}function ZA($){let{responseNodeId:v,promptNodeId:g}=$;if(!v)return;let _=g?j.value.get(g):void 0;if(_&&Array.isArray(_.data.turns)){RU.set(v,g);let z=[..._.data.turns];z.push({role:"assistant",text:"",status:"streaming"}),v$(g,{turns:z,threadStatus:"streaming",_activeResponseId:v}),Iv(g);return}let U=_?{x:_.position.x,y:_.position.y+_.size.height+24}:{x:l6.response.x,y:l6.response.y};if(!j.value.has(v))_6(B2(tg(v,"response",{content:"",status:"streaming",promptNodeId:g},{position:U})));if(g)V_({id:`edge-${g}-${v}`,from:g,to:v,type:"flow",animated:!0});Iv(v)}function QA($){let v=$.responseNodeId;if(!v)return;let g=RU.get(v);if(g){let _=j.value.get(g);if(_&&Array.isArray(_.data.turns)){let U=[..._.data.turns],z=U[U.length-1];if(z&&z.role==="assistant")z.text=$.content,z.status="streaming";v$(g,{turns:U,threadStatus:"streaming"})}return}if(!j.value.has(v))return;v$(v,{content:$.content,status:"streaming"})}function MA($){let v=$.responseNodeId;if(!v)return;let g=RU.get(v);if(g){let z=j.value.get(g);if(z&&Array.isArray(z.data.turns)){let J=[...z.data.turns],G=J[J.length-1];if(G&&G.role==="assistant")G.text=$.content,G.status="complete";v$(g,{turns:J,threadStatus:"answered",_activeResponseId:void 0})}RU.delete(v);return}if(!j.value.has(v))return;v$(v,{content:$.content,status:"complete"});let U=j.value.get(v)?.data.promptNodeId;if(U){let z=`edge-${U}-${v}`,J=m$.value.get(z);if(J)HO(z),V_({...J,animated:!1})}}function SA($){let v=$.layout;if(!v?.nodes)return;let g=!w6.value;w6.value=!0;let _=v.nodes.map(vA).filter((G)=>G!==null),U=Array.isArray(v.edges)?v.edges.map(UA).filter((G)=>G!==null):Array.from(m$.value.values()),z=Array.isArray(v.annotations)?v.annotations.map(gA).filter((G)=>G!==null):void 0,J=v.viewport?{x:typeof v.viewport.x==="number"?v.viewport.x:0,y:typeof v.viewport.y==="number"?v.viewport.y:0,scale:typeof v.viewport.scale==="number"?v.viewport.scale:1}:void 0;u4(),AO({...J?{viewport:J}:{},nodes:_,edges:U,...z?{annotations:z}:{}},{applyViewport:g}),n2({event:"canvas-layout-update",data:$})}function NA($){if($<=1)return 500;if($===2)return 1000;return Math.min(2500,1500+($-3)*500)}function yA($){let v=$.nodeId;if(v&&j.value.has(v)){if($.noPan===!0){Q6(v);return}Iv(v)}}function DA($){let v=$.viewport;if(!v)return;let g=typeof v.x==="number"?v.x:0,_=typeof v.y==="number"?v.y:0,U=typeof v.scale==="number"?v.scale:1;u4(),XO({x:g,y:_,scale:U})}function RA($){if(j.value.get("context-main"))v$("context-main",{currentTokens:$.currentTokens,tokenLimit:$.tokenLimit,messagesLength:$.messagesLength,utilization:$.utilization,nearLimit:$.nearLimit})}function uA($){T_.value=$.enabled===!0}function TA($){if(typeof $.theme==="string")DP($.theme)}function jA($){let v=Array.isArray($.nodeIds)?$.nodeIds.filter((g)=>typeof g==="string"):[];kO(v),n2({event:"context-pins-changed",data:$})}var O2=null;function QP(){if(O2)clearTimeout(O2);O2=setTimeout(()=>{O2=null,aK().then(($)=>{A6.value=$})},150)}function rA($){let v=$.intent;if(!v||typeof v.id!=="string"||typeof v.kind!=="string"||typeof v.expiresAt!=="number")return;LB(v)}function VA($){let v=typeof $.id==="string"?$.id:"";if(!v)return;if($.settled===!0)qB(v,typeof $.nodeId==="string"?$.nodeId:void 0);else fb(v)}var uP={connected:_A,"workbench-open":zA,"canvas-status":JA,"execution-phase":GA,"context-cards":bA,"mcp-app-candidate":KA,"mcp-app-host-snapshot":OA,"mcp-app-host-fallback":WA,"aux-open":BA,"aux-close":PA,"assistant-complete":kA,"tool-start":YA,"tool-complete":HA,"review-state":LA,"subagent-status":FA,"ext-app-open":IA,"ext-app-update":qA,"ext-app-result":XA,"context-pins-changed":jA,"canvas-layout-update":SA,"canvas-focus-node":yA,"canvas-viewport-update":DA,"context-usage":RA,"trace-state":uA,"theme-changed":TA,"canvas-prompt-created":wA,"canvas-prompt-status":AA,"canvas-response-start":ZA,"canvas-response-delta":QA,"canvas-response-complete":MA,"ax-state-changed":QP,"ax-event-created":QP,"ax-intent":rA,"ax-intent-clear":VA};function TP($,v){let g=uP[$];if(!g)return;let _=g;try{_(v)}catch(U){console.warn(`[sse-bridge] Handler for "${$}" failed:`,U)}}function MP(){dg=!0,n6+=1;let $=n6;xv.value="connecting";let v=null,g=!1,_=async()=>{if($!==n6)return;try{let U=new URLSearchParams;if(DU!==null)U.set("since",String(DU));let z=U4.value;if(z)U.set("session",z);let J=U.toString(),G=await fetch(`/api/workbench/poll${J?`?${J}`:""}`);if($!==n6)return;if(!G.ok)throw Error(`poll failed with HTTP ${G.status}`);let K=await G.json();if($!==n6)return;if(!K.ok)throw Error("poll returned ok: false");let O=v;if(v=K.sessionId??null,O!==null&&K.sessionId&&O!==K.sessionId&&!K.snapshot){DU=null,k6=setTimeout(()=>void _(),0);return}if(K.snapshot&&g)W2=E2(),t6(),w6.value=!1,o2(),Eb(),RU.clear();for(let W of K.events)TP(W.event,W.payload);g=!0,DU=K.seq,xv.value="connected",k6=setTimeout(()=>void _(),xw)}catch(U){if($!==n6)return;console.warn("[sse-bridge] poll transport error:",U),xv.value="disconnected",k6=setTimeout(()=>void _(),hw)}};return _(),()=>{if(n6+=1,dg=!1,DU=null,k6)clearTimeout(k6),k6=null}}function eb(){if(W2=E2(),t6(),w6.value=!1,o2(),Eb(),RU.clear(),p6)clearTimeout(p6),p6=null;let $=lw();if($==="poll"||dg)return MP();let v=U4.value,g=v?`/api/workbench/events?session=${v}`:"/api/workbench/events";xv.value="connecting";let _=new EventSource(g);Y4=_;let U=!1;if(o6)clearTimeout(o6);if(o6=null,$!=="sse")o6=setTimeout(()=>{if(o6=null,U||Y4!==_)return;console.warn("[sse-bridge] No SSE event within watchdog window — switching to polling transport."),_.close(),Y4=null,MP()},iw);for(let[z]of Object.entries(uP))_.addEventListener(z,(J)=>{U=!0;try{TP(z,JSON.parse(J.data))}catch(G){console.warn(`[sse-bridge] Failed to parse "${z}" event:`,G)}});return _.onopen=()=>{if(Y4!==_)return;ab=0,xv.value="connected"},_.onerror=()=>{if(Y4!==_)return;xv.value="disconnected",_.close(),Y4=null,ab+=1,p6=setTimeout(()=>{p6=null,eb()},NA(ab))},()=>{if(p6)clearTimeout(p6),p6=null;if(o6)clearTimeout(o6),o6=null;if(dg){if(n6+=1,dg=!1,DU=null,k6)clearTimeout(k6),k6=null}_.close(),Y4=null}}function CA($,v){console.error(`[app] ${$} failed`,v)}function jP($,v={}){fetch(`/api/workbench/intent?_ts=${Date.now()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})}).catch((g)=>{CA("sendIntent",g)})}function bv({label:$,detail:v,shortcut:g,align:_="center",children:U}){return b("span",{class:`toolbar-tooltip-anchor toolbar-tooltip-anchor-${_}`,children:[U,b("span",{class:"toolbar-tooltip",role:"tooltip",children:[b("span",{class:"toolbar-tooltip-label",children:$},void 0,!1,void 0,this),(v||g)&&b("span",{class:"toolbar-tooltip-meta",children:[v&&b("span",{children:v},void 0,!1,void 0,this),g&&b("kbd",{class:"toolbar-tooltip-shortcut",children:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function fA({minimapVisible:$,onToggleMinimap:v,snapshotOpen:g,onToggleSnapshot:_,snapshotBtnRef:U,onOpenPalette:z,onOpenShortcuts:J,annotationTool:G,onToggleAnnotationMode:K,onToggleAnnotationEraser:O,onToggleTextAnnotation:W}){let B=xv.value,k=w6.value,P=k$.value,X=j.value.size,L=m$.value.size,Y=T_.value,I=Array.from(j.value.values()).filter((C)=>C.type==="trace").length,q=B==="connected"&&!k?"syncing":B,w=q.charAt(0).toUpperCase()+q.slice(1),S=k?[`${X} node${X!==1?"s":""}`,...L>0?[`${L} edge${L!==1?"s":""}`]:[],...I>0?[`${I} trace${I!==1?"s":""}`]:Y?["trace armed"]:[]].join(" · "):"Syncing canvas…";return b("div",{class:"toolbar-group",children:[b("div",{class:"canvas-toolbar",children:[b(bv,{label:"PMX Canvas",detail:"Focus Field · spatial workbench for coding agents",align:"start",children:b("span",{class:"canvas-brand","aria-label":"PMX Canvas",children:b(fB,{size:22},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("div",{class:"separator"},void 0,!1,void 0,this),b(bv,{label:"Canvas status",detail:k?w:"Syncing canvas from server",align:"start",children:b("span",{class:`connection-dot ${B}`,"aria-label":`Canvas status: ${q}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("span",{class:"hud-collapsible-text",style:{fontSize:"11px",color:"var(--c-muted)"},children:U4.value?U4.value.slice(0,12):"…"},void 0,!1,void 0,this),b("div",{class:"separator"},void 0,!1,void 0,this),b(bv,{label:"Fit canvas",detail:"Frame every node on screen",children:b("button",{type:"button",onClick:()=>f_(window.innerWidth,window.innerHeight),"aria-label":"Fit canvas",children:b(wB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:"Reset view",shortcut:`${Mv}+0`,children:b("button",{type:"button",onClick:()=>hv({x:0,y:0,scale:1},250),"aria-label":"Reset view",children:b(AB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:"Zoom in",shortcut:`${Mv}++`,children:b("button",{type:"button",onClick:()=>hv({...P,scale:Math.min(4,P.scale*1.25)},150),"aria-label":"Zoom in",children:b(ZB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:"Zoom out",shortcut:`${Mv}+-`,children:b("button",{type:"button",onClick:()=>hv({...P,scale:Math.max(0.1,P.scale/1.25)},150),"aria-label":"Zoom out",children:b(QB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)",minWidth:"36px",textAlign:"center"},children:[Math.round(P.scale*100),"%"]},void 0,!0,void 0,this),b("div",{class:"separator"},void 0,!1,void 0,this),b(bv,{label:"Arrange layout",detail:L>0?"Graph-aware layout for connected nodes":"Grid layout for loose nodes",children:b("button",{type:"button",onClick:()=>L>0?m_():E_(),"aria-label":"Arrange layout",children:b(MB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:$?"Hide minimap":"Show minimap",detail:"Quickly navigate large canvases",children:b("button",{type:"button",onClick:v,"aria-label":$?"Hide minimap":"Show minimap",style:{color:$?"var(--c-accent)":void 0},children:b(SB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:`Switch to ${j$.value==="dark"?"light":"dark"} theme`,detail:`Current theme: ${j$.value}`,children:b("button",{type:"button",onClick:()=>{let C=j$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",C),FU(),j$.value=C,S_(C)},"aria-label":`Switch to ${j$.value==="dark"?"light":"dark"} theme`,children:j$.value==="dark"?b(NB,{},void 0,!1,void 0,this):b(yB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:"Snapshots",detail:"Capture and restore canvas states",align:"end",children:b("button",{ref:U,type:"button",onClick:_,"aria-label":"Snapshots",style:{color:g?"var(--c-accent)":void 0},children:b(TB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"canvas-toolbar",children:[b(bv,{label:Y?"Disable trace":"Enable trace",detail:Y?"Stop collecting new trace nodes":"Capture agent execution on the canvas",children:b("button",{type:"button",onClick:()=>jP("trace-toggle",{enabled:!Y}),"aria-label":Y?"Disable trace":"Enable trace",style:{color:Y?"var(--c-purple)":void 0},children:b(jB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),(Y||I>0)&&b(bv,{label:"Clear trace",detail:I>0?`Remove ${I} trace node${I===1?"":"s"}`:"Trace is enabled but still empty",children:b("button",{type:"button",onClick:()=>jP("trace-clear"),"aria-label":"Clear trace",children:b(rB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("div",{class:"separator"},void 0,!1,void 0,this),b(bv,{label:G==="pen"?"Stop annotating":"Annotate canvas",detail:"Draw directly on the canvas for human-visible markup",children:b("button",{type:"button",onClick:K,"aria-label":G==="pen"?"Stop annotating":"Annotate canvas","aria-pressed":G==="pen",style:{color:G==="pen"?"var(--c-accent)":void 0},children:b(DB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:G==="eraser"?"Stop erasing":"Erase annotations",detail:"Click a drawn annotation to remove it",children:b("button",{type:"button",onClick:O,"aria-label":G==="eraser"?"Stop erasing":"Erase annotations","aria-pressed":G==="eraser",style:{color:G==="eraser"?"var(--c-accent)":void 0},children:b(RB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:G==="text"?"Stop text annotations":"Text annotations",detail:"Click anywhere to type an intent note",children:b("button",{type:"button",onClick:W,"aria-label":G==="text"?"Stop text annotations":"Text annotations","aria-pressed":G==="text",style:{color:G==="text"?"var(--c-accent)":void 0},children:b(uB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("div",{class:"separator"},void 0,!1,void 0,this),b(bv,{label:"Search nodes and actions",shortcut:`${Mv}+K`,children:b("button",{type:"button",onClick:z,"aria-label":"Search nodes and actions",children:b(VB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b(bv,{label:"Keyboard shortcuts",shortcut:"?",align:"end",children:b("button",{type:"button",onClick:J,"aria-label":"Keyboard shortcuts",children:b(CB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),b("span",{class:"hud-collapsible-text",style:{fontSize:"10px",color:"var(--c-dim)"},children:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function EA({onOpenPalette:$}){return b("div",{class:"welcome-card",children:[b("div",{class:"welcome-icon",children:"◇"},void 0,!1,void 0,this),b("div",{class:"welcome-title",children:"Shape What The Agent Sees"},void 0,!1,void 0,this),b("div",{class:"welcome-subtitle",children:"Lay out notes, files, and evidence. Bring related nodes together. Pin what matters. The board will reflect the active focus."},void 0,!1,void 0,this),b("div",{class:"welcome-hints",children:[b("button",{type:"button",class:"welcome-hint",onClick:$,children:[b("kbd",{children:[Mv,"+K"]},void 0,!0,void 0,this),b("span",{children:"Create a note"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"welcome-hint",children:[b("kbd",{children:"Drop files"},void 0,!1,void 0,this),b("span",{children:"Add evidence to the board"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"welcome-hint",children:[b("kbd",{children:"✦"},void 0,!1,void 0,this),b("span",{children:"Pin important nodes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"welcome-hint",children:[b("kbd",{children:"Move nearby"},void 0,!1,void 0,this),b("span",{children:"Shape the focus field"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),b("div",{class:"welcome-footer",children:"The canvas is a shared attention surface, not just an editor."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rP(){let[$,v]=h(!0),[g,_]=h(!1),[U,z]=h(!1),[J,G]=h(!1),[K,O]=h(null),W=R(null),{menu:B,openNodeMenu:k,openCanvasMenu:P,closeMenu:X}=OP(),L=w6.value,Y=M(()=>v((D)=>!D),[]),I=M(()=>_((D)=>!D),[]),q=M(()=>_(!1),[]),w=M(()=>O((D)=>D==="pen"?null:"pen"),[]),S=M(()=>O((D)=>D==="eraser"?null:"eraser"),[]),C=M(()=>O((D)=>D==="text"?null:"text"),[]),o=M((D,N)=>{hv({x:D,y:N,scale:k$.value.scale},200)},[]);E(()=>{return eb()},[]),E(()=>{let D=(N)=>{let U$=N.metaKey||N.ctrlKey;if(U$&&N.key==="k"){N.preventDefault(),z((i)=>!i);return}if(N.key==="Escape"&&K){N.preventDefault(),O(null);return}if(N.key==="Escape"&&r$.value&&!iv.value){N.preventDefault(),g4();return}if(N.key==="Escape"&&U){N.preventDefault(),z(!1);return}if(N.key==="Escape"&&J){N.preventDefault(),G(!1);return}let m=N.target?.tagName;if(m==="INPUT"||m==="TEXTAREA")return;if(N.key==="?"||N.key==="/"&&N.shiftKey){N.preventDefault(),G((i)=>!i);return}if(U$&&N.key==="0")N.preventDefault(),hv({x:0,y:0,scale:1},250);else if(U$&&(N.key==="="||N.key==="+")){N.preventDefault();let i=k$.value;hv({...i,scale:Math.min(4,i.scale*1.25)},150)}else if(U$&&N.key==="-"){N.preventDefault();let i=k$.value;hv({...i,scale:Math.max(0.1,i.scale/1.25)},150)}else if(N.key==="Escape"){if(i$.value.size>0){rv();return}u$.value=null,X()}else if(N.key==="Tab")N.preventDefault(),QO(N.shiftKey?-1:1);else if(u$.value&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(N.key)){N.preventDefault();let i=N.key.replace("Arrow","").toLowerCase();MO(i)}};return document.addEventListener("keydown",D),()=>{document.removeEventListener("keydown",D)}},[K,X,U,J]),E(()=>{if(!L)return;let D=window.__pmxCanvasBootstrapReady;if(typeof D==="function")D()},[L]);let y=Array.from(j.value.values()),n=y.filter((D)=>D.dockPosition==="left"),e=y.filter((D)=>D.dockPosition==="right").sort((D,N)=>{let U$={context:0,ledger:1};return(U$[D.type]??2)-(U$[N.type]??2)});return b("div",{style:{width:"100%",height:"100%",position:"relative"},children:[b("div",{class:"hud-layer",children:[b("div",{class:"hud-left",children:n.map((D)=>b(db,{node:D},D.id,!1,void 0,this))},void 0,!1,void 0,this),b(fA,{minimapVisible:$,onToggleMinimap:Y,snapshotOpen:g,onToggleSnapshot:I,snapshotBtnRef:W,onOpenPalette:()=>z(!0),onOpenShortcuts:()=>G((D)=>!D),annotationTool:K,onToggleAnnotationMode:w,onToggleAnnotationEraser:S,onToggleTextAnnotation:C},void 0,!1,void 0,this),b("div",{class:"hud-right",children:e.map((D)=>b(db,{node:D},D.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b(NO,{},void 0,!1,void 0,this),b(SO,{},void 0,!1,void 0,this),b(bP,{onNodeContextMenu:k,onCanvasContextMenu:P,annotationMode:K!==null,annotationTool:K},void 0,!1,void 0,this),L&&y.filter((D)=>!D.dockPosition).length===0&&Lv.value.size===0&&b(EA,{onOpenPalette:()=>z(!0)},void 0,!1,void 0,this),i$.value.size>0&&b(FP,{},void 0,!1,void 0,this),T$.value.size>0&&b(PP,{},void 0,!1,void 0,this),r$.value&&b(IP,{},void 0,!1,void 0,this),b(AP,{open:g,onClose:q,anchorRef:W},void 0,!1,void 0,this),$&&b(XP,{viewport:k$,nodes:j,edges:m$,onNavigate:o,containerWidth:window.innerWidth,containerHeight:window.innerHeight},void 0,!1,void 0,this),B&&b(WP,{menu:B,onClose:X},void 0,!1,void 0,this),U&&b(KP,{onClose:()=>z(!1),onToggleMinimap:Y},void 0,!1,void 0,this),J&&b(wP,{onClose:()=>G(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}dW();var VP=document.getElementById("app");if(VP)IK(b(rP,{},void 0,!1,void 0,this),VP);