pmx-canvas 0.3.4 → 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.
Files changed (51) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/Readme.md +16 -3
  3. package/dist/canvas/index.js +80 -80
  4. package/dist/types/client/index.d.ts +1 -1
  5. package/dist/types/client/nodes/ExtAppFrame.d.ts +10 -0
  6. package/dist/types/client/nodes/iframe-document-url.d.ts +1 -0
  7. package/dist/types/client/nodes/use-surface-frame.d.ts +13 -0
  8. package/dist/types/client/state/canvas-store.d.ts +1 -0
  9. package/dist/types/client/state/iframe-mode.d.ts +25 -0
  10. package/dist/types/client/state/node-factory.d.ts +29 -0
  11. package/dist/types/client/uuid-polyfill.d.ts +0 -0
  12. package/dist/types/server/canvas-db.d.ts +0 -1
  13. package/dist/types/server/canvas-state.d.ts +14 -15
  14. package/dist/types/server/operations/composites.d.ts +6 -21
  15. package/dist/types/server/server.d.ts +1 -0
  16. package/docs/RELEASE.md +10 -4
  17. package/docs/cli.md +5 -0
  18. package/docs/environment.md +2 -2
  19. package/docs/http-api.md +47 -1
  20. package/docs/mcp.md +21 -30
  21. package/docs/plans/plan-009-tech-debt-backlog.md +22 -13
  22. package/docs/screenshot.png +0 -0
  23. package/docs/tech-debt-assessment-2026-06.md +5 -5
  24. package/package.json +7 -7
  25. package/skills/pmx-canvas/SKILL.md +36 -10
  26. package/skills/pmx-canvas/evals/evals.json +2 -2
  27. package/skills/pmx-canvas/references/full-reference.md +17 -15
  28. package/skills/pmx-canvas-testing/SKILL.md +3 -0
  29. package/src/cli/commands/history.ts +1 -1
  30. package/src/cli/commands/nodes.ts +31 -1
  31. package/src/cli/index.ts +8 -2
  32. package/src/cli/shared.ts +1 -0
  33. package/src/client/index.tsx +7 -0
  34. package/src/client/nodes/ExtAppFrame.tsx +50 -2
  35. package/src/client/nodes/HtmlNode.tsx +5 -1
  36. package/src/client/nodes/McpAppNode.tsx +5 -1
  37. package/src/client/nodes/iframe-document-url.ts +62 -9
  38. package/src/client/nodes/use-surface-frame.ts +53 -0
  39. package/src/client/state/canvas-store.ts +5 -0
  40. package/src/client/state/iframe-mode.ts +103 -0
  41. package/src/client/state/node-factory.ts +72 -0
  42. package/src/client/state/sse-bridge.ts +212 -86
  43. package/src/client/uuid-polyfill.ts +14 -0
  44. package/src/server/canvas-db.ts +0 -8
  45. package/src/server/canvas-schema.ts +2 -8
  46. package/src/server/canvas-state.ts +51 -151
  47. package/src/server/index.ts +3 -9
  48. package/src/server/operations/composites.ts +24 -21
  49. package/src/server/operations/ops/snapshots.ts +6 -7
  50. package/src/server/operations/registry.ts +4 -1
  51. package/src/server/server.ts +194 -75
@@ -1,155 +1,155 @@
1
- var qP=Object.create;var{getPrototypeOf:FP,defineProperty:v2,getOwnPropertyNames:XP}=Object;var wP=Object.prototype.hasOwnProperty;function AP($){return this[$]}var ZP,MP,SP=($,v,U)=>{var _=$!=null&&typeof $==="object";if(_){var g=v?ZP??=new WeakMap:MP??=new WeakMap,z=g.get($);if(z)return z}U=$!=null?qP(FP($)):{};let J=v||!$||!$.__esModule?v2(U,"default",{value:$,enumerable:!0}):U;for(let b of XP($))if(!wP.call(J,b))v2(J,b,{get:AP.bind($,b),enumerable:!0});if(_)g.set($,J);return J};var QP=($,v)=>()=>(v||$((v={exports:{}}).exports,v),v.exports);var NP=($)=>$;function rP($,v){this[$]=NP.bind(null,v)}var ev=($,v)=>{for(var U in v)v2($,U,{get:v[U],enumerable:!0,configurable:!0,set:rP.bind(v,U)})};var xK=QP((hK)=>{Object.defineProperty(hK,"__esModule",{value:!0});var uK=/highlight-(?:text|source)-([a-z0-9]+)/;function DK($){$.addRule("highlightedCodeBlock",{filter:function(v){var U=v.firstChild;return v.nodeName==="DIV"&&uK.test(v.className)&&U&&U.nodeName==="PRE"},replacement:function(v,U,_){var g=U.className||"",z=(g.match(uK)||[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
- `+U.firstChild.textContent+`
4
+ `+g.firstChild.textContent+`
5
5
  `+_.fence+`
6
6
 
7
- `}})}function RK($){$.addRule("strikethrough",{filter:["del","s","strike"],replacement:function(v){return"~~"+v+"~~"}})}var sk=Array.prototype.indexOf,ek=Array.prototype.every,S6={},$H={left:":---",right:"---:",center:":---:"},j2=null,TK=null,yK=new WeakMap;function vH($){return $?($.getAttribute("align")||$.style.textAlign||"").toLowerCase():""}function jK($){return $?$H[$]:"---"}function VK($,v){var U={left:0,right:0,center:0,"":0},_="";for(var g=0;g<$.rows.length;++g){var z=$.rows[g];if(v<z.childNodes.length){var J=vH(z.childNodes[v]);if(++U[J],U[J]>U[_])_=J}}return _}S6.tableCell={filter:["th","td"],replacement:function($,v){if(C2(mK(v)))return $;return CK($,v)}};S6.tableRow={filter:"tr",replacement:function($,v){let U=mK(v);if(C2(U))return $;var _="";if(gH(v)){let J=EK(U);for(var g=0;g<J;g++){let b=g<v.childNodes.length?v.childNodes[g]:null;var z=jK(VK(U,g));_+=CK(z,b,g)}}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
- `+_:"")}};S6.table={filter:function($,v){return $.nodeName==="TABLE"},replacement:function($,v){if(cK(v,TK)){let b=v.outerHTML,O=zH(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(C2(v))return $;$=$.replace(/\n+/g,`
14
- `);var U=$.trim().split(`
15
- `);if(U.length>=2)U=U[1];var _=/\| :?---/.test(U),g=EK(v),z="";if(g&&!_){z="|"+" |".repeat(g)+`
16
- |`;for(var J=0;J<g;++J)z+=" "+jK(VK(v,J))+" |"}let b=v.caption?v.caption.textContent||"":"",O=b?`${b}
13
+ `;else return G}else{if(e2(v))return $;$=$.replace(/\n+/g,`
14
+ `);var g=$.trim().split(`
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
- `}}};S6.tableCaption={filter:["caption"],replacement:()=>""};S6.tableColgroup={filter:["colgroup","col"],replacement:()=>""};S6.tableSection={filter:["thead","tbody","tfoot"],replacement:function($){return $}};function gH($){var v=$.parentNode;return v.nodeName==="THEAD"||v.firstChild===$&&(v.nodeName==="TABLE"||UH(v))&&ek.call($.childNodes,function(U){return U.nodeName==="TH"})}function UH($){var v=$.previousSibling;return $.nodeName==="TBODY"&&(!v||v.nodeName==="THEAD"&&/^\s*$/i.test(v.textContent))}function CK($,v=null,U=null){if(U===null)U=sk.call(v.parentNode.childNodes,v);var _=" ";if(U===0)_="| ";let g=$.trim().replace(/\n\r/g,"<br>").replace(/\n/g,"<br>");g=g.replace(/\|+/g,"\\|");while(g.length<3)g+=" ";if(v)g=JH(g,v," ");return _+g+" |"}function fK($){if(!$.childNodes)return!1;for(let v=0;v<$.childNodes.length;v++){let U=$.childNodes[v];if(U.nodeName==="TABLE")return!0;if(fK(U))return!0}return!1}var V2=($,v)=>{if(!$.childNodes)return!1;for(let U=0;U<$.childNodes.length;U++){let _=$.childNodes[U];if(v==="code"&&j2&&j2(_))return!0;if(v.includes(_.nodeName))return!0;if(V2(_,v))return!0}return!1},cK=($,v)=>{let U=["UL","OL","H1","H2","H3","H4","H5","H6","HR","BLOCKQUOTE"];if(v.preserveNestedTables)U.push("TABLE");return V2($,"code")||V2($,U)};function C2($){let v=yK.get($);if(v!==void 0)return v;let U=_H($);return yK.set($,U),U}function _H($){if(!$)return!0;if(!$.rows)return!0;if($.rows.length===1&&$.rows[0].childNodes.length<=1)return!0;if(fK($))return!0;return!1}function zH($){let v=$.parentNode;while(v.nodeName!=="DIV")if(v=v.parentNode,!v)return null;return v}function mK($){let v=$.parentNode;while(v.nodeName!=="TABLE")if(v=v.parentNode,!v)return null;return v}function JH($,v,U){let _=v.getAttribute("colspan")||1;for(let g=1;g<_;g++)$+=" | "+U.repeat(3);return $}function EK($){let v=0;for(let U=0;U<$.rows.length;U++){let g=$.rows[U].childNodes.length;if(g>v)v=g}return v}function iK($){j2=$.isCodeBlock,TK=$.options,$.keep(function(U){if(U.nodeName==="TABLE"&&cK(U,$.options))return!0;return!1});for(var v in S6)$.addRule(v,S6[v])}function lK($){$.addRule("taskListItems",{filter:function(v){let U=v.parentNode,_=U.parentNode;return v.type==="checkbox"&&(U.nodeName==="LI"||U.nodeName==="LABEL"&&_&&_.nodeName==="LI")},replacement:function(v,U){return(U.checked?"[x]":"[ ]")+" "}})}function bH($){$.use([DK,RK,iK,lK])}hK.gfm=bH;hK.highlightedCodeBlock=DK;hK.strikethrough=RK;hK.tables=iK;hK.taskListItems=lK});var aU,B$,pO,z2,I6,iO,oO,nO,tO,J2,g2,U2,uP,nU={},tU=[],yP=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,sU=Array.isArray;function $6($,v){for(var U in v)$[U]=v[U];return $}function b2($){$&&$.parentNode&&$.parentNode.removeChild($)}function DP($,v,U){var _,g,z,J={};for(z in v)z=="key"?_=v[z]:z=="ref"?g=v[z]:J[z]=v[z];if(arguments.length>2&&(J.children=arguments.length>3?aU.call(arguments,2):U),typeof $=="function"&&$.defaultProps!=null)for(z in $.defaultProps)J[z]===void 0&&(J[z]=$.defaultProps[z]);return oU($,J,_,g,null)}function oU($,v,U,_,g){var z={type:$,props:v,key:U,ref:_,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:g==null?++pO:g,__i:-1,__u:0};return g==null&&B$.vnode!=null&&B$.vnode(z),z}function a$($){return $.children}function K4($,v){this.props=$,this.context=v}function W4($,v){if(v==null)return $.__?W4($.__,$.__i+1):null;for(var U;v<$.__k.length;v++)if((U=$.__k[v])!=null&&U.__e!=null)return U.__e;return typeof $.type=="function"?W4($):null}function RP($){if($.__P&&$.__d){var v=$.__v,U=v.__e,_=[],g=[],z=$6({},v);z.__v=v.__v+1,B$.vnode&&B$.vnode(z),G2($.__P,z,v,$.__n,$.__P.namespaceURI,32&v.__u?[U]:null,_,U==null?W4(v):U,!!(32&v.__u),g),z.__v=v.__v,z.__.__k[z.__i]=z,eO(_,z,g),v.__e=v.__=null,z.__e!=U&&dO(z)}}function dO($){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}),dO($)}function lO($){(!$.__d&&($.__d=!0)&&I6.push($)&&!dU.__r++||iO!=B$.debounceRendering)&&((iO=B$.debounceRendering)||oO)(dU)}function dU(){try{for(var $,v=1;I6.length;)I6.length>v&&I6.sort(nO),$=I6.shift(),v=I6.length,RP($)}finally{I6.length=dU.__r=0}}function aO($,v,U,_,g,z,J,b,O,K,W){var B,k,P,F,I,H,Y,q=_&&_.__k||tU,w=v.length;for(O=TP(U,v,q,O,w),B=0;B<w;B++)(P=U.__k[B])!=null&&(k=P.__i!=-1&&q[P.__i]||nU,P.__i=B,H=G2($,P,k,g,z,J,b,O,K,W),F=P.__e,P.ref&&k.ref!=P.ref&&(k.ref&&O2(k.ref,null,P),W.push(P.ref,P.__c||F,P)),I==null&&F!=null&&(I=F),(Y=!!(4&P.__u))||k.__k===P.__k?O=sO(P,O,$,Y):typeof P.type=="function"&&H!==void 0?O=H:F&&(O=F.nextSibling),P.__u&=-7);return U.__e=I,O}function TP($,v,U,_,g){var z,J,b,O,K,W=U.length,B=W,k=0;for($.__k=Array(g),z=0;z<g;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]=oU(null,J,null,null,null):sU(J)?J=$.__k[z]=oU(a$,{children:J},null,null,null):J.constructor===void 0&&J.__b>0?J=$.__k[z]=oU(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=jP(J,U,O,B))!=-1&&(B--,(b=U[K])&&(b.__u|=2)),b==null||b.__v==null?(K==-1&&(g>W?k--:g<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=U[z])!=null&&(2&b.__u)==0&&(b.__e==_&&(_=W4(b)),v3(b,b));return _}function sO($,v,U,_){var g,z;if(typeof $.type=="function"){for(g=$.__k,z=0;g&&z<g.length;z++)g[z]&&(g[z].__=$,v=sO(g[z],v,U,_));return v}$.__e!=v&&(_&&(v&&$.type&&!v.parentNode&&(v=W4($)),U.insertBefore($.__e,v||null)),v=$.__e);do v=v&&v.nextSibling;while(v!=null&&v.nodeType==8);return v}function jP($,v,U,_){var g,z,J,b=$.key,O=$.type,K=v[U],W=K!=null&&(2&K.__u)==0;if(K===null&&b==null||W&&b==K.key&&O==K.type)return U;if(_>(W?1:0)){for(g=U-1,z=U+1;g>=0||z<v.length;)if((K=v[J=g>=0?g--:z++])!=null&&(2&K.__u)==0&&b==K.key&&O==K.type)return J}return-1}function hO($,v,U){v[0]=="-"?$.setProperty(v,U==null?"":U):$[v]=U==null?"":typeof U!="number"||yP.test(v)?U:U+"px"}function pU($,v,U,_,g){var z,J;$:if(v=="style")if(typeof U=="string")$.style.cssText=U;else{if(typeof _=="string"&&($.style.cssText=_=""),_)for(v in _)U&&v in U||hO($.style,v,"");if(U)for(v in U)_&&U[v]==_[v]||hO($.style,v,U[v])}else if(v[0]=="o"&&v[1]=="n")z=v!=(v=v.replace(tO,"$1")),J=v.toLowerCase(),v=J in $||v=="onFocusOut"||v=="onFocusIn"?J.slice(2):v.slice(2),$.l||($.l={}),$.l[v+z]=U,U?_?U.u=_.u:(U.u=J2,$.addEventListener(v,z?U2:g2,z)):$.removeEventListener(v,z?U2:g2,z);else{if(g=="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]=U==null?"":U;break $}catch(b){}typeof U=="function"||(U==null||U===!1&&v[4]!="-"?$.removeAttribute(v):$.setAttribute(v,v=="popover"&&U==1?"":U))}}function xO($){return function(v){if(this.l){var U=this.l[v.type+$];if(v.t==null)v.t=J2++;else if(v.t<U.u)return;return U(B$.event?B$.event(v):v)}}}function G2($,v,U,_,g,z,J,b,O,K){var W,B,k,P,F,I,H,Y,q,w,N,C,p,r,n,e=v.type;if(v.constructor!==void 0)return null;128&U.__u&&(O=!!(32&U.__u),z=[b=v.__e=U.__e]),(W=B$.__b)&&W(v);$:if(typeof e=="function")try{if(Y=v.props,q=e.prototype&&e.prototype.render,w=(W=e.contextType)&&_[W.__c],N=W?w?w.props.value:W.__:_,U.__c?H=(B=v.__c=U.__c).__=B.__E:(q?v.__c=B=new e(Y,N):(v.__c=B=new K4(Y,N),B.constructor=e,B.render=CP),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(Y,B.__s))),P=B.props,F=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&&Y!==P&&B.componentWillReceiveProps!=null&&B.componentWillReceiveProps(Y,N),v.__v==U.__v||!B.__e&&B.shouldComponentUpdate!=null&&B.shouldComponentUpdate(Y,B.__s,N)===!1){v.__v!=U.__v&&(B.props=Y,B.state=B.__s,B.__d=!1),v.__e=U.__e,v.__k=U.__k,v.__k.some(function(u){u&&(u.__=v)}),tU.push.apply(B.__h,B._sb),B._sb=[],B.__h.length&&J.push(B);break $}B.componentWillUpdate!=null&&B.componentWillUpdate(Y,B.__s,N),q&&B.componentDidUpdate!=null&&B.__h.push(function(){B.componentDidUpdate(P,F,I)})}if(B.context=N,B.props=Y,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),tU.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&&(I=B.getSnapshotBeforeUpdate(P,F)),r=W!=null&&W.type===a$&&W.key==null?$3(W.props.children):W,b=aO($,sU(r)?r:[r],v,U,_,g,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--;)b2(z[n]);_2(v)}else v.__e=U.__e,v.__k=U.__k,u.then||_2(v);B$.__e(u,v,U)}else z==null&&v.__v==U.__v?(v.__k=U.__k,v.__e=U.__e):b=v.__e=VP(U.__e,v,U,_,g,z,J,O,K);return(W=B$.diffed)&&W(v),128&v.__u?void 0:b}function _2($){$&&($.__c&&($.__c.__e=!0),$.__k&&$.__k.some(_2))}function eO($,v,U){for(var _=0;_<U.length;_++)O2(U[_],U[++_],U[++_]);B$.__c&&B$.__c(v,$),$.some(function(g){try{$=g.__h,g.__h=[],$.some(function(z){z.call(g)})}catch(z){B$.__e(z,g.__v)}})}function $3($){return typeof $!="object"||$==null||$.__b>0?$:sU($)?$.map($3):$6({},$)}function VP($,v,U,_,g,z,J,b,O){var K,W,B,k,P,F,I,H=U.props||nU,Y=v.props,q=v.type;if(q=="svg"?g="http://www.w3.org/2000/svg":q=="math"?g="http://www.w3.org/1998/Math/MathML":g||(g="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(Y);$=document.createElementNS(g,q,Y.is&&Y),b&&(B$.__m&&B$.__m(v,z),b=!1),z=null}if(q==null)H===Y||b&&$.data==Y||($.data=Y);else{if(z=z&&aU.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 Y)||K=="value"&&("defaultValue"in Y)||K=="checked"&&("defaultChecked"in Y)||pU($,K,null,P,g);for(K in Y)P=Y[K],K=="children"?k=P:K=="dangerouslySetInnerHTML"?W=P:K=="value"?F=P:K=="checked"?I=P:b&&typeof P!="function"||H[K]===P||pU($,K,P,H[K],g);if(W)b||B&&(W.__html==B.__html||W.__html==$.innerHTML)||($.innerHTML=W.__html),v.__k=[];else if(B&&($.innerHTML=""),aO(v.type=="template"?$.content:$,sU(k)?k:[k],v,U,_,q=="foreignObject"?"http://www.w3.org/1999/xhtml":g,z,J,z?z[0]:U.__k&&W4(U,0),b,O),z!=null)for(K=z.length;K--;)b2(z[K]);b||(K="value",q=="progress"&&F==null?$.removeAttribute("value"):F!=null&&(F!==$[K]||q=="progress"&&!F||q=="option"&&F!=H[K])&&pU($,K,F,H[K],g),K="checked",I!=null&&I!=$[K]&&pU($,K,I,H[K],g))}return $}function O2($,v,U){try{if(typeof $=="function"){var _=typeof $.__u=="function";_&&$.__u(),_&&v==null||($.__u=$(v))}else $.current=v}catch(g){B$.__e(g,U)}}function v3($,v,U){var _,g;if(B$.unmount&&B$.unmount($),(_=$.ref)&&(_.current&&_.current!=$.__e||O2(_,null,v)),(_=$.__c)!=null){if(_.componentWillUnmount)try{_.componentWillUnmount()}catch(z){B$.__e(z,v)}_.base=_.__P=null}if(_=$.__k)for(g=0;g<_.length;g++)_[g]&&v3(_[g],v,U||typeof $.type!="function");U||b2($.__e),$.__c=$.__=$.__e=void 0}function CP($,v,U){return this.constructor($,U)}function g3($,v,U){var _,g,z,J;v==document&&(v=document.documentElement),B$.__&&B$.__($,v),g=(_=typeof U=="function")?null:U&&U.__k||v.__k,z=[],J=[],G2(v,$=(!_&&U||v).__k=DP(a$,null,[$]),g||nU,nU,v.namespaceURI,!_&&U?[U]:g?null:v.firstChild?aU.call(v.childNodes):null,z,!_&&U?U:g?g.__e:v.firstChild,_,J),eO(z,$,J)}aU=tU.slice,B$={__e:function($,v,U,_){for(var g,z,J;v=v.__;)if((g=v.__c)&&!g.__)try{if((z=g.constructor)&&z.getDerivedStateFromError!=null&&(g.setState(z.getDerivedStateFromError($)),J=g.__d),g.componentDidCatch!=null&&(g.componentDidCatch($,_||{}),J=g.__d),J)return g.__E=g}catch(b){$=b}throw $}},pO=0,z2=function($){return $!=null&&$.constructor===void 0},K4.prototype.setState=function($,v){var U;U=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$6({},this.state),typeof $=="function"&&($=$($6({},U),this.props)),$&&$6(U,$),$!=null&&this.__v&&(v&&this._sb.push(v),lO(this))},K4.prototype.forceUpdate=function($){this.__v&&(this.__e=!0,$&&this.__h.push($),lO(this))},K4.prototype.render=a$,I6=[],oO=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,nO=function($,v){return $.__v.__b-v.__v.__b},dU.__r=0,tO=/(PointerCapture)$|Capture$/i,J2=0,g2=xO(!1),U2=xO(!0),uP=0;var B4,f$,K2,U3,Mg=0,W3=[],E$=B$,_3=E$.__b,z3=E$.__r,J3=E$.diffed,b3=E$.__c,G3=E$.unmount,O3=E$.__;function $_($,v){E$.__h&&E$.__h(f$,$,Mg||v),Mg=0;var U=f$.__H||(f$.__H={__:[],__h:[]});return $>=U.__.length&&U.__.push({}),U.__[$]}function o($){return Mg=1,fP(B3,$)}function fP($,v,U){var _=$_(B4++,2);if(_.t=$,!_.__c&&(_.__=[U?U(v):B3(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 g=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,g(b,O,K),z=W}J&&J.call(this,b,O,K)},f$.shouldComponentUpdate=g}return _.__N||_.__}function c($,v){var U=$_(B4++,3);!E$.__s&&B2(U.__H,v)&&(U.__=$,U.u=v,f$.__H.__h.push(U))}function v_($,v){var U=$_(B4++,4);!E$.__s&&B2(U.__H,v)&&(U.__=$,U.u=v,f$.__h.push(U))}function y($){return Mg=5,n$(function(){return{current:$}},[])}function n$($,v){var U=$_(B4++,7);return B2(U.__H,v)&&(U.__=$(),U.__H=v,U.__h=$),U.__}function S($,v){return Mg=8,n$(function(){return $},v)}function cP(){for(var $;$=W3.shift();){var v=$.__H;if($.__P&&v)try{v.__h.some(eU),v.__h.some(W2),v.__h=[]}catch(U){v.__h=[],E$.__e(U,$.__v)}}}E$.__b=function($){f$=null,_3&&_3($)},E$.__=function($,v){$&&v.__k&&v.__k.__m&&($.__m=v.__k.__m),O3&&O3($,v)},E$.__r=function($){z3&&z3($),B4=0;var v=(f$=$.__c).__H;v&&(K2===f$?(v.__h=[],f$.__h=[],v.__.some(function(U){U.__N&&(U.__=U.__N),U.u=U.__N=void 0})):(v.__h.some(eU),v.__h.some(W2),v.__h=[],B4=0)),K2=f$},E$.diffed=function($){J3&&J3($);var v=$.__c;v&&v.__H&&(v.__H.__h.length&&(W3.push(v)!==1&&U3===E$.requestAnimationFrame||((U3=E$.requestAnimationFrame)||mP)(cP)),v.__H.__.some(function(U){U.u&&(U.__H=U.u),U.u=void 0})),K2=f$=null},E$.__c=function($,v){v.some(function(U){try{U.__h.some(eU),U.__h=U.__h.filter(function(_){return!_.__||W2(_)})}catch(_){v.some(function(g){g.__h&&(g.__h=[])}),v=[],E$.__e(_,U.__v)}}),b3&&b3($,v)},E$.unmount=function($){G3&&G3($);var v,U=$.__c;U&&U.__H&&(U.__H.__.some(function(_){try{eU(_)}catch(g){v=g}}),U.__H=void 0,v&&E$.__e(v,U.__v))};var K3=typeof requestAnimationFrame=="function";function mP($){var v,U=function(){clearTimeout(_),K3&&cancelAnimationFrame(v),setTimeout($)},_=setTimeout(U,35);K3&&(v=requestAnimationFrame(U))}function eU($){var v=f$,U=$.__c;typeof U=="function"&&($.__c=void 0,U()),f$=v}function W2($){var v=f$;$.__c=$.__(),f$=v}function B2($,v){return!$||$.length!==v.length||v.some(function(U,_){return U!==$[_]})}function B3($,v){return typeof v=="function"?v($):v}var EP=Symbol.for("preact-signals");function z_(){if(!(v6>1)){var $,v=!1;(function(){var g=U_;U_=void 0;while(g!==void 0){if(g.S.v===g.v)g.S.i=g.i;g=g.o}})();while(Sg!==void 0){var U=Sg;Sg=void 0,g_++;while(U!==void 0){var _=U.u;if(U.u=void 0,U.f&=-3,!(8&U.f)&&H3(U))try{U.c()}catch(g){if(!v)$=g,v=!0}U=_}}if(g_=0,v6--,v)throw $}else v6--}function g6($){if(v6>0)return $();P2=++iP,v6++;try{return $()}finally{z_()}}var F$=void 0;function k2($){var v=F$;F$=void 0;try{return $()}finally{F$=v}}var P3,Sg=void 0,v6=0,g_=0,iP=0,P2=0,U_=void 0,__=0;function k3($){if(F$!==void 0){var v=$.n;if(v===void 0||v.t!==F$){if(v={i:0,S:$,p:F$.s,n:void 0,t:F$,e:void 0,x:void 0,r:v},F$.s!==void 0)F$.s.n=v;if(F$.s=v,$.n=v,32&F$.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=F$.s,v.n=void 0,F$.s.n=v,F$.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=EP;o$.prototype.h=function(){return!0};o$.prototype.S=function($){var v=this,U=this.t;if(U!==$&&$.e===void 0)if($.x=U,this.t=$,U!==void 0)U.e=$;else k2(function(){var _;(_=v.W)==null||_.call(v)})};o$.prototype.U=function($){var v=this;if(this.t!==void 0){var{e:U,x:_}=$;if(U!==void 0)U.x=_,$.e=void 0;if(_!==void 0)_.e=U,$.x=void 0;if($===this.t){if(this.t=_,_===void 0)k2(function(){var g;(g=v.Z)==null||g.call(v)})}}};o$.prototype.subscribe=function($){var v=this;return Y6(function(){var U=v.value,_=F$;F$=void 0;try{$(U)}finally{F$=_}},{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 $=F$;F$=void 0;try{return this.value}finally{F$=$}};Object.defineProperty(o$.prototype,"value",{get:function(){var $=k3(this);if($!==void 0)$.i=this.i;return this.v},set:function($){if($!==this.v){if(g_>100)throw Error("Cycle detected");(function(U){if(v6!==0&&g_===0){if(U.l!==P2)U.l=P2,U_={S:U,v:U.v,i:U.i,o:U_}}})(this),this.v=$,this.i++,__++,v6++;try{for(var v=this.t;v!==void 0;v=v.x)v.t.N()}finally{z_()}}}});function O$($,v){return new o$($,v)}function H3($){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 L3($){for(var v=$.s;v!==void 0;v=v.n){var U=v.S.n;if(U!==void 0)v.r=U;if(v.S.n=v,v.i=-1,v.n===void 0){$.s=v;break}}}function I3($){var v=$.s,U=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 U=v;if(v.S.n=v.r,v.r!==void 0)v.r=void 0;v=_}$.s=U}function p6($,v){o$.call(this,void 0),this.x=$,this.s=void 0,this.g=__-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}p6.prototype=new o$;p6.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===__)return!0;if(this.g=__,this.f|=1,this.i>0&&!H3(this))return this.f&=-2,!0;var $=F$;try{L3(this),F$=this;var v=this.x();if(16&this.f||this.v!==v||this.i===0)this.v=v,this.f&=-17,this.i++}catch(U){this.v=U,this.f|=16,this.i++}return F$=$,I3(this),this.f&=-2,!0};p6.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,$)};p6.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)}}};p6.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var $=this.t;$!==void 0;$=$.x)$.t.N()}};Object.defineProperty(p6.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var $=k3(this);if(this.h(),$!==void 0)$.i=this.i;if(16&this.f)throw this.v;return this.v}});function o6($,v){return new p6($,v)}function Y3($){var v=$.m;if($.m=void 0,typeof v=="function"){v6++;var U=F$;F$=void 0;try{v()}catch(_){throw $.f&=-2,$.f|=8,H2($),_}finally{F$=U,z_()}}}function H2($){for(var v=$.s;v!==void 0;v=v.n)v.S.U(v);$.x=void 0,$.s=void 0,Y3($)}function lP($){if(F$!==this)throw Error("Out-of-order effect");if(I3(this),F$=$,this.f&=-2,8&this.f)H2(this);z_()}function P4($,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,P3)P3.push(this)}P4.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{$()}};P4.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,Y3(this),L3(this),v6++;var $=F$;return F$=this,lP.bind(this,$)};P4.prototype.N=function(){if(!(2&this.f))this.f|=2,this.u=Sg,Sg=this};P4.prototype.d=function(){if(this.f|=8,!(1&this.f))H2(this)};P4.prototype.dispose=function(){this.d()};function Y6($,v){var U=new P4($,v);try{U.c()}catch(g){throw U.d(),g}var _=U.d.bind(U);return _[Symbol.dispose]=_,_}var L2,I2,J_,hP=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,q3=[],F3=[];Y6(function(){L2=this.N})();function k4($,v){B$[$]=v.bind(null,B$[$]||function(){})}function b_($){if(J_){var v=J_;J_=void 0,v()}J_=$&&$.S()}function X3($){var v=this,U=$.data,_=pP(U);_.value=U;var g=n$(function(){var b=v,O=v.__v;while(O=O.__)if(O.__c){O.__c.__$f|=4;break}var K=o6(function(){var P=_.value.value;return P===0?0:P===!0?"":P||""}),W=o6(function(){return!Array.isArray(K.value)&&!z2(K.value)}),B=Y6(function(){if(this.N=w3,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=g[0],J=g[1];return z.value?J.peek():J.value}X3.displayName="ReactiveTextNode";Object.defineProperties(o$.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:X3},props:{configurable:!0,get:function(){var $=this;return{data:{get value(){return $.value}}}}},__b:{configurable:!0,value:1}});k4("__b",function($,v){if(typeof v.type=="string"){var U,_=v.props;for(var g in _)if(g!=="children"){var z=_[g];if(z instanceof o$){if(!U)v.__np=U={};U[g]=z,_[g]=z.peek()}}}$(v)});k4("__r",function($,v){if($(v),v.type!==a$){b_();var U,_=v.__c;if(_){if(_.__$f&=-2,(U=_.__$u)===void 0)_.__$u=U=function(g,z){var J;return Y6(function(){J=this},{name:z}),J.c=g,J}(function(){var g;if(hP)(g=U.y)==null||g.call(U);_.__$f|=1,_.setState({})},typeof v.type=="function"?v.type.displayName||v.type.name:"")}I2=_,b_(U)}});k4("__e",function($,v,U,_){b_(),I2=void 0,$(v,U,_)});k4("diffed",function($,v){b_(),I2=void 0;var U;if(typeof v.type=="string"&&(U=v.__e)){var{__np:_,props:g}=v;if(_){var z=U.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={},U.U=z;for(var O in _){var K=z[O],W=_[O];if(K===void 0)K=xP(U,O,W),z[O]=K;else K.o(W,g)}for(var B in _)g[B]=_[B]}}$(v)});function xP($,v,U,_){var g=v in $&&$.ownerSVGElement===void 0,z=O$(U),J=U.peek();return{o:function(b,O){z.value=b,J=b.peek()},d:Y6(function(){this.N=w3;var b=z.value.value;if(J!==b)if(J=void 0,g)$[v]=b;else if(b!=null&&(b!==!1||v[4]==="-"))$.setAttribute(v,b);else $.removeAttribute(v);else J=void 0})}}k4("unmount",function($,v){if(typeof v.type=="string"){var U=v.__e;if(U){var _=U.U;if(_){U.U=void 0;for(var g in _){var z=_[g];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)});k4("__h",function($,v,U,_){if(_<3||_===9)v.__$f|=2;$(v,U,_)});K4.prototype.shouldComponentUpdate=function($,v){if(this.__R)return!0;var U=this.__$u,_=U&&U.s!==void 0;for(var g 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 pP($,v){return n$(function(){return O$($,v)},[])}var oP=typeof requestAnimationFrame>"u"?setTimeout:function($){var v=function(){clearTimeout(U),cancelAnimationFrame(_),$()},U=setTimeout(v,35),_=requestAnimationFrame(v)},nP=function($){queueMicrotask(function(){queueMicrotask($)})};function tP(){g6(function(){var $;while($=q3.shift())L2.call($)})}function dP(){if(q3.push(this)===1)(B$.requestAnimationFrame||oP)(tP)}function aP(){g6(function(){var $;while($=F3.shift())L2.call($)})}function w3(){if(F3.push(this)===1)(B$.requestAnimationFrame||nP)(aP)}function A3($,v){var U=y($);U.current=$,c(function(){return Y6(function(){return this.N=dP,U.current()},v)},[])}var G_=O$(null),Qg=O$([]),L4=O$(new Set),I4=O$(new Set),O_=O$([]),K_=O$(new Set),q6=O$(!1),H4=O$(0);function Z3(){G_.value=null,Qg.value=[],L4.value=new Set,I4.value=new Set,O_.value=[],K_.value=new Set,q6.value=!1,H4.value=0}function W_(){q6.value=!0,H4.value=0}function B_(){q6.value=!1}function M3($,v,U){L4.value=new Set($),I4.value=new Set(v),O_.value=U}function P_($){G_.value=$}function S3($,v=6){if(Qg.value=[$,...Qg.value].slice(0,v),!q6.value)H4.value=Math.min(99,H4.value+1)}function k_($){K_.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"},H_=new Set(["markdown","mcp-app","webpage","json-render","graph","context","ledger","file","image","html"]);function Q3($){return $.type==="mcp-app"&&$.data.mode==="ext-app"&&$.data.serverName==="Excalidraw"&&$.data.toolName==="create_view"}function N3($){if($.length===0)return null;let{POSITIVE_INFINITY:v,POSITIVE_INFINITY:U,NEGATIVE_INFINITY:_,NEGATIVE_INFINITY:g}=Number;for(let z of $)v=Math.min(v,z.position.x),U=Math.min(U,z.position.y),_=Math.max(_,z.position.x+z.size.width),g=Math.max(g,z.position.y+z.size.height);if(!Number.isFinite(v)||!Number.isFinite(U))return null;return{x:v-40,y:U-40-32,width:_-v+80,height:g-U+80+32}}function sP($){let v=$.filter((O)=>!O.pinned&&O.dockPosition===null),U=new Map(v.map((O)=>[O.id,O])),_=new Map,g=[],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?U.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}`;g.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=N3(W);if(!B)continue;let k=`group:${O.id}`;g.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}`;g.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:g,nodesById:U,nodeToUnit:_}}function eP($,v,U){let _=new Map,g=new Map,z=new Map,J=new Map;for(let b of $)_.set(b.id,new Set),g.set(b.id,new Set),z.set(b.id,0),J.set(b.id,0);for(let b of U){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);g.get(O).add(K),g.get(K).add(O)}return{outgoing:_,undirected:g,indegree:z,outdegree:J}}function $k($,v){let U=new Map($.map((z)=>[z.id,z])),_=new Set,g=[];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)=>U.get(K)).filter((K)=>K!==void 0).sort((K,W)=>K.sortKey.y-W.sortKey.y||K.sortKey.x-W.sortKey.x);g.push(O)}return g.sort((z,J)=>z[0].sortKey.y-J[0].sortKey.y||z[0].sortKey.x-J[0].sortKey.x)}function vk($){let v=new Map,U=0,_=0,g=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(U>0&&U+b.size.width>J)U=0,_+=g+72,g=0;v.set(b.id,{x:U,y:_}),U+=b.size.width+96,g=Math.max(g,b.size.height),z=Math.max(z,U-96)}return{positions:v,size:{width:Math.max(0,z),height:_+g},sortKey:$[0].sortKey}}function gk($,v,U,_,g){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&&(g.get(q.id)??0)>0).sort((q,w)=>q.sortKey.x-w.sortKey.x||q.sortKey.y-w.sortKey.y),b=J.length>0?J:[$.slice().sort((q,w)=>q.sortKey.x-w.sortKey.x||q.sortKey.y-w.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(),w=O.get(q)??0;for(let N of U.get(q)??[]){if(!z.has(N)||O.has(N))continue;O.set(N,w+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 w=O.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,N)=>w.sortKey.y-N.sortKey.y||w.sortKey.x-N.sortKey.x);let P=new Map,F=new Map,I=0;for(let q of k){let w=B.get(q),N=w.reduce((p,r,n)=>p+r.size.height+(n>0?72:0),0),C=Math.max(...w.map((p)=>p.size.width));P.set(q,N),F.set(q,C),I=Math.max(I,N)}let H=new Map,Y=0;for(let q of k){let w=B.get(q),N=P.get(q)??0,C=F.get(q)??0,p=Math.max(0,(I-N)/2);for(let r of w)H.set(r.id,{x:Y,y:p}),p+=r.size.height+72;Y+=C+96}return{positions:H,size:{width:Math.max(0,Y-96),height:I},sortKey:$[0].sortKey}}function Uk($){let v=new Map,U=40,_=80,g=0;for(let z of $){if(U>40&&U+z.size.width>3200)U=40,_+=g+180,g=0;for(let[J,b]of z.positions.entries())v.set(J,{x:U+b.x,y:_+b.y});U+=z.size.width+220,g=Math.max(g,z.size.height)}return v}function Y2($,v,U){let{units:_,nodesById:g,nodeToUnit:z}=sP($),J=new Map,b=new Map;if(_.length===0)return{nodePositions:J,groupBounds:b};let{outgoing:O,undirected:K,indegree:W,outdegree:B}=eP(_,z,v),k=$k(_,K).map((F)=>U==="graph"?gk(F,O,K,W,B):vk(F)),P=Uk(k);for(let F of _){let I=P.get(F.id);if(!I)continue;let H=I.x-F.origin.x,Y=I.y-F.origin.y;if(F.groupId){let N=[];for(let p of F.memberIds){let r=g.get(p);if(!r)continue;let n={x:r.position.x+H,y:r.position.y+Y};J.set(p,n),N.push({position:n,size:r.size})}let C=N3(N);if(C)b.set(F.groupId,C);continue}let q=F.memberIds[0],w=g.get(q);if(!w)continue;J.set(q,{x:w.position.x+H,y:w.position.y+Y})}return{nodePositions:J,groupBounds:b}}function q2($,v){console.error(`[intent-bridge] ${$} failed`,v)}async function c$($,v,U,_){try{return await(await fetch(v,_)).json()}catch(g){return q2($,g),U}}async function _k($,v,U){try{return{ok:(await fetch(v,U)).ok}}catch(_){return q2($,_),{ok:!1}}}async function r3($,v,U){try{await fetch(v,U)}catch(_){q2($,_)}}async function u3($,v={}){return c$("sendIntent","/api/workbench/intent",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})})}async function F2($){let U=`Veto: do not ${$.label?.trim()||`${$.kind} intent`}${$.reason?` — ${$.reason}`:""}.`;if((await c$("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 r3("vetoGhostSteering","/api/canvas/ax/steer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:U,source:"browser"})}),!0}async function U6($){return(await c$("renderMarkdown","/api/render",{},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdown:$})})).html??""}async function Ng($){return c$("fetchFile",`/api/file?path=${encodeURIComponent($)}`,{content:""})}async function y3($,v){return c$("saveFile","/api/file/save",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$,content:v})})}async function L_($){return _k("openWorkbenchFile","/api/workbench/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:$})})}async function I_($){return c$("saveCanvasTheme","/api/canvas/theme",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theme:$})})}async function D3(){return[]}async function rg($,v,U,_,g){if(!$.trim())return{ok:!1,error:"Prompt text is required"};return c$("submitCanvasPrompt","/api/canvas/prompt",{ok:!1,error:"Network error"},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:$,...v?{position:v}:{},...U?{parentNodeId:U}:{},..._&&_.length>0?{contextNodeIds:_}:{},...g?{threadNodeId:g}:{}})})}async function R3($,v){return rg(v,void 0,void 0,void 0,$)}async function T3($,v={}){await r3("pushCanvasUpdate","/api/canvas/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates:$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function Y4($,v,U,_){return c$("createEdgeFromClient","/api/canvas/edge",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:$,to:v,type:U,label:_})})}async function Ev($){return c$("createNodeFromClient","/api/canvas/node",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function Zv($,v){return c$("updateNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)})}async function Y_($,v){return c$("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 c$("removeNodeFromClient",`/api/canvas/node/${encodeURIComponent($)}`,{ok:!1},{method:"DELETE"})}async function j3(){return c$("fetchAxSurfaceState","/api/canvas/ax/surface-snapshot",null)}async function V3($,v){return c$("openNodeInSystemBrowserRequest","/api/canvas/open-external",{ok:!1,opened:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:$,url:v})})}async function F_($){return c$("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 C3($,v={}){return c$("updateViewportFromClient","/api/canvas/viewport",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...$,...v.recordHistory===!1?{recordHistory:!1}:{}})})}async function X_($){return c$("createGroupFromClient","/api/canvas/group",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})}async function f3($){return c$("ungroupFromClient","/api/canvas/group/ungroup",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupId:$})})}async function c3(){return c$("listSnapshots","/api/canvas/snapshots?all=true",[])}async function m3($){return c$("saveSnapshot","/api/canvas/snapshots",{ok:!1},{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})})}async function E3($){return c$("restoreSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"POST"})}async function i3($){return c$("deleteSnapshot",`/api/canvas/snapshots/${$}`,{ok:!1},{method:"DELETE"})}function ug($,v){console.error(`[canvas-store] ${$} failed`,v)}var P$=O$({x:0,y:0,scale:1}),T=O$(new Map),m$=O$(new Map),F4=O$(new Map),D$=O$(null),n6=O$("connecting"),X4=O$(""),A_=O$(!1),T$=O$("dark"),t6=O$(!1),X6=O$(null),j$=O$(null),iv=O$(null),Mv=null,q4,l3=100,zk=2500,Z_=O$(null),uv=O$(null),w6=O$(null),i$=O$(new Set),R$=O$(new Set);function p3($,v){if(!$)return new Set;let U=new Set;for(let _ of v.values()){if(_.from===$)U.add(_.to);if(_.to===$)U.add(_.from)}return U}var o3=o6(()=>p3(D$.value,m$.value));function h3($,v){let U=new Set;for(let _ of $)if(v.has(_))U.add(_);return U}function x3($,v){if($.size!==v.size)return!1;for(let U of $)if(!v.has(U))return!1;return!0}function n3($){let v=new Set(i$.value);if(v.has($))v.delete($);else v.add($);i$.value=v}function t3($){i$.value=new Set($)}function jv(){if(i$.value.size===0)return;i$.value=new Set}function w4($){let v=new Set(R$.value);if(v.has($))v.delete($);else v.add($);R$.value=v,t$(),M_(v)}function d3($){let v=new Set(R$.value);for(let U of $)v.add(U);R$.value=v,t$(),M_(v)}function a3(){if(R$.value.size===0)return;R$.value=new Set,t$(),M_(new Set)}function s3($){R$.value=new Set($)}function e3(){let $=R$.value;if($.size===0)return[];return Array.from($).map((v)=>T.value.get(v)).filter((v)=>v!==void 0)}function M_($){fetch("/api/canvas/context-pins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeIds:Array.from($)})}).catch((v)=>{ug("syncContextPinsToServer",v)})}var w_=1;function _6($){g6(()=>{let v=new Map(T.value);if($.zIndex>=w_)w_=$.zIndex+1;v.set($.id,$),T.value=v,D$.value=$.id})}function Pv($,v){w2($,v)}function w2($,v,U={}){let _=T.value.get($);if(!_)return;let g=new Map(T.value);if(_.type==="group"&&v.position&&U.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=g.get(K);if(!W||W.type==="group")continue;g.set(K,{...W,position:{x:W.position.x+J,y:W.position.y+b}})}}}g.set($,{..._,...v}),T.value=g;let z=g.get($)?.data.appCheckpoint?.updatedAt;if(iv.value===$&&z!==void 0&&z!==q4)X2($)}function v$($,v){let U=T.value.get($);if(!U)return;Pv($,{data:{...U.data,...v}})}function A4($){Jk($);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 U=new Set(i$.value);U.delete($),i$.value=U}if(R$.value.has($)){let U=new Set(R$.value);U.delete($),R$.value=U,M_(U)}}function S_($){let v=new Map(m$.value);v.set($.id,$),m$.value=v}function $K($){let v=new Map(m$.value);v.delete($),m$.value=v}function Jk($){let v=!1,U=new Map(m$.value);for(let[_,g]of U)if(g.from===$||g.to===$)U.delete(_),v=!0;if(v)m$.value=U}function bk($){let v=new Map(F4.value);if(!v.delete($))return;F4.value=v}async function A2($){try{return{ok:(await fetch("/api/canvas/annotation",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).ok}}catch(v){return ug("createAnnotationFromClient",v),{ok:!1}}}async function vK($){try{let v=await fetch(`/api/canvas/annotation/${encodeURIComponent($)}`,{method:"DELETE"});if(v.ok)bk($);return{ok:v.ok}}catch(v){return ug("removeAnnotationFromClient",v),{ok:!1}}}function Z4($,v){if(!T.value.get($))return;Pv($,{size:v})}function A6($){if(!T.value.get($))return;Pv($,{zIndex:w_++}),D$.value=$}function Z6($){let v=T.value.get($);if(!v)return;Pv($,{collapsed:!v.collapsed})}function gK(){for(let $ of T.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)Pv($.id,{collapsed:!0})}var Q_=o6(()=>{for(let $ of T.value.values())if($.type==="context"&&$.dockPosition==="right"&&!$.collapsed)return!0;return!1});function Z2($,v){if(!T.value.get($))return;Pv($,{dockPosition:v}),t$()}function M4($){let v=T.value.get($);if(!v)return;let U=P$.value,_=(window.innerWidth/2-U.x)/U.scale,g=(window.innerHeight/2-U.y)/U.scale;Pv($,{dockPosition:null,position:{x:_-v.size.width/2,y:g-v.size.height/2}}),t$()}function UK($){P$.value={...P$.value,...$}}function _K($){P$.value=$}function zK($){JK($)}function JK($,v={}){P$.value=$,t$(v),C3($,v)}function bK($,v={}){let U=new Map,_=1;for(let B of $.nodes)if(U.set(B.id,B),B.zIndex>=_)_=B.zIndex+1;let g=$.edges.filter((B)=>U.has(B.from)&&U.has(B.to)),z=new Map;for(let B of g)z.set(B.id,B);let J=new Map;for(let B of $.annotations??[])J.set(B.id,B);let b=D$.value!==null&&U.has(D$.value)?D$.value:null,O=j$.value!==null&&U.has(j$.value)?j$.value:null,K=h3(i$.value,U),W=h3(R$.value,U);g6(()=>{if(v.applyViewport===!0&&$.viewport)P$.value=$.viewport;if(w_=_,T.value=U,m$.value=z,F4.value=J,D$.value=b,j$.value=O,!x3(i$.value,K))i$.value=K;if(!x3(R$.value,W))R$.value=W})}var F6=null;function Gk($){return 1-(1-$)**3}function lv($,v=300,U={}){if(F6!==null)cancelAnimationFrame(F6);let _={...P$.value},g=performance.now();function z(J){let b=J-g,O=Math.min(1,b/v),K=Gk(O);if(P$.value={x:_.x+($.x-_.x)*K,y:_.y+($.y-_.y)*K,scale:_.scale+($.scale-_.scale)*K},O<1)F6=requestAnimationFrame(z);else F6=null,JK($,U)}F6=requestAnimationFrame(z)}function S4(){if(F6!==null)cancelAnimationFrame(F6),F6=null}var GK="pmx-canvas-layout";function t$($={}){try{let v=Array.from(T.value.values()),U=v.map((g)=>({id:g.id,position:g.position,size:g.size,collapsed:g.collapsed,dockPosition:g.dockPosition})),_={viewport:P$.value,nodes:v.map((g)=>({id:g.id,type:g.type,position:g.position,size:g.size,collapsed:g.collapsed,pinned:g.pinned,dockPosition:g.dockPosition})),edges:Array.from(m$.value.values()).map((g)=>({id:g.id,from:g.from,to:g.to,type:g.type,label:g.label,style:g.style,animated:g.animated})),contextPinnedNodeIds:Array.from(R$.value)};localStorage.setItem(GK,JSON.stringify(_)),T3(U,$)}catch(v){ug("persistLayout",v)}}function OK(){try{let $=localStorage.getItem(GK);if(!$)return null;let v=JSON.parse($),U=Array.isArray(v.nodes)?v.nodes:[];if(U.length===0)return null;let _=new Map;for(let g of U){if(typeof g.id!=="string"||g.id.length===0)continue;_.set(g.id,{...g.position?{position:g.position}:{},...g.size?{size:g.size}:{},...g.collapsed!==void 0?{collapsed:g.collapsed}:{},...g.pinned!==void 0?{pinned:g.pinned}:{},...g.dockPosition!==void 0?{dockPosition:g.dockPosition}:{}})}return _.size>0?_:null}catch($){return ug("restoreLayout",$),null}}function N_($,v){let U=Array.from(T.value.values());if(U.length===0)return;let{POSITIVE_INFINITY:_,POSITIVE_INFINITY:g,NEGATIVE_INFINITY:z,NEGATIVE_INFINITY:J}=Number;for(let P of U)_=Math.min(_,P.position.x),g=Math.min(g,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-g+b*2,W=Math.min(1,Math.min($/O,v/K)),B=(_+z)/2,k=(g+J)/2;lv({x:$/2-B*W,y:v/2-k*W,scale:W})}function Yv($,v={}){let U=T.value.get($);if(!U)return;let _=P$.value,g=U.position.x+U.size.width/2,z=U.position.y+U.size.height/2;lv({x:window.innerWidth/2-g*_.scale,y:window.innerHeight/2-z*_.scale,scale:_.scale},300,v),A6($)}function KK($=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,g=v[_];A6(g),Yv(g)}function WK($){let v=D$.value;if(!v)return;let U=T.value.get(v);if(!U)return;let _=p3(v,m$.value);if(_.size===0)return;let g=U.position.x+U.size.width/2,z=U.position.y+U.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-g,P=B-z,F=Math.sqrt(k*k+P*P);if(F<1)continue;let I;switch($){case"up":I=-P;break;case"down":I=P;break;case"left":I=-k;break;case"right":I=k;break}if(I<=0)continue;let H=I/F-F*0.001;if(H>b)b=H,J=O}if(J)Yv(J)}function z6($){if(!T.value.get($))return;if(Mv!==null)clearTimeout(Mv),Mv=null;iv.value=null,q4=void 0,A6($),j$.value=$}function X2($){if(Mv!==null)clearTimeout(Mv),Mv=null;if(j$.value===$)j$.value=null;if(iv.value===$)iv.value=null;q4=void 0}function d6(){let $=j$.value,v=$?T.value.get($):void 0;if($&&v&&Q3(v)){let U=$,_=Date.now();if(iv.value=U,q4=v.data.appCheckpoint?.updatedAt,Mv!==null)clearTimeout(Mv);let g=()=>{let J=T.value.get(U)?.data.appCheckpoint?.updatedAt;if(J!==void 0&&J!==q4){X2(U);return}if(Date.now()-_>=zk){X2(U);return}Mv=setTimeout(g,l3)};Mv=setTimeout(g,l3);return}if(Mv!==null)clearTimeout(Mv),Mv=null;iv.value=null,q4=void 0,j$.value=null}function r_(){let $=Y2(Array.from(T.value.values()),Array.from(m$.value.values()),"grid");if($.nodePositions.size===0&&$.groupBounds.size===0)return;g6(()=>{for(let[v,U]of $.nodePositions.entries())Pv(v,{position:U});for(let[v,U]of $.groupBounds.entries())w2(v,{position:{x:U.x,y:U.y},size:{width:U.width,height:U.height}},{skipGroupChildTranslation:!0})}),t$()}function u_(){let $=Y2(Array.from(T.value.values()),Array.from(m$.value.values()),"graph");if($.nodePositions.size===0&&$.groupBounds.size===0)return;g6(()=>{for(let[v,U]of $.nodePositions.entries())Pv(v,{position:U});for(let[v,U]of $.groupBounds.entries())w2(v,{position:{x:U.x,y:U.y},size:{width:U.width,height:U.height}},{skipGroupChildTranslation:!0})}),t$()}var Ok=0;function G($,v,U,_,g,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:U,ref:J,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ok,__i:-1,__u:0,__source:g,__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 Kk($){return new Date($).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}function Wk(){gK(),W_()}function BK(){let $=Qg.value;if($.length===0)return null;let v=q6.value,U=H4.value;if(!v&&Q_.value)return null;if(!v)return G("button",{type:"button",class:"attention-history-tab",onClick:Wk,"aria-label":U>0?`Recent updates — ${U} new`:"Recent updates",title:U>0?`${U} 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),U>0&&G("span",{class:"attention-history-tab-badge","aria-hidden":"true",children:U>9?"9+":U},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:B_,"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:Kk(_.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 PK(){let $=G_.value;if(!$)return null;return G("button",{type:"button",class:`attention-toast attention-tone-${$.tone}`,onClick:W_,"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 Bk=700,Pk=1600;function kk($){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 U=kk($);if(U.length<=v)return U;if(v<=1)return U.slice(0,v);return`${U.slice(0,Math.max(0,v-1)).trimEnd()}…`}function y_($,v){if(typeof $==="string")return qv($,v);if($===null||$===void 0)return"";try{return qv(JSON.stringify($),v)}catch{return""}}function Hk($,v){let U=[],_=typeof $.url==="string"?$.url:"",g=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(_)U.push(`URL: ${_}`);if(g)U.push(`Title: ${g}`);if(z)U.push(`Description: ${z}`);if(J||b!==null)U.push(`Fetch: ${J||"unknown"}${b!==null?` (${b})`:""}`);if(O)U.push(`Error: ${O}`);let W=U.join(`
28
- `),B=Math.max(0,v-W.length-(W?2:0)),k=B>0?qv(K,B):"";if(W&&k)return`${W}
29
-
30
- ${k}`;if(W)return qv(W,v);return qv(K,v)}function Lk($){if($===null||$===void 0)return"";if(typeof $!=="object"||Array.isArray($))return"";let v=$.elements;if(Array.isArray(v))return`Diagram elements: ${v.length}`;let U=Object.keys($).sort();return U.length>0?`Input keys: ${U.join(", ")}`:""}function Ik($,v){let U=[],_=typeof $.title==="string"?$.title:"",g=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=Lk($.toolInput);if(_)U.push(`App: ${_}`);if(g||z)U.push(`Mode: ${[g,z].filter(Boolean).join(" / ")}`);if(J||b)U.push(`Source: ${[J,b].filter(Boolean).join(" / ")}`);if(O)U.push(`Resource: ${O}`);if(K)U.push(`Path: ${K}`);if(W)U.push(`URL: ${W}`);if(B)U.push(`Session: ${B}`);if(k)U.push(k);if(U.length===0)return"MCP App node";return qv(U.join(`
31
- `),v)}function Yk($,v){let U=[],_=typeof $.content==="string"?$.content:"",g=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(_)U.push(_);if(!_&&g)U.push(`Web artifact: ${g}`);if(W.length>0&&!_.includes("Source files:")){let k=K!==null?Math.max(0,K-W.length):0;U.push(`Source files: ${W.join(", ")}${k>0?`, +${k} more`:""}`)}if(O!==null&&!_.includes("Artifact bytes:"))U.push(`Artifact bytes: ${O}`);if(B.length>0&&!_.includes("Dependencies:"))U.push(`Dependencies: ${B.join(", ")}`);if(z)U.push(`Path: ${z}`);if(b)U.push(`Project: ${b}`);if(J)U.push(`URL: ${J}`);return U.length>0?qv(U.join(`
32
- `),v):"Web artifact node"}function qk($,v){let U=[],_=typeof $.htmlPrimitive==="string"?$.htmlPrimitive:"",g=typeof $.description==="string"?$.description:"",z=$.primitiveData;if(_)U.push(`HTML primitive: ${_}`);if(g)U.push(g);if(z!==void 0)U.push(`Data: ${y_(z,v)}`);return qv(U.join(`
33
- `),v)}function kK($,v={}){let U=v.defaultTextLength??Bk,_=v.webpageTextLength??Pk;switch($.type){case"markdown":{let g=$.data.rendered||$.data.content||"";return qv(g,U)}case"mcp-app":{if($.data.viewerType==="web-artifact")return Yk($.data,U);let g=$.data.chartConfig;if(g){let z=g.title||"Untitled chart",J=g.type||"unknown",b=Array.isArray(g.labels)?g.labels.join(", "):"";return qv(`Chart: ${z} (${J}). Labels: ${b}`,U)}return Ik($.data,U)}case"webpage":return Hk($.data,_);case"json-render":case"graph":{let g=$.data.graphConfig;if(g)return qv(`Graph: ${JSON.stringify(g)}`,U);return y_($.data.spec??{},U)}case"html":{if(typeof $.data.agentSummary==="string")return qv($.data.agentSummary,U);if(typeof $.data.htmlPrimitive==="string")return qk($.data,U);return y_({title:$.data.title,description:$.data.description,summary:$.data.summary,contentSummary:$.data.contentSummary,embeddedNodeIds:$.data.embeddedNodeIds,embeddedUrls:$.data.embeddedUrls},U)}case"prompt":case"response":{let g=$.data.text||$.data.content||"";return qv(g,U)}case"file":{let g=typeof $.data.path==="string"?$.data.path:"",z=typeof $.data.fileContent==="string"?$.data.fileContent:typeof $.data.content==="string"?$.data.content:"",J=g?`Path: ${g}
34
-
35
- `:"",b=Math.max(0,U-J.length);return`${J}${qv(z,b)}`.trim()}default:return y_($.data,U)}}function Fk($,v){let U=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,g=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2;return Math.sqrt((U-g)**2+(_-z)**2)}function Xk($,v){let U=$.position.x+$.size.width,_=$.position.y+$.size.height,g=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(U,g)),b=Math.max(0,Math.max($.position.y,v.position.y)-Math.min(_,z));return Math.sqrt(J**2+b**2)}function wk($){let v=[...$],U=100;return v.sort((_,g)=>{let z=Math.floor(_.position.y/100),J=Math.floor(g.position.y/100);if(z!==J)return z-J;return _.position.x-g.position.x}),v}function Ak($){let v=$.find((g)=>g.data.title&&typeof g.data.title==="string");if(v&&$.length<=3)return $.filter((z)=>z.data.title).map((z)=>z.data.title).slice(0,3).join(", ");let U={};for(let g of $)U[g.type]=(U[g.type]??0)+1;let _=Object.entries(U).map(([g,z])=>z===1?g:`${z} ${g}`);if(v)return`${v.data.title} + ${_.join(", ")}`;return _.join(", ")}function Zk($,v){return $.x<=v.x+v.width&&$.x+$.width>=v.x&&$.y<=v.y+v.height&&$.y+$.height>=v.y}function Mk($,v){let U=v.filter((g)=>Zk($.bounds,{x:g.position.x,y:g.position.y,width:g.size.width,height:g.size.height})),_=U.map((g)=>typeof g.data.title==="string"&&g.data.title.length>0?g.data.title:g.id);return{id:$.id,label:$.label??$.text??null,bounds:$.bounds,targetNodeIds:U.map((g)=>g.id),targetNodeTitles:_,target:_.length>0?_.join(", "):"empty canvas region"}}function Sk($,v=200){if($.length===0)return[];let U=new Map,_=(O)=>{while(U.get(O)!==O){let K=U.get(O);U.set(O,U.get(K)),O=K}return O},g=(O,K)=>{let W=_(O),B=_(K);if(W!==B)U.set(W,B)};for(let O of $)U.set(O.id,O.id);for(let O=0;O<$.length;O++)for(let K=O+1;K<$.length;K++)if(Xk($[O],$[K])<=v)g($[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((Y)=>Y.position.x),W=O.map((Y)=>Y.position.y),B=O.map((Y)=>Y.position.x+Y.size.width),k=O.map((Y)=>Y.position.y+Y.size.height),P=Math.min(...K),F=Math.min(...W),I=Math.max(...B),H=Math.max(...k);J.push({id:`cluster-${b++}`,nodeIds:O.map((Y)=>Y.id),label:Ak(O),centroid:{x:Math.round((P+I)/2),y:Math.round((F+H)/2)},bounds:{x:P,y:F,width:I-P,height:H-F}})}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 Qk($,v,U=5,_=600){let g=$.filter((J)=>v.has(J.id)),z=$.filter((J)=>!v.has(J.id));return g.map((J)=>{let b=z.map((O)=>({node:O,distance:Fk(J,O)})).filter((O)=>O.distance<=_).sort((O,K)=>O.distance-K.distance).slice(0,U);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 yg($,v,U,_=[]){let g=Sk($),z=new Map;for(let K of g)for(let W of K.nodeIds)z.set(W,K.id);let b=wk($).map((K,W)=>({id:K.id,type:K.type,title:K.data.title??null,content:kK(K,{defaultTextLength:320,webpageTextLength:640})||null,clusterId:z.get(K.id)??null,readingOrder:W})),O=Qk($,U);return{totalNodes:$.length,clusters:g,nodesInReadingOrder:b,pinnedNeighborhoods:O,annotations:_.map((K)=>Mk(K,$))}}function Q4($){if(!$)return null;let v=$.data.title;return typeof v==="string"&&v.trim().length>0?v.trim():null}function D_($,v){return{id:$?.id??v,title:Q4($),nodeType:$?.type??"markdown"}}function HK($,v){return{id:$.id,edgeType:$.type,fromId:$.from,toId:$.to,fromTitle:Q4(v.get($.from)),toTitle:Q4(v.get($.to))}}function R_($){return new Map($.map((v)=>[v.id,v]))}function LK($){return new Map($.map((v)=>[v.id,v]))}function Vv($){return Array.from($).sort((v,U)=>v.localeCompare(U))}function M2($,v){if($.length!==v.length)return!1;for(let U=0;U<$.length;U++)if($[U]!==v[U])return!1;return!0}function S2($){if(!$||$.type!=="group")return[];let v=$.data.children;if(!Array.isArray(v))return[];return v.filter((U)=>typeof U==="string").sort((U,_)=>U.localeCompare(_))}function IK($){let v=new Map;for(let U of $.clusters){let _=[...U.nodeIds].sort((g,z)=>g.localeCompare(z));for(let g of _)v.set(g,_.filter((z)=>z!==g))}return v}function YK($){let v=new Map;for(let U of $.pinnedNeighborhoods)v.set(U.pinnedNodeId,U.neighbors.map((_)=>_.id).sort((_,g)=>_.localeCompare(g)));return v}function Nk($,v){let U=Vv(Array.from(v).filter((g)=>!$.has(g))),_=Vv(Array.from($).filter((g)=>!v.has(g)));return{added:U,removed:_}}function qK($){let v=$&&typeof $==="object"?$:{};return{timestamp:typeof v.timestamp==="string"?v.timestamp:void 0,sessionId:typeof v.sessionId==="string"?v.sessionId:void 0}}function rk($,v,U){if(!$||!U)return{layout:$,pinnedNodeIds:[],primaryFocusNodeIds:[],secondaryFocusNodeIds:[],regions:[],spatial:U};let _=R_($.nodes),g=Vv(v).filter((O)=>_.has(O)),z=new Set(g),J=new Set,b=[];for(let O of U.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&&g.length>0)for(let O of g)b.push({id:`region-${O}`,primaryNodeId:O,nodeIds:[O]});return{layout:$,pinnedNodeIds:g,primaryFocusNodeIds:g,secondaryFocusNodeIds:Vv(J),regions:b,spatial:U}}class T_{currentLayout=null;currentPins=new Set;previousSpatial=null;setInitialPins($){this.currentPins=new Set($)}getAttentionSnapshot(){return rk(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"?$:{},U=Array.isArray(v.nodeIds)?v.nodeIds.filter((K)=>typeof K==="string"):[],_=qK($),g=new Set(U),{added:z,removed:J}=Nk(this.currentPins,g);if(this.currentPins=g,!this.currentLayout)return[];let b=R_(this.currentLayout.nodes),O={added:z.map((K)=>D_(b.get(K),K)),removed:J.map((K)=>D_(b.get(K),K))};if(this.previousSpatial=yg(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"?$:{},U=v.layout&&typeof v.layout==="object"?v.layout:null;if(!U)return[];let _=qK($);if(!this.currentLayout)return this.currentLayout=U,this.previousSpatial=yg(U.nodes,U.edges,this.currentPins,U.annotations??[]),[];let g=this.currentLayout,z=this.previousSpatial??yg(g.nodes,g.edges,this.currentPins,g.annotations??[]),J=yg(U.nodes,U.edges,this.currentPins,U.annotations??[]),b=[],O=R_(g.nodes),K=R_(U.nodes),W=LK(g.edges),B=LK(U.edges),k=Vv(Array.from(B.keys()).filter((Y)=>!W.has(Y))).map((Y)=>B.get(Y)).filter((Y)=>Y!==void 0);if(k.length>0)b.push({type:"connect",..._,edges:k.map((Y)=>HK(Y,K))});let P=Vv(Array.from(O.keys()).filter((Y)=>!K.has(Y))),F=Vv(Array.from(W.keys()).filter((Y)=>!B.has(Y)));if(P.length>0||F.length>0)b.push({type:"remove",..._,nodes:P.map((Y)=>D_(O.get(Y),Y)),edges:F.map((Y)=>W.get(Y)).filter((Y)=>Y!==void 0).map((Y)=>HK(Y,O))});let I=this.buildGroupEvent(O,K,_);if(I)b.push(I);let H=this.buildMoveEndEvent(g,U,O,K,z,J,_);if(H)b.push(H);return this.currentLayout=U,this.previousSpatial=J,b}buildGroupEvent($,v,U){let _=Vv(Array.from($.values()).filter((b)=>b.type==="group").map((b)=>b.id)),g=Vv(Array.from(v.values()).filter((b)=>b.type==="group").map((b)=>b.id)),z=g.filter((b)=>!_.includes(b)).map((b)=>{let O=v.get(b),K=S2(O);return{id:b,title:Q4(O),childCount:K.length}}),J=[];for(let b of g.filter((O)=>_.includes(O))){let O=S2($.get(b)),K=S2(v.get(b));if(M2(O,K))continue;J.push({id:b,title:Q4(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",...U,created:z,updated:J}}buildMoveEndEvent($,v,U,_,g,z,J){let b=Vv(Array.from(_.keys()).filter((H)=>{let Y=U.get(H),q=_.get(H);if(!Y||!q)return!1;return Y.position.x!==q.position.x||Y.position.y!==q.position.y}));if(b.length===0)return null;let O=IK(g),K=IK(z),W=YK(g),B=YK(z),k=new Map,P=(H,Y)=>{let q=k.get(H)??new Set;q.add(Y),k.set(H,q)};for(let H of b){let Y=O.get(H)??[],q=K.get(H)??[];if(!M2(Y,q))if(Y.length===0&&q.length>0)P(H,"joined cluster");else if(Y.length>0&&q.length===0)P(H,"left cluster");else P(H,"cluster changed")}let F=new Set([...W.keys(),...B.keys()]);for(let H of F){let Y=W.get(H)??[],q=B.get(H)??[];if(M2(Y,q))continue;let w=Q4(_.get(H)??U.get(H))??H,N=q.filter((p)=>!Y.includes(p)),C=Y.filter((p)=>!q.includes(p));for(let p of N)if(b.includes(p))P(p,`entered pinned neighborhood of "${w}"`);for(let p of C)if(b.includes(p))P(p,`left pinned neighborhood of "${w}"`);if(b.includes(H))P(H,"pinned neighborhood changed")}let I=b.filter((H)=>(k.get(H)?.size??0)>0).map((H)=>{let Y=_.get(H);return{...D_(Y,H),reasons:Array.from(k.get(H)??[]).sort((q,w)=>q.localeCompare(w))}});if(I.length===0)return null;return{type:"move-end",...J,nodes:I}}}var u2=new T_,y2=[],Dg=null,N4=null,Q2="",N2=0;function XK($,v){return globalThis.setTimeout($,v)}function r2($){if($===null)return;globalThis.clearTimeout($)}function uk($){if(typeof globalThis.requestAnimationFrame==="function"){globalThis.requestAnimationFrame(()=>$());return}$()}function M6($,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 yk($){return Array.from(new Set(Array.from($).filter((v)=>v.length>0)))}function Cv($,v,U,_,g=Date.now()){return{id:`${$}-${g}-${Math.random().toString(36).slice(2,8)}`,tone:$,title:v,detail:U,nodeIds:yk(_),createdAt:g}}function FK($){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 U=/^left pinned neighborhood of "(.+)"$/.exec($);if(U)return`moved out of focus around ${U[1]}`;return $}function Dk($){let v=$.added.map((g)=>M6(g.title,g.id)),U=$.removed.map((g)=>M6(g.title,g.id));if(v.length===0&&U.length===0)return null;let _="";if(v.length>0&&U.length===0)_=`Now in focus: ${J6(v)}`;else if(U.length>0&&v.length===0)_=`Removed from focus: ${J6(U)}`;else{let g=[];if(v.length>0)g.push(`${J6(v)} added`);if(U.length>0)g.push(`${J6(U)} removed`);_=g.join(" · ")}return Cv("context","Context updated",_,[...$.added.map((g)=>g.id),...$.removed.map((g)=>g.id)],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function Rk($){if($.edges.length===0)return null;if($.edges.length===1){let v=$.edges[0];return Cv("relationship","Relationship added",`${M6(v.fromTitle,v.fromId)} linked to ${M6(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 Tk($){if($.nodes.length===0&&$.edges.length===0)return null;let v=$.nodes.map((_)=>M6(_.title,_.id)),U=[];if(v.length>0)U.push(J6(v));if($.edges.length>0)U.push(`${$.edges.length} relationship${$.edges.length===1?"":"s"}`);return Cv("remove","Items removed",U.join(" · "),[...$.nodes.map((_)=>_.id),...$.edges.flatMap((_)=>[_.fromId,_.toId])],$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}function jk($){if($.created.length>0){let v=$.created.map((U)=>M6(U.title,U.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((U)=>U.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}if($.updated.length>0){let v=$.updated.map((U)=>M6(U.title,U.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((U)=>U.id),$.timestamp?Date.parse($.timestamp)||Date.now():Date.now())}return null}function Vk($){if($.nodes.length===0)return null;let v=$.nodes.flatMap((z)=>z.reasons),U=$.nodes.map((z)=>M6(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",`${U[0]} ${FK($.nodes[0].reasons[0])}`,$.nodes.map((z)=>z.id),_);return Cv("neighborhood","Neighborhood changed",J6(U),$.nodes.map((z)=>z.id),_)}let g=v.filter((z)=>z.includes("cluster"));if(g.length>0){let z=g.every((J)=>J==="joined cluster");if($.nodes.length===1)return Cv("cluster",z?"Cluster formed":"Cluster changed",`${U[0]} ${FK($.nodes[0].reasons[0])}`,$.nodes.map((J)=>J.id),_);return Cv("cluster",z?"Cluster formed":"Cluster changed",J6(U),$.nodes.map((J)=>J.id),_)}return null}function Ck($){switch($.type){case"context-pin":return Dk($);case"connect":return Rk($);case"remove":return Tk($);case"group":return jk($);case"move-end":return Vk($)}}function fk(){let $=u2.getAttentionSnapshot();M3($.primaryFocusNodeIds,$.secondaryFocusNodeIds,$.regions)}function wK(){if(Dg!==null)return;let $=y2.shift()??null;if(!$){P_(null);return}P_($);let v=Math.max(1800,Math.min(2800,1600+$.detail.length*18));Dg=XK(()=>{Dg=null,P_(null),wK()},v)}function AK($){y2.push($),wK()}function r4($,v,U="",_=[]){AK(Cv($,v,U,_))}function ck($){if(r2(N4),N4=null,k_([]),$.length===0)return;uk(()=>{k_($),N4=XK(()=>{N4=null,k_([])},900)})}function mk($){let v=`${$.tone}:${$.title}:${$.detail}`,U=$.createdAt;if(v===Q2&&U-N2<1200)return!0;return Q2=v,N2=U,!1}function ZK(){r2(Dg),r2(N4),Dg=null,N4=null,y2=[],Q2="",N2=0,u2=new T_,Z3()}function D2($){let v=u2.handleMessage($).map((U)=>Ck(U)).filter((U)=>U!==null);fk();for(let U of v){if(mk(U))continue;S3(U),AK(U),ck(U.nodeIds)}}async function j_($,v,U,_){let g=await F_({type:v,sourceNodeId:$.id,sourceSurface:"native-node",...U?{payload:U}:{}});if(g.ok)r4("context",_,"",[$.id]);else r4("remove","AX action failed",g.error??g.code??"Unknown error",[$.id])}var MK={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 Ek($){let v=$.title||$.label||$.key||"Context",U=$.summary?.trim()||"Available in startup context.",_=$.pathDisplay||$.path||"",g=$.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:U,pathDisplay:_,category:g,sourceKind:z,status:J,required:$.required===!0}}function fv($){return typeof $==="string"?$.trim():""}function ik($){return $.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function lk($){let v=fv($.title),U=fv($.content),_=ik(fv($.rendered)),g=U||_,z=fv($.path);if(!v&&!g&&!z)return null;return{title:v||"Context",summary:g,path:z}}function hk($){let v=fv($.data.title)||$.id,U=fv($.data.content)||fv($.data.excerpt)||fv($.data.description)||fv($.data.pageTitle)||"",_=fv($.data.path)||fv($.data.url);return{id:$.id,title:v,summary:U,kind:s$[$.type]??$.type,path:_}}function SK($){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 xk($){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 a6({node:$,expanded:v=!1,pinnedNodes:U=[]}){let _=$.data.cards??[],g=$.data.auxTabs??[],z=U.map(hk),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=xk(K??0),P=!J&&_.length===0&&g.length===0?lk($.data):null,F=async(I)=>{let H=typeof I.path==="string"?I.path.trim():"";if(!H)return;await L_(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:MK,onClick:(I)=>{I.stopPropagation(),j_($,"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,"% — ",SK(b)," / ",SK(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((I)=>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:I.title},void 0,!1,void 0,this),I.summary&&G("div",{style:{color:"var(--c-muted)",fontSize:"10px",lineHeight:1.45,marginBottom:"4px",whiteSpace:"pre-wrap"},children:I.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:I.kind},void 0,!1,void 0,this)},void 0,!1,void 0,this),I.path&&G("div",{style:{marginTop:"6px"},children:[G("div",{style:{color:"var(--c-dim)",fontSize:"10px",wordBreak:"break-all",marginBottom:"6px"},children:I.path},void 0,!1,void 0,this),I.path.startsWith("/")&&G("button",{type:"button",onClick:()=>void L_(I.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)]},I.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((I)=>{let H=Ek(I);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),I.path&&G("div",{style:{marginTop:"6px"},children:G("button",{type:"button",onClick:()=>void F(I),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)]},I.key??H.pathDisplay??H.title,!0,void 0,this)})]},void 0,!0,void 0,this),!J&&g.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 (",g.length,")"]},void 0,!0,void 0,this),g.map((I)=>G("a",{href:I.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:[I.url,I.reason&&G("span",{style:{color:"var(--c-dim)",fontSize:"10px",marginLeft:"6px"},children:["(",I.reason,")"]},void 0,!0,void 0,this)]},I.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 L_(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&&g.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 pk($){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 V_({node:$,expanded:v=!1}){let U=$.data.path||$.data.content||"",_=$.data.title||U.split("/").pop()||"File",g=$.data.fileContent,z=$.data.updatedAt,J=$.data.lineCount,[b,O]=o(g??""),[K,W]=o(!g&&!!U),[B,k]=o(null);c(()=>{if(!U)return;if(g!==void 0){O(g),W(!1);return}let Y=!1;return W(!0),k(null),Ng(U).then(({content:q})=>{if(Y)return;if(!q&&q!==""){k("File not found"),W(!1);return}O(q),W(!1);let w=q.split(`
36
- `).length;v$($.id,{fileContent:q,lineCount:w}),Zv($.id,{data:{fileContent:q,lineCount:w}})}).catch(()=>{if(!Y)k("Failed to load file"),W(!1)}),()=>{Y=!0}},[U,g]),c(()=>{if(g!==void 0&&g!==b)O(g)},[g]);let P=S(()=>{if(!U)return;W(!0),k(null),v$($.id,{fileContent:void 0}),Zv($.id,{data:{fileContent:void 0}}),Ng(U).then(({content:Y})=>{O(Y),W(!1);let q=Y.split(`
37
- `).length,w=new Date().toISOString();v$($.id,{fileContent:Y,lineCount:q,updatedAt:w}),Zv($.id,{data:{fileContent:Y,lineCount:q,updatedAt:w}})}).catch(()=>{k("Failed to reload"),W(!1)})},[U,$.id]),F=pk(U),I=b.split(`
38
- `),H=`${String(I.length).length+1}ch`;if(!U)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:F},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:U,children:U},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:(Y)=>{Y.stopPropagation(),j_($,"ax.evidence.add",{kind:"file",title:U.split("/").pop()||U,ref:U},"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:I.map((Y,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:Y||`
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 ok=new Set(["title","__type","content","strictSize","arrangeLocked"]);function u4({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),g=Object.entries(v).filter(([z])=>!ok.has(z));if(_.length===0&&g.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),g.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 R2=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Sv=R2?"⌘":"Ctrl";function C_($,v){let{selectionStart:U,selectionEnd:_,value:g}=$,z=g.slice(U,_),J=g.slice(Math.max(0,U-v.length),U),b=g.slice(_,_+v.length);if(J===v&&b===v){let O=g.slice(0,U-v.length)+z+g.slice(_+v.length);hv($,O,U-v.length,_-v.length);return}if(z){let O=g.slice(0,U)+v+z+v+g.slice(_);hv($,O,U+v.length,_+v.length)}else{let O=g.slice(0,U)+v+v+g.slice(_);hv($,O,U+v.length,U+v.length)}}function Rg($,v){let{selectionStart:U,selectionEnd:_,value:g}=$,z=g.lastIndexOf(`
40
- `,U-1)+1,J=g.indexOf(`
41
- `,_),b=J===-1?g.length:J,O=g.slice(z,b);if(O.startsWith(v)){let W=g.slice(0,z)+O.slice(v.length)+g.slice(b);hv($,W,Math.max(z,U-v.length),Math.max(z,_-v.length));return}let K=g.slice(0,z)+v+g.slice(z);hv($,K,U+v.length,_+v.length)}function nk($){let{selectionStart:v,selectionEnd:U,value:_}=$,g=_.slice(v,U);if(g){let z=_.slice(0,v)+`[${g}](url)`+_.slice(U),J=v+g.length+3;hv($,z,J,J+3)}else{let z=_.slice(0,v)+"[text](url)"+_.slice(U);hv($,z,v+1,v+5)}}function tk($){let{selectionStart:v,selectionEnd:U,value:_}=$,g=_.slice(v,U),z="```";if(g){let J=_.slice(0,v)+`\`\`\`
42
- ${g}
43
- \`\`\``+_.slice(U);hv($,J,v+3+1,v+3+1+g.length)}else{let J=_.slice(0,v)+"```\n\n```"+_.slice(U);hv($,J,v+3+1,v+3+1)}}function QK($,v){let{selectionStart:U,selectionEnd:_,value:g}=$,z=g.lastIndexOf(`
44
- `,U-1)+1,J=g.indexOf(`
45
- `,_),b=J===-1?g.length:J,O=g.slice(z,b).split(`
46
- `),K=U,W=_,B=O.map((P,F)=>{if(v){if(P.startsWith(" ")){if(F===0)K=Math.max(z,K-2);return W-=2,P.slice(2)}else if(P.startsWith("\t")){if(F===0)K=Math.max(z,K-1);return W-=1,P.slice(1)}return P}else{if(F===0)K+=2;return W+=2," "+P}}),k=g.slice(0,z)+B.join(`
47
- `)+g.slice(b);hv($,k,K,W)}function hv($,v,U,_){let g=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;if(g)g.call($,v);else $.value=v;$.selectionStart=U,$.selectionEnd=_,$.dispatchEvent(new Event("input",{bubbles:!0}))}var f_=[{key:"bold",label:"Bold",icon:"B",shortcut:"b",action:($)=>C_($,"**")},{key:"italic",label:"Italic",icon:"I",shortcut:"i",action:($)=>C_($,"_")},{key:"strike",label:"Strikethrough",icon:"S",shortcut:"u",action:($)=>C_($,"~~")},{key:"code",label:"Inline code",icon:"`",shortcut:"e",action:($)=>C_($,"`")},{key:"link",label:"Link",icon:"\uD83D\uDD17",shortcut:"k",action:nk},{key:"h1",label:"Heading 1",icon:"H1",action:($)=>Rg($,"# ")},{key:"h2",label:"Heading 2",icon:"H2",action:($)=>Rg($,"## ")},{key:"quote",label:"Blockquote",icon:"❝",action:($)=>Rg($,"> ")},{key:"ul",label:"Bullet list",icon:"•",action:($)=>Rg($,"- ")},{key:"ol",label:"Numbered list",icon:"1.",action:($)=>Rg($,"1. ")},{key:"codeblock",label:"Code block",icon:"{ }",action:tk}];function NK($,v){if(!($.metaKey||$.ctrlKey))return!1;let U=f_.find((_)=>_.shortcut===$.key);if(!U)return!1;return $.preventDefault(),U.action(v),!0}function rK($){if($.selectionStart===$.selectionEnd)return null;let v=document.createElement("div"),U=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]=U[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 g=$.value,z=document.createTextNode(g.slice(0,$.selectionStart)),J=document.createElement("span");J.textContent=g.slice($.selectionStart,$.selectionEnd)||".",v.appendChild(z),v.appendChild(J),v.appendChild(document.createTextNode(g.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 dk=f_.filter(($)=>$.shortcut),ak=f_.filter(($)=>!$.shortcut);function T2({textareaRef:$}){let[v,U]=o(!1),[_,g]=o({top:0,left:0}),z=y(null),J=y(null),b=S(()=>{let W=$.current;if(!W||W.selectionStart===W.selectionEnd){U(!1);return}let B=rK(W);if(!B){U(!1);return}let k=380,P=Math.max(8,Math.min(B.left+B.width/2-k/2,window.innerWidth-k-8));g({top:B.top-40,left:P}),U(!0)},[$]);c(()=>{let W=$.current;if(!W)return;let B=()=>{if(J.current)clearTimeout(J.current);J.current=setTimeout(b,50)},k=()=>{J.current=setTimeout(()=>U(!1),200)},P=(F)=>{if(F.shiftKey||F.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=S((W)=>{let B=$.current;if(B)W.action(B),B.focus()},[$]);if(!v)return null;let K=R2?"⌘":"Ctrl";return G("div",{ref:z,class:"md-format-bar",style:{top:`${_.top}px`,left:`${_.left}px`},onMouseDown:(W)=>W.preventDefault(),children:[dk.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),ak.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 b5=SP(xK(),1);function PH($){for(var v=1;v<arguments.length;v++){var U=arguments[v];for(var _ in U)if(Object.prototype.hasOwnProperty.call(U,_))$[_]=U[_]}return $}function E2($,v){return Array(v+1).join($)}function nK($){return $.replace(/^\n*/,"")}function tK($){var v=$.length;while(v>0&&$[v-1]===`
48
- `)v--;return $.substring(0,v)}function dK($){return tK(nK($))}var kH=["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 i2($){return l2($,kH)}var aK=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function sK($){return l2($,aK)}function HH($){return $5($,aK)}var eK=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function LH($){return l2($,eK)}function IH($){return $5($,eK)}function l2($,v){return v.indexOf($.nodeName)>=0}function $5($,v){return $.getElementsByTagName&&v.some(function(U){return $.getElementsByTagName(U).length})}var YH=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function v5($){return YH.reduce(function(v,U){return v.replace(U[0],U[1])},$)}var Gv={};Gv.paragraph={filter:"p",replacement:function($){return`
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
+
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
+
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
+ `,g-1)+1,J=U.indexOf(`
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
+ ${U}
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
+ `,g-1)+1,J=U.indexOf(`
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,U){return U.br+`
53
- `}};Gv.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function($,v,U){var _=Number(v.nodeName.charAt(1));if(U.headingStyle==="setext"&&_<3){var g=E2(_===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
- `+g+`
56
+ `+U+`
57
57
 
58
58
  `}else return`
59
59
 
60
- `+E2("#",_)+" "+$+`
60
+ `+gz("#",_)+" "+$+`
61
61
 
62
- `}};Gv.blockquote={filter:"blockquote",replacement:function($){return $=dK($).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 U=v.parentNode;if(U.nodeName==="LI"&&U.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,U){var _=U.bulletListMarker+" ",g=v.parentNode;if(g.nodeName==="OL"){var z=g.getAttribute("start"),J=Array.prototype.indexOf.call(g.children,v);_=(z?Number(z)+J:J+1)+". "}var b=/\n$/.test($);return $=dK($)+(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,U){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,U){var _=v.firstChild.getAttribute("class")||"",g=(_.match(/language-(\S+)/)||[null,""])[1],z=v.firstChild.textContent,J=U.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=E2(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
- `+W+g+`
81
+ `+W+U+`
82
82
  `+z.replace(/\n$/,"")+`
83
83
  `+W+`
84
84
 
85
- `}};Gv.horizontalRule={filter:"hr",replacement:function($,v,U){return`
85
+ `}};Kv.horizontalRule={filter:"hr",replacement:function($,v,g){return`
86
86
 
87
- `+U.hr+`
87
+ `+g.hr+`
88
88
 
89
- `}};Gv.inlineLink={filter:function($,v){return v.linkStyle==="inlined"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v){var U=h2(v.getAttribute("href")),_=x2(c_(v.getAttribute("title"))),g=_?' "'+_+'"':"";return"["+$+"]("+U+g+")"}};Gv.referenceLink={filter:function($,v){return v.linkStyle==="referenced"&&$.nodeName==="A"&&$.getAttribute("href")},replacement:function($,v,U){var _=h2(v.getAttribute("href")),g=c_(v.getAttribute("title"));if(g)g=' "'+x2(g)+'"';var z,J;switch(U.linkReferenceStyle){case"collapsed":z="["+$+"][]",J="["+$+"]: "+_+g;break;case"shortcut":z="["+$+"]",J="["+$+"]: "+_+g;break;default:var b=this.references.length+1;z="["+$+"]["+b+"]",J="["+b+"]: "+_+g}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,U){if(!$.trim())return"";return U.emDelimiter+$+U.emDelimiter}};Gv.strong={filter:["strong","b"],replacement:function($,v,U){if(!$.trim())return"";return U.strongDelimiter+$+U.strongDelimiter}};Gv.code={filter:function($){var v=$.previousSibling||$.nextSibling,U=$.parentNode.nodeName==="PRE"&&!v;return $.nodeName==="CODE"&&!U},replacement:function($){if(!$)return"";$=$.replace(/\r?\n|\r/g," ");var v=/^`|^ .*?[^ ].* $|`$/.test($)?" ":"",U="`",_=$.match(/`+/gm)||[];while(_.indexOf(U)!==-1)U=U+"`";return U+v+$+v+U}};Gv.image={filter:"img",replacement:function($,v){var U=v5(c_(v.getAttribute("alt"))),_=h2(v.getAttribute("src")||""),g=c_(v.getAttribute("title")),z=g?' "'+x2(g)+'"':"";return _?"!["+U+"]("+_+z+")":""}};function c_($){return $?$.replace(/(\n+\s*)+/g,`
95
- `):""}function h2($){var v=$.replace(/([<>()])/g,"\\$1");return v.indexOf(" ")>=0?"<"+v+">":v}function x2($){return $.replace(/"/g,"\\\"")}function g5($){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])}g5.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=f2(this.array,$,this.options))return v;if(v=f2(this._keep,$,this.options))return v;if(v=f2(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 f2($,v,U){for(var _=0;_<$.length;_++){var g=$[_];if(qH(g,v,U))return g}return}function qH($,v,U){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,U))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function FH($){var{element:v,isBlock:U,isVoid:_}=$,g=$.isPre||function(B){return B.nodeName==="PRE"};if(!v.firstChild||g(v))return;var z=null,J=!1,b=null,O=pK(b,v,g);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=c2(O);continue}O.data=K,z=O}else if(O.nodeType===1){if(U(O)||O.nodeName==="BR"){if(z)z.data=z.data.replace(/ $/,"");z=null,J=!1}else if(_(O)||g(O))z=null,J=!0;else if(z)J=!1}else{O=c2(O);continue}var W=pK(b,O,g);b=O,O=W}if(z){if(z.data=z.data.replace(/ $/,""),!z.data)c2(z)}}function c2($){var v=$.nextSibling||$.parentNode;return $.parentNode.removeChild($),v}function pK($,v,U){if($&&$.parentNode===v||U(v))return v.nextSibling||v.parentNode;return v.firstChild||v.nextSibling||v.parentNode}var p2=typeof window<"u"?window:{};function XH(){var $=p2.DOMParser,v=!1;try{if(new $().parseFromString("","text/html"))v=!0}catch(U){}return v}function wH(){var $=function(){};if(AH())$.prototype.parseFromString=function(v){var U=new window.ActiveXObject("htmlfile");return U.designMode="on",U.open(),U.write(v),U.close(),U};else $.prototype.parseFromString=function(v){var U=document.implementation.createHTMLDocument("");return U.open(),U.write(v),U.close(),U};return $}function AH(){var $=!1;try{document.implementation.createHTMLDocument("").open()}catch(v){if(p2.ActiveXObject)$=!0}return $}var ZH=XH()?p2.DOMParser:wH();function MH($,v){var U;if(typeof $==="string"){var _=SH().parseFromString('<x-turndown id="turndown-root">'+$+"</x-turndown>","text/html");U=_.getElementById("turndown-root")}else U=$.cloneNode(!0);return FH({element:U,isBlock:i2,isVoid:sK,isPre:v.preformattedCode?QH:null}),U}var m2;function SH(){return m2=m2||new ZH,m2}function QH($){return $.nodeName==="PRE"||$.nodeName==="CODE"}function NH($,v){return $.isBlock=i2($),$.isCode=$.nodeName==="CODE"||$.parentNode.isCode,$.isBlank=rH($),$.flankingWhitespace=uH($,v),$}function rH($){return!sK($)&&!LH($)&&/^\s*$/i.test($.textContent)&&!HH($)&&!IH($)}function uH($,v){if($.isBlock||v.preformattedCode&&$.isCode)return{leading:"",trailing:""};var U=yH($.textContent);if(U.leadingAscii&&oK("left",$,v))U.leading=U.leadingNonAscii;if(U.trailingAscii&&oK("right",$,v))U.trailing=U.trailingNonAscii;return{leading:U.leading,trailing:U.trailing}}function yH($){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 oK($,v,U){var _,g,z;if($==="left")_=v.previousSibling,g=/ $/;else _=v.nextSibling,g=/^ /;if(_){if(_.nodeType===3)z=g.test(_.nodeValue);else if(U.preformattedCode&&_.nodeName==="CODE")z=!1;else if(_.nodeType===1&&!i2(_))z=g.test(_.textContent)}return z}var DH=Array.prototype.reduce;function Tg($){if(!(this instanceof Tg))return new Tg($);var v={rules:Gv,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(U,_){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
- `:""},keepReplacement:function(U,_){return _.isBlock?`
97
+ `:""},keepReplacement:function(g,_){return _.isBlock?`
98
98
 
99
99
  `+_.outerHTML+`
100
100
 
101
- `:_.outerHTML},defaultReplacement:function(U,_){return _.isBlock?`
101
+ `:_.outerHTML},defaultReplacement:function(g,_){return _.isBlock?`
102
102
 
103
- `+U+`
103
+ `+g+`
104
104
 
105
- `:U}};this.options=PH({},v,$),this.rules=new g5(this.options)}Tg.prototype={turndown:function($){if(!jH($))throw TypeError($+" is not a string, or an element/document/fragment node.");if($==="")return"";var v=U5.call(this,new MH($,this.options));return RH.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 v5($)}};function U5($){var v=this;return DH.call($.childNodes,function(U,_){_=new NH(_,v.options);var g="";if(_.nodeType===3)g=_.isCode?_.nodeValue:v.escape(_.nodeValue);else if(_.nodeType===1)g=TH.call(v,_);return _5(U,g)},"")}function RH($){var v=this;return this.rules.forEach(function(U){if(typeof U.append==="function")$=_5($,U.append(v.options))}),$.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function TH($){var v=this.rules.forNode($),U=U5.call(this,$),_=$.flankingWhitespace;if(_.leading||_.trailing)U=U.trim();return _.leading+v.replacement(U,$,this.options)+_.trailing}function _5($,v){var U=tK($),_=nK(v),g=Math.max($.length-U.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,g);return U+z+_}function jH($){return $!=null&&(typeof $==="string"||$.nodeType&&($.nodeType===1||$.nodeType===9||$.nodeType===11))}function m_(){let $=window.prompt("Link URL:");if(!$)return;let v=$.trim().toLowerCase();if(v.startsWith("javascript:")||v.startsWith("data:"))return;document.execCommand("createLink",!1,$)}function z5(){let $=window.getSelection();if(!$||$.rangeCount===0)return;let v=$.getRangeAt(0);if(v.collapsed)return;let U=v.toString(),_=document.createElement("code");_.textContent=U,v.deleteContents(),v.insertNode(_);let g=document.createRange();g.setStartAfter(_),g.setEndAfter(_),$.removeAllRanges(),$.addRange(g)}var E_=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 CH($){switch($.kind){case"exec":document.execCommand($.command);return;case"block":document.execCommand("formatBlock",!1,$.tag);return;case"code":z5();return;case"link":m_();return}}function J5({hostRef:$,onChange:v}){let[U,_]=o(!1),[g,z]=o({top:0,left:0}),[J,b]=o(0),O=y(null),K=y(null),W=S(()=>{let P=$.current;if(!P){_(!1);return}let F=window.getSelection();if(!F||F.rangeCount===0||F.isCollapsed){_(!1);return}let I=F.getRangeAt(0);if(!P.contains(I.commonAncestorContainer)){_(!1);return}let H=I.getBoundingClientRect();if(H.width===0&&H.height===0){_(!1);return}let Y=J||420,q=Math.max(E_,Math.min(H.left+H.width/2-Y/2,window.innerWidth-Y-E_)),w=Math.max(E_,H.top-E_-36);z({top:w,left:q}),_(!0)},[$,J]),B=S(()=>{if(K.current!==null)return;K.current=requestAnimationFrame(()=>{K.current=null,W()})},[W]);c(()=>{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]),v_(()=>{if(!U)return;let P=O.current;if(!P)return;let F=P.getBoundingClientRect().width;if(F&&Math.abs(F-J)>1)b(F)},[U,J]);let k=S((P)=>{CH(P),v(),W()},[v,W]);if(!U)return null;return G("div",{ref:O,class:"md-inline-format-bar",style:{top:`${g.top}px`,left:`${g.left}px`},onMouseDown:(P)=>P.preventDefault(),children:VH.flatMap((P,F)=>{let I=G("button",{type:"button",class:"md-inline-format-btn",title:P.title,onClick:()=>k(P),children:P.icon},`btn-${F}`,!1,void 0,this);return P.dividerBefore?[G("span",{class:"md-inline-format-divider"},`div-${F}`,!1,void 0,this),I]:[I]})},void 0,!1,void 0,this)}var o2=null;function fH(){if(o2)return o2;let $=new Tg({headingStyle:"atx",codeBlockStyle:"fenced",emDelimiter:"*",bulletListMarker:"-"});return $.use(b5.gfm),o2=$,$}function G5({initialHtml:$,className:v,onChange:U,onSave:_}){let g=y(null),z=y($);c(()=>{let B=g.current;if(!B)return;B.innerHTML=z.current},[]);let J=S(()=>{let B=g.current;if(!B)return"";return fH().turndown(B.innerHTML)},[]),b=S(()=>{U(J())},[U,J]),O=S(()=>{_?.(J())},[_,J]),K=S((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(),m_(),b()},[b,O]),W=S((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:g,class:v,contentEditable:!0,spellcheck:!1,onInput:b,onKeyDown:K,onPaste:W,onBlur:O},void 0,!1,void 0,this),G(J5,{hostRef:g,onChange:b},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function n2({html:$,className:v,style:U}){let _=y(null);return c(()=>{let g=_.current;if(!g)return;if(g.replaceChildren(),!$)return;let z=document.createElement("template");z.innerHTML=$,g.append(z.content.cloneNode(!0))},[$]),G("div",{ref:_,class:v,style:U},void 0,!1,void 0,this)}function i_({node:$,expanded:v=!1}){let U=$.data.path,[_,g]=o(""),[z,J]=o(""),[b,O]=o(!1),[K,W]=o(!1),[B,k]=o(!1),[P,F]=o(!1),I=y(null),H=y(null),Y=y(""),q=y(null),w=$.data.reviewActive;c(()=>{let Q=!1;return(async()=>{let g$;if(U){let i=await Ng(U);if(Q)return;g$=i.content}else if($.data.content)g$=$.data.content;else{O(!0);return}g(g$);let m=await U6(g$);if(Q)return;J(m),O(!0),v$($.id,{content:g$,rendered:m})})(),()=>{Q=!0}},[U,$.id,$.data.content]);let N=S(async(Q)=>{let g$=Q.target.value;g(g$),F(!0);let m=await U6(g$);J(m)},[]),C=S(async(Q)=>{if(!U){let m=await U6(Q);J(m),F(!1),v$($.id,{content:Q,rendered:m}),await Zv($.id,{content:Q,data:{rendered:m}});return}k(!0);let g$=await y3(U,Q);if(k(!1),g$.ok){let m=await U6(Q);J(m),F(!1),v$($.id,{content:Q,rendered:m,savedAt:g$.updatedAt}),await Zv($.id,{content:Q,data:{rendered:m,savedAt:g$.updatedAt}})}},[U,$.id]),p=S(async()=>{if(!P)return;await C(_)},[P,_,C]),r=S((Q)=>{if((Q.metaKey||Q.ctrlKey)&&Q.key==="s"){Q.preventDefault(),p();return}let g$=I.current;if(g$&&NK(Q,g$))return;if(g$&&Q.key==="Tab")Q.preventDefault(),QK(g$,Q.shiftKey)},[p]);q.current=C;let n=S((Q)=>{if(g(Q),F(!0),Y.current=Q,H.current!==null)window.clearTimeout(H.current);H.current=window.setTimeout(()=>{H.current=null,C(Q)},800)},[C]),e=S((Q)=>{if(g(Q),Y.current=Q,H.current!==null)window.clearTimeout(H.current),H.current=null;C(Q)},[C]);c(()=>{return()=>{if(H.current===null)return;window.clearTimeout(H.current),H.current=null;let Q=q.current;if(Q)Q(Y.current)}},[$.id]);let u=w?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:[U&&G("span",{class:"md-toolbar-path",children:U.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:I,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),G(T2,{textareaRef:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(n2,{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:I,value:_,onInput:N,spellcheck:!1},void 0,!1,void 0,this),G(T2,{textareaRef:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(n2,{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(G5,{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(n2,{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:(Q)=>{Q.target.style.opacity="1"},onMouseLeave:(Q)=>{Q.target.style.opacity="0.7"},children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var l_="pmx-canvas-ax",h_="pmx-canvas-ax-ack",xv="pmx-canvas-html-node",t2="pmx-canvas-ext-app-alive";var O5=37;function cH($){return $.type==="html"||$.type==="json-render"||$.type==="graph"||$.type==="mcp-app"||$.type==="webpage"}function mH($){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 K5($){return $.collapsed===!0||$.dockPosition!=null||$.data.strictSize===!0||$.data.userResized===!0||$.type==="group"}function d2($){return!K5($)&&!cH($)}function W5($,v){if(!d2($)||v<=0)return null;return Math.min(v+37,600)}function a2($){return mH($)&&!K5($)}function B5($,v){if(!a2($)||v<=0)return null;let U=Math.min(v+37+24,1400);return U>$.size.height+8?U:null}var L={};ev(L,{xor:()=>x7,xid:()=>L7,void:()=>E7,uuidv7:()=>G7,uuidv6:()=>b7,uuidv4:()=>J7,uuid:()=>z7,util:()=>j,url:()=>O7,uppercase:()=>l4,unknown:()=>S$,union:()=>A$,undefined:()=>c7,ulid:()=>H7,uint64:()=>C7,uint32:()=>T7,tuple:()=>GG,trim:()=>t4,treeifyError:()=>Oz,transform:()=>H0,toUpperCase:()=>a4,toLowerCase:()=>d4,toJSONSchema:()=>l1,templateLiteral:()=>gW,symbol:()=>f7,superRefine:()=>TG,success:()=>e7,stringbool:()=>OW,stringFormat:()=>Q7,string:()=>Z,strictObject:()=>h7,startsWith:()=>x4,slugify:()=>s4,size:()=>g4,setErrorMap:()=>OY,set:()=>t7,safeParseAsync:()=>m9,safeParse:()=>c9,safeEncodeAsync:()=>o9,safeEncode:()=>x9,safeDecodeAsync:()=>n9,safeDecode:()=>p9,registry:()=>k1,regexes:()=>Dv,regex:()=>E4,refine:()=>RG,record:()=>N$,readonly:()=>QG,property:()=>c1,promise:()=>UW,prettifyError:()=>Kz,preprocess:()=>YU,prefault:()=>FG,positive:()=>j1,pipe:()=>KU,partialRecord:()=>p7,parseAsync:()=>f9,parse:()=>C9,overwrite:()=>cv,optional:()=>y$,object:()=>h,number:()=>I$,nullish:()=>s7,nullable:()=>OU,null:()=>bg,normalize:()=>n4,nonpositive:()=>C1,nonoptional:()=>XG,nonnegative:()=>f1,never:()=>k0,negative:()=>V1,nativeEnum:()=>d7,nanoid:()=>B7,nan:()=>$W,multipleOf:()=>y6,minSize:()=>tv,minLength:()=>G6,mime:()=>o4,meta:()=>bW,maxSize:()=>D6,maxLength:()=>U4,map:()=>n7,mac:()=>q7,lte:()=>Nv,lt:()=>ov,lowercase:()=>i4,looseRecord:()=>o7,looseObject:()=>$v,locales:()=>_U,literal:()=>t,length:()=>_4,lazy:()=>uG,ksuid:()=>I7,keyof:()=>l7,jwt:()=>S7,json:()=>KW,iso:()=>V6,ipv6:()=>F7,ipv4:()=>Y7,intersection:()=>Gg,int64:()=>V7,int32:()=>R7,int:()=>t1,instanceof:()=>GW,includes:()=>h4,httpUrl:()=>K7,hostname:()=>N7,hex:()=>r7,hash:()=>u7,guid:()=>_7,gte:()=>Hv,gt:()=>nv,globalRegistry:()=>e$,getErrorMap:()=>KY,function:()=>_W,fromJSONSchema:()=>BW,formatError:()=>hg,float64:()=>D7,float32:()=>y7,flattenError:()=>lg,file:()=>a7,exactOptional:()=>HG,enum:()=>vv,endsWith:()=>p4,encodeAsync:()=>l9,encode:()=>E9,emoji:()=>W7,email:()=>U7,e164:()=>M7,discriminatedUnion:()=>HU,describe:()=>JW,decodeAsync:()=>h9,decode:()=>i9,date:()=>i7,custom:()=>F0,cuid2:()=>k7,cuid:()=>P7,core:()=>O6,config:()=>l$,coerce:()=>VG,codec:()=>vW,clone:()=>kv,cidrv6:()=>w7,cidrv4:()=>X7,check:()=>zW,catch:()=>ZG,boolean:()=>h$,bigint:()=>j7,base64url:()=>Z7,base64:()=>A7,array:()=>J$,any:()=>m7,_function:()=>_W,_default:()=>YG,_ZodString:()=>d1,ZodXor:()=>_G,ZodXID:()=>U0,ZodVoid:()=>gG,ZodUnknown:()=>$G,ZodUnion:()=>kU,ZodUndefined:()=>a9,ZodUUID:()=>dv,ZodURL:()=>WU,ZodULID:()=>g0,ZodType:()=>_$,ZodTuple:()=>bG,ZodTransform:()=>PG,ZodTemplateLiteral:()=>NG,ZodSymbol:()=>d9,ZodSuccess:()=>wG,ZodStringFormat:()=>M$,ZodString:()=>gg,ZodSet:()=>KG,ZodRecord:()=>LU,ZodRealError:()=>wv,ZodReadonly:()=>SG,ZodPromise:()=>yG,ZodPrefault:()=>qG,ZodPipe:()=>Y0,ZodOptional:()=>L0,ZodObject:()=>PU,ZodNumberFormat:()=>z4,ZodNumber:()=>_g,ZodNullable:()=>LG,ZodNull:()=>s9,ZodNonOptional:()=>I0,ZodNever:()=>vG,ZodNanoID:()=>e1,ZodNaN:()=>MG,ZodMap:()=>OG,ZodMAC:()=>t9,ZodLiteral:()=>WG,ZodLazy:()=>rG,ZodKSUID:()=>_0,ZodJWT:()=>B0,ZodIssueCode:()=>GY,ZodIntersection:()=>JG,ZodISOTime:()=>o1,ZodISODuration:()=>n1,ZodISODateTime:()=>x1,ZodISODate:()=>p1,ZodIPv6:()=>J0,ZodIPv4:()=>z0,ZodGUID:()=>GU,ZodFunction:()=>DG,ZodFirstPartyTypeKind:()=>jG,ZodFile:()=>BG,ZodExactOptional:()=>kG,ZodError:()=>JY,ZodEnum:()=>vg,ZodEmoji:()=>s1,ZodEmail:()=>a1,ZodE164:()=>W0,ZodDiscriminatedUnion:()=>zG,ZodDefault:()=>IG,ZodDate:()=>BU,ZodCustomStringFormat:()=>Ug,ZodCustom:()=>IU,ZodCodec:()=>q0,ZodCatch:()=>AG,ZodCUID2:()=>v0,ZodCUID:()=>$0,ZodCIDRv6:()=>G0,ZodCIDRv4:()=>b0,ZodBoolean:()=>zg,ZodBigIntFormat:()=>P0,ZodBigInt:()=>Jg,ZodBase64URL:()=>K0,ZodBase64:()=>O0,ZodArray:()=>UG,ZodAny:()=>e9,TimePrecision:()=>B8,NEVER:()=>s2,$output:()=>J8,$input:()=>b8,$brand:()=>e2});var O6={};ev(O6,{version:()=>UJ,util:()=>j,treeifyError:()=>Oz,toJSONSchema:()=>l1,toDotPath:()=>Y5,safeParseAsync:()=>og,safeParse:()=>C4,safeEncodeAsync:()=>M5,safeEncode:()=>A5,safeDecodeAsync:()=>S5,safeDecode:()=>Z5,registry:()=>k1,regexes:()=>Dv,process:()=>X$,prettifyError:()=>Kz,parseAsync:()=>pg,parse:()=>xg,meta:()=>p8,locales:()=>_U,isValidJWT:()=>x5,isValidBase64URL:()=>h5,isValidBase64:()=>MJ,initializeContext:()=>R6,globalRegistry:()=>e$,globalConfig:()=>jg,formatError:()=>hg,flattenError:()=>lg,finalize:()=>j6,extractDefs:()=>T6,encodeAsync:()=>X5,encode:()=>q5,describe:()=>x8,decodeAsync:()=>w5,decode:()=>F5,createToJSONSchemaMethod:()=>n8,createStandardJSONSchemaMethod:()=>$g,config:()=>l$,clone:()=>kv,_xor:()=>VI,_xid:()=>M1,_void:()=>V8,_uuidv7:()=>q1,_uuidv6:()=>Y1,_uuidv4:()=>I1,_uuid:()=>L1,_url:()=>JU,_uppercase:()=>l4,_unknown:()=>T8,_union:()=>jI,_undefined:()=>y8,_ulid:()=>Z1,_uint64:()=>r8,_uint32:()=>A8,_tuple:()=>cI,_trim:()=>t4,_transform:()=>pI,_toUpperCase:()=>a4,_toLowerCase:()=>d4,_templateLiteral:()=>vY,_symbol:()=>u8,_superRefine:()=>h8,_success:()=>aI,_stringbool:()=>o8,_stringFormat:()=>e4,_string:()=>O8,_startsWith:()=>x4,_slugify:()=>s4,_size:()=>g4,_set:()=>iI,_safeParseAsync:()=>f4,_safeParse:()=>V4,_safeEncodeAsync:()=>e_,_safeEncode:()=>a_,_safeDecodeAsync:()=>$1,_safeDecode:()=>s_,_regex:()=>E4,_refine:()=>l8,_record:()=>mI,_readonly:()=>$Y,_property:()=>c1,_promise:()=>UY,_positive:()=>j1,_pipe:()=>eI,_parseAsync:()=>j4,_parse:()=>T4,_overwrite:()=>cv,_optional:()=>oI,_number:()=>I8,_nullable:()=>nI,_null:()=>D8,_normalize:()=>n4,_nonpositive:()=>C1,_nonoptional:()=>dI,_nonnegative:()=>f1,_never:()=>j8,_negative:()=>V1,_nativeEnum:()=>hI,_nanoid:()=>X1,_nan:()=>c8,_multipleOf:()=>y6,_minSize:()=>tv,_minLength:()=>G6,_min:()=>Hv,_mime:()=>o4,_maxSize:()=>D6,_maxLength:()=>U4,_max:()=>Nv,_map:()=>EI,_mac:()=>W8,_lte:()=>Nv,_lt:()=>ov,_lowercase:()=>i4,_literal:()=>xI,_length:()=>_4,_lazy:()=>gY,_ksuid:()=>S1,_jwt:()=>T1,_isoTime:()=>H8,_isoDuration:()=>L8,_isoDateTime:()=>P8,_isoDate:()=>k8,_ipv6:()=>N1,_ipv4:()=>Q1,_intersection:()=>fI,_int64:()=>N8,_int32:()=>w8,_int:()=>q8,_includes:()=>h4,_guid:()=>zU,_gte:()=>Hv,_gt:()=>nv,_float64:()=>X8,_float32:()=>F8,_file:()=>E8,_enum:()=>lI,_endsWith:()=>p4,_encodeAsync:()=>t_,_encode:()=>o_,_emoji:()=>F1,_email:()=>H1,_e164:()=>R1,_discriminatedUnion:()=>CI,_default:()=>tI,_decodeAsync:()=>d_,_decode:()=>n_,_date:()=>C8,_custom:()=>i8,_cuid2:()=>A1,_cuid:()=>w1,_coercedString:()=>K8,_coercedNumber:()=>Y8,_coercedDate:()=>f8,_coercedBoolean:()=>M8,_coercedBigint:()=>Q8,_cidrv6:()=>u1,_cidrv4:()=>r1,_check:()=>$7,_catch:()=>sI,_boolean:()=>Z8,_bigint:()=>S8,_base64url:()=>D1,_base64:()=>y1,_array:()=>m8,_any:()=>R8,TimePrecision:()=>B8,NEVER:()=>s2,JSONSchemaGenerator:()=>D9,JSONSchema:()=>v7,Doc:()=>_1,$output:()=>J8,$input:()=>b8,$constructor:()=>X,$brand:()=>e2,$ZodXor:()=>lJ,$ZodXID:()=>kJ,$ZodVoid:()=>cJ,$ZodUnknown:()=>CJ,$ZodUnion:()=>sg,$ZodUndefined:()=>TJ,$ZodUUID:()=>JJ,$ZodURL:()=>GJ,$ZodULID:()=>PJ,$ZodType:()=>$$,$ZodTuple:()=>B1,$ZodTransform:()=>sJ,$ZodTemplateLiteral:()=>Ob,$ZodSymbol:()=>RJ,$ZodSuccess:()=>_b,$ZodStringFormat:()=>Z$,$ZodString:()=>v4,$ZodSet:()=>nJ,$ZodRegistry:()=>G8,$ZodRecord:()=>pJ,$ZodRealError:()=>Xv,$ZodReadonly:()=>Gb,$ZodPromise:()=>Wb,$ZodPrefault:()=>gb,$ZodPipe:()=>bb,$ZodOptional:()=>P1,$ZodObjectJIT:()=>iJ,$ZodObject:()=>n5,$ZodNumberFormat:()=>yJ,$ZodNumber:()=>K1,$ZodNullable:()=>$b,$ZodNull:()=>jJ,$ZodNonOptional:()=>Ub,$ZodNever:()=>fJ,$ZodNanoID:()=>KJ,$ZodNaN:()=>Jb,$ZodMap:()=>oJ,$ZodMAC:()=>wJ,$ZodLiteral:()=>dJ,$ZodLazy:()=>Bb,$ZodKSUID:()=>HJ,$ZodJWT:()=>rJ,$ZodIntersection:()=>xJ,$ZodISOTime:()=>YJ,$ZodISODuration:()=>qJ,$ZodISODateTime:()=>LJ,$ZodISODate:()=>IJ,$ZodIPv6:()=>XJ,$ZodIPv4:()=>FJ,$ZodGUID:()=>zJ,$ZodFunction:()=>Kb,$ZodFile:()=>aJ,$ZodExactOptional:()=>eJ,$ZodError:()=>ig,$ZodEnum:()=>tJ,$ZodEncodeError:()=>s6,$ZodEmoji:()=>OJ,$ZodEmail:()=>bJ,$ZodE164:()=>NJ,$ZodDiscriminatedUnion:()=>hJ,$ZodDefault:()=>vb,$ZodDate:()=>mJ,$ZodCustomStringFormat:()=>uJ,$ZodCustom:()=>Pb,$ZodCodec:()=>eg,$ZodCheckUpperCase:()=>dz,$ZodCheckStringFormat:()=>c4,$ZodCheckStartsWith:()=>sz,$ZodCheckSizeEquals:()=>hz,$ZodCheckRegex:()=>nz,$ZodCheckProperty:()=>$J,$ZodCheckOverwrite:()=>gJ,$ZodCheckNumberFormat:()=>mz,$ZodCheckMultipleOf:()=>cz,$ZodCheckMinSize:()=>lz,$ZodCheckMinLength:()=>pz,$ZodCheckMimeType:()=>vJ,$ZodCheckMaxSize:()=>iz,$ZodCheckMaxLength:()=>xz,$ZodCheckLowerCase:()=>tz,$ZodCheckLessThan:()=>g1,$ZodCheckLengthEquals:()=>oz,$ZodCheckIncludes:()=>az,$ZodCheckGreaterThan:()=>U1,$ZodCheckEndsWith:()=>ez,$ZodCheckBigIntFormat:()=>Ez,$ZodCheck:()=>Q$,$ZodCatch:()=>zb,$ZodCUID2:()=>BJ,$ZodCUID:()=>WJ,$ZodCIDRv6:()=>ZJ,$ZodCIDRv4:()=>AJ,$ZodBoolean:()=>ag,$ZodBigIntFormat:()=>DJ,$ZodBigInt:()=>W1,$ZodBase64URL:()=>QJ,$ZodBase64:()=>SJ,$ZodAsyncError:()=>pv,$ZodArray:()=>EJ,$ZodAny:()=>VJ});var s2=Object.freeze({status:"aborted"});function X($,v,U){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 g=U?.Parent??Object;class z extends g{}Object.defineProperty(z,"name",{value:$});function J(b){var O;let K=U?.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(U?.Parent&&b instanceof U.Parent)return!0;return b?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}var e2=Symbol("zod_brand");class pv extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class s6 extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}}var jg={};function l$($){if($)Object.assign(jg,$);return jg}var j={};ev(j,{unwrapMessage:()=>Vg,uint8ArrayToHex:()=>WL,uint8ArrayToBase64url:()=>OL,uint8ArrayToBase64:()=>H5,stringifyPrimitive:()=>D,slugify:()=>gz,shallowClone:()=>_z,safeExtend:()=>UL,required:()=>JL,randomString:()=>dH,propertyKeyTypes:()=>cg,promiseAllObject:()=>tH,primitiveTypes:()=>zz,prefixIssues:()=>Qv,pick:()=>$L,partial:()=>zL,parsedType:()=>R,optionalKeys:()=>Jz,omit:()=>vL,objectClone:()=>pH,numKeys:()=>aH,nullish:()=>Q6,normalizeParams:()=>V,mergeDefs:()=>b6,merge:()=>_L,jsonStringifyReplacer:()=>y4,joinValues:()=>A,issue:()=>R4,isPlainObject:()=>r6,isObject:()=>e6,hexToUint8Array:()=>KL,getSizableOrigin:()=>mg,getParsedType:()=>sH,getLengthableOrigin:()=>Eg,getEnumValues:()=>Cg,getElementAtPath:()=>nH,floatSafeRemainder:()=>vz,finalizeIssue:()=>Fv,extend:()=>gL,escapeRegex:()=>yv,esc:()=>x_,defineLazy:()=>z$,createTransparentProxy:()=>eH,cloneDef:()=>oH,clone:()=>kv,cleanRegex:()=>fg,cleanEnum:()=>bL,captureStackTrace:()=>p_,cached:()=>D4,base64urlToUint8Array:()=>GL,base64ToUint8Array:()=>k5,assignProp:()=>N6,assertNotEqual:()=>iH,assertNever:()=>hH,assertIs:()=>lH,assertEqual:()=>EH,assert:()=>xH,allowsEval:()=>Uz,aborted:()=>u6,NUMBER_FORMAT_RANGES:()=>bz,Class:()=>L5,BIGINT_FORMAT_RANGES:()=>Gz});function EH($){return $}function iH($){return $}function lH($){}function hH($){throw Error("Unexpected value in exhaustive check")}function xH($){}function Cg($){let v=Object.values($).filter((_)=>typeof _==="number");return Object.entries($).filter(([_,g])=>v.indexOf(+_)===-1).map(([_,g])=>g)}function A($,v="|"){return $.map((U)=>D(U)).join(v)}function y4($,v){if(typeof v==="bigint")return v.toString();return v}function D4($){return{get value(){{let U=$();return Object.defineProperty(this,"value",{value:U}),U}throw Error("cached value already set")}}}function Q6($){return $===null||$===void 0}function fg($){let v=$.startsWith("^")?1:0,U=$.endsWith("$")?$.length-1:$.length;return $.slice(v,U)}function vz($,v){let U=($.toString().split(".")[1]||"").length,_=v.toString(),g=(_.split(".")[1]||"").length;if(g===0&&/\d?e-\d?/.test(_)){let O=_.match(/\d?e-(\d?)/);if(O?.[1])g=Number.parseInt(O[1])}let z=U>g?U:g,J=Number.parseInt($.toFixed(z).replace(".","")),b=Number.parseInt(v.toFixed(z).replace(".",""));return J%b/10**z}var P5=Symbol("evaluating");function z$($,v,U){let _=void 0;Object.defineProperty($,v,{get(){if(_===P5)return;if(_===void 0)_=P5,_=U();return _},set(g){Object.defineProperty($,v,{value:g})},configurable:!0})}function pH($){return Object.create(Object.getPrototypeOf($),Object.getOwnPropertyDescriptors($))}function N6($,v,U){Object.defineProperty($,v,{value:U,writable:!0,enumerable:!0,configurable:!0})}function b6(...$){let v={};for(let U of $){let _=Object.getOwnPropertyDescriptors(U);Object.assign(v,_)}return Object.defineProperties({},v)}function oH($){return b6($._zod.def)}function nH($,v){if(!v)return $;return v.reduce((U,_)=>U?.[_],$)}function tH($){let v=Object.keys($),U=v.map((_)=>$[_]);return Promise.all(U).then((_)=>{let g={};for(let z=0;z<v.length;z++)g[v[z]]=_[z];return g})}function dH($=10){let U="";for(let _=0;_<$;_++)U+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return U}function x_($){return JSON.stringify($)}function gz($){return $.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var p_="captureStackTrace"in Error?Error.captureStackTrace:(...$)=>{};function e6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var Uz=D4(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch($){return!1}});function r6($){if(e6($)===!1)return!1;let v=$.constructor;if(v===void 0)return!0;if(typeof v!=="function")return!0;let U=v.prototype;if(e6(U)===!1)return!1;if(Object.prototype.hasOwnProperty.call(U,"isPrototypeOf")===!1)return!1;return!0}function _z($){if(r6($))return{...$};if(Array.isArray($))return[...$];return $}function aH($){let v=0;for(let U in $)if(Object.prototype.hasOwnProperty.call($,U))v++;return v}var sH=($)=>{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}`)}},cg=new Set(["string","number","symbol"]),zz=new Set(["string","number","bigint","boolean","symbol","undefined"]);function yv($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kv($,v,U){let _=new $._zod.constr(v??$._zod.def);if(!v||U?.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 eH($){let v;return new Proxy({},{get(U,_,g){return v??(v=$()),Reflect.get(v,_,g)},set(U,_,g,z){return v??(v=$()),Reflect.set(v,_,g,z)},has(U,_){return v??(v=$()),Reflect.has(v,_)},deleteProperty(U,_){return v??(v=$()),Reflect.deleteProperty(v,_)},ownKeys(U){return v??(v=$()),Reflect.ownKeys(v)},getOwnPropertyDescriptor(U,_){return v??(v=$()),Reflect.getOwnPropertyDescriptor(v,_)},defineProperty(U,_,g){return v??(v=$()),Reflect.defineProperty(v,_,g)}})}function D($){if(typeof $==="bigint")return $.toString()+"n";if(typeof $==="string")return`"${$}"`;return`${$}`}function Jz($){return Object.keys($).filter((v)=>{return $[v]._zod.optin==="optional"&&$[v]._zod.optout==="optional"})}var bz={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]},Gz={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function $L($,v){let U=$._zod.def,_=U.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 U.shape))throw Error(`Unrecognized key: "${b}"`);if(!v[b])continue;J[b]=U.shape[b]}return N6(this,"shape",J),J},checks:[]});return kv($,z)}function vL($,v){let U=$._zod.def,_=U.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 U.shape))throw Error(`Unrecognized key: "${b}"`);if(!v[b])continue;delete J[b]}return N6(this,"shape",J),J},checks:[]});return kv($,z)}function gL($,v){if(!r6(v))throw Error("Invalid input to extend: expected a plain object");let U=$._zod.def.checks;if(U&&U.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 g=b6($._zod.def,{get shape(){let z={...$._zod.def.shape,...v};return N6(this,"shape",z),z}});return kv($,g)}function UL($,v){if(!r6(v))throw Error("Invalid input to safeExtend: expected a plain object");let U=b6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v};return N6(this,"shape",_),_}});return kv($,U)}function _L($,v){let U=b6($._zod.def,{get shape(){let _={...$._zod.def.shape,...v._zod.def.shape};return N6(this,"shape",_),_},get catchall(){return v._zod.def.catchall},checks:[]});return kv($,U)}function zL($,v,U){let g=v._zod.def.checks;if(g&&g.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(U)for(let K in U){if(!(K in b))throw Error(`Unrecognized key: "${K}"`);if(!U[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 N6(this,"shape",O),O},checks:[]});return kv(v,J)}function JL($,v,U){let _=b6(v._zod.def,{get shape(){let g=v._zod.def.shape,z={...g};if(U)for(let J in U){if(!(J in z))throw Error(`Unrecognized key: "${J}"`);if(!U[J])continue;z[J]=new $({type:"nonoptional",innerType:g[J]})}else for(let J in g)z[J]=new $({type:"nonoptional",innerType:g[J]});return N6(this,"shape",z),z}});return kv(v,_)}function u6($,v=0){if($.aborted===!0)return!0;for(let U=v;U<$.issues.length;U++)if($.issues[U]?.continue!==!0)return!0;return!1}function Qv($,v){return v.map((U)=>{var _;return(_=U).path??(_.path=[]),U.path.unshift($),U})}function Vg($){return typeof $==="string"?$:$?.message}function Fv($,v,U){let _={...$,path:$.path??[]};if(!$.message){let g=Vg($.inst?._zod.def?.error?.($))??Vg(v?.error?.($))??Vg(U.customError?.($))??Vg(U.localeError?.($))??"Invalid input";_.message=g}if(delete _.inst,delete _.continue,!v?.reportInput)delete _.input;return _}function mg($){if($ instanceof Set)return"set";if($ instanceof Map)return"map";if($ instanceof File)return"file";return"unknown"}function Eg($){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 U=$;if(U&&Object.getPrototypeOf(U)!==Object.prototype&&"constructor"in U&&U.constructor)return U.constructor.name}}return v}function R4(...$){let[v,U,_]=$;if(typeof v==="string")return{message:v,code:"custom",input:U,inst:_};return{...v}}function bL($){return Object.entries($).filter(([v,U])=>{return Number.isNaN(Number.parseInt(v,10))}).map((v)=>v[1])}function k5($){let v=atob($),U=new Uint8Array(v.length);for(let _=0;_<v.length;_++)U[_]=v.charCodeAt(_);return U}function H5($){let v="";for(let U=0;U<$.length;U++)v+=String.fromCharCode($[U]);return btoa(v)}function GL($){let v=$.replace(/-/g,"+").replace(/_/g,"/"),U="=".repeat((4-v.length%4)%4);return k5(v+U)}function OL($){return H5($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function KL($){let v=$.replace(/^0x/,"");if(v.length%2!==0)throw Error("Invalid hex string length");let U=new Uint8Array(v.length/2);for(let _=0;_<v.length;_+=2)U[_/2]=Number.parseInt(v.slice(_,_+2),16);return U}function WL($){return Array.from($).map((v)=>v.toString(16).padStart(2,"0")).join("")}class L5{constructor(...$){}}var I5=($,v)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:v,enumerable:!1}),$.message=JSON.stringify(v,y4,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},ig=X("$ZodError",I5),Xv=X("$ZodError",I5,{Parent:Error});function lg($,v=(U)=>U.message){let U={},_=[];for(let g of $.issues)if(g.path.length>0)U[g.path[0]]=U[g.path[0]]||[],U[g.path[0]].push(v(g));else _.push(v(g));return{formErrors:_,fieldErrors:U}}function hg($,v=(U)=>U.message){let U={_errors:[]},_=(g)=>{for(let z of g.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)U._errors.push(v(z));else{let J=U,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 _($),U}function Oz($,v=(U)=>U.message){let U={errors:[]},_=(g,z=[])=>{var J,b;for(let O of g.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){U.errors.push(v(O));continue}let W=U,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 _($),U}function Y5($){let v=[],U=$.map((_)=>typeof _==="object"?_.key:_);for(let _ of U)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 Kz($){let v=[],U=[...$.issues].sort((_,g)=>(_.path??[]).length-(g.path??[]).length);for(let _ of U)if(v.push(`✖ ${_.message}`),_.path?.length)v.push(` → at ${Y5(_.path)}`);return v.join(`
108
- `)}var T4=($)=>(v,U,_,g)=>{let z=_?Object.assign(_,{async:!1}):{async:!1},J=v._zod.run({value:U,issues:[]},z);if(J instanceof Promise)throw new pv;if(J.issues.length){let b=new(g?.Err??$)(J.issues.map((O)=>Fv(O,z,l$())));throw p_(b,g?.callee),b}return J.value},xg=T4(Xv),j4=($)=>async(v,U,_,g)=>{let z=_?Object.assign(_,{async:!0}):{async:!0},J=v._zod.run({value:U,issues:[]},z);if(J instanceof Promise)J=await J;if(J.issues.length){let b=new(g?.Err??$)(J.issues.map((O)=>Fv(O,z,l$())));throw p_(b,g?.callee),b}return J.value},pg=j4(Xv),V4=($)=>(v,U,_)=>{let g=_?{..._,async:!1}:{async:!1},z=v._zod.run({value:U,issues:[]},g);if(z instanceof Promise)throw new pv;return z.issues.length?{success:!1,error:new($??ig)(z.issues.map((J)=>Fv(J,g,l$())))}:{success:!0,data:z.value}},C4=V4(Xv),f4=($)=>async(v,U,_)=>{let g=_?Object.assign(_,{async:!0}):{async:!0},z=v._zod.run({value:U,issues:[]},g);if(z instanceof Promise)z=await z;return z.issues.length?{success:!1,error:new $(z.issues.map((J)=>Fv(J,g,l$())))}:{success:!0,data:z.value}},og=f4(Xv),o_=($)=>(v,U,_)=>{let g=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return T4($)(v,U,g)},q5=o_(Xv),n_=($)=>(v,U,_)=>{return T4($)(v,U,_)},F5=n_(Xv),t_=($)=>async(v,U,_)=>{let g=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return j4($)(v,U,g)},X5=t_(Xv),d_=($)=>async(v,U,_)=>{return j4($)(v,U,_)},w5=d_(Xv),a_=($)=>(v,U,_)=>{let g=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return V4($)(v,U,g)},A5=a_(Xv),s_=($)=>(v,U,_)=>{return V4($)(v,U,_)},Z5=s_(Xv),e_=($)=>async(v,U,_)=>{let g=_?Object.assign(_,{direction:"backward"}):{direction:"backward"};return f4($)(v,U,g)},M5=e_(Xv),$1=($)=>async(v,U,_)=>{return f4($)(v,U,_)},S5=$1(Xv);var Dv={};ev(Dv,{xid:()=>kz,uuid7:()=>LL,uuid6:()=>HL,uuid4:()=>kL,uuid:()=>$4,uppercase:()=>fz,unicodeEmail:()=>Q5,undefined:()=>Vz,ulid:()=>Pz,time:()=>rz,string:()=>yz,sha512_hex:()=>CL,sha512_base64url:()=>cL,sha512_base64:()=>fL,sha384_hex:()=>TL,sha384_base64url:()=>VL,sha384_base64:()=>jL,sha256_hex:()=>yL,sha256_base64url:()=>RL,sha256_base64:()=>DL,sha1_hex:()=>NL,sha1_base64url:()=>uL,sha1_base64:()=>rL,rfc5322Email:()=>YL,number:()=>ng,null:()=>jz,nanoid:()=>Lz,md5_hex:()=>ML,md5_base64url:()=>QL,md5_base64:()=>SL,mac:()=>Az,lowercase:()=>Cz,ksuid:()=>Hz,ipv6:()=>wz,ipv4:()=>Xz,integer:()=>Rz,idnEmail:()=>qL,html5Email:()=>IL,hostname:()=>wL,hex:()=>ZL,guid:()=>Yz,extendedDuration:()=>PL,emoji:()=>Fz,email:()=>qz,e164:()=>Qz,duration:()=>Iz,domain:()=>AL,datetime:()=>uz,date:()=>Nz,cuid2:()=>Bz,cuid:()=>Wz,cidrv6:()=>Mz,cidrv4:()=>Zz,browserEmail:()=>FL,boolean:()=>Tz,bigint:()=>Dz,base64url:()=>v1,base64:()=>Sz});var Wz=/^[cC][^\s-]{8,}$/,Bz=/^[0-9a-z]+$/,Pz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kz=/^[0-9a-vA-V]{20}$/,Hz=/^[A-Za-z0-9]{27}$/,Lz=/^[a-zA-Z0-9_-]{21}$/,Iz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,PL=/^[-+]?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)?)??$/,Yz=/^([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})$/,$4=($)=>{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})$`)},kL=$4(4),HL=$4(6),LL=$4(7),qz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,IL=/^[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])?)*$/,YL=/^(([^<>()\[\]\\.,;:\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,}))$/,Q5=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,qL=Q5,FL=/^[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])?)*$/,XL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fz(){return new RegExp(XL,"u")}var Xz=/^(?:(?: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])$/,wz=/^(([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}|:))$/,Az=($)=>{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}$`)},Zz=/^((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])$/,Mz=/^(([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])$/,Sz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,v1=/^[A-Za-z0-9_-]*$/,wL=/^(?=.{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])?)*\.?$/,AL=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Qz=/^\+[1-9]\d{6,14}$/,N5="(?:(?:\\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])))",Nz=new RegExp(`^${N5}$`);function r5($){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 rz($){return new RegExp(`^${r5($)}$`)}function uz($){let v=r5({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let _=`${v}(?:${U.join("|")})`;return new RegExp(`^${N5}T(?:${_})$`)}var yz=($)=>{let v=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${v}$`)},Dz=/^-?\d+n?$/,Rz=/^-?\d+$/,ng=/^-?\d+(?:\.\d+)?$/,Tz=/^(?:true|false)$/i,jz=/^null$/i;var Vz=/^undefined$/i;var Cz=/^[^A-Z]*$/,fz=/^[^a-z]*$/,ZL=/^[0-9a-fA-F]*$/;function tg($,v){return new RegExp(`^[A-Za-z0-9+/]{${$}}${v}$`)}function dg($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var ML=/^[0-9a-fA-F]{32}$/,SL=tg(22,"=="),QL=dg(22),NL=/^[0-9a-fA-F]{40}$/,rL=tg(27,"="),uL=dg(27),yL=/^[0-9a-fA-F]{64}$/,DL=tg(43,"="),RL=dg(43),TL=/^[0-9a-fA-F]{96}$/,jL=tg(64,""),VL=dg(64),CL=/^[0-9a-fA-F]{128}$/,fL=tg(86,"=="),cL=dg(86);var Q$=X("$ZodCheck",($,v)=>{var U;$._zod??($._zod={}),$._zod.def=v,(U=$._zod).onattach??(U.onattach=[])}),y5={number:"number",bigint:"bigint",object:"date"},g1=X("$ZodCheckLessThan",($,v)=>{Q$.init($,v);let U=y5[typeof v.value];$._zod.onattach.push((_)=>{let g=_._zod.bag,z=(v.inclusive?g.maximum:g.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(v.value<z)if(v.inclusive)g.maximum=v.value;else g.exclusiveMaximum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value<=v.value:_.value<v.value)return;_.issues.push({origin:U,code:"too_big",maximum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),U1=X("$ZodCheckGreaterThan",($,v)=>{Q$.init($,v);let U=y5[typeof v.value];$._zod.onattach.push((_)=>{let g=_._zod.bag,z=(v.inclusive?g.minimum:g.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(v.value>z)if(v.inclusive)g.minimum=v.value;else g.exclusiveMinimum=v.value}),$._zod.check=(_)=>{if(v.inclusive?_.value>=v.value:_.value>v.value)return;_.issues.push({origin:U,code:"too_small",minimum:typeof v.value==="object"?v.value.getTime():v.value,input:_.value,inclusive:v.inclusive,inst:$,continue:!v.abort})}}),cz=X("$ZodCheckMultipleOf",($,v)=>{Q$.init($,v),$._zod.onattach.push((U)=>{var _;(_=U._zod.bag).multipleOf??(_.multipleOf=v.value)}),$._zod.check=(U)=>{if(typeof U.value!==typeof v.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof U.value==="bigint"?U.value%v.value===BigInt(0):vz(U.value,v.value)===0)return;U.issues.push({origin:typeof U.value,code:"not_multiple_of",divisor:v.value,input:U.value,inst:$,continue:!v.abort})}}),mz=X("$ZodCheckNumberFormat",($,v)=>{Q$.init($,v),v.format=v.format||"float64";let U=v.format?.includes("int"),_=U?"int":"number",[g,z]=bz[v.format];$._zod.onattach.push((J)=>{let b=J._zod.bag;if(b.format=v.format,b.minimum=g,b.maximum=z,U)b.pattern=Rz}),$._zod.check=(J)=>{let b=J.value;if(U){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<g)J.issues.push({origin:"number",input:b,code:"too_small",minimum:g,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})}}),Ez=X("$ZodCheckBigIntFormat",($,v)=>{Q$.init($,v);let[U,_]=Gz[v.format];$._zod.onattach.push((g)=>{let z=g._zod.bag;z.format=v.format,z.minimum=U,z.maximum=_}),$._zod.check=(g)=>{let z=g.value;if(z<U)g.issues.push({origin:"bigint",input:z,code:"too_small",minimum:U,inclusive:!0,inst:$,continue:!v.abort});if(z>_)g.issues.push({origin:"bigint",input:z,code:"too_big",maximum:_,inclusive:!0,inst:$,continue:!v.abort})}}),iz=X("$ZodCheckMaxSize",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.size!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<g)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let g=_.value;if(g.size<=v.maximum)return;_.issues.push({origin:mg(g),code:"too_big",maximum:v.maximum,inclusive:!0,input:g,inst:$,continue:!v.abort})}}),lz=X("$ZodCheckMinSize",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.size!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>g)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let g=_.value;if(g.size>=v.minimum)return;_.issues.push({origin:mg(g),code:"too_small",minimum:v.minimum,inclusive:!0,input:g,inst:$,continue:!v.abort})}}),hz=X("$ZodCheckSizeEquals",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.size!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag;g.minimum=v.size,g.maximum=v.size,g.size=v.size}),$._zod.check=(_)=>{let g=_.value,z=g.size;if(z===v.size)return;let J=z>v.size;_.issues.push({origin:mg(g),...J?{code:"too_big",maximum:v.size}:{code:"too_small",minimum:v.size},inclusive:!0,exact:!0,input:_.value,inst:$,continue:!v.abort})}}),xz=X("$ZodCheckMaxLength",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.length!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag.maximum??Number.POSITIVE_INFINITY;if(v.maximum<g)_._zod.bag.maximum=v.maximum}),$._zod.check=(_)=>{let g=_.value;if(g.length<=v.maximum)return;let J=Eg(g);_.issues.push({origin:J,code:"too_big",maximum:v.maximum,inclusive:!0,input:g,inst:$,continue:!v.abort})}}),pz=X("$ZodCheckMinLength",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.length!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(v.minimum>g)_._zod.bag.minimum=v.minimum}),$._zod.check=(_)=>{let g=_.value;if(g.length>=v.minimum)return;let J=Eg(g);_.issues.push({origin:J,code:"too_small",minimum:v.minimum,inclusive:!0,input:g,inst:$,continue:!v.abort})}}),oz=X("$ZodCheckLengthEquals",($,v)=>{var U;Q$.init($,v),(U=$._zod.def).when??(U.when=(_)=>{let g=_.value;return!Q6(g)&&g.length!==void 0}),$._zod.onattach.push((_)=>{let g=_._zod.bag;g.minimum=v.length,g.maximum=v.length,g.length=v.length}),$._zod.check=(_)=>{let g=_.value,z=g.length;if(z===v.length)return;let J=Eg(g),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})}}),c4=X("$ZodCheckStringFormat",($,v)=>{var U,_;if(Q$.init($,v),$._zod.onattach.push((g)=>{let z=g._zod.bag;if(z.format=v.format,v.pattern)z.patterns??(z.patterns=new Set),z.patterns.add(v.pattern)}),v.pattern)(U=$._zod).check??(U.check=(g)=>{if(v.pattern.lastIndex=0,v.pattern.test(g.value))return;g.issues.push({origin:"string",code:"invalid_format",format:v.format,input:g.value,...v.pattern?{pattern:v.pattern.toString()}:{},inst:$,continue:!v.abort})});else(_=$._zod).check??(_.check=()=>{})}),nz=X("$ZodCheckRegex",($,v)=>{c4.init($,v),$._zod.check=(U)=>{if(v.pattern.lastIndex=0,v.pattern.test(U.value))return;U.issues.push({origin:"string",code:"invalid_format",format:"regex",input:U.value,pattern:v.pattern.toString(),inst:$,continue:!v.abort})}}),tz=X("$ZodCheckLowerCase",($,v)=>{v.pattern??(v.pattern=Cz),c4.init($,v)}),dz=X("$ZodCheckUpperCase",($,v)=>{v.pattern??(v.pattern=fz),c4.init($,v)}),az=X("$ZodCheckIncludes",($,v)=>{Q$.init($,v);let U=yv(v.includes),_=new RegExp(typeof v.position==="number"?`^.{${v.position}}${U}`:U);v.pattern=_,$._zod.onattach.push((g)=>{let z=g._zod.bag;z.patterns??(z.patterns=new Set),z.patterns.add(_)}),$._zod.check=(g)=>{if(g.value.includes(v.includes,v.position))return;g.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:v.includes,input:g.value,inst:$,continue:!v.abort})}}),sz=X("$ZodCheckStartsWith",($,v)=>{Q$.init($,v);let U=new RegExp(`^${yv(v.prefix)}.*`);v.pattern??(v.pattern=U),$._zod.onattach.push((_)=>{let g=_._zod.bag;g.patterns??(g.patterns=new Set),g.patterns.add(U)}),$._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})}}),ez=X("$ZodCheckEndsWith",($,v)=>{Q$.init($,v);let U=new RegExp(`.*${yv(v.suffix)}$`);v.pattern??(v.pattern=U),$._zod.onattach.push((_)=>{let g=_._zod.bag;g.patterns??(g.patterns=new Set),g.patterns.add(U)}),$._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 u5($,v,U){if($.issues.length)v.issues.push(...Qv(U,$.issues))}var $J=X("$ZodCheckProperty",($,v)=>{Q$.init($,v),$._zod.check=(U)=>{let _=v.schema._zod.run({value:U.value[v.property],issues:[]},{});if(_ instanceof Promise)return _.then((g)=>u5(g,U,v.property));u5(_,U,v.property);return}}),vJ=X("$ZodCheckMimeType",($,v)=>{Q$.init($,v);let U=new Set(v.mime);$._zod.onattach.push((_)=>{_._zod.bag.mime=v.mime}),$._zod.check=(_)=>{if(U.has(_.value.type))return;_.issues.push({code:"invalid_value",values:v.mime,input:_.value.type,inst:$,continue:!v.abort})}}),gJ=X("$ZodCheckOverwrite",($,v)=>{Q$.init($,v),$._zod.check=(U)=>{U.value=v.tx(U.value)}});class _1{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 U=$.split(`
109
- `).filter((z)=>z),_=Math.min(...U.map((z)=>z.length-z.trimStart().length)),g=U.map((z)=>z.slice(_)).map((z)=>" ".repeat(this.indent*2)+z);for(let z of g)this.content.push(z)}compile(){let $=Function,v=this?.args,_=[...(this?.content??[""]).map((g)=>` ${g}`)];return new $(...v,_.join(`
110
- `))}}var UJ={major:4,minor:3,patch:6};var $$=X("$ZodType",($,v)=>{var U;$??($={}),$._zod.def=v,$._zod.bag=$._zod.bag||{},$._zod.version=UJ;let _=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))_.unshift($);for(let g of _)for(let z of g._zod.onattach)z($);if(_.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let g=(J,b,O)=>{let K=u6(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 pv;if(W||P instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await P,J.issues.length===k)return;if(!K)K=u6(J,k)});else{if(J.issues.length===k)continue;if(!K)K=u6(J,k)}}if(W)return W.then(()=>{return J});return J},z=(J,b,O)=>{if(u6(J))return J.aborted=!0,J;let K=g(b,_,O);if(K instanceof Promise){if(O.async===!1)throw new pv;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 pv;return O.then((K)=>g(K,_,b))}return g(O,_,b)}}z$($,"~standard",()=>({validate:(g)=>{try{let z=C4($,g);return z.success?{value:z.data}:{issues:z.error?.issues}}catch(z){return og($,g).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),v4=X("$ZodString",($,v)=>{$$.init($,v),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??yz($._zod.bag),$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=String(U.value)}catch(g){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),Z$=X("$ZodStringFormat",($,v)=>{c4.init($,v),v4.init($,v)}),zJ=X("$ZodGUID",($,v)=>{v.pattern??(v.pattern=Yz),Z$.init($,v)}),JJ=X("$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=$4(_))}else v.pattern??(v.pattern=$4());Z$.init($,v)}),bJ=X("$ZodEmail",($,v)=>{v.pattern??(v.pattern=qz),Z$.init($,v)}),GJ=X("$ZodURL",($,v)=>{Z$.init($,v),$._zod.check=(U)=>{try{let _=U.value.trim(),g=new URL(_);if(v.hostname){if(v.hostname.lastIndex=0,!v.hostname.test(g.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:v.hostname.source,input:U.value,inst:$,continue:!v.abort})}if(v.protocol){if(v.protocol.lastIndex=0,!v.protocol.test(g.protocol.endsWith(":")?g.protocol.slice(0,-1):g.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:v.protocol.source,input:U.value,inst:$,continue:!v.abort})}if(v.normalize)U.value=g.href;else U.value=_;return}catch(_){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!v.abort})}}}),OJ=X("$ZodEmoji",($,v)=>{v.pattern??(v.pattern=Fz()),Z$.init($,v)}),KJ=X("$ZodNanoID",($,v)=>{v.pattern??(v.pattern=Lz),Z$.init($,v)}),WJ=X("$ZodCUID",($,v)=>{v.pattern??(v.pattern=Wz),Z$.init($,v)}),BJ=X("$ZodCUID2",($,v)=>{v.pattern??(v.pattern=Bz),Z$.init($,v)}),PJ=X("$ZodULID",($,v)=>{v.pattern??(v.pattern=Pz),Z$.init($,v)}),kJ=X("$ZodXID",($,v)=>{v.pattern??(v.pattern=kz),Z$.init($,v)}),HJ=X("$ZodKSUID",($,v)=>{v.pattern??(v.pattern=Hz),Z$.init($,v)}),LJ=X("$ZodISODateTime",($,v)=>{v.pattern??(v.pattern=uz(v)),Z$.init($,v)}),IJ=X("$ZodISODate",($,v)=>{v.pattern??(v.pattern=Nz),Z$.init($,v)}),YJ=X("$ZodISOTime",($,v)=>{v.pattern??(v.pattern=rz(v)),Z$.init($,v)}),qJ=X("$ZodISODuration",($,v)=>{v.pattern??(v.pattern=Iz),Z$.init($,v)}),FJ=X("$ZodIPv4",($,v)=>{v.pattern??(v.pattern=Xz),Z$.init($,v),$._zod.bag.format="ipv4"}),XJ=X("$ZodIPv6",($,v)=>{v.pattern??(v.pattern=wz),Z$.init($,v),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!v.abort})}}}),wJ=X("$ZodMAC",($,v)=>{v.pattern??(v.pattern=Az(v.delimiter)),Z$.init($,v),$._zod.bag.format="mac"}),AJ=X("$ZodCIDRv4",($,v)=>{v.pattern??(v.pattern=Zz),Z$.init($,v)}),ZJ=X("$ZodCIDRv6",($,v)=>{v.pattern??(v.pattern=Mz),Z$.init($,v),$._zod.check=(U)=>{let _=U.value.split("/");try{if(_.length!==2)throw Error();let[g,z]=_;if(!z)throw Error();let J=Number(z);if(`${J}`!==z)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${g}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!v.abort})}}});function MJ($){if($==="")return!0;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}var SJ=X("$ZodBase64",($,v)=>{v.pattern??(v.pattern=Sz),Z$.init($,v),$._zod.bag.contentEncoding="base64",$._zod.check=(U)=>{if(MJ(U.value))return;U.issues.push({code:"invalid_format",format:"base64",input:U.value,inst:$,continue:!v.abort})}});function h5($){if(!v1.test($))return!1;let v=$.replace(/[-_]/g,(_)=>_==="-"?"+":"/"),U=v.padEnd(Math.ceil(v.length/4)*4,"=");return MJ(U)}var QJ=X("$ZodBase64URL",($,v)=>{v.pattern??(v.pattern=v1),Z$.init($,v),$._zod.bag.contentEncoding="base64url",$._zod.check=(U)=>{if(h5(U.value))return;U.issues.push({code:"invalid_format",format:"base64url",input:U.value,inst:$,continue:!v.abort})}}),NJ=X("$ZodE164",($,v)=>{v.pattern??(v.pattern=Qz),Z$.init($,v)});function x5($,v=null){try{let U=$.split(".");if(U.length!==3)return!1;let[_]=U;if(!_)return!1;let g=JSON.parse(atob(_));if("typ"in g&&g?.typ!=="JWT")return!1;if(!g.alg)return!1;if(v&&(!("alg"in g)||g.alg!==v))return!1;return!0}catch{return!1}}var rJ=X("$ZodJWT",($,v)=>{Z$.init($,v),$._zod.check=(U)=>{if(x5(U.value,v.alg))return;U.issues.push({code:"invalid_format",format:"jwt",input:U.value,inst:$,continue:!v.abort})}}),uJ=X("$ZodCustomStringFormat",($,v)=>{Z$.init($,v),$._zod.check=(U)=>{if(v.fn(U.value))return;U.issues.push({code:"invalid_format",format:v.format,input:U.value,inst:$,continue:!v.abort})}}),K1=X("$ZodNumber",($,v)=>{$$.init($,v),$._zod.pattern=$._zod.bag.pattern??ng,$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=Number(U.value)}catch(J){}let g=U.value;if(typeof g==="number"&&!Number.isNaN(g)&&Number.isFinite(g))return U;let z=typeof g==="number"?Number.isNaN(g)?"NaN":!Number.isFinite(g)?"Infinity":void 0:void 0;return U.issues.push({expected:"number",code:"invalid_type",input:g,inst:$,...z?{received:z}:{}}),U}}),yJ=X("$ZodNumberFormat",($,v)=>{mz.init($,v),K1.init($,v)}),ag=X("$ZodBoolean",($,v)=>{$$.init($,v),$._zod.pattern=Tz,$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=Boolean(U.value)}catch(z){}let g=U.value;if(typeof g==="boolean")return U;return U.issues.push({expected:"boolean",code:"invalid_type",input:g,inst:$}),U}}),W1=X("$ZodBigInt",($,v)=>{$$.init($,v),$._zod.pattern=Dz,$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=BigInt(U.value)}catch(g){}if(typeof U.value==="bigint")return U;return U.issues.push({expected:"bigint",code:"invalid_type",input:U.value,inst:$}),U}}),DJ=X("$ZodBigIntFormat",($,v)=>{Ez.init($,v),W1.init($,v)}),RJ=X("$ZodSymbol",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(typeof g==="symbol")return U;return U.issues.push({expected:"symbol",code:"invalid_type",input:g,inst:$}),U}}),TJ=X("$ZodUndefined",($,v)=>{$$.init($,v),$._zod.pattern=Vz,$._zod.values=new Set([void 0]),$._zod.optin="optional",$._zod.optout="optional",$._zod.parse=(U,_)=>{let g=U.value;if(typeof g>"u")return U;return U.issues.push({expected:"undefined",code:"invalid_type",input:g,inst:$}),U}}),jJ=X("$ZodNull",($,v)=>{$$.init($,v),$._zod.pattern=jz,$._zod.values=new Set([null]),$._zod.parse=(U,_)=>{let g=U.value;if(g===null)return U;return U.issues.push({expected:"null",code:"invalid_type",input:g,inst:$}),U}}),VJ=X("$ZodAny",($,v)=>{$$.init($,v),$._zod.parse=(U)=>U}),CJ=X("$ZodUnknown",($,v)=>{$$.init($,v),$._zod.parse=(U)=>U}),fJ=X("$ZodNever",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{return U.issues.push({expected:"never",code:"invalid_type",input:U.value,inst:$}),U}}),cJ=X("$ZodVoid",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(typeof g>"u")return U;return U.issues.push({expected:"void",code:"invalid_type",input:g,inst:$}),U}}),mJ=X("$ZodDate",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{if(v.coerce)try{U.value=new Date(U.value)}catch(b){}let g=U.value,z=g instanceof Date;if(z&&!Number.isNaN(g.getTime()))return U;return U.issues.push({expected:"date",code:"invalid_type",input:g,...z?{received:"Invalid Date"}:{},inst:$}),U}});function R5($,v,U){if($.issues.length)v.issues.push(...Qv(U,$.issues));v.value[U]=$.value}var EJ=X("$ZodArray",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(!Array.isArray(g))return U.issues.push({expected:"array",code:"invalid_type",input:g,inst:$}),U;U.value=Array(g.length);let z=[];for(let J=0;J<g.length;J++){let b=g[J],O=v.element._zod.run({value:b,issues:[]},_);if(O instanceof Promise)z.push(O.then((K)=>R5(K,U,J)));else R5(O,U,J)}if(z.length)return Promise.all(z).then(()=>U);return U}});function O1($,v,U,_,g){if($.issues.length){if(g&&!(U in _))return;v.issues.push(...Qv(U,$.issues))}if($.value===void 0){if(U in _)v.value[U]=void 0}else v.value[U]=$.value}function p5($){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 U=Jz($.shape);return{...$,keys:v,keySet:new Set(v),numKeys:v.length,optionalKeys:new Set(U)}}function o5($,v,U,_,g,z){let J=[],b=g.keySet,O=g.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)=>O1(P,U,B,v,W)));else O1(k,U,B,v,W)}if(J.length)U.issues.push({code:"unrecognized_keys",keys:J,input:v,inst:z});if(!$.length)return U;return Promise.all($).then(()=>{return U})}var n5=X("$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 _=D4(()=>p5(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 g=e6,z=v.catchall,J;$._zod.parse=(b,O)=>{J??(J=_.value);let K=b.value;if(!g(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],F=P._zod.optout==="optional",I=P._zod.run({value:K[k],issues:[]},O);if(I instanceof Promise)W.push(I.then((H)=>O1(H,b,k,K,F)));else O1(I,b,k,K,F)}if(!z)return W.length?Promise.all(W).then(()=>b):b;return o5(W,K,b,O,_.value,$)}}),iJ=X("$ZodObjectJIT",($,v)=>{n5.init($,v);let U=$._zod.parse,_=D4(()=>p5(v)),g=(k)=>{let P=new _1(["shape","payload","ctx"]),F=_.value,I=(w)=>{let N=x_(w);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};P.write("const input = payload.value;");let H=Object.create(null),Y=0;for(let w of F.keys)H[w]=`key_${Y++}`;P.write("const newResult = {};");for(let w of F.keys){let N=H[w],C=x_(w),r=k[w]?._zod?.optout==="optional";if(P.write(`const ${N} = ${I(w)};`),r)P.write(`
111
- if (${N}.issues.length) {
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
+ `).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 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(w,N)=>q(k,w,N)},z,J=e6,b=!jg.jitless,K=b&&Uz.value,W=v.catchall,B;$._zod.parse=(k,P)=>{B??(B=_.value);let F=k.value;if(!J(F))return k.issues.push({expected:"object",code:"invalid_type",input:F,inst:$}),k;if(b&&K&&P?.async===!1&&P.jitless!==!0){if(!z)z=g(v.shape);if(k=z(k,P),!W)return k;return o5([],F,k,P,B,$)}return U(k,P)}});function T5($,v,U,_){for(let z of $)if(z.issues.length===0)return v.value=z.value,v;let g=$.filter((z)=>!u6(z));if(g.length===1)return v.value=g[0].value,g[0];return v.issues.push({code:"invalid_union",input:v.value,inst:U,errors:$.map((z)=>z.issues.map((J)=>Fv(J,_,l$())))}),v}var sg=X("$ZodUnion",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.options.some((g)=>g._zod.optin==="optional")?"optional":void 0),z$($._zod,"optout",()=>v.options.some((g)=>g._zod.optout==="optional")?"optional":void 0),z$($._zod,"values",()=>{if(v.options.every((g)=>g._zod.values))return new Set(v.options.flatMap((g)=>Array.from(g._zod.values)));return}),z$($._zod,"pattern",()=>{if(v.options.every((g)=>g._zod.pattern)){let g=v.options.map((z)=>z._zod.pattern);return new RegExp(`^(${g.map((z)=>fg(z.source)).join("|")})$`)}return});let U=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(g,z)=>{if(U)return _(g,z);let J=!1,b=[];for(let O of v.options){let K=O._zod.run({value:g.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 T5(b,g,$,z);return Promise.all(b).then((O)=>{return T5(O,g,$,z)})}});function j5($,v,U,_){let g=$.filter((z)=>z.issues.length===0);if(g.length===1)return v.value=g[0].value,v;if(g.length===0)v.issues.push({code:"invalid_union",input:v.value,inst:U,errors:$.map((z)=>z.issues.map((J)=>Fv(J,_,l$())))});else v.issues.push({code:"invalid_union",input:v.value,inst:U,errors:[],inclusive:!1});return v}var lJ=X("$ZodXor",($,v)=>{sg.init($,v),v.inclusive=!1;let U=v.options.length===1,_=v.options[0]._zod.run;$._zod.parse=(g,z)=>{if(U)return _(g,z);let J=!1,b=[];for(let O of v.options){let K=O._zod.run({value:g.value,issues:[]},z);if(K instanceof Promise)b.push(K),J=!0;else b.push(K)}if(!J)return j5(b,g,$,z);return Promise.all(b).then((O)=>{return j5(O,g,$,z)})}}),hJ=X("$ZodDiscriminatedUnion",($,v)=>{v.inclusive=!1,sg.init($,v);let U=$._zod.parse;z$($._zod,"propValues",()=>{let g={};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(!g[b])g[b]=new Set;for(let K of O)g[b].add(K)}}return g});let _=D4(()=>{let g=v.options,z=new Map;for(let J of g){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=(g,z)=>{let J=g.value;if(!e6(J))return g.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),g;let b=_.value.get(J?.[v.discriminator]);if(b)return b._zod.run(g,z);if(v.unionFallback)return U(g,z);return g.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:v.discriminator,input:J,path:[v.discriminator],inst:$}),g}}),xJ=X("$ZodIntersection",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value,z=v.left._zod.run({value:g,issues:[]},_),J=v.right._zod.run({value:g,issues:[]},_);if(z instanceof Promise||J instanceof Promise)return Promise.all([z,J]).then(([O,K])=>{return V5(U,O,K)});return V5(U,z,J)}});function _J($,v){if($===v)return{valid:!0,data:$};if($ instanceof Date&&v instanceof Date&&+$===+v)return{valid:!0,data:$};if(r6($)&&r6(v)){let U=Object.keys(v),_=Object.keys($).filter((z)=>U.indexOf(z)!==-1),g={...$,...v};for(let z of _){let J=_J($[z],v[z]);if(!J.valid)return{valid:!1,mergeErrorPath:[z,...J.mergeErrorPath]};g[z]=J.data}return{valid:!0,data:g}}if(Array.isArray($)&&Array.isArray(v)){if($.length!==v.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let _=0;_<$.length;_++){let g=$[_],z=v[_],J=_J(g,z);if(!J.valid)return{valid:!1,mergeErrorPath:[_,...J.mergeErrorPath]};U.push(J.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function V5($,v,U){let _=new Map,g;for(let b of v.issues)if(b.code==="unrecognized_keys"){g??(g=b);for(let O of b.keys){if(!_.has(O))_.set(O,{});_.get(O).l=!0}}else $.issues.push(b);for(let b of U.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&&g)$.issues.push({...g,keys:z});if(u6($))return $;let J=_J(v.value,U.value);if(!J.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var B1=X("$ZodTuple",($,v)=>{$$.init($,v);let U=v.items;$._zod.parse=(_,g)=>{let z=_.value;if(!Array.isArray(z))return _.issues.push({input:z,inst:$,expected:"tuple",code:"invalid_type"}),_;_.value=[];let J=[],b=[...U].reverse().findIndex((W)=>W._zod.optin!=="optional"),O=b===-1?0:U.length-b;if(!v.rest){let W=z.length>U.length,B=z.length<O-1;if(W||B)return _.issues.push({...W?{code:"too_big",maximum:U.length,inclusive:!0}:{code:"too_small",minimum:U.length},input:z,inst:$,origin:"array"}),_}let K=-1;for(let W of U){if(K++,K>=z.length){if(K>=O)continue}let B=W._zod.run({value:z[K],issues:[]},g);if(B instanceof Promise)J.push(B.then((k)=>z1(k,_,K)));else z1(B,_,K)}if(v.rest){let W=z.slice(U.length);for(let B of W){K++;let k=v.rest._zod.run({value:B,issues:[]},g);if(k instanceof Promise)J.push(k.then((P)=>z1(P,_,K)));else z1(k,_,K)}}if(J.length)return Promise.all(J).then(()=>_);return _}});function z1($,v,U){if($.issues.length)v.issues.push(...Qv(U,$.issues));v.value[U]=$.value}var pJ=X("$ZodRecord",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(!r6(g))return U.issues.push({expected:"record",code:"invalid_type",input:g,inst:$}),U;let z=[],J=v.keyType._zod.values;if(J){U.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:g[K],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)U.issues.push(...Qv(K,B.issues));U.value[K]=B.value}));else{if(W.issues.length)U.issues.push(...Qv(K,W.issues));U.value[K]=W.value}}let O;for(let K in g)if(!b.has(K))O=O??[],O.push(K);if(O&&O.length>0)U.issues.push({code:"unrecognized_keys",input:g,inst:$,keys:O})}else{U.value={};for(let b of Reflect.ownKeys(g)){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"&&ng.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")U.value[b]=g[b];else U.issues.push({code:"invalid_key",origin:"record",issues:O.issues.map((B)=>Fv(B,_,l$())),input:b,path:[b],inst:$});continue}let W=v.valueType._zod.run({value:g[b],issues:[]},_);if(W instanceof Promise)z.push(W.then((B)=>{if(B.issues.length)U.issues.push(...Qv(b,B.issues));U.value[O.value]=B.value}));else{if(W.issues.length)U.issues.push(...Qv(b,W.issues));U.value[O.value]=W.value}}}if(z.length)return Promise.all(z).then(()=>U);return U}}),oJ=X("$ZodMap",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(!(g instanceof Map))return U.issues.push({expected:"map",code:"invalid_type",input:g,inst:$}),U;let z=[];U.value=new Map;for(let[J,b]of g){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])=>{C5(W,B,U,J,g,$,_)}));else C5(O,K,U,J,g,$,_)}if(z.length)return Promise.all(z).then(()=>U);return U}});function C5($,v,U,_,g,z,J){if($.issues.length)if(cg.has(typeof _))U.issues.push(...Qv(_,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:g,inst:z,issues:$.issues.map((b)=>Fv(b,J,l$()))});if(v.issues.length)if(cg.has(typeof _))U.issues.push(...Qv(_,v.issues));else U.issues.push({origin:"map",code:"invalid_element",input:g,inst:z,key:_,issues:v.issues.map((b)=>Fv(b,J,l$()))});U.value.set($.value,v.value)}var nJ=X("$ZodSet",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(!(g instanceof Set))return U.issues.push({input:g,inst:$,expected:"set",code:"invalid_type"}),U;let z=[];U.value=new Set;for(let J of g){let b=v.valueType._zod.run({value:J,issues:[]},_);if(b instanceof Promise)z.push(b.then((O)=>f5(O,U)));else f5(b,U)}if(z.length)return Promise.all(z).then(()=>U);return U}});function f5($,v){if($.issues.length)v.issues.push(...$.issues);v.value.add($.value)}var tJ=X("$ZodEnum",($,v)=>{$$.init($,v);let U=Cg(v.entries),_=new Set(U);$._zod.values=_,$._zod.pattern=new RegExp(`^(${U.filter((g)=>cg.has(typeof g)).map((g)=>typeof g==="string"?yv(g):g.toString()).join("|")})$`),$._zod.parse=(g,z)=>{let J=g.value;if(_.has(J))return g;return g.issues.push({code:"invalid_value",values:U,input:J,inst:$}),g}}),dJ=X("$ZodLiteral",($,v)=>{if($$.init($,v),v.values.length===0)throw Error("Cannot create literal schema with no valid values");let U=new Set(v.values);$._zod.values=U,$._zod.pattern=new RegExp(`^(${v.values.map((_)=>typeof _==="string"?yv(_):_?yv(_.toString()):String(_)).join("|")})$`),$._zod.parse=(_,g)=>{let z=_.value;if(U.has(z))return _;return _.issues.push({code:"invalid_value",values:v.values,input:z,inst:$}),_}}),aJ=X("$ZodFile",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{let g=U.value;if(g instanceof File)return U;return U.issues.push({expected:"file",code:"invalid_type",input:g,inst:$}),U}}),sJ=X("$ZodTransform",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{if(_.direction==="backward")throw new s6($.constructor.name);let g=v.transform(U.value,U);if(_.async)return(g instanceof Promise?g:Promise.resolve(g)).then((J)=>{return U.value=J,U});if(g instanceof Promise)throw new pv;return U.value=g,U}});function c5($,v){if($.issues.length&&v===void 0)return{issues:[],value:void 0};return $}var P1=X("$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 U=v.innerType._zod.pattern;return U?new RegExp(`^(${fg(U.source)})?$`):void 0}),$._zod.parse=(U,_)=>{if(v.innerType._zod.optin==="optional"){let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>c5(z,U.value));return c5(g,U.value)}if(U.value===void 0)return U;return v.innerType._zod.run(U,_)}}),eJ=X("$ZodExactOptional",($,v)=>{P1.init($,v),z$($._zod,"values",()=>v.innerType._zod.values),z$($._zod,"pattern",()=>v.innerType._zod.pattern),$._zod.parse=(U,_)=>{return v.innerType._zod.run(U,_)}}),$b=X("$ZodNullable",($,v)=>{$$.init($,v),z$($._zod,"optin",()=>v.innerType._zod.optin),z$($._zod,"optout",()=>v.innerType._zod.optout),z$($._zod,"pattern",()=>{let U=v.innerType._zod.pattern;return U?new RegExp(`^(${fg(U.source)}|null)$`):void 0}),z$($._zod,"values",()=>{return v.innerType._zod.values?new Set([...v.innerType._zod.values,null]):void 0}),$._zod.parse=(U,_)=>{if(U.value===null)return U;return v.innerType._zod.run(U,_)}}),vb=X("$ZodDefault",($,v)=>{$$.init($,v),$._zod.optin="optional",z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(U,_)=>{if(_.direction==="backward")return v.innerType._zod.run(U,_);if(U.value===void 0)return U.value=v.defaultValue,U;let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>m5(z,v));return m5(g,v)}});function m5($,v){if($.value===void 0)$.value=v.defaultValue;return $}var gb=X("$ZodPrefault",($,v)=>{$$.init($,v),$._zod.optin="optional",z$($._zod,"values",()=>v.innerType._zod.values),$._zod.parse=(U,_)=>{if(_.direction==="backward")return v.innerType._zod.run(U,_);if(U.value===void 0)U.value=v.defaultValue;return v.innerType._zod.run(U,_)}}),Ub=X("$ZodNonOptional",($,v)=>{$$.init($,v),z$($._zod,"values",()=>{let U=v.innerType._zod.values;return U?new Set([...U].filter((_)=>_!==void 0)):void 0}),$._zod.parse=(U,_)=>{let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>E5(z,$));return E5(g,$)}});function E5($,v){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:v});return $}var _b=X("$ZodSuccess",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{if(_.direction==="backward")throw new s6("ZodSuccess");let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>{return U.value=z.issues.length===0,U});return U.value=g.issues.length===0,U}}),zb=X("$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=(U,_)=>{if(_.direction==="backward")return v.innerType._zod.run(U,_);let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>{if(U.value=z.value,z.issues.length)U.value=v.catchValue({...U,error:{issues:z.issues.map((J)=>Fv(J,_,l$()))},input:U.value}),U.issues=[];return U});if(U.value=g.value,g.issues.length)U.value=v.catchValue({...U,error:{issues:g.issues.map((z)=>Fv(z,_,l$()))},input:U.value}),U.issues=[];return U}}),Jb=X("$ZodNaN",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{if(typeof U.value!=="number"||!Number.isNaN(U.value))return U.issues.push({input:U.value,inst:$,expected:"nan",code:"invalid_type"}),U;return U}}),bb=X("$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=(U,_)=>{if(_.direction==="backward"){let z=v.out._zod.run(U,_);if(z instanceof Promise)return z.then((J)=>J1(J,v.in,_));return J1(z,v.in,_)}let g=v.in._zod.run(U,_);if(g instanceof Promise)return g.then((z)=>J1(z,v.out,_));return J1(g,v.out,_)}});function J1($,v,U){if($.issues.length)return $.aborted=!0,$;return v._zod.run({value:$.value,issues:$.issues},U)}var eg=X("$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=(U,_)=>{if((_.direction||"forward")==="forward"){let z=v.in._zod.run(U,_);if(z instanceof Promise)return z.then((J)=>b1(J,v,_));return b1(z,v,_)}else{let z=v.out._zod.run(U,_);if(z instanceof Promise)return z.then((J)=>b1(J,v,_));return b1(z,v,_)}}});function b1($,v,U){if($.issues.length)return $.aborted=!0,$;if((U.direction||"forward")==="forward"){let g=v.transform($.value,$);if(g instanceof Promise)return g.then((z)=>G1($,z,v.out,U));return G1($,g,v.out,U)}else{let g=v.reverseTransform($.value,$);if(g instanceof Promise)return g.then((z)=>G1($,z,v.in,U));return G1($,g,v.in,U)}}function G1($,v,U,_){if($.issues.length)return $.aborted=!0,$;return U._zod.run({value:v,issues:$.issues},_)}var Gb=X("$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=(U,_)=>{if(_.direction==="backward")return v.innerType._zod.run(U,_);let g=v.innerType._zod.run(U,_);if(g instanceof Promise)return g.then(i5);return i5(g)}});function i5($){return $.value=Object.freeze($.value),$}var Ob=X("$ZodTemplateLiteral",($,v)=>{$$.init($,v);let U=[];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 g=_._zod.pattern instanceof RegExp?_._zod.pattern.source:_._zod.pattern;if(!g)throw Error(`Invalid template literal part: ${_._zod.traits}`);let z=g.startsWith("^")?1:0,J=g.endsWith("$")?g.length-1:g.length;U.push(g.slice(z,J))}else if(_===null||zz.has(typeof _))U.push(yv(`${_}`));else throw Error(`Invalid template literal part: ${_}`);$._zod.pattern=new RegExp(`^${U.join("")}$`),$._zod.parse=(_,g)=>{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 _}}),Kb=X("$ZodFunction",($,v)=>{return $$.init($,v),$._def=v,$._zod.def=v,$.implement=(U)=>{if(typeof U!=="function")throw Error("implement() must be called with a function");return function(..._){let g=$._def.input?xg($._def.input,_):_,z=Reflect.apply(U,this,g);if($._def.output)return xg($._def.output,z);return z}},$.implementAsync=(U)=>{if(typeof U!=="function")throw Error("implementAsync() must be called with a function");return async function(..._){let g=$._def.input?await pg($._def.input,_):_,z=await Reflect.apply(U,this,g);if($._def.output)return await pg($._def.output,z);return z}},$._zod.parse=(U,_)=>{if(typeof U.value!=="function")return U.issues.push({code:"invalid_type",expected:"function",input:U.value,inst:$}),U;if($._def.output&&$._def.output._zod.def.type==="promise")U.value=$.implementAsync(U.value);else U.value=$.implement(U.value);return U},$.input=(...U)=>{let _=$.constructor;if(Array.isArray(U[0]))return new _({type:"function",input:new B1({type:"tuple",items:U[0],rest:U[1]}),output:$._def.output});return new _({type:"function",input:U[0],output:$._def.output})},$.output=(U)=>{return new $.constructor({type:"function",input:$._def.input,output:U})},$}),Wb=X("$ZodPromise",($,v)=>{$$.init($,v),$._zod.parse=(U,_)=>{return Promise.resolve(U.value).then((g)=>v.innerType._zod.run({value:g,issues:[]},_))}}),Bb=X("$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=(U,_)=>{return $._zod.innerType._zod.run(U,_)}}),Pb=X("$ZodCustom",($,v)=>{Q$.init($,v),$$.init($,v),$._zod.parse=(U,_)=>{return U},$._zod.check=(U)=>{let _=U.value,g=v.fn(_);if(g instanceof Promise)return g.then((z)=>l5(z,U,_,$));l5(g,U,_,$);return}});function l5($,v,U,_){if(!$){let g={code:"custom",input:U,inst:_,path:[..._._zod.def.path??[]],continue:!_._zod.def.abort};if(_._zod.def.params)g.params=_._zod.def.params;v.issues.push(R4(g))}}var _U={};ev(_U,{zhTW:()=>_8,zhCN:()=>U8,yo:()=>z8,vi:()=>g8,uz:()=>v8,ur:()=>$8,uk:()=>UU,ua:()=>eb,tr:()=>sb,th:()=>ab,ta:()=>db,sv:()=>tb,sl:()=>nb,ru:()=>ob,pt:()=>pb,ps:()=>hb,pl:()=>xb,ota:()=>lb,no:()=>ib,nl:()=>Eb,ms:()=>mb,mk:()=>cb,lt:()=>fb,ko:()=>Cb,km:()=>vU,kh:()=>Vb,ka:()=>jb,ja:()=>Tb,it:()=>Rb,is:()=>Db,id:()=>yb,hy:()=>ub,hu:()=>rb,he:()=>Nb,frCA:()=>Qb,fr:()=>Sb,fi:()=>Mb,fa:()=>Zb,es:()=>Ab,eo:()=>wb,en:()=>$U,de:()=>Xb,da:()=>Fb,cs:()=>qb,ca:()=>Yb,bg:()=>Ib,be:()=>Lb,az:()=>Hb,ar:()=>kb});var EL=()=>{let $={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${g.expected}، ولكن تم إدخال ${b}`;return`مدخلات غير مقبولة: يفترض إدخال ${z}، ولكن تم إدخال ${b}`}case"invalid_value":if(g.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${D(g.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return` أكبر من اللازم: يفترض أن تكون ${g.origin??"القيمة"} ${z} ${g.maximum.toString()} ${J.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${g.origin??"القيمة"} ${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`أصغر من اللازم: يفترض لـ ${g.origin} أن يكون ${z} ${g.minimum.toString()} ${J.unit}`;return`أصغر من اللازم: يفترض لـ ${g.origin} أن يكون ${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;if(z.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${g.prefix}"`;if(z.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${z.suffix}"`;if(z.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${z.includes}"`;if(z.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${z.pattern}`;return`${U[z.format]??g.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${g.divisor}`;case"unrecognized_keys":return`معرف${g.keys.length>1?"ات":""} غريب${g.keys.length>1?"ة":""}: ${A(g.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${g.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${g.origin}`;default:return"مدخل غير مقبول"}}};function kb(){return{localeError:EL()}}var iL=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Yanlış dəyər: gözlənilən instanceof ${g.expected}, daxil olan ${b}`;return`Yanlış dəyər: gözlənilən ${z}, daxil olan ${b}`}case"invalid_value":if(g.values.length===1)return`Yanlış dəyər: gözlənilən ${D(g.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Çox böyük: gözlənilən ${g.origin??"dəyər"} ${z}${g.maximum.toString()} ${J.unit??"element"}`;return`Çox böyük: gözlənilən ${g.origin??"dəyər"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Çox kiçik: gözlənilən ${g.origin} ${z}${g.minimum.toString()} ${J.unit}`;return`Çox kiçik: gözlənilən ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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ış ${U[z.format]??g.format}`}case"not_multiple_of":return`Yanlış ədəd: ${g.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${g.keys.length>1?"lar":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${g.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function Hb(){return{localeError:iL()}}function t5($,v,U,_){let g=Math.abs($),z=g%10,J=g%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return U;return _}var lL=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Няправільны ўвод: чакаўся instanceof ${g.expected}, атрымана ${b}`;return`Няправільны ўвод: чакаўся ${z}, атрымана ${b}`}case"invalid_value":if(g.values.length===1)return`Няправільны ўвод: чакалася ${D(g.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J){let b=Number(g.maximum),O=t5(b,J.unit.one,J.unit.few,J.unit.many);return`Занадта вялікі: чакалася, што ${g.origin??"значэнне"} павінна ${J.verb} ${z}${g.maximum.toString()} ${O}`}return`Занадта вялікі: чакалася, што ${g.origin??"значэнне"} павінна быць ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J){let b=Number(g.minimum),O=t5(b,J.unit.one,J.unit.few,J.unit.many);return`Занадта малы: чакалася, што ${g.origin} павінна ${J.verb} ${z}${g.minimum.toString()} ${O}`}return`Занадта малы: чакалася, што ${g.origin} павінна быць ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`Няправільны ${U[z.format]??g.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${g.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${g.keys.length>1?"ключы":"ключ"}: ${A(g.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${g.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${g.origin}`;default:return"Няправільны ўвод"}}};function Lb(){return{localeError:lL()}}var hL=()=>{let $={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Невалиден вход: очакван instanceof ${g.expected}, получен ${b}`;return`Невалиден вход: очакван ${z}, получен ${b}`}case"invalid_value":if(g.values.length===1)return`Невалиден вход: очакван ${D(g.values[0])}`;return`Невалидна опция: очаквано едно от ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Твърде голямо: очаква се ${g.origin??"стойност"} да съдържа ${z}${g.maximum.toString()} ${J.unit??"елемента"}`;return`Твърде голямо: очаква се ${g.origin??"стойност"} да бъде ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Твърде малко: очаква се ${g.origin} да съдържа ${z}${g.minimum.toString()} ${J.unit}`;return`Твърде малко: очаква се ${g.origin} да бъде ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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} ${U[z.format]??g.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${g.divisor}`;case"unrecognized_keys":return`Неразпознат${g.keys.length>1?"и":""} ключ${g.keys.length>1?"ове":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${g.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${g.origin}`;default:return"Невалиден вход"}}};function Ib(){return{localeError:hL()}}var xL=()=>{let $={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Tipus invàlid: s'esperava instanceof ${g.expected}, s'ha rebut ${b}`;return`Tipus invàlid: s'esperava ${z}, s'ha rebut ${b}`}case"invalid_value":if(g.values.length===1)return`Valor invàlid: s'esperava ${D(g.values[0])}`;return`Opció invàlida: s'esperava una de ${A(g.values," o ")}`;case"too_big":{let z=g.inclusive?"com a màxim":"menys de",J=v(g.origin);if(J)return`Massa gran: s'esperava que ${g.origin??"el valor"} contingués ${z} ${g.maximum.toString()} ${J.unit??"elements"}`;return`Massa gran: s'esperava que ${g.origin??"el valor"} fos ${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?"com a mínim":"més de",J=v(g.origin);if(J)return`Massa petit: s'esperava que ${g.origin} contingués ${z} ${g.minimum.toString()} ${J.unit}`;return`Massa petit: s'esperava que ${g.origin} fos ${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${g.divisor}`;case"unrecognized_keys":return`Clau${g.keys.length>1?"s":""} no reconeguda${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${g.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${g.origin}`;default:return"Entrada invàlida"}}};function Yb(){return{localeError:xL()}}var pL=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Neplatný vstup: očekáváno instanceof ${g.expected}, obdrženo ${b}`;return`Neplatný vstup: očekáváno ${z}, obdrženo ${b}`}case"invalid_value":if(g.values.length===1)return`Neplatný vstup: očekáváno ${D(g.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Hodnota je příliš velká: ${g.origin??"hodnota"} musí mít ${z}${g.maximum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš velká: ${g.origin??"hodnota"} musí být ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Hodnota je příliš malá: ${g.origin??"hodnota"} musí mít ${z}${g.minimum.toString()} ${J.unit??"prvků"}`;return`Hodnota je příliš malá: ${g.origin??"hodnota"} musí být ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${g.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${A(g.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${g.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${g.origin}`;default:return"Neplatný vstup"}}};function qb(){return{localeError:pL()}}var oL=()=>{let $={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ugyldigt input: forventede instanceof ${g.expected}, fik ${b}`;return`Ugyldigt input: forventede ${z}, fik ${b}`}case"invalid_value":if(g.values.length===1)return`Ugyldig værdi: forventede ${D(g.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin),b=_[g.origin]??g.origin;if(J)return`For stor: forventede ${b??"value"} ${J.verb} ${z} ${g.maximum.toString()} ${J.unit??"elementer"}`;return`For stor: forventede ${b??"value"} havde ${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin),b=_[g.origin]??g.origin;if(J)return`For lille: forventede ${b} ${J.verb} ${z} ${g.minimum.toString()} ${J.unit}`;return`For lille: forventede ${b} havde ${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${g.divisor}`;case"unrecognized_keys":return`${g.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${A(g.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${g.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${g.origin}`;default:return"Ugyldigt input"}}};function Fb(){return{localeError:oL()}}var nL=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ungültige Eingabe: erwartet instanceof ${g.expected}, erhalten ${b}`;return`Ungültige Eingabe: erwartet ${z}, erhalten ${b}`}case"invalid_value":if(g.values.length===1)return`Ungültige Eingabe: erwartet ${D(g.values[0])}`;return`Ungültige Option: erwartet eine von ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Zu groß: erwartet, dass ${g.origin??"Wert"} ${z}${g.maximum.toString()} ${J.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${g.origin??"Wert"} ${z}${g.maximum.toString()} ist`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Zu klein: erwartet, dass ${g.origin} ${z}${g.minimum.toString()} ${J.unit} hat`;return`Zu klein: erwartet, dass ${g.origin} ${z}${g.minimum.toString()} ist`}case"invalid_format":{let z=g;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: ${U[z.format]??g.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${g.divisor} sein`;case"unrecognized_keys":return`${g.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${A(g.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${g.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${g.origin}`;default:return"Ungültige Eingabe"}}};function Xb(){return{localeError:nL()}}var tL=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;return`Invalid input: expected ${z}, received ${b}`}case"invalid_value":if(g.values.length===1)return`Invalid input: expected ${D(g.values[0])}`;return`Invalid option: expected one of ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Too big: expected ${g.origin??"value"} to have ${z}${g.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${g.origin??"value"} to be ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Too small: expected ${g.origin} to have ${z}${g.minimum.toString()} ${J.unit}`;return`Too small: expected ${g.origin} to be ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${g.divisor}`;case"unrecognized_keys":return`Unrecognized key${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Invalid key in ${g.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${g.origin}`;default:return"Invalid input"}}};function $U(){return{localeError:tL()}}var dL=()=>{let $={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Nevalida enigo: atendiĝis instanceof ${g.expected}, riceviĝis ${b}`;return`Nevalida enigo: atendiĝis ${z}, riceviĝis ${b}`}case"invalid_value":if(g.values.length===1)return`Nevalida enigo: atendiĝis ${D(g.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Tro granda: atendiĝis ke ${g.origin??"valoro"} havu ${z}${g.maximum.toString()} ${J.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${g.origin??"valoro"} havu ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Tro malgranda: atendiĝis ke ${g.origin} havu ${z}${g.minimum.toString()} ${J.unit}`;return`Tro malgranda: atendiĝis ke ${g.origin} estu ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${g.divisor}`;case"unrecognized_keys":return`Nekonata${g.keys.length>1?"j":""} ŝlosilo${g.keys.length>1?"j":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${g.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${g.origin}`;default:return"Nevalida enigo"}}};function wb(){return{localeError:dL()}}var aL=()=>{let $={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Entrada inválida: se esperaba instanceof ${g.expected}, recibido ${b}`;return`Entrada inválida: se esperaba ${z}, recibido ${b}`}case"invalid_value":if(g.values.length===1)return`Entrada inválida: se esperaba ${D(g.values[0])}`;return`Opción inválida: se esperaba una de ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin),b=_[g.origin]??g.origin;if(J)return`Demasiado grande: se esperaba que ${b??"valor"} tuviera ${z}${g.maximum.toString()} ${J.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${b??"valor"} fuera ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin),b=_[g.origin]??g.origin;if(J)return`Demasiado pequeño: se esperaba que ${b} tuviera ${z}${g.minimum.toString()} ${J.unit}`;return`Demasiado pequeño: se esperaba que ${b} fuera ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${g.divisor}`;case"unrecognized_keys":return`Llave${g.keys.length>1?"s":""} desconocida${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Llave inválida en ${_[g.origin]??g.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${_[g.origin]??g.origin}`;default:return"Entrada inválida"}}};function Ab(){return{localeError:aL()}}var sL=()=>{let $={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`ورودی نامعتبر: می‌بایست instanceof ${g.expected} می‌بود، ${b} دریافت شد`;return`ورودی نامعتبر: می‌بایست ${z} می‌بود، ${b} دریافت شد`}case"invalid_value":if(g.values.length===1)return`ورودی نامعتبر: می‌بایست ${D(g.values[0])} می‌بود`;return`گزینه نامعتبر: می‌بایست یکی از ${A(g.values,"|")} می‌بود`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`خیلی بزرگ: ${g.origin??"مقدار"} باید ${z}${g.maximum.toString()} ${J.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${g.origin??"مقدار"} باید ${z}${g.maximum.toString()} باشد`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`خیلی کوچک: ${g.origin} باید ${z}${g.minimum.toString()} ${J.unit} باشد`;return`خیلی کوچک: ${g.origin} باید ${z}${g.minimum.toString()} باشد`}case"invalid_format":{let z=g;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`${U[z.format]??g.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${g.divisor} باشد`;case"unrecognized_keys":return`کلید${g.keys.length>1?"های":""} ناشناس: ${A(g.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${g.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${g.origin}`;default:return"ورودی نامعتبر"}}};function Zb(){return{localeError:sL()}}var eL=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Virheellinen tyyppi: odotettiin instanceof ${g.expected}, oli ${b}`;return`Virheellinen tyyppi: odotettiin ${z}, oli ${b}`}case"invalid_value":if(g.values.length===1)return`Virheellinen syöte: täytyy olla ${D(g.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Liian suuri: ${J.subject} täytyy olla ${z}${g.maximum.toString()} ${J.unit}`.trim();return`Liian suuri: arvon täytyy olla ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Liian pieni: ${J.subject} täytyy olla ${z}${g.minimum.toString()} ${J.unit}`.trim();return`Liian pieni: arvon täytyy olla ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${g.divisor} monikerta`;case"unrecognized_keys":return`${g.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${A(g.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 Mb(){return{localeError:eL()}}var $I=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Entrée invalide : instanceof ${g.expected} attendu, ${b} reçu`;return`Entrée invalide : ${z} attendu, ${b} reçu`}case"invalid_value":if(g.values.length===1)return`Entrée invalide : ${D(g.values[0])} attendu`;return`Option invalide : une valeur parmi ${A(g.values,"|")} attendue`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Trop grand : ${g.origin??"valeur"} doit ${J.verb} ${z}${g.maximum.toString()} ${J.unit??"élément(s)"}`;return`Trop grand : ${g.origin??"valeur"} doit être ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Trop petit : ${g.origin} doit ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`Trop petit : ${g.origin} doit être ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`${U[z.format]??g.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${g.divisor}`;case"unrecognized_keys":return`Clé${g.keys.length>1?"s":""} non reconnue${g.keys.length>1?"s":""} : ${A(g.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${g.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${g.origin}`;default:return"Entrée invalide"}}};function Sb(){return{localeError:$I()}}var vI=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Entrée invalide : attendu instanceof ${g.expected}, reçu ${b}`;return`Entrée invalide : attendu ${z}, reçu ${b}`}case"invalid_value":if(g.values.length===1)return`Entrée invalide : attendu ${D(g.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"≤":"<",J=v(g.origin);if(J)return`Trop grand : attendu que ${g.origin??"la valeur"} ait ${z}${g.maximum.toString()} ${J.unit}`;return`Trop grand : attendu que ${g.origin??"la valeur"} soit ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?"≥":">",J=v(g.origin);if(J)return`Trop petit : attendu que ${g.origin} ait ${z}${g.minimum.toString()} ${J.unit}`;return`Trop petit : attendu que ${g.origin} soit ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`${U[z.format]??g.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${g.divisor}`;case"unrecognized_keys":return`Clé${g.keys.length>1?"s":""} non reconnue${g.keys.length>1?"s":""} : ${A(g.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${g.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${g.origin}`;default:return"Entrée invalide"}}};function Qb(){return{localeError:vI()}}var gI=()=>{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:"גדול"}},U=(K)=>K?$[K]:void 0,_=(K)=>{let W=U(K);if(W)return W.label;return K??$.unknown.label},g=(K)=>`ה${_(K)}`,z=(K)=>{return(U(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=g(K.origin??"value");if(K.origin==="string")return`${W?.longLabel??"ארוך"} מדי: ${B} צריכה להכיל ${K.maximum.toString()} ${W?.unit??""} ${K.inclusive?"או פחות":"לכל היותר"}`.trim();if(K.origin==="number"){let F=K.inclusive?`קטן או שווה ל-${K.maximum}`:`קטן מ-${K.maximum}`;return`גדול מדי: ${B} צריך להיות ${F}`}if(K.origin==="array"||K.origin==="set"){let F=K.origin==="set"?"צריכה":"צריך",I=K.inclusive?`${K.maximum} ${W?.unit??""} או פחות`:`פחות מ-${K.maximum} ${W?.unit??""}`;return`גדול מדי: ${B} ${F} להכיל ${I}`.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=g(K.origin??"value");if(K.origin==="string")return`${W?.shortLabel??"קצר"} מדי: ${B} צריכה להכיל ${K.minimum.toString()} ${W?.unit??""} ${K.inclusive?"או יותר":"לפחות"}`.trim();if(K.origin==="number"){let F=K.inclusive?`גדול או שווה ל-${K.minimum}`:`גדול מ-${K.minimum}`;return`קטן מדי: ${B} צריך להיות ${F}`}if(K.origin==="array"||K.origin==="set"){let F=K.origin==="set"?"צריכה":"צריך";if(K.minimum===1&&K.inclusive){let H=K.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${B} ${F} להכיל ${H}`}let I=K.inclusive?`${K.minimum} ${W?.unit??""} או יותר`:`יותר מ-${K.minimum} ${W?.unit??""}`;return`קטן מדי: ${B} ${F} להכיל ${I}`.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,F=(B?.gender??"m")==="f"?"תקינה":"תקין";return`${k} לא ${F}`}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`ערך לא תקין ב${g(K.origin??"array")}`;default:return"קלט לא תקין"}}};function Nb(){return{localeError:gI()}}var UI=()=>{let $={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Érvénytelen bemenet: a várt érték instanceof ${g.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(g.values.length===1)return`Érvénytelen bemenet: a várt érték ${D(g.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Túl nagy: ${g.origin??"érték"} mérete túl nagy ${z}${g.maximum.toString()} ${J.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${g.origin??"érték"} túl nagy: ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Túl kicsi: a bemeneti érték ${g.origin} mérete túl kicsi ${z}${g.minimum.toString()} ${J.unit}`;return`Túl kicsi: a bemeneti érték ${g.origin} túl kicsi ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Érvénytelen szám: ${g.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${g.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${g.origin}`;default:return"Érvénytelen bemenet"}}};function rb(){return{localeError:UI()}}function d5($,v,U){return Math.abs($)===1?v:U}function m4($){if(!$)return"";let v=["ա","ե","ը","ի","ո","ու","օ"],U=$[$.length-1];return $+(v.includes(U)?"ն":"ը")}var _I=()=>{let $={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${g.expected}, ստացվել է ${b}`;return`Սխալ մուտքագրում․ սպասվում էր ${z}, ստացվել է ${b}`}case"invalid_value":if(g.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${D(g.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J){let b=Number(g.maximum),O=d5(b,J.unit.one,J.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${m4(g.origin??"արժեք")} կունենա ${z}${g.maximum.toString()} ${O}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${m4(g.origin??"արժեք")} լինի ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J){let b=Number(g.minimum),O=d5(b,J.unit.one,J.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${m4(g.origin)} կունենա ${z}${g.minimum.toString()} ${O}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${m4(g.origin)} լինի ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`Սխալ ${U[z.format]??g.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${g.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${g.keys.length>1?"ներ":""}. ${A(g.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${m4(g.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${m4(g.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function ub(){return{localeError:_I()}}var zI=()=>{let $={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Input tidak valid: diharapkan instanceof ${g.expected}, diterima ${b}`;return`Input tidak valid: diharapkan ${z}, diterima ${b}`}case"invalid_value":if(g.values.length===1)return`Input tidak valid: diharapkan ${D(g.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Terlalu besar: diharapkan ${g.origin??"value"} memiliki ${z}${g.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: diharapkan ${g.origin??"value"} menjadi ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Terlalu kecil: diharapkan ${g.origin} memiliki ${z}${g.minimum.toString()} ${J.unit}`;return`Terlalu kecil: diharapkan ${g.origin} menjadi ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`${U[z.format]??g.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${g.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${g.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${g.origin}`;default:return"Input tidak valid"}}};function yb(){return{localeError:zI()}}var JI=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Rangt gildi: Þú slóst inn ${b} þar sem á að vera instanceof ${g.expected}`;return`Rangt gildi: Þú slóst inn ${b} þar sem á að vera ${z}`}case"invalid_value":if(g.values.length===1)return`Rangt gildi: gert ráð fyrir ${D(g.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Of stórt: gert er ráð fyrir að ${g.origin??"gildi"} hafi ${z}${g.maximum.toString()} ${J.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${g.origin??"gildi"} sé ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Of lítið: gert er ráð fyrir að ${g.origin} hafi ${z}${g.minimum.toString()} ${J.unit}`;return`Of lítið: gert er ráð fyrir að ${g.origin} sé ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${g.divisor}`;case"unrecognized_keys":return`Óþekkt ${g.keys.length>1?"ir lyklar":"ur lykill"}: ${A(g.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${g.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${g.origin}`;default:return"Rangt gildi"}}};function Db(){return{localeError:JI()}}var bI=()=>{let $={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Input non valido: atteso instanceof ${g.expected}, ricevuto ${b}`;return`Input non valido: atteso ${z}, ricevuto ${b}`}case"invalid_value":if(g.values.length===1)return`Input non valido: atteso ${D(g.values[0])}`;return`Opzione non valida: atteso uno tra ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Troppo grande: ${g.origin??"valore"} deve avere ${z}${g.maximum.toString()} ${J.unit??"elementi"}`;return`Troppo grande: ${g.origin??"valore"} deve essere ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Troppo piccolo: ${g.origin} deve avere ${z}${g.minimum.toString()} ${J.unit}`;return`Troppo piccolo: ${g.origin} deve essere ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${g.divisor}`;case"unrecognized_keys":return`Chiav${g.keys.length>1?"i":"e"} non riconosciut${g.keys.length>1?"e":"a"}: ${A(g.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${g.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${g.origin}`;default:return"Input non valido"}}};function Rb(){return{localeError:bI()}}var GI=()=>{let $={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`無効な入力: instanceof ${g.expected}が期待されましたが、${b}が入力されました`;return`無効な入力: ${z}が期待されましたが、${b}が入力されました`}case"invalid_value":if(g.values.length===1)return`無効な入力: ${D(g.values[0])}が期待されました`;return`無効な選択: ${A(g.values,"、")}のいずれかである必要があります`;case"too_big":{let z=g.inclusive?"以下である":"より小さい",J=v(g.origin);if(J)return`大きすぎる値: ${g.origin??"値"}は${g.maximum.toString()}${J.unit??"要素"}${z}必要があります`;return`大きすぎる値: ${g.origin??"値"}は${g.maximum.toString()}${z}必要があります`}case"too_small":{let z=g.inclusive?"以上である":"より大きい",J=v(g.origin);if(J)return`小さすぎる値: ${g.origin}は${g.minimum.toString()}${J.unit}${z}必要があります`;return`小さすぎる値: ${g.origin}は${g.minimum.toString()}${z}必要があります`}case"invalid_format":{let z=g;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`無効な${U[z.format]??g.format}`}case"not_multiple_of":return`無効な数値: ${g.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${g.keys.length>1?"群":""}: ${A(g.keys,"、")}`;case"invalid_key":return`${g.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${g.origin}内の無効な値`;default:return"無効な入力"}}};function Tb(){return{localeError:GI()}}var OI=()=>{let $={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${g.expected}, მიღებული ${b}`;return`არასწორი შეყვანა: მოსალოდნელი ${z}, მიღებული ${b}`}case"invalid_value":if(g.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${D(g.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${A(g.values,"|")}-დან`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`ზედმეტად დიდი: მოსალოდნელი ${g.origin??"მნიშვნელობა"} ${J.verb} ${z}${g.maximum.toString()} ${J.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${g.origin??"მნიშვნელობა"} იყოს ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`ზედმეტად პატარა: მოსალოდნელი ${g.origin} ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${g.origin} იყოს ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`არასწორი ${U[z.format]??g.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${g.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${g.keys.length>1?"ები":"ი"}: ${A(g.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${g.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${g.origin}-ში`;default:return"არასწორი შეყვანა"}}};function jb(){return{localeError:OI()}}var KI=()=>{let $={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${g.expected} ប៉ុន្តែទទួលបាន ${b}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${z} ប៉ុន្តែទទួលបាន ${b}`}case"invalid_value":if(g.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${D(g.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`ធំពេក៖ ត្រូវការ ${g.origin??"តម្លៃ"} ${z} ${g.maximum.toString()} ${J.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${g.origin??"តម្លៃ"} ${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`តូចពេក៖ ត្រូវការ ${g.origin} ${z} ${g.minimum.toString()} ${J.unit}`;return`តូចពេក៖ ត្រូវការ ${g.origin} ${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;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`មិនត្រឹមត្រូវ៖ ${U[z.format]??g.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${g.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${A(g.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${g.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${g.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function vU(){return{localeError:KI()}}function Vb(){return vU()}var WI=()=>{let $={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`잘못된 입력: 예상 타입은 instanceof ${g.expected}, 받은 타입은 ${b}입니다`;return`잘못된 입력: 예상 타입은 ${z}, 받은 타입은 ${b}입니다`}case"invalid_value":if(g.values.length===1)return`잘못된 입력: 값은 ${D(g.values[0])} 이어야 합니다`;return`잘못된 옵션: ${A(g.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let z=g.inclusive?"이하":"미만",J=z==="미만"?"이어야 합니다":"여야 합니다",b=v(g.origin),O=b?.unit??"요소";if(b)return`${g.origin??"값"}이 너무 큽니다: ${g.maximum.toString()}${O} ${z}${J}`;return`${g.origin??"값"}이 너무 큽니다: ${g.maximum.toString()} ${z}${J}`}case"too_small":{let z=g.inclusive?"이상":"초과",J=z==="이상"?"이어야 합니다":"여야 합니다",b=v(g.origin),O=b?.unit??"요소";if(b)return`${g.origin??"값"}이 너무 작습니다: ${g.minimum.toString()}${O} ${z}${J}`;return`${g.origin??"값"}이 너무 작습니다: ${g.minimum.toString()} ${z}${J}`}case"invalid_format":{let z=g;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`잘못된 ${U[z.format]??g.format}`}case"not_multiple_of":return`잘못된 숫자: ${g.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${A(g.keys,", ")}`;case"invalid_key":return`잘못된 키: ${g.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${g.origin}`;default:return"잘못된 입력"}}};function Cb(){return{localeError:WI()}}var gU=($)=>{return $.charAt(0).toUpperCase()+$.slice(1)};function a5($){let v=Math.abs($),U=v%10,_=v%100;if(_>=11&&_<=19||U===0)return"many";if(U===1)return"one";return"few"}var BI=()=>{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(g,z,J,b){let O=$[g]??null;if(O===null)return O;return{unit:O.unit[z],verb:O.verb[b][J?"inclusive":"notInclusive"]}}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Gautas tipas ${b}, o tikėtasi - instanceof ${g.expected}`;return`Gautas tipas ${b}, o tikėtasi - ${z}`}case"invalid_value":if(g.values.length===1)return`Privalo būti ${D(g.values[0])}`;return`Privalo būti vienas iš ${A(g.values,"|")} pasirinkimų`;case"too_big":{let z=_[g.origin]??g.origin,J=v(g.origin,a5(Number(g.maximum)),g.inclusive??!1,"smaller");if(J?.verb)return`${gU(z??g.origin??"reikšmė")} ${J.verb} ${g.maximum.toString()} ${J.unit??"elementų"}`;let b=g.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${gU(z??g.origin??"reikšmė")} turi būti ${b} ${g.maximum.toString()} ${J?.unit}`}case"too_small":{let z=_[g.origin]??g.origin,J=v(g.origin,a5(Number(g.minimum)),g.inclusive??!1,"bigger");if(J?.verb)return`${gU(z??g.origin??"reikšmė")} ${J.verb} ${g.minimum.toString()} ${J.unit??"elementų"}`;let b=g.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${gU(z??g.origin??"reikšmė")} turi būti ${b} ${g.minimum.toString()} ${J?.unit}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Skaičius privalo būti ${g.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${g.keys.length>1?"i":"as"} rakt${g.keys.length>1?"ai":"as"}: ${A(g.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let z=_[g.origin]??g.origin;return`${gU(z??g.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function fb(){return{localeError:BI()}}var PI=()=>{let $={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Грешен внес: се очекува instanceof ${g.expected}, примено ${b}`;return`Грешен внес: се очекува ${z}, примено ${b}`}case"invalid_value":if(g.values.length===1)return`Invalid input: expected ${D(g.values[0])}`;return`Грешана опција: се очекува една ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Премногу голем: се очекува ${g.origin??"вредноста"} да има ${z}${g.maximum.toString()} ${J.unit??"елементи"}`;return`Премногу голем: се очекува ${g.origin??"вредноста"} да биде ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Премногу мал: се очекува ${g.origin} да има ${z}${g.minimum.toString()} ${J.unit}`;return`Премногу мал: се очекува ${g.origin} да биде ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${g.divisor}`;case"unrecognized_keys":return`${g.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${A(g.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${g.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${g.origin}`;default:return"Грешен внес"}}};function cb(){return{localeError:PI()}}var kI=()=>{let $={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Input tidak sah: dijangka instanceof ${g.expected}, diterima ${b}`;return`Input tidak sah: dijangka ${z}, diterima ${b}`}case"invalid_value":if(g.values.length===1)return`Input tidak sah: dijangka ${D(g.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Terlalu besar: dijangka ${g.origin??"nilai"} ${J.verb} ${z}${g.maximum.toString()} ${J.unit??"elemen"}`;return`Terlalu besar: dijangka ${g.origin??"nilai"} adalah ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Terlalu kecil: dijangka ${g.origin} ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`Terlalu kecil: dijangka ${g.origin} adalah ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`${U[z.format]??g.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${g.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${A(g.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${g.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${g.origin}`;default:return"Input tidak sah"}}};function mb(){return{localeError:kI()}}var HI=()=>{let $={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ongeldige invoer: verwacht instanceof ${g.expected}, ontving ${b}`;return`Ongeldige invoer: verwacht ${z}, ontving ${b}`}case"invalid_value":if(g.values.length===1)return`Ongeldige invoer: verwacht ${D(g.values[0])}`;return`Ongeldige optie: verwacht één van ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin),b=g.origin==="date"?"laat":g.origin==="string"?"lang":"groot";if(J)return`Te ${b}: verwacht dat ${g.origin??"waarde"} ${z}${g.maximum.toString()} ${J.unit??"elementen"} ${J.verb}`;return`Te ${b}: verwacht dat ${g.origin??"waarde"} ${z}${g.maximum.toString()} is`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin),b=g.origin==="date"?"vroeg":g.origin==="string"?"kort":"klein";if(J)return`Te ${b}: verwacht dat ${g.origin} ${z}${g.minimum.toString()} ${J.unit} ${J.verb}`;return`Te ${b}: verwacht dat ${g.origin} ${z}${g.minimum.toString()} is`}case"invalid_format":{let z=g;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: ${U[z.format]??g.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${g.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${g.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${g.origin}`;default:return"Ongeldige invoer"}}};function Eb(){return{localeError:HI()}}var LI=()=>{let $={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ugyldig input: forventet instanceof ${g.expected}, fikk ${b}`;return`Ugyldig input: forventet ${z}, fikk ${b}`}case"invalid_value":if(g.values.length===1)return`Ugyldig verdi: forventet ${D(g.values[0])}`;return`Ugyldig valg: forventet en av ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`For stor(t): forventet ${g.origin??"value"} til å ha ${z}${g.maximum.toString()} ${J.unit??"elementer"}`;return`For stor(t): forventet ${g.origin??"value"} til å ha ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`For lite(n): forventet ${g.origin} til å ha ${z}${g.minimum.toString()} ${J.unit}`;return`For lite(n): forventet ${g.origin} til å ha ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${g.divisor}`;case"unrecognized_keys":return`${g.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${A(g.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${g.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${g.origin}`;default:return"Ugyldig input"}}};function ib(){return{localeError:LI()}}var II=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Fâsit giren: umulan instanceof ${g.expected}, alınan ${b}`;return`Fâsit giren: umulan ${z}, alınan ${b}`}case"invalid_value":if(g.values.length===1)return`Fâsit giren: umulan ${D(g.values[0])}`;return`Fâsit tercih: mûteberler ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Fazla büyük: ${g.origin??"value"}, ${z}${g.maximum.toString()} ${J.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${g.origin??"value"}, ${z}${g.maximum.toString()} olmalıydı.`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Fazla küçük: ${g.origin}, ${z}${g.minimum.toString()} ${J.unit} sahip olmalıydı.`;return`Fazla küçük: ${g.origin}, ${z}${g.minimum.toString()} olmalıydı.`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Fâsit sayı: ${g.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${g.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function lb(){return{localeError:II()}}var YI=()=>{let $={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`ناسم ورودي: باید instanceof ${g.expected} وای, مګر ${b} ترلاسه شو`;return`ناسم ورودي: باید ${z} وای, مګر ${b} ترلاسه شو`}case"invalid_value":if(g.values.length===1)return`ناسم ورودي: باید ${D(g.values[0])} وای`;return`ناسم انتخاب: باید یو له ${A(g.values,"|")} څخه وای`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`ډیر لوی: ${g.origin??"ارزښت"} باید ${z}${g.maximum.toString()} ${J.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${g.origin??"ارزښت"} باید ${z}${g.maximum.toString()} وي`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`ډیر کوچنی: ${g.origin} باید ${z}${g.minimum.toString()} ${J.unit} ولري`;return`ډیر کوچنی: ${g.origin} باید ${z}${g.minimum.toString()} وي`}case"invalid_format":{let z=g;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`${U[z.format]??g.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${g.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${g.keys.length>1?"کلیډونه":"کلیډ"}: ${A(g.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${g.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${g.origin} کې`;default:return"ناسمه ورودي"}}};function hb(){return{localeError:YI()}}var qI=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${g.expected}, otrzymano ${b}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${z}, otrzymano ${b}`}case"invalid_value":if(g.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${D(g.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Za duża wartość: oczekiwano, że ${g.origin??"wartość"} będzie mieć ${z}${g.maximum.toString()} ${J.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${g.origin??"wartość"} będzie wynosić ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Za mała wartość: oczekiwano, że ${g.origin??"wartość"} będzie mieć ${z}${g.minimum.toString()} ${J.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${g.origin??"wartość"} będzie wynosić ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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) ${U[z.format]??g.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${g.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${g.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${g.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function xb(){return{localeError:qI()}}var FI=()=>{let $={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Tipo inválido: esperado instanceof ${g.expected}, recebido ${b}`;return`Tipo inválido: esperado ${z}, recebido ${b}`}case"invalid_value":if(g.values.length===1)return`Entrada inválida: esperado ${D(g.values[0])}`;return`Opção inválida: esperada uma das ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Muito grande: esperado que ${g.origin??"valor"} tivesse ${z}${g.maximum.toString()} ${J.unit??"elementos"}`;return`Muito grande: esperado que ${g.origin??"valor"} fosse ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Muito pequeno: esperado que ${g.origin} tivesse ${z}${g.minimum.toString()} ${J.unit}`;return`Muito pequeno: esperado que ${g.origin} fosse ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`${U[z.format]??g.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${g.divisor}`;case"unrecognized_keys":return`Chave${g.keys.length>1?"s":""} desconhecida${g.keys.length>1?"s":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Chave inválida em ${g.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${g.origin}`;default:return"Campo inválido"}}};function pb(){return{localeError:FI()}}function s5($,v,U,_){let g=Math.abs($),z=g%10,J=g%100;if(J>=11&&J<=19)return _;if(z===1)return v;if(z>=2&&z<=4)return U;return _}var XI=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Неверный ввод: ожидалось instanceof ${g.expected}, получено ${b}`;return`Неверный ввод: ожидалось ${z}, получено ${b}`}case"invalid_value":if(g.values.length===1)return`Неверный ввод: ожидалось ${D(g.values[0])}`;return`Неверный вариант: ожидалось одно из ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J){let b=Number(g.maximum),O=s5(b,J.unit.one,J.unit.few,J.unit.many);return`Слишком большое значение: ожидалось, что ${g.origin??"значение"} будет иметь ${z}${g.maximum.toString()} ${O}`}return`Слишком большое значение: ожидалось, что ${g.origin??"значение"} будет ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J){let b=Number(g.minimum),O=s5(b,J.unit.one,J.unit.few,J.unit.many);return`Слишком маленькое значение: ожидалось, что ${g.origin} будет иметь ${z}${g.minimum.toString()} ${O}`}return`Слишком маленькое значение: ожидалось, что ${g.origin} будет ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`Неверный ${U[z.format]??g.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${g.divisor}`;case"unrecognized_keys":return`Нераспознанн${g.keys.length>1?"ые":"ый"} ключ${g.keys.length>1?"и":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${g.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${g.origin}`;default:return"Неверные входные данные"}}};function ob(){return{localeError:XI()}}var wI=()=>{let $={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Neveljaven vnos: pričakovano instanceof ${g.expected}, prejeto ${b}`;return`Neveljaven vnos: pričakovano ${z}, prejeto ${b}`}case"invalid_value":if(g.values.length===1)return`Neveljaven vnos: pričakovano ${D(g.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Preveliko: pričakovano, da bo ${g.origin??"vrednost"} imelo ${z}${g.maximum.toString()} ${J.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${g.origin??"vrednost"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Premajhno: pričakovano, da bo ${g.origin} imelo ${z}${g.minimum.toString()} ${J.unit}`;return`Premajhno: pričakovano, da bo ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${g.divisor}`;case"unrecognized_keys":return`Neprepoznan${g.keys.length>1?"i ključi":" ključ"}: ${A(g.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${g.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${g.origin}`;default:return"Neveljaven vnos"}}};function nb(){return{localeError:wI()}}var AI=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ogiltig inmatning: förväntat instanceof ${g.expected}, fick ${b}`;return`Ogiltig inmatning: förväntat ${z}, fick ${b}`}case"invalid_value":if(g.values.length===1)return`Ogiltig inmatning: förväntat ${D(g.values[0])}`;return`Ogiltigt val: förväntade en av ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`För stor(t): förväntade ${g.origin??"värdet"} att ha ${z}${g.maximum.toString()} ${J.unit??"element"}`;return`För stor(t): förväntat ${g.origin??"värdet"} att ha ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`För lite(t): förväntade ${g.origin??"värdet"} att ha ${z}${g.minimum.toString()} ${J.unit}`;return`För lite(t): förväntade ${g.origin??"värdet"} att ha ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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) ${U[z.format]??g.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${g.divisor}`;case"unrecognized_keys":return`${g.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${A(g.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${g.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${g.origin??"värdet"}`;default:return"Ogiltig input"}}};function tb(){return{localeError:AI()}}var ZI=()=>{let $={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${g.expected}, பெறப்பட்டது ${b}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${z}, பெறப்பட்டது ${b}`}case"invalid_value":if(g.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${D(g.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${A(g.values,"|")} இல் ஒன்று`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${g.origin??"மதிப்பு"} ${z}${g.maximum.toString()} ${J.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${g.origin??"மதிப்பு"} ${z}${g.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${g.origin} ${z}${g.minimum.toString()} ${J.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${g.origin} ${z}${g.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let z=g;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`தவறான ${U[z.format]??g.format}`}case"not_multiple_of":return`தவறான எண்: ${g.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${g.keys.length>1?"கள்":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${g.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function db(){return{localeError:ZI()}}var MI=()=>{let $={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${g.expected} แต่ได้รับ ${b}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${z} แต่ได้รับ ${b}`}case"invalid_value":if(g.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${D(g.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"ไม่เกิน":"น้อยกว่า",J=v(g.origin);if(J)return`เกินกำหนด: ${g.origin??"ค่า"} ควรมี${z} ${g.maximum.toString()} ${J.unit??"รายการ"}`;return`เกินกำหนด: ${g.origin??"ค่า"} ควรมี${z} ${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?"อย่างน้อย":"มากกว่า",J=v(g.origin);if(J)return`น้อยกว่ากำหนด: ${g.origin} ควรมี${z} ${g.minimum.toString()} ${J.unit}`;return`น้อยกว่ากำหนด: ${g.origin} ควรมี${z} ${g.minimum.toString()}`}case"invalid_format":{let z=g;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`รูปแบบไม่ถูกต้อง: ${U[z.format]??g.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${g.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${A(g.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${g.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${g.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function ab(){return{localeError:MI()}}var SI=()=>{let $={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Geçersiz değer: beklenen instanceof ${g.expected}, alınan ${b}`;return`Geçersiz değer: beklenen ${z}, alınan ${b}`}case"invalid_value":if(g.values.length===1)return`Geçersiz değer: beklenen ${D(g.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Çok büyük: beklenen ${g.origin??"değer"} ${z}${g.maximum.toString()} ${J.unit??"öğe"}`;return`Çok büyük: beklenen ${g.origin??"değer"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Çok küçük: beklenen ${g.origin} ${z}${g.minimum.toString()} ${J.unit}`;return`Çok küçük: beklenen ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Geçersiz sayı: ${g.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${g.keys.length>1?"lar":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${g.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function sb(){return{localeError:SI()}}var QI=()=>{let $={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Неправильні вхідні дані: очікується instanceof ${g.expected}, отримано ${b}`;return`Неправильні вхідні дані: очікується ${z}, отримано ${b}`}case"invalid_value":if(g.values.length===1)return`Неправильні вхідні дані: очікується ${D(g.values[0])}`;return`Неправильна опція: очікується одне з ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Занадто велике: очікується, що ${g.origin??"значення"} ${J.verb} ${z}${g.maximum.toString()} ${J.unit??"елементів"}`;return`Занадто велике: очікується, що ${g.origin??"значення"} буде ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Занадто мале: очікується, що ${g.origin} ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`Занадто мале: очікується, що ${g.origin} буде ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`Неправильний ${U[z.format]??g.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${g.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${g.keys.length>1?"і":""}: ${A(g.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${g.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${g.origin}`;default:return"Неправильні вхідні дані"}}};function UU(){return{localeError:QI()}}function eb(){return UU()}var NI=()=>{let $={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`غلط ان پٹ: instanceof ${g.expected} متوقع تھا، ${b} موصول ہوا`;return`غلط ان پٹ: ${z} متوقع تھا، ${b} موصول ہوا`}case"invalid_value":if(g.values.length===1)return`غلط ان پٹ: ${D(g.values[0])} متوقع تھا`;return`غلط آپشن: ${A(g.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`بہت بڑا: ${g.origin??"ویلیو"} کے ${z}${g.maximum.toString()} ${J.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${g.origin??"ویلیو"} کا ${z}${g.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`بہت چھوٹا: ${g.origin} کے ${z}${g.minimum.toString()} ${J.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${g.origin} کا ${z}${g.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let z=g;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`غلط ${U[z.format]??g.format}`}case"not_multiple_of":return`غلط نمبر: ${g.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${g.keys.length>1?"ز":""}: ${A(g.keys,"، ")}`;case"invalid_key":return`${g.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${g.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function $8(){return{localeError:NI()}}var rI=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${g.expected}, qabul qilingan ${b}`;return`Noto‘g‘ri kirish: kutilgan ${z}, qabul qilingan ${b}`}case"invalid_value":if(g.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${D(g.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Juda katta: kutilgan ${g.origin??"qiymat"} ${z}${g.maximum.toString()} ${J.unit} ${J.verb}`;return`Juda katta: kutilgan ${g.origin??"qiymat"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Juda kichik: kutilgan ${g.origin} ${z}${g.minimum.toString()} ${J.unit} ${J.verb}`;return`Juda kichik: kutilgan ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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 ${U[z.format]??g.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${g.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${g.keys.length>1?"lar":""}: ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${g.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function v8(){return{localeError:rI()}}var uI=()=>{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(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${g.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(g.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${D(g.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Quá lớn: mong đợi ${g.origin??"giá trị"} ${J.verb} ${z}${g.maximum.toString()} ${J.unit??"phần tử"}`;return`Quá lớn: mong đợi ${g.origin??"giá trị"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Quá nhỏ: mong đợi ${g.origin} ${J.verb} ${z}${g.minimum.toString()} ${J.unit}`;return`Quá nhỏ: mong đợi ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`${U[z.format]??g.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 ${g.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${A(g.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${g.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 ${g.origin}`;default:return"Đầu vào không hợp lệ"}}};function g8(){return{localeError:uI()}}var yI=()=>{let $={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`无效输入:期望 instanceof ${g.expected},实际接收 ${b}`;return`无效输入:期望 ${z},实际接收 ${b}`}case"invalid_value":if(g.values.length===1)return`无效输入:期望 ${D(g.values[0])}`;return`无效选项:期望以下之一 ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`数值过大:期望 ${g.origin??"值"} ${z}${g.maximum.toString()} ${J.unit??"个元素"}`;return`数值过大:期望 ${g.origin??"值"} ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`数值过小:期望 ${g.origin} ${z}${g.minimum.toString()} ${J.unit}`;return`数值过小:期望 ${g.origin} ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`无效${U[z.format]??g.format}`}case"not_multiple_of":return`无效数字:必须是 ${g.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${A(g.keys,", ")}`;case"invalid_key":return`${g.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${g.origin} 中包含无效值(value)`;default:return"无效输入"}}};function U8(){return{localeError:yI()}}var DI=()=>{let $={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`無效的輸入值:預期為 instanceof ${g.expected},但收到 ${b}`;return`無效的輸入值:預期為 ${z},但收到 ${b}`}case"invalid_value":if(g.values.length===1)return`無效的輸入值:預期為 ${D(g.values[0])}`;return`無效的選項:預期為以下其中之一 ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`數值過大:預期 ${g.origin??"值"} 應為 ${z}${g.maximum.toString()} ${J.unit??"個元素"}`;return`數值過大:預期 ${g.origin??"值"} 應為 ${z}${g.maximum.toString()}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`數值過小:預期 ${g.origin} 應為 ${z}${g.minimum.toString()} ${J.unit}`;return`數值過小:預期 ${g.origin} 應為 ${z}${g.minimum.toString()}`}case"invalid_format":{let z=g;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`無效的 ${U[z.format]??g.format}`}case"not_multiple_of":return`無效的數字:必須為 ${g.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${g.keys.length>1?"們":""}:${A(g.keys,"、")}`;case"invalid_key":return`${g.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${g.origin} 中有無效的值`;default:return"無效的輸入值"}}};function _8(){return{localeError:DI()}}var RI=()=>{let $={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function v(g){return $[g]??null}let U={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(g)=>{switch(g.code){case"invalid_type":{let z=_[g.expected]??g.expected,J=R(g.input),b=_[J]??J;if(/^[A-Z]/.test(g.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${g.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(g.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${D(g.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${A(g.values,"|")}`;case"too_big":{let z=g.inclusive?"<=":"<",J=v(g.origin);if(J)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${g.origin??"iye"} ${J.verb} ${z}${g.maximum} ${J.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${z}${g.maximum}`}case"too_small":{let z=g.inclusive?">=":">",J=v(g.origin);if(J)return`Kéré ju: a ní láti jẹ́ pé ${g.origin} ${J.verb} ${z}${g.minimum} ${J.unit}`;return`Kéré ju: a ní láti jẹ́ ${z}${g.minimum}`}case"invalid_format":{let z=g;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: ${U[z.format]??g.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${g.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${A(g.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${g.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${g.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function z8(){return{localeError:RI()}}var e5,J8=Symbol("ZodOutput"),b8=Symbol("ZodInput");class G8{constructor(){this._map=new WeakMap,this._idmap=new Map}add($,...v){let U=v[0];if(this._map.set($,U),U&&typeof U==="object"&&"id"in U)this._idmap.set(U.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 U={...this.get(v)??{}};delete U.id;let _={...U,...this._map.get($)};return Object.keys(_).length?_:void 0}return this._map.get($)}has($){return this._map.has($)}}function k1(){return new G8}(e5=globalThis).__zod_globalRegistry??(e5.__zod_globalRegistry=k1());var e$=globalThis.__zod_globalRegistry;function O8($,v){return new $({type:"string",...V(v)})}function K8($,v){return new $({type:"string",coerce:!0,...V(v)})}function H1($,v){return new $({type:"string",format:"email",check:"string_format",abort:!1,...V(v)})}function zU($,v){return new $({type:"string",format:"guid",check:"string_format",abort:!1,...V(v)})}function L1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,...V(v)})}function I1($,v){return new $({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...V(v)})}function Y1($,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 JU($,v){return new $({type:"string",format:"url",check:"string_format",abort:!1,...V(v)})}function F1($,v){return new $({type:"string",format:"emoji",check:"string_format",abort:!1,...V(v)})}function X1($,v){return new $({type:"string",format:"nanoid",check:"string_format",abort:!1,...V(v)})}function w1($,v){return new $({type:"string",format:"cuid",check:"string_format",abort:!1,...V(v)})}function A1($,v){return new $({type:"string",format:"cuid2",check:"string_format",abort:!1,...V(v)})}function Z1($,v){return new $({type:"string",format:"ulid",check:"string_format",abort:!1,...V(v)})}function M1($,v){return new $({type:"string",format:"xid",check:"string_format",abort:!1,...V(v)})}function S1($,v){return new $({type:"string",format:"ksuid",check:"string_format",abort:!1,...V(v)})}function Q1($,v){return new $({type:"string",format:"ipv4",check:"string_format",abort:!1,...V(v)})}function N1($,v){return new $({type:"string",format:"ipv6",check:"string_format",abort:!1,...V(v)})}function W8($,v){return new $({type:"string",format:"mac",check:"string_format",abort:!1,...V(v)})}function r1($,v){return new $({type:"string",format:"cidrv4",check:"string_format",abort:!1,...V(v)})}function u1($,v){return new $({type:"string",format:"cidrv6",check:"string_format",abort:!1,...V(v)})}function y1($,v){return new $({type:"string",format:"base64",check:"string_format",abort:!1,...V(v)})}function D1($,v){return new $({type:"string",format:"base64url",check:"string_format",abort:!1,...V(v)})}function R1($,v){return new $({type:"string",format:"e164",check:"string_format",abort:!1,...V(v)})}function T1($,v){return new $({type:"string",format:"jwt",check:"string_format",abort:!1,...V(v)})}var B8={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function P8($,v){return new $({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...V(v)})}function k8($,v){return new $({type:"string",format:"date",check:"string_format",...V(v)})}function H8($,v){return new $({type:"string",format:"time",check:"string_format",precision:null,...V(v)})}function L8($,v){return new $({type:"string",format:"duration",check:"string_format",...V(v)})}function I8($,v){return new $({type:"number",checks:[],...V(v)})}function Y8($,v){return new $({type:"number",coerce:!0,checks:[],...V(v)})}function q8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"safeint",...V(v)})}function F8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float32",...V(v)})}function X8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"float64",...V(v)})}function w8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"int32",...V(v)})}function A8($,v){return new $({type:"number",check:"number_format",abort:!1,format:"uint32",...V(v)})}function Z8($,v){return new $({type:"boolean",...V(v)})}function M8($,v){return new $({type:"boolean",coerce:!0,...V(v)})}function S8($,v){return new $({type:"bigint",...V(v)})}function Q8($,v){return new $({type:"bigint",coerce:!0,...V(v)})}function N8($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...V(v)})}function r8($,v){return new $({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...V(v)})}function u8($,v){return new $({type:"symbol",...V(v)})}function y8($,v){return new $({type:"undefined",...V(v)})}function D8($,v){return new $({type:"null",...V(v)})}function R8($){return new $({type:"any"})}function T8($){return new $({type:"unknown"})}function j8($,v){return new $({type:"never",...V(v)})}function V8($,v){return new $({type:"void",...V(v)})}function C8($,v){return new $({type:"date",...V(v)})}function f8($,v){return new $({type:"date",coerce:!0,...V(v)})}function c8($,v){return new $({type:"nan",...V(v)})}function ov($,v){return new g1({check:"less_than",...V(v),value:$,inclusive:!1})}function Nv($,v){return new g1({check:"less_than",...V(v),value:$,inclusive:!0})}function nv($,v){return new U1({check:"greater_than",...V(v),value:$,inclusive:!1})}function Hv($,v){return new U1({check:"greater_than",...V(v),value:$,inclusive:!0})}function j1($){return nv(0,$)}function V1($){return ov(0,$)}function C1($){return Nv(0,$)}function f1($){return Hv(0,$)}function y6($,v){return new cz({check:"multiple_of",...V(v),value:$})}function D6($,v){return new iz({check:"max_size",...V(v),maximum:$})}function tv($,v){return new lz({check:"min_size",...V(v),minimum:$})}function g4($,v){return new hz({check:"size_equals",...V(v),size:$})}function U4($,v){return new xz({check:"max_length",...V(v),maximum:$})}function G6($,v){return new pz({check:"min_length",...V(v),minimum:$})}function _4($,v){return new oz({check:"length_equals",...V(v),length:$})}function E4($,v){return new nz({check:"string_format",format:"regex",...V(v),pattern:$})}function i4($){return new tz({check:"string_format",format:"lowercase",...V($)})}function l4($){return new dz({check:"string_format",format:"uppercase",...V($)})}function h4($,v){return new az({check:"string_format",format:"includes",...V(v),includes:$})}function x4($,v){return new sz({check:"string_format",format:"starts_with",...V(v),prefix:$})}function p4($,v){return new ez({check:"string_format",format:"ends_with",...V(v),suffix:$})}function c1($,v,U){return new $J({check:"property",property:$,schema:v,...V(U)})}function o4($,v){return new vJ({check:"mime_type",mime:$,...V(v)})}function cv($){return new gJ({check:"overwrite",tx:$})}function n4($){return cv((v)=>v.normalize($))}function t4(){return cv(($)=>$.trim())}function d4(){return cv(($)=>$.toLowerCase())}function a4(){return cv(($)=>$.toUpperCase())}function s4(){return cv(($)=>gz($))}function m8($,v,U){return new $({type:"array",element:v,...V(U)})}function jI($,v,U){return new $({type:"union",options:v,...V(U)})}function VI($,v,U){return new $({type:"union",options:v,inclusive:!1,...V(U)})}function CI($,v,U,_){return new $({type:"union",options:U,discriminator:v,...V(_)})}function fI($,v,U){return new $({type:"intersection",left:v,right:U})}function cI($,v,U,_){let g=U instanceof $$;return new $({type:"tuple",items:v,rest:g?U:null,...V(g?_:U)})}function mI($,v,U,_){return new $({type:"record",keyType:v,valueType:U,...V(_)})}function EI($,v,U,_){return new $({type:"map",keyType:v,valueType:U,...V(_)})}function iI($,v,U){return new $({type:"set",valueType:v,...V(U)})}function lI($,v,U){let _=Array.isArray(v)?Object.fromEntries(v.map((g)=>[g,g])):v;return new $({type:"enum",entries:_,...V(U)})}function hI($,v,U){return new $({type:"enum",entries:v,...V(U)})}function xI($,v,U){return new $({type:"literal",values:Array.isArray(v)?v:[v],...V(U)})}function E8($,v){return new $({type:"file",...V(v)})}function pI($,v){return new $({type:"transform",transform:v})}function oI($,v){return new $({type:"optional",innerType:v})}function nI($,v){return new $({type:"nullable",innerType:v})}function tI($,v,U){return new $({type:"default",innerType:v,get defaultValue(){return typeof U==="function"?U():_z(U)}})}function dI($,v,U){return new $({type:"nonoptional",innerType:v,...V(U)})}function aI($,v){return new $({type:"success",innerType:v})}function sI($,v,U){return new $({type:"catch",innerType:v,catchValue:typeof U==="function"?U:()=>U})}function eI($,v,U){return new $({type:"pipe",in:v,out:U})}function $Y($,v){return new $({type:"readonly",innerType:v})}function vY($,v,U){return new $({type:"template_literal",parts:v,...V(U)})}function gY($,v){return new $({type:"lazy",getter:v})}function UY($,v){return new $({type:"promise",innerType:v})}function i8($,v,U){let _=V(U);return _.abort??(_.abort=!0),new $({type:"custom",check:"custom",fn:v,..._})}function l8($,v,U){return new $({type:"custom",check:"custom",fn:v,...V(U)})}function h8($){let v=$7((U)=>{return U.addIssue=(_)=>{if(typeof _==="string")U.issues.push(R4(_,U.value,v._zod.def));else{let g=_;if(g.fatal)g.continue=!1;g.code??(g.code="custom"),g.input??(g.input=U.value),g.inst??(g.inst=v),g.continue??(g.continue=!v._zod.def.abort),U.issues.push(R4(g))}},$(U.value,U)});return v}function $7($,v){let U=new Q$({check:"custom",...V(v)});return U._zod.check=$,U}function x8($){let v=new Q$({check:"describe"});return v._zod.onattach=[(U)=>{let _=e$.get(U)??{};e$.add(U,{..._,description:$})}],v._zod.check=()=>{},v}function p8($){let v=new Q$({check:"meta"});return v._zod.onattach=[(U)=>{let _=e$.get(U)??{};e$.add(U,{..._,...$})}],v._zod.check=()=>{},v}function o8($,v){let U=V(v),_=U.truthy??["true","1","yes","on","y","enabled"],g=U.falsy??["false","0","no","off","n","disabled"];if(U.case!=="sensitive")_=_.map((P)=>typeof P==="string"?P.toLowerCase():P),g=g.map((P)=>typeof P==="string"?P.toLowerCase():P);let z=new Set(_),J=new Set(g),b=$.Codec??eg,O=$.Boolean??ag,W=new($.String??v4)({type:"string",error:U.error}),B=new O({type:"boolean",error:U.error}),k=new b({type:"pipe",in:W,out:B,transform:(P,F)=>{let I=P;if(U.case!=="sensitive")I=I.toLowerCase();if(z.has(I))return!0;else if(J.has(I))return!1;else return F.issues.push({code:"invalid_value",expected:"stringbool",values:[...z,...J],input:F.value,inst:k,continue:!1}),{}},reverseTransform:(P,F)=>{if(P===!0)return _[0]||"true";else return g[0]||"false"},error:U.error});return k}function e4($,v,U,_={}){let g=V(_),z={...V(_),check:"string_format",type:"string",format:v,fn:typeof U==="function"?U:(b)=>U.test(b),...g};if(U instanceof RegExp)z.pattern=U;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??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 X$($,v,U={path:[],schemaPath:[]}){var _;let g=$._zod.def,z=v.seen.get($);if(z){if(z.count++,U.schemaPath.includes($))z.cycle=U.path;return z.schema}let J={schema:{},count:1,cycle:void 0,path:U.path};v.seen.set($,J);let b=$._zod.toJSONSchema?.();if(b)J.schema=b;else{let W={...U,schemaPath:[...U.schemaPath,$],path:U.path};if($._zod.processJSONSchema)$._zod.processJSONSchema(v,J.schema,W);else{let k=J.schema,P=v.processors[g.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${g.type}`);P($,v,k,W)}let B=$._zod.parent;if(B){if(!J.ref)J.ref=B;X$(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"&&Lv($))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 T6($,v){let U=$.seen.get(v);if(!U)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 g=(J)=>{let b=$.target==="draft-2020-12"?"$defs":"definitions";if($.external){let B=$.external.registry.get(J[0])?.id,k=$.external.uri??((F)=>F);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]===U)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}=g(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 j6($,v){let U=$.seen.get(v);if(!U)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 I in O){if(I==="$ref"||I==="allOf")continue;if(!(I in K))delete O[I]}if(P.$ref&&k.def)for(let I in O){if(I==="$ref"||I==="allOf")continue;if(I in k.def&&JSON.stringify(O[I])===JSON.stringify(k.def[I]))delete O[I]}}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 g={};if($.target==="draft-2020-12")g.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")g.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")g.$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");g.$id=$.external.uri(J)}Object.assign(g,U.def??U.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")g.$defs=z;else g.definitions=z;try{let J=JSON.parse(JSON.stringify(g));return Object.defineProperty(J,"~standard",{value:{...v["~standard"],jsonSchema:{input:$g(v,"input",$.processors),output:$g(v,"output",$.processors)}},enumerable:!1,writable:!1}),J}catch(J){throw Error("Error converting schema to JSON.")}}function Lv($,v){let U=v??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let _=$._zod.def;if(_.type==="transform")return!0;if(_.type==="array")return Lv(_.element,U);if(_.type==="set")return Lv(_.valueType,U);if(_.type==="lazy")return Lv(_.getter(),U);if(_.type==="promise"||_.type==="optional"||_.type==="nonoptional"||_.type==="nullable"||_.type==="readonly"||_.type==="default"||_.type==="prefault")return Lv(_.innerType,U);if(_.type==="intersection")return Lv(_.left,U)||Lv(_.right,U);if(_.type==="record"||_.type==="map")return Lv(_.keyType,U)||Lv(_.valueType,U);if(_.type==="pipe")return Lv(_.in,U)||Lv(_.out,U);if(_.type==="object"){for(let g in _.shape)if(Lv(_.shape[g],U))return!0;return!1}if(_.type==="union"){for(let g of _.options)if(Lv(g,U))return!0;return!1}if(_.type==="tuple"){for(let g of _.items)if(Lv(g,U))return!0;if(_.rest&&Lv(_.rest,U))return!0;return!1}return!1}var n8=($,v={})=>(U)=>{let _=R6({...U,processors:v});return X$($,_),T6(_,$),j6(_,$)},$g=($,v,U={})=>(_)=>{let{libraryOptions:g,target:z}=_??{},J=R6({...g??{},target:z,io:v,processors:U});return X$($,J),T6(J,$),j6(J,$)};var _Y={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},t8=($,v,U,_)=>{let g=U;g.type="string";let{minimum:z,maximum:J,format:b,patterns:O,contentEncoding:K}=$._zod.bag;if(typeof z==="number")g.minLength=z;if(typeof J==="number")g.maxLength=J;if(b){if(g.format=_Y[b]??b,g.format==="")delete g.format;if(b==="time")delete g.format}if(K)g.contentEncoding=K;if(O&&O.size>0){let W=[...O];if(W.length===1)g.pattern=W[0].source;else if(W.length>1)g.allOf=[...W.map((B)=>({...v.target==="draft-07"||v.target==="draft-04"||v.target==="openapi-3.0"?{type:"string"}:{},pattern:B.source}))]}},d8=($,v,U,_)=>{let g=U,{minimum:z,maximum:J,format:b,multipleOf:O,exclusiveMaximum:K,exclusiveMinimum:W}=$._zod.bag;if(typeof b==="string"&&b.includes("int"))g.type="integer";else g.type="number";if(typeof W==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")g.minimum=W,g.exclusiveMinimum=!0;else g.exclusiveMinimum=W;if(typeof z==="number"){if(g.minimum=z,typeof W==="number"&&v.target!=="draft-04")if(W>=z)delete g.minimum;else delete g.exclusiveMinimum}if(typeof K==="number")if(v.target==="draft-04"||v.target==="openapi-3.0")g.maximum=K,g.exclusiveMaximum=!0;else g.exclusiveMaximum=K;if(typeof J==="number"){if(g.maximum=J,typeof K==="number"&&v.target!=="draft-04")if(K<=J)delete g.maximum;else delete g.exclusiveMaximum}if(typeof O==="number")g.multipleOf=O},a8=($,v,U,_)=>{U.type="boolean"},s8=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},e8=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},$9=($,v,U,_)=>{if(v.target==="openapi-3.0")U.type="string",U.nullable=!0,U.enum=[null];else U.type="null"},v9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},g9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},U9=($,v,U,_)=>{U.not={}},_9=($,v,U,_)=>{},z9=($,v,U,_)=>{},J9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},b9=($,v,U,_)=>{let g=$._zod.def,z=Cg(g.entries);if(z.every((J)=>typeof J==="number"))U.type="number";if(z.every((J)=>typeof J==="string"))U.type="string";U.enum=z},G9=($,v,U,_)=>{let g=$._zod.def,z=[];for(let J of g.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(U.type=J===null?"null":typeof J,v.target==="draft-04"||v.target==="openapi-3.0")U.enum=[J];else U.const=J}else{if(z.every((J)=>typeof J==="number"))U.type="number";if(z.every((J)=>typeof J==="string"))U.type="string";if(z.every((J)=>typeof J==="boolean"))U.type="boolean";if(z.every((J)=>J===null))U.type="null";U.enum=z}},O9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},K9=($,v,U,_)=>{let g=U,z=$._zod.pattern;if(!z)throw Error("Pattern not found in template literal");g.type="string",g.pattern=z.source},W9=($,v,U,_)=>{let g=U,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(g,z);else Object.assign(g,z),g.anyOf=O.map((K)=>({contentMediaType:K}));else Object.assign(g,z)},B9=($,v,U,_)=>{U.type="boolean"},P9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},k9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},H9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},L9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},I9=($,v,U,_)=>{if(v.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Y9=($,v,U,_)=>{let g=U,z=$._zod.def,{minimum:J,maximum:b}=$._zod.bag;if(typeof J==="number")g.minItems=J;if(typeof b==="number")g.maxItems=b;g.type="array",g.items=X$(z.element,v,{..._,path:[..._.path,"items"]})},q9=($,v,U,_)=>{let g=U,z=$._zod.def;g.type="object",g.properties={};let J=z.shape;for(let K in J)g.properties[K]=X$(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)g.required=Array.from(O);if(z.catchall?._zod.def.type==="never")g.additionalProperties=!1;else if(!z.catchall){if(v.io==="output")g.additionalProperties=!1}else if(z.catchall)g.additionalProperties=X$(z.catchall,v,{..._,path:[..._.path,"additionalProperties"]})},E1=($,v,U,_)=>{let g=$._zod.def,z=g.inclusive===!1,J=g.options.map((b,O)=>X$(b,v,{..._,path:[..._.path,z?"oneOf":"anyOf",O]}));if(z)U.oneOf=J;else U.anyOf=J},F9=($,v,U,_)=>{let g=$._zod.def,z=X$(g.left,v,{..._,path:[..._.path,"allOf",0]}),J=X$(g.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]];U.allOf=O},X9=($,v,U,_)=>{let g=U,z=$._zod.def;g.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)=>X$(k,v,{..._,path:[..._.path,J,P]})),K=z.rest?X$(z.rest,v,{..._,path:[..._.path,b,...v.target==="openapi-3.0"?[z.items.length]:[]]}):null;if(v.target==="draft-2020-12"){if(g.prefixItems=O,K)g.items=K}else if(v.target==="openapi-3.0"){if(g.items={anyOf:O},K)g.items.anyOf.push(K);if(g.minItems=O.length,!K)g.maxItems=O.length}else if(g.items=O,K)g.additionalItems=K;let{minimum:W,maximum:B}=$._zod.bag;if(typeof W==="number")g.minItems=W;if(typeof B==="number")g.maxItems=B},w9=($,v,U,_)=>{let g=U,z=$._zod.def;g.type="object";let J=z.keyType,O=J._zod.bag?.patterns;if(z.mode==="loose"&&O&&O.size>0){let W=X$(z.valueType,v,{..._,path:[..._.path,"patternProperties","*"]});g.patternProperties={};for(let B of O)g.patternProperties[B.source]=W}else{if(v.target==="draft-07"||v.target==="draft-2020-12")g.propertyNames=X$(z.keyType,v,{..._,path:[..._.path,"propertyNames"]});g.additionalProperties=X$(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)g.required=W}},A9=($,v,U,_)=>{let g=$._zod.def,z=X$(g.innerType,v,_),J=v.seen.get($);if(v.target==="openapi-3.0")J.ref=g.innerType,U.nullable=!0;else U.anyOf=[z,{type:"null"}]},Z9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType},M9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType,U.default=JSON.parse(JSON.stringify(g.defaultValue))},S9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);if(z.ref=g.innerType,v.io==="input")U._prefault=JSON.parse(JSON.stringify(g.defaultValue))},Q9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType;let J;try{J=g.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}U.default=J},N9=($,v,U,_)=>{let g=$._zod.def,z=v.io==="input"?g.in._zod.def.type==="transform"?g.out:g.in:g.out;X$(z,v,_);let J=v.seen.get($);J.ref=z},r9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType,U.readOnly=!0},u9=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType},i1=($,v,U,_)=>{let g=$._zod.def;X$(g.innerType,v,_);let z=v.seen.get($);z.ref=g.innerType},y9=($,v,U,_)=>{let g=$._zod.innerType;X$(g,v,_);let z=v.seen.get($);z.ref=g},m1={string:t8,number:d8,boolean:a8,bigint:s8,symbol:e8,null:$9,undefined:v9,void:g9,never:U9,any:_9,unknown:z9,date:J9,enum:b9,literal:G9,nan:O9,template_literal:K9,file:W9,success:B9,custom:P9,function:k9,transform:H9,map:L9,set:I9,array:Y9,object:q9,union:E1,intersection:F9,tuple:X9,record:w9,nullable:A9,nonoptional:Z9,default:M9,prefault:S9,catch:Q9,pipe:N9,readonly:r9,promise:u9,optional:i1,lazy:y9};function l1($,v){if("_idmap"in $){let _=$,g=R6({...v,processors:m1}),z={};for(let O of _._idmap.entries()){let[K,W]=O;X$(W,g)}let J={},b={registry:_,uri:v?.uri,defs:z};g.external=b;for(let O of _._idmap.entries()){let[K,W]=O;T6(g,W),J[K]=j6(g,W)}if(Object.keys(z).length>0){let O=g.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[O]:z}}return{schemas:J}}let U=R6({...v,processors:m1});return X$($,U),T6(U,$),j6(U,$)}class D9{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:m1,target:v,...$?.metadata&&{metadata:$.metadata},...$?.unrepresentable&&{unrepresentable:$.unrepresentable},...$?.override&&{override:$.override},...$?.io&&{io:$.io}})}process($,v={path:[],schemaPath:[]}){return X$($,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}T6(this.ctx,$);let U=j6(this.ctx,$),{"~standard":_,...g}=U;return g}}var v7={};var bU={};ev(bU,{xor:()=>x7,xid:()=>L7,void:()=>E7,uuidv7:()=>G7,uuidv6:()=>b7,uuidv4:()=>J7,uuid:()=>z7,url:()=>O7,unknown:()=>S$,union:()=>A$,undefined:()=>c7,ulid:()=>H7,uint64:()=>C7,uint32:()=>T7,tuple:()=>GG,transform:()=>H0,templateLiteral:()=>gW,symbol:()=>f7,superRefine:()=>TG,success:()=>e7,stringbool:()=>OW,stringFormat:()=>Q7,string:()=>Z,strictObject:()=>h7,set:()=>t7,refine:()=>RG,record:()=>N$,readonly:()=>QG,promise:()=>UW,preprocess:()=>YU,prefault:()=>FG,pipe:()=>KU,partialRecord:()=>p7,optional:()=>y$,object:()=>h,number:()=>I$,nullish:()=>s7,nullable:()=>OU,null:()=>bg,nonoptional:()=>XG,never:()=>k0,nativeEnum:()=>d7,nanoid:()=>B7,nan:()=>$W,meta:()=>bW,map:()=>n7,mac:()=>q7,looseRecord:()=>o7,looseObject:()=>$v,literal:()=>t,lazy:()=>uG,ksuid:()=>I7,keyof:()=>l7,jwt:()=>S7,json:()=>KW,ipv6:()=>F7,ipv4:()=>Y7,intersection:()=>Gg,int64:()=>V7,int32:()=>R7,int:()=>t1,instanceof:()=>GW,httpUrl:()=>K7,hostname:()=>N7,hex:()=>r7,hash:()=>u7,guid:()=>_7,function:()=>_W,float64:()=>D7,float32:()=>y7,file:()=>a7,exactOptional:()=>HG,enum:()=>vv,emoji:()=>W7,email:()=>U7,e164:()=>M7,discriminatedUnion:()=>HU,describe:()=>JW,date:()=>i7,custom:()=>F0,cuid2:()=>k7,cuid:()=>P7,codec:()=>vW,cidrv6:()=>w7,cidrv4:()=>X7,check:()=>zW,catch:()=>ZG,boolean:()=>h$,bigint:()=>j7,base64url:()=>Z7,base64:()=>A7,array:()=>J$,any:()=>m7,_function:()=>_W,_default:()=>YG,_ZodString:()=>d1,ZodXor:()=>_G,ZodXID:()=>U0,ZodVoid:()=>gG,ZodUnknown:()=>$G,ZodUnion:()=>kU,ZodUndefined:()=>a9,ZodUUID:()=>dv,ZodURL:()=>WU,ZodULID:()=>g0,ZodType:()=>_$,ZodTuple:()=>bG,ZodTransform:()=>PG,ZodTemplateLiteral:()=>NG,ZodSymbol:()=>d9,ZodSuccess:()=>wG,ZodStringFormat:()=>M$,ZodString:()=>gg,ZodSet:()=>KG,ZodRecord:()=>LU,ZodReadonly:()=>SG,ZodPromise:()=>yG,ZodPrefault:()=>qG,ZodPipe:()=>Y0,ZodOptional:()=>L0,ZodObject:()=>PU,ZodNumberFormat:()=>z4,ZodNumber:()=>_g,ZodNullable:()=>LG,ZodNull:()=>s9,ZodNonOptional:()=>I0,ZodNever:()=>vG,ZodNanoID:()=>e1,ZodNaN:()=>MG,ZodMap:()=>OG,ZodMAC:()=>t9,ZodLiteral:()=>WG,ZodLazy:()=>rG,ZodKSUID:()=>_0,ZodJWT:()=>B0,ZodIntersection:()=>JG,ZodIPv6:()=>J0,ZodIPv4:()=>z0,ZodGUID:()=>GU,ZodFunction:()=>DG,ZodFile:()=>BG,ZodExactOptional:()=>kG,ZodEnum:()=>vg,ZodEmoji:()=>s1,ZodEmail:()=>a1,ZodE164:()=>W0,ZodDiscriminatedUnion:()=>zG,ZodDefault:()=>IG,ZodDate:()=>BU,ZodCustomStringFormat:()=>Ug,ZodCustom:()=>IU,ZodCodec:()=>q0,ZodCatch:()=>AG,ZodCUID2:()=>v0,ZodCUID:()=>$0,ZodCIDRv6:()=>G0,ZodCIDRv4:()=>b0,ZodBoolean:()=>zg,ZodBigIntFormat:()=>P0,ZodBigInt:()=>Jg,ZodBase64URL:()=>K0,ZodBase64:()=>O0,ZodArray:()=>UG,ZodAny:()=>e9});var h1={};ev(h1,{uppercase:()=>l4,trim:()=>t4,toUpperCase:()=>a4,toLowerCase:()=>d4,startsWith:()=>x4,slugify:()=>s4,size:()=>g4,regex:()=>E4,property:()=>c1,positive:()=>j1,overwrite:()=>cv,normalize:()=>n4,nonpositive:()=>C1,nonnegative:()=>f1,negative:()=>V1,multipleOf:()=>y6,minSize:()=>tv,minLength:()=>G6,mime:()=>o4,maxSize:()=>D6,maxLength:()=>U4,lte:()=>Nv,lt:()=>ov,lowercase:()=>i4,length:()=>_4,includes:()=>h4,gte:()=>Hv,gt:()=>nv,endsWith:()=>p4});var V6={};ev(V6,{time:()=>j9,duration:()=>V9,datetime:()=>R9,date:()=>T9,ZodISOTime:()=>o1,ZodISODuration:()=>n1,ZodISODateTime:()=>x1,ZodISODate:()=>p1});var x1=X("ZodISODateTime",($,v)=>{LJ.init($,v),M$.init($,v)});function R9($){return P8(x1,$)}var p1=X("ZodISODate",($,v)=>{IJ.init($,v),M$.init($,v)});function T9($){return k8(p1,$)}var o1=X("ZodISOTime",($,v)=>{YJ.init($,v),M$.init($,v)});function j9($){return H8(o1,$)}var n1=X("ZodISODuration",($,v)=>{qJ.init($,v),M$.init($,v)});function V9($){return L8(n1,$)}var g7=($,v)=>{ig.init($,v),$.name="ZodError",Object.defineProperties($,{format:{value:(U)=>hg($,U)},flatten:{value:(U)=>lg($,U)},addIssue:{value:(U)=>{$.issues.push(U),$.message=JSON.stringify($.issues,y4,2)}},addIssues:{value:(U)=>{$.issues.push(...U),$.message=JSON.stringify($.issues,y4,2)}},isEmpty:{get(){return $.issues.length===0}}})},JY=X("ZodError",g7),wv=X("ZodError",g7,{Parent:Error});var C9=T4(wv),f9=j4(wv),c9=V4(wv),m9=f4(wv),E9=o_(wv),i9=n_(wv),l9=t_(wv),h9=d_(wv),x9=a_(wv),p9=s_(wv),o9=e_(wv),n9=$1(wv);var _$=X("ZodType",($,v)=>{return $$.init($,v),Object.assign($["~standard"],{jsonSchema:{input:$g($,"input"),output:$g($,"output")}}),$.toJSONSchema=n8($,{}),$.def=v,$.type=v.type,Object.defineProperty($,"_def",{value:v}),$.check=(...U)=>{return $.clone(j.mergeDefs(v,{checks:[...v.checks??[],...U.map((_)=>typeof _==="function"?{_zod:{check:_,def:{check:"custom"},onattach:[]}}:_)]}),{parent:!0})},$.with=$.check,$.clone=(U,_)=>kv($,U,_),$.brand=()=>$,$.register=(U,_)=>{return U.add($,_),$},$.parse=(U,_)=>C9($,U,_,{callee:$.parse}),$.safeParse=(U,_)=>c9($,U,_),$.parseAsync=async(U,_)=>f9($,U,_,{callee:$.parseAsync}),$.safeParseAsync=async(U,_)=>m9($,U,_),$.spa=$.safeParseAsync,$.encode=(U,_)=>E9($,U,_),$.decode=(U,_)=>i9($,U,_),$.encodeAsync=async(U,_)=>l9($,U,_),$.decodeAsync=async(U,_)=>h9($,U,_),$.safeEncode=(U,_)=>x9($,U,_),$.safeDecode=(U,_)=>p9($,U,_),$.safeEncodeAsync=async(U,_)=>o9($,U,_),$.safeDecodeAsync=async(U,_)=>n9($,U,_),$.refine=(U,_)=>$.check(RG(U,_)),$.superRefine=(U)=>$.check(TG(U)),$.overwrite=(U)=>$.check(cv(U)),$.optional=()=>y$($),$.exactOptional=()=>HG($),$.nullable=()=>OU($),$.nullish=()=>y$(OU($)),$.nonoptional=(U)=>XG($,U),$.array=()=>J$($),$.or=(U)=>A$([$,U]),$.and=(U)=>Gg($,U),$.transform=(U)=>KU($,H0(U)),$.default=(U)=>YG($,U),$.prefault=(U)=>FG($,U),$.catch=(U)=>ZG($,U),$.pipe=(U)=>KU($,U),$.readonly=()=>QG($),$.describe=(U)=>{let _=$.clone();return e$.add(_,{description:U}),_},Object.defineProperty($,"description",{get(){return e$.get($)?.description},configurable:!0}),$.meta=(...U)=>{if(U.length===0)return e$.get($);let _=$.clone();return e$.add(_,U[0]),_},$.isOptional=()=>$.safeParse(void 0).success,$.isNullable=()=>$.safeParse(null).success,$.apply=(U)=>U($),$}),d1=X("_ZodString",($,v)=>{v4.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>t8($,_,g,z);let U=$._zod.bag;$.format=U.format??null,$.minLength=U.minimum??null,$.maxLength=U.maximum??null,$.regex=(..._)=>$.check(E4(..._)),$.includes=(..._)=>$.check(h4(..._)),$.startsWith=(..._)=>$.check(x4(..._)),$.endsWith=(..._)=>$.check(p4(..._)),$.min=(..._)=>$.check(G6(..._)),$.max=(..._)=>$.check(U4(..._)),$.length=(..._)=>$.check(_4(..._)),$.nonempty=(..._)=>$.check(G6(1,..._)),$.lowercase=(_)=>$.check(i4(_)),$.uppercase=(_)=>$.check(l4(_)),$.trim=()=>$.check(t4()),$.normalize=(..._)=>$.check(n4(..._)),$.toLowerCase=()=>$.check(d4()),$.toUpperCase=()=>$.check(a4()),$.slugify=()=>$.check(s4())}),gg=X("ZodString",($,v)=>{v4.init($,v),d1.init($,v),$.email=(U)=>$.check(H1(a1,U)),$.url=(U)=>$.check(JU(WU,U)),$.jwt=(U)=>$.check(T1(B0,U)),$.emoji=(U)=>$.check(F1(s1,U)),$.guid=(U)=>$.check(zU(GU,U)),$.uuid=(U)=>$.check(L1(dv,U)),$.uuidv4=(U)=>$.check(I1(dv,U)),$.uuidv6=(U)=>$.check(Y1(dv,U)),$.uuidv7=(U)=>$.check(q1(dv,U)),$.nanoid=(U)=>$.check(X1(e1,U)),$.guid=(U)=>$.check(zU(GU,U)),$.cuid=(U)=>$.check(w1($0,U)),$.cuid2=(U)=>$.check(A1(v0,U)),$.ulid=(U)=>$.check(Z1(g0,U)),$.base64=(U)=>$.check(y1(O0,U)),$.base64url=(U)=>$.check(D1(K0,U)),$.xid=(U)=>$.check(M1(U0,U)),$.ksuid=(U)=>$.check(S1(_0,U)),$.ipv4=(U)=>$.check(Q1(z0,U)),$.ipv6=(U)=>$.check(N1(J0,U)),$.cidrv4=(U)=>$.check(r1(b0,U)),$.cidrv6=(U)=>$.check(u1(G0,U)),$.e164=(U)=>$.check(R1(W0,U)),$.datetime=(U)=>$.check(R9(U)),$.date=(U)=>$.check(T9(U)),$.time=(U)=>$.check(j9(U)),$.duration=(U)=>$.check(V9(U))});function Z($){return O8(gg,$)}var M$=X("ZodStringFormat",($,v)=>{Z$.init($,v),d1.init($,v)}),a1=X("ZodEmail",($,v)=>{bJ.init($,v),M$.init($,v)});function U7($){return H1(a1,$)}var GU=X("ZodGUID",($,v)=>{zJ.init($,v),M$.init($,v)});function _7($){return zU(GU,$)}var dv=X("ZodUUID",($,v)=>{JJ.init($,v),M$.init($,v)});function z7($){return L1(dv,$)}function J7($){return I1(dv,$)}function b7($){return Y1(dv,$)}function G7($){return q1(dv,$)}var WU=X("ZodURL",($,v)=>{GJ.init($,v),M$.init($,v)});function O7($){return JU(WU,$)}function K7($){return JU(WU,{protocol:/^https?$/,hostname:Dv.domain,...j.normalizeParams($)})}var s1=X("ZodEmoji",($,v)=>{OJ.init($,v),M$.init($,v)});function W7($){return F1(s1,$)}var e1=X("ZodNanoID",($,v)=>{KJ.init($,v),M$.init($,v)});function B7($){return X1(e1,$)}var $0=X("ZodCUID",($,v)=>{WJ.init($,v),M$.init($,v)});function P7($){return w1($0,$)}var v0=X("ZodCUID2",($,v)=>{BJ.init($,v),M$.init($,v)});function k7($){return A1(v0,$)}var g0=X("ZodULID",($,v)=>{PJ.init($,v),M$.init($,v)});function H7($){return Z1(g0,$)}var U0=X("ZodXID",($,v)=>{kJ.init($,v),M$.init($,v)});function L7($){return M1(U0,$)}var _0=X("ZodKSUID",($,v)=>{HJ.init($,v),M$.init($,v)});function I7($){return S1(_0,$)}var z0=X("ZodIPv4",($,v)=>{FJ.init($,v),M$.init($,v)});function Y7($){return Q1(z0,$)}var t9=X("ZodMAC",($,v)=>{wJ.init($,v),M$.init($,v)});function q7($){return W8(t9,$)}var J0=X("ZodIPv6",($,v)=>{XJ.init($,v),M$.init($,v)});function F7($){return N1(J0,$)}var b0=X("ZodCIDRv4",($,v)=>{AJ.init($,v),M$.init($,v)});function X7($){return r1(b0,$)}var G0=X("ZodCIDRv6",($,v)=>{ZJ.init($,v),M$.init($,v)});function w7($){return u1(G0,$)}var O0=X("ZodBase64",($,v)=>{SJ.init($,v),M$.init($,v)});function A7($){return y1(O0,$)}var K0=X("ZodBase64URL",($,v)=>{QJ.init($,v),M$.init($,v)});function Z7($){return D1(K0,$)}var W0=X("ZodE164",($,v)=>{NJ.init($,v),M$.init($,v)});function M7($){return R1(W0,$)}var B0=X("ZodJWT",($,v)=>{rJ.init($,v),M$.init($,v)});function S7($){return T1(B0,$)}var Ug=X("ZodCustomStringFormat",($,v)=>{uJ.init($,v),M$.init($,v)});function Q7($,v,U={}){return e4(Ug,$,v,U)}function N7($){return e4(Ug,"hostname",Dv.hostname,$)}function r7($){return e4(Ug,"hex",Dv.hex,$)}function u7($,v){let U=v?.enc??"hex",_=`${$}_${U}`,g=Dv[_];if(!g)throw Error(`Unrecognized hash format: ${_}`);return e4(Ug,_,g,v)}var _g=X("ZodNumber",($,v)=>{K1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>d8($,_,g,z),$.gt=(_,g)=>$.check(nv(_,g)),$.gte=(_,g)=>$.check(Hv(_,g)),$.min=(_,g)=>$.check(Hv(_,g)),$.lt=(_,g)=>$.check(ov(_,g)),$.lte=(_,g)=>$.check(Nv(_,g)),$.max=(_,g)=>$.check(Nv(_,g)),$.int=(_)=>$.check(t1(_)),$.safe=(_)=>$.check(t1(_)),$.positive=(_)=>$.check(nv(0,_)),$.nonnegative=(_)=>$.check(Hv(0,_)),$.negative=(_)=>$.check(ov(0,_)),$.nonpositive=(_)=>$.check(Nv(0,_)),$.multipleOf=(_,g)=>$.check(y6(_,g)),$.step=(_,g)=>$.check(y6(_,g)),$.finite=()=>$;let U=$._zod.bag;$.minValue=Math.max(U.minimum??Number.NEGATIVE_INFINITY,U.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,$.maxValue=Math.min(U.maximum??Number.POSITIVE_INFINITY,U.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,$.isInt=(U.format??"").includes("int")||Number.isSafeInteger(U.multipleOf??0.5),$.isFinite=!0,$.format=U.format??null});function I$($){return I8(_g,$)}var z4=X("ZodNumberFormat",($,v)=>{yJ.init($,v),_g.init($,v)});function t1($){return q8(z4,$)}function y7($){return F8(z4,$)}function D7($){return X8(z4,$)}function R7($){return w8(z4,$)}function T7($){return A8(z4,$)}var zg=X("ZodBoolean",($,v)=>{ag.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>a8($,U,_,g)});function h$($){return Z8(zg,$)}var Jg=X("ZodBigInt",($,v)=>{W1.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>s8($,_,g,z),$.gte=(_,g)=>$.check(Hv(_,g)),$.min=(_,g)=>$.check(Hv(_,g)),$.gt=(_,g)=>$.check(nv(_,g)),$.gte=(_,g)=>$.check(Hv(_,g)),$.min=(_,g)=>$.check(Hv(_,g)),$.lt=(_,g)=>$.check(ov(_,g)),$.lte=(_,g)=>$.check(Nv(_,g)),$.max=(_,g)=>$.check(Nv(_,g)),$.positive=(_)=>$.check(nv(BigInt(0),_)),$.negative=(_)=>$.check(ov(BigInt(0),_)),$.nonpositive=(_)=>$.check(Nv(BigInt(0),_)),$.nonnegative=(_)=>$.check(Hv(BigInt(0),_)),$.multipleOf=(_,g)=>$.check(y6(_,g));let U=$._zod.bag;$.minValue=U.minimum??null,$.maxValue=U.maximum??null,$.format=U.format??null});function j7($){return S8(Jg,$)}var P0=X("ZodBigIntFormat",($,v)=>{DJ.init($,v),Jg.init($,v)});function V7($){return N8(P0,$)}function C7($){return r8(P0,$)}var d9=X("ZodSymbol",($,v)=>{RJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>e8($,U,_,g)});function f7($){return u8(d9,$)}var a9=X("ZodUndefined",($,v)=>{TJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>v9($,U,_,g)});function c7($){return y8(a9,$)}var s9=X("ZodNull",($,v)=>{jJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>$9($,U,_,g)});function bg($){return D8(s9,$)}var e9=X("ZodAny",($,v)=>{VJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>_9($,U,_,g)});function m7(){return R8(e9)}var $G=X("ZodUnknown",($,v)=>{CJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>z9($,U,_,g)});function S$(){return T8($G)}var vG=X("ZodNever",($,v)=>{fJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>U9($,U,_,g)});function k0($){return j8(vG,$)}var gG=X("ZodVoid",($,v)=>{cJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>g9($,U,_,g)});function E7($){return V8(gG,$)}var BU=X("ZodDate",($,v)=>{mJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>J9($,_,g,z),$.min=(_,g)=>$.check(Hv(_,g)),$.max=(_,g)=>$.check(Nv(_,g));let U=$._zod.bag;$.minDate=U.minimum?new Date(U.minimum):null,$.maxDate=U.maximum?new Date(U.maximum):null});function i7($){return C8(BU,$)}var UG=X("ZodArray",($,v)=>{EJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>Y9($,U,_,g),$.element=v.element,$.min=(U,_)=>$.check(G6(U,_)),$.nonempty=(U)=>$.check(G6(1,U)),$.max=(U,_)=>$.check(U4(U,_)),$.length=(U,_)=>$.check(_4(U,_)),$.unwrap=()=>$.element});function J$($,v){return m8(UG,$,v)}function l7($){let v=$._zod.def.shape;return vv(Object.keys(v))}var PU=X("ZodObject",($,v)=>{iJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>q9($,U,_,g),j.defineLazy($,"shape",()=>{return v.shape}),$.keyof=()=>vv(Object.keys($._zod.def.shape)),$.catchall=(U)=>$.clone({...$._zod.def,catchall:U}),$.passthrough=()=>$.clone({...$._zod.def,catchall:S$()}),$.loose=()=>$.clone({...$._zod.def,catchall:S$()}),$.strict=()=>$.clone({...$._zod.def,catchall:k0()}),$.strip=()=>$.clone({...$._zod.def,catchall:void 0}),$.extend=(U)=>{return j.extend($,U)},$.safeExtend=(U)=>{return j.safeExtend($,U)},$.merge=(U)=>j.merge($,U),$.pick=(U)=>j.pick($,U),$.omit=(U)=>j.omit($,U),$.partial=(...U)=>j.partial(L0,$,U[0]),$.required=(...U)=>j.required(I0,$,U[0])});function h($,v){let U={type:"object",shape:$??{},...j.normalizeParams(v)};return new PU(U)}function h7($,v){return new PU({type:"object",shape:$,catchall:k0(),...j.normalizeParams(v)})}function $v($,v){return new PU({type:"object",shape:$,catchall:S$(),...j.normalizeParams(v)})}var kU=X("ZodUnion",($,v)=>{sg.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>E1($,U,_,g),$.options=v.options});function A$($,v){return new kU({type:"union",options:$,...j.normalizeParams(v)})}var _G=X("ZodXor",($,v)=>{kU.init($,v),lJ.init($,v),$._zod.processJSONSchema=(U,_,g)=>E1($,U,_,g),$.options=v.options});function x7($,v){return new _G({type:"union",options:$,inclusive:!1,...j.normalizeParams(v)})}var zG=X("ZodDiscriminatedUnion",($,v)=>{kU.init($,v),hJ.init($,v)});function HU($,v,U){return new zG({type:"union",options:v,discriminator:$,...j.normalizeParams(U)})}var JG=X("ZodIntersection",($,v)=>{xJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>F9($,U,_,g)});function Gg($,v){return new JG({type:"intersection",left:$,right:v})}var bG=X("ZodTuple",($,v)=>{B1.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>X9($,U,_,g),$.rest=(U)=>$.clone({...$._zod.def,rest:U})});function GG($,v,U){let _=v instanceof $$,g=_?U:v;return new bG({type:"tuple",items:$,rest:_?v:null,...j.normalizeParams(g)})}var LU=X("ZodRecord",($,v)=>{pJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>w9($,U,_,g),$.keyType=v.keyType,$.valueType=v.valueType});function N$($,v,U){return new LU({type:"record",keyType:$,valueType:v,...j.normalizeParams(U)})}function p7($,v,U){let _=kv($);return _._zod.values=void 0,new LU({type:"record",keyType:_,valueType:v,...j.normalizeParams(U)})}function o7($,v,U){return new LU({type:"record",keyType:$,valueType:v,mode:"loose",...j.normalizeParams(U)})}var OG=X("ZodMap",($,v)=>{oJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>L9($,U,_,g),$.keyType=v.keyType,$.valueType=v.valueType,$.min=(...U)=>$.check(tv(...U)),$.nonempty=(U)=>$.check(tv(1,U)),$.max=(...U)=>$.check(D6(...U)),$.size=(...U)=>$.check(g4(...U))});function n7($,v,U){return new OG({type:"map",keyType:$,valueType:v,...j.normalizeParams(U)})}var KG=X("ZodSet",($,v)=>{nJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>I9($,U,_,g),$.min=(...U)=>$.check(tv(...U)),$.nonempty=(U)=>$.check(tv(1,U)),$.max=(...U)=>$.check(D6(...U)),$.size=(...U)=>$.check(g4(...U))});function t7($,v){return new KG({type:"set",valueType:$,...j.normalizeParams(v)})}var vg=X("ZodEnum",($,v)=>{tJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(_,g,z)=>b9($,_,g,z),$.enum=v.entries,$.options=Object.values(v.entries);let U=new Set(Object.keys(v.entries));$.extract=(_,g)=>{let z={};for(let J of _)if(U.has(J))z[J]=v.entries[J];else throw Error(`Key ${J} not found in enum`);return new vg({...v,checks:[],...j.normalizeParams(g),entries:z})},$.exclude=(_,g)=>{let z={...v.entries};for(let J of _)if(U.has(J))delete z[J];else throw Error(`Key ${J} not found in enum`);return new vg({...v,checks:[],...j.normalizeParams(g),entries:z})}});function vv($,v){let U=Array.isArray($)?Object.fromEntries($.map((_)=>[_,_])):$;return new vg({type:"enum",entries:U,...j.normalizeParams(v)})}function d7($,v){return new vg({type:"enum",entries:$,...j.normalizeParams(v)})}var WG=X("ZodLiteral",($,v)=>{dJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>G9($,U,_,g),$.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 WG({type:"literal",values:Array.isArray($)?$:[$],...j.normalizeParams(v)})}var BG=X("ZodFile",($,v)=>{aJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>W9($,U,_,g),$.min=(U,_)=>$.check(tv(U,_)),$.max=(U,_)=>$.check(D6(U,_)),$.mime=(U,_)=>$.check(o4(Array.isArray(U)?U:[U],_))});function a7($){return E8(BG,$)}var PG=X("ZodTransform",($,v)=>{sJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>H9($,U,_,g),$._zod.parse=(U,_)=>{if(_.direction==="backward")throw new s6($.constructor.name);U.addIssue=(z)=>{if(typeof z==="string")U.issues.push(j.issue(z,U.value,v));else{let J=z;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=U.value),J.inst??(J.inst=$),U.issues.push(j.issue(J))}};let g=v.transform(U.value,U);if(g instanceof Promise)return g.then((z)=>{return U.value=z,U});return U.value=g,U}});function H0($){return new PG({type:"transform",transform:$})}var L0=X("ZodOptional",($,v)=>{P1.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>i1($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function y$($){return new L0({type:"optional",innerType:$})}var kG=X("ZodExactOptional",($,v)=>{eJ.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>i1($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function HG($){return new kG({type:"optional",innerType:$})}var LG=X("ZodNullable",($,v)=>{$b.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>A9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function OU($){return new LG({type:"nullable",innerType:$})}function s7($){return y$(OU($))}var IG=X("ZodDefault",($,v)=>{vb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>M9($,U,_,g),$.unwrap=()=>$._zod.def.innerType,$.removeDefault=$.unwrap});function YG($,v){return new IG({type:"default",innerType:$,get defaultValue(){return typeof v==="function"?v():j.shallowClone(v)}})}var qG=X("ZodPrefault",($,v)=>{gb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>S9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function FG($,v){return new qG({type:"prefault",innerType:$,get defaultValue(){return typeof v==="function"?v():j.shallowClone(v)}})}var I0=X("ZodNonOptional",($,v)=>{Ub.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>Z9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function XG($,v){return new I0({type:"nonoptional",innerType:$,...j.normalizeParams(v)})}var wG=X("ZodSuccess",($,v)=>{_b.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>B9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function e7($){return new wG({type:"success",innerType:$})}var AG=X("ZodCatch",($,v)=>{zb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>Q9($,U,_,g),$.unwrap=()=>$._zod.def.innerType,$.removeCatch=$.unwrap});function ZG($,v){return new AG({type:"catch",innerType:$,catchValue:typeof v==="function"?v:()=>v})}var MG=X("ZodNaN",($,v)=>{Jb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>O9($,U,_,g)});function $W($){return c8(MG,$)}var Y0=X("ZodPipe",($,v)=>{bb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>N9($,U,_,g),$.in=v.in,$.out=v.out});function KU($,v){return new Y0({type:"pipe",in:$,out:v})}var q0=X("ZodCodec",($,v)=>{Y0.init($,v),eg.init($,v)});function vW($,v,U){return new q0({type:"pipe",in:$,out:v,transform:U.decode,reverseTransform:U.encode})}var SG=X("ZodReadonly",($,v)=>{Gb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>r9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function QG($){return new SG({type:"readonly",innerType:$})}var NG=X("ZodTemplateLiteral",($,v)=>{Ob.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>K9($,U,_,g)});function gW($,v){return new NG({type:"template_literal",parts:$,...j.normalizeParams(v)})}var rG=X("ZodLazy",($,v)=>{Bb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>y9($,U,_,g),$.unwrap=()=>$._zod.def.getter()});function uG($){return new rG({type:"lazy",getter:$})}var yG=X("ZodPromise",($,v)=>{Wb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>u9($,U,_,g),$.unwrap=()=>$._zod.def.innerType});function UW($){return new yG({type:"promise",innerType:$})}var DG=X("ZodFunction",($,v)=>{Kb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>k9($,U,_,g)});function _W($){return new DG({type:"function",input:Array.isArray($?.input)?GG($?.input):$?.input??J$(S$()),output:$?.output??S$()})}var IU=X("ZodCustom",($,v)=>{Pb.init($,v),_$.init($,v),$._zod.processJSONSchema=(U,_,g)=>P9($,U,_,g)});function zW($){let v=new Q$({check:"custom"});return v._zod.check=$,v}function F0($,v){return i8(IU,$??(()=>!0),v)}function RG($,v={}){return l8(IU,$,v)}function TG($){return h8($)}var JW=x8,bW=p8;function GW($,v={}){let U=new IU({type:"custom",check:"custom",fn:(_)=>_ instanceof $,abort:!0,...j.normalizeParams(v)});return U._zod.bag.Class=$,U._zod.check=(_)=>{if(!(_.value instanceof $))_.issues.push({code:"invalid_type",expected:$.name,input:_.value,inst:U,path:[...U._zod.def.path??[]]})},U}var OW=(...$)=>o8({Codec:q0,Boolean:zg,String:gg},...$);function KW($){let v=uG(()=>{return A$([Z($),I$(),h$(),bg(),J$(v),N$(Z(),v)])});return v}function YU($,v){return KU(H0($),v)}var GY={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 OY($){l$({customError:$})}function KY(){return l$().customError}var jG;(function($){})(jG||(jG={}));var E={...bU,...h1,iso:V6},WY=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 BY($,v){let U=$.$schema;if(U==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(U==="http://json-schema.org/draft-07/schema#")return"draft-7";if(U==="http://json-schema.org/draft-04/schema#")return"draft-4";return v??"draft-2020-12"}function PY($,v){if(!$.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let U=$.slice(1).split("/").filter(Boolean);if(U.length===0)return v.rootSchema;let _=v.version==="draft-2020-12"?"$defs":"definitions";if(U[0]===_){let g=U[1];if(!g||!v.defs[g])throw Error(`Reference not found: ${$}`);return v.defs[g]}throw Error(`Reference not found: ${$}`)}function WW($,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 g=$.$ref;if(v.refs.has(g))return v.refs.get(g);if(v.processing.has(g))return E.lazy(()=>{if(!v.refs.has(g))throw Error(`Circular reference not resolved: ${g}`);return v.refs.get(g)});v.processing.add(g);let z=PY(g,v),J=Ov(z,v);return v.refs.set(g,J),v.processing.delete(g),J}if($.enum!==void 0){let g=$.enum;if(v.version==="openapi-3.0"&&$.nullable===!0&&g.length===1&&g[0]===null)return E.null();if(g.length===0)return E.never();if(g.length===1)return E.literal(g[0]);if(g.every((J)=>typeof J==="string"))return E.enum(g);let z=g.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 U=$.type;if(Array.isArray(U)){let g=U.map((z)=>{let J={...$,type:z};return WW(J,v)});if(g.length===0)return E.never();if(g.length===1)return g[0];return E.union(g)}if(!U)return E.any();let _;switch(U){case"string":{let g=E.string();if($.format){let z=$.format;if(z==="email")g=g.check(E.email());else if(z==="uri"||z==="uri-reference")g=g.check(E.url());else if(z==="uuid"||z==="guid")g=g.check(E.uuid());else if(z==="date-time")g=g.check(E.iso.datetime());else if(z==="date")g=g.check(E.iso.date());else if(z==="time")g=g.check(E.iso.time());else if(z==="duration")g=g.check(E.iso.duration());else if(z==="ipv4")g=g.check(E.ipv4());else if(z==="ipv6")g=g.check(E.ipv6());else if(z==="mac")g=g.check(E.mac());else if(z==="cidr")g=g.check(E.cidrv4());else if(z==="cidr-v6")g=g.check(E.cidrv6());else if(z==="base64")g=g.check(E.base64());else if(z==="base64url")g=g.check(E.base64url());else if(z==="e164")g=g.check(E.e164());else if(z==="jwt")g=g.check(E.jwt());else if(z==="emoji")g=g.check(E.emoji());else if(z==="nanoid")g=g.check(E.nanoid());else if(z==="cuid")g=g.check(E.cuid());else if(z==="cuid2")g=g.check(E.cuid2());else if(z==="ulid")g=g.check(E.ulid());else if(z==="xid")g=g.check(E.xid());else if(z==="ksuid")g=g.check(E.ksuid())}if(typeof $.minLength==="number")g=g.min($.minLength);if(typeof $.maxLength==="number")g=g.max($.maxLength);if($.pattern)g=g.regex(new RegExp($.pattern));_=g;break}case"number":case"integer":{let g=U==="integer"?E.number().int():E.number();if(typeof $.minimum==="number")g=g.min($.minimum);if(typeof $.maximum==="number")g=g.max($.maximum);if(typeof $.exclusiveMinimum==="number")g=g.gt($.exclusiveMinimum);else if($.exclusiveMinimum===!0&&typeof $.minimum==="number")g=g.gt($.minimum);if(typeof $.exclusiveMaximum==="number")g=g.lt($.exclusiveMaximum);else if($.exclusiveMaximum===!0&&typeof $.maximum==="number")g=g.lt($.maximum);if(typeof $.multipleOf==="number")g=g.multipleOf($.multipleOf);_=g;break}case"boolean":{_=E.boolean();break}case"null":{_=E.null();break}case"object":{let g={},z=$.properties||{},J=new Set($.required||[]);for(let[O,K]of Object.entries(z)){let W=Ov(K,v);g[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(g).length===0){_=E.record(O,K);break}let W=E.object(g).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),F=E.string().regex(new RegExp(k));W.push(E.looseRecord(F,P))}let B=[];if(Object.keys(g).length>0)B.push(E.object(g).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(g);if($.additionalProperties===!1)_=b.strict();else if(typeof $.additionalProperties==="object")_=b.catchall(Ov($.additionalProperties,v));else _=b.passthrough();break}case"array":{let{prefixItems:g,items:z}=$;if(g&&Array.isArray(g)){let J=g.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: ${U}`)}if($.description)_=_.describe($.description);if($.default!==void 0)_=_.default($.default);return _}function Ov($,v){if(typeof $==="boolean")return $?E.any():E.never();let U=WW($,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);U=_?E.intersection(U,O):O}if($.oneOf&&Array.isArray($.oneOf)){let b=$.oneOf.map((K)=>Ov(K,v)),O=E.xor(b);U=_?E.intersection(U,O):O}if($.allOf&&Array.isArray($.allOf))if($.allOf.length===0)U=_?U:E.any();else{let b=_?U:Ov($.allOf[0],v),O=_?0:1;for(let K=O;K<$.allOf.length;K++)b=E.intersection(b,Ov($.allOf[K],v));U=b}if($.nullable===!0&&v.version==="openapi-3.0")U=E.nullable(U);if($.readOnly===!0)U=E.readonly(U);let g={},z=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let b of z)if(b in $)g[b]=$[b];let J=["contentEncoding","contentMediaType","contentSchema"];for(let b of J)if(b in $)g[b]=$[b];for(let b of Object.keys($))if(!WY.has(b))g[b]=$[b];if(Object.keys(g).length>0)v.registry.add(U,g);return U}function BW($,v){if(typeof $==="boolean")return $?E.any():E.never();let U=BY($,v?.defaultTarget),_=$.$defs||$.definitions||{},g={version:U,defs:_,refs:new Map,processing:new Set,rootSchema:$,registry:v?.registry??e$};return Ov($,g)}var VG={};ev(VG,{string:()=>kY,number:()=>HY,date:()=>YY,boolean:()=>LY,bigint:()=>IY});function kY($){return K8(gg,$)}function HY($){return Y8(_g,$)}function LY($){return M8(zg,$)}function IY($){return Q8(Jg,$)}function YY($){return f8(BU,$)}l$($U());var C6="io.modelcontextprotocol/related-task",w0="2.0",gv=F0(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),PW=A$([Z(),I$().int()]),kW=Z(),cQ=$v({ttl:A$([I$(),bg()]).optional(),pollInterval:I$().optional()}),qY=h({ttl:I$().optional()}),FY=h({taskId:Z()}),CG=$v({progressToken:PW.optional(),[C6]:FY.optional()}),rv=h({_meta:CG.optional()}),qU=rv.extend({task:qY.optional()}),HW=($)=>qU.safeParse($).success,Uv=h({method:Z(),params:rv.loose().optional()}),Rv=h({_meta:CG.optional()}),Tv=h({method:Z(),params:Rv.loose().optional()}),_v=$v({_meta:CG.optional()}),Kg=A$([Z(),I$().int()]),LW=h({jsonrpc:t(w0),id:Kg,...Uv.shape}).strict(),fG=($)=>LW.safeParse($).success,IW=h({jsonrpc:t(w0),...Tv.shape}).strict(),YW=($)=>IW.safeParse($).success,cG=h({jsonrpc:t(w0),id:Kg,result:_v}).strict(),FU=($)=>cG.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 mG=h({jsonrpc:t(w0),id:Kg.optional(),error:h({code:I$().int(),message:Z(),data:S$().optional()})}).strict();var qW=($)=>mG.safeParse($).success;var FW=A$([LW,IW,cG,mG]),mQ=A$([cG,mG]),A0=_v.strict(),XY=Rv.extend({requestId:Kg.optional(),reason:Z().optional()}),Z0=Tv.extend({method:t("notifications/cancelled"),params:XY}),wY=h({src:Z(),mimeType:Z().optional(),sizes:J$(Z()).optional(),theme:vv(["light","dark"]).optional()}),XU=h({icons:J$(wY).optional()}),Og=h({name:Z(),title:Z().optional()}),wU=Og.extend({...Og.shape,...XU.shape,version:Z(),websiteUrl:Z().optional(),description:Z().optional()}),AY=Gg(h({applyDefaults:h$().optional()}),N$(Z(),S$())),ZY=YU(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},Gg(h({form:AY.optional(),url:gv.optional()}),N$(Z(),S$()).optional())),MY=$v({list:gv.optional(),cancel:gv.optional(),requests:$v({sampling:$v({createMessage:gv.optional()}).optional(),elicitation:$v({create:gv.optional()}).optional()}).optional()}),SY=$v({list:gv.optional(),cancel:gv.optional(),requests:$v({tools:$v({call:gv.optional()}).optional()}).optional()}),QY=h({experimental:N$(Z(),gv).optional(),sampling:h({context:gv.optional(),tools:gv.optional()}).optional(),elicitation:ZY.optional(),roots:h({listChanged:h$().optional()}).optional(),tasks:MY.optional()}),NY=rv.extend({protocolVersion:Z(),capabilities:QY,clientInfo:wU}),rY=Uv.extend({method:t("initialize"),params:NY});var uY=h({experimental:N$(Z(),gv).optional(),logging:gv.optional(),completions:gv.optional(),prompts:h({listChanged:h$().optional()}).optional(),resources:h({subscribe:h$().optional(),listChanged:h$().optional()}).optional(),tools:h({listChanged:h$().optional()}).optional(),tasks:SY.optional()}),yY=_v.extend({protocolVersion:Z(),capabilities:uY,serverInfo:wU,instructions:Z().optional()}),DY=Tv.extend({method:t("notifications/initialized"),params:Rv.optional()});var f6=Uv.extend({method:t("ping"),params:rv.optional()}),RY=h({progress:I$(),total:y$(I$()),message:y$(Z())}),TY=h({...Rv.shape,...RY.shape,progressToken:PW}),M0=Tv.extend({method:t("notifications/progress"),params:TY}),jY=rv.extend({cursor:kW.optional()}),AU=Uv.extend({params:jY.optional()}),ZU=_v.extend({nextCursor:kW.optional()}),VY=vv(["working","input_required","completed","failed","cancelled"]),MU=h({taskId:Z(),status:VY,ttl:A$([I$(),bg()]),createdAt:Z(),lastUpdatedAt:Z(),pollInterval:y$(I$()),statusMessage:y$(Z())}),S0=_v.extend({task:MU}),CY=Rv.merge(MU),SU=Tv.extend({method:t("notifications/tasks/status"),params:CY}),Q0=Uv.extend({method:t("tasks/get"),params:rv.extend({taskId:Z()})}),N0=_v.merge(MU),r0=Uv.extend({method:t("tasks/result"),params:rv.extend({taskId:Z()})}),EQ=_v.loose(),u0=AU.extend({method:t("tasks/list")}),y0=ZU.extend({tasks:J$(MU)}),D0=Uv.extend({method:t("tasks/cancel"),params:rv.extend({taskId:Z()})}),XW=_v.merge(MU),wW=h({uri:Z(),mimeType:y$(Z()),_meta:N$(Z(),S$()).optional()}),AW=wW.extend({text:Z()}),EG=Z().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),ZW=wW.extend({blob:EG}),QU=vv(["user","assistant"]),Wg=h({audience:J$(QU).optional(),priority:I$().min(0).max(1).optional(),lastModified:V6.datetime({offset:!0}).optional()}),MW=h({...Og.shape,...XU.shape,uri:Z(),description:y$(Z()),mimeType:y$(Z()),annotations:Wg.optional(),_meta:y$($v({}))}),fY=h({...Og.shape,...XU.shape,uriTemplate:Z(),description:y$(Z()),mimeType:y$(Z()),annotations:Wg.optional(),_meta:y$($v({}))}),iG=AU.extend({method:t("resources/list")}),NU=ZU.extend({resources:J$(MW)}),lG=AU.extend({method:t("resources/templates/list")}),hG=ZU.extend({resourceTemplates:J$(fY)}),xG=rv.extend({uri:Z()}),cY=xG,pG=Uv.extend({method:t("resources/read"),params:cY}),rU=_v.extend({contents:J$(A$([AW,ZW]))}),oG=Tv.extend({method:t("notifications/resources/list_changed"),params:Rv.optional()}),mY=xG,EY=Uv.extend({method:t("resources/subscribe"),params:mY}),iY=xG,lY=Uv.extend({method:t("resources/unsubscribe"),params:iY}),hY=Rv.extend({uri:Z()}),xY=Tv.extend({method:t("notifications/resources/updated"),params:hY}),pY=h({name:Z(),description:y$(Z()),required:y$(h$())}),oY=h({...Og.shape,...XU.shape,description:y$(Z()),arguments:y$(J$(pY)),_meta:y$($v({}))}),nG=AU.extend({method:t("prompts/list")}),tG=ZU.extend({prompts:J$(oY)}),nY=rv.extend({name:Z(),arguments:N$(Z(),Z()).optional()}),tY=Uv.extend({method:t("prompts/get"),params:nY}),dG=h({type:t("text"),text:Z(),annotations:Wg.optional(),_meta:N$(Z(),S$()).optional()}),aG=h({type:t("image"),data:EG,mimeType:Z(),annotations:Wg.optional(),_meta:N$(Z(),S$()).optional()}),sG=h({type:t("audio"),data:EG,mimeType:Z(),annotations:Wg.optional(),_meta:N$(Z(),S$()).optional()}),dY=h({type:t("tool_use"),name:Z(),id:Z(),input:N$(Z(),S$()),_meta:N$(Z(),S$()).optional()}),eG=h({type:t("resource"),resource:A$([AW,ZW]),annotations:Wg.optional(),_meta:N$(Z(),S$()).optional()}),$O=MW.extend({type:t("resource_link")}),Bg=A$([dG,aG,sG,$O,eG]),aY=h({role:QU,content:Bg}),sY=_v.extend({description:Z().optional(),messages:J$(aY)}),vO=Tv.extend({method:t("notifications/prompts/list_changed"),params:Rv.optional()}),eY=h({title:Z().optional(),readOnlyHint:h$().optional(),destructiveHint:h$().optional(),idempotentHint:h$().optional(),openWorldHint:h$().optional()}),$q=h({taskSupport:vv(["required","optional","forbidden"]).optional()}),R0=h({...Og.shape,...XU.shape,description:Z().optional(),inputSchema:h({type:t("object"),properties:N$(Z(),gv).optional(),required:J$(Z()).optional()}).catchall(S$()),outputSchema:h({type:t("object"),properties:N$(Z(),gv).optional(),required:J$(Z()).optional()}).catchall(S$()).optional(),annotations:eY.optional(),execution:$q.optional(),_meta:N$(Z(),S$()).optional()}),uU=AU.extend({method:t("tools/list")}),vq=ZU.extend({tools:J$(R0)}),c6=_v.extend({content:J$(Bg).default([]),structuredContent:N$(Z(),S$()).optional(),isError:h$().optional()}),iQ=c6.or(_v.extend({toolResult:S$()})),gq=qU.extend({name:Z(),arguments:N$(Z(),S$()).optional()}),yU=Uv.extend({method:t("tools/call"),params:gq}),gO=Tv.extend({method:t("notifications/tools/list_changed"),params:Rv.optional()}),lQ=h({autoRefresh:h$().default(!0),debounceMs:I$().int().nonnegative().default(300)}),SW=vv(["debug","info","notice","warning","error","critical","alert","emergency"]),Uq=rv.extend({level:SW}),_q=Uv.extend({method:t("logging/setLevel"),params:Uq}),zq=Rv.extend({level:SW,logger:Z().optional(),data:S$()}),UO=Tv.extend({method:t("notifications/message"),params:zq}),Jq=h({name:Z().optional()}),bq=h({hints:J$(Jq).optional(),costPriority:I$().min(0).max(1).optional(),speedPriority:I$().min(0).max(1).optional(),intelligencePriority:I$().min(0).max(1).optional()}),Gq=h({mode:vv(["auto","required","none"]).optional()}),Oq=h({type:t("tool_result"),toolUseId:Z().describe("The unique identifier for the corresponding tool call."),content:J$(Bg).default([]),structuredContent:h({}).loose().optional(),isError:h$().optional(),_meta:N$(Z(),S$()).optional()}),Kq=HU("type",[dG,aG,sG]),X0=HU("type",[dG,aG,sG,dY,Oq]),Wq=h({role:QU,content:A$([X0,J$(X0)]),_meta:N$(Z(),S$()).optional()}),Bq=qU.extend({messages:J$(Wq),modelPreferences:bq.optional(),systemPrompt:Z().optional(),includeContext:vv(["none","thisServer","allServers"]).optional(),temperature:I$().optional(),maxTokens:I$().int(),stopSequences:J$(Z()).optional(),metadata:gv.optional(),tools:J$(R0).optional(),toolChoice:Gq.optional()}),Pq=Uv.extend({method:t("sampling/createMessage"),params:Bq}),kq=_v.extend({model:Z(),stopReason:y$(vv(["endTurn","stopSequence","maxTokens"]).or(Z())),role:QU,content:Kq}),Hq=_v.extend({model:Z(),stopReason:y$(vv(["endTurn","stopSequence","maxTokens","toolUse"]).or(Z())),role:QU,content:A$([X0,J$(X0)])}),Lq=h({type:t("boolean"),title:Z().optional(),description:Z().optional(),default:h$().optional()}),Iq=h({type:t("string"),title:Z().optional(),description:Z().optional(),minLength:I$().optional(),maxLength:I$().optional(),format:vv(["email","uri","date","date-time"]).optional(),default:Z().optional()}),Yq=h({type:vv(["number","integer"]),title:Z().optional(),description:Z().optional(),minimum:I$().optional(),maximum:I$().optional(),default:I$().optional()}),qq=h({type:t("string"),title:Z().optional(),description:Z().optional(),enum:J$(Z()),default:Z().optional()}),Fq=h({type:t("string"),title:Z().optional(),description:Z().optional(),oneOf:J$(h({const:Z(),title:Z()})),default:Z().optional()}),Xq=h({type:t("string"),title:Z().optional(),description:Z().optional(),enum:J$(Z()),enumNames:J$(Z()).optional(),default:Z().optional()}),wq=A$([qq,Fq]),Aq=h({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:I$().optional(),maxItems:I$().optional(),items:h({type:t("string"),enum:J$(Z())}),default:J$(Z()).optional()}),Zq=h({type:t("array"),title:Z().optional(),description:Z().optional(),minItems:I$().optional(),maxItems:I$().optional(),items:h({anyOf:J$(h({const:Z(),title:Z()}))}),default:J$(Z()).optional()}),Mq=A$([Aq,Zq]),Sq=A$([Xq,wq,Mq]),Qq=A$([Sq,Lq,Iq,Yq]),Nq=qU.extend({mode:t("form").optional(),message:Z(),requestedSchema:h({type:t("object"),properties:N$(Z(),Qq),required:J$(Z()).optional()})}),rq=qU.extend({mode:t("url"),message:Z(),elicitationId:Z(),url:Z().url()}),uq=A$([Nq,rq]),yq=Uv.extend({method:t("elicitation/create"),params:uq}),Dq=Rv.extend({elicitationId:Z()}),Rq=Tv.extend({method:t("notifications/elicitation/complete"),params:Dq}),Tq=_v.extend({action:vv(["accept","decline","cancel"]),content:YU(($)=>$===null?void 0:$,N$(Z(),A$([Z(),I$(),h$(),J$(Z())])).optional())}),jq=h({type:t("ref/resource"),uri:Z()});var Vq=h({type:t("ref/prompt"),name:Z()}),Cq=rv.extend({ref:A$([Vq,jq]),argument:h({name:Z(),value:Z()}),context:h({arguments:N$(Z(),Z()).optional()}).optional()}),fq=Uv.extend({method:t("completion/complete"),params:Cq});var cq=_v.extend({completion:$v({values:J$(Z()).max(100),total:y$(I$().int()),hasMore:y$(h$())})}),mq=h({uri:Z().startsWith("file://"),name:Z().optional(),_meta:N$(Z(),S$()).optional()}),Eq=Uv.extend({method:t("roots/list"),params:rv.optional()}),iq=_v.extend({roots:J$(mq)}),lq=Tv.extend({method:t("notifications/roots/list_changed"),params:Rv.optional()}),hQ=A$([f6,rY,fq,_q,tY,nG,iG,lG,pG,EY,lY,yU,uU,Q0,r0,u0,D0]),xQ=A$([Z0,M0,DY,lq,SU]),pQ=A$([A0,kq,Hq,Tq,iq,N0,y0,S0]),oQ=A$([f6,Pq,yq,Eq,Q0,r0,u0,D0]),nQ=A$([Z0,M0,UO,xY,oG,gO,vO,SU,Rq]),tQ=A$([A0,yY,cq,sY,tG,NU,hG,rU,c6,vq,N0,y0,S0]);class k$ extends Error{constructor($,v,U){super(`MCP error ${$}: ${v}`);this.code=$,this.data=U,this.name="McpError"}static fromError($,v,U){if($===w$.UrlElicitationRequired&&U){let _=U;if(_.elicitations)return new QW(_.elicitations,v)}return new k$($,v,U)}}class QW extends k${constructor($,v=`URL elicitation${$.length>1?"s":""} required`){super(w$.UrlElicitationRequired,v,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}function T0($){return!!$._zod}function j0($,v){if(T0($))return C4($,v);return $.safeParse(v)}function NW($){if(!$)return;let v;if(T0($))v=$._zod?.def?.shape;else v=$.shape;if(!v)return;if(typeof v==="function")try{return v()}catch{return}return v}function rW($){if(T0($)){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 U=$._def;if(U){if(U.value!==void 0)return U.value;if(Array.isArray(U.values)&&U.values.length>0)return U.values[0]}let _=$.value;if(_!==void 0)return _;return}function m6($){return $==="completed"||$==="failed"||$==="cancelled"}var hq=Symbol("Let zodToJsonSchema decide on which parser to use");var RN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _O($){let U=NW($)?.method;if(!U)throw Error("Schema is missing a method literal");let _=rW(U);if(typeof _!=="string")throw Error("Schema method literal must be a string");return _}function zO($,v){let U=j0($,v);if(!U.success)throw U.error;return U.data}var dq=60000;class RU{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(Z0,(v)=>{this._oncancel(v)}),this.setNotificationHandler(M0,(v)=>{this._onprogress(v)}),this.setRequestHandler(f6,(v)=>({})),this._taskStore=$?.taskStore,this._taskMessageQueue=$?.taskMessageQueue,this._taskStore)this.setRequestHandler(Q0,async(v,U)=>{let _=await this._taskStore.getTask(v.params.taskId,U.sessionId);if(!_)throw new k$(w$.InvalidParams,"Failed to retrieve task: Task not found");return{..._}}),this.setRequestHandler(r0,async(v,U)=>{let _=async()=>{let g=v.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(g,U.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:U.requestId})}}let z=await this._taskStore.getTask(g,U.sessionId);if(!z)throw new k$(w$.InvalidParams,`Task not found: ${g}`);if(!m6(z.status))return await this._waitForTaskUpdate(g,U.signal),await _();if(m6(z.status)){let J=await this._taskStore.getTaskResult(g,U.sessionId);return this._clearTaskQueue(g),{...J,_meta:{...J._meta,[C6]:{taskId:g}}}}return await _()};return await _()}),this.setRequestHandler(u0,async(v,U)=>{try{let{tasks:_,nextCursor:g}=await this._taskStore.listTasks(v.params?.cursor,U.sessionId);return{tasks:_,nextCursor:g,_meta:{}}}catch(_){throw new k$(w$.InvalidParams,`Failed to list tasks: ${_ instanceof Error?_.message:String(_)}`)}}),this.setRequestHandler(D0,async(v,U)=>{try{let _=await this._taskStore.getTask(v.params.taskId,U.sessionId);if(!_)throw new k$(w$.InvalidParams,`Task not found: ${v.params.taskId}`);if(m6(_.status))throw new k$(w$.InvalidParams,`Cannot cancel task in terminal status: ${_.status}`);await this._taskStore.updateTaskStatus(v.params.taskId,"cancelled","Client cancelled task execution.",U.sessionId),this._clearTaskQueue(v.params.taskId);let g=await this._taskStore.getTask(v.params.taskId,U.sessionId);if(!g)throw new k$(w$.InvalidParams,`Task not found after cancellation: ${v.params.taskId}`);return{_meta:{},...g}}catch(_){if(_ instanceof k$)throw _;throw new k$(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,U,_,g=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(_,v),startTime:Date.now(),timeout:v,maxTotalTimeout:U,resetTimeoutOnProgress:g,onTimeout:_})}_resetTimeout($){let v=this._timeoutInfo.get($);if(!v)return!1;let U=Date.now()-v.startTime;if(v.maxTotalTimeout&&U>=v.maxTotalTimeout)throw this._timeoutInfo.delete($),k$.fromError(w$.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:U});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 U=this.transport?.onerror;this._transport.onerror=(g)=>{U?.(g),this._onerror(g)};let _=this._transport?.onmessage;this._transport.onmessage=(g,z)=>{if(_?.(g,z),FU(g)||qW(g))this._onresponse(g);else if(fG(g))this._onrequest(g,z);else if(YW(g))this._onnotification(g);else this._onerror(Error(`Unknown message type: ${JSON.stringify(g)}`))},await this._transport.start()}_onclose(){let $=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let U of this._timeoutInfo.values())clearTimeout(U.timeoutId);this._timeoutInfo.clear();for(let U of this._requestHandlerAbortControllers.values())U.abort();this._requestHandlerAbortControllers.clear();let v=k$.fromError(w$.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let U of $.values())U(v)}_onerror($){this.onerror?.($)}_onnotification($){let v=this._notificationHandlers.get($.method)??this.fallbackNotificationHandler;if(v===void 0)return;Promise.resolve().then(()=>v($)).catch((U)=>this._onerror(Error(`Uncaught error in notification handler: ${U}`)))}_onrequest($,v){let U=this._requestHandlers.get($.method)??this.fallbackRequestHandler,_=this._transport,g=$.params?._meta?.[C6]?.taskId;if(U===void 0){let K={jsonrpc:"2.0",id:$.id,error:{code:w$.MethodNotFound,message:"Method not found"}};if(g&&this._taskMessageQueue)this._enqueueTaskMessage(g,{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=HW($.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(g)W.relatedTask={taskId:g};await this.notification(K,W)},sendRequest:async(K,W,B)=>{if(z.signal.aborted)throw new k$(w$.ConnectionClosed,"Request was cancelled");let k={...B,relatedRequestId:$.id};if(g&&!k.relatedTask)k.relatedTask={taskId:g};let P=k.relatedTask?.taskId??g;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:g,taskStore:b,taskRequestedTtl:J?.ttl,closeSSEStream:v?.closeSSEStream,closeStandaloneSSEStream:v?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability($.method)}).then(()=>U($,O)).then(async(K)=>{if(z.signal.aborted)return;let W={result:K,jsonrpc:"2.0",id:$.id};if(g&&this._taskMessageQueue)await this._enqueueTaskMessage(g,{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:w$.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(g&&this._taskMessageQueue)await this._enqueueTaskMessage(g,{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,...U}=$.params,_=Number(v),g=this._progressHandlers.get(_);if(!g){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}g(U)}_onresponse($){let v=Number($.id),U=this._requestResolvers.get(v);if(U){if(this._requestResolvers.delete(v),FU($))U($);else{let z=new k$($.error.code,$.error.message,$.error.data);U(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 g=!1;if(FU($)&&$.result&&typeof $.result==="object"){let z=$.result;if(z.task&&typeof z.task==="object"){let J=z.task;if(typeof J.taskId==="string")g=!0,this._taskProgressTokens.set(J.taskId,v)}}if(!g)this._progressHandlers.delete(v);if(FU($))_($);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,U){let{task:_}=U??{};if(!_){try{yield{type:"result",result:await this.request($,v,U)}}catch(z){yield{type:"error",error:z instanceof k$?z:new k$(w$.InternalError,String(z))}}return}let g;try{let z=await this.request($,S0,U);if(z.task)g=z.task.taskId,yield{type:"taskCreated",task:z.task};else throw new k$(w$.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:g},U);if(yield{type:"taskStatus",task:J},m6(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:g},v,U)};else if(J.status==="failed")yield{type:"error",error:new k$(w$.InternalError,`Task ${g} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new k$(w$.InternalError,`Task ${g} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:g},v,U)};return}let b=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((O)=>setTimeout(O,b)),U?.signal?.throwIfAborted()}}catch(z){yield{type:"error",error:z instanceof k$?z:new k$(w$.InternalError,String(z))}}}request($,v,U){let{relatedRequestId:_,resumptionToken:g,onresumptiontoken:z,task:J,relatedTask:b}=U??{};return new Promise((O,K)=>{let W=(Y)=>{K(Y)};if(!this._transport){W(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod($.method),J)this.assertTaskCapability($.method)}catch(Y){W(Y);return}U?.signal?.throwIfAborted();let B=this._requestMessageId++,k={...$,jsonrpc:"2.0",id:B};if(U?.onprogress)this._progressHandlers.set(B,U.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||{},[C6]:b}};let P=(Y)=>{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(Y)}},{relatedRequestId:_,resumptionToken:g,onresumptiontoken:z}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));let q=Y instanceof k$?Y:new k$(w$.RequestTimeout,String(Y));K(q)};this._responseHandlers.set(B,(Y)=>{if(U?.signal?.aborted)return;if(Y instanceof Error)return K(Y);try{let q=j0(v,Y.result);if(!q.success)K(q.error);else O(q.data)}catch(q){K(q)}}),U?.signal?.addEventListener("abort",()=>{P(U?.signal?.reason)});let F=U?.timeout??dq,I=()=>P(k$.fromError(w$.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(B,F,U?.maxTotalTimeout,I,U?.resetTimeoutOnProgress??!1);let H=b?.taskId;if(H){let Y=(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,Y),this._enqueueTaskMessage(H,{type:"request",message:k,timestamp:Date.now()}).catch((q)=>{this._cleanupTimeout(B),K(q)})}else this._transport.send(k,{relatedRequestId:_,resumptionToken:g,onresumptiontoken:z}).catch((Y)=>{this._cleanupTimeout(B),K(Y)})})}async getTask($,v){return this.request({method:"tasks/get",params:$},N0,v)}async getTaskResult($,v,U){return this.request({method:"tasks/result",params:$},v,U)}async listTasks($,v){return this.request({method:"tasks/list",params:$},y0,v)}async cancelTask($,v){return this.request({method:"tasks/cancel",params:$},XW,v)}async notification($,v){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability($.method);let U=v?.relatedTask?.taskId;if(U){let J={...$,jsonrpc:"2.0",params:{...$.params,_meta:{...$.params?._meta||{},[C6]:v.relatedTask}}};await this._enqueueTaskMessage(U,{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||{},[C6]: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||{},[C6]:v.relatedTask}}};await this._transport.send(z,v)}setRequestHandler($,v){let U=_O($);this.assertRequestHandlerCapability(U),this._requestHandlers.set(U,(_,g)=>{let z=zO($,_);return Promise.resolve(v(z,g))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,v){let U=_O($);this._notificationHandlers.set(U,(_)=>{let g=zO($,_);return Promise.resolve(v(g))})}removeNotificationHandler($){this._notificationHandlers.delete($)}_cleanupTaskProgressHandler($){let v=this._taskProgressTokens.get($);if(v!==void 0)this._progressHandlers.delete(v),this._taskProgressTokens.delete($)}async _enqueueTaskMessage($,v,U){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,U,_)}async _clearTaskQueue($,v){if(this._taskMessageQueue){let U=await this._taskMessageQueue.dequeueAll($,v);for(let _ of U)if(_.type==="request"&&fG(_.message)){let g=_.message.id,z=this._requestResolvers.get(g);if(z)z(new k$(w$.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(g);else this._onerror(Error(`Resolver missing for request ${g} during task ${$} cleanup`))}}}async _waitForTaskUpdate($,v){let U=this._options?.defaultTaskPollInterval??1000;try{let _=await this._taskStore?.getTask($);if(_?.pollInterval)U=_.pollInterval}catch{}return new Promise((_,g)=>{if(v.aborted){g(new k$(w$.InvalidRequest,"Request cancelled"));return}let z=setTimeout(_,U);v.addEventListener("abort",()=>{clearTimeout(z),g(new k$(w$.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore($,v){let U=this._taskStore;if(!U)throw Error("No task store configured");return{createTask:async(_)=>{if(!$)throw Error("No request provided");return await U.createTask(_,$.id,{method:$.method,params:$.params},v)},getTask:async(_)=>{let g=await U.getTask(_,v);if(!g)throw new k$(w$.InvalidParams,"Failed to retrieve task: Task not found");return g},storeTaskResult:async(_,g,z)=>{await U.storeTaskResult(_,g,z,v);let J=await U.getTask(_,v);if(J){let b=SU.parse({method:"notifications/tasks/status",params:J});if(await this.notification(b),m6(J.status))this._cleanupTaskProgressHandler(_)}},getTaskResult:(_)=>{return U.getTaskResult(_,v)},updateTaskStatus:async(_,g,z)=>{let J=await U.getTask(_,v);if(!J)throw new k$(w$.InvalidParams,`Task "${_}" not found - it may have been cleaned up`);if(m6(J.status))throw new k$(w$.InvalidParams,`Cannot update task "${_}" from terminal status "${J.status}" to "${g}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await U.updateTaskStatus(_,g,z,v);let b=await U.getTask(_,v);if(b){let O=SU.parse({method:"notifications/tasks/status",params:b});if(await this.notification(O),m6(b.status))this._cleanupTaskProgressHandler(_)}},listTasks:(_)=>{return U.listTasks(_,v)}}}}var JO="2026-01-26";var aq="ui/notifications/tool-input-partial";var sq=L.union([L.literal("light"),L.literal("dark")]).describe("Color theme preference for the host environment."),TU=L.union([L.literal("inline"),L.literal("fullscreen"),L.literal("pip")]).describe("Display mode for UI presentation."),eq=L.union([L.literal("--color-background-primary"),L.literal("--color-background-secondary"),L.literal("--color-background-tertiary"),L.literal("--color-background-inverse"),L.literal("--color-background-ghost"),L.literal("--color-background-info"),L.literal("--color-background-danger"),L.literal("--color-background-success"),L.literal("--color-background-warning"),L.literal("--color-background-disabled"),L.literal("--color-text-primary"),L.literal("--color-text-secondary"),L.literal("--color-text-tertiary"),L.literal("--color-text-inverse"),L.literal("--color-text-ghost"),L.literal("--color-text-info"),L.literal("--color-text-danger"),L.literal("--color-text-success"),L.literal("--color-text-warning"),L.literal("--color-text-disabled"),L.literal("--color-border-primary"),L.literal("--color-border-secondary"),L.literal("--color-border-tertiary"),L.literal("--color-border-inverse"),L.literal("--color-border-ghost"),L.literal("--color-border-info"),L.literal("--color-border-danger"),L.literal("--color-border-success"),L.literal("--color-border-warning"),L.literal("--color-border-disabled"),L.literal("--color-ring-primary"),L.literal("--color-ring-secondary"),L.literal("--color-ring-inverse"),L.literal("--color-ring-info"),L.literal("--color-ring-danger"),L.literal("--color-ring-success"),L.literal("--color-ring-warning"),L.literal("--font-sans"),L.literal("--font-mono"),L.literal("--font-weight-normal"),L.literal("--font-weight-medium"),L.literal("--font-weight-semibold"),L.literal("--font-weight-bold"),L.literal("--font-text-xs-size"),L.literal("--font-text-sm-size"),L.literal("--font-text-md-size"),L.literal("--font-text-lg-size"),L.literal("--font-heading-xs-size"),L.literal("--font-heading-sm-size"),L.literal("--font-heading-md-size"),L.literal("--font-heading-lg-size"),L.literal("--font-heading-xl-size"),L.literal("--font-heading-2xl-size"),L.literal("--font-heading-3xl-size"),L.literal("--font-text-xs-line-height"),L.literal("--font-text-sm-line-height"),L.literal("--font-text-md-line-height"),L.literal("--font-text-lg-line-height"),L.literal("--font-heading-xs-line-height"),L.literal("--font-heading-sm-line-height"),L.literal("--font-heading-md-line-height"),L.literal("--font-heading-lg-line-height"),L.literal("--font-heading-xl-line-height"),L.literal("--font-heading-2xl-line-height"),L.literal("--font-heading-3xl-line-height"),L.literal("--border-radius-xs"),L.literal("--border-radius-sm"),L.literal("--border-radius-md"),L.literal("--border-radius-lg"),L.literal("--border-radius-xl"),L.literal("--border-radius-full"),L.literal("--border-width-regular"),L.literal("--shadow-hairline"),L.literal("--shadow-sm"),L.literal("--shadow-md"),L.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),$F=L.record(eq.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.`),L.union([L.string(),L.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.`),vF=L.object({method:L.literal("ui/open-link"),params:L.object({url:L.string().describe("URL to open in the host's browser")})}),gF=L.object({isError:L.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),UF=L.object({isError:L.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),_F=L.object({isError:L.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),zF=L.object({method:L.literal("ui/notifications/sandbox-proxy-ready"),params:L.object({})}),bO=L.object({connectDomains:L.array(L.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:L.array(L.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:L.array(L.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:L.array(L.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'`)")}),GO=L.object({camera:L.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:L.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:L.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:L.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),JF=L.object({method:L.literal("ui/notifications/size-changed"),params:L.object({width:L.number().optional().describe("New width in pixels."),height:L.number().optional().describe("New height in pixels.")})}),bF=L.object({method:L.literal("ui/notifications/tool-input"),params:L.object({arguments:L.record(L.string(),L.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),GF=L.object({method:L.literal("ui/notifications/tool-input-partial"),params:L.object({arguments:L.record(L.string(),L.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),OF=L.object({method:L.literal("ui/notifications/tool-cancelled"),params:L.object({reason:L.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),KF=L.object({fonts:L.string().optional()}),WF=L.object({variables:$F.optional().describe("CSS variables for theming the app."),css:KF.optional().describe("CSS blocks that apps can inject.")}),BF=L.object({method:L.literal("ui/resource-teardown"),params:L.object({})}),PF=L.record(L.string(),L.unknown()),uW=L.object({text:L.object({}).optional().describe("Host supports text content blocks."),image:L.object({}).optional().describe("Host supports image content blocks."),audio:L.object({}).optional().describe("Host supports audio content blocks."),resource:L.object({}).optional().describe("Host supports resource content blocks."),resourceLink:L.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:L.object({}).optional().describe("Host supports structured content.")}),kF=L.object({method:L.literal("ui/notifications/request-teardown"),params:L.object({}).optional()}),HF=L.object({experimental:L.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:L.object({}).optional().describe("Host supports opening external URLs."),downloadFile:L.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:L.object({listChanged:L.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:L.object({listChanged:L.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:L.object({}).optional().describe("Host accepts log messages."),sandbox:L.object({permissions:GO.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:bO.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:uW.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:uW.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),LF=L.object({experimental:L.object({}).optional().describe("Experimental features (structure TBD)."),tools:L.object({listChanged:L.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:L.array(TU).optional().describe("Display modes the app supports.")}),IF=L.object({method:L.literal("ui/notifications/initialized"),params:L.object({}).optional()}),jy=L.object({csp:bO.optional().describe("Content Security Policy configuration for UI resources."),permissions:GO.optional().describe("Sandbox permissions requested by the UI resource."),domain:L.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:L.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`)}),yW=L.object({method:L.literal("ui/request-display-mode"),params:L.object({mode:TU.describe("The display mode being requested.")})}),YF=L.object({mode:TU.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),qF=L.union([L.literal("model"),L.literal("app")]).describe("Tool visibility scope - who can access the tool."),Vy=L.object({resourceUri:L.string().optional(),visibility:L.array(qF).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`)}),Cy=L.object({mimeTypes:L.array(L.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),FF=L.object({method:L.literal("ui/download-file"),params:L.object({contents:L.array(L.union([eG,$O])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),XF=L.object({method:L.literal("ui/message"),params:L.object({role:L.literal("user").describe('Message role, currently only "user" is supported.'),content:L.array(Bg).describe("Message content blocks (text, image, etc.).")})}),fy=L.object({method:L.literal("ui/notifications/sandbox-resource-ready"),params:L.object({html:L.string().describe("HTML content to load into the inner iframe."),sandbox:L.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:bO.optional().describe("CSP configuration from resource metadata."),permissions:GO.optional().describe("Sandbox permissions from resource metadata.")})}),wF=L.object({method:L.literal("ui/notifications/tool-result"),params:c6.describe("Standard MCP tool execution result.")}),DW=L.object({toolInfo:L.object({id:Kg.optional().describe("JSON-RPC id of the tools/call request."),tool:R0.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:sq.optional().describe("Current color theme preference."),styles:WF.optional().describe("Style configuration for theming the app."),displayMode:TU.optional().describe("How the UI is currently displayed."),availableDisplayModes:L.array(TU).optional().describe("Display modes the host supports."),containerDimensions:L.union([L.object({height:L.number().describe("Fixed container height in pixels.")}),L.object({maxHeight:L.union([L.number(),L.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(L.union([L.object({width:L.number().describe("Fixed container width in pixels.")}),L.object({maxWidth:L.union([L.number(),L.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:L.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:L.string().optional().describe("User's timezone in IANA format."),userAgent:L.string().optional().describe("Host application identifier."),platform:L.union([L.literal("web"),L.literal("desktop"),L.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:L.object({touch:L.boolean().optional().describe("Whether the device supports touch input."),hover:L.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:L.object({top:L.number().describe("Top safe area inset in pixels."),right:L.number().describe("Right safe area inset in pixels."),bottom:L.number().describe("Bottom safe area inset in pixels."),left:L.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),AF=L.object({method:L.literal("ui/notifications/host-context-changed"),params:DW.describe("Partial context update containing only changed fields.")}),ZF=L.object({method:L.literal("ui/update-model-context"),params:L.object({content:L.array(Bg).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:L.record(L.string(),L.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),MF=L.object({method:L.literal("ui/initialize"),params:L.object({appInfo:wU.describe("App identification (name and version)."),appCapabilities:LF.describe("Features and capabilities this app provides."),protocolVersion:L.string().describe("Protocol version this app supports.")})}),SF=L.object({protocolVersion:L.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:wU.describe("Host application identification and version."),hostCapabilities:HF.describe("Features and capabilities provided by the host."),hostContext:DW.describe("Rich context about the host environment.")}).passthrough();class V0{eventTarget;eventSource;messageListener;constructor($=window.parent,v){this.eventTarget=$,this.eventSource=v,this.messageListener=(U)=>{if(v&&U.source!==this.eventSource){console.debug("Ignoring message from unknown source",U);return}let _=FW.safeParse(U.data);if(_.success)console.debug("Parsed message",_.data),this.onmessage?.(_.data);else if(U.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",_.error.message,U);else console.error("Failed to parse message",_.error.message,U),this.onerror?.(Error("Invalid JSON-RPC message received: "+_.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send($,v){if($.method!==aq)console.debug("Sending message",$);this.eventTarget.postMessage($,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}class QF extends RU{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor($,v={},U={autoResize:!0}){super(U);this._appInfo=$,this._capabilities=v,this.options=U,this.setRequestHandler(f6,(_)=>{return console.log("Received ping:",_.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput($){this.setNotificationHandler(bF,(v)=>$(v.params))}set ontoolinputpartial($){this.setNotificationHandler(GF,(v)=>$(v.params))}set ontoolresult($){this.setNotificationHandler(wF,(v)=>$(v.params))}set ontoolcancelled($){this.setNotificationHandler(OF,(v)=>$(v.params))}set onhostcontextchanged($){this.setNotificationHandler(AF,(v)=>{this._hostContext={...this._hostContext,...v.params},$(v.params)})}set onteardown($){this.setRequestHandler(BF,(v,U)=>$(v.params,U))}set oncalltool($){this.setRequestHandler(yU,(v,U)=>$(v.params,U))}set onlisttools($){this.setRequestHandler(uU,(v,U)=>$(v.params,U))}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:$},rU,v)}async listServerResources($,v){return await this.request({method:"resources/list",params:$},NU,v)}sendMessage($,v){return this.request({method:"ui/message",params:$},_F,v)}sendLog($){return this.notification({method:"notifications/message",params:$})}updateModelContext($,v){return this.request({method:"ui/update-model-context",params:$},A0,v)}openLink($,v){return this.request({method:"ui/open-link",params:$},gF,v)}sendOpenLink=this.openLink;downloadFile($,v){return this.request({method:"ui/download-file",params:$},UF,v)}requestTeardown($={}){return this.notification({method:"ui/notifications/request-teardown",params:$})}requestDisplayMode($,v){return this.request({method:"ui/request-display-mode",params:$},YF,v)}sendSizeChanged($){return this.notification({method:"ui/notifications/size-changed",params:$})}setupSizeChangedNotifications(){let $=!1,v=0,U=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!==U)v=W,U=B,this.sendSizeChanged({width:W,height:B})})};_();let g=new ResizeObserver(_);return g.observe(document.documentElement),g.observe(document.body),()=>g.disconnect()}async connect($=new V0(window.parent,window.parent),v){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect($);try{let U=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:JO}},SF,v);if(U===void 0)throw Error(`Server sent invalid initialize result: ${U}`);if(this._hostCapabilities=U.hostCapabilities,this._hostInfo=U.hostInfo,this._hostContext=U.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(U){throw this.close(),U}}}function RW($){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 NF=[JO];class OO extends RU{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;constructor($,v,U,_){super(_);this._client=$,this._hostInfo=v,this._capabilities=U,this._hostContext=_?.hostContext||{},this.setRequestHandler(MF,(g)=>this._oninitialize(g)),this.setRequestHandler(f6,(g,z)=>{return this.onping?.(g.params,z),{}}),this.setRequestHandler(yW,(g)=>{return{mode:this._hostContext.displayMode??"inline"}})}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;set onsizechange($){this.setNotificationHandler(JF,(v)=>$(v.params))}set onsandboxready($){this.setNotificationHandler(zF,(v)=>$(v.params))}set oninitialized($){this.setNotificationHandler(IF,(v)=>$(v.params))}set onmessage($){this.setRequestHandler(XF,async(v,U)=>{return $(v.params,U)})}set onopenlink($){this.setRequestHandler(vF,async(v,U)=>{return $(v.params,U)})}set ondownloadfile($){this.setRequestHandler(FF,async(v,U)=>{return $(v.params,U)})}set onrequestteardown($){this.setNotificationHandler(kF,(v)=>$(v.params))}set onrequestdisplaymode($){this.setRequestHandler(yW,async(v,U)=>{return $(v.params,U)})}set onloggingmessage($){this.setNotificationHandler(UO,async(v)=>{$(v.params)})}set onupdatemodelcontext($){this.setRequestHandler(ZF,async(v,U)=>{return $(v.params,U)})}set oncalltool($){this.setRequestHandler(yU,async(v,U)=>{return $(v.params,U)})}sendToolListChanged($={}){return this.notification({method:"notifications/tools/list_changed",params:$})}set onlistresources($){this.setRequestHandler(iG,async(v,U)=>{return $(v.params,U)})}set onlistresourcetemplates($){this.setRequestHandler(lG,async(v,U)=>{return $(v.params,U)})}set onreadresource($){this.setRequestHandler(pG,async(v,U)=>{return $(v.params,U)})}sendResourceListChanged($={}){return this.notification({method:"notifications/resources/list_changed",params:$})}set onlistprompts($){this.setRequestHandler(nG,async(v,U)=>{return $(v.params,U)})}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:NF.includes(v)?v:JO,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext($){let v={},U=!1;for(let _ of Object.keys($)){let g=this._hostContext[_],z=$[_];if(rF(g,z))continue;v[_]=z,U=!0}if(U)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:$},PF,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(U,_)=>{return this._client.request({method:"tools/call",params:U},c6,{signal:_.signal})},v.tools.listChanged)this._client.setNotificationHandler(gO,(U)=>this.sendToolListChanged(U.params))}if(v.resources){if(this.onlistresources=async(U,_)=>{return this._client.request({method:"resources/list",params:U},NU,{signal:_.signal})},this.onlistresourcetemplates=async(U,_)=>{return this._client.request({method:"resources/templates/list",params:U},hG,{signal:_.signal})},this.onreadresource=async(U,_)=>{return this._client.request({method:"resources/read",params:U},rU,{signal:_.signal})},v.resources.listChanged)this._client.setNotificationHandler(oG,(U)=>this.sendResourceListChanged(U.params))}if(v.prompts){if(this.onlistprompts=async(U,_)=>{return this._client.request({method:"prompts/list",params:U},tG,{signal:_.signal})},v.prompts.listChanged)this._client.setNotificationHandler(vO,(U)=>this.sendPromptListChanged(U.params))}}return super.connect($)}}function rF($,v){return JSON.stringify($)===JSON.stringify(v)}function KO($){return $!==null&&typeof $==="object"&&!Array.isArray($)}function uF($){return KO($)&&Array.isArray($.content)&&$.content.every((v)=>KO(v)&&typeof v.type==="string")}function yF(...$){for(let v of $)if(typeof v==="string"){if(v.trim().length>0)return v}return}function DF($){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 WO($){let v=$.success===!1;if(uF($.result))return{...$.result,isError:$.result.isError===!0||v};let U=KO($.result)?$.result:null,_=yF($.detailedContent,$.content,U?.detailedContent,U?.content,U?.textResultForLlm,U?.text,U?.message,typeof $.result==="string"?$.result:void 0,$.error)??DF($.result);return{content:_?[{type:"text",text:_}]:[],isError:v}}function TW($,v){if($===v)return!0;if($.isError!==v.isError)return!1;try{let U=JSON.stringify($),_=JSON.stringify(v);if(U===void 0||_===void 0)return!1;if(Math.abs(U.length-_.length)>2000000)return!1;return U===_}catch{return!1}}function jW($,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 BO="allow-scripts allow-popups allow-popups-to-escape-sandbox";function VW($){return Boolean($)&&typeof $==="object"&&$!==null&&!Array.isArray($)&&"ok"in $&&typeof $.ok==="boolean"}async function RF($,v){let U=await fetch("/api/canvas/frame-documents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:$,sandbox:v})}),_=await U.json();if(!U.ok||!VW(_)||!_.ok||typeof _.url!=="string"){let g=VW(_)&&_.error?_.error:`Frame document request failed with HTTP ${U.status}`;throw Error(g)}return _.url}function CW($,v){let[U,_]=o(null);return c(()=>{if(_(null),!$)return;let g=!1;return RF($,v).then((z)=>{if(!g)_(z)}).catch((z)=>{console.error("[iframe-document] failed to create frame document:",z)}),()=>{g=!0}},[$,v]),n$(()=>({attributes:U?{src:U}:{},ready:Boolean(U),key:U??""}),[U])}function Pg($){let{enabled:v,token:U,nodeId:_,sourceSurface:g,iframeRef:z}=$;c(()=>{if(!v||!U)return;function J(b){if(b.source!==z.current?.contentWindow)return;let O=b.data;if(!O||O.source!==l_||O.token!==U||O.nodeId!==_)return;let K=O.interaction;if(!K||typeof K.type!=="string")return;let W=K.type;F_({type:W,sourceNodeId:_,sourceSurface:g,...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:h_,token:U,...O.correlationId?{correlationId:O.correlationId}:{},interaction:{type:W},result:B},"*")})}return window.addEventListener("message",J),()=>window.removeEventListener("message",J)},[v,U,_,g])}async function J4($,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 PO($){return/AppleWebKit/.test($)&&!/Chrome|Chromium|CriOS|Edg|Android/.test($)}var TF=1000,jF=7000;function b4($,v){if(typeof window>"u")return;let U=window;if(U.__PMX_EXTAPP_LOG??=[],U.__PMX_EXTAPP_LOG.length<500)U.__PMX_EXTAPP_LOG.push({t:Date.now(),nodeId:$,event:v});VF({t:Date.now(),nodeId:$,event:v})}var fW=[],kO=null;function VF($){if(fW.push({...$,...typeof document<"u"?{visibility:document.visibilityState}:{}}),kO)return;kO=setTimeout(()=>{kO=null;let v=fW.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 cW=Promise.resolve();function CF($){cW=cW.then(async()=>{if(!$.remount())return;await $.awaitBoot(),await new Promise((v)=>setTimeout(v,TF))}).catch(()=>{})}function fF($,v){return v?$==="done":$==="ready"||$==="done"}function cF($,v){let U=typeof $.data.html==="string"?$.data.html:"",_=typeof $.data.serverName==="string"?$.data.serverName:"",g=typeof $.data.appSessionId==="string"?$.data.appSessionId:"",z=typeof $.data.sessionStatus==="string"?$.data.sessionStatus:"";return`${$.id}:${v}:${_}:${g}:${z}:${U}`}function mF($,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 mW($,v,U){if(await $.sendToolInput({arguments:v}),U)await $.sendToolResult(U)}function EF($){return typeof $==="string"&&$.trim().length>0?$.trim():BO}function iF($,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: '${l_}',
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 !== '${h_}' || 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 lF($,v){return`<script data-pmx-canvas-boot-beacon>
226
- window.parent.postMessage({ source: '${t2}', token: ${JSON.stringify($)}, nodeId: ${JSON.stringify(v)} }, '*');
227
- </script>`}function hF($,v){if(!v)return $;let U=/<head\b[^>]*>/i.exec($);if(U?.index!==void 0){let g=U.index+U[0].length;return`${$.slice(0,g)}${v}${$.slice(g)}`}let _=/<body\b[^>]*>/i.exec($);if(_?.index!==void 0){let g=_.index+_[0].length;return`${$.slice(0,g)}${v}${$.slice(g)}`}return`${v}${$}`}function kg($,v){if(Number.isFinite($)&&$>0)return Math.round($);if(Number.isFinite(v)&&v>0)return Math.round(v);return 1}function HO($,v){let U=$?.getBoundingClientRect();return{width:kg($?.clientWidth??0,kg(U?.width??0,v.width)),height:kg($?.clientHeight??0,kg(U?.height??0,v.height))}}function xF($,v){return typeof $==="number"&&Number.isFinite($)&&$>0&&!v}function pF($,v){return Math.max(kg($,1),kg(v,1))}function EW({node:$,expanded:v=!1}){let U=y(null),_=y(null),g=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),F=y(0),I=y(!1),H=y(!1),Y=y([]),q=y(!1),w=y(!1),N=y(!1),[C,p]=o("loading"),[r,n]=o(null),[e,u]=o(0),Q=$.data.html,g$=$.data.serverName,m=$.data.appSessionId,i=$.data.toolInput??{},H$=$.data.toolResult,q$=$.data.toolName??"ext-app",x$=$.data.toolDefinition,M=$.data.toolCallId,x=typeof M==="string"||typeof M==="number"?M:void 0,s=$.data.resourceMeta,d=$.data.sessionStatus,b$=$.data.sessionError,U$=$.size.height,l=$.id,f=cF($,e),a=H$!=null,G$=EF(null),V$=$.data.axCapabilities?.enabled===!0&&typeof Q==="string"&&Q.length>0,C$=n$(()=>`ax-${crypto.randomUUID()}`,[]),Kv=V$?iF(C$,l):"",Wv=typeof Q==="string"&&Q.length>0?lF(C$,l):"",P6=CW(hF(Q??"",Wv+Kv),G$);c(()=>{function W$(r$){if(r$.source!==U.current?.contentWindow)return;let p$=r$.data;if(!p$||p$.source!==t2||p$.token!==C$||p$.nodeId!==l)return;H.current=!0}return window.addEventListener("message",W$),()=>window.removeEventListener("message",W$)},[C$,l]),Pg({enabled:V$,token:C$,nodeId:l,sourceSurface:"mcp-app",iframeRef:U});let lU=3,k6=(W$)=>{if(F.current>=lU){b4(l,`remount-cap-hit (${W$})`);return}if(q.current)return;F.current+=1,q.current=!0,b4(l,`remount-queued #${F.current} (${W$})`),CF({remount:()=>{if(q.current=!1,N.current||j$.value===l)return b4(l,"remount-skipped"),!1;return w.current=typeof document<"u"&&document.visibilityState==="hidden",b4(l,`remount-run #${F.current}`),p("loading"),u((r$)=>r$+1),!0},awaitBoot:()=>new Promise((r$)=>{let p$=window.setTimeout(bv,jF);function bv(){window.clearTimeout(p$),r$()}Y.current.push(bv)})})};c(()=>{if(v||P.current)return;if(!fF(C,a))return;if(typeof navigator>"u"||typeof window>"u")return;if(!PO(navigator.userAgent))return;P.current=!0,k6("post-boot-repaint")},[C,a]),c(()=>{if(v)return;if(typeof document>"u"||typeof navigator>"u"||typeof window>"u")return;if(!PO(navigator.userAgent))return;function W$(){if(document.visibilityState!=="visible")return;if(!w.current||N.current)return;w.current=!1,F.current=0,b4(l,"visible-again-rearm"),k6("visible-after-hidden-boot")}return document.addEventListener("visibilitychange",W$),()=>document.removeEventListener("visibilitychange",W$)},[v,l]);let hU=6000;c(()=>{if(v)return;if(typeof navigator>"u"||typeof window>"u")return;if(!PO(navigator.userAgent))return;if(!P6.ready)return;let W$=window.setTimeout(()=>{if(I.current||H.current||N.current)return;k6("boot-watchdog")},hU);return()=>window.clearTimeout(W$)},[f,P6.ready,v]),c(()=>()=>{N.current=!0;for(let W$ of Y.current.splice(0))W$()},[]);let sv=(W$)=>W$==="light"?"light":"dark",Av=v||j$.value===l;J.current=i,b.current=H$;let Zg=d==="error"?b$??"Saved app session is unavailable. Reopen the app to restore interactivity.":"Reconnecting saved app session...",e0=(W$)=>{let r$=b.current;if(!W$||!B.current||!r$)return null;if(K.current===r$)return null;if(K.current&&TW(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 H6=bv instanceof Error?bv.message:String(bv);throw n(`Tool result delivery failed: ${H6}`),bv}).finally(()=>{W.current=null});return W.current=p$,p$};if(c(()=>{if(!Q||!P6.ready)return;let W$=U.current;if(!W$)return;let r$=!1,p$=null,bv=null,H6=null,l6=null;O.current=!1,K.current=void 0,W.current=null,B.current=!1,I.current=!1,H.current=!1;let xU=()=>{if(!p$)return;clearTimeout(p$),p$=null};return(async()=>{if(!Q)return;let L6=W$.contentWindow;if(!L6)throw Error("Ext-app iframe window is unavailable");let h6=(L$=j$.value===l?"fullscreen":"inline")=>({theme:sv(T$.value),platform:"web",containerDimensions:HO(W$,{width:$.size.width,height:U$}),displayMode:L$,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,...x$?{toolInfo:{id:x,tool:x$}}:{}}),YP=()=>{if(H6!==null)return;H6=requestAnimationFrame(()=>{if(H6=null,r$||!B.current)return;u$.setHostContext?.(h6())})},cO=()=>{if(l6!==null)return;l6=requestAnimationFrame(()=>{l6=requestAnimationFrame(()=>{if(l6=null,r$||!B.current)return;u$.sendHostContextChange?.(h6())})})},u$=new OO(null,{name:"PMX Canvas",version:"1.0.0"},{openLinks:{},serverTools:{listChanged:!1},serverResources:{listChanged:!1},logging:{},updateModelContext:{text:{},structuredContent:{}}},{hostContext:h6(Av?"fullscreen":"inline")});u$.onsizechange=async({height:L$})=>{if(xF(L$,j$.value===l)){let Bv=HO(W$.parentElement??W$,{width:$.size.width,height:U$}),mv=pF(L$,Bv.height);W$.style.height=`${mv}px`;let x6=T.value.get(l)?.size??$.size,EO=Math.max(x6.height,mv+O5);if(Math.abs(EO-x6.height)>8){if(Z4(l,{width:x6.width,height:EO}),z.current!==null)window.clearTimeout(z.current);z.current=window.setTimeout(()=>{t$({recordHistory:!1}),z.current=null},0)}}return{}},u$.onopenlink=async({url:L$})=>{return window.open(L$,"_blank","noopener"),{}},u$.onsandboxready=async()=>{await u$.sendSandboxResourceReady({html:Q,sandbox:BO,...s?.csp?{csp:s.csp}:{},...s?.permissions?{permissions:s.permissions}:{}})},u$.onrequestdisplaymode=async({mode:L$})=>{let{nextMode:Bv,shouldExpand:mv,shouldCollapse:x6}=mF(L$,Av);if(mv)z6(l);else if(x6)d6();return{mode:Bv}},u$.oncalltool=async(L$)=>{if(!m)throw Error(Zg);try{let Bv=await J4("/api/ext-app/call-tool",{sessionId:m,nodeId:l,serverName:g$,toolName:L$.name,arguments:L$.arguments??{}});return n(null),Bv}catch(Bv){let mv=Bv instanceof Error?Bv.message:String(Bv);throw n(`Tool call failed: ${mv}`),Bv}},u$.setRequestHandler(uU,async()=>{if(!m)return{tools:[]};return J4("/api/ext-app/list-tools",{sessionId:m})}),u$.onlistresources=async()=>m?J4("/api/ext-app/list-resources",{sessionId:m}):{resources:[]},u$.onlistresourcetemplates=async()=>m?J4("/api/ext-app/list-resource-templates",{sessionId:m}):{resourceTemplates:[]},u$.onreadresource=async(L$)=>{if(!m)throw Error(Zg);return J4("/api/ext-app/read-resource",{sessionId:m,uri:L$.uri})},u$.onlistprompts=async()=>m?J4("/api/ext-app/list-prompts",{sessionId:m}):{prompts:[]},u$.onupdatemodelcontext=async(L$)=>{if(!m)return{};return await J4("/api/ext-app/model-context",{nodeId:l,...Array.isArray(L$.content)?{content:L$.content}:{},...L$.structuredContent&&typeof L$.structuredContent==="object"?{structuredContent:L$.structuredContent}:{}}),{}};let $2=new V0(L6,L6);if(u$.oninitialized=()=>{if(r$)return;xU(),B.current=!0,I.current=!0,b4(l,"initialized"),p("ready"),n(null),Promise.resolve(u$.sendHostContextChange(h6(Av?"fullscreen":"inline"))).then(()=>mW(u$,J.current,void 0)).then(()=>e0(u$)).then(()=>{b4(l,"settled");for(let L$ of Y.current.splice(0))L$();cO()}).catch((L$)=>{let Bv=L$ instanceof Error?L$.message:String(L$);n(`Bridge bootstrap failed: ${Bv}`)})},p$=setTimeout(()=>{if(r$||B.current)return;let L$=b.current,Bv=h6(Av?"fullscreen":"inline");B.current=!0,u$.setHostContext?.(Bv),Promise.resolve(u$.sendHostContextChange(Bv)).then(()=>mW(u$,J.current,L$)).then(()=>{if(O.current=Boolean(L$),L$)K.current=L$;p(L$?"done":"ready"),n(null),cO()}).catch((mv)=>{let x6=mv instanceof Error?mv.message:String(mv);n(`Bridge bootstrap fallback failed: ${x6}`)})},1200),await u$.connect($2),r$){xU(),await $2.close();return}if(_.current=u$,g.current=$2,bv=new ResizeObserver(YP),bv.observe(W$),W$.parentElement)bv.observe(W$.parentElement);let mO=!0;k.current=T$.subscribe((L$)=>{if(mO){mO=!1;return}if(r$)return;u$.setHostContext?.({...h6(),theme:sv(L$)}),u$.sendHostContextChange?.(h6())}),e0(u$)})().catch((L6)=>{xU(),console.error("[ext-app] Bridge init failed:",L6),n(L6?.message??"Bridge initialization failed")}),()=>{if(r$=!0,xU(),bv?.disconnect(),bv=null,H6!==null)cancelAnimationFrame(H6),H6=null;if(l6!==null)cancelAnimationFrame(l6),l6=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,g.current)g.current.close().catch((L6)=>{console.error("[ext-app] transport close failed:",L6)}),g.current=null}},[f,P6.key]),c(()=>{if(H$&&_.current&&(C==="ready"||C==="done"))e0(_.current)},[H$,C]),c(()=>{let W$=_.current;if(U.current)U.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:HO(U.current,{width:$.size.width,height:U$}),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,U$]),!Q)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:Zg},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:U,...P6.attributes,sandbox:G$,allow:RW(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 C0($,v,U){let _=y($);_.current=$;let g=y(null);c(()=>{if(!U)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!==U)return;let O=_.current,K=typeof b.height==="number"?b.height:0,W=B5(O,K);if(W===null)return;if(Z4(O.id,{width:O.size.width,height:W}),g.current!==null)window.clearTimeout(g.current);g.current=window.setTimeout(()=>{t$({recordHistory:!1}),g.current=null},300)}return window.addEventListener("message",z),()=>{if(window.removeEventListener("message",z),g.current!==null)window.clearTimeout(g.current),g.current=null}},[$.id,U])}function oF($,v,U,_,g,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 U==="number")b.searchParams.set("v",String(U));if(_)b.searchParams.set("axToken",_);if(g)b.searchParams.set("axNodeId",g);if(z)b.searchParams.set("frameToken",z);if(J)b.searchParams.set("fit","content");return b.toString()}catch{return $}}function nF($,v=window.location.origin){if(!$)return!1;try{let U=new URL(v).origin,_=new URL($,U);return _.origin===U&&_.pathname.startsWith("/api/canvas/frame-documents/")}catch{return!1}}function E6({node:$,expanded:v=!1}){if($.data.mode==="ext-app")return G(EW,{node:$,expanded:v},void 0,!1,void 0,this);return G(tF,{node:$,expanded:v},void 0,!1,void 0,this)}function tF({node:$,expanded:v}){let U=y(null),_=$.type==="mcp-app"&&$.data.viewerType==="web-artifact",g=$.type==="json-render"||$.type==="graph",z=$.data.axCapabilities?.enabled,b=(g||_)&&(_?z===!0:z!==!1),O=_?"mcp-app":"json-render",K=n$(()=>b?`ax-${crypto.randomUUID()}`:"",[b]),W=a2($)&&!v,B=n$(()=>W?`frame-${crypto.randomUUID()}`:"",[W]);C0($,U,B),Pg({enabled:b&&Boolean(K),token:K,nodeId:$.id,sourceSurface:O,iframeRef:U});let k=X6.value,P=()=>{if(!b||!K||k==null)return;U.current?.contentWindow?.postMessage({source:xv,type:"ax-update",token:K,state:k},"*")};c(P,[b,K,k]);let F=typeof $.data.specVersion==="number"?$.data.specVersion:void 0,I=oF($.data.url||"",v,F,K||void 0,b?$.id:void 0,B||void 0,W),H=$.data.sourceServer||"",Y=$.data.hostMode||"hosted",q=$.data.fallbackReason,w=$.data.trustedDomain===!0||nF(I);if(Y==="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:I,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all"},children:I},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:[!w&&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:U,src:I,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 jU=null;function d$($){return getComputedStyle(document.documentElement).getPropertyValue($).trim()}function f0(){if(jU)return jU;return jU={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")},jU}function Hg(){jU=null}var c0={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 LO($){let v=typeof $.data.phase==="string"&&$.data.phase.trim().length>0?$.data.phase.trim():"";if(v)return v;let U=typeof $.data.content==="string"&&$.data.content.trim().length>0?$.data.content.trim():"";if(U)return U;return(typeof $.data.status==="string"&&$.data.status.trim().length>0?$.data.status.trim():"")||"idle"}function Lg({node:$}){let v=LO($),U=$.data.detail||"",_=$.data.message||"",g=$.data.level||"ok",z=$.data.activeTool,J=$.data.subagent,b=c0[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),U&&G("span",{style:{color:"var(--c-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U},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:g==="warn"?"var(--c-warn)":g==="error"?"var(--c-danger)":"var(--c-muted)",lineHeight:1.4},children:_},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ig($){return typeof $==="string"&&$.trim().length>0?$.trim():null}function iW($){if(typeof $==="string"){let g=Ig($);return g?{title:"Evidence warning",detail:g}:null}if(!$||typeof $!=="object")return null;let v=$,U=Ig(v.title)??"Evidence warning",_=Ig(v.detail);return _?{title:U,detail:_}:null}function dF($){let v=[],U=iW($.data.warning);if(U)v.push(U);let _=$.data.warnings;if(Array.isArray(_))for(let z of _){let J=iW(z);if(J)v.push(J)}let g=Ig($.data.validationStatus)?.toLowerCase();if(g==="failed"||g==="invalid")v.push({title:"Image failed validation",detail:Ig($.data.validationMessage)??"Review this image before using it as evidence."});return v}function aF($){let v=[$.data.title,$.data.caption,$.data.alt,$.data.src,$.data.path].map((U)=>Ig(U)?.toLowerCase()??"").join(" ");if(v.length===0)return!1;return["login","log in","sign in","signin","password","2fa","mfa","authenticate","authentication","sso"].some((U)=>v.includes(U))}function lW($){let v=dF($);if(v.length>0)return v;if(aF($))return[{title:"Captured login page",detail:"This image looks like an auth screen. Treat it as environment context, not product evidence."}];return[]}function m0({node:$,expanded:v=!1}){let U=$.data.src||"",_=$.data.alt||$.data.title||"Image",g=$.data.caption||"",z=lW($),J=U.startsWith("data:")||U.startsWith("http://")||U.startsWith("https://")?U:`/api/canvas/image/${$.id}`,[b,O]=o(!1),[K,W]=o(!1),[B,k]=o(1),[P,F]=o({x:0,y:0}),[I,H]=o({w:0,h:0}),Y=y(null),q=y(!1),w=y({x:0,y:0}),N=S((m)=>{let i=m.target;H({w:i.naturalWidth,h:i.naturalHeight}),O(!0),W(!1)},[]),C=S(()=>{W(!0),O(!1)},[]);c(()=>{k(1),F({x:0,y:0})},[U]);let p=S((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)))},[]),r=S((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=S((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},F((q$)=>({x:q$.x+i,y:q$.y+H$}))},[]),e=S(()=>{q.current=!1},[]),u=S(()=>{k(1),F({x:0,y:0})},[]);if(!U)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 Q=I.w>0?`${I.w}×${I.h}`:"",g$=Math.round(B*100);return G("div",{class:`image-node ${v?"image-node-expanded":""}`,ref:Y,children:[z.length>0&&G("div",{class:"image-node-warning-stack",children:z.map((m)=>G("div",{class:"image-node-warning",children:[G("span",{class:"image-node-warning-title",children:m.title},void 0,!1,void 0,this),G("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),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:U},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),(g||Q||B!==1)&&G("div",{class:"image-node-footer",children:[g&&G("span",{class:"image-node-caption",children:g},void 0,!1,void 0,this),G("span",{class:"image-node-meta",children:[Q&&G("span",{children:Q},void 0,!1,void 0,this),B!==1&&G("button",{type:"button",class:"image-node-zoom-reset",onClick:u,title:"Reset zoom",children:[g$,"% ↺"]},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 hW({node:$}){let v=$.data.children??[],U=T.value,_=v.filter((b)=>U.has(b)),g=_.length,z={};for(let b of _){let O=U.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:[g," node",g!==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),g===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 sF($){try{return new URL($).host}catch{return $}}function eF($){if(!$)return null;let v=new Date($);return Number.isNaN(v.getTime())?null:v.toLocaleString()}function E0({node:$,expanded:v=!1}){let U=typeof $.data.url==="string"?$.data.url:"",_=typeof $.data.pageTitle==="string"?$.data.pageTitle:"",g=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=eF(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,F]=o(!1),[I,H]=o(v);c(()=>{if(v)H(!0)},[v]);let Y=S(async()=>{if(!U||P)return;F(!0);try{await Y_($.id)}finally{F(!1)}},[$.id,P,U]);if(!U)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:sF(U)},void 0,!1,void 0,this),G("div",{style:{fontSize:v?"18px":"15px",fontWeight:700,color:"var(--c-text)"},children:_||$.data.title||U},void 0,!1,void 0,this),G("a",{href:U,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--c-accent)",fontSize:"12px",wordBreak:"break-all",textDecoration:"none"},children:U},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),(g||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),g&&G("p",{style:{margin:0,color:"var(--c-text-soft)",lineHeight:1.5,fontSize:v?"14px":"12px"},children:g},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:Y,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((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:I?"Hide live preview":"Show live preview"},void 0,!1,void 0,this),G("button",{type:"button",onClick:()=>window.open(U,"_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&&I&&!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||U,src:U,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 xW($){let v=5381;for(let U=0;U<$.length;U+=1)v=(v<<5)+v+$.charCodeAt(U)|0;return(v>>>0).toString(36)}function IO($,v={}){let U=new URLSearchParams;if(U.set("theme",v.theme??T$.value),v.themeToken)U.set("themeToken",v.themeToken);if(v.present)U.set("present","1");if(v.presentToken)U.set("presentToken",v.presentToken);if(v.v)U.set("v",v.v);if(v.axToken)U.set("axToken",v.axToken);if(v.frameToken)U.set("frameToken",v.frameToken);return`/api/canvas/surface/${encodeURIComponent($)}?${U.toString()}`}function i0($){return jW($.type,$.data)}async function l0($){let v=IO($.id);if(!(await V3($.id,v)).opened)window.open(v,"_blank","noopener")}function pW($){return $.type==="html"&&$.data.presentation===!0}function VU({node:$,expanded:v=!1,presentation:U=!1,presentationExitToken:_,autoFocus:g=!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$(()=>xW(W),[W]),k=n$(()=>W?IO($.id,{theme:J,themeToken:b,present:U,presentToken:_,v:B,axToken:O,frameToken:K}):"",[W,U,_,b,B,$.id,O,K]);C0($,z,v?"":K),Pg({enabled:!0,token:O,nodeId:$.id,sourceSurface:"html-node",iframeRef:z}),c(()=>{if(z.current?.contentWindow?.postMessage({source:xv,type:"theme-update",token:b,theme:J},"*"),g)z.current?.focus()},[J,b]);let P=$.data.axCapabilities,F=P?.enabled===!0&&(!Array.isArray(P.allowed)||P.allowed.length>0),I=X6.value;c(()=>{if(!F||I==null)return;z.current?.contentWindow?.postMessage({source:xv,type:"ax-update",token:O,state:I},"*")},[F,I,O]),c(()=>{if(!g)return;let Y=window.setTimeout(()=>z.current?.focus(),0);return()=>window.clearTimeout(Y)},[g,k]);let H=()=>{if(z.current?.contentWindow?.postMessage({source:xv,type:"theme-update",token:b,theme:J},"*"),F&&X6.value!=null)z.current?.contentWindow?.postMessage({source:xv,type:"ax-update",token:O,state:X6.value},"*");if(g)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:U?"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:g?0:void 0,onLoad:H,style:{width:"100%",height:"100%",minHeight:U?0:v?"70vh":"300px",border:"none",background:"var(--c-bg)",borderRadius:U?0:"6px",display:"block"}},void 0,!1,void 0,this)}var YO=null;async function oW(){if(!YO)YO=await D3();return YO}function nW($,v){if(!$)return null;let U=$.toLowerCase(),_=v.find((z)=>z.name.toLowerCase()===U);if(_)return _.name;let g=v.filter((z)=>z.name.toLowerCase().startsWith(U));return g.length===1?g[0].name:null}function $X($){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 vX({html:$}){let v=y(null);return c(()=>{let U=v.current;if(!U)return;if(U.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,U.append(_.content.cloneNode(!0))},[$]),G("div",{ref:v},void 0,!1,void 0,this)}function gX($,v){return`${$.role}:${$.status??"none"}:${v}:${$.text}`}function tW({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 dW({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 h0({node:$,expanded:v=!1}){let U=Array.isArray($.data.turns)?$.data.turns:[],_=U.length===0,g=$.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,F]=o(""),[I,H]=o(null),[Y,q]=o(new Map),w=y(null),N=y(null),C=U[U.length-1],p=`${U.length}:${C?.role??""}:${C?.status??""}:${Math.floor((C?.text?.length??0)/200)}`;c(()=>{if(v&&b&&w.current)w.current.focus()},[v,b]),c(()=>{if(!p)return;if(N.current)N.current.scrollTo({top:N.current.scrollHeight,behavior:"smooth"})},[p]);let r=y(null),n=y(U);n.current=U,c(()=>{let i=U.some((q$)=>q$.role==="assistant"&&q$.status==="streaming"),H$=()=>{let q$=!1,M=n.current.map((x,s)=>({turn:x,index:s})).filter(({turn:x})=>x.role==="assistant"&&x.text);if(M.length===0)return;return Promise.all(M.map(async({turn:x,index:s})=>{let d=await U6(x.text);return{index:s,html:$X(d)}})).then((x)=>{if(q$)return;let s=new Map;for(let d of x)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}},[U]);let e=S(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 rg(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=S(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"}),F(""),!(await R3($.id,i)).ok)q$.pop(),v$($.id,{turns:q$,threadStatus:"answered"}),F(H$),H("Failed to send reply. Your draft has been restored.")},[P,$.id,$.data.turns]),Q=S((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$)oW().then((q$)=>{let x$=nW(H$,q$);if(x$)k(`/${x$}`)})}},[e,B]),g$=S((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$)oW().then((q$)=>{let x$=nW(H$,q$);if(x$)F(`/${x$}`)})}},[u,P]),m=Array.isArray($.data.contextNodeIds)?$.data.contextNodeIds.length:0;if(b&&U.length===0)return G("div",{class:"prompt-node-inner",style:{display:"flex",flexDirection:"column",height:"100%",gap:"8px"},children:[G(tW,{count:m},void 0,!1,void 0,this),G(dW,{message:I,onDismiss:()=>H(null)},void 0,!1,void 0,this),G("textarea",{ref:w,value:B,onInput:(i)=>k(i.target.value),onKeyDown:Q,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:g},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(tW,{count:m},void 0,!1,void 0,this),G(dW,{message:I,onDismiss:()=>H(null)},void 0,!1,void 0,this),G("div",{ref:N,style:{flex:1,overflow:"auto",minHeight:0},children:U.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:Y.get(H$)?G(a$,{children:[G(vX,{html:Y.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)]},gX(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:[U.length," turn",U.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)=>F(i.target.value),onKeyDown:g$,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 UX($){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 _X({html:$}){let v=y(null);return c(()=>{let U=v.current;if(!U)return;if(U.replaceChildren(),!$)return;let _=document.createElement("template");_.innerHTML=$,U.append(_.content.cloneNode(!0))},[$]),G("div",{ref:v},void 0,!1,void 0,this)}function x0({node:$,expanded:v=!1}){let U=$.data.content||"",_=$.data.status||"streaming",[g,z]=o(""),J=_==="streaming",b=_==="complete";c(()=>{if(!U){z("");return}let K=!1;return U6(U).then((W)=>{if(!K)z(UX(W))}),()=>{K=!0}},[U]);let O=S(()=>{rg("",{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:U?1:0.4,transition:"opacity 0.2s ease"},children:g?G("div",{class:v?"md-reader-content":void 0,children:G(_X,{html:g},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 aW($){return{toolName:$.toolName||$.title||"unknown",category:$.category||"other",status:$.status||"running",duration:$.duration||"",resultSummary:$.resultSummary||$.content||"",error:$.error||""}}var sW={mcp:"var(--c-accent)",file:"var(--c-warn)",subagent:"var(--c-purple)",other:"var(--c-muted)"},zX={running:"⠋",success:"✓",failed:"✕"},JX={running:"var(--c-accent)",success:"var(--c-ok)",failed:"var(--c-danger)"};function p0({node:$}){let{toolName:v,category:U,status:_,duration:g,resultSummary:z,error:J}=aW($.data),b=sW[U]??sW.other,O=zX[_]??"◌",K=JX[_]??"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),g&&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:g},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function FO($){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 bX($){let v=$.map((O)=>FO(O)).filter((O)=>O!==null);if(v.length===0)return null;let U=Math.min(...v.map((O)=>O.left)),_=Math.min(...v.map((O)=>O.top)),g=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:U-J,top:_-b,width:g-U+J*2,height:z-_+b*2}}function qO($,v){return{left:`${$.left}px`,top:`${$.top}px`,width:`${$.width}px`,height:`${$.height}px`,borderRadius:`${v}px`}}function eW(){let $=Array.from(L4.value),v=Array.from(I4.value),U=O_.value;if($.length===0&&v.length===0)return null;return G("div",{class:"attention-field-layer","aria-hidden":"true",children:[U.map((_)=>{let g=bX(_.nodeIds);if(!g)return null;return G("div",{class:"attention-field-region",style:qO(g,42)},_.id,!1,void 0,this)}),v.map((_)=>{let g=FO(_);if(!g)return null;return G("div",{class:"attention-field-node attention-field-secondary",style:qO({left:g.left-18,top:g.top-18,width:g.width+36,height:g.height+36},28)},`secondary-${_}`,!1,void 0,this)}),$.map((_)=>{let g=FO(_);if(!g)return null;return G("div",{class:"attention-field-node attention-field-primary",style:qO({left:g.left-24,top:g.top-24,width:g.width+48,height:g.height+48},30)},`primary-${_}`,!1,void 0,this)})]},void 0,!0,void 0,this)}var Iv=O$(new Map),Yg=O$(null),GX=480,OX=320,CU=new Map,W6=null;function XO($){Iv.value=$,WX()}function wO($){let v=CU.get($);if(v)clearTimeout(v),CU.delete($)}function $B($){wO($.id);let v=new Map(Iv.value);v.set($.id,{...$,phase:"forming"}),XO(v)}function KX($){if(wO($),!Iv.value.has($))return;let v=new Map(Iv.value);v.delete($),XO(v)}function vB($,v,U,_){let g=Iv.value.get($);if(!g||g.phase===v)return;let z=new Map(Iv.value);z.set($,{...g,phase:v,..._?{settledNodeId:_}:{}}),XO(z),wO($),CU.set($,setTimeout(()=>KX($),U))}function gB($,v){vB($,"settling",GX,v)}function AO($){vB($,"dissolving",OX)}function UB(){for(let $ of CU.values())clearTimeout($);if(CU.clear(),W6)clearInterval(W6),W6=null;Yg.value=null,Iv.value=new Map}function WX(){if(W6||Iv.value.size===0)return;W6=setInterval(()=>{let $=Date.now();for(let v of Iv.value.values())if(v.phase==="forming"&&v.expiresAt<=$)AO(v.id);if(Iv.value.size===0&&W6)clearInterval(W6),W6=null},1000),W6.unref?.()}var BX={fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"};function Y$({size:$=16,children:v,...U}){return G("svg",{width:$,height:$,viewBox:"0 0 16 16",...BX,...U,children:v},void 0,!1,void 0,this)}function JB($){return G(Y$,{...$,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 bB($){return G(Y$,{...$,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 GB($){return G(Y$,{...$,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 OB($){return G(Y$,{...$,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 KB($){return G(Y$,{...$,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 WB($){return G(Y$,{...$,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 BB($){return G(Y$,{...$,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 PB($){return G(Y$,{...$,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 kB($){return G(Y$,{...$,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 HB($){return G(Y$,{...$,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 LB($){return G(Y$,{...$,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 IB($){return G(Y$,{...$,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 YB($){return G(Y$,{...$,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 qB($){return G(Y$,{...$,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 FB($){return G(Y$,{...$,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 XB($){return G(Y$,{...$,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 wB({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 _B($){return G(Y$,{...$,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 PX($){return G(Y$,{...$,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 kX($){return G(Y$,{...$,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 HX($){return G(Y$,{...$,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 LX($){return G(Y$,{...$,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 zB($){return G(Y$,{...$,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 IX($){return G(Y$,{...$,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 YX($){return G(Y$,{...$,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 qX($){return G(Y$,{...$,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 FX($){return G(Y$,{...$,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 XX($){return G(Y$,{...$,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 wX($){return G(Y$,{...$,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 AX($){return G(Y$,{...$,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 ZX($){return G(Y$,{...$,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 MX($){return G(Y$,{...$,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 fU($){switch($){case"markdown":return _B;case"prompt":return PX;case"response":return kX;case"file":return HX;case"image":return LX;case"webpage":return zB;case"context":return IX;case"group":return YX;case"status":return qX;case"trace":return FX;case"ledger":return XX;case"mcp-app":return wX;case"ext-app":return AX;case"json-render":return ZX;case"graph":return MX;case"html":return zB;default:return _B}}var AB={width:260,height:150},SX={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 MO($){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 ZO($){return{x:$.left+$.width/2,y:$.top+$.height/2}}function cU($){if(typeof $.confidence!=="number")return 0.82;return 0.4+Math.max(0,Math.min(1,$.confidence))*0.55}function ZB($,v){let U=Math.max(40,Math.abs(v.x-$.x)/2);return`M ${$.x} ${$.y} C ${$.x+U} ${$.y}, ${v.x-U} ${v.y}, ${v.x} ${v.y}`}function SO({intent:$}){let v=MO($.nodeType)?fU($.nodeType):null,U=$.label||$.kind,_=typeof $.confidence==="number"?`${Math.round($.confidence*100)}%`:null;return G("div",{class:"intent-info",onMouseEnter:()=>Yg.value=$.id,onMouseLeave:()=>{if(Yg.value===$.id)Yg.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:U},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:(g)=>{g.stopPropagation(),F2($)},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 MB({intent:$,rect:v}){let U=MO($.nodeType)?fU($.nodeType):null,_=MO($.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:cU($)},children:[G("div",{class:"intent-ghost-titlebar",children:[G("span",{class:"intent-ghost-icon","aria-hidden":"true",children:U?G(U,{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(SO,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function SB({intent:$,rect:v,variant:U}){return G("div",{class:`intent-ghost intent-ghost-${U} is-${$.phase}`,"data-intent-id":$.id,style:{left:`${v.left}px`,top:`${v.top}px`,width:`${v.width}px`,height:`${v.height}px`,opacity:cU($)},children:[U==="edit"&&G("div",{class:"intent-edit-bar"},void 0,!1,void 0,this),G(SO,{intent:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function QX($){let v=$.phase==="settling"?B6($.settledNodeId):null;switch($.kind){case"create":{if(!$.position)return null;let U=$.nodeType&&SX[$.nodeType]||AB,_=v??{left:$.position.x,top:$.position.y,...U};return G(MB,{intent:$,rect:_},$.id,!1,void 0,this)}case"move":{if(!$.position)return null;let _=B6($.nodeId)??AB,g=v??{left:$.position.x,top:$.position.y,width:_.width,height:_.height};return G(MB,{intent:$,rect:g},$.id,!1,void 0,this)}case"remove":{let U=v??B6($.nodeId);if(!U)return null;return G(SB,{intent:$,rect:U,variant:"remove"},$.id,!1,void 0,this)}case"edit":{let U=v??B6($.nodeId);if(!U)return null;return G(SB,{intent:$,rect:U,variant:"edit"},$.id,!1,void 0,this)}case"connect":{if(!$.edge)return null;let U=B6($.edge.from),_=B6($.edge.to);if(!U||!_)return null;let g={x:(U.left+U.width/2+_.left+_.width/2)/2,y:(U.top+U.height/2+_.top+_.height/2)/2},z={left:g.x-110,top:g.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:cU($)},children:G(SO,{intent:$},void 0,!1,void 0,this)},$.id,!1,void 0,this)}default:return null}}function QB(){let $=Array.from(Iv.value.values());if(c(()=>{function v(U){if(U.key!=="Escape")return;let _=Yg.value;if(!_)return;let g=Iv.value.get(_);if(!g||g.phase!=="forming")return;U.stopImmediatePropagation(),U.preventDefault(),F2(g)}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 U=B6(v.edge.from),_=B6(v.edge.to);if(!U||!_)return null;return G("path",{d:ZB(ZO(U),ZO(_)),class:`intent-edge type-${v.edge.type}`,style:{opacity:cU(v)}},`line-${v.id}`,!1,void 0,this)}if(v.kind==="move"&&v.position){let U=B6(v.nodeId);if(!U)return null;let _=U,g={x:v.position.x+_.width/2,y:v.position.y+_.height/2};return G("path",{d:ZB(ZO(U),g),class:"intent-trail",markerEnd:"url(#intent-arrow)",style:{opacity:cU(v)}},`line-${v.id}`,!1,void 0,this)}return null})]},void 0,!0,void 0,this),$.map(QX)]},void 0,!0,void 0,this)}var qg=8,G4=O$(null),Fg=[],Xg=[],uB=null;function NB($){let v=$?.data.parentGroup;return typeof v==="string"&&v.length>0?v:null}function rB($){if(!$||!Array.isArray($.data.children))return[];return $.data.children.filter((v)=>typeof v==="string")}function NX($,v){let U=new Map(v.map((b)=>[b.id,b])),_=new Set([$]),g=U.get($);if(!g)return _;let z=NB(g);while(z&&!_.has(z))_.add(z),z=NB(U.get(z));if(g.type!=="group")return _;let J=[...rB(g)];while(J.length>0){let b=J.pop();if(!b||_.has(b))continue;_.add(b);let O=U.get(b);if(O?.type==="group")J.push(...rB(O))}return _}function yB($,v){Fg=[],Xg=[],uB=$;let U=Array.from(v),_=NX($,U);for(let g of U){if(_.has(g.id)||g.dockPosition!==null)continue;let z=g.position.x,J=g.position.x+g.size.width,b=g.position.x+g.size.width/2,O=g.position.y,K=g.position.y+g.size.height,W=g.position.y+g.size.height/2;Fg.push({val:z,minY:O,maxY:K}),Fg.push({val:J,minY:O,maxY:K}),Fg.push({val:b,minY:O,maxY:K}),Xg.push({val:O,minX:z,maxX:J}),Xg.push({val:K,minX:z,maxX:J}),Xg.push({val:W,minX:z,maxX:J})}}function DB(){Fg=[],Xg=[],uB=null}function RB($,v,U,_){let g=[$,$+U/2,$+U],z=[v,v+_/2,v+_],J=[0,U/2,U],b=[0,_/2,_],O=null,K=qg+1,W=null;for(let I=0;I<3;I++){let H=g[I];for(let Y of Fg){let q=Math.abs(H-Y.val);if(q<K)K=q,O=Y.val-J[I],W={axis:"x",pos:Y.val,from:Math.min(Y.minY,v),to:Math.max(Y.maxY,v+_)}}}let B=null,k=qg+1,P=null;for(let I=0;I<3;I++){let H=z[I];for(let Y of Xg){let q=Math.abs(H-Y.val);if(q<k)k=q,B=Y.val-b[I],P={axis:"y",pos:Y.val,from:Math.min(Y.minX,$),to:Math.max(Y.maxX,$+U)}}}let F=[];if(W&&K<=qg)F.push(W);if(P&&k<=qg)F.push(P);return{x:O!==null&&K<=qg?O:$,y:B!==null&&k<=qg?B:v,guides:F}}function TB({nodeId:$,viewport:v,onMove:U,onDragEnd:_}){let g=y(!1),z=y({x:0,y:0}),J=y({x:0,y:0});return S((O,K,W)=>{O.stopPropagation(),O.preventDefault(),g.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,!g.current||!B)return;let H=B;B=null;let Y=v.value.scale,q=(H.x-z.current.x)/Y,w=(H.y-z.current.y)/Y;U($,J.current.x+q,J.current.y+w)},F=(H)=>{if(!g.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(P)},I=()=>{if(k!==null)window.cancelAnimationFrame(k),P();g.current=!1,document.documentElement.classList.remove("is-node-dragging"),document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",I),document.removeEventListener("pointercancel",I),_()};document.addEventListener("pointermove",F),document.addEventListener("pointerup",I),document.addEventListener("pointercancel",I)},[$,v,U,_])}var rX=200,uX=100;function jB({nodeId:$,viewport:v,onResize:U,onResizeEnd:_}){let g=y(!1),z=y({x:0,y:0}),J=y({w:0,h:0});return S((O,K,W)=>{O.stopPropagation(),O.preventDefault(),g.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,!g.current||!B)return;let H=B;B=null;let Y=v.value.scale,q=(H.x-z.current.x)/Y,w=(H.y-z.current.y)/Y;U($,Math.max(rX,J.current.w+q),Math.max(uX,J.current.h+w))},F=(H)=>{if(!g.current)return;if(B={x:H.clientX,y:H.clientY},k!==null)return;k=window.requestAnimationFrame(P)},I=()=>{if(k!==null)window.cancelAnimationFrame(k),P();g.current=!1,document.documentElement.classList.remove("is-node-resizing"),document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",I),document.removeEventListener("pointercancel",I),_()};document.addEventListener("pointermove",F),document.addEventListener("pointerup",I),document.addEventListener("pointercancel",I)},[$,v,U,_])}function VB({node:$,children:v,onContextMenu:U}){let _=D$.value===$.id,g=i$.value.has($.id),z=R$.value.has($.id),J=L4.value.has($.id),b=!J&&I4.value.has($.id),O=K_.value.has($.id),K=!_&&o3.value.has($.id),W=w6.value,B=W!==null&&W.has($.id),k=W!==null&&!W.has($.id),[P,F]=o(!1),I=y(null),H=S((f,a,G$)=>{let K$=RB(a,G$,$.size.width,$.size.height),V$=T.value.get(f);if(V$?.position.x===K$.x&&V$.position.y===K$.y){G4.value=K$.guides.length>0?K$.guides:null;return}Pv(f,{position:{x:K$.x,y:K$.y}}),G4.value=K$.guides.length>0?K$.guides:null},[$.size.width,$.size.height]),Y=S(()=>{DB(),G4.value=null,t$()},[]),q=TB({nodeId:$.id,viewport:P$,onMove:H,onDragEnd:Y}),w=S((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=S(()=>{v$($.id,{userResized:!0}),Zv($.id,{data:{userResized:!0}}),t$()},[$.id]),C=jB({nodeId:$.id,viewport:P$,onResize:w,onResizeEnd:N}),p=S((f)=>{if(P)return;A6($.id),yB($.id,T.value.values()),q(f,$.position.x,$.position.y)},[$.id,$.position.x,$.position.y,q,P]),r=S((f)=>{if(f.stopPropagation(),f.shiftKey){n3($.id);return}A6($.id)},[$.id]),n=S((f)=>{if(U)U(f,$.id)},[U,$.id]),e=S((f)=>{f.stopPropagation(),F(!0),requestAnimationFrame(()=>I.current?.focus())},[]),u=$.data.title||s$[$.type],Q=S((f)=>{let a=f.trim();if(a&&a!==u)v$($.id,{title:a}),Zv($.id,{title:a});F(!1)},[$.id,u]),g$=y(null),m=y(!1),i=y(null);c(()=>{if(m.current||!d2($))return;let f=g$.current;if(!f)return;let a=new ResizeObserver(()=>{if(m.current){a.disconnect();return}let G$=f.scrollHeight,K$=W5($,G$);if(K$===null)return;if(Math.abs(K$-$.size.height)>8){if(Z4($.id,{width:$.size.width,height:K$}),i.current!==null)window.clearTimeout(i.current);i.current=window.setTimeout(()=>{t$({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",x$=q$&&$.data.status==="running",M=$.type==="group",x=$.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,U$={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":"",g?"selected":"",z?"context-pinned":"",J?"attention-focus-primary":"",b?"attention-focus-secondary":"",O?"attention-pulse":"",H$?"pinned":"",q$?"trace-node":"",x$?"trace-running":"",M?"group-node":"",x?"strict-size":""].filter(Boolean).join(" ");return G("div",{class:l,style:U$,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=fU($.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:I,class:"node-title-input",value:u,onBlur:(f)=>Q(f.target.value),onKeyDown:(f)=>{if(f.key==="Enter")Q(f.target.value);if(f.key==="Escape")F(!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(),w4($.id)},title:z?"Remove from context":"Add to context",children:"✦"},void 0,!1,void 0,this),i0($)&&G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),l0($)},title:"Open as site",children:"↗"},void 0,!1,void 0,this),H_.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(),Z6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(f)=>{f.stopPropagation(),A4($.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:g$,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 yX={relation:"var(--c-muted)","depends-on":"var(--c-warn)",flow:"var(--c-accent)",references:"var(--c-dim)"},DX=new Set(["depends-on","flow"]);function RX($){if($.style==="dashed")return"8 4";if($.style==="dotted")return"3 3";if($.type==="references"&&!$.style)return"8 4";return}function CB($,v){let U=$.position.x+$.size.width/2,_=$.position.y+$.size.height/2,g=v.position.x+v.size.width/2,z=v.position.y+v.size.height/2,J=g-U,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:U+K/W*(J>0?1:-1),y:_+K*P}}let k=J>0?1:-1;return{x:U+O*k,y:_+W*O*(b>0?1:-1)}}function TX($,v,U,_,g,z,J,b){return{x:0.125*$+0.375*U+0.375*g+0.125*J,y:0.125*v+0.375*_+0.375*z+0.125*b}}function jX({edge:$,fromNode:v,toNode:U,focused:_,dimmed:g}){let z=CB(v,U),J=CB(U,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,F=z.y+k*W,I=J.x-B*W,H=J.y-k*W,Y=`M ${z.x} ${z.y} C ${P} ${F}, ${I} ${H}, ${J.x} ${J.y}`,q=yX[$.type],w=DX.has($.type),N=RX($),C=$.label?TX(z.x,z.y,P,F,I,H,J.x,J.y):null,p=`edge-path-${$.id}`;return G("g",{children:[G("path",{d:Y,fill:"none",stroke:"transparent","stroke-width":"12",style:{cursor:"pointer"}},void 0,!1,void 0,this),_&&G("path",{d:Y,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:Y,fill:"none",stroke:q,"stroke-width":_?2.5:1.5,"stroke-dasharray":N,"marker-end":w?"url(#edge-arrow)":void 0,opacity:g?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 fB({nodes:$,edges:v}){let U=$.value,_=Array.from(v.value.values()),g=D$.value,z=g!==null,J=w6.value,b=J!==null;if(_.length===0)return null;let O=96,K=Array.from(U.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,F=Math.max(1,k-W),I=Math.max(1,P-B);return G("svg",{"aria-label":"Canvas connections",role:"img",viewBox:`${W} ${B} ${F} ${I}`,width:F,height:I,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 Y=U.get(H.from),q=U.get(H.to);if(!Y||!q)return null;let w=z&&(H.from===g||H.to===g),N=b&&!(J.has(H.from)||J.has(H.to));return G(jX,{edge:H,fromNode:Y,toNode:q,focused:w,dimmed:z&&!w||N},H.id,!1,void 0,this)}),uv.value&&(()=>{let H=uv.value,Y=H.cursorX-H.fromX,q=H.cursorY-H.fromY,w=Math.sqrt(Y*Y+q*q),N=Math.min(w*0.25,80),C=Y/(w||1),p=q/(w||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 VX($){let[v,...U]=$;if(!v)return"";return U.reduce((_,g)=>`${_} L ${g.x} ${g.y}`,`M ${v.x} ${v.y}`)}function QO({annotations:$}){if($.length===0)return null;return G("svg",{class:"annotation-layer","aria-hidden":"true",children:$.map((v)=>{let U=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:U,"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:VX(v.points),fill:"none",stroke:U,"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 CX=0.1,fX=4,cB=1;function mB($){return Math.min(fX,Math.max(CX,$))}function EB({viewport:$,onViewportChange:v,onViewportCommit:U,disabled:_=!1}){let g=y(null),z=y(!1),J=y({x:0,y:0}),b=y(0),O=y(null),K=S((H)=>{if(O.current!==null)window.clearTimeout(O.current);O.current=window.setTimeout(()=>{O.current=null,U(H)},140)},[U]),W=S((H)=>{if(_)return;H.preventDefault();let Y=$.value;if(H.ctrlKey||H.metaKey){let q=g.current?.getBoundingClientRect();if(!q)return;let w=H.clientX-q.left,N=H.clientY-q.top,C=-H.deltaY*0.002,p=mB(Y.scale*(1+C)),r=p/Y.scale,n={x:w-r*(w-Y.x),y:N-r*(N-Y.y),scale:p};v(n),K(n)}else{let q={x:Y.x-H.deltaX*cB,y:Y.y-H.deltaY*cB,scale:Y.scale};v(q),K(q)}},[_,$,v,K]),B=S((H)=>{if(_)return;let Y=g.current;if(!Y||H.target!==Y)return;z.current=!0,J.current={x:H.clientX,y:H.clientY},Y.setPointerCapture(H.pointerId)},[_]),k=S((H)=>{if(!z.current)return;if(_)return;let Y=H.clientX-J.current.x,q=H.clientY-J.current.y;J.current={x:H.clientX,y:H.clientY};let w=$.value;v({x:w.x+Y,y:w.y+q,scale:w.scale})},[_,$,v]),P=S(()=>{if(z.current)U($.value);z.current=!1},[U,$]),F=S((H)=>{if(_)return;if(H.touches.length!==2){b.current=0;return}H.preventDefault();let Y=H.touches[0],q=H.touches[1],w=Math.hypot(q.clientX-Y.clientX,q.clientY-Y.clientY),N=(Y.clientX+q.clientX)/2,C=(Y.clientY+q.clientY)/2;if(b.current>0){let p=$.value,r=g.current?.getBoundingClientRect();if(!r)return;let n=N-r.left,e=C-r.top,u=w/b.current,Q=mB(p.scale*u),g$=Q/p.scale,m={x:n-g$*(n-p.x),y:e-g$*(e-p.y),scale:Q};v(m),K(m)}b.current=w},[_,$,v,K]),I=S(()=>{if(O.current!==null)window.clearTimeout(O.current),O.current=null;U($.value),b.current=0},[U,$]);return c(()=>{let H=g.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",F,{passive:!1}),H.addEventListener("touchend",I),()=>{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",F),H.removeEventListener("touchend",I)}},[W,B,k,P,F,I]),g}function cX($){switch($.type){case"markdown":return G(i_,{node:$},void 0,!1,void 0,this);case"mcp-app":return G(E6,{node:$},void 0,!1,void 0,this);case"webpage":return G(E0,{node:$},void 0,!1,void 0,this);case"json-render":return G(E6,{node:$},void 0,!1,void 0,this);case"graph":return G(E6,{node:$},void 0,!1,void 0,this);case"prompt":return G(h0,{node:$},void 0,!1,void 0,this);case"response":return G(x0,{node:$},void 0,!1,void 0,this);case"status":return G(Lg,{node:$},void 0,!1,void 0,this);case"context":return G(a6,{node:$},void 0,!1,void 0,this);case"ledger":return G(u4,{node:$},void 0,!1,void 0,this);case"trace":return G(p0,{node:$},void 0,!1,void 0,this);case"file":return G(V_,{node:$},void 0,!1,void 0,this);case"image":return G(m0,{node:$},void 0,!1,void 0,this);case"html":return G(VU,{node:$},void 0,!1,void 0,this);case"group":return G(hW,{node:$},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function mX($,v,U){let _=U.x-v.x,g=U.y-v.y,z=_*_+g*g;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)*g)/z));return Math.hypot($.x-(v.x+J*_),$.y-(v.y+J*g))}function EX($,v,U){for(let _=$.length-1;_>=0;_--){let g=$[_];if(!g)continue;let z=U+g.width;if(v.x<g.bounds.x-z||v.x>g.bounds.x+g.bounds.width+z||v.y<g.bounds.y-z||v.y>g.bounds.y+g.bounds.height+z)continue;if(g.type==="text")return g;for(let J=1;J<g.points.length;J++){let b=g.points[J-1],O=g.points[J];if(b&&O&&mX(v,b,O)<=U+g.width/2)return g}}return null}var NO="currentColor",iB=4,lB=24,iX=14,lX=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]),hX=new Set(["md","mdx","markdown"]),hB={width:520,height:420};function xX($){let v=$.trim();if(!v||/\s/.test(v))return null;let U=/^[a-z][a-z0-9+.-]*:/i.test(v)?v:`https://${v}`;try{let _=new URL(U);if(_.protocol!=="http:"&&_.protocol!=="https:")return null;return _.toString()}catch{return null}}function rO($){let v=$.trim();if(!v)return[];let U=v.includes(`
228
- `)?v.split(/\r?\n/):v.split(/\s+/),_=new Set,g=[];for(let z of U){let J=z.trim();if(!J||J.startsWith("#"))continue;let b=xX(J);if(!b||_.has(b))continue;_.add(b),g.push(b)}return g}function pX($){let v=rO($.getData("text/uri-list"));if(v.length>0)return v;return rO($.getData("text/plain"))}function oX($){if(!$)return!1;return $.types.includes("text/uri-list")||$.types.includes("text/plain")}function xB($){if(!($ instanceof HTMLElement))return!1;return Boolean($.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]'))}function nX($){let v=$.split(".").pop()?.toLowerCase()??"";if(lX.has(v))return"image";if(hX.has(v))return"markdown";return"file"}function tX($,v){let U=[],_=0;for(let g of $){if(g.dockPosition!==null)continue;if(v&&g.id===v)continue;if(g.type==="group")U.splice(_++,0,g);else U.push(g)}return U}function pB({onNodeContextMenu:$,onCanvasContextMenu:v,annotationMode:U=!1,annotationTool:_=null}){let g=P$.value,z=y(!1),J=y(!1),b=y([]),[O,K]=o(null),[W,B]=o(null),[k,P]=o(null),F=y(null),[I,H]=o(!1),Y=y(0),q=y(null),w=EB({viewport:P$,disabled:U,onViewportChange:(M)=>{if(z.current||U)return;S4(),UK(M)},onViewportCommit:(M)=>{if(z.current||U)return;S4(),zK(M)}}),N=S((M)=>{F.current=M,P(M)},[]),C=S(async(M,x,s)=>{if(M.length===0)return;let{width:d,height:b$}=hB,U$=24,l=Math.ceil(Math.sqrt(M.length)),f=Math.ceil(M.length/l),a=l*d+Math.max(0,l-1)*U$,G$=f*b$+Math.max(0,f-1)*U$;for(let K$=0;K$<M.length;K$++){let V$=K$%l,C$=Math.floor(K$/l),Kv=x-a/2+V$*(d+U$),Wv=s-G$/2+C$*(b$+U$);await Ev({type:"webpage",content:M[K$],x:Kv,y:Wv,width:d,height:b$})}},[]),p=S((M)=>{let x=w.current;if(!x)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=x.getBoundingClientRect(),a=P$.value,G$={x:(M.clientX-f.left-a.x)/a.scale,y:(M.clientY-f.top-a.y)/a.scale},K$=EX(Array.from(F4.value.values()),G$,iX/a.scale);if(K$)vK(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=x.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=x.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:NO,width:iB,createdAt:""}),x.setPointerCapture(M.pointerId);return}if(M.target!==x)return;if(!M.shiftKey){if(!q.current)D$.value=null,jv();return}M.preventDefault(),M.stopPropagation(),z.current=!0;let s=x.getBoundingClientRect(),d=M.clientX-s.left,b$=M.clientY-s.top,U$={startX:d,startY:b$,currentX:d,currentY:b$};q.current=U$,K(U$),x.setPointerCapture(M.pointerId)},[_,w]),r=S((M)=>{if(J.current){let d=w.current;if(!d)return;let b$=d.getBoundingClientRect(),U$=P$.value,l={x:(M.clientX-b$.left-U$.x)/U$.scale,y:(M.clientY-b$.top-U$.y)/U$.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 x=w.current?.getBoundingClientRect();if(!x)return;let s={...q.current,currentX:M.clientX-x.left,currentY:M.clientY-x.top};q.current=s,K(s)},[w]),n=S((M)=>{if(J.current){J.current=!1;let l=b.current;if(b.current=[],B(null),l.length>=2)A2({points:l,color:NO,width:iB});let f=w.current;if(f?.hasPointerCapture(M.pointerId))f.releasePointerCapture(M.pointerId);return}let x=q.current;if(!z.current||!x)return;z.current=!1,q.current=null;let s=Math.min(x.startX,x.currentX),d=Math.max(x.startX,x.currentX),b$=Math.min(x.startY,x.currentY),U$=Math.max(x.startY,x.currentY);if(d-s>5||U$-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$=(U$-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)t3(V$)}K(null)},[]);c(()=>{if(U)return;if(!J.current&&!W&&!k)return;J.current=!1,b.current=[],B(null),N(null)},[U,W,N,k]);let e=S(()=>{let M=F.current;if(!M)return;let x=M.value.trim();if(N(null),!x)return;let s={x:M.x,y:M.y};A2({type:"text",points:[s],color:NO,width:lB,text:x})},[N]);c(()=>{if(_!=="text"&&k)N(null)},[_,N,k]),c(()=>{function M(s){if(!uv.value)return;let d=w.current;if(!d)return;let b$=d.getBoundingClientRect(),U$=P$.value;uv.value={...uv.value,cursorX:(s.clientX-b$.left-U$.x)/U$.scale,cursorY:(s.clientY-b$.top-U$.y)/U$.scale}}function x(s){let d=uv.value;if(!d)return;uv.value=null;let b$=w.current;if(!b$)return;let U$=b$.getBoundingClientRect(),l=P$.value,f=(s.clientX-U$.left-l.x)/l.scale,a=(s.clientY-U$.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){Y4(d.fromId,G$.id,"relation");return}}}return document.addEventListener("pointermove",M),document.addEventListener("pointerup",x),()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",x)}},[w]);let u=S((M)=>{if(U)return;let x=w.current;if(!x||M.target!==x)return;let s=x.getBoundingClientRect(),d=P$.value,b$=(M.clientX-s.left-d.x)/d.scale,U$=(M.clientY-s.top-d.y)/d.scale,l=520,f=360;Ev({type:"markdown",title:"New note",x:b$-l/2,y:U$-f/2,width:l,height:f})},[U,w]),Q=S((M)=>{if(U)return;if(!v)return;let x=w.current;if(!x)return;if((M.target instanceof Element?M.target:null)?.closest(".canvas-node"))return;let d=x.getBoundingClientRect(),b$=P$.value,U$=(M.clientX-d.left-b$.x)/b$.scale,l=(M.clientY-d.top-b$.y)/b$.scale;v(M,U$,l)},[U,w,v]),g$=S((M)=>{if(M.preventDefault(),Y.current++,M.dataTransfer?.types.includes("Files")||oX(M.dataTransfer))H(!0)},[]),m=S((M)=>{if(M.preventDefault(),M.dataTransfer)M.dataTransfer.dropEffect="copy"},[]),i=S((M)=>{if(M.preventDefault(),Y.current--,Y.current<=0)Y.current=0,H(!1)},[]),H$=S(async(M)=>{M.preventDefault(),H(!1),Y.current=0;let x=w.current;if(!x||!M.dataTransfer)return;let s=x.getBoundingClientRect(),d=P$.value,b$=(M.clientX-s.left-d.x)/d.scale,U$=(M.clientY-s.top-d.y)/d.scale,l=Array.from(M.dataTransfer.files);if(l.length===0){let V$=pX(M.dataTransfer);await C(V$,b$,U$);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$),P6=b$-K$*(f+G$)/2+Kv*(f+G$),lU=U$-a/2+Wv*(a+G$),k6=nX(C$.name),hU=C$.name;if(k6==="image"){let sv=new FileReader,Av=await new Promise((Zg)=>{sv.onload=()=>Zg(sv.result),sv.readAsDataURL(C$)});await Ev({type:"image",title:hU,content:Av,x:P6,y:lU,width:f,height:a})}else{let sv=await C$.text(),Av=k6==="markdown"||k6==="file";await Ev({type:k6,title:hU,content:sv,x:P6,y:lU,width:Av?720:f,height:Av?500:a})}}},[w,C]);c(()=>{let M=async(x)=>{if(x.defaultPrevented)return;if(xB(x.target instanceof Element?x.target:null))return;if(xB(document.activeElement))return;let s=x.clipboardData?.getData("text/plain")??"",d=rO(s);if(d.length===0)return;let b$=w.current;if(!b$)return;x.preventDefault();let U$=b$.getBoundingClientRect(),l=P$.value,f=(U$.width/2-l.x)/l.scale,a=(U$.height/2-l.y)/l.scale;await C(d,f,a)};return document.addEventListener("paste",M),()=>{document.removeEventListener("paste",M)}},[w,C]);let q$=tX(T.value.values(),j$.value),x$=null;if(O){let M=Math.min(O.startX,O.currentX),x=Math.min(O.startY,O.currentY),s=Math.abs(O.currentX-O.startX),d=Math.abs(O.currentY-O.startY);x$={position:"absolute",left:`${M}px`,top:`${x}px`,width:`${s}px`,height:`${d}px`,pointerEvents:"none"}}return G("div",{class:"canvas-viewport",ref:w,tabIndex:0,onPointerDown:p,onPointerMove:r,onPointerUp:n,onContextMenu:Q,onDblClick:u,onDragEnter:g$,onDragOver:m,onDragLeave:i,onDrop:H$,style:{width:"100%",height:"100%",position:"relative",overflow:"hidden",cursor:_==="eraser"?"cell":_==="text"?"text":U||uv.value||z.current?"crosshair":"grab"},children:[G("div",{style:{transform:`matrix(${g.scale}, 0, 0, ${g.scale}, ${g.x}, ${g.y})`,transformOrigin:"0 0",willChange:"transform",position:"absolute",top:0,left:0},children:[G(eW,{},void 0,!1,void 0,this),G(QB,{},void 0,!1,void 0,this),G(fB,{nodes:T,edges:m$},void 0,!1,void 0,this),G(QO,{annotations:Array.from(F4.value.values())},void 0,!1,void 0,this),W&&W.points.length>=2&&G(QO,{annotations:[W]},void 0,!1,void 0,this),q$.map((M)=>G(VB,{node:M,onContextMenu:$,children:cX(M)},M.id,!1,void 0,this)),G4.value&&G("svg",{class:"snap-guides-svg",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},children:G4.value.map((M,x)=>M.axis==="x"?G("line",{x1:M.pos,y1:M.from-20,x2:M.pos,y2:M.to+20,class:"snap-guide-line"},x,!1,void 0,this):G("line",{x1:M.from-20,y1:M.pos,x2:M.to+20,y2:M.pos,class:"snap-guide-line"},x,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&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*g.scale+g.x}px`,top:`${k.y*g.scale+g.y}px`,fontSize:`${lB*g.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),x$&&G("div",{class:"lasso-rect",style:x$},void 0,!1,void 0,this),I&&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 dX($,v){let U=$.toLowerCase(),_=v.toLowerCase(),g=[],z=0,J=0,b=-1;for(let O=0;O<_.length&&z<U.length;O++)if(_[O]===U[z]){if(g.push(O),J+=b===O-1?10:1,O===0||_[O-1]===" "||_[O-1]==="-"||_[O-1]==="_")J+=5;b=O,z++}return{match:z===U.length,score:J,indices:g}}function aX($,v){if(v.length===0)return $;let U=[],_=0;for(let g of v){if(g>_)U.push($.slice(_,g));U.push(G("mark",{children:$[g]},g,!1,void 0,this)),_=g+1}if(_<$.length)U.push($.slice(_));return U}var uO={md:"markdown",app:"mcp-app",web:"webpage",ui:"json-render",chart:"graph",ctx:"context",log:"ledger"};function sX($){let v=$.toLowerCase().trim();if(v.startsWith("type:")){let U=v.slice(5).trim(),g=Object.keys(s$).find((J)=>J.startsWith(U));if(g)return{typeFilter:g,remaining:""};let z=uO[U];if(z)return{typeFilter:z,remaining:""}}if(uO[v])return{typeFilter:uO[v],remaining:""};return{typeFilter:null,remaining:$}}function oB({onClose:$,onToggleMinimap:v}){let[U,_]=o(""),[g,z]=o(0),J=y(null),b=y(null);c(()=>{setTimeout(()=>J.current?.focus(),30)},[]);let O=S(()=>{let I=[];for(let Y of T.value.values()){let q=Y.data.title||s$[Y.type],w=Y.data.content||Y.data.path||"";I.push({id:`node:${Y.id}`,kind:"node",label:q,description:w.length>80?w.slice(0,80)+"...":w||void 0,badge:s$[Y.type],nodeType:Y.type,action:()=>{Yv(Y.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:()=>{N_(window.innerWidth,window.innerHeight),$()}},{label:"Auto-arrange (grid)",badge:"LAYOUT",action:()=>{r_(),$()}},{label:"Auto-arrange (graph-aware)",badge:"LAYOUT",action:()=>{u_(),$()}},{label:"Toggle minimap",badge:"VIEW",action:()=>{v(),$()}},{label:"Toggle theme (dark/light)",badge:"THEME",action:()=>{let Y=T$.value==="dark"?"light":"dark";document.documentElement.setAttribute("data-theme",Y),Hg(),T$.value=Y,I_(Y),$()}}];for(let Y of H)I.push({id:`action:${Y.label}`,kind:"action",label:Y.label,badge:Y.badge,badgeClass:"command-palette-badge--action",action:Y.action});return I},[$,v]),{typeFilter:K,remaining:W}=sX(U),B=O(),k;if(!U.trim())k=B.map((I)=>({...I,score:0,indices:[]}));else{k=[];for(let I of B){if(K){if(I.kind!=="node"||I.nodeType!==K)continue;if(!W){k.push({...I,score:0,indices:[]});continue}}let H=dX(W||U,I.label);if(H.match)k.push({...I,score:H.score,indices:H.indices})}k.sort((I,H)=>H.score-I.score)}c(()=>{if(!U.trim()){w6.value=null;return}let I=new Set;for(let H of k)if(H.kind==="node")I.add(H.id.slice(5));w6.value=I.size>0?I:null},[U,k]),c(()=>{return()=>{w6.value=null}},[]);let P=Math.min(g,Math.max(0,k.length-1)),F=S((I)=>{if(I.key==="ArrowDown")I.preventDefault(),z((H)=>Math.min(H+1,k.length-1));else if(I.key==="ArrowUp")I.preventDefault(),z((H)=>Math.max(H-1,0));else if(I.key==="Enter"){if(I.preventDefault(),k[P])k[P].action()}else if(I.key==="Escape")I.preventDefault(),I.stopPropagation(),$()},[k,P,$]);return c(()=>{let I=b.current;if(!I)return;I.children[P]?.scrollIntoView({block:"nearest"})},[P]),c(()=>{z(0)},[U]),G("div",{class:"command-palette-backdrop",onMouseDown:$,children:G("div",{class:"command-palette",onMouseDown:(I)=>I.stopPropagation(),children:[G("input",{ref:J,type:"text",class:"command-palette-input",value:U,onInput:(I)=>_(I.target.value),onKeyDown:F,placeholder:`Search nodes and actions... (${Sv}+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((I,H)=>G("button",{type:"button",class:`command-palette-item${H===P?" selected":""}`,onMouseEnter:()=>z(H),onClick:()=>I.action(),children:[G("span",{class:`command-palette-badge${I.badgeClass?` ${I.badgeClass}`:""}`,children:I.badge},void 0,!1,void 0,this),G("span",{class:"command-palette-label",children:I.indices.length>0?aX(I.label,I.indices):I.label},void 0,!1,void 0,this),I.description&&G("span",{class:"command-palette-desc",children:I.description},void 0,!1,void 0,this)]},I.id,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function nB(){let[$,v]=o(null),U=S((z,J)=>{z.preventDefault(),z.stopPropagation(),v({kind:"node",x:z.clientX,y:z.clientY,nodeId:J})},[]),_=S((z,J,b)=>{z.preventDefault(),z.stopPropagation(),v({kind:"canvas",x:z.clientX,y:z.clientY,canvasX:J,canvasY:b})},[]),g=S(()=>v(null),[]);return c(()=>{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:U,openCanvasMenu:_,closeMenu:g}}var eX="#4bbcFF",$w=[{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 tB({menu:$,onClose:v}){let U;if($.kind==="node"){let b=T.value.get($.nodeId);if(!b)return null;U=Jw(b)}else U=zw($.canvasX,$.canvasY);let _=new Map,g=U.some((b)=>b.render)?U.length*32+168:U.length*32+8,z=Math.min($.x,Math.max(12,window.innerWidth-240)),J=Math.min($.y,Math.max(12,window.innerHeight-g));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:U.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 vw($){return(typeof $.data.path==="string"?$.data.path.trim():"")||null}function o0($){let v=$.trim().toLowerCase(),U=v.match(/^#([0-9a-f]{3})$/);if(U){let[_,g,z]=U[1].split("");return`#${_}${_}${g}${g}${z}${z}`}return v}function dB($){if(typeof $.data.color!=="string"||!$.data.color.trim())return null;return o0($.data.color)}function gw($){let v=dB($);return v&&/^#[0-9a-f]{6}$/.test(v)?v:o0(eX)}function yO($,v){let U=v?o0(v):null;Pv($.id,{data:{...$.data,color:U}}),Zv($.id,{data:{color:U}})}function Uw($,v){let U=dB($);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:()=>{yO($,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:$w.map((_)=>{let g=o0(_.value);return G("button",{type:"button",class:`context-menu-color-swatch${U===g?" active":""}`,"aria-label":`Set group color to ${_.label}`,title:_.label,style:{"--swatch-color":_.value},onClick:()=>{yO($,_.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:gw($),onClick:(_)=>_.stopPropagation(),onInput:(_)=>{yO($,_.currentTarget.value),v()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function RO($,v,U,_){return{x:$-U/2,y:v-_/2}}function _w($,v){return $.trim().replace(/[?#].*$/,"").split("/").filter(Boolean).at(-1)||v}async function DO($){let v=window.prompt($.promptLabel,$.placeholder??"");if(!v)return;let U=v.trim();if(!U)return;let _=RO($.canvasX,$.canvasY,$.width,$.height);if(!(await Ev({type:$.type,...$.type!=="webpage"?{title:_w(U,$.titleFallback)}:{},content:U,x:_.x,y:_.y,width:$.width,height:$.height})).ok)window.alert($.errorMessage)}function zw($,v){return[{label:"New note",action:()=>{let g=RO($,v,520,360);Ev({type:"markdown",title:"New note",x:g.x,y:g.y,width:520,height:360})}},{label:"Open webpage...",action:()=>{DO({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:()=>{DO({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:()=>{DO({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 g=RO($,v,600,400);X_({title:"Group",x:g.x,y:g.y,width:600,height:400})}}]}function Jw($){let v=[],U=vw($);if(v.push({label:"Focus",action:()=>Yv($.id)}),H_.has($.type))v.push({label:"Expand",shortcut:"⤢",action:()=>z6($.id)});v.push({label:$.collapsed?"Expand":"Collapse",action:()=>Z6($.id)});let _=R$.value.has($.id);v.push({label:_?"Unpin from context":"Pin as context",action:()=>w4($.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 g=Z_.value;if(g&&g.from!==$.id){let J=T.value.get(g.from),b=J?(J.data.title||J.id).slice(0,20):g.from;v.push({label:`Connect from "${b}"`,action:()=>{Y4(g.from,$.id,"relation"),Z_.value=null}})}v.push({label:g?"Connect from here (replace)":"Connect from here",action:()=>{Z_.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")&&U)v.push({label:"Open in browser",action:()=>{window.open(`/artifact?path=${encodeURIComponent(U)}`,"_blank","noopener")}}),v.push({label:"Copy path",action:()=>{navigator.clipboard.writeText(U)}});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:()=>u3("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:()=>{Y_($.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)=>Uw($,b)}),J.length>0)v.push({label:`Ungroup (${J.length} node${J.length!==1?"s":""})`,action:()=>f3($.id)})}if($.type==="status"||$.type==="ledger")if(v.push({separator:!0}),$.dockPosition!==null)v.push({label:"Undock to canvas",action:()=>M4($.id)});else v.push({label:"Dock left of toolbar",action:()=>Z2($.id,"left")}),v.push({label:"Dock right of toolbar",action:()=>Z2($.id,"right")});return v.push({separator:!0}),v.push({label:"Close",action:()=>{A4($.id),q_($.id)}}),v}function aB(){let $=R$.value.size;if($===0||q6.value||Q_.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:a3,title:"Clear all context pins",children:"×"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function sB({node:$}){let v=LO($),U=$.data.activeTool,_=$.data.subagent,g=c0[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:g,animation:v!=="idle"?"pulse 1.5s infinite":"none",flexShrink:0}},void 0,!1,void 0,this),G("span",{style:{color:g,fontSize:"10px",textTransform:"uppercase",fontWeight:600},children:v},void 0,!1,void 0,this),U&&G("span",{style:{color:"var(--c-warn)",fontSize:"10px",fontFamily:"var(--mono)"},children:["⚙ ",U]},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 bw($){switch($.type){case"status":return G(Lg,{node:$},void 0,!1,void 0,this);case"ledger":return G(u4,{node:$},void 0,!1,void 0,this);case"context":return G(a6,{node:$},void 0,!1,void 0,this);default:return null}}function Gw($){let v=Array.isArray($.data.cards)?$.data.cards:[],U=Array.isArray($.data.auxTabs)?$.data.auxTabs:[];return v.length+U.length}function Ow({node:$}){let v=e3(),U=v.length>0?v.length:Gw($),_=U>0,g=$.collapsed===!0,z=()=>{B_(),Z6($.id)};if(g)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:U>99?"99+":U},void 0,!1,void 0,this),G("div",{class:"docked-node-controls",children:[G("button",{type:"button",onClick:(J)=>{J.stopPropagation(),z()},title:_?`${U} item${U===1?"":"s"} in agent context — expand`:"Expand agent context","aria-label":_?`Context — ${U} item${U===1?"":"s"}`:"Expand agent context",children:"▸"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(J)=>{J.stopPropagation(),M4($.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:_?`${U} item${U===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(),M4($.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(),Z6($.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(a6,{node:$,pinnedNodes:v},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function TO({node:$}){if($.type==="context")return G(Ow,{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(sB,{node:$},void 0,!1,void 0,this),G("div",{class:"docked-node-controls",children:[G("button",{type:"button",onClick:(v)=>{v.stopPropagation(),Z6($.id)},title:$.collapsed?"Expand":"Collapse",children:$.collapsed?"▸":"▾"},void 0,!1,void 0,this),G("button",{type:"button",onClick:(v)=>{v.stopPropagation(),M4($.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:bw($)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function eB($,v){switch($.type){case"markdown":return G(i_,{node:$,expanded:v},void 0,!1,void 0,this);case"mcp-app":return G(E6,{node:$,expanded:v},void 0,!1,void 0,this);case"webpage":return G(E0,{node:$,expanded:v},void 0,!1,void 0,this);case"json-render":return G(E6,{node:$,expanded:v},void 0,!1,void 0,this);case"graph":return G(E6,{node:$,expanded:v},void 0,!1,void 0,this);case"prompt":return G(h0,{node:$},void 0,!1,void 0,this);case"response":return G(x0,{node:$,expanded:v},void 0,!1,void 0,this);case"status":return G(Lg,{node:$},void 0,!1,void 0,this);case"context":return G(a6,{node:$,expanded:v},void 0,!1,void 0,this);case"ledger":return G(u4,{node:$},void 0,!1,void 0,this);case"trace":return G(p0,{node:$},void 0,!1,void 0,this);case"file":return G(V_,{node:$,expanded:v},void 0,!1,void 0,this);case"image":return G(m0,{node:$,expanded:v},void 0,!1,void 0,this);case"html":return G(VU,{node:$,expanded:v},void 0,!1,void 0,this);default:return G("div",{children:"Unknown node type"},void 0,!1,void 0,this)}}function $P($){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 Kw($){if(!$)return 0;return $.split(/\s+/).filter(Boolean).length}function Ww($,v){return $!==null&&typeof $==="object"&&$.source===xv&&$.type==="presentation-exit"&&$.token===v}function Bw($){return $==="ArrowRight"||$==="PageDown"||$===" "||$==="ArrowLeft"||$==="PageUp"||$==="Home"||$==="End"}function vP($){return $ instanceof HTMLElement&&Boolean($.closest(".html-presentation-exit"))}function gP(){let $=j$.value,v=$?T.value.get($):void 0,[U,_]=o(!1),[g,z]=o(!1),[J,b]=o(""),O=y(null),K=y(null),W=S(()=>{z(!1),d6()},[]),B=S(()=>{b(`presentation-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),z(!0)},[]),k=S((u)=>{document.querySelector(".html-presentation-overlay iframe.html-node-frame-presentation")?.contentWindow?.postMessage({source:xv,token:J,...u},"*")},[J]),P=S(()=>{z(!1)},[]),F=S((u)=>{if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),z(!1);return}if(u.key==="Tab"&&!vP(u.target)){u.preventDefault(),u.stopPropagation(),K.current?.focus();return}if((u.key===" "||u.key==="Enter")&&vP(u.target))return;if(!Bw(u.key))return;u.preventDefault(),u.stopPropagation(),k({type:"presentation-key",key:u.key})},[k]),I=S((u)=>{if(u.target.classList.contains("expanded-overlay-backdrop"))d6()},[]),H=S(()=>{if(!v)return;let u=$P(v);if(!u)return;navigator.clipboard.writeText(u).then(()=>{_(!0),setTimeout(()=>_(!1),1500)})},[v]),Y=S(()=>{if(!$)return;w4($)},[$]);if(c(()=>{z(!1)},[$]),v_(()=>{if(!g)return;let u=()=>{let m=O.current;if(!m||m.contains(document.activeElement))return;m.focus()},Q=[0,50,150].map((m)=>window.setTimeout(u,m)),g$=(m)=>{if(!Ww(m.data,J))return;z(!1)};return document.addEventListener("keydown",F,!0),window.addEventListener("message",g$),()=>{Q.forEach((m)=>{window.clearTimeout(m)}),document.removeEventListener("keydown",F,!0),window.removeEventListener("message",g$)}},[F,J,g]),!v)return null;let q=v.data.title||v.data.path?.split("/").pop()||s$[v.type],w=$P(v),N=Kw(w),C=$?R$.value.has($):!1,p=w.length>0,r=iv.value===$,n=v.type==="mcp-app"||v.type==="webpage"||v.type==="json-render"||v.type==="graph",e=pW(v);return G("div",{class:"expanded-overlay-backdrop",onPointerDown:I,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:Y,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:U?"Copied!":"Copy"},void 0,!1,void 0,this),i0(v)&&G("button",{type:"button",class:"expanded-action-btn",onClick:()=>void l0(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:eB(v,!0)},void 0,!1,void 0,this):eB(v,!0)},void 0,!1,void 0,this),e&&g&&G("div",{ref:O,class:"html-presentation-overlay",role:"dialog","aria-modal":"true","aria-label":`Present ${q}`,tabIndex:-1,onKeyDownCapture:F,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(VU,{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 wg=180,Ag=120,n0=20;function Pw(){let $=f0();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 kw(){let $=f0();return{relation:$.muted,"depends-on":$.warn,flow:$.accent,references:$.dim}}function UP($,v,U,_){let g=Array.from($.values()),z=0,J=0,b=1000,O=800;if(g.length>0){z=Number.POSITIVE_INFINITY,J=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,O=Number.NEGATIVE_INFINITY;for(let H of g)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+U/v.scale,k=W+_/v.scale,P={minX:Math.min(z,K)-n0,minY:Math.min(J,W)-n0,maxX:Math.max(b,B)+n0,maxY:Math.max(O,k)+n0},F=P.maxX-P.minX||1,I=P.maxY-P.minY||1;return{bounds:P,scale:Math.min(wg/F,Ag/I)}}function _P({viewport:$,nodes:v,edges:U,onNavigate:_,containerWidth:g,containerHeight:z}){let J=y(null),b=y(!1),O=y(null),K=y(null),W=S(()=>{let I=J.current;if(!I)return;let H=I.getContext("2d");if(!H)return;let Y=v.value,q=U.value,w=$.value,N=window.devicePixelRatio||1;I.width=wg*N,I.height=Ag*N,H.scale(N,N),H.clearRect(0,0,wg,Ag);let C=f0();H.fillStyle=C.panel+"d9",H.fillRect(0,0,wg,Ag);let p=UP(Y,w,g,z);O.current=p;let{bounds:r,scale:n}=p,e=(M)=>(M-r.minX)*n,u=(M)=>(M-r.minY)*n,Q=Array.from(Y.values()),g$=Pw();for(let M of Q)H.fillStyle=g$[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 m=kw();for(let M of q.values()){let x=Y.get(M.from),s=Y.get(M.to);if(!x||!s)continue;let d=e(x.position.x+x.size.width/2),b$=u(x.position.y+x.size.height/2),U$=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(U$,l),H.strokeStyle=m[M.type]??C.muted,H.globalAlpha=0.3,H.lineWidth=0.5,H.stroke()}let i=-w.x/w.scale,H$=-w.y/w.scale,q$=g/w.scale,x$=z/w.scale;H.globalAlpha=1,H.strokeStyle=C.accent,H.lineWidth=1.5,H.strokeRect(e(i),u(H$),q$*n,x$*n)},[v,U,$,g,z]),B=y(W);B.current=W;let k=S(()=>{if(K.current!==null)return;K.current=window.requestAnimationFrame(()=>{K.current=null,B.current()})},[]);A3(()=>{T$.value,v.value,U.value,$.value,k()}),c(()=>{k()},[g,z,k]),c(()=>()=>{if(K.current!==null)window.cancelAnimationFrame(K.current),K.current=null},[]);let P=S((I)=>{let H=J.current;if(!H)return;let Y=H.getBoundingClientRect(),q=I.clientX-Y.left,w=I.clientY-Y.top,N=O.current??UP(v.value,$.value,g,z);O.current=N;let{bounds:C,scale:p}=N,r=$.value,n=g/r.scale,e=z/r.scale,u=q/p+C.minX,Q=w/p+C.minY;_(-(u-n/2)*r.scale,-(Q-e/2)*r.scale)},[v,$,g,z,_]),F=S((I)=>{I.stopPropagation(),b.current=!0,P(I);let H=(q)=>{if(b.current)P(q)},Y=()=>{b.current=!1,document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",Y)};document.addEventListener("pointermove",H),document.addEventListener("pointerup",Y)},[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:wg,height:Ag,style:{width:`${wg}px`,height:`${Ag}px`,display:"block",cursor:"pointer"},onPointerDown:F},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function zP(){let $=i$.value.size,v=S(()=>{let g=Array.from(i$.value);if(g.length===0)return;d3(g),jv()},[]),U=S(()=>{let g=Array.from(i$.value);if(g.length===0)return;X_({title:"Group",childIds:g}),jv()},[]),_=S(()=>{let g=Array.from(i$.value);for(let z=0;z<g.length;z++)for(let J=z+1;J<g.length;J++)Y4(g[z],g[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:U,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 Hw=[{title:"Navigation",shortcuts:[{keys:`${Sv}+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:`${Sv}+0`,desc:"Reset viewport to origin"},{keys:`${Sv}++ / ${Sv}+−`,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 JP({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:Hw.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((U)=>G("div",{class:"shortcut-row",children:[G("kbd",{class:"shortcut-keys",children:U.keys},void 0,!1,void 0,this),G("span",{class:"shortcut-desc",children:U.desc},void 0,!1,void 0,this)]},U.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 Lw($){let v=Date.now()-new Date($).getTime(),U=Math.floor(v/60000);if(U<1)return"just now";if(U<60)return`${U}m ago`;let _=Math.floor(U/60);if(_<24)return`${_}h ago`;return`${Math.floor(_/24)}d ago`}function bP({open:$,onClose:v,anchorRef:U}){let[_,g]=o([]),[z,J]=o(!1),[b,O]=o(!1),[K,W]=o(null),[B,k]=o(""),[P,F]=o(null),I=y(null),H=y(null);c(()=>{if(!$)return;J(!0),c3().then((r)=>{g(r),J(!1)})},[$]),c(()=>{if($)setTimeout(()=>H.current?.focus(),50)},[$]),c(()=>{if(!$)return;let r=(n)=>{let e=I.current,u=U.current;if(e&&!e.contains(n.target)&&u&&!u.contains(n.target))v()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[$,v]),c(()=>{if(!$)return;let r=(n)=>{if(n.key==="Escape")v()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[$,v]);let Y=S(async()=>{let r=B.trim();if(!r)return;O(!0);let n=await m3(r);if(O(!1),n.ok&&n.snapshot)g((e)=>[n.snapshot,...e]),k("")},[B]),q=S(async(r)=>{F(null),W(r);let n=await E3(r);if(W(null),n.ok)v()},[v]),w=S(async(r)=>{if((await i3(r)).ok)g((e)=>e.filter((u)=>u.id!==r));F(null)},[]);if(!$)return null;let N=U.current?.getBoundingClientRect(),C=N?Math.max(8,N.left-120):100,p=N?N.bottom+8:48;return G("div",{ref:I,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")Y()},placeholder:"Snapshot name...",maxLength:80,disabled:b},void 0,!1,void 0,this),G("button",{type:"button",class:"snapshot-save-btn",onClick:Y,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":""}`:""," · ",Lw(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"?w(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:()=>F(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:()=>F({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:()=>F({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 GP($,v,U,_,g){return $.x<_.position.x+_.size.width+g&&$.x+v+g>_.position.x&&$.y<_.position.y+_.size.height+g&&$.y+U+g>_.position.y}function Iw($,v,U,_,g){return _.some((z)=>GP($,v,U,z,g))}function Yw($,v,U,_,g){return _.find((z)=>GP($,v,U,z,g))}function t0($,v,U,_=24){if($.length===0)return{x:40,y:80};let g=$[$.length-1],z={x:g.position.x+g.size.width+_,y:g.position.y};if(!Iw(z,v,U,$,_))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 I=Yw({x:k,y:K},v,U,$,_);if(!I)return{x:k,y:K};k=I.position.x+I.size.width+_}K=$.filter((I)=>I.position.y<=K+U+_&&I.position.y+I.size.height+_>K).reduce((I,H)=>Math.max(I,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 mU=null,VO=null,jO=0,i6=null,a0=new Map;function EU($){let v=0;for(let U=0;U<$.length;U++)v=(v<<5)-v+$.charCodeAt(U)|0;return Math.abs(v).toString(36)}function s0($){if(!VO)return $;let v=VO.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}}var av={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 iU($,v,U,_=null){let g=av[v];return s0({id:$,type:v,position:{x:g.x,y:g.y},size:{width:g.w,height:g.h},zIndex:v==="status"?0:1,collapsed:!1,pinned:!1,dockPosition:_,data:U})}function qw(){return t0([...T.value.values()],av.markdown.w,av.markdown.h)}function O4(){if(!T.value.has("status-main"))_6(iU("status-main","status",{phase:"idle",message:"",elapsed:0},"left"))}function Fw($,v){let U=`md-${EU($)}`;if(T.value.get(U))v$(U,{path:$,title:v}),D$.value=U;else{let g=qw(),z=iU(U,"markdown",{path:$,title:v,content:"",rendered:""});if(z.position=g,_6(z),!z.dockPosition)Yv(U)}}function Xw($){if(T.value.get("context-main"))v$("context-main",{cards:$});else if($.length>0){let _=iU("context-main","context",{cards:$});_6(_)}}function ww($){let v=$.url,U=`mcp-${EU(v)}`;if(T.value.get(U))v$(U,$);else _6(iU(U,"mcp-app",$)),Yv(U)}function Aw($){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,Y]of T.value.entries())if(Y.type==="mcp-app"&&Y.data.mode==="ext-app"&&Y.data.serverName===z&&Y.data.toolName===J&&!Y.data.toolResult){v$(H,{...$});return}}let{_x:b,_y:O,_width:K,_height:W}=$,B=av["mcp-app"],k=K??B.w,P=W??B.h,F=b===void 0||O===void 0?t0([...T.value.values()],k,P):null,I=s0({id:_,type:"mcp-app",position:{x:b??F?.x??B.x,y:O??F?.y??B.y},size:{width:k,height:P},zIndex:1,collapsed:!1,pinned:!1,dockPosition:null,data:{mode:"ext-app",...$}});if(_6(I),!I.dockPosition)Yv(_,{recordHistory:!1})}function Zw($){let v=$.startsWith("ext-app-")?$:`ext-app-${$}`;if(T.value.has(v))return v;let U=`ext-app-${$}`;if(U!==v&&T.value.has(U))return U;for(let[_,g]of T.value.entries())if(g.type==="mcp-app"&&g.data.mode==="ext-app"&&g.data.toolCallId===$)return _;return null}function KP($){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 Zw($.toolCallId)}function WP($,v){if(typeof $!=="string"||!$)return null;if(typeof v!=="string"||!v)return null;let U=null;for(let[_,g]of T.value.entries())if(g.type==="mcp-app"&&g.data.mode==="ext-app"&&g.data.serverName===$&&g.data.toolName===v&&!g.data.toolResult){if(U)return null;U=_}return U}function BP($){if(T.value.get("ledger-main"))v$("ledger-main",$);else{let _=iU("ledger-main","ledger",$,"right");_.collapsed=!0,_6(_)}}function PP($){if(!($==="dark"||$==="light"||$==="high-contrast"))return;if(document.documentElement.setAttribute("data-theme",$),Hg(),T$.value!==$)T$.value=$}function Mw($){return $==="markdown"||$==="mcp-app"||$==="webpage"||$==="json-render"||$==="graph"||$==="prompt"||$==="response"||$==="status"||$==="context"||$==="ledger"||$==="trace"||$==="file"||$==="image"||$==="html"||$==="group"}function Sw($){return $==="relation"||$==="depends-on"||$==="flow"||$==="references"}function CO($){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 kP($){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 Qw($){let v=CO($),U=kP($);return v&&U?{...v,...U}:null}function Nw($){if(typeof $.id!=="string"||!$.id)return null;if(!Mw($.type))return null;let v=CO($.position),U=kP($.size);if(!v||!U)return null;let _=$.dockPosition==="left"||$.dockPosition==="right"?$.dockPosition:null,g=$.data&&typeof $.data==="object"?Object.fromEntries(Object.entries($.data)):{};return{id:$.id,type:$.type,position:v,size:U,zIndex:typeof $.zIndex==="number"?$.zIndex:1,collapsed:$.collapsed===!0,pinned:$.pinned===!0,dockPosition:_,data:g}}function rw($){if(typeof $.id!=="string"||!$.id)return null;if(typeof $.from!=="string"||!$.from)return null;if(typeof $.to!=="string"||!$.to)return null;if(!Sw($.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 uw($){if(typeof $.id!=="string"||!$.id)return null;if($.type!=="freehand"&&$.type!=="text")return null;if(!Array.isArray($.points))return null;let v=$.points.map((_)=>CO(_)).filter((_)=>_!==null),U=Qw($.bounds);if(v.length<($.type==="text"?1:2)||!U)return null;return{id:$.id,type:$.type,points:v,bounds:U,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 yw($){if(X4.value=$.sessionId||"",n6.value="connected",typeof $.theme==="string")PP($.theme);if($.ledgerSummary)BP($.ledgerSummary)}function Dw($){if(typeof $.path!=="string"||!$.path)return;let v=$.path,U=(typeof $.title==="string"?$.title:"")||v.split("/").pop()||"Untitled";if(Fw(v,U),$.ledgerSummary)BP($.ledgerSummary)}function Rw($){O4(),v$("status-main",{message:typeof $.message==="string"?$.message:String($.message??""),level:$.level??"ok",source:$.source})}function Tw($){O4(),v$("status-main",{phase:$.phase,detail:$.detail})}function jw($){let v=$.cards??[];Xw(v)}function Vw($){if(typeof $.url==="string"&&$.url)ww({url:$.url,sourceServer:$.sourceServer,sourceTool:$.sourceTool,inferredType:$.inferredType,trustedDomain:$.trustedDomain,hostMode:$.hostMode??"hosted"})}function Cw($){let v=$.sessions??[];for(let U of v){let _=U.url;if(!_)continue;let g=`mcp-${EU(_)}`;if(T.value.has(g))v$(g,{sessionState:U.state,lastSeenAt:U.lastSeenAt})}}function fw($){if(typeof $.url==="string"&&$.url){let v=`mcp-${EU($.url)}`;if(T.value.has(v))v$(v,{hostMode:"fallback",fallbackReason:$.reasonCode})}}function cw($){let U=T.value.get("context-main");if(!U)return;let _=(U.data.auxTabs??[]).concat($);v$("context-main",{auxTabs:_})}function mw($){if(T.value.has("context-main"))if($.mode==="all")v$("context-main",{auxTabs:[]});else{let _=T.value.get("context-main");if(!_)return;let g=(_.data.auxTabs??[]).filter((z)=>z.id!==$.id);v$("context-main",{auxTabs:g})}}function Ew($){O4(),v$("status-main",{phase:"idle",lastCompletion:{tokenCount:$.tokenCount,artifactCount:$.artifactCount}})}function iw($){O4(),v$("status-main",{phase:"tooling",detail:`${$.name}`,activeTool:$.name})}function lw($){O4(),v$("status-main",{activeTool:null})}function hw($){if($.state==="active"&&$.path){let U=`md-${EU($.path)}`;if(T.value.has(U))v$(U,{reviewActive:!0})}}function xw($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;Aw({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 pw($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=KP($)??WP($.serverName,$.toolName);if(!v)return;if(T.value.has(v))v$(v,{html:$.html})}function ow($){if(typeof $.toolCallId!=="string"||!$.toolCallId)return;let v=KP($)??WP($.serverName,$.toolName);if(!v)return;if(T.value.has(v)){if($.success===!1){A4(v);return}v$(v,{toolResult:WO({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 nw($){O4(),v$("status-main",{subagent:{state:$.state,name:$.agentDisplayName??$.agentName}})}function tw($){let v=$.nodeId;if(!v)return;let U=$.text||"",_=$.position,g=$.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!==U)O.push({role:"user",text:U,status:"pending"});v$(J,{turns:O,threadStatus:"pending"});return}if(!T.value.has(v)){let J=_??av.prompt;_6(s0({id:v,type:"prompt",position:{x:J.x,y:J.y},size:{width:av.prompt.w,height:400},zIndex:1,collapsed:!1,pinned:!1,dockPosition:null,data:{text:U,turns:U?[{role:"user",text:U,status:"pending"}]:[],threadStatus:U?"pending":"draft",status:U?"pending":"draft",parentNodeId:g,contextNodeIds:z}})),Yv(v)}if(g&&T.value.has(g))S_({id:`edge-${g}-${v}`,from:g,to:v,type:"flow",style:"dashed"})}function dw($){let{nodeId:v,status:U}=$;if(v&&T.value.has(v))v$(v,{status:U})}function aw($){let{responseNodeId:v,promptNodeId:U}=$;if(!v)return;let _=U?T.value.get(U):void 0;if(_&&Array.isArray(_.data.turns)){a0.set(v,U);let z=[..._.data.turns];z.push({role:"assistant",text:"",status:"streaming"}),v$(U,{turns:z,threadStatus:"streaming",_activeResponseId:v}),Yv(U);return}let g=_?{x:_.position.x,y:_.position.y+_.size.height+24}:{x:av.response.x,y:av.response.y};if(!T.value.has(v))_6(s0({id:v,type:"response",position:g,size:{width:av.response.w,height:av.response.h},zIndex:1,collapsed:!1,pinned:!1,dockPosition:null,data:{content:"",status:"streaming",promptNodeId:U}}));if(U)S_({id:`edge-${U}-${v}`,from:U,to:v,type:"flow",animated:!0});Yv(v)}function sw($){let v=$.responseNodeId;if(!v)return;let U=a0.get(v);if(U){let _=T.value.get(U);if(_&&Array.isArray(_.data.turns)){let g=[..._.data.turns],z=g[g.length-1];if(z&&z.role==="assistant")z.text=$.content,z.status="streaming";v$(U,{turns:g,threadStatus:"streaming"})}return}if(!T.value.has(v))return;v$(v,{content:$.content,status:"streaming"})}function ew($){let v=$.responseNodeId;if(!v)return;let U=a0.get(v);if(U){let z=T.value.get(U);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$(U,{turns:J,threadStatus:"answered",_activeResponseId:void 0})}a0.delete(v);return}if(!T.value.has(v))return;v$(v,{content:$.content,status:"complete"});let g=T.value.get(v)?.data.promptNodeId;if(g){let z=`edge-${g}-${v}`,J=m$.value.get(z);if(J)$K(z),S_({...J,animated:!1})}}function $A($){let v=$.layout;if(!v?.nodes)return;let U=!t6.value;t6.value=!0;let _=v.nodes.map(Nw).filter((b)=>b!==null),g=Array.isArray(v.edges)?v.edges.map(rw).filter((b)=>b!==null):Array.from(m$.value.values()),z=Array.isArray(v.annotations)?v.annotations.map(uw).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;S4(),bK({...J?{viewport:J}:{},nodes:_,edges:g,...z?{annotations:z}:{}},{applyViewport:U}),D2({event:"canvas-layout-update",data:$})}function vA($){if($<=1)return 500;if($===2)return 1000;return Math.min(2500,1500+($-3)*500)}function gA($){let v=$.nodeId;if(v&&T.value.has(v)){if($.noPan===!0){A6(v);return}Yv(v)}}function UA($){let v=$.viewport;if(!v)return;let U=typeof v.x==="number"?v.x:0,_=typeof v.y==="number"?v.y:0,g=typeof v.scale==="number"?v.scale:1;S4(),_K({x:U,y:_,scale:g})}function _A($){if(T.value.get("context-main"))v$("context-main",{currentTokens:$.currentTokens,tokenLimit:$.tokenLimit,messagesLength:$.messagesLength,utilization:$.utilization,nearLimit:$.nearLimit})}function zA($){A_.value=$.enabled===!0}function JA($){if(typeof $.theme==="string")PP($.theme)}function bA($){let v=Array.isArray($.nodeIds)?$.nodeIds.filter((U)=>typeof U==="string"):[];s3(v),D2({event:"context-pins-changed",data:$})}var d0=null;function OP(){if(d0)clearTimeout(d0);d0=setTimeout(()=>{d0=null,j3().then(($)=>{X6.value=$})},150)}function GA($){let v=$.intent;if(!v||typeof v.id!=="string"||typeof v.kind!=="string"||typeof v.expiresAt!=="number")return;$B(v)}function OA($){let v=typeof $.id==="string"?$.id:"";if(!v)return;if($.settled===!0)gB(v,typeof $.nodeId==="string"?$.nodeId:void 0);else AO(v)}var KA={connected:yw,"workbench-open":Dw,"canvas-status":Rw,"execution-phase":Tw,"context-cards":jw,"mcp-app-candidate":Vw,"mcp-app-host-snapshot":Cw,"mcp-app-host-fallback":fw,"aux-open":cw,"aux-close":mw,"assistant-complete":Ew,"tool-start":iw,"tool-complete":lw,"review-state":hw,"subagent-status":nw,"ext-app-open":xw,"ext-app-update":pw,"ext-app-result":ow,"context-pins-changed":bA,"canvas-layout-update":$A,"canvas-focus-node":gA,"canvas-viewport-update":UA,"context-usage":_A,"trace-state":zA,"theme-changed":JA,"canvas-prompt-created":tw,"canvas-prompt-status":dw,"canvas-response-start":aw,"canvas-response-delta":sw,"canvas-response-complete":ew,"ax-state-changed":OP,"ax-event-created":OP,"ax-intent":GA,"ax-intent-clear":OA};function fO(){if(VO=OK(),O4(),t6.value=!1,ZK(),UB(),i6)clearTimeout(i6),i6=null;let $=X4.value,v=$?`/api/workbench/events?session=${$}`:"/api/workbench/events";n6.value="connecting";let U=new EventSource(v);mU=U;for(let[_,g]of Object.entries(KA))U.addEventListener(_,(z)=>{try{g(JSON.parse(z.data))}catch(J){console.warn(`[sse-bridge] Failed to parse "${_}" event:`,J)}});return U.onopen=()=>{if(mU!==U)return;jO=0,n6.value="connected"},U.onerror=()=>{if(mU!==U)return;n6.value="disconnected",U.close(),mU=null,jO+=1,i6=setTimeout(()=>{i6=null,fO()},vA(jO))},()=>{if(i6)clearTimeout(i6),i6=null;U.close(),mU=null}}function WA($,v){console.error(`[app] ${$} failed`,v)}function HP($,v={}){fetch(`/api/workbench/intent?_ts=${Date.now()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:$,payload:v})}).catch((U)=>{WA("sendIntent",U)})}function Jv({label:$,detail:v,shortcut:U,align:_="center",children:g}){return G("span",{class:`toolbar-tooltip-anchor toolbar-tooltip-anchor-${_}`,children:[g,G("span",{class:"toolbar-tooltip",role:"tooltip",children:[G("span",{class:"toolbar-tooltip-label",children:$},void 0,!1,void 0,this),(v||U)&&G("span",{class:"toolbar-tooltip-meta",children:[v&&G("span",{children:v},void 0,!1,void 0,this),U&&G("kbd",{class:"toolbar-tooltip-shortcut",children:U},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 BA({minimapVisible:$,onToggleMinimap:v,snapshotOpen:U,onToggleSnapshot:_,snapshotBtnRef:g,onOpenPalette:z,onOpenShortcuts:J,annotationTool:b,onToggleAnnotationMode:O,onToggleAnnotationEraser:K,onToggleTextAnnotation:W}){let B=n6.value,k=t6.value,P=P$.value,F=T.value.size,I=m$.value.size,H=A_.value,Y=Array.from(T.value.values()).filter((C)=>C.type==="trace").length,q=B==="connected"&&!k?"syncing":B,w=q.charAt(0).toUpperCase()+q.slice(1),N=k?[`${F} node${F!==1?"s":""}`,...I>0?[`${I} edge${I!==1?"s":""}`]:[],...Y>0?[`${Y} trace${Y!==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(wB,{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?w:"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:X4.value?X4.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:()=>N_(window.innerWidth,window.innerHeight),"aria-label":"Fit canvas",children:G(JB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Reset view",shortcut:`${Sv}+0`,children:G("button",{type:"button",onClick:()=>lv({x:0,y:0,scale:1},250),"aria-label":"Reset view",children:G(bB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Zoom in",shortcut:`${Sv}++`,children:G("button",{type:"button",onClick:()=>lv({...P,scale:Math.min(4,P.scale*1.25)},150),"aria-label":"Zoom in",children:G(GB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),G(Jv,{label:"Zoom out",shortcut:`${Sv}+-`,children:G("button",{type:"button",onClick:()=>lv({...P,scale:Math.max(0.1,P.scale/1.25)},150),"aria-label":"Zoom out",children:G(OB,{},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:I>0?"Graph-aware layout for connected nodes":"Grid layout for loose nodes",children:G("button",{type:"button",onClick:()=>I>0?u_():r_(),"aria-label":"Arrange layout",children:G(KB,{},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(WB,{},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),Hg(),T$.value=C,I_(C)},"aria-label":`Switch to ${T$.value==="dark"?"light":"dark"} theme`,children:T$.value==="dark"?G(BB,{},void 0,!1,void 0,this):G(PB,{},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:g,type:"button",onClick:_,"aria-label":"Snapshots",style:{color:U?"var(--c-accent)":void 0},children:G(IB,{},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:()=>HP("trace-toggle",{enabled:!H}),"aria-label":H?"Disable trace":"Enable trace",style:{color:H?"var(--c-purple)":void 0},children:G(YB,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),(H||Y>0)&&G(Jv,{label:"Clear trace",detail:Y>0?`Remove ${Y} trace node${Y===1?"":"s"}`:"Trace is enabled but still empty",children:G("button",{type:"button",onClick:()=>HP("trace-clear"),"aria-label":"Clear trace",children:G(qB,{},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(kB,{},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(HB,{},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(LB,{},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:`${Sv}+K`,children:G("button",{type:"button",onClick:z,"aria-label":"Search nodes and actions",children:G(FB,{},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(XB,{},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 PA({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:[Sv,"+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 LP(){let[$,v]=o(!0),[U,_]=o(!1),[g,z]=o(!1),[J,b]=o(!1),[O,K]=o(null),W=y(null),{menu:B,openNodeMenu:k,openCanvasMenu:P,closeMenu:F}=nB(),I=t6.value,H=S(()=>v((u)=>!u),[]),Y=S(()=>_((u)=>!u),[]),q=S(()=>_(!1),[]),w=S(()=>K((u)=>u==="pen"?null:"pen"),[]),N=S(()=>K((u)=>u==="eraser"?null:"eraser"),[]),C=S(()=>K((u)=>u==="text"?null:"text"),[]),p=S((u,Q)=>{lv({x:u,y:Q,scale:P$.value.scale},200)},[]);c(()=>{return fO()},[]),c(()=>{let u=(Q)=>{let g$=Q.metaKey||Q.ctrlKey;if(g$&&Q.key==="k"){Q.preventDefault(),z((i)=>!i);return}if(Q.key==="Escape"&&O){Q.preventDefault(),K(null);return}if(Q.key==="Escape"&&j$.value&&!iv.value){Q.preventDefault(),d6();return}if(Q.key==="Escape"&&g){Q.preventDefault(),z(!1);return}if(Q.key==="Escape"&&J){Q.preventDefault(),b(!1);return}let m=Q.target?.tagName;if(m==="INPUT"||m==="TEXTAREA")return;if(Q.key==="?"||Q.key==="/"&&Q.shiftKey){Q.preventDefault(),b((i)=>!i);return}if(g$&&Q.key==="0")Q.preventDefault(),lv({x:0,y:0,scale:1},250);else if(g$&&(Q.key==="="||Q.key==="+")){Q.preventDefault();let i=P$.value;lv({...i,scale:Math.min(4,i.scale*1.25)},150)}else if(g$&&Q.key==="-"){Q.preventDefault();let i=P$.value;lv({...i,scale:Math.max(0.1,i.scale/1.25)},150)}else if(Q.key==="Escape"){if(i$.value.size>0){jv();return}D$.value=null,F()}else if(Q.key==="Tab")Q.preventDefault(),KK(Q.shiftKey?-1:1);else if(D$.value&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(Q.key)){Q.preventDefault();let i=Q.key.replace("Arrow","").toLowerCase();WK(i)}};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[O,F,g,J]),c(()=>{if(!I)return;let u=window.__pmxCanvasBootstrapReady;if(typeof u==="function")u()},[I]);let r=Array.from(T.value.values()),n=r.filter((u)=>u.dockPosition==="left"),e=r.filter((u)=>u.dockPosition==="right").sort((u,Q)=>{let g$={context:0,ledger:1};return(g$[u.type]??2)-(g$[Q.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(TO,{node:u},u.id,!1,void 0,this))},void 0,!1,void 0,this),G(BA,{minimapVisible:$,onToggleMinimap:H,snapshotOpen:U,onToggleSnapshot:Y,snapshotBtnRef:W,onOpenPalette:()=>z(!0),onOpenShortcuts:()=>b((u)=>!u),annotationTool:O,onToggleAnnotationMode:w,onToggleAnnotationEraser:N,onToggleTextAnnotation:C},void 0,!1,void 0,this),G("div",{class:"hud-right",children:e.map((u)=>G(TO,{node:u},u.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G(PK,{},void 0,!1,void 0,this),G(BK,{},void 0,!1,void 0,this),G(pB,{onNodeContextMenu:k,onCanvasContextMenu:P,annotationMode:O!==null,annotationTool:O},void 0,!1,void 0,this),I&&r.filter((u)=>!u.dockPosition).length===0&&Iv.value.size===0&&G(PA,{onOpenPalette:()=>z(!0)},void 0,!1,void 0,this),i$.value.size>0&&G(zP,{},void 0,!1,void 0,this),R$.value.size>0&&G(aB,{},void 0,!1,void 0,this),j$.value&&G(gP,{},void 0,!1,void 0,this),G(bP,{open:U,onClose:q,anchorRef:W},void 0,!1,void 0,this),$&&G(_P,{viewport:P$,nodes:T,edges:m$,onNavigate:p,containerWidth:window.innerWidth,containerHeight:window.innerHeight},void 0,!1,void 0,this),B&&G(tB,{menu:B,onClose:F},void 0,!1,void 0,this),g&&G(oB,{onClose:()=>z(!1),onToggleMinimap:H},void 0,!1,void 0,this),J&&G(JP,{onClose:()=>b(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var IP=document.getElementById("app");if(IP)g3(G(LP,{},void 0,!1,void 0,this),IP);
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);