@fabrika/builder 0.9.0-dev.11 → 0.9.0-dev.13
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.
- package/decisions/technologies/zerops-fabrika-auth.md +1 -1
- package/decisions/technologies/zerops-platform.md +1 -1
- package/package.json +9 -9
- package/types/shared/index.d.ts +27 -27
- package/ui/dist/assets/client.cemdw2n8.js +214 -0
- package/ui/dist/assets/components.js +21 -21
- package/ui/dist/index.html +1 -1
- package/ui/dist/assets/client.mh3w1dvc.js +0 -214
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
]`).replace("lheading",
|
|
1
|
+
var s5=Object.defineProperty;var t5=($)=>$;function e5($,J){this[$]=t5.bind(null,J)}var $2=($,J)=>{for(var Q in J)s5($,Q,{get:J[Q],enumerable:!0,configurable:!0,set:e5.bind(J,Q)})};import{useFeedback as KQ}from"#canvas/runtime";function H1(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var x$=H1();function c1($){x$=$}var m$={exec:()=>null};function E($,J=""){let Q=typeof $=="string"?$:$.source,q={replace:(W,Y)=>{let X=typeof Y=="string"?Y:Y.source;return X=X.replace(t.caret,"$1"),Q=Q.replace(W,X),q},getRegex:()=>new RegExp(Q,J)};return q}var J2=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),t={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:($)=>new RegExp(`^( {0,3}${$})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}#`),htmlBeginRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:($)=>new RegExp(`^ {0,${Math.min(3,$-1)}}>`)},Q2=/^(?:[ \t]*(?:\n|$))+/,W2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,q2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,L0=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Y2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,G1=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,p1=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,d1=E(p1).replace(/bull/g,G1).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),X2=E(p1).replace(/bull/g,G1).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),B1=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,H2=/^[^\n]+/,_1=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,G2=E(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_1).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),B2=E(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,G1).getRegex(),h0="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",M1=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_2=E("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",M1).replace("tag",h0).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),r1=E(B1).replace("hr",L0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",h0).getRegex(),M2=E(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",r1).getRegex(),U1={blockquote:M2,code:W2,def:G2,fences:q2,heading:Y2,hr:L0,html:_2,lheading:d1,list:B2,newline:Q2,paragraph:r1,table:m$,text:H2},h1=E("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",L0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",h0).getRegex(),U2={...U1,lheading:X2,table:h1,paragraph:E(B1).replace("hr",L0).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",h1).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",h0).getRegex()},w2={...U1,html:E(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",M1).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:m$,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:E(B1).replace("hr",L0).replace("heading",` *#{1,6} *[^
|
|
2
|
+
]`).replace("lheading",d1).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},z2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,N2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,i1=/^( {2,}|\\)\n(?!\s*$)/,K2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,i$=/[\p{P}\p{S}]/u,m0=/[\s\p{P}\p{S}]/u,w1=/[^\s\p{P}\p{S}]/u,O2=E(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,m0).getRegex(),o1=/(?!~)[\p{P}\p{S}]/u,L2=/(?!~)[\s\p{P}\p{S}]/u,F2=/(?:[^\s\p{P}\p{S}]|~)/u,S2=E(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",J2?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),n1=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,A2=E(n1,"u").replace(/punct/g,i$).getRegex(),b2=E(n1,"u").replace(/punct/g,o1).getRegex(),a1="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",f2=E(a1,"gu").replace(/notPunctSpace/g,w1).replace(/punctSpace/g,m0).replace(/punct/g,i$).getRegex(),v2=E(a1,"gu").replace(/notPunctSpace/g,F2).replace(/punctSpace/g,L2).replace(/punct/g,o1).getRegex(),R2=E("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,w1).replace(/punctSpace/g,m0).replace(/punct/g,i$).getRegex(),j2=E(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,i$).getRegex(),V2="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",P2=E(V2,"gu").replace(/notPunctSpace/g,w1).replace(/punctSpace/g,m0).replace(/punct/g,i$).getRegex(),D2=E(/\\(punct)/,"gu").replace(/punct/g,i$).getRegex(),k2=E(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[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])?)+(?![-_])/).getRegex(),C2=E(M1).replace("(?:-->|$)","-->").getRegex(),E2=E("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",C2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),I0=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,T2=E(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",I0).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),s1=E(/^!?\[(label)\]\[(ref)\]/).replace("label",I0).replace("ref",_1).getRegex(),t1=E(/^!?\[(ref)\](?:\[\])?/).replace("ref",_1).getRegex(),I2=E("reflink|nolink(?!\\()","g").replace("reflink",s1).replace("nolink",t1).getRegex(),m1=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,z1={_backpedal:m$,anyPunctuation:D2,autolink:k2,blockSkip:S2,br:i1,code:N2,del:m$,delLDelim:m$,delRDelim:m$,emStrongLDelim:A2,emStrongRDelimAst:f2,emStrongRDelimUnd:R2,escape:z2,link:T2,nolink:t1,punctuation:O2,reflink:s1,reflinkSearch:I2,tag:E2,text:K2,url:m$},y2={...z1,link:E(/^!?\[(label)\]\((.*?)\)/).replace("label",I0).getRegex(),reflink:E(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",I0).getRegex()},X1={...z1,emStrongRDelimAst:v2,emStrongLDelim:b2,delLDelim:j2,delRDelim:P2,url:E(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",m1).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:E(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",m1).getRegex()},g2={...X1,br:E(i1).replace("{2,}","*").getRegex(),text:E(X1.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},T0={normal:U1,gfm:U2,pedantic:w2},N0={normal:z1,gfm:X1,breaks:g2,pedantic:y2},h2={"&":"&","<":"<",">":">",'"':""","'":"'"},Z1=($)=>h2[$];function N$($,J){if(J){if(t.escapeTest.test($))return $.replace(t.escapeReplace,Z1)}else if(t.escapeTestNoEncode.test($))return $.replace(t.escapeReplaceNoEncode,Z1);return $}function x1($){try{$=encodeURI($).replace(t.percentDecode,"%")}catch{return null}return $}function u1($,J){let Q=$.replace(t.findPipe,(Y,X,G)=>{let H=!1,B=X;for(;--B>=0&&G[B]==="\\";)H=!H;return H?"|":" |"}),q=Q.split(t.splitPipe),W=0;if(q[0].trim()||q.shift(),q.length>0&&!q.at(-1)?.trim()&&q.pop(),J)if(q.length>J)q.splice(J);else for(;q.length<J;)q.push("");for(;W<q.length;W++)q[W]=q[W].trim().replace(t.slashPipe,"|");return q}function K0($,J,Q){let q=$.length;if(q===0)return"";let W=0;for(;W<q;){let Y=$.charAt(q-W-1);if(Y===J&&!Q)W++;else if(Y!==J&&Q)W++;else break}return $.slice(0,q-W)}function m2($,J){if($.indexOf(J[1])===-1)return-1;let Q=0;for(let q=0;q<$.length;q++)if($[q]==="\\")q++;else if($[q]===J[0])Q++;else if($[q]===J[1]&&(Q--,Q<0))return q;return Q>0?-2:-1}function Z2($,J=0){let Q=J,q="";for(let W of $)if(W==="\t"){let Y=4-Q%4;q+=" ".repeat(Y),Q+=Y}else q+=W,Q++;return q}function l1($,J,Q,q,W){let Y=J.href,X=J.title||null,G=$[1].replace(W.other.outputLinkReplace,"$1");q.state.inLink=!0;let H={type:$[0].charAt(0)==="!"?"image":"link",raw:Q,href:Y,title:X,text:G,tokens:q.inlineTokens(G)};return q.state.inLink=!1,H}function x2($,J,Q){let q=$.match(Q.other.indentCodeCompensation);if(q===null)return J;let W=q[1];return J.split(`
|
|
3
3
|
`).map((Y)=>{let X=Y.match(Q.other.beginningSpace);if(X===null)return Y;let[G]=X;return G.length>=W.length?Y.slice(W.length):Y}).join(`
|
|
4
|
-
`)}var
|
|
5
|
-
`)}}}fences($){let J=this.rules.block.fences.exec($);if(J){let Q=J[0],q=
|
|
6
|
-
`)}}blockquote($){let J=this.rules.block.blockquote.exec($);if(J){let Q=
|
|
4
|
+
`)}var y0=class{options;rules;lexer;constructor($){this.options=$||x$}space($){let J=this.rules.block.newline.exec($);if(J&&J[0].length>0)return{type:"space",raw:J[0]}}code($){let J=this.rules.block.code.exec($);if(J){let Q=J[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:J[0],codeBlockStyle:"indented",text:this.options.pedantic?Q:K0(Q,`
|
|
5
|
+
`)}}}fences($){let J=this.rules.block.fences.exec($);if(J){let Q=J[0],q=x2(Q,J[3]||"",this.rules);return{type:"code",raw:Q,lang:J[2]?J[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):J[2],text:q}}}heading($){let J=this.rules.block.heading.exec($);if(J){let Q=J[2].trim();if(this.rules.other.endingHash.test(Q)){let q=K0(Q,"#");(this.options.pedantic||!q||this.rules.other.endingSpaceChar.test(q))&&(Q=q.trim())}return{type:"heading",raw:J[0],depth:J[1].length,text:Q,tokens:this.lexer.inline(Q)}}}hr($){let J=this.rules.block.hr.exec($);if(J)return{type:"hr",raw:K0(J[0],`
|
|
6
|
+
`)}}blockquote($){let J=this.rules.block.blockquote.exec($);if(J){let Q=K0(J[0],`
|
|
7
7
|
`).split(`
|
|
8
8
|
`),q="",W="",Y=[];for(;Q.length>0;){let X=!1,G=[],H;for(H=0;H<Q.length;H++)if(this.rules.other.blockquoteStart.test(Q[H]))G.push(Q[H]),X=!0;else if(!X)G.push(Q[H]);else break;Q=Q.slice(H);let B=G.join(`
|
|
9
9
|
`),_=B.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -14,17 +14,17 @@ ${_}`:_;let w=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
14
14
|
`),K=this.blockquote(U);Y[Y.length-1]=K,q=q.substring(0,q.length-F.raw.length)+K.raw,W=W.substring(0,W.length-F.text.length)+K.text;break}else if(L?.type==="list"){let F=L,U=F.raw+`
|
|
15
15
|
`+Q.join(`
|
|
16
16
|
`),K=this.list(U);Y[Y.length-1]=K,q=q.substring(0,q.length-L.raw.length)+K.raw,W=W.substring(0,W.length-F.raw.length)+K.raw,Q=U.substring(Y.at(-1).raw.length).split(`
|
|
17
|
-
`);continue}}return{type:"blockquote",raw:q,tokens:Y,text:W}}}list($){let J=this.rules.block.list.exec($);if(J){let Q=J[1].trim(),q=Q.length>1,W={type:"list",raw:"",ordered:q,start:q?+Q.slice(0,-1):"",loose:!1,items:[]};Q=q?`\\d{1,9}\\${Q.slice(-1)}`:`\\${Q}`,this.options.pedantic&&(Q=q?Q:"[*+-]");let Y=this.rules.other.listItemRegex(Q),X=!1;for(;$;){let H=!1,B="",_="";if(!(J=Y.exec($))||this.rules.block.hr.test($))break;B=J[0],$=$.substring(B.length);let w=
|
|
17
|
+
`);continue}}return{type:"blockquote",raw:q,tokens:Y,text:W}}}list($){let J=this.rules.block.list.exec($);if(J){let Q=J[1].trim(),q=Q.length>1,W={type:"list",raw:"",ordered:q,start:q?+Q.slice(0,-1):"",loose:!1,items:[]};Q=q?`\\d{1,9}\\${Q.slice(-1)}`:`\\${Q}`,this.options.pedantic&&(Q=q?Q:"[*+-]");let Y=this.rules.other.listItemRegex(Q),X=!1;for(;$;){let H=!1,B="",_="";if(!(J=Y.exec($))||this.rules.block.hr.test($))break;B=J[0],$=$.substring(B.length);let w=Z2(J[2].split(`
|
|
18
18
|
`,1)[0],J[1].length),L=$.split(`
|
|
19
19
|
`,1)[0],F=!w.trim(),U=0;if(this.options.pedantic?(U=2,_=w.trimStart()):F?U=J[1].length+1:(U=w.search(this.rules.other.nonSpaceChar),U=U>4?1:U,_=w.slice(U),U+=J[1].length),F&&this.rules.other.blankLine.test(L)&&(B+=L+`
|
|
20
|
-
`,$=$.substring(L.length+1),H=!0),!H){let K=this.rules.other.nextBulletRegex(U),O=this.rules.other.hrRegex(U),R=this.rules.other.fencesBeginRegex(U),
|
|
21
|
-
`,1)[0],
|
|
22
|
-
`+
|
|
23
|
-
`+L}F=!L.trim(),B+=
|
|
24
|
-
`,$=$.substring(
|
|
25
|
-
`):[],Y={type:"table",raw:J[0],header:[],align:[],rows:[]};if(Q.length===q.length){for(let X of q)this.rules.other.tableAlignRight.test(X)?Y.align.push("right"):this.rules.other.tableAlignCenter.test(X)?Y.align.push("center"):this.rules.other.tableAlignLeft.test(X)?Y.align.push("left"):Y.align.push(null);for(let X=0;X<Q.length;X++)Y.header.push({text:Q[X],tokens:this.lexer.inline(Q[X]),header:!0,align:Y.align[X]});for(let X of W)Y.rows.push(
|
|
26
|
-
`?J[1].slice(0,-1):J[1];return{type:"paragraph",raw:J[0],text:Q,tokens:this.lexer.inline(Q)}}}text($){let J=this.rules.block.text.exec($);if(J)return{type:"text",raw:J[0],text:J[0],tokens:this.lexer.inline(J[0])}}escape($){let J=this.rules.inline.escape.exec($);if(J)return{type:"escape",raw:J[0],text:J[1]}}tag($){let J=this.rules.inline.tag.exec($);if(J)return!this.lexer.state.inLink&&this.rules.other.startATag.test(J[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(J[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(J[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(J[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:J[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:J[0]}}link($){let J=this.rules.inline.link.exec($);if(J){let Q=J[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(Q)){if(!this.rules.other.endAngleBracket.test(Q))return;let Y=
|
|
27
|
-
`),this.blockTokens(J,this.tokens);for(let Q=0;Q<this.inlineQueue.length;Q++){let q=this.inlineQueue[Q];this.inlineTokens(q.src,q.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(J,Q=[],q=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(J=J.replace(
|
|
20
|
+
`,$=$.substring(L.length+1),H=!0),!H){let K=this.rules.other.nextBulletRegex(U),O=this.rules.other.hrRegex(U),R=this.rules.other.fencesBeginRegex(U),I=this.rules.other.headingBeginRegex(U),y=this.rules.other.htmlBeginRegex(U),l=this.rules.other.blockquoteBeginRegex(U);for(;$;){let Z=$.split(`
|
|
21
|
+
`,1)[0],x;if(L=Z,this.options.pedantic?(L=L.replace(this.rules.other.listReplaceNesting," "),x=L):x=L.replace(this.rules.other.tabCharGlobal," "),R.test(L)||I.test(L)||y.test(L)||l.test(L)||K.test(L)||O.test(L))break;if(x.search(this.rules.other.nonSpaceChar)>=U||!L.trim())_+=`
|
|
22
|
+
`+x.slice(U);else{if(F||w.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||R.test(w)||I.test(w)||O.test(w))break;_+=`
|
|
23
|
+
`+L}F=!L.trim(),B+=Z+`
|
|
24
|
+
`,$=$.substring(Z.length+1),w=x.slice(U)}}W.loose||(X?W.loose=!0:this.rules.other.doubleBlankLine.test(B)&&(X=!0)),W.items.push({type:"list_item",raw:B,task:!!this.options.gfm&&this.rules.other.listIsTask.test(_),loose:!1,text:_,tokens:[]}),W.raw+=B}let G=W.items.at(-1);if(G)G.raw=G.raw.trimEnd(),G.text=G.text.trimEnd();else return;W.raw=W.raw.trimEnd();for(let H of W.items){if(this.lexer.state.top=!1,H.tokens=this.lexer.blockTokens(H.text,[]),H.task){if(H.text=H.text.replace(this.rules.other.listReplaceTask,""),H.tokens[0]?.type==="text"||H.tokens[0]?.type==="paragraph"){H.tokens[0].raw=H.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),H.tokens[0].text=H.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let _=this.lexer.inlineQueue.length-1;_>=0;_--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[_].src)){this.lexer.inlineQueue[_].src=this.lexer.inlineQueue[_].src.replace(this.rules.other.listReplaceTask,"");break}}let B=this.rules.other.listTaskCheckbox.exec(H.raw);if(B){let _={type:"checkbox",raw:B[0]+" ",checked:B[0]!=="[ ]"};H.checked=_.checked,W.loose?H.tokens[0]&&["paragraph","text"].includes(H.tokens[0].type)&&"tokens"in H.tokens[0]&&H.tokens[0].tokens?(H.tokens[0].raw=_.raw+H.tokens[0].raw,H.tokens[0].text=_.raw+H.tokens[0].text,H.tokens[0].tokens.unshift(_)):H.tokens.unshift({type:"paragraph",raw:_.raw,text:_.raw,tokens:[_]}):H.tokens.unshift(_)}}if(!W.loose){let B=H.tokens.filter((w)=>w.type==="space"),_=B.length>0&&B.some((w)=>this.rules.other.anyLine.test(w.raw));W.loose=_}}if(W.loose)for(let H of W.items){H.loose=!0;for(let B of H.tokens)B.type==="text"&&(B.type="paragraph")}return W}}html($){let J=this.rules.block.html.exec($);if(J)return{type:"html",block:!0,raw:J[0],pre:J[1]==="pre"||J[1]==="script"||J[1]==="style",text:J[0]}}def($){let J=this.rules.block.def.exec($);if(J){let Q=J[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),q=J[2]?J[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",W=J[3]?J[3].substring(1,J[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):J[3];return{type:"def",tag:Q,raw:J[0],href:q,title:W}}}table($){let J=this.rules.block.table.exec($);if(!J||!this.rules.other.tableDelimiter.test(J[2]))return;let Q=u1(J[1]),q=J[2].replace(this.rules.other.tableAlignChars,"").split("|"),W=J[3]?.trim()?J[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
25
|
+
`):[],Y={type:"table",raw:J[0],header:[],align:[],rows:[]};if(Q.length===q.length){for(let X of q)this.rules.other.tableAlignRight.test(X)?Y.align.push("right"):this.rules.other.tableAlignCenter.test(X)?Y.align.push("center"):this.rules.other.tableAlignLeft.test(X)?Y.align.push("left"):Y.align.push(null);for(let X=0;X<Q.length;X++)Y.header.push({text:Q[X],tokens:this.lexer.inline(Q[X]),header:!0,align:Y.align[X]});for(let X of W)Y.rows.push(u1(X,Y.header.length).map((G,H)=>({text:G,tokens:this.lexer.inline(G),header:!1,align:Y.align[H]})));return Y}}lheading($){let J=this.rules.block.lheading.exec($);if(J){let Q=J[1].trim();return{type:"heading",raw:J[0],depth:J[2].charAt(0)==="="?1:2,text:Q,tokens:this.lexer.inline(Q)}}}paragraph($){let J=this.rules.block.paragraph.exec($);if(J){let Q=J[1].charAt(J[1].length-1)===`
|
|
26
|
+
`?J[1].slice(0,-1):J[1];return{type:"paragraph",raw:J[0],text:Q,tokens:this.lexer.inline(Q)}}}text($){let J=this.rules.block.text.exec($);if(J)return{type:"text",raw:J[0],text:J[0],tokens:this.lexer.inline(J[0])}}escape($){let J=this.rules.inline.escape.exec($);if(J)return{type:"escape",raw:J[0],text:J[1]}}tag($){let J=this.rules.inline.tag.exec($);if(J)return!this.lexer.state.inLink&&this.rules.other.startATag.test(J[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(J[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(J[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(J[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:J[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:J[0]}}link($){let J=this.rules.inline.link.exec($);if(J){let Q=J[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(Q)){if(!this.rules.other.endAngleBracket.test(Q))return;let Y=K0(Q.slice(0,-1),"\\");if((Q.length-Y.length)%2===0)return}else{let Y=m2(J[2],"()");if(Y===-2)return;if(Y>-1){let X=(J[0].indexOf("!")===0?5:4)+J[1].length+Y;J[2]=J[2].substring(0,Y),J[0]=J[0].substring(0,X).trim(),J[3]=""}}let q=J[2],W="";if(this.options.pedantic){let Y=this.rules.other.pedanticHrefTitle.exec(q);Y&&(q=Y[1],W=Y[3])}else W=J[3]?J[3].slice(1,-1):"";return q=q.trim(),this.rules.other.startAngleBracket.test(q)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(Q)?q=q.slice(1):q=q.slice(1,-1)),l1(J,{href:q&&q.replace(this.rules.inline.anyPunctuation,"$1"),title:W&&W.replace(this.rules.inline.anyPunctuation,"$1")},J[0],this.lexer,this.rules)}}reflink($,J){let Q;if((Q=this.rules.inline.reflink.exec($))||(Q=this.rules.inline.nolink.exec($))){let q=(Q[2]||Q[1]).replace(this.rules.other.multipleSpaceGlobal," "),W=J[q.toLowerCase()];if(!W){let Y=Q[0].charAt(0);return{type:"text",raw:Y,text:Y}}return l1(Q,W,Q[0],this.lexer,this.rules)}}emStrong($,J,Q=""){let q=this.rules.inline.emStrongLDelim.exec($);if(!q||!q[1]&&!q[2]&&!q[3]&&!q[4]||q[4]&&Q.match(this.rules.other.unicodeAlphaNumeric))return;if(!(q[1]||q[3])||!Q||this.rules.inline.punctuation.exec(Q)){let W=[...q[0]].length-1,Y,X,G=W,H=0,B=q[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(B.lastIndex=0,J=J.slice(-1*$.length+W);(q=B.exec(J))!==null;){if(Y=q[1]||q[2]||q[3]||q[4]||q[5]||q[6],!Y)continue;if(X=[...Y].length,q[3]||q[4]){G+=X;continue}else if((q[5]||q[6])&&W%3&&!((W+X)%3)){H+=X;continue}if(G-=X,G>0)continue;X=Math.min(X,X+G+H);let _=[...q[0]][0].length,w=$.slice(0,W+q.index+_+X);if(Math.min(W,X)%2){let F=w.slice(1,-1);return{type:"em",raw:w,text:F,tokens:this.lexer.inlineTokens(F)}}let L=w.slice(2,-2);return{type:"strong",raw:w,text:L,tokens:this.lexer.inlineTokens(L)}}}}codespan($){let J=this.rules.inline.code.exec($);if(J){let Q=J[2].replace(this.rules.other.newLineCharGlobal," "),q=this.rules.other.nonSpaceChar.test(Q),W=this.rules.other.startingSpaceChar.test(Q)&&this.rules.other.endingSpaceChar.test(Q);return q&&W&&(Q=Q.substring(1,Q.length-1)),{type:"codespan",raw:J[0],text:Q}}}br($){let J=this.rules.inline.br.exec($);if(J)return{type:"br",raw:J[0]}}del($,J,Q=""){let q=this.rules.inline.delLDelim.exec($);if(!q)return;if(!q[1]||!Q||this.rules.inline.punctuation.exec(Q)){let W=[...q[0]].length-1,Y,X,G=W,H=this.rules.inline.delRDelim;for(H.lastIndex=0,J=J.slice(-1*$.length+W);(q=H.exec(J))!==null;){if(Y=q[1]||q[2]||q[3]||q[4]||q[5]||q[6],!Y||(X=[...Y].length,X!==W))continue;if(q[3]||q[4]){G+=X;continue}if(G-=X,G>0)continue;X=Math.min(X,X+G);let B=[...q[0]][0].length,_=$.slice(0,W+q.index+B+X),w=_.slice(W,-W);return{type:"del",raw:_,text:w,tokens:this.lexer.inlineTokens(w)}}}}autolink($){let J=this.rules.inline.autolink.exec($);if(J){let Q,q;return J[2]==="@"?(Q=J[1],q="mailto:"+Q):(Q=J[1],q=Q),{type:"link",raw:J[0],text:Q,href:q,tokens:[{type:"text",raw:Q,text:Q}]}}}url($){let J;if(J=this.rules.inline.url.exec($)){let Q,q;if(J[2]==="@")Q=J[0],q="mailto:"+Q;else{let W;do W=J[0],J[0]=this.rules.inline._backpedal.exec(J[0])?.[0]??"";while(W!==J[0]);Q=J[0],J[1]==="www."?q="http://"+J[0]:q=J[0]}return{type:"link",raw:J[0],text:Q,href:q,tokens:[{type:"text",raw:Q,text:Q}]}}}inlineText($){let J=this.rules.inline.text.exec($);if(J){let Q=this.lexer.state.inRawBlock;return{type:"text",raw:J[0],text:J[0],escaped:Q}}}},Y$=class ${tokens;options;state;inlineQueue;tokenizer;constructor(J){this.tokens=[],this.tokens.links=Object.create(null),this.options=J||x$,this.options.tokenizer=this.options.tokenizer||new y0,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let Q={other:t,block:T0.normal,inline:N0.normal};this.options.pedantic?(Q.block=T0.pedantic,Q.inline=N0.pedantic):this.options.gfm&&(Q.block=T0.gfm,this.options.breaks?Q.inline=N0.breaks:Q.inline=N0.gfm),this.tokenizer.rules=Q}static get rules(){return{block:T0,inline:N0}}static lex(J,Q){return new $(Q).lex(J)}static lexInline(J,Q){return new $(Q).inlineTokens(J)}lex(J){J=J.replace(t.carriageReturn,`
|
|
27
|
+
`),this.blockTokens(J,this.tokens);for(let Q=0;Q<this.inlineQueue.length;Q++){let q=this.inlineQueue[Q];this.inlineTokens(q.src,q.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(J,Q=[],q=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(J=J.replace(t.tabCharGlobal," ").replace(t.spaceLine,""));J;){let W;if(this.options.extensions?.block?.some((X)=>(W=X.call({lexer:this},J,Q))?(J=J.substring(W.raw.length),Q.push(W),!0):!1))continue;if(W=this.tokenizer.space(J)){J=J.substring(W.raw.length);let X=Q.at(-1);W.raw.length===1&&X!==void 0?X.raw+=`
|
|
28
28
|
`:Q.push(W);continue}if(W=this.tokenizer.code(J)){J=J.substring(W.raw.length);let X=Q.at(-1);X?.type==="paragraph"||X?.type==="text"?(X.raw+=(X.raw.endsWith(`
|
|
29
29
|
`)?"":`
|
|
30
30
|
`)+W.raw,X.text+=`
|
|
@@ -37,9 +37,9 @@ ${_}`:_;let w=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
37
37
|
`+W.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=X.text):Q.push(W),q=Y.length!==J.length,J=J.substring(W.raw.length);continue}if(W=this.tokenizer.text(J)){J=J.substring(W.raw.length);let X=Q.at(-1);X?.type==="text"?(X.raw+=(X.raw.endsWith(`
|
|
38
38
|
`)?"":`
|
|
39
39
|
`)+W.raw,X.text+=`
|
|
40
|
-
`+W.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=X.text):Q.push(W);continue}if(J){let X="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(X);break}else throw Error(X)}}return this.state.top=!0,Q}inline(J,Q=[]){return this.inlineQueue.push({src:J,tokens:Q}),Q}inlineTokens(J,Q=[]){this.tokenizer.lexer=this;let q=J,W=null;if(this.tokens.links){let H=Object.keys(this.tokens.links);if(H.length>0)for(;(W=this.tokenizer.rules.inline.reflinkSearch.exec(q))!==null;)H.includes(W[0].slice(W[0].lastIndexOf("[")+1,-1))&&(q=q.slice(0,W.index)+"["+"a".repeat(W[0].length-2)+"]"+q.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(W=this.tokenizer.rules.inline.anyPunctuation.exec(q))!==null;)q=q.slice(0,W.index)+"++"+q.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let Y;for(;(W=this.tokenizer.rules.inline.blockSkip.exec(q))!==null;)Y=W[2]?W[2].length:0,q=q.slice(0,W.index+Y)+"["+"a".repeat(W[0].length-Y-2)+"]"+q.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);q=this.options.hooks?.emStrongMask?.call({lexer:this},q)??q;let X=!1,G="";for(;J;){X||(G=""),X=!1;let H;if(this.options.extensions?.inline?.some((_)=>(H=_.call({lexer:this},J,Q))?(J=J.substring(H.raw.length),Q.push(H),!0):!1))continue;if(H=this.tokenizer.escape(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.tag(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.link(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.reflink(J,this.tokens.links)){J=J.substring(H.raw.length);let _=Q.at(-1);H.type==="text"&&_?.type==="text"?(_.raw+=H.raw,_.text+=H.text):Q.push(H);continue}if(H=this.tokenizer.emStrong(J,q,G)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.codespan(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.br(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.del(J,q,G)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.autolink(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(!this.state.inLink&&(H=this.tokenizer.url(J))){J=J.substring(H.raw.length),Q.push(H);continue}let B=J;if(this.options.extensions?.startInline){let _=1/0,w=J.slice(1),L;this.options.extensions.startInline.forEach((F)=>{L=F.call({lexer:this},w),typeof L=="number"&&L>=0&&(_=Math.min(_,L))}),_<1/0&&_>=0&&(B=J.substring(0,_+1))}if(H=this.tokenizer.inlineText(B)){J=J.substring(H.raw.length),H.raw.slice(-1)!=="_"&&(G=H.raw.slice(-1)),X=!0;let _=Q.at(-1);_?.type==="text"?(_.raw+=H.raw,_.text+=H.text):Q.push(H);continue}if(J){let _="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw Error(_)}}return Q}},
|
|
41
|
-
`;return q?'<pre><code class="language-'+
|
|
42
|
-
`:"<pre><code>"+(Q?W:
|
|
40
|
+
`+W.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=X.text):Q.push(W);continue}if(J){let X="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(X);break}else throw Error(X)}}return this.state.top=!0,Q}inline(J,Q=[]){return this.inlineQueue.push({src:J,tokens:Q}),Q}inlineTokens(J,Q=[]){this.tokenizer.lexer=this;let q=J,W=null;if(this.tokens.links){let H=Object.keys(this.tokens.links);if(H.length>0)for(;(W=this.tokenizer.rules.inline.reflinkSearch.exec(q))!==null;)H.includes(W[0].slice(W[0].lastIndexOf("[")+1,-1))&&(q=q.slice(0,W.index)+"["+"a".repeat(W[0].length-2)+"]"+q.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(W=this.tokenizer.rules.inline.anyPunctuation.exec(q))!==null;)q=q.slice(0,W.index)+"++"+q.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let Y;for(;(W=this.tokenizer.rules.inline.blockSkip.exec(q))!==null;)Y=W[2]?W[2].length:0,q=q.slice(0,W.index+Y)+"["+"a".repeat(W[0].length-Y-2)+"]"+q.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);q=this.options.hooks?.emStrongMask?.call({lexer:this},q)??q;let X=!1,G="";for(;J;){X||(G=""),X=!1;let H;if(this.options.extensions?.inline?.some((_)=>(H=_.call({lexer:this},J,Q))?(J=J.substring(H.raw.length),Q.push(H),!0):!1))continue;if(H=this.tokenizer.escape(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.tag(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.link(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.reflink(J,this.tokens.links)){J=J.substring(H.raw.length);let _=Q.at(-1);H.type==="text"&&_?.type==="text"?(_.raw+=H.raw,_.text+=H.text):Q.push(H);continue}if(H=this.tokenizer.emStrong(J,q,G)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.codespan(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.br(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.del(J,q,G)){J=J.substring(H.raw.length),Q.push(H);continue}if(H=this.tokenizer.autolink(J)){J=J.substring(H.raw.length),Q.push(H);continue}if(!this.state.inLink&&(H=this.tokenizer.url(J))){J=J.substring(H.raw.length),Q.push(H);continue}let B=J;if(this.options.extensions?.startInline){let _=1/0,w=J.slice(1),L;this.options.extensions.startInline.forEach((F)=>{L=F.call({lexer:this},w),typeof L=="number"&&L>=0&&(_=Math.min(_,L))}),_<1/0&&_>=0&&(B=J.substring(0,_+1))}if(H=this.tokenizer.inlineText(B)){J=J.substring(H.raw.length),H.raw.slice(-1)!=="_"&&(G=H.raw.slice(-1)),X=!0;let _=Q.at(-1);_?.type==="text"?(_.raw+=H.raw,_.text+=H.text):Q.push(H);continue}if(J){let _="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw Error(_)}}return Q}},g0=class{options;parser;constructor($){this.options=$||x$}space($){return""}code({text:$,lang:J,escaped:Q}){let q=(J||"").match(t.notSpaceStart)?.[0],W=$.replace(t.endingNewline,"")+`
|
|
41
|
+
`;return q?'<pre><code class="language-'+N$(q)+'">'+(Q?W:N$(W,!0))+`</code></pre>
|
|
42
|
+
`:"<pre><code>"+(Q?W:N$(W,!0))+`</code></pre>
|
|
43
43
|
`}blockquote({tokens:$}){return`<blockquote>
|
|
44
44
|
${this.parser.parse($)}</blockquote>
|
|
45
45
|
`}html({text:$}){return $}def($){return""}heading({tokens:$,depth:J}){return`<h${J}>${this.parser.parseInline($)}</h${J}>
|
|
@@ -55,9 +55,9 @@ ${this.parser.parse($)}</blockquote>
|
|
|
55
55
|
`}tablerow({text:$}){return`<tr>
|
|
56
56
|
${$}</tr>
|
|
57
57
|
`}tablecell($){let J=this.parser.parseInline($.tokens),Q=$.header?"th":"td";return($.align?`<${Q} align="${$.align}">`:`<${Q}>`)+J+`</${Q}>
|
|
58
|
-
`}strong({tokens:$}){return`<strong>${this.parser.parseInline($)}</strong>`}em({tokens:$}){return`<em>${this.parser.parseInline($)}</em>`}codespan({text:$}){return`<code>${
|
|
59
|
-
Please report this to https://github.com/markedjs/marked.`,$){let q="<p>An error occurred:</p><pre>"+O$(Q.message+"",!0)+"</pre>";return J?Promise.resolve(q):q}if(J)return Promise.reject(Q);throw Q}}},x$=new m2;function k($,J){return x$.parse($,J)}k.options=k.setOptions=function($){return x$.setOptions($),k.defaults=x$.defaults,l1(k.defaults),k};k.getDefaults=X1;k.defaults=u$;k.use=function(...$){return x$.use(...$),k.defaults=x$.defaults,l1(k.defaults),k};k.walkTokens=function($,J){return x$.walkTokens($,J)};k.parseInline=x$.parseInline;k.Parser=X$;k.parser=X$.parse;k.Renderer=h0;k.TextRenderer=z1;k.Lexer=Y$;k.lexer=Y$.lex;k.Tokenizer=g0;k.Hooks=L0;k.parse=k;var{options:v6,setOptions:R6,use:j6,walkTokens:V6,parseInline:P6}=k;var D6=X$.parse,C6=Y$.lex;import t1 from"react";import{jsxDEV as N1}from"react/jsx-dev-runtime";k.setOptions({gfm:!0,breaks:!1});var Z2=new Set(["a","abbr","b","br","code","del","em","i","kbd","mark","q","s","small","span","strong","sub","sup","time","u"]),x2=new Set(["Priority"]);function u2($){if(typeof $==="string"||typeof $==="number")return!0;if(!t1.isValidElement($))return!1;if(typeof $!=="object"||$===null||!("type"in $))return!1;let J=$.type;if(typeof J==="string")return Z2.has(J);if(typeof J==="function"){let Q="displayName"in J&&typeof J.displayName==="string"?J.displayName:J.name;return Q?x2.has(Q):!1}return!1}function l2($,J){let Q=$.trim();if(!Q)return null;let q=k.parse(Q,{async:!1});return N1("div",{className:"prose-canvas","data-md":"markdown","data-md-source":Q,dangerouslySetInnerHTML:{__html:q}},J,!1,void 0,this)}function c2($,J){return N1("div",{className:"prose-canvas",children:$.map((Q,q)=>{if(typeof Q==="string"||typeof Q==="number"){let W=k.parseInline(String(Q),{async:!1});return N1("span",{dangerouslySetInnerHTML:{__html:W}},q,!1,void 0,this)}return Q})},J,!1,void 0,this)}function P$($){let J=t1.Children.toArray($);if(J.length===0)return null;let Q=[],q=[],W=0,Y=()=>{if(q.length===0)return;if(q.some((G)=>typeof G!=="string"&&typeof G!=="number"))Q.push(c2(q,`md-${W++}`));else{let G=l2(q.join(""),`md-${W++}`);if(G)Q.push(G)}q=[]};for(let X of J)if(u2(X))q.push(X);else Y(),Q.push(X);return Y(),Q}import{jsxDEV as K1}from"react/jsx-dev-runtime";var p2={info:{bg:"bg-accent-blue-muted",icon:"i",iconColor:"text-accent-blue"},warning:{bg:"bg-accent-amber-muted",icon:"!",iconColor:"text-accent-amber"},danger:{bg:"bg-accent-red-muted",icon:"✕",iconColor:"text-accent-red"},tip:{bg:"bg-accent-green-muted",icon:"✓",iconColor:"text-accent-green"}};function d2({type:$="info",children:J}){let Q=p2[$];return K1("div",{className:`${Q.bg} relative rounded-lg px-5 py-4 mt-3 flex gap-3 items-start`,"data-md":"callout","data-md-type":$,children:[K1("span",{"aria-hidden":"true",className:`${Q.iconColor} opacity-70 text-base leading-relaxed flex-shrink-0 mt-px`,children:Q.icon},void 0,!1,void 0,this),K1("div",{className:"text-body text-text-secondary leading-relaxed",children:P$(J)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as a$}from"react/jsx-dev-runtime";function r2({items:$}){return a$("ul",{className:"space-y-1 mt-3","data-md":"checklist",children:$.map((J,Q)=>a$("li",{"data-md":"checklist-item","data-md-label":J.label,className:"relative flex items-start gap-2.5 py-1",children:[a$("span",{className:`w-4 h-4 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 transition-all ${J.checked?"bg-accent-green":"border-[1.5px] border-border-hover"}`,children:J.checked&&a$("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:a$("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a$("span",{className:`text-body font-body ${J.checked?"text-text-tertiary line-through decoration-border-hover":"text-text-secondary"}`,children:J.label},void 0,!1,void 0,this)]},Q,!0,void 0,this))},void 0,!1,void 0,this)}import{useAnnotations as V5,useResponseRegistration as P5}from"#canvas/runtime";import{useEffect as D5,useMemo as C5,useRef as k5,useState as E5}from"react";import{AnnotationCtx as C7,AnnotationHostContext as k7,SessionContext as E7,useAnnotationHost as T7,useAnnotations as I7}from"@fabrika/annotations/runtime";function O1($,J){let Q=[],q=i2($);for(let W of q){let Y=document.createRange();if(Y.selectNodeContents(W),W===$.startContainer)Y.setStart(W,$.startOffset);if(W===$.endContainer)Y.setEnd(W,$.endOffset);let X=Y.toString();if(!X||!X.trim())continue;let G=document.createElement("mark");G.setAttribute("data-annotation-id",J);try{Y.surroundContents(G)}catch{let H=Y.extractContents();G.appendChild(H),Y.insertNode(G)}Q.push(G)}return Q}function L1($){let J=$.parentElement;if(J?.classList.contains("select-none"))return!1;if(J?.closest("[data-annotation-id]"))return!1;return!0}function i2($){let J=[],Q=$.commonAncestorContainer;if(Q.nodeType===Node.TEXT_NODE)return J.push(Q),J;let q=document.createTreeWalker(Q,NodeFilter.SHOW_TEXT),W;while(W=q.nextNode()){if(!L1(W))continue;if($.intersectsNode(W))J.push(W)}return J}function F1($,J){for(let Q of J){if($.querySelector(`[data-annotation-id="${Q.id}"]`))continue;let q=Q.snippet;if(!q)continue;let{fullText:W,textNodes:Y}=o2($),X=[],G=0;while(!0){let U=W.indexOf(q,G);if(U===-1)break;X.push(U),G=U+1}let[H]=X;if(H===void 0)continue;let B=H;if(X.length>1&&Q.context){let U=-1;for(let K of X){let O=0;if(Q.context.before){let R=W.slice(Math.max(0,K-80),K);if(R.includes(Q.context.before))O+=2;else if(Q.context.before.length>10&&R.includes(Q.context.before.slice(-10)))O+=1}if(Q.context.after){let R=W.slice(K+q.length,K+q.length+80);if(R.includes(Q.context.after))O+=2;else if(Q.context.after.length>10&&R.includes(Q.context.after.slice(0,10)))O+=1}if(O>U)U=O,B=K}}let _=B,w=B+q.length,L=e1(Y,_),F=e1(Y,w);if(!L||!F)continue;try{let U=document.createRange();U.setStart(L.node,L.offset),U.setEnd(F.node,F.offset),O1(U,Q.id)}catch{}}}function o2($){let J=[],Q="",q=document.createTreeWalker($,NodeFilter.SHOW_TEXT),W;while(W=q.nextNode()){if(!L1(W))continue;J.push({node:W,start:Q.length}),Q+=W.textContent||""}return{fullText:Q,textNodes:J}}function e1($,J){for(let Q=$.length-1;Q>=0;Q--){let q=$[Q];if(!q||q.start>J)continue;let W=J-q.start,Y=q.node.textContent?.length??0;if(W<=Y)return{node:q.node,offset:W}}return null}function S0($){return{kind:$.kind,owns:(J)=>$.parse(J)!==null,find:(J,Q)=>{let q=$.parse(J);return q===null?null:$.find(q,Q)},restore:(J,Q)=>{let q=$.parse(Q.snippet);if(q===null)return;$.restore?.(q,J,Q)},describe:(J)=>{let Q=$.parse(J);if(Q===null||!$.describe)return null;return $.describe(Q)}}}function $5($){let J=document.createTreeWalker($,NodeFilter.SHOW_TEXT),Q="";for(let q=J.nextNode();q;q=J.nextNode()){let W=q.parentElement?.closest("[aria-hidden='true']");if(W&&$.contains(W))continue;Q+=q.textContent??""}return Q.trim()}function x0($,J,Q){return{selector:$,snippet:(q)=>{let W=q.getAttribute(Q);return W?`${J} ${W}`:null}}}var S1=[x0("[data-md='item']","[Item]","data-md-label"),x0("[data-md='section']","[Section]","data-md-title"),x0("[data-md='checklist-item']","[Checklist]","data-md-label"),x0("[data-md='image']","[Image]","data-md-src"),{selector:"[data-md='callout']",snippet:($)=>{return`[Callout:${$.getAttribute("data-md-type")||"info"}] ${$5($).slice(0,60)||"Callout"}`}},{selector:"[data-md='note']",snippet:($)=>`[Note] ${$5($).slice(0,60)||"Note"}`},{selector:"[data-md='table'] tbody tr",snippet:($)=>{let J=Array.from($.querySelectorAll("td")).map((Q)=>Q.textContent?.trim()).filter(Boolean);return J.length?`[Row] ${J.join(" | ")}`:null}}],n2=["[data-md='choice-option']","[data-md='multichoice-option']","[data-md='userinput']","[data-md='rangeinput']"],A1=S1.map(($)=>$.selector).join(", "),J5=[...S1.map(($)=>$.selector),...n2].join(", ");function b1($){for(let J of S1)if($.matches(J.selector))return J.snippet($);return null}var f1={kind:"block",parse:($)=>$.startsWith("[")?{snippet:$}:null,format:($)=>$.snippet,find:($,J)=>{for(let Q of J.querySelectorAll(A1)){if(!(Q instanceof HTMLElement))continue;if(b1(Q)===$.snippet)return Q}return null}};var a2=/^\[Region:(rect|ellipse)\] ([\s\S]+) @(0|[1-9]\d*),(0|[1-9]\d*),(0|[1-9]\d*),(0|[1-9]\d*)$/;function s2($){if($==="rect")return"rect";if($==="ellipse")return"ellipse";return null}function u0($){if($===void 0)return null;let J=Number($);if(!Number.isInteger(J)||J<0||J>1e4)return null;return J}function Q5($){return{left:`${$.x/100}%`,top:`${$.y/100}%`,width:`${$.w/100}%`,height:`${$.h/100}%`}}function l0($){return`${($/100).toFixed(1).replace(/\.0$/,"")}%`}function R1($){let J=`${l0($.x)}-${l0($.x+$.w)}`,Q=`${l0($.y)}-${l0($.y+$.h)}`;return`[Region] ${$.src} — ${$.shape} x ${J}, y ${Q} of the image`}function v1($,J){for(let Q of J.querySelectorAll("[data-md='image']")){if(!(Q instanceof HTMLElement))continue;if(Q.getAttribute("data-md-src")!==$)continue;let q=Q.querySelector("[data-annotation-image]");if(q instanceof HTMLElement)return q}return null}function W5($,J){let Q=Q5(J);$.style.left=Q.left,$.style.top=Q.top,$.style.width=Q.width,$.style.height=Q.height}function j1($,J,Q){let q=document.createElement("div");return q.className="ann-region",q.setAttribute("data-annotation-id",Q),q.setAttribute("data-annotation-region",J),W5(q,$),q}var c0={kind:"region",parse:($)=>{let J=a2.exec($);if(!J)return null;let Q=s2(J[1]),q=J[2],W=u0(J[3]),Y=u0(J[4]),X=u0(J[5]),G=u0(J[6]);if(Q===null||q===void 0)return null;if(W===null||Y===null||X===null||G===null)return null;if(X<1||G<1)return null;return{src:q,shape:Q,x:W,y:Y,w:X,h:G}},format:($)=>`[Region:${$.shape}] ${$.src} @${$.x},${$.y},${$.w},${$.h}`,find:($,J)=>v1($.src,J),restore:($,J,Q)=>{if(J.querySelector(`[data-annotation-id="${Q.id}"]`))return;let q=v1($.src,J);if(!q)return;q.appendChild(j1($,$.shape,Q.id))},describe:R1};var V1={kind:"text",parse:($)=>$?{text:$}:null,format:($)=>$.text,find:()=>null,restore:($,J,Q)=>{F1(J,[Q])}};var t2=[S0(c0),S0(f1),S0(V1)];import{AnnotationCtx as l8,SessionContext as c8,useAnnotationHost as p8}from"@fabrika/annotations/runtime";import{useEffect as i8,useRef as o8,useState as n8}from"react";var S={};s5(S,{void:()=>g4,util:()=>C,unknown:()=>I4,union:()=>x4,undefined:()=>k4,tuple:()=>c4,transformer:()=>e4,symbol:()=>C4,string:()=>U5,strictObject:()=>Z4,setErrorMap:()=>J4,set:()=>r4,record:()=>p4,quotelessJson:()=>e2,promise:()=>t4,preprocess:()=>Q3,pipeline:()=>W3,ostring:()=>q3,optional:()=>$3,onumber:()=>Y3,oboolean:()=>X3,objectUtil:()=>P1,object:()=>m4,number:()=>w5,nullable:()=>J3,null:()=>E4,never:()=>y4,nativeEnum:()=>s4,nan:()=>V4,map:()=>d4,makeIssue:()=>A0,literal:()=>n4,lazy:()=>o4,late:()=>R4,isValid:()=>D$,isDirty:()=>d0,isAsync:()=>t$,isAborted:()=>p0,intersection:()=>l4,instanceof:()=>j4,getParsedType:()=>L$,getErrorMap:()=>s$,function:()=>i4,enum:()=>a4,effect:()=>e4,discriminatedUnion:()=>u4,defaultErrorMap:()=>f$,datetimeRegex:()=>B5,date:()=>D4,custom:()=>M5,coerce:()=>H3,boolean:()=>z5,bigint:()=>P4,array:()=>h4,any:()=>T4,addIssueToContext:()=>N,ZodVoid:()=>f0,ZodUnknown:()=>C$,ZodUnion:()=>q0,ZodUndefined:()=>Q0,ZodType:()=>D,ZodTuple:()=>S$,ZodTransformer:()=>M$,ZodSymbol:()=>b0,ZodString:()=>H$,ZodSet:()=>d$,ZodSchema:()=>D,ZodRecord:()=>v0,ZodReadonly:()=>M0,ZodPromise:()=>r$,ZodPipeline:()=>V0,ZodParsedType:()=>z,ZodOptional:()=>B$,ZodObject:()=>m,ZodNumber:()=>k$,ZodNullable:()=>R$,ZodNull:()=>W0,ZodNever:()=>F$,ZodNativeEnum:()=>G0,ZodNaN:()=>j0,ZodMap:()=>R0,ZodLiteral:()=>H0,ZodLazy:()=>X0,ZodIssueCode:()=>M,ZodIntersection:()=>Y0,ZodFunction:()=>$0,ZodFirstPartyTypeKind:()=>f,ZodError:()=>$$,ZodEnum:()=>T$,ZodEffects:()=>M$,ZodDiscriminatedUnion:()=>r0,ZodDefault:()=>B0,ZodDate:()=>c$,ZodCatch:()=>_0,ZodBranded:()=>i0,ZodBoolean:()=>J0,ZodBigInt:()=>E$,ZodArray:()=>G$,ZodAny:()=>p$,Schema:()=>D,ParseStatus:()=>r,OK:()=>o,NEVER:()=>G3,INVALID:()=>b,EMPTY_PATH:()=>Q4,DIRTY:()=>l$,BRAND:()=>v4});var C;(function($){$.assertEqual=(W)=>{};function J(W){}$.assertIs=J;function Q(W){throw Error()}$.assertNever=Q,$.arrayToEnum=(W)=>{let Y={};for(let X of W)Y[X]=X;return Y},$.getValidEnumValues=(W)=>{let Y=$.objectKeys(W).filter((G)=>typeof W[W[G]]!=="number"),X={};for(let G of Y)X[G]=W[G];return $.objectValues(X)},$.objectValues=(W)=>{return $.objectKeys(W).map(function(Y){return W[Y]})},$.objectKeys=typeof Object.keys==="function"?(W)=>Object.keys(W):(W)=>{let Y=[];for(let X in W)if(Object.prototype.hasOwnProperty.call(W,X))Y.push(X);return Y},$.find=(W,Y)=>{for(let X of W)if(Y(X))return X;return},$.isInteger=typeof Number.isInteger==="function"?(W)=>Number.isInteger(W):(W)=>typeof W==="number"&&Number.isFinite(W)&&Math.floor(W)===W;function q(W,Y=" | "){return W.map((X)=>typeof X==="string"?`'${X}'`:X).join(Y)}$.joinValues=q,$.jsonStringifyReplacer=(W,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(C||(C={}));var P1;(function($){$.mergeShapes=(J,Q)=>{return{...J,...Q}}})(P1||(P1={}));var z=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L$=($)=>{switch(typeof $){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN($)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":if(Array.isArray($))return z.array;if($===null)return z.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return z.promise;if(typeof Map<"u"&&$ instanceof Map)return z.map;if(typeof Set<"u"&&$ instanceof Set)return z.set;if(typeof Date<"u"&&$ instanceof Date)return z.date;return z.object;default:return z.unknown}};var M=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),e2=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class $$ extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let J=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,J);else this.__proto__=J;this.name="ZodError",this.issues=$}format($){let J=$||function(W){return W.message},Q={_errors:[]},q=(W)=>{for(let Y of W.issues)if(Y.code==="invalid_union")Y.unionErrors.map(q);else if(Y.code==="invalid_return_type")q(Y.returnTypeError);else if(Y.code==="invalid_arguments")q(Y.argumentsError);else if(Y.path.length===0)Q._errors.push(J(Y));else{let X=Q,G=0;while(G<Y.path.length){let H=Y.path[G];if(G!==Y.path.length-1)X[H]=X[H]||{_errors:[]};else X[H]=X[H]||{_errors:[]},X[H]._errors.push(J(Y));X=X[H],G++}}};return q(this),Q}static assert($){if(!($ instanceof $$))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(J)=>J.message){let J={},Q=[];for(let q of this.issues)if(q.path.length>0){let W=q.path[0];J[W]=J[W]||[],J[W].push($(q))}else Q.push($(q));return{formErrors:Q,fieldErrors:J}}get formErrors(){return this.flatten()}}$$.create=($)=>{return new $$($)};var $4=($,J)=>{let Q;switch($.code){case M.invalid_type:if($.received===z.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case M.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,C.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:Q=`Unrecognized key(s) in object: ${C.joinValues($.keys,", ")}`;break;case M.invalid_union:Q="Invalid input";break;case M.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${C.joinValues($.options)}`;break;case M.invalid_enum_value:Q=`Invalid enum value. Expected ${C.joinValues($.options)}, received '${$.received}'`;break;case M.invalid_arguments:Q="Invalid function arguments";break;case M.invalid_return_type:Q="Invalid function return type";break;case M.invalid_date:Q="Invalid date";break;case M.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else C.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case M.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case M.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case M.custom:Q="Invalid input";break;case M.invalid_intersection_types:Q="Intersection results could not be merged";break;case M.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case M.not_finite:Q="Number must be finite";break;default:Q=J.defaultError,C.assertNever($)}return{message:Q}},f$=$4;var q5=f$;function J4($){q5=$}function s$(){return q5}var A0=($)=>{let{data:J,path:Q,errorMaps:q,issueData:W}=$,Y=[...Q,...W.path||[]],X={...W,path:Y};if(W.message!==void 0)return{...W,path:Y,message:W.message};let G="",H=q.filter((B)=>!!B).slice().reverse();for(let B of H)G=B(X,{data:J,defaultError:G}).message;return{...W,path:Y,message:G}},Q4=[];function N($,J){let Q=s$(),q=A0({issueData:J,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===f$?void 0:f$].filter((W)=>!!W)});$.common.issues.push(q)}class r{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,J){let Q=[];for(let q of J){if(q.status==="aborted")return b;if(q.status==="dirty")$.dirty();Q.push(q.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,J){let Q=[];for(let q of J){let W=await q.key,Y=await q.value;Q.push({key:W,value:Y})}return r.mergeObjectSync($,Q)}static mergeObjectSync($,J){let Q={};for(let q of J){let{key:W,value:Y}=q;if(W.status==="aborted")return b;if(Y.status==="aborted")return b;if(W.status==="dirty")$.dirty();if(Y.status==="dirty")$.dirty();if(W.value!=="__proto__"&&(typeof Y.value<"u"||q.alwaysSet))Q[W.value]=Y.value}return{status:$.value,value:Q}}}var b=Object.freeze({status:"aborted"}),l$=($)=>({status:"dirty",value:$}),o=($)=>({status:"valid",value:$}),p0=($)=>$.status==="aborted",d0=($)=>$.status==="dirty",D$=($)=>$.status==="valid",t$=($)=>typeof Promise<"u"&&$ instanceof Promise;var A;(function($){$.errToObj=(J)=>typeof J==="string"?{message:J}:J||{},$.toString=(J)=>typeof J==="string"?J:J?.message})(A||(A={}));class _${constructor($,J,Q,q){this._cachedPath=[],this.parent=$,this.data=J,this._path=Q,this._key=q}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Y5=($,J)=>{if(D$(J))return{success:!0,data:J.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new $$($.common.issues);return this._error=Q,this._error}}}};function V($){if(!$)return{};let{errorMap:J,invalid_type_error:Q,required_error:q,description:W}=$;if(J&&(Q||q))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(J)return{errorMap:J,description:W};return{errorMap:(X,G)=>{let{message:H}=$;if(X.code==="invalid_enum_value")return{message:H??G.defaultError};if(typeof G.data>"u")return{message:H??q??G.defaultError};if(X.code!=="invalid_type")return{message:G.defaultError};return{message:H??Q??G.defaultError}},description:W}}class D{get description(){return this._def.description}_getType($){return L$($.data)}_getOrReturnCtx($,J){return J||{common:$.parent.common,data:$.data,parsedType:L$($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new r,ctx:{common:$.parent.common,data:$.data,parsedType:L$($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let J=this._parse($);if(t$(J))throw Error("Synchronous parse encountered promise.");return J}_parseAsync($){let J=this._parse($);return Promise.resolve(J)}parse($,J){let Q=this.safeParse($,J);if(Q.success)return Q.data;throw Q.error}safeParse($,J){let Q={common:{issues:[],async:J?.async??!1,contextualErrorMap:J?.errorMap},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:L$($)},q=this._parseSync({data:$,path:Q.path,parent:Q});return Y5(Q,q)}"~validate"($){let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:L$($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:J});return D$(Q)?{value:Q.value}:{issues:J.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((Q)=>D$(Q)?{value:Q.value}:{issues:J.common.issues})}async parseAsync($,J){let Q=await this.safeParseAsync($,J);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,J){let Q={common:{issues:[],contextualErrorMap:J?.errorMap,async:!0},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:L$($)},q=this._parse({data:$,path:Q.path,parent:Q}),W=await(t$(q)?q:Promise.resolve(q));return Y5(Q,W)}refine($,J){let Q=(q)=>{if(typeof J==="string"||typeof J>"u")return{message:J};else if(typeof J==="function")return J(q);else return J};return this._refinement((q,W)=>{let Y=$(q),X=()=>W.addIssue({code:M.custom,...Q(q)});if(typeof Promise<"u"&&Y instanceof Promise)return Y.then((G)=>{if(!G)return X(),!1;else return!0});if(!Y)return X(),!1;else return!0})}refinement($,J){return this._refinement((Q,q)=>{if(!$(Q))return q.addIssue(typeof J==="function"?J(Q,q):J),!1;else return!0})}_refinement($){return new M$({schema:this,typeName:f.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(J)=>this["~validate"](J)}}optional(){return B$.create(this,this._def)}nullable(){return R$.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return G$.create(this)}promise(){return r$.create(this,this._def)}or($){return q0.create([this,$],this._def)}and($){return Y0.create(this,$,this._def)}transform($){return new M$({...V(this._def),schema:this,typeName:f.ZodEffects,effect:{type:"transform",transform:$}})}default($){let J=typeof $==="function"?$:()=>$;return new B0({...V(this._def),innerType:this,defaultValue:J,typeName:f.ZodDefault})}brand(){return new i0({typeName:f.ZodBranded,type:this,...V(this._def)})}catch($){let J=typeof $==="function"?$:()=>$;return new _0({...V(this._def),innerType:this,catchValue:J,typeName:f.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return V0.create(this,$)}readonly(){return M0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var W4=/^c[^\s-]{8,}$/i,q4=/^[0-9a-z]+$/,Y4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,X4=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,H4=/^[a-z0-9_-]{21}$/i,G4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,B4=/^[-+]?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)?)??$/,_4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,M4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",D1,U4=/^(?:(?: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])$/,w4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,z4=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,N4=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,K4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,O4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,H5="((\\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])))",L4=new RegExp(`^${H5}$`);function G5($){let J="[0-5]\\d";if($.precision)J=`${J}\\.\\d{${$.precision}}`;else if($.precision==null)J=`${J}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${J})${Q}`}function F4($){return new RegExp(`^${G5($)}$`)}function B5($){let J=`${H5}T${G5($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return J=`${J}(${Q.join("|")})`,new RegExp(`^${J}$`)}function S4($,J){if((J==="v4"||!J)&&U4.test($))return!0;if((J==="v6"||!J)&&z4.test($))return!0;return!1}function A4($,J){if(!G4.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let q=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),W=JSON.parse(atob(q));if(typeof W!=="object"||W===null)return!1;if("typ"in W&&W?.typ!=="JWT")return!1;if(!W.alg)return!1;if(J&&W.alg!==J)return!1;return!0}catch{return!1}}function b4($,J){if((J==="v4"||!J)&&w4.test($))return!0;if((J==="v6"||!J)&&N4.test($))return!0;return!1}class H$ extends D{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==z.string){let W=this._getOrReturnCtx($);return N(W,{code:M.invalid_type,expected:z.string,received:W.parsedType}),b}let Q=new r,q=void 0;for(let W of this._def.checks)if(W.kind==="min"){if($.data.length<W.value)q=this._getOrReturnCtx($,q),N(q,{code:M.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),Q.dirty()}else if(W.kind==="max"){if($.data.length>W.value)q=this._getOrReturnCtx($,q),N(q,{code:M.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),Q.dirty()}else if(W.kind==="length"){let Y=$.data.length>W.value,X=$.data.length<W.value;if(Y||X){if(q=this._getOrReturnCtx($,q),Y)N(q,{code:M.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});else if(X)N(q,{code:M.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});Q.dirty()}}else if(W.kind==="email"){if(!_4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"email",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="emoji"){if(!D1)D1=new RegExp(M4,"u");if(!D1.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"emoji",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="uuid"){if(!X4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"uuid",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="nanoid"){if(!H4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"nanoid",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="cuid"){if(!W4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"cuid",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="cuid2"){if(!q4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"cuid2",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="ulid"){if(!Y4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"ulid",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="url")try{new URL($.data)}catch{q=this._getOrReturnCtx($,q),N(q,{validation:"url",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="regex"){if(W.regex.lastIndex=0,!W.regex.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"regex",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="trim")$.data=$.data.trim();else if(W.kind==="includes"){if(!$.data.includes(W.value,W.position))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:{includes:W.value,position:W.position},message:W.message}),Q.dirty()}else if(W.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(W.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(W.kind==="startsWith"){if(!$.data.startsWith(W.value))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:{startsWith:W.value},message:W.message}),Q.dirty()}else if(W.kind==="endsWith"){if(!$.data.endsWith(W.value))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:{endsWith:W.value},message:W.message}),Q.dirty()}else if(W.kind==="datetime"){if(!B5(W).test($.data))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:"datetime",message:W.message}),Q.dirty()}else if(W.kind==="date"){if(!L4.test($.data))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:"date",message:W.message}),Q.dirty()}else if(W.kind==="time"){if(!F4(W).test($.data))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:"time",message:W.message}),Q.dirty()}else if(W.kind==="duration"){if(!B4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"duration",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="ip"){if(!S4($.data,W.version))q=this._getOrReturnCtx($,q),N(q,{validation:"ip",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="jwt"){if(!A4($.data,W.alg))q=this._getOrReturnCtx($,q),N(q,{validation:"jwt",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="cidr"){if(!b4($.data,W.version))q=this._getOrReturnCtx($,q),N(q,{validation:"cidr",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="base64"){if(!K4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"base64",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="base64url"){if(!O4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"base64url",code:M.invalid_string,message:W.message}),Q.dirty()}else C.assertNever(W);return{status:Q.value,value:$.data}}_regex($,J,Q){return this.refinement((q)=>$.test(q),{validation:J,code:M.invalid_string,...A.errToObj(Q)})}_addCheck($){return new H$({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...A.errToObj($)})}url($){return this._addCheck({kind:"url",...A.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...A.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...A.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...A.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...A.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...A.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...A.errToObj($)})}base64($){return this._addCheck({kind:"base64",...A.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...A.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...A.errToObj($)})}ip($){return this._addCheck({kind:"ip",...A.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...A.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...A.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...A.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...A.errToObj($)})}regex($,J){return this._addCheck({kind:"regex",regex:$,...A.errToObj(J)})}includes($,J){return this._addCheck({kind:"includes",value:$,position:J?.position,...A.errToObj(J?.message)})}startsWith($,J){return this._addCheck({kind:"startsWith",value:$,...A.errToObj(J)})}endsWith($,J){return this._addCheck({kind:"endsWith",value:$,...A.errToObj(J)})}min($,J){return this._addCheck({kind:"min",value:$,...A.errToObj(J)})}max($,J){return this._addCheck({kind:"max",value:$,...A.errToObj(J)})}length($,J){return this._addCheck({kind:"length",value:$,...A.errToObj(J)})}nonempty($){return this.min(1,A.errToObj($))}trim(){return new H$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new H$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new H$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxLength(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}H$.create=($)=>{return new H$({checks:[],typeName:f.ZodString,coerce:$?.coerce??!1,...V($)})};function f4($,J){let Q=($.toString().split(".")[1]||"").length,q=(J.toString().split(".")[1]||"").length,W=Q>q?Q:q,Y=Number.parseInt($.toFixed(W).replace(".","")),X=Number.parseInt(J.toFixed(W).replace(".",""));return Y%X/10**W}class k$ extends D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==z.number){let W=this._getOrReturnCtx($);return N(W,{code:M.invalid_type,expected:z.number,received:W.parsedType}),b}let Q=void 0,q=new r;for(let W of this._def.checks)if(W.kind==="int"){if(!C.isInteger($.data))Q=this._getOrReturnCtx($,Q),N(Q,{code:M.invalid_type,expected:"integer",received:"float",message:W.message}),q.dirty()}else if(W.kind==="min"){if(W.inclusive?$.data<W.value:$.data<=W.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.too_small,minimum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),q.dirty()}else if(W.kind==="max"){if(W.inclusive?$.data>W.value:$.data>=W.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.too_big,maximum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),q.dirty()}else if(W.kind==="multipleOf"){if(f4($.data,W.value)!==0)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.not_multiple_of,multipleOf:W.value,message:W.message}),q.dirty()}else if(W.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),N(Q,{code:M.not_finite,message:W.message}),q.dirty()}else C.assertNever(W);return{status:q.value,value:$.data}}gte($,J){return this.setLimit("min",$,!0,A.toString(J))}gt($,J){return this.setLimit("min",$,!1,A.toString(J))}lte($,J){return this.setLimit("max",$,!0,A.toString(J))}lt($,J){return this.setLimit("max",$,!1,A.toString(J))}setLimit($,J,Q,q){return new k$({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:A.toString(q)}]})}_addCheck($){return new k$({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:A.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:A.toString(J)})}finite($){return this._addCheck({kind:"finite",message:A.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString($)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&C.isInteger($.value))}get isFinite(){let $=null,J=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(J)&&Number.isFinite($)}}k$.create=($)=>{return new k$({checks:[],typeName:f.ZodNumber,coerce:$?.coerce||!1,...V($)})};class E$ extends D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==z.bigint)return this._getInvalidInput($);let Q=void 0,q=new r;for(let W of this._def.checks)if(W.kind==="min"){if(W.inclusive?$.data<W.value:$.data<=W.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.too_small,type:"bigint",minimum:W.value,inclusive:W.inclusive,message:W.message}),q.dirty()}else if(W.kind==="max"){if(W.inclusive?$.data>W.value:$.data>=W.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.too_big,type:"bigint",maximum:W.value,inclusive:W.inclusive,message:W.message}),q.dirty()}else if(W.kind==="multipleOf"){if($.data%W.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),N(Q,{code:M.not_multiple_of,multipleOf:W.value,message:W.message}),q.dirty()}else C.assertNever(W);return{status:q.value,value:$.data}}_getInvalidInput($){let J=this._getOrReturnCtx($);return N(J,{code:M.invalid_type,expected:z.bigint,received:J.parsedType}),b}gte($,J){return this.setLimit("min",$,!0,A.toString(J))}gt($,J){return this.setLimit("min",$,!1,A.toString(J))}lte($,J){return this.setLimit("max",$,!0,A.toString(J))}lt($,J){return this.setLimit("max",$,!1,A.toString(J))}setLimit($,J,Q,q){return new E$({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:A.toString(q)}]})}_addCheck($){return new E$({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:A.toString(J)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}E$.create=($)=>{return new E$({checks:[],typeName:f.ZodBigInt,coerce:$?.coerce??!1,...V($)})};class J0 extends D{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==z.boolean){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.boolean,received:Q.parsedType}),b}return o($.data)}}J0.create=($)=>{return new J0({typeName:f.ZodBoolean,coerce:$?.coerce||!1,...V($)})};class c$ extends D{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==z.date){let W=this._getOrReturnCtx($);return N(W,{code:M.invalid_type,expected:z.date,received:W.parsedType}),b}if(Number.isNaN($.data.getTime())){let W=this._getOrReturnCtx($);return N(W,{code:M.invalid_date}),b}let Q=new r,q=void 0;for(let W of this._def.checks)if(W.kind==="min"){if($.data.getTime()<W.value)q=this._getOrReturnCtx($,q),N(q,{code:M.too_small,message:W.message,inclusive:!0,exact:!1,minimum:W.value,type:"date"}),Q.dirty()}else if(W.kind==="max"){if($.data.getTime()>W.value)q=this._getOrReturnCtx($,q),N(q,{code:M.too_big,message:W.message,inclusive:!0,exact:!1,maximum:W.value,type:"date"}),Q.dirty()}else C.assertNever(W);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new c$({...this._def,checks:[...this._def.checks,$]})}min($,J){return this._addCheck({kind:"min",value:$.getTime(),message:A.toString(J)})}max($,J){return this._addCheck({kind:"max",value:$.getTime(),message:A.toString(J)})}get minDate(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $!=null?new Date($):null}}c$.create=($)=>{return new c$({checks:[],coerce:$?.coerce||!1,typeName:f.ZodDate,...V($)})};class b0 extends D{_parse($){if(this._getType($)!==z.symbol){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.symbol,received:Q.parsedType}),b}return o($.data)}}b0.create=($)=>{return new b0({typeName:f.ZodSymbol,...V($)})};class Q0 extends D{_parse($){if(this._getType($)!==z.undefined){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.undefined,received:Q.parsedType}),b}return o($.data)}}Q0.create=($)=>{return new Q0({typeName:f.ZodUndefined,...V($)})};class W0 extends D{_parse($){if(this._getType($)!==z.null){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.null,received:Q.parsedType}),b}return o($.data)}}W0.create=($)=>{return new W0({typeName:f.ZodNull,...V($)})};class p$ extends D{constructor(){super(...arguments);this._any=!0}_parse($){return o($.data)}}p$.create=($)=>{return new p$({typeName:f.ZodAny,...V($)})};class C$ extends D{constructor(){super(...arguments);this._unknown=!0}_parse($){return o($.data)}}C$.create=($)=>{return new C$({typeName:f.ZodUnknown,...V($)})};class F$ extends D{_parse($){let J=this._getOrReturnCtx($);return N(J,{code:M.invalid_type,expected:z.never,received:J.parsedType}),b}}F$.create=($)=>{return new F$({typeName:f.ZodNever,...V($)})};class f0 extends D{_parse($){if(this._getType($)!==z.undefined){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.void,received:Q.parsedType}),b}return o($.data)}}f0.create=($)=>{return new f0({typeName:f.ZodVoid,...V($)})};class G$ extends D{_parse($){let{ctx:J,status:Q}=this._processInputParams($),q=this._def;if(J.parsedType!==z.array)return N(J,{code:M.invalid_type,expected:z.array,received:J.parsedType}),b;if(q.exactLength!==null){let Y=J.data.length>q.exactLength.value,X=J.data.length<q.exactLength.value;if(Y||X)N(J,{code:Y?M.too_big:M.too_small,minimum:X?q.exactLength.value:void 0,maximum:Y?q.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:q.exactLength.message}),Q.dirty()}if(q.minLength!==null){if(J.data.length<q.minLength.value)N(J,{code:M.too_small,minimum:q.minLength.value,type:"array",inclusive:!0,exact:!1,message:q.minLength.message}),Q.dirty()}if(q.maxLength!==null){if(J.data.length>q.maxLength.value)N(J,{code:M.too_big,maximum:q.maxLength.value,type:"array",inclusive:!0,exact:!1,message:q.maxLength.message}),Q.dirty()}if(J.common.async)return Promise.all([...J.data].map((Y,X)=>{return q.type._parseAsync(new _$(J,Y,J.path,X))})).then((Y)=>{return r.mergeArray(Q,Y)});let W=[...J.data].map((Y,X)=>{return q.type._parseSync(new _$(J,Y,J.path,X))});return r.mergeArray(Q,W)}get element(){return this._def.type}min($,J){return new G$({...this._def,minLength:{value:$,message:A.toString(J)}})}max($,J){return new G$({...this._def,maxLength:{value:$,message:A.toString(J)}})}length($,J){return new G$({...this._def,exactLength:{value:$,message:A.toString(J)}})}nonempty($){return this.min(1,$)}}G$.create=($,J)=>{return new G$({type:$,minLength:null,maxLength:null,exactLength:null,typeName:f.ZodArray,...V(J)})};function e$($){if($ instanceof m){let J={};for(let Q in $.shape){let q=$.shape[Q];J[Q]=B$.create(e$(q))}return new m({...$._def,shape:()=>J})}else if($ instanceof G$)return new G$({...$._def,type:e$($.element)});else if($ instanceof B$)return B$.create(e$($.unwrap()));else if($ instanceof R$)return R$.create(e$($.unwrap()));else if($ instanceof S$)return S$.create($.items.map((J)=>e$(J)));else return $}class m extends D{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),J=C.objectKeys($);return this._cached={shape:$,keys:J},this._cached}_parse($){if(this._getType($)!==z.object){let H=this._getOrReturnCtx($);return N(H,{code:M.invalid_type,expected:z.object,received:H.parsedType}),b}let{status:Q,ctx:q}=this._processInputParams($),{shape:W,keys:Y}=this._getCached(),X=[];if(!(this._def.catchall instanceof F$&&this._def.unknownKeys==="strip")){for(let H in q.data)if(!Y.includes(H))X.push(H)}let G=[];for(let H of Y){let B=W[H],_=q.data[H];G.push({key:{status:"valid",value:H},value:B._parse(new _$(q,_,q.path,H)),alwaysSet:H in q.data})}if(this._def.catchall instanceof F$){let H=this._def.unknownKeys;if(H==="passthrough")for(let B of X)G.push({key:{status:"valid",value:B},value:{status:"valid",value:q.data[B]}});else if(H==="strict"){if(X.length>0)N(q,{code:M.unrecognized_keys,keys:X}),Q.dirty()}else if(H==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let H=this._def.catchall;for(let B of X){let _=q.data[B];G.push({key:{status:"valid",value:B},value:H._parse(new _$(q,_,q.path,B)),alwaysSet:B in q.data})}}if(q.common.async)return Promise.resolve().then(async()=>{let H=[];for(let B of G){let _=await B.key,w=await B.value;H.push({key:_,value:w,alwaysSet:B.alwaysSet})}return H}).then((H)=>{return r.mergeObjectSync(Q,H)});else return r.mergeObjectSync(Q,G)}get shape(){return this._def.shape()}strict($){return A.errToObj,new m({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(J,Q)=>{let q=this._def.errorMap?.(J,Q).message??Q.defaultError;if(J.code==="unrecognized_keys")return{message:A.errToObj($).message??q};return{message:q}}}:{}})}strip(){return new m({...this._def,unknownKeys:"strip"})}passthrough(){return new m({...this._def,unknownKeys:"passthrough"})}extend($){return new m({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new m({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:f.ZodObject})}setKey($,J){return this.augment({[$]:J})}catchall($){return new m({...this._def,catchall:$})}pick($){let J={};for(let Q of C.objectKeys($))if($[Q]&&this.shape[Q])J[Q]=this.shape[Q];return new m({...this._def,shape:()=>J})}omit($){let J={};for(let Q of C.objectKeys(this.shape))if(!$[Q])J[Q]=this.shape[Q];return new m({...this._def,shape:()=>J})}deepPartial(){return e$(this)}partial($){let J={};for(let Q of C.objectKeys(this.shape)){let q=this.shape[Q];if($&&!$[Q])J[Q]=q;else J[Q]=q.optional()}return new m({...this._def,shape:()=>J})}required($){let J={};for(let Q of C.objectKeys(this.shape))if($&&!$[Q])J[Q]=this.shape[Q];else{let W=this.shape[Q];while(W instanceof B$)W=W._def.innerType;J[Q]=W}return new m({...this._def,shape:()=>J})}keyof(){return _5(C.objectKeys(this.shape))}}m.create=($,J)=>{return new m({shape:()=>$,unknownKeys:"strip",catchall:F$.create(),typeName:f.ZodObject,...V(J)})};m.strictCreate=($,J)=>{return new m({shape:()=>$,unknownKeys:"strict",catchall:F$.create(),typeName:f.ZodObject,...V(J)})};m.lazycreate=($,J)=>{return new m({shape:$,unknownKeys:"strip",catchall:F$.create(),typeName:f.ZodObject,...V(J)})};class q0 extends D{_parse($){let{ctx:J}=this._processInputParams($),Q=this._def.options;function q(W){for(let X of W)if(X.result.status==="valid")return X.result;for(let X of W)if(X.result.status==="dirty")return J.common.issues.push(...X.ctx.common.issues),X.result;let Y=W.map((X)=>new $$(X.ctx.common.issues));return N(J,{code:M.invalid_union,unionErrors:Y}),b}if(J.common.async)return Promise.all(Q.map(async(W)=>{let Y={...J,common:{...J.common,issues:[]},parent:null};return{result:await W._parseAsync({data:J.data,path:J.path,parent:Y}),ctx:Y}})).then(q);else{let W=void 0,Y=[];for(let G of Q){let H={...J,common:{...J.common,issues:[]},parent:null},B=G._parseSync({data:J.data,path:J.path,parent:H});if(B.status==="valid")return B;else if(B.status==="dirty"&&!W)W={result:B,ctx:H};if(H.common.issues.length)Y.push(H.common.issues)}if(W)return J.common.issues.push(...W.ctx.common.issues),W.result;let X=Y.map((G)=>new $$(G));return N(J,{code:M.invalid_union,unionErrors:X}),b}}get options(){return this._def.options}}q0.create=($,J)=>{return new q0({options:$,typeName:f.ZodUnion,...V(J)})};var v$=($)=>{if($ instanceof X0)return v$($.schema);else if($ instanceof M$)return v$($.innerType());else if($ instanceof H0)return[$.value];else if($ instanceof T$)return $.options;else if($ instanceof G0)return C.objectValues($.enum);else if($ instanceof B0)return v$($._def.innerType);else if($ instanceof Q0)return[void 0];else if($ instanceof W0)return[null];else if($ instanceof B$)return[void 0,...v$($.unwrap())];else if($ instanceof R$)return[null,...v$($.unwrap())];else if($ instanceof i0)return v$($.unwrap());else if($ instanceof M0)return v$($.unwrap());else if($ instanceof _0)return v$($._def.innerType);else return[]};class r0 extends D{_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==z.object)return N(J,{code:M.invalid_type,expected:z.object,received:J.parsedType}),b;let Q=this.discriminator,q=J.data[Q],W=this.optionsMap.get(q);if(!W)return N(J,{code:M.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),b;if(J.common.async)return W._parseAsync({data:J.data,path:J.path,parent:J});else return W._parseSync({data:J.data,path:J.path,parent:J})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,J,Q){let q=new Map;for(let W of J){let Y=v$(W.shape[$]);if(!Y.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let X of Y){if(q.has(X))throw Error(`Discriminator property ${String($)} has duplicate value ${String(X)}`);q.set(X,W)}}return new r0({typeName:f.ZodDiscriminatedUnion,discriminator:$,options:J,optionsMap:q,...V(Q)})}}function C1($,J){let Q=L$($),q=L$(J);if($===J)return{valid:!0,data:$};else if(Q===z.object&&q===z.object){let W=C.objectKeys(J),Y=C.objectKeys($).filter((G)=>W.indexOf(G)!==-1),X={...$,...J};for(let G of Y){let H=C1($[G],J[G]);if(!H.valid)return{valid:!1};X[G]=H.data}return{valid:!0,data:X}}else if(Q===z.array&&q===z.array){if($.length!==J.length)return{valid:!1};let W=[];for(let Y=0;Y<$.length;Y++){let X=$[Y],G=J[Y],H=C1(X,G);if(!H.valid)return{valid:!1};W.push(H.data)}return{valid:!0,data:W}}else if(Q===z.date&&q===z.date&&+$===+J)return{valid:!0,data:$};else return{valid:!1}}class Y0 extends D{_parse($){let{status:J,ctx:Q}=this._processInputParams($),q=(W,Y)=>{if(p0(W)||p0(Y))return b;let X=C1(W.value,Y.value);if(!X.valid)return N(Q,{code:M.invalid_intersection_types}),b;if(d0(W)||d0(Y))J.dirty();return{status:J.value,value:X.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([W,Y])=>q(W,Y));else return q(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}Y0.create=($,J,Q)=>{return new Y0({left:$,right:J,typeName:f.ZodIntersection,...V(Q)})};class S$ extends D{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==z.array)return N(Q,{code:M.invalid_type,expected:z.array,received:Q.parsedType}),b;if(Q.data.length<this._def.items.length)return N(Q,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;if(!this._def.rest&&Q.data.length>this._def.items.length)N(Q,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J.dirty();let W=[...Q.data].map((Y,X)=>{let G=this._def.items[X]||this._def.rest;if(!G)return null;return G._parse(new _$(Q,Y,Q.path,X))}).filter((Y)=>!!Y);if(Q.common.async)return Promise.all(W).then((Y)=>{return r.mergeArray(J,Y)});else return r.mergeArray(J,W)}get items(){return this._def.items}rest($){return new S$({...this._def,rest:$})}}S$.create=($,J)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new S$({items:$,typeName:f.ZodTuple,rest:null,...V(J)})};class v0 extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==z.object)return N(Q,{code:M.invalid_type,expected:z.object,received:Q.parsedType}),b;let q=[],W=this._def.keyType,Y=this._def.valueType;for(let X in Q.data)q.push({key:W._parse(new _$(Q,X,Q.path,X)),value:Y._parse(new _$(Q,Q.data[X],Q.path,X)),alwaysSet:X in Q.data});if(Q.common.async)return r.mergeObjectAsync(J,q);else return r.mergeObjectSync(J,q)}get element(){return this._def.valueType}static create($,J,Q){if(J instanceof D)return new v0({keyType:$,valueType:J,typeName:f.ZodRecord,...V(Q)});return new v0({keyType:H$.create(),valueType:$,typeName:f.ZodRecord,...V(J)})}}class R0 extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==z.map)return N(Q,{code:M.invalid_type,expected:z.map,received:Q.parsedType}),b;let q=this._def.keyType,W=this._def.valueType,Y=[...Q.data.entries()].map(([X,G],H)=>{return{key:q._parse(new _$(Q,X,Q.path,[H,"key"])),value:W._parse(new _$(Q,G,Q.path,[H,"value"]))}});if(Q.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let G of Y){let H=await G.key,B=await G.value;if(H.status==="aborted"||B.status==="aborted")return b;if(H.status==="dirty"||B.status==="dirty")J.dirty();X.set(H.value,B.value)}return{status:J.value,value:X}})}else{let X=new Map;for(let G of Y){let{key:H,value:B}=G;if(H.status==="aborted"||B.status==="aborted")return b;if(H.status==="dirty"||B.status==="dirty")J.dirty();X.set(H.value,B.value)}return{status:J.value,value:X}}}}R0.create=($,J,Q)=>{return new R0({valueType:J,keyType:$,typeName:f.ZodMap,...V(Q)})};class d$ extends D{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==z.set)return N(Q,{code:M.invalid_type,expected:z.set,received:Q.parsedType}),b;let q=this._def;if(q.minSize!==null){if(Q.data.size<q.minSize.value)N(Q,{code:M.too_small,minimum:q.minSize.value,type:"set",inclusive:!0,exact:!1,message:q.minSize.message}),J.dirty()}if(q.maxSize!==null){if(Q.data.size>q.maxSize.value)N(Q,{code:M.too_big,maximum:q.maxSize.value,type:"set",inclusive:!0,exact:!1,message:q.maxSize.message}),J.dirty()}let W=this._def.valueType;function Y(G){let H=new Set;for(let B of G){if(B.status==="aborted")return b;if(B.status==="dirty")J.dirty();H.add(B.value)}return{status:J.value,value:H}}let X=[...Q.data.values()].map((G,H)=>W._parse(new _$(Q,G,Q.path,H)));if(Q.common.async)return Promise.all(X).then((G)=>Y(G));else return Y(X)}min($,J){return new d$({...this._def,minSize:{value:$,message:A.toString(J)}})}max($,J){return new d$({...this._def,maxSize:{value:$,message:A.toString(J)}})}size($,J){return this.min($,J).max($,J)}nonempty($){return this.min(1,$)}}d$.create=($,J)=>{return new d$({valueType:$,minSize:null,maxSize:null,typeName:f.ZodSet,...V(J)})};class $0 extends D{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==z.function)return N(J,{code:M.invalid_type,expected:z.function,received:J.parsedType}),b;function Q(X,G){return A0({data:X,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,s$(),f$].filter((H)=>!!H),issueData:{code:M.invalid_arguments,argumentsError:G}})}function q(X,G){return A0({data:X,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,s$(),f$].filter((H)=>!!H),issueData:{code:M.invalid_return_type,returnTypeError:G}})}let W={errorMap:J.common.contextualErrorMap},Y=J.data;if(this._def.returns instanceof r$){let X=this;return o(async function(...G){let H=new $$([]),B=await X._def.args.parseAsync(G,W).catch((L)=>{throw H.addIssue(Q(G,L)),H}),_=await Reflect.apply(Y,this,B);return await X._def.returns._def.type.parseAsync(_,W).catch((L)=>{throw H.addIssue(q(_,L)),H})})}else{let X=this;return o(function(...G){let H=X._def.args.safeParse(G,W);if(!H.success)throw new $$([Q(G,H.error)]);let B=Reflect.apply(Y,this,H.data),_=X._def.returns.safeParse(B,W);if(!_.success)throw new $$([q(B,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new $0({...this._def,args:S$.create($).rest(C$.create())})}returns($){return new $0({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,J,Q){return new $0({args:$?$:S$.create([]).rest(C$.create()),returns:J||C$.create(),typeName:f.ZodFunction,...V(Q)})}}class X0 extends D{get schema(){return this._def.getter()}_parse($){let{ctx:J}=this._processInputParams($);return this._def.getter()._parse({data:J.data,path:J.path,parent:J})}}X0.create=($,J)=>{return new X0({getter:$,typeName:f.ZodLazy,...V(J)})};class H0 extends D{_parse($){if($.data!==this._def.value){let J=this._getOrReturnCtx($);return N(J,{received:J.data,code:M.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:$.data}}get value(){return this._def.value}}H0.create=($,J)=>{return new H0({value:$,typeName:f.ZodLiteral,...V(J)})};function _5($,J){return new T$({values:$,typeName:f.ZodEnum,...V(J)})}class T$ extends D{_parse($){if(typeof $.data!=="string"){let J=this._getOrReturnCtx($),Q=this._def.values;return N(J,{expected:C.joinValues(Q),received:J.parsedType,code:M.invalid_type}),b}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let J=this._getOrReturnCtx($),Q=this._def.values;return N(J,{received:J.data,code:M.invalid_enum_value,options:Q}),b}return o($.data)}get options(){return this._def.values}get enum(){let $={};for(let J of this._def.values)$[J]=J;return $}get Values(){let $={};for(let J of this._def.values)$[J]=J;return $}get Enum(){let $={};for(let J of this._def.values)$[J]=J;return $}extract($,J=this._def){return T$.create($,{...this._def,...J})}exclude($,J=this._def){return T$.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...J})}}T$.create=_5;class G0 extends D{_parse($){let J=C.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==z.string&&Q.parsedType!==z.number){let q=C.objectValues(J);return N(Q,{expected:C.joinValues(q),received:Q.parsedType,code:M.invalid_type}),b}if(!this._cache)this._cache=new Set(C.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let q=C.objectValues(J);return N(Q,{received:Q.data,code:M.invalid_enum_value,options:q}),b}return o($.data)}get enum(){return this._def.values}}G0.create=($,J)=>{return new G0({values:$,typeName:f.ZodNativeEnum,...V(J)})};class r$ extends D{unwrap(){return this._def.type}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==z.promise&&J.common.async===!1)return N(J,{code:M.invalid_type,expected:z.promise,received:J.parsedType}),b;let Q=J.parsedType===z.promise?J.data:Promise.resolve(J.data);return o(Q.then((q)=>{return this._def.type.parseAsync(q,{path:J.path,errorMap:J.common.contextualErrorMap})}))}}r$.create=($,J)=>{return new r$({type:$,typeName:f.ZodPromise,...V(J)})};class M$ extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===f.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:J,ctx:Q}=this._processInputParams($),q=this._def.effect||null,W={addIssue:(Y)=>{if(N(Q,Y),Y.fatal)J.abort();else J.dirty()},get path(){return Q.path}};if(W.addIssue=W.addIssue.bind(W),q.type==="preprocess"){let Y=q.transform(Q.data,W);if(Q.common.async)return Promise.resolve(Y).then(async(X)=>{if(J.value==="aborted")return b;let G=await this._def.schema._parseAsync({data:X,path:Q.path,parent:Q});if(G.status==="aborted")return b;if(G.status==="dirty")return l$(G.value);if(J.value==="dirty")return l$(G.value);return G});else{if(J.value==="aborted")return b;let X=this._def.schema._parseSync({data:Y,path:Q.path,parent:Q});if(X.status==="aborted")return b;if(X.status==="dirty")return l$(X.value);if(J.value==="dirty")return l$(X.value);return X}}if(q.type==="refinement"){let Y=(X)=>{let G=q.refinement(X,W);if(Q.common.async)return Promise.resolve(G);if(G instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(Q.common.async===!1){let X=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(X.status==="aborted")return b;if(X.status==="dirty")J.dirty();return Y(X.value),{status:J.value,value:X.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((X)=>{if(X.status==="aborted")return b;if(X.status==="dirty")J.dirty();return Y(X.value).then(()=>{return{status:J.value,value:X.value}})})}if(q.type==="transform")if(Q.common.async===!1){let Y=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!D$(Y))return b;let X=q.transform(Y.value,W);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:J.value,value:X}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((Y)=>{if(!D$(Y))return b;return Promise.resolve(q.transform(Y.value,W)).then((X)=>({status:J.value,value:X}))});C.assertNever(q)}}M$.create=($,J,Q)=>{return new M$({schema:$,typeName:f.ZodEffects,effect:J,...V(Q)})};M$.createWithPreprocess=($,J,Q)=>{return new M$({schema:J,effect:{type:"preprocess",transform:$},typeName:f.ZodEffects,...V(Q)})};class B$ extends D{_parse($){if(this._getType($)===z.undefined)return o(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}B$.create=($,J)=>{return new B$({innerType:$,typeName:f.ZodOptional,...V(J)})};class R$ extends D{_parse($){if(this._getType($)===z.null)return o(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}R$.create=($,J)=>{return new R$({innerType:$,typeName:f.ZodNullable,...V(J)})};class B0 extends D{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;if(J.parsedType===z.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:J.path,parent:J})}removeDefault(){return this._def.innerType}}B0.create=($,J)=>{return new B0({innerType:$,typeName:f.ZodDefault,defaultValue:typeof J.default==="function"?J.default:()=>J.default,...V(J)})};class _0 extends D{_parse($){let{ctx:J}=this._processInputParams($),Q={...J,common:{...J.common,issues:[]}},q=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(t$(q))return q.then((W)=>{return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new $$(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:q.status==="valid"?q.value:this._def.catchValue({get error(){return new $$(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}_0.create=($,J)=>{return new _0({innerType:$,typeName:f.ZodCatch,catchValue:typeof J.catch==="function"?J.catch:()=>J.catch,...V(J)})};class j0 extends D{_parse($){if(this._getType($)!==z.nan){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.nan,received:Q.parsedType}),b}return{status:"valid",value:$.data}}}j0.create=($)=>{return new j0({typeName:f.ZodNaN,...V($)})};var v4=Symbol("zod_brand");class i0 extends D{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;return this._def.type._parse({data:Q,path:J.path,parent:J})}unwrap(){return this._def.type}}class V0 extends D{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let W=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(W.status==="aborted")return b;if(W.status==="dirty")return J.dirty(),l$(W.value);else return this._def.out._parseAsync({data:W.value,path:Q.path,parent:Q})})();else{let q=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(q.status==="aborted")return b;if(q.status==="dirty")return J.dirty(),{status:"dirty",value:q.value};else return this._def.out._parseSync({data:q.value,path:Q.path,parent:Q})}}static create($,J){return new V0({in:$,out:J,typeName:f.ZodPipeline})}}class M0 extends D{_parse($){let J=this._def.innerType._parse($),Q=(q)=>{if(D$(q))q.value=Object.freeze(q.value);return q};return t$(J)?J.then((q)=>Q(q)):Q(J)}unwrap(){return this._def.innerType}}M0.create=($,J)=>{return new M0({innerType:$,typeName:f.ZodReadonly,...V(J)})};function X5($,J){let Q=typeof $==="function"?$(J):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function M5($,J={},Q){if($)return p$.create().superRefine((q,W)=>{let Y=$(q);if(Y instanceof Promise)return Y.then((X)=>{if(!X){let G=X5(J,q),H=G.fatal??Q??!0;W.addIssue({code:"custom",...G,fatal:H})}});if(!Y){let X=X5(J,q),G=X.fatal??Q??!0;W.addIssue({code:"custom",...X,fatal:G})}return});return p$.create()}var R4={object:m.lazycreate},f;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(f||(f={}));var j4=($,J={message:`Input not instance of ${$.name}`})=>M5((Q)=>Q instanceof $,J),U5=H$.create,w5=k$.create,V4=j0.create,P4=E$.create,z5=J0.create,D4=c$.create,C4=b0.create,k4=Q0.create,E4=W0.create,T4=p$.create,I4=C$.create,y4=F$.create,g4=f0.create,h4=G$.create,m4=m.create,Z4=m.strictCreate,x4=q0.create,u4=r0.create,l4=Y0.create,c4=S$.create,p4=v0.create,d4=R0.create,r4=d$.create,i4=$0.create,o4=X0.create,n4=H0.create,a4=T$.create,s4=G0.create,t4=r$.create,e4=M$.create,$3=B$.create,J3=R$.create,Q3=M$.createWithPreprocess,W3=V0.create,q3=()=>U5().optional(),Y3=()=>w5().optional(),X3=()=>z5().optional(),H3={string:($)=>H$.create({...$,coerce:!0}),number:($)=>k$.create({...$,coerce:!0}),boolean:($)=>J0.create({...$,coerce:!0}),bigint:($)=>E$.create({...$,coerce:!0}),date:($)=>c$.create({...$,coerce:!0})};var G3=b;var B3=S.object({before:S.string(),after:S.string(),hierarchy:S.array(S.string()),lineStart:S.number().optional(),lineEnd:S.number().optional()}).passthrough(),_3=S.object({id:S.string(),name:S.string()}).passthrough(),M3=S.object({url:S.string(),mime:S.string().optional()}).passthrough(),U3=S.object({id:S.string(),snippet:S.string(),note:S.string(),createdAt:S.string(),filePath:S.string().optional(),canvasFile:S.string().optional(),context:B3.optional(),images:S.array(S.string()).optional(),attachments:S.array(M3).optional(),source:S.enum(["local","remote"]).optional(),author:_3.optional()}).passthrough(),w3=S.array(U3.optional().catch(void 0)).transform(($)=>$.filter((J)=>J!==void 0)).catch([]),k1=S.object({annotations:w3,generalNote:S.string().catch("")}).passthrough(),N5=S.object({path:S.string()}),K5=S.object({url:S.string()});import{useCallback as g8,useMemo as h8,useState as m8}from"react";function P0($){return $.uploadUrl!==null}function j$($,J){$.style.height="auto",$.style.height=(J?Math.max(J,$.scrollHeight):$.scrollHeight)+"px"}import{useAnnotations as o0}from"@fabrika/annotations/runtime";import{jsxDEV as $9}from"react/jsx-dev-runtime";import{jsxDEV as X9,Fragment as Y9}from"react/jsx-dev-runtime";import{useAnnotationHost as N3}from"@fabrika/annotations/runtime";import{useCallback as V$,useEffect as K3,useRef as T1,useState as I1}from"react";import{jsxDEV as s}from"react/jsx-dev-runtime";function O5($){if($.startsWith("/s/")||$.startsWith("http://")||$.startsWith("https://"))return $;return`/api/uploads/${$.split("/").pop()}`}async function O3($,J){let Q=$.uploadUrl;if(!Q)return null;let q=new FormData;q.append("image",J);try{let Y=await(await fetch(Q(),{method:"POST",body:q})).json();if($.isShared)return K5.parse(Y).url||null;return N5.parse(Y).path||null}catch{return null}}function n0({note:$,onNoteChange:J,images:Q,onAddImage:q,onRemoveImage:W,sessionId:Y,placeholder:X="Add your note...",autoFocus:G=!1,autoResize:H=!1,readOnly:B=!1,onKeyDown:_,onTextareaClick:w,textareaRef:L,textareaClassName:F,textareaStyle:U,minHeight:K,attachButton:O="always",openFilePickerRef:R}){let T=N3(),I=!B&&P0(T),[l,x]=I1(!1),[u,t]=I1(!1),[J$,U$]=I1(!1),h=T1(0),c=T1(null),e=T1(null),d=V$(()=>e.current?.click(),[]);if(R)R.current=d;let w$=V$((j)=>{if(c.current=j,L)L.current=j;if(j&&H)j$(j,K)},[L,H,K]);K3(()=>{if(G&&c.current){let j=c.current;if(j.focus(),j.value)j.setSelectionRange(j.value.length,j.value.length)}},[G]);let Q$=V$(async(j)=>{if(!j.type.startsWith("image/"))return;t(!0);try{let n=await O3(T,j);if(n)q(n)}finally{t(!1)}},[T,q]),g$=V$((j)=>{for(let n of j.clipboardData?.items??[])if(n.type.startsWith("image/")){j.preventDefault();let o$=n.getAsFile();if(o$)Q$(o$);return}},[Q$]),W$=V$((j)=>{if(j.preventDefault(),h.current++,h.current===1)x(!0)},[]),q$=V$((j)=>{j.preventDefault()},[]),z$=V$((j)=>{if(j.preventDefault(),h.current--,h.current===0)x(!1)},[]),N$=V$((j)=>{j.preventDefault(),h.current=0,x(!1);for(let n of j.dataTransfer?.files??[])if(n.type.startsWith("image/"))Q$(n)},[Q$]),h$=V$((j)=>{if(J(j.currentTarget.value),H)j.currentTarget.style.height="auto",j.currentTarget.style.height=(K?Math.max(K,j.currentTarget.scrollHeight):j.currentTarget.scrollHeight)+"px"},[J,H,K]),m$="w-full bg-transparent text-[13px] font-body text-text-primary resize-none focus:outline-none leading-relaxed p-0 border-none",q1={width:"100%",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",outline:"none",...H?{resize:"none",overflow:"hidden"}:{resize:"vertical"}},T0=I&&(O==="always"||O==="on-focus"&&J$);return s("div",{style:{position:"relative"},onDragEnter:I?W$:void 0,onDragOver:I?q$:void 0,onDragLeave:I?z$:void 0,onDrop:I?N$:void 0,children:[s("textarea",{ref:w$,value:$,onChange:B?void 0:h$,onPaste:I?g$:void 0,onKeyDown:_,onClick:w,onFocus:()=>U$(!0),onBlur:()=>{setTimeout(()=>U$(!1),150)},readOnly:B,placeholder:X,className:F??m$,style:U??q1,rows:H?1:void 0},void 0,!1,void 0,this),I&&s("input",{ref:e,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:(j)=>{let n=j.currentTarget.files;if(n)for(let o$ of n)Q$(o$);j.currentTarget.value=""}},void 0,!1,void 0,this),(Q.length>0||T0)&&s("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",marginTop:"6px",alignItems:"center"},children:[Q.map((j)=>s("div",{style:{position:"relative",width:"56px",height:"56px",borderRadius:"6px",overflow:"hidden",border:"1px solid var(--color-border-subtle)",flexShrink:0},children:[s("img",{src:O5(j),alt:"",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}},void 0,!1,void 0,this),!B&&s("button",{onClick:(n)=>{n.stopPropagation(),W(j)},style:{position:"absolute",top:"2px",right:"2px",width:"16px",height:"16px",borderRadius:"50%",background:"rgba(0,0,0,0.6)",color:"white",border:"none",cursor:"pointer",fontSize:"11px",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:0},title:"Remove image",children:"×"},void 0,!1,void 0,this)]},j,!0,void 0,this)),T0&&s(a0,{onClick:d},void 0,!1,void 0,this)]},void 0,!0,void 0,this),u&&s("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontFamily:"'Inter', sans-serif",marginTop:"4px"},children:"Uploading..."},void 0,!1,void 0,this),l&&s("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-highlight-bg)",opacity:0.9,border:"2px dashed var(--color-highlight-border)",borderRadius:"6px",zIndex:10,pointerEvents:"none",fontSize:"12px",fontFamily:"'Inter', sans-serif",color:"var(--color-text-secondary)"},children:"Drop image"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function a0({onClick:$,size:J=16}){return s("button",{onClick:(Q)=>{Q.stopPropagation(),$()},style:{width:`${J*2}px`,height:`${J*2}px`,borderRadius:"6px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",flexShrink:0,transition:"color 0.15s"},title:"Attach image",onMouseEnter:(Q)=>{Q.currentTarget.style.color="var(--color-text-secondary)"},onMouseLeave:(Q)=>{Q.currentTarget.style.color="var(--color-text-tertiary)"},children:s("svg",{width:J,height:J,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),s("circle",{cx:"8.5",cy:"8.5",r:"1.5"},void 0,!1,void 0,this),s("polyline",{points:"21 15 16 10 5 21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{SessionContext as K9}from"@fabrika/annotations/runtime";import{useContext as L9,useEffect as F9,useRef as S9}from"react";import{jsxDEV as j9,Fragment as V9}from"react/jsx-dev-runtime";import{SessionContext as A3,useAnnotationHost as b3}from"@fabrika/annotations/runtime";import{useCallback as s0,useContext as f3,useEffect as v3,useMemo as A5,useRef as t0,useState as U0}from"react";import{createPortal as R3}from"react-dom";function F5($){let J=/^(\d+(?:\.\d+)?)px$/.exec($.trim());return J?Number(J[1]):void 0}function S5($,J,Q=280){let W=J||document.body,Y=$.getBoundingClientRect(),X=W.getBoundingClientRect(),G=W===document.body?0:W.scrollTop,H=Y.bottom-X.top+G+8,B=Math.max(0,Math.min(Y.left-X.left,X.width-Q-12));return W.style.position="relative",{style:{position:"absolute",top:`${H}px`,left:`${B}px`},parent:W}}import{jsxDEV as i,Fragment as j3}from"react/jsx-dev-runtime";function f5({anchorEl:$,scrollContainer:J,onClose:Q,ignoreSelector:q,zIndex:W="50",padding:Y="12px",width:X="280px",children:G}){let H=t0(null),B=t0(Q);B.current=Q;let{style:_,parent:w}=S5($,J,F5(X));return v3(()=>{let L=setTimeout(()=>{let F=(U)=>{if(H.current&&!H.current.contains(U.target)){if(q&&U.target.closest?.(q))return;B.current(),document.removeEventListener("mousedown",F)}};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},0);return()=>clearTimeout(L)},[q]),R3(i("div",{ref:H,style:{..._,zIndex:W,width:X,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border-hover)",borderRadius:"8px",boxShadow:"0 4px 12px var(--color-shadow)",padding:Y,fontFamily:"'Inter', sans-serif"},children:G},void 0,!1,void 0,this),w)}var v5=[{label:"Clarity",items:["Unclear","Why?","Needs example","Missing context"]},{label:"Scope",items:["Overkill","Out of scope","Important","Risky"]},{label:"Action",items:["Simplify","Rethink","Expand on this","Skip this"]}],b5=v5.flatMap(($)=>$.items);function R5({anchorEl:$,scrollContainer:J,snippet:Q,truncateAt:q=100,header:W,initialNote:Y="",initialImages:X,onConfirm:G,onCancel:H,onDelete:B}){let _=f3(A3),w=b3(),L=P0(w),F=Y!==""||!!B,[U,K]=U0(Y),[O,R]=U0(X||[]),[T,I]=U0(null),[l,x]=U0(F),[u,t]=U0(!1),J$=t0(null),U$=t0(null),h=s0(()=>{if(U.trim()||O.length>0)G(U.trim(),O);else if(F&&B)B();else H()},[U,O,G,H,F,B]),c=s0(()=>{if(F){if(!U.trim()&&O.length===0&&B){B(),H();return}G(U,O);return}H()},[U,O,F,G,H,B]),e=!F,d=U.trim().length>0?b5.filter((v)=>v.toLowerCase().startsWith(U.trim().toLowerCase())):b5,w$=!e||l?[]:d.length===1&&d[0]?.toLowerCase()===U.trim().toLowerCase()?[]:d,Q$=new Set(w$),g$=v5.map((v)=>({label:v.label,items:v.items.filter((g)=>Q$.has(g))})).filter((v)=>v.items.length>0),W$=g$.map((v)=>v.items),q$=(v)=>W$[v]?.length??0,z$=W$.flat(),N$=A5(()=>{if(T===null)return 0;let v=0;for(let g=0;g<W$.length;g++){if(T<v+q$(g))return g;v+=q$(g)}return 0},[T,W$]),h$=A5(()=>{if(T===null)return 0;let v=0;for(let g=0;g<N$;g++)v+=q$(g);return T-v},[T,N$,W$]),m$=(v,g)=>{let p=0;for(let K$=0;K$<v;K$++)p+=q$(K$);return p+g},[q1,T0]=U0(U);if(U!==q1)T0(U),I(null),x(F);let j=s0((v)=>{K(v)},[]),n=Q.length>q?Q.slice(0,q)+"...":Q,o$=s0((v)=>{if(z$.length>0&&(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="ArrowLeft"||v.key==="ArrowRight")){if(v.preventDefault(),T===null){I(0);return}if(v.key==="ArrowDown"){let p=Math.min(h$+1,q$(N$)-1);I(m$(N$,p))}else if(v.key==="ArrowUp"){let p=Math.max(h$-1,0);I(m$(N$,p))}else if(v.key==="ArrowRight"){let p=Math.min(N$+1,W$.length-1),K$=Math.min(h$,q$(p)-1);I(m$(p,K$))}else if(v.key==="ArrowLeft"){let p=Math.max(N$-1,0),K$=Math.min(h$,q$(p)-1);I(m$(p,K$))}return}let g=T===null?void 0:z$[T];if(g!==void 0){if(v.key==="Tab"){v.preventDefault(),j(g);return}if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),G(g,O);return}}if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),h();return}if(v.key==="Escape")if(z$.length>0&&!l)x(!0);else if(F)c();else H()},[z$,T,h$,N$,W$,m$,j,G,O,h,l,F,c,H]);return i(f5,{anchorEl:$,scrollContainer:J,onClose:F?c:H,ignoreSelector:F?"[data-annotation-id]":void 0,zIndex:F?"60":"50",padding:F?"10px 12px":"12px",width:"420px",children:[!F&&(W??i("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontStyle:"italic",marginBottom:"8px",lineHeight:"1.4",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:["“",n,"”"]},void 0,!0,void 0,this)),i(n0,{note:U,onNoteChange:K,images:O,onAddImage:(v)=>R((g)=>[...g,v]),onRemoveImage:(v)=>R((g)=>g.filter((p)=>p!==v)),sessionId:_,autoFocus:!0,autoResize:F,textareaRef:J$,onKeyDown:o$,attachButton:"none",openFilePickerRef:U$,textareaStyle:F?{width:"100%",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"none",outline:"none",overflow:"hidden"}:{width:"100%",minHeight:"60px",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"vertical",outline:"none"},placeholder:"Add your note..."},void 0,!1,void 0,this),i("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:F?"6px":"8px"},children:[L&&i(a0,{onClick:()=>U$.current?.(),size:14},void 0,!1,void 0,this),i("div",{style:{flex:1}},void 0,!1,void 0,this),F?i("button",{onClick:()=>{if(B)B();H()},onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),style:{fontSize:"11px",color:u?"var(--color-accent-red)":"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"2px 0",fontFamily:"'Inter', sans-serif"},children:"Delete"},void 0,!1,void 0,this):i(j3,{children:[i("button",{onClick:H,style:{fontSize:"11px",color:"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"4px 12px",fontFamily:"'Inter', sans-serif"},children:"Cancel"},void 0,!1,void 0,this),i("button",{onClick:h,style:{fontSize:"11px",fontWeight:500,padding:"4px 12px",borderRadius:"6px",background:"var(--color-highlight-bg)",color:"var(--color-text-primary)",border:"1px solid var(--color-highlight-border)",cursor:"pointer",fontFamily:"'Inter', sans-serif"},children:"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),z$.length>0&&i("div",{style:{marginTop:"6px",borderTop:"1px solid var(--color-border-subtle)",paddingTop:"8px",display:"flex",gap:"4px"},children:g$.map((v)=>i("div",{style:{flex:1},children:[i("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--color-text-disabled)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"2px 6px",marginBottom:"2px",fontFamily:"'Inter', sans-serif"},children:v.label},void 0,!1,void 0,this),v.items.map((g)=>{let p=z$.indexOf(g);return i("div",{onMouseDown:(K$)=>{K$.preventDefault(),K$.stopPropagation(),j(g)},onMouseEnter:()=>I(p),style:{padding:"3px 6px",fontSize:"12px",borderRadius:"4px",fontFamily:"'Inter', sans-serif",color:p===T?"var(--color-text-primary)":"var(--color-text-secondary)",background:p===T?"var(--color-highlight-selected)":"transparent",cursor:"pointer"},children:[i("span",{style:{fontWeight:500},children:g.slice(0,U.trim().length)},void 0,!1,void 0,this),g.slice(U.trim().length)]},g,!0,void 0,this)})]},v.label,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function D0({anchorEl:$,scrollContainer:J,snippet:Q,truncateAt:q,header:W,onAdd:Y,onCancel:X}){return i(R5,{anchorEl:$,scrollContainer:J,snippet:Q,truncateAt:q,header:W,onConfirm:(G,H)=>Y(G,H),onCancel:X},void 0,!1,void 0,this)}import{useEffect as p9,useRef as d9,useState as r9}from"react";import{jsxDEV as t9}from"react/jsx-dev-runtime";import{useCallback as W7,useEffect as q7,useRef as Y7,useState as X7}from"react";import{jsxDEV as z7,Fragment as w7}from"react/jsx-dev-runtime";import{jsxDEV as j5}from"react/jsx-dev-runtime";function w0({note:$,onChange:J}){return j5("div",{className:"mt-1.5",children:j5("textarea",{value:$,onChange:(Q)=>J(Q.currentTarget.value),className:"w-full bg-transparent text-[12px] font-body text-text-primary resize-none focus:outline-none border-none placeholder:text-text-disabled transition-colors min-h-[20px] p-0 leading-relaxed",placeholder:"Add a note...",rows:1,onInput:(Q)=>j$(Q.currentTarget),ref:(Q)=>{if(Q)j$(Q)}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as Z}from"react/jsx-dev-runtime";function T5($){return $.map((J)=>typeof J==="string"?{value:J,label:J}:{value:J.value,label:J.label??J.value})}function g3({id:$,label:J,options:Q,required:q}){let{responses:W,setResponse:Y}=V5();P5($);let X=C5(()=>T5(Q),[Q]),G=W.get($),H=G?.value,B=G?.note||"",[_,w]=E5(!1),L=k5(null);if(!W.has($))Y($,{id:$,type:"radio",label:J,value:null,options:X.map((K)=>K.value),required:q});let F=(K)=>{Y($,{...G,value:K})};D5(()=>{let K=L.current;if(!K)return;let O=(R)=>{let I=R.target.closest("[data-md-label]")?.getAttribute("data-md-label"),l=X.find((x)=>x.label===I);if(l)F(l.value)};return K.addEventListener("kb-select",O),()=>K.removeEventListener("kb-select",O)},[X,F]);let U=G?.required&&!H;return Z("div",{ref:L,"data-md":"choice","data-md-label":J,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[Z("div",{className:"flex items-baseline gap-2 mb-2",children:[Z("span",{className:"text-[13px] font-body font-medium text-text-primary",children:J},void 0,!1,void 0,this),q&&Z("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z("div",{className:"space-y-1",children:X.map(({value:K,label:O})=>Z("label",{"data-md":"choice-option","data-md-label":O,onClick:()=>F(K),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${H===K?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[Z("span",{className:`w-4 h-4 rounded-full border-[1.5px] flex items-center justify-center flex-shrink-0 transition-all ${H===K?"border-accent-amber bg-accent-amber":"border-border-strong"}`,children:H===K&&Z("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z("span",{className:"text-[13px] font-body text-text-secondary",children:O},void 0,!1,void 0,this)]},K,!0,void 0,this))},void 0,!1,void 0,this),Z(w0,{show:_,note:B,onToggle:()=>w(!_),onChange:(K)=>Y($,{...G,note:K})},void 0,!1,void 0,this),U&&Z("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select an option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function h3({id:$,label:J,options:Q,required:q}){let{responses:W,setResponse:Y}=V5();P5($);let X=C5(()=>T5(Q),[Q]),G=W.get($),H=G?.value||[],B=G?.note||"",[_,w]=E5(!1),L=k5(null);if(!W.has($))Y($,{id:$,type:"checkbox",label:J,value:[],options:X.map((K)=>K.value),required:q});let F=(K)=>{let O=H.includes(K)?H.filter((R)=>R!==K):[...H,K];Y($,{...G,value:O})};D5(()=>{let K=L.current;if(!K)return;let O=(R)=>{let I=R.target.closest("[data-md-label]")?.getAttribute("data-md-label"),l=X.find((x)=>x.label===I);if(l)F(l.value)};return K.addEventListener("kb-select",O),()=>K.removeEventListener("kb-select",O)},[X,F]);let U=G?.required&&H.length===0;return Z("div",{ref:L,"data-md":"multichoice","data-md-label":J,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[Z("div",{className:"flex items-baseline gap-2 mb-2",children:[Z("span",{className:"text-[13px] font-body font-medium text-text-primary",children:J},void 0,!1,void 0,this),q&&Z("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Z("div",{className:"space-y-1",children:X.map(({value:K,label:O})=>{let R=H.includes(K);return Z("label",{"data-md":"multichoice-option","data-md-label":O,onClick:()=>F(K),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${R?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[Z("span",{className:`w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all ${R?"bg-accent-amber":"border-[1.5px] border-border-strong"}`,children:R&&Z("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:Z("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Z("span",{className:"text-[13px] font-body text-text-secondary",children:O},void 0,!1,void 0,this)]},K,!0,void 0,this)})},void 0,!1,void 0,this),Z(w0,{show:_,note:B,onToggle:()=>w(!_),onChange:(K)=>Y($,{...G,note:K})},void 0,!1,void 0,this),U&&Z("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select at least one option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as m3,useRef as Z3}from"react";function e0(){return window.hljs}function I5(){return window.mermaid}import{jsxDEV as $1}from"react/jsx-dev-runtime";function x3({language:$,children:J}){let Q=typeof J==="string"?J:String(J??""),q=Z3(null);return m3(()=>{let W=q.current,Y=e0();if(!W||!Y)return;W.removeAttribute("data-highlighted"),W.className=$?`language-${$}`:"",W.textContent=Q,Y.highlightElement(W)},[Q,$]),$1("div",{className:"relative mt-3 group/code","data-md":"codeblock","data-md-language":$||"",children:[$&&$1("span",{className:"absolute top-2 right-3 text-tiny text-text-tertiary opacity-0 group-hover/code:opacity-60 transition-opacity duration-150 z-10 font-mono",children:$},void 0,!1,void 0,this),$1("pre",{className:"bg-bg-code rounded-md p-4 overflow-x-auto text-code font-mono leading-relaxed",children:$1("code",{ref:q,className:$?`language-${$}`:"",children:Q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function y5($,J){let Q=$.split(`
|
|
58
|
+
`}strong({tokens:$}){return`<strong>${this.parser.parseInline($)}</strong>`}em({tokens:$}){return`<em>${this.parser.parseInline($)}</em>`}codespan({text:$}){return`<code>${N$($,!0)}</code>`}br($){return"<br>"}del({tokens:$}){return`<del>${this.parser.parseInline($)}</del>`}link({href:$,title:J,tokens:Q}){let q=this.parser.parseInline(Q),W=x1($);if(W===null)return q;$=W;let Y='<a href="'+$+'"';return J&&(Y+=' title="'+N$(J)+'"'),Y+=">"+q+"</a>",Y}image({href:$,title:J,text:Q,tokens:q}){q&&(Q=this.parser.parseInline(q,this.parser.textRenderer));let W=x1($);if(W===null)return N$(Q);$=W;let Y=`<img src="${$}" alt="${N$(Q)}"`;return J&&(Y+=` title="${N$(J)}"`),Y+=">",Y}text($){return"tokens"in $&&$.tokens?this.parser.parseInline($.tokens):("escaped"in $)&&$.escaped?$.text:N$($.text)}},N1=class{strong({text:$}){return $}em({text:$}){return $}codespan({text:$}){return $}del({text:$}){return $}html({text:$}){return $}text({text:$}){return $}link({text:$}){return""+$}image({text:$}){return""+$}br(){return""}checkbox({raw:$}){return $}},X$=class ${options;renderer;textRenderer;constructor(J){this.options=J||x$,this.options.renderer=this.options.renderer||new g0,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new N1}static parse(J,Q){return new $(Q).parse(J)}static parseInline(J,Q){return new $(Q).parseInline(J)}parse(J){this.renderer.parser=this;let Q="";for(let q=0;q<J.length;q++){let W=J[q];if(this.options.extensions?.renderers?.[W.type]){let X=W,G=this.options.extensions.renderers[X.type].call({parser:this},X);if(G!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(X.type)){Q+=G||"";continue}}let Y=W;switch(Y.type){case"space":{Q+=this.renderer.space(Y);break}case"hr":{Q+=this.renderer.hr(Y);break}case"heading":{Q+=this.renderer.heading(Y);break}case"code":{Q+=this.renderer.code(Y);break}case"table":{Q+=this.renderer.table(Y);break}case"blockquote":{Q+=this.renderer.blockquote(Y);break}case"list":{Q+=this.renderer.list(Y);break}case"checkbox":{Q+=this.renderer.checkbox(Y);break}case"html":{Q+=this.renderer.html(Y);break}case"def":{Q+=this.renderer.def(Y);break}case"paragraph":{Q+=this.renderer.paragraph(Y);break}case"text":{Q+=this.renderer.text(Y);break}default:{let X='Token with "'+Y.type+'" type was not found.';if(this.options.silent)return console.error(X),"";throw Error(X)}}}return Q}parseInline(J,Q=this.renderer){this.renderer.parser=this;let q="";for(let W=0;W<J.length;W++){let Y=J[W];if(this.options.extensions?.renderers?.[Y.type]){let G=this.options.extensions.renderers[Y.type].call({parser:this},Y);if(G!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(Y.type)){q+=G||"";continue}}let X=Y;switch(X.type){case"escape":{q+=Q.text(X);break}case"html":{q+=Q.html(X);break}case"link":{q+=Q.link(X);break}case"image":{q+=Q.image(X);break}case"checkbox":{q+=Q.checkbox(X);break}case"strong":{q+=Q.strong(X);break}case"em":{q+=Q.em(X);break}case"codespan":{q+=Q.codespan(X);break}case"br":{q+=Q.br(X);break}case"del":{q+=Q.del(X);break}case"text":{q+=Q.text(X);break}default:{let G='Token with "'+X.type+'" type was not found.';if(this.options.silent)return console.error(G),"";throw Error(G)}}}return q}},O0=class{options;block;constructor($){this.options=$||x$}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess($){return $}postprocess($){return $}processAllTokens($){return $}emStrongMask($){return $}provideLexer($=this.block){return $?Y$.lex:Y$.lexInline}provideParser($=this.block){return $?X$.parse:X$.parseInline}},u2=class{defaults=H1();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=X$;Renderer=g0;TextRenderer=N1;Lexer=Y$;Tokenizer=y0;Hooks=O0;constructor(...$){this.use(...$)}walkTokens($,J){let Q=[];for(let q of $)switch(Q=Q.concat(J.call(this,q)),q.type){case"table":{let W=q;for(let Y of W.header)Q=Q.concat(this.walkTokens(Y.tokens,J));for(let Y of W.rows)for(let X of Y)Q=Q.concat(this.walkTokens(X.tokens,J));break}case"list":{let W=q;Q=Q.concat(this.walkTokens(W.items,J));break}default:{let W=q;this.defaults.extensions?.childTokens?.[W.type]?this.defaults.extensions.childTokens[W.type].forEach((Y)=>{let X=W[Y].flat(1/0);Q=Q.concat(this.walkTokens(X,J))}):W.tokens&&(Q=Q.concat(this.walkTokens(W.tokens,J)))}}return Q}use(...$){let J=this.defaults.extensions||{renderers:{},childTokens:{}};return $.forEach((Q)=>{let q={...Q};if(q.async=this.defaults.async||q.async||!1,Q.extensions&&(Q.extensions.forEach((W)=>{if(!W.name)throw Error("extension name required");if("renderer"in W){let Y=J.renderers[W.name];Y?J.renderers[W.name]=function(...X){let G=W.renderer.apply(this,X);return G===!1&&(G=Y.apply(this,X)),G}:J.renderers[W.name]=W.renderer}if("tokenizer"in W){if(!W.level||W.level!=="block"&&W.level!=="inline")throw Error("extension level must be 'block' or 'inline'");let Y=J[W.level];Y?Y.unshift(W.tokenizer):J[W.level]=[W.tokenizer],W.start&&(W.level==="block"?J.startBlock?J.startBlock.push(W.start):J.startBlock=[W.start]:W.level==="inline"&&(J.startInline?J.startInline.push(W.start):J.startInline=[W.start]))}"childTokens"in W&&W.childTokens&&(J.childTokens[W.name]=W.childTokens)}),q.extensions=J),Q.renderer){let W=this.defaults.renderer||new g0(this.defaults);for(let Y in Q.renderer){if(!(Y in W))throw Error(`renderer '${Y}' does not exist`);if(["options","parser"].includes(Y))continue;let X=Y,G=Q.renderer[X],H=W[X];W[X]=(...B)=>{let _=G.apply(W,B);return _===!1&&(_=H.apply(W,B)),_||""}}q.renderer=W}if(Q.tokenizer){let W=this.defaults.tokenizer||new y0(this.defaults);for(let Y in Q.tokenizer){if(!(Y in W))throw Error(`tokenizer '${Y}' does not exist`);if(["options","rules","lexer"].includes(Y))continue;let X=Y,G=Q.tokenizer[X],H=W[X];W[X]=(...B)=>{let _=G.apply(W,B);return _===!1&&(_=H.apply(W,B)),_}}q.tokenizer=W}if(Q.hooks){let W=this.defaults.hooks||new O0;for(let Y in Q.hooks){if(!(Y in W))throw Error(`hook '${Y}' does not exist`);if(["options","block"].includes(Y))continue;let X=Y,G=Q.hooks[X],H=W[X];O0.passThroughHooks.has(Y)?W[X]=(B)=>{if(this.defaults.async&&O0.passThroughHooksRespectAsync.has(Y))return(async()=>{let w=await G.call(W,B);return H.call(W,w)})();let _=G.call(W,B);return H.call(W,_)}:W[X]=(...B)=>{if(this.defaults.async)return(async()=>{let w=await G.apply(W,B);return w===!1&&(w=await H.apply(W,B)),w})();let _=G.apply(W,B);return _===!1&&(_=H.apply(W,B)),_}}q.hooks=W}if(Q.walkTokens){let W=this.defaults.walkTokens,Y=Q.walkTokens;q.walkTokens=function(X){let G=[];return G.push(Y.call(this,X)),W&&(G=G.concat(W.call(this,X))),G}}this.defaults={...this.defaults,...q}}),this}setOptions($){return this.defaults={...this.defaults,...$},this}lexer($,J){return Y$.lex($,J??this.defaults)}parser($,J){return X$.parse($,J??this.defaults)}parseMarkdown($){return(J,Q)=>{let q={...Q},W={...this.defaults,...q},Y=this.onError(!!W.silent,!!W.async);if(this.defaults.async===!0&&q.async===!1)return Y(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof J>"u"||J===null)return Y(Error("marked(): input parameter is undefined or null"));if(typeof J!="string")return Y(Error("marked(): input parameter is of type "+Object.prototype.toString.call(J)+", string expected"));if(W.hooks&&(W.hooks.options=W,W.hooks.block=$),W.async)return(async()=>{let X=W.hooks?await W.hooks.preprocess(J):J,G=await(W.hooks?await W.hooks.provideLexer($):$?Y$.lex:Y$.lexInline)(X,W),H=W.hooks?await W.hooks.processAllTokens(G):G;W.walkTokens&&await Promise.all(this.walkTokens(H,W.walkTokens));let B=await(W.hooks?await W.hooks.provideParser($):$?X$.parse:X$.parseInline)(H,W);return W.hooks?await W.hooks.postprocess(B):B})().catch(Y);try{W.hooks&&(J=W.hooks.preprocess(J));let X=(W.hooks?W.hooks.provideLexer($):$?Y$.lex:Y$.lexInline)(J,W);W.hooks&&(X=W.hooks.processAllTokens(X)),W.walkTokens&&this.walkTokens(X,W.walkTokens);let G=(W.hooks?W.hooks.provideParser($):$?X$.parse:X$.parseInline)(X,W);return W.hooks&&(G=W.hooks.postprocess(G)),G}catch(X){return Y(X)}}}onError($,J){return(Q)=>{if(Q.message+=`
|
|
59
|
+
Please report this to https://github.com/markedjs/marked.`,$){let q="<p>An error occurred:</p><pre>"+N$(Q.message+"",!0)+"</pre>";return J?Promise.resolve(q):q}if(J)return Promise.reject(Q);throw Q}}},Z$=new u2;function C($,J){return Z$.parse($,J)}C.options=C.setOptions=function($){return Z$.setOptions($),C.defaults=Z$.defaults,c1(C.defaults),C};C.getDefaults=H1;C.defaults=x$;C.use=function(...$){return Z$.use(...$),C.defaults=Z$.defaults,c1(C.defaults),C};C.walkTokens=function($,J){return Z$.walkTokens($,J)};C.parseInline=Z$.parseInline;C.Parser=X$;C.parser=X$.parse;C.Renderer=g0;C.TextRenderer=N1;C.Lexer=Y$;C.lexer=Y$.lex;C.Tokenizer=y0;C.Hooks=O0;C.parse=C;var{options:V6,setOptions:P6,use:D6,walkTokens:k6,parseInline:C6}=C;var E6=X$.parse,T6=Y$.lex;import e1 from"react";import{jsxDEV as K1}from"react/jsx-dev-runtime";C.setOptions({gfm:!0,breaks:!1});var l2=new Set(["a","abbr","b","br","code","del","em","i","kbd","mark","q","s","small","span","strong","sub","sup","time","u"]),c2=new Set(["Priority"]);function p2($){if(typeof $==="string"||typeof $==="number")return!0;if(!e1.isValidElement($))return!1;if(typeof $!=="object"||$===null||!("type"in $))return!1;let J=$.type;if(typeof J==="string")return l2.has(J);if(typeof J==="function"){let Q="displayName"in J&&typeof J.displayName==="string"?J.displayName:J.name;return Q?c2.has(Q):!1}return!1}function d2($,J){let Q=$.trim();if(!Q)return null;let q=C.parse(Q,{async:!1});return K1("div",{className:"prose-canvas","data-md":"markdown","data-md-source":Q,dangerouslySetInnerHTML:{__html:q}},J,!1,void 0,this)}function r2($,J){return K1("div",{className:"prose-canvas",children:$.map((Q,q)=>{if(typeof Q==="string"||typeof Q==="number"){let W=C.parseInline(String(Q),{async:!1});return K1("span",{dangerouslySetInnerHTML:{__html:W}},q,!1,void 0,this)}return Q})},J,!1,void 0,this)}function V$($){let J=e1.Children.toArray($);if(J.length===0)return null;let Q=[],q=[],W=0,Y=()=>{if(q.length===0)return;if(q.some((G)=>typeof G!=="string"&&typeof G!=="number"))Q.push(r2(q,`md-${W++}`));else{let G=d2(q.join(""),`md-${W++}`);if(G)Q.push(G)}q=[]};for(let X of J)if(p2(X))q.push(X);else Y(),Q.push(X);return Y(),Q}import{jsxDEV as O1}from"react/jsx-dev-runtime";var i2={info:{bg:"bg-accent-blue-muted",icon:"i",iconColor:"text-accent-blue"},warning:{bg:"bg-accent-amber-muted",icon:"!",iconColor:"text-accent-amber"},danger:{bg:"bg-accent-red-muted",icon:"✕",iconColor:"text-accent-red"},tip:{bg:"bg-accent-green-muted",icon:"✓",iconColor:"text-accent-green"}};function o2({type:$="info",children:J}){let Q=i2[$];return O1("div",{className:`${Q.bg} relative rounded-lg px-5 py-4 mt-3 flex gap-3 items-start`,"data-md":"callout","data-md-type":$,children:[O1("span",{"aria-hidden":"true",className:`${Q.iconColor} opacity-70 text-base leading-relaxed flex-shrink-0 mt-px`,children:Q.icon},void 0,!1,void 0,this),O1("div",{className:"text-body text-text-secondary leading-relaxed",children:V$(J)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as o$}from"react/jsx-dev-runtime";function n2({items:$}){return o$("ul",{className:"space-y-1 mt-3","data-md":"checklist",children:$.map((J,Q)=>o$("li",{"data-md":"checklist-item","data-md-label":J.label,className:"relative flex items-start gap-2.5 py-1",children:[o$("span",{className:`w-4 h-4 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5 transition-all ${J.checked?"bg-accent-green":"border-[1.5px] border-border-hover"}`,children:J.checked&&o$("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:o$("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),o$("span",{className:`text-body font-body ${J.checked?"text-text-tertiary line-through decoration-border-hover":"text-text-secondary"}`,children:J.label},void 0,!1,void 0,this)]},Q,!0,void 0,this))},void 0,!1,void 0,this)}import{useAnnotations as k5,useResponseRegistration as C5}from"#canvas/runtime";import{useEffect as E5,useMemo as T5,useRef as I5,useState as y5}from"react";import{AnnotationCtx as T7,AnnotationHostContext as I7,SessionContext as y7,useAnnotationHost as g7,useAnnotations as h7}from"@fabrika/annotations/runtime";function L1($,J){let Q=[],q=a2($);for(let W of q){let Y=document.createRange();if(Y.selectNodeContents(W),W===$.startContainer)Y.setStart(W,$.startOffset);if(W===$.endContainer)Y.setEnd(W,$.endOffset);let X=Y.toString();if(!X||!X.trim())continue;let G=document.createElement("mark");G.setAttribute("data-annotation-id",J);try{Y.surroundContents(G)}catch{let H=Y.extractContents();G.appendChild(H),Y.insertNode(G)}Q.push(G)}return Q}function F1($){let J=$.parentElement;if(J?.classList.contains("select-none"))return!1;if(J?.closest("[data-annotation-id]"))return!1;return!0}function a2($){let J=[],Q=$.commonAncestorContainer;if(Q.nodeType===Node.TEXT_NODE)return J.push(Q),J;let q=document.createTreeWalker(Q,NodeFilter.SHOW_TEXT),W;while(W=q.nextNode()){if(!F1(W))continue;if($.intersectsNode(W))J.push(W)}return J}function S1($,J){for(let Q of J){if($.querySelector(`[data-annotation-id="${Q.id}"]`))continue;let q=Q.snippet;if(!q)continue;let{fullText:W,textNodes:Y}=s2($),X=[],G=0;while(!0){let U=W.indexOf(q,G);if(U===-1)break;X.push(U),G=U+1}let[H]=X;if(H===void 0)continue;let B=H;if(X.length>1&&Q.context){let U=-1;for(let K of X){let O=0;if(Q.context.before){let R=W.slice(Math.max(0,K-80),K);if(R.includes(Q.context.before))O+=2;else if(Q.context.before.length>10&&R.includes(Q.context.before.slice(-10)))O+=1}if(Q.context.after){let R=W.slice(K+q.length,K+q.length+80);if(R.includes(Q.context.after))O+=2;else if(Q.context.after.length>10&&R.includes(Q.context.after.slice(0,10)))O+=1}if(O>U)U=O,B=K}}let _=B,w=B+q.length,L=$5(Y,_),F=$5(Y,w);if(!L||!F)continue;try{let U=document.createRange();U.setStart(L.node,L.offset),U.setEnd(F.node,F.offset),L1(U,Q.id)}catch{}}}function s2($){let J=[],Q="",q=document.createTreeWalker($,NodeFilter.SHOW_TEXT),W;while(W=q.nextNode()){if(!F1(W))continue;J.push({node:W,start:Q.length}),Q+=W.textContent||""}return{fullText:Q,textNodes:J}}function $5($,J){for(let Q=$.length-1;Q>=0;Q--){let q=$[Q];if(!q||q.start>J)continue;let W=J-q.start,Y=q.node.textContent?.length??0;if(W<=Y)return{node:q.node,offset:W}}return null}function F0($){return{kind:$.kind,owns:(J)=>$.parse(J)!==null,find:(J,Q)=>{let q=$.parse(J);return q===null?null:$.find(q,Q)},restore:(J,Q)=>{let q=$.parse(Q.snippet);if(q===null)return;$.restore?.(q,J,Q)},describe:(J)=>{let Q=$.parse(J);if(Q===null||!$.describe)return null;return $.describe(Q)}}}function J5($){let J=document.createTreeWalker($,NodeFilter.SHOW_TEXT),Q="";for(let q=J.nextNode();q;q=J.nextNode()){let W=q.parentElement?.closest("[aria-hidden='true']");if(W&&$.contains(W))continue;Q+=q.textContent??""}return Q.trim()}function Z0($,J,Q){return{selector:$,snippet:(q)=>{let W=q.getAttribute(Q);return W?`${J} ${W}`:null}}}var A1=[Z0("[data-md='item']","[Item]","data-md-label"),Z0("[data-md='section']","[Section]","data-md-title"),Z0("[data-md='checklist-item']","[Checklist]","data-md-label"),Z0("[data-md='image']","[Image]","data-md-src"),{selector:"[data-md='callout']",snippet:($)=>{return`[Callout:${$.getAttribute("data-md-type")||"info"}] ${J5($).slice(0,60)||"Callout"}`}},{selector:"[data-md='note']",snippet:($)=>`[Note] ${J5($).slice(0,60)||"Note"}`},{selector:"[data-md='table'] tbody tr",snippet:($)=>{let J=Array.from($.querySelectorAll("td")).map((Q)=>Q.textContent?.trim()).filter(Boolean);return J.length?`[Row] ${J.join(" | ")}`:null}}],t2=["[data-md='choice-option']","[data-md='multichoice-option']","[data-md='userinput']","[data-md='rangeinput']"],b1=A1.map(($)=>$.selector).join(", "),Q5=[...A1.map(($)=>$.selector),...t2].join(", ");function f1($){for(let J of A1)if($.matches(J.selector))return J.snippet($);return null}var v1={kind:"block",parse:($)=>$.startsWith("[")?{snippet:$}:null,format:($)=>$.snippet,find:($,J)=>{for(let Q of J.querySelectorAll(b1)){if(!(Q instanceof HTMLElement))continue;if(f1(Q)===$.snippet)return Q}return null}};var e2=/^\[Region:(rect|ellipse)\] ([\s\S]+) @(0|[1-9]\d*),(0|[1-9]\d*),(0|[1-9]\d*),(0|[1-9]\d*)$/;function $4($){if($==="rect")return"rect";if($==="ellipse")return"ellipse";return null}function x0($){if($===void 0)return null;let J=Number($);if(!Number.isInteger(J)||J<0||J>1e4)return null;return J}function W5($){return{left:`${$.x/100}%`,top:`${$.y/100}%`,width:`${$.w/100}%`,height:`${$.h/100}%`}}function u0($){return`${($/100).toFixed(1).replace(/\.0$/,"")}%`}function j1($){let J=`${u0($.x)}-${u0($.x+$.w)}`,Q=`${u0($.y)}-${u0($.y+$.h)}`;return`[Region] ${$.src} — ${$.shape} x ${J}, y ${Q} of the image`}function R1($,J){for(let Q of J.querySelectorAll("[data-md='image']")){if(!(Q instanceof HTMLElement))continue;if(Q.getAttribute("data-md-src")!==$)continue;let q=Q.querySelector("[data-annotation-image]");if(q instanceof HTMLElement)return q}return null}function q5($,J){let Q=W5(J);$.style.left=Q.left,$.style.top=Q.top,$.style.width=Q.width,$.style.height=Q.height}function V1($,J,Q){let q=document.createElement("div");return q.className="ann-region",q.setAttribute("data-annotation-id",Q),q.setAttribute("data-annotation-region",J),q5(q,$),q}var l0={kind:"region",parse:($)=>{let J=e2.exec($);if(!J)return null;let Q=$4(J[1]),q=J[2],W=x0(J[3]),Y=x0(J[4]),X=x0(J[5]),G=x0(J[6]);if(Q===null||q===void 0)return null;if(W===null||Y===null||X===null||G===null)return null;if(X<1||G<1)return null;return{src:q,shape:Q,x:W,y:Y,w:X,h:G}},format:($)=>`[Region:${$.shape}] ${$.src} @${$.x},${$.y},${$.w},${$.h}`,find:($,J)=>R1($.src,J),restore:($,J,Q)=>{if(J.querySelector(`[data-annotation-id="${Q.id}"]`))return;let q=R1($.src,J);if(!q)return;q.appendChild(V1($,$.shape,Q.id))},describe:j1};var P1={kind:"text",parse:($)=>$?{text:$}:null,format:($)=>$.text,find:()=>null,restore:($,J,Q)=>{S1(J,[Q])}};var J4=[F0(l0),F0(v1),F0(P1)];import{AnnotationCtx as d8,SessionContext as r8,useAnnotationHost as i8}from"@fabrika/annotations/runtime";import{useEffect as a8,useRef as s8,useState as t8}from"react";var S={};$2(S,{void:()=>Z4,util:()=>k,unknown:()=>h4,union:()=>c4,undefined:()=>I4,tuple:()=>r4,transformer:()=>Q3,symbol:()=>T4,string:()=>w5,strictObject:()=>l4,setErrorMap:()=>q4,set:()=>n4,record:()=>i4,quotelessJson:()=>Q4,promise:()=>J3,preprocess:()=>Y3,pipeline:()=>X3,ostring:()=>H3,optional:()=>W3,onumber:()=>G3,oboolean:()=>B3,objectUtil:()=>D1,object:()=>u4,number:()=>z5,nullable:()=>q3,null:()=>y4,never:()=>m4,nativeEnum:()=>$3,nan:()=>k4,map:()=>o4,makeIssue:()=>S0,literal:()=>t4,lazy:()=>s4,late:()=>P4,isValid:()=>P$,isDirty:()=>p0,isAsync:()=>a$,isAborted:()=>c0,intersection:()=>d4,instanceof:()=>D4,getParsedType:()=>K$,getErrorMap:()=>n$,function:()=>a4,enum:()=>e4,effect:()=>Q3,discriminatedUnion:()=>p4,defaultErrorMap:()=>A$,datetimeRegex:()=>_5,date:()=>E4,custom:()=>U5,coerce:()=>_3,boolean:()=>N5,bigint:()=>C4,array:()=>x4,any:()=>g4,addIssueToContext:()=>N,ZodVoid:()=>b0,ZodUnknown:()=>D$,ZodUnion:()=>Q0,ZodUndefined:()=>$0,ZodType:()=>D,ZodTuple:()=>L$,ZodTransformer:()=>M$,ZodSymbol:()=>A0,ZodString:()=>H$,ZodSet:()=>p$,ZodSchema:()=>D,ZodRecord:()=>f0,ZodReadonly:()=>B0,ZodPromise:()=>d$,ZodPipeline:()=>j0,ZodParsedType:()=>z,ZodOptional:()=>B$,ZodObject:()=>h,ZodNumber:()=>k$,ZodNullable:()=>f$,ZodNull:()=>J0,ZodNever:()=>O$,ZodNativeEnum:()=>X0,ZodNaN:()=>R0,ZodMap:()=>v0,ZodLiteral:()=>Y0,ZodLazy:()=>q0,ZodIssueCode:()=>M,ZodIntersection:()=>W0,ZodFunction:()=>t$,ZodFirstPartyTypeKind:()=>v,ZodError:()=>$$,ZodEnum:()=>E$,ZodEffects:()=>M$,ZodDiscriminatedUnion:()=>d0,ZodDefault:()=>H0,ZodDate:()=>l$,ZodCatch:()=>G0,ZodBranded:()=>r0,ZodBoolean:()=>e$,ZodBigInt:()=>C$,ZodArray:()=>G$,ZodAny:()=>c$,Schema:()=>D,ParseStatus:()=>i,OK:()=>n,NEVER:()=>M3,INVALID:()=>f,EMPTY_PATH:()=>Y4,DIRTY:()=>u$,BRAND:()=>V4});var k;(function($){$.assertEqual=(W)=>{};function J(W){}$.assertIs=J;function Q(W){throw Error()}$.assertNever=Q,$.arrayToEnum=(W)=>{let Y={};for(let X of W)Y[X]=X;return Y},$.getValidEnumValues=(W)=>{let Y=$.objectKeys(W).filter((G)=>typeof W[W[G]]!=="number"),X={};for(let G of Y)X[G]=W[G];return $.objectValues(X)},$.objectValues=(W)=>{return $.objectKeys(W).map(function(Y){return W[Y]})},$.objectKeys=typeof Object.keys==="function"?(W)=>Object.keys(W):(W)=>{let Y=[];for(let X in W)if(Object.prototype.hasOwnProperty.call(W,X))Y.push(X);return Y},$.find=(W,Y)=>{for(let X of W)if(Y(X))return X;return},$.isInteger=typeof Number.isInteger==="function"?(W)=>Number.isInteger(W):(W)=>typeof W==="number"&&Number.isFinite(W)&&Math.floor(W)===W;function q(W,Y=" | "){return W.map((X)=>typeof X==="string"?`'${X}'`:X).join(Y)}$.joinValues=q,$.jsonStringifyReplacer=(W,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(k||(k={}));var D1;(function($){$.mergeShapes=(J,Q)=>{return{...J,...Q}}})(D1||(D1={}));var z=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),K$=($)=>{switch(typeof $){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN($)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":if(Array.isArray($))return z.array;if($===null)return z.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return z.promise;if(typeof Map<"u"&&$ instanceof Map)return z.map;if(typeof Set<"u"&&$ instanceof Set)return z.set;if(typeof Date<"u"&&$ instanceof Date)return z.date;return z.object;default:return z.unknown}};var M=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Q4=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class $$ extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let J=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,J);else this.__proto__=J;this.name="ZodError",this.issues=$}format($){let J=$||function(W){return W.message},Q={_errors:[]},q=(W)=>{for(let Y of W.issues)if(Y.code==="invalid_union")Y.unionErrors.map(q);else if(Y.code==="invalid_return_type")q(Y.returnTypeError);else if(Y.code==="invalid_arguments")q(Y.argumentsError);else if(Y.path.length===0)Q._errors.push(J(Y));else{let X=Q,G=0;while(G<Y.path.length){let H=Y.path[G];if(G!==Y.path.length-1)X[H]=X[H]||{_errors:[]};else X[H]=X[H]||{_errors:[]},X[H]._errors.push(J(Y));X=X[H],G++}}};return q(this),Q}static assert($){if(!($ instanceof $$))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(J)=>J.message){let J={},Q=[];for(let q of this.issues)if(q.path.length>0){let W=q.path[0];J[W]=J[W]||[],J[W].push($(q))}else Q.push($(q));return{formErrors:Q,fieldErrors:J}}get formErrors(){return this.flatten()}}$$.create=($)=>{return new $$($)};var W4=($,J)=>{let Q;switch($.code){case M.invalid_type:if($.received===z.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case M.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,k.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:Q=`Unrecognized key(s) in object: ${k.joinValues($.keys,", ")}`;break;case M.invalid_union:Q="Invalid input";break;case M.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${k.joinValues($.options)}`;break;case M.invalid_enum_value:Q=`Invalid enum value. Expected ${k.joinValues($.options)}, received '${$.received}'`;break;case M.invalid_arguments:Q="Invalid function arguments";break;case M.invalid_return_type:Q="Invalid function return type";break;case M.invalid_date:Q="Invalid date";break;case M.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else k.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case M.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case M.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case M.custom:Q="Invalid input";break;case M.invalid_intersection_types:Q="Intersection results could not be merged";break;case M.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case M.not_finite:Q="Number must be finite";break;default:Q=J.defaultError,k.assertNever($)}return{message:Q}},A$=W4;var Y5=A$;function q4($){Y5=$}function n$(){return Y5}var S0=($)=>{let{data:J,path:Q,errorMaps:q,issueData:W}=$,Y=[...Q,...W.path||[]],X={...W,path:Y};if(W.message!==void 0)return{...W,path:Y,message:W.message};let G="",H=q.filter((B)=>!!B).slice().reverse();for(let B of H)G=B(X,{data:J,defaultError:G}).message;return{...W,path:Y,message:G}},Y4=[];function N($,J){let Q=n$(),q=S0({issueData:J,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===A$?void 0:A$].filter((W)=>!!W)});$.common.issues.push(q)}class i{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,J){let Q=[];for(let q of J){if(q.status==="aborted")return f;if(q.status==="dirty")$.dirty();Q.push(q.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,J){let Q=[];for(let q of J){let W=await q.key,Y=await q.value;Q.push({key:W,value:Y})}return i.mergeObjectSync($,Q)}static mergeObjectSync($,J){let Q={};for(let q of J){let{key:W,value:Y}=q;if(W.status==="aborted")return f;if(Y.status==="aborted")return f;if(W.status==="dirty")$.dirty();if(Y.status==="dirty")$.dirty();if(W.value!=="__proto__"&&(typeof Y.value<"u"||q.alwaysSet))Q[W.value]=Y.value}return{status:$.value,value:Q}}}var f=Object.freeze({status:"aborted"}),u$=($)=>({status:"dirty",value:$}),n=($)=>({status:"valid",value:$}),c0=($)=>$.status==="aborted",p0=($)=>$.status==="dirty",P$=($)=>$.status==="valid",a$=($)=>typeof Promise<"u"&&$ instanceof Promise;var b;(function($){$.errToObj=(J)=>typeof J==="string"?{message:J}:J||{},$.toString=(J)=>typeof J==="string"?J:J?.message})(b||(b={}));class _${constructor($,J,Q,q){this._cachedPath=[],this.parent=$,this.data=J,this._path=Q,this._key=q}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var X5=($,J)=>{if(P$(J))return{success:!0,data:J.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new $$($.common.issues);return this._error=Q,this._error}}}};function j($){if(!$)return{};let{errorMap:J,invalid_type_error:Q,required_error:q,description:W}=$;if(J&&(Q||q))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(J)return{errorMap:J,description:W};return{errorMap:(X,G)=>{let{message:H}=$;if(X.code==="invalid_enum_value")return{message:H??G.defaultError};if(typeof G.data>"u")return{message:H??q??G.defaultError};if(X.code!=="invalid_type")return{message:G.defaultError};return{message:H??Q??G.defaultError}},description:W}}class D{get description(){return this._def.description}_getType($){return K$($.data)}_getOrReturnCtx($,J){return J||{common:$.parent.common,data:$.data,parsedType:K$($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new i,ctx:{common:$.parent.common,data:$.data,parsedType:K$($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let J=this._parse($);if(a$(J))throw Error("Synchronous parse encountered promise.");return J}_parseAsync($){let J=this._parse($);return Promise.resolve(J)}parse($,J){let Q=this.safeParse($,J);if(Q.success)return Q.data;throw Q.error}safeParse($,J){let Q={common:{issues:[],async:J?.async??!1,contextualErrorMap:J?.errorMap},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:K$($)},q=this._parseSync({data:$,path:Q.path,parent:Q});return X5(Q,q)}"~validate"($){let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:K$($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:J});return P$(Q)?{value:Q.value}:{issues:J.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((Q)=>P$(Q)?{value:Q.value}:{issues:J.common.issues})}async parseAsync($,J){let Q=await this.safeParseAsync($,J);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,J){let Q={common:{issues:[],contextualErrorMap:J?.errorMap,async:!0},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:K$($)},q=this._parse({data:$,path:Q.path,parent:Q}),W=await(a$(q)?q:Promise.resolve(q));return X5(Q,W)}refine($,J){let Q=(q)=>{if(typeof J==="string"||typeof J>"u")return{message:J};else if(typeof J==="function")return J(q);else return J};return this._refinement((q,W)=>{let Y=$(q),X=()=>W.addIssue({code:M.custom,...Q(q)});if(typeof Promise<"u"&&Y instanceof Promise)return Y.then((G)=>{if(!G)return X(),!1;else return!0});if(!Y)return X(),!1;else return!0})}refinement($,J){return this._refinement((Q,q)=>{if(!$(Q))return q.addIssue(typeof J==="function"?J(Q,q):J),!1;else return!0})}_refinement($){return new M$({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(J)=>this["~validate"](J)}}optional(){return B$.create(this,this._def)}nullable(){return f$.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return G$.create(this)}promise(){return d$.create(this,this._def)}or($){return Q0.create([this,$],this._def)}and($){return W0.create(this,$,this._def)}transform($){return new M$({...j(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:$}})}default($){let J=typeof $==="function"?$:()=>$;return new H0({...j(this._def),innerType:this,defaultValue:J,typeName:v.ZodDefault})}brand(){return new r0({typeName:v.ZodBranded,type:this,...j(this._def)})}catch($){let J=typeof $==="function"?$:()=>$;return new G0({...j(this._def),innerType:this,catchValue:J,typeName:v.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return j0.create(this,$)}readonly(){return B0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var X4=/^c[^\s-]{8,}$/i,H4=/^[0-9a-z]+$/,G4=/^[0-9A-HJKMNP-TV-Z]{26}$/i,B4=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,_4=/^[a-z0-9_-]{21}$/i,M4=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,U4=/^[-+]?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)?)??$/,w4=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",k1,N4=/^(?:(?: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])$/,K4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,O4=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,L4=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,F4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,S4=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,G5="((\\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])))",A4=new RegExp(`^${G5}$`);function B5($){let J="[0-5]\\d";if($.precision)J=`${J}\\.\\d{${$.precision}}`;else if($.precision==null)J=`${J}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${J})${Q}`}function b4($){return new RegExp(`^${B5($)}$`)}function _5($){let J=`${G5}T${B5($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return J=`${J}(${Q.join("|")})`,new RegExp(`^${J}$`)}function f4($,J){if((J==="v4"||!J)&&N4.test($))return!0;if((J==="v6"||!J)&&O4.test($))return!0;return!1}function v4($,J){if(!M4.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let q=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),W=JSON.parse(atob(q));if(typeof W!=="object"||W===null)return!1;if("typ"in W&&W?.typ!=="JWT")return!1;if(!W.alg)return!1;if(J&&W.alg!==J)return!1;return!0}catch{return!1}}function R4($,J){if((J==="v4"||!J)&&K4.test($))return!0;if((J==="v6"||!J)&&L4.test($))return!0;return!1}class H$ extends D{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==z.string){let W=this._getOrReturnCtx($);return N(W,{code:M.invalid_type,expected:z.string,received:W.parsedType}),f}let Q=new i,q=void 0;for(let W of this._def.checks)if(W.kind==="min"){if($.data.length<W.value)q=this._getOrReturnCtx($,q),N(q,{code:M.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),Q.dirty()}else if(W.kind==="max"){if($.data.length>W.value)q=this._getOrReturnCtx($,q),N(q,{code:M.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),Q.dirty()}else if(W.kind==="length"){let Y=$.data.length>W.value,X=$.data.length<W.value;if(Y||X){if(q=this._getOrReturnCtx($,q),Y)N(q,{code:M.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});else if(X)N(q,{code:M.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});Q.dirty()}}else if(W.kind==="email"){if(!w4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"email",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="emoji"){if(!k1)k1=new RegExp(z4,"u");if(!k1.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"emoji",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="uuid"){if(!B4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"uuid",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="nanoid"){if(!_4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"nanoid",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="cuid"){if(!X4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"cuid",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="cuid2"){if(!H4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"cuid2",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="ulid"){if(!G4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"ulid",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="url")try{new URL($.data)}catch{q=this._getOrReturnCtx($,q),N(q,{validation:"url",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="regex"){if(W.regex.lastIndex=0,!W.regex.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"regex",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="trim")$.data=$.data.trim();else if(W.kind==="includes"){if(!$.data.includes(W.value,W.position))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:{includes:W.value,position:W.position},message:W.message}),Q.dirty()}else if(W.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(W.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(W.kind==="startsWith"){if(!$.data.startsWith(W.value))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:{startsWith:W.value},message:W.message}),Q.dirty()}else if(W.kind==="endsWith"){if(!$.data.endsWith(W.value))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:{endsWith:W.value},message:W.message}),Q.dirty()}else if(W.kind==="datetime"){if(!_5(W).test($.data))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:"datetime",message:W.message}),Q.dirty()}else if(W.kind==="date"){if(!A4.test($.data))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:"date",message:W.message}),Q.dirty()}else if(W.kind==="time"){if(!b4(W).test($.data))q=this._getOrReturnCtx($,q),N(q,{code:M.invalid_string,validation:"time",message:W.message}),Q.dirty()}else if(W.kind==="duration"){if(!U4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"duration",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="ip"){if(!f4($.data,W.version))q=this._getOrReturnCtx($,q),N(q,{validation:"ip",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="jwt"){if(!v4($.data,W.alg))q=this._getOrReturnCtx($,q),N(q,{validation:"jwt",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="cidr"){if(!R4($.data,W.version))q=this._getOrReturnCtx($,q),N(q,{validation:"cidr",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="base64"){if(!F4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"base64",code:M.invalid_string,message:W.message}),Q.dirty()}else if(W.kind==="base64url"){if(!S4.test($.data))q=this._getOrReturnCtx($,q),N(q,{validation:"base64url",code:M.invalid_string,message:W.message}),Q.dirty()}else k.assertNever(W);return{status:Q.value,value:$.data}}_regex($,J,Q){return this.refinement((q)=>$.test(q),{validation:J,code:M.invalid_string,...b.errToObj(Q)})}_addCheck($){return new H$({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...b.errToObj($)})}url($){return this._addCheck({kind:"url",...b.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...b.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...b.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...b.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...b.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...b.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...b.errToObj($)})}base64($){return this._addCheck({kind:"base64",...b.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...b.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...b.errToObj($)})}ip($){return this._addCheck({kind:"ip",...b.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...b.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...b.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...b.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...b.errToObj($)})}regex($,J){return this._addCheck({kind:"regex",regex:$,...b.errToObj(J)})}includes($,J){return this._addCheck({kind:"includes",value:$,position:J?.position,...b.errToObj(J?.message)})}startsWith($,J){return this._addCheck({kind:"startsWith",value:$,...b.errToObj(J)})}endsWith($,J){return this._addCheck({kind:"endsWith",value:$,...b.errToObj(J)})}min($,J){return this._addCheck({kind:"min",value:$,...b.errToObj(J)})}max($,J){return this._addCheck({kind:"max",value:$,...b.errToObj(J)})}length($,J){return this._addCheck({kind:"length",value:$,...b.errToObj(J)})}nonempty($){return this.min(1,b.errToObj($))}trim(){return new H$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new H$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new H$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxLength(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}H$.create=($)=>{return new H$({checks:[],typeName:v.ZodString,coerce:$?.coerce??!1,...j($)})};function j4($,J){let Q=($.toString().split(".")[1]||"").length,q=(J.toString().split(".")[1]||"").length,W=Q>q?Q:q,Y=Number.parseInt($.toFixed(W).replace(".","")),X=Number.parseInt(J.toFixed(W).replace(".",""));return Y%X/10**W}class k$ extends D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==z.number){let W=this._getOrReturnCtx($);return N(W,{code:M.invalid_type,expected:z.number,received:W.parsedType}),f}let Q=void 0,q=new i;for(let W of this._def.checks)if(W.kind==="int"){if(!k.isInteger($.data))Q=this._getOrReturnCtx($,Q),N(Q,{code:M.invalid_type,expected:"integer",received:"float",message:W.message}),q.dirty()}else if(W.kind==="min"){if(W.inclusive?$.data<W.value:$.data<=W.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.too_small,minimum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),q.dirty()}else if(W.kind==="max"){if(W.inclusive?$.data>W.value:$.data>=W.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.too_big,maximum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),q.dirty()}else if(W.kind==="multipleOf"){if(j4($.data,W.value)!==0)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.not_multiple_of,multipleOf:W.value,message:W.message}),q.dirty()}else if(W.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),N(Q,{code:M.not_finite,message:W.message}),q.dirty()}else k.assertNever(W);return{status:q.value,value:$.data}}gte($,J){return this.setLimit("min",$,!0,b.toString(J))}gt($,J){return this.setLimit("min",$,!1,b.toString(J))}lte($,J){return this.setLimit("max",$,!0,b.toString(J))}lt($,J){return this.setLimit("max",$,!1,b.toString(J))}setLimit($,J,Q,q){return new k$({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:b.toString(q)}]})}_addCheck($){return new k$({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:b.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:b.toString(J)})}finite($){return this._addCheck({kind:"finite",message:b.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString($)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&k.isInteger($.value))}get isFinite(){let $=null,J=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(J)&&Number.isFinite($)}}k$.create=($)=>{return new k$({checks:[],typeName:v.ZodNumber,coerce:$?.coerce||!1,...j($)})};class C$ extends D{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==z.bigint)return this._getInvalidInput($);let Q=void 0,q=new i;for(let W of this._def.checks)if(W.kind==="min"){if(W.inclusive?$.data<W.value:$.data<=W.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.too_small,type:"bigint",minimum:W.value,inclusive:W.inclusive,message:W.message}),q.dirty()}else if(W.kind==="max"){if(W.inclusive?$.data>W.value:$.data>=W.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:M.too_big,type:"bigint",maximum:W.value,inclusive:W.inclusive,message:W.message}),q.dirty()}else if(W.kind==="multipleOf"){if($.data%W.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),N(Q,{code:M.not_multiple_of,multipleOf:W.value,message:W.message}),q.dirty()}else k.assertNever(W);return{status:q.value,value:$.data}}_getInvalidInput($){let J=this._getOrReturnCtx($);return N(J,{code:M.invalid_type,expected:z.bigint,received:J.parsedType}),f}gte($,J){return this.setLimit("min",$,!0,b.toString(J))}gt($,J){return this.setLimit("min",$,!1,b.toString(J))}lte($,J){return this.setLimit("max",$,!0,b.toString(J))}lt($,J){return this.setLimit("max",$,!1,b.toString(J))}setLimit($,J,Q,q){return new C$({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:b.toString(q)}]})}_addCheck($){return new C$({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:b.toString(J)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}C$.create=($)=>{return new C$({checks:[],typeName:v.ZodBigInt,coerce:$?.coerce??!1,...j($)})};class e$ extends D{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==z.boolean){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.boolean,received:Q.parsedType}),f}return n($.data)}}e$.create=($)=>{return new e$({typeName:v.ZodBoolean,coerce:$?.coerce||!1,...j($)})};class l$ extends D{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==z.date){let W=this._getOrReturnCtx($);return N(W,{code:M.invalid_type,expected:z.date,received:W.parsedType}),f}if(Number.isNaN($.data.getTime())){let W=this._getOrReturnCtx($);return N(W,{code:M.invalid_date}),f}let Q=new i,q=void 0;for(let W of this._def.checks)if(W.kind==="min"){if($.data.getTime()<W.value)q=this._getOrReturnCtx($,q),N(q,{code:M.too_small,message:W.message,inclusive:!0,exact:!1,minimum:W.value,type:"date"}),Q.dirty()}else if(W.kind==="max"){if($.data.getTime()>W.value)q=this._getOrReturnCtx($,q),N(q,{code:M.too_big,message:W.message,inclusive:!0,exact:!1,maximum:W.value,type:"date"}),Q.dirty()}else k.assertNever(W);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new l$({...this._def,checks:[...this._def.checks,$]})}min($,J){return this._addCheck({kind:"min",value:$.getTime(),message:b.toString(J)})}max($,J){return this._addCheck({kind:"max",value:$.getTime(),message:b.toString(J)})}get minDate(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $!=null?new Date($):null}}l$.create=($)=>{return new l$({checks:[],coerce:$?.coerce||!1,typeName:v.ZodDate,...j($)})};class A0 extends D{_parse($){if(this._getType($)!==z.symbol){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.symbol,received:Q.parsedType}),f}return n($.data)}}A0.create=($)=>{return new A0({typeName:v.ZodSymbol,...j($)})};class $0 extends D{_parse($){if(this._getType($)!==z.undefined){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.undefined,received:Q.parsedType}),f}return n($.data)}}$0.create=($)=>{return new $0({typeName:v.ZodUndefined,...j($)})};class J0 extends D{_parse($){if(this._getType($)!==z.null){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.null,received:Q.parsedType}),f}return n($.data)}}J0.create=($)=>{return new J0({typeName:v.ZodNull,...j($)})};class c$ extends D{constructor(){super(...arguments);this._any=!0}_parse($){return n($.data)}}c$.create=($)=>{return new c$({typeName:v.ZodAny,...j($)})};class D$ extends D{constructor(){super(...arguments);this._unknown=!0}_parse($){return n($.data)}}D$.create=($)=>{return new D$({typeName:v.ZodUnknown,...j($)})};class O$ extends D{_parse($){let J=this._getOrReturnCtx($);return N(J,{code:M.invalid_type,expected:z.never,received:J.parsedType}),f}}O$.create=($)=>{return new O$({typeName:v.ZodNever,...j($)})};class b0 extends D{_parse($){if(this._getType($)!==z.undefined){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.void,received:Q.parsedType}),f}return n($.data)}}b0.create=($)=>{return new b0({typeName:v.ZodVoid,...j($)})};class G$ extends D{_parse($){let{ctx:J,status:Q}=this._processInputParams($),q=this._def;if(J.parsedType!==z.array)return N(J,{code:M.invalid_type,expected:z.array,received:J.parsedType}),f;if(q.exactLength!==null){let Y=J.data.length>q.exactLength.value,X=J.data.length<q.exactLength.value;if(Y||X)N(J,{code:Y?M.too_big:M.too_small,minimum:X?q.exactLength.value:void 0,maximum:Y?q.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:q.exactLength.message}),Q.dirty()}if(q.minLength!==null){if(J.data.length<q.minLength.value)N(J,{code:M.too_small,minimum:q.minLength.value,type:"array",inclusive:!0,exact:!1,message:q.minLength.message}),Q.dirty()}if(q.maxLength!==null){if(J.data.length>q.maxLength.value)N(J,{code:M.too_big,maximum:q.maxLength.value,type:"array",inclusive:!0,exact:!1,message:q.maxLength.message}),Q.dirty()}if(J.common.async)return Promise.all([...J.data].map((Y,X)=>{return q.type._parseAsync(new _$(J,Y,J.path,X))})).then((Y)=>{return i.mergeArray(Q,Y)});let W=[...J.data].map((Y,X)=>{return q.type._parseSync(new _$(J,Y,J.path,X))});return i.mergeArray(Q,W)}get element(){return this._def.type}min($,J){return new G$({...this._def,minLength:{value:$,message:b.toString(J)}})}max($,J){return new G$({...this._def,maxLength:{value:$,message:b.toString(J)}})}length($,J){return new G$({...this._def,exactLength:{value:$,message:b.toString(J)}})}nonempty($){return this.min(1,$)}}G$.create=($,J)=>{return new G$({type:$,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...j(J)})};function s$($){if($ instanceof h){let J={};for(let Q in $.shape){let q=$.shape[Q];J[Q]=B$.create(s$(q))}return new h({...$._def,shape:()=>J})}else if($ instanceof G$)return new G$({...$._def,type:s$($.element)});else if($ instanceof B$)return B$.create(s$($.unwrap()));else if($ instanceof f$)return f$.create(s$($.unwrap()));else if($ instanceof L$)return L$.create($.items.map((J)=>s$(J)));else return $}class h extends D{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),J=k.objectKeys($);return this._cached={shape:$,keys:J},this._cached}_parse($){if(this._getType($)!==z.object){let H=this._getOrReturnCtx($);return N(H,{code:M.invalid_type,expected:z.object,received:H.parsedType}),f}let{status:Q,ctx:q}=this._processInputParams($),{shape:W,keys:Y}=this._getCached(),X=[];if(!(this._def.catchall instanceof O$&&this._def.unknownKeys==="strip")){for(let H in q.data)if(!Y.includes(H))X.push(H)}let G=[];for(let H of Y){let B=W[H],_=q.data[H];G.push({key:{status:"valid",value:H},value:B._parse(new _$(q,_,q.path,H)),alwaysSet:H in q.data})}if(this._def.catchall instanceof O$){let H=this._def.unknownKeys;if(H==="passthrough")for(let B of X)G.push({key:{status:"valid",value:B},value:{status:"valid",value:q.data[B]}});else if(H==="strict"){if(X.length>0)N(q,{code:M.unrecognized_keys,keys:X}),Q.dirty()}else if(H==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let H=this._def.catchall;for(let B of X){let _=q.data[B];G.push({key:{status:"valid",value:B},value:H._parse(new _$(q,_,q.path,B)),alwaysSet:B in q.data})}}if(q.common.async)return Promise.resolve().then(async()=>{let H=[];for(let B of G){let _=await B.key,w=await B.value;H.push({key:_,value:w,alwaysSet:B.alwaysSet})}return H}).then((H)=>{return i.mergeObjectSync(Q,H)});else return i.mergeObjectSync(Q,G)}get shape(){return this._def.shape()}strict($){return b.errToObj,new h({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(J,Q)=>{let q=this._def.errorMap?.(J,Q).message??Q.defaultError;if(J.code==="unrecognized_keys")return{message:b.errToObj($).message??q};return{message:q}}}:{}})}strip(){return new h({...this._def,unknownKeys:"strip"})}passthrough(){return new h({...this._def,unknownKeys:"passthrough"})}extend($){return new h({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new h({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:v.ZodObject})}setKey($,J){return this.augment({[$]:J})}catchall($){return new h({...this._def,catchall:$})}pick($){let J={};for(let Q of k.objectKeys($))if($[Q]&&this.shape[Q])J[Q]=this.shape[Q];return new h({...this._def,shape:()=>J})}omit($){let J={};for(let Q of k.objectKeys(this.shape))if(!$[Q])J[Q]=this.shape[Q];return new h({...this._def,shape:()=>J})}deepPartial(){return s$(this)}partial($){let J={};for(let Q of k.objectKeys(this.shape)){let q=this.shape[Q];if($&&!$[Q])J[Q]=q;else J[Q]=q.optional()}return new h({...this._def,shape:()=>J})}required($){let J={};for(let Q of k.objectKeys(this.shape))if($&&!$[Q])J[Q]=this.shape[Q];else{let W=this.shape[Q];while(W instanceof B$)W=W._def.innerType;J[Q]=W}return new h({...this._def,shape:()=>J})}keyof(){return M5(k.objectKeys(this.shape))}}h.create=($,J)=>{return new h({shape:()=>$,unknownKeys:"strip",catchall:O$.create(),typeName:v.ZodObject,...j(J)})};h.strictCreate=($,J)=>{return new h({shape:()=>$,unknownKeys:"strict",catchall:O$.create(),typeName:v.ZodObject,...j(J)})};h.lazycreate=($,J)=>{return new h({shape:$,unknownKeys:"strip",catchall:O$.create(),typeName:v.ZodObject,...j(J)})};class Q0 extends D{_parse($){let{ctx:J}=this._processInputParams($),Q=this._def.options;function q(W){for(let X of W)if(X.result.status==="valid")return X.result;for(let X of W)if(X.result.status==="dirty")return J.common.issues.push(...X.ctx.common.issues),X.result;let Y=W.map((X)=>new $$(X.ctx.common.issues));return N(J,{code:M.invalid_union,unionErrors:Y}),f}if(J.common.async)return Promise.all(Q.map(async(W)=>{let Y={...J,common:{...J.common,issues:[]},parent:null};return{result:await W._parseAsync({data:J.data,path:J.path,parent:Y}),ctx:Y}})).then(q);else{let W=void 0,Y=[];for(let G of Q){let H={...J,common:{...J.common,issues:[]},parent:null},B=G._parseSync({data:J.data,path:J.path,parent:H});if(B.status==="valid")return B;else if(B.status==="dirty"&&!W)W={result:B,ctx:H};if(H.common.issues.length)Y.push(H.common.issues)}if(W)return J.common.issues.push(...W.ctx.common.issues),W.result;let X=Y.map((G)=>new $$(G));return N(J,{code:M.invalid_union,unionErrors:X}),f}}get options(){return this._def.options}}Q0.create=($,J)=>{return new Q0({options:$,typeName:v.ZodUnion,...j(J)})};var b$=($)=>{if($ instanceof q0)return b$($.schema);else if($ instanceof M$)return b$($.innerType());else if($ instanceof Y0)return[$.value];else if($ instanceof E$)return $.options;else if($ instanceof X0)return k.objectValues($.enum);else if($ instanceof H0)return b$($._def.innerType);else if($ instanceof $0)return[void 0];else if($ instanceof J0)return[null];else if($ instanceof B$)return[void 0,...b$($.unwrap())];else if($ instanceof f$)return[null,...b$($.unwrap())];else if($ instanceof r0)return b$($.unwrap());else if($ instanceof B0)return b$($.unwrap());else if($ instanceof G0)return b$($._def.innerType);else return[]};class d0 extends D{_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==z.object)return N(J,{code:M.invalid_type,expected:z.object,received:J.parsedType}),f;let Q=this.discriminator,q=J.data[Q],W=this.optionsMap.get(q);if(!W)return N(J,{code:M.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),f;if(J.common.async)return W._parseAsync({data:J.data,path:J.path,parent:J});else return W._parseSync({data:J.data,path:J.path,parent:J})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,J,Q){let q=new Map;for(let W of J){let Y=b$(W.shape[$]);if(!Y.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let X of Y){if(q.has(X))throw Error(`Discriminator property ${String($)} has duplicate value ${String(X)}`);q.set(X,W)}}return new d0({typeName:v.ZodDiscriminatedUnion,discriminator:$,options:J,optionsMap:q,...j(Q)})}}function C1($,J){let Q=K$($),q=K$(J);if($===J)return{valid:!0,data:$};else if(Q===z.object&&q===z.object){let W=k.objectKeys(J),Y=k.objectKeys($).filter((G)=>W.indexOf(G)!==-1),X={...$,...J};for(let G of Y){let H=C1($[G],J[G]);if(!H.valid)return{valid:!1};X[G]=H.data}return{valid:!0,data:X}}else if(Q===z.array&&q===z.array){if($.length!==J.length)return{valid:!1};let W=[];for(let Y=0;Y<$.length;Y++){let X=$[Y],G=J[Y],H=C1(X,G);if(!H.valid)return{valid:!1};W.push(H.data)}return{valid:!0,data:W}}else if(Q===z.date&&q===z.date&&+$===+J)return{valid:!0,data:$};else return{valid:!1}}class W0 extends D{_parse($){let{status:J,ctx:Q}=this._processInputParams($),q=(W,Y)=>{if(c0(W)||c0(Y))return f;let X=C1(W.value,Y.value);if(!X.valid)return N(Q,{code:M.invalid_intersection_types}),f;if(p0(W)||p0(Y))J.dirty();return{status:J.value,value:X.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([W,Y])=>q(W,Y));else return q(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}W0.create=($,J,Q)=>{return new W0({left:$,right:J,typeName:v.ZodIntersection,...j(Q)})};class L$ extends D{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==z.array)return N(Q,{code:M.invalid_type,expected:z.array,received:Q.parsedType}),f;if(Q.data.length<this._def.items.length)return N(Q,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;if(!this._def.rest&&Q.data.length>this._def.items.length)N(Q,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J.dirty();let W=[...Q.data].map((Y,X)=>{let G=this._def.items[X]||this._def.rest;if(!G)return null;return G._parse(new _$(Q,Y,Q.path,X))}).filter((Y)=>!!Y);if(Q.common.async)return Promise.all(W).then((Y)=>{return i.mergeArray(J,Y)});else return i.mergeArray(J,W)}get items(){return this._def.items}rest($){return new L$({...this._def,rest:$})}}L$.create=($,J)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new L$({items:$,typeName:v.ZodTuple,rest:null,...j(J)})};class f0 extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==z.object)return N(Q,{code:M.invalid_type,expected:z.object,received:Q.parsedType}),f;let q=[],W=this._def.keyType,Y=this._def.valueType;for(let X in Q.data)q.push({key:W._parse(new _$(Q,X,Q.path,X)),value:Y._parse(new _$(Q,Q.data[X],Q.path,X)),alwaysSet:X in Q.data});if(Q.common.async)return i.mergeObjectAsync(J,q);else return i.mergeObjectSync(J,q)}get element(){return this._def.valueType}static create($,J,Q){if(J instanceof D)return new f0({keyType:$,valueType:J,typeName:v.ZodRecord,...j(Q)});return new f0({keyType:H$.create(),valueType:$,typeName:v.ZodRecord,...j(J)})}}class v0 extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==z.map)return N(Q,{code:M.invalid_type,expected:z.map,received:Q.parsedType}),f;let q=this._def.keyType,W=this._def.valueType,Y=[...Q.data.entries()].map(([X,G],H)=>{return{key:q._parse(new _$(Q,X,Q.path,[H,"key"])),value:W._parse(new _$(Q,G,Q.path,[H,"value"]))}});if(Q.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let G of Y){let H=await G.key,B=await G.value;if(H.status==="aborted"||B.status==="aborted")return f;if(H.status==="dirty"||B.status==="dirty")J.dirty();X.set(H.value,B.value)}return{status:J.value,value:X}})}else{let X=new Map;for(let G of Y){let{key:H,value:B}=G;if(H.status==="aborted"||B.status==="aborted")return f;if(H.status==="dirty"||B.status==="dirty")J.dirty();X.set(H.value,B.value)}return{status:J.value,value:X}}}}v0.create=($,J,Q)=>{return new v0({valueType:J,keyType:$,typeName:v.ZodMap,...j(Q)})};class p$ extends D{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==z.set)return N(Q,{code:M.invalid_type,expected:z.set,received:Q.parsedType}),f;let q=this._def;if(q.minSize!==null){if(Q.data.size<q.minSize.value)N(Q,{code:M.too_small,minimum:q.minSize.value,type:"set",inclusive:!0,exact:!1,message:q.minSize.message}),J.dirty()}if(q.maxSize!==null){if(Q.data.size>q.maxSize.value)N(Q,{code:M.too_big,maximum:q.maxSize.value,type:"set",inclusive:!0,exact:!1,message:q.maxSize.message}),J.dirty()}let W=this._def.valueType;function Y(G){let H=new Set;for(let B of G){if(B.status==="aborted")return f;if(B.status==="dirty")J.dirty();H.add(B.value)}return{status:J.value,value:H}}let X=[...Q.data.values()].map((G,H)=>W._parse(new _$(Q,G,Q.path,H)));if(Q.common.async)return Promise.all(X).then((G)=>Y(G));else return Y(X)}min($,J){return new p$({...this._def,minSize:{value:$,message:b.toString(J)}})}max($,J){return new p$({...this._def,maxSize:{value:$,message:b.toString(J)}})}size($,J){return this.min($,J).max($,J)}nonempty($){return this.min(1,$)}}p$.create=($,J)=>{return new p$({valueType:$,minSize:null,maxSize:null,typeName:v.ZodSet,...j(J)})};class t$ extends D{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==z.function)return N(J,{code:M.invalid_type,expected:z.function,received:J.parsedType}),f;function Q(X,G){return S0({data:X,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,n$(),A$].filter((H)=>!!H),issueData:{code:M.invalid_arguments,argumentsError:G}})}function q(X,G){return S0({data:X,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,n$(),A$].filter((H)=>!!H),issueData:{code:M.invalid_return_type,returnTypeError:G}})}let W={errorMap:J.common.contextualErrorMap},Y=J.data;if(this._def.returns instanceof d$){let X=this;return n(async function(...G){let H=new $$([]),B=await X._def.args.parseAsync(G,W).catch((L)=>{throw H.addIssue(Q(G,L)),H}),_=await Reflect.apply(Y,this,B);return await X._def.returns._def.type.parseAsync(_,W).catch((L)=>{throw H.addIssue(q(_,L)),H})})}else{let X=this;return n(function(...G){let H=X._def.args.safeParse(G,W);if(!H.success)throw new $$([Q(G,H.error)]);let B=Reflect.apply(Y,this,H.data),_=X._def.returns.safeParse(B,W);if(!_.success)throw new $$([q(B,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new t$({...this._def,args:L$.create($).rest(D$.create())})}returns($){return new t$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,J,Q){return new t$({args:$?$:L$.create([]).rest(D$.create()),returns:J||D$.create(),typeName:v.ZodFunction,...j(Q)})}}class q0 extends D{get schema(){return this._def.getter()}_parse($){let{ctx:J}=this._processInputParams($);return this._def.getter()._parse({data:J.data,path:J.path,parent:J})}}q0.create=($,J)=>{return new q0({getter:$,typeName:v.ZodLazy,...j(J)})};class Y0 extends D{_parse($){if($.data!==this._def.value){let J=this._getOrReturnCtx($);return N(J,{received:J.data,code:M.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:$.data}}get value(){return this._def.value}}Y0.create=($,J)=>{return new Y0({value:$,typeName:v.ZodLiteral,...j(J)})};function M5($,J){return new E$({values:$,typeName:v.ZodEnum,...j(J)})}class E$ extends D{_parse($){if(typeof $.data!=="string"){let J=this._getOrReturnCtx($),Q=this._def.values;return N(J,{expected:k.joinValues(Q),received:J.parsedType,code:M.invalid_type}),f}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let J=this._getOrReturnCtx($),Q=this._def.values;return N(J,{received:J.data,code:M.invalid_enum_value,options:Q}),f}return n($.data)}get options(){return this._def.values}get enum(){let $={};for(let J of this._def.values)$[J]=J;return $}get Values(){let $={};for(let J of this._def.values)$[J]=J;return $}get Enum(){let $={};for(let J of this._def.values)$[J]=J;return $}extract($,J=this._def){return E$.create($,{...this._def,...J})}exclude($,J=this._def){return E$.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...J})}}E$.create=M5;class X0 extends D{_parse($){let J=k.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==z.string&&Q.parsedType!==z.number){let q=k.objectValues(J);return N(Q,{expected:k.joinValues(q),received:Q.parsedType,code:M.invalid_type}),f}if(!this._cache)this._cache=new Set(k.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let q=k.objectValues(J);return N(Q,{received:Q.data,code:M.invalid_enum_value,options:q}),f}return n($.data)}get enum(){return this._def.values}}X0.create=($,J)=>{return new X0({values:$,typeName:v.ZodNativeEnum,...j(J)})};class d$ extends D{unwrap(){return this._def.type}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==z.promise&&J.common.async===!1)return N(J,{code:M.invalid_type,expected:z.promise,received:J.parsedType}),f;let Q=J.parsedType===z.promise?J.data:Promise.resolve(J.data);return n(Q.then((q)=>{return this._def.type.parseAsync(q,{path:J.path,errorMap:J.common.contextualErrorMap})}))}}d$.create=($,J)=>{return new d$({type:$,typeName:v.ZodPromise,...j(J)})};class M$ extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:J,ctx:Q}=this._processInputParams($),q=this._def.effect||null,W={addIssue:(Y)=>{if(N(Q,Y),Y.fatal)J.abort();else J.dirty()},get path(){return Q.path}};if(W.addIssue=W.addIssue.bind(W),q.type==="preprocess"){let Y=q.transform(Q.data,W);if(Q.common.async)return Promise.resolve(Y).then(async(X)=>{if(J.value==="aborted")return f;let G=await this._def.schema._parseAsync({data:X,path:Q.path,parent:Q});if(G.status==="aborted")return f;if(G.status==="dirty")return u$(G.value);if(J.value==="dirty")return u$(G.value);return G});else{if(J.value==="aborted")return f;let X=this._def.schema._parseSync({data:Y,path:Q.path,parent:Q});if(X.status==="aborted")return f;if(X.status==="dirty")return u$(X.value);if(J.value==="dirty")return u$(X.value);return X}}if(q.type==="refinement"){let Y=(X)=>{let G=q.refinement(X,W);if(Q.common.async)return Promise.resolve(G);if(G instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(Q.common.async===!1){let X=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(X.status==="aborted")return f;if(X.status==="dirty")J.dirty();return Y(X.value),{status:J.value,value:X.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((X)=>{if(X.status==="aborted")return f;if(X.status==="dirty")J.dirty();return Y(X.value).then(()=>{return{status:J.value,value:X.value}})})}if(q.type==="transform")if(Q.common.async===!1){let Y=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!P$(Y))return f;let X=q.transform(Y.value,W);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:J.value,value:X}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((Y)=>{if(!P$(Y))return f;return Promise.resolve(q.transform(Y.value,W)).then((X)=>({status:J.value,value:X}))});k.assertNever(q)}}M$.create=($,J,Q)=>{return new M$({schema:$,typeName:v.ZodEffects,effect:J,...j(Q)})};M$.createWithPreprocess=($,J,Q)=>{return new M$({schema:J,effect:{type:"preprocess",transform:$},typeName:v.ZodEffects,...j(Q)})};class B$ extends D{_parse($){if(this._getType($)===z.undefined)return n(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}B$.create=($,J)=>{return new B$({innerType:$,typeName:v.ZodOptional,...j(J)})};class f$ extends D{_parse($){if(this._getType($)===z.null)return n(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}f$.create=($,J)=>{return new f$({innerType:$,typeName:v.ZodNullable,...j(J)})};class H0 extends D{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;if(J.parsedType===z.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:J.path,parent:J})}removeDefault(){return this._def.innerType}}H0.create=($,J)=>{return new H0({innerType:$,typeName:v.ZodDefault,defaultValue:typeof J.default==="function"?J.default:()=>J.default,...j(J)})};class G0 extends D{_parse($){let{ctx:J}=this._processInputParams($),Q={...J,common:{...J.common,issues:[]}},q=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(a$(q))return q.then((W)=>{return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new $$(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:q.status==="valid"?q.value:this._def.catchValue({get error(){return new $$(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}G0.create=($,J)=>{return new G0({innerType:$,typeName:v.ZodCatch,catchValue:typeof J.catch==="function"?J.catch:()=>J.catch,...j(J)})};class R0 extends D{_parse($){if(this._getType($)!==z.nan){let Q=this._getOrReturnCtx($);return N(Q,{code:M.invalid_type,expected:z.nan,received:Q.parsedType}),f}return{status:"valid",value:$.data}}}R0.create=($)=>{return new R0({typeName:v.ZodNaN,...j($)})};var V4=Symbol("zod_brand");class r0 extends D{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;return this._def.type._parse({data:Q,path:J.path,parent:J})}unwrap(){return this._def.type}}class j0 extends D{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let W=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(W.status==="aborted")return f;if(W.status==="dirty")return J.dirty(),u$(W.value);else return this._def.out._parseAsync({data:W.value,path:Q.path,parent:Q})})();else{let q=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(q.status==="aborted")return f;if(q.status==="dirty")return J.dirty(),{status:"dirty",value:q.value};else return this._def.out._parseSync({data:q.value,path:Q.path,parent:Q})}}static create($,J){return new j0({in:$,out:J,typeName:v.ZodPipeline})}}class B0 extends D{_parse($){let J=this._def.innerType._parse($),Q=(q)=>{if(P$(q))q.value=Object.freeze(q.value);return q};return a$(J)?J.then((q)=>Q(q)):Q(J)}unwrap(){return this._def.innerType}}B0.create=($,J)=>{return new B0({innerType:$,typeName:v.ZodReadonly,...j(J)})};function H5($,J){let Q=typeof $==="function"?$(J):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function U5($,J={},Q){if($)return c$.create().superRefine((q,W)=>{let Y=$(q);if(Y instanceof Promise)return Y.then((X)=>{if(!X){let G=H5(J,q),H=G.fatal??Q??!0;W.addIssue({code:"custom",...G,fatal:H})}});if(!Y){let X=H5(J,q),G=X.fatal??Q??!0;W.addIssue({code:"custom",...X,fatal:G})}return});return c$.create()}var P4={object:h.lazycreate},v;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(v||(v={}));var D4=($,J={message:`Input not instance of ${$.name}`})=>U5((Q)=>Q instanceof $,J),w5=H$.create,z5=k$.create,k4=R0.create,C4=C$.create,N5=e$.create,E4=l$.create,T4=A0.create,I4=$0.create,y4=J0.create,g4=c$.create,h4=D$.create,m4=O$.create,Z4=b0.create,x4=G$.create,u4=h.create,l4=h.strictCreate,c4=Q0.create,p4=d0.create,d4=W0.create,r4=L$.create,i4=f0.create,o4=v0.create,n4=p$.create,a4=t$.create,s4=q0.create,t4=Y0.create,e4=E$.create,$3=X0.create,J3=d$.create,Q3=M$.create,W3=B$.create,q3=f$.create,Y3=M$.createWithPreprocess,X3=j0.create,H3=()=>w5().optional(),G3=()=>z5().optional(),B3=()=>N5().optional(),_3={string:($)=>H$.create({...$,coerce:!0}),number:($)=>k$.create({...$,coerce:!0}),boolean:($)=>e$.create({...$,coerce:!0}),bigint:($)=>C$.create({...$,coerce:!0}),date:($)=>l$.create({...$,coerce:!0})};var M3=f;var U3=S.object({before:S.string(),after:S.string(),hierarchy:S.array(S.string()),lineStart:S.number().optional(),lineEnd:S.number().optional()}).passthrough(),w3=S.object({id:S.string(),name:S.string()}).passthrough(),z3=S.object({url:S.string(),mime:S.string().optional()}).passthrough(),N3=S.object({id:S.string(),snippet:S.string(),note:S.string(),createdAt:S.string(),filePath:S.string().optional(),canvasFile:S.string().optional(),context:U3.optional(),images:S.array(S.string()).optional(),attachments:S.array(z3).optional(),source:S.enum(["local","remote"]).optional(),author:w3.optional()}).passthrough(),K3=S.array(N3.optional().catch(void 0)).transform(($)=>$.filter((J)=>J!==void 0)).catch([]),E1=S.object({annotations:K3,generalNote:S.string().catch("")}).passthrough(),K5=S.object({path:S.string()}),O5=S.object({url:S.string()}),L5=S.object({error:S.string()});import{useCallback as Z8,useMemo as x8,useState as u8}from"react";function V0($){return $.uploadUrl!==null}var T1=["image/png","image/jpeg","image/gif","image/webp"],F5="Only PNG, JPEG, GIF and WebP images can be attached";function v$($,J){$.style.height="auto",$.style.height=(J?Math.max(J,$.scrollHeight):$.scrollHeight)+"px"}import{useAnnotations as i0}from"@fabrika/annotations/runtime";import{jsxDEV as W9}from"react/jsx-dev-runtime";import{jsxDEV as B9,Fragment as G9}from"react/jsx-dev-runtime";import{useAnnotationHost as L3}from"@fabrika/annotations/runtime";import{useCallback as R$,useEffect as F3,useRef as y1,useState as o0}from"react";import{jsxDEV as a}from"react/jsx-dev-runtime";function S5($){if($.startsWith("/s/")||$.startsWith("http://")||$.startsWith("https://"))return $;return`/api/uploads/${$.split("/").pop()}`}async function S3($,J){let Q=$.uploadUrl;if(!Q)return{error:"Uploads are not available here"};let q=new FormData;q.append("image",J);try{let W=await fetch(Q(),{method:"POST",body:q}),Y=await W.json();if(!W.ok){let X=L5.safeParse(Y);return{error:X.success?X.data.error:`Upload failed (HTTP ${W.status})`}}return{path:$.isShared?O5.parse(Y).url:K5.parse(Y).path}}catch{return{error:"Upload failed"}}}function n0({note:$,onNoteChange:J,images:Q,onAddImage:q,onRemoveImage:W,sessionId:Y,placeholder:X="Add your note...",autoFocus:G=!1,autoResize:H=!1,readOnly:B=!1,onKeyDown:_,onTextareaClick:w,textareaRef:L,textareaClassName:F,textareaStyle:U,minHeight:K,attachButton:O="always",openFilePickerRef:R}){let I=L3(),y=!B&&V0(I),[l,Z]=o0(!1),[x,e]=o0(!1),[J$,Q$]=o0(null),[u,d]=o0(!1),r=y1(0),c=y1(null),W$=y1(null),j$=R$(()=>W$.current?.click(),[]);if(R)R.current=j$;let y$=R$((V)=>{if(c.current=V,L)L.current=V;if(V&&H)v$(V,K)},[L,H,K]);F3(()=>{if(G&&c.current){let V=c.current;if(V.focus(),V.value)V.setSelectionRange(V.value.length,V.value.length)}},[G]);let s=R$(async(V)=>{if(!T1.includes(V.type)){Q$(F5);return}Q$(null),e(!0);try{let A=await S3(I,V);if("path"in A)q(A.path);else Q$(A.error)}finally{e(!1)}},[I,q]),q$=R$((V)=>{for(let A of V.clipboardData?.items??[])if(A.type.startsWith("image/")){V.preventDefault();let T=A.getAsFile();if(T)s(T);return}},[s]),U$=R$((V)=>{if(V.preventDefault(),r.current++,r.current===1)Z(!0)},[]),w$=R$((V)=>{V.preventDefault()},[]),g$=R$((V)=>{if(V.preventDefault(),r.current--,r.current===0)Z(!1)},[]),h$=R$((V)=>{V.preventDefault(),r.current=0,Z(!1);for(let A of V.dataTransfer?.files??[])if(A.type.startsWith("image/"))s(A)},[s]),q1=R$((V)=>{if(J(V.currentTarget.value),H)V.currentTarget.style.height="auto",V.currentTarget.style.height=(K?Math.max(K,V.currentTarget.scrollHeight):V.currentTarget.scrollHeight)+"px"},[J,H,K]),Y1="w-full bg-transparent text-[13px] font-body text-text-primary resize-none focus:outline-none leading-relaxed p-0 border-none",z0={width:"100%",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",outline:"none",...H?{resize:"none",overflow:"hidden"}:{resize:"vertical"}},E0=y&&(O==="always"||O==="on-focus"&&u);return a("div",{style:{position:"relative"},onDragEnter:y?U$:void 0,onDragOver:y?w$:void 0,onDragLeave:y?g$:void 0,onDrop:y?h$:void 0,children:[a("textarea",{ref:y$,value:$,onChange:B?void 0:q1,onPaste:y?q$:void 0,onKeyDown:_,onClick:w,onFocus:()=>d(!0),onBlur:()=>{setTimeout(()=>d(!1),150)},readOnly:B,placeholder:X,className:F??Y1,style:U??z0,rows:H?1:void 0},void 0,!1,void 0,this),y&&a("input",{ref:W$,type:"file",accept:T1.join(","),multiple:!0,style:{display:"none"},onChange:(V)=>{let A=V.currentTarget.files;if(A)for(let T of A)s(T);V.currentTarget.value=""}},void 0,!1,void 0,this),(Q.length>0||E0)&&a("div",{style:{display:"flex",gap:"6px",flexWrap:"wrap",marginTop:"6px",alignItems:"center"},children:[Q.map((V)=>a("div",{style:{position:"relative",width:"56px",height:"56px",borderRadius:"6px",overflow:"hidden",border:"1px solid var(--color-border-subtle)",flexShrink:0},children:[a("img",{src:S5(V),alt:"",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}},void 0,!1,void 0,this),!B&&a("button",{onClick:(A)=>{A.stopPropagation(),W(V)},style:{position:"absolute",top:"2px",right:"2px",width:"16px",height:"16px",borderRadius:"50%",background:"rgba(0,0,0,0.6)",color:"white",border:"none",cursor:"pointer",fontSize:"11px",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,padding:0},title:"Remove image",children:"×"},void 0,!1,void 0,this)]},V,!0,void 0,this)),E0&&a(a0,{onClick:j$},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x&&a("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontFamily:"'Inter', sans-serif",marginTop:"4px"},children:"Uploading..."},void 0,!1,void 0,this),J$&&a("div",{role:"alert",style:{fontSize:"11px",color:"var(--color-accent-red)",fontFamily:"'Inter', sans-serif",marginTop:"4px"},children:J$},void 0,!1,void 0,this),l&&a("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-highlight-bg)",opacity:0.9,border:"2px dashed var(--color-highlight-border)",borderRadius:"6px",zIndex:10,pointerEvents:"none",fontSize:"12px",fontFamily:"'Inter', sans-serif",color:"var(--color-text-secondary)"},children:"Drop image"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function a0({onClick:$,size:J=16}){return a("button",{onClick:(Q)=>{Q.stopPropagation(),$()},style:{width:`${J*2}px`,height:`${J*2}px`,borderRadius:"6px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",flexShrink:0,transition:"color 0.15s"},title:"Attach image",onMouseEnter:(Q)=>{Q.currentTarget.style.color="var(--color-text-secondary)"},onMouseLeave:(Q)=>{Q.currentTarget.style.color="var(--color-text-tertiary)"},children:a("svg",{width:J,height:J,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),a("circle",{cx:"8.5",cy:"8.5",r:"1.5"},void 0,!1,void 0,this),a("polyline",{points:"21 15 16 10 5 21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{SessionContext as F9}from"@fabrika/annotations/runtime";import{useContext as A9,useEffect as b9,useRef as f9}from"react";import{jsxDEV as D9,Fragment as k9}from"react/jsx-dev-runtime";import{SessionContext as v3,useAnnotationHost as R3}from"@fabrika/annotations/runtime";import{useCallback as s0,useContext as j3,useEffect as V3,useMemo as v5,useRef as t0,useState as _0}from"react";import{createPortal as P3}from"react-dom";function b5($){let J=/^(\d+(?:\.\d+)?)px$/.exec($.trim());return J?Number(J[1]):void 0}function f5($,J,Q=280){let W=J||document.body,Y=$.getBoundingClientRect(),X=W.getBoundingClientRect(),G=W===document.body?0:W.scrollTop,H=Y.bottom-X.top+G+8,B=Math.max(0,Math.min(Y.left-X.left,X.width-Q-12));return W.style.position="relative",{style:{position:"absolute",top:`${H}px`,left:`${B}px`},parent:W}}import{jsxDEV as o,Fragment as D3}from"react/jsx-dev-runtime";function j5({anchorEl:$,scrollContainer:J,onClose:Q,ignoreSelector:q,zIndex:W="50",padding:Y="12px",width:X="280px",children:G}){let H=t0(null),B=t0(Q);B.current=Q;let{style:_,parent:w}=f5($,J,b5(X));return V3(()=>{let L=setTimeout(()=>{let F=(U)=>{if(H.current&&!H.current.contains(U.target)){if(q&&U.target.closest?.(q))return;B.current(),document.removeEventListener("mousedown",F)}};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},0);return()=>clearTimeout(L)},[q]),P3(o("div",{ref:H,style:{..._,zIndex:W,width:X,background:"var(--color-bg-elevated)",border:"1px solid var(--color-border-hover)",borderRadius:"8px",boxShadow:"0 4px 12px var(--color-shadow)",padding:Y,fontFamily:"'Inter', sans-serif"},children:G},void 0,!1,void 0,this),w)}var V5=[{label:"Clarity",items:["Unclear","Why?","Needs example","Missing context"]},{label:"Scope",items:["Overkill","Out of scope","Important","Risky"]},{label:"Action",items:["Simplify","Rethink","Expand on this","Skip this"]}],R5=V5.flatMap(($)=>$.items);function P5({anchorEl:$,scrollContainer:J,snippet:Q,truncateAt:q=100,header:W,initialNote:Y="",initialImages:X,onConfirm:G,onCancel:H,onDelete:B}){let _=j3(v3),w=R3(),L=V0(w),F=Y!==""||!!B,[U,K]=_0(Y),[O,R]=_0(X||[]),[I,y]=_0(null),[l,Z]=_0(F),[x,e]=_0(!1),J$=t0(null),Q$=t0(null),u=s0(()=>{if(U.trim()||O.length>0)G(U.trim(),O);else if(F&&B)B();else H()},[U,O,G,H,F,B]),d=s0(()=>{if(F){if(!U.trim()&&O.length===0&&B){B(),H();return}G(U,O);return}H()},[U,O,F,G,H,B]),r=!F,c=U.trim().length>0?R5.filter((A)=>A.toLowerCase().startsWith(U.trim().toLowerCase())):R5,W$=!r||l?[]:c.length===1&&c[0]?.toLowerCase()===U.trim().toLowerCase()?[]:c,j$=new Set(W$),y$=V5.map((A)=>({label:A.label,items:A.items.filter((T)=>j$.has(T))})).filter((A)=>A.items.length>0),s=y$.map((A)=>A.items),q$=(A)=>s[A]?.length??0,U$=s.flat(),w$=v5(()=>{if(I===null)return 0;let A=0;for(let T=0;T<s.length;T++){if(I<A+q$(T))return T;A+=q$(T)}return 0},[I,s]),g$=v5(()=>{if(I===null)return 0;let A=0;for(let T=0;T<w$;T++)A+=q$(T);return I-A},[I,w$,s]),h$=(A,T)=>{let p=0;for(let z$=0;z$<A;z$++)p+=q$(z$);return p+T},[q1,Y1]=_0(U);if(U!==q1)Y1(U),y(null),Z(F);let z0=s0((A)=>{K(A)},[]),E0=Q.length>q?Q.slice(0,q)+"...":Q,V=s0((A)=>{if(U$.length>0&&(A.key==="ArrowDown"||A.key==="ArrowUp"||A.key==="ArrowLeft"||A.key==="ArrowRight")){if(A.preventDefault(),I===null){y(0);return}if(A.key==="ArrowDown"){let p=Math.min(g$+1,q$(w$)-1);y(h$(w$,p))}else if(A.key==="ArrowUp"){let p=Math.max(g$-1,0);y(h$(w$,p))}else if(A.key==="ArrowRight"){let p=Math.min(w$+1,s.length-1),z$=Math.min(g$,q$(p)-1);y(h$(p,z$))}else if(A.key==="ArrowLeft"){let p=Math.max(w$-1,0),z$=Math.min(g$,q$(p)-1);y(h$(p,z$))}return}let T=I===null?void 0:U$[I];if(T!==void 0){if(A.key==="Tab"){A.preventDefault(),z0(T);return}if(A.key==="Enter"&&!A.shiftKey){A.preventDefault(),G(T,O);return}}if(A.key==="Enter"&&!A.shiftKey){A.preventDefault(),u();return}if(A.key==="Escape")if(U$.length>0&&!l)Z(!0);else if(F)d();else H()},[U$,I,g$,w$,s,h$,z0,G,O,u,l,F,d,H]);return o(j5,{anchorEl:$,scrollContainer:J,onClose:F?d:H,ignoreSelector:F?"[data-annotation-id]":void 0,zIndex:F?"60":"50",padding:F?"10px 12px":"12px",width:"420px",children:[!F&&(W??o("div",{style:{fontSize:"11px",color:"var(--color-text-tertiary)",fontStyle:"italic",marginBottom:"8px",lineHeight:"1.4",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:["“",E0,"”"]},void 0,!0,void 0,this)),o(n0,{note:U,onNoteChange:K,images:O,onAddImage:(A)=>R((T)=>[...T,A]),onRemoveImage:(A)=>R((T)=>T.filter((p)=>p!==A)),sessionId:_,autoFocus:!0,autoResize:F,textareaRef:J$,onKeyDown:V,attachButton:"none",openFilePickerRef:Q$,textareaStyle:F?{width:"100%",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"none",outline:"none",overflow:"hidden"}:{width:"100%",minHeight:"60px",background:"transparent",border:"none",color:"var(--color-text-primary)",fontFamily:"'Inter', sans-serif",fontSize:"13px",lineHeight:"1.5",resize:"vertical",outline:"none"},placeholder:"Add your note..."},void 0,!1,void 0,this),o("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:F?"6px":"8px"},children:[L&&o(a0,{onClick:()=>Q$.current?.(),size:14},void 0,!1,void 0,this),o("div",{style:{flex:1}},void 0,!1,void 0,this),F?o("button",{onClick:()=>{if(B)B();H()},onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1),style:{fontSize:"11px",color:x?"var(--color-accent-red)":"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"2px 0",fontFamily:"'Inter', sans-serif"},children:"Delete"},void 0,!1,void 0,this):o(D3,{children:[o("button",{onClick:H,style:{fontSize:"11px",color:"var(--color-text-tertiary)",background:"none",border:"none",cursor:"pointer",padding:"4px 12px",fontFamily:"'Inter', sans-serif"},children:"Cancel"},void 0,!1,void 0,this),o("button",{onClick:u,style:{fontSize:"11px",fontWeight:500,padding:"4px 12px",borderRadius:"6px",background:"var(--color-highlight-bg)",color:"var(--color-text-primary)",border:"1px solid var(--color-highlight-border)",cursor:"pointer",fontFamily:"'Inter', sans-serif"},children:"Add"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),U$.length>0&&o("div",{style:{marginTop:"6px",borderTop:"1px solid var(--color-border-subtle)",paddingTop:"8px",display:"flex",gap:"4px"},children:y$.map((A)=>o("div",{style:{flex:1},children:[o("div",{style:{fontSize:"10px",fontWeight:600,color:"var(--color-text-disabled)",textTransform:"uppercase",letterSpacing:"0.05em",padding:"2px 6px",marginBottom:"2px",fontFamily:"'Inter', sans-serif"},children:A.label},void 0,!1,void 0,this),A.items.map((T)=>{let p=U$.indexOf(T);return o("div",{onMouseDown:(z$)=>{z$.preventDefault(),z$.stopPropagation(),z0(T)},onMouseEnter:()=>y(p),style:{padding:"3px 6px",fontSize:"12px",borderRadius:"4px",fontFamily:"'Inter', sans-serif",color:p===I?"var(--color-text-primary)":"var(--color-text-secondary)",background:p===I?"var(--color-highlight-selected)":"transparent",cursor:"pointer"},children:[o("span",{style:{fontWeight:500},children:T.slice(0,U.trim().length)},void 0,!1,void 0,this),T.slice(U.trim().length)]},T,!0,void 0,this)})]},A.label,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function P0({anchorEl:$,scrollContainer:J,snippet:Q,truncateAt:q,header:W,onAdd:Y,onCancel:X}){return o(P5,{anchorEl:$,scrollContainer:J,snippet:Q,truncateAt:q,header:W,onConfirm:(G,H)=>Y(G,H),onCancel:X},void 0,!1,void 0,this)}import{useEffect as i9,useRef as o9,useState as n9}from"react";import{jsxDEV as J7}from"react/jsx-dev-runtime";import{useCallback as X7,useEffect as H7,useRef as G7,useState as B7}from"react";import{jsxDEV as O7,Fragment as K7}from"react/jsx-dev-runtime";import{jsxDEV as D5}from"react/jsx-dev-runtime";function M0({note:$,onChange:J}){return D5("div",{className:"mt-1.5",children:D5("textarea",{value:$,onChange:(Q)=>J(Q.currentTarget.value),className:"w-full bg-transparent text-[12px] font-body text-text-primary resize-none focus:outline-none border-none placeholder:text-text-disabled transition-colors min-h-[20px] p-0 leading-relaxed",placeholder:"Add a note...",rows:1,onInput:(Q)=>v$(Q.currentTarget),ref:(Q)=>{if(Q)v$(Q)}},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as m}from"react/jsx-dev-runtime";function g5($){return $.map((J)=>typeof J==="string"?{value:J,label:J}:{value:J.value,label:J.label??J.value})}function Z3({id:$,label:J,options:Q,required:q}){let{responses:W,setResponse:Y}=k5();C5($);let X=T5(()=>g5(Q),[Q]),G=W.get($),H=G?.value,B=G?.note||"",[_,w]=y5(!1),L=I5(null);if(!W.has($))Y($,{id:$,type:"radio",label:J,value:null,options:X.map((K)=>K.value),required:q});let F=(K)=>{Y($,{...G,value:K})};E5(()=>{let K=L.current;if(!K)return;let O=(R)=>{let y=R.target.closest("[data-md-label]")?.getAttribute("data-md-label"),l=X.find((Z)=>Z.label===y);if(l)F(l.value)};return K.addEventListener("kb-select",O),()=>K.removeEventListener("kb-select",O)},[X,F]);let U=G?.required&&!H;return m("div",{ref:L,"data-md":"choice","data-md-label":J,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[m("div",{className:"flex items-baseline gap-2 mb-2",children:[m("span",{className:"text-[13px] font-body font-medium text-text-primary",children:J},void 0,!1,void 0,this),q&&m("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m("div",{className:"space-y-1",children:X.map(({value:K,label:O})=>m("label",{"data-md":"choice-option","data-md-label":O,onClick:()=>F(K),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${H===K?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[m("span",{className:`w-4 h-4 rounded-full border-[1.5px] flex items-center justify-center flex-shrink-0 transition-all ${H===K?"border-accent-amber bg-accent-amber":"border-border-strong"}`,children:H===K&&m("span",{className:"w-1.5 h-1.5 rounded-full bg-text-inverse"},void 0,!1,void 0,this)},void 0,!1,void 0,this),m("span",{className:"text-[13px] font-body text-text-secondary",children:O},void 0,!1,void 0,this)]},K,!0,void 0,this))},void 0,!1,void 0,this),m(M0,{show:_,note:B,onToggle:()=>w(!_),onChange:(K)=>Y($,{...G,note:K})},void 0,!1,void 0,this),U&&m("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select an option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function x3({id:$,label:J,options:Q,required:q}){let{responses:W,setResponse:Y}=k5();C5($);let X=T5(()=>g5(Q),[Q]),G=W.get($),H=G?.value||[],B=G?.note||"",[_,w]=y5(!1),L=I5(null);if(!W.has($))Y($,{id:$,type:"checkbox",label:J,value:[],options:X.map((K)=>K.value),required:q});let F=(K)=>{let O=H.includes(K)?H.filter((R)=>R!==K):[...H,K];Y($,{...G,value:O})};E5(()=>{let K=L.current;if(!K)return;let O=(R)=>{let y=R.target.closest("[data-md-label]")?.getAttribute("data-md-label"),l=X.find((Z)=>Z.label===y);if(l)F(l.value)};return K.addEventListener("kb-select",O),()=>K.removeEventListener("kb-select",O)},[X,F]);let U=G?.required&&H.length===0;return m("div",{ref:L,"data-md":"multichoice","data-md-label":J,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[m("div",{className:"flex items-baseline gap-2 mb-2",children:[m("span",{className:"text-[13px] font-body font-medium text-text-primary",children:J},void 0,!1,void 0,this),q&&m("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m("div",{className:"space-y-1",children:X.map(({value:K,label:O})=>{let R=H.includes(K);return m("label",{"data-md":"multichoice-option","data-md-label":O,onClick:()=>F(K),className:`flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer transition-all duration-150 ${R?"bg-highlight-selected":"hover:bg-bg-elevated"}`,children:[m("span",{className:`w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all ${R?"bg-accent-amber":"border-[1.5px] border-border-strong"}`,children:R&&m("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:m("path",{d:"M2.5 5L4.5 7L7.5 3",style:{stroke:"var(--color-text-inverse)"},strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),m("span",{className:"text-[13px] font-body text-text-secondary",children:O},void 0,!1,void 0,this)]},K,!0,void 0,this)})},void 0,!1,void 0,this),m(M0,{show:_,note:B,onToggle:()=>w(!_),onChange:(K)=>Y($,{...G,note:K})},void 0,!1,void 0,this),U&&m("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select at least one option."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as u3,useRef as l3}from"react";function e0(){return window.hljs}function h5(){return window.mermaid}import{jsxDEV as $1}from"react/jsx-dev-runtime";function c3({language:$,children:J}){let Q=typeof J==="string"?J:String(J??""),q=l3(null);return u3(()=>{let W=q.current,Y=e0();if(!W||!Y)return;W.removeAttribute("data-highlighted"),W.className=$?`language-${$}`:"",W.textContent=Q,Y.highlightElement(W)},[Q,$]),$1("div",{className:"relative mt-3 group/code","data-md":"codeblock","data-md-language":$||"",children:[$&&$1("span",{className:"absolute top-2 right-3 text-tiny text-text-tertiary opacity-0 group-hover/code:opacity-60 transition-opacity duration-150 z-10 font-mono",children:$},void 0,!1,void 0,this),$1("pre",{className:"bg-bg-code rounded-md p-4 overflow-x-auto text-code font-mono leading-relaxed",children:$1("code",{ref:q,className:$?`language-${$}`:"",children:Q},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function m5($,J){let Q=$.split(`
|
|
60
60
|
`),q=J.split(`
|
|
61
|
-
`),W=
|
|
61
|
+
`),W=p3(Q,q),Y=[],X=0,G=0,H=0;while(X<Q.length||G<q.length){let B=Q[X],_=q[G];if(H<W.length&&B!==void 0&&_!==void 0&&B===W[H]&&_===W[H])Y.push({type:"same",line:B}),X++,G++,H++;else if(B!==void 0&&(H>=W.length||B!==W[H]))Y.push({type:"removed",line:B}),X++;else if(_!==void 0)Y.push({type:"added",line:_}),G++}return Y}function p3($,J){let Q=$.length,q=J.length,W=Array.from({length:Q+1},()=>Array(q+1).fill(0));for(let H=1;H<=Q;H++){let B=W[H]??[],_=W[H-1]??[];for(let w=1;w<=q;w++)B[w]=$[H-1]===J[w-1]?(_[w-1]??0)+1:Math.max(_[w]??0,B[w-1]??0)}let Y=[],X=Q,G=q;while(X>0&&G>0){let H=$[X-1];if(H!==void 0&&H===J[G-1])Y.unshift(H),X--,G--;else if((W[X-1]?.[G]??0)>(W[X]?.[G-1]??0))X--;else G--}return Y}import{jsxDEV as D0}from"react/jsx-dev-runtime";function d3({before:$,after:J,language:Q}){let q=m5($,J);return D0("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden group/diff","data-md":"diff","data-md-language":Q||"",children:[Q&&D0("div",{className:"px-4 py-2 text-meta font-mono text-text-tertiary opacity-0 group-hover/diff:opacity-60 transition-opacity",children:["diff (",Q,")"]},void 0,!0,void 0,this),D0("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono",children:q.map((W,Y)=>D0("div",{className:W.type==="removed"?"bg-accent-red-muted text-accent-red":W.type==="added"?"bg-accent-green-muted text-accent-green":"text-text-tertiary",children:[D0("span",{className:"select-none w-6 inline-block text-center opacity-60",children:W.type==="removed"?"-":W.type==="added"?"+":" "},void 0,!1,void 0,this),W.line]},Y,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{ActiveViewCtx as o3,SessionContext as n3}from"#canvas/runtime";import{useContext as x5,useEffect as u5,useRef as a3,useState as J1}from"react";var r3=S.object({id:S.string(),type:S.enum(["select","radio","checkbox","text","range"]),label:S.string(),value:S.unknown(),options:S.array(S.string()).optional(),required:S.boolean().optional(),note:S.string().optional()}).passthrough().transform(($)=>({...$,value:$.value})),i3=S.object({id:S.string(),markdown:S.string(),label:S.string().optional(),required:S.boolean().optional()}).passthrough(),AJ=E1.extend({responses:S.array(S.tuple([S.string(),r3]).optional().catch(void 0)).transform(($)=>$.filter((J)=>J!==void 0)).catch([]),feedbackEntries:S.array(S.tuple([S.string(),i3]).optional().catch(void 0)).transform(($)=>$.filter((J)=>J!==void 0)).optional().catch([])});var bJ=S.object({feedback:S.string().nullish()}),Z5=S.union([S.object({error:S.string().min(1)}),S.object({content:S.string(),language:S.string().nullish()})]);import{jsxDEV as T$}from"react/jsx-dev-runtime";var s3={ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",py:"python",rs:"rust",go:"go",rb:"ruby",java:"java",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",css:"css",html:"html",sh:"bash",bash:"bash",toml:"toml",sql:"sql",xml:"xml",c:"c",cpp:"cpp",h:"c"};function t3({path:$,lines:J,__content:Q}){let q=x5(n3),{setActiveView:W}=x5(o3),[Y,X]=J1(Q??null),[G,H]=J1(()=>{let U=$.split(".").pop()||"";return s3[U]||"text"}),[B,_]=J1(null),[w,L]=J1(!Q),F=a3(null);if(u5(()=>{if(Q!==void 0)return;L(!0),_(null),fetch(`/api/file?session=${q}&path=${encodeURIComponent($)}`).then((U)=>U.json()).then((U)=>{let K=Z5.parse(U);if("error"in K)_(K.error);else{let O=K.content;if(J)O=O.split(`
|
|
62
62
|
`).slice(J[0]-1,J[1]).join(`
|
|
63
|
-
`);X(O),H(K.language||"text")}}).catch(()=>_("Failed to fetch file")).finally(()=>L(!1))},[q,$,J?.[0],J?.[1],Q]),m5(()=>{let U=F.current,K=e0();if(!U||!K||!Y)return;U.removeAttribute("data-highlighted"),U.className=G?`language-${G}`:"",U.textContent=Y,K.highlightElement(U)},[Y,G]),w)return I$("div",{className:"text-text-tertiary text-body mt-3 bg-bg-code rounded-md p-4",children:["Loading ",$,"..."]},void 0,!0,void 0,this);if(B)return I$("div",{className:"text-accent-red text-body mt-3 bg-accent-red-muted rounded-md p-4",children:[$,": ",B]},void 0,!0,void 0,this);return I$("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden","data-md":"filepreview","data-md-path":$,...J?{"data-md-lines":`${J[0]}-${J[1]}`}:{},children:[I$("div",{className:"px-4 py-2 flex items-center justify-between",children:[I$("button",{className:"font-mono text-meta text-text-tertiary hover:text-text-secondary hover:underline cursor-pointer text-left",onClick:()=>W({type:"file",path:$}),title:`Open ${$}`,children:$},void 0,!1,void 0,this),J&&I$("span",{className:"font-mono text-meta text-text-tertiary opacity-60",children:["L",J[0],"–",J[1]]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),I$("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono !bg-transparent",style:{background:"transparent"},children:I$("code",{ref:F,className:G?`language-${G}`:"",children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{SessionContext as a3}from"#canvas/runtime";import{useContext as s3,useState as t3}from"react";import{jsxDEV as k0}from"react/jsx-dev-runtime";function e3({src:$,alt:J,caption:Q,width:q,height:W}){let Y=s3(a3),[X,G]=t3(!1),H=`/api/image?session=${encodeURIComponent(Y)}&path=${encodeURIComponent($)}`;if(X)return k0("div",{className:"mt-3 text-accent-red text-body bg-accent-red-muted rounded-md p-4",children:[$,": Failed to load image"]},void 0,!0,void 0,this);return k0("figure",{className:"mt-3 relative","data-md":"image","data-md-src":$,children:[k0("div",{"data-annotation-image":!0,className:"rounded-md overflow-hidden border border-border-subtle bg-bg-code inline-block",children:k0("img",{src:H,alt:J||$,onError:()=>G(!0),draggable:!1,className:"block max-w-full h-auto",...q?{width:q}:{},...W?{height:W}:{}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Q&&k0("figcaption",{className:"mt-1.5 text-meta text-text-tertiary font-body",children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useMemo as $6}from"react";import{jsxDEV as Z5}from"react/jsx-dev-runtime";k.setOptions({gfm:!0,breaks:!1});function J6({children:$,file:J,__content:Q}){let q=Q??(typeof $==="string"?$:String($??"")),W=$6(()=>{if(!q)return"";return k.parse(q,{async:!1})},[q]);if(!q)return Z5("div",{className:"text-text-tertiary text-tiny mt-3",children:J?`Could not load: ${J}`:"No markdown content"},void 0,!1,void 0,this);return Z5("div",{className:"mt-3 prose-canvas","data-md":"markdown",...J?{"data-md-file":J}:{},"data-md-source":q,dangerouslySetInnerHTML:{__html:W}},void 0,!1,void 0,this)}import{useAnnotations as Q6,useCanvasFile as W6}from"#canvas/runtime";import{useCallback as A$,useEffect as y1,useRef as E0,useState as z0}from"react";import q6 from"react-dom";import{jsxDEV as P,Fragment as c5}from"react/jsx-dev-runtime";var N0=0.2,Q1=0.25,W1=4;function u5({zoom:$,onZoomIn:J,onZoomOut:Q,onZoomReset:q,onFullscreen:W}){return P("div",{className:"flex items-center gap-0.5 bg-bg-surface border border-border-subtle rounded-md px-1 py-0.5",style:{fontSize:"12px"},children:[P("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:Q,title:"Zoom out",disabled:$<=Q1,children:P("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:P("line",{x1:"5",y1:"12",x2:"19",y2:"12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P("button",{className:"px-1.5 h-7 rounded hover:bg-bg-elevated text-text-tertiary hover:text-text-primary transition-colors tabular-nums",onClick:q,title:"Reset zoom",children:[Math.round($*100),"%"]},void 0,!0,void 0,this),P("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:J,title:"Zoom in",disabled:$>=W1,children:P("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[P("line",{x1:"12",y1:"5",x2:"12",y2:"19"},void 0,!1,void 0,this),P("line",{x1:"5",y1:"12",x2:"19",y2:"12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W&&P(c5,{children:[P("div",{className:"w-px h-4 bg-border-subtle mx-0.5"},void 0,!1,void 0,this),P("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:W,title:"Fullscreen",children:P("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[P("polyline",{points:"15 3 21 3 21 9"},void 0,!1,void 0,this),P("polyline",{points:"9 21 3 21 3 15"},void 0,!1,void 0,this),P("line",{x1:"21",y1:"3",x2:"14",y2:"10"},void 0,!1,void 0,this),P("line",{x1:"3",y1:"21",x2:"10",y2:"14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function l5($=1){let[J,Q]=z0($),q=A$(()=>Q((X)=>Math.min(W1,+(X+N0).toFixed(2))),[]),W=A$(()=>Q((X)=>Math.max(Q1,+(X-N0).toFixed(2))),[]),Y=A$(()=>Q(1),[]);return{zoom:J,zoomIn:q,zoomOut:W,zoomReset:Y,setZoom:Q}}function Y6({svgHtml:$,source:J,onClose:Q}){let q=E0(null),{zoom:W,zoomIn:Y,zoomOut:X,zoomReset:G,setZoom:H}=l5(1),[B,_]=z0({x:0,y:0}),w=E0(null);y1(()=>{let R=(T)=>{if(T.key==="Escape")Q()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[Q]);let L=A$((R)=>{R.preventDefault();let T=R.deltaY>0?-N0:N0;H((I)=>Math.max(Q1,Math.min(W1,+(I+T).toFixed(2))))},[H]),F=A$((R)=>{if(R.button!==0)return;w.current={startX:R.clientX,startY:R.clientY,panX:B.x,panY:B.y},R.preventDefault()},[B]),U=A$((R)=>{if(!w.current)return;_({x:w.current.panX+(R.clientX-w.current.startX),y:w.current.panY+(R.clientY-w.current.startY)})},[]),K=A$(()=>{w.current=null},[]),O=A$(()=>{G(),_({x:0,y:0})},[G]);return q6.createPortal(P("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"var(--color-bg-base)",display:"flex",flexDirection:"column"},onMouseMove:U,onMouseUp:K,onMouseLeave:K,children:[P("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle",style:{flexShrink:0,background:"var(--color-bg-surface)"},children:[P("span",{className:"text-body text-text-secondary",style:{fontSize:"13px"},children:"Mermaid Diagram"},void 0,!1,void 0,this),P("div",{className:"flex items-center gap-2",children:[P(u5,{zoom:W,onZoomIn:Y,onZoomOut:X,onZoomReset:O},void 0,!1,void 0,this),P("button",{className:"flex items-center justify-center w-8 h-8 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:Q,title:"Close (Esc)",children:P("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[P("line",{x1:"18",y1:"6",x2:"6",y2:"18"},void 0,!1,void 0,this),P("line",{x1:"6",y1:"6",x2:"18",y2:"18"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P("div",{style:{flex:1,overflow:"hidden",cursor:w.current?"grabbing":"grab"},onWheel:L,onMouseDown:F,children:P("div",{ref:q,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",transform:`translate(${B.x}px, ${B.y}px) scale(${W})`,transformOrigin:"center center",transition:w.current?"none":"transform 0.1s ease-out"},dangerouslySetInnerHTML:{__html:$}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),document.body)}function X6({children:$}){let J=E0(null),[Q,q]=z0(null),[W,Y]=z0(!1),[X,G]=z0(""),H=typeof $==="string"?$:String($??""),{annotations:B,addAnnotationWithId:_,activeAnnotationId:w,setActiveAnnotationId:L}=Q6(),F=W6(),[U,K]=z0(null),{zoom:O,zoomIn:R,zoomOut:T,zoomReset:I,setZoom:l}=l5(1),x=E0(B);x.current=B;let u=A$((h,c,e)=>{let d=`[Diagram ${e.toLowerCase()}] ${c}`,w$=x.current.find((Q$)=>Q$.snippet===d);if(w$)L(w$.id);else K({anchorEl:h,snippet:c,prefix:e})},[L]),t=E0(u);t.current=u,y1(()=>{let h=!1,c=async()=>{try{let d=I5();if(!d){q("Mermaid library not loaded");return}let w$=document.documentElement.dataset.theme==="light"?"default":"dark";d.initialize({startOnLoad:!1,theme:w$});let Q$=`mermaid-${Math.random().toString(36).slice(2)}`,{svg:g$}=await d.render(Q$,H.trim());if(!h&&J.current)J.current.innerHTML=g$,G(g$),H6(J.current,(W$,q$,z$)=>t.current(W$,q$,z$)),x5(J.current,x.current);q(null)}catch(d){if(!h)q(d instanceof Error&&d.message||"Invalid diagram")}};c();let e=new MutationObserver((d)=>{for(let w$ of d)if(w$.attributeName==="data-theme")c()});return e.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{h=!0,e.disconnect()}},[H]),y1(()=>{if(J.current)x5(J.current,B,w)},[B,w]);let J$=A$((h)=>{if(!h.ctrlKey&&!h.metaKey)return;h.preventDefault();let c=h.deltaY>0?-N0:N0;l((e)=>Math.max(Q1,Math.min(W1,+(e+c).toFixed(2))))},[l]);if(Q)return P("div",{className:"bg-accent-red-muted rounded-md p-4 mt-3 text-body text-accent-red",children:["Mermaid error: ",Q,P("pre",{className:"mt-2 text-tiny text-text-tertiary whitespace-pre-wrap",children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let U$=J.current?.closest("#plan-scroll-container");return P(c5,{children:[P("div",{className:"mt-3 mermaid-container","data-md":"mermaid","data-md-source":H.trim(),children:[P("div",{className:"flex justify-end mb-1",children:P(u5,{zoom:O,onZoomIn:R,onZoomOut:T,onZoomReset:I,onFullscreen:()=>Y(!0)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P("div",{style:{overflow:"auto",maxHeight:"70vh"},onWheel:J$,children:P("div",{ref:J,className:"flex justify-center",style:{transform:`scale(${O})`,transformOrigin:"top center",transition:"transform 0.1s ease-out",minHeight:O<1?void 0:void 0}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&P(D0,{anchorEl:U.anchorEl,scrollContainer:U$,snippet:U.snippet,header:P("div",{style:{fontSize:"12px",color:"var(--color-text-tertiary)",marginBottom:"8px",lineHeight:"1.4",display:"flex",alignItems:"center",gap:"6px"},children:[P("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--color-accent-amber)",flexShrink:0}},void 0,!1,void 0,this),U.snippet]},void 0,!0,void 0,this),onAdd:(h,c)=>{let e=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;_(e,`[Diagram ${U.prefix.toLowerCase()}] ${U.snippet}`,h,void 0,void 0,c,F||void 0),K(null)},onCancel:()=>K(null)},void 0,!1,void 0,this),W&&X&&P(Y6,{svgHtml:X,source:H,onClose:()=>Y(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function H6($,J){let Q=(q,W,Y)=>{q.style.cursor="pointer",q.addEventListener("mouseenter",()=>{q.style.filter="brightness(1.2)"}),q.addEventListener("mouseleave",()=>{q.style.filter=""}),q.addEventListener("click",(X)=>{X.stopPropagation(),X.preventDefault(),J(q,W(),Y)})};for(let q of $.querySelectorAll(".node"))Q(q,()=>{return(q.querySelector(".nodeLabel")||q.querySelector("foreignObject span")||q.querySelector("text"))?.textContent?.trim()||"Node"},"Node");for(let q of $.querySelectorAll(".edgePath")){let W=q,Y=W.querySelector("path");if(Y){Y.style.strokeWidth=Math.max(parseFloat(Y.style.strokeWidth||"1"),8)+"px",Y.style.strokeOpacity="0";let G=Y.cloneNode(!0);G.style.strokeWidth="",G.style.strokeOpacity="",W.insertBefore(G,Y)}let X=W.id||"";Q(W,()=>{let G=$.querySelectorAll(".edgeLabel");for(let H of G)if(H.id&&X&&H.id.replace("label","").includes(X.replace("L-","").replace("edge",""))){let B=H.textContent?.trim();if(B)return B}return"Connection"},"Edge")}for(let q of $.querySelectorAll(".edgeLabel")){let W=q.textContent?.trim();if(!W)continue;Q(q,()=>W,"Edge")}for(let q of $.querySelectorAll(".actor")){let W=q.closest("g")?.querySelector("text")||q.parentElement?.querySelector("text");if(!W)continue;let Y=q.closest("g");if(!Y||Y.hasAttribute("data-clickable"))continue;Y.setAttribute("data-clickable","true"),Q(Y,()=>W.textContent?.trim()||"Participant","Node")}for(let q of $.querySelectorAll(".messageText")){let W=q.textContent?.trim();if(!W)continue;Q(q,()=>W,"Edge")}for(let q of $.querySelectorAll(".entityBox")){let W=q.closest("g");if(!W||W.hasAttribute("data-clickable"))continue;let Y=W.querySelector(".entityLabel");if(!Y)continue;W.setAttribute("data-clickable","true"),Q(W,()=>Y.textContent?.trim()||"Entity","Node")}for(let q of $.querySelectorAll(".relationshipLabel")){let W=q.textContent?.trim();if(!W)continue;let X=q.closest("g")||q;if(X.hasAttribute("data-clickable"))continue;X.setAttribute("data-clickable","true"),Q(X,()=>W,"Edge")}for(let q of $.querySelectorAll(".classGroup")){let W=q;if(W.hasAttribute("data-clickable"))continue;let Y=W.querySelector(".classTitle, .classTitleText, text");if(!Y)continue;W.setAttribute("data-clickable","true"),Q(W,()=>Y.textContent?.trim()||"Class","Node")}for(let q of $.querySelectorAll(".statediagram-state")){let W=q;if(W.hasAttribute("data-clickable"))continue;let Y=W.querySelector(".state-title, text");if(!Y)continue;W.setAttribute("data-clickable","true"),Q(W,()=>Y.textContent?.trim()||"State","Node")}for(let q of $.querySelectorAll(".mindmap-node")){let W=q;if(W.hasAttribute("data-clickable"))continue;let Y=W.querySelector(".mindmap-node-label, text");if(!Y)continue;W.setAttribute("data-clickable","true"),Q(W,()=>Y.textContent?.trim()||"Node","Node")}}function x5($,J,Q){let q=new Map;for(let Y of J){let X=Y.snippet.match(/^\[Diagram (?:node|edge)\] (.+)$/)?.[1];if(X)q.set(X,Y.id)}for(let Y of $.querySelectorAll("[data-annotated]"))Y.style.outline="",Y.style.outlineOffset="",Y.style.borderRadius="",Y.removeAttribute("data-annotated");if(q.size===0)return;for(let Y of $.querySelectorAll(".node")){let G=(Y.querySelector(".nodeLabel")||Y.querySelector("foreignObject span")||Y.querySelector("text"))?.textContent?.trim();if(!G||!q.has(G))continue;let H=q.get(G),B=Y;B.setAttribute("data-annotated",H);let _=H===Q;B.style.outline=_?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",B.style.outlineOffset="2px",B.style.borderRadius="4px"}for(let Y of $.querySelectorAll(".edgeLabel")){let X=Y.textContent?.trim();if(!X||!q.has(X))continue;let G=q.get(X),H=Y;H.setAttribute("data-annotated",G);let B=G===Q;H.style.outline=B?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",H.style.outlineOffset="2px",H.style.borderRadius="4px"}for(let Y of $.querySelectorAll(".actor")){let X=Y.closest("g");if(!X)continue;let H=X.querySelector("text")?.textContent?.trim();if(!H||!q.has(H))continue;if(X.hasAttribute("data-annotated"))continue;let B=q.get(H);X.setAttribute("data-annotated",B);let _=B===Q,w=X.querySelector("rect");if(w)w.style.outline=_?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",w.style.outlineOffset="2px",w.style.borderRadius="4px"}for(let Y of $.querySelectorAll(".messageText")){let X=Y.textContent?.trim();if(!X||!q.has(X))continue;let G=q.get(X),H=Y;H.setAttribute("data-annotated",G);let B=G===Q;H.style.outline=B?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",H.style.outlineOffset="2px",H.style.borderRadius="4px"}let W=(Y,X,G)=>{for(let H of $.querySelectorAll(Y)){let B=G(H);if(!B||B.hasAttribute("data-annotated"))continue;let w=B.querySelector(X)?.textContent?.trim();if(!w||!q.has(w))continue;let L=q.get(w);B.setAttribute("data-annotated",L);let F=L===Q,U=B.querySelector("rect, circle, ellipse, polygon")||B;U.style.outline=F?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",U.style.outlineOffset="2px",U.style.borderRadius="4px"}};W(".entityBox",".entityLabel",(Y)=>Y.closest("g"));for(let Y of $.querySelectorAll(".relationshipLabel")){let G=Y.closest("g")||Y;if(G.hasAttribute("data-annotated"))continue;let H=Y.textContent?.trim();if(!H||!q.has(H))continue;let B=q.get(H);G.setAttribute("data-annotated",B);let _=B===Q;G.style.outline=_?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",G.style.outlineOffset="2px",G.style.borderRadius="4px"}W(".classGroup",".classTitle, .classTitleText, text",(Y)=>Y),W(".statediagram-state",".state-title, text",(Y)=>Y),W(".mindmap-node",".mindmap-node-label, text",(Y)=>Y)}import{jsxDEV as B6}from"react/jsx-dev-runtime";function G6({children:$}){return B6("div",{className:"relative bg-bg-elevated rounded-lg px-5 py-4 mt-3 text-body text-text-secondary italic leading-relaxed","data-md":"note",children:P$($)},void 0,!1,void 0,this)}import{jsxDEV as U6}from"react/jsx-dev-runtime";var _6={high:"text-accent-red bg-accent-red-muted",medium:"text-accent-amber bg-accent-amber-muted",low:"text-text-tertiary bg-border-subtle"};function M6({level:$}){return U6("span",{className:`inline text-tiny font-medium font-body ml-2 px-1.5 py-0.5 rounded ${_6[$]}`,"data-md":"priority","data-md-level":$,children:$},void 0,!1,void 0,this)}import{useState as w6}from"react";import{jsxDEV as i$}from"react/jsx-dev-runtime";function z6({title:$,children:J}){let[Q,q]=w6(!1);return i$("div",{className:"relative mb-8 p-4 group/section","data-md":"section","data-md-title":$,children:[i$("div",{className:"relative mb-2",children:[i$("button",{onClick:()=>q(!Q),className:`absolute -left-8 top-1/2 -translate-y-1/2 text-text-tertiary opacity-0 group-hover/section:opacity-50 hover:!opacity-100 transition-all duration-150 p-0.5 ${Q?"-rotate-90":""}`,children:i$("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:i$("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),i$("h2",{className:"font-heading text-section text-text-primary",style:{fontWeight:400},children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i$("div",{className:Q?"mt-6 hidden":"mt-6",children:P$(J)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as y$}from"react/jsx-dev-runtime";function N6({headers:$,rows:J}){return y$("div",{className:"overflow-x-auto mt-3","data-md":"table",children:y$("table",{className:"w-full text-body",children:[y$("thead",{children:y$("tr",{className:"border-b border-border-subtle",children:$.map((Q,q)=>y$("th",{className:"text-left px-4 py-2.5 text-meta font-medium uppercase tracking-wider text-text-tertiary font-body",children:Q},q,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),y$("tbody",{children:J.map((Q,q)=>y$("tr",{className:`relative border-b border-border-subtle last:border-b-0 transition-colors hover:bg-bg-surface/50 ${q%2===1?"bg-bg-surface/30":""}`,children:Q.map((W,Y)=>y$("td",{className:"px-4 py-2.5 text-text-secondary font-body",children:W},Y,!1,void 0,this))},q,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as b$}from"react/jsx-dev-runtime";var K6={todo:"bg-border-hover",done:"bg-accent-green",blocked:"bg-accent-red","in-progress":"bg-accent-blue"},O6={todo:"Todo",done:"Done",blocked:"Blocked","in-progress":"In progress"},L6={info:"bg-accent-blue-muted text-accent-blue",success:"bg-accent-green-muted text-accent-green",warning:"bg-accent-amber-muted text-accent-amber",danger:"bg-accent-red-muted text-accent-red",neutral:"bg-border-subtle text-text-tertiary"};function p5({id:$,label:J,status:Q,badge:q,badgeVariant:W="neutral",children:Y}){return b$("div",{className:"group/task relative -mx-4 px-4 py-3 rounded-md transition-colors duration-150 hover:bg-bg-input","data-task-id":$,"data-md":"item","data-md-label":J,...Q?{"data-md-status":Q}:{},...q?{"data-md-badge":q}:{},children:b$("div",{className:"flex items-start gap-3",children:[Q&&b$("span",{className:`w-2 h-2 rounded-full mt-[7px] flex-shrink-0 ${K6[Q]}`},void 0,!1,void 0,this),b$("div",{className:"flex-1 min-w-0",children:[b$("div",{className:"flex items-baseline gap-2",children:[b$("span",{className:"font-body text-task-label font-semibold text-text-primary",children:J},void 0,!1,void 0,this),Q&&b$("span",{className:"font-body text-tiny uppercase tracking-wider text-text-tertiary opacity-0 group-hover/task:opacity-100 transition-opacity duration-150",children:O6[Q]},void 0,!1,void 0,this),q&&b$("span",{className:`font-body text-tiny font-medium px-1.5 py-px rounded-full ${L6[W]}`,children:q},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y&&b$("div",{className:"text-body text-text-secondary mt-1 leading-relaxed",children:P$(Y)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function F6($){return b$(p5,{...$},void 0,!1,void 0,this)}import{useAnnotations as d5,useResponseRegistration as r5}from"#canvas/runtime";import{useRef as S6,useState as i5}from"react";import{jsxDEV as y}from"react/jsx-dev-runtime";function A6({id:$,label:J,placeholder:Q,multiline:q,required:W}){let{responses:Y,setResponse:X}=d5();r5($);let G=Y.get($),H=G?.value??"",B=G?.note||"",[_,w]=i5(!1),L=S6(null);if(!Y.has($))X($,{id:$,type:"text",label:J,value:"",required:W});let F=(O)=>{X($,{...G,value:O})},U=(O)=>j$(O,q?60:32),K=G?.required&&!H.trim();return y("div",{"data-md":"userinput","data-md-label":J,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[y("div",{className:"flex items-baseline gap-2 mb-2",children:[y("span",{className:"text-[13px] font-body font-medium text-text-primary",children:J},void 0,!1,void 0,this),W&&y("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y("textarea",{ref:L,value:H,onChange:(O)=>{F(O.currentTarget.value),U(O.currentTarget)},placeholder:Q||"Type your response...",rows:q?3:1,className:"w-full bg-bg-input text-[13px] font-body text-text-primary rounded-lg px-3 py-2 resize-none focus:outline-none border border-border-subtle focus:border-border-hover placeholder:text-text-tertiary transition-colors",onInput:(O)=>U(O.currentTarget),onFocus:(O)=>U(O.currentTarget)},void 0,!1,void 0,this),y(w0,{show:_,note:B,onToggle:()=>w(!_),onChange:(O)=>X($,{...G,note:O})},void 0,!1,void 0,this),K&&y("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"This field is required."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function b6({id:$,label:J,min:Q=1,max:q=10,step:W=1,required:Y,minLabel:X,maxLabel:G}){let{responses:H,setResponse:B}=d5();r5($);let _=H.get($),w=_?.value,L=_?.note||"",[F,U]=i5(!1);if(!H.has($))B($,{id:$,type:"range",label:J,value:null,required:Y});let K=(u)=>{B($,{..._,value:u})},O=w!==null&&w!==void 0,R=O?w:Math.round((Q+q)/2),T=(R-Q)/(q-Q)*100,I=Math.round((q-Q)/W),l=I<=20,x=_?.required&&!O;return y("div",{"data-md":"rangeinput","data-md-label":J,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[y("div",{className:"flex items-baseline justify-between mb-1",children:[y("div",{className:"flex items-baseline gap-2",children:[y("span",{className:"text-[13px] font-body font-medium text-text-primary",children:J},void 0,!1,void 0,this),Y&&y("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y("span",{className:"flex items-center gap-1.5",children:[y("span",{className:`text-[13px] font-mono ${O?"text-accent-amber":"text-text-disabled"}`,children:O?w:"—"},void 0,!1,void 0,this),O&&y("button",{onClick:()=>B($,{..._,value:null}),className:"text-text-disabled hover:text-text-tertiary transition-colors text-[10px] leading-none",title:"Clear",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),y("div",{className:"relative h-6 flex items-center",children:[y("div",{className:"absolute left-0 right-0 h-1.5 rounded-full bg-border-medium",children:O&&y("div",{className:"h-full rounded-full bg-accent-amber transition-all duration-150",style:{width:`${T}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),l&&Array.from({length:I+1},(u,t)=>{let J$=Q+t*W,U$=(J$-Q)/(q-Q)*100,h=O&&J$<=w;return y("div",{className:`absolute rounded-full pointer-events-none transition-all duration-150 ${O&&J$===w?"w-2.5 h-2.5 bg-accent-amber":h?"w-1.5 h-1.5 bg-accent-amber":"w-1.5 h-1.5 bg-border-hover"}`,style:{left:`${U$}%`,transform:"translate(-50%, -50%)",top:"50%"}},t,!1,void 0,this)}),O?y("div",{className:"absolute h-5 w-5 rounded-full bg-accent-amber shadow-md pointer-events-none transition-all duration-150",style:{left:`calc(${T}% - 10px)`,borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this):y("div",{className:"absolute h-4 w-4 rounded-full bg-border-hover pointer-events-none opacity-50",style:{left:"calc(50% - 8px)",borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this),y("input",{type:"range",min:Q,max:q,step:W,value:R,onChange:(u)=>K(Number(u.currentTarget.value)),className:"absolute inset-0 w-full opacity-0 cursor-pointer"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l&&I<=10?y("div",{className:"flex justify-between -mt-0.5 px-0",children:Array.from({length:I+1},(u,t)=>{let J$=Q+t*W;return y("span",{className:`text-[10px] font-mono transition-colors ${O&&J$===w?"text-accent-amber font-medium":"text-text-disabled"}`,style:{minWidth:"1ch",textAlign:"center"},children:J$},t,!1,void 0,this)})},void 0,!1,void 0,this):y("div",{className:"flex justify-between -mt-0.5",children:[y("span",{className:"text-[11px] text-text-tertiary font-body",children:X||Q},void 0,!1,void 0,this),y("span",{className:"text-[11px] text-text-tertiary font-body",children:G||q},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y(w0,{show:F,note:L,onToggle:()=>U(!F),onChange:(u)=>B($,{..._,note:u})},void 0,!1,void 0,this),x&&y("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select a value."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{wQ as useFeedback,A6 as UserInput,F6 as Task,N6 as Table,z6 as Section,b6 as RangeInput,M6 as Priority,G6 as Note,h3 as MultiChoice,X6 as Mermaid,J6 as Markdown,p5 as Item,e3 as ImageView,n3 as FilePreview,l3 as Diff,x3 as CodeBlock,g3 as Choice,r2 as Checklist,d2 as Callout};
|
|
63
|
+
`);X(O),H(K.language||"text")}}).catch(()=>_("Failed to fetch file")).finally(()=>L(!1))},[q,$,J?.[0],J?.[1],Q]),u5(()=>{let U=F.current,K=e0();if(!U||!K||!Y)return;U.removeAttribute("data-highlighted"),U.className=G?`language-${G}`:"",U.textContent=Y,K.highlightElement(U)},[Y,G]),w)return T$("div",{className:"text-text-tertiary text-body mt-3 bg-bg-code rounded-md p-4",children:["Loading ",$,"..."]},void 0,!0,void 0,this);if(B)return T$("div",{className:"text-accent-red text-body mt-3 bg-accent-red-muted rounded-md p-4",children:[$,": ",B]},void 0,!0,void 0,this);return T$("div",{className:"mt-3 bg-bg-code rounded-md overflow-hidden","data-md":"filepreview","data-md-path":$,...J?{"data-md-lines":`${J[0]}-${J[1]}`}:{},children:[T$("div",{className:"px-4 py-2 flex items-center justify-between",children:[T$("button",{className:"font-mono text-meta text-text-tertiary hover:text-text-secondary hover:underline cursor-pointer text-left",onClick:()=>W({type:"file",path:$}),title:`Open ${$}`,children:$},void 0,!1,void 0,this),J&&T$("span",{className:"font-mono text-meta text-text-tertiary opacity-60",children:["L",J[0],"–",J[1]]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T$("pre",{className:"px-4 pb-3 overflow-x-auto text-code font-mono !bg-transparent",style:{background:"transparent"},children:T$("code",{ref:F,className:G?`language-${G}`:"",children:Y},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{SessionContext as e3}from"#canvas/runtime";import{useContext as $6,useState as J6}from"react";import{jsxDEV as k0}from"react/jsx-dev-runtime";function Q6({src:$,alt:J,caption:Q,width:q,height:W}){let Y=$6(e3),[X,G]=J6(!1),H=`/api/image?session=${encodeURIComponent(Y)}&path=${encodeURIComponent($)}`;if(X)return k0("div",{className:"mt-3 text-accent-red text-body bg-accent-red-muted rounded-md p-4",children:[$,": Failed to load image"]},void 0,!0,void 0,this);return k0("figure",{className:"mt-3 relative","data-md":"image","data-md-src":$,children:[k0("div",{"data-annotation-image":!0,className:"rounded-md overflow-hidden border border-border-subtle bg-bg-code inline-block",children:k0("img",{src:H,alt:J||$,onError:()=>G(!0),draggable:!1,className:"block max-w-full h-auto",...q?{width:q}:{},...W?{height:W}:{}},void 0,!1,void 0,this)},void 0,!1,void 0,this),Q&&k0("figcaption",{className:"mt-1.5 text-meta text-text-tertiary font-body",children:Q},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useMemo as W6}from"react";import{jsxDEV as l5}from"react/jsx-dev-runtime";C.setOptions({gfm:!0,breaks:!1});function q6({children:$,file:J,__content:Q}){let q=Q??(typeof $==="string"?$:String($??"")),W=W6(()=>{if(!q)return"";return C.parse(q,{async:!1})},[q]);if(!q)return l5("div",{className:"text-text-tertiary text-tiny mt-3",children:J?`Could not load: ${J}`:"No markdown content"},void 0,!1,void 0,this);return l5("div",{className:"mt-3 prose-canvas","data-md":"markdown",...J?{"data-md-file":J}:{},"data-md-source":q,dangerouslySetInnerHTML:{__html:W}},void 0,!1,void 0,this)}import{useAnnotations as Y6,useCanvasFile as X6}from"#canvas/runtime";import{useCallback as F$,useEffect as g1,useRef as C0,useState as U0}from"react";import H6 from"react-dom";import{jsxDEV as P,Fragment as r5}from"react/jsx-dev-runtime";var w0=0.2,Q1=0.25,W1=4;function p5({zoom:$,onZoomIn:J,onZoomOut:Q,onZoomReset:q,onFullscreen:W}){return P("div",{className:"flex items-center gap-0.5 bg-bg-surface border border-border-subtle rounded-md px-1 py-0.5",style:{fontSize:"12px"},children:[P("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:Q,title:"Zoom out",disabled:$<=Q1,children:P("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:P("line",{x1:"5",y1:"12",x2:"19",y2:"12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P("button",{className:"px-1.5 h-7 rounded hover:bg-bg-elevated text-text-tertiary hover:text-text-primary transition-colors tabular-nums",onClick:q,title:"Reset zoom",children:[Math.round($*100),"%"]},void 0,!0,void 0,this),P("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:J,title:"Zoom in",disabled:$>=W1,children:P("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[P("line",{x1:"12",y1:"5",x2:"12",y2:"19"},void 0,!1,void 0,this),P("line",{x1:"5",y1:"12",x2:"19",y2:"12"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W&&P(r5,{children:[P("div",{className:"w-px h-4 bg-border-subtle mx-0.5"},void 0,!1,void 0,this),P("button",{className:"flex items-center justify-center w-7 h-7 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:W,title:"Fullscreen",children:P("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[P("polyline",{points:"15 3 21 3 21 9"},void 0,!1,void 0,this),P("polyline",{points:"9 21 3 21 3 15"},void 0,!1,void 0,this),P("line",{x1:"21",y1:"3",x2:"14",y2:"10"},void 0,!1,void 0,this),P("line",{x1:"3",y1:"21",x2:"10",y2:"14"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function d5($=1){let[J,Q]=U0($),q=F$(()=>Q((X)=>Math.min(W1,+(X+w0).toFixed(2))),[]),W=F$(()=>Q((X)=>Math.max(Q1,+(X-w0).toFixed(2))),[]),Y=F$(()=>Q(1),[]);return{zoom:J,zoomIn:q,zoomOut:W,zoomReset:Y,setZoom:Q}}function G6({svgHtml:$,source:J,onClose:Q}){let q=C0(null),{zoom:W,zoomIn:Y,zoomOut:X,zoomReset:G,setZoom:H}=d5(1),[B,_]=U0({x:0,y:0}),w=C0(null);g1(()=>{let R=(I)=>{if(I.key==="Escape")Q()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[Q]);let L=F$((R)=>{R.preventDefault();let I=R.deltaY>0?-w0:w0;H((y)=>Math.max(Q1,Math.min(W1,+(y+I).toFixed(2))))},[H]),F=F$((R)=>{if(R.button!==0)return;w.current={startX:R.clientX,startY:R.clientY,panX:B.x,panY:B.y},R.preventDefault()},[B]),U=F$((R)=>{if(!w.current)return;_({x:w.current.panX+(R.clientX-w.current.startX),y:w.current.panY+(R.clientY-w.current.startY)})},[]),K=F$(()=>{w.current=null},[]),O=F$(()=>{G(),_({x:0,y:0})},[G]);return H6.createPortal(P("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"var(--color-bg-base)",display:"flex",flexDirection:"column"},onMouseMove:U,onMouseUp:K,onMouseLeave:K,children:[P("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border-subtle",style:{flexShrink:0,background:"var(--color-bg-surface)"},children:[P("span",{className:"text-body text-text-secondary",style:{fontSize:"13px"},children:"Mermaid Diagram"},void 0,!1,void 0,this),P("div",{className:"flex items-center gap-2",children:[P(p5,{zoom:W,onZoomIn:Y,onZoomOut:X,onZoomReset:O},void 0,!1,void 0,this),P("button",{className:"flex items-center justify-center w-8 h-8 rounded hover:bg-bg-elevated text-text-secondary hover:text-text-primary transition-colors",onClick:Q,title:"Close (Esc)",children:P("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[P("line",{x1:"18",y1:"6",x2:"6",y2:"18"},void 0,!1,void 0,this),P("line",{x1:"6",y1:"6",x2:"18",y2:"18"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),P("div",{style:{flex:1,overflow:"hidden",cursor:w.current?"grabbing":"grab"},onWheel:L,onMouseDown:F,children:P("div",{ref:q,style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",transform:`translate(${B.x}px, ${B.y}px) scale(${W})`,transformOrigin:"center center",transition:w.current?"none":"transform 0.1s ease-out"},dangerouslySetInnerHTML:{__html:$}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),document.body)}function B6({children:$}){let J=C0(null),[Q,q]=U0(null),[W,Y]=U0(!1),[X,G]=U0(""),H=typeof $==="string"?$:String($??""),{annotations:B,addAnnotationWithId:_,activeAnnotationId:w,setActiveAnnotationId:L}=Y6(),F=X6(),[U,K]=U0(null),{zoom:O,zoomIn:R,zoomOut:I,zoomReset:y,setZoom:l}=d5(1),Z=C0(B);Z.current=B;let x=F$((u,d,r)=>{let c=`[Diagram ${r.toLowerCase()}] ${d}`,W$=Z.current.find((j$)=>j$.snippet===c);if(W$)L(W$.id);else K({anchorEl:u,snippet:d,prefix:r})},[L]),e=C0(x);e.current=x,g1(()=>{let u=!1,d=async()=>{try{let c=h5();if(!c){q("Mermaid library not loaded");return}let W$=document.documentElement.dataset.theme==="light"?"default":"dark";c.initialize({startOnLoad:!1,theme:W$});let j$=`mermaid-${Math.random().toString(36).slice(2)}`,{svg:y$}=await c.render(j$,H.trim());if(!u&&J.current)J.current.innerHTML=y$,G(y$),_6(J.current,(s,q$,U$)=>e.current(s,q$,U$)),c5(J.current,Z.current);q(null)}catch(c){if(!u)q(c instanceof Error&&c.message||"Invalid diagram")}};d();let r=new MutationObserver((c)=>{for(let W$ of c)if(W$.attributeName==="data-theme")d()});return r.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>{u=!0,r.disconnect()}},[H]),g1(()=>{if(J.current)c5(J.current,B,w)},[B,w]);let J$=F$((u)=>{if(!u.ctrlKey&&!u.metaKey)return;u.preventDefault();let d=u.deltaY>0?-w0:w0;l((r)=>Math.max(Q1,Math.min(W1,+(r+d).toFixed(2))))},[l]);if(Q)return P("div",{className:"bg-accent-red-muted rounded-md p-4 mt-3 text-body text-accent-red",children:["Mermaid error: ",Q,P("pre",{className:"mt-2 text-tiny text-text-tertiary whitespace-pre-wrap",children:H},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let Q$=J.current?.closest("#plan-scroll-container");return P(r5,{children:[P("div",{className:"mt-3 mermaid-container","data-md":"mermaid","data-md-source":H.trim(),children:[P("div",{className:"flex justify-end mb-1",children:P(p5,{zoom:O,onZoomIn:R,onZoomOut:I,onZoomReset:y,onFullscreen:()=>Y(!0)},void 0,!1,void 0,this)},void 0,!1,void 0,this),P("div",{style:{overflow:"auto",maxHeight:"70vh"},onWheel:J$,children:P("div",{ref:J,className:"flex justify-center",style:{transform:`scale(${O})`,transformOrigin:"top center",transition:"transform 0.1s ease-out",minHeight:O<1?void 0:void 0}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U&&P(P0,{anchorEl:U.anchorEl,scrollContainer:Q$,snippet:U.snippet,header:P("div",{style:{fontSize:"12px",color:"var(--color-text-tertiary)",marginBottom:"8px",lineHeight:"1.4",display:"flex",alignItems:"center",gap:"6px"},children:[P("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--color-accent-amber)",flexShrink:0}},void 0,!1,void 0,this),U.snippet]},void 0,!0,void 0,this),onAdd:(u,d)=>{let r=`ann-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;_(r,`[Diagram ${U.prefix.toLowerCase()}] ${U.snippet}`,u,void 0,void 0,d,F||void 0),K(null)},onCancel:()=>K(null)},void 0,!1,void 0,this),W&&X&&P(G6,{svgHtml:X,source:H,onClose:()=>Y(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function _6($,J){let Q=(q,W,Y)=>{q.style.cursor="pointer",q.addEventListener("mouseenter",()=>{q.style.filter="brightness(1.2)"}),q.addEventListener("mouseleave",()=>{q.style.filter=""}),q.addEventListener("click",(X)=>{X.stopPropagation(),X.preventDefault(),J(q,W(),Y)})};for(let q of $.querySelectorAll(".node"))Q(q,()=>{return(q.querySelector(".nodeLabel")||q.querySelector("foreignObject span")||q.querySelector("text"))?.textContent?.trim()||"Node"},"Node");for(let q of $.querySelectorAll(".edgePath")){let W=q,Y=W.querySelector("path");if(Y){Y.style.strokeWidth=Math.max(parseFloat(Y.style.strokeWidth||"1"),8)+"px",Y.style.strokeOpacity="0";let G=Y.cloneNode(!0);G.style.strokeWidth="",G.style.strokeOpacity="",W.insertBefore(G,Y)}let X=W.id||"";Q(W,()=>{let G=$.querySelectorAll(".edgeLabel");for(let H of G)if(H.id&&X&&H.id.replace("label","").includes(X.replace("L-","").replace("edge",""))){let B=H.textContent?.trim();if(B)return B}return"Connection"},"Edge")}for(let q of $.querySelectorAll(".edgeLabel")){let W=q.textContent?.trim();if(!W)continue;Q(q,()=>W,"Edge")}for(let q of $.querySelectorAll(".actor")){let W=q.closest("g")?.querySelector("text")||q.parentElement?.querySelector("text");if(!W)continue;let Y=q.closest("g");if(!Y||Y.hasAttribute("data-clickable"))continue;Y.setAttribute("data-clickable","true"),Q(Y,()=>W.textContent?.trim()||"Participant","Node")}for(let q of $.querySelectorAll(".messageText")){let W=q.textContent?.trim();if(!W)continue;Q(q,()=>W,"Edge")}for(let q of $.querySelectorAll(".entityBox")){let W=q.closest("g");if(!W||W.hasAttribute("data-clickable"))continue;let Y=W.querySelector(".entityLabel");if(!Y)continue;W.setAttribute("data-clickable","true"),Q(W,()=>Y.textContent?.trim()||"Entity","Node")}for(let q of $.querySelectorAll(".relationshipLabel")){let W=q.textContent?.trim();if(!W)continue;let X=q.closest("g")||q;if(X.hasAttribute("data-clickable"))continue;X.setAttribute("data-clickable","true"),Q(X,()=>W,"Edge")}for(let q of $.querySelectorAll(".classGroup")){let W=q;if(W.hasAttribute("data-clickable"))continue;let Y=W.querySelector(".classTitle, .classTitleText, text");if(!Y)continue;W.setAttribute("data-clickable","true"),Q(W,()=>Y.textContent?.trim()||"Class","Node")}for(let q of $.querySelectorAll(".statediagram-state")){let W=q;if(W.hasAttribute("data-clickable"))continue;let Y=W.querySelector(".state-title, text");if(!Y)continue;W.setAttribute("data-clickable","true"),Q(W,()=>Y.textContent?.trim()||"State","Node")}for(let q of $.querySelectorAll(".mindmap-node")){let W=q;if(W.hasAttribute("data-clickable"))continue;let Y=W.querySelector(".mindmap-node-label, text");if(!Y)continue;W.setAttribute("data-clickable","true"),Q(W,()=>Y.textContent?.trim()||"Node","Node")}}function c5($,J,Q){let q=new Map;for(let Y of J){let X=Y.snippet.match(/^\[Diagram (?:node|edge)\] (.+)$/)?.[1];if(X)q.set(X,Y.id)}for(let Y of $.querySelectorAll("[data-annotated]"))Y.style.outline="",Y.style.outlineOffset="",Y.style.borderRadius="",Y.removeAttribute("data-annotated");if(q.size===0)return;for(let Y of $.querySelectorAll(".node")){let G=(Y.querySelector(".nodeLabel")||Y.querySelector("foreignObject span")||Y.querySelector("text"))?.textContent?.trim();if(!G||!q.has(G))continue;let H=q.get(G),B=Y;B.setAttribute("data-annotated",H);let _=H===Q;B.style.outline=_?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",B.style.outlineOffset="2px",B.style.borderRadius="4px"}for(let Y of $.querySelectorAll(".edgeLabel")){let X=Y.textContent?.trim();if(!X||!q.has(X))continue;let G=q.get(X),H=Y;H.setAttribute("data-annotated",G);let B=G===Q;H.style.outline=B?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",H.style.outlineOffset="2px",H.style.borderRadius="4px"}for(let Y of $.querySelectorAll(".actor")){let X=Y.closest("g");if(!X)continue;let H=X.querySelector("text")?.textContent?.trim();if(!H||!q.has(H))continue;if(X.hasAttribute("data-annotated"))continue;let B=q.get(H);X.setAttribute("data-annotated",B);let _=B===Q,w=X.querySelector("rect");if(w)w.style.outline=_?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",w.style.outlineOffset="2px",w.style.borderRadius="4px"}for(let Y of $.querySelectorAll(".messageText")){let X=Y.textContent?.trim();if(!X||!q.has(X))continue;let G=q.get(X),H=Y;H.setAttribute("data-annotated",G);let B=G===Q;H.style.outline=B?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",H.style.outlineOffset="2px",H.style.borderRadius="4px"}let W=(Y,X,G)=>{for(let H of $.querySelectorAll(Y)){let B=G(H);if(!B||B.hasAttribute("data-annotated"))continue;let w=B.querySelector(X)?.textContent?.trim();if(!w||!q.has(w))continue;let L=q.get(w);B.setAttribute("data-annotated",L);let F=L===Q,U=B.querySelector("rect, circle, ellipse, polygon")||B;U.style.outline=F?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",U.style.outlineOffset="2px",U.style.borderRadius="4px"}};W(".entityBox",".entityLabel",(Y)=>Y.closest("g"));for(let Y of $.querySelectorAll(".relationshipLabel")){let G=Y.closest("g")||Y;if(G.hasAttribute("data-annotated"))continue;let H=Y.textContent?.trim();if(!H||!q.has(H))continue;let B=q.get(H);G.setAttribute("data-annotated",B);let _=B===Q;G.style.outline=_?"2px solid var(--color-highlight-border)":"2px solid var(--color-highlight-annotation)",G.style.outlineOffset="2px",G.style.borderRadius="4px"}W(".classGroup",".classTitle, .classTitleText, text",(Y)=>Y),W(".statediagram-state",".state-title, text",(Y)=>Y),W(".mindmap-node",".mindmap-node-label, text",(Y)=>Y)}import{jsxDEV as U6}from"react/jsx-dev-runtime";function M6({children:$}){return U6("div",{className:"relative bg-bg-elevated rounded-lg px-5 py-4 mt-3 text-body text-text-secondary italic leading-relaxed","data-md":"note",children:V$($)},void 0,!1,void 0,this)}import{jsxDEV as N6}from"react/jsx-dev-runtime";var w6={high:"text-accent-red bg-accent-red-muted",medium:"text-accent-amber bg-accent-amber-muted",low:"text-text-tertiary bg-border-subtle"};function z6({level:$}){return N6("span",{className:`inline text-tiny font-medium font-body ml-2 px-1.5 py-0.5 rounded ${w6[$]}`,"data-md":"priority","data-md-level":$,children:$},void 0,!1,void 0,this)}import{useState as K6}from"react";import{jsxDEV as r$}from"react/jsx-dev-runtime";function O6({title:$,children:J}){let[Q,q]=K6(!1);return r$("div",{className:"relative mb-8 p-4 group/section","data-md":"section","data-md-title":$,children:[r$("div",{className:"relative mb-2",children:[r$("button",{onClick:()=>q(!Q),className:`absolute -left-8 top-1/2 -translate-y-1/2 text-text-tertiary opacity-0 group-hover/section:opacity-50 hover:!opacity-100 transition-all duration-150 p-0.5 ${Q?"-rotate-90":""}`,children:r$("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",children:r$("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),r$("h2",{className:"font-heading text-section text-text-primary",style:{fontWeight:400},children:$},void 0,!1,void 0,this)]},void 0,!0,void 0,this),r$("div",{className:Q?"mt-6 hidden":"mt-6",children:V$(J)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as I$}from"react/jsx-dev-runtime";function L6({headers:$,rows:J}){return I$("div",{className:"overflow-x-auto mt-3","data-md":"table",children:I$("table",{className:"w-full text-body",children:[I$("thead",{children:I$("tr",{className:"border-b border-border-subtle",children:$.map((Q,q)=>I$("th",{className:"text-left px-4 py-2.5 text-meta font-medium uppercase tracking-wider text-text-tertiary font-body",children:Q},q,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),I$("tbody",{children:J.map((Q,q)=>I$("tr",{className:`relative border-b border-border-subtle last:border-b-0 transition-colors hover:bg-bg-surface/50 ${q%2===1?"bg-bg-surface/30":""}`,children:Q.map((W,Y)=>I$("td",{className:"px-4 py-2.5 text-text-secondary font-body",children:W},Y,!1,void 0,this))},q,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as S$}from"react/jsx-dev-runtime";var F6={todo:"bg-border-hover",done:"bg-accent-green",blocked:"bg-accent-red","in-progress":"bg-accent-blue"},S6={todo:"Todo",done:"Done",blocked:"Blocked","in-progress":"In progress"},A6={info:"bg-accent-blue-muted text-accent-blue",success:"bg-accent-green-muted text-accent-green",warning:"bg-accent-amber-muted text-accent-amber",danger:"bg-accent-red-muted text-accent-red",neutral:"bg-border-subtle text-text-tertiary"};function i5({id:$,label:J,status:Q,badge:q,badgeVariant:W="neutral",children:Y}){return S$("div",{className:"group/task relative -mx-4 px-4 py-3 rounded-md transition-colors duration-150 hover:bg-bg-input","data-task-id":$,"data-md":"item","data-md-label":J,...Q?{"data-md-status":Q}:{},...q?{"data-md-badge":q}:{},children:S$("div",{className:"flex items-start gap-3",children:[Q&&S$("span",{className:`w-2 h-2 rounded-full mt-[7px] flex-shrink-0 ${F6[Q]}`},void 0,!1,void 0,this),S$("div",{className:"flex-1 min-w-0",children:[S$("div",{className:"flex items-baseline gap-2",children:[S$("span",{className:"font-body text-task-label font-semibold text-text-primary",children:J},void 0,!1,void 0,this),Q&&S$("span",{className:"font-body text-tiny uppercase tracking-wider text-text-tertiary opacity-0 group-hover/task:opacity-100 transition-opacity duration-150",children:S6[Q]},void 0,!1,void 0,this),q&&S$("span",{className:`font-body text-tiny font-medium px-1.5 py-px rounded-full ${A6[W]}`,children:q},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Y&&S$("div",{className:"text-body text-text-secondary mt-1 leading-relaxed",children:V$(Y)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function b6($){return S$(i5,{...$},void 0,!1,void 0,this)}import{useAnnotations as o5,useResponseRegistration as n5}from"#canvas/runtime";import{useRef as f6,useState as a5}from"react";import{jsxDEV as g}from"react/jsx-dev-runtime";function v6({id:$,label:J,placeholder:Q,multiline:q,required:W}){let{responses:Y,setResponse:X}=o5();n5($);let G=Y.get($),H=G?.value??"",B=G?.note||"",[_,w]=a5(!1),L=f6(null);if(!Y.has($))X($,{id:$,type:"text",label:J,value:"",required:W});let F=(O)=>{X($,{...G,value:O})},U=(O)=>v$(O,q?60:32),K=G?.required&&!H.trim();return g("div",{"data-md":"userinput","data-md-label":J,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[g("div",{className:"flex items-baseline gap-2 mb-2",children:[g("span",{className:"text-[13px] font-body font-medium text-text-primary",children:J},void 0,!1,void 0,this),W&&g("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g("textarea",{ref:L,value:H,onChange:(O)=>{F(O.currentTarget.value),U(O.currentTarget)},placeholder:Q||"Type your response...",rows:q?3:1,className:"w-full bg-bg-input text-[13px] font-body text-text-primary rounded-lg px-3 py-2 resize-none focus:outline-none border border-border-subtle focus:border-border-hover placeholder:text-text-tertiary transition-colors",onInput:(O)=>U(O.currentTarget),onFocus:(O)=>U(O.currentTarget)},void 0,!1,void 0,this),g(M0,{show:_,note:B,onToggle:()=>w(!_),onChange:(O)=>X($,{...G,note:O})},void 0,!1,void 0,this),K&&g("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"This field is required."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function R6({id:$,label:J,min:Q=1,max:q=10,step:W=1,required:Y,minLabel:X,maxLabel:G}){let{responses:H,setResponse:B}=o5();n5($);let _=H.get($),w=_?.value,L=_?.note||"",[F,U]=a5(!1);if(!H.has($))B($,{id:$,type:"range",label:J,value:null,required:Y});let K=(x)=>{B($,{..._,value:x})},O=w!==null&&w!==void 0,R=O?w:Math.round((Q+q)/2),I=(R-Q)/(q-Q)*100,y=Math.round((q-Q)/W),l=y<=20,Z=_?.required&&!O;return g("div",{"data-md":"rangeinput","data-md-label":J,className:"-mx-4 px-4 py-3 my-1 rounded-lg transition-colors duration-150 hover:bg-bg-input",children:[g("div",{className:"flex items-baseline justify-between mb-1",children:[g("div",{className:"flex items-baseline gap-2",children:[g("span",{className:"text-[13px] font-body font-medium text-text-primary",children:J},void 0,!1,void 0,this),Y&&g("span",{className:"text-[10px] text-accent-red font-body",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g("span",{className:"flex items-center gap-1.5",children:[g("span",{className:`text-[13px] font-mono ${O?"text-accent-amber":"text-text-disabled"}`,children:O?w:"—"},void 0,!1,void 0,this),O&&g("button",{onClick:()=>B($,{..._,value:null}),className:"text-text-disabled hover:text-text-tertiary transition-colors text-[10px] leading-none",title:"Clear",children:"✕"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),g("div",{className:"relative h-6 flex items-center",children:[g("div",{className:"absolute left-0 right-0 h-1.5 rounded-full bg-border-medium",children:O&&g("div",{className:"h-full rounded-full bg-accent-amber transition-all duration-150",style:{width:`${I}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),l&&Array.from({length:y+1},(x,e)=>{let J$=Q+e*W,Q$=(J$-Q)/(q-Q)*100,u=O&&J$<=w;return g("div",{className:`absolute rounded-full pointer-events-none transition-all duration-150 ${O&&J$===w?"w-2.5 h-2.5 bg-accent-amber":u?"w-1.5 h-1.5 bg-accent-amber":"w-1.5 h-1.5 bg-border-hover"}`,style:{left:`${Q$}%`,transform:"translate(-50%, -50%)",top:"50%"}},e,!1,void 0,this)}),O?g("div",{className:"absolute h-5 w-5 rounded-full bg-accent-amber shadow-md pointer-events-none transition-all duration-150",style:{left:`calc(${I}% - 10px)`,borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this):g("div",{className:"absolute h-4 w-4 rounded-full bg-border-hover pointer-events-none opacity-50",style:{left:"calc(50% - 8px)",borderWidth:"2px",borderStyle:"solid",borderColor:"var(--color-bg-base)"}},void 0,!1,void 0,this),g("input",{type:"range",min:Q,max:q,step:W,value:R,onChange:(x)=>K(Number(x.currentTarget.value)),className:"absolute inset-0 w-full opacity-0 cursor-pointer"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),l&&y<=10?g("div",{className:"flex justify-between -mt-0.5 px-0",children:Array.from({length:y+1},(x,e)=>{let J$=Q+e*W;return g("span",{className:`text-[10px] font-mono transition-colors ${O&&J$===w?"text-accent-amber font-medium":"text-text-disabled"}`,style:{minWidth:"1ch",textAlign:"center"},children:J$},e,!1,void 0,this)})},void 0,!1,void 0,this):g("div",{className:"flex justify-between -mt-0.5",children:[g("span",{className:"text-[11px] text-text-tertiary font-body",children:X||Q},void 0,!1,void 0,this),g("span",{className:"text-[11px] text-text-tertiary font-body",children:G||q},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g(M0,{show:F,note:L,onToggle:()=>U(!F),onChange:(x)=>B($,{..._,note:x})},void 0,!1,void 0,this),Z&&g("p",{className:"text-[11px] text-accent-red font-body mt-1",children:"Please select a value."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}export{KQ as useFeedback,v6 as UserInput,b6 as Task,L6 as Table,O6 as Section,R6 as RangeInput,z6 as Priority,M6 as Note,x3 as MultiChoice,B6 as Mermaid,q6 as Markdown,i5 as Item,Q6 as ImageView,t3 as FilePreview,d3 as Diff,c3 as CodeBlock,Z3 as Choice,n2 as Checklist,o2 as Callout};
|