@vibe-forge/client 0.8.3 → 0.8.4
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/dist/assets/{arc-CZwEW7WR.js → arc-DCuZPvAs.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88--ejJ1hay.js → blockDiagram-c4efeb88-C39d7-Bu.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-D0N419di.js → c4Diagram-c83219d4-jWPBJdeq.js} +1 -1
- package/dist/assets/channel-bLjHfx-Q.js +1 -0
- package/dist/assets/{classDiagram-beda092f-BRVsm_of.js → classDiagram-beda092f-Bo7Yvv2T.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-OShdAlFU.js → classDiagram-v2-2358418a-DfoCP9XM.js} +1 -1
- package/dist/assets/clone-upfY39Je.js +1 -0
- package/dist/assets/{createText-1719965b-psgY2hME.js → createText-1719965b-8_Ez5rxh.js} +1 -1
- package/dist/assets/{edges-96097737-BA56Qmd2.js → edges-96097737-BEegO-R-.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-Dyrrgc5j.js → erDiagram-0228fc6a-derRgkLz.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-CRgQ7Xd3.js → flowDb-c6c81e3f-ChtOxgsJ.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-B73a9Glk.js → flowDiagram-50d868cf-Bm4ufmmA.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-F66FzZTY.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-DtsYC0Wf.js → flowchart-elk-definition-6af322e1-BRYLO-BL.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-gzdnsQCV.js → ganttDiagram-a2739b55-CbP6dzRO.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-RHa92Mol.js → gitGraphDiagram-82fe8481-Du44v02s.js} +1 -1
- package/dist/assets/{graph-Uj8iC7DB.js → graph-0_VzJX6O.js} +1 -1
- package/dist/assets/{index-5325376f-B2Q_MiDU.js → index-5325376f-DLP7F7of.js} +1 -1
- package/dist/assets/{index-ADFje5Kc.js → index-C1O04Df8.js} +34 -34
- package/dist/assets/{index-DGEAe87I.css → index-sE8VA1N7.css} +1 -1
- package/dist/assets/{infoDiagram-8eee0895-BIrv_GjX.js → infoDiagram-8eee0895-DY19rRl6.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-DMZd-Mfh.js → journeyDiagram-c64418c1-4Asnwc86.js} +1 -1
- package/dist/assets/{layout-Bwa2VjOX.js → layout-BILp7GjD.js} +1 -1
- package/dist/assets/{line-BDn4wwV7.js → line-D0Xqr8mi.js} +1 -1
- package/dist/assets/{linear-DQPiAjW8.js → linear-LpL8RZsq.js} +1 -1
- package/dist/assets/{mermaid.core-B5GfAmDT.js → mermaid.core-Bk0Y_0sz.js} +4 -4
- package/dist/assets/{mindmap-definition-8da855dc-BTOOR2ac.js → mindmap-definition-8da855dc-eCAgn5kY.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-C3QNifd4.js → pieDiagram-a8764435-BeGFFS1p.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-Ds5ATncA.js → quadrantDiagram-1e28029f-tLqbYOHC.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-CVdpqqVi.js → requirementDiagram-08caed73-DCverr_g.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-CxP85079.js → sankeyDiagram-a04cb91d-DidhF5PL.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-BeaQEYgt.js → sequenceDiagram-c5b8d532-CEKaiwTo.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-Bv-YlfIf.js → stateDiagram-1ecb1508-Cj9ZY7RH.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-CWKsGrvN.js → stateDiagram-v2-c2b004d7-Gsmps-dk.js} +1 -1
- package/dist/assets/{styles-b4e223ce-DzdnfR-A.js → styles-b4e223ce-D7E8Th0j.js} +1 -1
- package/dist/assets/{styles-ca3715f6-BS5E4Xdv.js → styles-ca3715f6-tTC26Jsm.js} +1 -1
- package/dist/assets/{styles-d45a18b0-t7c5i-_-.js → styles-d45a18b0-Bf6oqNdR.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-CyA-VVES.js → svgDrawCommon-b86b1483-BxKi01m2.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-BuFEjpzk.js → timeline-definition-faaaa080-D6PePEip.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-B4b4QqYX.js → xychartDiagram-f5964ef8-BuP4qfXm.js} +1 -1
- package/dist/favicon.svg +5 -0
- package/dist/index.html +3 -2
- package/index.html +2 -1
- package/package.json +7 -7
- package/public/favicon.svg +5 -0
- package/src/components/chat/sender/Sender.scss +6 -0
- package/src/components/config/ConfigSectionForm.tsx +0 -1
- package/src/components/config/configSchema.ts +2 -23
- package/src/hooks/use-session-subscription.ts +31 -8
- package/src/runtime-config.ts +18 -9
- package/dist/assets/channel-dXWmEygA.js +0 -1
- package/dist/assets/clone-C4IafnWc.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-Ccm4QuQe.js +0 -1
|
@@ -64,7 +64,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
64
64
|
`);else if(v._keyframe)h(v);else{var S=f.reduce(function(C,_){var w;return(_==null||(w=_.visit)===null||w===void 0?void 0:w.call(_,C))||C},v);Object.keys(S).forEach(function(C){var _=S[C];if(st(_)==="object"&&_&&(C!=="animationName"||!_._keyframe)&&!J6(_)){var w=!1,N=C.trim(),k=!1;(o||i)&&s?N.startsWith("@")?w=!0:N==="&"?N=K$("",s,c):N=K$(C,s,c):o&&!s&&(N==="&"||N==="")&&(N="",k=!0);var E=e(_,n,{root:k,injectHash:w,parentSelectors:[].concat(Ee(a),[N])}),$=fe(E,2),O=$[0],R=$[1];p=G(G({},p),R),m+="".concat(N).concat(O)}else{let P=function(j,L){var D=j.replace(/[A-Z]/g,function(M){return"-".concat(M.toLowerCase())}),z=L;!R6[j]&&typeof z=="number"&&z!==0&&(z="".concat(z,"px")),j==="animationName"&&L!==null&&L!==void 0&&L._keyframe&&(h(L),z=L.getName(s)),m+="".concat(D,":").concat(z,";")};var T,I=(T=_==null?void 0:_.value)!==null&&T!==void 0?T:_;st(_)==="object"&&_!==null&&_!==void 0&&_[RM]&&Array.isArray(I)?I.forEach(function(j){P(C,j)}):P(C,I)}})}}),o?l&&(m&&(m="@layer ".concat(l.name," {").concat(m,"}")),l.dependencies&&(p["@layer ".concat(l.name)]=l.dependencies.map(function(g){return"@layer ".concat(g,", ").concat(l.name,";")}).join(`
|
|
65
65
|
`))):m="{".concat(m,"}"),[m,p]};function PM(e,t){return cf("".concat(e.join("%")).concat(t))}function t8(){return null}var TM="style";function Ax(e,t){var n=e.token,r=e.path,o=e.hashId,i=e.layer,a=e.nonce,s=e.clientOnly,l=e.order,c=l===void 0?0:l,d=u.useContext(zf),f=d.autoClear;d.mock;var m=d.defaultCache,p=d.hashPriority,h=d.container,b=d.ssrInline,x=d.transformers,g=d.linters,v=d.cache,S=d.layer,C=n._tokenKey,_=[C];S&&_.push("layer"),_.push.apply(_,Ee(r));var w=Tx,N=Bw(TM,_,function(){var R=_.join("|");if(Y6(R)){var T=Q6(R),I=fe(T,2),P=I[0],j=I[1];if(P)return[P,C,j,{},s,c]}var L=t(),D=e8(L,{hashId:o,hashPriority:p,layer:S?i:void 0,path:r.join("-"),transformers:x,linters:g}),z=fe(D,2),M=z[0],H=z[1],F=Pp(M),A=PM(_,F);return[F,C,A,H,s,c]},function(R,T){var I=fe(R,3),P=I[2];(T||f)&&Tx&&uf(P,{mark:wi,attachTo:h})},function(R){var T=fe(R,4),I=T[0];T[1];var P=T[2],j=T[3];if(w&&I!==OM){var L={mark:wi,prepend:S?!1:"queue",attachTo:h,priority:c},D=typeof a=="function"?a():a;D&&(L.csp={nonce:D});var z=[],M=[];Object.keys(j).forEach(function(F){F.startsWith("@layer")?z.push(F):M.push(F)}),z.forEach(function(F){_a(Pp(j[F]),"_layer-".concat(F),G(G({},L),{},{prepend:!0}))});var H=_a(I,P,L);H[ss]=v.instanceId,H.setAttribute(Vc,C),M.forEach(function(F){_a(Pp(j[F]),"_effect-".concat(F),L)})}}),k=fe(N,3),E=k[0],$=k[1],O=k[2];return function(R){var T;return!b||w||!m?T=u.createElement(t8,null):T=u.createElement("style",Ne({},V(V({},Vc,$),wi,O),{dangerouslySetInnerHTML:{__html:E}})),u.createElement(u.Fragment,null,T,R)}}var n8=function(t,n,r){var o=fe(t,6),i=o[0],a=o[1],s=o[2],l=o[3],c=o[4],d=o[5],f=r||{},m=f.plain;if(c)return null;var p=i,h={"data-rc-order":"prependQueue","data-rc-priority":"".concat(d)};return p=_h(i,a,s,h,m),l&&Object.keys(l).forEach(function(b){if(!n[b]){n[b]=!0;var x=Pp(l[b]),g=_h(x,a,"_effect-".concat(b),h,m);b.startsWith("@layer")?p=g+p:p+=g}}),[d,s,p]},jM="cssVar",r8=function(t,n){var r=t.key,o=t.prefix,i=t.unitless,a=t.ignore,s=t.token,l=t.scope,c=l===void 0?"":l,d=u.useContext(zf),f=d.cache.instanceId,m=d.container,p=s._tokenKey,h=[].concat(Ee(t.path),[r,c,p]),b=Bw(jM,h,function(){var x=n(),g=SM(x,r,{prefix:o,unitless:i,ignore:a,scope:c}),v=fe(g,2),S=v[0],C=v[1],_=PM(h,C);return[S,C,_,r]},function(x){var g=fe(x,3),v=g[2];Tx&&uf(v,{mark:wi,attachTo:m})},function(x){var g=fe(x,3),v=g[1],S=g[2];if(v){var C=_a(v,S,{mark:wi,prepend:"queue",attachTo:m,priority:-999});C[ss]=f,C.setAttribute(Vc,r)}});return b},o8=function(t,n,r){var o=fe(t,4),i=o[1],a=o[2],s=o[3],l=r||{},c=l.plain;if(!i)return null;var d=-999,f={"data-rc-order":"prependQueue","data-rc-priority":"".concat(d)},m=_h(i,s,a,f,c);return[d,a,m]};V(V(V({},TM,n8),CM,I6),jM,o8);var At=function(){function e(t,n){Vn(this,e),V(this,"name",void 0),V(this,"style",void 0),V(this,"_keyframe",!0),this.name=t,this.style=n}return Wn(e,[{key:"getName",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return n?"".concat(n,"-").concat(this.name):this.name}}]),e}();function Ml(e){return e.notSplit=!0,e}Ml(["borderTop","borderBottom"]),Ml(["borderTop"]),Ml(["borderBottom"]),Ml(["borderLeft","borderRight"]),Ml(["borderLeft"]),Ml(["borderRight"]);var Vw=u.createContext({});function MM(e){return hM(e)||dM(e)||Aw(e)||gM()}function ao(e,t){for(var n=e,r=0;r<t.length;r+=1){if(n==null)return;n=n[t[r]]}return n}function AM(e,t,n,r){if(!t.length)return n;var o=MM(t),i=o[0],a=o.slice(1),s;return!e&&typeof i=="number"?s=[]:Array.isArray(e)?s=Ee(e):s=G({},e),r&&n===void 0&&a.length===1?delete s[i][a[0]]:s[i]=AM(s[i],a,n,r),s}function Xo(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.length&&r&&n===void 0&&!ao(e,t.slice(0,-1))?e:AM(e,t,n,r)}function i8(e){return st(e)==="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function U$(e){return Array.isArray(e)?[]:{}}var a8=typeof Reflect>"u"?Object.keys:Reflect.ownKeys;function cc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=U$(t[0]);return t.forEach(function(o){function i(a,s){var l=new Set(s),c=ao(o,a),d=Array.isArray(c);if(d||i8(c)){if(!l.has(c)){l.add(c);var f=ao(r,a);d?r=Xo(r,a,[]):(!f||st(f)!=="object")&&(r=Xo(r,a,U$(c))),a8(c).forEach(function(m){i([].concat(Ee(a),[m]),l)})}}else r=Xo(r,a,c)}i([])}),r}function s8(){}const l8=u.createContext({}),sa=()=>{const e=()=>{};return e.deprecated=s8,e},LM=u.createContext(void 0);var DM={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"},c8={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},u8=G(G({},c8),{},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"OK",clear:"Clear",week:"Week",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",dateFormat:"M/D/YYYY",dateTimeFormat:"M/D/YYYY HH:mm:ss",previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"});const zM={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},G$={lang:Object.assign({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},u8),timePickerLocale:Object.assign({},zM)},ko="${label} is not a valid ${type}",Pi={locale:"en",Pagination:DM,DatePicker:G$,TimePicker:zM,Calendar:G$,global:{placeholder:"Please select",close:"Close"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckAll:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",deselectAll:"Deselect all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand",collapse:"Collapse"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:ko,method:ko,array:ko,object:ko,number:ko,date:ko,boolean:ko,integer:ko,float:ko,regexp:ko,email:ko,url:ko,hex:ko},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"},ColorPicker:{presetEmpty:"Empty",transparent:"Transparent",singleColor:"Single",gradientColor:"Gradient"}};let Tp=Object.assign({},Pi.Modal),jp=[];const q$=()=>jp.reduce((e,t)=>Object.assign(Object.assign({},e),t),Pi.Modal);function d8(e){if(e){const t=Object.assign({},e);return jp.push(t),Tp=q$(),()=>{jp=jp.filter(n=>n!==t),Tp=q$()}}Tp=Object.assign({},Pi.Modal)}function f8(){return Tp}const Ww=u.createContext(void 0),Mi=(e,t)=>{const n=u.useContext(Ww),r=u.useMemo(()=>{var i;const a=t||Pi[e],s=(i=n==null?void 0:n[e])!==null&&i!==void 0?i:{};return Object.assign(Object.assign({},typeof a=="function"?a():a),s||{})},[e,t,n]),o=u.useMemo(()=>{const i=n==null?void 0:n.locale;return n!=null&&n.exist&&!i?Pi.locale:i},[n]);return[r,o]},m8="internalMark",p8=e=>{const{locale:t={},children:n,_ANT_MARK__:r}=e;u.useEffect(()=>d8(t==null?void 0:t.Modal),[t]);const o=u.useMemo(()=>Object.assign(Object.assign({},t),{exist:!0}),[t]);return u.createElement(Ww.Provider,{value:o},n)},Kw={blue:"#1677FF",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#EB2F96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},ff=Object.assign(Object.assign({},Kw),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorLink:"",colorTextBase:"",colorBgBase:"",fontFamily:`-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
66
66
|
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
67
|
-
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),xr=Math.round;function Yy(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(o=>parseFloat(o));for(let o=0;o<3;o+=1)r[o]=t(r[o]||0,n[o]||"",o);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const X$=(e,t,n)=>n===0?e:e/100;function Gu(e,t){const n=t||255;return e>n?n:e<0?0:e}class qt{constructor(t){V(this,"isValid",!0),V(this,"r",0),V(this,"g",0),V(this,"b",0),V(this,"a",1),V(this,"_h",void 0),V(this,"_s",void 0),V(this,"_l",void 0),V(this,"_v",void 0),V(this,"_max",void 0),V(this,"_min",void 0),V(this,"_brightness",void 0);function n(r){return r[0]in t&&r[1]in t&&r[2]in t}if(t)if(typeof t=="string"){let o=function(i){return r.startsWith(i)};const r=t.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):o("rgb")?this.fromRgbString(r):o("hsl")?this.fromHslString(r):(o("hsv")||o("hsb"))&&this.fromHsvString(r)}else if(t instanceof qt)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=Gu(t.r),this.g=Gu(t.g),this.b=Gu(t.b),this.a=typeof t.a=="number"?Gu(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(i){const a=i/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),o=t(this.b);return .2126*n+.7152*r+.0722*o}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=xr(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let o=this.getLightness()-t/100;return o<0&&(o=0),this._c({h:n,s:r,l:o,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let o=this.getLightness()+t/100;return o>1&&(o=1),this._c({h:n,s:r,l:o,a:this.a})}mix(t,n=50){const r=this._c(t),o=n/100,i=s=>(r[s]-this[s])*o+this[s],a={r:xr(i("r")),g:xr(i("g")),b:xr(i("b")),a:xr(i("a")*100)/100};return this._c(a)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),o=i=>xr((this[i]*this.a+n[i]*n.a*(1-this.a))/r);return this._c({r:o("r"),g:o("g"),b:o("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const o=(this.b||0).toString(16);if(t+=o.length===2?o:"0"+o,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=xr(this.a*255).toString(16);t+=i.length===2?i:"0"+i}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=xr(this.getSaturation()*100),r=xr(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const o=this.clone();return o[t]=Gu(n,r),o}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(o,i){return parseInt(n[o]+n[i||o],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:o}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof o=="number"?o:1,n<=0){const m=xr(r*255);this.r=m,this.g=m,this.b=m}let i=0,a=0,s=0;const l=t/60,c=(1-Math.abs(2*r-1))*n,d=c*(1-Math.abs(l%2-1));l>=0&&l<1?(i=c,a=d):l>=1&&l<2?(i=d,a=c):l>=2&&l<3?(a=c,s=d):l>=3&&l<4?(a=d,s=c):l>=4&&l<5?(i=d,s=c):l>=5&&l<6&&(i=c,s=d);const f=r-c/2;this.r=xr((i+f)*255),this.g=xr((a+f)*255),this.b=xr((s+f)*255)}fromHsv({h:t,s:n,v:r,a:o}){this._h=t%360,this._s=n,this._v=r,this.a=typeof o=="number"?o:1;const i=xr(r*255);if(this.r=i,this.g=i,this.b=i,n<=0)return;const a=t/60,s=Math.floor(a),l=a-s,c=xr(r*(1-n)*255),d=xr(r*(1-n*l)*255),f=xr(r*(1-n*(1-l))*255);switch(s){case 0:this.g=f,this.b=c;break;case 1:this.r=d,this.b=c;break;case 2:this.r=c,this.b=f;break;case 3:this.r=c,this.g=d;break;case 4:this.r=f,this.g=c;break;case 5:default:this.g=c,this.b=d;break}}fromHsvString(t){const n=Yy(t,X$);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=Yy(t,X$);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=Yy(t,(r,o)=>o.includes("%")?xr(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var Dm=2,Y$=.16,h8=.05,g8=.05,v8=.15,BM=5,FM=4,y8=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Q$(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-Dm*t:Math.round(e.h)+Dm*t:r=n?Math.round(e.h)+Dm*t:Math.round(e.h)-Dm*t,r<0?r+=360:r>=360&&(r-=360),r}function Z$(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-Y$*t:t===FM?r=e.s+Y$:r=e.s+h8*t,r>1&&(r=1),n&&t===BM&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function J$(e,t,n){var r;return n?r=e.v+g8*t:r=e.v-v8*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function sl(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new qt(e),o=r.toHsv(),i=BM;i>0;i-=1){var a=new qt({h:Q$(o,i,!0),s:Z$(o,i,!0),v:J$(o,i,!0)});n.push(a)}n.push(r);for(var s=1;s<=FM;s+=1){var l=new qt({h:Q$(o,s),s:Z$(o,s),v:J$(o,s)});n.push(l)}return t.theme==="dark"?y8.map(function(c){var d=c.index,f=c.amount;return new qt(t.backgroundColor||"#141414").mix(n[d],f).toHexString()}):n.map(function(c){return c.toHexString()})}var Ec={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Lx=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];Lx.primary=Lx[5];var Dx=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Dx.primary=Dx[5];var zx=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];zx.primary=zx[5];var Eh=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];Eh.primary=Eh[5];var Bx=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Bx.primary=Bx[5];var Fx=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Fx.primary=Fx[5];var Hx=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];Hx.primary=Hx[5];var Vx=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Vx.primary=Vx[5];var $h=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];$h.primary=$h[5];var Wx=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Wx.primary=Wx[5];var Kx=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Kx.primary=Kx[5];var Ux=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Ux.primary=Ux[5];var Gx=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];Gx.primary=Gx[5];var Qy={red:Lx,volcano:Dx,orange:zx,gold:Eh,yellow:Bx,lime:Fx,green:Hx,cyan:Vx,blue:$h,geekblue:Wx,purple:Kx,magenta:Ux,grey:Gx};function HM(e,{generateColorPalettes:t,generateNeutralColorPalettes:n}){const{colorSuccess:r,colorWarning:o,colorError:i,colorInfo:a,colorPrimary:s,colorBgBase:l,colorTextBase:c}=e,d=t(s),f=t(r),m=t(o),p=t(i),h=t(a),b=n(l,c),x=e.colorLink||e.colorInfo,g=t(x),v=new qt(p[1]).mix(new qt(p[3]),50).toHexString();return Object.assign(Object.assign({},b),{colorPrimaryBg:d[1],colorPrimaryBgHover:d[2],colorPrimaryBorder:d[3],colorPrimaryBorderHover:d[4],colorPrimaryHover:d[5],colorPrimary:d[6],colorPrimaryActive:d[7],colorPrimaryTextHover:d[8],colorPrimaryText:d[9],colorPrimaryTextActive:d[10],colorSuccessBg:f[1],colorSuccessBgHover:f[2],colorSuccessBorder:f[3],colorSuccessBorderHover:f[4],colorSuccessHover:f[4],colorSuccess:f[6],colorSuccessActive:f[7],colorSuccessTextHover:f[8],colorSuccessText:f[9],colorSuccessTextActive:f[10],colorErrorBg:p[1],colorErrorBgHover:p[2],colorErrorBgFilledHover:v,colorErrorBgActive:p[3],colorErrorBorder:p[3],colorErrorBorderHover:p[4],colorErrorHover:p[5],colorError:p[6],colorErrorActive:p[7],colorErrorTextHover:p[8],colorErrorText:p[9],colorErrorTextActive:p[10],colorWarningBg:m[1],colorWarningBgHover:m[2],colorWarningBorder:m[3],colorWarningBorderHover:m[4],colorWarningHover:m[4],colorWarning:m[6],colorWarningActive:m[7],colorWarningTextHover:m[8],colorWarningText:m[9],colorWarningTextActive:m[10],colorInfoBg:h[1],colorInfoBgHover:h[2],colorInfoBorder:h[3],colorInfoBorderHover:h[4],colorInfoHover:h[4],colorInfo:h[6],colorInfoActive:h[7],colorInfoTextHover:h[8],colorInfoText:h[9],colorInfoTextActive:h[10],colorLinkHover:g[4],colorLink:g[6],colorLinkActive:g[7],colorBgMask:new qt("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const b8=e=>{let t=e,n=e,r=e,o=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?o=4:e>=8&&(o=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:o}};function x8(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:o}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:o+1},b8(r))}const S8=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function Mp(e){return(e+8)/e}function C8(e){const t=Array.from({length:10}).map((n,r)=>{const o=r-1,i=e*Math.pow(Math.E,o/5),a=r>1?Math.floor(i):Math.ceil(i);return Math.floor(a/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:Mp(n)}))}const w8=e=>{const t=C8(e),n=t.map(d=>d.size),r=t.map(d=>d.lineHeight),o=n[1],i=n[0],a=n[2],s=r[1],l=r[0],c=r[2];return{fontSizeSM:i,fontSize:o,fontSizeLG:a,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:s,lineHeightLG:c,lineHeightSM:l,fontHeight:Math.round(s*o),fontHeightLG:Math.round(c*a),fontHeightSM:Math.round(l*i),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function _8(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const Wo=(e,t)=>new qt(e).setA(t).toRgbString(),qu=(e,t)=>new qt(e).darken(t).toHexString(),E8=e=>{const t=sl(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},$8=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:Wo(r,.88),colorTextSecondary:Wo(r,.65),colorTextTertiary:Wo(r,.45),colorTextQuaternary:Wo(r,.25),colorFill:Wo(r,.15),colorFillSecondary:Wo(r,.06),colorFillTertiary:Wo(r,.04),colorFillQuaternary:Wo(r,.02),colorBgSolid:Wo(r,1),colorBgSolidHover:Wo(r,.75),colorBgSolidActive:Wo(r,.95),colorBgLayout:qu(n,4),colorBgContainer:qu(n,0),colorBgElevated:qu(n,0),colorBgSpotlight:Wo(r,.85),colorBgBlur:"transparent",colorBorder:qu(n,15),colorBorderSecondary:qu(n,6)}};function Uw(e){Ec.pink=Ec.magenta,Qy.pink=Qy.magenta;const t=Object.keys(Kw).map(n=>{const r=e[n]===Ec[n]?Qy[n]:sl(e[n]);return Array.from({length:10},()=>1).reduce((o,i,a)=>(o[`${n}-${a+1}`]=r[a],o[`${n}${a+1}`]=r[a],o),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),HM(e,{generateColorPalettes:E8,generateNeutralColorPalettes:$8})),w8(e.fontSize)),_8(e)),S8(e)),x8(e))}const VM=Px(Uw),kh={token:ff,override:{override:ff},hashed:!0},WM=J.createContext(kh),mf="ant",Gw="anticon",k8=["outlined","borderless","filled","underlined"],N8=(e,t)=>t||(e?`${mf}-${e}`:mf),vt=u.createContext({getPrefixCls:N8,iconPrefixCls:Gw}),{Consumer:g1e}=vt,ek={};function ur(e){const t=u.useContext(vt),{getPrefixCls:n,direction:r,getPopupContainer:o}=t,i=t[e];return Object.assign(Object.assign({classNames:ek,styles:ek},i),{getPrefixCls:n,direction:r,getPopupContainer:o})}const O8=`-ant-${Date.now()}-${Math.random()}`;function I8(e,t){const n={},r=(a,s)=>{let l=a.clone();return l=(s==null?void 0:s(l))||l,l.toRgbString()},o=(a,s)=>{const l=new qt(a),c=sl(l.toRgbString());n[`${s}-color`]=r(l),n[`${s}-color-disabled`]=c[1],n[`${s}-color-hover`]=c[4],n[`${s}-color-active`]=c[6],n[`${s}-color-outline`]=l.clone().setA(.2).toRgbString(),n[`${s}-color-deprecated-bg`]=c[0],n[`${s}-color-deprecated-border`]=c[2]};if(t.primaryColor){o(t.primaryColor,"primary");const a=new qt(t.primaryColor),s=sl(a.toRgbString());s.forEach((c,d)=>{n[`primary-${d+1}`]=c}),n["primary-color-deprecated-l-35"]=r(a,c=>c.lighten(35)),n["primary-color-deprecated-l-20"]=r(a,c=>c.lighten(20)),n["primary-color-deprecated-t-20"]=r(a,c=>c.tint(20)),n["primary-color-deprecated-t-50"]=r(a,c=>c.tint(50)),n["primary-color-deprecated-f-12"]=r(a,c=>c.setA(c.a*.12));const l=new qt(s[0]);n["primary-color-active-deprecated-f-30"]=r(l,c=>c.setA(c.a*.3)),n["primary-color-active-deprecated-d-02"]=r(l,c=>c.darken(2))}return t.successColor&&o(t.successColor,"success"),t.warningColor&&o(t.warningColor,"warning"),t.errorColor&&o(t.errorColor,"error"),t.infoColor&&o(t.infoColor,"info"),`
|
|
67
|
+
'Noto Color Emoji'`,fontFamilyCode:"'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1,motion:!0}),xr=Math.round;function Yy(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(o=>parseFloat(o));for(let o=0;o<3;o+=1)r[o]=t(r[o]||0,n[o]||"",o);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const X$=(e,t,n)=>n===0?e:e/100;function Gu(e,t){const n=t||255;return e>n?n:e<0?0:e}class qt{constructor(t){V(this,"isValid",!0),V(this,"r",0),V(this,"g",0),V(this,"b",0),V(this,"a",1),V(this,"_h",void 0),V(this,"_s",void 0),V(this,"_l",void 0),V(this,"_v",void 0),V(this,"_max",void 0),V(this,"_min",void 0),V(this,"_brightness",void 0);function n(r){return r[0]in t&&r[1]in t&&r[2]in t}if(t)if(typeof t=="string"){let o=function(i){return r.startsWith(i)};const r=t.trim();/^#?[A-F\d]{3,8}$/i.test(r)?this.fromHexString(r):o("rgb")?this.fromRgbString(r):o("hsl")?this.fromHslString(r):(o("hsv")||o("hsb"))&&this.fromHsvString(r)}else if(t instanceof qt)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(n("rgb"))this.r=Gu(t.r),this.g=Gu(t.g),this.b=Gu(t.b),this.a=typeof t.a=="number"?Gu(t.a,1):1;else if(n("hsl"))this.fromHsl(t);else if(n("hsv"))this.fromHsv(t);else throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t))}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const n=this.toHsv();return n.h=t,this._c(n)}getLuminance(){function t(i){const a=i/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)}const n=t(this.r),r=t(this.g),o=t(this.b);return .2126*n+.7152*r+.0722*o}getHue(){if(typeof this._h>"u"){const t=this.getMax()-this.getMin();t===0?this._h=0:this._h=xr(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(typeof this._s>"u"){const t=this.getMax()-this.getMin();t===0?this._s=0:this._s=t/this.getMax()}return this._s}getLightness(){return typeof this._l>"u"&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return typeof this._v>"u"&&(this._v=this.getMax()/255),this._v}getBrightness(){return typeof this._brightness>"u"&&(this._brightness=(this.r*299+this.g*587+this.b*114)/1e3),this._brightness}darken(t=10){const n=this.getHue(),r=this.getSaturation();let o=this.getLightness()-t/100;return o<0&&(o=0),this._c({h:n,s:r,l:o,a:this.a})}lighten(t=10){const n=this.getHue(),r=this.getSaturation();let o=this.getLightness()+t/100;return o>1&&(o=1),this._c({h:n,s:r,l:o,a:this.a})}mix(t,n=50){const r=this._c(t),o=n/100,i=s=>(r[s]-this[s])*o+this[s],a={r:xr(i("r")),g:xr(i("g")),b:xr(i("b")),a:xr(i("a")*100)/100};return this._c(a)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const n=this._c(t),r=this.a+n.a*(1-this.a),o=i=>xr((this[i]*this.a+n[i]*n.a*(1-this.a))/r);return this._c({r:o("r"),g:o("g"),b:o("b"),a:r})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const n=(this.r||0).toString(16);t+=n.length===2?n:"0"+n;const r=(this.g||0).toString(16);t+=r.length===2?r:"0"+r;const o=(this.b||0).toString(16);if(t+=o.length===2?o:"0"+o,typeof this.a=="number"&&this.a>=0&&this.a<1){const i=xr(this.a*255).toString(16);t+=i.length===2?i:"0"+i}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),n=xr(this.getSaturation()*100),r=xr(this.getLightness()*100);return this.a!==1?`hsla(${t},${n}%,${r}%,${this.a})`:`hsl(${t},${n}%,${r}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return this.a!==1?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,n,r){const o=this.clone();return o[t]=Gu(n,r),o}_c(t){return new this.constructor(t)}getMax(){return typeof this._max>"u"&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return typeof this._min>"u"&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const n=t.replace("#","");function r(o,i){return parseInt(n[o]+n[i||o],16)}n.length<6?(this.r=r(0),this.g=r(1),this.b=r(2),this.a=n[3]?r(3)/255:1):(this.r=r(0,1),this.g=r(2,3),this.b=r(4,5),this.a=n[6]?r(6,7)/255:1)}fromHsl({h:t,s:n,l:r,a:o}){if(this._h=t%360,this._s=n,this._l=r,this.a=typeof o=="number"?o:1,n<=0){const m=xr(r*255);this.r=m,this.g=m,this.b=m}let i=0,a=0,s=0;const l=t/60,c=(1-Math.abs(2*r-1))*n,d=c*(1-Math.abs(l%2-1));l>=0&&l<1?(i=c,a=d):l>=1&&l<2?(i=d,a=c):l>=2&&l<3?(a=c,s=d):l>=3&&l<4?(a=d,s=c):l>=4&&l<5?(i=d,s=c):l>=5&&l<6&&(i=c,s=d);const f=r-c/2;this.r=xr((i+f)*255),this.g=xr((a+f)*255),this.b=xr((s+f)*255)}fromHsv({h:t,s:n,v:r,a:o}){this._h=t%360,this._s=n,this._v=r,this.a=typeof o=="number"?o:1;const i=xr(r*255);if(this.r=i,this.g=i,this.b=i,n<=0)return;const a=t/60,s=Math.floor(a),l=a-s,c=xr(r*(1-n)*255),d=xr(r*(1-n*l)*255),f=xr(r*(1-n*(1-l))*255);switch(s){case 0:this.g=f,this.b=c;break;case 1:this.r=d,this.b=c;break;case 2:this.r=c,this.b=f;break;case 3:this.r=c,this.g=d;break;case 4:this.r=f,this.g=c;break;case 5:default:this.g=c,this.b=d;break}}fromHsvString(t){const n=Yy(t,X$);this.fromHsv({h:n[0],s:n[1],v:n[2],a:n[3]})}fromHslString(t){const n=Yy(t,X$);this.fromHsl({h:n[0],s:n[1],l:n[2],a:n[3]})}fromRgbString(t){const n=Yy(t,(r,o)=>o.includes("%")?xr(r/100*255):r);this.r=n[0],this.g=n[1],this.b=n[2],this.a=n[3]}}var Dm=2,Y$=.16,h8=.05,g8=.05,v8=.15,BM=5,FM=4,y8=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Q$(e,t,n){var r;return Math.round(e.h)>=60&&Math.round(e.h)<=240?r=n?Math.round(e.h)-Dm*t:Math.round(e.h)+Dm*t:r=n?Math.round(e.h)+Dm*t:Math.round(e.h)-Dm*t,r<0?r+=360:r>=360&&(r-=360),r}function Z$(e,t,n){if(e.h===0&&e.s===0)return e.s;var r;return n?r=e.s-Y$*t:t===FM?r=e.s+Y$:r=e.s+h8*t,r>1&&(r=1),n&&t===BM&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(r*100)/100}function J$(e,t,n){var r;return n?r=e.v+g8*t:r=e.v-v8*t,r=Math.max(0,Math.min(1,r)),Math.round(r*100)/100}function sl(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[],r=new qt(e),o=r.toHsv(),i=BM;i>0;i-=1){var a=new qt({h:Q$(o,i,!0),s:Z$(o,i,!0),v:J$(o,i,!0)});n.push(a)}n.push(r);for(var s=1;s<=FM;s+=1){var l=new qt({h:Q$(o,s),s:Z$(o,s),v:J$(o,s)});n.push(l)}return t.theme==="dark"?y8.map(function(c){var d=c.index,f=c.amount;return new qt(t.backgroundColor||"#141414").mix(n[d],f).toHexString()}):n.map(function(c){return c.toHexString()})}var Ec={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1677FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Lx=["#fff1f0","#ffccc7","#ffa39e","#ff7875","#ff4d4f","#f5222d","#cf1322","#a8071a","#820014","#5c0011"];Lx.primary=Lx[5];var Dx=["#fff2e8","#ffd8bf","#ffbb96","#ff9c6e","#ff7a45","#fa541c","#d4380d","#ad2102","#871400","#610b00"];Dx.primary=Dx[5];var zx=["#fff7e6","#ffe7ba","#ffd591","#ffc069","#ffa940","#fa8c16","#d46b08","#ad4e00","#873800","#612500"];zx.primary=zx[5];var Eh=["#fffbe6","#fff1b8","#ffe58f","#ffd666","#ffc53d","#faad14","#d48806","#ad6800","#874d00","#613400"];Eh.primary=Eh[5];var Bx=["#feffe6","#ffffb8","#fffb8f","#fff566","#ffec3d","#fadb14","#d4b106","#ad8b00","#876800","#614700"];Bx.primary=Bx[5];var Fx=["#fcffe6","#f4ffb8","#eaff8f","#d3f261","#bae637","#a0d911","#7cb305","#5b8c00","#3f6600","#254000"];Fx.primary=Fx[5];var Hx=["#f6ffed","#d9f7be","#b7eb8f","#95de64","#73d13d","#52c41a","#389e0d","#237804","#135200","#092b00"];Hx.primary=Hx[5];var Vx=["#e6fffb","#b5f5ec","#87e8de","#5cdbd3","#36cfc9","#13c2c2","#08979c","#006d75","#00474f","#002329"];Vx.primary=Vx[5];var $h=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];$h.primary=$h[5];var Wx=["#f0f5ff","#d6e4ff","#adc6ff","#85a5ff","#597ef7","#2f54eb","#1d39c4","#10239e","#061178","#030852"];Wx.primary=Wx[5];var Kx=["#f9f0ff","#efdbff","#d3adf7","#b37feb","#9254de","#722ed1","#531dab","#391085","#22075e","#120338"];Kx.primary=Kx[5];var Ux=["#fff0f6","#ffd6e7","#ffadd2","#ff85c0","#f759ab","#eb2f96","#c41d7f","#9e1068","#780650","#520339"];Ux.primary=Ux[5];var Gx=["#a6a6a6","#999999","#8c8c8c","#808080","#737373","#666666","#404040","#1a1a1a","#000000","#000000"];Gx.primary=Gx[5];var Qy={red:Lx,volcano:Dx,orange:zx,gold:Eh,yellow:Bx,lime:Fx,green:Hx,cyan:Vx,blue:$h,geekblue:Wx,purple:Kx,magenta:Ux,grey:Gx};function HM(e,{generateColorPalettes:t,generateNeutralColorPalettes:n}){const{colorSuccess:r,colorWarning:o,colorError:i,colorInfo:a,colorPrimary:s,colorBgBase:l,colorTextBase:c}=e,d=t(s),f=t(r),m=t(o),p=t(i),h=t(a),b=n(l,c),x=e.colorLink||e.colorInfo,g=t(x),v=new qt(p[1]).mix(new qt(p[3]),50).toHexString();return Object.assign(Object.assign({},b),{colorPrimaryBg:d[1],colorPrimaryBgHover:d[2],colorPrimaryBorder:d[3],colorPrimaryBorderHover:d[4],colorPrimaryHover:d[5],colorPrimary:d[6],colorPrimaryActive:d[7],colorPrimaryTextHover:d[8],colorPrimaryText:d[9],colorPrimaryTextActive:d[10],colorSuccessBg:f[1],colorSuccessBgHover:f[2],colorSuccessBorder:f[3],colorSuccessBorderHover:f[4],colorSuccessHover:f[4],colorSuccess:f[6],colorSuccessActive:f[7],colorSuccessTextHover:f[8],colorSuccessText:f[9],colorSuccessTextActive:f[10],colorErrorBg:p[1],colorErrorBgHover:p[2],colorErrorBgFilledHover:v,colorErrorBgActive:p[3],colorErrorBorder:p[3],colorErrorBorderHover:p[4],colorErrorHover:p[5],colorError:p[6],colorErrorActive:p[7],colorErrorTextHover:p[8],colorErrorText:p[9],colorErrorTextActive:p[10],colorWarningBg:m[1],colorWarningBgHover:m[2],colorWarningBorder:m[3],colorWarningBorderHover:m[4],colorWarningHover:m[4],colorWarning:m[6],colorWarningActive:m[7],colorWarningTextHover:m[8],colorWarningText:m[9],colorWarningTextActive:m[10],colorInfoBg:h[1],colorInfoBgHover:h[2],colorInfoBorder:h[3],colorInfoBorderHover:h[4],colorInfoHover:h[4],colorInfo:h[6],colorInfoActive:h[7],colorInfoTextHover:h[8],colorInfoText:h[9],colorInfoTextActive:h[10],colorLinkHover:g[4],colorLink:g[6],colorLinkActive:g[7],colorBgMask:new qt("#000").setA(.45).toRgbString(),colorWhite:"#fff"})}const b8=e=>{let t=e,n=e,r=e,o=e;return e<6&&e>=5?t=e+1:e<16&&e>=6?t=e+2:e>=16&&(t=16),e<7&&e>=5?n=4:e<8&&e>=7?n=5:e<14&&e>=8?n=6:e<16&&e>=14?n=7:e>=16&&(n=8),e<6&&e>=2?r=1:e>=6&&(r=2),e>4&&e<8?o=4:e>=8&&(o=6),{borderRadius:e,borderRadiusXS:r,borderRadiusSM:n,borderRadiusLG:t,borderRadiusOuter:o}};function x8(e){const{motionUnit:t,motionBase:n,borderRadius:r,lineWidth:o}=e;return Object.assign({motionDurationFast:`${(n+t).toFixed(1)}s`,motionDurationMid:`${(n+t*2).toFixed(1)}s`,motionDurationSlow:`${(n+t*3).toFixed(1)}s`,lineWidthBold:o+1},b8(r))}const S8=e=>{const{controlHeight:t}=e;return{controlHeightSM:t*.75,controlHeightXS:t*.5,controlHeightLG:t*1.25}};function Mp(e){return(e+8)/e}function C8(e){const t=Array.from({length:10}).map((n,r)=>{const o=r-1,i=e*Math.pow(Math.E,o/5),a=r>1?Math.floor(i):Math.ceil(i);return Math.floor(a/2)*2});return t[1]=e,t.map(n=>({size:n,lineHeight:Mp(n)}))}const w8=e=>{const t=C8(e),n=t.map(d=>d.size),r=t.map(d=>d.lineHeight),o=n[1],i=n[0],a=n[2],s=r[1],l=r[0],c=r[2];return{fontSizeSM:i,fontSize:o,fontSizeLG:a,fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:s,lineHeightLG:c,lineHeightSM:l,fontHeight:Math.round(s*o),fontHeightLG:Math.round(c*a),fontHeightSM:Math.round(l*i),lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function _8(e){const{sizeUnit:t,sizeStep:n}=e;return{sizeXXL:t*(n+8),sizeXL:t*(n+4),sizeLG:t*(n+2),sizeMD:t*(n+1),sizeMS:t*n,size:t*n,sizeSM:t*(n-1),sizeXS:t*(n-2),sizeXXS:t*(n-3)}}const Wo=(e,t)=>new qt(e).setA(t).toRgbString(),qu=(e,t)=>new qt(e).darken(t).toHexString(),E8=e=>{const t=sl(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},$8=(e,t)=>{const n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:Wo(r,.88),colorTextSecondary:Wo(r,.65),colorTextTertiary:Wo(r,.45),colorTextQuaternary:Wo(r,.25),colorFill:Wo(r,.15),colorFillSecondary:Wo(r,.06),colorFillTertiary:Wo(r,.04),colorFillQuaternary:Wo(r,.02),colorBgSolid:Wo(r,1),colorBgSolidHover:Wo(r,.75),colorBgSolidActive:Wo(r,.95),colorBgLayout:qu(n,4),colorBgContainer:qu(n,0),colorBgElevated:qu(n,0),colorBgSpotlight:Wo(r,.85),colorBgBlur:"transparent",colorBorder:qu(n,15),colorBorderSecondary:qu(n,6)}};function Uw(e){Ec.pink=Ec.magenta,Qy.pink=Qy.magenta;const t=Object.keys(Kw).map(n=>{const r=e[n]===Ec[n]?Qy[n]:sl(e[n]);return Array.from({length:10},()=>1).reduce((o,i,a)=>(o[`${n}-${a+1}`]=r[a],o[`${n}${a+1}`]=r[a],o),{})}).reduce((n,r)=>(n=Object.assign(Object.assign({},n),r),n),{});return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e),t),HM(e,{generateColorPalettes:E8,generateNeutralColorPalettes:$8})),w8(e.fontSize)),_8(e)),S8(e)),x8(e))}const VM=Px(Uw),kh={token:ff,override:{override:ff},hashed:!0},WM=J.createContext(kh),mf="ant",Gw="anticon",k8=["outlined","borderless","filled","underlined"],N8=(e,t)=>t||(e?`${mf}-${e}`:mf),vt=u.createContext({getPrefixCls:N8,iconPrefixCls:Gw}),{Consumer:y1e}=vt,ek={};function ur(e){const t=u.useContext(vt),{getPrefixCls:n,direction:r,getPopupContainer:o}=t,i=t[e];return Object.assign(Object.assign({classNames:ek,styles:ek},i),{getPrefixCls:n,direction:r,getPopupContainer:o})}const O8=`-ant-${Date.now()}-${Math.random()}`;function I8(e,t){const n={},r=(a,s)=>{let l=a.clone();return l=(s==null?void 0:s(l))||l,l.toRgbString()},o=(a,s)=>{const l=new qt(a),c=sl(l.toRgbString());n[`${s}-color`]=r(l),n[`${s}-color-disabled`]=c[1],n[`${s}-color-hover`]=c[4],n[`${s}-color-active`]=c[6],n[`${s}-color-outline`]=l.clone().setA(.2).toRgbString(),n[`${s}-color-deprecated-bg`]=c[0],n[`${s}-color-deprecated-border`]=c[2]};if(t.primaryColor){o(t.primaryColor,"primary");const a=new qt(t.primaryColor),s=sl(a.toRgbString());s.forEach((c,d)=>{n[`primary-${d+1}`]=c}),n["primary-color-deprecated-l-35"]=r(a,c=>c.lighten(35)),n["primary-color-deprecated-l-20"]=r(a,c=>c.lighten(20)),n["primary-color-deprecated-t-20"]=r(a,c=>c.tint(20)),n["primary-color-deprecated-t-50"]=r(a,c=>c.tint(50)),n["primary-color-deprecated-f-12"]=r(a,c=>c.setA(c.a*.12));const l=new qt(s[0]);n["primary-color-active-deprecated-f-30"]=r(l,c=>c.setA(c.a*.3)),n["primary-color-active-deprecated-d-02"]=r(l,c=>c.darken(2))}return t.successColor&&o(t.successColor,"success"),t.warningColor&&o(t.warningColor,"warning"),t.errorColor&&o(t.errorColor,"error"),t.infoColor&&o(t.infoColor,"info"),`
|
|
68
68
|
:root {
|
|
69
69
|
${Object.keys(n).map(a=>`--${e}-${a}: ${n[a]};`).join(`
|
|
70
70
|
`)}
|
|
@@ -454,9 +454,9 @@ html body {
|
|
|
454
454
|
* @license MIT
|
|
455
455
|
*/var CI="popstate";function zce(e={}){function t(r,o){let{pathname:i,search:a,hash:s}=r.location;return WS("",{pathname:i,search:a,hash:s},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:Cf(o)}return Fce(t,n,null,e)}function Fn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ci(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Bce(){return Math.random().toString(36).substring(2,10)}function wI(e,t){return{usr:e.state,key:e.key,idx:t}}function WS(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Iu(t):t,state:n,key:t&&t.key||r||Bce()}}function Cf({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Iu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Fce(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:i=!1}=r,a=o.history,s="POP",l=null,c=d();c==null&&(c=0,a.replaceState({...a.state,idx:c},""));function d(){return(a.state||{idx:null}).idx}function f(){s="POP";let x=d(),g=x==null?null:x-c;c=x,l&&l({action:s,location:b.location,delta:g})}function m(x,g){s="PUSH";let v=WS(b.location,x,g);c=d()+1;let S=wI(v,c),C=b.createHref(v);try{a.pushState(S,"",C)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;o.location.assign(C)}i&&l&&l({action:s,location:b.location,delta:1})}function p(x,g){s="REPLACE";let v=WS(b.location,x,g);c=d();let S=wI(v,c),C=b.createHref(v);a.replaceState(S,"",C),i&&l&&l({action:s,location:b.location,delta:0})}function h(x){return Hce(x)}let b={get action(){return s},get location(){return e(o,a)},listen(x){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(CI,f),l=x,()=>{o.removeEventListener(CI,f),l=null}},createHref(x){return t(o,x)},createURL:h,encodeLocation(x){let g=h(x);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:m,replace:p,go(x){return a.go(x)}};return b}function Hce(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Fn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Cf(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function fz(e,t,n="/"){return Vce(e,t,n,!1)}function Vce(e,t,n,r){let o=typeof t=="string"?Iu(t):t,i=Pa(o.pathname||"/",n);if(i==null)return null;let a=mz(e);Wce(a);let s=null;for(let l=0;s==null&&l<a.length;++l){let c=tue(i);s=Jce(a[l],c,r)}return s}function mz(e,t=[],n=[],r="",o=!1){let i=(a,s,l=o,c)=>{let d={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;Fn(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let f=$a([r,d.relativePath]),m=n.concat(d);a.children&&a.children.length>0&&(Fn(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),mz(a.children,t,m,f,l)),!(a.path==null&&!a.index)&&t.push({path:f,score:Qce(f,a.index),routesMeta:m})};return e.forEach((a,s)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))i(a,s);else for(let c of pz(a.path))i(a,s,!0,c)}),t}function pz(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let a=pz(r.join("/")),s=[];return s.push(...a.map(l=>l===""?i:[i,l].join("/"))),o&&s.push(...a),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function Wce(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Zce(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Kce=/^:[\w-]+$/,Uce=3,Gce=2,qce=1,Xce=10,Yce=-2,_I=e=>e==="*";function Qce(e,t){let n=e.split("/"),r=n.length;return n.some(_I)&&(r+=Yce),t&&(r+=Gce),n.filter(o=>!_I(o)).reduce((o,i)=>o+(Kce.test(i)?Uce:i===""?qce:Xce),r)}function Zce(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function Jce(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let s=0;s<r.length;++s){let l=r[s],c=s===r.length-1,d=i==="/"?t:t.slice(i.length)||"/",f=wf({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),m=l.route;if(!f&&c&&n&&!r[r.length-1].route.index&&(f=wf({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!f)return null;Object.assign(o,f.params),a.push({params:o,pathname:$a([i,f.pathname]),pathnameBase:iue($a([i,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(i=$a([i,f.pathnameBase]))}return a}function wf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=eue(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],a=i.replace(/(.)\/+$/,"$1"),s=o.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:f},m)=>{if(d==="*"){let h=s[m]||"";a=i.slice(0,i.length-h.length).replace(/(.)\/+$/,"$1")}const p=s[m];return f&&!p?c[d]=void 0:c[d]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:a,pattern:e}}function eue(e,t=!1,n=!0){ci(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,s,l)=>(r.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function tue(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ci(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Pa(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var hz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nue=e=>hz.test(e);function rue(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Iu(e):e,i;if(n)if(nue(n))i=n;else{if(n.includes("//")){let a=n;n=n.replace(/\/\/+/g,"/"),ci(!1,`Pathnames cannot have embedded double slashes - normalizing ${a} -> ${n}`)}n.startsWith("/")?i=EI(n.substring(1),"/"):i=EI(n,t)}else i=t;return{pathname:i,search:aue(r),hash:sue(o)}}function EI(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Vb(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function oue(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function gz(e){let t=oue(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function vz(e,t,n,r=!1){let o;typeof e=="string"?o=Iu(e):(o={...e},Fn(!o.pathname||!o.pathname.includes("?"),Vb("?","pathname","search",o)),Fn(!o.pathname||!o.pathname.includes("#"),Vb("#","pathname","hash",o)),Fn(!o.search||!o.search.includes("#"),Vb("#","search","hash",o)));let i=e===""||o.pathname==="",a=i?"/":o.pathname,s;if(a==null)s=n;else{let f=t.length-1;if(!r&&a.startsWith("..")){let m=a.split("/");for(;m[0]==="..";)m.shift(),f-=1;o.pathname=m.join("/")}s=f>=0?t[f]:"/"}let l=rue(o,s),c=a&&a!=="/"&&a.endsWith("/"),d=(i||a===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var $a=e=>e.join("/").replace(/\/\/+/g,"/"),iue=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),aue=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sue=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,lue=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function cue(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function uue(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var yz=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function bz(e,t){let n=e;if(typeof n!="string"||!hz.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(yz)try{let i=new URL(window.location.href),a=n.startsWith("//")?new URL(i.protocol+n):new URL(n),s=Pa(a.pathname,t);a.origin===i.origin&&s!=null?n=s+a.search+a.hash:o=!0}catch{ci(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var xz=["POST","PUT","PATCH","DELETE"];new Set(xz);var due=["GET",...xz];new Set(due);var Ru=u.createContext(null);Ru.displayName="DataRouter";var qv=u.createContext(null);qv.displayName="DataRouterState";var fue=u.createContext(!1),Sz=u.createContext({isTransitioning:!1});Sz.displayName="ViewTransition";var mue=u.createContext(new Map);mue.displayName="Fetchers";var pue=u.createContext(null);pue.displayName="Await";var di=u.createContext(null);di.displayName="Navigation";var im=u.createContext(null);im.displayName="Location";var ca=u.createContext({outlet:null,matches:[],isDataRoute:!1});ca.displayName="Route";var s1=u.createContext(null);s1.displayName="RouteError";var Cz="REACT_ROUTER_ERROR",hue="REDIRECT",gue="ROUTE_ERROR_RESPONSE";function vue(e){if(e.startsWith(`${Cz}:${hue}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function yue(e){if(e.startsWith(`${Cz}:${gue}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new lue(t.status,t.statusText,t.data)}catch{}}function bue(e,{relative:t}={}){Fn(am(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=u.useContext(di),{hash:o,pathname:i,search:a}=sm(e,{relative:t}),s=i;return n!=="/"&&(s=i==="/"?n:$a([n,i])),r.createHref({pathname:s,search:a,hash:o})}function am(){return u.useContext(im)!=null}function ua(){return Fn(am(),"useLocation() may be used only in the context of a <Router> component."),u.useContext(im).location}var wz="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _z(e){u.useContext(di).static||u.useLayoutEffect(e)}function Ts(){let{isDataRoute:e}=u.useContext(ca);return e?Tue():xue()}function xue(){Fn(am(),"useNavigate() may be used only in the context of a <Router> component.");let e=u.useContext(Ru),{basename:t,navigator:n}=u.useContext(di),{matches:r}=u.useContext(ca),{pathname:o}=ua(),i=JSON.stringify(gz(r)),a=u.useRef(!1);return _z(()=>{a.current=!0}),u.useCallback((l,c={})=>{if(ci(a.current,wz),!a.current)return;if(typeof l=="number"){n.go(l);return}let d=vz(l,JSON.parse(i),o,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:$a([t,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[t,n,i,o,e])}u.createContext(null);function Sue(){let{matches:e}=u.useContext(ca),t=e[e.length-1];return t?t.params:{}}function sm(e,{relative:t}={}){let{matches:n}=u.useContext(ca),{pathname:r}=ua(),o=JSON.stringify(gz(n));return u.useMemo(()=>vz(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function Cue(e,t){return Ez(e,t)}function Ez(e,t,n,r,o){var v;Fn(am(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=u.useContext(di),{matches:a}=u.useContext(ca),s=a[a.length-1],l=s?s.params:{},c=s?s.pathname:"/",d=s?s.pathnameBase:"/",f=s&&s.route;{let S=f&&f.path||"";kz(c,!f||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
456
456
|
|
|
457
|
-
Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let m=ua(),p;if(t){let S=typeof t=="string"?Iu(t):t;Fn(d==="/"||((v=S.pathname)==null?void 0:v.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${S.pathname}" was given in the \`location\` prop.`),p=S}else p=m;let h=p.pathname||"/",b=h;if(d!=="/"){let S=d.replace(/^\//,"").split("/");b="/"+h.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=fz(e,{pathname:b});ci(f||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),ci(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=kue(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:$a([d,i.encodeLocation?i.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?d:$a([d,i.encodeLocation?i.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),a,n,r,o);return t&&g?u.createElement(im.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...p},navigationType:"POP"}},g):g}function wue(){let e=Pue(),t=cue(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=u.createElement(u.Fragment,null,u.createElement("p",null,"💿 Hey developer 👋"),u.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",u.createElement("code",{style:i},"ErrorBoundary")," or"," ",u.createElement("code",{style:i},"errorElement")," prop on your route.")),u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},t),n?u.createElement("pre",{style:o},n):null,a)}var _ue=u.createElement(wue,null),$z=class extends u.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=yue(e.digest);n&&(e=n)}let t=e!==void 0?u.createElement(ca.Provider,{value:this.props.routeContext},u.createElement(s1.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?u.createElement(Eue,{error:e},t):t}};$z.contextType=fue;var Wb=new WeakMap;function Eue({children:e,error:t}){let{basename:n}=u.useContext(di);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=vue(t.digest);if(r){let o=Wb.get(t);if(o)throw o;let i=bz(r.location,n);if(yz&&!Wb.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Wb.set(t,a),a}return u.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function $ue({routeContext:e,match:t,children:n}){let r=u.useContext(Ru);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),u.createElement(ca.Provider,{value:e},n)}function kue(e,t=[],n=null,r=null,o=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,a=n==null?void 0:n.errors;if(a!=null){let d=i.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);Fn(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let s=!1,l=-1;if(n)for(let d=0;d<i.length;d++){let f=i[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=d),f.route.id){let{loaderData:m,errors:p}=n,h=f.route.loader&&!m.hasOwnProperty(f.route.id)&&(!p||p[f.route.id]===void 0);if(f.route.lazy||h){s=!0,l>=0?i=i.slice(0,l+1):i=[i[0]];break}}}let c=n&&r?(d,f)=>{var m,p;r(d,{location:n.location,params:((p=(m=n.matches)==null?void 0:m[0])==null?void 0:p.params)??{},unstable_pattern:uue(n.matches),errorInfo:f})}:void 0;return i.reduceRight((d,f,m)=>{let p,h=!1,b=null,x=null;n&&(p=a&&f.route.id?a[f.route.id]:void 0,b=f.route.errorElement||_ue,s&&(l<0&&m===0?(kz("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,x=null):l===m&&(h=!0,x=f.route.hydrateFallbackElement||null)));let g=t.concat(i.slice(0,m+1)),v=()=>{let S;return p?S=b:h?S=x:f.route.Component?S=u.createElement(f.route.Component,null):f.route.element?S=f.route.element:S=d,u.createElement($ue,{match:f,routeContext:{outlet:d,matches:g,isDataRoute:n!=null},children:S})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?u.createElement($z,{location:n.location,revalidation:n.revalidation,component:b,error:p,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:c}):v()},null)}function l1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Nue(e){let t=u.useContext(Ru);return Fn(t,l1(e)),t}function Oue(e){let t=u.useContext(qv);return Fn(t,l1(e)),t}function Iue(e){let t=u.useContext(ca);return Fn(t,l1(e)),t}function c1(e){let t=Iue(e),n=t.matches[t.matches.length-1];return Fn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Rue(){return c1("useRouteId")}function Pue(){var r;let e=u.useContext(s1),t=Oue("useRouteError"),n=c1("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Tue(){let{router:e}=Nue("useNavigate"),t=c1("useNavigate"),n=u.useRef(!1);return _z(()=>{n.current=!0}),u.useCallback(async(o,i={})=>{ci(n.current,wz),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var $I={};function kz(e,t,n){!t&&!$I[e]&&($I[e]=!0,ci(!1,n))}u.memo(jue);function jue({routes:e,future:t,state:n,onError:r}){return Ez(e,void 0,n,r,t)}function Ya(e){Fn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Mue({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:i=!1,unstable_useTransitions:a}){Fn(!am(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=u.useMemo(()=>({basename:s,navigator:o,static:i,unstable_useTransitions:a,future:{}}),[s,o,i,a]);typeof n=="string"&&(n=Iu(n));let{pathname:c="/",search:d="",hash:f="",state:m=null,key:p="default"}=n,h=u.useMemo(()=>{let b=Pa(c,s);return b==null?null:{location:{pathname:b,search:d,hash:f,state:m,key:p},navigationType:r}},[s,c,d,f,m,p,r]);return ci(h!=null,`<Router basename="${s}"> is not able to match the URL "${c}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:u.createElement(di.Provider,{value:l},u.createElement(im.Provider,{children:t,value:h}))}function Aue({children:e,location:t}){return Cue(KS(e),t)}function KS(e,t=[]){let n=[];return u.Children.forEach(e,(r,o)=>{if(!u.isValidElement(r))return;let i=[...t,o];if(r.type===u.Fragment){n.push.apply(n,KS(r.props.children,i));return}Fn(r.type===Ya,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Fn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=KS(r.props.children,i)),n.push(a)}),n}var Fp="get",Hp="application/x-www-form-urlencoded";function Xv(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Lue(e){return Xv(e)&&e.tagName.toLowerCase()==="button"}function Due(e){return Xv(e)&&e.tagName.toLowerCase()==="form"}function zue(e){return Xv(e)&&e.tagName.toLowerCase()==="input"}function Bue(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Fue(e,t){return e.button===0&&(!t||t==="_self")&&!Bue(e)}function US(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function Hue(e,t){let n=US(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var ep=null;function Vue(){if(ep===null)try{new FormData(document.createElement("form"),0),ep=!1}catch{ep=!0}return ep}var Wue=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Kb(e){return e!=null&&!Wue.has(e)?(ci(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Hp}"`),null):e}function Kue(e,t){let n,r,o,i,a;if(Due(e)){let s=e.getAttribute("action");r=s?Pa(s,t):null,n=e.getAttribute("method")||Fp,o=Kb(e.getAttribute("enctype"))||Hp,i=new FormData(e)}else if(Lue(e)||zue(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(r=l?Pa(l,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||Fp,o=Kb(e.getAttribute("formenctype"))||Kb(s.getAttribute("enctype"))||Hp,i=new FormData(s,e),!Vue()){let{name:c,type:d,value:f}=e;if(d==="image"){let m=c?`${c}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else c&&i.append(c,f)}}else{if(Xv(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Fp,r=null,o=Hp,a=e}return i&&o==="text/plain"&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function u1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Uue(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Pa(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function Gue(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function que(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Xue(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let a=await Gue(i,n);return a.links?a.links():[]}return[]}));return Jue(r.flat(1).filter(que).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function kI(e,t,n,r,o,i){let a=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,s=(l,c)=>{var d;return n[c].pathname!==l.pathname||((d=n[c].route.path)==null?void 0:d.endsWith("*"))&&n[c].params["*"]!==l.params["*"]};return i==="assets"?t.filter((l,c)=>a(l,c)||s(l,c)):i==="data"?t.filter((l,c)=>{var f;let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(a(l,c)||s(l,c))return!0;if(l.route.shouldRevalidate){let m=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function Yue(e,t,{includeHydrateFallback:n}={}){return Que(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function Que(e){return[...new Set(e)]}function Zue(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Jue(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(Zue(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function Nz(){let e=u.useContext(Ru);return u1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function ede(){let e=u.useContext(qv);return u1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var d1=u.createContext(void 0);d1.displayName="FrameworkContext";function Oz(){let e=u.useContext(d1);return u1(e,"You must render this element inside a <HydratedRouter> element"),e}function tde(e,t){let n=u.useContext(d1),[r,o]=u.useState(!1),[i,a]=u.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=t,m=u.useRef(null);u.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let b=g=>{g.forEach(v=>{a(v.isIntersecting)})},x=new IntersectionObserver(b,{threshold:.5});return m.current&&x.observe(m.current),()=>{x.disconnect()}}},[e]),u.useEffect(()=>{if(r){let b=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(b)}}},[r]);let p=()=>{o(!0)},h=()=>{o(!1),a(!1)};return n?e!=="intent"?[i,m,{}]:[i,m,{onFocus:Ju(s,p),onBlur:Ju(l,h),onMouseEnter:Ju(c,p),onMouseLeave:Ju(d,h),onTouchStart:Ju(f,p)}]:[!1,m,{}]}function Ju(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function nde({page:e,...t}){let{router:n}=Nz(),r=u.useMemo(()=>fz(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?u.createElement(ode,{page:e,matches:r,...t}):null}function rde(e){let{manifest:t,routeModules:n}=Oz(),[r,o]=u.useState([]);return u.useEffect(()=>{let i=!1;return Xue(e,t,n).then(a=>{i||o(a)}),()=>{i=!0}},[e,t,n]),r}function ode({page:e,matches:t,...n}){let r=ua(),{future:o,manifest:i,routeModules:a}=Oz(),{basename:s}=Nz(),{loaderData:l,matches:c}=ede(),d=u.useMemo(()=>kI(e,t,c,i,r,"data"),[e,t,c,i,r]),f=u.useMemo(()=>kI(e,t,c,i,r,"assets"),[e,t,c,i,r]),m=u.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let b=new Set,x=!1;if(t.forEach(v=>{var C;let S=i.routes[v.route.id];!S||!S.hasLoader||(!d.some(_=>_.route.id===v.route.id)&&v.route.id in l&&((C=a[v.route.id])!=null&&C.shouldRevalidate)||S.hasClientLoader?x=!0:b.add(v.route.id))}),b.size===0)return[];let g=Uue(e,s,o.unstable_trailingSlashAwareDataRequests,"data");return x&&b.size>0&&g.searchParams.set("_routes",t.filter(v=>b.has(v.route.id)).map(v=>v.route.id).join(",")),[g.pathname+g.search]},[s,o.unstable_trailingSlashAwareDataRequests,l,r,i,d,t,e,a]),p=u.useMemo(()=>Yue(f,i),[f,i]),h=rde(f);return u.createElement(u.Fragment,null,m.map(b=>u.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...n})),p.map(b=>u.createElement("link",{key:b,rel:"modulepreload",href:b,...n})),h.map(({key:b,link:x})=>u.createElement("link",{key:b,nonce:n.nonce,...x})))}function ide(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var ade=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{ade&&(window.__reactRouterVersion="7.12.0")}catch{}function sde({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=u.useRef();o.current==null&&(o.current=zce({window:r,v5Compat:!0}));let i=o.current,[a,s]=u.useState({action:i.action,location:i.location}),l=u.useCallback(c=>{n===!1?s(c):u.startTransition(()=>s(c))},[n]);return u.useLayoutEffect(()=>i.listen(l),[i,l]),u.createElement(Mue,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,unstable_useTransitions:n})}var Iz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rz=u.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:i,replace:a,state:s,target:l,to:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m,...p},h){let{basename:b,unstable_useTransitions:x}=u.useContext(di),g=typeof c=="string"&&Iz.test(c),v=bz(c,b);c=v.to;let S=bue(c,{relative:o}),[C,_,w]=tde(r,p),N=dde(c,{replace:a,state:s,target:l,preventScrollReset:d,relative:o,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:x});function k($){t&&t($),$.defaultPrevented||N($)}let E=u.createElement("a",{...p,...w,href:v.absoluteURL||S,onClick:v.isExternal||i?t:k,ref:ide(h,_),target:l,"data-discover":!g&&n==="render"?"true":void 0});return C&&!g?u.createElement(u.Fragment,null,E,u.createElement(nde,{page:S})):E});Rz.displayName="Link";var lde=u.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:a,viewTransition:s,children:l,...c},d){let f=sm(a,{relative:c.relative}),m=ua(),p=u.useContext(qv),{navigator:h,basename:b}=u.useContext(di),x=p!=null&&vde(f)&&s===!0,g=h.encodeLocation?h.encodeLocation(f).pathname:f.pathname,v=m.pathname,S=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(v=v.toLowerCase(),S=S?S.toLowerCase():null,g=g.toLowerCase()),S&&b&&(S=Pa(S,b)||S);const C=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let _=v===g||!o&&v.startsWith(g)&&v.charAt(C)==="/",w=S!=null&&(S===g||!o&&S.startsWith(g)&&S.charAt(g.length)==="/"),N={isActive:_,isPending:w,isTransitioning:x},k=_?t:void 0,E;typeof r=="function"?E=r(N):E=[r,_?"active":null,w?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let $=typeof i=="function"?i(N):i;return u.createElement(Rz,{...c,"aria-current":k,className:E,ref:d,style:$,to:a,viewTransition:s},typeof l=="function"?l(N):l)});lde.displayName="NavLink";var cde=u.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:a=Fp,action:s,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m,...p},h)=>{let{unstable_useTransitions:b}=u.useContext(di),x=hde(),g=gde(s,{relative:c}),v=a.toLowerCase()==="get"?"get":"post",S=typeof s=="string"&&Iz.test(s),C=_=>{if(l&&l(_),_.defaultPrevented)return;_.preventDefault();let w=_.nativeEvent.submitter,N=(w==null?void 0:w.getAttribute("formmethod"))||a,k=()=>x(w||_.currentTarget,{fetcherKey:t,method:N,navigate:n,replace:o,state:i,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m});b&&n!==!1?u.startTransition(()=>k()):k()};return u.createElement("form",{ref:h,method:v,action:g,onSubmit:r?l:C,...p,"data-discover":!S&&e==="render"?"true":void 0})});cde.displayName="Form";function ude(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pz(e){let t=u.useContext(Ru);return Fn(t,ude(e)),t}function dde(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:i,viewTransition:a,unstable_defaultShouldRevalidate:s,unstable_useTransitions:l}={}){let c=Ts(),d=ua(),f=sm(e,{relative:i});return u.useCallback(m=>{if(Fue(m,t)){m.preventDefault();let p=n!==void 0?n:Cf(d)===Cf(f),h=()=>c(e,{replace:p,state:r,preventScrollReset:o,relative:i,viewTransition:a,unstable_defaultShouldRevalidate:s});l?u.startTransition(()=>h()):h()}},[d,c,f,n,r,t,e,o,i,a,s,l])}function fde(e){ci(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=u.useRef(US(e)),n=u.useRef(!1),r=ua(),o=u.useMemo(()=>Hue(r.search,n.current?null:t.current),[r.search]),i=Ts(),a=u.useCallback((s,l)=>{const c=US(typeof s=="function"?s(new URLSearchParams(o)):s);n.current=!0,i("?"+c,l)},[i,o]);return[o,a]}var mde=0,pde=()=>`__${String(++mde)}__`;function hde(){let{router:e}=Pz("useSubmit"),{basename:t}=u.useContext(di),n=Rue(),r=e.fetch,o=e.navigate;return u.useCallback(async(i,a={})=>{let{action:s,method:l,encType:c,formData:d,body:f}=Kue(i,t);if(a.navigate===!1){let m=a.fetcherKey||pde();await r(m,n,a.action||s,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||c,flushSync:a.flushSync})}else await o(a.action||s,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,o,t,n])}function gde(e,{relative:t}={}){let{basename:n}=u.useContext(di),r=u.useContext(ca);Fn(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...sm(e||".",{relative:t})},a=ua();if(e==null){i.search=a.search;let s=new URLSearchParams(i.search),l=s.getAll("index");if(l.some(d=>d==="")){s.delete("index"),l.filter(f=>f).forEach(f=>s.append("index",f));let d=s.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:$a([n,i.pathname])),Cf(i)}function vde(e,{relative:t}={}){let n=u.useContext(Sz);Fn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Pz("useViewTransitionState"),o=sm(e,{relative:t});if(!n.isTransitioning)return!1;let i=Pa(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=Pa(n.nextLocation.pathname,r)||n.nextLocation.pathname;return wf(o.pathname,a)!=null||wf(o.pathname,i)!=null}const Tz=0,jz=1,Mz=2,NI=3;var OI=Object.prototype.hasOwnProperty;function GS(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&GS(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(OI.call(e,n)&&++r&&!OI.call(t,n)||!(n in t)||!GS(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const ha=new WeakMap,ba=()=>{},jr=ba(),Uh=Object,fn=e=>e===jr,xi=e=>typeof e=="function",Ta=(e,t)=>({...e,...t}),Az=e=>xi(e.then),Ub={},tp={},f1="undefined",lm=typeof window!=f1,qS=typeof document!=f1,yde=lm&&"Deno"in window,bde=()=>lm&&typeof window.requestAnimationFrame!=f1,Lz=(e,t)=>{const n=ha.get(e);return[()=>!fn(t)&&e.get(t)||Ub,r=>{if(!fn(t)){const o=e.get(t);t in tp||(tp[t]=o),n[5](t,Ta(o,r),o||Ub)}},n[6],()=>!fn(t)&&t in tp?tp[t]:!fn(t)&&e.get(t)||Ub]};let XS=!0;const xde=()=>XS,[YS,QS]=lm&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ba,ba],Sde=()=>{const e=qS&&document.visibilityState;return fn(e)||e!=="hidden"},Cde=e=>(qS&&document.addEventListener("visibilitychange",e),YS("focus",e),()=>{qS&&document.removeEventListener("visibilitychange",e),QS("focus",e)}),wde=e=>{const t=()=>{XS=!0,e()},n=()=>{XS=!1};return YS("online",t),YS("offline",n),()=>{QS("online",t),QS("offline",n)}},_de={isOnline:xde,isVisible:Sde},Ede={initFocus:Cde,initReconnect:wde},II=!J.useId,Ic=!lm||yde,$de=e=>bde()?window.requestAnimationFrame(e):setTimeout(e,1),Vp=Ic?u.useEffect:u.useLayoutEffect,Gb=typeof navigator<"u"&&navigator.connection,RI=!Ic&&Gb&&(["slow-2g","2g"].includes(Gb.effectiveType)||Gb.saveData),np=new WeakMap,kde=e=>Uh.prototype.toString.call(e),qb=(e,t)=>e===`[object ${t}]`;let Nde=0;const ZS=e=>{const t=typeof e,n=kde(e),r=qb(n,"Date"),o=qb(n,"RegExp"),i=qb(n,"Object");let a,s;if(Uh(e)===e&&!r&&!o){if(a=np.get(e),a)return a;if(a=++Nde+"~",np.set(e,a),Array.isArray(e)){for(a="@",s=0;s<e.length;s++)a+=ZS(e[s])+",";np.set(e,a)}if(i){a="#";const l=Uh.keys(e).sort();for(;!fn(s=l.pop());)fn(e[s])||(a+=s+":"+ZS(e[s])+",");np.set(e,a)}}else a=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return a},m1=e=>{if(xi(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?ZS(e):"",[e,t]};let Ode=0;const JS=()=>++Ode;async function Dz(...e){const[t,n,r,o]=e,i=Ta({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let a=i.populateCache;const s=i.rollbackOnError;let l=i.optimisticData;const c=m=>typeof s=="function"?s(m):s!==!1,d=i.throwOnError;if(xi(n)){const m=n,p=[],h=t.keys();for(const b of h)!/^\$(inf|sub)\$/.test(b)&&m(t.get(b)._k)&&p.push(b);return Promise.all(p.map(f))}return f(n);async function f(m){const[p]=m1(m);if(!p)return;const[h,b]=Lz(t,p),[x,g,v,S]=ha.get(t),C=()=>{const I=x[p];return(xi(i.revalidate)?i.revalidate(h().data,m):i.revalidate!==!1)&&(delete v[p],delete S[p],I&&I[0])?I[0](Mz).then(()=>h().data):h().data};if(e.length<3)return C();let _=r,w,N=!1;const k=JS();g[p]=[k,0];const E=!fn(l),$=h(),O=$.data,R=$._c,T=fn(R)?O:R;if(E&&(l=xi(l)?l(T,O):l,b({data:l,_c:T})),xi(_))try{_=_(T)}catch(I){w=I,N=!0}if(_&&Az(_))if(_=await _.catch(I=>{w=I,N=!0}),k!==g[p][0]){if(N)throw w;return _}else N&&E&&c(w)&&(a=!0,b({data:T,_c:jr}));if(a&&!N)if(xi(a)){const I=a(_,T);b({data:I,error:jr,_c:jr})}else b({data:_,error:jr,_c:jr});if(g[p][1]=JS(),Promise.resolve(C()).then(()=>{b({_c:jr})}),N){if(d)throw w;return}return _}}const PI=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},zz=(e,t)=>{if(!ha.has(e)){const n=Ta(Ede,t),r=Object.create(null),o=Dz.bind(jr,e);let i=ba;const a=Object.create(null),s=(d,f)=>{const m=a[d]||[];return a[d]=m,m.push(f),()=>m.splice(m.indexOf(f),1)},l=(d,f,m)=>{e.set(d,f);const p=a[d];if(p)for(const h of p)h(f,m)},c=()=>{if(!ha.has(e)&&(ha.set(e,[r,Object.create(null),Object.create(null),Object.create(null),o,l,s]),!Ic)){const d=n.initFocus(setTimeout.bind(jr,PI.bind(jr,r,Tz))),f=n.initReconnect(setTimeout.bind(jr,PI.bind(jr,r,jz)));i=()=>{d&&d(),f&&f(),ha.delete(e)}}};return c(),[e,o,c,i]}return[e,ha.get(e)[4]]},Ide=(e,t,n,r,o)=>{const i=n.errorRetryCount,a=o.retryCount,s=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;!fn(i)&&a>i||setTimeout(r,s,o)},Rde=GS,[p1,Pde]=zz(new Map),Bz=Ta({onLoadingSlow:ba,onSuccess:ba,onError:ba,onErrorRetry:Ide,onDiscarded:ba,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:RI?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:RI?5e3:3e3,compare:Rde,isPaused:()=>!1,cache:p1,mutate:Pde,fallback:{}},_de),Fz=(e,t)=>{const n=Ta(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:a}=t;r&&i&&(n.use=r.concat(i)),o&&a&&(n.fallback=Ta(o,a))}return n},eC=u.createContext({}),Tde=e=>{const{value:t}=e,n=u.useContext(eC),r=xi(t),o=u.useMemo(()=>r?t(n):t,[r,n,t]),i=u.useMemo(()=>r?o:Fz(n,o),[r,n,o]),a=o&&o.provider,s=u.useRef(jr);a&&!s.current&&(s.current=zz(a(i.cache||p1),o));const l=s.current;return l&&(i.cache=l[0],i.mutate=l[1]),Vp(()=>{if(l)return l[2]&&l[2](),l[3]},[]),u.createElement(eC.Provider,Ta(e,{value:i}))},jde="$inf$",Hz=lm&&window.__SWR_DEVTOOLS_USE__,Mde=Hz?window.__SWR_DEVTOOLS_USE__:[],Ade=()=>{Hz&&(window.__SWR_DEVTOOLS_REACT__=J)},Lde=e=>xi(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],Yv=()=>{const e=u.useContext(eC);return u.useMemo(()=>Ta(Bz,e),[e])},Dde=e=>(t,n,r)=>e(t,n&&((...i)=>{const[a]=m1(t),[,,,s]=ha.get(p1);if(a.startsWith(jde))return n(...i);const l=s[a];return fn(l)?n(...i):(delete s[a],l)}),r),zde=Mde.concat(Dde),Bde=e=>function(...n){const r=Yv(),[o,i,a]=Lde(n),s=Fz(r,a);let l=e;const{use:c}=s,d=(c||[]).concat(zde);for(let f=d.length;f--;)l=d[f](l);return l(o,i||s.fetcher||null,s)},Fde=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o>=0&&(r[o]=r[r.length-1],r.pop())}};Ade();const Xb=J.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),Yb={dedupe:!0},TI=Promise.resolve(jr),Hde=(e,t,n)=>{const{cache:r,compare:o,suspense:i,fallbackData:a,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:c,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:m,strictServerPrefetchWarning:p}=n,[h,b,x,g]=ha.get(r),[v,S]=m1(e),C=u.useRef(!1),_=u.useRef(!1),w=u.useRef(v),N=u.useRef(t),k=u.useRef(n),E=()=>k.current,$=()=>E().isVisible()&&E().isOnline(),[O,R,T,I]=Lz(r,v),P=u.useRef({}).current,j=fn(a)?fn(n.fallback)?jr:n.fallback[v]:a,L=(X,ce)=>{for(const pe in P){const ge=pe;if(ge==="data"){if(!o(X[ge],ce[ge])&&(!fn(X[ge])||!o(W,ce[ge])))return!1}else if(ce[ge]!==X[ge])return!1}return!0},D=u.useMemo(()=>{const X=!v||!t?!1:fn(s)?E().isPaused()||i?!1:l!==!1:s,ce=ue=>{const me=Ta(ue);return delete me._k,X?{isValidating:!0,isLoading:!0,...me}:me},pe=O(),ge=I(),we=ce(pe),ae=pe===ge?we:ce(ge);let de=we;return[()=>{const ue=ce(O());return L(ue,de)?(de.data=ue.data,de.isLoading=ue.isLoading,de.isValidating=ue.isValidating,de.error=ue.error,de):(de=ue,ue)},()=>ae]},[r,v]),z=P0.useSyncExternalStore(u.useCallback(X=>T(v,(ce,pe)=>{L(pe,ce)||X()}),[r,v]),D[0],D[1]),M=!C.current,H=h[v]&&h[v].length>0,F=z.data,A=fn(F)?j&&Az(j)?Xb(j):j:F,B=z.error,K=u.useRef(A),W=m?fn(F)?fn(K.current)?A:K.current:F:A,q=v&&fn(A),U=!Ic&&P0.useSyncExternalStore(()=>ba,()=>!1,()=>!0);p&&U&&!i&&q&&console.warn(`Missing pre-initiated data for serialized key "${v}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const te=H&&!fn(B)?!1:M&&!fn(s)?s:E().isPaused()?!1:i?fn(A)?!1:l:fn(A)||l,le=!!(v&&t&&M&&te),ie=fn(z.isValidating)?le:z.isValidating,ee=fn(z.isLoading)?le:z.isLoading,se=u.useCallback(async X=>{const ce=N.current;if(!v||!ce||_.current||E().isPaused())return!1;let pe,ge,we=!0;const ae=X||{},de=!x[v]||!ae.dedupe,ue=()=>II?!_.current&&v===w.current&&C.current:v===w.current,me={isValidating:!1,isLoading:!1},Ce=()=>{R(me)},ne=()=>{const ye=x[v];ye&&ye[1]===ge&&delete x[v]},he={isValidating:!0};fn(O().data)&&(he.isLoading=!0);try{if(de&&(R(he),n.loadingTimeout&&fn(O().data)&&setTimeout(()=>{we&&ue()&&E().onLoadingSlow(v,n)},n.loadingTimeout),x[v]=[ce(S),JS()]),[pe,ge]=x[v],pe=await pe,de&&setTimeout(ne,n.dedupingInterval),!x[v]||x[v][1]!==ge)return de&&ue()&&E().onDiscarded(v),!1;me.error=jr;const ye=b[v];if(!fn(ye)&&(ge<=ye[0]||ge<=ye[1]||ye[1]===0))return Ce(),de&&ue()&&E().onDiscarded(v),!1;const xe=O().data;me.data=o(xe,pe)?xe:pe,de&&ue()&&E().onSuccess(pe,v,n)}catch(ye){ne();const xe=E(),{shouldRetryOnError:$e}=xe;xe.isPaused()||(me.error=ye,de&&ue()&&(xe.onError(ye,v,xe),($e===!0||xi($e)&&$e(ye))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||$())&&xe.onErrorRetry(ye,v,xe,Se=>{const be=h[v];be&&be[0]&&be[0](NI,Se)},{retryCount:(ae.retryCount||0)+1,dedupe:!0})))}return we=!1,Ce(),!0},[v,r]),re=u.useCallback((...X)=>Dz(r,w.current,...X),[]);if(Vp(()=>{N.current=t,k.current=n,fn(F)||(K.current=F)}),Vp(()=>{if(!v)return;const X=se.bind(jr,Yb);let ce=0;E().revalidateOnFocus&&(ce=Date.now()+E().focusThrottleInterval);const ge=Fde(v,h,(we,ae={})=>{if(we==Tz){const de=Date.now();E().revalidateOnFocus&&de>ce&&$()&&(ce=de+E().focusThrottleInterval,X())}else if(we==jz)E().revalidateOnReconnect&&$()&&X();else{if(we==Mz)return se();if(we==NI)return se(ae)}});return _.current=!1,w.current=v,C.current=!0,R({_k:S}),te&&(x[v]||(fn(A)||Ic?X():$de(X))),()=>{_.current=!0,ge()}},[v]),Vp(()=>{let X;function ce(){const ge=xi(c)?c(O().data):c;ge&&X!==-1&&(X=setTimeout(pe,ge))}function pe(){!O().error&&(d||E().isVisible())&&(f||E().isOnline())?se(Yb).then(ce):ce()}return ce(),()=>{X&&(clearTimeout(X),X=-1)}},[c,d,f,v]),u.useDebugValue(W),i){if(!II&&Ic&&q)throw new Error("Fallback data is required when using Suspense in SSR.");q&&(N.current=t,k.current=n,_.current=!1);const X=g[v],ce=!fn(X)&&q?re(X):TI;if(Xb(ce),!fn(B)&&q)throw B;const pe=q?se(Yb):TI;!fn(W)&&q&&(pe.status="fulfilled",pe.value=!0),Xb(pe)}return{mutate:re,get data(){return P.data=!0,W},get error(){return P.error=!0,B},get isValidating(){return P.isValidating=!0,ie},get isLoading(){return P.isLoading=!0,ee}}},Vde=Uh.defineProperty(Tde,"defaultValue",{value:Bz}),Qn=Bde(Hde),Wde=()=>globalThis.__VF_PROJECT_AI_RUNTIME_ENV__,Kde=e=>{let t=(e==null?void 0:e.trim())??"";return t?(t.startsWith("/")||(t=`/${t}`),t.endsWith("/")||(t+="/"),t):"/ui/"},Ude=e=>{let t=(e==null?void 0:e.trim())??"";return t?(t.startsWith("/")||(t=`/${t}`),t):"/ws"},Qv=()=>Wde()??{},Gde=()=>Kde(Qv().__VF_PROJECT_AI_CLIENT_BASE__??void 0),Vz=()=>Qv().__VF_PROJECT_AI_SERVER_HOST__??void 0,Wz=()=>Qv().__VF_PROJECT_AI_SERVER_PORT__??void 0,qde=()=>Ude(Qv().__VF_PROJECT_AI_SERVER_WS_PATH__??void 0),Xde="8787",Qb=Vz(),Zb=Wz(),Pu={"Content-Type":"application/json"},Kz=()=>Qb!=null&&Qb!==""?Qb:window.location.hostname,Uz=()=>Zb!=null&&Zb!==""?Zb:Xde,Yde=()=>`http://${Kz()}:${Uz()}`,h1=e=>{if(e.startsWith("http://")||e.startsWith("https://"))return e;const t=e.startsWith("/")?e:`/${e}`;return`${Yde()}${t}`},cm=e=>new URL(h1(e));class mc extends Error{constructor(n,r){super(r.message);Ae(this,"status");Ae(this,"code");Ae(this,"details");this.name="ApiError",this.status=n,this.code=r.code,this.details=r.details}}const Gh=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),Qde=e=>Gh(e)&&e.success===!0&&"data"in e,Gz=e=>Gh(e)&&e.success===!1&&Gh(e.error)&&typeof e.error.message=="string"&&typeof e.error.code=="string",Zde=async e=>{const t=await e.text();if(t.trim()==="")return null;try{return JSON.parse(t)}catch{return t}},Jde=(e,t,n)=>{if(Gz(t))return new mc(e,t.error);if(Gh(t)){const r=typeof t.error=="string"?t.error:typeof t.message=="string"?t.message:n,o=typeof t.code=="string"?t.code:"request_failed";return new mc(e,{code:o,message:r,...t.details!==void 0?{details:t.details}:{}})}return typeof t=="string"&&t.trim()!==""?new mc(e,{code:"request_failed",message:t}):new mc(e,{code:"request_failed",message:n})},qz=async(e,t)=>{const n=await Zde(e);if(!e.ok){const r=t??`Request failed with status ${e.status}`,o=Jde(e.status,n,r);throw console.error(t??"[api] request failed",e.status,o.message,o.details),o}if(Gz(n))throw new mc(e.status,n.error);return Qde(n)?n.data:n},Mr=(e,t)=>e instanceof mc&&e.message.trim()!==""||e instanceof Error&&e.message.trim()!==""?e.message:t;async function Rr(e,t){const n=typeof e=="string"?h1(e):e.toString(),r=await fetch(n,t);return qz(r)}async function g1(e,t,n){const r=typeof e=="string"?h1(e):e.toString(),o=await fetch(r,t);return qz(o,n)}const xa={BASE_URL:"/__VF_PROJECT_AI_CLIENT_BASE__/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function Xz(e){return"init"in e}function tC(e){return!!e.write}function jI(e){return"v"in e||"e"in e}function qh(e){if("e"in e)throw e.e;if((xa?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}const Xh=new WeakMap;function Yz(e){var t;return Yh(e)&&!!((t=Xh.get(e))!=null&&t[0])}function efe(e){const t=Xh.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))}function nC(e,t){let n=Xh.get(e);if(!n){n=[!0,new Set],Xh.set(e,n);const r=()=>{n[0]=!1};e.then(r,r)}n[1].add(t)}function Yh(e){return typeof(e==null?void 0:e.then)=="function"}function Qz(e,t,n){if(!n.p.has(e)){n.p.add(e);const r=()=>n.p.delete(e);t.then(r,r)}}function Zz(e,t,n){var r;const o=new Set;for(const i of((r=n.get(e))==null?void 0:r.t)||[])o.add(i);for(const i of t.p)o.add(i);return o}const tfe=(e,t,...n)=>t.read(...n),nfe=(e,t,...n)=>t.write(...n),rfe=(e,t)=>{if(t.INTERNAL_onInit)return t.INTERNAL_onInit(e);if(t.unstable_onInit)return console.warn("[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."),t.unstable_onInit(e)},ofe=(e,t,n)=>{var r;return(r=t.onMount)==null?void 0:r.call(t,n)},ife=(e,t)=>{var n;const r=Qr(e),o=r[0],i=r[6],a=r[9];if((xa?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let s=o.get(t);return s||(s={d:new Map,p:new Set,n:0},o.set(t,s),(n=i.i)==null||n.call(i,t),a==null||a(e,t)),s},afe=e=>{const t=Qr(e),n=t[1],r=t[3],o=t[4],i=t[5],a=t[6],s=t[13],l=[],c=d=>{try{d()}catch(f){l.push(f)}};do{a.f&&c(a.f);const d=new Set,f=d.add.bind(d);r.forEach(m=>{var p;return(p=n.get(m))==null?void 0:p.l.forEach(f)}),r.clear(),i.forEach(f),i.clear(),o.forEach(f),o.clear(),d.forEach(c),r.size&&s(e)}while(r.size||i.size||o.size);if(l.length)throw new AggregateError(l)},sfe=e=>{const t=Qr(e),n=t[1],r=t[2],o=t[3],i=t[11],a=t[14],s=t[17],l=[],c=new WeakSet,d=new WeakSet,f=Array.from(o);for(;f.length;){const m=f[f.length-1],p=i(e,m);if(d.has(m)){f.pop();continue}if(c.has(m)){if(r.get(m)===p.n)l.push([m,p]);else if((xa?"production":void 0)!=="production"&&r.has(m))throw new Error("[Bug] invalidated atom exists");d.add(m),f.pop();continue}c.add(m);for(const h of Zz(m,p,n))c.has(h)||f.push(h)}for(let m=l.length-1;m>=0;--m){const[p,h]=l[m];let b=!1;for(const x of h.d.keys())if(x!==p&&o.has(x)){b=!0;break}b&&(a(e,p),s(e,p)),r.delete(p)}},rC=new WeakSet,lfe=(e,t)=>{var n,r;const o=Qr(e),i=o[1],a=o[2],s=o[3],l=o[6],c=o[7],d=o[11],f=o[12],m=o[13],p=o[14],h=o[16],b=o[17],x=o[20],g=d(e,t);if(jI(g)){if(i.has(t)&&a.get(t)!==g.n)return g;let E=!1;for(const[$,O]of g.d)if(p(e,$).n!==O){E=!0;break}if(!E)return g}g.d.clear();let v=!0;function S(){i.has(t)&&(b(e,t),m(e),f(e))}function C(E){var $;if(E===t){const R=d(e,E);if(!jI(R))if(Xz(E))x(e,E,E.init);else throw new Error("no atom init");return qh(R)}const O=p(e,E);try{return qh(O)}finally{g.d.set(E,O.n),Yz(g.v)&&Qz(t,g.v,O),i.has(t)&&(($=i.get(E))==null||$.t.add(t)),v||S()}}let _,w;const N={get signal(){return _||(_=new AbortController),_.signal},get setSelf(){return(xa?"production":void 0)!=="production"&&!tC(t)&&console.warn("setSelf function cannot be used with read-only atom"),!w&&tC(t)&&(w=(...E)=>{if((xa?"production":void 0)!=="production"&&v&&console.warn("setSelf function cannot be called in sync"),!v)try{return h(e,t,...E)}finally{m(e),f(e)}}),w}},k=g.n;try{(xa?"production":void 0)!=="production"&&rC.delete(e);const E=c(e,t,C,N);return(xa?"production":void 0)!=="production"&&rC.has(e)&&console.warn("Detected store mutation during atom read. This is not supported."),x(e,t,E),Yh(E)&&(nC(E,()=>_==null?void 0:_.abort()),E.then(S,S)),(n=l.r)==null||n.call(l,t),g}catch(E){return delete g.v,g.e=E,++g.n,g}finally{v=!1,k!==g.n&&a.get(t)===k&&(a.set(t,g.n),s.add(t),(r=l.c)==null||r.call(l,t))}},cfe=(e,t)=>{const n=Qr(e),r=n[1],o=n[2],i=n[11],a=[t];for(;a.length;){const s=a.pop(),l=i(e,s);for(const c of Zz(s,l,r)){const d=i(e,c);o.set(c,d.n),a.push(c)}}},ufe=(e,t,...n)=>{const r=Qr(e),o=r[3],i=r[6],a=r[8],s=r[11],l=r[12],c=r[13],d=r[14],f=r[15],m=r[16],p=r[17],h=r[20];let b=!0;const x=v=>qh(d(e,v)),g=(v,...S)=>{var C;const _=s(e,v);try{if(v===t){if(!Xz(v))throw new Error("atom not writable");(xa?"production":void 0)!=="production"&&rC.add(e);const w=_.n,N=S[0];h(e,v,N),p(e,v),w!==_.n&&(o.add(v),f(e,v),(C=i.c)==null||C.call(i,v));return}else return m(e,v,...S)}finally{b||(c(e),l(e))}};try{return a(e,t,x,g,...n)}finally{b=!1}},dfe=(e,t)=>{var n;const r=Qr(e),o=r[1],i=r[3],a=r[6],s=r[11],l=r[15],c=r[18],d=r[19],f=s(e,t),m=o.get(t);if(m&&!Yz(f.v)){for(const[p,h]of f.d)if(!m.d.has(p)){const b=s(e,p);c(e,p).t.add(t),m.d.add(p),h!==b.n&&(i.add(p),l(e,p),(n=a.c)==null||n.call(a,p))}for(const p of m.d)if(!f.d.has(p)){m.d.delete(p);const h=d(e,p);h==null||h.t.delete(t)}}},ffe=(e,t)=>{var n;const r=Qr(e),o=r[1],i=r[4],a=r[6],s=r[10],l=r[11],c=r[12],d=r[13],f=r[14],m=r[16],p=r[18],h=l(e,t);let b=o.get(t);if(!b){f(e,t);for(const x of h.d.keys())p(e,x).t.add(t);if(b={l:new Set,d:new Set(h.d.keys()),t:new Set},o.set(t,b),tC(t)){const x=()=>{let g=!0;const v=(...S)=>{try{return m(e,t,...S)}finally{g||(d(e),c(e))}};try{const S=s(e,t,v);S&&(b.u=()=>{g=!0;try{S()}finally{g=!1}})}finally{g=!1}};i.add(x)}(n=a.m)==null||n.call(a,t)}return b},mfe=(e,t)=>{var n,r;const o=Qr(e),i=o[1],a=o[5],s=o[6],l=o[11],c=o[19],d=l(e,t);let f=i.get(t);if(!f||f.l.size)return f;let m=!1;for(const p of f.t)if((n=i.get(p))!=null&&n.d.has(t)){m=!0;break}if(!m){f.u&&a.add(f.u),f=void 0,i.delete(t);for(const p of d.d.keys()){const h=c(e,p);h==null||h.t.delete(t)}(r=s.u)==null||r.call(s,t);return}return f},pfe=(e,t,n)=>{const r=Qr(e)[11],o=r(e,t),i="v"in o,a=o.v;if(Yh(n))for(const s of o.d.keys())Qz(t,n,r(e,s));o.v=n,delete o.e,(!i||!Object.is(a,o.v))&&(++o.n,Yh(a)&&efe(a))},hfe=(e,t)=>{const n=Qr(e)[14];return qh(n(e,t))},gfe=(e,t,...n)=>{const r=Qr(e),o=r[12],i=r[13],a=r[16];try{return a(e,t,...n)}finally{i(e),o(e)}},vfe=(e,t,n)=>{const r=Qr(e),o=r[12],i=r[18],a=r[19],l=i(e,t).l;return l.add(n),o(e),()=>{l.delete(n),a(e,t),o(e)}},Jz=new WeakMap,Qr=e=>{const t=Jz.get(e);if((xa?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function yfe(...e){const t={get(r){const o=Qr(t)[21];return o(t,r)},set(r,...o){const i=Qr(t)[22];return i(t,r,...o)},sub(r,o){const i=Qr(t)[23];return i(t,r,o)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},tfe,nfe,rfe,ofe,ife,afe,sfe,lfe,cfe,ufe,dfe,ffe,mfe,pfe,hfe,gfe,vfe,void 0].map((r,o)=>e[o]||r);return Jz.set(t,Object.freeze(n)),t}const eB={};let bfe=0;function Tu(e,t){const n=`atom${++bfe}`,r={toString(){return(eB?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?r.read=e:(r.init=e,r.read=xfe,r.write=Sfe),r}function xfe(e){return e(this)}function Sfe(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}function Cfe(){return yfe()}let ed;function wfe(){return ed||(ed=Cfe(),(eB?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=ed),globalThis.__JOTAI_DEFAULT_STORE__!==ed&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),ed}const _fe={},Efe=u.createContext(void 0);function tB(e){return u.useContext(Efe)||wfe()}const oC=e=>typeof(e==null?void 0:e.then)=="function",iC=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},$fe=J.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(iC(e),e)}),Jb=new WeakMap,MI=(e,t)=>{let n=Jb.get(e);return n||(n=new Promise((r,o)=>{let i=e;const a=c=>d=>{i===c&&r(d)},s=c=>d=>{i===c&&o(d)},l=()=>{try{const c=t();oC(c)?(Jb.set(c,n),i=c,c.then(a(c),s(c)),nC(c,l)):r(c)}catch(c){o(c)}};e.then(a(e),s(e)),nC(e,l)}),Jb.set(e,n)),n};function vl(e,t){const{delay:n,unstable_promiseStatus:r=!J.use}={},o=tB(),[[i,a,s],l]=u.useReducer(d=>{const f=o.get(e);return Object.is(d[0],f)&&d[1]===o&&d[2]===e?d:[f,o,e]},void 0,()=>[o.get(e),o,e]);let c=i;if((a!==o||s!==e)&&(l(),c=o.get(e)),u.useEffect(()=>{const d=o.sub(e,()=>{if(r)try{const f=o.get(e);oC(f)&&iC(MI(f,()=>o.get(e)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),d},[o,e,n,r]),u.useDebugValue(c),oC(c)){const d=MI(c,()=>o.get(e));return r&&iC(d),$fe(d)}return c}function kfe(e,t){const n=tB();return u.useCallback((...o)=>{if((_fe?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...o)},[n,e])}function um(e,t){return[vl(e),kfe(e)]}const Nfe=Tu(Number(localStorage.getItem("sidebarWidth"))||300),nB=Tu(!1),v1=Tu(localStorage.getItem("sidebarCollapsed")==="true");Tu(void 0);const y1=Tu(localStorage.getItem("theme")||"system"),rB=Tu(!0);function Ofe({collapsed:e,onToggleCollapse:t}){const{t:n,i18n:r}=Ot(),[o,i]=um(y1),a=Ts(),l=ua().pathname,c=J.useMemo(()=>[{key:"zh",label:"简体中文",icon:r.language.startsWith("zh")?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("div",{className:"nav-menu-icon-placeholder"}),onClick:()=>{r.changeLanguage("zh")}},{key:"en",label:"English",icon:r.language.startsWith("en")?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("div",{className:"nav-menu-icon-placeholder"}),onClick:()=>{r.changeLanguage("en")}}],[r.language]),d=J.useMemo(()=>[{key:"light",label:n("common.themeLight"),icon:o==="light"?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("span",{className:"material-symbols-rounded nav-menu-icon",children:"light_mode"}),onClick:()=>{i("light"),localStorage.setItem("theme","light")}},{key:"dark",label:n("common.themeDark"),icon:o==="dark"?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("span",{className:"material-symbols-rounded nav-menu-icon",children:"dark_mode"}),onClick:()=>{i("dark"),localStorage.setItem("theme","dark")}},{key:"system",label:n("common.themeSystem"),icon:o==="system"?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("span",{className:"material-symbols-rounded nav-menu-icon",children:"desktop_windows"}),onClick:()=>{i("system"),localStorage.setItem("theme","system")}}],[o,n,i]),f=J.useMemo(()=>[{key:"sessions",icon:"chat_bubble",label:n("common.sessions"),path:"/",active:l==="/"||l.startsWith("/session/")},{key:"knowledge",icon:"library_books",label:n("common.knowledgeBase"),path:"/knowledge",active:l==="/knowledge"},{key:"automation",icon:"schedule",label:n("common.automation"),path:"/automation",active:l==="/automation"},{key:"benchmark",icon:"speed",label:n("common.benchmark"),path:"/benchmark",active:l==="/benchmark"},{key:"archive",icon:"archive",label:n("common.archivedSessions"),path:"/archive",active:l==="/archive"}],[l,n]);return y.jsxs("div",{className:"nav-rail",children:[y.jsx("div",{className:"nav-rail-top",children:f.map(m=>y.jsx(dt,{title:m.label,placement:"right",children:y.jsx("span",{children:y.jsx(ct,{type:"text",className:`nav-item ${m.active?"active":""}`,onClick:()=>void a(m.path),icon:y.jsx("span",{className:"material-symbols-rounded",children:m.icon})})})},m.key))}),y.jsxs("div",{className:"nav-rail-bottom",children:[y.jsx(dt,{title:n("common.theme"),placement:"right",children:y.jsx("span",{children:y.jsx(Jc,{menu:{items:d},placement:"topRight",trigger:["click"],children:y.jsx(ct,{type:"text",className:"nav-item",icon:y.jsx("span",{className:"material-symbols-rounded",children:o==="light"?"light_mode":o==="dark"?"dark_mode":"desktop_windows"})})})})}),y.jsx(dt,{title:n("common.language"),placement:"right",children:y.jsx("span",{children:y.jsx(Jc,{menu:{items:c},placement:"topRight",trigger:["click"],children:y.jsx(ct,{type:"text",className:"nav-item",icon:y.jsx("span",{className:"material-symbols-rounded",children:"language"})})})})}),y.jsx(dt,{title:n("common.settings"),placement:"right",children:y.jsx("span",{children:y.jsx(ct,{type:"text",className:`nav-item ${l==="/config"?"active":""}`,icon:y.jsx("span",{className:"material-symbols-rounded",children:"settings"}),onClick:()=>void a("/config")})})})]})]})}const ju=({keys:e,defaults:t,omit:n})=>{const[r,o]=fde(),i=u.useMemo(()=>new Set(e),[e]),a=u.useMemo(()=>e.reduce((l,c)=>{const d=r.get(c),f=(t==null?void 0:t[c])??"";return l[c]=d??f,l},{}),[t,e,r]),s=u.useCallback(l=>{const c=new URLSearchParams,d=e.reduce((f,m)=>{const p=r.get(m),h=(t==null?void 0:t[m])??"";return f[m]=p??h,f},{});Object.assign(d,l),e.forEach(f=>{const m=d[f]??"";m===""||(n!=null&&n[f]?n[f](m):!1)||c.set(f,m)});for(const[f,m]of r.entries())i.has(f)||c.append(f,m);c.toString()!==r.toString()&&o(c,{replace:!0})},[t,i,e,n,r,o]);return{values:a,update:s,searchParams:r}};async function Ife(){return Rr("/api/automation/rules")}async function Rfe(e){return Rr("/api/automation/rules",{method:"POST",headers:Pu,body:JSON.stringify(e)})}async function AI(e,t){return Rr(`/api/automation/rules/${e}`,{method:"PATCH",headers:Pu,body:JSON.stringify(t)})}async function Pfe(e){return Rr(`/api/automation/rules/${e}`,{method:"DELETE"})}async function Tfe(e){return Rr(`/api/automation/rules/${e}/run`,{method:"POST"})}async function jfe(e,t=50){const n=cm(`/api/automation/rules/${e}/runs`);return n.searchParams.set("limit",t.toString()),Rr(n)}async function Mfe(){return Rr("/api/benchmark/categories")}async function Afe(e){const t=cm("/api/benchmark/cases");return Rr(t)}async function Lfe(e,t){return Rr(`/api/benchmark/results/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async function rp(e){return g1("/api/benchmark/run",{method:"POST",headers:Pu,body:JSON.stringify(e)},"Failed to start benchmark run")}async function Dfe(e){return Rr(`/api/benchmark/runs/${encodeURIComponent(e)}`)}async function b1(){return Rr("/api/config")}async function zfe(e,t,n){return g1("/api/config",{method:"PATCH",headers:Pu,body:JSON.stringify({source:e,section:t,value:n})},"[api] update config failed:")}async function Bfe(e){const t=cm("/api/ai/specs/detail");return t.searchParams.set("path",e),Rr(t)}async function Ffe(e){const t=cm("/api/ai/rules/detail");return t.searchParams.set("path",e),Rr(t)}async function oB(e="active"){return Rr(e==="archived"?"/api/sessions/archived":"/api/sessions")}async function LI(e,t,n,r,o){return Rr("/api/sessions",{method:"POST",headers:Pu,body:JSON.stringify({title:e,initialMessage:t,initialContent:n,model:r,start:o==null?void 0:o.start,parentSessionId:o==null?void 0:o.parentSessionId,id:o==null?void 0:o.id,promptType:o==null?void 0:o.promptType,promptName:o==null?void 0:o.promptName,effort:o==null?void 0:o.effort,permissionMode:o==null?void 0:o.permissionMode,adapter:o==null?void 0:o.adapter})})}async function Hfe(e,t){const n=cm(`/api/sessions/${e}/messages`);return Rr(n)}async function Qh(e){return g1(`/api/sessions/${e}`,{method:"DELETE"},"[api] delete session failed:")}async function Sa(e,t){return Rr(`/api/sessions/${e}`,{method:"PATCH",headers:Pu,body:JSON.stringify(t)})}const x1=e=>e===" "?"space":e.toLowerCase(),Vfe=(e,t)=>{if(e==null||e.trim()==="")return null;const n=e.split("+").map(o=>o.trim()).filter(Boolean);if(n.length===0)return null;const r={key:"",metaKey:!1,ctrlKey:!1,altKey:!1,shiftKey:!1};for(const o of n){const i=o.toLowerCase();i==="cmd"||i==="command"||i==="meta"?r.metaKey=!0:i==="ctrl"||i==="control"?r.ctrlKey=!0:i==="alt"||i==="option"?r.altKey=!0:i==="shift"?r.shiftKey=!0:i==="mod"?t?r.metaKey=!0:r.ctrlKey=!0:r.key=x1(i)}return r.key===""?null:r},iB=(e,t)=>e==null||e.trim()===""?"":e.split("+").map(r=>r.trim()).filter(Boolean).map(r=>{const o=r.toLowerCase();return o==="mod"?t?"⌘":"Ctrl":o==="cmd"||o==="command"||o==="meta"?"⌘":o==="ctrl"||o==="control"?"Ctrl":o==="alt"||o==="option"?"Alt":o==="shift"?"Shift":o==="space"?"Space":r.length===1?r.toUpperCase():r}).join("+"),aC=(e,t,n)=>{const r=Vfe(t,n);return r==null||e.metaKey!==r.metaKey||e.ctrlKey!==r.ctrlKey||e.altKey!==r.altKey||e.shiftKey!==r.shiftKey?!1:x1(e.key)===r.key},Wfe=e=>{const t=x1(e.key);if(["meta","control","shift","alt"].includes(t))return null;const n=[];return(e.metaKey||e.ctrlKey)&&n.push("mod"),e.shiftKey&&n.push("shift"),e.altKey&&n.push("alt"),n.push(t),n.join("+")},Kfe=({shortcut:e,enabled:t=!0,isMac:n,onTrigger:r})=>{u.useEffect(()=>{if(!t)return;const o=i=>{aC(i,e,n)&&r(i)};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,n,r,e])};var aB={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Dd,function(){return function(n,r,o){n=n||{};var i=r.prototype,a={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function s(c,d,f,m){return i.fromToBase(c,d,f,m)}o.en.relativeTime=a,i.fromToBase=function(c,d,f,m,p){for(var h,b,x,g=f.$locale().relativeTime||a,v=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],S=v.length,C=0;C<S;C+=1){var _=v[C];_.d&&(h=m?o(c).diff(f,_.d,!0):f.diff(c,_.d,!0));var w=(n.rounding||Math.round)(Math.abs(h));if(x=h>0,w<=_.r||!_.r){w<=1&&C>0&&(_=v[C-1]);var N=g[_.l];p&&(w=p(""+w)),b=typeof N=="string"?N.replace("%d",w):N(w,d,_.l,x);break}}if(d)return b;var k=x?g.future:g.past;return typeof k=="function"?k(b):k.replace("%s",b)},i.to=function(c,d){return s(c,d,this,!0)},i.from=function(c,d){return s(c,d,this)};var l=function(c){return c.$u?o.utc():o()};i.toNow=function(c){return this.to(l(this),c)},i.fromNow=function(c){return this.from(l(this),c)}}})})(aB);var Ufe=aB.exports;const Gfe=Da(Ufe);var qfe={exports:{}};(function(e,t){(function(n,r){e.exports=r(sL)})(Dd,function(n){function r(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var o=r(n),i={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(a,s){return s==="W"?a+"周":a+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(a,s){var l=100*a+s;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return o.default.locale(i,null,!0),i})})(qfe);Js.extend(Gfe);function Xfe({session:e,isActive:t,isBatchMode:n,isSelected:r,onSelect:o,onArchive:i,onDelete:a,onStar:s,onUpdateTags:l,onToggleSelect:c}){var N;const{t:d,i18n:f}=Ot(),[m,p]=J.useState(!1),[h,b]=J.useState(""),x="automation:",g=u.useMemo(()=>{const k=Js(e.createdAt);return f.language==="zh"?k.locale("zh-cn"):k.locale("en"),{relative:k.fromNow(),full:k.format("YYYY-MM-DD HH:mm:ss")}},[e.createdAt,f.language]),v=e.title!=null&&e.title!==""?e.title:e.lastUserMessage!=null&&e.lastUserMessage!==""?e.lastUserMessage:d("common.newChat"),S=e.messageCount??0,C=u.useMemo(()=>e.lastMessage==null||e.lastMessage===""?null:e.lastMessage.length>60?`${e.lastMessage.slice(0,60)}...`:e.lastMessage,[e.lastMessage]),_=u.useMemo(()=>k=>{if(!k.startsWith(x))return null;const E=k.split(":");return E.length<3?null:{ruleId:E[1],ruleTitle:E.slice(2).join(":")}},[x]),w=k=>{if(!k)return y.jsx("div",{className:`status-dot ${t?"active":""}`});let E="",$="";const O=d(`common.status.${k}`);switch(k){case"completed":E="check_circle",$="#52c41a";break;case"terminated":E="remove_circle",$="#bfbfbf";break;case"failed":E="cancel",$="#ff4d4f";break;case"running":E="sync",$="#1890ff";break;case"waiting_input":return y.jsx(dt,{title:O,children:y.jsx("div",{className:"waiting-input-indicator"})});default:return y.jsx("div",{className:`status-dot ${t?"active":""}`})}return y.jsx(dt,{title:O,children:y.jsx("span",{className:`material-symbols-rounded status-icon ${k==="running"?"spin":""}`,style:{color:$,fontSize:"16px",lineHeight:"16px",display:"flex",alignItems:"center",justifyContent:"center"},children:E})})};return y.jsxs(ji.Item,{onClick:()=>n?c(e.id):o(e),onDoubleClick:()=>{console.log("Session Details:",e)},className:`session-item ${t?"active":""} ${r?"selected":""} ${e.isStarred?"starred":""}`,children:[y.jsxs("div",{className:"session-item-content",children:[!n&&y.jsx("div",{className:"status-indicator",children:w(e.status)}),n&&y.jsx("div",{className:"batch-checkbox-wrapper",children:y.jsx(Ji,{checked:r,onChange:()=>c(e.id),onClick:k=>k.stopPropagation()})}),y.jsxs("div",{className:`session-info ${n?"":"with-actions"}`,children:[y.jsxs("div",{className:"session-header",children:[y.jsx("div",{className:"session-title",children:y.jsx("span",{className:"session-title-text",children:v})}),!n&&y.jsxs("div",{className:"session-item-actions",children:[y.jsx(dt,{title:e.isStarred?d("common.unstar"):d("common.star"),children:y.jsx(ct,{type:"text",size:"small",className:`action-btn ${e.isStarred?"starred":""}`,onClick:k=>{k.stopPropagation(),s(e.id,!e.isStarred)},icon:y.jsx("span",{className:`material-symbols-rounded ${e.isStarred?"filled":""}`,children:"star"})})}),y.jsx(dt,{title:d("common.archive"),children:y.jsx(ct,{type:"text",size:"small",className:"action-btn archive-btn",onClick:k=>{k.stopPropagation(),i(e.id)},icon:y.jsx("span",{className:"material-symbols-rounded",children:"archive"})})})]})]}),C!=null&&y.jsx("div",{className:"last-message",children:C}),y.jsxs("div",{className:"session-meta",children:[e.status&&y.jsx("span",{className:"status-text",style:{fontSize:"11px",color:"var(--sub-text-color)",marginRight:"8px"},children:d(`common.status.${e.status}`)}),y.jsx(dt,{title:g.full,children:y.jsx("span",{className:"time-display",children:g.relative})})]}),y.jsx("div",{className:"tags-container",children:(N=e.tags)==null?void 0:N.map(k=>{const E=_(k);if(E){const $=`/automation?rule=${encodeURIComponent(E.ruleId)}`;return y.jsx(dt,{title:E.ruleTitle,children:y.jsx(Do,{className:"session-tag session-tag--automation",onClick:O=>O.stopPropagation(),children:y.jsx("a",{className:"session-tag__link",href:$,onClick:O=>O.stopPropagation(),children:E.ruleTitle})})},k)}return y.jsx(dt,{title:k,children:y.jsx(Do,{className:"session-tag",children:y.jsx("span",{className:"session-tag__text",children:k})})},k)})})]})]}),S>0&&y.jsx(E_,{count:S>99?"99+":S,className:"session-item-badge"})]})}function Yfe({sessions:e,activeId:t,isBatchMode:n,selectedIds:r,searchQuery:o,onSelectSession:i,onArchiveSession:a,onDeleteSession:s,onStarSession:l,onUpdateTags:c,onToggleSelect:d}){const{t:f}=Ot(),[m,p]=u.useState(new Set),{flattenedSessions:h,childSummaryMap:b}=u.useMemo(()=>{const g=new Map(e.map(k=>[k.id,k])),v=new Map;for(const k of e)if(k.parentSessionId){const E=v.get(k.parentSessionId)??[];E.push(k),v.set(k.parentSessionId,E)}const S=e.filter(k=>k.parentSessionId?!g.has(k.parentSessionId):!0),C=new Map;for(const[k,E]of v.entries()){const $=E.length,O=new Map;for(const T of E){const I=T.status??"running";O.set(I,(O.get(I)??0)+1)}const R=[f("common.childSummary",{count:$})];for(const[T,I]of O.entries())R.push(f("common.childStatusItem",{count:I,status:f(`common.status.${T}`)}));C.set(k,R.join(" · "))}const _=[],w=new Set,N=(k,E)=>{if(w.has(k.id))return;w.add(k.id);const $=v.get(k.id)??[];if(_.push({session:k,depth:E,hasChildren:$.length>0}),!m.has(k.id))for(const O of $)N(O,E+1)};for(const k of S)N(k,0);return{flattenedSessions:_,childSummaryMap:C}},[e,m,f]),x=g=>{p(v=>{const S=new Set(v);return S.has(g)?S.delete(g):S.add(g),S})};return y.jsx("div",{className:"session-list-container",children:y.jsx("div",{className:"session-list-scroll",children:y.jsx(ji,{className:"session-list",size:"small",locale:{emptyText:y.jsx("div",{className:"empty-text",children:f(o?"common.noSessions":"common.startNewChat")})},dataSource:h,renderItem:({session:g,depth:v,hasChildren:S})=>y.jsxs("div",{className:`session-row ${v>0?"has-parent":""}`,style:{"--session-depth":v},children:[y.jsx(Xfe,{session:g,isActive:t===g.id,isBatchMode:n,isSelected:r.has(g.id),onSelect:i,onArchive:a,onDelete:s,onStar:l,onUpdateTags:c,onToggleSelect:d}),S&&!n&&y.jsxs("div",{className:"session-collapse-row",style:{"--session-depth":v},onClick:C=>C.stopPropagation(),children:[y.jsx(ct,{type:"text",size:"small",className:`session-tree-toggle ${m.has(g.id)?"collapsed":""}`,onClick:()=>x(g.id),icon:y.jsx("span",{className:"material-symbols-rounded",children:"chevron_right"})}),y.jsx("span",{className:"session-collapse-label",children:m.has(g.id)?f("common.expandChildren"):f("common.collapseChildren")}),y.jsx("span",{className:"session-collapse-summary",children:b.get(g.id)??f("common.childSummary",{count:0})})]})]})})})})}function Qfe({searchQuery:e,onSearchChange:t,isBatchMode:n,onToggleBatchMode:r,selectedCount:o,totalCount:i,onSelectAll:a,onBatchArchive:s,isCreatingSession:l,onCreateSession:c}){const{t:d}=Ot(),[f,m]=um(v1),p=i>0&&o===i;return y.jsx("div",{className:"sidebar-header",children:y.jsxs("div",{className:"header-bottom",children:[n&&y.jsx("div",{className:"batch-select-wrapper",children:y.jsx(dt,{title:d(p?"common.deselectAll":"common.selectAll"),children:y.jsx(Ji,{checked:p,indeterminate:o>0&&o<i,onChange:h=>a(h.target.checked)})})}),y.jsx(Ft,{className:"search-input",placeholder:d("common.search"),value:e,onChange:h=>t(h.target.value),prefix:y.jsx("span",{className:"material-symbols-rounded search-icon",children:"search"}),allowClear:!0}),y.jsxs("div",{className:"batch-actions",children:[y.jsx(dt,{title:d(n?"common.cancelBatch":"common.batchMode"),children:y.jsx(ct,{className:`action-btn ${n?"active":""}`,type:n?"primary":"text",onClick:r,children:y.jsx("span",{className:"material-symbols-rounded",children:n?"close":"checklist"})})}),n&&y.jsx(Hh,{title:d("common.archiveConfirm",{count:o}),onConfirm:s,okText:d("common.confirm"),cancelText:d("common.cancel"),okButtonProps:{danger:!1},disabled:o===0,children:y.jsx(dt,{title:d("common.batchArchive"),children:y.jsx(ct,{className:"action-btn",type:"text",disabled:o===0,children:y.jsx("span",{className:"material-symbols-rounded",children:"archive"})})})})]}),y.jsx(dt,{title:d(f?"common.expand":"common.collapse"),children:y.jsx(ct,{className:"sidebar-collapse-btn",type:"text",onClick:()=>m(!f),children:y.jsx("span",{className:"material-symbols-rounded",children:f?"dock_to_right":"left_panel_close"})})}),f&&y.jsx(dt,{title:d(l?"common.alreadyInNewChat":"common.newChat"),placement:"right",children:y.jsx(ct,{className:`sidebar-new-chat-btn ${l?"active":""}`,type:"text",disabled:!!l,onClick:c,children:y.jsx("span",{className:`material-symbols-rounded ${l?"filled":""}`,children:l?"chat_bubble":"send"})})})]})})}function Zfe({activeId:e,onSelectSession:t,onDeletedSession:n,width:r}){var z,M,H;const{t:o}=Ot(),[i]=um(v1),a=vl(nB),[s,l]=u.useState(""),[c,d]=u.useState(!1),[f,m]=u.useState(new Set),p=navigator.platform.includes("Mac"),{values:h}=ju({keys:["tag"],defaults:{tag:""},omit:{tag:F=>F===""}}),b=h.tag.trim(),{data:x,mutate:g}=Qn("/api/sessions"),v=(x==null?void 0:x.sessions)??[],{data:S}=Qn("/api/config"),C=(H=(M=(z=S==null?void 0:S.sources)==null?void 0:z.merged)==null?void 0:M.shortcuts)==null?void 0:H.newSession,_=C!=null&&C.trim()!==""?C:"mod+k",w=u.useMemo(()=>iB(_,p),[_,p]),N=u.useMemo(()=>{const F=s.trim().toLowerCase();return v.filter(A=>b&&!(A.tags??[]).some(K=>K.toLowerCase()===b.toLowerCase())?!1:F?(A.title??"").toLowerCase().includes(F)||(A.lastMessage??"").toLowerCase().includes(F)||(A.lastUserMessage??"").toLowerCase().includes(F)||A.id.toLowerCase().includes(F)||(A.tags??[]).some(B=>B.toLowerCase().includes(F)):!0)},[v,s,b]);async function k(){t({id:""},!0)}async function E(F){let A;const B=v.findIndex(K=>K.id===F);B!==-1&&(B+1<v.length?A=v[B+1].id:B-1>=0&&(A=v[B-1].id));try{await Sa(F,{isArchived:!0}),await g(),n==null||n(F,A)}catch(K){console.error("Failed to archive session:",K)}}async function $(F){let A;const B=v.findIndex(K=>K.id===F);B!==-1&&(B+1<v.length?A=v[B+1].id:B-1>=0&&(A=v[B-1].id));try{await Qh(F),await g(),e===F&&(n==null||n(F,A))}catch(K){console.error("Failed to delete session:",K)}}async function O(F,A){try{await Sa(F,{isStarred:A}),await g()}catch(B){console.error("Failed to star session:",B)}}async function R(F,A){try{await Sa(F,{tags:A}),await g()}catch(B){console.error("Failed to update tags:",B)}}const T=F=>{m(A=>{const B=new Set(A);return B.has(F)?B.delete(F):B.add(F),B})},I=F=>{m(F?new Set(N.map(A=>A.id)):new Set)},P=async()=>{try{if(await Promise.all(Array.from(f).map(async F=>Sa(F,{isArchived:!0}))),await g(),e&&f.has(e)){let F;const A=v.find(B=>!f.has(B.id));A&&(F=A.id),n==null||n(e,F)}m(new Set),d(!1)}catch(F){console.error("Failed to batch archive sessions:",F)}},j=()=>{d(F=>!F),m(new Set)},L=e===void 0||e==="",D=u.useRef(null);return Kfe({shortcut:_,isMac:p,onTrigger:F=>{F.preventDefault(),!L&&(D.current&&(D.current.classList.add("active-scale"),setTimeout(()=>{var A;(A=D.current)==null||A.classList.remove("active-scale")},200)),k())}}),y.jsx("div",{className:`sidebar-container ${i?"collapsed":""}`,style:{width:i?0:r,minWidth:i?0:void 0,transition:a?"none":"width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",borderRight:i?"none":void 0},children:y.jsxs("div",{className:"sidebar-content",style:{width:r,transition:a?"none":"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)",transform:i?`translateX(-${r}px)`:"translateX(0)"},children:[y.jsx(Qfe,{searchQuery:s,onSearchChange:l,isBatchMode:c,onToggleBatchMode:j,selectedCount:f.size,totalCount:N.length,onSelectAll:I,onBatchArchive:()=>{P()},isCreatingSession:L,onCreateSession:()=>{k()}}),y.jsx("div",{className:"sidebar-new-chat",children:y.jsx(dt,{title:L?o("common.alreadyInNewChat"):void 0,placement:"right",children:y.jsxs(ct,{ref:D,className:`new-chat-btn ${L?"active":""}`,type:L?"default":"primary",block:!0,disabled:!!L,onClick:()=>{k()},children:[y.jsxs("span",{className:"btn-content",children:[y.jsx("span",{className:`material-symbols-rounded ${L?"filled":""}`,children:L?"chat_bubble":"send"}),y.jsx("span",{children:o(L?"common.creatingChat":"common.newChat")})]}),y.jsx("span",{className:"shortcut-tag",children:w})]})})}),y.jsx(Yfe,{sessions:N,activeId:e,isBatchMode:c,selectedIds:f,searchQuery:s,onSelectSession:t,onArchiveSession:E,onDeleteSession:$,onStarSession:O,onUpdateTags:R,onToggleSelect:T})]})})}function Jfe({activeSessionId:e,children:t,isDarkMode:n,onDeletedSession:r,onSelectSession:o,showSidebar:i,sidebarWidth:a}){return y.jsxs(hl,{className:`app-shell ${n?"app-shell--dark":""}`,children:[y.jsx(Ofe,{}),i&&y.jsx(Zfe,{width:a,activeId:e,onSelectSession:o,onDeletedSession:r}),y.jsx(hl.Content,{className:"app-shell__content",children:t})]})}function eme(){var a,s,l;const{i18n:e}=Ot(),t=vl(y1),{data:n}=Qn("/api/config",b1),r=(l=(s=(a=n==null?void 0:n.sources)==null?void 0:a.merged)==null?void 0:s.general)==null?void 0:l.interfaceLanguage,o=t==="dark"||t==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches;u.useEffect(()=>{document.documentElement.classList.toggle("dark",o)},[o]),u.useEffect(()=>{r&&e.language!==r&&e.changeLanguage(r)},[e,r]);const i=u.useMemo(()=>({algorithm:o?pI.darkAlgorithm:pI.defaultAlgorithm,token:{colorPrimary:o?"#3b82f6":"#000000"}}),[o]);return{isDarkMode:o,themeConfig:i}}const tme=Vz()||window.location.hostname,nme=Wz()||"8787",rme=`ws://${tme}:${nme}${qde()}`;function sB(e,t){let n=rme;if(t){const o=new URLSearchParams(t);n+=(n.includes("?")?"&":"?")+o.toString()}const r=new WebSocket(n);return r.addEventListener("open",()=>{var o;return(o=e.onOpen)==null?void 0:o.call(e)}),r.addEventListener("message",o=>{var i;try{const a=JSON.parse(String(o.data));(i=e.onMessage)==null||i.call(e,a)}catch(a){console.error(a)}}),r.addEventListener("error",o=>{var i;return(i=e.onError)==null?void 0:i.call(e,o)}),r.addEventListener("close",()=>{var o;return(o=e.onClose)==null?void 0:o.call(e)}),r}const ome=e=>"isDeleted"in e&&e.isDeleted,ime=e=>[...e].sort((t,n)=>{const r=+(n.isStarred===!0)-+(t.isStarred===!0);return r!==0?r:(n.createdAt??0)-(t.createdAt??0)}),DI=(e,t,n)=>{if((e==null?void 0:e.sessions)==null)return e;if(ome(t))return{...e,sessions:e.sessions.filter(s=>s.id!==t.id)};const r=t,o=n==="archived"?r.isArchived===!0:r.isArchived!==!0,i=e.sessions.find(s=>s.id===t.id);if(!o)return{...e,sessions:e.sessions.filter(s=>s.id!==t.id)};const a=i?e.sessions.map(s=>s.id===t.id?{...s,...r}:s):[r,...e.sessions];return{...e,sessions:ime(a)}};function ame(){const{mutate:e}=Yv();u.useEffect(()=>{let t=!1,n,r;const o=()=>{t||(n=sB({onMessage:i=>{if(i.type!=="session_updated")return;const a=i.session;e("/api/sessions",s=>DI(s,a,"active"),!1),e("/api/sessions/archived",s=>DI(s,a,"archived"),!1)},onClose:()=>{t||(r=setTimeout(o,1e3))},onError:()=>{n==null||n.close()}},{subscribe:"sessions"}))};return o(),()=>{t=!0,r&&clearTimeout(r),n==null||n.close()}},[e])}const sme="/session/:sessionId";function lme(){const e=Ts(),t=ua(),n=vl(Nfe),r=wf({path:sme,end:!0},t.pathname),o=r==null?void 0:r.params.sessionId,i=t.pathname==="/"||o!=null,a=u.useCallback((l,c)=>{e(l.id===""?"/":`/session/${l.id}`)},[e]),s=u.useCallback((l,c)=>{o===l&&e(c?`/session/${c}`:"/")},[o,e]);return{activeSessionId:o,handleDeletedSession:s,handleSelectSession:a,showSidebar:i,sidebarWidth:n}}function cme(){const{t:e}=Ot(),{message:t}=Eo.useApp(),{data:n,mutate:r}=Qn("/api/sessions/archived",async()=>oB("archived")),o=(n==null?void 0:n.sessions)??[],[i,a]=u.useState(""),[s,l]=u.useState(new Set),[c,d]=u.useState(!1),f=u.useMemo(()=>{if(i.trim()==="")return o;const S=i.toLowerCase();return o.filter(C=>{const _=C.title??"",w=C.lastMessage??"",N=C.lastUserMessage??"",k=(C.tags??[]).join(" ");return`${_} ${C.id} ${w} ${N} ${k}`.toLowerCase().includes(S)})},[o,i]),m=async S=>{try{await Sa(S,{isArchived:!1}),t.success(e("common.restoreSuccess","Restored successfully")),r()}catch(C){t.error(Mr(C,e("common.restoreFailed","Failed to restore")))}},p=async S=>{try{await Qh(S),t.success(e("common.deleteSuccess","Deleted successfully")),r()}catch(C){t.error(Mr(C,e("common.deleteFailed","Failed to delete")))}},h=S=>{const C=new Set(s);C.has(S)?C.delete(S):C.add(S),l(C)},b=S=>{l(S?new Set(f.map(C=>C.id)):new Set)},x=async()=>{try{await Promise.all(Array.from(s).map(async S=>Sa(S,{isArchived:!1}))),t.success(e("common.batchRestoreSuccess","Batch restored successfully")),l(new Set),d(!1),r()}catch(S){t.error(Mr(S,e("common.batchRestoreFailed","Failed to restore some sessions")))}},g=async()=>{try{await Promise.all(Array.from(s).map(async S=>Qh(S))),t.success(e("common.batchDeleteSuccess","Batch deleted successfully")),l(new Set),d(!1),r()}catch(S){t.error(Mr(S,e("common.batchDeleteFailed","Failed to delete some sessions")))}},v=f.length>0&&s.size===f.length;return y.jsxs("div",{className:"archive-view",children:[y.jsxs("div",{className:"archive-view__header",children:[y.jsx(ea,{size:8,className:"archive-view__title",children:y.jsx("h2",{className:"archive-view__title-text",children:e("common.archivedSessions")})}),y.jsx(ea,{children:c?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"archive-view__batch-info",children:e("common.selectedCount",{count:s.size})}),y.jsx(dt,{title:e("common.cancel"),children:y.jsx(ct,{icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"close"}),onClick:()=>{d(!1),l(new Set)},className:"archive-view__icon-button"})}),y.jsx(dt,{title:e("common.batchRestore"),children:y.jsx(ct,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"unarchive"}),onClick:()=>{x()},disabled:s.size===0,className:"archive-view__icon-button"})}),y.jsx(Hh,{title:e("common.deleteConfirm",{count:s.size}),onConfirm:()=>{g()},disabled:s.size===0,children:y.jsx(dt,{title:e("common.batchDelete"),children:y.jsx(ct,{danger:!0,icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"delete_sweep"}),disabled:s.size===0,className:"archive-view__icon-button"})})})]}):y.jsx(dt,{title:e("common.batchMode"),children:y.jsx(ct,{icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"checklist"}),onClick:()=>d(!0),disabled:o.length===0,className:"archive-view__icon-button"})})})]}),y.jsxs("div",{className:"archive-view__filter-bar",children:[c&&y.jsx("div",{className:"archive-view__select-all",children:y.jsx(dt,{title:e(v?"common.deselectAll":"common.selectAll"),children:y.jsx(Ji,{checked:v,indeterminate:s.size>0&&s.size<f.length,onChange:S=>b(S.target.checked)})})}),y.jsx(Ft,{prefix:y.jsx("span",{className:"material-symbols-rounded archive-view__search-icon",children:"search"}),placeholder:e("common.search"),value:i,onChange:S=>a(S.target.value),allowClear:!0,className:"archive-view__search-input"})]}),y.jsx("div",{className:"archive-view__list",children:f.length===0?y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:e(i?"common.noSessions":"common.noArchivedSessions")}):y.jsx(ji,{itemLayout:"horizontal",dataSource:f,renderItem:S=>y.jsx(ji.Item,{className:["archive-view__item",s.has(S.id)?"archive-view__item--selected":"",c?"archive-view__item--batch":""].filter(Boolean).join(" "),onClick:()=>c&&h(S.id),children:y.jsxs("div",{className:"archive-view__item-row",children:[c&&y.jsx("div",{className:"archive-view__item-select",children:y.jsx(Ji,{checked:s.has(S.id),onChange:()=>h(S.id),onClick:C=>C.stopPropagation()})}),y.jsx("span",{className:"material-symbols-rounded archive-view__item-icon",children:"chat_bubble"}),y.jsxs("div",{className:"archive-view__item-main",children:[y.jsx("span",{className:"archive-view__item-title",children:S.title!=null&&S.title!==""?S.title:S.lastMessage!=null&&S.lastMessage!==""?S.lastMessage:e("common.newChat")}),S.tags&&S.tags.length>0&&y.jsx("div",{className:"archive-view__item-tags",children:S.tags.map(C=>y.jsx(Do,{className:"archive-view__item-tag",children:C},C))}),y.jsx("span",{className:"archive-view__item-time",children:Js(S.createdAt).format("YYYY-MM-DD HH:mm")})]}),!c&&y.jsxs("div",{className:"archive-view__item-actions",children:[y.jsx(dt,{title:e("common.restore"),children:y.jsx(ct,{type:"text",size:"small",className:"archive-view__item-action-button",icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"unarchive"}),onClick:C=>{C.stopPropagation(),m(S.id)}})}),y.jsx(Hh,{title:e("common.deleteSessionConfirm"),onConfirm:C=>{C==null||C.stopPropagation(),p(S.id)},children:y.jsx(ct,{type:"text",size:"small",danger:!0,className:"archive-view__item-action-button",icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"delete"}),onClick:C=>C.stopPropagation()})})]})]})})})})]})}function ume(){return y.jsx(cme,{})}function dme(){const{t:e}=Ot();return y.jsx(_n.List,{name:"tasks",children:(t,{add:n,remove:r})=>y.jsxs("div",{className:"automation-view__list automation-view__list--horizontal",children:[y.jsxs("div",{className:"automation-view__section-header",children:[y.jsxs("div",{className:"automation-view__section-heading",children:[y.jsxs("div",{className:"automation-view__form-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__form-icon",children:"task"}),e("automation.sectionTasks")]}),y.jsx("span",{className:"automation-view__section-count",children:e("automation.taskCount",{count:t.length})})]}),y.jsx("div",{className:"automation-view__section-actions",children:y.jsx(dt,{title:e("automation.addTask"),children:y.jsx(ct,{className:"automation-view__icon-button",type:"text",onClick:()=>n({title:e("automation.taskDefaultTitle",{index:t.length+1}),prompt:""}),children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"add"})})})})]}),y.jsx("div",{className:"automation-view__form-desc",children:e("automation.taskAll")}),y.jsx("div",{className:"automation-view__list-scroll",children:t.map((o,i)=>y.jsxs("div",{className:"automation-view__list-item",children:[y.jsx(_n.Item,{name:[o.name,"id"],hidden:!0,children:y.jsx(Ft,{})}),y.jsx(dt,{title:e("automation.remove"),children:y.jsx(ct,{className:"automation-view__remove-button",type:"text",danger:!0,onClick:()=>r(o.name),disabled:t.length<=1,children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"close"})})}),y.jsx("div",{className:"automation-view__list-header",children:y.jsx(_n.Item,{name:[o.name,"title"],label:e("automation.taskTitle"),children:y.jsx(Ft,{placeholder:e("automation.taskTitlePlaceholder")})})}),y.jsx(_n.Item,{name:[o.name,"prompt"],label:e("automation.prompt"),rules:[{required:!0,message:e("automation.promptRequired")}],children:y.jsx(Ft.TextArea,{rows:3})}),y.jsxs("div",{className:"automation-view__task-index",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__task-index-icon",children:"format_list_numbered"}),e("automation.taskIndex",{index:i+1})]})]},o.key))})]})})}function fme({form:e,updateWeeklyCron:t,getWebhookUrl:n}){const{t:r}=Ot();return y.jsx(_n.List,{name:"triggers",children:(o,{add:i,remove:a})=>y.jsxs("div",{className:"automation-view__list automation-view__list--horizontal",children:[y.jsxs("div",{className:"automation-view__section-header",children:[y.jsxs("div",{className:"automation-view__section-heading",children:[y.jsxs("div",{className:"automation-view__form-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__form-icon",children:"bolt"}),r("automation.sectionTriggers")]}),y.jsx("span",{className:"automation-view__section-count",children:r("automation.triggerCount",{count:o.length})})]}),y.jsx("div",{className:"automation-view__section-actions",children:y.jsx(dt,{title:r("automation.addTrigger"),children:y.jsx(ct,{className:"automation-view__icon-button",type:"text",onClick:()=>i({type:"interval",intervalMinutes:30,cronExpression:"",weeklyDay:"1",weeklyTime:"09:00"}),children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"add"})})})})]}),y.jsx("div",{className:"automation-view__form-desc",children:r("automation.triggerAny")}),y.jsx("div",{className:"automation-view__list-scroll",children:o.map((s,l)=>y.jsx(_n.Item,{noStyle:!0,shouldUpdate:(c,d)=>{var p,h;const f=(p=c.triggers)==null?void 0:p[s.name],m=(h=d.triggers)==null?void 0:h[s.name];return(f==null?void 0:f.type)!==(m==null?void 0:m.type)||(f==null?void 0:f.webhookKey)!==(m==null?void 0:m.webhookKey)||(f==null?void 0:f.id)!==(m==null?void 0:m.id)},children:c=>{const d=c.getFieldValue(["triggers",s.name,"type"]),f=c.getFieldValue(["triggers",s.name,"id"]),m=c.getFieldValue(["triggers",s.name,"webhookKey"]),p=n(f,m);return y.jsxs("div",{className:"automation-view__list-item",children:[y.jsx(_n.Item,{name:[s.name,"id"],hidden:!0,children:y.jsx(Ft,{})}),y.jsx(dt,{title:r("automation.remove"),children:y.jsx(ct,{className:"automation-view__remove-button",type:"text",danger:!0,onClick:()=>a(s.name),disabled:o.length<=1,children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"close"})})}),y.jsx("div",{className:"automation-view__list-header",children:y.jsx(_n.Item,{name:[s.name,"type"],label:r("automation.ruleType"),rules:[{required:!0,message:r("automation.ruleTypeRequired")}],children:y.jsx(Yn,{options:[{label:r("automation.typeInterval"),value:"interval"},{label:r("automation.typeWebhook"),value:"webhook"},{label:r("automation.typeCron"),value:"cron"}],onChange:h=>{h==="interval"&&(e.setFieldValue(["triggers",s.name,"intervalMinutes"],30),e.setFieldValue(["triggers",s.name,"cronExpression"],""),e.setFieldValue(["triggers",s.name,"weeklyDay"],"1"),e.setFieldValue(["triggers",s.name,"weeklyTime"],"09:00"),e.setFieldValue(["triggers",s.name,"webhookKey"],"")),h==="cron"&&(e.setFieldValue(["triggers",s.name,"cronExpression"],""),e.setFieldValue(["triggers",s.name,"weeklyDay"],"1"),e.setFieldValue(["triggers",s.name,"weeklyTime"],"09:00"),e.setFieldValue(["triggers",s.name,"intervalMinutes"],30),e.setFieldValue(["triggers",s.name,"webhookKey"],"")),h==="webhook"&&(e.setFieldValue(["triggers",s.name,"webhookKey"],""),e.setFieldValue(["triggers",s.name,"intervalMinutes"],30),e.setFieldValue(["triggers",s.name,"cronExpression"],""),e.setFieldValue(["triggers",s.name,"weeklyDay"],"1"),e.setFieldValue(["triggers",s.name,"weeklyTime"],"09:00"))}})})}),d==="interval"&&y.jsx(_n.Item,{name:[s.name,"intervalMinutes"],label:r("automation.intervalMinutes"),rules:[{required:!0,message:r("automation.intervalRequired")}],children:y.jsx(Zc,{min:1,className:"automation-view__input-number"})}),d==="cron"&&y.jsxs("div",{className:"automation-view__cron-section",children:[y.jsx(_n.Item,{name:[s.name,"cronExpression"],label:r("automation.cronExpressionLabel"),rules:[{required:!0,message:r("automation.cronExpressionRequired")}],children:y.jsx(Ft,{placeholder:r("automation.cronExpressionHint")})}),y.jsx(_n.Item,{name:[s.name,"cronPreset"],label:r("automation.cronPreset"),children:y.jsx(Yn,{options:[{label:r("automation.cronPresetHourly"),value:"0 * * * *"},{label:r("automation.cronPresetDaily9"),value:"0 9 * * *"},{label:r("automation.cronPresetWeekday9"),value:"0 9 * * 1-5"},{label:r("automation.cronPresetWeekend10"),value:"0 10 * * 6,0"}],onChange:h=>e.setFieldValue(["triggers",s.name,"cronExpression"],h),placeholder:r("automation.cronPresetHint"),allowClear:!0})}),y.jsx("div",{className:"automation-view__cron-hint",children:r("automation.cronInputHint")}),y.jsxs("div",{className:"automation-view__cron-weekly",children:[y.jsx(_n.Item,{name:[s.name,"weeklyDay"],label:r("automation.weeklyDay"),children:y.jsx(Yn,{options:[{label:r("automation.weekdaySun"),value:"0"},{label:r("automation.weekdayMon"),value:"1"},{label:r("automation.weekdayTue"),value:"2"},{label:r("automation.weekdayWed"),value:"3"},{label:r("automation.weekdayThu"),value:"4"},{label:r("automation.weekdayFri"),value:"5"},{label:r("automation.weekdaySat"),value:"6"}],onChange:h=>t(l,h)})}),y.jsx(_n.Item,{name:[s.name,"weeklyTime"],label:r("automation.weeklyTime"),children:y.jsx(Ft,{placeholder:r("automation.weeklyTimeHint"),onChange:h=>t(l,void 0,h.target.value)})})]})]}),d==="webhook"&&y.jsxs("div",{className:"automation-view__webhook",children:[y.jsx(_n.Item,{name:[s.name,"webhookKey"],label:r("automation.webhookKey"),children:y.jsx(Ft,{placeholder:r("automation.webhookKeyHint")})}),p&&y.jsxs("div",{className:"automation-view__webhook-row",children:[y.jsx("span",{className:"automation-view__webhook-label",children:r("automation.webhookUrl")}),y.jsx(dt,{title:r("automation.copy"),children:y.jsx(ct,{className:"automation-view__icon-button",type:"text",onClick:()=>{navigator.clipboard.writeText(p)},children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"content_copy"})})})]})]})]})}},s.key))})]})})}const mme=Kz(),pme=Uz(),hme=`http://${mme}:${pme}`;function zI({mode:e,rule:t,submitting:n,onSubmit:r,onCancel:o}){const{t:i}=Ot(),[a]=_n.useForm(),s=u.useCallback((d,f,m)=>{const p=a.getFieldValue("triggers"),h=p==null?void 0:p[d];if(!h)return;const b=f??h.weeklyDay,x=m??h.weeklyTime;if(!b||!x)return;const[g,v]=x.split(":");if(!g||!v)return;const S=Number.parseInt(g,10),C=Number.parseInt(v,10);if(Number.isNaN(S)||Number.isNaN(C))return;const _=`${C} ${S} * * ${b}`,w=h.cronExpression;(!w||/^\d{1,2}\s+\d{1,2}\s+\*\s+\*\s+\d$/.test(w))&&a.setFieldValue(["triggers",d,"cronExpression"],_)},[a]),l=u.useCallback((d,f)=>!d||!f?"":`${hme}/api/automation/webhook/${d}?key=${f}`,[]);u.useEffect(()=>{if(e==="create"){a.setFieldsValue({name:"",description:"",enabled:!0,immediateRun:!1,triggers:[{type:"interval",intervalMinutes:30,cronExpression:"",cronPreset:void 0,weeklyDay:"1",weeklyTime:"09:00"}],tasks:[{title:i("automation.taskDefaultTitle",{index:1}),prompt:""}]});return}if(e==="edit"&&t){const d=(t.triggers??[]).map(m=>{const p=m.cronExpression??"",h=p.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+(\d)$/);return{id:m.id,type:m.type,intervalMinutes:m.intervalMs?Math.max(1,Math.round(m.intervalMs/6e4)):void 0,webhookKey:m.webhookKey??void 0,cronExpression:p,cronPreset:void 0,weeklyDay:h?h[3]:"1",weeklyTime:h?`${h[2].padStart(2,"0")}:${h[1].padStart(2,"0")}`:"09:00"}}),f=(t.tasks??[]).map((m,p)=>({id:m.id,title:m.title||i("automation.taskDefaultTitle",{index:p+1}),prompt:m.prompt}));a.setFieldsValue({name:t.name,description:t.description??"",enabled:t.enabled,immediateRun:!1,triggers:d.length>0?d:[{type:"interval",intervalMinutes:30,cronExpression:"",cronPreset:void 0,weeklyDay:"1",weeklyTime:"09:00"}],tasks:f.length>0?f:[{title:i("automation.taskDefaultTitle",{index:1}),prompt:""}]})}},[a,e,t,i]);const c=u.useCallback(async()=>{var m;const d=await a.validateFields(),f={name:d.name.trim(),description:((m=d.description)==null?void 0:m.trim())??"",enabled:d.enabled,triggers:d.triggers.map(p=>{var h,b;return p.type==="interval"?{id:p.id,type:"interval",intervalMs:Math.max(1,p.intervalMinutes??1)*6e4}:p.type==="cron"?{id:p.id,type:"cron",cronExpression:((h=p.cronExpression)==null?void 0:h.trim())??""}:{id:p.id,type:"webhook",webhookKey:((b=p.webhookKey)==null?void 0:b.trim())??""}}),tasks:d.tasks.map(p=>{var h;return{id:p.id,title:((h=p.title)==null?void 0:h.trim())??"",prompt:p.prompt.trim()}})};await r(f,d.immediateRun)},[a,r]);return y.jsxs("div",{className:"automation-view__form-panel",children:[y.jsxs("div",{className:"automation-view__form-header",children:[y.jsxs("div",{className:"automation-view__form-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__form-icon",children:"edit_square"}),i(e==="create"?"automation.newRule":"automation.editRule")]}),y.jsxs("div",{className:"automation-view__form-header-actions",children:[y.jsx(dt,{title:i("common.cancel"),children:y.jsx(ct,{className:"automation-view__square-button",onClick:o,children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"close"})})}),y.jsx(dt,{title:i("common.confirm"),children:y.jsx(ct,{className:"automation-view__square-button automation-view__square-button--confirm",type:"primary",loading:n,onClick:()=>void c(),children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"check"})})})]})]}),y.jsx(_n,{form:a,layout:"vertical",initialValues:{enabled:!0,immediateRun:!1},children:y.jsxs("div",{className:"automation-view__form-grid",children:[y.jsx("div",{className:"automation-view__form-left",children:y.jsxs("div",{className:"automation-view__form-section",children:[y.jsxs("div",{className:"automation-view__form-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__form-icon",children:"info"}),i("automation.sectionBasic")]}),y.jsx(_n.Item,{name:"name",label:y.jsxs("span",{className:"automation-view__label",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__label-icon",children:"badge"}),i("automation.ruleName")]}),rules:[{required:!0,message:i("automation.ruleNameRequired")}],children:y.jsx(Ft,{})}),y.jsx(_n.Item,{name:"description",label:y.jsxs("span",{className:"automation-view__label",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__label-icon",children:"description"}),i("automation.ruleDescription")]}),children:y.jsx(Ft.TextArea,{rows:2})}),y.jsxs("div",{className:"automation-view__toggle-group",children:[y.jsxs("div",{className:"automation-view__toggle-row",children:[y.jsxs("span",{className:"automation-view__toggle-label",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__label-icon",children:"toggle_on"}),i("automation.enabled")]}),y.jsx(_n.Item,{name:"enabled",valuePropName:"checked",noStyle:!0,children:y.jsx(ta,{})})]}),y.jsxs("div",{className:"automation-view__toggle-row",children:[y.jsxs("span",{className:"automation-view__toggle-label automation-view__toggle-label--run",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__label-icon automation-view__label-icon--run",children:"play_circle"}),i("automation.immediateRun")]}),y.jsx(_n.Item,{name:"immediateRun",valuePropName:"checked",noStyle:!0,children:y.jsx(ta,{})})]})]})]})}),y.jsx("div",{className:"automation-view__form-right",children:y.jsxs("div",{className:"automation-view__form-right-scroll",children:[y.jsx("div",{className:"automation-view__form-section",children:y.jsx(fme,{form:a,updateWeeklyCron:s,getWebhookUrl:l})}),y.jsx("div",{className:"automation-view__form-section",children:y.jsx(dme,{})})]})})]})})]})}function gme({rules:e,selectedRuleId:t,query:n,isCreating:r,onCreate:o,onSelect:i,onRun:a,onDelete:s,onToggle:l,onQueryChange:c}){const{t:d}=Ot(),[f,m]=u.useState(()=>{try{const g=window.localStorage.getItem("automationRuleFavorites");if(!g)return[];const v=JSON.parse(g);return Array.isArray(v)?v:[]}catch{return[]}});u.useEffect(()=>{window.localStorage.setItem("automationRuleFavorites",JSON.stringify(f))},[f]);const p=u.useMemo(()=>new Set(f),[f]),h=u.useMemo(()=>{const g=n.trim().toLowerCase();return[...g?e.filter(S=>{const C=S.name.toLowerCase().includes(g),_=(S.description??"").toLowerCase().includes(g);return C||_}):e].sort((S,C)=>{const _=p.has(S.id)?1:0,w=p.has(C.id)?1:0;return _!==w?w-_:C.createdAt-S.createdAt})},[p,n,e]),b=u.useCallback(g=>{m(v=>v.includes(g)?v.filter(S=>S!==g):[...v,g])},[]),x=u.useCallback(g=>{if(g.type==="interval"){const v=g.intervalMs?Math.max(1,Math.round(g.intervalMs/6e4)):0;return y.jsxs("span",{className:"automation-view__trigger-chip",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__trigger-icon",children:"timer"}),d("automation.intervalEvery",{minutes:v})]})}return g.type==="cron"?y.jsxs("span",{className:"automation-view__trigger-chip",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__trigger-icon",children:"schedule"}),d("automation.cronExpression",{expression:g.cronExpression??"-"})]}):y.jsxs("span",{className:"automation-view__trigger-chip",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__trigger-icon",children:"webhook"}),d("automation.webhookTrigger")]})},[d]);return y.jsxs("div",{className:"automation-view__sidebar",children:[y.jsxs("div",{className:"automation-view__sidebar-header",children:[y.jsx("div",{className:"automation-view__title",children:y.jsx("h2",{className:"automation-view__title-text",children:d("automation.title")})}),y.jsx(dt,{title:d(r?"automation.creatingRule":"automation.newRule"),children:y.jsx(ct,{className:"automation-view__icon-button automation-view__icon-button--add",type:"text",onClick:o,disabled:r,children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:r?"progress_activity":"add"})})})]}),y.jsx("div",{className:"automation-view__sidebar-search",children:y.jsx(Ft,{value:n,onChange:g=>c(g.target.value),placeholder:d("automation.searchRule"),prefix:y.jsx("span",{className:"material-symbols-rounded automation-view__search-icon",children:"search"}),allowClear:!0})}),h.length===0?y.jsx("div",{className:"automation-view__empty",children:y.jsx(bn,{description:d("automation.emptyRules")})}):y.jsx(ji,{className:"automation-view__rule-list",dataSource:h,renderItem:g=>{var E,$;const v=g.id===t,S=p.has(g.id),C=g.triggers??[],_=C.slice(0,2),w=Math.max(C.length-_.length,0),N=((E=g.tasks)==null?void 0:E.length)??0,k=(($=C[0])==null?void 0:$.type)??"interval";return y.jsx(ji.Item,{className:`automation-view__rule-item ${v?"automation-view__rule-item--active":""}`,onClick:()=>i(g.id),children:y.jsxs("div",{className:"automation-view__rule-card",children:[y.jsxs("div",{className:"automation-view__rule-content",children:[y.jsxs("div",{className:"automation-view__rule-name",children:[y.jsx("span",{className:`material-symbols-rounded automation-view__rule-icon automation-view__rule-icon--${k}`,children:k==="interval"?"timer":k==="cron"?"schedule":"webhook"}),y.jsx("span",{className:"automation-view__rule-title",children:g.name}),y.jsx(Do,{color:k==="interval"?"blue":k==="cron"?"geekblue":"purple",children:d(k==="interval"?"automation.typeInterval":k==="cron"?"automation.typeCron":"automation.typeWebhook")})]}),y.jsxs("div",{className:"automation-view__rule-meta",children:[y.jsxs("div",{className:"automation-view__rule-trigger-list",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"bolt"}),_.map(O=>y.jsx("span",{children:x(O)},O.id)),w>0&&y.jsxs("span",{className:"automation-view__trigger-more",children:["+",w]})]}),y.jsxs("span",{className:"automation-view__rule-tasks",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"checklist"}),d("automation.taskCount",{count:N})]}),y.jsxs("span",{className:"automation-view__rule-last",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"update"}),g.lastRunAt?d("automation.lastRunAt",{time:Js(g.lastRunAt).format("YYYY-MM-DD HH:mm")}):d("automation.noRunYet")]})]})]}),y.jsxs("div",{className:"automation-view__rule-actions",children:[y.jsx("div",{className:"automation-view__rule-actions-top",children:y.jsx(dt,{title:d("automation.toggleEnabled"),children:y.jsx(ta,{checked:g.enabled,onChange:O=>void l(g,O),onClick:(O,R)=>R.stopPropagation()})})}),y.jsxs("div",{className:"automation-view__rule-actions-bottom",children:[y.jsx(dt,{title:d("automation.run"),children:y.jsx(ct,{className:"automation-view__icon-button automation-view__icon-button--run",type:"text",onClick:O=>{O.stopPropagation(),a(g)},children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"play_arrow"})})}),y.jsx(dt,{title:d("automation.delete"),children:y.jsx(ct,{className:"automation-view__icon-button automation-view__icon-button--delete",type:"text",onClick:O=>{O.stopPropagation(),s(g)},children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"delete"})})}),y.jsx(dt,{title:d(S?"automation.unfavorite":"automation.favorite"),children:y.jsx(ct,{className:`automation-view__icon-button automation-view__icon-button--favorite ${S?"automation-view__icon-button--active":""}`,type:"text",onClick:O=>{O.stopPropagation(),b(g.id)},children:y.jsx("span",{className:`material-symbols-rounded automation-view__action-icon ${S?"automation-view__action-icon--star":""}`,children:S?"star":"star_outline"})})})]})]})]})})}})]})}function vme({rule:e,runs:t,runQuery:n,statusFilter:r,timeFilter:o,sortOrder:i,onEditRule:a,onRunQueryChange:s,onStatusFilterChange:l,onTimeFilterChange:c,onSortOrderChange:d}){const{t:f}=Ot(),m=u.useMemo(()=>{const g=n.trim().toLowerCase(),v=Date.now(),C={all:null,"24h":24*60*60*1e3,"7d":7*24*60*60*1e3,"30d":30*24*60*60*1e3}[o]??null;return t.filter(w=>r!=="all"&&(w.status??"unknown")!==r||C!=null&&v-w.runAt>C?!1:g?[w.taskTitle,w.title,w.lastMessage,w.lastUserMessage,w.sessionId].filter(Boolean).join(" ").toLowerCase().includes(g):!0).sort((w,N)=>i==="asc"?w.runAt-N.runAt:N.runAt-w.runAt)},[n,t,i,r,o]),p=u.useMemo(()=>[{title:f("automation.runTime"),dataIndex:"runAt",key:"runAt",render:g=>Js(g).format("YYYY-MM-DD HH:mm")},{title:f("automation.taskTitle"),dataIndex:"taskTitle",key:"taskTitle",render:(g,v)=>y.jsx("div",{className:"automation-view__task-cell",children:y.jsxs("a",{className:"automation-view__task-link",href:`/session/${v.sessionId}`,children:[y.jsx("span",{className:"material-symbols-rounded automation-view__task-icon",children:"task_alt"}),y.jsx("span",{className:"automation-view__task-text",children:v.taskTitle??f("automation.taskUnknown")}),v.status?y.jsxs("span",{className:"automation-view__status","data-status":v.status,children:[y.jsx("span",{className:"material-symbols-rounded automation-view__status-icon",children:"fiber_manual_record"}),f(`common.status.${v.status}`,v.status)]}):y.jsx("span",{className:"automation-view__status",children:"-"})]})})},{title:f("automation.runSummary"),dataIndex:"lastMessage",key:"summary",render:(g,v)=>{const S=v.title??v.lastMessage??v.lastUserMessage??"-";return y.jsx("span",{className:"automation-view__run-summary",children:S})}}],[f]),h=u.useMemo(()=>{var S;if(t.length===0)return[];const g=[...t].sort((C,_)=>_.runAt-C.runAt),v=(S=g[0])==null?void 0:S.sessionId;return v?g.filter(C=>C.sessionId===v):g.slice(0,1)},[t]);if(!e)return y.jsx("div",{className:"automation-view__empty",children:y.jsx(bn,{description:f("automation.selectRule")})});const b=(e.triggers??[]).map(g=>{var v;if(g.type==="interval"){const S=g.intervalMs?Math.max(1,Math.round(g.intervalMs/6e4)):1;return f("automation.intervalEvery",{minutes:S})}if(g.type==="cron"){const S=((v=g.cronExpression)==null?void 0:v.trim())||"-";return f("automation.cronExpression",{expression:S})}return f("automation.webhookTrigger")}),x=(e.tasks??[]).map((g,v)=>g.title||f("automation.taskDefaultTitle",{index:v+1}));return y.jsxs("div",{className:"automation-view__content",children:[y.jsxs("div",{className:"automation-view__detail",children:[y.jsxs("div",{className:"automation-view__detail-header",children:[y.jsxs("div",{className:"automation-view__detail-title",children:[y.jsx("h3",{className:"automation-view__content-text",children:e.name}),y.jsx("span",{className:"automation-view__detail-id",children:e.id})]}),y.jsx(ct,{className:"automation-view__icon-button automation-view__icon-button--edit",type:"text",onClick:()=>a(e),children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"edit"})})]}),y.jsxs("div",{className:"automation-view__detail-description",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"description"}),y.jsx("span",{children:e.description||f("automation.noDescription")})]}),y.jsxs("div",{className:"automation-view__detail-body",children:[y.jsxs("div",{className:"automation-view__detail-left",children:[y.jsxs("div",{className:"automation-view__detail-row",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"event"}),y.jsx("span",{className:"automation-view__detail-label",children:f("automation.createdAt")}),y.jsx("span",{className:"automation-view__detail-value",children:Js(e.createdAt).format("YYYY-MM-DD HH:mm")})]}),y.jsxs("div",{className:"automation-view__detail-row",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"toggle_on"}),y.jsx("span",{className:"automation-view__detail-label",children:f("automation.ruleStatus")}),y.jsx("span",{className:"automation-view__detail-value","data-status":e.enabled?"enabled":"disabled",children:e.enabled?f("automation.enabledOn"):f("automation.enabledOff")})]}),y.jsxs("div",{className:"automation-view__detail-list",children:[y.jsxs("div",{className:"automation-view__detail-row",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"update"}),y.jsx("span",{className:"automation-view__detail-label",children:f("automation.lastRunLabel")})]}),y.jsx("div",{className:"automation-view__run-list",children:h.length>0?h.map(g=>y.jsxs("div",{className:"automation-view__run-item",children:[y.jsx("a",{className:"automation-view__run-link",href:`/session/${g.sessionId}?tag=${encodeURIComponent(`automation:${e.id}:${e.name}`)}`,target:"_blank",rel:"noreferrer",children:g.taskTitle??f("automation.taskUnknown")}),y.jsx("span",{className:"automation-view__run-time",children:Js(g.runAt).format("YYYY-MM-DD HH:mm")})]},g.id)):y.jsx("span",{className:"automation-view__detail-value",children:f("automation.noRunYet")})})]}),e.lastSessionId&&y.jsxs("div",{className:"automation-view__detail-row",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"open_in_new"}),y.jsx("a",{className:"automation-view__detail-label automation-view__detail-link",href:`/session/${e.lastSessionId}?tag=${encodeURIComponent(`automation:${e.id}:${e.name}`)}`,target:"_blank",rel:"noreferrer",children:f("automation.relatedSession")})]})]}),y.jsxs("div",{className:"automation-view__detail-right",children:[y.jsxs("div",{className:"automation-view__detail-section",children:[y.jsxs("div",{className:"automation-view__detail-section-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"bolt"}),f("automation.sectionTriggers")]}),y.jsx("div",{className:"automation-view__detail-chips",children:b.length?b.map((g,v)=>y.jsx("span",{className:"automation-view__detail-chip",children:g},`${g}-${v}`)):y.jsx("span",{className:"automation-view__detail-placeholder",children:f("automation.noTriggers")})})]}),y.jsxs("div",{className:"automation-view__detail-section",children:[y.jsxs("div",{className:"automation-view__detail-section-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"task"}),f("automation.sectionTasks")]}),y.jsx("div",{className:"automation-view__detail-chips",children:x.length?x.map((g,v)=>y.jsx("span",{className:"automation-view__detail-chip",children:g},`${g}-${v}`)):y.jsx("span",{className:"automation-view__detail-placeholder",children:f("automation.noTasks")})})]})]})]})]}),y.jsx("div",{className:"automation-view__content-header",children:y.jsxs("div",{className:"automation-view__content-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__content-icon",children:"history"}),y.jsx("h3",{className:"automation-view__content-text",children:f("automation.runHistory")})]})}),y.jsxs("div",{className:"automation-view__run-filters",children:[y.jsx(Ft,{value:n,onChange:g=>s(g.target.value),placeholder:f("automation.runSearch"),className:"automation-view__run-search",allowClear:!0}),y.jsx(Yn,{value:r,onChange:l,className:"automation-view__run-select",options:[{label:f("automation.statusAll"),value:"all"},{label:f("common.status.running"),value:"running"},{label:f("common.status.completed"),value:"completed"},{label:f("common.status.failed"),value:"failed"},{label:f("common.status.terminated"),value:"terminated"},{label:f("common.status.waiting_input"),value:"waiting_input"}]}),y.jsx(Yn,{value:o,onChange:c,className:"automation-view__run-select",options:[{label:f("automation.timeAll"),value:"all"},{label:f("automation.time24h"),value:"24h"},{label:f("automation.time7d"),value:"7d"},{label:f("automation.time30d"),value:"30d"}]}),y.jsx(Yn,{value:i,onChange:d,className:"automation-view__run-select",options:[{label:f("automation.sortDesc"),value:"desc"},{label:f("automation.sortAsc"),value:"asc"}]})]}),m.length===0?y.jsx("div",{className:"automation-view__empty",children:y.jsx(bn,{description:f("automation.noRuns")})}):y.jsx(la,{rowKey:"id",className:"automation-view__run-table",columns:p,dataSource:m,pagination:{pageSize:8,hideOnSinglePage:!0}})]})}function yme(){const{t:e}=Ot(),{message:t}=Eo.useApp(),n=Ts(),{data:r,mutate:o}=Qn("/api/automation/rules",Ife),i=(r==null?void 0:r.rules)??[],[a,s]=u.useState("view"),[l,c]=u.useState(!1),{values:d,update:f}=ju({keys:["rule","q","runQ","status","time","sort"],defaults:{rule:"",q:"",runQ:"",status:"all",time:"all",sort:"desc"},omit:{rule:E=>E==="",q:E=>E==="",runQ:E=>E==="",status:E=>E==="all",time:E=>E==="all",sort:E=>E==="desc"}}),m=u.useMemo(()=>{var $;const E=d.rule;return E&&i.some(O=>O.id===E)?E:(($=i[0])==null?void 0:$.id)??null},[i,d.rule]),p=u.useMemo(()=>i.find(E=>E.id===m)??null,[i,m]),{data:h,mutate:b}=Qn(m?`/api/automation/rules/${m}/runs`:null,()=>jfe(m??"")),x=(h==null?void 0:h.runs)??[];u.useEffect(()=>{i.length!==0&&(!d.rule||!i.some(E=>E.id===d.rule))&&f({rule:i[0].id})},[i,f,d.rule]);const g=u.useCallback(E=>{s("view"),f({rule:E})},[f]),v=u.useCallback(()=>{s("create")},[]),S=u.useCallback(E=>{s("edit"),f({rule:E.id})},[f]),C=u.useCallback(()=>{s("view")},[]),_=u.useCallback(async(E,$)=>{var O;try{if(c(!0),a==="create"){const R=await Rfe({...E,immediateRun:$});await o(),(O=R.rule)!=null&&O.id&&f({rule:R.rule.id}),s("view");return}a==="edit"&&p&&(await AI(p.id,{...E,immediateRun:$}),await o(),b(),s("view"))}catch(R){t.error(Mr(R,e("automation.saveFailed")))}finally{c(!1)}},[a,o,b,t,p,e]),w=u.useCallback(async E=>{try{await Pfe(E.id),m===E.id&&(f({rule:""}),s("view")),o(),t.success(e("automation.deleted"))}catch($){t.error(Mr($,e("automation.deleteFailed")))}},[t,o,m,e]),N=u.useCallback(async E=>{var $;try{const R=($=(await Tfe(E.id)).sessionIds)==null?void 0:$[0];R&&(t.success(e("automation.runStarted")),b(),n(`/session/${R}`))}catch(O){t.error(Mr(O,e("automation.runFailed")))}},[t,b,n,e]),k=u.useCallback(async(E,$)=>{try{await AI(E.id,{enabled:$}),o()}catch(O){t.error(Mr(O,e("automation.toggleFailed")))}},[t,o,e]);return y.jsxs("div",{className:"automation-view",children:[y.jsx("div",{className:"automation-view__left",children:y.jsx(gme,{rules:i,selectedRuleId:m,query:d.q,isCreating:a==="create",onCreate:v,onSelect:g,onRun:N,onDelete:w,onToggle:k,onQueryChange:E=>f({q:E})})}),y.jsx("div",{className:"automation-view__divider"}),y.jsxs("div",{className:"automation-view__right",children:[a==="create"&&y.jsx(zI,{mode:"create",rule:null,submitting:l,onSubmit:_,onCancel:C}),a==="edit"&&y.jsx(zI,{mode:"edit",rule:p,submitting:l,onSubmit:_,onCancel:C}),a==="view"&&y.jsx(vme,{rule:p,runs:x,runQuery:d.runQ,statusFilter:d.status,timeFilter:d.time,sortOrder:d.sort,onEditRule:S,onRunQueryChange:E=>f({runQ:E}),onStatusFilterChange:E=>f({status:E}),onTimeFilterChange:E=>f({time:E}),onSortOrderChange:E=>f({sort:E})})]})]})}function bme(){return y.jsx(yme,{})}const xme="modulepreload",Sme=function(e){return"/__VF_PROJECT_AI_CLIENT_BASE__/"+e},BI={},oe=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),s=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));o=Promise.allSettled(n.map(l=>{if(l=Sme(l),l in BI)return;BI[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":xme,c||(f.as="script"),f.crossOrigin="",f.href=l,s&&f.setAttribute("nonce",s),document.head.appendChild(f),c)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return o.then(a=>{for(const s of a||[])s.status==="rejected"&&i(s.reason);return t().catch(i)})};let sr=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Cme(e){return S1(e)}function S1(e){return Array.isArray(e)?wme(e):e instanceof RegExp?e:typeof e=="object"?_me(e):e}function wme(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=S1(e[n]);return t}function _me(e){let t={};for(let n in e)t[n]=S1(e[n]);return t}function lB(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function cB(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?cB(e.substring(0,e.length-1)):e.substr(~t+1)}var e0=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,op=class{static hasCaptures(e){return e===null?!1:(e0.lastIndex=0,e0.test(e))}static replaceCaptures(e,t,n){return e.replace(e0,(r,o,i,a)=>{let s=n[parseInt(o||i,10)];if(s){let l=t.substring(s.start,s.end);for(;l[0]===".";)l=l.substring(1);switch(a){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function uB(e,t){return e<t?-1:e>t?1:0}function dB(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let o=0;o<n;o++){let i=uB(e[o],t[o]);if(i!==0)return i}return 0}return n-r}function FI(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function fB(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var mB=class{constructor(e){Ae(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Zh=class{constructor(e,t,n){Ae(this,"_cachedMatchRoot",new mB(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(kme(e),t)}static createFromParsedTheme(e,t){return Ome(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(o=>Eme(e.parent,o.parentScopes));return r?new pB(r.fontStyle,r.foreground,r.background):null}},t0=class Wp{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Wp(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Wp(n,t[r]);return n}push(t){return new Wp(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function Eme(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],o=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],o=!0}for(;e&&!$me(e.scopeName,r);){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function $me(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var pB=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function kme(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let o=0,i=t.length;o<i;o++){let a=t[o];if(!a.settings)continue;let s;if(typeof a.scope=="string"){let f=a.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),s=f.split(",")}else Array.isArray(a.scope)?s=a.scope:s=[""];let l=-1;if(typeof a.settings.fontStyle=="string"){l=0;let f=a.settings.fontStyle.split(" ");for(let m=0,p=f.length;m<p;m++)switch(f[m]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof a.settings.foreground=="string"&&FI(a.settings.foreground)&&(c=a.settings.foreground);let d=null;typeof a.settings.background=="string"&&FI(a.settings.background)&&(d=a.settings.background);for(let f=0,m=s.length;f<m;f++){let h=s[f].trim().split(" "),b=h[h.length-1],x=null;h.length>1&&(x=h.slice(0,h.length-1),x.reverse()),n[r++]=new Nme(b,x,o,l,c,d)}}return n}var Nme=class{constructor(e,t,n,r,o,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=o,this.background=i}},Xr=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Xr||{});function Ome(e,t){e.sort((l,c)=>{let d=uB(l.scope,c.scope);return d!==0||(d=dB(l.parentScopes,c.parentScopes),d!==0)?d:l.index-c.index});let n=0,r="#000000",o="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(o=l.background)}let i=new Ime(t),a=new pB(n,i.getId(r),i.getId(o)),s=new Pme(new sC(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let d=e[l];s.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new Zh(i,a,s)}var Ime=class{constructor(e){Ae(this,"_isFrozen");Ae(this,"_lastColorId");Ae(this,"_id2color");Ae(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Rme=Object.freeze([]),sC=class hB{constructor(t,n,r,o,i){Ae(this,"scopeDepth");Ae(this,"parentScopes");Ae(this,"fontStyle");Ae(this,"foreground");Ae(this,"background");this.scopeDepth=t,this.parentScopes=n||Rme,this.fontStyle=r,this.foreground=o,this.background=i}clone(){return new hB(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,o=t.length;r<o;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,o){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),o!==0&&(this.background=o)}},Pme=class lC{constructor(t,n=[],r={}){Ae(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,o=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[o]===">"&&o++,!(r>=t.parentScopes.length||o>=n.parentScopes.length);){const i=n.parentScopes[o].length-t.parentScopes[r].length;if(i!==0)return i;r++,o++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),o,i;if(r===-1?(o=t,i=""):(o=t.substring(0,r),i=t.substring(r+1)),this._children.hasOwnProperty(o))return this._children[o].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(lC._cmpBySpecificity),n}insert(t,n,r,o,i,a){if(n===""){this._doInsertHere(t,r,o,i,a);return}let s=n.indexOf("."),l,c;s===-1?(l=n,c=""):(l=n.substring(0,s),c=n.substring(s+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new lC(this._mainRule.clone(),sC.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(t+1,c,r,o,i,a)}_doInsertHere(t,n,r,o,i){if(n===null){this._mainRule.acceptOverwrite(t,r,o,i);return}for(let a=0,s=this._rulesWithParentScopes.length;a<s;a++){let l=this._rulesWithParentScopes[a];if(dB(l.parentScopes,n)===0){l.acceptOverwrite(t,r,o,i);return}}r===-1&&(r=this._mainRule.fontStyle),o===0&&(o=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new sC(t,n,r,o,i))}},eu=class qo{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=qo.getLanguageId(t),r=qo.getTokenType(t),o=qo.getFontStyle(t),i=qo.getForeground(t),a=qo.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:o,foreground:i,background:a})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,o,i,a,s){let l=qo.getLanguageId(t),c=qo.getTokenType(t),d=qo.containsBalancedBrackets(t)?1:0,f=qo.getFontStyle(t),m=qo.getForeground(t),p=qo.getBackground(t);return n!==0&&(l=n),r!==8&&(c=r),o!==null&&(d=o?1:0),i!==-1&&(f=i),a!==0&&(m=a),s!==0&&(p=s),(l<<0|c<<8|d<<10|f<<11|m<<15|p<<24)>>>0}};function Jh(e,t){const n=[],r=Tme(e);let o=r.next();for(;o!==null;){let l=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=r.next()}let c=a();if(n.push({matcher:c,priority:l}),o!==",")break;o=r.next()}return n;function i(){if(o==="-"){o=r.next();const l=i();return c=>!!l&&!l(c)}if(o==="("){o=r.next();const l=s();return o===")"&&(o=r.next()),l}if(HI(o)){const l=[];do l.push(o),o=r.next();while(HI(o));return c=>t(l,c)}return null}function a(){const l=[];let c=i();for(;c;)l.push(c),c=i();return d=>l.every(f=>f(d))}function s(){const l=[];let c=a();for(;c&&(l.push(c),o==="|"||o===",");){do o=r.next();while(o==="|"||o===",");c=a()}return d=>l.some(f=>f(d))}}function HI(e){return!!e&&!!e.match(/[\w\.:]+/)}function Tme(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function gB(e){typeof e.dispose=="function"&&e.dispose()}var _f=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},jme=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Mme=class{constructor(){Ae(this,"_references",[]);Ae(this,"_seenReferenceKeys",new Set);Ae(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Ame=class{constructor(e,t){Ae(this,"seenFullScopeRequests",new Set);Ae(this,"seenPartialScopeRequests",new Set);Ae(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new _f(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Mme;for(const n of e)Lme(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof _f){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Lme(e,t,n,r){const o=n.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof _f?Kp({baseGrammar:i,selfGrammar:o},r):cC(e.ruleName,{baseGrammar:i,selfGrammar:o,repository:o.repository},r);const a=n.injections(e.scopeName);if(a)for(const s of a)r.add(new _f(s))}function cC(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];eg([r],t,n)}}function Kp(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&eg(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&eg(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function eg(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const o=r.repository?lB({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&eg(r.patterns,{...t,repository:o},n);const i=r.include;if(!i)continue;const a=vB(i);switch(a.kind){case 0:Kp({...t,selfGrammar:t.baseGrammar},n);break;case 1:Kp(t,n);break;case 2:cC(a.ruleName,{...t,repository:o},n);break;case 3:case 4:const s=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){const l={baseGrammar:t.baseGrammar,selfGrammar:s,repository:o};a.kind===4?cC(a.ruleName,l,n):Kp(l,n)}else a.kind===4?n.add(new jme(a.scopeName,a.ruleName)):n.add(new _f(a.scopeName));break}}}var Dme=class{constructor(){Ae(this,"kind",0)}},zme=class{constructor(){Ae(this,"kind",1)}},Bme=class{constructor(e){Ae(this,"kind",2);this.ruleName=e}},Fme=class{constructor(e){Ae(this,"kind",3);this.scopeName=e}},Hme=class{constructor(e,t){Ae(this,"kind",4);this.scopeName=e,this.ruleName=t}};function vB(e){if(e==="$base")return new Dme;if(e==="$self")return new zme;const t=e.indexOf("#");if(t===-1)return new Fme(e);if(t===0)return new Bme(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new Hme(n,r)}}var Vme=/\\(\d+)/,VI=/\\(\d+)/g,Wme=-1,yB=-2;var dm=class{constructor(e,t,n,r){Ae(this,"$location");Ae(this,"id");Ae(this,"_nameIsCapturing");Ae(this,"_name");Ae(this,"_contentNameIsCapturing");Ae(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=op.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=op.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${cB(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:op.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:op.replaceCaptures(this._contentName,e,t)}},Kme=class extends dm{constructor(t,n,r,o,i){super(t,n,r,o);Ae(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,r,o){throw new Error("Not supported!")}},Ume=class extends dm{constructor(t,n,r,o,i){super(t,n,r,null);Ae(this,"_match");Ae(this,"captures");Ae(this,"_cachedCompiledPatterns");this._match=new Ef(o,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,o){return this._getCachedCompiledPatterns(t).compileAG(t,r,o)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new $f,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},WI=class extends dm{constructor(t,n,r,o,i){super(t,n,r,o);Ae(this,"hasMissingPatterns");Ae(this,"patterns");Ae(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,o){return this._getCachedCompiledPatterns(t).compileAG(t,r,o)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new $f,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},uC=class extends dm{constructor(t,n,r,o,i,a,s,l,c,d){super(t,n,r,o);Ae(this,"_begin");Ae(this,"beginCaptures");Ae(this,"_end");Ae(this,"endHasBackReferences");Ae(this,"endCaptures");Ae(this,"applyEndPatternLast");Ae(this,"hasMissingPatterns");Ae(this,"patterns");Ae(this,"_cachedCompiledPatterns");this._begin=new Ef(i,this.id),this.beginCaptures=a,this._end=new Ef(s||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,o){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,o)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new $f;for(const r of this.patterns)t.getRule(r).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},tg=class extends dm{constructor(t,n,r,o,i,a,s,l,c){super(t,n,r,o);Ae(this,"_begin");Ae(this,"beginCaptures");Ae(this,"whileCaptures");Ae(this,"_while");Ae(this,"whileHasBackReferences");Ae(this,"hasMissingPatterns");Ae(this,"patterns");Ae(this,"_cachedCompiledPatterns");Ae(this,"_cachedCompiledWhilePatterns");this._begin=new Ef(i,this.id),this.beginCaptures=a,this.whileCaptures=l,this._while=new Ef(s,yB),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,o){return this._getCachedCompiledPatterns(t).compileAG(t,r,o)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new $f;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,r,o){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,o)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new $f,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},bB=class Kr{static createCaptureRule(t,n,r,o,i){return t.registerRule(a=>new Kme(n,a,r,o,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(o=>{if(t.id=o,t.match)return new Ume(t.$vscodeTextmateLocation,t.id,t.name,t.match,Kr._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=lB({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new WI(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Kr._compilePatterns(i,n,r))}return t.while?new tg(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Kr._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Kr._compileCaptures(t.whileCaptures||t.captures,n,r),Kr._compilePatterns(t.patterns,n,r)):new uC(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Kr._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Kr._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Kr._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let o=[];if(t){let i=0;for(const a in t){if(a==="$vscodeTextmateLocation")continue;const s=parseInt(a,10);s>i&&(i=s)}for(let a=0;a<=i;a++)o[a]=null;for(const a in t){if(a==="$vscodeTextmateLocation")continue;const s=parseInt(a,10);let l=0;t[a].patterns&&(l=Kr.getCompiledRuleId(t[a],n,r)),o[s]=Kr.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,l)}}return o}static _compilePatterns(t,n,r){let o=[];if(t)for(let i=0,a=t.length;i<a;i++){const s=t[i];let l=-1;if(s.include){const c=vB(s.include);switch(c.kind){case 0:case 1:l=Kr.getCompiledRuleId(r[s.include],n,r);break;case 2:let d=r[c.ruleName];d&&(l=Kr.getCompiledRuleId(d,n,r));break;case 3:case 4:const f=c.scopeName,m=c.kind===4?c.ruleName:null,p=n.getExternalGrammar(f,r);if(p)if(m){let h=p.repository[m];h&&(l=Kr.getCompiledRuleId(h,n,p.repository))}else l=Kr.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else l=Kr.getCompiledRuleId(s,n,r);if(l!==-1){const c=n.getRule(l);let d=!1;if((c instanceof WI||c instanceof uC||c instanceof tg)&&c.hasMissingPatterns&&c.patterns.length===0&&(d=!0),d)continue;o.push(l)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},Ef=class xB{constructor(t,n){Ae(this,"source");Ae(this,"ruleId");Ae(this,"hasAnchor");Ae(this,"hasBackReferences");Ae(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let o=0,i=[],a=!1;for(let s=0;s<r;s++)if(t.charAt(s)==="\\"&&s+1<r){const c=t.charAt(s+1);c==="z"?(i.push(t.substring(o,s)),i.push("$(?!\\n)(?<!\\n)"),o=s+2):(c==="A"||c==="G")&&(a=!0),s++}this.hasAnchor=a,o===0?this.source=t:(i.push(t.substring(o,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Vme.test(this.source):this.hasBackReferences=!1}clone(){return new xB(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(o=>t.substring(o.start,o.end));return VI.lastIndex=0,this.source.replace(VI,(o,i)=>fB(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],o=[],i,a,s,l;for(i=0,a=this.source.length;i<a;i++)s=this.source.charAt(i),t[i]=s,n[i]=s,r[i]=s,o[i]=s,s==="\\"&&i+1<a&&(l=this.source.charAt(i+1),l==="A"?(t[i+1]="",n[i+1]="",r[i+1]="A",o[i+1]="A"):l==="G"?(t[i+1]="",n[i+1]="G",r[i+1]="",o[i+1]="G"):(t[i+1]=l,n[i+1]=l,r[i+1]=l,o[i+1]=l),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:o.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},$f=class{constructor(){Ae(this,"_items");Ae(this,"_hasAnchors");Ae(this,"_cached");Ae(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new KI(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(o=>o.resolveAnchors(t,n));return new KI(e,r,this._items.map(o=>o.ruleId))}},KI=class{constructor(e,t,n){Ae(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
458
|
-
`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},n0=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ga,
|
|
459
|
-
`;const i=this.createOnigString(e),a=i.content.length,s=new ipe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=SB(this,i,o,0,t,s,!0,r);return gB(i),{lineLength:a,lineTokens:s,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function qI(e,t){return e=Cme(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Td=class zi{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,o=(t==null?void 0:t.scopePath)??null;for(const i of n)o=t0.push(o,i.scopeNames),r=new zi(r,o,i.encodedTokenAttributes);return r}static createRoot(t,n){return new zi(null,new t0(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const o=r.getMetadataForScope(t),i=new t0(null,t),a=r.themeProvider.themeMatch(i),s=zi.mergeAttributes(n,o,a);return new zi(null,i,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return zi.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let o=-1,i=0,a=0;return r!==null&&(o=r.fontStyle,i=r.foregroundId,a=r.backgroundId),eu.set(t,n.languageId,n.tokenType,null,o,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return zi._pushAttributed(this,t,n);const r=t.split(/ /g);let o=this;for(const i of r)o=zi._pushAttributed(o,i,n);return o}static _pushAttributed(t,n,r){const o=r.getMetadataForScope(n),i=t.scopePath.push(n),a=r.themeProvider.themeMatch(i),s=zi.mergeAttributes(t.tokenAttributes,o,a);return new zi(t,i,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var o;const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((o=r.parent)==null?void 0:o.scopePath)??null)}),r=r.parent;return r===t?n.reverse():void 0}},ei,dC=(ei=class{constructor(t,n,r,o,i,a,s,l){Ae(this,"_stackElementBrand");Ae(this,"_enterPos");Ae(this,"_anchorPos");Ae(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=s,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=o}equals(t){return t===null?!1:ei._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Td.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){ei._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,o,i,a,s){return new ei(this,t,n,r,o,i,a,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var r,o;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(o=this.contentNameScopesList)==null?void 0:o.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new ei(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const r=Td.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new ei(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Td.fromExtension(r,n.contentNameScopesList))}},Ae(ei,"NULL",new ei(null,0,0,0,!1,null,null,null)),ei),ope=class{constructor(e,t){Ae(this,"balancedBracketScopes");Ae(this,"unbalancedBracketScopes");Ae(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Jh(n,ng).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Jh(n,ng).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},ipe=class{constructor(e,t,n,r){Ae(this,"_emitBinaryTokens");Ae(this,"_lineText");Ae(this,"_tokens");Ae(this,"_binaryTokens");Ae(this,"_lastTokenEndIndex");Ae(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var r;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let o=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const a=(e==null?void 0:e.getScopeNames())??[];for(const s of this._tokenTypeOverrides)s.matcher(a)&&(o=eu.set(o,0,s.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(a))}if(i&&(o=eu.set(o,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===o){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(o),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,o=this._binaryTokens.length;r<o;r++)n[r]=this._binaryTokens[r];return n}},ape=class{constructor(e,t){Ae(this,"_grammars",new Map);Ae(this,"_rawGrammars",new Map);Ae(this,"_injectionGrammars",new Map);Ae(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,o){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,tpe(e,i,t,n,r,o,this,this._onigLib))}return this._grammars.get(e)}},spe=class{constructor(t){Ae(this,"_options");Ae(this,"_syncRegistry");Ae(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new ape(Zh.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Zh.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new ope(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,o,i){const a=new Ame(this._syncRegistry,t);for(;a.Q.length>0;)a.Q.map(s=>this._loadSingleGrammar(s.scopeName)),a.processQueue();return this._grammarForScopeName(t,n,r,o,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,o=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,o)}_grammarForScopeName(t,n=0,r=null,o=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,r,o,i)}},fC=dC.NULL;const lpe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class fm{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}fm.prototype.normal={};fm.prototype.property={};fm.prototype.space=void 0;function wB(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new fm(n,r,t)}function mC(e){return e.toLowerCase()}class $o{constructor(t,n){this.attribute=n,this.property=t}}$o.prototype.attribute="";$o.prototype.booleanish=!1;$o.prototype.boolean=!1;$o.prototype.commaOrSpaceSeparated=!1;$o.prototype.commaSeparated=!1;$o.prototype.defined=!1;$o.prototype.mustUseProperty=!1;$o.prototype.number=!1;$o.prototype.overloadedBoolean=!1;$o.prototype.property="";$o.prototype.spaceSeparated=!1;$o.prototype.space=void 0;let cpe=0;const Xt=Il(),or=Il(),pC=Il(),et=Il(),In=Il(),Rc=Il(),Ro=Il();function Il(){return 2**++cpe}const hC=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xt,booleanish:or,commaOrSpaceSeparated:Ro,commaSeparated:Rc,number:et,overloadedBoolean:pC,spaceSeparated:In},Symbol.toStringTag,{value:"Module"})),r0=Object.keys(hC);class C1 extends $o{constructor(t,n,r,o){let i=-1;if(super(t,n),XI(this,"space",o),typeof r=="number")for(;++i<r0.length;){const a=r0[i];XI(this,r0[i],(r&hC[a])===hC[a])}}}C1.prototype.defined=!0;function XI(e,t,n){n&&(e[t]=n)}function Mu(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new C1(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[mC(r)]=r,n[mC(i.attribute)]=r}return new fm(t,n,e.space)}const _B=Mu({properties:{ariaActiveDescendant:null,ariaAtomic:or,ariaAutoComplete:null,ariaBusy:or,ariaChecked:or,ariaColCount:et,ariaColIndex:et,ariaColSpan:et,ariaControls:In,ariaCurrent:null,ariaDescribedBy:In,ariaDetails:null,ariaDisabled:or,ariaDropEffect:In,ariaErrorMessage:null,ariaExpanded:or,ariaFlowTo:In,ariaGrabbed:or,ariaHasPopup:null,ariaHidden:or,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:In,ariaLevel:et,ariaLive:null,ariaModal:or,ariaMultiLine:or,ariaMultiSelectable:or,ariaOrientation:null,ariaOwns:In,ariaPlaceholder:null,ariaPosInSet:et,ariaPressed:or,ariaReadOnly:or,ariaRelevant:null,ariaRequired:or,ariaRoleDescription:In,ariaRowCount:et,ariaRowIndex:et,ariaRowSpan:et,ariaSelected:or,ariaSetSize:et,ariaSort:null,ariaValueMax:et,ariaValueMin:et,ariaValueNow:et,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function EB(e,t){return t in e?e[t]:t}function $B(e,t){return EB(e,t.toLowerCase())}const upe=Mu({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rc,acceptCharset:In,accessKey:In,action:null,allow:null,allowFullScreen:Xt,allowPaymentRequest:Xt,allowUserMedia:Xt,alt:null,as:null,async:Xt,autoCapitalize:null,autoComplete:In,autoFocus:Xt,autoPlay:Xt,blocking:In,capture:null,charSet:null,checked:Xt,cite:null,className:In,cols:et,colSpan:null,content:null,contentEditable:or,controls:Xt,controlsList:In,coords:et|Rc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xt,defer:Xt,dir:null,dirName:null,disabled:Xt,download:pC,draggable:or,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xt,formTarget:null,headers:In,height:et,hidden:pC,high:et,href:null,hrefLang:null,htmlFor:In,httpEquiv:In,id:null,imageSizes:null,imageSrcSet:null,inert:Xt,inputMode:null,integrity:null,is:null,isMap:Xt,itemId:null,itemProp:In,itemRef:In,itemScope:Xt,itemType:In,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xt,low:et,manifest:null,max:null,maxLength:et,media:null,method:null,min:null,minLength:et,multiple:Xt,muted:Xt,name:null,nonce:null,noModule:Xt,noValidate:Xt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Xt,optimum:et,pattern:null,ping:In,placeholder:null,playsInline:Xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xt,referrerPolicy:null,rel:In,required:Xt,reversed:Xt,rows:et,rowSpan:et,sandbox:In,scope:null,scoped:Xt,seamless:Xt,selected:Xt,shadowRootClonable:Xt,shadowRootDelegatesFocus:Xt,shadowRootMode:null,shape:null,size:et,sizes:null,slot:null,span:et,spellCheck:or,src:null,srcDoc:null,srcLang:null,srcSet:null,start:et,step:null,style:null,tabIndex:et,target:null,title:null,translate:null,type:null,typeMustMatch:Xt,useMap:null,value:or,width:et,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:In,axis:null,background:null,bgColor:null,border:et,borderColor:null,bottomMargin:et,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xt,declare:Xt,event:null,face:null,frame:null,frameBorder:null,hSpace:et,leftMargin:et,link:null,longDesc:null,lowSrc:null,marginHeight:et,marginWidth:et,noResize:Xt,noHref:Xt,noShade:Xt,noWrap:Xt,object:null,profile:null,prompt:null,rev:null,rightMargin:et,rules:null,scheme:null,scrolling:or,standby:null,summary:null,text:null,topMargin:et,valueType:null,version:null,vAlign:null,vLink:null,vSpace:et,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xt,disableRemotePlayback:Xt,prefix:null,property:null,results:et,security:null,unselectable:null},space:"html",transform:$B}),dpe=Mu({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ro,accentHeight:et,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:et,amplitude:et,arabicForm:null,ascent:et,attributeName:null,attributeType:null,azimuth:et,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:et,by:null,calcMode:null,capHeight:et,className:In,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:et,diffuseConstant:et,direction:null,display:null,dur:null,divisor:et,dominantBaseline:null,download:Xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:et,enableBackground:null,end:null,event:null,exponent:et,externalResourcesRequired:null,fill:null,fillOpacity:et,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Rc,g2:Rc,glyphName:Rc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:et,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:et,horizOriginX:et,horizOriginY:et,id:null,ideographic:et,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:et,k:et,k1:et,k2:et,k3:et,k4:et,kernelMatrix:Ro,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:et,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:et,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:et,overlineThickness:et,paintOrder:null,panose1:null,path:null,pathLength:et,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:In,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:et,pointsAtY:et,pointsAtZ:et,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ro,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ro,rev:Ro,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ro,requiredFeatures:Ro,requiredFonts:Ro,requiredFormats:Ro,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:et,specularExponent:et,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:et,strikethroughThickness:et,string:null,stroke:null,strokeDashArray:Ro,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:et,strokeOpacity:et,strokeWidth:null,style:null,surfaceScale:et,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ro,tabIndex:et,tableValues:null,target:null,targetX:et,targetY:et,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ro,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:et,underlineThickness:et,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:et,values:null,vAlphabetic:et,vMathematical:et,vectorEffect:null,vHanging:et,vIdeographic:et,version:null,vertAdvY:et,vertOriginX:et,vertOriginY:et,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:et,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:EB}),kB=Mu({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),NB=Mu({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$B}),OB=Mu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),fpe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},mpe=/[A-Z]/g,YI=/-[a-z]/g,ppe=/^data[-\w.:]+$/i;function IB(e,t){const n=mC(t);let r=t,o=$o;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ppe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(YI,gpe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!YI.test(i)){let a=i.replace(mpe,hpe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=C1}return new o(r,t)}function hpe(e){return"-"+e.toLowerCase()}function gpe(e){return e.charAt(1).toUpperCase()}const RB=wB([_B,upe,kB,NB,OB],"html"),mm=wB([_B,dpe,kB,NB,OB],"svg"),QI={}.hasOwnProperty;function vpe(e,t){const n=t||{};function r(o,...i){let a=r.invalid;const s=r.handlers;if(o&&QI.call(o,e)){const l=String(o[e]);a=QI.call(s,l)?s[l]:r.unknown}if(a)return a.call(this,o,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const ype=/["&'<>`]/g,bpe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,xpe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Spe=/[|\\{}()[\]^$+*?.]/g,ZI=new WeakMap;function Cpe(e,t){if(e=e.replace(t.subset?wpe(t.subset):ype,r),t.subset||t.escapeOnly)return e;return e.replace(bpe,n).replace(xpe,r);function n(o,i,a){return t.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,a.charCodeAt(i+2),t)}function r(o,i,a){return t.format(o.charCodeAt(0),a.charCodeAt(i+1),t)}}function wpe(e){let t=ZI.get(e);return t||(t=_pe(e),ZI.set(e,t)),t}function _pe(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Spe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Epe=/[\dA-Fa-f]/;function $pe(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Epe.test(String.fromCharCode(t))?r:r+";"}const kpe=/\d/;function Npe(e,t,n){const r="&#"+String(e);return n&&t&&!kpe.test(String.fromCharCode(t))?r:r+";"}const Ope=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],o0={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Ipe=["cent","copy","divide","gt","lt","not","para","times"],PB={}.hasOwnProperty,gC={};let ip;for(ip in o0)PB.call(o0,ip)&&(gC[o0[ip]]=ip);const Rpe=/[^\dA-Za-z]/;function Ppe(e,t,n,r){const o=String.fromCharCode(e);if(PB.call(gC,o)){const i=gC[o],a="&"+i;return n&&Ope.includes(i)&&!Ipe.includes(i)&&(!r||t&&t!==61&&Rpe.test(String.fromCharCode(t)))?a:a+";"}return""}function Tpe(e,t,n){let r=$pe(e,t,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=Ppe(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){const i=Npe(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return o&&(!n.useShortestReferences||o.length<r.length)?o:r}function Pc(e,t){return Cpe(e,Object.assign({format:Tpe},t))}const jpe=/^>|^->|<!--|-->|--!>|<!-$/g,Mpe=[">"],Ape=["<",">"];function Lpe(e,t,n,r){return r.settings.bogusComments?"<?"+Pc(e.value,Object.assign({},r.settings.characterReferences,{subset:Mpe}))+">":"<!--"+e.value.replace(jpe,o)+"-->";function o(i){return Pc(i,Object.assign({},r.settings.characterReferences,{subset:Ape}))}}function Dpe(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function rg(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}function TB(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function jB(e){return e.join(" ").trim()}const zpe=/[ \t\n\f\r]/g;function Zv(e){return typeof e=="object"?e.type==="text"?JI(e.value):!1:JI(e)}function JI(e){return e.replace(zpe,"")===""}const gr=AB(1),MB=AB(-1),Bpe=[];function AB(e){return t;function t(n,r,o){const i=n?n.children:Bpe;let a=(r||0)+e,s=i[a];if(!o)for(;s&&Zv(s);)a+=e,s=i[a];return s}}const Fpe={}.hasOwnProperty;function LB(e){return t;function t(n,r,o){return Fpe.call(e,n.tagName)&&e[n.tagName](n,r,o)}}const w1=LB({body:Vpe,caption:i0,colgroup:i0,dd:Gpe,dt:Upe,head:i0,html:Hpe,li:Kpe,optgroup:qpe,option:Xpe,p:Wpe,rp:eR,rt:eR,tbody:Qpe,td:tR,tfoot:Zpe,th:tR,thead:Ype,tr:Jpe});function i0(e,t,n){const r=gr(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Zv(r.value.charAt(0)))}function Hpe(e,t,n){const r=gr(n,t);return!r||r.type!=="comment"}function Vpe(e,t,n){const r=gr(n,t);return!r||r.type!=="comment"}function Wpe(e,t,n){const r=gr(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Kpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Upe(e,t,n){const r=gr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Gpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function eR(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function qpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Xpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Ype(e,t,n){const r=gr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Qpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Zpe(e,t,n){return!gr(n,t)}function Jpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function tR(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ehe=LB({body:rhe,colgroup:ohe,head:nhe,html:the,tbody:ihe});function the(e){const t=gr(e,-1);return!t||t.type!=="comment"}function nhe(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function rhe(e){const t=gr(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Zv(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function ohe(e,t,n){const r=MB(n,t),o=gr(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&w1(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function ihe(e,t,n){const r=MB(n,t),o=gr(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&w1(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const ap={name:[[`
|
|
457
|
+
Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let m=ua(),p;if(t){let S=typeof t=="string"?Iu(t):t;Fn(d==="/"||((v=S.pathname)==null?void 0:v.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${S.pathname}" was given in the \`location\` prop.`),p=S}else p=m;let h=p.pathname||"/",b=h;if(d!=="/"){let S=d.replace(/^\//,"").split("/");b="/"+h.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=fz(e,{pathname:b});ci(f||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),ci(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=kue(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:$a([d,i.encodeLocation?i.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?d:$a([d,i.encodeLocation?i.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),a,n,r,o);return t&&g?u.createElement(im.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...p},navigationType:"POP"}},g):g}function wue(){let e=Pue(),t=cue(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=u.createElement(u.Fragment,null,u.createElement("p",null,"💿 Hey developer 👋"),u.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",u.createElement("code",{style:i},"ErrorBoundary")," or"," ",u.createElement("code",{style:i},"errorElement")," prop on your route.")),u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},t),n?u.createElement("pre",{style:o},n):null,a)}var _ue=u.createElement(wue,null),$z=class extends u.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=yue(e.digest);n&&(e=n)}let t=e!==void 0?u.createElement(ca.Provider,{value:this.props.routeContext},u.createElement(s1.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?u.createElement(Eue,{error:e},t):t}};$z.contextType=fue;var Wb=new WeakMap;function Eue({children:e,error:t}){let{basename:n}=u.useContext(di);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=vue(t.digest);if(r){let o=Wb.get(t);if(o)throw o;let i=bz(r.location,n);if(yz&&!Wb.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Wb.set(t,a),a}return u.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function $ue({routeContext:e,match:t,children:n}){let r=u.useContext(Ru);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),u.createElement(ca.Provider,{value:e},n)}function kue(e,t=[],n=null,r=null,o=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,a=n==null?void 0:n.errors;if(a!=null){let d=i.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);Fn(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let s=!1,l=-1;if(n)for(let d=0;d<i.length;d++){let f=i[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=d),f.route.id){let{loaderData:m,errors:p}=n,h=f.route.loader&&!m.hasOwnProperty(f.route.id)&&(!p||p[f.route.id]===void 0);if(f.route.lazy||h){s=!0,l>=0?i=i.slice(0,l+1):i=[i[0]];break}}}let c=n&&r?(d,f)=>{var m,p;r(d,{location:n.location,params:((p=(m=n.matches)==null?void 0:m[0])==null?void 0:p.params)??{},unstable_pattern:uue(n.matches),errorInfo:f})}:void 0;return i.reduceRight((d,f,m)=>{let p,h=!1,b=null,x=null;n&&(p=a&&f.route.id?a[f.route.id]:void 0,b=f.route.errorElement||_ue,s&&(l<0&&m===0?(kz("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),h=!0,x=null):l===m&&(h=!0,x=f.route.hydrateFallbackElement||null)));let g=t.concat(i.slice(0,m+1)),v=()=>{let S;return p?S=b:h?S=x:f.route.Component?S=u.createElement(f.route.Component,null):f.route.element?S=f.route.element:S=d,u.createElement($ue,{match:f,routeContext:{outlet:d,matches:g,isDataRoute:n!=null},children:S})};return n&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?u.createElement($z,{location:n.location,revalidation:n.revalidation,component:b,error:p,children:v(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:c}):v()},null)}function l1(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Nue(e){let t=u.useContext(Ru);return Fn(t,l1(e)),t}function Oue(e){let t=u.useContext(qv);return Fn(t,l1(e)),t}function Iue(e){let t=u.useContext(ca);return Fn(t,l1(e)),t}function c1(e){let t=Iue(e),n=t.matches[t.matches.length-1];return Fn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Rue(){return c1("useRouteId")}function Pue(){var r;let e=u.useContext(s1),t=Oue("useRouteError"),n=c1("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function Tue(){let{router:e}=Nue("useNavigate"),t=c1("useNavigate"),n=u.useRef(!1);return _z(()=>{n.current=!0}),u.useCallback(async(o,i={})=>{ci(n.current,wz),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var $I={};function kz(e,t,n){!t&&!$I[e]&&($I[e]=!0,ci(!1,n))}u.memo(jue);function jue({routes:e,future:t,state:n,onError:r}){return Ez(e,void 0,n,r,t)}function Ya(e){Fn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Mue({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:i=!1,unstable_useTransitions:a}){Fn(!am(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=u.useMemo(()=>({basename:s,navigator:o,static:i,unstable_useTransitions:a,future:{}}),[s,o,i,a]);typeof n=="string"&&(n=Iu(n));let{pathname:c="/",search:d="",hash:f="",state:m=null,key:p="default"}=n,h=u.useMemo(()=>{let b=Pa(c,s);return b==null?null:{location:{pathname:b,search:d,hash:f,state:m,key:p},navigationType:r}},[s,c,d,f,m,p,r]);return ci(h!=null,`<Router basename="${s}"> is not able to match the URL "${c}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:u.createElement(di.Provider,{value:l},u.createElement(im.Provider,{children:t,value:h}))}function Aue({children:e,location:t}){return Cue(KS(e),t)}function KS(e,t=[]){let n=[];return u.Children.forEach(e,(r,o)=>{if(!u.isValidElement(r))return;let i=[...t,o];if(r.type===u.Fragment){n.push.apply(n,KS(r.props.children,i));return}Fn(r.type===Ya,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Fn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=KS(r.props.children,i)),n.push(a)}),n}var Fp="get",Hp="application/x-www-form-urlencoded";function Xv(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Lue(e){return Xv(e)&&e.tagName.toLowerCase()==="button"}function Due(e){return Xv(e)&&e.tagName.toLowerCase()==="form"}function zue(e){return Xv(e)&&e.tagName.toLowerCase()==="input"}function Bue(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Fue(e,t){return e.button===0&&(!t||t==="_self")&&!Bue(e)}function US(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function Hue(e,t){let n=US(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var ep=null;function Vue(){if(ep===null)try{new FormData(document.createElement("form"),0),ep=!1}catch{ep=!0}return ep}var Wue=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Kb(e){return e!=null&&!Wue.has(e)?(ci(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Hp}"`),null):e}function Kue(e,t){let n,r,o,i,a;if(Due(e)){let s=e.getAttribute("action");r=s?Pa(s,t):null,n=e.getAttribute("method")||Fp,o=Kb(e.getAttribute("enctype"))||Hp,i=new FormData(e)}else if(Lue(e)||zue(e)&&(e.type==="submit"||e.type==="image")){let s=e.form;if(s==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=e.getAttribute("formaction")||s.getAttribute("action");if(r=l?Pa(l,t):null,n=e.getAttribute("formmethod")||s.getAttribute("method")||Fp,o=Kb(e.getAttribute("formenctype"))||Kb(s.getAttribute("enctype"))||Hp,i=new FormData(s,e),!Vue()){let{name:c,type:d,value:f}=e;if(d==="image"){let m=c?`${c}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else c&&i.append(c,f)}}else{if(Xv(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Fp,r=null,o=Hp,a=e}return i&&o==="text/plain"&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function u1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Uue(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Pa(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function Gue(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function que(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Xue(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let a=await Gue(i,n);return a.links?a.links():[]}return[]}));return Jue(r.flat(1).filter(que).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function kI(e,t,n,r,o,i){let a=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,s=(l,c)=>{var d;return n[c].pathname!==l.pathname||((d=n[c].route.path)==null?void 0:d.endsWith("*"))&&n[c].params["*"]!==l.params["*"]};return i==="assets"?t.filter((l,c)=>a(l,c)||s(l,c)):i==="data"?t.filter((l,c)=>{var f;let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(a(l,c)||s(l,c))return!0;if(l.route.shouldRevalidate){let m=l.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function Yue(e,t,{includeHydrateFallback:n}={}){return Que(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function Que(e){return[...new Set(e)]}function Zue(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Jue(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(Zue(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function Nz(){let e=u.useContext(Ru);return u1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function ede(){let e=u.useContext(qv);return u1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var d1=u.createContext(void 0);d1.displayName="FrameworkContext";function Oz(){let e=u.useContext(d1);return u1(e,"You must render this element inside a <HydratedRouter> element"),e}function tde(e,t){let n=u.useContext(d1),[r,o]=u.useState(!1),[i,a]=u.useState(!1),{onFocus:s,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=t,m=u.useRef(null);u.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let b=g=>{g.forEach(v=>{a(v.isIntersecting)})},x=new IntersectionObserver(b,{threshold:.5});return m.current&&x.observe(m.current),()=>{x.disconnect()}}},[e]),u.useEffect(()=>{if(r){let b=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(b)}}},[r]);let p=()=>{o(!0)},h=()=>{o(!1),a(!1)};return n?e!=="intent"?[i,m,{}]:[i,m,{onFocus:Ju(s,p),onBlur:Ju(l,h),onMouseEnter:Ju(c,p),onMouseLeave:Ju(d,h),onTouchStart:Ju(f,p)}]:[!1,m,{}]}function Ju(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function nde({page:e,...t}){let{router:n}=Nz(),r=u.useMemo(()=>fz(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?u.createElement(ode,{page:e,matches:r,...t}):null}function rde(e){let{manifest:t,routeModules:n}=Oz(),[r,o]=u.useState([]);return u.useEffect(()=>{let i=!1;return Xue(e,t,n).then(a=>{i||o(a)}),()=>{i=!0}},[e,t,n]),r}function ode({page:e,matches:t,...n}){let r=ua(),{future:o,manifest:i,routeModules:a}=Oz(),{basename:s}=Nz(),{loaderData:l,matches:c}=ede(),d=u.useMemo(()=>kI(e,t,c,i,r,"data"),[e,t,c,i,r]),f=u.useMemo(()=>kI(e,t,c,i,r,"assets"),[e,t,c,i,r]),m=u.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let b=new Set,x=!1;if(t.forEach(v=>{var C;let S=i.routes[v.route.id];!S||!S.hasLoader||(!d.some(_=>_.route.id===v.route.id)&&v.route.id in l&&((C=a[v.route.id])!=null&&C.shouldRevalidate)||S.hasClientLoader?x=!0:b.add(v.route.id))}),b.size===0)return[];let g=Uue(e,s,o.unstable_trailingSlashAwareDataRequests,"data");return x&&b.size>0&&g.searchParams.set("_routes",t.filter(v=>b.has(v.route.id)).map(v=>v.route.id).join(",")),[g.pathname+g.search]},[s,o.unstable_trailingSlashAwareDataRequests,l,r,i,d,t,e,a]),p=u.useMemo(()=>Yue(f,i),[f,i]),h=rde(f);return u.createElement(u.Fragment,null,m.map(b=>u.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...n})),p.map(b=>u.createElement("link",{key:b,rel:"modulepreload",href:b,...n})),h.map(({key:b,link:x})=>u.createElement("link",{key:b,nonce:n.nonce,...x})))}function ide(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var ade=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{ade&&(window.__reactRouterVersion="7.12.0")}catch{}function sde({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=u.useRef();o.current==null&&(o.current=zce({window:r,v5Compat:!0}));let i=o.current,[a,s]=u.useState({action:i.action,location:i.location}),l=u.useCallback(c=>{n===!1?s(c):u.startTransition(()=>s(c))},[n]);return u.useLayoutEffect(()=>i.listen(l),[i,l]),u.createElement(Mue,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,unstable_useTransitions:n})}var Iz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rz=u.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:i,replace:a,state:s,target:l,to:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m,...p},h){let{basename:b,unstable_useTransitions:x}=u.useContext(di),g=typeof c=="string"&&Iz.test(c),v=bz(c,b);c=v.to;let S=bue(c,{relative:o}),[C,_,w]=tde(r,p),N=dde(c,{replace:a,state:s,target:l,preventScrollReset:d,relative:o,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:x});function k($){t&&t($),$.defaultPrevented||N($)}let E=u.createElement("a",{...p,...w,href:v.absoluteURL||S,onClick:v.isExternal||i?t:k,ref:ide(h,_),target:l,"data-discover":!g&&n==="render"?"true":void 0});return C&&!g?u.createElement(u.Fragment,null,E,u.createElement(nde,{page:S})):E});Rz.displayName="Link";var lde=u.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:a,viewTransition:s,children:l,...c},d){let f=sm(a,{relative:c.relative}),m=ua(),p=u.useContext(qv),{navigator:h,basename:b}=u.useContext(di),x=p!=null&&vde(f)&&s===!0,g=h.encodeLocation?h.encodeLocation(f).pathname:f.pathname,v=m.pathname,S=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(v=v.toLowerCase(),S=S?S.toLowerCase():null,g=g.toLowerCase()),S&&b&&(S=Pa(S,b)||S);const C=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let _=v===g||!o&&v.startsWith(g)&&v.charAt(C)==="/",w=S!=null&&(S===g||!o&&S.startsWith(g)&&S.charAt(g.length)==="/"),N={isActive:_,isPending:w,isTransitioning:x},k=_?t:void 0,E;typeof r=="function"?E=r(N):E=[r,_?"active":null,w?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let $=typeof i=="function"?i(N):i;return u.createElement(Rz,{...c,"aria-current":k,className:E,ref:d,style:$,to:a,viewTransition:s},typeof l=="function"?l(N):l)});lde.displayName="NavLink";var cde=u.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:a=Fp,action:s,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m,...p},h)=>{let{unstable_useTransitions:b}=u.useContext(di),x=hde(),g=gde(s,{relative:c}),v=a.toLowerCase()==="get"?"get":"post",S=typeof s=="string"&&Iz.test(s),C=_=>{if(l&&l(_),_.defaultPrevented)return;_.preventDefault();let w=_.nativeEvent.submitter,N=(w==null?void 0:w.getAttribute("formmethod"))||a,k=()=>x(w||_.currentTarget,{fetcherKey:t,method:N,navigate:n,replace:o,state:i,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m});b&&n!==!1?u.startTransition(()=>k()):k()};return u.createElement("form",{ref:h,method:v,action:g,onSubmit:r?l:C,...p,"data-discover":!S&&e==="render"?"true":void 0})});cde.displayName="Form";function ude(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pz(e){let t=u.useContext(Ru);return Fn(t,ude(e)),t}function dde(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:i,viewTransition:a,unstable_defaultShouldRevalidate:s,unstable_useTransitions:l}={}){let c=Ts(),d=ua(),f=sm(e,{relative:i});return u.useCallback(m=>{if(Fue(m,t)){m.preventDefault();let p=n!==void 0?n:Cf(d)===Cf(f),h=()=>c(e,{replace:p,state:r,preventScrollReset:o,relative:i,viewTransition:a,unstable_defaultShouldRevalidate:s});l?u.startTransition(()=>h()):h()}},[d,c,f,n,r,t,e,o,i,a,s,l])}function fde(e){ci(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=u.useRef(US(e)),n=u.useRef(!1),r=ua(),o=u.useMemo(()=>Hue(r.search,n.current?null:t.current),[r.search]),i=Ts(),a=u.useCallback((s,l)=>{const c=US(typeof s=="function"?s(new URLSearchParams(o)):s);n.current=!0,i("?"+c,l)},[i,o]);return[o,a]}var mde=0,pde=()=>`__${String(++mde)}__`;function hde(){let{router:e}=Pz("useSubmit"),{basename:t}=u.useContext(di),n=Rue(),r=e.fetch,o=e.navigate;return u.useCallback(async(i,a={})=>{let{action:s,method:l,encType:c,formData:d,body:f}=Kue(i,t);if(a.navigate===!1){let m=a.fetcherKey||pde();await r(m,n,a.action||s,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||c,flushSync:a.flushSync})}else await o(a.action||s,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:f,formMethod:a.method||l,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,o,t,n])}function gde(e,{relative:t}={}){let{basename:n}=u.useContext(di),r=u.useContext(ca);Fn(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...sm(e||".",{relative:t})},a=ua();if(e==null){i.search=a.search;let s=new URLSearchParams(i.search),l=s.getAll("index");if(l.some(d=>d==="")){s.delete("index"),l.filter(f=>f).forEach(f=>s.append("index",f));let d=s.toString();i.search=d?`?${d}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:$a([n,i.pathname])),Cf(i)}function vde(e,{relative:t}={}){let n=u.useContext(Sz);Fn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Pz("useViewTransitionState"),o=sm(e,{relative:t});if(!n.isTransitioning)return!1;let i=Pa(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=Pa(n.nextLocation.pathname,r)||n.nextLocation.pathname;return wf(o.pathname,a)!=null||wf(o.pathname,i)!=null}const Tz=0,jz=1,Mz=2,NI=3;var OI=Object.prototype.hasOwnProperty;function GS(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&GS(e[r],t[r]););return r===-1}if(!n||typeof e=="object"){r=0;for(n in e)if(OI.call(e,n)&&++r&&!OI.call(t,n)||!(n in t)||!GS(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t}const ha=new WeakMap,ba=()=>{},jr=ba(),Uh=Object,fn=e=>e===jr,xi=e=>typeof e=="function",Ta=(e,t)=>({...e,...t}),Az=e=>xi(e.then),Ub={},tp={},f1="undefined",lm=typeof window!=f1,qS=typeof document!=f1,yde=lm&&"Deno"in window,bde=()=>lm&&typeof window.requestAnimationFrame!=f1,Lz=(e,t)=>{const n=ha.get(e);return[()=>!fn(t)&&e.get(t)||Ub,r=>{if(!fn(t)){const o=e.get(t);t in tp||(tp[t]=o),n[5](t,Ta(o,r),o||Ub)}},n[6],()=>!fn(t)&&t in tp?tp[t]:!fn(t)&&e.get(t)||Ub]};let XS=!0;const xde=()=>XS,[YS,QS]=lm&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ba,ba],Sde=()=>{const e=qS&&document.visibilityState;return fn(e)||e!=="hidden"},Cde=e=>(qS&&document.addEventListener("visibilitychange",e),YS("focus",e),()=>{qS&&document.removeEventListener("visibilitychange",e),QS("focus",e)}),wde=e=>{const t=()=>{XS=!0,e()},n=()=>{XS=!1};return YS("online",t),YS("offline",n),()=>{QS("online",t),QS("offline",n)}},_de={isOnline:xde,isVisible:Sde},Ede={initFocus:Cde,initReconnect:wde},II=!J.useId,Ic=!lm||yde,$de=e=>bde()?window.requestAnimationFrame(e):setTimeout(e,1),Vp=Ic?u.useEffect:u.useLayoutEffect,Gb=typeof navigator<"u"&&navigator.connection,RI=!Ic&&Gb&&(["slow-2g","2g"].includes(Gb.effectiveType)||Gb.saveData),np=new WeakMap,kde=e=>Uh.prototype.toString.call(e),qb=(e,t)=>e===`[object ${t}]`;let Nde=0;const ZS=e=>{const t=typeof e,n=kde(e),r=qb(n,"Date"),o=qb(n,"RegExp"),i=qb(n,"Object");let a,s;if(Uh(e)===e&&!r&&!o){if(a=np.get(e),a)return a;if(a=++Nde+"~",np.set(e,a),Array.isArray(e)){for(a="@",s=0;s<e.length;s++)a+=ZS(e[s])+",";np.set(e,a)}if(i){a="#";const l=Uh.keys(e).sort();for(;!fn(s=l.pop());)fn(e[s])||(a+=s+":"+ZS(e[s])+",");np.set(e,a)}}else a=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return a},m1=e=>{if(xi(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?ZS(e):"",[e,t]};let Ode=0;const JS=()=>++Ode;async function Dz(...e){const[t,n,r,o]=e,i=Ta({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let a=i.populateCache;const s=i.rollbackOnError;let l=i.optimisticData;const c=m=>typeof s=="function"?s(m):s!==!1,d=i.throwOnError;if(xi(n)){const m=n,p=[],h=t.keys();for(const b of h)!/^\$(inf|sub)\$/.test(b)&&m(t.get(b)._k)&&p.push(b);return Promise.all(p.map(f))}return f(n);async function f(m){const[p]=m1(m);if(!p)return;const[h,b]=Lz(t,p),[x,g,v,S]=ha.get(t),C=()=>{const I=x[p];return(xi(i.revalidate)?i.revalidate(h().data,m):i.revalidate!==!1)&&(delete v[p],delete S[p],I&&I[0])?I[0](Mz).then(()=>h().data):h().data};if(e.length<3)return C();let _=r,w,N=!1;const k=JS();g[p]=[k,0];const E=!fn(l),$=h(),O=$.data,R=$._c,T=fn(R)?O:R;if(E&&(l=xi(l)?l(T,O):l,b({data:l,_c:T})),xi(_))try{_=_(T)}catch(I){w=I,N=!0}if(_&&Az(_))if(_=await _.catch(I=>{w=I,N=!0}),k!==g[p][0]){if(N)throw w;return _}else N&&E&&c(w)&&(a=!0,b({data:T,_c:jr}));if(a&&!N)if(xi(a)){const I=a(_,T);b({data:I,error:jr,_c:jr})}else b({data:_,error:jr,_c:jr});if(g[p][1]=JS(),Promise.resolve(C()).then(()=>{b({_c:jr})}),N){if(d)throw w;return}return _}}const PI=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},zz=(e,t)=>{if(!ha.has(e)){const n=Ta(Ede,t),r=Object.create(null),o=Dz.bind(jr,e);let i=ba;const a=Object.create(null),s=(d,f)=>{const m=a[d]||[];return a[d]=m,m.push(f),()=>m.splice(m.indexOf(f),1)},l=(d,f,m)=>{e.set(d,f);const p=a[d];if(p)for(const h of p)h(f,m)},c=()=>{if(!ha.has(e)&&(ha.set(e,[r,Object.create(null),Object.create(null),Object.create(null),o,l,s]),!Ic)){const d=n.initFocus(setTimeout.bind(jr,PI.bind(jr,r,Tz))),f=n.initReconnect(setTimeout.bind(jr,PI.bind(jr,r,jz)));i=()=>{d&&d(),f&&f(),ha.delete(e)}}};return c(),[e,o,c,i]}return[e,ha.get(e)[4]]},Ide=(e,t,n,r,o)=>{const i=n.errorRetryCount,a=o.retryCount,s=~~((Math.random()+.5)*(1<<(a<8?a:8)))*n.errorRetryInterval;!fn(i)&&a>i||setTimeout(r,s,o)},Rde=GS,[p1,Pde]=zz(new Map),Bz=Ta({onLoadingSlow:ba,onSuccess:ba,onError:ba,onErrorRetry:Ide,onDiscarded:ba,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:RI?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:RI?5e3:3e3,compare:Rde,isPaused:()=>!1,cache:p1,mutate:Pde,fallback:{}},_de),Fz=(e,t)=>{const n=Ta(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:a}=t;r&&i&&(n.use=r.concat(i)),o&&a&&(n.fallback=Ta(o,a))}return n},eC=u.createContext({}),Tde=e=>{const{value:t}=e,n=u.useContext(eC),r=xi(t),o=u.useMemo(()=>r?t(n):t,[r,n,t]),i=u.useMemo(()=>r?o:Fz(n,o),[r,n,o]),a=o&&o.provider,s=u.useRef(jr);a&&!s.current&&(s.current=zz(a(i.cache||p1),o));const l=s.current;return l&&(i.cache=l[0],i.mutate=l[1]),Vp(()=>{if(l)return l[2]&&l[2](),l[3]},[]),u.createElement(eC.Provider,Ta(e,{value:i}))},jde="$inf$",Hz=lm&&window.__SWR_DEVTOOLS_USE__,Mde=Hz?window.__SWR_DEVTOOLS_USE__:[],Ade=()=>{Hz&&(window.__SWR_DEVTOOLS_REACT__=J)},Lde=e=>xi(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],Yv=()=>{const e=u.useContext(eC);return u.useMemo(()=>Ta(Bz,e),[e])},Dde=e=>(t,n,r)=>e(t,n&&((...i)=>{const[a]=m1(t),[,,,s]=ha.get(p1);if(a.startsWith(jde))return n(...i);const l=s[a];return fn(l)?n(...i):(delete s[a],l)}),r),zde=Mde.concat(Dde),Bde=e=>function(...n){const r=Yv(),[o,i,a]=Lde(n),s=Fz(r,a);let l=e;const{use:c}=s,d=(c||[]).concat(zde);for(let f=d.length;f--;)l=d[f](l);return l(o,i||s.fetcher||null,s)},Fde=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o>=0&&(r[o]=r[r.length-1],r.pop())}};Ade();const Xb=J.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e}}),Yb={dedupe:!0},TI=Promise.resolve(jr),Hde=(e,t,n)=>{const{cache:r,compare:o,suspense:i,fallbackData:a,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:c,refreshWhenHidden:d,refreshWhenOffline:f,keepPreviousData:m,strictServerPrefetchWarning:p}=n,[h,b,x,g]=ha.get(r),[v,S]=m1(e),C=u.useRef(!1),_=u.useRef(!1),w=u.useRef(v),N=u.useRef(t),k=u.useRef(n),E=()=>k.current,$=()=>E().isVisible()&&E().isOnline(),[O,R,T,I]=Lz(r,v),P=u.useRef({}).current,j=fn(a)?fn(n.fallback)?jr:n.fallback[v]:a,L=(X,ce)=>{for(const pe in P){const ge=pe;if(ge==="data"){if(!o(X[ge],ce[ge])&&(!fn(X[ge])||!o(W,ce[ge])))return!1}else if(ce[ge]!==X[ge])return!1}return!0},D=u.useMemo(()=>{const X=!v||!t?!1:fn(s)?E().isPaused()||i?!1:l!==!1:s,ce=ue=>{const me=Ta(ue);return delete me._k,X?{isValidating:!0,isLoading:!0,...me}:me},pe=O(),ge=I(),we=ce(pe),ae=pe===ge?we:ce(ge);let de=we;return[()=>{const ue=ce(O());return L(ue,de)?(de.data=ue.data,de.isLoading=ue.isLoading,de.isValidating=ue.isValidating,de.error=ue.error,de):(de=ue,ue)},()=>ae]},[r,v]),z=P0.useSyncExternalStore(u.useCallback(X=>T(v,(ce,pe)=>{L(pe,ce)||X()}),[r,v]),D[0],D[1]),M=!C.current,H=h[v]&&h[v].length>0,F=z.data,A=fn(F)?j&&Az(j)?Xb(j):j:F,B=z.error,K=u.useRef(A),W=m?fn(F)?fn(K.current)?A:K.current:F:A,q=v&&fn(A),U=!Ic&&P0.useSyncExternalStore(()=>ba,()=>!1,()=>!0);p&&U&&!i&&q&&console.warn(`Missing pre-initiated data for serialized key "${v}" during server-side rendering. Data fethcing should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const te=H&&!fn(B)?!1:M&&!fn(s)?s:E().isPaused()?!1:i?fn(A)?!1:l:fn(A)||l,le=!!(v&&t&&M&&te),ie=fn(z.isValidating)?le:z.isValidating,ee=fn(z.isLoading)?le:z.isLoading,se=u.useCallback(async X=>{const ce=N.current;if(!v||!ce||_.current||E().isPaused())return!1;let pe,ge,we=!0;const ae=X||{},de=!x[v]||!ae.dedupe,ue=()=>II?!_.current&&v===w.current&&C.current:v===w.current,me={isValidating:!1,isLoading:!1},Ce=()=>{R(me)},ne=()=>{const ye=x[v];ye&&ye[1]===ge&&delete x[v]},he={isValidating:!0};fn(O().data)&&(he.isLoading=!0);try{if(de&&(R(he),n.loadingTimeout&&fn(O().data)&&setTimeout(()=>{we&&ue()&&E().onLoadingSlow(v,n)},n.loadingTimeout),x[v]=[ce(S),JS()]),[pe,ge]=x[v],pe=await pe,de&&setTimeout(ne,n.dedupingInterval),!x[v]||x[v][1]!==ge)return de&&ue()&&E().onDiscarded(v),!1;me.error=jr;const ye=b[v];if(!fn(ye)&&(ge<=ye[0]||ge<=ye[1]||ye[1]===0))return Ce(),de&&ue()&&E().onDiscarded(v),!1;const xe=O().data;me.data=o(xe,pe)?xe:pe,de&&ue()&&E().onSuccess(pe,v,n)}catch(ye){ne();const xe=E(),{shouldRetryOnError:$e}=xe;xe.isPaused()||(me.error=ye,de&&ue()&&(xe.onError(ye,v,xe),($e===!0||xi($e)&&$e(ye))&&(!E().revalidateOnFocus||!E().revalidateOnReconnect||$())&&xe.onErrorRetry(ye,v,xe,Se=>{const be=h[v];be&&be[0]&&be[0](NI,Se)},{retryCount:(ae.retryCount||0)+1,dedupe:!0})))}return we=!1,Ce(),!0},[v,r]),re=u.useCallback((...X)=>Dz(r,w.current,...X),[]);if(Vp(()=>{N.current=t,k.current=n,fn(F)||(K.current=F)}),Vp(()=>{if(!v)return;const X=se.bind(jr,Yb);let ce=0;E().revalidateOnFocus&&(ce=Date.now()+E().focusThrottleInterval);const ge=Fde(v,h,(we,ae={})=>{if(we==Tz){const de=Date.now();E().revalidateOnFocus&&de>ce&&$()&&(ce=de+E().focusThrottleInterval,X())}else if(we==jz)E().revalidateOnReconnect&&$()&&X();else{if(we==Mz)return se();if(we==NI)return se(ae)}});return _.current=!1,w.current=v,C.current=!0,R({_k:S}),te&&(x[v]||(fn(A)||Ic?X():$de(X))),()=>{_.current=!0,ge()}},[v]),Vp(()=>{let X;function ce(){const ge=xi(c)?c(O().data):c;ge&&X!==-1&&(X=setTimeout(pe,ge))}function pe(){!O().error&&(d||E().isVisible())&&(f||E().isOnline())?se(Yb).then(ce):ce()}return ce(),()=>{X&&(clearTimeout(X),X=-1)}},[c,d,f,v]),u.useDebugValue(W),i){if(!II&&Ic&&q)throw new Error("Fallback data is required when using Suspense in SSR.");q&&(N.current=t,k.current=n,_.current=!1);const X=g[v],ce=!fn(X)&&q?re(X):TI;if(Xb(ce),!fn(B)&&q)throw B;const pe=q?se(Yb):TI;!fn(W)&&q&&(pe.status="fulfilled",pe.value=!0),Xb(pe)}return{mutate:re,get data(){return P.data=!0,W},get error(){return P.error=!0,B},get isValidating(){return P.isValidating=!0,ie},get isLoading(){return P.isLoading=!0,ee}}},Vde=Uh.defineProperty(Tde,"defaultValue",{value:Bz}),Qn=Bde(Hde),Wde=()=>globalThis.__VF_PROJECT_AI_RUNTIME_ENV__,Kde=(...e)=>e.find(t=>typeof t=="string"&&t.trim()!==""),Ude=e=>{let t=(e==null?void 0:e.trim())??"/ui";return t.startsWith("/")||(t=`/${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t},Gde=e=>{let t=(e==null?void 0:e.trim())??"";return t?(t.startsWith("/")||(t=`/${t}`),t):"/ws"},Qv=()=>Wde()??{},qde=(...e)=>Ude(Kde(...e)),Xde=()=>qde(Qv().__VF_PROJECT_AI_CLIENT_BASE__,void 0,"/__VF_PROJECT_AI_CLIENT_BASE__/","/ui"),Vz=()=>Qv().__VF_PROJECT_AI_SERVER_HOST__??void 0,Wz=()=>Qv().__VF_PROJECT_AI_SERVER_PORT__??void 0,Yde=()=>Gde(Qv().__VF_PROJECT_AI_SERVER_WS_PATH__??void 0),Qde="8787",Qb=Vz(),Zb=Wz(),Pu={"Content-Type":"application/json"},Kz=()=>Qb!=null&&Qb!==""?Qb:window.location.hostname,Uz=()=>Zb!=null&&Zb!==""?Zb:Qde,Zde=()=>`http://${Kz()}:${Uz()}`,h1=e=>{if(e.startsWith("http://")||e.startsWith("https://"))return e;const t=e.startsWith("/")?e:`/${e}`;return`${Zde()}${t}`},cm=e=>new URL(h1(e));class mc extends Error{constructor(n,r){super(r.message);Ae(this,"status");Ae(this,"code");Ae(this,"details");this.name="ApiError",this.status=n,this.code=r.code,this.details=r.details}}const Gh=e=>e!=null&&typeof e=="object"&&!Array.isArray(e),Jde=e=>Gh(e)&&e.success===!0&&"data"in e,Gz=e=>Gh(e)&&e.success===!1&&Gh(e.error)&&typeof e.error.message=="string"&&typeof e.error.code=="string",efe=async e=>{const t=await e.text();if(t.trim()==="")return null;try{return JSON.parse(t)}catch{return t}},tfe=(e,t,n)=>{if(Gz(t))return new mc(e,t.error);if(Gh(t)){const r=typeof t.error=="string"?t.error:typeof t.message=="string"?t.message:n,o=typeof t.code=="string"?t.code:"request_failed";return new mc(e,{code:o,message:r,...t.details!==void 0?{details:t.details}:{}})}return typeof t=="string"&&t.trim()!==""?new mc(e,{code:"request_failed",message:t}):new mc(e,{code:"request_failed",message:n})},qz=async(e,t)=>{const n=await efe(e);if(!e.ok){const r=t??`Request failed with status ${e.status}`,o=tfe(e.status,n,r);throw console.error(t??"[api] request failed",e.status,o.message,o.details),o}if(Gz(n))throw new mc(e.status,n.error);return Jde(n)?n.data:n},Mr=(e,t)=>e instanceof mc&&e.message.trim()!==""||e instanceof Error&&e.message.trim()!==""?e.message:t;async function Rr(e,t){const n=typeof e=="string"?h1(e):e.toString(),r=await fetch(n,t);return qz(r)}async function g1(e,t,n){const r=typeof e=="string"?h1(e):e.toString(),o=await fetch(r,t);return qz(o,n)}const xa={BASE_URL:"/__VF_PROJECT_AI_CLIENT_BASE__/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function Xz(e){return"init"in e}function tC(e){return!!e.write}function jI(e){return"v"in e||"e"in e}function qh(e){if("e"in e)throw e.e;if((xa?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}const Xh=new WeakMap;function Yz(e){var t;return Yh(e)&&!!((t=Xh.get(e))!=null&&t[0])}function nfe(e){const t=Xh.get(e);t!=null&&t[0]&&(t[0]=!1,t[1].forEach(n=>n()))}function nC(e,t){let n=Xh.get(e);if(!n){n=[!0,new Set],Xh.set(e,n);const r=()=>{n[0]=!1};e.then(r,r)}n[1].add(t)}function Yh(e){return typeof(e==null?void 0:e.then)=="function"}function Qz(e,t,n){if(!n.p.has(e)){n.p.add(e);const r=()=>n.p.delete(e);t.then(r,r)}}function Zz(e,t,n){var r;const o=new Set;for(const i of((r=n.get(e))==null?void 0:r.t)||[])o.add(i);for(const i of t.p)o.add(i);return o}const rfe=(e,t,...n)=>t.read(...n),ofe=(e,t,...n)=>t.write(...n),ife=(e,t)=>{if(t.INTERNAL_onInit)return t.INTERNAL_onInit(e);if(t.unstable_onInit)return console.warn("[DEPRECATED] atom.unstable_onInit is renamed to atom.INTERNAL_onInit."),t.unstable_onInit(e)},afe=(e,t,n)=>{var r;return(r=t.onMount)==null?void 0:r.call(t,n)},sfe=(e,t)=>{var n;const r=Qr(e),o=r[0],i=r[6],a=r[9];if((xa?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let s=o.get(t);return s||(s={d:new Map,p:new Set,n:0},o.set(t,s),(n=i.i)==null||n.call(i,t),a==null||a(e,t)),s},lfe=e=>{const t=Qr(e),n=t[1],r=t[3],o=t[4],i=t[5],a=t[6],s=t[13],l=[],c=d=>{try{d()}catch(f){l.push(f)}};do{a.f&&c(a.f);const d=new Set,f=d.add.bind(d);r.forEach(m=>{var p;return(p=n.get(m))==null?void 0:p.l.forEach(f)}),r.clear(),i.forEach(f),i.clear(),o.forEach(f),o.clear(),d.forEach(c),r.size&&s(e)}while(r.size||i.size||o.size);if(l.length)throw new AggregateError(l)},cfe=e=>{const t=Qr(e),n=t[1],r=t[2],o=t[3],i=t[11],a=t[14],s=t[17],l=[],c=new WeakSet,d=new WeakSet,f=Array.from(o);for(;f.length;){const m=f[f.length-1],p=i(e,m);if(d.has(m)){f.pop();continue}if(c.has(m)){if(r.get(m)===p.n)l.push([m,p]);else if((xa?"production":void 0)!=="production"&&r.has(m))throw new Error("[Bug] invalidated atom exists");d.add(m),f.pop();continue}c.add(m);for(const h of Zz(m,p,n))c.has(h)||f.push(h)}for(let m=l.length-1;m>=0;--m){const[p,h]=l[m];let b=!1;for(const x of h.d.keys())if(x!==p&&o.has(x)){b=!0;break}b&&(a(e,p),s(e,p)),r.delete(p)}},rC=new WeakSet,ufe=(e,t)=>{var n,r;const o=Qr(e),i=o[1],a=o[2],s=o[3],l=o[6],c=o[7],d=o[11],f=o[12],m=o[13],p=o[14],h=o[16],b=o[17],x=o[20],g=d(e,t);if(jI(g)){if(i.has(t)&&a.get(t)!==g.n)return g;let E=!1;for(const[$,O]of g.d)if(p(e,$).n!==O){E=!0;break}if(!E)return g}g.d.clear();let v=!0;function S(){i.has(t)&&(b(e,t),m(e),f(e))}function C(E){var $;if(E===t){const R=d(e,E);if(!jI(R))if(Xz(E))x(e,E,E.init);else throw new Error("no atom init");return qh(R)}const O=p(e,E);try{return qh(O)}finally{g.d.set(E,O.n),Yz(g.v)&&Qz(t,g.v,O),i.has(t)&&(($=i.get(E))==null||$.t.add(t)),v||S()}}let _,w;const N={get signal(){return _||(_=new AbortController),_.signal},get setSelf(){return(xa?"production":void 0)!=="production"&&!tC(t)&&console.warn("setSelf function cannot be used with read-only atom"),!w&&tC(t)&&(w=(...E)=>{if((xa?"production":void 0)!=="production"&&v&&console.warn("setSelf function cannot be called in sync"),!v)try{return h(e,t,...E)}finally{m(e),f(e)}}),w}},k=g.n;try{(xa?"production":void 0)!=="production"&&rC.delete(e);const E=c(e,t,C,N);return(xa?"production":void 0)!=="production"&&rC.has(e)&&console.warn("Detected store mutation during atom read. This is not supported."),x(e,t,E),Yh(E)&&(nC(E,()=>_==null?void 0:_.abort()),E.then(S,S)),(n=l.r)==null||n.call(l,t),g}catch(E){return delete g.v,g.e=E,++g.n,g}finally{v=!1,k!==g.n&&a.get(t)===k&&(a.set(t,g.n),s.add(t),(r=l.c)==null||r.call(l,t))}},dfe=(e,t)=>{const n=Qr(e),r=n[1],o=n[2],i=n[11],a=[t];for(;a.length;){const s=a.pop(),l=i(e,s);for(const c of Zz(s,l,r)){const d=i(e,c);o.set(c,d.n),a.push(c)}}},ffe=(e,t,...n)=>{const r=Qr(e),o=r[3],i=r[6],a=r[8],s=r[11],l=r[12],c=r[13],d=r[14],f=r[15],m=r[16],p=r[17],h=r[20];let b=!0;const x=v=>qh(d(e,v)),g=(v,...S)=>{var C;const _=s(e,v);try{if(v===t){if(!Xz(v))throw new Error("atom not writable");(xa?"production":void 0)!=="production"&&rC.add(e);const w=_.n,N=S[0];h(e,v,N),p(e,v),w!==_.n&&(o.add(v),f(e,v),(C=i.c)==null||C.call(i,v));return}else return m(e,v,...S)}finally{b||(c(e),l(e))}};try{return a(e,t,x,g,...n)}finally{b=!1}},mfe=(e,t)=>{var n;const r=Qr(e),o=r[1],i=r[3],a=r[6],s=r[11],l=r[15],c=r[18],d=r[19],f=s(e,t),m=o.get(t);if(m&&!Yz(f.v)){for(const[p,h]of f.d)if(!m.d.has(p)){const b=s(e,p);c(e,p).t.add(t),m.d.add(p),h!==b.n&&(i.add(p),l(e,p),(n=a.c)==null||n.call(a,p))}for(const p of m.d)if(!f.d.has(p)){m.d.delete(p);const h=d(e,p);h==null||h.t.delete(t)}}},pfe=(e,t)=>{var n;const r=Qr(e),o=r[1],i=r[4],a=r[6],s=r[10],l=r[11],c=r[12],d=r[13],f=r[14],m=r[16],p=r[18],h=l(e,t);let b=o.get(t);if(!b){f(e,t);for(const x of h.d.keys())p(e,x).t.add(t);if(b={l:new Set,d:new Set(h.d.keys()),t:new Set},o.set(t,b),tC(t)){const x=()=>{let g=!0;const v=(...S)=>{try{return m(e,t,...S)}finally{g||(d(e),c(e))}};try{const S=s(e,t,v);S&&(b.u=()=>{g=!0;try{S()}finally{g=!1}})}finally{g=!1}};i.add(x)}(n=a.m)==null||n.call(a,t)}return b},hfe=(e,t)=>{var n,r;const o=Qr(e),i=o[1],a=o[5],s=o[6],l=o[11],c=o[19],d=l(e,t);let f=i.get(t);if(!f||f.l.size)return f;let m=!1;for(const p of f.t)if((n=i.get(p))!=null&&n.d.has(t)){m=!0;break}if(!m){f.u&&a.add(f.u),f=void 0,i.delete(t);for(const p of d.d.keys()){const h=c(e,p);h==null||h.t.delete(t)}(r=s.u)==null||r.call(s,t);return}return f},gfe=(e,t,n)=>{const r=Qr(e)[11],o=r(e,t),i="v"in o,a=o.v;if(Yh(n))for(const s of o.d.keys())Qz(t,n,r(e,s));o.v=n,delete o.e,(!i||!Object.is(a,o.v))&&(++o.n,Yh(a)&&nfe(a))},vfe=(e,t)=>{const n=Qr(e)[14];return qh(n(e,t))},yfe=(e,t,...n)=>{const r=Qr(e),o=r[12],i=r[13],a=r[16];try{return a(e,t,...n)}finally{i(e),o(e)}},bfe=(e,t,n)=>{const r=Qr(e),o=r[12],i=r[18],a=r[19],l=i(e,t).l;return l.add(n),o(e),()=>{l.delete(n),a(e,t),o(e)}},Jz=new WeakMap,Qr=e=>{const t=Jz.get(e);if((xa?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function xfe(...e){const t={get(r){const o=Qr(t)[21];return o(t,r)},set(r,...o){const i=Qr(t)[22];return i(t,r,...o)},sub(r,o){const i=Qr(t)[23];return i(t,r,o)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},rfe,ofe,ife,afe,sfe,lfe,cfe,ufe,dfe,ffe,mfe,pfe,hfe,gfe,vfe,yfe,bfe,void 0].map((r,o)=>e[o]||r);return Jz.set(t,Object.freeze(n)),t}const eB={};let Sfe=0;function Tu(e,t){const n=`atom${++Sfe}`,r={toString(){return(eB?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?r.read=e:(r.init=e,r.read=Cfe,r.write=wfe),r}function Cfe(e){return e(this)}function wfe(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}function _fe(){return xfe()}let ed;function Efe(){return ed||(ed=_fe(),(eB?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=ed),globalThis.__JOTAI_DEFAULT_STORE__!==ed&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),ed}const $fe={},kfe=u.createContext(void 0);function tB(e){return u.useContext(kfe)||Efe()}const oC=e=>typeof(e==null?void 0:e.then)=="function",iC=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},Nfe=J.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(iC(e),e)}),Jb=new WeakMap,MI=(e,t)=>{let n=Jb.get(e);return n||(n=new Promise((r,o)=>{let i=e;const a=c=>d=>{i===c&&r(d)},s=c=>d=>{i===c&&o(d)},l=()=>{try{const c=t();oC(c)?(Jb.set(c,n),i=c,c.then(a(c),s(c)),nC(c,l)):r(c)}catch(c){o(c)}};e.then(a(e),s(e)),nC(e,l)}),Jb.set(e,n)),n};function vl(e,t){const{delay:n,unstable_promiseStatus:r=!J.use}={},o=tB(),[[i,a,s],l]=u.useReducer(d=>{const f=o.get(e);return Object.is(d[0],f)&&d[1]===o&&d[2]===e?d:[f,o,e]},void 0,()=>[o.get(e),o,e]);let c=i;if((a!==o||s!==e)&&(l(),c=o.get(e)),u.useEffect(()=>{const d=o.sub(e,()=>{if(r)try{const f=o.get(e);oC(f)&&iC(MI(f,()=>o.get(e)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),d},[o,e,n,r]),u.useDebugValue(c),oC(c)){const d=MI(c,()=>o.get(e));return r&&iC(d),Nfe(d)}return c}function Ofe(e,t){const n=tB();return u.useCallback((...o)=>{if(($fe?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...o)},[n,e])}function um(e,t){return[vl(e),Ofe(e)]}const Ife=Tu(Number(localStorage.getItem("sidebarWidth"))||300),nB=Tu(!1),v1=Tu(localStorage.getItem("sidebarCollapsed")==="true");Tu(void 0);const y1=Tu(localStorage.getItem("theme")||"system"),rB=Tu(!0);function Rfe({collapsed:e,onToggleCollapse:t}){const{t:n,i18n:r}=Ot(),[o,i]=um(y1),a=Ts(),l=ua().pathname,c=J.useMemo(()=>[{key:"zh",label:"简体中文",icon:r.language.startsWith("zh")?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("div",{className:"nav-menu-icon-placeholder"}),onClick:()=>{r.changeLanguage("zh")}},{key:"en",label:"English",icon:r.language.startsWith("en")?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("div",{className:"nav-menu-icon-placeholder"}),onClick:()=>{r.changeLanguage("en")}}],[r.language]),d=J.useMemo(()=>[{key:"light",label:n("common.themeLight"),icon:o==="light"?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("span",{className:"material-symbols-rounded nav-menu-icon",children:"light_mode"}),onClick:()=>{i("light"),localStorage.setItem("theme","light")}},{key:"dark",label:n("common.themeDark"),icon:o==="dark"?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("span",{className:"material-symbols-rounded nav-menu-icon",children:"dark_mode"}),onClick:()=>{i("dark"),localStorage.setItem("theme","dark")}},{key:"system",label:n("common.themeSystem"),icon:o==="system"?y.jsx("span",{className:"material-symbols-rounded nav-menu-icon active",children:"check"}):y.jsx("span",{className:"material-symbols-rounded nav-menu-icon",children:"desktop_windows"}),onClick:()=>{i("system"),localStorage.setItem("theme","system")}}],[o,n,i]),f=J.useMemo(()=>[{key:"sessions",icon:"chat_bubble",label:n("common.sessions"),path:"/",active:l==="/"||l.startsWith("/session/")},{key:"knowledge",icon:"library_books",label:n("common.knowledgeBase"),path:"/knowledge",active:l==="/knowledge"},{key:"automation",icon:"schedule",label:n("common.automation"),path:"/automation",active:l==="/automation"},{key:"benchmark",icon:"speed",label:n("common.benchmark"),path:"/benchmark",active:l==="/benchmark"},{key:"archive",icon:"archive",label:n("common.archivedSessions"),path:"/archive",active:l==="/archive"}],[l,n]);return y.jsxs("div",{className:"nav-rail",children:[y.jsx("div",{className:"nav-rail-top",children:f.map(m=>y.jsx(dt,{title:m.label,placement:"right",children:y.jsx("span",{children:y.jsx(ct,{type:"text",className:`nav-item ${m.active?"active":""}`,onClick:()=>void a(m.path),icon:y.jsx("span",{className:"material-symbols-rounded",children:m.icon})})})},m.key))}),y.jsxs("div",{className:"nav-rail-bottom",children:[y.jsx(dt,{title:n("common.theme"),placement:"right",children:y.jsx("span",{children:y.jsx(Jc,{menu:{items:d},placement:"topRight",trigger:["click"],children:y.jsx(ct,{type:"text",className:"nav-item",icon:y.jsx("span",{className:"material-symbols-rounded",children:o==="light"?"light_mode":o==="dark"?"dark_mode":"desktop_windows"})})})})}),y.jsx(dt,{title:n("common.language"),placement:"right",children:y.jsx("span",{children:y.jsx(Jc,{menu:{items:c},placement:"topRight",trigger:["click"],children:y.jsx(ct,{type:"text",className:"nav-item",icon:y.jsx("span",{className:"material-symbols-rounded",children:"language"})})})})}),y.jsx(dt,{title:n("common.settings"),placement:"right",children:y.jsx("span",{children:y.jsx(ct,{type:"text",className:`nav-item ${l==="/config"?"active":""}`,icon:y.jsx("span",{className:"material-symbols-rounded",children:"settings"}),onClick:()=>void a("/config")})})})]})]})}const ju=({keys:e,defaults:t,omit:n})=>{const[r,o]=fde(),i=u.useMemo(()=>new Set(e),[e]),a=u.useMemo(()=>e.reduce((l,c)=>{const d=r.get(c),f=(t==null?void 0:t[c])??"";return l[c]=d??f,l},{}),[t,e,r]),s=u.useCallback(l=>{const c=new URLSearchParams,d=e.reduce((f,m)=>{const p=r.get(m),h=(t==null?void 0:t[m])??"";return f[m]=p??h,f},{});Object.assign(d,l),e.forEach(f=>{const m=d[f]??"";m===""||(n!=null&&n[f]?n[f](m):!1)||c.set(f,m)});for(const[f,m]of r.entries())i.has(f)||c.append(f,m);c.toString()!==r.toString()&&o(c,{replace:!0})},[t,i,e,n,r,o]);return{values:a,update:s,searchParams:r}};async function Pfe(){return Rr("/api/automation/rules")}async function Tfe(e){return Rr("/api/automation/rules",{method:"POST",headers:Pu,body:JSON.stringify(e)})}async function AI(e,t){return Rr(`/api/automation/rules/${e}`,{method:"PATCH",headers:Pu,body:JSON.stringify(t)})}async function jfe(e){return Rr(`/api/automation/rules/${e}`,{method:"DELETE"})}async function Mfe(e){return Rr(`/api/automation/rules/${e}/run`,{method:"POST"})}async function Afe(e,t=50){const n=cm(`/api/automation/rules/${e}/runs`);return n.searchParams.set("limit",t.toString()),Rr(n)}async function Lfe(){return Rr("/api/benchmark/categories")}async function Dfe(e){const t=cm("/api/benchmark/cases");return Rr(t)}async function zfe(e,t){return Rr(`/api/benchmark/results/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async function rp(e){return g1("/api/benchmark/run",{method:"POST",headers:Pu,body:JSON.stringify(e)},"Failed to start benchmark run")}async function Bfe(e){return Rr(`/api/benchmark/runs/${encodeURIComponent(e)}`)}async function b1(){return Rr("/api/config")}async function Ffe(e,t,n){return g1("/api/config",{method:"PATCH",headers:Pu,body:JSON.stringify({source:e,section:t,value:n})},"[api] update config failed:")}async function Hfe(e){const t=cm("/api/ai/specs/detail");return t.searchParams.set("path",e),Rr(t)}async function Vfe(e){const t=cm("/api/ai/rules/detail");return t.searchParams.set("path",e),Rr(t)}async function oB(e="active"){return Rr(e==="archived"?"/api/sessions/archived":"/api/sessions")}async function LI(e,t,n,r,o){return Rr("/api/sessions",{method:"POST",headers:Pu,body:JSON.stringify({title:e,initialMessage:t,initialContent:n,model:r,start:o==null?void 0:o.start,parentSessionId:o==null?void 0:o.parentSessionId,id:o==null?void 0:o.id,promptType:o==null?void 0:o.promptType,promptName:o==null?void 0:o.promptName,effort:o==null?void 0:o.effort,permissionMode:o==null?void 0:o.permissionMode,adapter:o==null?void 0:o.adapter})})}async function Wfe(e,t){const n=cm(`/api/sessions/${e}/messages`);return Rr(n)}async function Qh(e){return g1(`/api/sessions/${e}`,{method:"DELETE"},"[api] delete session failed:")}async function Sa(e,t){return Rr(`/api/sessions/${e}`,{method:"PATCH",headers:Pu,body:JSON.stringify(t)})}const x1=e=>e===" "?"space":e.toLowerCase(),Kfe=(e,t)=>{if(e==null||e.trim()==="")return null;const n=e.split("+").map(o=>o.trim()).filter(Boolean);if(n.length===0)return null;const r={key:"",metaKey:!1,ctrlKey:!1,altKey:!1,shiftKey:!1};for(const o of n){const i=o.toLowerCase();i==="cmd"||i==="command"||i==="meta"?r.metaKey=!0:i==="ctrl"||i==="control"?r.ctrlKey=!0:i==="alt"||i==="option"?r.altKey=!0:i==="shift"?r.shiftKey=!0:i==="mod"?t?r.metaKey=!0:r.ctrlKey=!0:r.key=x1(i)}return r.key===""?null:r},iB=(e,t)=>e==null||e.trim()===""?"":e.split("+").map(r=>r.trim()).filter(Boolean).map(r=>{const o=r.toLowerCase();return o==="mod"?t?"⌘":"Ctrl":o==="cmd"||o==="command"||o==="meta"?"⌘":o==="ctrl"||o==="control"?"Ctrl":o==="alt"||o==="option"?"Alt":o==="shift"?"Shift":o==="space"?"Space":r.length===1?r.toUpperCase():r}).join("+"),aC=(e,t,n)=>{const r=Kfe(t,n);return r==null||e.metaKey!==r.metaKey||e.ctrlKey!==r.ctrlKey||e.altKey!==r.altKey||e.shiftKey!==r.shiftKey?!1:x1(e.key)===r.key},Ufe=e=>{const t=x1(e.key);if(["meta","control","shift","alt"].includes(t))return null;const n=[];return(e.metaKey||e.ctrlKey)&&n.push("mod"),e.shiftKey&&n.push("shift"),e.altKey&&n.push("alt"),n.push(t),n.join("+")},Gfe=({shortcut:e,enabled:t=!0,isMac:n,onTrigger:r})=>{u.useEffect(()=>{if(!t)return;const o=i=>{aC(i,e,n)&&r(i)};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[t,n,r,e])};var aB={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Dd,function(){return function(n,r,o){n=n||{};var i=r.prototype,a={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function s(c,d,f,m){return i.fromToBase(c,d,f,m)}o.en.relativeTime=a,i.fromToBase=function(c,d,f,m,p){for(var h,b,x,g=f.$locale().relativeTime||a,v=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],S=v.length,C=0;C<S;C+=1){var _=v[C];_.d&&(h=m?o(c).diff(f,_.d,!0):f.diff(c,_.d,!0));var w=(n.rounding||Math.round)(Math.abs(h));if(x=h>0,w<=_.r||!_.r){w<=1&&C>0&&(_=v[C-1]);var N=g[_.l];p&&(w=p(""+w)),b=typeof N=="string"?N.replace("%d",w):N(w,d,_.l,x);break}}if(d)return b;var k=x?g.future:g.past;return typeof k=="function"?k(b):k.replace("%s",b)},i.to=function(c,d){return s(c,d,this,!0)},i.from=function(c,d){return s(c,d,this)};var l=function(c){return c.$u?o.utc():o()};i.toNow=function(c){return this.to(l(this),c)},i.fromNow=function(c){return this.from(l(this),c)}}})})(aB);var qfe=aB.exports;const Xfe=Da(qfe);var Yfe={exports:{}};(function(e,t){(function(n,r){e.exports=r(sL)})(Dd,function(n){function r(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var o=r(n),i={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(a,s){return s==="W"?a+"周":a+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(a,s){var l=100*a+s;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return o.default.locale(i,null,!0),i})})(Yfe);Js.extend(Xfe);function Qfe({session:e,isActive:t,isBatchMode:n,isSelected:r,onSelect:o,onArchive:i,onDelete:a,onStar:s,onUpdateTags:l,onToggleSelect:c}){var N;const{t:d,i18n:f}=Ot(),[m,p]=J.useState(!1),[h,b]=J.useState(""),x="automation:",g=u.useMemo(()=>{const k=Js(e.createdAt);return f.language==="zh"?k.locale("zh-cn"):k.locale("en"),{relative:k.fromNow(),full:k.format("YYYY-MM-DD HH:mm:ss")}},[e.createdAt,f.language]),v=e.title!=null&&e.title!==""?e.title:e.lastUserMessage!=null&&e.lastUserMessage!==""?e.lastUserMessage:d("common.newChat"),S=e.messageCount??0,C=u.useMemo(()=>e.lastMessage==null||e.lastMessage===""?null:e.lastMessage.length>60?`${e.lastMessage.slice(0,60)}...`:e.lastMessage,[e.lastMessage]),_=u.useMemo(()=>k=>{if(!k.startsWith(x))return null;const E=k.split(":");return E.length<3?null:{ruleId:E[1],ruleTitle:E.slice(2).join(":")}},[x]),w=k=>{if(!k)return y.jsx("div",{className:`status-dot ${t?"active":""}`});let E="",$="";const O=d(`common.status.${k}`);switch(k){case"completed":E="check_circle",$="#52c41a";break;case"terminated":E="remove_circle",$="#bfbfbf";break;case"failed":E="cancel",$="#ff4d4f";break;case"running":E="sync",$="#1890ff";break;case"waiting_input":return y.jsx(dt,{title:O,children:y.jsx("div",{className:"waiting-input-indicator"})});default:return y.jsx("div",{className:`status-dot ${t?"active":""}`})}return y.jsx(dt,{title:O,children:y.jsx("span",{className:`material-symbols-rounded status-icon ${k==="running"?"spin":""}`,style:{color:$,fontSize:"16px",lineHeight:"16px",display:"flex",alignItems:"center",justifyContent:"center"},children:E})})};return y.jsxs(ji.Item,{onClick:()=>n?c(e.id):o(e),onDoubleClick:()=>{console.log("Session Details:",e)},className:`session-item ${t?"active":""} ${r?"selected":""} ${e.isStarred?"starred":""}`,children:[y.jsxs("div",{className:"session-item-content",children:[!n&&y.jsx("div",{className:"status-indicator",children:w(e.status)}),n&&y.jsx("div",{className:"batch-checkbox-wrapper",children:y.jsx(Ji,{checked:r,onChange:()=>c(e.id),onClick:k=>k.stopPropagation()})}),y.jsxs("div",{className:`session-info ${n?"":"with-actions"}`,children:[y.jsxs("div",{className:"session-header",children:[y.jsx("div",{className:"session-title",children:y.jsx("span",{className:"session-title-text",children:v})}),!n&&y.jsxs("div",{className:"session-item-actions",children:[y.jsx(dt,{title:e.isStarred?d("common.unstar"):d("common.star"),children:y.jsx(ct,{type:"text",size:"small",className:`action-btn ${e.isStarred?"starred":""}`,onClick:k=>{k.stopPropagation(),s(e.id,!e.isStarred)},icon:y.jsx("span",{className:`material-symbols-rounded ${e.isStarred?"filled":""}`,children:"star"})})}),y.jsx(dt,{title:d("common.archive"),children:y.jsx(ct,{type:"text",size:"small",className:"action-btn archive-btn",onClick:k=>{k.stopPropagation(),i(e.id)},icon:y.jsx("span",{className:"material-symbols-rounded",children:"archive"})})})]})]}),C!=null&&y.jsx("div",{className:"last-message",children:C}),y.jsxs("div",{className:"session-meta",children:[e.status&&y.jsx("span",{className:"status-text",style:{fontSize:"11px",color:"var(--sub-text-color)",marginRight:"8px"},children:d(`common.status.${e.status}`)}),y.jsx(dt,{title:g.full,children:y.jsx("span",{className:"time-display",children:g.relative})})]}),y.jsx("div",{className:"tags-container",children:(N=e.tags)==null?void 0:N.map(k=>{const E=_(k);if(E){const $=`/automation?rule=${encodeURIComponent(E.ruleId)}`;return y.jsx(dt,{title:E.ruleTitle,children:y.jsx(Do,{className:"session-tag session-tag--automation",onClick:O=>O.stopPropagation(),children:y.jsx("a",{className:"session-tag__link",href:$,onClick:O=>O.stopPropagation(),children:E.ruleTitle})})},k)}return y.jsx(dt,{title:k,children:y.jsx(Do,{className:"session-tag",children:y.jsx("span",{className:"session-tag__text",children:k})})},k)})})]})]}),S>0&&y.jsx(E_,{count:S>99?"99+":S,className:"session-item-badge"})]})}function Zfe({sessions:e,activeId:t,isBatchMode:n,selectedIds:r,searchQuery:o,onSelectSession:i,onArchiveSession:a,onDeleteSession:s,onStarSession:l,onUpdateTags:c,onToggleSelect:d}){const{t:f}=Ot(),[m,p]=u.useState(new Set),{flattenedSessions:h,childSummaryMap:b}=u.useMemo(()=>{const g=new Map(e.map(k=>[k.id,k])),v=new Map;for(const k of e)if(k.parentSessionId){const E=v.get(k.parentSessionId)??[];E.push(k),v.set(k.parentSessionId,E)}const S=e.filter(k=>k.parentSessionId?!g.has(k.parentSessionId):!0),C=new Map;for(const[k,E]of v.entries()){const $=E.length,O=new Map;for(const T of E){const I=T.status??"running";O.set(I,(O.get(I)??0)+1)}const R=[f("common.childSummary",{count:$})];for(const[T,I]of O.entries())R.push(f("common.childStatusItem",{count:I,status:f(`common.status.${T}`)}));C.set(k,R.join(" · "))}const _=[],w=new Set,N=(k,E)=>{if(w.has(k.id))return;w.add(k.id);const $=v.get(k.id)??[];if(_.push({session:k,depth:E,hasChildren:$.length>0}),!m.has(k.id))for(const O of $)N(O,E+1)};for(const k of S)N(k,0);return{flattenedSessions:_,childSummaryMap:C}},[e,m,f]),x=g=>{p(v=>{const S=new Set(v);return S.has(g)?S.delete(g):S.add(g),S})};return y.jsx("div",{className:"session-list-container",children:y.jsx("div",{className:"session-list-scroll",children:y.jsx(ji,{className:"session-list",size:"small",locale:{emptyText:y.jsx("div",{className:"empty-text",children:f(o?"common.noSessions":"common.startNewChat")})},dataSource:h,renderItem:({session:g,depth:v,hasChildren:S})=>y.jsxs("div",{className:`session-row ${v>0?"has-parent":""}`,style:{"--session-depth":v},children:[y.jsx(Qfe,{session:g,isActive:t===g.id,isBatchMode:n,isSelected:r.has(g.id),onSelect:i,onArchive:a,onDelete:s,onStar:l,onUpdateTags:c,onToggleSelect:d}),S&&!n&&y.jsxs("div",{className:"session-collapse-row",style:{"--session-depth":v},onClick:C=>C.stopPropagation(),children:[y.jsx(ct,{type:"text",size:"small",className:`session-tree-toggle ${m.has(g.id)?"collapsed":""}`,onClick:()=>x(g.id),icon:y.jsx("span",{className:"material-symbols-rounded",children:"chevron_right"})}),y.jsx("span",{className:"session-collapse-label",children:m.has(g.id)?f("common.expandChildren"):f("common.collapseChildren")}),y.jsx("span",{className:"session-collapse-summary",children:b.get(g.id)??f("common.childSummary",{count:0})})]})]})})})})}function Jfe({searchQuery:e,onSearchChange:t,isBatchMode:n,onToggleBatchMode:r,selectedCount:o,totalCount:i,onSelectAll:a,onBatchArchive:s,isCreatingSession:l,onCreateSession:c}){const{t:d}=Ot(),[f,m]=um(v1),p=i>0&&o===i;return y.jsx("div",{className:"sidebar-header",children:y.jsxs("div",{className:"header-bottom",children:[n&&y.jsx("div",{className:"batch-select-wrapper",children:y.jsx(dt,{title:d(p?"common.deselectAll":"common.selectAll"),children:y.jsx(Ji,{checked:p,indeterminate:o>0&&o<i,onChange:h=>a(h.target.checked)})})}),y.jsx(Ft,{className:"search-input",placeholder:d("common.search"),value:e,onChange:h=>t(h.target.value),prefix:y.jsx("span",{className:"material-symbols-rounded search-icon",children:"search"}),allowClear:!0}),y.jsxs("div",{className:"batch-actions",children:[y.jsx(dt,{title:d(n?"common.cancelBatch":"common.batchMode"),children:y.jsx(ct,{className:`action-btn ${n?"active":""}`,type:n?"primary":"text",onClick:r,children:y.jsx("span",{className:"material-symbols-rounded",children:n?"close":"checklist"})})}),n&&y.jsx(Hh,{title:d("common.archiveConfirm",{count:o}),onConfirm:s,okText:d("common.confirm"),cancelText:d("common.cancel"),okButtonProps:{danger:!1},disabled:o===0,children:y.jsx(dt,{title:d("common.batchArchive"),children:y.jsx(ct,{className:"action-btn",type:"text",disabled:o===0,children:y.jsx("span",{className:"material-symbols-rounded",children:"archive"})})})})]}),y.jsx(dt,{title:d(f?"common.expand":"common.collapse"),children:y.jsx(ct,{className:"sidebar-collapse-btn",type:"text",onClick:()=>m(!f),children:y.jsx("span",{className:"material-symbols-rounded",children:f?"dock_to_right":"left_panel_close"})})}),f&&y.jsx(dt,{title:d(l?"common.alreadyInNewChat":"common.newChat"),placement:"right",children:y.jsx(ct,{className:`sidebar-new-chat-btn ${l?"active":""}`,type:"text",disabled:!!l,onClick:c,children:y.jsx("span",{className:`material-symbols-rounded ${l?"filled":""}`,children:l?"chat_bubble":"send"})})})]})})}function eme({activeId:e,onSelectSession:t,onDeletedSession:n,width:r}){var z,M,H;const{t:o}=Ot(),[i]=um(v1),a=vl(nB),[s,l]=u.useState(""),[c,d]=u.useState(!1),[f,m]=u.useState(new Set),p=navigator.platform.includes("Mac"),{values:h}=ju({keys:["tag"],defaults:{tag:""},omit:{tag:F=>F===""}}),b=h.tag.trim(),{data:x,mutate:g}=Qn("/api/sessions"),v=(x==null?void 0:x.sessions)??[],{data:S}=Qn("/api/config"),C=(H=(M=(z=S==null?void 0:S.sources)==null?void 0:z.merged)==null?void 0:M.shortcuts)==null?void 0:H.newSession,_=C!=null&&C.trim()!==""?C:"mod+k",w=u.useMemo(()=>iB(_,p),[_,p]),N=u.useMemo(()=>{const F=s.trim().toLowerCase();return v.filter(A=>b&&!(A.tags??[]).some(K=>K.toLowerCase()===b.toLowerCase())?!1:F?(A.title??"").toLowerCase().includes(F)||(A.lastMessage??"").toLowerCase().includes(F)||(A.lastUserMessage??"").toLowerCase().includes(F)||A.id.toLowerCase().includes(F)||(A.tags??[]).some(B=>B.toLowerCase().includes(F)):!0)},[v,s,b]);async function k(){t({id:""},!0)}async function E(F){let A;const B=v.findIndex(K=>K.id===F);B!==-1&&(B+1<v.length?A=v[B+1].id:B-1>=0&&(A=v[B-1].id));try{await Sa(F,{isArchived:!0}),await g(),n==null||n(F,A)}catch(K){console.error("Failed to archive session:",K)}}async function $(F){let A;const B=v.findIndex(K=>K.id===F);B!==-1&&(B+1<v.length?A=v[B+1].id:B-1>=0&&(A=v[B-1].id));try{await Qh(F),await g(),e===F&&(n==null||n(F,A))}catch(K){console.error("Failed to delete session:",K)}}async function O(F,A){try{await Sa(F,{isStarred:A}),await g()}catch(B){console.error("Failed to star session:",B)}}async function R(F,A){try{await Sa(F,{tags:A}),await g()}catch(B){console.error("Failed to update tags:",B)}}const T=F=>{m(A=>{const B=new Set(A);return B.has(F)?B.delete(F):B.add(F),B})},I=F=>{m(F?new Set(N.map(A=>A.id)):new Set)},P=async()=>{try{if(await Promise.all(Array.from(f).map(async F=>Sa(F,{isArchived:!0}))),await g(),e&&f.has(e)){let F;const A=v.find(B=>!f.has(B.id));A&&(F=A.id),n==null||n(e,F)}m(new Set),d(!1)}catch(F){console.error("Failed to batch archive sessions:",F)}},j=()=>{d(F=>!F),m(new Set)},L=e===void 0||e==="",D=u.useRef(null);return Gfe({shortcut:_,isMac:p,onTrigger:F=>{F.preventDefault(),!L&&(D.current&&(D.current.classList.add("active-scale"),setTimeout(()=>{var A;(A=D.current)==null||A.classList.remove("active-scale")},200)),k())}}),y.jsx("div",{className:`sidebar-container ${i?"collapsed":""}`,style:{width:i?0:r,minWidth:i?0:void 0,transition:a?"none":"width 0.3s cubic-bezier(0.4, 0, 0.2, 1)",borderRight:i?"none":void 0},children:y.jsxs("div",{className:"sidebar-content",style:{width:r,transition:a?"none":"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)",transform:i?`translateX(-${r}px)`:"translateX(0)"},children:[y.jsx(Jfe,{searchQuery:s,onSearchChange:l,isBatchMode:c,onToggleBatchMode:j,selectedCount:f.size,totalCount:N.length,onSelectAll:I,onBatchArchive:()=>{P()},isCreatingSession:L,onCreateSession:()=>{k()}}),y.jsx("div",{className:"sidebar-new-chat",children:y.jsx(dt,{title:L?o("common.alreadyInNewChat"):void 0,placement:"right",children:y.jsxs(ct,{ref:D,className:`new-chat-btn ${L?"active":""}`,type:L?"default":"primary",block:!0,disabled:!!L,onClick:()=>{k()},children:[y.jsxs("span",{className:"btn-content",children:[y.jsx("span",{className:`material-symbols-rounded ${L?"filled":""}`,children:L?"chat_bubble":"send"}),y.jsx("span",{children:o(L?"common.creatingChat":"common.newChat")})]}),y.jsx("span",{className:"shortcut-tag",children:w})]})})}),y.jsx(Zfe,{sessions:N,activeId:e,isBatchMode:c,selectedIds:f,searchQuery:s,onSelectSession:t,onArchiveSession:E,onDeleteSession:$,onStarSession:O,onUpdateTags:R,onToggleSelect:T})]})})}function tme({activeSessionId:e,children:t,isDarkMode:n,onDeletedSession:r,onSelectSession:o,showSidebar:i,sidebarWidth:a}){return y.jsxs(hl,{className:`app-shell ${n?"app-shell--dark":""}`,children:[y.jsx(Rfe,{}),i&&y.jsx(eme,{width:a,activeId:e,onSelectSession:o,onDeletedSession:r}),y.jsx(hl.Content,{className:"app-shell__content",children:t})]})}function nme(){var a,s,l;const{i18n:e}=Ot(),t=vl(y1),{data:n}=Qn("/api/config",b1),r=(l=(s=(a=n==null?void 0:n.sources)==null?void 0:a.merged)==null?void 0:s.general)==null?void 0:l.interfaceLanguage,o=t==="dark"||t==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches;u.useEffect(()=>{document.documentElement.classList.toggle("dark",o)},[o]),u.useEffect(()=>{r&&e.language!==r&&e.changeLanguage(r)},[e,r]);const i=u.useMemo(()=>({algorithm:o?pI.darkAlgorithm:pI.defaultAlgorithm,token:{colorPrimary:o?"#3b82f6":"#000000"}}),[o]);return{isDarkMode:o,themeConfig:i}}const rme=Vz()||window.location.hostname,ome=Wz()||"8787",ime=`ws://${rme}:${ome}${Yde()}`;function sB(e,t){let n=ime;if(t){const o=new URLSearchParams(t);n+=(n.includes("?")?"&":"?")+o.toString()}const r=new WebSocket(n);return r.addEventListener("open",()=>{var o;return(o=e.onOpen)==null?void 0:o.call(e)}),r.addEventListener("message",o=>{var i;try{const a=JSON.parse(String(o.data));(i=e.onMessage)==null||i.call(e,a)}catch(a){console.error(a)}}),r.addEventListener("error",o=>{var i;return(i=e.onError)==null?void 0:i.call(e,o)}),r.addEventListener("close",()=>{var o;return(o=e.onClose)==null?void 0:o.call(e)}),r}const ame=e=>"isDeleted"in e&&e.isDeleted,sme=e=>[...e].sort((t,n)=>{const r=+(n.isStarred===!0)-+(t.isStarred===!0);return r!==0?r:(n.createdAt??0)-(t.createdAt??0)}),DI=(e,t,n)=>{if((e==null?void 0:e.sessions)==null)return e;if(ame(t))return{...e,sessions:e.sessions.filter(s=>s.id!==t.id)};const r=t,o=n==="archived"?r.isArchived===!0:r.isArchived!==!0,i=e.sessions.find(s=>s.id===t.id);if(!o)return{...e,sessions:e.sessions.filter(s=>s.id!==t.id)};const a=i?e.sessions.map(s=>s.id===t.id?{...s,...r}:s):[r,...e.sessions];return{...e,sessions:sme(a)}};function lme(){const{mutate:e}=Yv();u.useEffect(()=>{let t=!1,n,r;const o=s=>{if(s&&!(s.readyState===WebSocket.CLOSED||s.readyState===WebSocket.CLOSING)){if(s.readyState===WebSocket.CONNECTING){s.addEventListener("open",()=>s.close(),{once:!0});return}s.close()}},i=(s=0)=>{t||(r&&clearTimeout(r),r=setTimeout(()=>{r=void 0,a()},s))},a=()=>{t||(n=sB({onMessage:s=>{if(t||s.type!=="session_updated")return;const l=s.session;e("/api/sessions",c=>DI(c,l,"active"),!1),e("/api/sessions/archived",c=>DI(c,l,"archived"),!1)},onClose:()=>{t||i(1e3)},onError:()=>{o(n)}},{subscribe:"sessions"}))};return i(),()=>{t=!0,r&&clearTimeout(r),o(n)}},[e])}const cme="/session/:sessionId";function ume(){const e=Ts(),t=ua(),n=vl(Ife),r=wf({path:cme,end:!0},t.pathname),o=r==null?void 0:r.params.sessionId,i=t.pathname==="/"||o!=null,a=u.useCallback((l,c)=>{e(l.id===""?"/":`/session/${l.id}`)},[e]),s=u.useCallback((l,c)=>{o===l&&e(c?`/session/${c}`:"/")},[o,e]);return{activeSessionId:o,handleDeletedSession:s,handleSelectSession:a,showSidebar:i,sidebarWidth:n}}function dme(){const{t:e}=Ot(),{message:t}=Eo.useApp(),{data:n,mutate:r}=Qn("/api/sessions/archived",async()=>oB("archived")),o=(n==null?void 0:n.sessions)??[],[i,a]=u.useState(""),[s,l]=u.useState(new Set),[c,d]=u.useState(!1),f=u.useMemo(()=>{if(i.trim()==="")return o;const S=i.toLowerCase();return o.filter(C=>{const _=C.title??"",w=C.lastMessage??"",N=C.lastUserMessage??"",k=(C.tags??[]).join(" ");return`${_} ${C.id} ${w} ${N} ${k}`.toLowerCase().includes(S)})},[o,i]),m=async S=>{try{await Sa(S,{isArchived:!1}),t.success(e("common.restoreSuccess","Restored successfully")),r()}catch(C){t.error(Mr(C,e("common.restoreFailed","Failed to restore")))}},p=async S=>{try{await Qh(S),t.success(e("common.deleteSuccess","Deleted successfully")),r()}catch(C){t.error(Mr(C,e("common.deleteFailed","Failed to delete")))}},h=S=>{const C=new Set(s);C.has(S)?C.delete(S):C.add(S),l(C)},b=S=>{l(S?new Set(f.map(C=>C.id)):new Set)},x=async()=>{try{await Promise.all(Array.from(s).map(async S=>Sa(S,{isArchived:!1}))),t.success(e("common.batchRestoreSuccess","Batch restored successfully")),l(new Set),d(!1),r()}catch(S){t.error(Mr(S,e("common.batchRestoreFailed","Failed to restore some sessions")))}},g=async()=>{try{await Promise.all(Array.from(s).map(async S=>Qh(S))),t.success(e("common.batchDeleteSuccess","Batch deleted successfully")),l(new Set),d(!1),r()}catch(S){t.error(Mr(S,e("common.batchDeleteFailed","Failed to delete some sessions")))}},v=f.length>0&&s.size===f.length;return y.jsxs("div",{className:"archive-view",children:[y.jsxs("div",{className:"archive-view__header",children:[y.jsx(ea,{size:8,className:"archive-view__title",children:y.jsx("h2",{className:"archive-view__title-text",children:e("common.archivedSessions")})}),y.jsx(ea,{children:c?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"archive-view__batch-info",children:e("common.selectedCount",{count:s.size})}),y.jsx(dt,{title:e("common.cancel"),children:y.jsx(ct,{icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"close"}),onClick:()=>{d(!1),l(new Set)},className:"archive-view__icon-button"})}),y.jsx(dt,{title:e("common.batchRestore"),children:y.jsx(ct,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"unarchive"}),onClick:()=>{x()},disabled:s.size===0,className:"archive-view__icon-button"})}),y.jsx(Hh,{title:e("common.deleteConfirm",{count:s.size}),onConfirm:()=>{g()},disabled:s.size===0,children:y.jsx(dt,{title:e("common.batchDelete"),children:y.jsx(ct,{danger:!0,icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"delete_sweep"}),disabled:s.size===0,className:"archive-view__icon-button"})})})]}):y.jsx(dt,{title:e("common.batchMode"),children:y.jsx(ct,{icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"checklist"}),onClick:()=>d(!0),disabled:o.length===0,className:"archive-view__icon-button"})})})]}),y.jsxs("div",{className:"archive-view__filter-bar",children:[c&&y.jsx("div",{className:"archive-view__select-all",children:y.jsx(dt,{title:e(v?"common.deselectAll":"common.selectAll"),children:y.jsx(Ji,{checked:v,indeterminate:s.size>0&&s.size<f.length,onChange:S=>b(S.target.checked)})})}),y.jsx(Ft,{prefix:y.jsx("span",{className:"material-symbols-rounded archive-view__search-icon",children:"search"}),placeholder:e("common.search"),value:i,onChange:S=>a(S.target.value),allowClear:!0,className:"archive-view__search-input"})]}),y.jsx("div",{className:"archive-view__list",children:f.length===0?y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:e(i?"common.noSessions":"common.noArchivedSessions")}):y.jsx(ji,{itemLayout:"horizontal",dataSource:f,renderItem:S=>y.jsx(ji.Item,{className:["archive-view__item",s.has(S.id)?"archive-view__item--selected":"",c?"archive-view__item--batch":""].filter(Boolean).join(" "),onClick:()=>c&&h(S.id),children:y.jsxs("div",{className:"archive-view__item-row",children:[c&&y.jsx("div",{className:"archive-view__item-select",children:y.jsx(Ji,{checked:s.has(S.id),onChange:()=>h(S.id),onClick:C=>C.stopPropagation()})}),y.jsx("span",{className:"material-symbols-rounded archive-view__item-icon",children:"chat_bubble"}),y.jsxs("div",{className:"archive-view__item-main",children:[y.jsx("span",{className:"archive-view__item-title",children:S.title!=null&&S.title!==""?S.title:S.lastMessage!=null&&S.lastMessage!==""?S.lastMessage:e("common.newChat")}),S.tags&&S.tags.length>0&&y.jsx("div",{className:"archive-view__item-tags",children:S.tags.map(C=>y.jsx(Do,{className:"archive-view__item-tag",children:C},C))}),y.jsx("span",{className:"archive-view__item-time",children:Js(S.createdAt).format("YYYY-MM-DD HH:mm")})]}),!c&&y.jsxs("div",{className:"archive-view__item-actions",children:[y.jsx(dt,{title:e("common.restore"),children:y.jsx(ct,{type:"text",size:"small",className:"archive-view__item-action-button",icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"unarchive"}),onClick:C=>{C.stopPropagation(),m(S.id)}})}),y.jsx(Hh,{title:e("common.deleteSessionConfirm"),onConfirm:C=>{C==null||C.stopPropagation(),p(S.id)},children:y.jsx(ct,{type:"text",size:"small",danger:!0,className:"archive-view__item-action-button",icon:y.jsx("span",{className:"material-symbols-rounded archive-view__action-icon",children:"delete"}),onClick:C=>C.stopPropagation()})})]})]})})})})]})}function fme(){return y.jsx(dme,{})}function mme(){const{t:e}=Ot();return y.jsx(_n.List,{name:"tasks",children:(t,{add:n,remove:r})=>y.jsxs("div",{className:"automation-view__list automation-view__list--horizontal",children:[y.jsxs("div",{className:"automation-view__section-header",children:[y.jsxs("div",{className:"automation-view__section-heading",children:[y.jsxs("div",{className:"automation-view__form-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__form-icon",children:"task"}),e("automation.sectionTasks")]}),y.jsx("span",{className:"automation-view__section-count",children:e("automation.taskCount",{count:t.length})})]}),y.jsx("div",{className:"automation-view__section-actions",children:y.jsx(dt,{title:e("automation.addTask"),children:y.jsx(ct,{className:"automation-view__icon-button",type:"text",onClick:()=>n({title:e("automation.taskDefaultTitle",{index:t.length+1}),prompt:""}),children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"add"})})})})]}),y.jsx("div",{className:"automation-view__form-desc",children:e("automation.taskAll")}),y.jsx("div",{className:"automation-view__list-scroll",children:t.map((o,i)=>y.jsxs("div",{className:"automation-view__list-item",children:[y.jsx(_n.Item,{name:[o.name,"id"],hidden:!0,children:y.jsx(Ft,{})}),y.jsx(dt,{title:e("automation.remove"),children:y.jsx(ct,{className:"automation-view__remove-button",type:"text",danger:!0,onClick:()=>r(o.name),disabled:t.length<=1,children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"close"})})}),y.jsx("div",{className:"automation-view__list-header",children:y.jsx(_n.Item,{name:[o.name,"title"],label:e("automation.taskTitle"),children:y.jsx(Ft,{placeholder:e("automation.taskTitlePlaceholder")})})}),y.jsx(_n.Item,{name:[o.name,"prompt"],label:e("automation.prompt"),rules:[{required:!0,message:e("automation.promptRequired")}],children:y.jsx(Ft.TextArea,{rows:3})}),y.jsxs("div",{className:"automation-view__task-index",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__task-index-icon",children:"format_list_numbered"}),e("automation.taskIndex",{index:i+1})]})]},o.key))})]})})}function pme({form:e,updateWeeklyCron:t,getWebhookUrl:n}){const{t:r}=Ot();return y.jsx(_n.List,{name:"triggers",children:(o,{add:i,remove:a})=>y.jsxs("div",{className:"automation-view__list automation-view__list--horizontal",children:[y.jsxs("div",{className:"automation-view__section-header",children:[y.jsxs("div",{className:"automation-view__section-heading",children:[y.jsxs("div",{className:"automation-view__form-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__form-icon",children:"bolt"}),r("automation.sectionTriggers")]}),y.jsx("span",{className:"automation-view__section-count",children:r("automation.triggerCount",{count:o.length})})]}),y.jsx("div",{className:"automation-view__section-actions",children:y.jsx(dt,{title:r("automation.addTrigger"),children:y.jsx(ct,{className:"automation-view__icon-button",type:"text",onClick:()=>i({type:"interval",intervalMinutes:30,cronExpression:"",weeklyDay:"1",weeklyTime:"09:00"}),children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"add"})})})})]}),y.jsx("div",{className:"automation-view__form-desc",children:r("automation.triggerAny")}),y.jsx("div",{className:"automation-view__list-scroll",children:o.map((s,l)=>y.jsx(_n.Item,{noStyle:!0,shouldUpdate:(c,d)=>{var p,h;const f=(p=c.triggers)==null?void 0:p[s.name],m=(h=d.triggers)==null?void 0:h[s.name];return(f==null?void 0:f.type)!==(m==null?void 0:m.type)||(f==null?void 0:f.webhookKey)!==(m==null?void 0:m.webhookKey)||(f==null?void 0:f.id)!==(m==null?void 0:m.id)},children:c=>{const d=c.getFieldValue(["triggers",s.name,"type"]),f=c.getFieldValue(["triggers",s.name,"id"]),m=c.getFieldValue(["triggers",s.name,"webhookKey"]),p=n(f,m);return y.jsxs("div",{className:"automation-view__list-item",children:[y.jsx(_n.Item,{name:[s.name,"id"],hidden:!0,children:y.jsx(Ft,{})}),y.jsx(dt,{title:r("automation.remove"),children:y.jsx(ct,{className:"automation-view__remove-button",type:"text",danger:!0,onClick:()=>a(s.name),disabled:o.length<=1,children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"close"})})}),y.jsx("div",{className:"automation-view__list-header",children:y.jsx(_n.Item,{name:[s.name,"type"],label:r("automation.ruleType"),rules:[{required:!0,message:r("automation.ruleTypeRequired")}],children:y.jsx(Yn,{options:[{label:r("automation.typeInterval"),value:"interval"},{label:r("automation.typeWebhook"),value:"webhook"},{label:r("automation.typeCron"),value:"cron"}],onChange:h=>{h==="interval"&&(e.setFieldValue(["triggers",s.name,"intervalMinutes"],30),e.setFieldValue(["triggers",s.name,"cronExpression"],""),e.setFieldValue(["triggers",s.name,"weeklyDay"],"1"),e.setFieldValue(["triggers",s.name,"weeklyTime"],"09:00"),e.setFieldValue(["triggers",s.name,"webhookKey"],"")),h==="cron"&&(e.setFieldValue(["triggers",s.name,"cronExpression"],""),e.setFieldValue(["triggers",s.name,"weeklyDay"],"1"),e.setFieldValue(["triggers",s.name,"weeklyTime"],"09:00"),e.setFieldValue(["triggers",s.name,"intervalMinutes"],30),e.setFieldValue(["triggers",s.name,"webhookKey"],"")),h==="webhook"&&(e.setFieldValue(["triggers",s.name,"webhookKey"],""),e.setFieldValue(["triggers",s.name,"intervalMinutes"],30),e.setFieldValue(["triggers",s.name,"cronExpression"],""),e.setFieldValue(["triggers",s.name,"weeklyDay"],"1"),e.setFieldValue(["triggers",s.name,"weeklyTime"],"09:00"))}})})}),d==="interval"&&y.jsx(_n.Item,{name:[s.name,"intervalMinutes"],label:r("automation.intervalMinutes"),rules:[{required:!0,message:r("automation.intervalRequired")}],children:y.jsx(Zc,{min:1,className:"automation-view__input-number"})}),d==="cron"&&y.jsxs("div",{className:"automation-view__cron-section",children:[y.jsx(_n.Item,{name:[s.name,"cronExpression"],label:r("automation.cronExpressionLabel"),rules:[{required:!0,message:r("automation.cronExpressionRequired")}],children:y.jsx(Ft,{placeholder:r("automation.cronExpressionHint")})}),y.jsx(_n.Item,{name:[s.name,"cronPreset"],label:r("automation.cronPreset"),children:y.jsx(Yn,{options:[{label:r("automation.cronPresetHourly"),value:"0 * * * *"},{label:r("automation.cronPresetDaily9"),value:"0 9 * * *"},{label:r("automation.cronPresetWeekday9"),value:"0 9 * * 1-5"},{label:r("automation.cronPresetWeekend10"),value:"0 10 * * 6,0"}],onChange:h=>e.setFieldValue(["triggers",s.name,"cronExpression"],h),placeholder:r("automation.cronPresetHint"),allowClear:!0})}),y.jsx("div",{className:"automation-view__cron-hint",children:r("automation.cronInputHint")}),y.jsxs("div",{className:"automation-view__cron-weekly",children:[y.jsx(_n.Item,{name:[s.name,"weeklyDay"],label:r("automation.weeklyDay"),children:y.jsx(Yn,{options:[{label:r("automation.weekdaySun"),value:"0"},{label:r("automation.weekdayMon"),value:"1"},{label:r("automation.weekdayTue"),value:"2"},{label:r("automation.weekdayWed"),value:"3"},{label:r("automation.weekdayThu"),value:"4"},{label:r("automation.weekdayFri"),value:"5"},{label:r("automation.weekdaySat"),value:"6"}],onChange:h=>t(l,h)})}),y.jsx(_n.Item,{name:[s.name,"weeklyTime"],label:r("automation.weeklyTime"),children:y.jsx(Ft,{placeholder:r("automation.weeklyTimeHint"),onChange:h=>t(l,void 0,h.target.value)})})]})]}),d==="webhook"&&y.jsxs("div",{className:"automation-view__webhook",children:[y.jsx(_n.Item,{name:[s.name,"webhookKey"],label:r("automation.webhookKey"),children:y.jsx(Ft,{placeholder:r("automation.webhookKeyHint")})}),p&&y.jsxs("div",{className:"automation-view__webhook-row",children:[y.jsx("span",{className:"automation-view__webhook-label",children:r("automation.webhookUrl")}),y.jsx(dt,{title:r("automation.copy"),children:y.jsx(ct,{className:"automation-view__icon-button",type:"text",onClick:()=>{navigator.clipboard.writeText(p)},children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"content_copy"})})})]})]})]})}},s.key))})]})})}const hme=Kz(),gme=Uz(),vme=`http://${hme}:${gme}`;function zI({mode:e,rule:t,submitting:n,onSubmit:r,onCancel:o}){const{t:i}=Ot(),[a]=_n.useForm(),s=u.useCallback((d,f,m)=>{const p=a.getFieldValue("triggers"),h=p==null?void 0:p[d];if(!h)return;const b=f??h.weeklyDay,x=m??h.weeklyTime;if(!b||!x)return;const[g,v]=x.split(":");if(!g||!v)return;const S=Number.parseInt(g,10),C=Number.parseInt(v,10);if(Number.isNaN(S)||Number.isNaN(C))return;const _=`${C} ${S} * * ${b}`,w=h.cronExpression;(!w||/^\d{1,2}\s+\d{1,2}\s+\*\s+\*\s+\d$/.test(w))&&a.setFieldValue(["triggers",d,"cronExpression"],_)},[a]),l=u.useCallback((d,f)=>!d||!f?"":`${vme}/api/automation/webhook/${d}?key=${f}`,[]);u.useEffect(()=>{if(e==="create"){a.setFieldsValue({name:"",description:"",enabled:!0,immediateRun:!1,triggers:[{type:"interval",intervalMinutes:30,cronExpression:"",cronPreset:void 0,weeklyDay:"1",weeklyTime:"09:00"}],tasks:[{title:i("automation.taskDefaultTitle",{index:1}),prompt:""}]});return}if(e==="edit"&&t){const d=(t.triggers??[]).map(m=>{const p=m.cronExpression??"",h=p.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+(\d)$/);return{id:m.id,type:m.type,intervalMinutes:m.intervalMs?Math.max(1,Math.round(m.intervalMs/6e4)):void 0,webhookKey:m.webhookKey??void 0,cronExpression:p,cronPreset:void 0,weeklyDay:h?h[3]:"1",weeklyTime:h?`${h[2].padStart(2,"0")}:${h[1].padStart(2,"0")}`:"09:00"}}),f=(t.tasks??[]).map((m,p)=>({id:m.id,title:m.title||i("automation.taskDefaultTitle",{index:p+1}),prompt:m.prompt}));a.setFieldsValue({name:t.name,description:t.description??"",enabled:t.enabled,immediateRun:!1,triggers:d.length>0?d:[{type:"interval",intervalMinutes:30,cronExpression:"",cronPreset:void 0,weeklyDay:"1",weeklyTime:"09:00"}],tasks:f.length>0?f:[{title:i("automation.taskDefaultTitle",{index:1}),prompt:""}]})}},[a,e,t,i]);const c=u.useCallback(async()=>{var m;const d=await a.validateFields(),f={name:d.name.trim(),description:((m=d.description)==null?void 0:m.trim())??"",enabled:d.enabled,triggers:d.triggers.map(p=>{var h,b;return p.type==="interval"?{id:p.id,type:"interval",intervalMs:Math.max(1,p.intervalMinutes??1)*6e4}:p.type==="cron"?{id:p.id,type:"cron",cronExpression:((h=p.cronExpression)==null?void 0:h.trim())??""}:{id:p.id,type:"webhook",webhookKey:((b=p.webhookKey)==null?void 0:b.trim())??""}}),tasks:d.tasks.map(p=>{var h;return{id:p.id,title:((h=p.title)==null?void 0:h.trim())??"",prompt:p.prompt.trim()}})};await r(f,d.immediateRun)},[a,r]);return y.jsxs("div",{className:"automation-view__form-panel",children:[y.jsxs("div",{className:"automation-view__form-header",children:[y.jsxs("div",{className:"automation-view__form-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__form-icon",children:"edit_square"}),i(e==="create"?"automation.newRule":"automation.editRule")]}),y.jsxs("div",{className:"automation-view__form-header-actions",children:[y.jsx(dt,{title:i("common.cancel"),children:y.jsx(ct,{className:"automation-view__square-button",onClick:o,children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"close"})})}),y.jsx(dt,{title:i("common.confirm"),children:y.jsx(ct,{className:"automation-view__square-button automation-view__square-button--confirm",type:"primary",loading:n,onClick:()=>void c(),children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"check"})})})]})]}),y.jsx(_n,{form:a,layout:"vertical",initialValues:{enabled:!0,immediateRun:!1},children:y.jsxs("div",{className:"automation-view__form-grid",children:[y.jsx("div",{className:"automation-view__form-left",children:y.jsxs("div",{className:"automation-view__form-section",children:[y.jsxs("div",{className:"automation-view__form-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__form-icon",children:"info"}),i("automation.sectionBasic")]}),y.jsx(_n.Item,{name:"name",label:y.jsxs("span",{className:"automation-view__label",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__label-icon",children:"badge"}),i("automation.ruleName")]}),rules:[{required:!0,message:i("automation.ruleNameRequired")}],children:y.jsx(Ft,{})}),y.jsx(_n.Item,{name:"description",label:y.jsxs("span",{className:"automation-view__label",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__label-icon",children:"description"}),i("automation.ruleDescription")]}),children:y.jsx(Ft.TextArea,{rows:2})}),y.jsxs("div",{className:"automation-view__toggle-group",children:[y.jsxs("div",{className:"automation-view__toggle-row",children:[y.jsxs("span",{className:"automation-view__toggle-label",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__label-icon",children:"toggle_on"}),i("automation.enabled")]}),y.jsx(_n.Item,{name:"enabled",valuePropName:"checked",noStyle:!0,children:y.jsx(ta,{})})]}),y.jsxs("div",{className:"automation-view__toggle-row",children:[y.jsxs("span",{className:"automation-view__toggle-label automation-view__toggle-label--run",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__label-icon automation-view__label-icon--run",children:"play_circle"}),i("automation.immediateRun")]}),y.jsx(_n.Item,{name:"immediateRun",valuePropName:"checked",noStyle:!0,children:y.jsx(ta,{})})]})]})]})}),y.jsx("div",{className:"automation-view__form-right",children:y.jsxs("div",{className:"automation-view__form-right-scroll",children:[y.jsx("div",{className:"automation-view__form-section",children:y.jsx(pme,{form:a,updateWeeklyCron:s,getWebhookUrl:l})}),y.jsx("div",{className:"automation-view__form-section",children:y.jsx(mme,{})})]})})]})})]})}function yme({rules:e,selectedRuleId:t,query:n,isCreating:r,onCreate:o,onSelect:i,onRun:a,onDelete:s,onToggle:l,onQueryChange:c}){const{t:d}=Ot(),[f,m]=u.useState(()=>{try{const g=window.localStorage.getItem("automationRuleFavorites");if(!g)return[];const v=JSON.parse(g);return Array.isArray(v)?v:[]}catch{return[]}});u.useEffect(()=>{window.localStorage.setItem("automationRuleFavorites",JSON.stringify(f))},[f]);const p=u.useMemo(()=>new Set(f),[f]),h=u.useMemo(()=>{const g=n.trim().toLowerCase();return[...g?e.filter(S=>{const C=S.name.toLowerCase().includes(g),_=(S.description??"").toLowerCase().includes(g);return C||_}):e].sort((S,C)=>{const _=p.has(S.id)?1:0,w=p.has(C.id)?1:0;return _!==w?w-_:C.createdAt-S.createdAt})},[p,n,e]),b=u.useCallback(g=>{m(v=>v.includes(g)?v.filter(S=>S!==g):[...v,g])},[]),x=u.useCallback(g=>{if(g.type==="interval"){const v=g.intervalMs?Math.max(1,Math.round(g.intervalMs/6e4)):0;return y.jsxs("span",{className:"automation-view__trigger-chip",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__trigger-icon",children:"timer"}),d("automation.intervalEvery",{minutes:v})]})}return g.type==="cron"?y.jsxs("span",{className:"automation-view__trigger-chip",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__trigger-icon",children:"schedule"}),d("automation.cronExpression",{expression:g.cronExpression??"-"})]}):y.jsxs("span",{className:"automation-view__trigger-chip",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__trigger-icon",children:"webhook"}),d("automation.webhookTrigger")]})},[d]);return y.jsxs("div",{className:"automation-view__sidebar",children:[y.jsxs("div",{className:"automation-view__sidebar-header",children:[y.jsx("div",{className:"automation-view__title",children:y.jsx("h2",{className:"automation-view__title-text",children:d("automation.title")})}),y.jsx(dt,{title:d(r?"automation.creatingRule":"automation.newRule"),children:y.jsx(ct,{className:"automation-view__icon-button automation-view__icon-button--add",type:"text",onClick:o,disabled:r,children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:r?"progress_activity":"add"})})})]}),y.jsx("div",{className:"automation-view__sidebar-search",children:y.jsx(Ft,{value:n,onChange:g=>c(g.target.value),placeholder:d("automation.searchRule"),prefix:y.jsx("span",{className:"material-symbols-rounded automation-view__search-icon",children:"search"}),allowClear:!0})}),h.length===0?y.jsx("div",{className:"automation-view__empty",children:y.jsx(bn,{description:d("automation.emptyRules")})}):y.jsx(ji,{className:"automation-view__rule-list",dataSource:h,renderItem:g=>{var E,$;const v=g.id===t,S=p.has(g.id),C=g.triggers??[],_=C.slice(0,2),w=Math.max(C.length-_.length,0),N=((E=g.tasks)==null?void 0:E.length)??0,k=(($=C[0])==null?void 0:$.type)??"interval";return y.jsx(ji.Item,{className:`automation-view__rule-item ${v?"automation-view__rule-item--active":""}`,onClick:()=>i(g.id),children:y.jsxs("div",{className:"automation-view__rule-card",children:[y.jsxs("div",{className:"automation-view__rule-content",children:[y.jsxs("div",{className:"automation-view__rule-name",children:[y.jsx("span",{className:`material-symbols-rounded automation-view__rule-icon automation-view__rule-icon--${k}`,children:k==="interval"?"timer":k==="cron"?"schedule":"webhook"}),y.jsx("span",{className:"automation-view__rule-title",children:g.name}),y.jsx(Do,{color:k==="interval"?"blue":k==="cron"?"geekblue":"purple",children:d(k==="interval"?"automation.typeInterval":k==="cron"?"automation.typeCron":"automation.typeWebhook")})]}),y.jsxs("div",{className:"automation-view__rule-meta",children:[y.jsxs("div",{className:"automation-view__rule-trigger-list",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"bolt"}),_.map(O=>y.jsx("span",{children:x(O)},O.id)),w>0&&y.jsxs("span",{className:"automation-view__trigger-more",children:["+",w]})]}),y.jsxs("span",{className:"automation-view__rule-tasks",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"checklist"}),d("automation.taskCount",{count:N})]}),y.jsxs("span",{className:"automation-view__rule-last",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"update"}),g.lastRunAt?d("automation.lastRunAt",{time:Js(g.lastRunAt).format("YYYY-MM-DD HH:mm")}):d("automation.noRunYet")]})]})]}),y.jsxs("div",{className:"automation-view__rule-actions",children:[y.jsx("div",{className:"automation-view__rule-actions-top",children:y.jsx(dt,{title:d("automation.toggleEnabled"),children:y.jsx(ta,{checked:g.enabled,onChange:O=>void l(g,O),onClick:(O,R)=>R.stopPropagation()})})}),y.jsxs("div",{className:"automation-view__rule-actions-bottom",children:[y.jsx(dt,{title:d("automation.run"),children:y.jsx(ct,{className:"automation-view__icon-button automation-view__icon-button--run",type:"text",onClick:O=>{O.stopPropagation(),a(g)},children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"play_arrow"})})}),y.jsx(dt,{title:d("automation.delete"),children:y.jsx(ct,{className:"automation-view__icon-button automation-view__icon-button--delete",type:"text",onClick:O=>{O.stopPropagation(),s(g)},children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"delete"})})}),y.jsx(dt,{title:d(S?"automation.unfavorite":"automation.favorite"),children:y.jsx(ct,{className:`automation-view__icon-button automation-view__icon-button--favorite ${S?"automation-view__icon-button--active":""}`,type:"text",onClick:O=>{O.stopPropagation(),b(g.id)},children:y.jsx("span",{className:`material-symbols-rounded automation-view__action-icon ${S?"automation-view__action-icon--star":""}`,children:S?"star":"star_outline"})})})]})]})]})})}})]})}function bme({rule:e,runs:t,runQuery:n,statusFilter:r,timeFilter:o,sortOrder:i,onEditRule:a,onRunQueryChange:s,onStatusFilterChange:l,onTimeFilterChange:c,onSortOrderChange:d}){const{t:f}=Ot(),m=u.useMemo(()=>{const g=n.trim().toLowerCase(),v=Date.now(),C={all:null,"24h":24*60*60*1e3,"7d":7*24*60*60*1e3,"30d":30*24*60*60*1e3}[o]??null;return t.filter(w=>r!=="all"&&(w.status??"unknown")!==r||C!=null&&v-w.runAt>C?!1:g?[w.taskTitle,w.title,w.lastMessage,w.lastUserMessage,w.sessionId].filter(Boolean).join(" ").toLowerCase().includes(g):!0).sort((w,N)=>i==="asc"?w.runAt-N.runAt:N.runAt-w.runAt)},[n,t,i,r,o]),p=u.useMemo(()=>[{title:f("automation.runTime"),dataIndex:"runAt",key:"runAt",render:g=>Js(g).format("YYYY-MM-DD HH:mm")},{title:f("automation.taskTitle"),dataIndex:"taskTitle",key:"taskTitle",render:(g,v)=>y.jsx("div",{className:"automation-view__task-cell",children:y.jsxs("a",{className:"automation-view__task-link",href:`/session/${v.sessionId}`,children:[y.jsx("span",{className:"material-symbols-rounded automation-view__task-icon",children:"task_alt"}),y.jsx("span",{className:"automation-view__task-text",children:v.taskTitle??f("automation.taskUnknown")}),v.status?y.jsxs("span",{className:"automation-view__status","data-status":v.status,children:[y.jsx("span",{className:"material-symbols-rounded automation-view__status-icon",children:"fiber_manual_record"}),f(`common.status.${v.status}`,v.status)]}):y.jsx("span",{className:"automation-view__status",children:"-"})]})})},{title:f("automation.runSummary"),dataIndex:"lastMessage",key:"summary",render:(g,v)=>{const S=v.title??v.lastMessage??v.lastUserMessage??"-";return y.jsx("span",{className:"automation-view__run-summary",children:S})}}],[f]),h=u.useMemo(()=>{var S;if(t.length===0)return[];const g=[...t].sort((C,_)=>_.runAt-C.runAt),v=(S=g[0])==null?void 0:S.sessionId;return v?g.filter(C=>C.sessionId===v):g.slice(0,1)},[t]);if(!e)return y.jsx("div",{className:"automation-view__empty",children:y.jsx(bn,{description:f("automation.selectRule")})});const b=(e.triggers??[]).map(g=>{var v;if(g.type==="interval"){const S=g.intervalMs?Math.max(1,Math.round(g.intervalMs/6e4)):1;return f("automation.intervalEvery",{minutes:S})}if(g.type==="cron"){const S=((v=g.cronExpression)==null?void 0:v.trim())||"-";return f("automation.cronExpression",{expression:S})}return f("automation.webhookTrigger")}),x=(e.tasks??[]).map((g,v)=>g.title||f("automation.taskDefaultTitle",{index:v+1}));return y.jsxs("div",{className:"automation-view__content",children:[y.jsxs("div",{className:"automation-view__detail",children:[y.jsxs("div",{className:"automation-view__detail-header",children:[y.jsxs("div",{className:"automation-view__detail-title",children:[y.jsx("h3",{className:"automation-view__content-text",children:e.name}),y.jsx("span",{className:"automation-view__detail-id",children:e.id})]}),y.jsx(ct,{className:"automation-view__icon-button automation-view__icon-button--edit",type:"text",onClick:()=>a(e),children:y.jsx("span",{className:"material-symbols-rounded automation-view__action-icon",children:"edit"})})]}),y.jsxs("div",{className:"automation-view__detail-description",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"description"}),y.jsx("span",{children:e.description||f("automation.noDescription")})]}),y.jsxs("div",{className:"automation-view__detail-body",children:[y.jsxs("div",{className:"automation-view__detail-left",children:[y.jsxs("div",{className:"automation-view__detail-row",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"event"}),y.jsx("span",{className:"automation-view__detail-label",children:f("automation.createdAt")}),y.jsx("span",{className:"automation-view__detail-value",children:Js(e.createdAt).format("YYYY-MM-DD HH:mm")})]}),y.jsxs("div",{className:"automation-view__detail-row",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"toggle_on"}),y.jsx("span",{className:"automation-view__detail-label",children:f("automation.ruleStatus")}),y.jsx("span",{className:"automation-view__detail-value","data-status":e.enabled?"enabled":"disabled",children:e.enabled?f("automation.enabledOn"):f("automation.enabledOff")})]}),y.jsxs("div",{className:"automation-view__detail-list",children:[y.jsxs("div",{className:"automation-view__detail-row",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"update"}),y.jsx("span",{className:"automation-view__detail-label",children:f("automation.lastRunLabel")})]}),y.jsx("div",{className:"automation-view__run-list",children:h.length>0?h.map(g=>y.jsxs("div",{className:"automation-view__run-item",children:[y.jsx("a",{className:"automation-view__run-link",href:`/session/${g.sessionId}?tag=${encodeURIComponent(`automation:${e.id}:${e.name}`)}`,target:"_blank",rel:"noreferrer",children:g.taskTitle??f("automation.taskUnknown")}),y.jsx("span",{className:"automation-view__run-time",children:Js(g.runAt).format("YYYY-MM-DD HH:mm")})]},g.id)):y.jsx("span",{className:"automation-view__detail-value",children:f("automation.noRunYet")})})]}),e.lastSessionId&&y.jsxs("div",{className:"automation-view__detail-row",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"open_in_new"}),y.jsx("a",{className:"automation-view__detail-label automation-view__detail-link",href:`/session/${e.lastSessionId}?tag=${encodeURIComponent(`automation:${e.id}:${e.name}`)}`,target:"_blank",rel:"noreferrer",children:f("automation.relatedSession")})]})]}),y.jsxs("div",{className:"automation-view__detail-right",children:[y.jsxs("div",{className:"automation-view__detail-section",children:[y.jsxs("div",{className:"automation-view__detail-section-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"bolt"}),f("automation.sectionTriggers")]}),y.jsx("div",{className:"automation-view__detail-chips",children:b.length?b.map((g,v)=>y.jsx("span",{className:"automation-view__detail-chip",children:g},`${g}-${v}`)):y.jsx("span",{className:"automation-view__detail-placeholder",children:f("automation.noTriggers")})})]}),y.jsxs("div",{className:"automation-view__detail-section",children:[y.jsxs("div",{className:"automation-view__detail-section-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__meta-icon",children:"task"}),f("automation.sectionTasks")]}),y.jsx("div",{className:"automation-view__detail-chips",children:x.length?x.map((g,v)=>y.jsx("span",{className:"automation-view__detail-chip",children:g},`${g}-${v}`)):y.jsx("span",{className:"automation-view__detail-placeholder",children:f("automation.noTasks")})})]})]})]})]}),y.jsx("div",{className:"automation-view__content-header",children:y.jsxs("div",{className:"automation-view__content-title",children:[y.jsx("span",{className:"material-symbols-rounded automation-view__content-icon",children:"history"}),y.jsx("h3",{className:"automation-view__content-text",children:f("automation.runHistory")})]})}),y.jsxs("div",{className:"automation-view__run-filters",children:[y.jsx(Ft,{value:n,onChange:g=>s(g.target.value),placeholder:f("automation.runSearch"),className:"automation-view__run-search",allowClear:!0}),y.jsx(Yn,{value:r,onChange:l,className:"automation-view__run-select",options:[{label:f("automation.statusAll"),value:"all"},{label:f("common.status.running"),value:"running"},{label:f("common.status.completed"),value:"completed"},{label:f("common.status.failed"),value:"failed"},{label:f("common.status.terminated"),value:"terminated"},{label:f("common.status.waiting_input"),value:"waiting_input"}]}),y.jsx(Yn,{value:o,onChange:c,className:"automation-view__run-select",options:[{label:f("automation.timeAll"),value:"all"},{label:f("automation.time24h"),value:"24h"},{label:f("automation.time7d"),value:"7d"},{label:f("automation.time30d"),value:"30d"}]}),y.jsx(Yn,{value:i,onChange:d,className:"automation-view__run-select",options:[{label:f("automation.sortDesc"),value:"desc"},{label:f("automation.sortAsc"),value:"asc"}]})]}),m.length===0?y.jsx("div",{className:"automation-view__empty",children:y.jsx(bn,{description:f("automation.noRuns")})}):y.jsx(la,{rowKey:"id",className:"automation-view__run-table",columns:p,dataSource:m,pagination:{pageSize:8,hideOnSinglePage:!0}})]})}function xme(){const{t:e}=Ot(),{message:t}=Eo.useApp(),n=Ts(),{data:r,mutate:o}=Qn("/api/automation/rules",Pfe),i=(r==null?void 0:r.rules)??[],[a,s]=u.useState("view"),[l,c]=u.useState(!1),{values:d,update:f}=ju({keys:["rule","q","runQ","status","time","sort"],defaults:{rule:"",q:"",runQ:"",status:"all",time:"all",sort:"desc"},omit:{rule:E=>E==="",q:E=>E==="",runQ:E=>E==="",status:E=>E==="all",time:E=>E==="all",sort:E=>E==="desc"}}),m=u.useMemo(()=>{var $;const E=d.rule;return E&&i.some(O=>O.id===E)?E:(($=i[0])==null?void 0:$.id)??null},[i,d.rule]),p=u.useMemo(()=>i.find(E=>E.id===m)??null,[i,m]),{data:h,mutate:b}=Qn(m?`/api/automation/rules/${m}/runs`:null,()=>Afe(m??"")),x=(h==null?void 0:h.runs)??[];u.useEffect(()=>{i.length!==0&&(!d.rule||!i.some(E=>E.id===d.rule))&&f({rule:i[0].id})},[i,f,d.rule]);const g=u.useCallback(E=>{s("view"),f({rule:E})},[f]),v=u.useCallback(()=>{s("create")},[]),S=u.useCallback(E=>{s("edit"),f({rule:E.id})},[f]),C=u.useCallback(()=>{s("view")},[]),_=u.useCallback(async(E,$)=>{var O;try{if(c(!0),a==="create"){const R=await Tfe({...E,immediateRun:$});await o(),(O=R.rule)!=null&&O.id&&f({rule:R.rule.id}),s("view");return}a==="edit"&&p&&(await AI(p.id,{...E,immediateRun:$}),await o(),b(),s("view"))}catch(R){t.error(Mr(R,e("automation.saveFailed")))}finally{c(!1)}},[a,o,b,t,p,e]),w=u.useCallback(async E=>{try{await jfe(E.id),m===E.id&&(f({rule:""}),s("view")),o(),t.success(e("automation.deleted"))}catch($){t.error(Mr($,e("automation.deleteFailed")))}},[t,o,m,e]),N=u.useCallback(async E=>{var $;try{const R=($=(await Mfe(E.id)).sessionIds)==null?void 0:$[0];R&&(t.success(e("automation.runStarted")),b(),n(`/session/${R}`))}catch(O){t.error(Mr(O,e("automation.runFailed")))}},[t,b,n,e]),k=u.useCallback(async(E,$)=>{try{await AI(E.id,{enabled:$}),o()}catch(O){t.error(Mr(O,e("automation.toggleFailed")))}},[t,o,e]);return y.jsxs("div",{className:"automation-view",children:[y.jsx("div",{className:"automation-view__left",children:y.jsx(yme,{rules:i,selectedRuleId:m,query:d.q,isCreating:a==="create",onCreate:v,onSelect:g,onRun:N,onDelete:w,onToggle:k,onQueryChange:E=>f({q:E})})}),y.jsx("div",{className:"automation-view__divider"}),y.jsxs("div",{className:"automation-view__right",children:[a==="create"&&y.jsx(zI,{mode:"create",rule:null,submitting:l,onSubmit:_,onCancel:C}),a==="edit"&&y.jsx(zI,{mode:"edit",rule:p,submitting:l,onSubmit:_,onCancel:C}),a==="view"&&y.jsx(bme,{rule:p,runs:x,runQuery:d.runQ,statusFilter:d.status,timeFilter:d.time,sortOrder:d.sort,onEditRule:S,onRunQueryChange:E=>f({runQ:E}),onStatusFilterChange:E=>f({status:E}),onTimeFilterChange:E=>f({time:E}),onSortOrderChange:E=>f({sort:E})})]})]})}function Sme(){return y.jsx(xme,{})}const Cme="modulepreload",wme=function(e){return"/__VF_PROJECT_AI_CLIENT_BASE__/"+e},BI={},oe=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),s=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));o=Promise.allSettled(n.map(l=>{if(l=wme(l),l in BI)return;BI[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":Cme,c||(f.as="script"),f.crossOrigin="",f.href=l,s&&f.setAttribute("nonce",s),document.head.appendChild(f),c)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return o.then(a=>{for(const s of a||[])s.status==="rejected"&&i(s.reason);return t().catch(i)})};let sr=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function _me(e){return S1(e)}function S1(e){return Array.isArray(e)?Eme(e):e instanceof RegExp?e:typeof e=="object"?$me(e):e}function Eme(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=S1(e[n]);return t}function $me(e){let t={};for(let n in e)t[n]=S1(e[n]);return t}function lB(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function cB(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?cB(e.substring(0,e.length-1)):e.substr(~t+1)}var e0=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,op=class{static hasCaptures(e){return e===null?!1:(e0.lastIndex=0,e0.test(e))}static replaceCaptures(e,t,n){return e.replace(e0,(r,o,i,a)=>{let s=n[parseInt(o||i,10)];if(s){let l=t.substring(s.start,s.end);for(;l[0]===".";)l=l.substring(1);switch(a){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function uB(e,t){return e<t?-1:e>t?1:0}function dB(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let o=0;o<n;o++){let i=uB(e[o],t[o]);if(i!==0)return i}return 0}return n-r}function FI(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function fB(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var mB=class{constructor(e){Ae(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Zh=class{constructor(e,t,n){Ae(this,"_cachedMatchRoot",new mB(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Ome(e),t)}static createFromParsedTheme(e,t){return Rme(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(o=>kme(e.parent,o.parentScopes));return r?new pB(r.fontStyle,r.foreground,r.background):null}},t0=class Wp{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Wp(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Wp(n,t[r]);return n}push(t){return new Wp(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function kme(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],o=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],o=!0}for(;e&&!Nme(e.scopeName,r);){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Nme(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var pB=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Ome(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let o=0,i=t.length;o<i;o++){let a=t[o];if(!a.settings)continue;let s;if(typeof a.scope=="string"){let f=a.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),s=f.split(",")}else Array.isArray(a.scope)?s=a.scope:s=[""];let l=-1;if(typeof a.settings.fontStyle=="string"){l=0;let f=a.settings.fontStyle.split(" ");for(let m=0,p=f.length;m<p;m++)switch(f[m]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof a.settings.foreground=="string"&&FI(a.settings.foreground)&&(c=a.settings.foreground);let d=null;typeof a.settings.background=="string"&&FI(a.settings.background)&&(d=a.settings.background);for(let f=0,m=s.length;f<m;f++){let h=s[f].trim().split(" "),b=h[h.length-1],x=null;h.length>1&&(x=h.slice(0,h.length-1),x.reverse()),n[r++]=new Ime(b,x,o,l,c,d)}}return n}var Ime=class{constructor(e,t,n,r,o,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=o,this.background=i}},Xr=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Xr||{});function Rme(e,t){e.sort((l,c)=>{let d=uB(l.scope,c.scope);return d!==0||(d=dB(l.parentScopes,c.parentScopes),d!==0)?d:l.index-c.index});let n=0,r="#000000",o="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(o=l.background)}let i=new Pme(t),a=new pB(n,i.getId(r),i.getId(o)),s=new jme(new sC(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let d=e[l];s.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new Zh(i,a,s)}var Pme=class{constructor(e){Ae(this,"_isFrozen");Ae(this,"_lastColorId");Ae(this,"_id2color");Ae(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Tme=Object.freeze([]),sC=class hB{constructor(t,n,r,o,i){Ae(this,"scopeDepth");Ae(this,"parentScopes");Ae(this,"fontStyle");Ae(this,"foreground");Ae(this,"background");this.scopeDepth=t,this.parentScopes=n||Tme,this.fontStyle=r,this.foreground=o,this.background=i}clone(){return new hB(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,o=t.length;r<o;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,o){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),o!==0&&(this.background=o)}},jme=class lC{constructor(t,n=[],r={}){Ae(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,o=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[o]===">"&&o++,!(r>=t.parentScopes.length||o>=n.parentScopes.length);){const i=n.parentScopes[o].length-t.parentScopes[r].length;if(i!==0)return i;r++,o++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),o,i;if(r===-1?(o=t,i=""):(o=t.substring(0,r),i=t.substring(r+1)),this._children.hasOwnProperty(o))return this._children[o].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(lC._cmpBySpecificity),n}insert(t,n,r,o,i,a){if(n===""){this._doInsertHere(t,r,o,i,a);return}let s=n.indexOf("."),l,c;s===-1?(l=n,c=""):(l=n.substring(0,s),c=n.substring(s+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new lC(this._mainRule.clone(),sC.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(t+1,c,r,o,i,a)}_doInsertHere(t,n,r,o,i){if(n===null){this._mainRule.acceptOverwrite(t,r,o,i);return}for(let a=0,s=this._rulesWithParentScopes.length;a<s;a++){let l=this._rulesWithParentScopes[a];if(dB(l.parentScopes,n)===0){l.acceptOverwrite(t,r,o,i);return}}r===-1&&(r=this._mainRule.fontStyle),o===0&&(o=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new sC(t,n,r,o,i))}},eu=class qo{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=qo.getLanguageId(t),r=qo.getTokenType(t),o=qo.getFontStyle(t),i=qo.getForeground(t),a=qo.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:o,foreground:i,background:a})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,o,i,a,s){let l=qo.getLanguageId(t),c=qo.getTokenType(t),d=qo.containsBalancedBrackets(t)?1:0,f=qo.getFontStyle(t),m=qo.getForeground(t),p=qo.getBackground(t);return n!==0&&(l=n),r!==8&&(c=r),o!==null&&(d=o?1:0),i!==-1&&(f=i),a!==0&&(m=a),s!==0&&(p=s),(l<<0|c<<8|d<<10|f<<11|m<<15|p<<24)>>>0}};function Jh(e,t){const n=[],r=Mme(e);let o=r.next();for(;o!==null;){let l=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=r.next()}let c=a();if(n.push({matcher:c,priority:l}),o!==",")break;o=r.next()}return n;function i(){if(o==="-"){o=r.next();const l=i();return c=>!!l&&!l(c)}if(o==="("){o=r.next();const l=s();return o===")"&&(o=r.next()),l}if(HI(o)){const l=[];do l.push(o),o=r.next();while(HI(o));return c=>t(l,c)}return null}function a(){const l=[];let c=i();for(;c;)l.push(c),c=i();return d=>l.every(f=>f(d))}function s(){const l=[];let c=a();for(;c&&(l.push(c),o==="|"||o===",");){do o=r.next();while(o==="|"||o===",");c=a()}return d=>l.some(f=>f(d))}}function HI(e){return!!e&&!!e.match(/[\w\.:]+/)}function Mme(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function gB(e){typeof e.dispose=="function"&&e.dispose()}var _f=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ame=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Lme=class{constructor(){Ae(this,"_references",[]);Ae(this,"_seenReferenceKeys",new Set);Ae(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Dme=class{constructor(e,t){Ae(this,"seenFullScopeRequests",new Set);Ae(this,"seenPartialScopeRequests",new Set);Ae(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new _f(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Lme;for(const n of e)zme(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof _f){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function zme(e,t,n,r){const o=n.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof _f?Kp({baseGrammar:i,selfGrammar:o},r):cC(e.ruleName,{baseGrammar:i,selfGrammar:o,repository:o.repository},r);const a=n.injections(e.scopeName);if(a)for(const s of a)r.add(new _f(s))}function cC(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];eg([r],t,n)}}function Kp(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&eg(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&eg(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function eg(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const o=r.repository?lB({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&eg(r.patterns,{...t,repository:o},n);const i=r.include;if(!i)continue;const a=vB(i);switch(a.kind){case 0:Kp({...t,selfGrammar:t.baseGrammar},n);break;case 1:Kp(t,n);break;case 2:cC(a.ruleName,{...t,repository:o},n);break;case 3:case 4:const s=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){const l={baseGrammar:t.baseGrammar,selfGrammar:s,repository:o};a.kind===4?cC(a.ruleName,l,n):Kp(l,n)}else a.kind===4?n.add(new Ame(a.scopeName,a.ruleName)):n.add(new _f(a.scopeName));break}}}var Bme=class{constructor(){Ae(this,"kind",0)}},Fme=class{constructor(){Ae(this,"kind",1)}},Hme=class{constructor(e){Ae(this,"kind",2);this.ruleName=e}},Vme=class{constructor(e){Ae(this,"kind",3);this.scopeName=e}},Wme=class{constructor(e,t){Ae(this,"kind",4);this.scopeName=e,this.ruleName=t}};function vB(e){if(e==="$base")return new Bme;if(e==="$self")return new Fme;const t=e.indexOf("#");if(t===-1)return new Vme(e);if(t===0)return new Hme(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new Wme(n,r)}}var Kme=/\\(\d+)/,VI=/\\(\d+)/g,Ume=-1,yB=-2;var dm=class{constructor(e,t,n,r){Ae(this,"$location");Ae(this,"id");Ae(this,"_nameIsCapturing");Ae(this,"_name");Ae(this,"_contentNameIsCapturing");Ae(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=op.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=op.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${cB(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:op.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:op.replaceCaptures(this._contentName,e,t)}},Gme=class extends dm{constructor(t,n,r,o,i){super(t,n,r,o);Ae(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,r,o){throw new Error("Not supported!")}},qme=class extends dm{constructor(t,n,r,o,i){super(t,n,r,null);Ae(this,"_match");Ae(this,"captures");Ae(this,"_cachedCompiledPatterns");this._match=new Ef(o,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,o){return this._getCachedCompiledPatterns(t).compileAG(t,r,o)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new $f,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},WI=class extends dm{constructor(t,n,r,o,i){super(t,n,r,o);Ae(this,"hasMissingPatterns");Ae(this,"patterns");Ae(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,o){return this._getCachedCompiledPatterns(t).compileAG(t,r,o)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new $f,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},uC=class extends dm{constructor(t,n,r,o,i,a,s,l,c,d){super(t,n,r,o);Ae(this,"_begin");Ae(this,"beginCaptures");Ae(this,"_end");Ae(this,"endHasBackReferences");Ae(this,"endCaptures");Ae(this,"applyEndPatternLast");Ae(this,"hasMissingPatterns");Ae(this,"patterns");Ae(this,"_cachedCompiledPatterns");this._begin=new Ef(i,this.id),this.beginCaptures=a,this._end=new Ef(s||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,o){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,o)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new $f;for(const r of this.patterns)t.getRule(r).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},tg=class extends dm{constructor(t,n,r,o,i,a,s,l,c){super(t,n,r,o);Ae(this,"_begin");Ae(this,"beginCaptures");Ae(this,"whileCaptures");Ae(this,"_while");Ae(this,"whileHasBackReferences");Ae(this,"hasMissingPatterns");Ae(this,"patterns");Ae(this,"_cachedCompiledPatterns");Ae(this,"_cachedCompiledWhilePatterns");this._begin=new Ef(i,this.id),this.beginCaptures=a,this.whileCaptures=l,this._while=new Ef(s,yB),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,o){return this._getCachedCompiledPatterns(t).compileAG(t,r,o)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new $f;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,r,o){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,o)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new $f,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},bB=class Kr{static createCaptureRule(t,n,r,o,i){return t.registerRule(a=>new Gme(n,a,r,o,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(o=>{if(t.id=o,t.match)return new qme(t.$vscodeTextmateLocation,t.id,t.name,t.match,Kr._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=lB({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new WI(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Kr._compilePatterns(i,n,r))}return t.while?new tg(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Kr._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Kr._compileCaptures(t.whileCaptures||t.captures,n,r),Kr._compilePatterns(t.patterns,n,r)):new uC(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Kr._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Kr._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Kr._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let o=[];if(t){let i=0;for(const a in t){if(a==="$vscodeTextmateLocation")continue;const s=parseInt(a,10);s>i&&(i=s)}for(let a=0;a<=i;a++)o[a]=null;for(const a in t){if(a==="$vscodeTextmateLocation")continue;const s=parseInt(a,10);let l=0;t[a].patterns&&(l=Kr.getCompiledRuleId(t[a],n,r)),o[s]=Kr.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,l)}}return o}static _compilePatterns(t,n,r){let o=[];if(t)for(let i=0,a=t.length;i<a;i++){const s=t[i];let l=-1;if(s.include){const c=vB(s.include);switch(c.kind){case 0:case 1:l=Kr.getCompiledRuleId(r[s.include],n,r);break;case 2:let d=r[c.ruleName];d&&(l=Kr.getCompiledRuleId(d,n,r));break;case 3:case 4:const f=c.scopeName,m=c.kind===4?c.ruleName:null,p=n.getExternalGrammar(f,r);if(p)if(m){let h=p.repository[m];h&&(l=Kr.getCompiledRuleId(h,n,p.repository))}else l=Kr.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else l=Kr.getCompiledRuleId(s,n,r);if(l!==-1){const c=n.getRule(l);let d=!1;if((c instanceof WI||c instanceof uC||c instanceof tg)&&c.hasMissingPatterns&&c.patterns.length===0&&(d=!0),d)continue;o.push(l)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},Ef=class xB{constructor(t,n){Ae(this,"source");Ae(this,"ruleId");Ae(this,"hasAnchor");Ae(this,"hasBackReferences");Ae(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let o=0,i=[],a=!1;for(let s=0;s<r;s++)if(t.charAt(s)==="\\"&&s+1<r){const c=t.charAt(s+1);c==="z"?(i.push(t.substring(o,s)),i.push("$(?!\\n)(?<!\\n)"),o=s+2):(c==="A"||c==="G")&&(a=!0),s++}this.hasAnchor=a,o===0?this.source=t:(i.push(t.substring(o,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Kme.test(this.source):this.hasBackReferences=!1}clone(){return new xB(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(o=>t.substring(o.start,o.end));return VI.lastIndex=0,this.source.replace(VI,(o,i)=>fB(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],o=[],i,a,s,l;for(i=0,a=this.source.length;i<a;i++)s=this.source.charAt(i),t[i]=s,n[i]=s,r[i]=s,o[i]=s,s==="\\"&&i+1<a&&(l=this.source.charAt(i+1),l==="A"?(t[i+1]="",n[i+1]="",r[i+1]="A",o[i+1]="A"):l==="G"?(t[i+1]="",n[i+1]="G",r[i+1]="",o[i+1]="G"):(t[i+1]=l,n[i+1]=l,r[i+1]=l,o[i+1]=l),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:o.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},$f=class{constructor(){Ae(this,"_items");Ae(this,"_hasAnchors");Ae(this,"_cached");Ae(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new KI(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(o=>o.resolveAnchors(t,n));return new KI(e,r,this._items.map(o=>o.ruleId))}},KI=class{constructor(e,t,n){Ae(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
458
|
+
`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},n0=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ga,Xme=(ga=class{constructor(t,n){Ae(this,"_defaultAttributes");Ae(this,"_embeddedLanguagesMatcher");Ae(this,"_getBasicScopeAttributes",new mB(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new n0(n,r)}));this._defaultAttributes=new n0(t,8),this._embeddedLanguagesMatcher=new Yme(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?ga._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(ga.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},Ae(ga,"_NULL_SCOPE_METADATA",new n0(0,0)),Ae(ga,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),ga),Yme=class{constructor(e){Ae(this,"values");Ae(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>fB(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},UI=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function SB(e,t,n,r,o,i,a,s){const l=t.content.length;let c=!1,d=-1;if(a){const p=Qme(e,t,n,r,o,i);o=p.stack,r=p.linePos,n=p.isFirstLine,d=p.anchorPosition}const f=Date.now();for(;!c;){if(s!==0&&Date.now()-f>s)return new UI(o,!0);m()}return new UI(o,!1);function m(){const p=Zme(e,t,n,r,o,d);if(!p){i.produce(o,l),c=!0;return}const h=p.captureIndices,b=p.matchedRuleId,x=h&&h.length>0?h[0].end>r:!1;if(b===Ume){const g=o.getRule(e);i.produce(o,h[0].start),o=o.withContentNameScopesList(o.nameScopesList),pd(e,t,n,o,i,g.endCaptures,h),i.produce(o,h[0].end);const v=o;if(o=o.parent,d=v.getAnchorPos(),!x&&v.getEnterPos()===r){o=v,i.produce(o,l),c=!0;return}}else{const g=e.getRule(b);i.produce(o,h[0].start);const v=o,S=g.getName(t.content,h),C=o.contentNameScopesList.pushAttributed(S,e);if(o=o.push(b,r,d,h[0].end===l,null,C,C),g instanceof uC){const _=g;pd(e,t,n,o,i,_.beginCaptures,h),i.produce(o,h[0].end),d=h[0].end;const w=_.getContentName(t.content,h),N=C.pushAttributed(w,e);if(o=o.withContentNameScopesList(N),_.endHasBackReferences&&(o=o.withEndRule(_.getEndWithResolvedBackReferences(t.content,h))),!x&&v.hasSameRuleAs(o)){o=o.pop(),i.produce(o,l),c=!0;return}}else if(g instanceof tg){const _=g;pd(e,t,n,o,i,_.beginCaptures,h),i.produce(o,h[0].end),d=h[0].end;const w=_.getContentName(t.content,h),N=C.pushAttributed(w,e);if(o=o.withContentNameScopesList(N),_.whileHasBackReferences&&(o=o.withEndRule(_.getWhileWithResolvedBackReferences(t.content,h))),!x&&v.hasSameRuleAs(o)){o=o.pop(),i.produce(o,l),c=!0;return}}else if(pd(e,t,n,o,i,g.captures,h),i.produce(o,h[0].end),o=o.pop(),!x){o=o.safePop(),i.produce(o,l),c=!0;return}}h[0].end>r&&(r=h[0].end,n=!1)}}function Qme(e,t,n,r,o,i){let a=o.beginRuleCapturedEOL?0:-1;const s=[];for(let l=o;l;l=l.pop()){const c=l.getRule(e);c instanceof tg&&s.push({rule:c,stack:l})}for(let l=s.pop();l;l=s.pop()){const{ruleScanner:c,findOptions:d}=tpe(l.rule,e,l.stack.endRule,n,r===a),f=c.findNextMatchSync(t,r,d);if(f){if(f.ruleId!==yB){o=l.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(i.produce(l.stack,f.captureIndices[0].start),pd(e,t,n,l.stack,i,l.rule.whileCaptures,f.captureIndices),i.produce(l.stack,f.captureIndices[0].end),a=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{o=l.stack.pop();break}}return{stack:o,linePos:r,anchorPosition:a,isFirstLine:n}}function Zme(e,t,n,r,o,i){const a=Jme(e,t,n,r,o,i),s=e.getInjections();if(s.length===0)return a;const l=epe(s,e,t,n,r,o,i);if(!l)return a;if(!a)return l;const c=a.captureIndices[0].start,d=l.captureIndices[0].start;return d<c||l.priorityMatch&&d===c?l:a}function Jme(e,t,n,r,o,i){const a=o.getRule(e),{ruleScanner:s,findOptions:l}=CB(a,e,o.endRule,n,r===i),c=s.findNextMatchSync(t,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function epe(e,t,n,r,o,i,a){let s=Number.MAX_VALUE,l=null,c,d=0;const f=i.contentNameScopesList.getScopeNames();for(let m=0,p=e.length;m<p;m++){const h=e[m];if(!h.matcher(f))continue;const b=t.getRule(h.ruleId),{ruleScanner:x,findOptions:g}=CB(b,t,null,r,o===a),v=x.findNextMatchSync(n,o,g);if(!v)continue;const S=v.captureIndices[0].start;if(!(S>=s)&&(s=S,l=v.captureIndices,c=v.ruleId,d=h.priority,s===o))break}return l?{priorityMatch:d===-1,captureIndices:l,matchedRuleId:c}:null}function CB(e,t,n,r,o){return{ruleScanner:e.compileAG(t,n,r,o),findOptions:0}}function tpe(e,t,n,r,o){return{ruleScanner:e.compileWhileAG(t,n,r,o),findOptions:0}}function pd(e,t,n,r,o,i,a){if(i.length===0)return;const s=t.content,l=Math.min(i.length,a.length),c=[],d=a[0].end;for(let f=0;f<l;f++){const m=i[f];if(m===null)continue;const p=a[f];if(p.length===0)continue;if(p.start>d)break;for(;c.length>0&&c[c.length-1].endPos<=p.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,p.start):o.produce(r,p.start),m.retokenizeCapturedWithRuleId){const b=m.getName(s,a),x=r.contentNameScopesList.pushAttributed(b,e),g=m.getContentName(s,a),v=x.pushAttributed(g,e),S=r.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,x,v),C=e.createOnigString(s.substring(0,p.end));SB(e,C,n&&p.start===0,p.start,S,o,!1,0),gB(C);continue}const h=m.getName(s,a);if(h!==null){const x=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(h,e);c.push(new npe(x,p.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var npe=class{constructor(e,t){Ae(this,"scopes");Ae(this,"endPos");this.scopes=e,this.endPos=t}};function rpe(e,t,n,r,o,i,a,s){return new ipe(e,t,n,r,o,i,a,s)}function GI(e,t,n,r,o){const i=Jh(t,ng),a=bB.getCompiledRuleId(n,r,o.repository);for(const s of i)e.push({debugSelector:t,matcher:s.matcher,ruleId:a,grammar:o,priority:s.priority})}function ng(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let o=n;o<t.length;o++)if(ope(t[o],r))return n=o+1,!0;return!1})}function ope(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var ipe=class{constructor(e,t,n,r,o,i,a,s){Ae(this,"_rootId");Ae(this,"_lastRuleId");Ae(this,"_ruleId2desc");Ae(this,"_includedGrammars");Ae(this,"_grammarRepository");Ae(this,"_grammar");Ae(this,"_injections");Ae(this,"_basicScopeAttributesProvider");Ae(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=s,this._basicScopeAttributesProvider=new Xme(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=qI(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const l of Object.keys(o)){const c=Jh(l,ng);for(const d of c)this._tokenTypeMatchers.push({matcher:d.matcher,type:o[l]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:o=>o===this._rootScopeName?this._grammar:this.getExternalGrammar(o),injections:o=>this._grammarRepository.injections(o)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const o=r.injections;if(o)for(let a in o)GI(t,a,o[a],this,r);const i=this._grammarRepository.injections(n);i&&i.forEach(a=>{const s=this.getExternalGrammar(a);if(s){const l=s.injectionSelector;l&&GI(t,l,s,this,s)}})}return t.sort((o,i)=>o.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=qI(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=bB.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let o;if(!t||t===dC.NULL){o=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),f=eu.set(0,c.languageId,c.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),m=this.getRule(this._rootId).getName(null,null);let p;m?p=Td.createRootAndLookUpScopeName(m,f,this):p=Td.createRoot("unknown",f),t=new dC(null,this._rootId,-1,-1,!1,null,p,p)}else o=!1,t.reset();e=e+`
|
|
459
|
+
`;const i=this.createOnigString(e),a=i.content.length,s=new spe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=SB(this,i,o,0,t,s,!0,r);return gB(i),{lineLength:a,lineTokens:s,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function qI(e,t){return e=_me(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Td=class zi{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,o=(t==null?void 0:t.scopePath)??null;for(const i of n)o=t0.push(o,i.scopeNames),r=new zi(r,o,i.encodedTokenAttributes);return r}static createRoot(t,n){return new zi(null,new t0(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const o=r.getMetadataForScope(t),i=new t0(null,t),a=r.themeProvider.themeMatch(i),s=zi.mergeAttributes(n,o,a);return new zi(null,i,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return zi.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let o=-1,i=0,a=0;return r!==null&&(o=r.fontStyle,i=r.foregroundId,a=r.backgroundId),eu.set(t,n.languageId,n.tokenType,null,o,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return zi._pushAttributed(this,t,n);const r=t.split(/ /g);let o=this;for(const i of r)o=zi._pushAttributed(o,i,n);return o}static _pushAttributed(t,n,r){const o=r.getMetadataForScope(n),i=t.scopePath.push(n),a=r.themeProvider.themeMatch(i),s=zi.mergeAttributes(t.tokenAttributes,o,a);return new zi(t,i,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var o;const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((o=r.parent)==null?void 0:o.scopePath)??null)}),r=r.parent;return r===t?n.reverse():void 0}},ei,dC=(ei=class{constructor(t,n,r,o,i,a,s,l){Ae(this,"_stackElementBrand");Ae(this,"_enterPos");Ae(this,"_anchorPos");Ae(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=s,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=o}equals(t){return t===null?!1:ei._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Td.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){ei._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,o,i,a,s){return new ei(this,t,n,r,o,i,a,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var r,o;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(o=this.contentNameScopesList)==null?void 0:o.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new ei(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const r=Td.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new ei(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Td.fromExtension(r,n.contentNameScopesList))}},Ae(ei,"NULL",new ei(null,0,0,0,!1,null,null,null)),ei),ape=class{constructor(e,t){Ae(this,"balancedBracketScopes");Ae(this,"unbalancedBracketScopes");Ae(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Jh(n,ng).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Jh(n,ng).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},spe=class{constructor(e,t,n,r){Ae(this,"_emitBinaryTokens");Ae(this,"_lineText");Ae(this,"_tokens");Ae(this,"_binaryTokens");Ae(this,"_lastTokenEndIndex");Ae(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var r;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let o=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const a=(e==null?void 0:e.getScopeNames())??[];for(const s of this._tokenTypeOverrides)s.matcher(a)&&(o=eu.set(o,0,s.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(a))}if(i&&(o=eu.set(o,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===o){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(o),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,o=this._binaryTokens.length;r<o;r++)n[r]=this._binaryTokens[r];return n}},lpe=class{constructor(e,t){Ae(this,"_grammars",new Map);Ae(this,"_rawGrammars",new Map);Ae(this,"_injectionGrammars",new Map);Ae(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,o){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,rpe(e,i,t,n,r,o,this,this._onigLib))}return this._grammars.get(e)}},cpe=class{constructor(t){Ae(this,"_options");Ae(this,"_syncRegistry");Ae(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new lpe(Zh.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Zh.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new ape(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,o,i){const a=new Dme(this._syncRegistry,t);for(;a.Q.length>0;)a.Q.map(s=>this._loadSingleGrammar(s.scopeName)),a.processQueue();return this._grammarForScopeName(t,n,r,o,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,o=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,o)}_grammarForScopeName(t,n=0,r=null,o=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,r,o,i)}},fC=dC.NULL;const upe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class fm{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}fm.prototype.normal={};fm.prototype.property={};fm.prototype.space=void 0;function wB(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new fm(n,r,t)}function mC(e){return e.toLowerCase()}class $o{constructor(t,n){this.attribute=n,this.property=t}}$o.prototype.attribute="";$o.prototype.booleanish=!1;$o.prototype.boolean=!1;$o.prototype.commaOrSpaceSeparated=!1;$o.prototype.commaSeparated=!1;$o.prototype.defined=!1;$o.prototype.mustUseProperty=!1;$o.prototype.number=!1;$o.prototype.overloadedBoolean=!1;$o.prototype.property="";$o.prototype.spaceSeparated=!1;$o.prototype.space=void 0;let dpe=0;const Xt=Il(),or=Il(),pC=Il(),et=Il(),In=Il(),Rc=Il(),Ro=Il();function Il(){return 2**++dpe}const hC=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xt,booleanish:or,commaOrSpaceSeparated:Ro,commaSeparated:Rc,number:et,overloadedBoolean:pC,spaceSeparated:In},Symbol.toStringTag,{value:"Module"})),r0=Object.keys(hC);class C1 extends $o{constructor(t,n,r,o){let i=-1;if(super(t,n),XI(this,"space",o),typeof r=="number")for(;++i<r0.length;){const a=r0[i];XI(this,r0[i],(r&hC[a])===hC[a])}}}C1.prototype.defined=!0;function XI(e,t,n){n&&(e[t]=n)}function Mu(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new C1(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[mC(r)]=r,n[mC(i.attribute)]=r}return new fm(t,n,e.space)}const _B=Mu({properties:{ariaActiveDescendant:null,ariaAtomic:or,ariaAutoComplete:null,ariaBusy:or,ariaChecked:or,ariaColCount:et,ariaColIndex:et,ariaColSpan:et,ariaControls:In,ariaCurrent:null,ariaDescribedBy:In,ariaDetails:null,ariaDisabled:or,ariaDropEffect:In,ariaErrorMessage:null,ariaExpanded:or,ariaFlowTo:In,ariaGrabbed:or,ariaHasPopup:null,ariaHidden:or,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:In,ariaLevel:et,ariaLive:null,ariaModal:or,ariaMultiLine:or,ariaMultiSelectable:or,ariaOrientation:null,ariaOwns:In,ariaPlaceholder:null,ariaPosInSet:et,ariaPressed:or,ariaReadOnly:or,ariaRelevant:null,ariaRequired:or,ariaRoleDescription:In,ariaRowCount:et,ariaRowIndex:et,ariaRowSpan:et,ariaSelected:or,ariaSetSize:et,ariaSort:null,ariaValueMax:et,ariaValueMin:et,ariaValueNow:et,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function EB(e,t){return t in e?e[t]:t}function $B(e,t){return EB(e,t.toLowerCase())}const fpe=Mu({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rc,acceptCharset:In,accessKey:In,action:null,allow:null,allowFullScreen:Xt,allowPaymentRequest:Xt,allowUserMedia:Xt,alt:null,as:null,async:Xt,autoCapitalize:null,autoComplete:In,autoFocus:Xt,autoPlay:Xt,blocking:In,capture:null,charSet:null,checked:Xt,cite:null,className:In,cols:et,colSpan:null,content:null,contentEditable:or,controls:Xt,controlsList:In,coords:et|Rc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xt,defer:Xt,dir:null,dirName:null,disabled:Xt,download:pC,draggable:or,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xt,formTarget:null,headers:In,height:et,hidden:pC,high:et,href:null,hrefLang:null,htmlFor:In,httpEquiv:In,id:null,imageSizes:null,imageSrcSet:null,inert:Xt,inputMode:null,integrity:null,is:null,isMap:Xt,itemId:null,itemProp:In,itemRef:In,itemScope:Xt,itemType:In,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xt,low:et,manifest:null,max:null,maxLength:et,media:null,method:null,min:null,minLength:et,multiple:Xt,muted:Xt,name:null,nonce:null,noModule:Xt,noValidate:Xt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Xt,optimum:et,pattern:null,ping:In,placeholder:null,playsInline:Xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xt,referrerPolicy:null,rel:In,required:Xt,reversed:Xt,rows:et,rowSpan:et,sandbox:In,scope:null,scoped:Xt,seamless:Xt,selected:Xt,shadowRootClonable:Xt,shadowRootDelegatesFocus:Xt,shadowRootMode:null,shape:null,size:et,sizes:null,slot:null,span:et,spellCheck:or,src:null,srcDoc:null,srcLang:null,srcSet:null,start:et,step:null,style:null,tabIndex:et,target:null,title:null,translate:null,type:null,typeMustMatch:Xt,useMap:null,value:or,width:et,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:In,axis:null,background:null,bgColor:null,border:et,borderColor:null,bottomMargin:et,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xt,declare:Xt,event:null,face:null,frame:null,frameBorder:null,hSpace:et,leftMargin:et,link:null,longDesc:null,lowSrc:null,marginHeight:et,marginWidth:et,noResize:Xt,noHref:Xt,noShade:Xt,noWrap:Xt,object:null,profile:null,prompt:null,rev:null,rightMargin:et,rules:null,scheme:null,scrolling:or,standby:null,summary:null,text:null,topMargin:et,valueType:null,version:null,vAlign:null,vLink:null,vSpace:et,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xt,disableRemotePlayback:Xt,prefix:null,property:null,results:et,security:null,unselectable:null},space:"html",transform:$B}),mpe=Mu({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ro,accentHeight:et,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:et,amplitude:et,arabicForm:null,ascent:et,attributeName:null,attributeType:null,azimuth:et,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:et,by:null,calcMode:null,capHeight:et,className:In,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:et,diffuseConstant:et,direction:null,display:null,dur:null,divisor:et,dominantBaseline:null,download:Xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:et,enableBackground:null,end:null,event:null,exponent:et,externalResourcesRequired:null,fill:null,fillOpacity:et,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Rc,g2:Rc,glyphName:Rc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:et,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:et,horizOriginX:et,horizOriginY:et,id:null,ideographic:et,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:et,k:et,k1:et,k2:et,k3:et,k4:et,kernelMatrix:Ro,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:et,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:et,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:et,overlineThickness:et,paintOrder:null,panose1:null,path:null,pathLength:et,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:In,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:et,pointsAtY:et,pointsAtZ:et,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ro,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ro,rev:Ro,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ro,requiredFeatures:Ro,requiredFonts:Ro,requiredFormats:Ro,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:et,specularExponent:et,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:et,strikethroughThickness:et,string:null,stroke:null,strokeDashArray:Ro,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:et,strokeOpacity:et,strokeWidth:null,style:null,surfaceScale:et,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ro,tabIndex:et,tableValues:null,target:null,targetX:et,targetY:et,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ro,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:et,underlineThickness:et,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:et,values:null,vAlphabetic:et,vMathematical:et,vectorEffect:null,vHanging:et,vIdeographic:et,version:null,vertAdvY:et,vertOriginX:et,vertOriginY:et,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:et,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:EB}),kB=Mu({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),NB=Mu({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:$B}),OB=Mu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ppe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},hpe=/[A-Z]/g,YI=/-[a-z]/g,gpe=/^data[-\w.:]+$/i;function IB(e,t){const n=mC(t);let r=t,o=$o;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&gpe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(YI,ype);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!YI.test(i)){let a=i.replace(hpe,vpe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=C1}return new o(r,t)}function vpe(e){return"-"+e.toLowerCase()}function ype(e){return e.charAt(1).toUpperCase()}const RB=wB([_B,fpe,kB,NB,OB],"html"),mm=wB([_B,mpe,kB,NB,OB],"svg"),QI={}.hasOwnProperty;function bpe(e,t){const n=t||{};function r(o,...i){let a=r.invalid;const s=r.handlers;if(o&&QI.call(o,e)){const l=String(o[e]);a=QI.call(s,l)?s[l]:r.unknown}if(a)return a.call(this,o,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const xpe=/["&'<>`]/g,Spe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Cpe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,wpe=/[|\\{}()[\]^$+*?.]/g,ZI=new WeakMap;function _pe(e,t){if(e=e.replace(t.subset?Epe(t.subset):xpe,r),t.subset||t.escapeOnly)return e;return e.replace(Spe,n).replace(Cpe,r);function n(o,i,a){return t.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,a.charCodeAt(i+2),t)}function r(o,i,a){return t.format(o.charCodeAt(0),a.charCodeAt(i+1),t)}}function Epe(e){let t=ZI.get(e);return t||(t=$pe(e),ZI.set(e,t)),t}function $pe(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(wpe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const kpe=/[\dA-Fa-f]/;function Npe(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!kpe.test(String.fromCharCode(t))?r:r+";"}const Ope=/\d/;function Ipe(e,t,n){const r="&#"+String(e);return n&&t&&!Ope.test(String.fromCharCode(t))?r:r+";"}const Rpe=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],o0={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Ppe=["cent","copy","divide","gt","lt","not","para","times"],PB={}.hasOwnProperty,gC={};let ip;for(ip in o0)PB.call(o0,ip)&&(gC[o0[ip]]=ip);const Tpe=/[^\dA-Za-z]/;function jpe(e,t,n,r){const o=String.fromCharCode(e);if(PB.call(gC,o)){const i=gC[o],a="&"+i;return n&&Rpe.includes(i)&&!Ppe.includes(i)&&(!r||t&&t!==61&&Tpe.test(String.fromCharCode(t)))?a:a+";"}return""}function Mpe(e,t,n){let r=Npe(e,t,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=jpe(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){const i=Ipe(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return o&&(!n.useShortestReferences||o.length<r.length)?o:r}function Pc(e,t){return _pe(e,Object.assign({format:Mpe},t))}const Ape=/^>|^->|<!--|-->|--!>|<!-$/g,Lpe=[">"],Dpe=["<",">"];function zpe(e,t,n,r){return r.settings.bogusComments?"<?"+Pc(e.value,Object.assign({},r.settings.characterReferences,{subset:Lpe}))+">":"<!--"+e.value.replace(Ape,o)+"-->";function o(i){return Pc(i,Object.assign({},r.settings.characterReferences,{subset:Dpe}))}}function Bpe(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function rg(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}function TB(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function jB(e){return e.join(" ").trim()}const Fpe=/[ \t\n\f\r]/g;function Zv(e){return typeof e=="object"?e.type==="text"?JI(e.value):!1:JI(e)}function JI(e){return e.replace(Fpe,"")===""}const gr=AB(1),MB=AB(-1),Hpe=[];function AB(e){return t;function t(n,r,o){const i=n?n.children:Hpe;let a=(r||0)+e,s=i[a];if(!o)for(;s&&Zv(s);)a+=e,s=i[a];return s}}const Vpe={}.hasOwnProperty;function LB(e){return t;function t(n,r,o){return Vpe.call(e,n.tagName)&&e[n.tagName](n,r,o)}}const w1=LB({body:Kpe,caption:i0,colgroup:i0,dd:Xpe,dt:qpe,head:i0,html:Wpe,li:Gpe,optgroup:Ype,option:Qpe,p:Upe,rp:eR,rt:eR,tbody:Jpe,td:tR,tfoot:ehe,th:tR,thead:Zpe,tr:the});function i0(e,t,n){const r=gr(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Zv(r.value.charAt(0)))}function Wpe(e,t,n){const r=gr(n,t);return!r||r.type!=="comment"}function Kpe(e,t,n){const r=gr(n,t);return!r||r.type!=="comment"}function Upe(e,t,n){const r=gr(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Gpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&r.tagName==="li"}function qpe(e,t,n){const r=gr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Xpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function eR(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Ype(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Qpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Zpe(e,t,n){const r=gr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Jpe(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function ehe(e,t,n){return!gr(n,t)}function the(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function tR(e,t,n){const r=gr(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const nhe=LB({body:ihe,colgroup:ahe,head:ohe,html:rhe,tbody:she});function rhe(e){const t=gr(e,-1);return!t||t.type!=="comment"}function ohe(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function ihe(e){const t=gr(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Zv(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function ahe(e,t,n){const r=MB(n,t),o=gr(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&w1(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function she(e,t,n){const r=MB(n,t),o=gr(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&w1(r,n.children.indexOf(r),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const ap={name:[[`
|
|
460
460
|
\f\r &/=>`.split(""),`
|
|
461
461
|
\f\r "&'/=>\``.split("")],[`\0
|
|
462
462
|
\f\r "&'/<=>`.split(""),`\0
|
|
@@ -464,57 +464,57 @@ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}
|
|
|
464
464
|
\f\r &>`.split(""),`\0
|
|
465
465
|
\f\r "&'<=>\``.split("")],[`\0
|
|
466
466
|
\f\r "&'<=>\``.split(""),`\0
|
|
467
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function ahe(e,t,n,r){const o=r.schema,i=o.space==="svg"?!1:r.settings.omitOptionalTags;let a=o.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const s=[];let l;o.space==="html"&&e.tagName==="svg"&&(r.schema=mm);const c=she(r,e.properties),d=r.all(o.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=o,d&&(a=!1),(c||!i||!ehe(e,t,n))&&(s.push("<",e.tagName,c?" "+c:""),a&&(o.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(d),!a&&(!i||!w1(e,t,n))&&s.push("</"+e.tagName+">"),s.join("")}function she(e,t){const n=[];let r=-1,o;if(t){for(o in t)if(t[o]!==null&&t[o]!==void 0){const i=lhe(e,o,t[o]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function lhe(e,t,n){const r=IB(e.schema,t),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let a=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Pc(r.attribute,Object.assign({},e.settings.characterReferences,{subset:ap.name[o][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?TB:jB)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(s=Pc(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:ap.unquoted[o][i]}))),s!==n&&(e.settings.quoteSmart&&rg(n,a)>rg(n,e.alternative)&&(a=e.alternative),s=a+Pc(n,Object.assign({},e.settings.characterReferences,{subset:(a==="'"?ap.single:ap.double)[o][i],attribute:!0}))+a),l+(s&&"="+s))}const che=["<","&"];function DB(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Pc(e.value,Object.assign({},r.settings.characterReferences,{subset:che}))}function uhe(e,t,n,r){return r.settings.allowDangerousHtml?e.value:DB(e,t,n,r)}function dhe(e,t,n,r){return r.all(e)}const fhe=vpe("type",{invalid:mhe,unknown:phe,handlers:{comment:Lpe,doctype:Dpe,element:ahe,raw:uhe,root:dhe,text:DB}});function mhe(e){throw new Error("Expected node, not `"+e+"`")}function phe(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const hhe={},ghe={},vhe=[];function yhe(e,t){const n=t||hhe,r=n.quote||'"',o=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:bhe,all:xhe,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||lpe,characterReferences:n.characterReferences||ghe,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?mm:RB,quote:r,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function bhe(e,t,n){return fhe(e,t,n,this)}function xhe(e){const t=[],n=e&&e.children||vhe;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function og(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[o,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[o]=i:o===r&&Object.assign(n,i);return n}function bs(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function She(e){return Array.isArray(e)?e:[e]}async function zB(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function _1(e){return!e||["plaintext","txt","text","plain"].includes(e)}function BB(e){return e==="ansi"||_1(e)}function E1(e){return e==="none"}function FB(e){return E1(e)}function HB(e,t){var r;if(!t)return e;e.properties||(e.properties={}),(r=e.properties).class||(r.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const o of n)o&&!e.properties.class.includes(o)&&e.properties.class.push(o);return e}function Jv(e,t=!1){var i;if(e.length===0)return[["",0]];const n=e.split(/(\r?\n)/g);let r=0;const o=[];for(let a=0;a<n.length;a+=2){const s=t?n[a]+(n[a+1]||""):n[a];o.push([s,r]),r+=n[a].length,r+=((i=n[a+1])==null?void 0:i.length)||0}return o}function Che(e){const t=Jv(e,!0).map(([o])=>o);function n(o){if(o===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=o,a=0;for(const s of t){if(i<s.length)break;i-=s.length,a++}return{line:a,character:i}}function r(o,i){let a=0;for(let s=0;s<o;s++)a+=t[s].length;return a+=i,a}return{lines:t,indexToPos:n,posToIndex:r}}function whe(e,t,n){const r=new Set;for(const i of e.matchAll(/:?lang=["']([^"']+)["']/g)){const a=i[1].toLowerCase().trim();a&&r.add(a)}for(const i of e.matchAll(/(?:```|~~~)([\w-]+)/g)){const a=i[1].toLowerCase().trim();a&&r.add(a)}for(const i of e.matchAll(/\\begin\{([\w-]+)\}/g)){const a=i[1].toLowerCase().trim();a&&r.add(a)}for(const i of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){const a=i[1].toLowerCase().trim(),s=a.includes("/")?a.split("/").pop():a;s&&r.add(s)}if(!n)return Array.from(r);const o=n.getBundledLanguages();return Array.from(r).filter(i=>i&&o[i])}const $1="light-dark()",_he=["color","background-color"];function Ehe(e,t){let n=0;const r=[];for(const o of t)o>n&&r.push({...e,content:e.content.slice(n,o),offset:e.offset+n}),n=o;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function $he(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((r,o)=>r-o);return n.length?e.map(r=>r.flatMap(o=>{const i=n.filter(a=>o.offset<a&&a<o.offset+o.content.length).map(a=>a-o.offset).sort((a,s)=>a-s);return i.length?Ehe(o,i):o})):e}function khe(e,t,n,r,o="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(d=>ig(e.variants[d])),s=new Set(a.flatMap(d=>Object.keys(d))),l={},c=(d,f)=>{const m=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+t[d]+(f==="color"?"":m)};return a.forEach((d,f)=>{for(const m of s){const p=d[m]||"inherit";if(f===0&&r&&_he.includes(m))if(r===$1&&a.length>1){const h=t.findIndex(v=>v==="light"),b=t.findIndex(v=>v==="dark");if(h===-1||b===-1)throw new sr('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const x=a[h][m]||"inherit",g=a[b][m]||"inherit";l[m]=`light-dark(${x}, ${g})`,o==="css-vars"&&(l[c(f,m)]=p)}else l[m]=p;else o==="css-vars"&&(l[c(f,m)]=p)}}),i.htmlStyle=l,i}function ig(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&Xr.Italic&&(t["font-style"]="italic"),e.fontStyle&Xr.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&Xr.Underline&&n.push("underline"),e.fontStyle&Xr.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function vC(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}const VB=new WeakMap;function ey(e,t){VB.set(e,t)}function kf(e){return VB.get(e)}class Au{constructor(...t){Ae(this,"_stacks",{});Ae(this,"lang");if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,o]=t;this.lang=r,this._stacks={[o]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Au(Object.fromEntries(She(n).map(r=>[r,fC])),t)}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Nhe(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Nhe(e){const t=[],n=new Set;function r(o){var a;if(n.has(o))return;n.add(o);const i=(a=o==null?void 0:o.nameScopesList)==null?void 0:a.scopeName;i&&t.push(i),o.parent&&r(o.parent)}return r(e),t}function Ohe(e,t){if(!(e instanceof Au))throw new sr("Invalid grammar state");return e.getInternalStack(t)}function Ihe(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>n.source.length)throw new sr(`Invalid decoration offset: ${a}. Code length: ${n.source.length}`);return{...o.indexToPos(a),offset:a}}else{const s=o.lines[a.line];if(s===void 0)throw new sr(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${o.lines.length}`);let l=a.character;if(l<0&&(l=s.length+l),l<0||l>s.length)throw new sr(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${s.length}`);return{...a,character:l,offset:o.posToIndex(a.line,l)}}};const o=Che(n.source),i=(n.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));Rhe(i),e.set(n.meta,{decorations:i,converter:o,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var a;if(!((a=this.options.decorations)!=null&&a.length))return;const o=t(this).decorations.flatMap(s=>[s.start.offset,s.end.offset]);return $he(n,o)},code(n){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const r=t(this),o=Array.from(n.children).filter(f=>f.type==="element"&&f.tagName==="span");if(o.length!==r.converter.lines.length)throw new sr(`Number of lines in code element (${o.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(f,m,p,h){const b=o[f];let x="",g=-1,v=-1;if(m===0&&(g=0),p===0&&(v=0),p===Number.POSITIVE_INFINITY&&(v=b.children.length),g===-1||v===-1)for(let C=0;C<b.children.length;C++)x+=WB(b.children[C]),g===-1&&x.length===m&&(g=C+1),v===-1&&x.length===p&&(v=C+1);if(g===-1)throw new sr(`Failed to find start index for decoration ${JSON.stringify(h.start)}`);if(v===-1)throw new sr(`Failed to find end index for decoration ${JSON.stringify(h.end)}`);const S=b.children.slice(g,v);if(!h.alwaysWrap&&S.length===b.children.length)s(b,h,"line");else if(!h.alwaysWrap&&S.length===1&&S[0].type==="element")s(S[0],h,"token");else{const C={type:"element",tagName:"span",properties:{},children:S};s(C,h,"wrapper"),b.children.splice(g,S.length,C)}}function a(f,m){o[f]=s(o[f],m,"line")}function s(f,m,p){var x;const h=m.properties||{},b=m.transform||(g=>g);return f.tagName=m.tagName||"span",f.properties={...f.properties,...h,class:f.properties.class},(x=m.properties)!=null&&x.class&&HB(f,m.properties.class),f=b(f,p)||f,f}const l=[],c=r.decorations.sort((f,m)=>m.start.offset-f.start.offset||f.end.offset-m.end.offset);for(const f of c){const{start:m,end:p}=f;if(m.line===p.line)i(m.line,m.character,p.character,f);else if(m.line<p.line){i(m.line,m.character,Number.POSITIVE_INFINITY,f);for(let h=m.line+1;h<p.line;h++)l.unshift(()=>a(h,f));i(p.line,0,p.character,f)}}l.forEach(f=>f())}}}function Rhe(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new sr(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const o=e[r],i=n.start.offset<=o.start.offset&&o.start.offset<n.end.offset,a=n.start.offset<o.end.offset&&o.end.offset<=n.end.offset,s=o.start.offset<=n.start.offset&&n.start.offset<o.end.offset,l=o.start.offset<n.end.offset&&n.end.offset<=o.end.offset;if(i||a||s||l){if(i&&a||s&&l||s&&n.start.offset===n.end.offset||a&&o.start.offset===o.end.offset)continue;throw new sr(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(o.start)} intersect.`)}}}}function WB(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(WB).join(""):""}const Phe=[Ihe()];function ag(e){const t=The(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Phe]}function The(e){const t=[],n=[],r=[];for(const o of e)switch(o.enforce){case"pre":t.push(o);break;case"post":n.push(o);break;default:r.push(o)}return{pre:t,post:n,normal:r}}var Xs=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],a0={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function jhe(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const r=e.indexOf("m",n);if(r!==-1)return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function nR(e){const t=e.shift();if(t==="2"){const n=e.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function Mhe(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)a0[r]&&t.push({type:"setDecoration",value:a0[r]});else if(r<=29){const o=a0[r-20];o&&(t.push({type:"resetDecoration",value:o}),o==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Xs[r-30]}});else if(r===38){const o=nR(e);o&&t.push({type:"setForegroundColor",value:o})}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Xs[r-40]}});else if(r===48){const o=nR(e);o&&t.push({type:"setBackgroundColor",value:o})}else r===49?t.push({type:"resetBackgroundColor"}):r===53?t.push({type:"setDecoration",value:"overline"}):r===55?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Xs[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Xs[r-100+8]}})}return t}function Ahe(){let e=null,t=null,n=new Set;return{parse(r){const o=[];let i=0;do{const a=jhe(r,i),s=a.sequence?r.substring(i,a.startPosition):r.substring(i);if(s.length>0&&o.push({value:s,foreground:e,background:t,decorations:new Set(n)}),a.sequence){const l=Mhe(a.sequence);for(const c of l)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}i=a.position}while(i<r.length);return o}}}var Lhe={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Dhe(e=Lhe){function t(s){return e[s]}function n(s){return`#${s.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function o(){if(r)return r;r=[];for(let c=0;c<Xs.length;c++)r.push(t(Xs[c]));let s=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let d=0;d<6;d++)for(let f=0;f<6;f++)r.push(n([s[c],s[d],s[f]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function i(s){return o()[s]}function a(s){switch(s.type){case"named":return t(s.name);case"rgb":return n(s.rgb);case"table":return i(s.index)}}return{value:a}}const zhe={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Bhe(e,t,n){const r=og(e,n),o=Jv(t),i=Object.fromEntries(Xs.map(l=>{var f;const c=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,d=(f=e.colors)==null?void 0:f[c];return[l,d||zhe[l]]})),a=Dhe(i),s=Ahe();return o.map(l=>s.parse(l[0]).map(c=>{let d,f;c.decorations.has("reverse")?(d=c.background?a.value(c.background):e.bg,f=c.foreground?a.value(c.foreground):e.fg):(d=c.foreground?a.value(c.foreground):e.fg,f=c.background?a.value(c.background):void 0),d=bs(d,r),f=bs(f,r),c.decorations.has("dim")&&(d=Fhe(d));let m=Xr.None;return c.decorations.has("bold")&&(m|=Xr.Bold),c.decorations.has("italic")&&(m|=Xr.Italic),c.decorations.has("underline")&&(m|=Xr.Underline),c.decorations.has("strikethrough")&&(m|=Xr.Strikethrough),{content:c.value,offset:l[1],color:d,bgColor:f,fontStyle:m}}))}function Fhe(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const r=t[1];if(r.length===8){const o=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${o}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const o=r[0],i=r[1],a=r[2],s=r[3],l=Math.round(Number.parseInt(`${s}${s}`,16)/2).toString(16).padStart(2,"0");return`#${o}${o}${i}${i}${a}${a}${l}`}else if(r.length===3){const o=r[0],i=r[1],a=r[2];return`#${o}${o}${i}${i}${a}${a}80`}}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function k1(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n,o=e.resolveLangAlias(n.lang||"text");if(_1(o)||E1(r))return Jv(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:a}=e.setTheme(r);if(o==="ansi")return Bhe(i,t,n);const s=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==s.name)throw new sr(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(i.name))throw new sr(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Vhe(t,s,i,a,n)}function Hhe(...e){if(e.length===2)return kf(e[1]);const[t,n,r={}]=e,{lang:o="text",theme:i=t.getLoadedThemes()[0]}=r;if(_1(o)||E1(i))throw new sr("Plain language does not have grammar state");if(o==="ansi")throw new sr("ANSI language does not have grammar state");const{theme:a,colorMap:s}=t.setTheme(i),l=t.getLanguage(o);return new Au(N1(n,l,a,s,r).stateStack,l.name,a.name)}function Vhe(e,t,n,r,o){const i=N1(e,t,n,r,o),a=new Au(i.stateStack,t.name,n.name);return ey(i.tokens,a),i.tokens}function N1(e,t,n,r,o){const i=og(n,o),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:s=500}=o,l=Jv(e);let c=o.grammarState?Ohe(o.grammarState,n.name)??fC:o.grammarContextCode!=null?N1(o.grammarContextCode,t,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:fC,d=[];const f=[];for(let m=0,p=l.length;m<p;m++){const[h,b]=l[m];if(h===""){d=[],f.push([]);continue}if(a>0&&h.length>=a){d=[],f.push([{content:h,offset:b,color:"",fontStyle:0}]);continue}let x,g,v;o.includeExplanation&&(x=t.tokenizeLine(h,c,s),g=x.tokens,v=0);const S=t.tokenizeLine2(h,c,s),C=S.tokens.length/2;for(let _=0;_<C;_++){const w=S.tokens[2*_],N=_+1<C?S.tokens[2*_+2]:h.length;if(w===N)continue;const k=S.tokens[2*_+1],E=bs(r[eu.getForeground(k)],i),$=eu.getFontStyle(k),O={content:h.substring(w,N),offset:b+w,color:E,fontStyle:$};if(o.includeExplanation){const R=[];if(o.includeExplanation!=="scopeName")for(const I of n.settings){let P;switch(typeof I.scope){case"string":P=I.scope.split(/,/).map(j=>j.trim());break;case"object":P=I.scope;break;default:continue}R.push({settings:I,selectors:P.map(j=>j.split(/ /))})}O.explanation=[];let T=0;for(;w+T<N;){const I=g[v],P=h.substring(I.startIndex,I.endIndex);T+=P.length,O.explanation.push({content:P,scopes:o.includeExplanation==="scopeName"?Whe(I.scopes):Khe(R,I.scopes)}),v+=1}}d.push(O)}f.push(d),d=[],c=S.ruleStack}return{tokens:f,stateStack:c}}function Whe(e){return e.map(t=>({scopeName:t}))}function Khe(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const i=t[r];n[r]={scopeName:i,themeMatches:Ghe(e,i,t.slice(0,r))}}return n}function rR(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function Uhe(e,t,n){if(!rR(e[e.length-1],t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)rR(e[r],n[o])&&(r-=1),o-=1;return r===-1}function Ghe(e,t,n){const r=[];for(const{selectors:o,settings:i}of e)for(const a of o)if(Uhe(a,t,n)){r.push(i);break}return r}function KB(e,t,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=r.map(l=>{const c=k1(e,t,{...n,theme:l.theme}),d=kf(c),f=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:d,theme:f}}),i=qhe(...o.map(l=>l.tokens)),a=i[0].map((l,c)=>l.map((d,f)=>{const m={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(m.explanation=d.explanation),i.forEach((p,h)=>{const{content:b,explanation:x,offset:g,...v}=p[c][f];m.variants[r[h].color]=v}),m})),s=o[0].state?new Au(Object.fromEntries(o.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),o[0].state.lang):void 0;return s&&ey(a,s),a}function qhe(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const o=e.map(l=>l[r]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const a=o.map(()=>0),s=o.map(l=>l[0]);for(;s.every(l=>l);){const l=Math.min(...s.map(c=>c.content.length));for(let c=0;c<n;c++){const d=s[c];d.content.length===l?(i[c].push(d),a[c]+=1,s[c]=o[c][a[c]]):(i[c].push({...d,content:d.content.slice(0,l)}),s[c]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}function sg(e,t,n){let r,o,i,a,s,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:d="--shiki-",colorsRendering:f="css-vars"}=n,m=Object.entries(n.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,v)=>g.color===c?-1:v.color===c?1:0);if(m.length===0)throw new sr("`themes` option must not be empty");const p=KB(e,t,n);if(l=kf(p),c&&$1!==c&&!m.find(g=>g.color===c))throw new sr(`\`themes\` option must contain the defaultColor key \`${c}\``);const h=m.map(g=>e.getTheme(g.theme)),b=m.map(g=>g.color);i=p.map(g=>g.map(v=>khe(v,b,d,c,f))),l&&ey(i,l);const x=m.map(g=>og(g.theme,n));o=oR(m,h,x,d,c,"fg",f),r=oR(m,h,x,d,c,"bg",f),a=`shiki-themes ${h.map(g=>g.name).join(" ")}`,s=c?void 0:[o,r].join(";")}else if("theme"in n){const c=og(n.theme,n);i=k1(e,t,n);const d=e.getTheme(n.theme);r=bs(d.bg,c),o=bs(d.fg,c),a=d.name,l=kf(i)}else throw new sr("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:o,bg:r,themeName:a,rootStyle:s,grammarState:l}}function oR(e,t,n,r,o,i,a){return e.map((s,l)=>{const c=bs(t[l][i],n[l])||"inherit",d=`${r+s.color}${i==="bg"?"-bg":""}:${c}`;if(l===0&&o){if(o===$1&&e.length>1){const f=e.findIndex(b=>b.color==="light"),m=e.findIndex(b=>b.color==="dark");if(f===-1||m===-1)throw new sr('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=bs(t[f][i],n[f])||"inherit",h=bs(t[m][i],n[m])||"inherit";return`light-dark(${p}, ${h});${d}`}return c}return a==="css-vars"?d:null}).filter(s=>!!s).join(";")}function lg(e,t,n,r={meta:{},options:n,codeToHast:(o,i)=>lg(e,o,i),codeToTokens:(o,i)=>sg(e,o,i)}){var h,b;let o=t;for(const x of ag(n))o=((h=x.preprocess)==null?void 0:h.call(r,o,n))||o;let{tokens:i,fg:a,bg:s,themeName:l,rootStyle:c,grammarState:d}=sg(e,o,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:m=!1}=n;f===!0?i=Yhe(i):f==="never"&&(i=Qhe(i)),m&&(i=Zhe(i));const p={...r,get source(){return o}};for(const x of ag(n))i=((b=x.tokens)==null?void 0:b.call(p,i))||i;return Xhe(i,{...n,fg:a,bg:s,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},p,d)}function Xhe(e,t,n,r=kf(e)){var b,x,g,v;const o=ag(t),i=[],a={type:"root",children:[]},{structure:s="classic",tabindex:l="0"}=t,c={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),l!==!1&&l!=null&&(c.tabindex=l.toString());for(const[S,C]of Object.entries(t.meta||{}))S.startsWith("_")||(c[S]=C);let d={type:"element",tagName:"pre",properties:c,children:[],data:t.data},f={type:"element",tagName:"code",properties:{},children:i};const m=[],p={...n,structure:s,addClassToHast:HB,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return a},get pre(){return d},get code(){return f},get lines(){return m}};if(e.forEach((S,C)=>{var N,k;C&&(s==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):s==="classic"&&i.push({type:"text",value:`
|
|
468
|
-
`}));let _={type:"element",tagName:"span",properties:{class:"line"},children:[]},w=0;for(const E of S){let $={type:"element",tagName:"span",properties:{...E.htmlAttrs},children:[{type:"text",value:E.content}]};const O=vC(E.htmlStyle||ig(E));O&&($.properties.style=O);for(const R of o)$=((N=R==null?void 0:R.span)==null?void 0:N.call(p,$,C+1,w,_,E))||$;s==="inline"?a.children.push($):s==="classic"&&_.children.push($),w+=E.content.length}if(s==="classic"){for(const E of o)_=((k=E==null?void 0:E.line)==null?void 0:k.call(p,_,C+1))||_;m.push(_),i.push(_)}else s==="inline"&&m.push(_)}),s==="classic"){for(const S of o)f=((b=S==null?void 0:S.code)==null?void 0:b.call(p,f))||f;d.children.push(f);for(const S of o)d=((x=S==null?void 0:S.pre)==null?void 0:x.call(p,d))||d;a.children.push(d)}else if(s==="inline"){const S=[];let C={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const N of a.children)N.type==="element"&&N.tagName==="br"?(S.push(C),C={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(N.type==="element"||N.type==="text")&&C.children.push(N);S.push(C);let w={type:"element",tagName:"code",properties:{},children:S};for(const N of o)w=((g=N==null?void 0:N.code)==null?void 0:g.call(p,w))||w;a.children=[];for(let N=0;N<w.children.length;N++){N>0&&a.children.push({type:"element",tagName:"br",properties:{},children:[]});const k=w.children[N];k.type==="element"&&a.children.push(...k.children)}}let h=a;for(const S of o)h=((v=S==null?void 0:S.root)==null?void 0:v.call(p,h))||h;return r&&ey(h,r),h}function Yhe(e){return e.map(t=>{const n=[];let r="",o;return t.forEach((i,a)=>{const l=!(i.fontStyle&&(i.fontStyle&Xr.Underline||i.fontStyle&Xr.Strikethrough));l&&i.content.match(/^\s+$/)&&t[a+1]?(o===void 0&&(o=i.offset),r+=i.content):r?(l?n.push({...i,offset:o,content:r+i.content}):n.push({content:r,offset:o},i),o=void 0,r=""):n.push(i)}),n})}function Qhe(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,o,i,a]=r;if(!o&&!a)return n;const s=[{...n,offset:n.offset+o.length,content:i}];return o&&s.unshift({content:o,offset:n.offset}),a&&s.push({content:a,offset:n.offset+o.length+i.length}),s}))}function Zhe(e){return e.map(t=>{const n=[];for(const r of t){if(n.length===0){n.push({...r});continue}const o=n[n.length-1],i=vC(o.htmlStyle||ig(o)),a=vC(r.htmlStyle||ig(r)),s=o.fontStyle&&(o.fontStyle&Xr.Underline||o.fontStyle&Xr.Strikethrough),l=r.fontStyle&&(r.fontStyle&Xr.Underline||r.fontStyle&Xr.Strikethrough);!s&&!l&&i===a?o.content+=r.content:n.push({...r})}return n})}const Jhe=yhe;function ege(e,t,n){var i;const r={meta:{},options:n,codeToHast:(a,s)=>lg(e,a,s),codeToTokens:(a,s)=>sg(e,a,s)};let o=Jhe(lg(e,t,n,r));for(const a of ag(n))o=((i=a.postprocess)==null?void 0:i.call(r,o,n))||o;return o}const iR={light:"#333333",dark:"#bbbbbb"},aR={light:"#fffffe",dark:"#1e1e1e"},sR="__shiki_resolved";function O1(e){var s,l,c,d,f;if(e!=null&&e[sR])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:r}=t;if(!n||!r){const m=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(s=m==null?void 0:m.settings)!=null&&s.foreground&&(r=m.settings.foreground),(l=m==null?void 0:m.settings)!=null&&l.background&&(n=m.settings.background),!r&&((c=t==null?void 0:t.colors)!=null&&c["editor.foreground"])&&(r=t.colors["editor.foreground"]),!n&&((d=t==null?void 0:t.colors)!=null&&d["editor.background"])&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?iR.light:iR.dark),n||(n=t.type==="light"?aR.light:aR.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const i=new Map;function a(m){var h;if(i.has(m))return i.get(m);o+=1;const p=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return(h=t.colorReplacements)!=null&&h[`#${p}`]?a(m):(i.set(m,p),p)}t.settings=t.settings.map(m=>{var x,g;const p=((x=m.settings)==null?void 0:x.foreground)&&!m.settings.foreground.startsWith("#"),h=((g=m.settings)==null?void 0:g.background)&&!m.settings.background.startsWith("#");if(!p&&!h)return m;const b={...m,settings:{...m.settings}};if(p){const v=a(m.settings.foreground);t.colorReplacements[v]=m.settings.foreground,b.settings.foreground=v}if(h){const v=a(m.settings.background);t.colorReplacements[v]=m.settings.background,b.settings.background=v}return b});for(const m of Object.keys(t.colors||{}))if((m==="editor.foreground"||m==="editor.background"||m.startsWith("terminal.ansi"))&&!((f=t.colors[m])!=null&&f.startsWith("#"))){const p=a(t.colors[m]);t.colorReplacements[p]=t.colors[m],t.colors[m]=p}return Object.defineProperty(t,sR,{enumerable:!1,writable:!1,value:!0}),t}async function UB(e){return Array.from(new Set((await Promise.all(e.filter(t=>!BB(t)).map(async t=>await zB(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function GB(e){return(await Promise.all(e.map(async n=>FB(n)?null:O1(await zB(n))))).filter(n=>!!n)}let tge=3;function nge(e,t=3){t>tge||console.trace(`[SHIKI DEPRECATE]: ${e}`)}let pc=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function qB(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new pc(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class rge extends spe{constructor(n,r,o,i={}){super(n);Ae(this,"_resolvedThemes",new Map);Ae(this,"_resolvedGrammars",new Map);Ae(this,"_langMap",new Map);Ae(this,"_langGraph",new Map);Ae(this,"_textmateThemeCache",new WeakMap);Ae(this,"_loadedThemesCache",null);Ae(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=o,this._alias=i,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=O1(n);return r.name&&(this._resolvedThemes.set(r.name,r),this._loadedThemesCache=null),r}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let r=this._textmateThemeCache.get(n);r||(r=Zh.createFromRawTheme(n),this._textmateThemeCache.set(n,r)),this._syncRegistry.setTheme(r)}getGrammar(n){return n=qB(n,this._alias),this._resolvedGrammars.get(n)}loadLanguage(n){var a,s,l,c;if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(d=>{var f;return(f=d.embeddedLangsLazy)==null?void 0:f.includes(n.name)}));this._resolver.addLanguage(n);const o={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,o);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(d=>{this._alias[d]=n.name}),this._loadedLanguagesCache=null,r.size)for(const d of r)this._resolvedGrammars.delete(d.name),this._loadedLanguagesCache=null,(s=(a=this._syncRegistry)==null?void 0:a._injectionGrammars)==null||s.delete(d.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(d.scopeName),this.loadLanguage(this._langMap.get(d.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const r=Array.from(this._langGraph.entries()),o=r.filter(([i,a])=>!a);if(o.length){const i=r.filter(([a,s])=>{if(!s)return!1;const l=s.embeddedLanguages||s.embeddedLangs;return l==null?void 0:l.some(c=>o.map(([d])=>d).includes(c))}).filter(a=>!o.includes(a));throw new pc(`Missing languages ${o.map(([a])=>`\`${a}\``).join(", ")}, required by ${i.map(([a])=>`\`${a}\``).join(", ")}`)}for(const[i,a]of r)this._resolver.addLanguage(a);for(const[i,a]of r)this.loadLanguage(a)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){this._langMap.set(n.name,n),this._langGraph.set(n.name,n);const r=n.embeddedLanguages??n.embeddedLangs;if(r)for(const o of r)this._langGraph.set(o,this._langMap.get(o))}}class oge{constructor(t,n){Ae(this,"_langs",new Map);Ae(this,"_scopeToLang",new Map);Ae(this,"_injections",new Map);Ae(this,"_onigLib");this._onigLib={createOnigScanner:r=>t.createScanner(r),createOnigString:r=>t.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let r=[];for(let o=1;o<=n.length;o++){const i=n.slice(0,o).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let td=0;function ige(e){td+=1,e.warnings!==!1&&td>=10&&td%10===0&&console.warn(`[Shiki] ${td} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new pc("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(O1),o=new oge(e.engine,n),i=new rge(o,r,n,e.langAlias);let a;function s(S){return qB(S,e.langAlias)}function l(S){g();const C=i.getGrammar(typeof S=="string"?S:S.name);if(!C)throw new pc(`Language \`${S}\` not found, you may need to load it first`);return C}function c(S){if(S==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};g();const C=i.getTheme(S);if(!C)throw new pc(`Theme \`${S}\` not found, you may need to load it first`);return C}function d(S){g();const C=c(S);a!==S&&(i.setTheme(C),a=S);const _=i.getColorMap();return{theme:C,colorMap:_}}function f(){return g(),i.getLoadedThemes()}function m(){return g(),i.getLoadedLanguages()}function p(...S){g(),i.loadLanguages(S.flat(1))}async function h(...S){return p(await UB(S))}function b(...S){g();for(const C of S.flat(1))i.loadTheme(C)}async function x(...S){return g(),b(await GB(S))}function g(){if(t)throw new pc("Shiki instance has been disposed")}function v(){t||(t=!0,i.dispose(),td-=1)}return{setTheme:d,getTheme:c,getLanguage:l,getLoadedThemes:f,getLoadedLanguages:m,resolveLangAlias:s,loadLanguage:h,loadLanguageSync:p,loadTheme:x,loadThemeSync:b,dispose:v,[Symbol.dispose]:v}}async function age(e){e.engine||nge("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([GB(e.themes||[]),UB(e.langs||[]),e.engine]);return ige({...e,themes:t,langs:n,engine:r})}async function sge(e){const t=await age(e);return{getLastGrammarState:(...n)=>Hhe(t,...n),codeToTokensBase:(n,r)=>k1(t,n,r),codeToTokensWithThemes:(n,r)=>KB(t,n,r),codeToTokens:(n,r)=>sg(t,n,r),codeToHast:(n,r)=>lg(t,n,r),codeToHtml:(n,r)=>ege(t,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function lge(e){const t=e.langs,n=e.themes,r=e.engine;async function o(i){function a(f){var m;if(typeof f=="string"){if(f=((m=i.langAlias)==null?void 0:m[f])||f,BB(f))return[];const p=t[f];if(!p)throw new sr(`Language \`${f}\` is not included in this bundle. You may want to load it from external source.`);return p}return f}function s(f){if(FB(f))return"none";if(typeof f=="string"){const m=n[f];if(!m)throw new sr(`Theme \`${f}\` is not included in this bundle. You may want to load it from external source.`);return m}return f}const l=(i.themes??[]).map(f=>s(f)),c=(i.langs??[]).map(f=>a(f)),d=await sge({engine:i.engine??r(),...i,themes:l,langs:c});return{...d,loadLanguage(...f){return d.loadLanguage(...f.map(a))},loadTheme(...f){return d.loadTheme(...f.map(s))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return o}function cge(e){let t;async function n(r={}){if(t){const o=await t;return await Promise.all([o.loadTheme(...r.themes||[]),o.loadLanguage(...r.langs||[])]),o}else{t=e({...r,themes:[],langs:[]});const o=await t;return await Promise.all([o.loadTheme(...r.themes||[]),o.loadLanguage(...r.langs||[])]),o}}return n}function uge(e,t){const n=cge(e);async function r(o,i){var l;const a=await n({langs:[i.lang],themes:"theme"in i?[i.theme]:Object.values(i.themes)}),s=await((l=t==null?void 0:t.guessEmbeddedLanguages)==null?void 0:l.call(t,o,i.lang,a));return s&&await a.loadLanguage(...s),a}return{getSingletonHighlighter(o){return n(o)},async codeToHtml(o,i){return(await r(o,i)).codeToHtml(o,i)},async codeToHast(o,i){return(await r(o,i)).codeToHast(o,i)},async codeToTokens(o,i){return(await r(o,i)).codeToTokens(o,i)},async codeToTokensBase(o,i){return(await r(o,i)).codeToTokensBase(o,i)},async codeToTokensWithThemes(o,i){return(await r(o,i)).codeToTokensWithThemes(o,i)},async getLastGrammarState(o,i){return(await n({langs:[i.lang],themes:[i.theme]})).getLastGrammarState(o,i)}}}const XB=[{id:"abap",name:"ABAP",import:()=>oe(()=>import("./abap-BdImnpbu.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>oe(()=>import("./actionscript-3-CfeIJUat.js"),[])},{id:"ada",name:"Ada",import:()=>oe(()=>import("./ada-bCR0ucgS.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>oe(()=>import("./angular-html-CU67Zn6k.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>oe(()=>import("./angular-ts-BwZT4LLn.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>oe(()=>import("./apache-Pmp26Uib.js"),[])},{id:"apex",name:"Apex",import:()=>oe(()=>import("./apex-D8_7TLub.js"),[])},{id:"apl",name:"APL",import:()=>oe(()=>import("./apl-dKokRX4l.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>oe(()=>import("./applescript-Co6uUVPk.js"),[])},{id:"ara",name:"Ara",import:()=>oe(()=>import("./ara-BRHolxvo.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>oe(()=>import("./asciidoc-Dv7Oe6Be.js"),[])},{id:"asm",name:"Assembly",import:()=>oe(()=>import("./asm-D_Q5rh1f.js"),[])},{id:"astro",name:"Astro",import:()=>oe(()=>import("./astro-CbQHKStN.js"),__vite__mapDeps([10,9,2,11,3,12,13]))},{id:"awk",name:"AWK",import:()=>oe(()=>import("./awk-DMzUqQB5.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>oe(()=>import("./ballerina-BFfxhgS-.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>oe(()=>import("./bat-BkioyH1T.js"),[])},{id:"beancount",name:"Beancount",import:()=>oe(()=>import("./beancount-k_qm7-4y.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>oe(()=>import("./berry-uYugtg8r.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>oe(()=>import("./bibtex-CHM0blh-.js"),[])},{id:"bicep",name:"Bicep",import:()=>oe(()=>import("./bicep-Bmn6On1c.js"),[])},{id:"blade",name:"Blade",import:()=>oe(()=>import("./blade-D4QpJJKB.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>oe(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18]))},{id:"c",name:"C",import:()=>oe(()=>import("./c-BIGW1oBm.js"),[])},{id:"c3",name:"C3",import:()=>oe(()=>import("./c3-VCDPK7BO.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>oe(()=>import("./cadence-Bv_4Rxtq.js"),[])},{id:"cairo",name:"Cairo",import:()=>oe(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20]))},{id:"clarity",name:"Clarity",import:()=>oe(()=>import("./clarity-D53aC0YG.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>oe(()=>import("./clojure-P80f7IUj.js"),[])},{id:"cmake",name:"CMake",import:()=>oe(()=>import("./cmake-D1j8_8rp.js"),[])},{id:"cobol",name:"COBOL",import:()=>oe(()=>import("./cobol-nwyudZeR.js"),__vite__mapDeps([21,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>oe(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>oe(()=>import("./codeql-DsOJ9woJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>oe(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>oe(()=>import("./common-lisp-Cg-RD9OK.js"),[])},{id:"coq",name:"Coq",import:()=>oe(()=>import("./coq-DkFqJrB1.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>oe(()=>import("./cpp-CofmeUqb.js"),__vite__mapDeps([23,24,25,26,16]))},{id:"crystal",name:"Crystal",import:()=>oe(()=>import("./crystal-tKQVLTB8.js"),__vite__mapDeps([27,1,2,3,16,26,28]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>oe(()=>import("./csharp-K5feNrxe.js"),[])},{id:"css",name:"CSS",import:()=>oe(()=>import("./css-DPfMkruS.js"),[])},{id:"csv",name:"CSV",import:()=>oe(()=>import("./csv-fuZLfV_i.js"),[])},{id:"cue",name:"CUE",import:()=>oe(()=>import("./cue-D82EKSYY.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>oe(()=>import("./cypher-COkxafJQ.js"),[])},{id:"d",name:"D",import:()=>oe(()=>import("./d-85-TOEBH.js"),[])},{id:"dart",name:"Dart",import:()=>oe(()=>import("./dart-CF10PKvl.js"),[])},{id:"dax",name:"DAX",import:()=>oe(()=>import("./dax-CEL-wOlO.js"),[])},{id:"desktop",name:"Desktop",import:()=>oe(()=>import("./desktop-BmXAJ9_W.js"),[])},{id:"diff",name:"Diff",import:()=>oe(()=>import("./diff-D97Zzqfu.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>oe(()=>import("./docker-BcOcwvcX.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>oe(()=>import("./dotenv-Da5cRb03.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>oe(()=>import("./dream-maker-BtqSS_iP.js"),[])},{id:"edge",name:"Edge",import:()=>oe(()=>import("./edge-BkV0erSs.js"),__vite__mapDeps([29,11,1,2,3,15]))},{id:"elixir",name:"Elixir",import:()=>oe(()=>import("./elixir-CDX3lj18.js"),__vite__mapDeps([30,1,2,3]))},{id:"elm",name:"Elm",import:()=>oe(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>oe(()=>import("./emacs-lisp-C9XAeP06.js"),[])},{id:"erb",name:"ERB",import:()=>oe(()=>import("./erb-BOJIQeun.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38]))},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>oe(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40]))},{id:"fennel",name:"Fennel",import:()=>oe(()=>import("./fennel-BYunw83y.js"),[])},{id:"fish",name:"Fish",import:()=>oe(()=>import("./fish-BvzEVeQv.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>oe(()=>import("./fluent-C4IJs8-o.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>oe(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42]))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>oe(()=>import("./fortran-free-form-BxgE0vQu.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>oe(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40]))},{id:"gdresource",name:"GDResource",import:()=>oe(()=>import("./gdresource-B7Tvp0Sc.js"),__vite__mapDeps([44,45,46]))},{id:"gdscript",name:"GDScript",import:()=>oe(()=>import("./gdscript-DTMYz4Jt.js"),[])},{id:"gdshader",name:"GDShader",import:()=>oe(()=>import("./gdshader-DkwncUOv.js"),[])},{id:"genie",name:"Genie",import:()=>oe(()=>import("./genie-D0YGMca9.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>oe(()=>import("./gherkin-DyxjwDmM.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>oe(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>oe(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28]))},{id:"gleam",name:"Gleam",import:()=>oe(()=>import("./gleam-BspZqrRM.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>oe(()=>import("./glimmer-js-Rg0-pVw9.js"),__vite__mapDeps([50,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>oe(()=>import("./glimmer-ts-U6CK756n.js"),__vite__mapDeps([51,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>oe(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26]))},{id:"gn",name:"GN",import:()=>oe(()=>import("./gn-n2N0HUVH.js"),[])},{id:"gnuplot",name:"Gnuplot",import:()=>oe(()=>import("./gnuplot-DdkO51Og.js"),[])},{id:"go",name:"Go",import:()=>oe(()=>import("./go-Dn2_MT6a.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>oe(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13]))},{id:"groovy",name:"Groovy",import:()=>oe(()=>import("./groovy-gcz8RCvz.js"),[])},{id:"hack",name:"Hack",import:()=>oe(()=>import("./hack-CaT9iCJl.js"),__vite__mapDeps([52,1,2,3,16]))},{id:"haml",name:"Ruby Haml",import:()=>oe(()=>import("./haml-B8DHNrY2.js"),__vite__mapDeps([34,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>oe(()=>import("./handlebars-BL8al0AC.js"),__vite__mapDeps([53,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>oe(()=>import("./haskell-Df6bDoY_.js"),[])},{id:"haxe",name:"Haxe",import:()=>oe(()=>import("./haxe-CzTSHFRz.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>oe(()=>import("./hcl-BWvSN4gD.js"),[])},{id:"hjson",name:"Hjson",import:()=>oe(()=>import("./hjson-D5-asLiD.js"),[])},{id:"hlsl",name:"HLSL",import:()=>oe(()=>import("./hlsl-D3lLCCz7.js"),[])},{id:"html",name:"HTML",import:()=>oe(()=>import("./html-GMplVEZG.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>oe(()=>import("./html-derivative-BFtXZ54Q.js"),__vite__mapDeps([15,1,2,3]))},{id:"http",name:"HTTP",import:()=>oe(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13]))},{id:"hurl",name:"Hurl",import:()=>oe(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56]))},{id:"hxml",name:"HXML",import:()=>oe(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58]))},{id:"hy",name:"Hy",import:()=>oe(()=>import("./hy-DFXneXwc.js"),[])},{id:"imba",name:"Imba",import:()=>oe(()=>import("./imba-DGztddWO.js"),[])},{id:"ini",name:"INI",aliases:["properties"],import:()=>oe(()=>import("./ini-BEwlwnbL.js"),[])},{id:"java",name:"Java",import:()=>oe(()=>import("./java-CylS5w8V.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>oe(()=>import("./javascript-wDzz0qaB.js"),[])},{id:"jinja",name:"Jinja",import:()=>oe(()=>import("./jinja-4LBKfQ-Z.js"),__vite__mapDeps([59,1,2,3]))},{id:"jison",name:"Jison",import:()=>oe(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2]))},{id:"json",name:"JSON",import:()=>oe(()=>import("./json-Cp-IABpG.js"),[])},{id:"json5",name:"JSON5",import:()=>oe(()=>import("./json5-C9tS-k6U.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>oe(()=>import("./jsonc-Des-eS-w.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>oe(()=>import("./jsonl-DcaNXYhu.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>oe(()=>import("./jsonnet-DFQXde-d.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>oe(()=>import("./jssm-C2t-YnRu.js"),[])},{id:"jsx",name:"JSX",import:()=>oe(()=>import("./jsx-g9-lgVsj.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>oe(()=>import("./julia-CxzCAyBv.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62]))},{id:"kdl",name:"KDL",import:()=>oe(()=>import("./kdl-DV7GczEv.js"),[])},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>oe(()=>import("./kotlin-BdnUsdx6.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>oe(()=>import("./kusto-DZf3V79B.js"),[])},{id:"latex",name:"LaTeX",import:()=>oe(()=>import("./latex-B4uzh10-.js"),__vite__mapDeps([63,64,62]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>oe(()=>import("./lean-BZvkOJ9d.js"),[])},{id:"less",name:"Less",import:()=>oe(()=>import("./less-B1dDrJ26.js"),[])},{id:"liquid",name:"Liquid",import:()=>oe(()=>import("./liquid-DYVedYrR.js"),__vite__mapDeps([65,1,2,3,9]))},{id:"llvm",name:"LLVM IR",import:()=>oe(()=>import("./llvm-BtvRca6l.js"),[])},{id:"log",name:"Log file",import:()=>oe(()=>import("./log-2UxHyX5q.js"),[])},{id:"logo",name:"Logo",import:()=>oe(()=>import("./logo-BtOb2qkB.js"),[])},{id:"lua",name:"Lua",import:()=>oe(()=>import("./lua-BbnMAYS6.js"),__vite__mapDeps([37,26]))},{id:"luau",name:"Luau",import:()=>oe(()=>import("./luau-C-HG3fhB.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>oe(()=>import("./make-CHLpvVh8.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>oe(()=>import("./markdown-Cvjx9yec.js"),[])},{id:"marko",name:"Marko",import:()=>oe(()=>import("./marko-DZsq8hO1.js"),__vite__mapDeps([66,3,67,5,11]))},{id:"matlab",name:"MATLAB",import:()=>oe(()=>import("./matlab-D7o27uSR.js"),[])},{id:"mdc",name:"MDC",import:()=>oe(()=>import("./mdc-DUICxH0z.js"),__vite__mapDeps([68,40,38,15,1,2,3]))},{id:"mdx",name:"MDX",import:()=>oe(()=>import("./mdx-Cmh6b_Ma.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>oe(()=>import("./mermaid-mWjccvbQ.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>oe(()=>import("./mipsasm-CKIfxQSi.js"),[])},{id:"mojo",name:"Mojo",import:()=>oe(()=>import("./mojo-B93PlW-d.js"),[])},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>oe(()=>import("./moonbit-Ba13S78F.js"),[])},{id:"move",name:"Move",import:()=>oe(()=>import("./move-Bu9oaDYs.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>oe(()=>import("./narrat-DRg8JJMk.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>oe(()=>import("./nextflow-BrzmwbiE.js"),[])},{id:"nginx",name:"Nginx",import:()=>oe(()=>import("./nginx-DknmC5AR.js"),__vite__mapDeps([69,37,26]))},{id:"nim",name:"Nim",import:()=>oe(()=>import("./nim-CVrawwO9.js"),__vite__mapDeps([70,26,1,2,3,7,8,25,40]))},{id:"nix",name:"Nix",import:()=>oe(()=>import("./nix-CwoSXNpI.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>oe(()=>import("./nushell-C-sUppwS.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>oe(()=>import("./objective-c-DXmwc3jG.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>oe(()=>import("./objective-cpp-CLxacb5B.js"),[])},{id:"ocaml",name:"OCaml",import:()=>oe(()=>import("./ocaml-C0hk2d4L.js"),[])},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>oe(()=>import("./openscad-C4EeE6gA.js"),[])},{id:"pascal",name:"Pascal",import:()=>oe(()=>import("./pascal-D93ZcfNL.js"),[])},{id:"perl",name:"Perl",import:()=>oe(()=>import("./perl-C0TMdlhV.js"),__vite__mapDeps([71,1,2,3,7,8,16]))},{id:"php",name:"PHP",import:()=>oe(()=>import("./php-CDn_0X-4.js"),__vite__mapDeps([72,1,2,3,7,8,16,9]))},{id:"pkl",name:"Pkl",import:()=>oe(()=>import("./pkl-u5AG7uiY.js"),[])},{id:"plsql",name:"PL/SQL",import:()=>oe(()=>import("./plsql-ChMvpjG-.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>oe(()=>import("./po-BTJTHyun.js"),[])},{id:"polar",name:"Polar",import:()=>oe(()=>import("./polar-C0HS_06l.js"),[])},{id:"postcss",name:"PostCSS",import:()=>oe(()=>import("./postcss-CXtECtnM.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>oe(()=>import("./powerquery-CEu0bR-o.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>oe(()=>import("./powershell-Dpen1YoG.js"),[])},{id:"prisma",name:"Prisma",import:()=>oe(()=>import("./prisma-Dd19v3D-.js"),[])},{id:"prolog",name:"Prolog",import:()=>oe(()=>import("./prolog-CbFg5uaA.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>oe(()=>import("./proto-C7zT0LnQ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>oe(()=>import("./pug-CGlum2m_.js"),__vite__mapDeps([73,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>oe(()=>import("./puppet-BMWR74SV.js"),[])},{id:"purescript",name:"PureScript",import:()=>oe(()=>import("./purescript-CklMAg4u.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>oe(()=>import("./python-B6aJPvgy.js"),[])},{id:"qml",name:"QML",import:()=>oe(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([74,2]))},{id:"qmldir",name:"QML Directory",import:()=>oe(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>oe(()=>import("./qss-IeuSbFQv.js"),[])},{id:"r",name:"R",import:()=>oe(()=>import("./r-Dspwwk_N.js"),[])},{id:"racket",name:"Racket",import:()=>oe(()=>import("./racket-BqYA7rlc.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>oe(()=>import("./raku-DXvB9xmW.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>oe(()=>import("./razor-C1TweQQi.js"),__vite__mapDeps([75,1,2,3,76]))},{id:"reg",name:"Windows Registry Script",import:()=>oe(()=>import("./reg-C-SQnVFl.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>oe(()=>import("./regexp-CDVJQ6XC.js"),[])},{id:"rel",name:"Rel",import:()=>oe(()=>import("./rel-C3B-1QV4.js"),[])},{id:"riscv",name:"RISC-V",import:()=>oe(()=>import("./riscv-BM1_JUlF.js"),[])},{id:"rosmsg",name:"ROS Interface",import:()=>oe(()=>import("./rosmsg-BJDFO7_C.js"),[])},{id:"rst",name:"reStructuredText",import:()=>oe(()=>import("./rst-B0xPkSld.js"),__vite__mapDeps([77,15,1,2,3,23,24,25,26,16,20,28,38,78,33,34,7,8,35,11,36,13,37]))},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>oe(()=>import("./ruby-BvKwtOVI.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38]))},{id:"rust",name:"Rust",aliases:["rs"],import:()=>oe(()=>import("./rust-B1yitclQ.js"),[])},{id:"sas",name:"SAS",import:()=>oe(()=>import("./sas-cz2c8ADy.js"),__vite__mapDeps([79,16]))},{id:"sass",name:"Sass",import:()=>oe(()=>import("./sass-Cj5Yp3dK.js"),[])},{id:"scala",name:"Scala",import:()=>oe(()=>import("./scala-C151Ov-r.js"),[])},{id:"scheme",name:"Scheme",import:()=>oe(()=>import("./scheme-C98Dy4si.js"),[])},{id:"scss",name:"SCSS",import:()=>oe(()=>import("./scss-OYdSNvt2.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>oe(()=>import("./sdbl-DVxCFoDh.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>oe(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([80,81]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>oe(()=>import("./shellscript-Yzrsuije.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>oe(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([82,28]))},{id:"smalltalk",name:"Smalltalk",import:()=>oe(()=>import("./smalltalk-BERRCDM3.js"),[])},{id:"solidity",name:"Solidity",import:()=>oe(()=>import("./solidity-rGO070M0.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>oe(()=>import("./soy-Brmx7dQM.js"),__vite__mapDeps([83,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>oe(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([84,85]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>oe(()=>import("./splunk-BtCnVYZw.js"),[])},{id:"sql",name:"SQL",import:()=>oe(()=>import("./sql-BLtJtn59.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>oe(()=>import("./ssh-config-_ykCGR6B.js"),[])},{id:"stata",name:"Stata",import:()=>oe(()=>import("./stata-BH5u7GGu.js"),__vite__mapDeps([86,16]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>oe(()=>import("./stylus-BEDo0Tqx.js"),[])},{id:"svelte",name:"Svelte",import:()=>oe(()=>import("./svelte-zxCyuUbr.js"),__vite__mapDeps([87,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>oe(()=>import("./swift-Dg5xB15N.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>oe(()=>import("./system-verilog-CnnmHF94.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>oe(()=>import("./systemd-4A_iFExJ.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>oe(()=>import("./talonscript-CkByrt1z.js"),[])},{id:"tasl",name:"Tasl",import:()=>oe(()=>import("./tasl-QIJgUcNo.js"),[])},{id:"tcl",name:"Tcl",import:()=>oe(()=>import("./tcl-dwOrl1Do.js"),[])},{id:"templ",name:"Templ",import:()=>oe(()=>import("./templ-W15q3VgB.js"),__vite__mapDeps([88,89,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>oe(()=>import("./terraform-BETggiCN.js"),[])},{id:"tex",name:"TeX",import:()=>oe(()=>import("./tex-CvyZ59Mk.js"),__vite__mapDeps([64,62]))},{id:"toml",name:"TOML",import:()=>oe(()=>import("./toml-vGWfd6FD.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>oe(()=>import("./ts-tags-zn1MmPIZ.js"),__vite__mapDeps([90,11,3,2,25,26,1,16,7,8]))},{id:"tsv",name:"TSV",import:()=>oe(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>oe(()=>import("./tsx-COt5Ahok.js"),[])},{id:"turtle",name:"Turtle",import:()=>oe(()=>import("./turtle-BsS91CYL.js"),[])},{id:"twig",name:"Twig",import:()=>oe(()=>import("./twig-CO9l9SDP.js"),__vite__mapDeps([91,3,2,5,72,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38]))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>oe(()=>import("./typescript-BPQ3VLAy.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>oe(()=>import("./typespec-BGHnOYBU.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>oe(()=>import("./typst-DHCkPAjA.js"),[])},{id:"v",name:"V",import:()=>oe(()=>import("./v-BcVCzyr7.js"),[])},{id:"vala",name:"Vala",import:()=>oe(()=>import("./vala-CsfeWuGM.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>oe(()=>import("./vb-D17OF-Vu.js"),[])},{id:"verilog",name:"Verilog",import:()=>oe(()=>import("./verilog-BQ8w6xss.js"),[])},{id:"vhdl",name:"VHDL",import:()=>oe(()=>import("./vhdl-CeAyd5Ju.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>oe(()=>import("./viml-CJc9bBzg.js"),[])},{id:"vue",name:"Vue",import:()=>oe(()=>import("./vue-DN_0RTcg.js"),__vite__mapDeps([92,3,2,11,9,1,15]))},{id:"vue-html",name:"Vue HTML",import:()=>oe(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([93,2]))},{id:"vue-vine",name:"Vue Vine",import:()=>oe(()=>import("./vue-vine-CQOfvN7w.js"),__vite__mapDeps([94,3,5,67,95,12,2]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>oe(()=>import("./vyper-CDx5xZoG.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>oe(()=>import("./wasm-MzD3tlZU.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>oe(()=>import("./wenyan-BV7otONQ.js"),[])},{id:"wgsl",name:"WGSL",import:()=>oe(()=>import("./wgsl-Dx-B1_4e.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>oe(()=>import("./wikitext-BhOHFoWU.js"),[])},{id:"wit",name:"WebAssembly Interface Types",import:()=>oe(()=>import("./wit-5i3qLPDT.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>oe(()=>import("./wolfram-lXgVvXCa.js"),[])},{id:"xml",name:"XML",import:()=>oe(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>oe(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([96,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>oe(()=>import("./yaml-Buea-lGh.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>oe(()=>import("./zenscript-DVFEvuxE.js"),[])},{id:"zig",name:"Zig",import:()=>oe(()=>import("./zig-VOosw3JB.js"),[])}],dge=Object.fromEntries(XB.map(e=>[e.id,e.import])),fge=Object.fromEntries(XB.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),mge={...dge,...fge},pge=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>oe(()=>import("./andromeeda-C-Jbm3Hp.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>oe(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>oe(()=>import("./ayu-dark-CmMr59Fi.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>oe(()=>import("./catppuccin-frappe-DFWUc33u.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>oe(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>oe(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>oe(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>oe(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>oe(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>oe(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>oe(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>oe(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>oe(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>oe(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>oe(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>oe(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>oe(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>oe(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>oe(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>oe(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[])},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>oe(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[])},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>oe(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[])},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>oe(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[])},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>oe(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[])},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>oe(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>oe(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>oe(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>oe(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>oe(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>oe(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>oe(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>oe(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>oe(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>oe(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>oe(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>oe(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>oe(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>oe(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>oe(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>oe(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>oe(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>oe(()=>import("./one-dark-pro-DVMEJ2y_.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>oe(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>oe(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>oe(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>oe(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>oe(()=>import("./rose-pine-qdsjHGoJ.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>oe(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>oe(()=>import("./rose-pine-moon-D4_iv3hh.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>oe(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>oe(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>oe(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>oe(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>oe(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>oe(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>oe(()=>import("./tokyo-night-hegEt444.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>oe(()=>import("./vesper-DU1UobuO.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>oe(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>oe(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>oe(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],hge=Object.fromEntries(pge.map(e=>[e.id,e.import]));class I1 extends Error{constructor(t){super(t),this.name="ShikiError"}}function gge(){return 2147483648}function vge(){return typeof performance<"u"?performance.now():Date.now()}const yge=(e,t)=>e+(t-e%t)%t;async function bge(e){let t,n;const r={};function o(p){n=p,r.HEAPU8=new Uint8Array(p),r.HEAPU32=new Uint32Array(p)}function i(p,h,b){r.HEAPU8.copyWithin(p,h,h+b)}function a(p){try{return t.grow(p-n.byteLength+65535>>>16),o(t.buffer),1}catch{}}function s(p){const h=r.HEAPU8.length;p=p>>>0;const b=gge();if(p>b)return!1;for(let x=1;x<=4;x*=2){let g=h*(1+.2/x);g=Math.min(g,p+100663296);const v=Math.min(b,yge(Math.max(p,g),65536));if(a(v))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(p,h,b=1024){const x=h+b;let g=h;for(;p[g]&&!(g>=x);)++g;if(g-h>16&&p.buffer&&l)return l.decode(p.subarray(h,g));let v="";for(;h<g;){let S=p[h++];if(!(S&128)){v+=String.fromCharCode(S);continue}const C=p[h++]&63;if((S&224)===192){v+=String.fromCharCode((S&31)<<6|C);continue}const _=p[h++]&63;if((S&240)===224?S=(S&15)<<12|C<<6|_:S=(S&7)<<18|C<<12|_<<6|p[h++]&63,S<65536)v+=String.fromCharCode(S);else{const w=S-65536;v+=String.fromCharCode(55296|w>>10,56320|w&1023)}}return v}function d(p,h){return p?c(r.HEAPU8,p,h):""}const f={emscripten_get_now:vge,emscripten_memcpy_big:i,emscripten_resize_heap:s,fd_write:()=>0};async function m(){const h=await e({env:f,wasi_snapshot_preview1:f});t=h.memory,o(t.buffer),Object.assign(r,h),r.UTF8ToString=d}return await m(),r}var xge=Object.defineProperty,Sge=(e,t,n)=>t in e?xge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mr=(e,t,n)=>Sge(e,typeof t!="symbol"?t+"":t,n);let Sr=null;function Cge(e){throw new I1(e.UTF8ToString(e.getLastOnigError()))}class ty{constructor(t){mr(this,"utf16Length"),mr(this,"utf8Length"),mr(this,"utf16Value"),mr(this,"utf8Value"),mr(this,"utf16OffsetToUtf8"),mr(this,"utf8OffsetToUtf16");const n=t.length,r=ty._utf8ByteLength(t),o=r!==n,i=o?new Uint32Array(n+1):null;o&&(i[n]=r);const a=o?new Uint32Array(r+1):null;o&&(a[r]=n);const s=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const d=t.charCodeAt(c);let f=d,m=!1;if(d>=55296&&d<=56319&&c+1<n){const p=t.charCodeAt(c+1);p>=56320&&p<=57343&&(f=(d-55296<<10)+65536|p-56320,m=!0)}o&&(i[c]=l,m&&(i[c+1]=l),f<=127?a[l+0]=c:f<=2047?(a[l+0]=c,a[l+1]=c):f<=65535?(a[l+0]=c,a[l+1]=c,a[l+2]=c):(a[l+0]=c,a[l+1]=c,a[l+2]=c,a[l+3]=c)),f<=127?s[l++]=f:f<=2047?(s[l++]=192|(f&1984)>>>6,s[l++]=128|(f&63)>>>0):f<=65535?(s[l++]=224|(f&61440)>>>12,s[l++]=128|(f&4032)>>>6,s[l++]=128|(f&63)>>>0):(s[l++]=240|(f&1835008)>>>18,s[l++]=128|(f&258048)>>>12,s[l++]=128|(f&4032)>>>6,s[l++]=128|(f&63)>>>0),m&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=a}static _utf8ByteLength(t){let n=0;for(let r=0,o=t.length;r<o;r++){const i=t.charCodeAt(r);let a=i,s=!1;if(i>=55296&&i<=56319&&r+1<o){const l=t.charCodeAt(r+1);l>=56320&&l<=57343&&(a=(i-55296<<10)+65536|l-56320,s=!0)}a<=127?n+=1:a<=2047?n+=2:a<=65535?n+=3:n+=4,s&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const ny=class Bi{constructor(t){if(mr(this,"id",++Bi.LAST_ID),mr(this,"_onigBinding"),mr(this,"content"),mr(this,"utf16Length"),mr(this,"utf8Length"),mr(this,"utf16OffsetToUtf8"),mr(this,"utf8OffsetToUtf16"),mr(this,"ptr"),!Sr)throw new I1("Must invoke loadWasm first.");this._onigBinding=Sr,this.content=t;const n=new ty(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!Bi._sharedPtrInUse?(Bi._sharedPtr||(Bi._sharedPtr=Sr.omalloc(1e4)),Bi._sharedPtrInUse=!0,Sr.HEAPU8.set(n.utf8Value,Bi._sharedPtr),this.ptr=Bi._sharedPtr):this.ptr=n.createString(Sr)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===Bi._sharedPtr?Bi._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};mr(ny,"LAST_ID",0);mr(ny,"_sharedPtr",0);mr(ny,"_sharedPtrInUse",!1);let YB=ny;class wge{constructor(t){if(mr(this,"_onigBinding"),mr(this,"_ptr"),!Sr)throw new I1("Must invoke loadWasm first.");const n=[],r=[];for(let s=0,l=t.length;s<l;s++){const c=new ty(t[s]);n[s]=c.createString(Sr),r[s]=c.utf8Length}const o=Sr.omalloc(4*t.length);Sr.HEAPU32.set(n,o/4);const i=Sr.omalloc(4*t.length);Sr.HEAPU32.set(r,i/4);const a=Sr.createOnigScanner(o,i,t.length);for(let s=0,l=t.length;s<l;s++)Sr.ofree(n[s]);Sr.ofree(i),Sr.ofree(o),a===0&&Cge(Sr),this._onigBinding=Sr,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let o=0;if(typeof r=="number"&&(o=r),typeof t=="string"){t=new YB(t);const i=this._findNextMatchSync(t,n,!1,o);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,o)}_findNextMatchSync(t,n,r,o){const i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),o);if(a===0)return null;const s=i.HEAPU32;let l=a/4;const c=s[l++],d=s[l++],f=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(s[l++]),h=t.convertUtf8OffsetToUtf16(s[l++]);f[m]={start:p,end:h,length:h-p}}return{index:c,captureIndices:f}}}function _ge(e){return typeof e.instantiator=="function"}function Ege(e){return typeof e.default=="function"}function $ge(e){return typeof e.data<"u"}function kge(e){return typeof Response<"u"&&e instanceof Response}function Nge(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let sp;function Oge(e){if(sp)return sp;async function t(){Sr=await bge(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),_ge(r)?r=await r.instantiator(n):Ege(r)?r=await r.default(n):($ge(r)&&(r=r.data),kge(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Ige(r)(n):r=await Rge(r)(n):Nge(r)?r=await s0(r)(n):r instanceof WebAssembly.Module?r=await s0(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await s0(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return sp=t(),sp}function s0(e){return t=>WebAssembly.instantiate(e,t)}function Ige(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Rge(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function Pge(e){return e&&await Oge(e),{createScanner(t){return new wge(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new YB(t)}}}const Tge=lge({langs:mge,themes:hge,engine:()=>Pge(oe(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:jge}=uge(Tge,{guessEmbeddedLanguages:whe});function wo({code:e,lang:t="json",showLineNumbers:n=!1,hideHeader:r=!1}){const[o,i]=u.useState(""),[a,s]=u.useState(!1),l=vl(y1),c=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)}catch(f){console.error("Failed to copy code:",f)}},d=f=>{const m=f.toLowerCase(),h={js:"javascript-plain",javascript:"javascript-plain",ts:"typescript-plain",typescript:"typescript-plain",html:"html5-plain",css:"css3-plain",python:"python-plain",py:"python-plain",java:"java-plain",cpp:"cplusplus-plain",c:"c-plain",csharp:"csharp-plain",cs:"csharp-plain",go:"go-original-wordmark",rust:"rust-original",rs:"rust-original",php:"php-plain",ruby:"ruby-plain",rb:"ruby-plain",swift:"swift-plain",kotlin:"kotlin-plain",kt:"kotlin-plain",scala:"scala-plain",shell:"bash-plain",sh:"bash-plain",bash:"bash-plain",sql:"sqlline-plain",json:"json-plain",yaml:"yaml-plain",yml:"yaml-plain",markdown:"markdown-original",md:"markdown-original",docker:"docker-plain",dockerfile:"docker-plain",react:"react-original",jsx:"react-original",tsx:"react-original",vue:"vuejs-plain",angular:"angularjs-plain",sass:"sass-original",scss:"sass-original",less:"less-plain-wordmark",stylus:"stylus-plain",mongodb:"mongodb-plain",mysql:"mysql-plain",postgresql:"postgresql-plain",redis:"redis-plain",git:"git-plain",npm:"npm-original-wordmark",yarn:"yarn-plain",nginx:"nginx-original",bash_profile:"bash-plain"}[m]||"code-plain";return y.jsx("i",{className:`devicon-${h} colored`,style:{fontSize:"14px"}})};return u.useEffect(()=>{let f=!0;const m=l==="dark"||l==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches;return jge(e,{lang:t,theme:m?"github-dark":"github-light",transformers:n?[{name:"line-numbers",line(p,h){p.children.unshift({type:"element",tagName:"span",properties:{class:"line-number",style:"display: inline-block; width: 2rem; margin-right: 1rem; text-align: right; color: #9ca3af; user-select: none;"},children:[{type:"text",value:String(h)}]})}}]:[]}).then(p=>{f&&i(p)}),()=>{f=!1}},[e,t,n,l]),o===""?y.jsxs("div",{className:"code-block-wrapper",children:[!r&&y.jsxs("div",{className:"code-block-header",children:[y.jsxs("div",{className:"code-lang-container",children:[d(t),y.jsx("span",{className:"code-lang",children:t})]}),y.jsx("button",{className:"copy-button",onClick:()=>{c()},children:y.jsx("span",{className:"material-symbols-rounded",children:a?"check":"content_copy"})})]}),y.jsx("pre",{style:{margin:0,padding:12,fontSize:12,color:"#4b5563",overflowX:"auto"},children:y.jsx("code",{children:e})})]}):y.jsxs("div",{className:"code-block-wrapper",children:[!r&&y.jsxs("div",{className:"code-block-header",children:[y.jsxs("div",{className:"code-lang-container",children:[d(t),y.jsx("span",{className:"code-lang",children:t})]}),y.jsx("button",{className:"copy-button",onClick:()=>{c()},children:y.jsx("span",{className:"material-symbols-rounded",children:a?"check":"content_copy"})})]}),y.jsx("div",{dangerouslySetInnerHTML:{__html:o}})]})}const Mge=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Age=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lge={};function lR(e,t){return(Lge.jsx?Age:Mge).test(e)}var cR=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Dge=/\n/g,zge=/^\s*/,Bge=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Fge=/^:\s*/,Hge=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Vge=/^[;\s]*/,Wge=/^\s+|\s+$/g,Kge=`
|
|
469
|
-
`,uR="/",dR="*",Vs="",Uge="comment",Gge="declaration";function qge(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(h){var b=h.match(Dge);b&&(n+=b.length);var x=h.lastIndexOf(Kge);r=~x?h.length-x:r+h.length}function i(){var h={line:n,column:r};return function(b){return b.position=new a(h),c(),b}}function a(h){this.start=h,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function s(h){var b=new Error(t.source+":"+n+":"+r+": "+h);if(b.reason=h,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(h){var b=h.exec(e);if(b){var x=b[0];return o(x),e=e.slice(x.length),b}}function c(){l(zge)}function d(h){var b;for(h=h||[];b=f();)b!==!1&&h.push(b);return h}function f(){var h=i();if(!(uR!=e.charAt(0)||dR!=e.charAt(1))){for(var b=2;Vs!=e.charAt(b)&&(dR!=e.charAt(b)||uR!=e.charAt(b+1));)++b;if(b+=2,Vs===e.charAt(b-1))return s("End of comment missing");var x=e.slice(2,b-2);return r+=2,o(x),e=e.slice(b),r+=2,h({type:Uge,comment:x})}}function m(){var h=i(),b=l(Bge);if(b){if(f(),!l(Fge))return s("property missing ':'");var x=l(Hge),g=h({type:Gge,property:fR(b[0].replace(cR,Vs)),value:x?fR(x[0].replace(cR,Vs)):Vs});return l(Vge),g}}function p(){var h=[];d(h);for(var b;b=m();)b!==!1&&(h.push(b),d(h));return h}return c(),p()}function fR(e){return e?e.replace(Wge,Vs):Vs}function Xge(e,t){let n=null;if(!e||typeof e!="string")return n;const r=qge(e),o=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:s}=i;o?t(a,s,i):s&&(n=n||{},n[a]=s)}),n}const Yge=Object.freeze(Object.defineProperty({__proto__:null,default:Xge},Symbol.toStringTag,{value:"Module"})),Qge=LC(Yge);var ry={};Object.defineProperty(ry,"__esModule",{value:!0});ry.camelCase=void 0;var Zge=/^--[a-zA-Z0-9_-]+$/,Jge=/-([a-z])/g,eve=/^[^-]+$/,tve=/^-(webkit|moz|ms|o|khtml)-/,nve=/^-(ms)-/,rve=function(e){return!e||eve.test(e)||Zge.test(e)},ove=function(e,t){return t.toUpperCase()},mR=function(e,t){return"".concat(t,"-")},ive=function(e,t){return t===void 0&&(t={}),rve(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(nve,mR):e=e.replace(tve,mR),e.replace(Jge,ove))};ry.camelCase=ive;var ave=Dd&&Dd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},sve=ave(Qge),lve=ry;function yC(e,t){var n={};return!e||typeof e!="string"||(0,sve.default)(e,function(r,o){r&&o&&(n[(0,lve.camelCase)(r,t)]=o)}),n}yC.default=yC;var cve=yC;const uve=Da(cve),QB=ZB("end"),R1=ZB("start");function ZB(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function dve(e){const t=R1(e),n=QB(e);if(t&&n)return{start:t,end:n}}function jd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?pR(e.position):"start"in e||"end"in e?pR(e):"line"in e||"column"in e?bC(e):""}function bC(e){return hR(e&&e.line)+":"+hR(e&&e.column)}function pR(e){return bC(e&&e.start)+"-"+bC(e&&e.end)}function hR(e){return e&&typeof e=="number"?e:1}class no extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(a=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=s?s.line:void 0,this.name=jd(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}no.prototype.file="";no.prototype.name="";no.prototype.reason="";no.prototype.message="";no.prototype.stack="";no.prototype.column=void 0;no.prototype.line=void 0;no.prototype.ancestors=void 0;no.prototype.cause=void 0;no.prototype.fatal=void 0;no.prototype.place=void 0;no.prototype.ruleId=void 0;no.prototype.source=void 0;const P1={}.hasOwnProperty,fve=new Map,mve=/[A-Z]/g,pve=new Set(["table","tbody","thead","tfoot","tr"]),hve=new Set(["td","th"]),JB="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gve(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=_ve(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=wve(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?mm:RB,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=eF(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function eF(e,t,n){if(t.type==="element")return vve(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return yve(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return xve(e,t,n);if(t.type==="mdxjsEsm")return bve(e,t);if(t.type==="root")return Sve(e,t,n);if(t.type==="text")return Cve(e,t)}function vve(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=mm,e.schema=o),e.ancestors.push(t);const i=nF(e,t.tagName,!1),a=Eve(e,t);let s=j1(e,t);return pve.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Zv(l):!0})),tF(e,a,i,t),T1(a,s),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function yve(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Nf(e,t.position)}function bve(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Nf(e,t.position)}function xve(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=mm,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:nF(e,t.name,!0),a=$ve(e,t),s=j1(e,t);return tF(e,a,i,t),T1(a,s),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function Sve(e,t,n){const r={};return T1(r,j1(e,t)),e.create(t,e.Fragment,r,n)}function Cve(e,t){return t.value}function tF(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function T1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function wve(e,t,n){return r;function r(o,i,a,s){const c=Array.isArray(a.children)?n:t;return s?c(i,a,s):c(i,a)}}function _ve(e,t){return n;function n(r,o,i,a){const s=Array.isArray(i.children),l=R1(r);return t(o,i,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Eve(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&P1.call(t.properties,o)){const i=kve(e,o,t.properties[o]);if(i){const[a,s]=i;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&hve.has(t.tagName)?r=s:n[a]=s}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function $ve(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const s=a.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else Nf(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,i=e.evaluater.evaluateExpression(s.expression)}else Nf(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function j1(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:fve;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=o.get(l)||0;a=l+"-"+c,o.set(l,c+1)}}const s=eF(e,i,a);s!==void 0&&n.push(s)}return n}function kve(e,t,n){const r=IB(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?TB(n):jB(n)),r.property==="style"){let o=typeof n=="object"?n:Nve(e,String(n));return e.stylePropertyNameCase==="css"&&(o=Ove(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?fpe[r.property]||r.property:r.attribute,n]}}function Nve(e,t){try{return uve(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new no("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=JB+"#cannot-parse-style-attribute",o}}function nF(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,a;for(;++i<o.length;){const s=lR(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};a=a?{type:"MemberExpression",object:a,property:s,computed:!!(i&&s.type==="Literal"),optional:!1}:s}r=a}else r=lR(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return P1.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Nf(e)}function Nf(e,t){const n=new no("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=JB+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Ove(e){const t={};let n;for(n in e)P1.call(e,n)&&(t[Ive(n)]=e[n]);return t}function Ive(e){let t=e.replace(mve,Rve);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Rve(e){return"-"+e.toLowerCase()}const l0={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Pve={};function M1(e,t){const n=Pve,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return rF(e,r,o)}function rF(e,t,n){if(Tve(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return gR(e.children,t,n)}return Array.isArray(e)?gR(e,t,n):""}function gR(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=rF(e[o],t,n);return r.join("")}function Tve(e){return!!(e&&typeof e=="object")}const vR=document.createElement("i");function A1(e){const t="&"+e+";";vR.innerHTML=t;const n=vR.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ao(e,t,n,r){const o=e.length;let i=0,a;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Zo(e,t){return e.length>0?(Ao(e,e.length,0,t),e):t}const yR={}.hasOwnProperty;function oF(e){const t={};let n=-1;for(;++n<e.length;)jve(t,e[n]);return t}function jve(e,t){let n;for(n in t){const o=(yR.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){yR.call(o,a)||(o[a]=[]);const s=i[a];Mve(o[a],Array.isArray(s)?s:s?[s]:[])}}}function Mve(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ao(e,0,0,r)}function iF(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function $i(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const io=js(/[A-Za-z]/),Yr=js(/[\dA-Za-z]/),Ave=js(/[#-'*+\--9=?A-Z^-~]/);function cg(e){return e!==null&&(e<32||e===127)}const xC=js(/\d/),Lve=js(/[\dA-Fa-f]/),Dve=js(/[!-/:-@[-`{-~]/);function Rt(e){return e!==null&&e<-2}function Nn(e){return e!==null&&(e<0||e===32)}function nn(e){return e===-2||e===-1||e===32}const oy=js(new RegExp("\\p{P}|\\p{S}","u")),yl=js(/\s/);function js(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Lu(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Yr(e.charCodeAt(n+1))&&Yr(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const s=e.charCodeAt(n+1);i<56320&&s>56319&&s<57344?(a=String.fromCharCode(i,s),o=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+o+1,a=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function un(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return nn(l)?(e.enter(n),s(l)):t(l)}function s(l){return nn(l)&&i++<o?(e.consume(l),s):(e.exit(n),t(l))}}const zve={tokenize:Bve};function Bve(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),un(e,t,"linePrefix")}function o(s){return e.enter("paragraph"),i(s)}function i(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(s)}function a(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return Rt(s)?(e.consume(s),e.exit("chunkText"),i):(e.consume(s),a)}}const Fve={tokenize:Hve},bR={tokenize:Vve};function Hve(e){const t=this,n=[];let r=0,o,i,a;return s;function s(S){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&v();const C=t.events.length;let _=C,w;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){w=t.events[_][1].end;break}g(r);let N=C;for(;N<t.events.length;)t.events[N][1].end={...w},N++;return Ao(t.events,_+1,0,t.events.slice(C)),t.events.length=N,c(S)}return s(S)}function c(S){if(r===n.length){if(!o)return m(S);if(o.currentConstruct&&o.currentConstruct.concrete)return h(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bR,d,f)(S)}function d(S){return o&&v(),g(r),m(S)}function f(S){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,h(S)}function m(S){return t.containerState={},e.attempt(bR,p,h)(S)}function p(S){return r++,n.push([t.currentConstruct,t.containerState]),m(S)}function h(S){if(S===null){o&&v(),g(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),b(S)}function b(S){if(S===null){x(e.exit("chunkFlow"),!0),g(0),e.consume(S);return}return Rt(S)?(e.consume(S),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(S),b)}function x(S,C){const _=t.sliceStream(S);if(C&&_.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(_),t.parser.lazy[S.start.line]){let w=o.events.length;for(;w--;)if(o.events[w][1].start.offset<a&&(!o.events[w][1].end||o.events[w][1].end.offset>a))return;const N=t.events.length;let k=N,E,$;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(E){$=t.events[k][1].end;break}E=!0}for(g(r),w=N;w<t.events.length;)t.events[w][1].end={...$},w++;Ao(t.events,k+1,0,t.events.slice(N)),t.events.length=w}}function g(S){let C=n.length;for(;C-- >S;){const _=n[C];t.containerState=_[1],_[0].exit.call(t,e)}n.length=S}function v(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function Vve(e,t,n){return un(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function tu(e){if(e===null||Nn(e)||yl(e))return 1;if(oy(e))return 2}function iy(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const SC={name:"attention",resolveAll:Wve,tokenize:Kve};function Wve(e,t){let n=-1,r,o,i,a,s,l,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},m={...e[n][1].start};xR(f,-l),xR(m,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[n][1].start={...s.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Zo(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Zo(c,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",i,t]]),c=Zo(c,iy(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Zo(c,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Zo(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ao(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Kve(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=tu(r);let i;return a;function a(l){return i=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===i)return e.consume(l),s;const c=e.exit("attentionSequence"),d=tu(l),f=!d||d===2&&o||n.includes(l),m=!o||o===2&&d||n.includes(r);return c._open=!!(i===42?f:f&&(o||!m)),c._close=!!(i===42?m:m&&(d||!f)),t(l)}}function xR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Uve={name:"autolink",tokenize:Gve};function Gve(e,t,n){let r=0;return o;function o(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return io(p)?(e.consume(p),a):p===64?n(p):c(p)}function a(p){return p===43||p===45||p===46||Yr(p)?(r=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Yr(p))&&r++<32?(e.consume(p),s):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||cg(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),d):Ave(p)?(e.consume(p),c):n(p)}function d(p){return Yr(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Yr(p))&&r++<63){const h=p===45?m:f;return e.consume(p),h}return n(p)}}const pm={partial:!0,tokenize:qve};function qve(e,t,n){return r;function r(i){return nn(i)?un(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||Rt(i)?t(i):n(i)}}const aF={continuation:{tokenize:Yve},exit:Qve,name:"blockQuote",tokenize:Xve};function Xve(e,t,n){const r=this;return o;function o(a){if(a===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return nn(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function Yve(e,t,n){const r=this;return o;function o(a){return nn(a)?un(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(aF,t,n)(a)}}function Qve(e){e.exit("blockQuote")}const sF={name:"characterEscape",tokenize:Zve};function Zve(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return Dve(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const lF={name:"characterReference",tokenize:Jve};function Jve(e,t,n){const r=this;let o=0,i,a;return s;function s(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,a=Yr,d(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=Lve,d):(e.enter("characterReferenceValue"),i=7,a=xC,d(f))}function d(f){if(f===59&&o){const m=e.exit("characterReferenceValue");return a===Yr&&!A1(r.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&o++<i?(e.consume(f),d):n(f)}}const SR={partial:!0,tokenize:tye},CR={concrete:!0,name:"codeFenced",tokenize:eye};function eye(e,t,n){const r=this,o={partial:!0,tokenize:_};let i=0,a=0,s;return l;function l(w){return c(w)}function c(w){const N=r.events[r.events.length-1];return i=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,s=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(w)}function d(w){return w===s?(a++,e.consume(w),d):a<3?n(w):(e.exit("codeFencedFenceSequence"),nn(w)?un(e,f,"whitespace")(w):f(w))}function f(w){return w===null||Rt(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(SR,b,C)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||Rt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(w)):nn(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),un(e,p,"whitespace")(w)):w===96&&w===s?n(w):(e.consume(w),m)}function p(w){return w===null||Rt(w)?f(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(w))}function h(w){return w===null||Rt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(w)):w===96&&w===s?n(w):(e.consume(w),h)}function b(w){return e.attempt(o,C,x)(w)}function x(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g}function g(w){return i>0&&nn(w)?un(e,v,"linePrefix",i+1)(w):v(w)}function v(w){return w===null||Rt(w)?e.check(SR,b,C)(w):(e.enter("codeFlowValue"),S(w))}function S(w){return w===null||Rt(w)?(e.exit("codeFlowValue"),v(w)):(e.consume(w),S)}function C(w){return e.exit("codeFenced"),t(w)}function _(w,N,k){let E=0;return $;function $(P){return w.enter("lineEnding"),w.consume(P),w.exit("lineEnding"),O}function O(P){return w.enter("codeFencedFence"),nn(P)?un(w,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):R(P)}function R(P){return P===s?(w.enter("codeFencedFenceSequence"),T(P)):k(P)}function T(P){return P===s?(E++,w.consume(P),T):E>=a?(w.exit("codeFencedFenceSequence"),nn(P)?un(w,I,"whitespace")(P):I(P)):k(P)}function I(P){return P===null||Rt(P)?(w.exit("codeFencedFence"),N(P)):k(P)}}}function tye(e,t,n){const r=this;return o;function o(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const c0={name:"codeIndented",tokenize:rye},nye={partial:!0,tokenize:oye};function rye(e,t,n){const r=this;return o;function o(c){return e.enter("codeIndented"),un(e,i,"linePrefix",5)(c)}function i(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):Rt(c)?e.attempt(nye,a,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||Rt(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),t(c)}}function oye(e,t,n){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?n(a):Rt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):un(e,i,"linePrefix",5)(a)}function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):Rt(a)?o(a):n(a)}}const iye={name:"codeText",previous:sye,resolve:aye,tokenize:lye};function aye(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function sye(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lye(e,t,n){let r=0,o,i;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),s(f)}function s(f){return f===96?(e.consume(f),r++,s):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),o=0,d(f)):Rt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||Rt(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),c)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",c(f))}}class cye{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&nd(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),nd(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),nd(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);nd(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);nd(this.left,n.reverse())}}}function nd(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function cF(e){const t={};let n=-1,r,o,i,a,s,l,c;const d=new cye(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,uye(d,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(a=d.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),a[1].type="lineEnding",o=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},s=d.slice(o,n),s.unshift(r),d.splice(o,n-o+1,s))}}return Ao(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function uye(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const s=a.events,l=[],c={};let d,f,m=-1,p=n,h=0,b=0;const x=[b];for(;p;){for(;e.get(++o)[1]!==p;);i.push(o),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(b=m+1,x.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):x.pop(),m=x.length;m--;){const g=s.slice(x[m],x[m+1]),v=i.pop();l.push([v,v+g.length-1]),e.splice(v,2,g)}for(l.reverse(),m=-1;++m<l.length;)c[h+l[m][0]]=h+l[m][1],h+=l[m][1]-l[m][0]-1;return c}const dye={resolve:mye,tokenize:pye},fye={partial:!0,tokenize:hye};function mye(e){return cF(e),e}function pye(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(s)}function o(s){return s===null?i(s):Rt(s)?e.check(fye,a,i)(s):(e.consume(s),o)}function i(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function a(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function hye(e,t,n){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),un(e,i,"linePrefix")}function i(a){if(a===null||Rt(a))return n(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function uF(e,t,n,r,o,i,a,s,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(g),e.exit(i),m):g===null||g===32||g===41||cg(g)?n(g):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),b(g))}function m(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(s),m(g)):g===null||g===60||Rt(g)?n(g):(e.consume(g),g===92?h:p)}function h(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function b(g){return!d&&(g===null||g===41||Nn(g))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(g)):d<c&&g===40?(e.consume(g),d++,b):g===41?(e.consume(g),d--,b):g===null||g===32||g===40||cg(g)?n(g):(e.consume(g),g===92?x:b)}function x(g){return g===40||g===41||g===92?(e.consume(g),b):b(g)}}function dF(e,t,n,r,o,i){const a=this;let s=0,l;return c;function c(p){return e.enter(r),e.enter(o),e.consume(p),e.exit(o),e.enter(i),d}function d(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(i),e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):Rt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Rt(p)||s++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!nn(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),s++,f):f(p)}}function fF(e,t,n,r,o,i){let a;return s;function s(m){return m===34||m===39||m===40?(e.enter(r),e.enter(o),e.consume(m),e.exit(o),a=m===40?41:m,l):n(m)}function l(m){return m===a?(e.enter(o),e.consume(m),e.exit(o),e.exit(r),t):(e.enter(i),c(m))}function c(m){return m===a?(e.exit(i),l(a)):m===null?n(m):Rt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),un(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===a||m===null||Rt(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?f:d)}function f(m){return m===a||m===92?(e.consume(m),d):d(m)}}function Md(e,t){let n;return r;function r(o){return Rt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):nn(o)?un(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const gye={name:"definition",tokenize:yye},vye={partial:!0,tokenize:bye};function yye(e,t,n){const r=this;let o;return i;function i(p){return e.enter("definition"),a(p)}function a(p){return dF.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return o=$i(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Nn(p)?Md(e,c)(p):c(p)}function c(p){return uF(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(vye,f,f)(p)}function f(p){return nn(p)?un(e,m,"whitespace")(p):m(p)}function m(p){return p===null||Rt(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function bye(e,t,n){return r;function r(s){return Nn(s)?Md(e,o)(s):n(s)}function o(s){return fF(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return nn(s)?un(e,a,"whitespace")(s):a(s)}function a(s){return s===null||Rt(s)?t(s):n(s)}}const xye={name:"hardBreakEscape",tokenize:Sye};function Sye(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return Rt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Cye={name:"headingAtx",resolve:wye,tokenize:_ye};function wye(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ao(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function _ye(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Nn(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||Rt(d)?(e.exit("atxHeading"),t(d)):nn(d)?un(e,s,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),s(d))}function c(d){return d===null||d===35||Nn(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),c)}}const Eye=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wR=["pre","script","style","textarea"],$ye={concrete:!0,name:"htmlFlow",resolveTo:Oye,tokenize:Iye},kye={partial:!0,tokenize:Pye},Nye={partial:!0,tokenize:Rye};function Oye(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Iye(e,t,n){const r=this;let o,i,a,s,l;return c;function c(A){return d(A)}function d(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),f}function f(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),i=!0,b):A===63?(e.consume(A),o=3,r.interrupt?t:M):io(A)?(e.consume(A),a=String.fromCharCode(A),x):n(A)}function m(A){return A===45?(e.consume(A),o=2,p):A===91?(e.consume(A),o=5,s=0,h):io(A)?(e.consume(A),o=4,r.interrupt?t:M):n(A)}function p(A){return A===45?(e.consume(A),r.interrupt?t:M):n(A)}function h(A){const B="CDATA[";return A===B.charCodeAt(s++)?(e.consume(A),s===B.length?r.interrupt?t:R:h):n(A)}function b(A){return io(A)?(e.consume(A),a=String.fromCharCode(A),x):n(A)}function x(A){if(A===null||A===47||A===62||Nn(A)){const B=A===47,K=a.toLowerCase();return!B&&!i&&wR.includes(K)?(o=1,r.interrupt?t(A):R(A)):Eye.includes(a.toLowerCase())?(o=6,B?(e.consume(A),g):r.interrupt?t(A):R(A)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):i?v(A):S(A))}return A===45||Yr(A)?(e.consume(A),a+=String.fromCharCode(A),x):n(A)}function g(A){return A===62?(e.consume(A),r.interrupt?t:R):n(A)}function v(A){return nn(A)?(e.consume(A),v):$(A)}function S(A){return A===47?(e.consume(A),$):A===58||A===95||io(A)?(e.consume(A),C):nn(A)?(e.consume(A),S):$(A)}function C(A){return A===45||A===46||A===58||A===95||Yr(A)?(e.consume(A),C):_(A)}function _(A){return A===61?(e.consume(A),w):nn(A)?(e.consume(A),_):S(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),l=A,N):nn(A)?(e.consume(A),w):k(A)}function N(A){return A===l?(e.consume(A),l=null,E):A===null||Rt(A)?n(A):(e.consume(A),N)}function k(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Nn(A)?_(A):(e.consume(A),k)}function E(A){return A===47||A===62||nn(A)?S(A):n(A)}function $(A){return A===62?(e.consume(A),O):n(A)}function O(A){return A===null||Rt(A)?R(A):nn(A)?(e.consume(A),O):n(A)}function R(A){return A===45&&o===2?(e.consume(A),j):A===60&&o===1?(e.consume(A),L):A===62&&o===4?(e.consume(A),H):A===63&&o===3?(e.consume(A),M):A===93&&o===5?(e.consume(A),z):Rt(A)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(kye,F,T)(A)):A===null||Rt(A)?(e.exit("htmlFlowData"),T(A)):(e.consume(A),R)}function T(A){return e.check(Nye,I,F)(A)}function I(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),P}function P(A){return A===null||Rt(A)?T(A):(e.enter("htmlFlowData"),R(A))}function j(A){return A===45?(e.consume(A),M):R(A)}function L(A){return A===47?(e.consume(A),a="",D):R(A)}function D(A){if(A===62){const B=a.toLowerCase();return wR.includes(B)?(e.consume(A),H):R(A)}return io(A)&&a.length<8?(e.consume(A),a+=String.fromCharCode(A),D):R(A)}function z(A){return A===93?(e.consume(A),M):R(A)}function M(A){return A===62?(e.consume(A),H):A===45&&o===2?(e.consume(A),M):R(A)}function H(A){return A===null||Rt(A)?(e.exit("htmlFlowData"),F(A)):(e.consume(A),H)}function F(A){return e.exit("htmlFlow"),t(A)}}function Rye(e,t,n){const r=this;return o;function o(a){return Rt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function Pye(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(pm,t,n)}}const Tye={name:"htmlText",tokenize:jye};function jye(e,t,n){const r=this;let o,i,a;return s;function s(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),l}function l(M){return M===33?(e.consume(M),c):M===47?(e.consume(M),_):M===63?(e.consume(M),S):io(M)?(e.consume(M),k):n(M)}function c(M){return M===45?(e.consume(M),d):M===91?(e.consume(M),i=0,h):io(M)?(e.consume(M),v):n(M)}function d(M){return M===45?(e.consume(M),p):n(M)}function f(M){return M===null?n(M):M===45?(e.consume(M),m):Rt(M)?(a=f,L(M)):(e.consume(M),f)}function m(M){return M===45?(e.consume(M),p):f(M)}function p(M){return M===62?j(M):M===45?m(M):f(M)}function h(M){const H="CDATA[";return M===H.charCodeAt(i++)?(e.consume(M),i===H.length?b:h):n(M)}function b(M){return M===null?n(M):M===93?(e.consume(M),x):Rt(M)?(a=b,L(M)):(e.consume(M),b)}function x(M){return M===93?(e.consume(M),g):b(M)}function g(M){return M===62?j(M):M===93?(e.consume(M),g):b(M)}function v(M){return M===null||M===62?j(M):Rt(M)?(a=v,L(M)):(e.consume(M),v)}function S(M){return M===null?n(M):M===63?(e.consume(M),C):Rt(M)?(a=S,L(M)):(e.consume(M),S)}function C(M){return M===62?j(M):S(M)}function _(M){return io(M)?(e.consume(M),w):n(M)}function w(M){return M===45||Yr(M)?(e.consume(M),w):N(M)}function N(M){return Rt(M)?(a=N,L(M)):nn(M)?(e.consume(M),N):j(M)}function k(M){return M===45||Yr(M)?(e.consume(M),k):M===47||M===62||Nn(M)?E(M):n(M)}function E(M){return M===47?(e.consume(M),j):M===58||M===95||io(M)?(e.consume(M),$):Rt(M)?(a=E,L(M)):nn(M)?(e.consume(M),E):j(M)}function $(M){return M===45||M===46||M===58||M===95||Yr(M)?(e.consume(M),$):O(M)}function O(M){return M===61?(e.consume(M),R):Rt(M)?(a=O,L(M)):nn(M)?(e.consume(M),O):E(M)}function R(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),o=M,T):Rt(M)?(a=R,L(M)):nn(M)?(e.consume(M),R):(e.consume(M),I)}function T(M){return M===o?(e.consume(M),o=void 0,P):M===null?n(M):Rt(M)?(a=T,L(M)):(e.consume(M),T)}function I(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Nn(M)?E(M):(e.consume(M),I)}function P(M){return M===47||M===62||Nn(M)?E(M):n(M)}function j(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function L(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),D}function D(M){return nn(M)?un(e,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):z(M)}function z(M){return e.enter("htmlTextData"),a(M)}}const L1={name:"labelEnd",resolveAll:Dye,resolveTo:zye,tokenize:Bye},Mye={tokenize:Fye},Aye={tokenize:Hye},Lye={tokenize:Vye};function Dye(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Ao(e,0,e.length,n),e}function zye(e,t){let n=e.length,r=0,o,i,a,s;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(a=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,t],["enter",c,t]],s=Zo(s,e.slice(i+1,i+r+3)),s=Zo(s,[["enter",d,t]]),s=Zo(s,iy(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),s=Zo(s,[["exit",d,t],e[a-2],e[a-1],["exit",c,t]]),s=Zo(s,e.slice(a+1)),s=Zo(s,[["exit",l,t]]),Ao(e,i,e.length,s),e}function Bye(e,t,n){const r=this;let o=r.events.length,i,a;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return s;function s(m){return i?i._inactive?f(m):(a=r.parser.defined.includes($i(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(Mye,d,a?d:f)(m):m===91?e.attempt(Aye,d,a?c:f)(m):a?d(m):f(m)}function c(m){return e.attempt(Lye,d,f)(m)}function d(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function Fye(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return Nn(f)?Md(e,i)(f):i(f)}function i(f){return f===41?d(f):uF(e,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return Nn(f)?Md(e,l)(f):d(f)}function s(f){return n(f)}function l(f){return f===34||f===39||f===40?fF(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function c(f){return Nn(f)?Md(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Hye(e,t,n){const r=this;return o;function o(s){return dF.call(r,e,i,a,"reference","referenceMarker","referenceString")(s)}function i(s){return r.parser.defined.includes($i(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function a(s){return n(s)}}function Vye(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Wye={name:"labelStartImage",resolveAll:L1.resolveAll,tokenize:Kye};function Kye(e,t,n){const r=this;return o;function o(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),i}function i(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),a):n(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Uye={name:"labelStartLink",resolveAll:L1.resolveAll,tokenize:Gye};function Gye(e,t,n){const r=this;return o;function o(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const u0={name:"lineEnding",tokenize:qye};function qye(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),un(e,t,"linePrefix")}}const Up={name:"thematicBreak",tokenize:Xye};function Xye(e,t,n){let r=0,o;return i;function i(c){return e.enter("thematicBreak"),a(c)}function a(c){return o=c,s(c)}function s(c){return c===o?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Rt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===o?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),nn(c)?un(e,s,"whitespace")(c):s(c))}}const ho={continuation:{tokenize:Jye},exit:tbe,name:"list",tokenize:Zye},Yye={partial:!0,tokenize:nbe},Qye={partial:!0,tokenize:ebe};function Zye(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,a=0;return s;function s(p){const h=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:xC(p)){if(r.containerState.type||(r.containerState.type=h,e.enter(h,{_container:!0})),h==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Up,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return xC(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(pm,r.interrupt?n:d,e.attempt(Yye,m,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return nn(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Jye(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(pm,o,i);function o(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,un(e,t,"listItemIndent",r.containerState.size+1)(s)}function i(s){return r.containerState.furtherBlankLines||!nn(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Qye,t,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,un(e,e.attempt(ho,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function ebe(e,t,n){const r=this;return un(e,o,"listItemIndent",r.containerState.size+1);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function tbe(e){e.exit(this.containerState.type)}function nbe(e,t,n){const r=this;return un(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const a=r.events[r.events.length-1];return!nn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const _R={name:"setextUnderline",resolveTo:rbe,tokenize:obe};function rbe(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function obe(e,t,n){const r=this;let o;return i;function i(c){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),o=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===o?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),nn(c)?un(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Rt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const ibe={tokenize:abe};function abe(e){const t=this,n=e.attempt(pm,r,e.attempt(this.parser.constructs.flowInitial,o,un(e,e.attempt(this.parser.constructs.flow,o,e.attempt(dye,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const sbe={resolveAll:pF()},lbe=mF("string"),cbe=mF("text");function mF(e){return{resolveAll:pF(e==="text"?ube:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,a,s);return a;function a(d){return c(d)?i(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const f=o[d];let m=-1;if(f)for(;++m<f.length;){const p=f[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function pF(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function ube(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,a=-1,s=0,l;for(;i--;){const c=o[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(c===-2)l=!0,s++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const c={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const dbe={42:ho,43:ho,45:ho,48:ho,49:ho,50:ho,51:ho,52:ho,53:ho,54:ho,55:ho,56:ho,57:ho,62:aF},fbe={91:gye},mbe={[-2]:c0,[-1]:c0,32:c0},pbe={35:Cye,42:Up,45:[_R,Up],60:$ye,61:_R,95:Up,96:CR,126:CR},hbe={38:lF,92:sF},gbe={[-5]:u0,[-4]:u0,[-3]:u0,33:Wye,38:lF,42:SC,60:[Uve,Tye],91:Uye,92:[xye,sF],93:L1,95:SC,96:iye},vbe={null:[SC,sbe]},ybe={null:[42,95]},bbe={null:[]},xbe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ybe,contentInitial:fbe,disable:bbe,document:dbe,flow:pbe,flowInitial:mbe,insideSpan:vbe,string:hbe,text:gbe},Symbol.toStringTag,{value:"Module"}));function Sbe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let a=[],s=[];const l={attempt:N(_),check:N(w),consume:v,enter:S,exit:C,interrupt:N(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:b,events:[],now:h,parser:e,previous:null,sliceSerialize:m,sliceStream:p,write:f};let d=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function f(O){return a=Zo(a,O),x(),a[a.length-1]!==null?[]:(k(t,0),c.events=iy(i,c.events,c),c.events)}function m(O,R){return wbe(p(O),R)}function p(O){return Cbe(a,O)}function h(){const{_bufferIndex:O,_index:R,line:T,column:I,offset:P}=r;return{_bufferIndex:O,_index:R,line:T,column:I,offset:P}}function b(O){o[O.line]=O.column,$()}function x(){let O;for(;r._index<a.length;){const R=a[r._index];if(typeof R=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<R.length;)g(R.charCodeAt(r._bufferIndex));else g(R)}}function g(O){d=d(O)}function v(O){Rt(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,$()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=O}function S(O,R){const T=R||{};return T.type=O,T.start=h(),c.events.push(["enter",T,c]),s.push(T),T}function C(O){const R=s.pop();return R.end=h(),c.events.push(["exit",R,c]),R}function _(O,R){k(O,R.from)}function w(O,R){R.restore()}function N(O,R){return T;function T(I,P,j){let L,D,z,M;return Array.isArray(I)?F(I):"tokenize"in I?F([I]):H(I);function H(W){return q;function q(U){const te=U!==null&&W[U],le=U!==null&&W.null,ie=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(le)?le:le?[le]:[]];return F(ie)(U)}}function F(W){return L=W,D=0,W.length===0?j:A(W[D])}function A(W){return q;function q(U){return M=E(),z=W,W.partial||(c.currentConstruct=W),W.name&&c.parser.constructs.disable.null.includes(W.name)?K():W.tokenize.call(R?Object.assign(Object.create(c),R):c,l,B,K)(U)}}function B(W){return O(z,M),P}function K(W){return M.restore(),++D<L.length?A(L[D]):j}}}function k(O,R){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Ao(c.events,R,c.events.length-R,O.resolve(c.events.slice(R),c)),O.resolveTo&&(c.events=O.resolveTo(c.events,c))}function E(){const O=h(),R=c.previous,T=c.currentConstruct,I=c.events.length,P=Array.from(s);return{from:I,restore:j};function j(){r=O,c.previous=R,c.currentConstruct=T,c.events.length=I,s=P,$()}}function $(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function Cbe(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let a;if(n===o)a=[e[n].slice(r,i)];else{if(a=e.slice(n,o),r>-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}i>0&&a.push(e[o].slice(0,i))}return a}function wbe(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
467
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function lhe(e,t,n,r){const o=r.schema,i=o.space==="svg"?!1:r.settings.omitOptionalTags;let a=o.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const s=[];let l;o.space==="html"&&e.tagName==="svg"&&(r.schema=mm);const c=che(r,e.properties),d=r.all(o.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=o,d&&(a=!1),(c||!i||!nhe(e,t,n))&&(s.push("<",e.tagName,c?" "+c:""),a&&(o.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(d),!a&&(!i||!w1(e,t,n))&&s.push("</"+e.tagName+">"),s.join("")}function che(e,t){const n=[];let r=-1,o;if(t){for(o in t)if(t[o]!==null&&t[o]!==void 0){const i=uhe(e,o,t[o]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function uhe(e,t,n){const r=IB(e.schema,t),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let a=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Pc(r.attribute,Object.assign({},e.settings.characterReferences,{subset:ap.name[o][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?TB:jB)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(s=Pc(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:ap.unquoted[o][i]}))),s!==n&&(e.settings.quoteSmart&&rg(n,a)>rg(n,e.alternative)&&(a=e.alternative),s=a+Pc(n,Object.assign({},e.settings.characterReferences,{subset:(a==="'"?ap.single:ap.double)[o][i],attribute:!0}))+a),l+(s&&"="+s))}const dhe=["<","&"];function DB(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Pc(e.value,Object.assign({},r.settings.characterReferences,{subset:dhe}))}function fhe(e,t,n,r){return r.settings.allowDangerousHtml?e.value:DB(e,t,n,r)}function mhe(e,t,n,r){return r.all(e)}const phe=bpe("type",{invalid:hhe,unknown:ghe,handlers:{comment:zpe,doctype:Bpe,element:lhe,raw:fhe,root:mhe,text:DB}});function hhe(e){throw new Error("Expected node, not `"+e+"`")}function ghe(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const vhe={},yhe={},bhe=[];function xhe(e,t){const n=t||vhe,r=n.quote||'"',o=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:She,all:Che,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||upe,characterReferences:n.characterReferences||yhe,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?mm:RB,quote:r,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function She(e,t,n){return phe(e,t,n,this)}function Che(e){const t=[],n=e&&e.children||bhe;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function og(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[o,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[o]=i:o===r&&Object.assign(n,i);return n}function bs(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function whe(e){return Array.isArray(e)?e:[e]}async function zB(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function _1(e){return!e||["plaintext","txt","text","plain"].includes(e)}function BB(e){return e==="ansi"||_1(e)}function E1(e){return e==="none"}function FB(e){return E1(e)}function HB(e,t){var r;if(!t)return e;e.properties||(e.properties={}),(r=e.properties).class||(r.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const o of n)o&&!e.properties.class.includes(o)&&e.properties.class.push(o);return e}function Jv(e,t=!1){var i;if(e.length===0)return[["",0]];const n=e.split(/(\r?\n)/g);let r=0;const o=[];for(let a=0;a<n.length;a+=2){const s=t?n[a]+(n[a+1]||""):n[a];o.push([s,r]),r+=n[a].length,r+=((i=n[a+1])==null?void 0:i.length)||0}return o}function _he(e){const t=Jv(e,!0).map(([o])=>o);function n(o){if(o===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=o,a=0;for(const s of t){if(i<s.length)break;i-=s.length,a++}return{line:a,character:i}}function r(o,i){let a=0;for(let s=0;s<o;s++)a+=t[s].length;return a+=i,a}return{lines:t,indexToPos:n,posToIndex:r}}function Ehe(e,t,n){const r=new Set;for(const i of e.matchAll(/:?lang=["']([^"']+)["']/g)){const a=i[1].toLowerCase().trim();a&&r.add(a)}for(const i of e.matchAll(/(?:```|~~~)([\w-]+)/g)){const a=i[1].toLowerCase().trim();a&&r.add(a)}for(const i of e.matchAll(/\\begin\{([\w-]+)\}/g)){const a=i[1].toLowerCase().trim();a&&r.add(a)}for(const i of e.matchAll(/<script\s+(?:type|lang)=["']([^"']+)["']/gi)){const a=i[1].toLowerCase().trim(),s=a.includes("/")?a.split("/").pop():a;s&&r.add(s)}if(!n)return Array.from(r);const o=n.getBundledLanguages();return Array.from(r).filter(i=>i&&o[i])}const $1="light-dark()",$he=["color","background-color"];function khe(e,t){let n=0;const r=[];for(const o of t)o>n&&r.push({...e,content:e.content.slice(n,o),offset:e.offset+n}),n=o;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Nhe(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((r,o)=>r-o);return n.length?e.map(r=>r.flatMap(o=>{const i=n.filter(a=>o.offset<a&&a<o.offset+o.content.length).map(a=>a-o.offset).sort((a,s)=>a-s);return i.length?khe(o,i):o})):e}function Ohe(e,t,n,r,o="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(d=>ig(e.variants[d])),s=new Set(a.flatMap(d=>Object.keys(d))),l={},c=(d,f)=>{const m=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+t[d]+(f==="color"?"":m)};return a.forEach((d,f)=>{for(const m of s){const p=d[m]||"inherit";if(f===0&&r&&$he.includes(m))if(r===$1&&a.length>1){const h=t.findIndex(v=>v==="light"),b=t.findIndex(v=>v==="dark");if(h===-1||b===-1)throw new sr('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const x=a[h][m]||"inherit",g=a[b][m]||"inherit";l[m]=`light-dark(${x}, ${g})`,o==="css-vars"&&(l[c(f,m)]=p)}else l[m]=p;else o==="css-vars"&&(l[c(f,m)]=p)}}),i.htmlStyle=l,i}function ig(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&Xr.Italic&&(t["font-style"]="italic"),e.fontStyle&Xr.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&Xr.Underline&&n.push("underline"),e.fontStyle&Xr.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function vC(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}const VB=new WeakMap;function ey(e,t){VB.set(e,t)}function kf(e){return VB.get(e)}class Au{constructor(...t){Ae(this,"_stacks",{});Ae(this,"lang");if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,o]=t;this.lang=r,this._stacks={[o]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Au(Object.fromEntries(whe(n).map(r=>[r,fC])),t)}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Ihe(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Ihe(e){const t=[],n=new Set;function r(o){var a;if(n.has(o))return;n.add(o);const i=(a=o==null?void 0:o.nameScopesList)==null?void 0:a.scopeName;i&&t.push(i),o.parent&&r(o.parent)}return r(e),t}function Rhe(e,t){if(!(e instanceof Au))throw new sr("Invalid grammar state");return e.getInternalStack(t)}function Phe(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(a){if(typeof a=="number"){if(a<0||a>n.source.length)throw new sr(`Invalid decoration offset: ${a}. Code length: ${n.source.length}`);return{...o.indexToPos(a),offset:a}}else{const s=o.lines[a.line];if(s===void 0)throw new sr(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${o.lines.length}`);let l=a.character;if(l<0&&(l=s.length+l),l<0||l>s.length)throw new sr(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${s.length}`);return{...a,character:l,offset:o.posToIndex(a.line,l)}}};const o=_he(n.source),i=(n.options.decorations||[]).map(a=>({...a,start:r(a.start),end:r(a.end)}));The(i),e.set(n.meta,{decorations:i,converter:o,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var a;if(!((a=this.options.decorations)!=null&&a.length))return;const o=t(this).decorations.flatMap(s=>[s.start.offset,s.end.offset]);return Nhe(n,o)},code(n){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const r=t(this),o=Array.from(n.children).filter(f=>f.type==="element"&&f.tagName==="span");if(o.length!==r.converter.lines.length)throw new sr(`Number of lines in code element (${o.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(f,m,p,h){const b=o[f];let x="",g=-1,v=-1;if(m===0&&(g=0),p===0&&(v=0),p===Number.POSITIVE_INFINITY&&(v=b.children.length),g===-1||v===-1)for(let C=0;C<b.children.length;C++)x+=WB(b.children[C]),g===-1&&x.length===m&&(g=C+1),v===-1&&x.length===p&&(v=C+1);if(g===-1)throw new sr(`Failed to find start index for decoration ${JSON.stringify(h.start)}`);if(v===-1)throw new sr(`Failed to find end index for decoration ${JSON.stringify(h.end)}`);const S=b.children.slice(g,v);if(!h.alwaysWrap&&S.length===b.children.length)s(b,h,"line");else if(!h.alwaysWrap&&S.length===1&&S[0].type==="element")s(S[0],h,"token");else{const C={type:"element",tagName:"span",properties:{},children:S};s(C,h,"wrapper"),b.children.splice(g,S.length,C)}}function a(f,m){o[f]=s(o[f],m,"line")}function s(f,m,p){var x;const h=m.properties||{},b=m.transform||(g=>g);return f.tagName=m.tagName||"span",f.properties={...f.properties,...h,class:f.properties.class},(x=m.properties)!=null&&x.class&&HB(f,m.properties.class),f=b(f,p)||f,f}const l=[],c=r.decorations.sort((f,m)=>m.start.offset-f.start.offset||f.end.offset-m.end.offset);for(const f of c){const{start:m,end:p}=f;if(m.line===p.line)i(m.line,m.character,p.character,f);else if(m.line<p.line){i(m.line,m.character,Number.POSITIVE_INFINITY,f);for(let h=m.line+1;h<p.line;h++)l.unshift(()=>a(h,f));i(p.line,0,p.character,f)}}l.forEach(f=>f())}}}function The(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new sr(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const o=e[r],i=n.start.offset<=o.start.offset&&o.start.offset<n.end.offset,a=n.start.offset<o.end.offset&&o.end.offset<=n.end.offset,s=o.start.offset<=n.start.offset&&n.start.offset<o.end.offset,l=o.start.offset<n.end.offset&&n.end.offset<=o.end.offset;if(i||a||s||l){if(i&&a||s&&l||s&&n.start.offset===n.end.offset||a&&o.start.offset===o.end.offset)continue;throw new sr(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(o.start)} intersect.`)}}}}function WB(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(WB).join(""):""}const jhe=[Phe()];function ag(e){const t=Mhe(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...jhe]}function Mhe(e){const t=[],n=[],r=[];for(const o of e)switch(o.enforce){case"pre":t.push(o);break;case"post":n.push(o);break;default:r.push(o)}return{pre:t,post:n,normal:r}}var Xs=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],a0={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Ahe(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const r=e.indexOf("m",n);if(r!==-1)return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function nR(e){const t=e.shift();if(t==="2"){const n=e.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function Lhe(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)a0[r]&&t.push({type:"setDecoration",value:a0[r]});else if(r<=29){const o=a0[r-20];o&&(t.push({type:"resetDecoration",value:o}),o==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Xs[r-30]}});else if(r===38){const o=nR(e);o&&t.push({type:"setForegroundColor",value:o})}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Xs[r-40]}});else if(r===48){const o=nR(e);o&&t.push({type:"setBackgroundColor",value:o})}else r===49?t.push({type:"resetBackgroundColor"}):r===53?t.push({type:"setDecoration",value:"overline"}):r===55?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Xs[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Xs[r-100+8]}})}return t}function Dhe(){let e=null,t=null,n=new Set;return{parse(r){const o=[];let i=0;do{const a=Ahe(r,i),s=a.sequence?r.substring(i,a.startPosition):r.substring(i);if(s.length>0&&o.push({value:s,foreground:e,background:t,decorations:new Set(n)}),a.sequence){const l=Lhe(a.sequence);for(const c of l)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}i=a.position}while(i<r.length);return o}}}var zhe={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Bhe(e=zhe){function t(s){return e[s]}function n(s){return`#${s.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function o(){if(r)return r;r=[];for(let c=0;c<Xs.length;c++)r.push(t(Xs[c]));let s=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let d=0;d<6;d++)for(let f=0;f<6;f++)r.push(n([s[c],s[d],s[f]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function i(s){return o()[s]}function a(s){switch(s.type){case"named":return t(s.name);case"rgb":return n(s.rgb);case"table":return i(s.index)}}return{value:a}}const Fhe={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Hhe(e,t,n){const r=og(e,n),o=Jv(t),i=Object.fromEntries(Xs.map(l=>{var f;const c=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,d=(f=e.colors)==null?void 0:f[c];return[l,d||Fhe[l]]})),a=Bhe(i),s=Dhe();return o.map(l=>s.parse(l[0]).map(c=>{let d,f;c.decorations.has("reverse")?(d=c.background?a.value(c.background):e.bg,f=c.foreground?a.value(c.foreground):e.fg):(d=c.foreground?a.value(c.foreground):e.fg,f=c.background?a.value(c.background):void 0),d=bs(d,r),f=bs(f,r),c.decorations.has("dim")&&(d=Vhe(d));let m=Xr.None;return c.decorations.has("bold")&&(m|=Xr.Bold),c.decorations.has("italic")&&(m|=Xr.Italic),c.decorations.has("underline")&&(m|=Xr.Underline),c.decorations.has("strikethrough")&&(m|=Xr.Strikethrough),{content:c.value,offset:l[1],color:d,bgColor:f,fontStyle:m}}))}function Vhe(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const r=t[1];if(r.length===8){const o=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${o}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const o=r[0],i=r[1],a=r[2],s=r[3],l=Math.round(Number.parseInt(`${s}${s}`,16)/2).toString(16).padStart(2,"0");return`#${o}${o}${i}${i}${a}${a}${l}`}else if(r.length===3){const o=r[0],i=r[1],a=r[2];return`#${o}${o}${i}${i}${a}${a}80`}}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function k1(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n,o=e.resolveLangAlias(n.lang||"text");if(_1(o)||E1(r))return Jv(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:a}=e.setTheme(r);if(o==="ansi")return Hhe(i,t,n);const s=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==s.name)throw new sr(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(i.name))throw new sr(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Khe(t,s,i,a,n)}function Whe(...e){if(e.length===2)return kf(e[1]);const[t,n,r={}]=e,{lang:o="text",theme:i=t.getLoadedThemes()[0]}=r;if(_1(o)||E1(i))throw new sr("Plain language does not have grammar state");if(o==="ansi")throw new sr("ANSI language does not have grammar state");const{theme:a,colorMap:s}=t.setTheme(i),l=t.getLanguage(o);return new Au(N1(n,l,a,s,r).stateStack,l.name,a.name)}function Khe(e,t,n,r,o){const i=N1(e,t,n,r,o),a=new Au(i.stateStack,t.name,n.name);return ey(i.tokens,a),i.tokens}function N1(e,t,n,r,o){const i=og(n,o),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:s=500}=o,l=Jv(e);let c=o.grammarState?Rhe(o.grammarState,n.name)??fC:o.grammarContextCode!=null?N1(o.grammarContextCode,t,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:fC,d=[];const f=[];for(let m=0,p=l.length;m<p;m++){const[h,b]=l[m];if(h===""){d=[],f.push([]);continue}if(a>0&&h.length>=a){d=[],f.push([{content:h,offset:b,color:"",fontStyle:0}]);continue}let x,g,v;o.includeExplanation&&(x=t.tokenizeLine(h,c,s),g=x.tokens,v=0);const S=t.tokenizeLine2(h,c,s),C=S.tokens.length/2;for(let _=0;_<C;_++){const w=S.tokens[2*_],N=_+1<C?S.tokens[2*_+2]:h.length;if(w===N)continue;const k=S.tokens[2*_+1],E=bs(r[eu.getForeground(k)],i),$=eu.getFontStyle(k),O={content:h.substring(w,N),offset:b+w,color:E,fontStyle:$};if(o.includeExplanation){const R=[];if(o.includeExplanation!=="scopeName")for(const I of n.settings){let P;switch(typeof I.scope){case"string":P=I.scope.split(/,/).map(j=>j.trim());break;case"object":P=I.scope;break;default:continue}R.push({settings:I,selectors:P.map(j=>j.split(/ /))})}O.explanation=[];let T=0;for(;w+T<N;){const I=g[v],P=h.substring(I.startIndex,I.endIndex);T+=P.length,O.explanation.push({content:P,scopes:o.includeExplanation==="scopeName"?Uhe(I.scopes):Ghe(R,I.scopes)}),v+=1}}d.push(O)}f.push(d),d=[],c=S.ruleStack}return{tokens:f,stateStack:c}}function Uhe(e){return e.map(t=>({scopeName:t}))}function Ghe(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const i=t[r];n[r]={scopeName:i,themeMatches:Xhe(e,i,t.slice(0,r))}}return n}function rR(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function qhe(e,t,n){if(!rR(e[e.length-1],t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)rR(e[r],n[o])&&(r-=1),o-=1;return r===-1}function Xhe(e,t,n){const r=[];for(const{selectors:o,settings:i}of e)for(const a of o)if(qhe(a,t,n)){r.push(i);break}return r}function KB(e,t,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=r.map(l=>{const c=k1(e,t,{...n,theme:l.theme}),d=kf(c),f=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:d,theme:f}}),i=Yhe(...o.map(l=>l.tokens)),a=i[0].map((l,c)=>l.map((d,f)=>{const m={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(m.explanation=d.explanation),i.forEach((p,h)=>{const{content:b,explanation:x,offset:g,...v}=p[c][f];m.variants[r[h].color]=v}),m})),s=o[0].state?new Au(Object.fromEntries(o.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),o[0].state.lang):void 0;return s&&ey(a,s),a}function Yhe(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const o=e.map(l=>l[r]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const a=o.map(()=>0),s=o.map(l=>l[0]);for(;s.every(l=>l);){const l=Math.min(...s.map(c=>c.content.length));for(let c=0;c<n;c++){const d=s[c];d.content.length===l?(i[c].push(d),a[c]+=1,s[c]=o[c][a[c]]):(i[c].push({...d,content:d.content.slice(0,l)}),s[c]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}function sg(e,t,n){let r,o,i,a,s,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:d="--shiki-",colorsRendering:f="css-vars"}=n,m=Object.entries(n.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,v)=>g.color===c?-1:v.color===c?1:0);if(m.length===0)throw new sr("`themes` option must not be empty");const p=KB(e,t,n);if(l=kf(p),c&&$1!==c&&!m.find(g=>g.color===c))throw new sr(`\`themes\` option must contain the defaultColor key \`${c}\``);const h=m.map(g=>e.getTheme(g.theme)),b=m.map(g=>g.color);i=p.map(g=>g.map(v=>Ohe(v,b,d,c,f))),l&&ey(i,l);const x=m.map(g=>og(g.theme,n));o=oR(m,h,x,d,c,"fg",f),r=oR(m,h,x,d,c,"bg",f),a=`shiki-themes ${h.map(g=>g.name).join(" ")}`,s=c?void 0:[o,r].join(";")}else if("theme"in n){const c=og(n.theme,n);i=k1(e,t,n);const d=e.getTheme(n.theme);r=bs(d.bg,c),o=bs(d.fg,c),a=d.name,l=kf(i)}else throw new sr("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:o,bg:r,themeName:a,rootStyle:s,grammarState:l}}function oR(e,t,n,r,o,i,a){return e.map((s,l)=>{const c=bs(t[l][i],n[l])||"inherit",d=`${r+s.color}${i==="bg"?"-bg":""}:${c}`;if(l===0&&o){if(o===$1&&e.length>1){const f=e.findIndex(b=>b.color==="light"),m=e.findIndex(b=>b.color==="dark");if(f===-1||m===-1)throw new sr('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=bs(t[f][i],n[f])||"inherit",h=bs(t[m][i],n[m])||"inherit";return`light-dark(${p}, ${h});${d}`}return c}return a==="css-vars"?d:null}).filter(s=>!!s).join(";")}function lg(e,t,n,r={meta:{},options:n,codeToHast:(o,i)=>lg(e,o,i),codeToTokens:(o,i)=>sg(e,o,i)}){var h,b;let o=t;for(const x of ag(n))o=((h=x.preprocess)==null?void 0:h.call(r,o,n))||o;let{tokens:i,fg:a,bg:s,themeName:l,rootStyle:c,grammarState:d}=sg(e,o,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:m=!1}=n;f===!0?i=Zhe(i):f==="never"&&(i=Jhe(i)),m&&(i=ege(i));const p={...r,get source(){return o}};for(const x of ag(n))i=((b=x.tokens)==null?void 0:b.call(p,i))||i;return Qhe(i,{...n,fg:a,bg:s,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},p,d)}function Qhe(e,t,n,r=kf(e)){var b,x,g,v;const o=ag(t),i=[],a={type:"root",children:[]},{structure:s="classic",tabindex:l="0"}=t,c={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),l!==!1&&l!=null&&(c.tabindex=l.toString());for(const[S,C]of Object.entries(t.meta||{}))S.startsWith("_")||(c[S]=C);let d={type:"element",tagName:"pre",properties:c,children:[],data:t.data},f={type:"element",tagName:"code",properties:{},children:i};const m=[],p={...n,structure:s,addClassToHast:HB,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return a},get pre(){return d},get code(){return f},get lines(){return m}};if(e.forEach((S,C)=>{var N,k;C&&(s==="inline"?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):s==="classic"&&i.push({type:"text",value:`
|
|
468
|
+
`}));let _={type:"element",tagName:"span",properties:{class:"line"},children:[]},w=0;for(const E of S){let $={type:"element",tagName:"span",properties:{...E.htmlAttrs},children:[{type:"text",value:E.content}]};const O=vC(E.htmlStyle||ig(E));O&&($.properties.style=O);for(const R of o)$=((N=R==null?void 0:R.span)==null?void 0:N.call(p,$,C+1,w,_,E))||$;s==="inline"?a.children.push($):s==="classic"&&_.children.push($),w+=E.content.length}if(s==="classic"){for(const E of o)_=((k=E==null?void 0:E.line)==null?void 0:k.call(p,_,C+1))||_;m.push(_),i.push(_)}else s==="inline"&&m.push(_)}),s==="classic"){for(const S of o)f=((b=S==null?void 0:S.code)==null?void 0:b.call(p,f))||f;d.children.push(f);for(const S of o)d=((x=S==null?void 0:S.pre)==null?void 0:x.call(p,d))||d;a.children.push(d)}else if(s==="inline"){const S=[];let C={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const N of a.children)N.type==="element"&&N.tagName==="br"?(S.push(C),C={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(N.type==="element"||N.type==="text")&&C.children.push(N);S.push(C);let w={type:"element",tagName:"code",properties:{},children:S};for(const N of o)w=((g=N==null?void 0:N.code)==null?void 0:g.call(p,w))||w;a.children=[];for(let N=0;N<w.children.length;N++){N>0&&a.children.push({type:"element",tagName:"br",properties:{},children:[]});const k=w.children[N];k.type==="element"&&a.children.push(...k.children)}}let h=a;for(const S of o)h=((v=S==null?void 0:S.root)==null?void 0:v.call(p,h))||h;return r&&ey(h,r),h}function Zhe(e){return e.map(t=>{const n=[];let r="",o;return t.forEach((i,a)=>{const l=!(i.fontStyle&&(i.fontStyle&Xr.Underline||i.fontStyle&Xr.Strikethrough));l&&i.content.match(/^\s+$/)&&t[a+1]?(o===void 0&&(o=i.offset),r+=i.content):r?(l?n.push({...i,offset:o,content:r+i.content}):n.push({content:r,offset:o},i),o=void 0,r=""):n.push(i)}),n})}function Jhe(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,o,i,a]=r;if(!o&&!a)return n;const s=[{...n,offset:n.offset+o.length,content:i}];return o&&s.unshift({content:o,offset:n.offset}),a&&s.push({content:a,offset:n.offset+o.length+i.length}),s}))}function ege(e){return e.map(t=>{const n=[];for(const r of t){if(n.length===0){n.push({...r});continue}const o=n[n.length-1],i=vC(o.htmlStyle||ig(o)),a=vC(r.htmlStyle||ig(r)),s=o.fontStyle&&(o.fontStyle&Xr.Underline||o.fontStyle&Xr.Strikethrough),l=r.fontStyle&&(r.fontStyle&Xr.Underline||r.fontStyle&Xr.Strikethrough);!s&&!l&&i===a?o.content+=r.content:n.push({...r})}return n})}const tge=xhe;function nge(e,t,n){var i;const r={meta:{},options:n,codeToHast:(a,s)=>lg(e,a,s),codeToTokens:(a,s)=>sg(e,a,s)};let o=tge(lg(e,t,n,r));for(const a of ag(n))o=((i=a.postprocess)==null?void 0:i.call(r,o,n))||o;return o}const iR={light:"#333333",dark:"#bbbbbb"},aR={light:"#fffffe",dark:"#1e1e1e"},sR="__shiki_resolved";function O1(e){var s,l,c,d,f;if(e!=null&&e[sR])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:r}=t;if(!n||!r){const m=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(s=m==null?void 0:m.settings)!=null&&s.foreground&&(r=m.settings.foreground),(l=m==null?void 0:m.settings)!=null&&l.background&&(n=m.settings.background),!r&&((c=t==null?void 0:t.colors)!=null&&c["editor.foreground"])&&(r=t.colors["editor.foreground"]),!n&&((d=t==null?void 0:t.colors)!=null&&d["editor.background"])&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?iR.light:iR.dark),n||(n=t.type==="light"?aR.light:aR.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const i=new Map;function a(m){var h;if(i.has(m))return i.get(m);o+=1;const p=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return(h=t.colorReplacements)!=null&&h[`#${p}`]?a(m):(i.set(m,p),p)}t.settings=t.settings.map(m=>{var x,g;const p=((x=m.settings)==null?void 0:x.foreground)&&!m.settings.foreground.startsWith("#"),h=((g=m.settings)==null?void 0:g.background)&&!m.settings.background.startsWith("#");if(!p&&!h)return m;const b={...m,settings:{...m.settings}};if(p){const v=a(m.settings.foreground);t.colorReplacements[v]=m.settings.foreground,b.settings.foreground=v}if(h){const v=a(m.settings.background);t.colorReplacements[v]=m.settings.background,b.settings.background=v}return b});for(const m of Object.keys(t.colors||{}))if((m==="editor.foreground"||m==="editor.background"||m.startsWith("terminal.ansi"))&&!((f=t.colors[m])!=null&&f.startsWith("#"))){const p=a(t.colors[m]);t.colorReplacements[p]=t.colors[m],t.colors[m]=p}return Object.defineProperty(t,sR,{enumerable:!1,writable:!1,value:!0}),t}async function UB(e){return Array.from(new Set((await Promise.all(e.filter(t=>!BB(t)).map(async t=>await zB(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function GB(e){return(await Promise.all(e.map(async n=>FB(n)?null:O1(await zB(n))))).filter(n=>!!n)}let rge=3;function oge(e,t=3){t>rge||console.trace(`[SHIKI DEPRECATE]: ${e}`)}let pc=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function qB(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new pc(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class ige extends cpe{constructor(n,r,o,i={}){super(n);Ae(this,"_resolvedThemes",new Map);Ae(this,"_resolvedGrammars",new Map);Ae(this,"_langMap",new Map);Ae(this,"_langGraph",new Map);Ae(this,"_textmateThemeCache",new WeakMap);Ae(this,"_loadedThemesCache",null);Ae(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=o,this._alias=i,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const r=O1(n);return r.name&&(this._resolvedThemes.set(r.name,r),this._loadedThemesCache=null),r}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let r=this._textmateThemeCache.get(n);r||(r=Zh.createFromRawTheme(n),this._textmateThemeCache.set(n,r)),this._syncRegistry.setTheme(r)}getGrammar(n){return n=qB(n,this._alias),this._resolvedGrammars.get(n)}loadLanguage(n){var a,s,l,c;if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(d=>{var f;return(f=d.embeddedLangsLazy)==null?void 0:f.includes(n.name)}));this._resolver.addLanguage(n);const o={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,o);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(d=>{this._alias[d]=n.name}),this._loadedLanguagesCache=null,r.size)for(const d of r)this._resolvedGrammars.delete(d.name),this._loadedLanguagesCache=null,(s=(a=this._syncRegistry)==null?void 0:a._injectionGrammars)==null||s.delete(d.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(d.scopeName),this.loadLanguage(this._langMap.get(d.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const r=Array.from(this._langGraph.entries()),o=r.filter(([i,a])=>!a);if(o.length){const i=r.filter(([a,s])=>{if(!s)return!1;const l=s.embeddedLanguages||s.embeddedLangs;return l==null?void 0:l.some(c=>o.map(([d])=>d).includes(c))}).filter(a=>!o.includes(a));throw new pc(`Missing languages ${o.map(([a])=>`\`${a}\``).join(", ")}, required by ${i.map(([a])=>`\`${a}\``).join(", ")}`)}for(const[i,a]of r)this._resolver.addLanguage(a);for(const[i,a]of r)this.loadLanguage(a)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){this._langMap.set(n.name,n),this._langGraph.set(n.name,n);const r=n.embeddedLanguages??n.embeddedLangs;if(r)for(const o of r)this._langGraph.set(o,this._langMap.get(o))}}class age{constructor(t,n){Ae(this,"_langs",new Map);Ae(this,"_scopeToLang",new Map);Ae(this,"_injections",new Map);Ae(this,"_onigLib");this._onigLib={createOnigScanner:r=>t.createScanner(r),createOnigString:r=>t.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let r=[];for(let o=1;o<=n.length;o++){const i=n.slice(0,o).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let td=0;function sge(e){td+=1,e.warnings!==!1&&td>=10&&td%10===0&&console.warn(`[Shiki] ${td} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new pc("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(O1),o=new age(e.engine,n),i=new ige(o,r,n,e.langAlias);let a;function s(S){return qB(S,e.langAlias)}function l(S){g();const C=i.getGrammar(typeof S=="string"?S:S.name);if(!C)throw new pc(`Language \`${S}\` not found, you may need to load it first`);return C}function c(S){if(S==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};g();const C=i.getTheme(S);if(!C)throw new pc(`Theme \`${S}\` not found, you may need to load it first`);return C}function d(S){g();const C=c(S);a!==S&&(i.setTheme(C),a=S);const _=i.getColorMap();return{theme:C,colorMap:_}}function f(){return g(),i.getLoadedThemes()}function m(){return g(),i.getLoadedLanguages()}function p(...S){g(),i.loadLanguages(S.flat(1))}async function h(...S){return p(await UB(S))}function b(...S){g();for(const C of S.flat(1))i.loadTheme(C)}async function x(...S){return g(),b(await GB(S))}function g(){if(t)throw new pc("Shiki instance has been disposed")}function v(){t||(t=!0,i.dispose(),td-=1)}return{setTheme:d,getTheme:c,getLanguage:l,getLoadedThemes:f,getLoadedLanguages:m,resolveLangAlias:s,loadLanguage:h,loadLanguageSync:p,loadTheme:x,loadThemeSync:b,dispose:v,[Symbol.dispose]:v}}async function lge(e){e.engine||oge("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([GB(e.themes||[]),UB(e.langs||[]),e.engine]);return sge({...e,themes:t,langs:n,engine:r})}async function cge(e){const t=await lge(e);return{getLastGrammarState:(...n)=>Whe(t,...n),codeToTokensBase:(n,r)=>k1(t,n,r),codeToTokensWithThemes:(n,r)=>KB(t,n,r),codeToTokens:(n,r)=>sg(t,n,r),codeToHast:(n,r)=>lg(t,n,r),codeToHtml:(n,r)=>nge(t,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function uge(e){const t=e.langs,n=e.themes,r=e.engine;async function o(i){function a(f){var m;if(typeof f=="string"){if(f=((m=i.langAlias)==null?void 0:m[f])||f,BB(f))return[];const p=t[f];if(!p)throw new sr(`Language \`${f}\` is not included in this bundle. You may want to load it from external source.`);return p}return f}function s(f){if(FB(f))return"none";if(typeof f=="string"){const m=n[f];if(!m)throw new sr(`Theme \`${f}\` is not included in this bundle. You may want to load it from external source.`);return m}return f}const l=(i.themes??[]).map(f=>s(f)),c=(i.langs??[]).map(f=>a(f)),d=await cge({engine:i.engine??r(),...i,themes:l,langs:c});return{...d,loadLanguage(...f){return d.loadLanguage(...f.map(a))},loadTheme(...f){return d.loadTheme(...f.map(s))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return o}function dge(e){let t;async function n(r={}){if(t){const o=await t;return await Promise.all([o.loadTheme(...r.themes||[]),o.loadLanguage(...r.langs||[])]),o}else{t=e({...r,themes:[],langs:[]});const o=await t;return await Promise.all([o.loadTheme(...r.themes||[]),o.loadLanguage(...r.langs||[])]),o}}return n}function fge(e,t){const n=dge(e);async function r(o,i){var l;const a=await n({langs:[i.lang],themes:"theme"in i?[i.theme]:Object.values(i.themes)}),s=await((l=t==null?void 0:t.guessEmbeddedLanguages)==null?void 0:l.call(t,o,i.lang,a));return s&&await a.loadLanguage(...s),a}return{getSingletonHighlighter(o){return n(o)},async codeToHtml(o,i){return(await r(o,i)).codeToHtml(o,i)},async codeToHast(o,i){return(await r(o,i)).codeToHast(o,i)},async codeToTokens(o,i){return(await r(o,i)).codeToTokens(o,i)},async codeToTokensBase(o,i){return(await r(o,i)).codeToTokensBase(o,i)},async codeToTokensWithThemes(o,i){return(await r(o,i)).codeToTokensWithThemes(o,i)},async getLastGrammarState(o,i){return(await n({langs:[i.lang],themes:[i.theme]})).getLastGrammarState(o,i)}}}const XB=[{id:"abap",name:"ABAP",import:()=>oe(()=>import("./abap-BdImnpbu.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>oe(()=>import("./actionscript-3-CfeIJUat.js"),[])},{id:"ada",name:"Ada",import:()=>oe(()=>import("./ada-bCR0ucgS.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>oe(()=>import("./angular-html-CU67Zn6k.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>oe(()=>import("./angular-ts-BwZT4LLn.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>oe(()=>import("./apache-Pmp26Uib.js"),[])},{id:"apex",name:"Apex",import:()=>oe(()=>import("./apex-D8_7TLub.js"),[])},{id:"apl",name:"APL",import:()=>oe(()=>import("./apl-dKokRX4l.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>oe(()=>import("./applescript-Co6uUVPk.js"),[])},{id:"ara",name:"Ara",import:()=>oe(()=>import("./ara-BRHolxvo.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>oe(()=>import("./asciidoc-Dv7Oe6Be.js"),[])},{id:"asm",name:"Assembly",import:()=>oe(()=>import("./asm-D_Q5rh1f.js"),[])},{id:"astro",name:"Astro",import:()=>oe(()=>import("./astro-CbQHKStN.js"),__vite__mapDeps([10,9,2,11,3,12,13]))},{id:"awk",name:"AWK",import:()=>oe(()=>import("./awk-DMzUqQB5.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>oe(()=>import("./ballerina-BFfxhgS-.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>oe(()=>import("./bat-BkioyH1T.js"),[])},{id:"beancount",name:"Beancount",import:()=>oe(()=>import("./beancount-k_qm7-4y.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>oe(()=>import("./berry-uYugtg8r.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>oe(()=>import("./bibtex-CHM0blh-.js"),[])},{id:"bicep",name:"Bicep",import:()=>oe(()=>import("./bicep-Bmn6On1c.js"),[])},{id:"blade",name:"Blade",import:()=>oe(()=>import("./blade-D4QpJJKB.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>oe(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18]))},{id:"c",name:"C",import:()=>oe(()=>import("./c-BIGW1oBm.js"),[])},{id:"c3",name:"C3",import:()=>oe(()=>import("./c3-VCDPK7BO.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>oe(()=>import("./cadence-Bv_4Rxtq.js"),[])},{id:"cairo",name:"Cairo",import:()=>oe(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20]))},{id:"clarity",name:"Clarity",import:()=>oe(()=>import("./clarity-D53aC0YG.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>oe(()=>import("./clojure-P80f7IUj.js"),[])},{id:"cmake",name:"CMake",import:()=>oe(()=>import("./cmake-D1j8_8rp.js"),[])},{id:"cobol",name:"COBOL",import:()=>oe(()=>import("./cobol-nwyudZeR.js"),__vite__mapDeps([21,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>oe(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>oe(()=>import("./codeql-DsOJ9woJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>oe(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>oe(()=>import("./common-lisp-Cg-RD9OK.js"),[])},{id:"coq",name:"Coq",import:()=>oe(()=>import("./coq-DkFqJrB1.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>oe(()=>import("./cpp-CofmeUqb.js"),__vite__mapDeps([23,24,25,26,16]))},{id:"crystal",name:"Crystal",import:()=>oe(()=>import("./crystal-tKQVLTB8.js"),__vite__mapDeps([27,1,2,3,16,26,28]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>oe(()=>import("./csharp-K5feNrxe.js"),[])},{id:"css",name:"CSS",import:()=>oe(()=>import("./css-DPfMkruS.js"),[])},{id:"csv",name:"CSV",import:()=>oe(()=>import("./csv-fuZLfV_i.js"),[])},{id:"cue",name:"CUE",import:()=>oe(()=>import("./cue-D82EKSYY.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>oe(()=>import("./cypher-COkxafJQ.js"),[])},{id:"d",name:"D",import:()=>oe(()=>import("./d-85-TOEBH.js"),[])},{id:"dart",name:"Dart",import:()=>oe(()=>import("./dart-CF10PKvl.js"),[])},{id:"dax",name:"DAX",import:()=>oe(()=>import("./dax-CEL-wOlO.js"),[])},{id:"desktop",name:"Desktop",import:()=>oe(()=>import("./desktop-BmXAJ9_W.js"),[])},{id:"diff",name:"Diff",import:()=>oe(()=>import("./diff-D97Zzqfu.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>oe(()=>import("./docker-BcOcwvcX.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>oe(()=>import("./dotenv-Da5cRb03.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>oe(()=>import("./dream-maker-BtqSS_iP.js"),[])},{id:"edge",name:"Edge",import:()=>oe(()=>import("./edge-BkV0erSs.js"),__vite__mapDeps([29,11,1,2,3,15]))},{id:"elixir",name:"Elixir",import:()=>oe(()=>import("./elixir-CDX3lj18.js"),__vite__mapDeps([30,1,2,3]))},{id:"elm",name:"Elm",import:()=>oe(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>oe(()=>import("./emacs-lisp-C9XAeP06.js"),[])},{id:"erb",name:"ERB",import:()=>oe(()=>import("./erb-BOJIQeun.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38]))},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>oe(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40]))},{id:"fennel",name:"Fennel",import:()=>oe(()=>import("./fennel-BYunw83y.js"),[])},{id:"fish",name:"Fish",import:()=>oe(()=>import("./fish-BvzEVeQv.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>oe(()=>import("./fluent-C4IJs8-o.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>oe(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42]))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>oe(()=>import("./fortran-free-form-BxgE0vQu.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>oe(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40]))},{id:"gdresource",name:"GDResource",import:()=>oe(()=>import("./gdresource-B7Tvp0Sc.js"),__vite__mapDeps([44,45,46]))},{id:"gdscript",name:"GDScript",import:()=>oe(()=>import("./gdscript-DTMYz4Jt.js"),[])},{id:"gdshader",name:"GDShader",import:()=>oe(()=>import("./gdshader-DkwncUOv.js"),[])},{id:"genie",name:"Genie",import:()=>oe(()=>import("./genie-D0YGMca9.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>oe(()=>import("./gherkin-DyxjwDmM.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>oe(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>oe(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28]))},{id:"gleam",name:"Gleam",import:()=>oe(()=>import("./gleam-BspZqrRM.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>oe(()=>import("./glimmer-js-Rg0-pVw9.js"),__vite__mapDeps([50,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>oe(()=>import("./glimmer-ts-U6CK756n.js"),__vite__mapDeps([51,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>oe(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26]))},{id:"gn",name:"GN",import:()=>oe(()=>import("./gn-n2N0HUVH.js"),[])},{id:"gnuplot",name:"Gnuplot",import:()=>oe(()=>import("./gnuplot-DdkO51Og.js"),[])},{id:"go",name:"Go",import:()=>oe(()=>import("./go-Dn2_MT6a.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>oe(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13]))},{id:"groovy",name:"Groovy",import:()=>oe(()=>import("./groovy-gcz8RCvz.js"),[])},{id:"hack",name:"Hack",import:()=>oe(()=>import("./hack-CaT9iCJl.js"),__vite__mapDeps([52,1,2,3,16]))},{id:"haml",name:"Ruby Haml",import:()=>oe(()=>import("./haml-B8DHNrY2.js"),__vite__mapDeps([34,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>oe(()=>import("./handlebars-BL8al0AC.js"),__vite__mapDeps([53,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>oe(()=>import("./haskell-Df6bDoY_.js"),[])},{id:"haxe",name:"Haxe",import:()=>oe(()=>import("./haxe-CzTSHFRz.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>oe(()=>import("./hcl-BWvSN4gD.js"),[])},{id:"hjson",name:"Hjson",import:()=>oe(()=>import("./hjson-D5-asLiD.js"),[])},{id:"hlsl",name:"HLSL",import:()=>oe(()=>import("./hlsl-D3lLCCz7.js"),[])},{id:"html",name:"HTML",import:()=>oe(()=>import("./html-GMplVEZG.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>oe(()=>import("./html-derivative-BFtXZ54Q.js"),__vite__mapDeps([15,1,2,3]))},{id:"http",name:"HTTP",import:()=>oe(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13]))},{id:"hurl",name:"Hurl",import:()=>oe(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56]))},{id:"hxml",name:"HXML",import:()=>oe(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58]))},{id:"hy",name:"Hy",import:()=>oe(()=>import("./hy-DFXneXwc.js"),[])},{id:"imba",name:"Imba",import:()=>oe(()=>import("./imba-DGztddWO.js"),[])},{id:"ini",name:"INI",aliases:["properties"],import:()=>oe(()=>import("./ini-BEwlwnbL.js"),[])},{id:"java",name:"Java",import:()=>oe(()=>import("./java-CylS5w8V.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:()=>oe(()=>import("./javascript-wDzz0qaB.js"),[])},{id:"jinja",name:"Jinja",import:()=>oe(()=>import("./jinja-4LBKfQ-Z.js"),__vite__mapDeps([59,1,2,3]))},{id:"jison",name:"Jison",import:()=>oe(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2]))},{id:"json",name:"JSON",import:()=>oe(()=>import("./json-Cp-IABpG.js"),[])},{id:"json5",name:"JSON5",import:()=>oe(()=>import("./json5-C9tS-k6U.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>oe(()=>import("./jsonc-Des-eS-w.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>oe(()=>import("./jsonl-DcaNXYhu.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>oe(()=>import("./jsonnet-DFQXde-d.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>oe(()=>import("./jssm-C2t-YnRu.js"),[])},{id:"jsx",name:"JSX",import:()=>oe(()=>import("./jsx-g9-lgVsj.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>oe(()=>import("./julia-CxzCAyBv.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62]))},{id:"kdl",name:"KDL",import:()=>oe(()=>import("./kdl-DV7GczEv.js"),[])},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>oe(()=>import("./kotlin-BdnUsdx6.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>oe(()=>import("./kusto-DZf3V79B.js"),[])},{id:"latex",name:"LaTeX",import:()=>oe(()=>import("./latex-B4uzh10-.js"),__vite__mapDeps([63,64,62]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>oe(()=>import("./lean-BZvkOJ9d.js"),[])},{id:"less",name:"Less",import:()=>oe(()=>import("./less-B1dDrJ26.js"),[])},{id:"liquid",name:"Liquid",import:()=>oe(()=>import("./liquid-DYVedYrR.js"),__vite__mapDeps([65,1,2,3,9]))},{id:"llvm",name:"LLVM IR",import:()=>oe(()=>import("./llvm-BtvRca6l.js"),[])},{id:"log",name:"Log file",import:()=>oe(()=>import("./log-2UxHyX5q.js"),[])},{id:"logo",name:"Logo",import:()=>oe(()=>import("./logo-BtOb2qkB.js"),[])},{id:"lua",name:"Lua",import:()=>oe(()=>import("./lua-BbnMAYS6.js"),__vite__mapDeps([37,26]))},{id:"luau",name:"Luau",import:()=>oe(()=>import("./luau-C-HG3fhB.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>oe(()=>import("./make-CHLpvVh8.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>oe(()=>import("./markdown-Cvjx9yec.js"),[])},{id:"marko",name:"Marko",import:()=>oe(()=>import("./marko-DZsq8hO1.js"),__vite__mapDeps([66,3,67,5,11]))},{id:"matlab",name:"MATLAB",import:()=>oe(()=>import("./matlab-D7o27uSR.js"),[])},{id:"mdc",name:"MDC",import:()=>oe(()=>import("./mdc-DUICxH0z.js"),__vite__mapDeps([68,40,38,15,1,2,3]))},{id:"mdx",name:"MDX",import:()=>oe(()=>import("./mdx-Cmh6b_Ma.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>oe(()=>import("./mermaid-mWjccvbQ.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>oe(()=>import("./mipsasm-CKIfxQSi.js"),[])},{id:"mojo",name:"Mojo",import:()=>oe(()=>import("./mojo-B93PlW-d.js"),[])},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:()=>oe(()=>import("./moonbit-Ba13S78F.js"),[])},{id:"move",name:"Move",import:()=>oe(()=>import("./move-Bu9oaDYs.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>oe(()=>import("./narrat-DRg8JJMk.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>oe(()=>import("./nextflow-BrzmwbiE.js"),[])},{id:"nginx",name:"Nginx",import:()=>oe(()=>import("./nginx-DknmC5AR.js"),__vite__mapDeps([69,37,26]))},{id:"nim",name:"Nim",import:()=>oe(()=>import("./nim-CVrawwO9.js"),__vite__mapDeps([70,26,1,2,3,7,8,25,40]))},{id:"nix",name:"Nix",import:()=>oe(()=>import("./nix-CwoSXNpI.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>oe(()=>import("./nushell-C-sUppwS.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>oe(()=>import("./objective-c-DXmwc3jG.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>oe(()=>import("./objective-cpp-CLxacb5B.js"),[])},{id:"ocaml",name:"OCaml",import:()=>oe(()=>import("./ocaml-C0hk2d4L.js"),[])},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:()=>oe(()=>import("./openscad-C4EeE6gA.js"),[])},{id:"pascal",name:"Pascal",import:()=>oe(()=>import("./pascal-D93ZcfNL.js"),[])},{id:"perl",name:"Perl",import:()=>oe(()=>import("./perl-C0TMdlhV.js"),__vite__mapDeps([71,1,2,3,7,8,16]))},{id:"php",name:"PHP",import:()=>oe(()=>import("./php-CDn_0X-4.js"),__vite__mapDeps([72,1,2,3,7,8,16,9]))},{id:"pkl",name:"Pkl",import:()=>oe(()=>import("./pkl-u5AG7uiY.js"),[])},{id:"plsql",name:"PL/SQL",import:()=>oe(()=>import("./plsql-ChMvpjG-.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>oe(()=>import("./po-BTJTHyun.js"),[])},{id:"polar",name:"Polar",import:()=>oe(()=>import("./polar-C0HS_06l.js"),[])},{id:"postcss",name:"PostCSS",import:()=>oe(()=>import("./postcss-CXtECtnM.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>oe(()=>import("./powerquery-CEu0bR-o.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>oe(()=>import("./powershell-Dpen1YoG.js"),[])},{id:"prisma",name:"Prisma",import:()=>oe(()=>import("./prisma-Dd19v3D-.js"),[])},{id:"prolog",name:"Prolog",import:()=>oe(()=>import("./prolog-CbFg5uaA.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>oe(()=>import("./proto-C7zT0LnQ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>oe(()=>import("./pug-CGlum2m_.js"),__vite__mapDeps([73,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>oe(()=>import("./puppet-BMWR74SV.js"),[])},{id:"purescript",name:"PureScript",import:()=>oe(()=>import("./purescript-CklMAg4u.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>oe(()=>import("./python-B6aJPvgy.js"),[])},{id:"qml",name:"QML",import:()=>oe(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([74,2]))},{id:"qmldir",name:"QML Directory",import:()=>oe(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>oe(()=>import("./qss-IeuSbFQv.js"),[])},{id:"r",name:"R",import:()=>oe(()=>import("./r-Dspwwk_N.js"),[])},{id:"racket",name:"Racket",import:()=>oe(()=>import("./racket-BqYA7rlc.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>oe(()=>import("./raku-DXvB9xmW.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>oe(()=>import("./razor-C1TweQQi.js"),__vite__mapDeps([75,1,2,3,76]))},{id:"reg",name:"Windows Registry Script",import:()=>oe(()=>import("./reg-C-SQnVFl.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>oe(()=>import("./regexp-CDVJQ6XC.js"),[])},{id:"rel",name:"Rel",import:()=>oe(()=>import("./rel-C3B-1QV4.js"),[])},{id:"riscv",name:"RISC-V",import:()=>oe(()=>import("./riscv-BM1_JUlF.js"),[])},{id:"rosmsg",name:"ROS Interface",import:()=>oe(()=>import("./rosmsg-BJDFO7_C.js"),[])},{id:"rst",name:"reStructuredText",import:()=>oe(()=>import("./rst-B0xPkSld.js"),__vite__mapDeps([77,15,1,2,3,23,24,25,26,16,20,28,38,78,33,34,7,8,35,11,36,13,37]))},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>oe(()=>import("./ruby-BvKwtOVI.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38]))},{id:"rust",name:"Rust",aliases:["rs"],import:()=>oe(()=>import("./rust-B1yitclQ.js"),[])},{id:"sas",name:"SAS",import:()=>oe(()=>import("./sas-cz2c8ADy.js"),__vite__mapDeps([79,16]))},{id:"sass",name:"Sass",import:()=>oe(()=>import("./sass-Cj5Yp3dK.js"),[])},{id:"scala",name:"Scala",import:()=>oe(()=>import("./scala-C151Ov-r.js"),[])},{id:"scheme",name:"Scheme",import:()=>oe(()=>import("./scheme-C98Dy4si.js"),[])},{id:"scss",name:"SCSS",import:()=>oe(()=>import("./scss-OYdSNvt2.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>oe(()=>import("./sdbl-DVxCFoDh.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>oe(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([80,81]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>oe(()=>import("./shellscript-Yzrsuije.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>oe(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([82,28]))},{id:"smalltalk",name:"Smalltalk",import:()=>oe(()=>import("./smalltalk-BERRCDM3.js"),[])},{id:"solidity",name:"Solidity",import:()=>oe(()=>import("./solidity-rGO070M0.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>oe(()=>import("./soy-Brmx7dQM.js"),__vite__mapDeps([83,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>oe(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([84,85]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>oe(()=>import("./splunk-BtCnVYZw.js"),[])},{id:"sql",name:"SQL",import:()=>oe(()=>import("./sql-BLtJtn59.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>oe(()=>import("./ssh-config-_ykCGR6B.js"),[])},{id:"stata",name:"Stata",import:()=>oe(()=>import("./stata-BH5u7GGu.js"),__vite__mapDeps([86,16]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>oe(()=>import("./stylus-BEDo0Tqx.js"),[])},{id:"svelte",name:"Svelte",import:()=>oe(()=>import("./svelte-zxCyuUbr.js"),__vite__mapDeps([87,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>oe(()=>import("./swift-Dg5xB15N.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>oe(()=>import("./system-verilog-CnnmHF94.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>oe(()=>import("./systemd-4A_iFExJ.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>oe(()=>import("./talonscript-CkByrt1z.js"),[])},{id:"tasl",name:"Tasl",import:()=>oe(()=>import("./tasl-QIJgUcNo.js"),[])},{id:"tcl",name:"Tcl",import:()=>oe(()=>import("./tcl-dwOrl1Do.js"),[])},{id:"templ",name:"Templ",import:()=>oe(()=>import("./templ-W15q3VgB.js"),__vite__mapDeps([88,89,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>oe(()=>import("./terraform-BETggiCN.js"),[])},{id:"tex",name:"TeX",import:()=>oe(()=>import("./tex-CvyZ59Mk.js"),__vite__mapDeps([64,62]))},{id:"toml",name:"TOML",import:()=>oe(()=>import("./toml-vGWfd6FD.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>oe(()=>import("./ts-tags-zn1MmPIZ.js"),__vite__mapDeps([90,11,3,2,25,26,1,16,7,8]))},{id:"tsv",name:"TSV",import:()=>oe(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>oe(()=>import("./tsx-COt5Ahok.js"),[])},{id:"turtle",name:"Turtle",import:()=>oe(()=>import("./turtle-BsS91CYL.js"),[])},{id:"twig",name:"Twig",import:()=>oe(()=>import("./twig-CO9l9SDP.js"),__vite__mapDeps([91,3,2,5,72,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38]))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:()=>oe(()=>import("./typescript-BPQ3VLAy.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>oe(()=>import("./typespec-BGHnOYBU.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>oe(()=>import("./typst-DHCkPAjA.js"),[])},{id:"v",name:"V",import:()=>oe(()=>import("./v-BcVCzyr7.js"),[])},{id:"vala",name:"Vala",import:()=>oe(()=>import("./vala-CsfeWuGM.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>oe(()=>import("./vb-D17OF-Vu.js"),[])},{id:"verilog",name:"Verilog",import:()=>oe(()=>import("./verilog-BQ8w6xss.js"),[])},{id:"vhdl",name:"VHDL",import:()=>oe(()=>import("./vhdl-CeAyd5Ju.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>oe(()=>import("./viml-CJc9bBzg.js"),[])},{id:"vue",name:"Vue",import:()=>oe(()=>import("./vue-DN_0RTcg.js"),__vite__mapDeps([92,3,2,11,9,1,15]))},{id:"vue-html",name:"Vue HTML",import:()=>oe(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([93,2]))},{id:"vue-vine",name:"Vue Vine",import:()=>oe(()=>import("./vue-vine-CQOfvN7w.js"),__vite__mapDeps([94,3,5,67,95,12,2]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>oe(()=>import("./vyper-CDx5xZoG.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>oe(()=>import("./wasm-MzD3tlZU.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>oe(()=>import("./wenyan-BV7otONQ.js"),[])},{id:"wgsl",name:"WGSL",import:()=>oe(()=>import("./wgsl-Dx-B1_4e.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>oe(()=>import("./wikitext-BhOHFoWU.js"),[])},{id:"wit",name:"WebAssembly Interface Types",import:()=>oe(()=>import("./wit-5i3qLPDT.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>oe(()=>import("./wolfram-lXgVvXCa.js"),[])},{id:"xml",name:"XML",import:()=>oe(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>oe(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([96,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>oe(()=>import("./yaml-Buea-lGh.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>oe(()=>import("./zenscript-DVFEvuxE.js"),[])},{id:"zig",name:"Zig",import:()=>oe(()=>import("./zig-VOosw3JB.js"),[])}],mge=Object.fromEntries(XB.map(e=>[e.id,e.import])),pge=Object.fromEntries(XB.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),hge={...mge,...pge},gge=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>oe(()=>import("./andromeeda-C-Jbm3Hp.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>oe(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>oe(()=>import("./ayu-dark-CmMr59Fi.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>oe(()=>import("./catppuccin-frappe-DFWUc33u.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>oe(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>oe(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>oe(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>oe(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>oe(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>oe(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>oe(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>oe(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>oe(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>oe(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>oe(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>oe(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>oe(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>oe(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>oe(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>oe(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[])},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>oe(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[])},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>oe(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[])},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>oe(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[])},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>oe(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[])},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>oe(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>oe(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>oe(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>oe(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>oe(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>oe(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>oe(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>oe(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>oe(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>oe(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>oe(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>oe(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>oe(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>oe(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>oe(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>oe(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>oe(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>oe(()=>import("./one-dark-pro-DVMEJ2y_.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>oe(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>oe(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>oe(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>oe(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>oe(()=>import("./rose-pine-qdsjHGoJ.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>oe(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>oe(()=>import("./rose-pine-moon-D4_iv3hh.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>oe(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>oe(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>oe(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>oe(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>oe(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>oe(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>oe(()=>import("./tokyo-night-hegEt444.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>oe(()=>import("./vesper-DU1UobuO.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>oe(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>oe(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>oe(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],vge=Object.fromEntries(gge.map(e=>[e.id,e.import]));class I1 extends Error{constructor(t){super(t),this.name="ShikiError"}}function yge(){return 2147483648}function bge(){return typeof performance<"u"?performance.now():Date.now()}const xge=(e,t)=>e+(t-e%t)%t;async function Sge(e){let t,n;const r={};function o(p){n=p,r.HEAPU8=new Uint8Array(p),r.HEAPU32=new Uint32Array(p)}function i(p,h,b){r.HEAPU8.copyWithin(p,h,h+b)}function a(p){try{return t.grow(p-n.byteLength+65535>>>16),o(t.buffer),1}catch{}}function s(p){const h=r.HEAPU8.length;p=p>>>0;const b=yge();if(p>b)return!1;for(let x=1;x<=4;x*=2){let g=h*(1+.2/x);g=Math.min(g,p+100663296);const v=Math.min(b,xge(Math.max(p,g),65536));if(a(v))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(p,h,b=1024){const x=h+b;let g=h;for(;p[g]&&!(g>=x);)++g;if(g-h>16&&p.buffer&&l)return l.decode(p.subarray(h,g));let v="";for(;h<g;){let S=p[h++];if(!(S&128)){v+=String.fromCharCode(S);continue}const C=p[h++]&63;if((S&224)===192){v+=String.fromCharCode((S&31)<<6|C);continue}const _=p[h++]&63;if((S&240)===224?S=(S&15)<<12|C<<6|_:S=(S&7)<<18|C<<12|_<<6|p[h++]&63,S<65536)v+=String.fromCharCode(S);else{const w=S-65536;v+=String.fromCharCode(55296|w>>10,56320|w&1023)}}return v}function d(p,h){return p?c(r.HEAPU8,p,h):""}const f={emscripten_get_now:bge,emscripten_memcpy_big:i,emscripten_resize_heap:s,fd_write:()=>0};async function m(){const h=await e({env:f,wasi_snapshot_preview1:f});t=h.memory,o(t.buffer),Object.assign(r,h),r.UTF8ToString=d}return await m(),r}var Cge=Object.defineProperty,wge=(e,t,n)=>t in e?Cge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mr=(e,t,n)=>wge(e,typeof t!="symbol"?t+"":t,n);let Sr=null;function _ge(e){throw new I1(e.UTF8ToString(e.getLastOnigError()))}class ty{constructor(t){mr(this,"utf16Length"),mr(this,"utf8Length"),mr(this,"utf16Value"),mr(this,"utf8Value"),mr(this,"utf16OffsetToUtf8"),mr(this,"utf8OffsetToUtf16");const n=t.length,r=ty._utf8ByteLength(t),o=r!==n,i=o?new Uint32Array(n+1):null;o&&(i[n]=r);const a=o?new Uint32Array(r+1):null;o&&(a[r]=n);const s=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const d=t.charCodeAt(c);let f=d,m=!1;if(d>=55296&&d<=56319&&c+1<n){const p=t.charCodeAt(c+1);p>=56320&&p<=57343&&(f=(d-55296<<10)+65536|p-56320,m=!0)}o&&(i[c]=l,m&&(i[c+1]=l),f<=127?a[l+0]=c:f<=2047?(a[l+0]=c,a[l+1]=c):f<=65535?(a[l+0]=c,a[l+1]=c,a[l+2]=c):(a[l+0]=c,a[l+1]=c,a[l+2]=c,a[l+3]=c)),f<=127?s[l++]=f:f<=2047?(s[l++]=192|(f&1984)>>>6,s[l++]=128|(f&63)>>>0):f<=65535?(s[l++]=224|(f&61440)>>>12,s[l++]=128|(f&4032)>>>6,s[l++]=128|(f&63)>>>0):(s[l++]=240|(f&1835008)>>>18,s[l++]=128|(f&258048)>>>12,s[l++]=128|(f&4032)>>>6,s[l++]=128|(f&63)>>>0),m&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=a}static _utf8ByteLength(t){let n=0;for(let r=0,o=t.length;r<o;r++){const i=t.charCodeAt(r);let a=i,s=!1;if(i>=55296&&i<=56319&&r+1<o){const l=t.charCodeAt(r+1);l>=56320&&l<=57343&&(a=(i-55296<<10)+65536|l-56320,s=!0)}a<=127?n+=1:a<=2047?n+=2:a<=65535?n+=3:n+=4,s&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const ny=class Bi{constructor(t){if(mr(this,"id",++Bi.LAST_ID),mr(this,"_onigBinding"),mr(this,"content"),mr(this,"utf16Length"),mr(this,"utf8Length"),mr(this,"utf16OffsetToUtf8"),mr(this,"utf8OffsetToUtf16"),mr(this,"ptr"),!Sr)throw new I1("Must invoke loadWasm first.");this._onigBinding=Sr,this.content=t;const n=new ty(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!Bi._sharedPtrInUse?(Bi._sharedPtr||(Bi._sharedPtr=Sr.omalloc(1e4)),Bi._sharedPtrInUse=!0,Sr.HEAPU8.set(n.utf8Value,Bi._sharedPtr),this.ptr=Bi._sharedPtr):this.ptr=n.createString(Sr)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===Bi._sharedPtr?Bi._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};mr(ny,"LAST_ID",0);mr(ny,"_sharedPtr",0);mr(ny,"_sharedPtrInUse",!1);let YB=ny;class Ege{constructor(t){if(mr(this,"_onigBinding"),mr(this,"_ptr"),!Sr)throw new I1("Must invoke loadWasm first.");const n=[],r=[];for(let s=0,l=t.length;s<l;s++){const c=new ty(t[s]);n[s]=c.createString(Sr),r[s]=c.utf8Length}const o=Sr.omalloc(4*t.length);Sr.HEAPU32.set(n,o/4);const i=Sr.omalloc(4*t.length);Sr.HEAPU32.set(r,i/4);const a=Sr.createOnigScanner(o,i,t.length);for(let s=0,l=t.length;s<l;s++)Sr.ofree(n[s]);Sr.ofree(i),Sr.ofree(o),a===0&&_ge(Sr),this._onigBinding=Sr,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let o=0;if(typeof r=="number"&&(o=r),typeof t=="string"){t=new YB(t);const i=this._findNextMatchSync(t,n,!1,o);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,o)}_findNextMatchSync(t,n,r,o){const i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),o);if(a===0)return null;const s=i.HEAPU32;let l=a/4;const c=s[l++],d=s[l++],f=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(s[l++]),h=t.convertUtf8OffsetToUtf16(s[l++]);f[m]={start:p,end:h,length:h-p}}return{index:c,captureIndices:f}}}function $ge(e){return typeof e.instantiator=="function"}function kge(e){return typeof e.default=="function"}function Nge(e){return typeof e.data<"u"}function Oge(e){return typeof Response<"u"&&e instanceof Response}function Ige(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let sp;function Rge(e){if(sp)return sp;async function t(){Sr=await Sge(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),$ge(r)?r=await r.instantiator(n):kge(r)?r=await r.default(n):(Nge(r)&&(r=r.data),Oge(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Pge(r)(n):r=await Tge(r)(n):Ige(r)?r=await s0(r)(n):r instanceof WebAssembly.Module?r=await s0(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await s0(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return sp=t(),sp}function s0(e){return t=>WebAssembly.instantiate(e,t)}function Pge(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Tge(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function jge(e){return e&&await Rge(e),{createScanner(t){return new Ege(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new YB(t)}}}const Mge=uge({langs:hge,themes:vge,engine:()=>jge(oe(()=>import("./wasm-CG6Dc4jp.js"),[]))}),{codeToHtml:Age}=fge(Mge,{guessEmbeddedLanguages:Ehe});function wo({code:e,lang:t="json",showLineNumbers:n=!1,hideHeader:r=!1}){const[o,i]=u.useState(""),[a,s]=u.useState(!1),l=vl(y1),c=async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)}catch(f){console.error("Failed to copy code:",f)}},d=f=>{const m=f.toLowerCase(),h={js:"javascript-plain",javascript:"javascript-plain",ts:"typescript-plain",typescript:"typescript-plain",html:"html5-plain",css:"css3-plain",python:"python-plain",py:"python-plain",java:"java-plain",cpp:"cplusplus-plain",c:"c-plain",csharp:"csharp-plain",cs:"csharp-plain",go:"go-original-wordmark",rust:"rust-original",rs:"rust-original",php:"php-plain",ruby:"ruby-plain",rb:"ruby-plain",swift:"swift-plain",kotlin:"kotlin-plain",kt:"kotlin-plain",scala:"scala-plain",shell:"bash-plain",sh:"bash-plain",bash:"bash-plain",sql:"sqlline-plain",json:"json-plain",yaml:"yaml-plain",yml:"yaml-plain",markdown:"markdown-original",md:"markdown-original",docker:"docker-plain",dockerfile:"docker-plain",react:"react-original",jsx:"react-original",tsx:"react-original",vue:"vuejs-plain",angular:"angularjs-plain",sass:"sass-original",scss:"sass-original",less:"less-plain-wordmark",stylus:"stylus-plain",mongodb:"mongodb-plain",mysql:"mysql-plain",postgresql:"postgresql-plain",redis:"redis-plain",git:"git-plain",npm:"npm-original-wordmark",yarn:"yarn-plain",nginx:"nginx-original",bash_profile:"bash-plain"}[m]||"code-plain";return y.jsx("i",{className:`devicon-${h} colored`,style:{fontSize:"14px"}})};return u.useEffect(()=>{let f=!0;const m=l==="dark"||l==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches;return Age(e,{lang:t,theme:m?"github-dark":"github-light",transformers:n?[{name:"line-numbers",line(p,h){p.children.unshift({type:"element",tagName:"span",properties:{class:"line-number",style:"display: inline-block; width: 2rem; margin-right: 1rem; text-align: right; color: #9ca3af; user-select: none;"},children:[{type:"text",value:String(h)}]})}}]:[]}).then(p=>{f&&i(p)}),()=>{f=!1}},[e,t,n,l]),o===""?y.jsxs("div",{className:"code-block-wrapper",children:[!r&&y.jsxs("div",{className:"code-block-header",children:[y.jsxs("div",{className:"code-lang-container",children:[d(t),y.jsx("span",{className:"code-lang",children:t})]}),y.jsx("button",{className:"copy-button",onClick:()=>{c()},children:y.jsx("span",{className:"material-symbols-rounded",children:a?"check":"content_copy"})})]}),y.jsx("pre",{style:{margin:0,padding:12,fontSize:12,color:"#4b5563",overflowX:"auto"},children:y.jsx("code",{children:e})})]}):y.jsxs("div",{className:"code-block-wrapper",children:[!r&&y.jsxs("div",{className:"code-block-header",children:[y.jsxs("div",{className:"code-lang-container",children:[d(t),y.jsx("span",{className:"code-lang",children:t})]}),y.jsx("button",{className:"copy-button",onClick:()=>{c()},children:y.jsx("span",{className:"material-symbols-rounded",children:a?"check":"content_copy"})})]}),y.jsx("div",{dangerouslySetInnerHTML:{__html:o}})]})}const Lge=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dge=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zge={};function lR(e,t){return(zge.jsx?Dge:Lge).test(e)}var cR=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Bge=/\n/g,Fge=/^\s*/,Hge=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Vge=/^:\s*/,Wge=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Kge=/^[;\s]*/,Uge=/^\s+|\s+$/g,Gge=`
|
|
469
|
+
`,uR="/",dR="*",Vs="",qge="comment",Xge="declaration";function Yge(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(h){var b=h.match(Bge);b&&(n+=b.length);var x=h.lastIndexOf(Gge);r=~x?h.length-x:r+h.length}function i(){var h={line:n,column:r};return function(b){return b.position=new a(h),c(),b}}function a(h){this.start=h,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function s(h){var b=new Error(t.source+":"+n+":"+r+": "+h);if(b.reason=h,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(h){var b=h.exec(e);if(b){var x=b[0];return o(x),e=e.slice(x.length),b}}function c(){l(Fge)}function d(h){var b;for(h=h||[];b=f();)b!==!1&&h.push(b);return h}function f(){var h=i();if(!(uR!=e.charAt(0)||dR!=e.charAt(1))){for(var b=2;Vs!=e.charAt(b)&&(dR!=e.charAt(b)||uR!=e.charAt(b+1));)++b;if(b+=2,Vs===e.charAt(b-1))return s("End of comment missing");var x=e.slice(2,b-2);return r+=2,o(x),e=e.slice(b),r+=2,h({type:qge,comment:x})}}function m(){var h=i(),b=l(Hge);if(b){if(f(),!l(Vge))return s("property missing ':'");var x=l(Wge),g=h({type:Xge,property:fR(b[0].replace(cR,Vs)),value:x?fR(x[0].replace(cR,Vs)):Vs});return l(Kge),g}}function p(){var h=[];d(h);for(var b;b=m();)b!==!1&&(h.push(b),d(h));return h}return c(),p()}function fR(e){return e?e.replace(Uge,Vs):Vs}function Qge(e,t){let n=null;if(!e||typeof e!="string")return n;const r=Yge(e),o=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:s}=i;o?t(a,s,i):s&&(n=n||{},n[a]=s)}),n}const Zge=Object.freeze(Object.defineProperty({__proto__:null,default:Qge},Symbol.toStringTag,{value:"Module"})),Jge=LC(Zge);var ry={};Object.defineProperty(ry,"__esModule",{value:!0});ry.camelCase=void 0;var eve=/^--[a-zA-Z0-9_-]+$/,tve=/-([a-z])/g,nve=/^[^-]+$/,rve=/^-(webkit|moz|ms|o|khtml)-/,ove=/^-(ms)-/,ive=function(e){return!e||nve.test(e)||eve.test(e)},ave=function(e,t){return t.toUpperCase()},mR=function(e,t){return"".concat(t,"-")},sve=function(e,t){return t===void 0&&(t={}),ive(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ove,mR):e=e.replace(rve,mR),e.replace(tve,ave))};ry.camelCase=sve;var lve=Dd&&Dd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},cve=lve(Jge),uve=ry;function yC(e,t){var n={};return!e||typeof e!="string"||(0,cve.default)(e,function(r,o){r&&o&&(n[(0,uve.camelCase)(r,t)]=o)}),n}yC.default=yC;var dve=yC;const fve=Da(dve),QB=ZB("end"),R1=ZB("start");function ZB(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function mve(e){const t=R1(e),n=QB(e);if(t&&n)return{start:t,end:n}}function jd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?pR(e.position):"start"in e||"end"in e?pR(e):"line"in e||"column"in e?bC(e):""}function bC(e){return hR(e&&e.line)+":"+hR(e&&e.column)}function pR(e){return bC(e&&e.start)+"-"+bC(e&&e.end)}function hR(e){return e&&typeof e=="number"?e:1}class no extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(a=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const s=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=s?s.line:void 0,this.name=jd(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}no.prototype.file="";no.prototype.name="";no.prototype.reason="";no.prototype.message="";no.prototype.stack="";no.prototype.column=void 0;no.prototype.line=void 0;no.prototype.ancestors=void 0;no.prototype.cause=void 0;no.prototype.fatal=void 0;no.prototype.place=void 0;no.prototype.ruleId=void 0;no.prototype.source=void 0;const P1={}.hasOwnProperty,pve=new Map,hve=/[A-Z]/g,gve=new Set(["table","tbody","thead","tfoot","tr"]),vve=new Set(["td","th"]),JB="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function yve(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=$ve(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Eve(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?mm:RB,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=eF(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function eF(e,t,n){if(t.type==="element")return bve(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return xve(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Cve(e,t,n);if(t.type==="mdxjsEsm")return Sve(e,t);if(t.type==="root")return wve(e,t,n);if(t.type==="text")return _ve(e,t)}function bve(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=mm,e.schema=o),e.ancestors.push(t);const i=nF(e,t.tagName,!1),a=kve(e,t);let s=j1(e,t);return gve.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Zv(l):!0})),tF(e,a,i,t),T1(a,s),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function xve(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Nf(e,t.position)}function Sve(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Nf(e,t.position)}function Cve(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=mm,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:nF(e,t.name,!0),a=Nve(e,t),s=j1(e,t);return tF(e,a,i,t),T1(a,s),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function wve(e,t,n){const r={};return T1(r,j1(e,t)),e.create(t,e.Fragment,r,n)}function _ve(e,t){return t.value}function tF(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function T1(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Eve(e,t,n){return r;function r(o,i,a,s){const c=Array.isArray(a.children)?n:t;return s?c(i,a,s):c(i,a)}}function $ve(e,t){return n;function n(r,o,i,a){const s=Array.isArray(i.children),l=R1(r);return t(o,i,a,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function kve(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&P1.call(t.properties,o)){const i=Ove(e,o,t.properties[o]);if(i){const[a,s]=i;e.tableCellAlignToStyle&&a==="align"&&typeof s=="string"&&vve.has(t.tagName)?r=s:n[a]=s}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Nve(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const s=a.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else Nf(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const s=r.value.data.estree.body[0];s.type,i=e.evaluater.evaluateExpression(s.expression)}else Nf(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function j1(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:pve;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=o.get(l)||0;a=l+"-"+c,o.set(l,c+1)}}const s=eF(e,i,a);s!==void 0&&n.push(s)}return n}function Ove(e,t,n){const r=IB(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?TB(n):jB(n)),r.property==="style"){let o=typeof n=="object"?n:Ive(e,String(n));return e.stylePropertyNameCase==="css"&&(o=Rve(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?ppe[r.property]||r.property:r.attribute,n]}}function Ive(e,t){try{return fve(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new no("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=JB+"#cannot-parse-style-attribute",o}}function nF(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,a;for(;++i<o.length;){const s=lR(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};a=a?{type:"MemberExpression",object:a,property:s,computed:!!(i&&s.type==="Literal"),optional:!1}:s}r=a}else r=lR(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return P1.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Nf(e)}function Nf(e,t){const n=new no("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=JB+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Rve(e){const t={};let n;for(n in e)P1.call(e,n)&&(t[Pve(n)]=e[n]);return t}function Pve(e){let t=e.replace(hve,Tve);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Tve(e){return"-"+e.toLowerCase()}const l0={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},jve={};function M1(e,t){const n=jve,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return rF(e,r,o)}function rF(e,t,n){if(Mve(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return gR(e.children,t,n)}return Array.isArray(e)?gR(e,t,n):""}function gR(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=rF(e[o],t,n);return r.join("")}function Mve(e){return!!(e&&typeof e=="object")}const vR=document.createElement("i");function A1(e){const t="&"+e+";";vR.innerHTML=t;const n=vR.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ao(e,t,n,r){const o=e.length;let i=0,a;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Zo(e,t){return e.length>0?(Ao(e,e.length,0,t),e):t}const yR={}.hasOwnProperty;function oF(e){const t={};let n=-1;for(;++n<e.length;)Ave(t,e[n]);return t}function Ave(e,t){let n;for(n in t){const o=(yR.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){yR.call(o,a)||(o[a]=[]);const s=i[a];Lve(o[a],Array.isArray(s)?s:s?[s]:[])}}}function Lve(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ao(e,0,0,r)}function iF(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function $i(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const io=js(/[A-Za-z]/),Yr=js(/[\dA-Za-z]/),Dve=js(/[#-'*+\--9=?A-Z^-~]/);function cg(e){return e!==null&&(e<32||e===127)}const xC=js(/\d/),zve=js(/[\dA-Fa-f]/),Bve=js(/[!-/:-@[-`{-~]/);function Rt(e){return e!==null&&e<-2}function Nn(e){return e!==null&&(e<0||e===32)}function nn(e){return e===-2||e===-1||e===32}const oy=js(new RegExp("\\p{P}|\\p{S}","u")),yl=js(/\s/);function js(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Lu(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Yr(e.charCodeAt(n+1))&&Yr(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const s=e.charCodeAt(n+1);i<56320&&s>56319&&s<57344?(a=String.fromCharCode(i,s),o=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+o+1,a=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function un(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(l){return nn(l)?(e.enter(n),s(l)):t(l)}function s(l){return nn(l)&&i++<o?(e.consume(l),s):(e.exit(n),t(l))}}const Fve={tokenize:Hve};function Hve(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),un(e,t,"linePrefix")}function o(s){return e.enter("paragraph"),i(s)}function i(s){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(s)}function a(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return Rt(s)?(e.consume(s),e.exit("chunkText"),i):(e.consume(s),a)}}const Vve={tokenize:Wve},bR={tokenize:Kve};function Wve(e){const t=this,n=[];let r=0,o,i,a;return s;function s(S){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&v();const C=t.events.length;let _=C,w;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){w=t.events[_][1].end;break}g(r);let N=C;for(;N<t.events.length;)t.events[N][1].end={...w},N++;return Ao(t.events,_+1,0,t.events.slice(C)),t.events.length=N,c(S)}return s(S)}function c(S){if(r===n.length){if(!o)return m(S);if(o.currentConstruct&&o.currentConstruct.concrete)return h(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bR,d,f)(S)}function d(S){return o&&v(),g(r),m(S)}function f(S){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,h(S)}function m(S){return t.containerState={},e.attempt(bR,p,h)(S)}function p(S){return r++,n.push([t.currentConstruct,t.containerState]),m(S)}function h(S){if(S===null){o&&v(),g(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),b(S)}function b(S){if(S===null){x(e.exit("chunkFlow"),!0),g(0),e.consume(S);return}return Rt(S)?(e.consume(S),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,s):(e.consume(S),b)}function x(S,C){const _=t.sliceStream(S);if(C&&_.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(_),t.parser.lazy[S.start.line]){let w=o.events.length;for(;w--;)if(o.events[w][1].start.offset<a&&(!o.events[w][1].end||o.events[w][1].end.offset>a))return;const N=t.events.length;let k=N,E,$;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(E){$=t.events[k][1].end;break}E=!0}for(g(r),w=N;w<t.events.length;)t.events[w][1].end={...$},w++;Ao(t.events,k+1,0,t.events.slice(N)),t.events.length=w}}function g(S){let C=n.length;for(;C-- >S;){const _=n[C];t.containerState=_[1],_[0].exit.call(t,e)}n.length=S}function v(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function Kve(e,t,n){return un(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function tu(e){if(e===null||Nn(e)||yl(e))return 1;if(oy(e))return 2}function iy(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const SC={name:"attention",resolveAll:Uve,tokenize:Gve};function Uve(e,t){let n=-1,r,o,i,a,s,l,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},m={...e[n][1].start};xR(f,-l),xR(m,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},e[r][1].end={...a.start},e[n][1].start={...s.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Zo(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Zo(c,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",i,t]]),c=Zo(c,iy(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Zo(c,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Zo(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ao(e,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Gve(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=tu(r);let i;return a;function a(l){return i=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===i)return e.consume(l),s;const c=e.exit("attentionSequence"),d=tu(l),f=!d||d===2&&o||n.includes(l),m=!o||o===2&&d||n.includes(r);return c._open=!!(i===42?f:f&&(o||!m)),c._close=!!(i===42?m:m&&(d||!f)),t(l)}}function xR(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const qve={name:"autolink",tokenize:Xve};function Xve(e,t,n){let r=0;return o;function o(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return io(p)?(e.consume(p),a):p===64?n(p):c(p)}function a(p){return p===43||p===45||p===46||Yr(p)?(r=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Yr(p))&&r++<32?(e.consume(p),s):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||cg(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),d):Dve(p)?(e.consume(p),c):n(p)}function d(p){return Yr(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Yr(p))&&r++<63){const h=p===45?m:f;return e.consume(p),h}return n(p)}}const pm={partial:!0,tokenize:Yve};function Yve(e,t,n){return r;function r(i){return nn(i)?un(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||Rt(i)?t(i):n(i)}}const aF={continuation:{tokenize:Zve},exit:Jve,name:"blockQuote",tokenize:Qve};function Qve(e,t,n){const r=this;return o;function o(a){if(a===62){const s=r.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return nn(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function Zve(e,t,n){const r=this;return o;function o(a){return nn(a)?un(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(aF,t,n)(a)}}function Jve(e){e.exit("blockQuote")}const sF={name:"characterEscape",tokenize:eye};function eye(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return Bve(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const lF={name:"characterReference",tokenize:tye};function tye(e,t,n){const r=this;let o=0,i,a;return s;function s(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,a=Yr,d(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=zve,d):(e.enter("characterReferenceValue"),i=7,a=xC,d(f))}function d(f){if(f===59&&o){const m=e.exit("characterReferenceValue");return a===Yr&&!A1(r.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&o++<i?(e.consume(f),d):n(f)}}const SR={partial:!0,tokenize:rye},CR={concrete:!0,name:"codeFenced",tokenize:nye};function nye(e,t,n){const r=this,o={partial:!0,tokenize:_};let i=0,a=0,s;return l;function l(w){return c(w)}function c(w){const N=r.events[r.events.length-1];return i=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,s=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(w)}function d(w){return w===s?(a++,e.consume(w),d):a<3?n(w):(e.exit("codeFencedFenceSequence"),nn(w)?un(e,f,"whitespace")(w):f(w))}function f(w){return w===null||Rt(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(SR,b,C)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(w))}function m(w){return w===null||Rt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(w)):nn(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),un(e,p,"whitespace")(w)):w===96&&w===s?n(w):(e.consume(w),m)}function p(w){return w===null||Rt(w)?f(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(w))}function h(w){return w===null||Rt(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(w)):w===96&&w===s?n(w):(e.consume(w),h)}function b(w){return e.attempt(o,C,x)(w)}function x(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g}function g(w){return i>0&&nn(w)?un(e,v,"linePrefix",i+1)(w):v(w)}function v(w){return w===null||Rt(w)?e.check(SR,b,C)(w):(e.enter("codeFlowValue"),S(w))}function S(w){return w===null||Rt(w)?(e.exit("codeFlowValue"),v(w)):(e.consume(w),S)}function C(w){return e.exit("codeFenced"),t(w)}function _(w,N,k){let E=0;return $;function $(P){return w.enter("lineEnding"),w.consume(P),w.exit("lineEnding"),O}function O(P){return w.enter("codeFencedFence"),nn(P)?un(w,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):R(P)}function R(P){return P===s?(w.enter("codeFencedFenceSequence"),T(P)):k(P)}function T(P){return P===s?(E++,w.consume(P),T):E>=a?(w.exit("codeFencedFenceSequence"),nn(P)?un(w,I,"whitespace")(P):I(P)):k(P)}function I(P){return P===null||Rt(P)?(w.exit("codeFencedFence"),N(P)):k(P)}}}function rye(e,t,n){const r=this;return o;function o(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const c0={name:"codeIndented",tokenize:iye},oye={partial:!0,tokenize:aye};function iye(e,t,n){const r=this;return o;function o(c){return e.enter("codeIndented"),un(e,i,"linePrefix",5)(c)}function i(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):Rt(c)?e.attempt(oye,a,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||Rt(c)?(e.exit("codeFlowValue"),a(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),t(c)}}function aye(e,t,n){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?n(a):Rt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):un(e,i,"linePrefix",5)(a)}function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):Rt(a)?o(a):n(a)}}const sye={name:"codeText",previous:cye,resolve:lye,tokenize:uye};function lye(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function cye(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uye(e,t,n){let r=0,o,i;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),s(f)}function s(f){return f===96?(e.consume(f),r++,s):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),o=0,d(f)):Rt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||Rt(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),c)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",c(f))}}class dye{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&nd(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),nd(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),nd(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);nd(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);nd(this.left,n.reverse())}}}function nd(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function cF(e){const t={};let n=-1,r,o,i,a,s,l,c;const d=new dye(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,fye(d,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(a=d.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),a[1].type="lineEnding",o=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},s=d.slice(o,n),s.unshift(r),d.splice(o,n-o+1,s))}}return Ao(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function fye(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const s=a.events,l=[],c={};let d,f,m=-1,p=n,h=0,b=0;const x=[b];for(;p;){for(;e.get(++o)[1]!==p;);i.push(o),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(b=m+1,x.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):x.pop(),m=x.length;m--;){const g=s.slice(x[m],x[m+1]),v=i.pop();l.push([v,v+g.length-1]),e.splice(v,2,g)}for(l.reverse(),m=-1;++m<l.length;)c[h+l[m][0]]=h+l[m][1],h+=l[m][1]-l[m][0]-1;return c}const mye={resolve:hye,tokenize:gye},pye={partial:!0,tokenize:vye};function hye(e){return cF(e),e}function gye(e,t){let n;return r;function r(s){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(s)}function o(s){return s===null?i(s):Rt(s)?e.check(pye,a,i)(s):(e.consume(s),o)}function i(s){return e.exit("chunkContent"),e.exit("content"),t(s)}function a(s){return e.consume(s),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function vye(e,t,n){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),un(e,i,"linePrefix")}function i(a){if(a===null||Rt(a))return n(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function uF(e,t,n,r,o,i,a,s,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(g),e.exit(i),m):g===null||g===32||g===41||cg(g)?n(g):(e.enter(r),e.enter(a),e.enter(s),e.enter("chunkString",{contentType:"string"}),b(g))}function m(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(s),m(g)):g===null||g===60||Rt(g)?n(g):(e.consume(g),g===92?h:p)}function h(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function b(g){return!d&&(g===null||g===41||Nn(g))?(e.exit("chunkString"),e.exit(s),e.exit(a),e.exit(r),t(g)):d<c&&g===40?(e.consume(g),d++,b):g===41?(e.consume(g),d--,b):g===null||g===32||g===40||cg(g)?n(g):(e.consume(g),g===92?x:b)}function x(g){return g===40||g===41||g===92?(e.consume(g),b):b(g)}}function dF(e,t,n,r,o,i){const a=this;let s=0,l;return c;function c(p){return e.enter(r),e.enter(o),e.consume(p),e.exit(o),e.enter(i),d}function d(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(i),e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):Rt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Rt(p)||s++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!nn(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),s++,f):f(p)}}function fF(e,t,n,r,o,i){let a;return s;function s(m){return m===34||m===39||m===40?(e.enter(r),e.enter(o),e.consume(m),e.exit(o),a=m===40?41:m,l):n(m)}function l(m){return m===a?(e.enter(o),e.consume(m),e.exit(o),e.exit(r),t):(e.enter(i),c(m))}function c(m){return m===a?(e.exit(i),l(a)):m===null?n(m):Rt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),un(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===a||m===null||Rt(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?f:d)}function f(m){return m===a||m===92?(e.consume(m),d):d(m)}}function Md(e,t){let n;return r;function r(o){return Rt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):nn(o)?un(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const yye={name:"definition",tokenize:xye},bye={partial:!0,tokenize:Sye};function xye(e,t,n){const r=this;let o;return i;function i(p){return e.enter("definition"),a(p)}function a(p){return dF.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return o=$i(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return Nn(p)?Md(e,c)(p):c(p)}function c(p){return uF(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(bye,f,f)(p)}function f(p){return nn(p)?un(e,m,"whitespace")(p):m(p)}function m(p){return p===null||Rt(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function Sye(e,t,n){return r;function r(s){return Nn(s)?Md(e,o)(s):n(s)}function o(s){return fF(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function i(s){return nn(s)?un(e,a,"whitespace")(s):a(s)}function a(s){return s===null||Rt(s)?t(s):n(s)}}const Cye={name:"hardBreakEscape",tokenize:wye};function wye(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return Rt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const _ye={name:"headingAtx",resolve:Eye,tokenize:$ye};function Eye(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ao(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function $ye(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Nn(d)?(e.exit("atxHeadingSequence"),s(d)):n(d)}function s(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||Rt(d)?(e.exit("atxHeading"),t(d)):nn(d)?un(e,s,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),s(d))}function c(d){return d===null||d===35||Nn(d)?(e.exit("atxHeadingText"),s(d)):(e.consume(d),c)}}const kye=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],wR=["pre","script","style","textarea"],Nye={concrete:!0,name:"htmlFlow",resolveTo:Rye,tokenize:Pye},Oye={partial:!0,tokenize:jye},Iye={partial:!0,tokenize:Tye};function Rye(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Pye(e,t,n){const r=this;let o,i,a,s,l;return c;function c(A){return d(A)}function d(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),f}function f(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),i=!0,b):A===63?(e.consume(A),o=3,r.interrupt?t:M):io(A)?(e.consume(A),a=String.fromCharCode(A),x):n(A)}function m(A){return A===45?(e.consume(A),o=2,p):A===91?(e.consume(A),o=5,s=0,h):io(A)?(e.consume(A),o=4,r.interrupt?t:M):n(A)}function p(A){return A===45?(e.consume(A),r.interrupt?t:M):n(A)}function h(A){const B="CDATA[";return A===B.charCodeAt(s++)?(e.consume(A),s===B.length?r.interrupt?t:R:h):n(A)}function b(A){return io(A)?(e.consume(A),a=String.fromCharCode(A),x):n(A)}function x(A){if(A===null||A===47||A===62||Nn(A)){const B=A===47,K=a.toLowerCase();return!B&&!i&&wR.includes(K)?(o=1,r.interrupt?t(A):R(A)):kye.includes(a.toLowerCase())?(o=6,B?(e.consume(A),g):r.interrupt?t(A):R(A)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):i?v(A):S(A))}return A===45||Yr(A)?(e.consume(A),a+=String.fromCharCode(A),x):n(A)}function g(A){return A===62?(e.consume(A),r.interrupt?t:R):n(A)}function v(A){return nn(A)?(e.consume(A),v):$(A)}function S(A){return A===47?(e.consume(A),$):A===58||A===95||io(A)?(e.consume(A),C):nn(A)?(e.consume(A),S):$(A)}function C(A){return A===45||A===46||A===58||A===95||Yr(A)?(e.consume(A),C):_(A)}function _(A){return A===61?(e.consume(A),w):nn(A)?(e.consume(A),_):S(A)}function w(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),l=A,N):nn(A)?(e.consume(A),w):k(A)}function N(A){return A===l?(e.consume(A),l=null,E):A===null||Rt(A)?n(A):(e.consume(A),N)}function k(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Nn(A)?_(A):(e.consume(A),k)}function E(A){return A===47||A===62||nn(A)?S(A):n(A)}function $(A){return A===62?(e.consume(A),O):n(A)}function O(A){return A===null||Rt(A)?R(A):nn(A)?(e.consume(A),O):n(A)}function R(A){return A===45&&o===2?(e.consume(A),j):A===60&&o===1?(e.consume(A),L):A===62&&o===4?(e.consume(A),H):A===63&&o===3?(e.consume(A),M):A===93&&o===5?(e.consume(A),z):Rt(A)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Oye,F,T)(A)):A===null||Rt(A)?(e.exit("htmlFlowData"),T(A)):(e.consume(A),R)}function T(A){return e.check(Iye,I,F)(A)}function I(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),P}function P(A){return A===null||Rt(A)?T(A):(e.enter("htmlFlowData"),R(A))}function j(A){return A===45?(e.consume(A),M):R(A)}function L(A){return A===47?(e.consume(A),a="",D):R(A)}function D(A){if(A===62){const B=a.toLowerCase();return wR.includes(B)?(e.consume(A),H):R(A)}return io(A)&&a.length<8?(e.consume(A),a+=String.fromCharCode(A),D):R(A)}function z(A){return A===93?(e.consume(A),M):R(A)}function M(A){return A===62?(e.consume(A),H):A===45&&o===2?(e.consume(A),M):R(A)}function H(A){return A===null||Rt(A)?(e.exit("htmlFlowData"),F(A)):(e.consume(A),H)}function F(A){return e.exit("htmlFlow"),t(A)}}function Tye(e,t,n){const r=this;return o;function o(a){return Rt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function jye(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(pm,t,n)}}const Mye={name:"htmlText",tokenize:Aye};function Aye(e,t,n){const r=this;let o,i,a;return s;function s(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),l}function l(M){return M===33?(e.consume(M),c):M===47?(e.consume(M),_):M===63?(e.consume(M),S):io(M)?(e.consume(M),k):n(M)}function c(M){return M===45?(e.consume(M),d):M===91?(e.consume(M),i=0,h):io(M)?(e.consume(M),v):n(M)}function d(M){return M===45?(e.consume(M),p):n(M)}function f(M){return M===null?n(M):M===45?(e.consume(M),m):Rt(M)?(a=f,L(M)):(e.consume(M),f)}function m(M){return M===45?(e.consume(M),p):f(M)}function p(M){return M===62?j(M):M===45?m(M):f(M)}function h(M){const H="CDATA[";return M===H.charCodeAt(i++)?(e.consume(M),i===H.length?b:h):n(M)}function b(M){return M===null?n(M):M===93?(e.consume(M),x):Rt(M)?(a=b,L(M)):(e.consume(M),b)}function x(M){return M===93?(e.consume(M),g):b(M)}function g(M){return M===62?j(M):M===93?(e.consume(M),g):b(M)}function v(M){return M===null||M===62?j(M):Rt(M)?(a=v,L(M)):(e.consume(M),v)}function S(M){return M===null?n(M):M===63?(e.consume(M),C):Rt(M)?(a=S,L(M)):(e.consume(M),S)}function C(M){return M===62?j(M):S(M)}function _(M){return io(M)?(e.consume(M),w):n(M)}function w(M){return M===45||Yr(M)?(e.consume(M),w):N(M)}function N(M){return Rt(M)?(a=N,L(M)):nn(M)?(e.consume(M),N):j(M)}function k(M){return M===45||Yr(M)?(e.consume(M),k):M===47||M===62||Nn(M)?E(M):n(M)}function E(M){return M===47?(e.consume(M),j):M===58||M===95||io(M)?(e.consume(M),$):Rt(M)?(a=E,L(M)):nn(M)?(e.consume(M),E):j(M)}function $(M){return M===45||M===46||M===58||M===95||Yr(M)?(e.consume(M),$):O(M)}function O(M){return M===61?(e.consume(M),R):Rt(M)?(a=O,L(M)):nn(M)?(e.consume(M),O):E(M)}function R(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),o=M,T):Rt(M)?(a=R,L(M)):nn(M)?(e.consume(M),R):(e.consume(M),I)}function T(M){return M===o?(e.consume(M),o=void 0,P):M===null?n(M):Rt(M)?(a=T,L(M)):(e.consume(M),T)}function I(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Nn(M)?E(M):(e.consume(M),I)}function P(M){return M===47||M===62||Nn(M)?E(M):n(M)}function j(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function L(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),D}function D(M){return nn(M)?un(e,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):z(M)}function z(M){return e.enter("htmlTextData"),a(M)}}const L1={name:"labelEnd",resolveAll:Bye,resolveTo:Fye,tokenize:Hye},Lye={tokenize:Vye},Dye={tokenize:Wye},zye={tokenize:Kye};function Bye(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Ao(e,0,e.length,n),e}function Fye(e,t){let n=e.length,r=0,o,i,a,s;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(a=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,t],["enter",c,t]],s=Zo(s,e.slice(i+1,i+r+3)),s=Zo(s,[["enter",d,t]]),s=Zo(s,iy(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),s=Zo(s,[["exit",d,t],e[a-2],e[a-1],["exit",c,t]]),s=Zo(s,e.slice(a+1)),s=Zo(s,[["exit",l,t]]),Ao(e,i,e.length,s),e}function Hye(e,t,n){const r=this;let o=r.events.length,i,a;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return s;function s(m){return i?i._inactive?f(m):(a=r.parser.defined.includes($i(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(Lye,d,a?d:f)(m):m===91?e.attempt(Dye,d,a?c:f)(m):a?d(m):f(m)}function c(m){return e.attempt(zye,d,f)(m)}function d(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function Vye(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return Nn(f)?Md(e,i)(f):i(f)}function i(f){return f===41?d(f):uF(e,a,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return Nn(f)?Md(e,l)(f):d(f)}function s(f){return n(f)}function l(f){return f===34||f===39||f===40?fF(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function c(f){return Nn(f)?Md(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function Wye(e,t,n){const r=this;return o;function o(s){return dF.call(r,e,i,a,"reference","referenceMarker","referenceString")(s)}function i(s){return r.parser.defined.includes($i(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function a(s){return n(s)}}function Kye(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Uye={name:"labelStartImage",resolveAll:L1.resolveAll,tokenize:Gye};function Gye(e,t,n){const r=this;return o;function o(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),i}function i(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),a):n(s)}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const qye={name:"labelStartLink",resolveAll:L1.resolveAll,tokenize:Xye};function Xye(e,t,n){const r=this;return o;function o(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const u0={name:"lineEnding",tokenize:Yye};function Yye(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),un(e,t,"linePrefix")}}const Up={name:"thematicBreak",tokenize:Qye};function Qye(e,t,n){let r=0,o;return i;function i(c){return e.enter("thematicBreak"),a(c)}function a(c){return o=c,s(c)}function s(c){return c===o?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Rt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===o?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),nn(c)?un(e,s,"whitespace")(c):s(c))}}const ho={continuation:{tokenize:tbe},exit:rbe,name:"list",tokenize:ebe},Zye={partial:!0,tokenize:obe},Jye={partial:!0,tokenize:nbe};function ebe(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,a=0;return s;function s(p){const h=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(h==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:xC(p)){if(r.containerState.type||(r.containerState.type=h,e.enter(h,{_container:!0})),h==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Up,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return xC(p)&&++a<10?(e.consume(p),l):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(pm,r.interrupt?n:d,e.attempt(Zye,m,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return nn(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function tbe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(pm,o,i);function o(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,un(e,t,"listItemIndent",r.containerState.size+1)(s)}function i(s){return r.containerState.furtherBlankLines||!nn(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Jye,t,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,un(e,e.attempt(ho,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function nbe(e,t,n){const r=this;return un(e,o,"listItemIndent",r.containerState.size+1);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function rbe(e){e.exit(this.containerState.type)}function obe(e,t,n){const r=this;return un(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const a=r.events[r.events.length-1];return!nn(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const _R={name:"setextUnderline",resolveTo:ibe,tokenize:abe};function ibe(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function abe(e,t,n){const r=this;let o;return i;function i(c){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),o=c,a(c)):n(c)}function a(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===o?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),nn(c)?un(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Rt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const sbe={tokenize:lbe};function lbe(e){const t=this,n=e.attempt(pm,r,e.attempt(this.parser.constructs.flowInitial,o,un(e,e.attempt(this.parser.constructs.flow,o,e.attempt(mye,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const cbe={resolveAll:pF()},ube=mF("string"),dbe=mF("text");function mF(e){return{resolveAll:pF(e==="text"?fbe:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,a,s);return a;function a(d){return c(d)?i(d):s(d)}function s(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const f=o[d];let m=-1;if(f)for(;++m<f.length;){const p=f[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function pF(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function fbe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,a=-1,s=0,l;for(;i--;){const c=o[i];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)s++,a--;if(a)break;a=-1}else if(c===-2)l=!0,s++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){const c={type:n===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const mbe={42:ho,43:ho,45:ho,48:ho,49:ho,50:ho,51:ho,52:ho,53:ho,54:ho,55:ho,56:ho,57:ho,62:aF},pbe={91:yye},hbe={[-2]:c0,[-1]:c0,32:c0},gbe={35:_ye,42:Up,45:[_R,Up],60:Nye,61:_R,95:Up,96:CR,126:CR},vbe={38:lF,92:sF},ybe={[-5]:u0,[-4]:u0,[-3]:u0,33:Uye,38:lF,42:SC,60:[qve,Mye],91:qye,92:[Cye,sF],93:L1,95:SC,96:sye},bbe={null:[SC,cbe]},xbe={null:[42,95]},Sbe={null:[]},Cbe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xbe,contentInitial:pbe,disable:Sbe,document:mbe,flow:gbe,flowInitial:hbe,insideSpan:bbe,string:vbe,text:ybe},Symbol.toStringTag,{value:"Module"}));function wbe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let a=[],s=[];const l={attempt:N(_),check:N(w),consume:v,enter:S,exit:C,interrupt:N(w,{interrupt:!0})},c={code:null,containerState:{},defineSkip:b,events:[],now:h,parser:e,previous:null,sliceSerialize:m,sliceStream:p,write:f};let d=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function f(O){return a=Zo(a,O),x(),a[a.length-1]!==null?[]:(k(t,0),c.events=iy(i,c.events,c),c.events)}function m(O,R){return Ebe(p(O),R)}function p(O){return _be(a,O)}function h(){const{_bufferIndex:O,_index:R,line:T,column:I,offset:P}=r;return{_bufferIndex:O,_index:R,line:T,column:I,offset:P}}function b(O){o[O.line]=O.column,$()}function x(){let O;for(;r._index<a.length;){const R=a[r._index];if(typeof R=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<R.length;)g(R.charCodeAt(r._bufferIndex));else g(R)}}function g(O){d=d(O)}function v(O){Rt(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,$()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=O}function S(O,R){const T=R||{};return T.type=O,T.start=h(),c.events.push(["enter",T,c]),s.push(T),T}function C(O){const R=s.pop();return R.end=h(),c.events.push(["exit",R,c]),R}function _(O,R){k(O,R.from)}function w(O,R){R.restore()}function N(O,R){return T;function T(I,P,j){let L,D,z,M;return Array.isArray(I)?F(I):"tokenize"in I?F([I]):H(I);function H(W){return q;function q(U){const te=U!==null&&W[U],le=U!==null&&W.null,ie=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(le)?le:le?[le]:[]];return F(ie)(U)}}function F(W){return L=W,D=0,W.length===0?j:A(W[D])}function A(W){return q;function q(U){return M=E(),z=W,W.partial||(c.currentConstruct=W),W.name&&c.parser.constructs.disable.null.includes(W.name)?K():W.tokenize.call(R?Object.assign(Object.create(c),R):c,l,B,K)(U)}}function B(W){return O(z,M),P}function K(W){return M.restore(),++D<L.length?A(L[D]):j}}}function k(O,R){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Ao(c.events,R,c.events.length-R,O.resolve(c.events.slice(R),c)),O.resolveTo&&(c.events=O.resolveTo(c.events,c))}function E(){const O=h(),R=c.previous,T=c.currentConstruct,I=c.events.length,P=Array.from(s);return{from:I,restore:j};function j(){r=O,c.previous=R,c.currentConstruct=T,c.events.length=I,s=P,$()}}function $(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function _be(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let a;if(n===o)a=[e[n].slice(r,i)];else{if(a=e.slice(n,o),r>-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}i>0&&a.push(e[o].slice(0,i))}return a}function Ebe(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
470
470
|
`;break}case-3:{a=`\r
|
|
471
|
-
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&o)continue;a=" ";break}default:a=String.fromCharCode(i)}o=i===-2,r.push(a)}return r.join("")}function _be(e){const r={constructs:oF([xbe,...(e||{}).extensions||[]]),content:o(zve),defined:[],document:o(Fve),flow:o(ibe),lazy:{},string:o(lbe),text:o(cbe)};return r;function o(i){return a;function a(s){return Sbe(r,i,s)}}}function Ebe(e){for(;!cF(e););return e}const ER=/[\0\t\n\r]/g;function $be(){let e=1,t="",n=!0,r;return o;function o(i,a,s){const l=[];let c,d,f,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(ER.lastIndex=f,c=ER.exec(i),m=c&&c.index!==void 0?c.index:i.length,p=i.charCodeAt(m),!c){t=i.slice(f);break}if(p===10&&f===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<m&&(l.push(i.slice(f,m)),e+=m-f),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=m+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const kbe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Nbe(e){return e.replace(kbe,Obe)}function Obe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return iF(n.slice(i?2:1),i?16:10)}return A1(n)||e}const hF={}.hasOwnProperty;function Ibe(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Rbe(n)(Ebe(_be(n).document().write($be()(e,t,!0))))}function Rbe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ge),autolinkProtocol:E,autolinkEmail:E,atxHeading:i(Z),blockQuote:i(le),characterEscape:E,characterReference:E,codeFenced:i(ie),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(ie,a),codeText:i(ee,a),codeTextData:E,data:E,codeFlowValue:E,definition:i(se),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(re),hardBreakEscape:i(X),hardBreakTrailing:i(X),htmlFlow:i(ce,a),htmlFlowData:E,htmlText:i(ce,a),htmlTextData:E,image:i(pe),label:a,link:i(ge),listItem:i(ae),listItemValue:m,listOrdered:i(we,f),listUnordered:i(we),paragraph:i(de),reference:A,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Z),strong:i(ue),thematicBreak:i(Ce)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:te,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:K,characterReferenceMarkerNumeric:K,characterReferenceValue:W,characterReference:q,codeFenced:l(x),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:h,codeFlowValue:$,codeIndented:l(g),codeText:l(P),codeTextData:$,data:$,definition:l(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(T),htmlFlowData:$,htmlText:l(I),htmlTextData:$,image:l(L),label:z,labelText:D,lineEnding:O,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:M,resourceTitleString:H,resource:F,setextHeading:l(k),setextHeadingLineSequence:N,setextHeadingText:w,strong:l(),thematicBreak:l()}};gF(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ne){let he={type:"root",children:[]};const ye={stack:[he],tokenStack:[],config:t,enter:s,exit:c,buffer:a,resume:d,data:n},xe=[];let $e=-1;for(;++$e<ne.length;)if(ne[$e][1].type==="listOrdered"||ne[$e][1].type==="listUnordered")if(ne[$e][0]==="enter")xe.push($e);else{const Se=xe.pop();$e=o(ne,Se,$e)}for($e=-1;++$e<ne.length;){const Se=t[ne[$e][0]];hF.call(Se,ne[$e][1].type)&&Se[ne[$e][1].type].call(Object.assign({sliceSerialize:ne[$e][2].sliceSerialize},ye),ne[$e][1])}if(ye.tokenStack.length>0){const Se=ye.tokenStack[ye.tokenStack.length-1];(Se[1]||$R).call(ye,void 0,Se[0])}for(he.position={start:Ua(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Ua(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<t.transforms.length;)he=t.transforms[$e](he)||he;return he}function o(ne,he,ye){let xe=he-1,$e=-1,Se=!1,be,ke,Oe,Me;for(;++xe<=ye;){const _e=ne[xe];switch(_e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{_e[0]==="enter"?$e++:$e--,Me=void 0;break}case"lineEndingBlank":{_e[0]==="enter"&&(be&&!Me&&!$e&&!Oe&&(Oe=xe),Me=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Me=void 0}if(!$e&&_e[0]==="enter"&&_e[1].type==="listItemPrefix"||$e===-1&&_e[0]==="exit"&&(_e[1].type==="listUnordered"||_e[1].type==="listOrdered")){if(be){let je=xe;for(ke=void 0;je--;){const Fe=ne[je];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;ke&&(ne[ke][1].type="lineEndingBlank",Se=!0),Fe[1].type="lineEnding",ke=je}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}Oe&&(!ke||Oe<ke)&&(be._spread=!0),be.end=Object.assign({},ke?ne[ke][1].start:_e[1].end),ne.splice(ke||xe,0,["exit",be,_e[2]]),xe++,ye++}if(_e[1].type==="listItemPrefix"){const je={type:"listItem",_spread:!1,start:Object.assign({},_e[1].start),end:void 0};be=je,ne.splice(xe,0,["enter",je,_e[2]]),xe++,ye++,Oe=void 0,Me=!0}}}return ne[he][1]._spread=Se,ye}function i(ne,he){return ye;function ye(xe){s.call(this,ne(xe),xe),he&&he.call(this,xe)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(ne,he,ye){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([he,ye||void 0]),ne.position={start:Ua(he.start),end:void 0}}function l(ne){return he;function he(ye){ne&&ne.call(this,ye),c.call(this,ye)}}function c(ne,he){const ye=this.stack.pop(),xe=this.tokenStack.pop();if(xe)xe[0].type!==ne.type&&(he?he.call(this,ne,xe[0]):(xe[1]||$R).call(this,ne,xe[0]));else throw new Error("Cannot close `"+ne.type+"` ("+jd({start:ne.start,end:ne.end})+"): it’s not open");ye.position.end=Ua(ne.end)}function d(){return M1(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(ne){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.lang=ne}function h(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.meta=ne}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne.replace(/(\r?\n|\r)$/g,"")}function v(ne){const he=this.resume(),ye=this.stack[this.stack.length-1];ye.label=he,ye.identifier=$i(this.sliceSerialize(ne)).toLowerCase()}function S(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.title=ne}function C(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.url=ne}function _(ne){const he=this.stack[this.stack.length-1];if(!he.depth){const ye=this.sliceSerialize(ne).length;he.depth=ye}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function N(ne){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function E(ne){const ye=this.stack[this.stack.length-1].children;let xe=ye[ye.length-1];(!xe||xe.type!=="text")&&(xe=me(),xe.position={start:Ua(ne.start),end:void 0},ye.push(xe)),this.stack.push(xe)}function $(ne){const he=this.stack.pop();he.value+=this.sliceSerialize(ne),he.position.end=Ua(ne.end)}function O(ne){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=he.children[he.children.length-1];ye.position.end=Ua(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(he.type)&&(E.call(this,ne),$.call(this,ne))}function R(){this.data.atHardBreak=!0}function T(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function I(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function P(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function j(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=he,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function L(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=he,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function D(ne){const he=this.sliceSerialize(ne),ye=this.stack[this.stack.length-2];ye.label=Nbe(he),ye.identifier=$i(he).toLowerCase()}function z(){const ne=this.stack[this.stack.length-1],he=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const xe=ne.children;ye.children=xe}else ye.alt=he}function M(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.url=ne}function H(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.title=ne}function F(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function B(ne){const he=this.resume(),ye=this.stack[this.stack.length-1];ye.label=he,ye.identifier=$i(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function K(ne){this.data.characterReferenceType=ne.type}function W(ne){const he=this.sliceSerialize(ne),ye=this.data.characterReferenceType;let xe;ye?(xe=iF(he,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):xe=A1(he);const $e=this.stack[this.stack.length-1];$e.value+=xe}function q(ne){const he=this.stack.pop();he.position.end=Ua(ne.end)}function U(ne){$.call(this,ne);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(ne)}function te(ne){$.call(this,ne);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(ne)}function le(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function ee(){return{type:"inlineCode",value:""}}function se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function re(){return{type:"emphasis",children:[]}}function Z(){return{type:"heading",depth:0,children:[]}}function X(){return{type:"break"}}function ce(){return{type:"html",value:""}}function pe(){return{type:"image",title:null,url:"",alt:null}}function ge(){return{type:"link",title:null,url:"",children:[]}}function we(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function ae(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function de(){return{type:"paragraph",children:[]}}function ue(){return{type:"strong",children:[]}}function me(){return{type:"text",value:""}}function Ce(){return{type:"thematicBreak"}}}function Ua(e){return{line:e.line,column:e.column,offset:e.offset}}function gF(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?gF(e,r):Pbe(e,r)}}function Pbe(e,t){let n;for(n in t)if(hF.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function $R(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jd({start:t.start,end:t.end})+") is still open")}function Tbe(e){const t=this;t.parser=n;function n(r){return Ibe(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function jbe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Mbe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
472
|
-
`}]}function
|
|
473
|
-
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function
|
|
471
|
+
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&o)continue;a=" ";break}default:a=String.fromCharCode(i)}o=i===-2,r.push(a)}return r.join("")}function $be(e){const r={constructs:oF([Cbe,...(e||{}).extensions||[]]),content:o(Fve),defined:[],document:o(Vve),flow:o(sbe),lazy:{},string:o(ube),text:o(dbe)};return r;function o(i){return a;function a(s){return wbe(r,i,s)}}}function kbe(e){for(;!cF(e););return e}const ER=/[\0\t\n\r]/g;function Nbe(){let e=1,t="",n=!0,r;return o;function o(i,a,s){const l=[];let c,d,f,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(ER.lastIndex=f,c=ER.exec(i),m=c&&c.index!==void 0?c.index:i.length,p=i.charCodeAt(m),!c){t=i.slice(f);break}if(p===10&&f===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<m&&(l.push(i.slice(f,m)),e+=m-f),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=m+1}return s&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Obe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ibe(e){return e.replace(Obe,Rbe)}function Rbe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return iF(n.slice(i?2:1),i?16:10)}return A1(n)||e}const hF={}.hasOwnProperty;function Pbe(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Tbe(n)(kbe($be(n).document().write(Nbe()(e,t,!0))))}function Tbe(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ge),autolinkProtocol:E,autolinkEmail:E,atxHeading:i(Z),blockQuote:i(le),characterEscape:E,characterReference:E,codeFenced:i(ie),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(ie,a),codeText:i(ee,a),codeTextData:E,data:E,codeFlowValue:E,definition:i(se),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(re),hardBreakEscape:i(X),hardBreakTrailing:i(X),htmlFlow:i(ce,a),htmlFlowData:E,htmlText:i(ce,a),htmlTextData:E,image:i(pe),label:a,link:i(ge),listItem:i(ae),listItemValue:m,listOrdered:i(we,f),listUnordered:i(we),paragraph:i(de),reference:A,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Z),strong:i(ue),thematicBreak:i(Ce)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:te,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:K,characterReferenceMarkerNumeric:K,characterReferenceValue:W,characterReference:q,codeFenced:l(x),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:h,codeFlowValue:$,codeIndented:l(g),codeText:l(P),codeTextData:$,data:$,definition:l(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(T),htmlFlowData:$,htmlText:l(I),htmlTextData:$,image:l(L),label:z,labelText:D,lineEnding:O,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:M,resourceTitleString:H,resource:F,setextHeading:l(k),setextHeadingLineSequence:N,setextHeadingText:w,strong:l(),thematicBreak:l()}};gF(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ne){let he={type:"root",children:[]};const ye={stack:[he],tokenStack:[],config:t,enter:s,exit:c,buffer:a,resume:d,data:n},xe=[];let $e=-1;for(;++$e<ne.length;)if(ne[$e][1].type==="listOrdered"||ne[$e][1].type==="listUnordered")if(ne[$e][0]==="enter")xe.push($e);else{const Se=xe.pop();$e=o(ne,Se,$e)}for($e=-1;++$e<ne.length;){const Se=t[ne[$e][0]];hF.call(Se,ne[$e][1].type)&&Se[ne[$e][1].type].call(Object.assign({sliceSerialize:ne[$e][2].sliceSerialize},ye),ne[$e][1])}if(ye.tokenStack.length>0){const Se=ye.tokenStack[ye.tokenStack.length-1];(Se[1]||$R).call(ye,void 0,Se[0])}for(he.position={start:Ua(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Ua(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e<t.transforms.length;)he=t.transforms[$e](he)||he;return he}function o(ne,he,ye){let xe=he-1,$e=-1,Se=!1,be,ke,Oe,Me;for(;++xe<=ye;){const _e=ne[xe];switch(_e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{_e[0]==="enter"?$e++:$e--,Me=void 0;break}case"lineEndingBlank":{_e[0]==="enter"&&(be&&!Me&&!$e&&!Oe&&(Oe=xe),Me=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Me=void 0}if(!$e&&_e[0]==="enter"&&_e[1].type==="listItemPrefix"||$e===-1&&_e[0]==="exit"&&(_e[1].type==="listUnordered"||_e[1].type==="listOrdered")){if(be){let je=xe;for(ke=void 0;je--;){const Fe=ne[je];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;ke&&(ne[ke][1].type="lineEndingBlank",Se=!0),Fe[1].type="lineEnding",ke=je}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}Oe&&(!ke||Oe<ke)&&(be._spread=!0),be.end=Object.assign({},ke?ne[ke][1].start:_e[1].end),ne.splice(ke||xe,0,["exit",be,_e[2]]),xe++,ye++}if(_e[1].type==="listItemPrefix"){const je={type:"listItem",_spread:!1,start:Object.assign({},_e[1].start),end:void 0};be=je,ne.splice(xe,0,["enter",je,_e[2]]),xe++,ye++,Oe=void 0,Me=!0}}}return ne[he][1]._spread=Se,ye}function i(ne,he){return ye;function ye(xe){s.call(this,ne(xe),xe),he&&he.call(this,xe)}}function a(){this.stack.push({type:"fragment",children:[]})}function s(ne,he,ye){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([he,ye||void 0]),ne.position={start:Ua(he.start),end:void 0}}function l(ne){return he;function he(ye){ne&&ne.call(this,ye),c.call(this,ye)}}function c(ne,he){const ye=this.stack.pop(),xe=this.tokenStack.pop();if(xe)xe[0].type!==ne.type&&(he?he.call(this,ne,xe[0]):(xe[1]||$R).call(this,ne,xe[0]));else throw new Error("Cannot close `"+ne.type+"` ("+jd({start:ne.start,end:ne.end})+"): it’s not open");ye.position.end=Ua(ne.end)}function d(){return M1(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(ne){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function p(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.lang=ne}function h(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.meta=ne}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne.replace(/(\r?\n|\r)$/g,"")}function v(ne){const he=this.resume(),ye=this.stack[this.stack.length-1];ye.label=he,ye.identifier=$i(this.sliceSerialize(ne)).toLowerCase()}function S(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.title=ne}function C(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.url=ne}function _(ne){const he=this.stack[this.stack.length-1];if(!he.depth){const ye=this.sliceSerialize(ne).length;he.depth=ye}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function N(ne){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function k(){this.data.setextHeadingSlurpLineEnding=void 0}function E(ne){const ye=this.stack[this.stack.length-1].children;let xe=ye[ye.length-1];(!xe||xe.type!=="text")&&(xe=me(),xe.position={start:Ua(ne.start),end:void 0},ye.push(xe)),this.stack.push(xe)}function $(ne){const he=this.stack.pop();he.value+=this.sliceSerialize(ne),he.position.end=Ua(ne.end)}function O(ne){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ye=he.children[he.children.length-1];ye.position.end=Ua(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(he.type)&&(E.call(this,ne),$.call(this,ne))}function R(){this.data.atHardBreak=!0}function T(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function I(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function P(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.value=ne}function j(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=he,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function L(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=he,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function D(ne){const he=this.sliceSerialize(ne),ye=this.stack[this.stack.length-2];ye.label=Ibe(he),ye.identifier=$i(he).toLowerCase()}function z(){const ne=this.stack[this.stack.length-1],he=this.resume(),ye=this.stack[this.stack.length-1];if(this.data.inReference=!0,ye.type==="link"){const xe=ne.children;ye.children=xe}else ye.alt=he}function M(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.url=ne}function H(){const ne=this.resume(),he=this.stack[this.stack.length-1];he.title=ne}function F(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function B(ne){const he=this.resume(),ye=this.stack[this.stack.length-1];ye.label=he,ye.identifier=$i(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function K(ne){this.data.characterReferenceType=ne.type}function W(ne){const he=this.sliceSerialize(ne),ye=this.data.characterReferenceType;let xe;ye?(xe=iF(he,ye==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):xe=A1(he);const $e=this.stack[this.stack.length-1];$e.value+=xe}function q(ne){const he=this.stack.pop();he.position.end=Ua(ne.end)}function U(ne){$.call(this,ne);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(ne)}function te(ne){$.call(this,ne);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(ne)}function le(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function ee(){return{type:"inlineCode",value:""}}function se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function re(){return{type:"emphasis",children:[]}}function Z(){return{type:"heading",depth:0,children:[]}}function X(){return{type:"break"}}function ce(){return{type:"html",value:""}}function pe(){return{type:"image",title:null,url:"",alt:null}}function ge(){return{type:"link",title:null,url:"",children:[]}}function we(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function ae(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function de(){return{type:"paragraph",children:[]}}function ue(){return{type:"strong",children:[]}}function me(){return{type:"text",value:""}}function Ce(){return{type:"thematicBreak"}}}function Ua(e){return{line:e.line,column:e.column,offset:e.offset}}function gF(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?gF(e,r):jbe(e,r)}}function jbe(e,t){let n;for(n in t)if(hF.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function $R(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jd({start:t.start,end:t.end})+") is still open")}function Mbe(e){const t=this;t.parser=n;function n(r){return Pbe(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Abe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Lbe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
472
|
+
`}]}function Dbe(e,t){const n=t.value?t.value+`
|
|
473
|
+
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function zbe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Bbe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fbe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=Lu(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,s+=1,e.footnoteCounts.set(r,s);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function Hbe(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Vbe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function vF(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const a=o[o.length-1];return a&&a.type==="text"?a.value+=r:o.push({type:"text",value:r}),o}function Wbe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vF(e,t);const o={src:Lu(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function Kbe(e,t){const n={src:Lu(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Ube(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Gbe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vF(e,t);const o={href:Lu(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function qbe(e,t){const n={href:Lu(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Xbe(e,t,n){const r=e.all(t),o=n?Ybe(n):yF(t),i={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let s=-1;for(;++s<r.length;){const d=r[s];(o||s!==0||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
|
|
474
474
|
`}),d.type==="element"&&d.tagName==="p"&&!o?a.push(...d.children):a.push(d)}const l=r[r.length-1];l&&(o||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
|
|
475
|
-
`});const c={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,c),e.applyData(t,c)}function
|
|
475
|
+
`});const c={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,c),e.applyData(t,c)}function Ybe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=yF(n[r])}return t}function yF(e){const t=e.spread;return t??e.children.length>1}function Qbe(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const a=r[o];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function Zbe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jbe(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function e0e(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function t0e(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),o.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=R1(t.children[1]),l=QB(t.children[t.children.length-1]);s&&l&&(a.position={start:s,end:l}),o.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function n0e(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,s=a?a.length:t.children.length;let l=-1;const c=[];for(;++l<s;){const f=t.children[l],m={},p=a?a[l]:void 0;p&&(m.align=p);let h={type:"element",tagName:i,properties:m,children:[]};f&&(h.children=e.all(f),e.patch(f,h),h=e.applyData(f,h)),c.push(h)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function r0e(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const kR=9,NR=32;function o0e(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(OR(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(OR(t.slice(o),o>0,!1)),i.join("")}function OR(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===kR||i===NR;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===kR||i===NR;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function i0e(e,t){const n={type:"text",value:o0e(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function a0e(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const s0e={blockquote:Abe,break:Lbe,code:Dbe,delete:zbe,emphasis:Bbe,footnoteReference:Fbe,heading:Hbe,html:Vbe,imageReference:Wbe,image:Kbe,inlineCode:Ube,linkReference:Gbe,link:qbe,listItem:Xbe,list:Qbe,paragraph:Zbe,root:Jbe,strong:e0e,table:t0e,tableCell:r0e,tableRow:n0e,text:i0e,thematicBreak:a0e,toml:lp,yaml:lp,definition:lp,footnoteDefinition:lp};function lp(){}const bF=-1,ay=0,Ad=1,ug=2,D1=3,z1=4,B1=5,F1=6,xF=7,SF=8,IR=typeof self=="object"?self:globalThis,l0e=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,a]=t[o];switch(i){case ay:case bF:return n(a,o);case Ad:{const s=n([],o);for(const l of a)s.push(r(l));return s}case ug:{const s=n({},o);for(const[l,c]of a)s[r(l)]=r(c);return s}case D1:return n(new Date(a),o);case z1:{const{source:s,flags:l}=a;return n(new RegExp(s,l),o)}case B1:{const s=n(new Map,o);for(const[l,c]of a)s.set(r(l),r(c));return s}case F1:{const s=n(new Set,o);for(const l of a)s.add(r(l));return s}case xF:{const{name:s,message:l}=a;return n(new IR[s](l),o)}case SF:return n(BigInt(a),o);case"BigInt":return n(Object(BigInt(a)),o);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:s}=new Uint8Array(a);return n(new DataView(s),a)}}return n(new IR[i](a),o)};return r},RR=e=>l0e(new Map,e)(0),Gl="",{toString:c0e}={},{keys:u0e}=Object,rd=e=>{const t=typeof e;if(t!=="object"||!e)return[ay,t];const n=c0e.call(e).slice(8,-1);switch(n){case"Array":return[Ad,Gl];case"Object":return[ug,Gl];case"Date":return[D1,Gl];case"RegExp":return[z1,Gl];case"Map":return[B1,Gl];case"Set":return[F1,Gl];case"DataView":return[Ad,n]}return n.includes("Array")?[Ad,n]:n.includes("Error")?[xF,n]:[ug,n]},cp=([e,t])=>e===ay&&(t==="function"||t==="symbol"),d0e=(e,t,n,r)=>{const o=(a,s)=>{const l=r.push(a)-1;return n.set(s,l),l},i=a=>{if(n.has(a))return n.get(a);let[s,l]=rd(a);switch(s){case ay:{let d=a;switch(l){case"bigint":s=SF,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return o([bF],a)}return o([s,d],a)}case Ad:{if(l){let m=a;return l==="DataView"?m=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(m=new Uint8Array(a)),o([l,[...m]],a)}const d=[],f=o([s,d],a);for(const m of a)d.push(i(m));return f}case ug:{if(l)switch(l){case"BigInt":return o([l,a.toString()],a);case"Boolean":case"Number":case"String":return o([l,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const d=[],f=o([s,d],a);for(const m of u0e(a))(e||!cp(rd(a[m])))&&d.push([i(m),i(a[m])]);return f}case D1:return o([s,a.toISOString()],a);case z1:{const{source:d,flags:f}=a;return o([s,{source:d,flags:f}],a)}case B1:{const d=[],f=o([s,d],a);for(const[m,p]of a)(e||!(cp(rd(m))||cp(rd(p))))&&d.push([i(m),i(p)]);return f}case F1:{const d=[],f=o([s,d],a);for(const m of a)(e||!cp(rd(m)))&&d.push(i(m));return f}}const{message:c}=a;return o([s,{name:l,message:c}],a)};return i},PR=(e,{json:t,lossy:n}={})=>{const r=[];return d0e(!(t||n),!!t,new Map,r)(e),r},dg=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?RR(PR(e,t)):structuredClone(e):(e,t)=>RR(PR(e,t));function f0e(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function m0e(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function p0e(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||f0e,r=e.options.footnoteBackLabel||m0e,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const d=e.all(c),f=String(c.identifier).toUpperCase(),m=Lu(f.toLowerCase());let p=0;const h=[],b=e.footnoteCounts.get(f);for(;b!==void 0&&++p<=b;){h.length>0&&h.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,p);typeof v=="string"&&(v={type:"text",value:v}),h.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...h)}else d.push(...h);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(c,g),s.push(g)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...dg(a),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
476
476
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:`
|
|
477
|
-
`}]}}const sy=function(e){if(e==null)return
|
|
477
|
+
`}]}}const sy=function(e){if(e==null)return y0e;if(typeof e=="function")return ly(e);if(typeof e=="object")return Array.isArray(e)?h0e(e):g0e(e);if(typeof e=="string")return v0e(e);throw new Error("Expected function, string, or object as test")};function h0e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=sy(e[n]);return ly(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function g0e(e){const t=e;return ly(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function v0e(e){return ly(t);function t(n){return n&&n.type===e}}function ly(e){return t;function t(n,r,o){return!!(b0e(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function y0e(){return!0}function b0e(e){return e!==null&&typeof e=="object"&&"type"in e}const CF=[],x0e=!0,CC=!1,S0e="skip";function wF(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=sy(o),a=r?-1:1;s(e,void 0,[])();function s(l,c,d){const f=l&&typeof l=="object"?l:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=CF,h,b,x;if((!t||i(l,c,d[d.length-1]||void 0))&&(p=C0e(n(l,d)),p[0]===CC))return p;if("children"in l&&l.children){const g=l;if(g.children&&p[0]!==S0e)for(b=(r?g.children.length:-1)+a,x=d.concat(g);b>-1&&b<g.children.length;){const v=g.children[b];if(h=s(v,b,x)(),h[0]===CC)return h;b=typeof h[1]=="number"?h[1]:b+a}}return p}}}function C0e(e){return Array.isArray(e)?e:typeof e=="number"?[x0e,e]:e==null?CF:[e]}function H1(e,t,n,r){let o,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,o=n):(i=t,a=n,o=r),wF(e,i,s,o);function s(l,c){const d=c[c.length-1],f=d?d.children.indexOf(l):void 0;return a(l,f,d)}}const wC={}.hasOwnProperty,w0e={};function _0e(e,t){const n=t||w0e,r=new Map,o=new Map,i=new Map,a={...s0e,...n.handlers},s={all:c,applyData:$0e,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:a,one:l,options:n,patch:E0e,wrap:N0e};return H1(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:o,m=String(d.identifier).toUpperCase();f.has(m)||f.set(m,d)}}),s;function l(d,f){const m=d.type,p=s.handlers[m];if(wC.call(s.handlers,m)&&p)return p(s,d,f);if(s.options.passThrough&&s.options.passThrough.includes(m)){if("children"in d){const{children:b,...x}=d,g=dg(x);return g.children=s.all(d),g}return dg(d)}return(s.options.unknownHandler||k0e)(s,d,f)}function c(d){const f=[];if("children"in d){const m=d.children;let p=-1;for(;++p<m.length;){const h=s.one(m[p],d);if(h){if(p&&m[p-1].type==="break"&&(!Array.isArray(h)&&h.type==="text"&&(h.value=TR(h.value)),!Array.isArray(h)&&h.type==="element")){const b=h.children[0];b&&b.type==="text"&&(b.value=TR(b.value))}Array.isArray(h)?f.push(...h):f.push(h)}}}return f}}function E0e(e,t){e.position&&(t.position=mve(e))}function $0e(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,dg(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function k0e(e,t){const n=t.data||{},r="value"in t&&!(wC.call(n,"hProperties")||wC.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function N0e(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
478
478
|
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
479
479
|
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
480
|
-
`}),n}function TR(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function jR(e,t){const n=
|
|
481
|
-
`},o),i}function k0e(e,t){return e&&"run"in e?async function(n,r){const o=jR(n,{file:r,...t});await e.run(o,r)}:function(n,r){return jR(n,{file:r,...e||t})}}function MR(e){if(e)throw e}var Gp=Object.prototype.hasOwnProperty,_F=Object.prototype.toString,AR=Object.defineProperty,LR=Object.getOwnPropertyDescriptor,DR=function(t){return typeof Array.isArray=="function"?Array.isArray(t):_F.call(t)==="[object Array]"},zR=function(t){if(!t||_F.call(t)!=="[object Object]")return!1;var n=Gp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Gp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Gp.call(t,o)},BR=function(t,n){AR&&n.name==="__proto__"?AR(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},FR=function(t,n){if(n==="__proto__")if(Gp.call(t,n)){if(LR)return LR(t,n).value}else return;return t[n]},N0e=function e(){var t,n,r,o,i,a,s=arguments[0],l=1,c=arguments.length,d=!1;for(typeof s=="boolean"&&(d=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=FR(s,n),o=FR(t,n),s!==o&&(d&&o&&(zR(o)||(i=DR(o)))?(i?(i=!1,a=r&&DR(r)?r:[]):a=r&&zR(r)?r:{},BR(s,{name:n,newValue:e(d,a,o)})):typeof o<"u"&&BR(s,{name:n,newValue:o}));return s};const d0=Da(N0e);function _C(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function O0e(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const a=o.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);s(null,...o);function s(l,...c){const d=e[++i];let f=-1;if(l){a(l);return}for(;++f<o.length;)(c[f]===null||c[f]===void 0)&&(c[f]=o[f]);o=c,d?I0e(d,s)(...c):a(null,...c)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function I0e(e,t){let n;return r;function r(...a){const s=e.length>a.length;let l;s&&a.push(o);try{l=e.apply(this,a)}catch(c){const d=c;if(s&&n)throw d;return o(d)}s||(l&&l.then&&typeof l.then=="function"?l.then(i,o):l instanceof Error?o(l):i(l))}function o(a,...s){n||(n=!0,t(a,...s))}function i(a){o(null,a)}}const Hi={basename:R0e,dirname:P0e,extname:T0e,join:j0e,sep:"/"};function R0e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');hm(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,s=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else a<0&&(i=!0,a=o+1),s>-1&&(e.codePointAt(o)===t.codePointAt(s--)?s<0&&(r=o):(s=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function P0e(e){if(hm(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function T0e(e){hm(e);let t=e.length,n=-1,r=0,o=-1,i=0,a;for(;t--;){const s=e.codePointAt(t);if(s===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),s===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function j0e(...e){let t=-1,n;for(;++t<e.length;)hm(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":M0e(n)}function M0e(e){hm(e);const t=e.codePointAt(0)===47;let n=A0e(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function A0e(e,t){let n="",r=0,o=-1,i=0,a=-1,s,l;for(;++a<=e.length;){if(a<e.length)s=e.codePointAt(a);else{if(s===47)break;s=47}if(s===47){if(!(o===a-1||i===1))if(o!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),o=a,i=0;continue}}else if(n.length>0){n="",r=0,o=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,a):n=e.slice(o+1,a),r=a-o-1;o=a,i=0}else s===46&&i>-1?i++:i=-1}return n}function hm(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const L0e={cwd:D0e};function D0e(){return"/"}function EC(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function z0e(e){if(typeof e=="string")e=new URL(e);else if(!EC(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return B0e(e)}function B0e(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const f0=["history","path","basename","stem","extname","dirname"];class EF{constructor(t){let n;t?EC(t)?n={path:t}:typeof t=="string"||F0e(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":L0e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<f0.length;){const i=f0[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)f0.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Hi.basename(this.path):void 0}set basename(t){p0(t,"basename"),m0(t,"basename"),this.path=Hi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Hi.dirname(this.path):void 0}set dirname(t){HR(this.basename,"dirname"),this.path=Hi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Hi.extname(this.path):void 0}set extname(t){if(m0(t,"extname"),HR(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Hi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){EC(t)&&(t=z0e(t)),p0(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Hi.basename(this.path,this.extname):void 0}set stem(t){p0(t,"stem"),m0(t,"stem"),this.path=Hi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new no(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function m0(e,t){if(e&&e.includes(Hi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Hi.sep+"`")}function p0(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function HR(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function F0e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const H0e=function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},V0e={}.hasOwnProperty;class V1 extends H0e{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=O0e()}copy(){const t=new V1;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(d0(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(v0("data",this.frozen),this.namespace[t]=n,this):V0e.call(this.namespace,t)&&this.namespace[t]||void 0:t?(v0("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=up(t),r=this.parser||this.Parser;return h0("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),h0("process",this.parser||this.Parser),g0("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,a){const s=up(t),l=r.parse(s);r.run(l,s,function(d,f,m){if(d||!f||!m)return c(d);const p=f,h=r.stringify(p,m);U0e(h)?m.value=h:m.result=h,c(d,m)});function c(d,f){d||!f?a(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),h0("processSync",this.parser||this.Parser),g0("processSync",this.compiler||this.Compiler),this.process(t,o),WR("processSync","process",n),r;function o(i,a){n=!0,MR(i),r=a}}run(t,n,r){VR(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,s){const l=up(n);o.run(t,l,c);function c(d,f,m){const p=f||t;d?s(d):a?a(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),WR("runSync","run",r),o;function i(a,s){MR(a),o=s,r=!0}}stringify(t,n){this.freeze();const r=up(n),o=this.compiler||this.Compiler;return g0("stringify",o),VR(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(v0("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?s(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...f]=c;l(d,f)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(o.settings=d0(!0,o.settings,c.settings))}function s(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const f=c[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let f=-1,m=-1;for(;++f<r.length;)if(r[f][0]===c){m=f;break}if(m===-1)r.push([c,...d]);else if(d.length>0){let[p,...h]=d;const b=r[m][1];_C(b)&&_C(p)&&(p=d0(!0,b,p)),r[m]=[c,p,...h]}}}}const W0e=new V1().freeze();function h0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function g0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function v0(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function VR(e){if(!_C(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function WR(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function up(e){return K0e(e)?e:new EF(e)}function K0e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function U0e(e){return typeof e=="string"||G0e(e)}function G0e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const q0e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",KR=[],UR={allowDangerousHtml:!0},X0e=/^(https?|ircs?|mailto|xmpp)$/i,Y0e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Q0e(e){const t=Z0e(e),n=J0e(e);return exe(t.runSync(t.parse(n),n),e)}function Z0e(e){const t=e.rehypePlugins||KR,n=e.remarkPlugins||KR,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...UR}:UR;return W0e().use(Tbe).use(n).use(k0e,r).use(t)}function J0e(e){const t=e.children||"",n=new EF;return typeof t=="string"&&(n.value=t),n}function exe(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,a=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||txe;for(const d of Y0e)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+q0e+d.id,void 0);return H1(e,c),gve(e,{Fragment:y.Fragment,components:o,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function c(d,f,m){if(d.type==="raw"&&m&&typeof f=="number")return a?m.children.splice(f,1):m.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in l0)if(Object.hasOwn(l0,p)&&Object.hasOwn(d.properties,p)){const h=d.properties[p],b=l0[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=l(String(h||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,m)),p&&m&&typeof f=="number")return s&&d.children?m.children.splice(f,1,...d.children):m.children.splice(f,1),f}}}function txe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||X0e.test(e.slice(0,t))?e:""}function nxe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function rxe(e,t,n){const o=sy((n||{}).ignore||[]),i=oxe(t);let a=-1;for(;++a<i.length;)wF(e,"text",s);function s(c,d){let f=-1,m;for(;++f<d.length;){const p=d[f],h=m?m.children:void 0;if(o(p,h?h.indexOf(p):void 0,m))return;m=p}if(m)return l(c,d)}function l(c,d){const f=d[d.length-1],m=i[a][0],p=i[a][1];let h=0;const x=f.children.indexOf(c);let g=!1,v=[];m.lastIndex=0;let S=m.exec(c.value);for(;S;){const C=S.index,_={index:S.index,input:S.input,stack:[...d,c]};let w=p(...S,_);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?m.lastIndex=C+1:(h!==C&&v.push({type:"text",value:c.value.slice(h,C)}),Array.isArray(w)?v.push(...w):w&&v.push(w),h=C+S[0].length,g=!0),!m.global)break;S=m.exec(c.value)}return g?(h<c.value.length&&v.push({type:"text",value:c.value.slice(h)}),f.children.splice(x,1,...v)):v=[c],x+v.length}}function oxe(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const o=n[r];t.push([ixe(o[0]),axe(o[1])])}return t}function ixe(e){return typeof e=="string"?new RegExp(nxe(e),"g"):e}function axe(e){return typeof e=="function"?e:function(){return e}}const y0="phrasing",b0=["autolink","link","image","label"];function sxe(){return{transforms:[pxe],enter:{literalAutolink:cxe,literalAutolinkEmail:x0,literalAutolinkHttp:x0,literalAutolinkWww:x0},exit:{literalAutolink:mxe,literalAutolinkEmail:fxe,literalAutolinkHttp:uxe,literalAutolinkWww:dxe}}}function lxe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:y0,notInConstruct:b0},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:y0,notInConstruct:b0},{character:":",before:"[ps]",after:"\\/",inConstruct:y0,notInConstruct:b0}]}}function cxe(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function x0(e){this.config.enter.autolinkProtocol.call(this,e)}function uxe(e){this.config.exit.autolinkProtocol.call(this,e)}function dxe(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function fxe(e){this.config.exit.autolinkEmail.call(this,e)}function mxe(e){this.exit(e)}function pxe(e){rxe(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,hxe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),gxe]],{ignore:["link","linkReference"]})}function hxe(e,t,n,r,o){let i="";if(!$F(o)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!vxe(n)))return!1;const a=yxe(n+r);if(!a[0])return!1;const s={type:"link",title:null,url:i+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function gxe(e,t,n,r){return!$F(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function vxe(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function yxe(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=rg(e,"(");let i=rg(e,")");for(;r!==-1&&o>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function $F(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||yl(n)||oy(n))&&(!t||n!==47)}kF.peek=kxe;function bxe(){this.buffer()}function xxe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Sxe(){this.buffer()}function Cxe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function wxe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$i(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _xe(e){this.exit(e)}function Exe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$i(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $xe(e){this.exit(e)}function kxe(){return"["}function kF(e,t,n,r){const o=n.createTracker(r);let i=o.move("[^");const a=n.enter("footnoteReference"),s=n.enter("reference");return i+=o.move(n.safe(n.associationId(e),{after:"]",before:i})),s(),a(),i+=o.move("]"),i}function Nxe(){return{enter:{gfmFootnoteCallString:bxe,gfmFootnoteCall:xxe,gfmFootnoteDefinitionLabelString:Sxe,gfmFootnoteDefinition:Cxe},exit:{gfmFootnoteCallString:wxe,gfmFootnoteCall:_xe,gfmFootnoteDefinitionLabelString:Exe,gfmFootnoteDefinition:$xe}}}function Oxe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:kF},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,i,a){const s=i.createTracker(a);let l=s.move("[^");const c=i.enter("footnoteDefinition"),d=i.enter("label");return l+=s.move(i.safe(i.associationId(r),{before:l,after:"]"})),d(),l+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),l+=s.move((t?`
|
|
482
|
-
`:" ")+i.indentLines(i.containerFlow(r,s.current()),t?NF:
|
|
483
|
-
`)}function
|
|
484
|
-
`&&
|
|
485
|
-
`}function
|
|
480
|
+
`}),n}function TR(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function jR(e,t){const n=_0e(e,t),r=n.one(e,void 0),o=p0e(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
|
|
481
|
+
`},o),i}function O0e(e,t){return e&&"run"in e?async function(n,r){const o=jR(n,{file:r,...t});await e.run(o,r)}:function(n,r){return jR(n,{file:r,...e||t})}}function MR(e){if(e)throw e}var Gp=Object.prototype.hasOwnProperty,_F=Object.prototype.toString,AR=Object.defineProperty,LR=Object.getOwnPropertyDescriptor,DR=function(t){return typeof Array.isArray=="function"?Array.isArray(t):_F.call(t)==="[object Array]"},zR=function(t){if(!t||_F.call(t)!=="[object Object]")return!1;var n=Gp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Gp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Gp.call(t,o)},BR=function(t,n){AR&&n.name==="__proto__"?AR(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},FR=function(t,n){if(n==="__proto__")if(Gp.call(t,n)){if(LR)return LR(t,n).value}else return;return t[n]},I0e=function e(){var t,n,r,o,i,a,s=arguments[0],l=1,c=arguments.length,d=!1;for(typeof s=="boolean"&&(d=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=FR(s,n),o=FR(t,n),s!==o&&(d&&o&&(zR(o)||(i=DR(o)))?(i?(i=!1,a=r&&DR(r)?r:[]):a=r&&zR(r)?r:{},BR(s,{name:n,newValue:e(d,a,o)})):typeof o<"u"&&BR(s,{name:n,newValue:o}));return s};const d0=Da(I0e);function _C(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function R0e(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const a=o.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);s(null,...o);function s(l,...c){const d=e[++i];let f=-1;if(l){a(l);return}for(;++f<o.length;)(c[f]===null||c[f]===void 0)&&(c[f]=o[f]);o=c,d?P0e(d,s)(...c):a(null,...c)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function P0e(e,t){let n;return r;function r(...a){const s=e.length>a.length;let l;s&&a.push(o);try{l=e.apply(this,a)}catch(c){const d=c;if(s&&n)throw d;return o(d)}s||(l&&l.then&&typeof l.then=="function"?l.then(i,o):l instanceof Error?o(l):i(l))}function o(a,...s){n||(n=!0,t(a,...s))}function i(a){o(null,a)}}const Hi={basename:T0e,dirname:j0e,extname:M0e,join:A0e,sep:"/"};function T0e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');hm(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,s=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else a<0&&(i=!0,a=o+1),s>-1&&(e.codePointAt(o)===t.codePointAt(s--)?s<0&&(r=o):(s=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function j0e(e){if(hm(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function M0e(e){hm(e);let t=e.length,n=-1,r=0,o=-1,i=0,a;for(;t--;){const s=e.codePointAt(t);if(s===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),s===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function A0e(...e){let t=-1,n;for(;++t<e.length;)hm(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":L0e(n)}function L0e(e){hm(e);const t=e.codePointAt(0)===47;let n=D0e(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function D0e(e,t){let n="",r=0,o=-1,i=0,a=-1,s,l;for(;++a<=e.length;){if(a<e.length)s=e.codePointAt(a);else{if(s===47)break;s=47}if(s===47){if(!(o===a-1||i===1))if(o!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),o=a,i=0;continue}}else if(n.length>0){n="",r=0,o=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,a):n=e.slice(o+1,a),r=a-o-1;o=a,i=0}else s===46&&i>-1?i++:i=-1}return n}function hm(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const z0e={cwd:B0e};function B0e(){return"/"}function EC(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function F0e(e){if(typeof e=="string")e=new URL(e);else if(!EC(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return H0e(e)}function H0e(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const f0=["history","path","basename","stem","extname","dirname"];class EF{constructor(t){let n;t?EC(t)?n={path:t}:typeof t=="string"||V0e(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":z0e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<f0.length;){const i=f0[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)f0.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Hi.basename(this.path):void 0}set basename(t){p0(t,"basename"),m0(t,"basename"),this.path=Hi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Hi.dirname(this.path):void 0}set dirname(t){HR(this.basename,"dirname"),this.path=Hi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Hi.extname(this.path):void 0}set extname(t){if(m0(t,"extname"),HR(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Hi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){EC(t)&&(t=F0e(t)),p0(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Hi.basename(this.path,this.extname):void 0}set stem(t){p0(t,"stem"),m0(t,"stem"),this.path=Hi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new no(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function m0(e,t){if(e&&e.includes(Hi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Hi.sep+"`")}function p0(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function HR(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function V0e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const W0e=function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},K0e={}.hasOwnProperty;class V1 extends W0e{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=R0e()}copy(){const t=new V1;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(d0(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(v0("data",this.frozen),this.namespace[t]=n,this):K0e.call(this.namespace,t)&&this.namespace[t]||void 0:t?(v0("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=up(t),r=this.parser||this.Parser;return h0("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),h0("process",this.parser||this.Parser),g0("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,a){const s=up(t),l=r.parse(s);r.run(l,s,function(d,f,m){if(d||!f||!m)return c(d);const p=f,h=r.stringify(p,m);q0e(h)?m.value=h:m.result=h,c(d,m)});function c(d,f){d||!f?a(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),h0("processSync",this.parser||this.Parser),g0("processSync",this.compiler||this.Compiler),this.process(t,o),WR("processSync","process",n),r;function o(i,a){n=!0,MR(i),r=a}}run(t,n,r){VR(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,s){const l=up(n);o.run(t,l,c);function c(d,f,m){const p=f||t;d?s(d):a?a(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),WR("runSync","run",r),o;function i(a,s){MR(a),o=s,r=!0}}stringify(t,n){this.freeze();const r=up(n),o=this.compiler||this.Compiler;return g0("stringify",o),VR(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(v0("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?s(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...f]=c;l(d,f)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(c.plugins),c.settings&&(o.settings=d0(!0,o.settings,c.settings))}function s(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const f=c[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let f=-1,m=-1;for(;++f<r.length;)if(r[f][0]===c){m=f;break}if(m===-1)r.push([c,...d]);else if(d.length>0){let[p,...h]=d;const b=r[m][1];_C(b)&&_C(p)&&(p=d0(!0,b,p)),r[m]=[c,p,...h]}}}}const U0e=new V1().freeze();function h0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function g0(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function v0(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function VR(e){if(!_C(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function WR(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function up(e){return G0e(e)?e:new EF(e)}function G0e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function q0e(e){return typeof e=="string"||X0e(e)}function X0e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Y0e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",KR=[],UR={allowDangerousHtml:!0},Q0e=/^(https?|ircs?|mailto|xmpp)$/i,Z0e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function J0e(e){const t=exe(e),n=txe(e);return nxe(t.runSync(t.parse(n),n),e)}function exe(e){const t=e.rehypePlugins||KR,n=e.remarkPlugins||KR,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...UR}:UR;return U0e().use(Mbe).use(n).use(O0e,r).use(t)}function txe(e){const t=e.children||"",n=new EF;return typeof t=="string"&&(n.value=t),n}function nxe(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,a=t.skipHtml,s=t.unwrapDisallowed,l=t.urlTransform||rxe;for(const d of Z0e)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Y0e+d.id,void 0);return H1(e,c),yve(e,{Fragment:y.Fragment,components:o,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function c(d,f,m){if(d.type==="raw"&&m&&typeof f=="number")return a?m.children.splice(f,1):m.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in l0)if(Object.hasOwn(l0,p)&&Object.hasOwn(d.properties,p)){const h=d.properties[p],b=l0[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=l(String(h||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,m)),p&&m&&typeof f=="number")return s&&d.children?m.children.splice(f,1,...d.children):m.children.splice(f,1),f}}}function rxe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||Q0e.test(e.slice(0,t))?e:""}function oxe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function ixe(e,t,n){const o=sy((n||{}).ignore||[]),i=axe(t);let a=-1;for(;++a<i.length;)wF(e,"text",s);function s(c,d){let f=-1,m;for(;++f<d.length;){const p=d[f],h=m?m.children:void 0;if(o(p,h?h.indexOf(p):void 0,m))return;m=p}if(m)return l(c,d)}function l(c,d){const f=d[d.length-1],m=i[a][0],p=i[a][1];let h=0;const x=f.children.indexOf(c);let g=!1,v=[];m.lastIndex=0;let S=m.exec(c.value);for(;S;){const C=S.index,_={index:S.index,input:S.input,stack:[...d,c]};let w=p(...S,_);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?m.lastIndex=C+1:(h!==C&&v.push({type:"text",value:c.value.slice(h,C)}),Array.isArray(w)?v.push(...w):w&&v.push(w),h=C+S[0].length,g=!0),!m.global)break;S=m.exec(c.value)}return g?(h<c.value.length&&v.push({type:"text",value:c.value.slice(h)}),f.children.splice(x,1,...v)):v=[c],x+v.length}}function axe(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const o=n[r];t.push([sxe(o[0]),lxe(o[1])])}return t}function sxe(e){return typeof e=="string"?new RegExp(oxe(e),"g"):e}function lxe(e){return typeof e=="function"?e:function(){return e}}const y0="phrasing",b0=["autolink","link","image","label"];function cxe(){return{transforms:[gxe],enter:{literalAutolink:dxe,literalAutolinkEmail:x0,literalAutolinkHttp:x0,literalAutolinkWww:x0},exit:{literalAutolink:hxe,literalAutolinkEmail:pxe,literalAutolinkHttp:fxe,literalAutolinkWww:mxe}}}function uxe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:y0,notInConstruct:b0},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:y0,notInConstruct:b0},{character:":",before:"[ps]",after:"\\/",inConstruct:y0,notInConstruct:b0}]}}function dxe(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function x0(e){this.config.enter.autolinkProtocol.call(this,e)}function fxe(e){this.config.exit.autolinkProtocol.call(this,e)}function mxe(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function pxe(e){this.config.exit.autolinkEmail.call(this,e)}function hxe(e){this.exit(e)}function gxe(e){ixe(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,vxe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),yxe]],{ignore:["link","linkReference"]})}function vxe(e,t,n,r,o){let i="";if(!$F(o)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!bxe(n)))return!1;const a=xxe(n+r);if(!a[0])return!1;const s={type:"link",title:null,url:i+t+a[0],children:[{type:"text",value:t+a[0]}]};return a[1]?[s,{type:"text",value:a[1]}]:s}function yxe(e,t,n,r){return!$F(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bxe(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function xxe(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=rg(e,"(");let i=rg(e,")");for(;r!==-1&&o>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function $F(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||yl(n)||oy(n))&&(!t||n!==47)}kF.peek=Oxe;function Sxe(){this.buffer()}function Cxe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function wxe(){this.buffer()}function _xe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Exe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$i(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $xe(e){this.exit(e)}function kxe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$i(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Nxe(e){this.exit(e)}function Oxe(){return"["}function kF(e,t,n,r){const o=n.createTracker(r);let i=o.move("[^");const a=n.enter("footnoteReference"),s=n.enter("reference");return i+=o.move(n.safe(n.associationId(e),{after:"]",before:i})),s(),a(),i+=o.move("]"),i}function Ixe(){return{enter:{gfmFootnoteCallString:Sxe,gfmFootnoteCall:Cxe,gfmFootnoteDefinitionLabelString:wxe,gfmFootnoteDefinition:_xe},exit:{gfmFootnoteCallString:Exe,gfmFootnoteCall:$xe,gfmFootnoteDefinitionLabelString:kxe,gfmFootnoteDefinition:Nxe}}}function Rxe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:kF},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,i,a){const s=i.createTracker(a);let l=s.move("[^");const c=i.enter("footnoteDefinition"),d=i.enter("label");return l+=s.move(i.safe(i.associationId(r),{before:l,after:"]"})),d(),l+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),l+=s.move((t?`
|
|
482
|
+
`:" ")+i.indentLines(i.containerFlow(r,s.current()),t?NF:Pxe))),c(),l}}function Pxe(e,t,n){return t===0?e:NF(e,t,n)}function NF(e,t,n){return(n?"":" ")+e}const Txe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];OF.peek=Dxe;function jxe(){return{canContainEols:["delete"],enter:{strikethrough:Axe},exit:{strikethrough:Lxe}}}function Mxe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Txe}],handlers:{delete:OF}}}function Axe(e){this.enter({type:"delete",children:[]},e)}function Lxe(e){this.exit(e)}function OF(e,t,n,r){const o=n.createTracker(r),i=n.enter("strikethrough");let a=o.move("~~");return a+=n.containerPhrasing(e,{...o.current(),before:a,after:"~"}),a+=o.move("~~"),i(),a}function Dxe(){return"~"}function zxe(e){return e.length}function Bxe(e,t){const n=t||{},r=(n.align||[]).concat(),o=n.stringLength||zxe,i=[],a=[],s=[],l=[];let c=0,d=-1;for(;++d<e.length;){const b=[],x=[];let g=-1;for(e[d].length>c&&(c=e[d].length);++g<e[d].length;){const v=Fxe(e[d][g]);if(n.alignDelimiters!==!1){const S=o(v);x[g]=S,(l[g]===void 0||S>l[g])&&(l[g]=S)}b.push(v)}a[d]=b,s[d]=x}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<c;)i[f]=GR(r[f]);else{const b=GR(r);for(;++f<c;)i[f]=b}f=-1;const m=[],p=[];for(;++f<c;){const b=i[f];let x="",g="";b===99?(x=":",g=":"):b===108?x=":":b===114&&(g=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[f]-x.length-g.length);const S=x+"-".repeat(v)+g;n.alignDelimiters!==!1&&(v=x.length+v+g.length,v>l[f]&&(l[f]=v),p[f]=v),m[f]=S}a.splice(1,0,m),s.splice(1,0,p),d=-1;const h=[];for(;++d<a.length;){const b=a[d],x=s[d];f=-1;const g=[];for(;++f<c;){const v=b[f]||"";let S="",C="";if(n.alignDelimiters!==!1){const _=l[f]-(x[f]||0),w=i[f];w===114?S=" ".repeat(_):w===99?_%2?(S=" ".repeat(_/2+.5),C=" ".repeat(_/2-.5)):(S=" ".repeat(_/2),C=S):C=" ".repeat(_)}n.delimiterStart!==!1&&!f&&g.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&g.push(" "),n.alignDelimiters!==!1&&g.push(S),g.push(v),n.alignDelimiters!==!1&&g.push(C),n.padding!==!1&&g.push(" "),(n.delimiterEnd!==!1||f!==c-1)&&g.push("|")}h.push(n.delimiterEnd===!1?g.join("").replace(/ +$/,""):g.join(""))}return h.join(`
|
|
483
|
+
`)}function Fxe(e){return e==null?"":String(e)}function GR(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Hxe(e,t,n,r){const o=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const a=n.indentLines(n.containerFlow(e,i.current()),Vxe);return o(),a}function Vxe(e,t,n){return">"+(n?"":" ")+e}function Wxe(e,t){return qR(e,t.inConstruct,!0)&&!qR(e,t.notInConstruct,!1)}function qR(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function XR(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
|
|
484
|
+
`&&Wxe(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
485
|
+
`}function Kxe(e,t){const n=String(e);let r=n.indexOf(t),o=r,i=0,a=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++i>a&&(a=i):i=1,o=r+t.length,r=n.indexOf(t,o);return a}function Uxe(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Gxe(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function qxe(e,t,n,r){const o=Gxe(n),i=e.value||"",a=o==="`"?"GraveAccent":"Tilde";if(Uxe(e,n)){const f=n.enter("codeIndented"),m=n.indentLines(i,Xxe);return f(),m}const s=n.createTracker(r),l=o.repeat(Math.max(Kxe(i,o)+1,3)),c=n.enter("codeFenced");let d=s.move(l);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=s.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...s.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=s.move(" "),d+=s.move(n.safe(e.meta,{before:d,after:`
|
|
486
486
|
`,encode:["`"],...s.current()})),f()}return d+=s.move(`
|
|
487
487
|
`),i&&(d+=s.move(i+`
|
|
488
|
-
`)),d+=s.move(l),c(),d}function
|
|
489
|
-
`,...l.current()}))),s(),e.title&&(s=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),s()),a(),c}function
|
|
488
|
+
`)),d+=s.move(l),c(),d}function Xxe(e,t,n){return(n?"":" ")+e}function W1(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Yxe(e,t,n,r){const o=W1(n),i=o==='"'?"Quote":"Apostrophe",a=n.enter("definition");let s=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
|
|
489
|
+
`,...l.current()}))),s(),e.title&&(s=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),s()),a(),c}function Qxe(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Of(e){return"&#x"+e.toString(16).toUpperCase()+";"}function fg(e,t,n){const r=tu(e),o=tu(t);return r===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}IF.peek=Zxe;function IF(e,t,n,r){const o=Qxe(n),i=n.enter("emphasis"),a=n.createTracker(r),s=a.move(o);let l=a.move(n.containerPhrasing(e,{after:o,before:s,...a.current()}));const c=l.charCodeAt(0),d=fg(r.before.charCodeAt(r.before.length-1),c,o);d.inside&&(l=Of(c)+l.slice(1));const f=l.charCodeAt(l.length-1),m=fg(r.after.charCodeAt(0),f,o);m.inside&&(l=l.slice(0,-1)+Of(f));const p=a.move(o);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},s+l+p}function Zxe(e,t,n){return n.options.emphasis||"*"}function Jxe(e,t){let n=!1;return H1(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,CC}),!!((!e.depth||e.depth<3)&&M1(e)&&(t.options.setext||n))}function eSe(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(Jxe(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
|
|
490
490
|
`,after:`
|
|
491
491
|
`});return f(),d(),m+`
|
|
492
492
|
`+(o===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
|
|
493
493
|
`))+1))}const a="#".repeat(o),s=n.enter("headingAtx"),l=n.enter("phrasing");i.move(a+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
|
|
494
|
-
`,...i.current()});return/^[\t ]/.test(c)&&(c=Of(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),s(),c}RF.peek=
|
|
494
|
+
`,...i.current()});return/^[\t ]/.test(c)&&(c=Of(c.charCodeAt(0))+c.slice(1)),c=c?a+" "+c:a,n.options.closeAtx&&(c+=" "+a),l(),s(),c}RF.peek=tSe;function RF(e){return e.value||""}function tSe(){return"<"}PF.peek=nSe;function PF(e,t,n,r){const o=W1(n),i=o==='"'?"Quote":"Apostrophe",a=n.enter("image");let s=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(s=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=n.enter(`title${i}`),c+=l.move(" "+o),c+=l.move(n.safe(e.title,{before:c,after:o,...l.current()})),c+=l.move(o),s()),c+=l.move(")"),a(),c}function nSe(){return"!"}TF.peek=rSe;function TF(e,t,n,r){const o=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const s=n.createTracker(r);let l=s.move("![");const c=n.safe(e.alt,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return a(),n.stack=d,i(),o==="full"||!c||c!==f?l+=s.move(f+"]"):o==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function rSe(){return"!"}jF.peek=oSe;function jF(e,t,n){let r=e.value||"",o="`",i=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const a=n.unsafe[i],s=n.compilePattern(a);let l;if(a.atBreak)for(;l=s.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return o+r+o}function oSe(){return"`"}function MF(e,t){const n=M1(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}AF.peek=iSe;function AF(e,t,n,r){const o=W1(n),i=o==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let s,l;if(MF(e,n)){const d=n.stack;n.stack=[],s=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),s(),n.stack=d,f}s=n.enter("link"),l=n.enter("label");let c=a.move("[");return c+=a.move(n.containerPhrasing(e,{before:c,after:"](",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=a.move(" "+o),c+=a.move(n.safe(e.title,{before:c,after:o,...a.current()})),c+=a.move(o),l()),c+=a.move(")"),s(),c}function iSe(e,t,n){return MF(e,n)?"<":"["}LF.peek=aSe;function LF(e,t,n,r){const o=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const s=n.createTracker(r);let l=s.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...s.current()});l+=s.move(c+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return a(),n.stack=d,i(),o==="full"||!c||c!==f?l+=s.move(f+"]"):o==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function aSe(){return"["}function K1(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function sSe(e){const t=K1(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function lSe(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function DF(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function cSe(e,t,n,r){const o=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?lSe(n):K1(n);const s=e.ordered?a==="."?")":".":sSe(n);let l=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),DF(n)===a&&d){let f=-1;for(;++f<e.children.length;){const m=e.children[f];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(a=s),n.bulletCurrent=a;const c=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=i,o(),c}function uSe(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function dSe(e,t,n,r){const o=uSe(n);let i=n.bulletCurrent||K1(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const s=n.createTracker(r);s.move(i+" ".repeat(a-i.length)),s.shift(a);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,s.current()),d);return l(),c;function d(f,m,p){return m?(p?"":" ".repeat(a))+f:(p?i:i+" ".repeat(a-i.length))+f}}function fSe(e,t,n,r){const o=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),o(),a}const mSe=sy(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function pSe(e,t,n,r){return(e.children.some(function(a){return mSe(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function hSe(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}zF.peek=gSe;function zF(e,t,n,r){const o=hSe(n),i=n.enter("strong"),a=n.createTracker(r),s=a.move(o+o);let l=a.move(n.containerPhrasing(e,{after:o,before:s,...a.current()}));const c=l.charCodeAt(0),d=fg(r.before.charCodeAt(r.before.length-1),c,o);d.inside&&(l=Of(c)+l.slice(1));const f=l.charCodeAt(l.length-1),m=fg(r.after.charCodeAt(0),f,o);m.inside&&(l=l.slice(0,-1)+Of(f));const p=a.move(o+o);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},s+l+p}function gSe(e,t,n){return n.options.strong||"*"}function vSe(e,t,n,r){return n.safe(e.value,r)}function ySe(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function bSe(e,t,n){const r=(DF(n)+(n.options.ruleSpaces?" ":"")).repeat(ySe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const BF={blockquote:Hxe,break:XR,code:qxe,definition:Yxe,emphasis:IF,hardBreak:XR,heading:eSe,html:RF,image:PF,imageReference:TF,inlineCode:jF,link:AF,linkReference:LF,list:cSe,listItem:dSe,paragraph:fSe,root:pSe,strong:zF,text:vSe,thematicBreak:bSe};function xSe(){return{enter:{table:SSe,tableData:YR,tableHeader:YR,tableRow:wSe},exit:{codeText:_Se,table:CSe,tableData:S0,tableHeader:S0,tableRow:S0}}}function SSe(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function CSe(e){this.exit(e),this.data.inTable=void 0}function wSe(e){this.enter({type:"tableRow",children:[]},e)}function S0(e){this.exit(e)}function YR(e){this.enter({type:"tableCell",children:[]},e)}function _Se(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ESe));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function ESe(e,t){return t==="|"?t:e}function $Se(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
495
495
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:a,tableCell:l,tableRow:s}};function a(p,h,b,x){return c(d(p,b,x),p.align)}function s(p,h,b,x){const g=f(p,b,x),v=c([g]);return v.slice(0,v.indexOf(`
|
|
496
|
-
`))}function l(p,h,b,x){const g=b.enter("tableCell"),v=b.enter("phrasing"),S=b.containerPhrasing(p,{...x,before:i,after:i});return v(),g(),S}function c(p,h){return Dxe(p,{align:h,alignDelimiters:r,padding:n,stringLength:o})}function d(p,h,b){const x=p.children;let g=-1;const v=[],S=h.enter("table");for(;++g<x.length;)v[g]=f(x[g],h,b);return S(),v}function f(p,h,b){const x=p.children;let g=-1;const v=[],S=h.enter("tableRow");for(;++g<x.length;)v[g]=l(x[g],p,h,b);return S(),v}function m(p,h,b){let x=BF.inlineCode(p,h,b);return b.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function ESe(){return{exit:{taskListCheckValueChecked:QR,taskListCheckValueUnchecked:QR,paragraph:kSe}}}function $Se(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:NSe}}}function QR(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function kSe(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,a;for(;++i<o.length;){const s=o[i];if(s.type==="paragraph"){a=s;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function NSe(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);i&&s.move(a);let l=BF.listItem(e,t,n,{...r,...s.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(d){return d+a}}function OSe(){return[sxe(),Nxe(),Pxe(),ySe(),ESe()]}function ISe(e){return{extensions:[lxe(),Oxe(e),Txe(),_Se(e),$Se()]}}const RSe={tokenize:LSe,partial:!0},FF={tokenize:DSe,partial:!0},HF={tokenize:zSe,partial:!0},VF={tokenize:BSe,partial:!0},PSe={tokenize:FSe,partial:!0},WF={name:"wwwAutolink",tokenize:MSe,previous:UF},KF={name:"protocolAutolink",tokenize:ASe,previous:GF},Ha={name:"emailAutolink",tokenize:jSe,previous:qF},da={};function TSe(){return{text:da}}let Ls=48;for(;Ls<123;)da[Ls]=Ha,Ls++,Ls===58?Ls=65:Ls===91&&(Ls=97);da[43]=Ha;da[45]=Ha;da[46]=Ha;da[95]=Ha;da[72]=[Ha,KF];da[104]=[Ha,KF];da[87]=[Ha,WF];da[119]=[Ha,WF];function jSe(e,t,n){const r=this;let o,i;return a;function a(f){return!$C(f)||!qF.call(r,r.previous)||U1(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(f))}function s(f){return $C(f)?(e.consume(f),s):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(PSe,d,c)(f):f===45||f===95||Yr(f)?(i=!0,e.consume(f),l):d(f)}function c(f){return e.consume(f),o=!0,l}function d(f){return i&&o&&io(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function MSe(e,t,n){const r=this;return o;function o(a){return a!==87&&a!==119||!UF.call(r,r.previous)||U1(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(RSe,e.attempt(FF,e.attempt(HF,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function ASe(e,t,n){const r=this;let o="",i=!1;return a;function a(f){return(f===72||f===104)&&GF.call(r,r.previous)&&!U1(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(f),e.consume(f),s):n(f)}function s(f){if(io(f)&&o.length<5)return o+=String.fromCodePoint(f),e.consume(f),s;if(f===58){const m=o.toLowerCase();if(m==="http"||m==="https")return e.consume(f),l}return n(f)}function l(f){return f===47?(e.consume(f),i?c:(i=!0,l)):n(f)}function c(f){return f===null||cg(f)||Nn(f)||yl(f)||oy(f)?n(f):e.attempt(FF,e.attempt(HF,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function LSe(e,t,n){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function DSe(e,t,n){let r,o,i;return a;function a(c){return c===46||c===95?e.check(VF,l,s)(c):c===null||Nn(c)||yl(c)||c!==45&&oy(c)?l(c):(i=!0,e.consume(c),a)}function s(c){return c===95?r=!0:(o=r,r=void 0),e.consume(c),a}function l(c){return o||r||!i?n(c):t(c)}}function zSe(e,t){let n=0,r=0;return o;function o(a){return a===40?(n++,e.consume(a),o):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(VF,t,i)(a):a===null||Nn(a)||yl(a)?t(a):(e.consume(a),o)}function i(a){return a===41&&r++,e.consume(a),o}}function BSe(e,t,n){return r;function r(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(e.consume(s),r):s===38?(e.consume(s),i):s===93?(e.consume(s),o):s===60||s===null||Nn(s)||yl(s)?t(s):n(s)}function o(s){return s===null||s===40||s===91||Nn(s)||yl(s)?t(s):r(s)}function i(s){return io(s)?a(s):n(s)}function a(s){return s===59?(e.consume(s),r):io(s)?(e.consume(s),a):n(s)}}function FSe(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Yr(i)?n(i):t(i)}}function UF(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Nn(e)}function GF(e){return!io(e)}function qF(e){return!(e===47||$C(e))}function $C(e){return e===43||e===45||e===46||e===95||Yr(e)}function U1(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const HSe={tokenize:YSe,partial:!0};function VSe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:GSe,continuation:{tokenize:qSe},exit:XSe}},text:{91:{name:"gfmFootnoteCall",tokenize:USe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:WSe,resolveTo:KSe}}}}function WSe(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const l=r.events[o][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return n(l);const c=$i(r.sliceSerialize({start:a.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function KSe(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function USe(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return s;function s(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(f){if(i>999||f===93&&!a||f===null||f===91||Nn(f))return n(f);if(f===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return o.includes($i(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Nn(f)||(a=!0),i++,e.consume(f),f===92?d:c}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,c):c(f)}}function GSe(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,s;return l;function l(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(h)}function d(h){if(a>999||h===93&&!s||h===null||h===91||Nn(h))return n(h);if(h===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=$i(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Nn(h)||(s=!0),a++,e.consume(h),h===92?f:d}function f(h){return h===91||h===92||h===93?(e.consume(h),a++,d):d(h)}function m(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),o.includes(i)||o.push(i),un(e,p,"gfmFootnoteDefinitionWhitespace")):n(h)}function p(h){return t(h)}}function qSe(e,t,n){return e.check(pm,t,e.attempt(HSe,t,n))}function XSe(e){e.exit("gfmFootnoteDefinition")}function YSe(e,t,n){const r=this;return un(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function QSe(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},f={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},m=[["enter",d,s],["enter",a[c][1],s],["exit",a[c][1],s],["enter",f,s]],p=s.parser.constructs.insideSpan.null;p&&Ao(m,m.length,0,iy(p,a.slice(c+1,l),s)),Ao(m,m.length,0,[["exit",f,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",d,s]]),Ao(a,c-1,l-c+3,m),l=c+m.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,s,l){const c=this.previous,d=this.events;let f=0;return m;function m(h){return c===126&&d[d.length-1][1].type!=="characterEscape"?l(h):(a.enter("strikethroughSequenceTemporary"),p(h))}function p(h){const b=tu(c);if(h===126)return f>1?l(h):(a.consume(h),f++,p);if(f<2&&!n)return l(h);const x=a.exit("strikethroughSequenceTemporary"),g=tu(h);return x._open=!g||g===2&&!!b,x._close=!b||b===2&&!!g,s(h)}}}class ZSe{constructor(){this.map=[]}add(t,n,r){JSe(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function JSe(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function eCe(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function tCe(){return{flow:{null:{name:"table",tokenize:nCe,resolveAll:rCe}}}}function nCe(e,t,n){const r=this;let o=0,i=0,a;return s;function s($){let O=r.events.length-1;for(;O>-1;){const I=r.events[O][1].type;if(I==="lineEnding"||I==="linePrefix")O--;else break}const R=O>-1?r.events[O][1].type:null,T=R==="tableHead"||R==="tableRow"?w:l;return T===w&&r.parser.lazy[r.now().line]?n($):T($)}function l($){return e.enter("tableHead"),e.enter("tableRow"),c($)}function c($){return $===124||(a=!0,i+=1),d($)}function d($){return $===null?n($):Rt($)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),p):n($):nn($)?un(e,d,"whitespace")($):(i+=1,a&&(a=!1,o+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f($)))}function f($){return $===null||$===124||Nn($)?(e.exit("data"),d($)):(e.consume($),$===92?m:f)}function m($){return $===92||$===124?(e.consume($),f):f($)}function p($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(e.enter("tableDelimiterRow"),a=!1,nn($)?un(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):h($))}function h($){return $===45||$===58?x($):$===124?(a=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),b):_($)}function b($){return nn($)?un(e,x,"whitespace")($):x($)}function x($){return $===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),g):$===45?(i+=1,g($)):$===null||Rt($)?C($):_($)}function g($){return $===45?(e.enter("tableDelimiterFiller"),v($)):_($)}function v($){return $===45?(e.consume($),v):$===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S($))}function S($){return nn($)?un(e,C,"whitespace")($):C($)}function C($){return $===124?h($):$===null||Rt($)?!a||o!==i?_($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t($)):_($)}function _($){return n($)}function w($){return e.enter("tableRow"),N($)}function N($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),N):$===null||Rt($)?(e.exit("tableRow"),t($)):nn($)?un(e,N,"whitespace")($):(e.enter("data"),k($))}function k($){return $===null||$===124||Nn($)?(e.exit("data"),N($)):(e.consume($),$===92?E:k)}function E($){return $===92||$===124?(e.consume($),k):k($)}}function rCe(e,t){let n=-1,r=!0,o=0,i=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,c,d,f;const m=new ZSe;for(;++n<e.length;){const p=e[n],h=p[1];p[0]==="enter"?h.type==="tableHead"?(s=!1,l!==0&&(ZR(m,t,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},m.add(n,0,[["enter",c,t]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(r=!0,f=void 0,i=[0,0,0,0],a=[0,n+1,0,0],s&&(s=!1,d={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},m.add(n,0,[["enter",d,t]])),o=h.type==="tableDelimiterRow"?2:d?3:1):o&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],f=dp(m,t,i,o,void 0,f),i=[0,0,0,0]),a[2]=n)):h.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],f=dp(m,t,i,o,void 0,f)),i=a,a=[i[1],n,0,0])):h.type==="tableHead"?(s=!0,l=n):h.type==="tableRow"||h.type==="tableDelimiterRow"?(l=n,i[1]!==0?(a[0]=a[1],f=dp(m,t,i,o,n,f)):a[1]!==0&&(f=dp(m,t,a,o,n,f)),o=0):o&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&ZR(m,t,l,c,d),m.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=eCe(t.events,n))}return e}function dp(e,t,n,r,o,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(i.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Xl(t.events,n[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=Xl(t.events,n[2]),d=Xl(t.events,n[3]),f={type:s,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const m=t.events[n[2]],p=t.events[n[3]];if(m[1].end=Object.assign({},p[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const h=n[2]+1,b=n[3]-n[2]-1;e.add(h,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return o!==void 0&&(i.end=Object.assign({},Xl(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function ZR(e,t,n,r,o){const i=[],a=Xl(t.events,n);o&&(o.end=Object.assign({},a),i.push(["exit",o,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function Xl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const oCe={name:"tasklistCheck",tokenize:aCe};function iCe(){return{text:{91:oCe}}}function aCe(e,t,n){const r=this;return o;function o(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Nn(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(l)}function s(l){return Rt(l)?t(l):nn(l)?e.check({tokenize:sCe},t,n)(l):n(l)}}function sCe(e,t,n){return un(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function lCe(e){return oF([TSe(),VSe(),QSe(e),tCe(),iCe()])}const cCe={};function uCe(e){const t=this,n=e||cCe,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(lCe(n)),i.push(OSe()),a.push(ISe(n))}function Xi({content:e}){return y.jsx("div",{className:"markdown-body",children:y.jsx(Q0e,{remarkPlugins:[uCe],components:{pre({children:t}){return y.jsx(y.Fragment,{children:t})},code({inline:t,className:n,children:r,...o}){const i=typeof n=="string"?n:"",a=/language-(\w+)/.exec(i),s=t===!0,l=String(r).replace(/\n$/,"");return!s&&a!=null?y.jsx(wo,{code:l,lang:a[1]}):y.jsx("code",{className:i,...o,children:r})}},children:e})})}const dCe=e=>(e==null?void 0:e.status)==="completed"||(e==null?void 0:e.status)==="failed",fCe=e=>e?new Date(e).toLocaleString():"-",XF=e=>e==null?{icon:"radio_button_unchecked",statusKey:"no-result"}:e.status==="pass"?{icon:"check_circle",statusKey:"pass"}:e.status==="partial"?{icon:"rule",statusKey:"partial"}:{icon:"cancel",statusKey:"fail"};function mCe({result:e}){const{t}=Ot(),n=XF(e),r={"no-result":"default",pass:"success",partial:"warning",fail:"error"};return y.jsxs(Do,{color:r[n.statusKey],className:"benchmark-view__status-tag",children:[y.jsx("span",{className:"material-symbols-rounded benchmark-view__tag-icon",children:n.icon}),n.statusKey==="no-result"?t("benchmark.noResult"):t(`benchmark.status.${n.statusKey}`)]})}function mg({icon:e,title:t,extra:n}){return y.jsxs("div",{className:"benchmark-view__section-label",children:[y.jsxs("div",{className:"benchmark-view__section-title",children:[y.jsx("span",{className:"material-symbols-rounded benchmark-view__section-icon",children:e}),y.jsx("span",{children:t})]}),n!=null?y.jsx("div",{className:"benchmark-view__section-extra",children:n}):null]})}function pCe({selectedCase:e,latestResult:t,activeRun:n,activeRunId:r,progressPercent:o,onRunCase:i}){const{t:a}=Ot();if(e==null)return y.jsx("div",{className:"benchmark-view__empty",children:y.jsx(bn,{description:a("benchmark.emptyCases")})});const s=e.frontmatter.title??e.title,l=e.frontmatter.description??e.summary??"";return y.jsxs("div",{className:"benchmark-view__canvas",children:[y.jsxs("div",{className:"benchmark-view__case-header",children:[y.jsxs("div",{className:"benchmark-view__case-title-row",children:[y.jsx(so.Title,{level:3,className:"benchmark-view__case-title",children:s}),y.jsx(ct,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"play_circle"}),onClick:i})]}),l?y.jsx(so.Paragraph,{type:"secondary",className:"benchmark-view__case-desc",children:l}):null,y.jsx("div",{className:"benchmark-view__case-meta",children:y.jsxs("span",{className:"benchmark-view__meta-item",children:[y.jsx("span",{className:"material-symbols-rounded",children:"history"}),a("benchmark.lastRunAt"),": ",fCe(t==null?void 0:t.timestamp)]})})]}),y.jsx(cO,{className:"benchmark-view__sep"}),y.jsxs("div",{className:"benchmark-view__twin-grid",children:[y.jsxs("div",{className:"benchmark-view__section",children:[y.jsx(mg,{icon:"tune",title:a("benchmark.configTitle")}),y.jsxs("div",{className:"benchmark-view__info-grid",children:[y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"commit"}),a("benchmark.baseCommit")]}),y.jsx("code",{children:e.frontmatter.baseCommit})]}),y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"timer"}),a("benchmark.timeoutSec")]}),y.jsx("span",{children:e.frontmatter.timeoutSec})]}),y.jsxs("div",{className:"benchmark-view__info-row benchmark-view__info-row--block",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"build"}),a("benchmark.setupCommand")]}),y.jsx(Xi,{content:`\`\`\`bash
|
|
496
|
+
`))}function l(p,h,b,x){const g=b.enter("tableCell"),v=b.enter("phrasing"),S=b.containerPhrasing(p,{...x,before:i,after:i});return v(),g(),S}function c(p,h){return Bxe(p,{align:h,alignDelimiters:r,padding:n,stringLength:o})}function d(p,h,b){const x=p.children;let g=-1;const v=[],S=h.enter("table");for(;++g<x.length;)v[g]=f(x[g],h,b);return S(),v}function f(p,h,b){const x=p.children;let g=-1;const v=[],S=h.enter("tableRow");for(;++g<x.length;)v[g]=l(x[g],p,h,b);return S(),v}function m(p,h,b){let x=BF.inlineCode(p,h,b);return b.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function kSe(){return{exit:{taskListCheckValueChecked:QR,taskListCheckValueUnchecked:QR,paragraph:OSe}}}function NSe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ISe}}}function QR(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function OSe(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let i=-1,a;for(;++i<o.length;){const s=o[i];if(s.type==="paragraph"){a=s;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function ISe(e,t,n,r){const o=e.children[0],i=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",s=n.createTracker(r);i&&s.move(a);let l=BF.listItem(e,t,n,{...r,...s.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(d){return d+a}}function RSe(){return[cxe(),Ixe(),jxe(),xSe(),kSe()]}function PSe(e){return{extensions:[uxe(),Rxe(e),Mxe(),$Se(e),NSe()]}}const TSe={tokenize:zSe,partial:!0},FF={tokenize:BSe,partial:!0},HF={tokenize:FSe,partial:!0},VF={tokenize:HSe,partial:!0},jSe={tokenize:VSe,partial:!0},WF={name:"wwwAutolink",tokenize:LSe,previous:UF},KF={name:"protocolAutolink",tokenize:DSe,previous:GF},Ha={name:"emailAutolink",tokenize:ASe,previous:qF},da={};function MSe(){return{text:da}}let Ls=48;for(;Ls<123;)da[Ls]=Ha,Ls++,Ls===58?Ls=65:Ls===91&&(Ls=97);da[43]=Ha;da[45]=Ha;da[46]=Ha;da[95]=Ha;da[72]=[Ha,KF];da[104]=[Ha,KF];da[87]=[Ha,WF];da[119]=[Ha,WF];function ASe(e,t,n){const r=this;let o,i;return a;function a(f){return!$C(f)||!qF.call(r,r.previous)||U1(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(f))}function s(f){return $C(f)?(e.consume(f),s):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(jSe,d,c)(f):f===45||f===95||Yr(f)?(i=!0,e.consume(f),l):d(f)}function c(f){return e.consume(f),o=!0,l}function d(f){return i&&o&&io(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function LSe(e,t,n){const r=this;return o;function o(a){return a!==87&&a!==119||!UF.call(r,r.previous)||U1(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(TSe,e.attempt(FF,e.attempt(HF,i),n),n)(a))}function i(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function DSe(e,t,n){const r=this;let o="",i=!1;return a;function a(f){return(f===72||f===104)&&GF.call(r,r.previous)&&!U1(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(f),e.consume(f),s):n(f)}function s(f){if(io(f)&&o.length<5)return o+=String.fromCodePoint(f),e.consume(f),s;if(f===58){const m=o.toLowerCase();if(m==="http"||m==="https")return e.consume(f),l}return n(f)}function l(f){return f===47?(e.consume(f),i?c:(i=!0,l)):n(f)}function c(f){return f===null||cg(f)||Nn(f)||yl(f)||oy(f)?n(f):e.attempt(FF,e.attempt(HF,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function zSe(e,t,n){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),i):n(a)}function i(a){return a===null?n(a):t(a)}}function BSe(e,t,n){let r,o,i;return a;function a(c){return c===46||c===95?e.check(VF,l,s)(c):c===null||Nn(c)||yl(c)||c!==45&&oy(c)?l(c):(i=!0,e.consume(c),a)}function s(c){return c===95?r=!0:(o=r,r=void 0),e.consume(c),a}function l(c){return o||r||!i?n(c):t(c)}}function FSe(e,t){let n=0,r=0;return o;function o(a){return a===40?(n++,e.consume(a),o):a===41&&r<n?i(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(VF,t,i)(a):a===null||Nn(a)||yl(a)?t(a):(e.consume(a),o)}function i(a){return a===41&&r++,e.consume(a),o}}function HSe(e,t,n){return r;function r(s){return s===33||s===34||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===63||s===95||s===126?(e.consume(s),r):s===38?(e.consume(s),i):s===93?(e.consume(s),o):s===60||s===null||Nn(s)||yl(s)?t(s):n(s)}function o(s){return s===null||s===40||s===91||Nn(s)||yl(s)?t(s):r(s)}function i(s){return io(s)?a(s):n(s)}function a(s){return s===59?(e.consume(s),r):io(s)?(e.consume(s),a):n(s)}}function VSe(e,t,n){return r;function r(i){return e.consume(i),o}function o(i){return Yr(i)?n(i):t(i)}}function UF(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Nn(e)}function GF(e){return!io(e)}function qF(e){return!(e===47||$C(e))}function $C(e){return e===43||e===45||e===46||e===95||Yr(e)}function U1(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const WSe={tokenize:ZSe,partial:!0};function KSe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:XSe,continuation:{tokenize:YSe},exit:QSe}},text:{91:{name:"gfmFootnoteCall",tokenize:qSe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:USe,resolveTo:GSe}}}}function USe(e,t,n){const r=this;let o=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const l=r.events[o][1];if(l.type==="labelImage"){a=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!a||!a._balanced)return n(l);const c=$i(r.sliceSerialize({start:a.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function GSe(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},s=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...s),e}function qSe(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return s;function s(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(f){if(i>999||f===93&&!a||f===null||f===91||Nn(f))return n(f);if(f===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return o.includes($i(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Nn(f)||(a=!0),i++,e.consume(f),f===92?d:c}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,c):c(f)}}function XSe(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,s;return l;function l(h){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(h){return h===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(h)}function d(h){if(a>999||h===93&&!s||h===null||h===91||Nn(h))return n(h);if(h===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=$i(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(h),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Nn(h)||(s=!0),a++,e.consume(h),h===92?f:d}function f(h){return h===91||h===92||h===93?(e.consume(h),a++,d):d(h)}function m(h){return h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),o.includes(i)||o.push(i),un(e,p,"gfmFootnoteDefinitionWhitespace")):n(h)}function p(h){return t(h)}}function YSe(e,t,n){return e.check(pm,t,e.attempt(WSe,t,n))}function QSe(e){e.exit("gfmFootnoteDefinition")}function ZSe(e,t,n){const r=this;return un(e,o,"gfmFootnoteDefinitionIndent",5);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function JSe(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,s){let l=-1;for(;++l<a.length;)if(a[l][0]==="enter"&&a[l][1].type==="strikethroughSequenceTemporary"&&a[l][1]._close){let c=l;for(;c--;)if(a[c][0]==="exit"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._open&&a[l][1].end.offset-a[l][1].start.offset===a[c][1].end.offset-a[c][1].start.offset){a[l][1].type="strikethroughSequence",a[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},a[c][1].start),end:Object.assign({},a[l][1].end)},f={type:"strikethroughText",start:Object.assign({},a[c][1].end),end:Object.assign({},a[l][1].start)},m=[["enter",d,s],["enter",a[c][1],s],["exit",a[c][1],s],["enter",f,s]],p=s.parser.constructs.insideSpan.null;p&&Ao(m,m.length,0,iy(p,a.slice(c+1,l),s)),Ao(m,m.length,0,[["exit",f,s],["enter",a[l][1],s],["exit",a[l][1],s],["exit",d,s]]),Ao(a,c-1,l-c+3,m),l=c+m.length-2;break}}for(l=-1;++l<a.length;)a[l][1].type==="strikethroughSequenceTemporary"&&(a[l][1].type="data");return a}function i(a,s,l){const c=this.previous,d=this.events;let f=0;return m;function m(h){return c===126&&d[d.length-1][1].type!=="characterEscape"?l(h):(a.enter("strikethroughSequenceTemporary"),p(h))}function p(h){const b=tu(c);if(h===126)return f>1?l(h):(a.consume(h),f++,p);if(f<2&&!n)return l(h);const x=a.exit("strikethroughSequenceTemporary"),g=tu(h);return x._open=!g||g===2&&!!b,x._close=!b||b===2&&!!g,s(h)}}}class eCe{constructor(){this.map=[]}add(t,n,r){tCe(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const i of o)t.push(i);o=r.pop()}this.map.length=0}}function tCe(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function nCe(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function rCe(){return{flow:{null:{name:"table",tokenize:oCe,resolveAll:iCe}}}}function oCe(e,t,n){const r=this;let o=0,i=0,a;return s;function s($){let O=r.events.length-1;for(;O>-1;){const I=r.events[O][1].type;if(I==="lineEnding"||I==="linePrefix")O--;else break}const R=O>-1?r.events[O][1].type:null,T=R==="tableHead"||R==="tableRow"?w:l;return T===w&&r.parser.lazy[r.now().line]?n($):T($)}function l($){return e.enter("tableHead"),e.enter("tableRow"),c($)}function c($){return $===124||(a=!0,i+=1),d($)}function d($){return $===null?n($):Rt($)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),p):n($):nn($)?un(e,d,"whitespace")($):(i+=1,a&&(a=!1,o+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f($)))}function f($){return $===null||$===124||Nn($)?(e.exit("data"),d($)):(e.consume($),$===92?m:f)}function m($){return $===92||$===124?(e.consume($),f):f($)}function p($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(e.enter("tableDelimiterRow"),a=!1,nn($)?un(e,h,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):h($))}function h($){return $===45||$===58?x($):$===124?(a=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),b):_($)}function b($){return nn($)?un(e,x,"whitespace")($):x($)}function x($){return $===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),g):$===45?(i+=1,g($)):$===null||Rt($)?C($):_($)}function g($){return $===45?(e.enter("tableDelimiterFiller"),v($)):_($)}function v($){return $===45?(e.consume($),v):$===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),S):(e.exit("tableDelimiterFiller"),S($))}function S($){return nn($)?un(e,C,"whitespace")($):C($)}function C($){return $===124?h($):$===null||Rt($)?!a||o!==i?_($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t($)):_($)}function _($){return n($)}function w($){return e.enter("tableRow"),N($)}function N($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),N):$===null||Rt($)?(e.exit("tableRow"),t($)):nn($)?un(e,N,"whitespace")($):(e.enter("data"),k($))}function k($){return $===null||$===124||Nn($)?(e.exit("data"),N($)):(e.consume($),$===92?E:k)}function E($){return $===92||$===124?(e.consume($),k):k($)}}function iCe(e,t){let n=-1,r=!0,o=0,i=[0,0,0,0],a=[0,0,0,0],s=!1,l=0,c,d,f;const m=new eCe;for(;++n<e.length;){const p=e[n],h=p[1];p[0]==="enter"?h.type==="tableHead"?(s=!1,l!==0&&(ZR(m,t,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},h.start),end:Object.assign({},h.end)},m.add(n,0,[["enter",c,t]])):h.type==="tableRow"||h.type==="tableDelimiterRow"?(r=!0,f=void 0,i=[0,0,0,0],a=[0,n+1,0,0],s&&(s=!1,d={type:"tableBody",start:Object.assign({},h.start),end:Object.assign({},h.end)},m.add(n,0,[["enter",d,t]])),o=h.type==="tableDelimiterRow"?2:d?3:1):o&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(i[1]!==0&&(a[0]=a[1],f=dp(m,t,i,o,void 0,f),i=[0,0,0,0]),a[2]=n)):h.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(a[0]=a[1],f=dp(m,t,i,o,void 0,f)),i=a,a=[i[1],n,0,0])):h.type==="tableHead"?(s=!0,l=n):h.type==="tableRow"||h.type==="tableDelimiterRow"?(l=n,i[1]!==0?(a[0]=a[1],f=dp(m,t,i,o,n,f)):a[1]!==0&&(f=dp(m,t,a,o,n,f)),o=0):o&&(h.type==="data"||h.type==="tableDelimiterMarker"||h.type==="tableDelimiterFiller")&&(a[3]=n)}for(l!==0&&ZR(m,t,l,c,d),m.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=nCe(t.events,n))}return e}function dp(e,t,n,r,o,i){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",s="tableContent";n[0]!==0&&(i.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Xl(t.events,n[1]);if(i={type:a,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=Xl(t.events,n[2]),d=Xl(t.events,n[3]),f={type:s,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const m=t.events[n[2]],p=t.events[n[3]];if(m[1].end=Object.assign({},p[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const h=n[2]+1,b=n[3]-n[2]-1;e.add(h,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return o!==void 0&&(i.end=Object.assign({},Xl(t.events,o)),e.add(o,0,[["exit",i,t]]),i=void 0),i}function ZR(e,t,n,r,o){const i=[],a=Xl(t.events,n);o&&(o.end=Object.assign({},a),i.push(["exit",o,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function Xl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const aCe={name:"tasklistCheck",tokenize:lCe};function sCe(){return{text:{91:aCe}}}function lCe(e,t,n){const r=this;return o;function o(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Nn(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),a):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),a):n(l)}function a(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(l)}function s(l){return Rt(l)?t(l):nn(l)?e.check({tokenize:cCe},t,n)(l):n(l)}}function cCe(e,t,n){return un(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function uCe(e){return oF([MSe(),KSe(),JSe(e),rCe(),sCe()])}const dCe={};function fCe(e){const t=this,n=e||dCe,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(uCe(n)),i.push(RSe()),a.push(PSe(n))}function Xi({content:e}){return y.jsx("div",{className:"markdown-body",children:y.jsx(J0e,{remarkPlugins:[fCe],components:{pre({children:t}){return y.jsx(y.Fragment,{children:t})},code({inline:t,className:n,children:r,...o}){const i=typeof n=="string"?n:"",a=/language-(\w+)/.exec(i),s=t===!0,l=String(r).replace(/\n$/,"");return!s&&a!=null?y.jsx(wo,{code:l,lang:a[1]}):y.jsx("code",{className:i,...o,children:r})}},children:e})})}const mCe=e=>(e==null?void 0:e.status)==="completed"||(e==null?void 0:e.status)==="failed",pCe=e=>e?new Date(e).toLocaleString():"-",XF=e=>e==null?{icon:"radio_button_unchecked",statusKey:"no-result"}:e.status==="pass"?{icon:"check_circle",statusKey:"pass"}:e.status==="partial"?{icon:"rule",statusKey:"partial"}:{icon:"cancel",statusKey:"fail"};function hCe({result:e}){const{t}=Ot(),n=XF(e),r={"no-result":"default",pass:"success",partial:"warning",fail:"error"};return y.jsxs(Do,{color:r[n.statusKey],className:"benchmark-view__status-tag",children:[y.jsx("span",{className:"material-symbols-rounded benchmark-view__tag-icon",children:n.icon}),n.statusKey==="no-result"?t("benchmark.noResult"):t(`benchmark.status.${n.statusKey}`)]})}function mg({icon:e,title:t,extra:n}){return y.jsxs("div",{className:"benchmark-view__section-label",children:[y.jsxs("div",{className:"benchmark-view__section-title",children:[y.jsx("span",{className:"material-symbols-rounded benchmark-view__section-icon",children:e}),y.jsx("span",{children:t})]}),n!=null?y.jsx("div",{className:"benchmark-view__section-extra",children:n}):null]})}function gCe({selectedCase:e,latestResult:t,activeRun:n,activeRunId:r,progressPercent:o,onRunCase:i}){const{t:a}=Ot();if(e==null)return y.jsx("div",{className:"benchmark-view__empty",children:y.jsx(bn,{description:a("benchmark.emptyCases")})});const s=e.frontmatter.title??e.title,l=e.frontmatter.description??e.summary??"";return y.jsxs("div",{className:"benchmark-view__canvas",children:[y.jsxs("div",{className:"benchmark-view__case-header",children:[y.jsxs("div",{className:"benchmark-view__case-title-row",children:[y.jsx(so.Title,{level:3,className:"benchmark-view__case-title",children:s}),y.jsx(ct,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"play_circle"}),onClick:i})]}),l?y.jsx(so.Paragraph,{type:"secondary",className:"benchmark-view__case-desc",children:l}):null,y.jsx("div",{className:"benchmark-view__case-meta",children:y.jsxs("span",{className:"benchmark-view__meta-item",children:[y.jsx("span",{className:"material-symbols-rounded",children:"history"}),a("benchmark.lastRunAt"),": ",pCe(t==null?void 0:t.timestamp)]})})]}),y.jsx(cO,{className:"benchmark-view__sep"}),y.jsxs("div",{className:"benchmark-view__twin-grid",children:[y.jsxs("div",{className:"benchmark-view__section",children:[y.jsx(mg,{icon:"tune",title:a("benchmark.configTitle")}),y.jsxs("div",{className:"benchmark-view__info-grid",children:[y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"commit"}),a("benchmark.baseCommit")]}),y.jsx("code",{children:e.frontmatter.baseCommit})]}),y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"timer"}),a("benchmark.timeoutSec")]}),y.jsx("span",{children:e.frontmatter.timeoutSec})]}),y.jsxs("div",{className:"benchmark-view__info-row benchmark-view__info-row--block",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"build"}),a("benchmark.setupCommand")]}),y.jsx(Xi,{content:`\`\`\`bash
|
|
497
497
|
${e.frontmatter.setupCommand}
|
|
498
498
|
\`\`\``})]}),y.jsxs("div",{className:"benchmark-view__info-row benchmark-view__info-row--block",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"science"}),a("benchmark.testCommand")]}),y.jsx(Xi,{content:`\`\`\`bash
|
|
499
499
|
${e.frontmatter.testCommand}
|
|
500
|
-
\`\`\``})]})]})]}),y.jsxs("div",{className:"benchmark-view__section benchmark-view__task-goal",children:[y.jsx(mg,{icon:"assignment",title:a("benchmark.taskGoal")}),y.jsx("div",{className:"benchmark-view__goal-body",children:y.jsx(Xi,{content:e.rfcBody})})]})]}),y.jsx(cO,{className:"benchmark-view__sep"}),y.jsxs("div",{className:"benchmark-view__twin-grid benchmark-view__section--last",children:[y.jsx(hCe,{activeRunId:r,activeRun:n,progressPercent:o,t:a}),y.jsx(gCe,{latestResult:t,t:a})]})]})}function hCe({activeRunId:e,activeRun:t,progressPercent:n,t:r}){return y.jsxs("div",{className:"benchmark-view__section",children:[y.jsx(mg,{icon:"pulse_alert",title:r("benchmark.runState"),extra:t?y.jsx(Do,{children:t.status}):null}),e===""?y.jsx(so.Text,{type:"secondary",className:"benchmark-view__hint",children:r("benchmark.noActiveRun")}):y.jsxs("div",{className:"benchmark-view__run-block",children:[y.jsxs("div",{className:"benchmark-view__run-metric",children:[y.jsx("label",{children:r("benchmark.progress")}),y.jsx("strong",{children:`${(t==null?void 0:t.completedCount)??0}/${(t==null?void 0:t.totalCount)??"-"}`})]}),y.jsx(eie,{percent:n,showInfo:!1}),y.jsxs("div",{className:"benchmark-view__info-grid",children:[y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsx("label",{children:r("benchmark.runStatus")}),y.jsx("span",{children:(t==null?void 0:t.status)??"-"})]}),y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsx("label",{children:r("benchmark.lastMessage")}),y.jsx(so.Text,{children:(t==null?void 0:t.lastMessage)??"-"})]})]})]})]})}function gCe({latestResult:e,t}){return y.jsxs("div",{className:"benchmark-view__section",children:[y.jsx(mg,{icon:"insights",title:t("benchmark.resultTitle"),extra:e?y.jsx(mCe,{result:e}):null}),e==null?y.jsx(so.Text,{type:"secondary",className:"benchmark-view__hint",children:t("benchmark.noResult")}):y.jsxs("div",{className:"benchmark-view__result",children:[y.jsxs("div",{className:"benchmark-view__score-strip",children:[y.jsxs("div",{className:"benchmark-view__score-item",children:[y.jsx("label",{children:t("benchmark.finalScore")}),y.jsx("strong",{children:e.finalScore})]}),y.jsxs("div",{className:"benchmark-view__score-item",children:[y.jsx("label",{children:t("benchmark.testScore")}),y.jsx("strong",{children:e.scores.testScore})]}),y.jsxs("div",{className:"benchmark-view__score-item",children:[y.jsx("label",{children:t("benchmark.goalScore")}),y.jsx("strong",{children:e.scores.goalScore})]}),y.jsxs("div",{className:"benchmark-view__score-item",children:[y.jsx("label",{children:t("benchmark.referenceScore")}),y.jsx("strong",{children:e.scores.referenceScore})]})]}),y.jsxs("div",{className:"benchmark-view__info-grid",children:[y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"schedule"}),t("benchmark.durationMs")]}),y.jsx("span",{children:e.durationMs})]}),y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"monitoring"}),t("benchmark.testExitCode")]}),y.jsx("span",{children:e.testExitCode})]})]}),y.jsx(so.Paragraph,{className:"benchmark-view__judge-summary",children:e.judgeSummary}),y.jsxs("div",{className:"benchmark-view__subgrid",children:[y.jsxs("div",{className:"benchmark-view__subpanel",children:[y.jsxs("div",{className:"benchmark-view__subpanel-title",children:[y.jsx("span",{className:"material-symbols-rounded",children:"plagiarism"}),y.jsx("span",{children:t("benchmark.changedFiles")})]}),e.changedFiles!=null&&e.changedFiles.length>0?y.jsx("div",{className:"benchmark-view__file-list",children:e.changedFiles.map(n=>y.jsx("span",{className:"benchmark-view__file-tag",children:n},n))}):y.jsx(so.Text,{type:"secondary",children:t("benchmark.noChangedFiles")})]}),y.jsxs("div",{className:"benchmark-view__subpanel",children:[y.jsxs("div",{className:"benchmark-view__subpanel-title",children:[y.jsx("span",{className:"material-symbols-rounded",children:"report"}),y.jsx("span",{children:t("benchmark.issues")})]}),e.issues.length===0?y.jsx(so.Text,{type:"secondary",children:t("benchmark.noIssues")}):y.jsx("ul",{className:"benchmark-view__issues-list",children:e.issues.map(n=>y.jsx("li",{children:n},n))})]})]})]})]})}function vCe({result:e}){const t=XF(e);return y.jsx("span",{className:`material-symbols-rounded benchmark-view__status-icon benchmark-view__status-icon--${t.statusKey}`,children:t.icon})}function yCe(e){const{categories:t,cases:n,query:r,t:o,onRunCase:i,onRunCategory:a}=e,s=r.trim().toLowerCase();return(t.length>0?t:Array.from(new Set(n.map(d=>d.category))).map(d=>({category:d,caseCount:n.filter(f=>f.category===d).length,lastStatuses:{pass:0,partial:0,fail:0}}))).map(d=>{const f=n.filter(h=>h.category===d.category),p=s===""||d.category.toLowerCase().includes(s)?f:f.filter(h=>{const b=h.frontmatter.title??"";return h.title.toLowerCase().includes(s)||b.toLowerCase().includes(s)});return p.length===0?null:{key:`category:${d.category}`,selectable:!0,title:y.jsxs("div",{className:"benchmark-view__tree-category",children:[y.jsx("span",{className:"material-symbols-rounded benchmark-view__tree-icon benchmark-view__tree-icon--category",children:"folder_open"}),y.jsx(so.Text,{strong:!0,className:"benchmark-view__tree-title",children:d.category}),y.jsx(dt,{title:o("benchmark.runCategory"),children:y.jsx(ct,{type:"text",size:"small",className:"benchmark-view__tree-run-btn benchmark-view__tree-run-btn--category",icon:y.jsx("span",{className:"material-symbols-rounded",children:"play_circle"}),onClick:h=>{h.stopPropagation(),a(d.category)}})})]}),children:p.map(h=>{const b={...h,key:`case:${h.category}/${h.title}`},x=h.frontmatter.title??h.title;return{key:b.key,isLeaf:!0,title:y.jsxs("div",{className:"benchmark-view__tree-case",children:[y.jsx(vCe,{result:b.latestResult}),y.jsx("span",{className:"material-symbols-rounded benchmark-view__tree-icon",children:"draft"}),y.jsx(so.Text,{className:"benchmark-view__tree-title",children:x}),y.jsx(dt,{title:o("benchmark.runCase"),children:y.jsx(ct,{type:"text",size:"small",className:"benchmark-view__tree-run-btn",icon:y.jsx("span",{className:"material-symbols-rounded",children:"play_circle"}),onClick:g=>{g.stopPropagation(),i(h)}})})]}),caseData:b}})}}).filter(d=>d!=null)}function bCe({cases:e,categories:t,selectedCase:n,query:r,expandedKeys:o,checkedKeys:i,checkedCaseCount:a,onQueryChange:s,onExpandedKeysChange:l,onCheckedKeysChange:c,onSelectCase:d,onRunCase:f,onRunCategory:m,onBatchRun:p}){const{t:h}=Ot(),b=u.useMemo(()=>yCe({categories:t,cases:e,query:r,t:h,onRunCase:f,onRunCategory:m}),[e,t,r,h]),x=v=>{const S=Array.isArray(v)?v:v.checked;c(S.map(String))},g=(v,S)=>{const C=S.node.caseData;if(C!=null){d(C.category,C.title);return}const _=String(S.node.key);if(!_.startsWith("category:"))return;const w=_.replace("category:",""),N=e.find(k=>k.category===w);d(w,(N==null?void 0:N.title)??"")};return y.jsxs("div",{className:"benchmark-view__sidebar",children:[y.jsx("div",{className:"benchmark-view__sidebar-header",children:y.jsx(so.Title,{level:4,className:"benchmark-view__sidebar-title",children:h("benchmark.title")})}),y.jsxs("div",{className:"benchmark-view__search-row",children:[y.jsx(Ft,{value:r,placeholder:h("benchmark.searchPlaceholder"),prefix:y.jsx("span",{className:"material-symbols-rounded benchmark-view__search-icon",children:"search"}),allowClear:!0,onChange:v=>s(v.target.value),className:"benchmark-view__search"}),y.jsx(dt,{title:h("benchmark.expandAll"),children:y.jsx(ct,{type:"text",size:"small",icon:y.jsx("span",{className:"material-symbols-rounded",children:"unfold_more"}),onClick:()=>l(t.map(v=>`category:${v.category}`))})}),y.jsx(dt,{title:h("benchmark.collapseAll"),children:y.jsx(ct,{type:"text",size:"small",icon:y.jsx("span",{className:"material-symbols-rounded",children:"unfold_less"}),onClick:()=>l([])})}),y.jsx(dt,{title:a>0?h("benchmark.runSelected",{count:a}):h("benchmark.runAll"),children:y.jsx(E_,{count:a,size:"small",children:y.jsx(ct,{type:"text",size:"small",icon:y.jsx("span",{className:"material-symbols-rounded",children:"play_circle"}),onClick:p})})})]}),y.jsx("div",{className:"benchmark-view__tree-shell",children:b.length===0?y.jsx("div",{className:"benchmark-view__tree-empty",children:y.jsx(bn,{description:h("benchmark.emptyCases"),image:bn.PRESENTED_IMAGE_SIMPLE})}):y.jsx(zv,{blockNode:!0,checkable:!0,showIcon:!1,switcherIcon:y.jsx("span",{className:"material-symbols-rounded benchmark-view__switcher",children:"chevron_right"}),selectedKeys:n?[`case:${n.category}/${n.title}`]:[],expandedKeys:o,checkedKeys:i,treeData:b,onExpand:v=>l(v.map(String)),onSelect:g,onCheck:x})})]})}function xCe(){const{t:e}=Ot(),{message:t}=Eo.useApp(),[n,r]=u.useState(""),[o,i]=u.useState(""),[a,s]=u.useState([]),[l,c]=u.useState([]),{values:d,update:f}=ju({keys:["category","title"],defaults:{category:"",title:""},omit:{category:I=>I==="",title:I=>I===""}}),{data:m,mutate:p}=Qn("/api/benchmark/categories",Mfe),h=(m==null?void 0:m.categories)??[],{data:b,mutate:x}=Qn("/api/benchmark/cases",()=>Afe()),g=(b==null?void 0:b.cases)??[],v=u.useMemo(()=>{if(g.length===0)return null;const I=g.find(j=>j.category===d.category&&j.title===d.title);return I||((d.category?g.find(j=>j.category===d.category)??null:null)??g[0]??null)},[g,d.category,d.title]),{data:S,mutate:C}=Qn(v?`/api/benchmark/results/${v.category}/${v.title}`:null,()=>Lfe((v==null?void 0:v.category)??"",(v==null?void 0:v.title)??"")),_=(S==null?void 0:S.result)??(v==null?void 0:v.latestResult)??null,{data:w,mutate:N}=Qn(n?`/api/benchmark/runs/${n}`:null,()=>Dfe(n),{refreshInterval:n?2e3:0}),k=w==null?void 0:w.run,E=u.useMemo(()=>{const I=(k==null?void 0:k.totalCount)??0;if(I<=0)return 0;const P=(k==null?void 0:k.completedCount)??0;return Math.min(100,Math.round(P/I*100))},[k==null?void 0:k.completedCount,k==null?void 0:k.totalCount]),$=u.useCallback(async I=>{try{const P=await rp({category:I.category,title:I.title});r(P.run.runId),t.success(e("benchmark.runStarted"))}catch(P){t.error(Mr(P,e("benchmark.runFailed")))}},[t,e]),O=u.useCallback(async I=>{try{const P=await rp({category:I});r(P.run.runId),t.success(e("benchmark.categoryRunStarted"))}catch(P){t.error(Mr(P,e("benchmark.runFailed")))}},[t,e]),R=u.useCallback(async()=>{const I=l.filter(L=>L.startsWith("case:")),P=g.filter(L=>I.includes(`case:${L.category}/${L.title}`));if(P.length===0){for(const L of g)try{await rp({category:L.category,title:L.title})}catch{}t.success(e("benchmark.runStarted"));return}let j=0;for(const L of P)try{await rp({category:L.category,title:L.title}),j++}catch{}j>0&&(c([]),x(),p(),t.success(e("benchmark.runStarted")))},[l,g,x,p,t,e]);u.useEffect(()=>{const I=h.map(P=>`category:${P.category}`);s(P=>P.length>0&&o.trim()===""?P:I)},[h,o]),u.useEffect(()=>{v!=null&&(d.category!==v.category||d.title!==v.title)&&f({category:v.category,title:v.title})},[v,f,d.category,d.title]),u.useEffect(()=>{if(!dCe(k))return;x(),p(),C(),n!==""&&N();const I=(k==null?void 0:k.status)==="completed"?e("benchmark.runCompleted"):e("benchmark.runFailed");t.info(I),r("")},[k,n,t,x,p,C,N,e]);const T=l.filter(I=>I.startsWith("case:")).length;return y.jsxs("div",{className:"benchmark-view",children:[y.jsx("div",{className:"benchmark-view__left",children:y.jsx(bCe,{cases:g,categories:h,selectedCase:v,query:o,expandedKeys:a,checkedKeys:l,checkedCaseCount:T,onQueryChange:i,onExpandedKeysChange:s,onCheckedKeysChange:c,onSelectCase:(I,P)=>f({category:I,title:P}),onRunCase:I=>void $(I),onRunCategory:I=>void O(I),onBatchRun:()=>void R()})}),y.jsx("div",{className:"benchmark-view__divider"}),y.jsx("div",{className:"benchmark-view__right",children:y.jsx(pCe,{selectedCase:v,latestResult:_,activeRun:k,activeRunId:n,progressPercent:E,onRunCase:()=>void(v&&$(v))})})]})}function SCe(){return y.jsx(xCe,{})}const CCe=({value:e})=>{const{t}=Ot(),n=e!=null&&typeof e=="object"?e:void 0,r=n==null?void 0:n.urls,o=n==null?void 0:n.version,i=n==null?void 0:n.lastReleaseAt;return y.jsxs("div",{className:"config-about",children:[y.jsxs("div",{className:"config-about__card",children:[y.jsxs("div",{className:"config-about__app",children:[y.jsx("div",{className:"config-about__app-icon",children:y.jsx("span",{className:"material-symbols-rounded",children:"auto_awesome"})}),y.jsxs("div",{className:"config-about__app-info",children:[y.jsx("div",{className:"config-about__app-title",children:t("config.about.software")}),y.jsxs("div",{className:"config-about__app-meta",children:[y.jsxs("span",{className:"config-about__app-version",children:[t("config.about.version"),": ",o??t("config.about.unknown")]}),y.jsx("span",{className:"config-about__app-date",children:i??t("config.about.unknown")})]})]})]}),y.jsx("a",{className:"config-about__primary",href:(r==null?void 0:r.releases)??(r==null?void 0:r.repo),target:"_blank",rel:"noreferrer",children:t("config.about.checkUpdate")})]}),y.jsxs("div",{className:"config-about__list",children:[y.jsxs("a",{className:"config-about__item-row",href:(r==null?void 0:r.docs)??(r==null?void 0:r.repo),target:"_blank",rel:"noreferrer",children:[y.jsxs("span",{className:"config-about__item-left",children:[y.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"menu_book"}),y.jsx("span",{children:t("config.about.docs")})]}),y.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]}),y.jsxs("a",{className:"config-about__item-row",href:(r==null?void 0:r.contact)??(r==null?void 0:r.repo),target:"_blank",rel:"noreferrer",children:[y.jsxs("span",{className:"config-about__item-left",children:[y.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"mail"}),y.jsx("span",{children:t("config.about.contact")})]}),y.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]}),y.jsxs("a",{className:"config-about__item-row",href:(r==null?void 0:r.issues)??(r==null?void 0:r.repo),target:"_blank",rel:"noreferrer",children:[y.jsxs("span",{className:"config-about__item-left",children:[y.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"bug_report"}),y.jsx("span",{children:t("config.about.feedback")})]}),y.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]})]})]})},kn=({title:e,description:t,icon:n,layout:r="inline",children:o})=>y.jsxs("div",{className:`config-view__field-row${r==="stacked"?" config-view__field-row--stacked":""}`,children:[y.jsxs("div",{className:"config-view__field-meta",children:[n!=null&&y.jsx("span",{className:"material-symbols-rounded config-view__field-icon",children:n}),y.jsxs("div",{className:"config-view__field-text",children:[y.jsx("div",{className:"config-view__field-title",children:e}),t!=null&&t!==""&&y.jsx("div",{className:"config-view__field-desc",children:t})]})]}),y.jsx("div",{className:"config-view__field-control",children:o})]}),pg=e=>e==null?!0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1,fp=e=>e==null?e:JSON.parse(JSON.stringify(e)),YF=e=>Array.isArray(e)?"array":e!=null&&typeof e=="object"?"object":typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string",Rn=e=>e==="string"?"text_fields":e==="number"?"numbers":e==="boolean"?"toggle_on":e==="array"?"view_list":"account_tree",QF=(e,t,n,r)=>{if(n.length===0)return r;const o=`config.fields.${t}.${n.join(".")}.label`;return e(o,{defaultValue:r})},ZF=(e,t,n)=>{if(n.length===0)return"";const r=`config.fields.${t}.${n.join(".")}.desc`;return e(r,{defaultValue:""})},JF=e=>/key|token|secret|password/i.test(e),qp=(e,t)=>{if(t.length===0)return e;let n=e;for(const r of t){if(n==null||typeof n!="object")return;n=n[r]}return n},JR=(e,t,n)=>{if(t.length===0)return n;const r=e!=null&&typeof e=="object"&&!Array.isArray(e)?{...e}:{};let o=r;for(let i=0;i<t.length-1;i+=1){const a=t[i],s=o[a],l=s!=null&&typeof s=="object"&&!Array.isArray(s)?{...s}:{};o[a]=l,o=l}return o[t[t.length-1]]=n,r},e4=({value:e,sectionKey:t,path:n=[],t:r})=>pg(e)?y.jsx(bn,{description:r("common.noData"),image:null}):Array.isArray(e)?e.some(i=>i!=null&&typeof i=="object")?y.jsx("span",{className:"config-view__pill",children:r("config.editor.complexValue")}):y.jsx("div",{className:"config-view__display-pill",children:e.map((i,a)=>y.jsx("span",{className:"config-view__pill",children:String(i)},`${a}-${String(i)}`))}):e!=null&&typeof e=="object"?y.jsx("div",{className:"config-view__field-list",children:Object.entries(e).map(([o,i])=>{const a=QF(r,t,[...n,o],o),s=ZF(r,t,[...n,o]);return y.jsx(kn,{title:a,description:s,icon:Rn(YF(i)),children:y.jsx(e4,{value:i,sectionKey:t,path:[...n,o],t:r})},o)})}):y.jsx("span",{className:"config-view__pill",children:String(e)}),nu=({value:e,onChange:t})=>{const{message:n}=Eo.useApp(),{t:r}=Ot(),[o,i]=u.useState(()=>JSON.stringify(e??{},null,2));return u.useEffect(()=>{i(JSON.stringify(e??{},null,2))},[e]),y.jsx(Ft.TextArea,{className:"config-view__complex-editor",value:o,onChange:a=>{i(a.target.value)},onBlur:()=>{try{const a=JSON.parse(o);t==null||t(a),i(JSON.stringify(a??{},null,2))}catch{n.error(r("config.invalidJson")),i(JSON.stringify(e??{},null,2))}},placeholder:r("config.editor.complexPlaceholder"),autoSize:{minRows:6}})},cy=({value:e,onChange:t,t:n})=>y.jsxs("div",{className:"config-view__array-list",children:[e.map((r,o)=>y.jsxs("div",{className:"config-view__array-item",children:[y.jsx(Ft,{value:r,placeholder:n("config.editor.itemPlaceholder"),onChange:i=>{const a=e.slice();a[o]=i.target.value,t(a)}}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const i=e.slice();i.splice(o,1),t(i)}})})]},`${o}-${r}`)),y.jsx(dt,{title:n("config.editor.addItem"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button config-view__icon-button--full","aria-label":n("config.editor.addItem"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"add"}),onClick:()=>{t([...e,""])}})})]}),wCe=({value:e,onChange:t,placeholder:n,isMac:r,t:o})=>{const i=e.trim()===""?"":iB(e,r);return y.jsxs("div",{className:"config-shortcut-input",children:[y.jsx(Ft,{value:i,placeholder:n,readOnly:!0,onKeyDown:a=>{if(a.key==="Backspace"||a.key==="Delete"){a.preventDefault(),t("");return}const s=Wfe(a);s!=null&&(a.preventDefault(),t(s))}}),y.jsx(dt,{title:o("config.editor.clearShortcut"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":o("config.editor.clearShortcut"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"close"}),onClick:()=>t("")})})]})},_Ce={general:{items:{labelKey:"config.fields.general.notifications.label"}}},ECe={general:[{path:["baseDir"],type:"string",defaultValue:".ai",icon:"folder",group:"base"},{path:["effort"],type:"select",defaultValue:"",icon:"psychology",group:"base",options:[{value:"low",label:"config.options.effort.low"},{value:"medium",label:"config.options.effort.medium"},{value:"high",label:"config.options.effort.high"},{value:"max",label:"config.options.effort.max"}]},{path:["defaultAdapter"],type:"select",defaultValue:"",icon:"settings_input_component",group:"base"},{path:["defaultModelService"],type:"select",defaultValue:"",icon:"hub",group:"base"},{path:["defaultModel"],type:"select",defaultValue:"",icon:"model_training",group:"base"},{path:["recommendedModels"],type:"json",defaultValue:[],icon:"stars",group:"base"},{path:["interfaceLanguage"],type:"select",defaultValue:"",icon:"language",group:"base",options:[{value:"zh",label:"config.options.language.zh"},{value:"en",label:"config.options.language.en"}]},{path:["modelLanguage"],type:"select",defaultValue:"",icon:"translate",group:"base",options:[{value:"zh",label:"config.options.language.zh"},{value:"en",label:"config.options.language.en"}]},{path:["announcements"],type:"string[]",defaultValue:[],icon:"campaign",group:"base"},{path:["permissions","allow"],type:"string[]",defaultValue:[],icon:"check_circle",group:"permissions"},{path:["permissions","deny"],type:"string[]",defaultValue:[],icon:"block",group:"permissions"},{path:["permissions","ask"],type:"string[]",defaultValue:[],icon:"help",group:"permissions"},{path:["env"],type:"record",recordKind:"keyValue",defaultValue:{},icon:"terminal",group:"env"},{path:["notifications","disabled"],type:"boolean",defaultValue:!1,icon:"notifications",group:"items"},{path:["notifications","volume"],type:"number",defaultValue:100,icon:"volume_down",group:"items"},{path:["notifications","events","completed","title"],type:"string",defaultValue:"",icon:"title",group:"items",collapse:{key:"notifications.events.completed",labelKey:"config.fields.general.notifications.events.completed.label",descKey:"config.fields.general.notifications.events.completed.desc",togglePath:["notifications","events","completed","disabled"]}},{path:["notifications","events","completed","description"],type:"multiline",defaultValue:"",icon:"notes",group:"items",collapse:{key:"notifications.events.completed",labelKey:"config.fields.general.notifications.events.completed.label",descKey:"config.fields.general.notifications.events.completed.desc",togglePath:["notifications","events","completed","disabled"]}},{path:["notifications","events","completed","sound"],type:"string",defaultValue:"",icon:"volume_up",group:"items",collapse:{key:"notifications.events.completed",labelKey:"config.fields.general.notifications.events.completed.label",descKey:"config.fields.general.notifications.events.completed.desc",togglePath:["notifications","events","completed","disabled"]}},{path:["notifications","events","failed","title"],type:"string",defaultValue:"",icon:"title",group:"items",collapse:{key:"notifications.events.failed",labelKey:"config.fields.general.notifications.events.failed.label",descKey:"config.fields.general.notifications.events.failed.desc",togglePath:["notifications","events","failed","disabled"]}},{path:["notifications","events","failed","description"],type:"multiline",defaultValue:"",icon:"notes",group:"items",collapse:{key:"notifications.events.failed",labelKey:"config.fields.general.notifications.events.failed.label",descKey:"config.fields.general.notifications.events.failed.desc",togglePath:["notifications","events","failed","disabled"]}},{path:["notifications","events","failed","sound"],type:"string",defaultValue:"",icon:"volume_up",group:"items",collapse:{key:"notifications.events.failed",labelKey:"config.fields.general.notifications.events.failed.label",descKey:"config.fields.general.notifications.events.failed.desc",togglePath:["notifications","events","failed","disabled"]}},{path:["notifications","events","terminated","title"],type:"string",defaultValue:"",icon:"title",group:"items",collapse:{key:"notifications.events.terminated",labelKey:"config.fields.general.notifications.events.terminated.label",descKey:"config.fields.general.notifications.events.terminated.desc",togglePath:["notifications","events","terminated","disabled"]}},{path:["notifications","events","terminated","description"],type:"multiline",defaultValue:"",icon:"notes",group:"items",collapse:{key:"notifications.events.terminated",labelKey:"config.fields.general.notifications.events.terminated.label",descKey:"config.fields.general.notifications.events.terminated.desc",togglePath:["notifications","events","terminated","disabled"]}},{path:["notifications","events","terminated","sound"],type:"string",defaultValue:"",icon:"volume_up",group:"items",collapse:{key:"notifications.events.terminated",labelKey:"config.fields.general.notifications.events.terminated.label",descKey:"config.fields.general.notifications.events.terminated.desc",togglePath:["notifications","events","terminated","disabled"]}},{path:["notifications","events","waiting_input","title"],type:"string",defaultValue:"",icon:"title",group:"items",collapse:{key:"notifications.events.waiting_input",labelKey:"config.fields.general.notifications.events.waiting_input.label",descKey:"config.fields.general.notifications.events.waiting_input.desc",togglePath:["notifications","events","waiting_input","disabled"]}},{path:["notifications","events","waiting_input","description"],type:"multiline",defaultValue:"",icon:"notes",group:"items",collapse:{key:"notifications.events.waiting_input",labelKey:"config.fields.general.notifications.events.waiting_input.label",descKey:"config.fields.general.notifications.events.waiting_input.desc",togglePath:["notifications","events","waiting_input","disabled"]}},{path:["notifications","events","waiting_input","sound"],type:"string",defaultValue:"",icon:"volume_up",group:"items",collapse:{key:"notifications.events.waiting_input",labelKey:"config.fields.general.notifications.events.waiting_input.label",descKey:"config.fields.general.notifications.events.waiting_input.desc",togglePath:["notifications","events","waiting_input","disabled"]}}],conversation:[{path:["style"],type:"select",defaultValue:"friendly",icon:"forum",options:[{value:"friendly",label:"config.options.conversation.friendly"},{value:"programmatic",label:"config.options.conversation.programmatic"}]},{path:["customInstructions"],type:"multiline",defaultValue:"",icon:"description"}],models:[{path:[],type:"record",recordKind:"json",defaultValue:{},icon:"tune"}],modelServices:[{path:[],type:"record",recordKind:"modelServices",defaultValue:{},icon:"hub"}],channels:[{path:[],type:"record",recordKind:"channels",defaultValue:{},icon:"campaign"}],adapters:[{path:[],type:"record",recordKind:"json",defaultValue:{},icon:"settings_input_component"}],plugins:[{path:["plugins"],type:"record",recordKind:"json",defaultValue:{},icon:"extension"},{path:["enabledPlugins"],type:"record",recordKind:"boolean",defaultValue:{},group:"base",icon:"toggle_on",labelKey:"config.fields.plugins.enabled.label",descriptionKey:"config.fields.plugins.enabled.desc"},{path:["extraKnownMarketplaces"],type:"record",recordKind:"json",defaultValue:{},group:"base",icon:"storefront",labelKey:"config.fields.plugins.marketplaces.label",descriptionKey:"config.fields.plugins.marketplaces.desc"}],mcp:[{path:["defaultIncludeMcpServers"],type:"string[]",defaultValue:[],group:"base",icon:"playlist_add"},{path:["defaultExcludeMcpServers"],type:"string[]",defaultValue:[],group:"base",icon:"playlist_remove"},{path:["noDefaultVibeForgeMcpServer"],type:"boolean",defaultValue:!1,group:"base",icon:"block"},{path:["mcpServers"],type:"record",recordKind:"mcpServers",defaultValue:{},icon:"account_tree"}],shortcuts:[{path:["newSession"],type:"shortcut",defaultValue:"",icon:"add_comment"},{path:["openConfig"],type:"shortcut",defaultValue:"",icon:"settings"},{path:["sendMessage"],type:"shortcut",defaultValue:"",icon:"send"},{path:["clearInput"],type:"shortcut",defaultValue:"",icon:"clear"}]},$Ce=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),a=Object.entries(e);return y.jsxs("div",{className:"config-view__record-list",children:[a.map(([s,l])=>y.jsxs("div",{className:"config-view__record-row",children:[y.jsx("div",{className:"config-view__record-key",children:s}),y.jsx(ta,{checked:!!l,onChange:c=>{t({...e,[s]:c})}}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const c={...e};delete c[s],t(c)}})})]},s)),y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:s=>i(s.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{t({...e,[o]:!0}),i("")}})})]})})]})};var pn;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const a of o)i[a]=a;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(const s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(const a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(pn||(pn={}));var eP;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(eP||(eP={}));const _t=pn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),es=e=>{switch(typeof e){case"undefined":return _t.undefined;case"string":return _t.string;case"number":return Number.isNaN(e)?_t.nan:_t.number;case"boolean":return _t.boolean;case"function":return _t.function;case"bigint":return _t.bigint;case"symbol":return _t.symbol;case"object":return Array.isArray(e)?_t.array:e===null?_t.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?_t.promise:typeof Map<"u"&&e instanceof Map?_t.map:typeof Set<"u"&&e instanceof Set?_t.set:typeof Date<"u"&&e instanceof Date?_t.date:_t.object;default:return _t.unknown}},ot=pn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ja extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(n(a))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof ja))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ja.create=e=>new ja(e);const kC=(e,t)=>{let n;switch(e.code){case ot.invalid_type:e.received===_t.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,pn.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${pn.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${pn.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${pn.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:pn.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ot.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ot.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,pn.assertNever(e)}return{message:n}};let kCe=kC;function NCe(){return kCe}const OCe=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function yt(e,t){const n=NCe(),r=OCe({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===kC?void 0:kC].filter(o=>!!o)});e.common.issues.push(r)}class uo{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Wt;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,a=await o.value;r.push({key:i,value:a})}return uo.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Wt;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(r[i.value]=a.value)}return{status:t.value,value:r}}}const Wt=Object.freeze({status:"aborted"}),hd=e=>({status:"dirty",value:e}),fi=e=>({status:"valid",value:e}),tP=e=>e.status==="aborted",nP=e=>e.status==="dirty",ru=e=>e.status==="valid",hg=e=>typeof Promise<"u"&&e instanceof Promise;var kt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(kt||(kt={}));class na{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const rP=(e,t)=>{if(ru(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ja(e.common.issues);return this._error=n,this._error}}};function Zt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{const{message:l}=e;return a.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??r??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:l??n??s.defaultError}},description:o}}class ln{get description(){return this._def.description}_getType(t){return es(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:es(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new uo,ctx:{common:t.parent.common,data:t.data,parsedType:es(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(hg(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:es(t)},o=this._parseSync({data:t,path:r.path,parent:r});return rP(r,o)}"~validate"(t){var r,o;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:es(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return ru(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(o=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>ru(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:es(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(hg(o)?o:Promise.resolve(o));return rP(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const a=t(o),s=()=>i.addIssue({code:ot.custom,...r(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Aa({schema:this,typeName:Ht.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ki.create(this,this._def)}nullable(){return La.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oi.create(this)}promise(){return Cg.create(this,this._def)}or(t){return vg.create([this,t],this._def)}and(t){return yg.create(this,t,this._def)}transform(t){return new Aa({...Zt(this._def),schema:this,typeName:Ht.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ou({...Zt(this._def),innerType:this,defaultValue:n,typeName:Ht.ZodDefault})}brand(){return new ZCe({typeName:Ht.ZodBranded,type:this,...Zt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new OC({...Zt(this._def),innerType:this,catchValue:n,typeName:Ht.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return G1.create(this,t)}readonly(){return IC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ICe=/^c[^\s-]{8,}$/i,RCe=/^[0-9a-z]+$/,PCe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,TCe=/^[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,jCe=/^[a-z0-9_-]{21}$/i,MCe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ACe=/^[-+]?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)?)??$/,LCe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,DCe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let C0;const zCe=/^(?:(?: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])$/,BCe=/^(?:(?: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])$/,FCe=/^(([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]))$/,HCe=/^(([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])$/,VCe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,WCe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,t4="((\\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])))",KCe=new RegExp(`^${t4}$`);function n4(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function UCe(e){return new RegExp(`^${n4(e)}$`)}function GCe(e){let t=`${t4}T${n4(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function qCe(e,t){return!!((t==="v4"||!t)&&zCe.test(e)||(t==="v6"||!t)&&FCe.test(e))}function XCe(e,t){if(!MCe.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function YCe(e,t){return!!((t==="v4"||!t)&&BCe.test(e)||(t==="v6"||!t)&&HCe.test(e))}class ni extends ln{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==_t.string){const i=this._getOrReturnCtx(t);return yt(i,{code:ot.invalid_type,expected:_t.string,received:i.parsedType}),Wt}const r=new uo;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?yt(o,{code:ot.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&yt(o,{code:ot.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")LCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"email",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")C0||(C0=new RegExp(DCe,"u")),C0.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"emoji",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")TCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"uuid",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")jCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"nanoid",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")ICe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"cuid",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")RCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"cuid2",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")PCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"ulid",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),yt(o,{validation:"url",code:ot.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"regex",code:ot.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?GCe(i).test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?KCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?UCe(i).test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?ACe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"duration",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?qCe(t.data,i.version)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"ip",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?XCe(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"jwt",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?YCe(t.data,i.version)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"cidr",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?VCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"base64",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?WCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"base64url",code:ot.invalid_string,message:i.message}),r.dirty()):pn.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:ot.invalid_string,...kt.errToObj(r)})}_addCheck(t){return new ni({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...kt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...kt.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...kt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...kt.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...kt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...kt.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...kt.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...kt.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...kt.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...kt.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...kt.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...kt.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...kt.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...kt.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...kt.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...kt.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...kt.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...kt.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...kt.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...kt.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...kt.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...kt.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...kt.errToObj(n)})}nonempty(t){return this.min(1,kt.errToObj(t))}trim(){return new ni({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ni({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ni({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}ni.create=e=>new ni({checks:[],typeName:Ht.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Zt(e)});function QCe(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}class bl extends ln{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==_t.number){const i=this._getOrReturnCtx(t);return yt(i,{code:ot.invalid_type,expected:_t.number,received:i.parsedType}),Wt}let r;const o=new uo;for(const i of this._def.checks)i.kind==="int"?pn.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?QCe(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.not_finite,message:i.message}),o.dirty()):pn.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,kt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,kt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,kt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,kt.toString(n))}setLimit(t,n,r,o){return new bl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:kt.toString(o)}]})}_addCheck(t){return new bl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:kt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:kt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:kt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:kt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:kt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:kt.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:kt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:kt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:kt.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&pn.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}bl.create=e=>new bl({checks:[],typeName:Ht.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Zt(e)});class If extends ln{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==_t.bigint)return this._getInvalidInput(t);let r;const o=new uo;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):pn.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return yt(n,{code:ot.invalid_type,expected:_t.bigint,received:n.parsedType}),Wt}gte(t,n){return this.setLimit("min",t,!0,kt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,kt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,kt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,kt.toString(n))}setLimit(t,n,r,o){return new If({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:kt.toString(o)}]})}_addCheck(t){return new If({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:kt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:kt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:kt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:kt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:kt.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}If.create=e=>new If({checks:[],typeName:Ht.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Zt(e)});class Rf extends ln{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==_t.boolean){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.boolean,received:r.parsedType}),Wt}return fi(t.data)}}Rf.create=e=>new Rf({typeName:Ht.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Zt(e)});class gg extends ln{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==_t.date){const i=this._getOrReturnCtx(t);return yt(i,{code:ot.invalid_type,expected:_t.date,received:i.parsedType}),Wt}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return yt(i,{code:ot.invalid_date}),Wt}const r=new uo;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):pn.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new gg({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:kt.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:kt.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}gg.create=e=>new gg({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ht.ZodDate,...Zt(e)});class oP extends ln{_parse(t){if(this._getType(t)!==_t.symbol){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.symbol,received:r.parsedType}),Wt}return fi(t.data)}}oP.create=e=>new oP({typeName:Ht.ZodSymbol,...Zt(e)});class iP extends ln{_parse(t){if(this._getType(t)!==_t.undefined){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.undefined,received:r.parsedType}),Wt}return fi(t.data)}}iP.create=e=>new iP({typeName:Ht.ZodUndefined,...Zt(e)});class aP extends ln{_parse(t){if(this._getType(t)!==_t.null){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.null,received:r.parsedType}),Wt}return fi(t.data)}}aP.create=e=>new aP({typeName:Ht.ZodNull,...Zt(e)});class sP extends ln{constructor(){super(...arguments),this._any=!0}_parse(t){return fi(t.data)}}sP.create=e=>new sP({typeName:Ht.ZodAny,...Zt(e)});class lP extends ln{constructor(){super(...arguments),this._unknown=!0}_parse(t){return fi(t.data)}}lP.create=e=>new lP({typeName:Ht.ZodUnknown,...Zt(e)});class $s extends ln{_parse(t){const n=this._getOrReturnCtx(t);return yt(n,{code:ot.invalid_type,expected:_t.never,received:n.parsedType}),Wt}}$s.create=e=>new $s({typeName:Ht.ZodNever,...Zt(e)});class cP extends ln{_parse(t){if(this._getType(t)!==_t.undefined){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.void,received:r.parsedType}),Wt}return fi(t.data)}}cP.create=e=>new cP({typeName:Ht.ZodVoid,...Zt(e)});class oi extends ln{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==_t.array)return yt(n,{code:ot.invalid_type,expected:_t.array,received:n.parsedType}),Wt;if(o.exactLength!==null){const a=n.data.length>o.exactLength.value,s=n.data.length<o.exactLength.value;(a||s)&&(yt(n,{code:a?ot.too_big:ot.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(yt(n,{code:ot.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(yt(n,{code:ot.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>o.type._parseAsync(new na(n,a,n.path,s)))).then(a=>uo.mergeArray(r,a));const i=[...n.data].map((a,s)=>o.type._parseSync(new na(n,a,n.path,s)));return uo.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new oi({...this._def,minLength:{value:t,message:kt.toString(n)}})}max(t,n){return new oi({...this._def,maxLength:{value:t,message:kt.toString(n)}})}length(t,n){return new oi({...this._def,exactLength:{value:t,message:kt.toString(n)}})}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ht.ZodArray,...Zt(t)});function Yl(e){if(e instanceof qn){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ki.create(Yl(r))}return new qn({...e._def,shape:()=>t})}else return e instanceof oi?new oi({...e._def,type:Yl(e.element)}):e instanceof ki?ki.create(Yl(e.unwrap())):e instanceof La?La.create(Yl(e.unwrap())):e instanceof xl?xl.create(e.items.map(t=>Yl(t))):e}class qn extends ln{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=pn.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==_t.object){const c=this._getOrReturnCtx(t);return yt(c,{code:ot.invalid_type,expected:_t.object,received:c.parsedType}),Wt}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof $s&&this._def.unknownKeys==="strip"))for(const c in o.data)a.includes(c)||s.push(c);const l=[];for(const c of a){const d=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new na(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof $s){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of s)l.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(c==="strict")s.length>0&&(yt(o,{code:ot.unrecognized_keys,keys:s}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of s){const f=o.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new na(o,f,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const f=await d.key,m=await d.value;c.push({key:f,value:m,alwaysSet:d.alwaysSet})}return c}).then(c=>uo.mergeObjectSync(r,c)):uo.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return kt.errToObj,new qn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,a;const o=((a=(i=this._def).errorMap)==null?void 0:a.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:kt.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new qn({...this._def,unknownKeys:"strip"})}passthrough(){return new qn({...this._def,unknownKeys:"passthrough"})}extend(t){return new qn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new qn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ht.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new qn({...this._def,catchall:t})}pick(t){const n={};for(const r of pn.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new qn({...this._def,shape:()=>n})}omit(t){const n={};for(const r of pn.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new qn({...this._def,shape:()=>n})}deepPartial(){return Yl(this)}partial(t){const n={};for(const r of pn.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new qn({...this._def,shape:()=>n})}required(t){const n={};for(const r of pn.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ki;)i=i._def.innerType;n[r]=i}return new qn({...this._def,shape:()=>n})}keyof(){return r4(pn.objectKeys(this.shape))}}qn.create=(e,t)=>new qn({shape:()=>e,unknownKeys:"strip",catchall:$s.create(),typeName:Ht.ZodObject,...Zt(t)});qn.strictCreate=(e,t)=>new qn({shape:()=>e,unknownKeys:"strict",catchall:$s.create(),typeName:Ht.ZodObject,...Zt(t)});qn.lazycreate=(e,t)=>new qn({shape:e,unknownKeys:"strip",catchall:$s.create(),typeName:Ht.ZodObject,...Zt(t)});class vg extends ln{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(s=>new ja(s.ctx.common.issues));return yt(n,{code:ot.invalid_union,unionErrors:a}),Wt}if(n.common.async)return Promise.all(r.map(async i=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(o);{let i;const a=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const s=a.map(l=>new ja(l));return yt(n,{code:ot.invalid_union,unionErrors:s}),Wt}}get options(){return this._def.options}}vg.create=(e,t)=>new vg({options:e,typeName:Ht.ZodUnion,...Zt(t)});function NC(e,t){const n=es(e),r=es(t);if(e===t)return{valid:!0,data:e};if(n===_t.object&&r===_t.object){const o=pn.objectKeys(t),i=pn.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(const s of i){const l=NC(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===_t.array&&r===_t.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const a=e[i],s=t[i],l=NC(a,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===_t.date&&r===_t.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class yg extends ln{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,a)=>{if(tP(i)||tP(a))return Wt;const s=NC(i.value,a.value);return s.valid?((nP(i)||nP(a))&&n.dirty(),{status:n.value,value:s.data}):(yt(r,{code:ot.invalid_intersection_types}),Wt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}yg.create=(e,t,n)=>new yg({left:e,right:t,typeName:Ht.ZodIntersection,...Zt(n)});class xl extends ln{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_t.array)return yt(r,{code:ot.invalid_type,expected:_t.array,received:r.parsedType}),Wt;if(r.data.length<this._def.items.length)return yt(r,{code:ot.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Wt;!this._def.rest&&r.data.length>this._def.items.length&&(yt(r,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new na(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>uo.mergeArray(n,a)):uo.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new xl({...this._def,rest:t})}}xl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xl({items:e,typeName:Ht.ZodTuple,rest:null,...Zt(t)})};class bg extends ln{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_t.object)return yt(r,{code:ot.invalid_type,expected:_t.object,received:r.parsedType}),Wt;const o=[],i=this._def.keyType,a=this._def.valueType;for(const s in r.data)o.push({key:i._parse(new na(r,s,r.path,s)),value:a._parse(new na(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?uo.mergeObjectAsync(n,o):uo.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ln?new bg({keyType:t,valueType:n,typeName:Ht.ZodRecord,...Zt(r)}):new bg({keyType:ni.create(),valueType:t,typeName:Ht.ZodRecord,...Zt(n)})}}class uP extends ln{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_t.map)return yt(r,{code:ot.invalid_type,expected:_t.map,received:r.parsedType}),Wt;const o=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([s,l],c)=>({key:o._parse(new na(r,s,r.path,[c,"key"])),value:i._parse(new na(r,l,r.path,[c,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return Wt;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),s.set(c.value,d.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return Wt;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),s.set(c.value,d.value)}return{status:n.value,value:s}}}}uP.create=(e,t,n)=>new uP({valueType:t,keyType:e,typeName:Ht.ZodMap,...Zt(n)});class Pf extends ln{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_t.set)return yt(r,{code:ot.invalid_type,expected:_t.set,received:r.parsedType}),Wt;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(yt(r,{code:ot.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(yt(r,{code:ot.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function a(l){const c=new Set;for(const d of l){if(d.status==="aborted")return Wt;d.status==="dirty"&&n.dirty(),c.add(d.value)}return{status:n.value,value:c}}const s=[...r.data.values()].map((l,c)=>i._parse(new na(r,l,r.path,c)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Pf({...this._def,minSize:{value:t,message:kt.toString(n)}})}max(t,n){return new Pf({...this._def,maxSize:{value:t,message:kt.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Pf.create=(e,t)=>new Pf({valueType:e,minSize:null,maxSize:null,typeName:Ht.ZodSet,...Zt(t)});class dP extends ln{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}dP.create=(e,t)=>new dP({getter:e,typeName:Ht.ZodLazy,...Zt(t)});class xg extends ln{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return yt(n,{received:n.data,code:ot.invalid_literal,expected:this._def.value}),Wt}return{status:"valid",value:t.data}}get value(){return this._def.value}}xg.create=(e,t)=>new xg({value:e,typeName:Ht.ZodLiteral,...Zt(t)});function r4(e,t){return new Ma({values:e,typeName:Ht.ZodEnum,...Zt(t)})}class Ma extends ln{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return yt(n,{expected:pn.joinValues(r),received:n.parsedType,code:ot.invalid_type}),Wt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return yt(n,{received:n.data,code:ot.invalid_enum_value,options:r}),Wt}return fi(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Ma.create(t,{...this._def,...n})}exclude(t,n=this._def){return Ma.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ma.create=r4;class Sg extends ln{_parse(t){const n=pn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==_t.string&&r.parsedType!==_t.number){const o=pn.objectValues(n);return yt(r,{expected:pn.joinValues(o),received:r.parsedType,code:ot.invalid_type}),Wt}if(this._cache||(this._cache=new Set(pn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=pn.objectValues(n);return yt(r,{received:r.data,code:ot.invalid_enum_value,options:o}),Wt}return fi(t.data)}get enum(){return this._def.values}}Sg.create=(e,t)=>new Sg({values:e,typeName:Ht.ZodNativeEnum,...Zt(t)});class Cg extends ln{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_t.promise&&n.common.async===!1)return yt(n,{code:ot.invalid_type,expected:_t.promise,received:n.parsedType}),Wt;const r=n.parsedType===_t.promise?n.data:Promise.resolve(n.data);return fi(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Cg.create=(e,t)=>new Cg({type:e,typeName:Ht.ZodPromise,...Zt(t)});class Aa extends ln{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ht.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{yt(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const a=o.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return Wt;const l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?Wt:l.status==="dirty"||n.value==="dirty"?hd(l.value):l});{if(n.value==="aborted")return Wt;const s=this._def.schema._parseSync({data:a,path:r.path,parent:r});return s.status==="aborted"?Wt:s.status==="dirty"||n.value==="dirty"?hd(s.value):s}}if(o.type==="refinement"){const a=s=>{const l=o.refinement(s,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Wt:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Wt:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(o.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ru(a))return Wt;const s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>ru(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:n.value,value:s})):Wt);pn.assertNever(o)}}Aa.create=(e,t,n)=>new Aa({schema:e,typeName:Ht.ZodEffects,effect:t,...Zt(n)});Aa.createWithPreprocess=(e,t,n)=>new Aa({schema:t,effect:{type:"preprocess",transform:e},typeName:Ht.ZodEffects,...Zt(n)});class ki extends ln{_parse(t){return this._getType(t)===_t.undefined?fi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ki.create=(e,t)=>new ki({innerType:e,typeName:Ht.ZodOptional,...Zt(t)});class La extends ln{_parse(t){return this._getType(t)===_t.null?fi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}La.create=(e,t)=>new La({innerType:e,typeName:Ht.ZodNullable,...Zt(t)});class ou extends ln{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===_t.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ou.create=(e,t)=>new ou({innerType:e,typeName:Ht.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Zt(t)});class OC extends ln{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return hg(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ja(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ja(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}OC.create=(e,t)=>new OC({innerType:e,typeName:Ht.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Zt(t)});class fP extends ln{_parse(t){if(this._getType(t)!==_t.nan){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.nan,received:r.parsedType}),Wt}return{status:"valid",value:t.data}}}fP.create=e=>new fP({typeName:Ht.ZodNaN,...Zt(e)});class ZCe extends ln{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class G1 extends ln{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Wt:i.status==="dirty"?(n.dirty(),hd(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Wt:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new G1({in:t,out:n,typeName:Ht.ZodPipeline})}}class IC extends ln{_parse(t){const n=this._def.innerType._parse(t),r=o=>(ru(o)&&(o.value=Object.freeze(o.value)),o);return hg(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}IC.create=(e,t)=>new IC({innerType:e,typeName:Ht.ZodReadonly,...Zt(t)});var Ht;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ht||(Ht={}));const yo=ni.create,RC=Rf.create;$s.create;const od=oi.create,q1=qn.create;vg.create;yg.create;xl.create;const JCe=xg.create,X1=Ma.create;Cg.create;ki.create;La.create;const ewe=q1({admins:od(yo()).optional().describe("频道管理员账号(sender ID),管理员拥有管理操作权限且不受以下访问控制限制"),allowPrivateChat:RC().optional().describe("是否允许私聊消息,默认 true"),allowGroupChat:RC().optional().describe("是否允许群聊消息,默认 true"),allowedGroups:od(yo()).optional().describe("群组白名单(channel ID),设置后仅在指定群中响应"),blockedGroups:od(yo()).optional().describe("群组黑名单(channel ID),在指定群中不响应"),allowedSenders:od(yo()).optional().describe("发送者白名单(sender ID),设置后仅白名单内的用户可交互"),blockedSenders:od(yo()).optional().describe("发送者黑名单(sender ID),黑名单内的用户消息将被忽略")}),o4=q1({type:yo().min(1).describe("频道类型"),title:yo().optional().describe("频道标题"),description:yo().optional().describe("频道说明"),enabled:RC().optional().describe("是否启用"),systemPrompt:yo().optional().describe("在此频道启动会话时注入的系统提示词"),commandPrefix:yo().optional().describe("频道指令前缀,默认 /"),language:X1(["zh","en"]).optional().describe("频道提示语言,默认 zh"),access:ewe.optional().describe("频道访问权限配置")}),twe=e=>e,nwe=o4.extend({type:JCe("lark").describe("频道类型"),appId:yo().min(1).describe("飞书 App ID"),appSecret:yo().min(1).describe("飞书 App Secret"),domain:X1(["Feishu","Lark"]).optional().describe("飞书 Domain")}),rwe=q1({receiveId:yo().min(1).describe("接收方 ID"),receiveIdType:X1(["open_id","user_id","chat_id","email"]).describe("接收方类型"),text:yo().min(1).describe("消息文本")}),owe=twe({type:"lark",label:"飞书",description:"飞书消息通道",configSchema:nwe,messageSchema:rwe}),PC=[owe],cs=e=>e instanceof qn?e.shape:e instanceof Aa?cs(e.innerType()):e instanceof ki?cs(e.unwrap()):e instanceof ou?cs(e.removeDefault()):e instanceof La?cs(e.unwrap()):{},hc=e=>e instanceof Aa?hc(e.innerType()):e instanceof ki?hc(e.unwrap()):e instanceof ou?hc(e.removeDefault()):e instanceof La?hc(e.unwrap()):e,wg=e=>{if(e instanceof ou)return e._def.defaultValue();if(!(e instanceof ki)){if(e instanceof La)return null;if(e instanceof xg)return e.value;if(e instanceof Ma)return e.options[0];if(e instanceof Sg){const t=Object.values(e.enum);return t.length>0?t[0]:void 0}if(e instanceof ni)return"";if(e instanceof bl)return 0;if(e instanceof Rf)return!1;if(e instanceof oi)return[];if(e instanceof qn){const t=cs(e);return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,wg(r)]))}if(e instanceof bg)return{};if(e instanceof Aa)return wg(e.innerType())}},iwe=e=>e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase()),mP=e=>{const t=cs(e.configSchema);return Object.entries(t).reduce((r,[o,i])=>(r[o]=wg(i),r),{})},w0=e=>PC.find(t=>t.type===e),awe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{var b;const[o,i]=u.useState(""),[a,s]=u.useState(((b=PC[0])==null?void 0:b.type)??""),l=u.useMemo(()=>Object.entries(e),[e]),[c,d]=u.useState(()=>Object.fromEntries(l.map(([x])=>[x,!0]))),f=u.useMemo(()=>new Set(Object.keys(cs(o4))),[]),m=u.useMemo(()=>PC.map(x=>({value:x.type,label:x.label})),[]);u.useEffect(()=>{d(x=>{const g={};for(const[v]of l)g[v]=x[v]??!0;return g})},[l]);const p=(x,g)=>{t({...e,[x]:g})},h=(x,g,v,S)=>{const C=hc(S),_=C.description??"",w=iwe(v),N=g[v],k=N!==void 0?N:wg(S);if(C instanceof ni){const E=JF(v);return y.jsx(kn,{title:w,description:_,icon:Rn("string"),children:E?y.jsx(Ft.Password,{value:typeof k=="string"?k:"",onChange:$=>{p(x,{...g,[v]:$.target.value})},placeholder:n("config.editor.secretPlaceholder")}):y.jsx(Ft,{value:typeof k=="string"?k:"",onChange:$=>{p(x,{...g,[v]:$.target.value})}})},v)}if(C instanceof bl)return y.jsx(kn,{title:w,description:_,icon:Rn("number"),children:y.jsx(Zc,{value:typeof k=="number"?k:0,onChange:E=>{p(x,{...g,[v]:E??0})}})},v);if(C instanceof Rf)return y.jsx(kn,{title:w,description:_,icon:Rn("boolean"),children:y.jsx(ta,{checked:!!k,onChange:E=>{p(x,{...g,[v]:E})}})},v);if(C instanceof Ma||C instanceof Sg){const E=(C instanceof Ma?C.options:Object.values(C.enum)).map($=>String($));return y.jsx(kn,{title:w,description:_,icon:Rn("string"),children:y.jsx(Yn,{value:typeof k=="string"?k:void 0,options:E.map($=>({value:$,label:$})),onChange:$=>{p(x,{...g,[v]:$})}})},v)}if(C instanceof oi){if(hc(C.element)instanceof ni){const $=Array.isArray(k)?k.filter(O=>typeof O=="string"):[];return y.jsx(kn,{title:w,description:_,icon:Rn("array"),layout:"stacked",children:y.jsx(cy,{value:$,onChange:O=>{p(x,{...g,[v]:O})},t:n})},v)}return y.jsx(kn,{title:w,description:_,icon:Rn("array"),layout:"stacked",children:y.jsx(nu,{value:Array.isArray(k)?k:[],onChange:$=>{p(x,{...g,[v]:$})}})},v)}return y.jsx(kn,{title:w,description:_,icon:Rn("object"),layout:"stacked",children:y.jsx(nu,{value:k??{},onChange:E=>{p(x,{...g,[v]:E})}})},v)};return y.jsxs("div",{className:"config-view__record-list",children:[y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:x=>i(x.target.value)}),y.jsx(Yn,{value:a,options:m,onChange:x=>s(x)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o)||a==="",onClick:()=>{const x=w0(a);x&&(t({...e,[o]:mP(x)}),i(""))}})})]})}),l.map(([x,g])=>{const v=g!=null&&typeof g=="object"?g:{},S=typeof v.type=="string"?v.type:void 0,C=w0(S),_=typeof v.title=="string"?v.title:"",w=typeof v.description=="string"?v.description:"",N=_.trim()!==""?_:x,k=(C==null?void 0:C.label)??S??n("config.editor.unknownChannelType"),E=c[x]===!0,$=C?cs(C.configSchema):{},O=Object.entries($).filter(([R])=>R!=="type").sort(([R],[T])=>{const I=["title","description","enabled","admins"],P=I.indexOf(R),j=I.indexOf(T);return P===-1&&j===-1?R.localeCompare(T):P===-1?1:j===-1?-1:P-j});return y.jsxs("div",{className:`config-view__record-card${E?" config-view__record-card--collapsed":""}`,children:[y.jsxs("div",{className:"config-view__record-title",children:[y.jsxs("div",{className:"config-view__record-title-left",children:[y.jsx(dt,{title:n(E?"config.editor.expand":"config.editor.collapse"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":n(E?"config.editor.expand":"config.editor.collapse"),icon:y.jsx("span",{className:"material-symbols-rounded",children:E?"chevron_right":"expand_more"}),onClick:()=>{d(R=>({...R,[x]:!E}))}})}),y.jsxs("div",{className:"config-view__record-heading",children:[y.jsx("div",{children:N}),y.jsxs("div",{className:"config-view__record-subtitle",children:[x," · ",k]}),w!==""&&y.jsx("div",{className:"config-view__record-desc",children:w})]})]}),y.jsx("div",{className:"config-view__record-actions",children:y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const R={...e};delete R[x],t(R)}})})})]}),y.jsx("div",{className:"config-view__record-body",children:y.jsxs("div",{className:"config-view__record-fields",children:[y.jsx(kn,{title:n("config.editor.channelType"),description:(C==null?void 0:C.description)??"",icon:Rn("string"),children:y.jsx(Yn,{value:S,options:m,onChange:R=>{const T=w0(R);if(!T)return;const I=mP(T),P=Object.fromEntries(Object.entries(v).filter(([j])=>f.has(j)));p(x,{...I,...P,type:R})}})}),O.map(([R,T])=>h(x,v,R,T))]})})]},x)})]})},TC=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),[a,s]=u.useState(""),l=Object.entries(e);return y.jsxs("div",{className:"config-view__array-list",children:[l.map(([c,d])=>y.jsxs("div",{className:"config-view__array-item",children:[y.jsx("div",{className:"config-view__record-key",children:c}),JF(c)?y.jsx(Ft.Password,{value:d,onChange:f=>{t({...e,[c]:f.target.value})},placeholder:n("config.editor.fieldValue")}):y.jsx(Ft,{value:d,onChange:f=>{t({...e,[c]:f.target.value})},placeholder:n("config.editor.fieldValue")}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const f={...e};delete f[c],t(f)}})})]},c)),y.jsx("div",{className:"config-view__array-add",children:y.jsxs("div",{className:"config-view__array-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:c=>i(c.target.value)}),y.jsx(Ft,{value:a,placeholder:n("config.editor.fieldValue"),onChange:c=>s(c.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{const c={...e,[o]:a};t(c),i(""),s("")}})})]})})]})},swe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),a=u.useMemo(()=>Object.entries(e),[e]),[s,l]=u.useState(()=>Object.fromEntries(a.map(([c])=>[c,!0])));return u.useEffect(()=>{l(c=>{const d={};for(const[f]of a)d[f]=c[f]??!0;return d})},[a]),y.jsxs("div",{className:"config-view__record-list",children:[a.map(([c,d])=>{const f=d!=null&&typeof d=="object"?d:{},m=typeof f.type=="string"?f.type:"command",p=f.env!=null&&typeof f.env=="object"?f.env:{},h=f.headers!=null&&typeof f.headers=="object"?f.headers:{},b=Array.isArray(f.args)?f.args.filter(v=>typeof v=="string"):[],x=v=>{t({...e,[c]:v})},g=s[c]===!0;return y.jsxs("div",{className:`config-view__record-card${g?" config-view__record-card--collapsed":""}`,children:[y.jsxs("div",{className:"config-view__record-title",children:[y.jsxs("div",{className:"config-view__record-title-left",children:[y.jsx(dt,{title:n(g?"config.editor.expand":"config.editor.collapse"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":n(g?"config.editor.expand":"config.editor.collapse"),icon:y.jsx("span",{className:"material-symbols-rounded",children:g?"chevron_right":"expand_more"}),onClick:()=>{l(v=>({...v,[c]:!g}))}})}),y.jsx("span",{children:c})]}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const v={...e};delete v[c],t(v)}})})]}),y.jsx("div",{className:"config-view__record-body",children:y.jsxs("div",{className:"config-view__record-fields",children:[y.jsx(kn,{title:n("config.fields.mcpServer.enabled.label"),description:n("config.fields.mcpServer.enabled.desc"),icon:Rn("boolean"),children:y.jsx(ta,{checked:!!f.enabled,onChange:v=>{x({...f,enabled:v})}})}),y.jsx(kn,{title:n("config.fields.mcpServer.type.label"),description:n("config.fields.mcpServer.type.desc"),icon:Rn("string"),children:y.jsx(Yn,{value:m,options:[{value:"command",label:n("config.options.mcp.command")},{value:"sse",label:n("config.options.mcp.sse")},{value:"http",label:n("config.options.mcp.http")}],onChange:v=>{const S={...f};v==="command"?(delete S.type,S.command==null&&(S.command=""),S.args==null&&(S.args=[]),delete S.url,delete S.headers):(S.type=v,S.url==null&&(S.url=""),S.headers==null&&(S.headers={}),delete S.command,delete S.args),x(S)}})}),m==="command"&&y.jsxs(y.Fragment,{children:[y.jsx(kn,{title:n("config.fields.mcpServer.command.label"),description:n("config.fields.mcpServer.command.desc"),icon:Rn("string"),children:y.jsx(Ft,{value:typeof f.command=="string"?f.command:"",onChange:v=>{x({...f,command:v.target.value})},placeholder:n("config.editor.commandPlaceholder")})}),y.jsx(kn,{title:n("config.fields.mcpServer.args.label"),description:n("config.fields.mcpServer.args.desc"),icon:Rn("array"),layout:"stacked",children:y.jsx(cy,{value:b,onChange:v=>{x({...f,args:v})},t:n})})]}),m!=="command"&&y.jsxs(y.Fragment,{children:[y.jsx(kn,{title:n("config.fields.mcpServer.url.label"),description:n("config.fields.mcpServer.url.desc"),icon:Rn("string"),children:y.jsx(Ft,{value:typeof f.url=="string"?f.url:"",onChange:v=>{x({...f,url:v.target.value})},placeholder:n("config.editor.urlPlaceholder")})}),y.jsx(kn,{title:n("config.fields.mcpServer.headers.label"),description:n("config.fields.mcpServer.headers.desc"),icon:Rn("object"),layout:"stacked",children:y.jsx(TC,{value:h,onChange:v=>{x({...f,headers:v})},t:n,keyPlaceholder:n("config.editor.newHeaderName")})})]}),y.jsx(kn,{title:n("config.fields.mcpServer.env.label"),description:n("config.fields.mcpServer.env.desc"),icon:Rn("object"),layout:"stacked",children:y.jsx(TC,{value:p,onChange:v=>{x({...f,env:v})},t:n,keyPlaceholder:n("config.editor.newEnvVarName")})})]})})]},c)}),y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:c=>i(c.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{t({...e,[o]:{enabled:!0,command:"",args:[]}}),i("")}})})]})})]})},lwe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),a=u.useMemo(()=>Object.entries(e),[e]),[s,l]=u.useState(()=>Object.fromEntries(a.map(([c])=>[c,!0])));return u.useEffect(()=>{l(c=>{const d={};for(const[f]of a)d[f]=c[f]??!0;return d})},[a]),y.jsxs("div",{className:"config-view__record-list",children:[a.map(([c,d])=>{const f=d!=null&&typeof d=="object"?d:{},m=typeof f.title=="string"?f.title:"",p=typeof f.description=="string"?f.description:"",h=m.trim()!==""?m:c,b=Array.isArray(f.models)?f.models.filter(g=>typeof g=="string"):[],x=s[c]===!0;return y.jsxs("div",{className:`config-view__record-card${x?" config-view__record-card--collapsed":""}`,children:[y.jsxs("div",{className:"config-view__record-title",children:[y.jsxs("div",{className:"config-view__record-title-left",children:[y.jsx(dt,{title:n(x?"config.editor.expand":"config.editor.collapse"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":n(x?"config.editor.expand":"config.editor.collapse"),icon:y.jsx("span",{className:"material-symbols-rounded",children:x?"chevron_right":"expand_more"}),onClick:()=>{l(g=>({...g,[c]:!x}))}})}),y.jsxs("div",{className:"config-view__record-heading",children:[y.jsx("div",{children:h}),h!==c&&y.jsx("div",{className:"config-view__record-subtitle",children:c}),p!==""&&y.jsx("div",{className:"config-view__record-desc",children:p})]})]}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const g={...e};delete g[c],t(g)}})})]}),y.jsx("div",{className:"config-view__record-body",children:y.jsxs("div",{className:"config-view__record-fields",children:[y.jsx(kn,{title:n("config.fields.modelServices.item.title.label"),description:n("config.fields.modelServices.item.title.desc"),icon:Rn("string"),children:y.jsx(Ft,{value:m,onChange:g=>{t({...e,[c]:{...f,title:g.target.value}})},placeholder:n("config.editor.titlePlaceholder")})}),y.jsx(kn,{title:n("config.fields.modelServices.item.description.label"),description:n("config.fields.modelServices.item.description.desc"),icon:Rn("string"),layout:"stacked",children:y.jsx(Ft.TextArea,{value:p,onChange:g=>{t({...e,[c]:{...f,description:g.target.value}})},autoSize:{minRows:2},placeholder:n("config.editor.descriptionPlaceholder")})}),y.jsx(kn,{title:n("config.fields.modelServices.item.apiBaseUrl.label"),description:n("config.fields.modelServices.item.apiBaseUrl.desc"),icon:Rn("string"),children:y.jsx(Ft,{value:typeof f.apiBaseUrl=="string"?f.apiBaseUrl:"",onChange:g=>{t({...e,[c]:{...f,apiBaseUrl:g.target.value}})}})}),y.jsx(kn,{title:n("config.fields.modelServices.item.apiKey.label"),description:n("config.fields.modelServices.item.apiKey.desc"),icon:Rn("string"),children:y.jsx(Ft.Password,{value:typeof f.apiKey=="string"?f.apiKey:"",onChange:g=>{t({...e,[c]:{...f,apiKey:g.target.value}})},placeholder:n("config.editor.secretPlaceholder")})}),y.jsx(kn,{title:n("config.fields.modelServices.item.models.label"),description:n("config.fields.modelServices.item.models.desc"),icon:Rn("array"),layout:"stacked",children:y.jsx(cy,{value:b,onChange:g=>{t({...e,[c]:{...f,models:g}})},t:n})}),y.jsx(kn,{title:n("config.fields.modelServices.item.modelsAlias.label"),description:n("config.fields.modelServices.item.modelsAlias.desc"),icon:Rn("object"),layout:"stacked",children:y.jsx(nu,{value:f.modelsAlias??{},onChange:g=>{t({...e,[c]:{...f,modelsAlias:g}})}})}),y.jsx(kn,{title:n("config.fields.modelServices.item.timeoutMs.label"),description:n("config.fields.modelServices.item.timeoutMs.desc"),icon:Rn("number"),children:y.jsx(Zc,{min:1,step:1e3,value:typeof f.timeoutMs=="number"?f.timeoutMs:void 0,onChange:g=>{t({...e,[c]:{...f,...typeof g=="number"?{timeoutMs:g}:{timeoutMs:void 0}}})}})}),y.jsx(kn,{title:n("config.fields.modelServices.item.maxOutputTokens.label"),description:n("config.fields.modelServices.item.maxOutputTokens.desc"),icon:Rn("number"),children:y.jsx(Zc,{min:1,step:256,value:typeof f.maxOutputTokens=="number"?f.maxOutputTokens:void 0,onChange:g=>{t({...e,[c]:{...f,...typeof g=="number"?{maxOutputTokens:g}:{maxOutputTokens:void 0}}})}})}),y.jsx(kn,{title:n("config.fields.modelServices.item.extra.label"),description:n("config.fields.modelServices.item.extra.desc"),icon:Rn("object"),layout:"stacked",children:y.jsx(nu,{value:f.extra??{},onChange:g=>{t({...e,[c]:{...f,extra:g}})}})})]})})]},c)}),y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:c=>i(c.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{t({...e,[o]:{title:"",description:"",apiBaseUrl:"",apiKey:"",models:[],modelsAlias:{},timeoutMs:void 0,maxOutputTokens:void 0,extra:{}}}),i("")}})})]})})]})},cwe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),a=u.useMemo(()=>Object.entries(e),[e]),[s,l]=u.useState(()=>Object.fromEntries(a.map(([c])=>[c,!0])));return u.useEffect(()=>{l(c=>{const d={};for(const[f]of a)d[f]=c[f]??!0;return d})},[a]),y.jsxs("div",{className:"config-view__record-list",children:[a.map(([c,d])=>{const f=s[c]===!0;return y.jsxs("div",{className:`config-view__record-card${f?" config-view__record-card--collapsed":""}`,children:[y.jsxs("div",{className:"config-view__record-title",children:[y.jsxs("div",{className:"config-view__record-title-left",children:[y.jsx(dt,{title:n(f?"config.editor.expand":"config.editor.collapse"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":n(f?"config.editor.expand":"config.editor.collapse"),icon:y.jsx("span",{className:"material-symbols-rounded",children:f?"chevron_right":"expand_more"}),onClick:()=>{l(m=>({...m,[c]:!f}))}})}),y.jsx("span",{children:c})]}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const m={...e};delete m[c],t(m)}})})]}),y.jsx("div",{className:"config-view__record-body",children:y.jsx(nu,{value:d,onChange:m=>{t({...e,[c]:m})}})})]},c)}),y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:c=>i(c.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{t({...e,[o]:{}}),i("")}})})]})})]})},uwe=({sectionKey:e,fields:t,value:n,onChange:r,mergedModelServices:o,mergedAdapters:i,selectedModelService:a,t:s})=>{const l=t??ECe[e]??[];if(l.length===0)return y.jsx(bn,{description:s("common.noData"),image:null});const c=new Set(["models","modelServices","channels","adapters","plugins","mcp"]),f=Object.entries(o).map(([C,_])=>{const w=_!=null&&typeof _=="object"?_:{},N=typeof w.title=="string"&&w.title.trim()!==""?w.title:C,k=typeof w.description=="string"?w.description:"";return{value:C,label:y.jsxs("div",{className:"config-view__option",children:[y.jsx("div",{className:"config-view__option-title",children:N}),k!==""&&y.jsx("div",{className:"config-view__option-desc",children:k})]})}}),m=a?o[a]:void 0,p=m!=null&&typeof m=="object"?m.models:void 0,h=Array.isArray(p)?p.filter(C=>typeof C=="string").map(C=>({value:C,label:y.jsx("span",{children:C})})):[],b=Object.keys(i).map(C=>({value:C,label:y.jsx("span",{children:C})})),x=l.reduce((C,_)=>{const w=_.group??"default";return C[w]||(C[w]=[]),C[w].push(_),C},{}),g=["base","permissions","env","items","default"].filter(C=>{var _;return(_=x[C])==null?void 0:_.length}),v=C=>e==="models"?s("config.editor.newModelSelectorName"):e==="modelServices"?s("config.editor.newModelServiceName"):e==="channels"?s("config.editor.newChannelName"):e==="adapters"?s("config.editor.newAdapterName"):e==="plugins"?C.path.join(".")==="extraKnownMarketplaces"?s("config.editor.newMarketplaceName"):s("config.editor.newPluginName"):e==="mcp"?s("config.editor.newMcpServerName"):e==="general"&&C.path.join(".")==="env"?s("config.editor.newEnvVarName"):s("config.editor.fieldKey"),S=C=>{const _=qp(n,C.path),w=_!==void 0?_:C.defaultValue,N=C.labelKey?s(C.labelKey):QF(s,e,C.path,C.path[C.path.length-1]??""),k=C.descriptionKey?s(C.descriptionKey):ZF(s,e,C.path),E=C.icon??Rn(YF(w)),$=T=>{const I=JR(n,C.path,T);r(I)};let O=null;const R=["multiline","json","record","string[]"].includes(C.type);if(C.type==="string"){const T=C.placeholderKey?s(C.placeholderKey):void 0;C.sensitive===!0?O=y.jsx(Ft.Password,{value:typeof w=="string"?w:"",onChange:I=>$(I.target.value),placeholder:s("config.editor.secretPlaceholder")}):O=y.jsx(Ft,{value:typeof w=="string"?w:"",onChange:I=>$(I.target.value),placeholder:T})}else if(C.type==="multiline"){const T=typeof w=="string"?w:"",I=C.placeholderKey?s(C.placeholderKey):s("config.editor.multilinePlaceholder");O=y.jsx("div",{className:"config-view__multiline",children:y.jsx(Ft.TextArea,{className:"config-view__multiline-input",value:T,onChange:P=>$(P.target.value),autoSize:{minRows:3},placeholder:I})})}else if(C.type==="number")if(C.path.join(".")==="notifications.volume"){const I=typeof w=="number"?w:0;O=y.jsx(tne,{className:"config-view__slider",min:0,max:100,step:1,value:I,onChange:P=>$(typeof P=="number"?P:0)})}else O=y.jsx(Zc,{value:typeof w=="number"?w:0,onChange:I=>$(typeof I=="number"?I:0)});else if(C.type==="boolean")O=y.jsx(ta,{checked:!!w,onChange:T=>$(T)});else if(C.type==="string[]"){const T=Array.isArray(w)?w.filter(I=>typeof I=="string"):[];O=y.jsx(cy,{value:T,onChange:I=>$(I),t:s})}else if(C.type==="select"){const T=e==="general"&&C.path.join(".")==="defaultAdapter",I=e==="general"&&C.path.join(".")==="defaultModelService",P=e==="general"&&C.path.join(".")==="defaultModel",j=I?f:P?h:T?b:(C.options??[]).map(L=>({value:L.value,label:y.jsx("span",{children:s(L.label)})}));O=y.jsx(Yn,{value:typeof w=="string"&&w!==""?w:void 0,options:j,onChange:L=>$(L),allowClear:!0,disabled:P&&h.length===0,placeholder:s(T?"config.editor.defaultAdapterPlaceholder":I?"config.editor.defaultModelServicePlaceholder":"config.editor.defaultModelPlaceholder")})}else if(C.type==="json")O=y.jsx(nu,{value:w,onChange:$});else if(C.type==="record"){const T=w!=null&&typeof w=="object"?w:{};C.recordKind==="modelServices"?O=y.jsx(lwe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):C.recordKind==="channels"?O=y.jsx(awe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):C.recordKind==="mcpServers"?O=y.jsx(swe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):C.recordKind==="keyValue"?O=y.jsx(TC,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):C.recordKind==="boolean"?O=y.jsx($Ce,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):O=y.jsx(cwe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)})}else if(C.type==="shortcut"){const T=navigator.platform.includes("Mac");O=y.jsx(wCe,{value:typeof w=="string"?w:"",onChange:I=>$(I),placeholder:s("config.editor.shortcutPlaceholder"),isMac:T,t:s})}return c.has(e)&&C.type==="record"?y.jsx("div",{children:O},`${C.path.join(".")}-${C.type}-${C.recordKind??""}`):y.jsx(kn,{title:N,description:k,icon:E,layout:R?"stacked":"inline",children:O},`${C.path.join(".")}-${C.type}-${C.labelKey??""}-${C.recordKind??""}`)};return y.jsx("div",{className:"config-view__field-stack",children:g.map(C=>{const _=x[C]??[];if(new Set(["base","permissions"]).has(C)&&!_.some(I=>{const P=qp(n,I.path);return typeof P=="boolean"?P:!pg(P)}))return null;if(C==="default")return c.has(e)?y.jsx("div",{children:_.map(S)},C):y.jsx("div",{className:"config-view__field-list",children:_.map(S)},C);const N=(()=>{var I,P;const T=(P=(I=_Ce[e])==null?void 0:I[C])==null?void 0:P.labelKey;return s(T||(C==="base"?"config.sectionGroups.base":C==="permissions"?"config.sectionGroups.permissions":C==="env"?"config.sectionGroups.env":e==="plugins"?"config.sectionGroups.plugins":"config.sectionGroups.items"))})(),k=_.filter(T=>T.hidden!==!0),E=k.filter(T=>T.collapse!=null),$=k.filter(T=>T.collapse==null),O=E.reduce((T,I)=>{const P=I.collapse;if(!P)return T;const j=T.get(P.key);return j?j.fields.push(I):T.set(P.key,{meta:P,fields:[I]}),T},new Map),R=Array.from(O.values()).map(T=>({key:T.meta.key,collapsible:"header",label:y.jsxs("div",{className:"config-view__collapse-header",children:[y.jsxs("div",{className:"config-view__collapse-header-main",children:[y.jsx("div",{className:"config-view__collapse-title",children:s(T.meta.labelKey)}),T.meta.descKey&&y.jsx("div",{className:"config-view__collapse-desc",children:s(T.meta.descKey)})]}),T.meta.togglePath&&y.jsx(ta,{checked:!qp(n,T.meta.togglePath),onChange:I=>{const P=JR(n,T.meta.togglePath,!I);r(P)},onClick:(I,P)=>{P.stopPropagation()}})]}),children:y.jsx("div",{className:"config-view__field-list",children:T.fields.map(S)})}));return y.jsxs("div",{className:"config-view__subsection",children:[y.jsx("div",{className:"config-view__subsection-title",children:N}),y.jsxs("div",{className:"config-view__subsection-body",children:[$.map(S),R.length>0&&y.jsx(x7,{className:"config-view__collapse-group config-view__field-row",ghost:!0,items:R})]})]},C)})})};function i4({sectionKey:e,title:t,icon:n,fields:r,value:o,onChange:i,mergedModelServices:a,mergedAdapters:s,selectedModelService:l,headerExtra:c,t:d,className:f}){const m=["config-view__editor-wrap",f].filter(Boolean).join(" "),p=t!=null||n!=null||c!=null;return y.jsxs("div",{className:m,children:[p&&y.jsxs("div",{className:"config-view__section-header",children:[y.jsxs("div",{className:"config-view__section-title",children:[n!=null&&y.jsx("span",{className:"material-symbols-rounded config-view__section-icon",children:n}),y.jsx("span",{children:t})]}),c]}),y.jsx("div",{className:"config-view__card",children:y.jsx(uwe,{sectionKey:e,fields:r,value:o,onChange:i,mergedModelServices:a,mergedAdapters:s,selectedModelService:l,t:d})})]})}function dwe({value:e,onChange:t,options:n}){return y.jsx(Nl.Group,{value:e,optionType:"button",buttonStyle:"solid",size:"small",onChange:r=>{t(r.target.value)},options:n.map(r=>({value:r.value,label:y.jsxs("span",{className:"config-view__source-option",children:[y.jsx("span",{className:"material-symbols-rounded",children:r.icon}),y.jsx("span",{children:r.label})]})}))})}function fwe({sessionInfo:e,sessionId:t,sessionTitle:n,isStarred:r,isArchived:o,tags:i,lastMessage:a,lastUserMessage:s,activeView:l,onViewChange:c}){const{t:d}=Ot(),{message:f}=Eo.useApp(),m=vl(v1),p=vl(nB),[h,b]=u.useState(""),x=(e==null?void 0:e.type)==="summary"?e.summary:null,g=((e==null?void 0:e.type)==="init"?e.title:null)??n;(e==null?void 0:e.type)==="init"&&e.cwd;const v=g!=null&&g!==""?g:x!=null&&x!==""?x:s!=null&&s!==""?s:a!=null&&a!==""?a:d("common.newChat");u.useEffect(()=>{g!=null&&g!==""&&b(g)},[g]);const S=async()=>{if(!(t==null||t===""))try{await Sa(t,{isStarred:!r}),f.success(d(r?"common.unstarred":"common.starred"))}catch(w){f.error(Mr(w,d("common.operationFailed")))}},C=async()=>{if(!(t==null||t===""))try{await Sa(t,{isArchived:!o}),f.success(d(o?"common.restored":"common.archived"))}catch(w){f.error(Mr(w,d("common.operationFailed")))}},_=[{key:"star",label:d(r?"common.unstar":"common.star"),icon:y.jsx("span",{className:`material-symbols-rounded ${r?"is-filled":""}`,style:{fontSize:"18px"},children:r?"star":"star_border"}),onClick:()=>{S()}},{key:"archive",label:d(o?"common.restore":"common.archive"),icon:y.jsx("span",{className:"material-symbols-rounded",style:{fontSize:"18px"},children:o?"unarchive":"archive"}),onClick:()=>{C()}}];return y.jsxs("div",{className:`chat-header ${m?"is-collapsed":""} ${p?"is-resizing":""}`,children:[y.jsx("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1,minWidth:0},children:y.jsxs("div",{className:"chat-header-info",children:[y.jsx("div",{className:"chat-header-title",children:v}),y.jsx("div",{className:"chat-header-subtitle",onDoubleClick:()=>{console.log("Session Full Info:",{sessionId:t,sessionTitle:n,isStarred:r,isArchived:o,tags:i,lastMessage:a,lastUserMessage:s,sessionInfo:e})},style:{cursor:"pointer",userSelect:"all"},children:t??d("chat.selectModel")})]})}),y.jsxs("div",{className:"chat-header-actions",children:[y.jsx(Nl.Group,{className:"chat-header-view-group",value:l,optionType:"button",buttonStyle:"solid",size:"small",onChange:w=>{c(w.target.value)},options:[{label:y.jsx("span",{className:"chat-header-view-option material-symbols-rounded",children:"forum"}),value:"history"},{label:y.jsx("span",{className:"chat-header-view-option material-symbols-rounded",children:"timeline"}),value:"timeline"},{label:y.jsx("span",{className:"chat-header-view-option material-symbols-rounded",children:"tune"}),value:"settings"}]}),y.jsx("div",{className:"chat-header-divider"}),y.jsx(Jc,{menu:{items:_},placement:"bottomRight",trigger:["click"],children:y.jsx(ct,{type:"text",icon:y.jsx("span",{className:"material-symbols-rounded",children:"more_vert"})})})]})]})}function mwe({sessionId:e,initialTitle:t,initialTags:n=[],onClose:r}){const{t:o}=Ot(),{message:i,modal:a}=Eo.useApp(),s=u.useMemo(()=>[{path:["title"],type:"string",defaultValue:"",icon:"edit_note",labelKey:"chat.title",placeholderKey:"chat.enterTitle"},{path:["tags"],type:"string[]",defaultValue:[],icon:"sell",labelKey:"chat.tags"}],[]),l=u.useMemo(()=>({title:t??"",tags:n}),[n,t]),[c,d]=u.useState(l),f=u.useRef(l),m=u.useRef(null),p=u.useRef(!1),h=u.useRef(null);u.useEffect(()=>{d(l)},[l]),u.useEffect(()=>{f.current=c},[c]),u.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const b=v=>{const S=JSON.stringify(v??{});h.current!==S&&(m.current&&clearTimeout(m.current),m.current=setTimeout(async()=>{if(p.current)return;const C=f.current,_=JSON.stringify(C??{});if(h.current!==_){p.current=!0;try{await Sa(e,{title:typeof C.title=="string"?C.title:"",tags:Array.isArray(C.tags)?C.tags:[]}),h.current=_}catch(w){i.error(Mr(w,o("common.operationFailed")))}finally{p.current=!1}}},500))},x=v=>{const S=v!=null&&typeof v=="object"?v:{},C={title:typeof S.title=="string"?S.title:"",tags:Array.isArray(S.tags)?S.tags.filter(_=>typeof _=="string"):[]};d(C),b(C)},g=()=>{a.confirm({title:o("common.deleteSession"),content:o("common.deleteSessionConfirm"),okText:o("common.delete"),okType:"danger",cancelText:o("common.cancel"),onOk:async()=>{try{await Qh(e),i.success(o("common.deleteSuccess")),r()}catch(v){i.error(Mr(v,o("common.deleteFailed")))}}})};return y.jsxs("div",{className:"session-settings-drawer",children:[y.jsx(i4,{sectionKey:"session",title:null,icon:void 0,fields:s,value:c,onChange:x,mergedModelServices:{},mergedAdapters:{},selectedModelService:void 0,t:o,className:"session-settings-drawer__form"}),y.jsx("div",{className:"settings-footer",children:y.jsx("div",{className:"danger-zone",children:y.jsxs("div",{className:"delete-session-row",children:[y.jsxs("div",{className:"delete-session-meta",children:[y.jsx("div",{className:"delete-session-title",children:o("chat.deleteSessionTitle")}),y.jsx("div",{className:"delete-session-desc",children:o("chat.deleteSessionDesc")})]}),y.jsx(ct,{danger:!0,type:"primary",size:"middle",icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete_forever"}),onClick:g,className:"delete-session-btn",children:o("common.delete")})]})})})]})}const pwe=80;function hwe({messagesLength:e}){const t=u.useRef(null),n=u.useRef(null),r=u.useRef(null),[o,i]=u.useState(!1),a=u.useCallback(()=>{const l=n.current;if(!l)return;const c=l.scrollHeight-(l.scrollTop+l.clientHeight);i(c>pwe)},[]),s=u.useCallback((l="smooth")=>{setTimeout(()=>{n.current&&n.current.scrollTo({top:n.current.scrollHeight,behavior:l})},50)},[]);return u.useEffect(()=>{const l=n.current;if(!l)return;a();const c=()=>a();return l.addEventListener("scroll",c,{passive:!0}),()=>{l.removeEventListener("scroll",c)}},[a]),u.useEffect(()=>{a()},[a,e]),{messagesEndRef:t,messagesContainerRef:n,messagesContentRef:r,showScrollBottom:o,scrollToBottom:s}}class gwe{constructor(){Ae(this,"sockets",new Map);Ae(this,"subscribers",new Map);Ae(this,"disconnectTimers",new Map);Ae(this,"connectionParams",new Map);Ae(this,"DISCONNECT_DELAY",6e4)}connect(t,n,r){var l;this.disconnectTimers.has(t)&&(clearTimeout(this.disconnectTimers.get(t)),this.disconnectTimers.delete(t)),this.subscribers.has(t)||this.subscribers.set(t,new Set),this.subscribers.get(t).add(n);const o=this.normalizeParams({sessionId:t,...r??{}}),i=this.buildParamsKey(o),a=this.connectionParams.get(t);let s=this.sockets.get(t);return a!=null&&a!==i&&s&&(s.close(),this.sockets.delete(t),s=void 0),!s||s.readyState===WebSocket.CLOSED||s.readyState===WebSocket.CLOSING?this.createConnection(t,o):s.readyState===WebSocket.OPEN&&((l=n.onOpen)==null||l.call(n)),this.connectionParams.set(t,i),()=>this.disconnect(t,n)}createConnection(t,n){const r=sB({onOpen:()=>{this.broadcast(t,"onOpen")},onMessage:o=>{this.broadcast(t,"onMessage",o)},onError:o=>{this.broadcast(t,"onError",o)},onClose:()=>{this.broadcast(t,"onClose"),this.sockets.get(t)===r&&this.sockets.delete(t)}},n);this.sockets.set(t,r)}disconnect(t,n){const r=this.subscribers.get(t);r&&(r.delete(n),r.size===0&&this.disconnectTimers.set(t,setTimeout(()=>{const o=this.sockets.get(t);o&&(o.close(),this.sockets.delete(t)),this.disconnectTimers.delete(t),this.subscribers.delete(t),this.connectionParams.delete(t)},this.DISCONNECT_DELAY)))}broadcast(t,n,r){const o=this.subscribers.get(t);o&&Array.from(o).forEach(a=>{if(a[n])try{a[n](r)}catch(s){console.error(`Error in ${n} handler for session ${t}:`,s)}})}close(t){const n=this.sockets.get(t);n&&(n.close(),this.sockets.delete(t)),this.disconnectTimers.has(t)&&(clearTimeout(this.disconnectTimers.get(t)),this.disconnectTimers.delete(t)),this.subscribers.delete(t),this.connectionParams.delete(t)}send(t,n){const r=this.sockets.get(t);r&&r.readyState===WebSocket.OPEN?r.send(typeof n=="string"?n:JSON.stringify(n)):console.warn(`Cannot send message: Session ${t} not connected or ready`)}normalizeParams(t){return Object.entries(t).reduce((n,[r,o])=>{if(o==null)return n;const i=String(o).trim();return i===""||(n[r]=i),n},{})}buildParamsKey(t){return Object.entries(t).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>`${n}=${r}`).join("&")}}const Ca=new gwe;function vwe({session:e,modelForQuery:t,hasAvailableModels:n,effort:r,permissionMode:o,adapter:i,onClearMessages:a}){const{message:s}=Eo.useApp(),{t:l}=Ot(),c=Ts(),{mutate:d}=Yv(),[f,m]=u.useState(!1),p=f||(e==null?void 0:e.status)==="running";u.useEffect(()=>{!f||(e==null?void 0:e.id)==null||e.id===""||m(!1)},[f,e==null?void 0:e.id]);const h=u.useCallback(async v=>{if(v.trim()===""||p)return!1;if(!n)return s.warning(l("chat.modelConfigRequired")),!1;if(!(e!=null&&e.id)){m(!0);try{const{session:S}=await LI(void 0,v.trim(),void 0,t,{effort:r==="default"?void 0:r,permissionMode:o,adapter:i});return await d("/api/sessions",C=>C!=null&&C.sessions?{...C,sessions:[S,...C.sessions]}:{sessions:[S]},!1),c(`/session/${S.id}`),!0}catch(S){return console.error(S),m(!1),s.error(Mr(S,"Failed to create session")),!1}}return Ca.send(e.id,{type:"user_message",text:v.trim()}),!0},[i,n,p,s,d,c,r,o,t,e==null?void 0:e.id,l]),b=u.useCallback(async v=>{if(v.length===0||p)return!1;if(!n)return s.warning(l("chat.modelConfigRequired")),!1;if(!(e!=null&&e.id)){m(!0);try{const{session:S}=await LI(void 0,void 0,v,t,{effort:r==="default"?void 0:r,permissionMode:o,adapter:i});return await d("/api/sessions",C=>C!=null&&C.sessions?{...C,sessions:[S,...C.sessions]}:{sessions:[S]},!1),c(`/session/${S.id}`),!0}catch(S){return console.error(S),m(!1),s.error(Mr(S,"Failed to create session")),!1}}return Ca.send(e.id,{type:"user_message",content:v}),!0},[i,n,p,s,d,c,r,o,t,e==null?void 0:e.id,l]),x=u.useCallback(()=>{!(e!=null&&e.id)||p===!1||Ca.send(e.id,{type:"interrupt"})},[p,e==null?void 0:e.id]),g=u.useCallback(()=>{a(),s.success("Messages cleared")},[s,a]);return{isCreating:f,isThinking:p,send:h,sendContent:b,interrupt:x,clearMessages:g}}function ywe({messages:e}){const{t}=Ot(),[n,r]=u.useState(!1);let o=[];for(let s=e.length-1;s>=0;s--){const l=e[s];if(l.role==="assistant"&&Array.isArray(l.content)){const c=l.content.find(d=>d!=null&&d.type==="tool_use"&&(d.name==="TodoWrite"||d.name==="todo_write"||d.name==="adapter:claude-code:TodoWrite"||d.name==="adapter:claude-code:todo_write"));if(c!=null&&c.type==="tool_use"&&c.input!=null&&typeof c.input=="object"){const d=c.input;if(Array.isArray(d.todos)){o=d.todos;break}}}}if(o.length===0)return null;const i=o.filter(s=>s.status==="completed").length,a=o.length;return a===0?y.jsx("div",{className:"current-todo-container empty",children:y.jsx("div",{className:"todo-progress-bar empty",children:y.jsxs("div",{className:"progress-info",children:[y.jsx("span",{className:"material-symbols-rounded",children:"assignment_late"}),y.jsx("span",{className:"text",children:t("chat.todo.noTasks")})]})})}):y.jsxs("div",{className:`current-todo-container ${n?"expanded":""}`,children:[y.jsxs("div",{className:"todo-progress-bar",onClick:()=>r(!n),children:[y.jsxs("div",{className:"progress-info",children:[y.jsx("span",{className:"material-symbols-rounded",children:"assignment"}),y.jsx("span",{className:"text",children:t("chat.todo.progress",{completed:i,total:a})})]}),y.jsx("div",{className:"progress-track",children:y.jsx("div",{className:"progress-fill",style:{width:`${i/a*100}%`}})}),y.jsx("button",{className:"expand-btn",children:y.jsx("span",{className:"material-symbols-rounded",children:n?"expand_more":"expand_less"})})]}),n&&y.jsx("div",{className:"todo-items-overlay",children:y.jsx("div",{className:"todo-items-scroll-container",children:o.map((s,l)=>y.jsxs("div",{className:`todo-item-vertical status-${s.status}`,children:[y.jsx("span",{className:"material-symbols-rounded icon",children:s.status==="completed"?"check_circle":s.status==="in_progress"?"clock_loader_40":"radio_button_unchecked"}),y.jsxs("div",{className:"todo-content-wrapper",children:[y.jsx("span",{className:"text",children:s.content}),s.priority!=null&&s.priority!==""&&y.jsx("span",{className:`priority-tag ${s.priority}`,children:s.priority})]})]},s.id||l))})})]})}function bwe(){var x;const{t:e}=Ot(),{message:t}=Eo.useApp(),[n,r]=um(rB),{data:o}=Qn("/api/ai/specs"),{data:i}=Qn("/api/ai/entities"),{data:a}=Qn("/api/config"),l=((o==null?void 0:o.specs)??[]).filter(g=>g.always),c=(i==null?void 0:i.entities)??[],d=o!=null,f=i!=null,{announcements:m=[]}=((x=a==null?void 0:a.sources.merged)==null?void 0:x.general)??{},p=[e("chat.newSessionGuide.help.item1"),e("chat.newSessionGuide.help.item2"),e("chat.newSessionGuide.help.item3")],h=()=>{t.info(e("chat.newSessionGuide.specs.createToast"))},b=()=>{t.info(e("chat.newSessionGuide.entities.createToast"))};return y.jsxs("div",{className:"new-session-guide",children:[n&&m.length>0&&y.jsxs("div",{className:"new-session-guide__announcements",children:[y.jsxs("div",{className:"new-session-guide__announcements-header",children:[y.jsxs("div",{className:"new-session-guide__announcements-title",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__announcements-icon",children:"campaign"}),y.jsx("span",{children:e("chat.newSessionGuide.announcements.title")})]}),y.jsx("button",{type:"button",className:"new-session-guide__announcements-close",onClick:()=>r(!1),children:y.jsx("span",{className:"material-symbols-rounded",children:"close"})})]}),y.jsx("div",{className:"new-session-guide__announcements-list",children:m.map((g,v)=>y.jsx("div",{className:"new-session-guide__announcements-item",children:y.jsx("span",{children:g})},`${g}-${v}`))})]}),y.jsxs("div",{className:"new-session-guide__grid",children:[y.jsxs("div",{className:"new-session-guide__card",children:[y.jsxs("div",{className:"new-session-guide__header",children:[y.jsxs("div",{className:"new-session-guide__title",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__title-icon",children:"account_tree"}),y.jsx("span",{children:e("chat.newSessionGuide.specs.title")})]}),y.jsx("div",{className:"new-session-guide__count",children:l.length})]}),y.jsxs("div",{className:"new-session-guide__body",children:[!d&&y.jsx("div",{className:"new-session-guide__loading",children:e("chat.newSessionGuide.loading")}),d&&l.length>0&&y.jsx("div",{className:"new-session-guide__list",children:l.map(g=>y.jsxs("div",{className:"new-session-guide__item",children:[y.jsx("div",{className:"new-session-guide__item-title",children:y.jsx("span",{children:g.name})}),y.jsx("div",{className:"new-session-guide__item-desc",children:g.description}),g.params.length>0&&y.jsx("div",{className:"new-session-guide__meta",children:e("chat.newSessionGuide.specs.params",{count:g.params.length})})]},g.id))}),d&&l.length===0&&y.jsxs("div",{className:"new-session-guide__empty",children:[y.jsx("div",{className:"new-session-guide__empty-desc",children:e("chat.newSessionGuide.specs.empty")}),y.jsx(ct,{type:"primary",size:"small",onClick:h,children:e("chat.newSessionGuide.specs.create")})]})]})]}),y.jsxs("div",{className:"new-session-guide__card",children:[y.jsxs("div",{className:"new-session-guide__header",children:[y.jsxs("div",{className:"new-session-guide__title",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__title-icon",children:"group_work"}),y.jsx("span",{children:e("chat.newSessionGuide.entities.title")})]}),y.jsx("div",{className:"new-session-guide__count",children:c.length})]}),y.jsxs("div",{className:"new-session-guide__body",children:[!f&&y.jsx("div",{className:"new-session-guide__loading",children:e("chat.newSessionGuide.loading")}),f&&c.length>0&&y.jsx("div",{className:"new-session-guide__list",children:c.map(g=>y.jsxs("div",{className:"new-session-guide__item",children:[y.jsx("div",{className:"new-session-guide__item-title",children:y.jsx("span",{children:g.name})}),y.jsx("div",{className:"new-session-guide__item-desc",children:g.description})]},g.id))}),f&&c.length===0&&y.jsxs("div",{className:"new-session-guide__empty",children:[y.jsx("div",{className:"new-session-guide__empty-desc",children:e("chat.newSessionGuide.entities.empty")}),y.jsx(ct,{type:"primary",size:"small",onClick:b,children:e("chat.newSessionGuide.entities.create")})]})]})]}),y.jsxs("div",{className:"new-session-guide__card",children:[y.jsx("div",{className:"new-session-guide__header",children:y.jsxs("div",{className:"new-session-guide__title",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__title-icon",children:"tips_and_updates"}),y.jsx("span",{children:e("chat.newSessionGuide.help.title")})]})}),y.jsxs("div",{className:"new-session-guide__body",children:[y.jsx("div",{className:"new-session-guide__help",children:p.map(g=>y.jsxs("div",{className:"new-session-guide__help-item",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__help-icon",children:"check_circle"}),y.jsx("span",{children:g})]},g))}),y.jsx("div",{className:"new-session-guide__help-footer",children:e("chat.newSessionGuide.help.footer")})]})]})]})]})}function ts(e,t=new WeakSet){if(e==null)return e;const n=typeof e;if(n==="bigint"||n==="symbol")return e.toString();if(n==="function")return"[Function]";if(n!=="object")return e;if(e instanceof Date)return e.toISOString();if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e instanceof Map)return Array.from(e.entries()).map(([i,a])=>[ts(i,t),ts(a,t)]);if(e instanceof Set)return Array.from(e.values()).map(i=>ts(i,t));if(ArrayBuffer.isView(e))return Array.from(e);if(e instanceof ArrayBuffer)return Array.from(new Uint8Array(e));if(Array.isArray(e))return e.map(i=>ts(i,t));const r=e;if(t.has(r))return"[Circular]";if(t.add(r),typeof r.toJSON=="function")try{return ts(r.toJSON(),t)}catch{return String(r)}const o={};for(const[i,a]of Object.entries(r))o[i]=ts(a,t);return o}function ra(e,t=2){try{const n=ts(e);return JSON.stringify(n,null,t)??"null"}catch{return JSON.stringify(String(e))??"null"}}function _o({header:e,content:t,isError:n=!1,type:r="call",defaultExpanded:o=!1,collapsible:i=!0,onDoubleClick:a}){const[s,l]=u.useState(o||!i),c=!i||s;return y.jsxs("div",{className:`tool-call-box ${r==="result"?"result":""} ${c?"expanded":"collapsed"}`,onDoubleClick:d=>{a&&(d.stopPropagation(),a(d))},children:[y.jsxs("div",{className:`tool-call-header ${r==="result"&&n?"error":""}`,onClick:()=>i&&l(!s),children:[y.jsx("div",{className:"tool-call-header-main",children:e}),i&&y.jsx("span",{className:"material-symbols-rounded expand-icon",children:c?"expand_less":"expand_more"})]}),c&&y.jsx("div",{className:"tool-call-body",children:t})]})}function xwe(e){if(typeof e!="string")return e;const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{return e}return e}function Swe(e){const t=typeof e.url=="string"?e.url:typeof e.src=="string"?e.src:typeof e.image_url=="string"?e.image_url:typeof e.imageUrl=="string"?e.imageUrl:typeof e.dataUrl=="string"?e.dataUrl:null;if(t)return t;const n=e.source!=null&&typeof e.source=="object"?e.source:null,r=typeof e.data=="string"?e.data:typeof e.base64=="string"?e.base64:n!=null&&typeof n.data=="string"?n.data:null;return r?`data:${typeof e.mimeType=="string"?e.mimeType:typeof e.mime_type=="string"?e.mime_type:n!=null&&typeof n.media_type=="string"?n.media_type:n!=null&&typeof n.mimeType=="string"?n.mimeType:n!=null&&typeof n.mime_type=="string"?n.mime_type:"image/png"};base64,${r}`:null}function _0(e){if(e==null||typeof e!="object")return null;const t=e,n=typeof t.type=="string"?t.type.toLowerCase():"";if(n==="text"||n==="markdown"||n==="md"){const r=typeof t.text=="string"?t.text:typeof t.content=="string"?t.content:null;if(r==null)return null;const o=typeof t.format=="string"?t.format.toLowerCase():"markdown";return{type:"text",text:r,format:n==="text"&&(o==="text"||o==="plain")?"text":"markdown"}}if(n==="image"){const r=Swe(t);if(!r)return null;const o=typeof t.alt=="string"?t.alt:void 0,i=typeof t.title=="string"?t.title:void 0,a=typeof t.width=="number"?t.width:void 0,s=typeof t.height=="number"?t.height:void 0;return{type:"image",src:r,alt:o,title:i,width:a,height:s}}return null}function Cwe(e){const t=ts(e),n=xwe(t);if(Array.isArray(n)){const o=n.map(_0);return o.every(Boolean)?o:null}if(n!=null&&typeof n=="object"){const o=n,i=o.content??o.items??o.blocks;if(Array.isArray(i)){const a=i.map(_0);return a.every(Boolean)?a:null}}const r=_0(n);return r?[r]:null}function wwe({blocks:e}){return y.jsx("div",{className:"tool-result-structured",children:e.map((t,n)=>t.type==="text"?y.jsx("div",{className:"tool-result-text",children:t.format==="markdown"?y.jsx(Xi,{content:t.text}):y.jsx("div",{className:"tool-result-text-content",children:t.text})},`text-${n}`):y.jsxs("div",{className:"tool-result-image-wrapper",children:[y.jsx("img",{className:"tool-result-image",src:t.src,alt:t.alt??"",width:t.width,height:t.height}),t.title!=null&&t.title.length>0&&y.jsx("div",{className:"tool-result-image-caption",children:t.title})]},`image-${n}`))})}function _we({item:e,resultItem:t}){const{t:n}=Ot(),r=t!=null?Cwe(t.content):null;return y.jsxs("div",{className:"tool-group",children:[y.jsx(_o,{header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"build"}),y.jsx("span",{className:"tool-header-title",children:e.name}),y.jsx("span",{className:"tool-header-hint",children:n("chat.tools.call")})]}),content:y.jsx("div",{className:"tool-content",children:y.jsx(wo,{code:ra(e.input!=null?e.input:{},2),lang:"json"})})}),t!=null&&y.jsx(_o,{type:"result",isError:t.is_error,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:t.is_error===!0?"error":"check_circle"}),y.jsx("span",{className:"tool-header-title",children:n("chat.result")})]}),content:y.jsx("div",{className:"tool-content",children:r!=null?y.jsx(wwe,{blocks:r}):typeof t.content=="string"?t.content.startsWith("```")?y.jsx(Xi,{content:t.content}):y.jsx(wo,{code:t.content,lang:"text"}):y.jsx(wo,{code:ra(t.content,2),lang:"json"})})})]})}function Y1(e,t){const n=t==null?void 0:t.namespace,r=Object.entries(e).flatMap(([o,i])=>{const a=[[o,i]];return n&&a.push([`${n}${o}`,i]),a});return Object.fromEntries(r)}const a4=({item:e,resultItem:t})=>{const{t:n}=Ot(),r=e.input!=null?e.input:{},o=r.command??"",i=r.description!=null&&r.description!==""?r.description:r.reason!=null&&r.reason!==""?r.reason:r.thought!=null&&r.thought!==""?r.thought:"",a=r.timeout,s=r.run_in_background,l=r.dangerouslyDisableSandbox,c=i.replaceAll(`
|
|
500
|
+
\`\`\``})]})]})]}),y.jsxs("div",{className:"benchmark-view__section benchmark-view__task-goal",children:[y.jsx(mg,{icon:"assignment",title:a("benchmark.taskGoal")}),y.jsx("div",{className:"benchmark-view__goal-body",children:y.jsx(Xi,{content:e.rfcBody})})]})]}),y.jsx(cO,{className:"benchmark-view__sep"}),y.jsxs("div",{className:"benchmark-view__twin-grid benchmark-view__section--last",children:[y.jsx(vCe,{activeRunId:r,activeRun:n,progressPercent:o,t:a}),y.jsx(yCe,{latestResult:t,t:a})]})]})}function vCe({activeRunId:e,activeRun:t,progressPercent:n,t:r}){return y.jsxs("div",{className:"benchmark-view__section",children:[y.jsx(mg,{icon:"pulse_alert",title:r("benchmark.runState"),extra:t?y.jsx(Do,{children:t.status}):null}),e===""?y.jsx(so.Text,{type:"secondary",className:"benchmark-view__hint",children:r("benchmark.noActiveRun")}):y.jsxs("div",{className:"benchmark-view__run-block",children:[y.jsxs("div",{className:"benchmark-view__run-metric",children:[y.jsx("label",{children:r("benchmark.progress")}),y.jsx("strong",{children:`${(t==null?void 0:t.completedCount)??0}/${(t==null?void 0:t.totalCount)??"-"}`})]}),y.jsx(eie,{percent:n,showInfo:!1}),y.jsxs("div",{className:"benchmark-view__info-grid",children:[y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsx("label",{children:r("benchmark.runStatus")}),y.jsx("span",{children:(t==null?void 0:t.status)??"-"})]}),y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsx("label",{children:r("benchmark.lastMessage")}),y.jsx(so.Text,{children:(t==null?void 0:t.lastMessage)??"-"})]})]})]})]})}function yCe({latestResult:e,t}){return y.jsxs("div",{className:"benchmark-view__section",children:[y.jsx(mg,{icon:"insights",title:t("benchmark.resultTitle"),extra:e?y.jsx(hCe,{result:e}):null}),e==null?y.jsx(so.Text,{type:"secondary",className:"benchmark-view__hint",children:t("benchmark.noResult")}):y.jsxs("div",{className:"benchmark-view__result",children:[y.jsxs("div",{className:"benchmark-view__score-strip",children:[y.jsxs("div",{className:"benchmark-view__score-item",children:[y.jsx("label",{children:t("benchmark.finalScore")}),y.jsx("strong",{children:e.finalScore})]}),y.jsxs("div",{className:"benchmark-view__score-item",children:[y.jsx("label",{children:t("benchmark.testScore")}),y.jsx("strong",{children:e.scores.testScore})]}),y.jsxs("div",{className:"benchmark-view__score-item",children:[y.jsx("label",{children:t("benchmark.goalScore")}),y.jsx("strong",{children:e.scores.goalScore})]}),y.jsxs("div",{className:"benchmark-view__score-item",children:[y.jsx("label",{children:t("benchmark.referenceScore")}),y.jsx("strong",{children:e.scores.referenceScore})]})]}),y.jsxs("div",{className:"benchmark-view__info-grid",children:[y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"schedule"}),t("benchmark.durationMs")]}),y.jsx("span",{children:e.durationMs})]}),y.jsxs("div",{className:"benchmark-view__info-row",children:[y.jsxs("label",{children:[y.jsx("span",{className:"material-symbols-rounded",children:"monitoring"}),t("benchmark.testExitCode")]}),y.jsx("span",{children:e.testExitCode})]})]}),y.jsx(so.Paragraph,{className:"benchmark-view__judge-summary",children:e.judgeSummary}),y.jsxs("div",{className:"benchmark-view__subgrid",children:[y.jsxs("div",{className:"benchmark-view__subpanel",children:[y.jsxs("div",{className:"benchmark-view__subpanel-title",children:[y.jsx("span",{className:"material-symbols-rounded",children:"plagiarism"}),y.jsx("span",{children:t("benchmark.changedFiles")})]}),e.changedFiles!=null&&e.changedFiles.length>0?y.jsx("div",{className:"benchmark-view__file-list",children:e.changedFiles.map(n=>y.jsx("span",{className:"benchmark-view__file-tag",children:n},n))}):y.jsx(so.Text,{type:"secondary",children:t("benchmark.noChangedFiles")})]}),y.jsxs("div",{className:"benchmark-view__subpanel",children:[y.jsxs("div",{className:"benchmark-view__subpanel-title",children:[y.jsx("span",{className:"material-symbols-rounded",children:"report"}),y.jsx("span",{children:t("benchmark.issues")})]}),e.issues.length===0?y.jsx(so.Text,{type:"secondary",children:t("benchmark.noIssues")}):y.jsx("ul",{className:"benchmark-view__issues-list",children:e.issues.map(n=>y.jsx("li",{children:n},n))})]})]})]})]})}function bCe({result:e}){const t=XF(e);return y.jsx("span",{className:`material-symbols-rounded benchmark-view__status-icon benchmark-view__status-icon--${t.statusKey}`,children:t.icon})}function xCe(e){const{categories:t,cases:n,query:r,t:o,onRunCase:i,onRunCategory:a}=e,s=r.trim().toLowerCase();return(t.length>0?t:Array.from(new Set(n.map(d=>d.category))).map(d=>({category:d,caseCount:n.filter(f=>f.category===d).length,lastStatuses:{pass:0,partial:0,fail:0}}))).map(d=>{const f=n.filter(h=>h.category===d.category),p=s===""||d.category.toLowerCase().includes(s)?f:f.filter(h=>{const b=h.frontmatter.title??"";return h.title.toLowerCase().includes(s)||b.toLowerCase().includes(s)});return p.length===0?null:{key:`category:${d.category}`,selectable:!0,title:y.jsxs("div",{className:"benchmark-view__tree-category",children:[y.jsx("span",{className:"material-symbols-rounded benchmark-view__tree-icon benchmark-view__tree-icon--category",children:"folder_open"}),y.jsx(so.Text,{strong:!0,className:"benchmark-view__tree-title",children:d.category}),y.jsx(dt,{title:o("benchmark.runCategory"),children:y.jsx(ct,{type:"text",size:"small",className:"benchmark-view__tree-run-btn benchmark-view__tree-run-btn--category",icon:y.jsx("span",{className:"material-symbols-rounded",children:"play_circle"}),onClick:h=>{h.stopPropagation(),a(d.category)}})})]}),children:p.map(h=>{const b={...h,key:`case:${h.category}/${h.title}`},x=h.frontmatter.title??h.title;return{key:b.key,isLeaf:!0,title:y.jsxs("div",{className:"benchmark-view__tree-case",children:[y.jsx(bCe,{result:b.latestResult}),y.jsx("span",{className:"material-symbols-rounded benchmark-view__tree-icon",children:"draft"}),y.jsx(so.Text,{className:"benchmark-view__tree-title",children:x}),y.jsx(dt,{title:o("benchmark.runCase"),children:y.jsx(ct,{type:"text",size:"small",className:"benchmark-view__tree-run-btn",icon:y.jsx("span",{className:"material-symbols-rounded",children:"play_circle"}),onClick:g=>{g.stopPropagation(),i(h)}})})]}),caseData:b}})}}).filter(d=>d!=null)}function SCe({cases:e,categories:t,selectedCase:n,query:r,expandedKeys:o,checkedKeys:i,checkedCaseCount:a,onQueryChange:s,onExpandedKeysChange:l,onCheckedKeysChange:c,onSelectCase:d,onRunCase:f,onRunCategory:m,onBatchRun:p}){const{t:h}=Ot(),b=u.useMemo(()=>xCe({categories:t,cases:e,query:r,t:h,onRunCase:f,onRunCategory:m}),[e,t,r,h]),x=v=>{const S=Array.isArray(v)?v:v.checked;c(S.map(String))},g=(v,S)=>{const C=S.node.caseData;if(C!=null){d(C.category,C.title);return}const _=String(S.node.key);if(!_.startsWith("category:"))return;const w=_.replace("category:",""),N=e.find(k=>k.category===w);d(w,(N==null?void 0:N.title)??"")};return y.jsxs("div",{className:"benchmark-view__sidebar",children:[y.jsx("div",{className:"benchmark-view__sidebar-header",children:y.jsx(so.Title,{level:4,className:"benchmark-view__sidebar-title",children:h("benchmark.title")})}),y.jsxs("div",{className:"benchmark-view__search-row",children:[y.jsx(Ft,{value:r,placeholder:h("benchmark.searchPlaceholder"),prefix:y.jsx("span",{className:"material-symbols-rounded benchmark-view__search-icon",children:"search"}),allowClear:!0,onChange:v=>s(v.target.value),className:"benchmark-view__search"}),y.jsx(dt,{title:h("benchmark.expandAll"),children:y.jsx(ct,{type:"text",size:"small",icon:y.jsx("span",{className:"material-symbols-rounded",children:"unfold_more"}),onClick:()=>l(t.map(v=>`category:${v.category}`))})}),y.jsx(dt,{title:h("benchmark.collapseAll"),children:y.jsx(ct,{type:"text",size:"small",icon:y.jsx("span",{className:"material-symbols-rounded",children:"unfold_less"}),onClick:()=>l([])})}),y.jsx(dt,{title:a>0?h("benchmark.runSelected",{count:a}):h("benchmark.runAll"),children:y.jsx(E_,{count:a,size:"small",children:y.jsx(ct,{type:"text",size:"small",icon:y.jsx("span",{className:"material-symbols-rounded",children:"play_circle"}),onClick:p})})})]}),y.jsx("div",{className:"benchmark-view__tree-shell",children:b.length===0?y.jsx("div",{className:"benchmark-view__tree-empty",children:y.jsx(bn,{description:h("benchmark.emptyCases"),image:bn.PRESENTED_IMAGE_SIMPLE})}):y.jsx(zv,{blockNode:!0,checkable:!0,showIcon:!1,switcherIcon:y.jsx("span",{className:"material-symbols-rounded benchmark-view__switcher",children:"chevron_right"}),selectedKeys:n?[`case:${n.category}/${n.title}`]:[],expandedKeys:o,checkedKeys:i,treeData:b,onExpand:v=>l(v.map(String)),onSelect:g,onCheck:x})})]})}function CCe(){const{t:e}=Ot(),{message:t}=Eo.useApp(),[n,r]=u.useState(""),[o,i]=u.useState(""),[a,s]=u.useState([]),[l,c]=u.useState([]),{values:d,update:f}=ju({keys:["category","title"],defaults:{category:"",title:""},omit:{category:I=>I==="",title:I=>I===""}}),{data:m,mutate:p}=Qn("/api/benchmark/categories",Lfe),h=(m==null?void 0:m.categories)??[],{data:b,mutate:x}=Qn("/api/benchmark/cases",()=>Dfe()),g=(b==null?void 0:b.cases)??[],v=u.useMemo(()=>{if(g.length===0)return null;const I=g.find(j=>j.category===d.category&&j.title===d.title);return I||((d.category?g.find(j=>j.category===d.category)??null:null)??g[0]??null)},[g,d.category,d.title]),{data:S,mutate:C}=Qn(v?`/api/benchmark/results/${v.category}/${v.title}`:null,()=>zfe((v==null?void 0:v.category)??"",(v==null?void 0:v.title)??"")),_=(S==null?void 0:S.result)??(v==null?void 0:v.latestResult)??null,{data:w,mutate:N}=Qn(n?`/api/benchmark/runs/${n}`:null,()=>Bfe(n),{refreshInterval:n?2e3:0}),k=w==null?void 0:w.run,E=u.useMemo(()=>{const I=(k==null?void 0:k.totalCount)??0;if(I<=0)return 0;const P=(k==null?void 0:k.completedCount)??0;return Math.min(100,Math.round(P/I*100))},[k==null?void 0:k.completedCount,k==null?void 0:k.totalCount]),$=u.useCallback(async I=>{try{const P=await rp({category:I.category,title:I.title});r(P.run.runId),t.success(e("benchmark.runStarted"))}catch(P){t.error(Mr(P,e("benchmark.runFailed")))}},[t,e]),O=u.useCallback(async I=>{try{const P=await rp({category:I});r(P.run.runId),t.success(e("benchmark.categoryRunStarted"))}catch(P){t.error(Mr(P,e("benchmark.runFailed")))}},[t,e]),R=u.useCallback(async()=>{const I=l.filter(L=>L.startsWith("case:")),P=g.filter(L=>I.includes(`case:${L.category}/${L.title}`));if(P.length===0){for(const L of g)try{await rp({category:L.category,title:L.title})}catch{}t.success(e("benchmark.runStarted"));return}let j=0;for(const L of P)try{await rp({category:L.category,title:L.title}),j++}catch{}j>0&&(c([]),x(),p(),t.success(e("benchmark.runStarted")))},[l,g,x,p,t,e]);u.useEffect(()=>{const I=h.map(P=>`category:${P.category}`);s(P=>P.length>0&&o.trim()===""?P:I)},[h,o]),u.useEffect(()=>{v!=null&&(d.category!==v.category||d.title!==v.title)&&f({category:v.category,title:v.title})},[v,f,d.category,d.title]),u.useEffect(()=>{if(!mCe(k))return;x(),p(),C(),n!==""&&N();const I=(k==null?void 0:k.status)==="completed"?e("benchmark.runCompleted"):e("benchmark.runFailed");t.info(I),r("")},[k,n,t,x,p,C,N,e]);const T=l.filter(I=>I.startsWith("case:")).length;return y.jsxs("div",{className:"benchmark-view",children:[y.jsx("div",{className:"benchmark-view__left",children:y.jsx(SCe,{cases:g,categories:h,selectedCase:v,query:o,expandedKeys:a,checkedKeys:l,checkedCaseCount:T,onQueryChange:i,onExpandedKeysChange:s,onCheckedKeysChange:c,onSelectCase:(I,P)=>f({category:I,title:P}),onRunCase:I=>void $(I),onRunCategory:I=>void O(I),onBatchRun:()=>void R()})}),y.jsx("div",{className:"benchmark-view__divider"}),y.jsx("div",{className:"benchmark-view__right",children:y.jsx(gCe,{selectedCase:v,latestResult:_,activeRun:k,activeRunId:n,progressPercent:E,onRunCase:()=>void(v&&$(v))})})]})}function wCe(){return y.jsx(CCe,{})}const _Ce=({value:e})=>{const{t}=Ot(),n=e!=null&&typeof e=="object"?e:void 0,r=n==null?void 0:n.urls,o=n==null?void 0:n.version,i=n==null?void 0:n.lastReleaseAt;return y.jsxs("div",{className:"config-about",children:[y.jsxs("div",{className:"config-about__card",children:[y.jsxs("div",{className:"config-about__app",children:[y.jsx("div",{className:"config-about__app-icon",children:y.jsx("span",{className:"material-symbols-rounded",children:"auto_awesome"})}),y.jsxs("div",{className:"config-about__app-info",children:[y.jsx("div",{className:"config-about__app-title",children:t("config.about.software")}),y.jsxs("div",{className:"config-about__app-meta",children:[y.jsxs("span",{className:"config-about__app-version",children:[t("config.about.version"),": ",o??t("config.about.unknown")]}),y.jsx("span",{className:"config-about__app-date",children:i??t("config.about.unknown")})]})]})]}),y.jsx("a",{className:"config-about__primary",href:(r==null?void 0:r.releases)??(r==null?void 0:r.repo),target:"_blank",rel:"noreferrer",children:t("config.about.checkUpdate")})]}),y.jsxs("div",{className:"config-about__list",children:[y.jsxs("a",{className:"config-about__item-row",href:(r==null?void 0:r.docs)??(r==null?void 0:r.repo),target:"_blank",rel:"noreferrer",children:[y.jsxs("span",{className:"config-about__item-left",children:[y.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"menu_book"}),y.jsx("span",{children:t("config.about.docs")})]}),y.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]}),y.jsxs("a",{className:"config-about__item-row",href:(r==null?void 0:r.contact)??(r==null?void 0:r.repo),target:"_blank",rel:"noreferrer",children:[y.jsxs("span",{className:"config-about__item-left",children:[y.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"mail"}),y.jsx("span",{children:t("config.about.contact")})]}),y.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]}),y.jsxs("a",{className:"config-about__item-row",href:(r==null?void 0:r.issues)??(r==null?void 0:r.repo),target:"_blank",rel:"noreferrer",children:[y.jsxs("span",{className:"config-about__item-left",children:[y.jsx("span",{className:"material-symbols-rounded config-about__item-icon",children:"bug_report"}),y.jsx("span",{children:t("config.about.feedback")})]}),y.jsx("span",{className:"material-symbols-rounded config-about__arrow",children:"open_in_new"})]})]})]})},kn=({title:e,description:t,icon:n,layout:r="inline",children:o})=>y.jsxs("div",{className:`config-view__field-row${r==="stacked"?" config-view__field-row--stacked":""}`,children:[y.jsxs("div",{className:"config-view__field-meta",children:[n!=null&&y.jsx("span",{className:"material-symbols-rounded config-view__field-icon",children:n}),y.jsxs("div",{className:"config-view__field-text",children:[y.jsx("div",{className:"config-view__field-title",children:e}),t!=null&&t!==""&&y.jsx("div",{className:"config-view__field-desc",children:t})]})]}),y.jsx("div",{className:"config-view__field-control",children:o})]}),pg=e=>e==null?!0:Array.isArray(e)?e.length===0:typeof e=="object"?Object.keys(e).length===0:!1,fp=e=>e==null?e:JSON.parse(JSON.stringify(e)),YF=e=>Array.isArray(e)?"array":e!=null&&typeof e=="object"?"object":typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string",Rn=e=>e==="string"?"text_fields":e==="number"?"numbers":e==="boolean"?"toggle_on":e==="array"?"view_list":"account_tree",QF=(e,t,n,r)=>{if(n.length===0)return r;const o=`config.fields.${t}.${n.join(".")}.label`;return e(o,{defaultValue:r})},ZF=(e,t,n)=>{if(n.length===0)return"";const r=`config.fields.${t}.${n.join(".")}.desc`;return e(r,{defaultValue:""})},JF=e=>/key|token|secret|password/i.test(e),qp=(e,t)=>{if(t.length===0)return e;let n=e;for(const r of t){if(n==null||typeof n!="object")return;n=n[r]}return n},JR=(e,t,n)=>{if(t.length===0)return n;const r=e!=null&&typeof e=="object"&&!Array.isArray(e)?{...e}:{};let o=r;for(let i=0;i<t.length-1;i+=1){const a=t[i],s=o[a],l=s!=null&&typeof s=="object"&&!Array.isArray(s)?{...s}:{};o[a]=l,o=l}return o[t[t.length-1]]=n,r},e4=({value:e,sectionKey:t,path:n=[],t:r})=>pg(e)?y.jsx(bn,{description:r("common.noData"),image:null}):Array.isArray(e)?e.some(i=>i!=null&&typeof i=="object")?y.jsx("span",{className:"config-view__pill",children:r("config.editor.complexValue")}):y.jsx("div",{className:"config-view__display-pill",children:e.map((i,a)=>y.jsx("span",{className:"config-view__pill",children:String(i)},`${a}-${String(i)}`))}):e!=null&&typeof e=="object"?y.jsx("div",{className:"config-view__field-list",children:Object.entries(e).map(([o,i])=>{const a=QF(r,t,[...n,o],o),s=ZF(r,t,[...n,o]);return y.jsx(kn,{title:a,description:s,icon:Rn(YF(i)),children:y.jsx(e4,{value:i,sectionKey:t,path:[...n,o],t:r})},o)})}):y.jsx("span",{className:"config-view__pill",children:String(e)}),nu=({value:e,onChange:t})=>{const{message:n}=Eo.useApp(),{t:r}=Ot(),[o,i]=u.useState(()=>JSON.stringify(e??{},null,2));return u.useEffect(()=>{i(JSON.stringify(e??{},null,2))},[e]),y.jsx(Ft.TextArea,{className:"config-view__complex-editor",value:o,onChange:a=>{i(a.target.value)},onBlur:()=>{try{const a=JSON.parse(o);t==null||t(a),i(JSON.stringify(a??{},null,2))}catch{n.error(r("config.invalidJson")),i(JSON.stringify(e??{},null,2))}},placeholder:r("config.editor.complexPlaceholder"),autoSize:{minRows:6}})},cy=({value:e,onChange:t,t:n})=>y.jsxs("div",{className:"config-view__array-list",children:[e.map((r,o)=>y.jsxs("div",{className:"config-view__array-item",children:[y.jsx(Ft,{value:r,placeholder:n("config.editor.itemPlaceholder"),onChange:i=>{const a=e.slice();a[o]=i.target.value,t(a)}}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const i=e.slice();i.splice(o,1),t(i)}})})]},`${o}-${r}`)),y.jsx(dt,{title:n("config.editor.addItem"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button config-view__icon-button--full","aria-label":n("config.editor.addItem"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"add"}),onClick:()=>{t([...e,""])}})})]}),ECe=({value:e,onChange:t,placeholder:n,isMac:r,t:o})=>{const i=e.trim()===""?"":iB(e,r);return y.jsxs("div",{className:"config-shortcut-input",children:[y.jsx(Ft,{value:i,placeholder:n,readOnly:!0,onKeyDown:a=>{if(a.key==="Backspace"||a.key==="Delete"){a.preventDefault(),t("");return}const s=Ufe(a);s!=null&&(a.preventDefault(),t(s))}}),y.jsx(dt,{title:o("config.editor.clearShortcut"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":o("config.editor.clearShortcut"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"close"}),onClick:()=>t("")})})]})},$Ce={general:{items:{labelKey:"config.fields.general.notifications.label"}}},kCe={general:[{path:["baseDir"],type:"string",defaultValue:".ai",icon:"folder",group:"base"},{path:["effort"],type:"select",defaultValue:"",icon:"psychology",group:"base",options:[{value:"low",label:"config.options.effort.low"},{value:"medium",label:"config.options.effort.medium"},{value:"high",label:"config.options.effort.high"},{value:"max",label:"config.options.effort.max"}]},{path:["defaultAdapter"],type:"select",defaultValue:"",icon:"settings_input_component",group:"base"},{path:["defaultModelService"],type:"select",defaultValue:"",icon:"hub",group:"base"},{path:["defaultModel"],type:"select",defaultValue:"",icon:"model_training",group:"base"},{path:["recommendedModels"],type:"json",defaultValue:[],icon:"stars",group:"base"},{path:["interfaceLanguage"],type:"select",defaultValue:"",icon:"language",group:"base",options:[{value:"zh",label:"config.options.language.zh"},{value:"en",label:"config.options.language.en"}]},{path:["modelLanguage"],type:"select",defaultValue:"",icon:"translate",group:"base",options:[{value:"zh",label:"config.options.language.zh"},{value:"en",label:"config.options.language.en"}]},{path:["announcements"],type:"string[]",defaultValue:[],icon:"campaign",group:"base"},{path:["permissions","allow"],type:"string[]",defaultValue:[],icon:"check_circle",group:"permissions"},{path:["permissions","deny"],type:"string[]",defaultValue:[],icon:"block",group:"permissions"},{path:["permissions","ask"],type:"string[]",defaultValue:[],icon:"help",group:"permissions"},{path:["env"],type:"record",recordKind:"keyValue",defaultValue:{},icon:"terminal",group:"env"},{path:["notifications","disabled"],type:"boolean",defaultValue:!1,icon:"notifications",group:"items"},{path:["notifications","volume"],type:"number",defaultValue:100,icon:"volume_down",group:"items"},{path:["notifications","events","completed","title"],type:"string",defaultValue:"",icon:"title",group:"items",collapse:{key:"notifications.events.completed",labelKey:"config.fields.general.notifications.events.completed.label",descKey:"config.fields.general.notifications.events.completed.desc",togglePath:["notifications","events","completed","disabled"]}},{path:["notifications","events","completed","description"],type:"multiline",defaultValue:"",icon:"notes",group:"items",collapse:{key:"notifications.events.completed",labelKey:"config.fields.general.notifications.events.completed.label",descKey:"config.fields.general.notifications.events.completed.desc",togglePath:["notifications","events","completed","disabled"]}},{path:["notifications","events","completed","sound"],type:"string",defaultValue:"",icon:"volume_up",group:"items",collapse:{key:"notifications.events.completed",labelKey:"config.fields.general.notifications.events.completed.label",descKey:"config.fields.general.notifications.events.completed.desc",togglePath:["notifications","events","completed","disabled"]}},{path:["notifications","events","failed","title"],type:"string",defaultValue:"",icon:"title",group:"items",collapse:{key:"notifications.events.failed",labelKey:"config.fields.general.notifications.events.failed.label",descKey:"config.fields.general.notifications.events.failed.desc",togglePath:["notifications","events","failed","disabled"]}},{path:["notifications","events","failed","description"],type:"multiline",defaultValue:"",icon:"notes",group:"items",collapse:{key:"notifications.events.failed",labelKey:"config.fields.general.notifications.events.failed.label",descKey:"config.fields.general.notifications.events.failed.desc",togglePath:["notifications","events","failed","disabled"]}},{path:["notifications","events","failed","sound"],type:"string",defaultValue:"",icon:"volume_up",group:"items",collapse:{key:"notifications.events.failed",labelKey:"config.fields.general.notifications.events.failed.label",descKey:"config.fields.general.notifications.events.failed.desc",togglePath:["notifications","events","failed","disabled"]}},{path:["notifications","events","terminated","title"],type:"string",defaultValue:"",icon:"title",group:"items",collapse:{key:"notifications.events.terminated",labelKey:"config.fields.general.notifications.events.terminated.label",descKey:"config.fields.general.notifications.events.terminated.desc",togglePath:["notifications","events","terminated","disabled"]}},{path:["notifications","events","terminated","description"],type:"multiline",defaultValue:"",icon:"notes",group:"items",collapse:{key:"notifications.events.terminated",labelKey:"config.fields.general.notifications.events.terminated.label",descKey:"config.fields.general.notifications.events.terminated.desc",togglePath:["notifications","events","terminated","disabled"]}},{path:["notifications","events","terminated","sound"],type:"string",defaultValue:"",icon:"volume_up",group:"items",collapse:{key:"notifications.events.terminated",labelKey:"config.fields.general.notifications.events.terminated.label",descKey:"config.fields.general.notifications.events.terminated.desc",togglePath:["notifications","events","terminated","disabled"]}},{path:["notifications","events","waiting_input","title"],type:"string",defaultValue:"",icon:"title",group:"items",collapse:{key:"notifications.events.waiting_input",labelKey:"config.fields.general.notifications.events.waiting_input.label",descKey:"config.fields.general.notifications.events.waiting_input.desc",togglePath:["notifications","events","waiting_input","disabled"]}},{path:["notifications","events","waiting_input","description"],type:"multiline",defaultValue:"",icon:"notes",group:"items",collapse:{key:"notifications.events.waiting_input",labelKey:"config.fields.general.notifications.events.waiting_input.label",descKey:"config.fields.general.notifications.events.waiting_input.desc",togglePath:["notifications","events","waiting_input","disabled"]}},{path:["notifications","events","waiting_input","sound"],type:"string",defaultValue:"",icon:"volume_up",group:"items",collapse:{key:"notifications.events.waiting_input",labelKey:"config.fields.general.notifications.events.waiting_input.label",descKey:"config.fields.general.notifications.events.waiting_input.desc",togglePath:["notifications","events","waiting_input","disabled"]}}],conversation:[{path:["style"],type:"select",defaultValue:"friendly",icon:"forum",options:[{value:"friendly",label:"config.options.conversation.friendly"},{value:"programmatic",label:"config.options.conversation.programmatic"}]},{path:["customInstructions"],type:"multiline",defaultValue:"",icon:"description"}],models:[{path:[],type:"record",recordKind:"json",defaultValue:{},icon:"tune"}],modelServices:[{path:[],type:"record",recordKind:"modelServices",defaultValue:{},icon:"hub"}],channels:[{path:[],type:"record",recordKind:"channels",defaultValue:{},icon:"campaign"}],adapters:[{path:[],type:"record",recordKind:"json",defaultValue:{},icon:"settings_input_component"}],plugins:[{path:["plugins"],type:"json",defaultValue:[],icon:"extension"}],mcp:[{path:["defaultIncludeMcpServers"],type:"string[]",defaultValue:[],group:"base",icon:"playlist_add"},{path:["defaultExcludeMcpServers"],type:"string[]",defaultValue:[],group:"base",icon:"playlist_remove"},{path:["noDefaultVibeForgeMcpServer"],type:"boolean",defaultValue:!1,group:"base",icon:"block"},{path:["mcpServers"],type:"record",recordKind:"mcpServers",defaultValue:{},icon:"account_tree"}],shortcuts:[{path:["newSession"],type:"shortcut",defaultValue:"",icon:"add_comment"},{path:["openConfig"],type:"shortcut",defaultValue:"",icon:"settings"},{path:["sendMessage"],type:"shortcut",defaultValue:"",icon:"send"},{path:["clearInput"],type:"shortcut",defaultValue:"",icon:"clear"}]},NCe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),a=Object.entries(e);return y.jsxs("div",{className:"config-view__record-list",children:[a.map(([s,l])=>y.jsxs("div",{className:"config-view__record-row",children:[y.jsx("div",{className:"config-view__record-key",children:s}),y.jsx(ta,{checked:!!l,onChange:c=>{t({...e,[s]:c})}}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const c={...e};delete c[s],t(c)}})})]},s)),y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:s=>i(s.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{t({...e,[o]:!0}),i("")}})})]})})]})};var pn;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function n(o){throw new Error}e.assertNever=n,e.arrayToEnum=o=>{const i={};for(const a of o)i[a]=a;return i},e.getValidEnumValues=o=>{const i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(const s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const i=[];for(const a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(const a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(pn||(pn={}));var eP;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(eP||(eP={}));const _t=pn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),es=e=>{switch(typeof e){case"undefined":return _t.undefined;case"string":return _t.string;case"number":return Number.isNaN(e)?_t.nan:_t.number;case"boolean":return _t.boolean;case"function":return _t.function;case"bigint":return _t.bigint;case"symbol":return _t.symbol;case"object":return Array.isArray(e)?_t.array:e===null?_t.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?_t.promise:typeof Map<"u"&&e instanceof Map?_t.map:typeof Set<"u"&&e instanceof Set?_t.set:typeof Date<"u"&&e instanceof Date?_t.date:_t.object;default:return _t.unknown}},ot=pn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ja extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(n(a))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return o(this),r}static assert(t){if(!(t instanceof ja))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,pn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const o of this.issues)if(o.path.length>0){const i=o.path[0];n[i]=n[i]||[],n[i].push(t(o))}else r.push(t(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ja.create=e=>new ja(e);const kC=(e,t)=>{let n;switch(e.code){case ot.invalid_type:e.received===_t.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ot.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,pn.jsonStringifyReplacer)}`;break;case ot.unrecognized_keys:n=`Unrecognized key(s) in object: ${pn.joinValues(e.keys,", ")}`;break;case ot.invalid_union:n="Invalid input";break;case ot.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${pn.joinValues(e.options)}`;break;case ot.invalid_enum_value:n=`Invalid enum value. Expected ${pn.joinValues(e.options)}, received '${e.received}'`;break;case ot.invalid_arguments:n="Invalid function arguments";break;case ot.invalid_return_type:n="Invalid function return type";break;case ot.invalid_date:n="Invalid date";break;case ot.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:pn.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ot.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ot.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ot.custom:n="Invalid input";break;case ot.invalid_intersection_types:n="Intersection results could not be merged";break;case ot.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ot.not_finite:n="Number must be finite";break;default:n=t.defaultError,pn.assertNever(e)}return{message:n}};let OCe=kC;function ICe(){return OCe}const RCe=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function yt(e,t){const n=ICe(),r=RCe({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===kC?void 0:kC].filter(o=>!!o)});e.common.issues.push(r)}class uo{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const o of n){if(o.status==="aborted")return Wt;o.status==="dirty"&&t.dirty(),r.push(o.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const o of n){const i=await o.key,a=await o.value;r.push({key:i,value:a})}return uo.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const o of n){const{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Wt;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(r[i.value]=a.value)}return{status:t.value,value:r}}}const Wt=Object.freeze({status:"aborted"}),hd=e=>({status:"dirty",value:e}),fi=e=>({status:"valid",value:e}),tP=e=>e.status==="aborted",nP=e=>e.status==="dirty",ru=e=>e.status==="valid",hg=e=>typeof Promise<"u"&&e instanceof Promise;var kt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(kt||(kt={}));class na{constructor(t,n,r,o){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const rP=(e,t)=>{if(ru(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ja(e.common.issues);return this._error=n,this._error}}};function Zt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{const{message:l}=e;return a.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??r??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:l??n??s.defaultError}},description:o}}class ln{get description(){return this._def.description}_getType(t){return es(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:es(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new uo,ctx:{common:t.parent.common,data:t.data,parsedType:es(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(hg(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:es(t)},o=this._parseSync({data:t,path:r.path,parent:r});return rP(r,o)}"~validate"(t){var r,o;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:es(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return ru(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(o=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>ru(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:es(t)},o=this._parse({data:t,path:r.path,parent:r}),i=await(hg(o)?o:Promise.resolve(o));return rP(r,i)}refine(t,n){const r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,i)=>{const a=t(o),s=()=>i.addIssue({code:ot.custom,...r(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,o)=>t(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(t){return new Aa({schema:this,typeName:Ht.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ki.create(this,this._def)}nullable(){return La.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oi.create(this)}promise(){return Cg.create(this,this._def)}or(t){return vg.create([this,t],this._def)}and(t){return yg.create(this,t,this._def)}transform(t){return new Aa({...Zt(this._def),schema:this,typeName:Ht.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ou({...Zt(this._def),innerType:this,defaultValue:n,typeName:Ht.ZodDefault})}brand(){return new ewe({typeName:Ht.ZodBranded,type:this,...Zt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new OC({...Zt(this._def),innerType:this,catchValue:n,typeName:Ht.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return G1.create(this,t)}readonly(){return IC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const PCe=/^c[^\s-]{8,}$/i,TCe=/^[0-9a-z]+$/,jCe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,MCe=/^[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,ACe=/^[a-z0-9_-]{21}$/i,LCe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,DCe=/^[-+]?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)?)??$/,zCe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,BCe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let C0;const FCe=/^(?:(?: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])$/,HCe=/^(?:(?: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])$/,VCe=/^(([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]))$/,WCe=/^(([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])$/,KCe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,UCe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,t4="((\\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])))",GCe=new RegExp(`^${t4}$`);function n4(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function qCe(e){return new RegExp(`^${n4(e)}$`)}function XCe(e){let t=`${t4}T${n4(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function YCe(e,t){return!!((t==="v4"||!t)&&FCe.test(e)||(t==="v6"||!t)&&VCe.test(e))}function QCe(e,t){if(!LCe.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function ZCe(e,t){return!!((t==="v4"||!t)&&HCe.test(e)||(t==="v6"||!t)&&WCe.test(e))}class ni extends ln{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==_t.string){const i=this._getOrReturnCtx(t);return yt(i,{code:ot.invalid_type,expected:_t.string,received:i.parsedType}),Wt}const r=new uo;let o;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?yt(o,{code:ot.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&yt(o,{code:ot.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")zCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"email",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")C0||(C0=new RegExp(BCe,"u")),C0.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"emoji",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")MCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"uuid",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")ACe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"nanoid",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")PCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"cuid",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")TCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"cuid2",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")jCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"ulid",code:ot.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),yt(o,{validation:"url",code:ot.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"regex",code:ot.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?XCe(i).test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?GCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?qCe(i).test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?DCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"duration",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?YCe(t.data,i.version)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"ip",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?QCe(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"jwt",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?ZCe(t.data,i.version)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"cidr",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?KCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"base64",code:ot.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?UCe.test(t.data)||(o=this._getOrReturnCtx(t,o),yt(o,{validation:"base64url",code:ot.invalid_string,message:i.message}),r.dirty()):pn.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(o=>t.test(o),{validation:n,code:ot.invalid_string,...kt.errToObj(r)})}_addCheck(t){return new ni({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...kt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...kt.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...kt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...kt.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...kt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...kt.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...kt.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...kt.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...kt.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...kt.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...kt.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...kt.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...kt.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...kt.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...kt.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...kt.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...kt.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...kt.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...kt.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...kt.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...kt.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...kt.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...kt.errToObj(n)})}nonempty(t){return this.min(1,kt.errToObj(t))}trim(){return new ni({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ni({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ni({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}ni.create=e=>new ni({checks:[],typeName:Ht.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Zt(e)});function JCe(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}class bl extends ln{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==_t.number){const i=this._getOrReturnCtx(t);return yt(i,{code:ot.invalid_type,expected:_t.number,received:i.parsedType}),Wt}let r;const o=new uo;for(const i of this._def.checks)i.kind==="int"?pn.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?JCe(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.not_finite,message:i.message}),o.dirty()):pn.assertNever(i);return{status:o.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,kt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,kt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,kt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,kt.toString(n))}setLimit(t,n,r,o){return new bl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:kt.toString(o)}]})}_addCheck(t){return new bl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:kt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:kt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:kt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:kt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:kt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:kt.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:kt.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:kt.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:kt.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&pn.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}bl.create=e=>new bl({checks:[],typeName:Ht.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Zt(e)});class If extends ln{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==_t.bigint)return this._getInvalidInput(t);let r;const o=new uo;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),yt(r,{code:ot.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):pn.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return yt(n,{code:ot.invalid_type,expected:_t.bigint,received:n.parsedType}),Wt}gte(t,n){return this.setLimit("min",t,!0,kt.toString(n))}gt(t,n){return this.setLimit("min",t,!1,kt.toString(n))}lte(t,n){return this.setLimit("max",t,!0,kt.toString(n))}lt(t,n){return this.setLimit("max",t,!1,kt.toString(n))}setLimit(t,n,r,o){return new If({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:kt.toString(o)}]})}_addCheck(t){return new If({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:kt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:kt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:kt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:kt.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:kt.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}If.create=e=>new If({checks:[],typeName:Ht.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Zt(e)});class Rf extends ln{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==_t.boolean){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.boolean,received:r.parsedType}),Wt}return fi(t.data)}}Rf.create=e=>new Rf({typeName:Ht.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Zt(e)});class gg extends ln{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==_t.date){const i=this._getOrReturnCtx(t);return yt(i,{code:ot.invalid_type,expected:_t.date,received:i.parsedType}),Wt}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return yt(i,{code:ot.invalid_date}),Wt}const r=new uo;let o;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),yt(o,{code:ot.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):pn.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new gg({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:kt.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:kt.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}gg.create=e=>new gg({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ht.ZodDate,...Zt(e)});class oP extends ln{_parse(t){if(this._getType(t)!==_t.symbol){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.symbol,received:r.parsedType}),Wt}return fi(t.data)}}oP.create=e=>new oP({typeName:Ht.ZodSymbol,...Zt(e)});class iP extends ln{_parse(t){if(this._getType(t)!==_t.undefined){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.undefined,received:r.parsedType}),Wt}return fi(t.data)}}iP.create=e=>new iP({typeName:Ht.ZodUndefined,...Zt(e)});class aP extends ln{_parse(t){if(this._getType(t)!==_t.null){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.null,received:r.parsedType}),Wt}return fi(t.data)}}aP.create=e=>new aP({typeName:Ht.ZodNull,...Zt(e)});class sP extends ln{constructor(){super(...arguments),this._any=!0}_parse(t){return fi(t.data)}}sP.create=e=>new sP({typeName:Ht.ZodAny,...Zt(e)});class lP extends ln{constructor(){super(...arguments),this._unknown=!0}_parse(t){return fi(t.data)}}lP.create=e=>new lP({typeName:Ht.ZodUnknown,...Zt(e)});class $s extends ln{_parse(t){const n=this._getOrReturnCtx(t);return yt(n,{code:ot.invalid_type,expected:_t.never,received:n.parsedType}),Wt}}$s.create=e=>new $s({typeName:Ht.ZodNever,...Zt(e)});class cP extends ln{_parse(t){if(this._getType(t)!==_t.undefined){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.void,received:r.parsedType}),Wt}return fi(t.data)}}cP.create=e=>new cP({typeName:Ht.ZodVoid,...Zt(e)});class oi extends ln{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),o=this._def;if(n.parsedType!==_t.array)return yt(n,{code:ot.invalid_type,expected:_t.array,received:n.parsedType}),Wt;if(o.exactLength!==null){const a=n.data.length>o.exactLength.value,s=n.data.length<o.exactLength.value;(a||s)&&(yt(n,{code:a?ot.too_big:ot.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(yt(n,{code:ot.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(yt(n,{code:ot.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>o.type._parseAsync(new na(n,a,n.path,s)))).then(a=>uo.mergeArray(r,a));const i=[...n.data].map((a,s)=>o.type._parseSync(new na(n,a,n.path,s)));return uo.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new oi({...this._def,minLength:{value:t,message:kt.toString(n)}})}max(t,n){return new oi({...this._def,maxLength:{value:t,message:kt.toString(n)}})}length(t,n){return new oi({...this._def,exactLength:{value:t,message:kt.toString(n)}})}nonempty(t){return this.min(1,t)}}oi.create=(e,t)=>new oi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ht.ZodArray,...Zt(t)});function Yl(e){if(e instanceof qn){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ki.create(Yl(r))}return new qn({...e._def,shape:()=>t})}else return e instanceof oi?new oi({...e._def,type:Yl(e.element)}):e instanceof ki?ki.create(Yl(e.unwrap())):e instanceof La?La.create(Yl(e.unwrap())):e instanceof xl?xl.create(e.items.map(t=>Yl(t))):e}class qn extends ln{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=pn.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==_t.object){const c=this._getOrReturnCtx(t);return yt(c,{code:ot.invalid_type,expected:_t.object,received:c.parsedType}),Wt}const{status:r,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof $s&&this._def.unknownKeys==="strip"))for(const c in o.data)a.includes(c)||s.push(c);const l=[];for(const c of a){const d=i[c],f=o.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new na(o,f,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof $s){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of s)l.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(c==="strict")s.length>0&&(yt(o,{code:ot.unrecognized_keys,keys:s}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of s){const f=o.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new na(o,f,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const f=await d.key,m=await d.value;c.push({key:f,value:m,alwaysSet:d.alwaysSet})}return c}).then(c=>uo.mergeObjectSync(r,c)):uo.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return kt.errToObj,new qn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,a;const o=((a=(i=this._def).errorMap)==null?void 0:a.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:kt.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new qn({...this._def,unknownKeys:"strip"})}passthrough(){return new qn({...this._def,unknownKeys:"passthrough"})}extend(t){return new qn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new qn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ht.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new qn({...this._def,catchall:t})}pick(t){const n={};for(const r of pn.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new qn({...this._def,shape:()=>n})}omit(t){const n={};for(const r of pn.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new qn({...this._def,shape:()=>n})}deepPartial(){return Yl(this)}partial(t){const n={};for(const r of pn.objectKeys(this.shape)){const o=this.shape[r];t&&!t[r]?n[r]=o:n[r]=o.optional()}return new qn({...this._def,shape:()=>n})}required(t){const n={};for(const r of pn.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ki;)i=i._def.innerType;n[r]=i}return new qn({...this._def,shape:()=>n})}keyof(){return r4(pn.objectKeys(this.shape))}}qn.create=(e,t)=>new qn({shape:()=>e,unknownKeys:"strip",catchall:$s.create(),typeName:Ht.ZodObject,...Zt(t)});qn.strictCreate=(e,t)=>new qn({shape:()=>e,unknownKeys:"strict",catchall:$s.create(),typeName:Ht.ZodObject,...Zt(t)});qn.lazycreate=(e,t)=>new qn({shape:e,unknownKeys:"strip",catchall:$s.create(),typeName:Ht.ZodObject,...Zt(t)});class vg extends ln{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function o(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=i.map(s=>new ja(s.ctx.common.issues));return yt(n,{code:ot.invalid_union,unionErrors:a}),Wt}if(n.common.async)return Promise.all(r.map(async i=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(o);{let i;const a=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const s=a.map(l=>new ja(l));return yt(n,{code:ot.invalid_union,unionErrors:s}),Wt}}get options(){return this._def.options}}vg.create=(e,t)=>new vg({options:e,typeName:Ht.ZodUnion,...Zt(t)});function NC(e,t){const n=es(e),r=es(t);if(e===t)return{valid:!0,data:e};if(n===_t.object&&r===_t.object){const o=pn.objectKeys(t),i=pn.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(const s of i){const l=NC(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===_t.array&&r===_t.array){if(e.length!==t.length)return{valid:!1};const o=[];for(let i=0;i<e.length;i++){const a=e[i],s=t[i],l=NC(a,s);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===_t.date&&r===_t.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class yg extends ln{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=(i,a)=>{if(tP(i)||tP(a))return Wt;const s=NC(i.value,a.value);return s.valid?((nP(i)||nP(a))&&n.dirty(),{status:n.value,value:s.data}):(yt(r,{code:ot.invalid_intersection_types}),Wt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}yg.create=(e,t,n)=>new yg({left:e,right:t,typeName:Ht.ZodIntersection,...Zt(n)});class xl extends ln{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_t.array)return yt(r,{code:ot.invalid_type,expected:_t.array,received:r.parsedType}),Wt;if(r.data.length<this._def.items.length)return yt(r,{code:ot.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Wt;!this._def.rest&&r.data.length>this._def.items.length&&(yt(r,{code:ot.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new na(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(i).then(a=>uo.mergeArray(n,a)):uo.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new xl({...this._def,rest:t})}}xl.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xl({items:e,typeName:Ht.ZodTuple,rest:null,...Zt(t)})};class bg extends ln{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_t.object)return yt(r,{code:ot.invalid_type,expected:_t.object,received:r.parsedType}),Wt;const o=[],i=this._def.keyType,a=this._def.valueType;for(const s in r.data)o.push({key:i._parse(new na(r,s,r.path,s)),value:a._parse(new na(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?uo.mergeObjectAsync(n,o):uo.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof ln?new bg({keyType:t,valueType:n,typeName:Ht.ZodRecord,...Zt(r)}):new bg({keyType:ni.create(),valueType:t,typeName:Ht.ZodRecord,...Zt(n)})}}class uP extends ln{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_t.map)return yt(r,{code:ot.invalid_type,expected:_t.map,received:r.parsedType}),Wt;const o=this._def.keyType,i=this._def.valueType,a=[...r.data.entries()].map(([s,l],c)=>({key:o._parse(new na(r,s,r.path,[c,"key"])),value:i._parse(new na(r,l,r.path,[c,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return Wt;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),s.set(c.value,d.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return Wt;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),s.set(c.value,d.value)}return{status:n.value,value:s}}}}uP.create=(e,t,n)=>new uP({valueType:t,keyType:e,typeName:Ht.ZodMap,...Zt(n)});class Pf extends ln{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_t.set)return yt(r,{code:ot.invalid_type,expected:_t.set,received:r.parsedType}),Wt;const o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(yt(r,{code:ot.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(yt(r,{code:ot.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());const i=this._def.valueType;function a(l){const c=new Set;for(const d of l){if(d.status==="aborted")return Wt;d.status==="dirty"&&n.dirty(),c.add(d.value)}return{status:n.value,value:c}}const s=[...r.data.values()].map((l,c)=>i._parse(new na(r,l,r.path,c)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Pf({...this._def,minSize:{value:t,message:kt.toString(n)}})}max(t,n){return new Pf({...this._def,maxSize:{value:t,message:kt.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Pf.create=(e,t)=>new Pf({valueType:e,minSize:null,maxSize:null,typeName:Ht.ZodSet,...Zt(t)});class dP extends ln{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}dP.create=(e,t)=>new dP({getter:e,typeName:Ht.ZodLazy,...Zt(t)});class xg extends ln{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return yt(n,{received:n.data,code:ot.invalid_literal,expected:this._def.value}),Wt}return{status:"valid",value:t.data}}get value(){return this._def.value}}xg.create=(e,t)=>new xg({value:e,typeName:Ht.ZodLiteral,...Zt(t)});function r4(e,t){return new Ma({values:e,typeName:Ht.ZodEnum,...Zt(t)})}class Ma extends ln{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return yt(n,{expected:pn.joinValues(r),received:n.parsedType,code:ot.invalid_type}),Wt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return yt(n,{received:n.data,code:ot.invalid_enum_value,options:r}),Wt}return fi(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Ma.create(t,{...this._def,...n})}exclude(t,n=this._def){return Ma.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Ma.create=r4;class Sg extends ln{_parse(t){const n=pn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==_t.string&&r.parsedType!==_t.number){const o=pn.objectValues(n);return yt(r,{expected:pn.joinValues(o),received:r.parsedType,code:ot.invalid_type}),Wt}if(this._cache||(this._cache=new Set(pn.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const o=pn.objectValues(n);return yt(r,{received:r.data,code:ot.invalid_enum_value,options:o}),Wt}return fi(t.data)}get enum(){return this._def.values}}Sg.create=(e,t)=>new Sg({values:e,typeName:Ht.ZodNativeEnum,...Zt(t)});class Cg extends ln{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_t.promise&&n.common.async===!1)return yt(n,{code:ot.invalid_type,expected:_t.promise,received:n.parsedType}),Wt;const r=n.parsedType===_t.promise?n.data:Promise.resolve(n.data);return fi(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Cg.create=(e,t)=>new Cg({type:e,typeName:Ht.ZodPromise,...Zt(t)});class Aa extends ln{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ht.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{yt(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){const a=o.transform(r.data,i);if(r.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return Wt;const l=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return l.status==="aborted"?Wt:l.status==="dirty"||n.value==="dirty"?hd(l.value):l});{if(n.value==="aborted")return Wt;const s=this._def.schema._parseSync({data:a,path:r.path,parent:r});return s.status==="aborted"?Wt:s.status==="dirty"||n.value==="dirty"?hd(s.value):s}}if(o.type==="refinement"){const a=s=>{const l=o.refinement(s,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Wt:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Wt:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(o.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ru(a))return Wt;const s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>ru(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:n.value,value:s})):Wt);pn.assertNever(o)}}Aa.create=(e,t,n)=>new Aa({schema:e,typeName:Ht.ZodEffects,effect:t,...Zt(n)});Aa.createWithPreprocess=(e,t,n)=>new Aa({schema:t,effect:{type:"preprocess",transform:e},typeName:Ht.ZodEffects,...Zt(n)});class ki extends ln{_parse(t){return this._getType(t)===_t.undefined?fi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ki.create=(e,t)=>new ki({innerType:e,typeName:Ht.ZodOptional,...Zt(t)});class La extends ln{_parse(t){return this._getType(t)===_t.null?fi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}La.create=(e,t)=>new La({innerType:e,typeName:Ht.ZodNullable,...Zt(t)});class ou extends ln{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===_t.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ou.create=(e,t)=>new ou({innerType:e,typeName:Ht.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Zt(t)});class OC extends ln{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return hg(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ja(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ja(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}OC.create=(e,t)=>new OC({innerType:e,typeName:Ht.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Zt(t)});class fP extends ln{_parse(t){if(this._getType(t)!==_t.nan){const r=this._getOrReturnCtx(t);return yt(r,{code:ot.invalid_type,expected:_t.nan,received:r.parsedType}),Wt}return{status:"valid",value:t.data}}}fP.create=e=>new fP({typeName:Ht.ZodNaN,...Zt(e)});class ewe extends ln{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class G1 extends ln{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Wt:i.status==="dirty"?(n.dirty(),hd(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Wt:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(t,n){return new G1({in:t,out:n,typeName:Ht.ZodPipeline})}}class IC extends ln{_parse(t){const n=this._def.innerType._parse(t),r=o=>(ru(o)&&(o.value=Object.freeze(o.value)),o);return hg(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}}IC.create=(e,t)=>new IC({innerType:e,typeName:Ht.ZodReadonly,...Zt(t)});var Ht;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ht||(Ht={}));const yo=ni.create,RC=Rf.create;$s.create;const od=oi.create,q1=qn.create;vg.create;yg.create;xl.create;const twe=xg.create,X1=Ma.create;Cg.create;ki.create;La.create;const nwe=q1({admins:od(yo()).optional().describe("频道管理员账号(sender ID),管理员拥有管理操作权限且不受以下访问控制限制"),allowPrivateChat:RC().optional().describe("是否允许私聊消息,默认 true"),allowGroupChat:RC().optional().describe("是否允许群聊消息,默认 true"),allowedGroups:od(yo()).optional().describe("群组白名单(channel ID),设置后仅在指定群中响应"),blockedGroups:od(yo()).optional().describe("群组黑名单(channel ID),在指定群中不响应"),allowedSenders:od(yo()).optional().describe("发送者白名单(sender ID),设置后仅白名单内的用户可交互"),blockedSenders:od(yo()).optional().describe("发送者黑名单(sender ID),黑名单内的用户消息将被忽略")}),o4=q1({type:yo().min(1).describe("频道类型"),title:yo().optional().describe("频道标题"),description:yo().optional().describe("频道说明"),enabled:RC().optional().describe("是否启用"),systemPrompt:yo().optional().describe("在此频道启动会话时注入的系统提示词"),commandPrefix:yo().optional().describe("频道指令前缀,默认 /"),language:X1(["zh","en"]).optional().describe("频道提示语言,默认 zh"),access:nwe.optional().describe("频道访问权限配置")}),rwe=e=>e,owe=o4.extend({type:twe("lark").describe("频道类型"),appId:yo().min(1).describe("飞书 App ID"),appSecret:yo().min(1).describe("飞书 App Secret"),domain:X1(["Feishu","Lark"]).optional().describe("飞书 Domain")}),iwe=q1({receiveId:yo().min(1).describe("接收方 ID"),receiveIdType:X1(["open_id","user_id","chat_id","email"]).describe("接收方类型"),text:yo().min(1).describe("消息文本")}),awe=rwe({type:"lark",label:"飞书",description:"飞书消息通道",configSchema:owe,messageSchema:iwe}),PC=[awe],cs=e=>e instanceof qn?e.shape:e instanceof Aa?cs(e.innerType()):e instanceof ki?cs(e.unwrap()):e instanceof ou?cs(e.removeDefault()):e instanceof La?cs(e.unwrap()):{},hc=e=>e instanceof Aa?hc(e.innerType()):e instanceof ki?hc(e.unwrap()):e instanceof ou?hc(e.removeDefault()):e instanceof La?hc(e.unwrap()):e,wg=e=>{if(e instanceof ou)return e._def.defaultValue();if(!(e instanceof ki)){if(e instanceof La)return null;if(e instanceof xg)return e.value;if(e instanceof Ma)return e.options[0];if(e instanceof Sg){const t=Object.values(e.enum);return t.length>0?t[0]:void 0}if(e instanceof ni)return"";if(e instanceof bl)return 0;if(e instanceof Rf)return!1;if(e instanceof oi)return[];if(e instanceof qn){const t=cs(e);return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,wg(r)]))}if(e instanceof bg)return{};if(e instanceof Aa)return wg(e.innerType())}},swe=e=>e.replace(/_/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/\b\w/g,t=>t.toUpperCase()),mP=e=>{const t=cs(e.configSchema);return Object.entries(t).reduce((r,[o,i])=>(r[o]=wg(i),r),{})},w0=e=>PC.find(t=>t.type===e),lwe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{var b;const[o,i]=u.useState(""),[a,s]=u.useState(((b=PC[0])==null?void 0:b.type)??""),l=u.useMemo(()=>Object.entries(e),[e]),[c,d]=u.useState(()=>Object.fromEntries(l.map(([x])=>[x,!0]))),f=u.useMemo(()=>new Set(Object.keys(cs(o4))),[]),m=u.useMemo(()=>PC.map(x=>({value:x.type,label:x.label})),[]);u.useEffect(()=>{d(x=>{const g={};for(const[v]of l)g[v]=x[v]??!0;return g})},[l]);const p=(x,g)=>{t({...e,[x]:g})},h=(x,g,v,S)=>{const C=hc(S),_=C.description??"",w=swe(v),N=g[v],k=N!==void 0?N:wg(S);if(C instanceof ni){const E=JF(v);return y.jsx(kn,{title:w,description:_,icon:Rn("string"),children:E?y.jsx(Ft.Password,{value:typeof k=="string"?k:"",onChange:$=>{p(x,{...g,[v]:$.target.value})},placeholder:n("config.editor.secretPlaceholder")}):y.jsx(Ft,{value:typeof k=="string"?k:"",onChange:$=>{p(x,{...g,[v]:$.target.value})}})},v)}if(C instanceof bl)return y.jsx(kn,{title:w,description:_,icon:Rn("number"),children:y.jsx(Zc,{value:typeof k=="number"?k:0,onChange:E=>{p(x,{...g,[v]:E??0})}})},v);if(C instanceof Rf)return y.jsx(kn,{title:w,description:_,icon:Rn("boolean"),children:y.jsx(ta,{checked:!!k,onChange:E=>{p(x,{...g,[v]:E})}})},v);if(C instanceof Ma||C instanceof Sg){const E=(C instanceof Ma?C.options:Object.values(C.enum)).map($=>String($));return y.jsx(kn,{title:w,description:_,icon:Rn("string"),children:y.jsx(Yn,{value:typeof k=="string"?k:void 0,options:E.map($=>({value:$,label:$})),onChange:$=>{p(x,{...g,[v]:$})}})},v)}if(C instanceof oi){if(hc(C.element)instanceof ni){const $=Array.isArray(k)?k.filter(O=>typeof O=="string"):[];return y.jsx(kn,{title:w,description:_,icon:Rn("array"),layout:"stacked",children:y.jsx(cy,{value:$,onChange:O=>{p(x,{...g,[v]:O})},t:n})},v)}return y.jsx(kn,{title:w,description:_,icon:Rn("array"),layout:"stacked",children:y.jsx(nu,{value:Array.isArray(k)?k:[],onChange:$=>{p(x,{...g,[v]:$})}})},v)}return y.jsx(kn,{title:w,description:_,icon:Rn("object"),layout:"stacked",children:y.jsx(nu,{value:k??{},onChange:E=>{p(x,{...g,[v]:E})}})},v)};return y.jsxs("div",{className:"config-view__record-list",children:[y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:x=>i(x.target.value)}),y.jsx(Yn,{value:a,options:m,onChange:x=>s(x)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o)||a==="",onClick:()=>{const x=w0(a);x&&(t({...e,[o]:mP(x)}),i(""))}})})]})}),l.map(([x,g])=>{const v=g!=null&&typeof g=="object"?g:{},S=typeof v.type=="string"?v.type:void 0,C=w0(S),_=typeof v.title=="string"?v.title:"",w=typeof v.description=="string"?v.description:"",N=_.trim()!==""?_:x,k=(C==null?void 0:C.label)??S??n("config.editor.unknownChannelType"),E=c[x]===!0,$=C?cs(C.configSchema):{},O=Object.entries($).filter(([R])=>R!=="type").sort(([R],[T])=>{const I=["title","description","enabled","admins"],P=I.indexOf(R),j=I.indexOf(T);return P===-1&&j===-1?R.localeCompare(T):P===-1?1:j===-1?-1:P-j});return y.jsxs("div",{className:`config-view__record-card${E?" config-view__record-card--collapsed":""}`,children:[y.jsxs("div",{className:"config-view__record-title",children:[y.jsxs("div",{className:"config-view__record-title-left",children:[y.jsx(dt,{title:n(E?"config.editor.expand":"config.editor.collapse"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":n(E?"config.editor.expand":"config.editor.collapse"),icon:y.jsx("span",{className:"material-symbols-rounded",children:E?"chevron_right":"expand_more"}),onClick:()=>{d(R=>({...R,[x]:!E}))}})}),y.jsxs("div",{className:"config-view__record-heading",children:[y.jsx("div",{children:N}),y.jsxs("div",{className:"config-view__record-subtitle",children:[x," · ",k]}),w!==""&&y.jsx("div",{className:"config-view__record-desc",children:w})]})]}),y.jsx("div",{className:"config-view__record-actions",children:y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const R={...e};delete R[x],t(R)}})})})]}),y.jsx("div",{className:"config-view__record-body",children:y.jsxs("div",{className:"config-view__record-fields",children:[y.jsx(kn,{title:n("config.editor.channelType"),description:(C==null?void 0:C.description)??"",icon:Rn("string"),children:y.jsx(Yn,{value:S,options:m,onChange:R=>{const T=w0(R);if(!T)return;const I=mP(T),P=Object.fromEntries(Object.entries(v).filter(([j])=>f.has(j)));p(x,{...I,...P,type:R})}})}),O.map(([R,T])=>h(x,v,R,T))]})})]},x)})]})},TC=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),[a,s]=u.useState(""),l=Object.entries(e);return y.jsxs("div",{className:"config-view__array-list",children:[l.map(([c,d])=>y.jsxs("div",{className:"config-view__array-item",children:[y.jsx("div",{className:"config-view__record-key",children:c}),JF(c)?y.jsx(Ft.Password,{value:d,onChange:f=>{t({...e,[c]:f.target.value})},placeholder:n("config.editor.fieldValue")}):y.jsx(Ft,{value:d,onChange:f=>{t({...e,[c]:f.target.value})},placeholder:n("config.editor.fieldValue")}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const f={...e};delete f[c],t(f)}})})]},c)),y.jsx("div",{className:"config-view__array-add",children:y.jsxs("div",{className:"config-view__array-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:c=>i(c.target.value)}),y.jsx(Ft,{value:a,placeholder:n("config.editor.fieldValue"),onChange:c=>s(c.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{const c={...e,[o]:a};t(c),i(""),s("")}})})]})})]})},cwe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),a=u.useMemo(()=>Object.entries(e),[e]),[s,l]=u.useState(()=>Object.fromEntries(a.map(([c])=>[c,!0])));return u.useEffect(()=>{l(c=>{const d={};for(const[f]of a)d[f]=c[f]??!0;return d})},[a]),y.jsxs("div",{className:"config-view__record-list",children:[a.map(([c,d])=>{const f=d!=null&&typeof d=="object"?d:{},m=typeof f.type=="string"?f.type:"command",p=f.env!=null&&typeof f.env=="object"?f.env:{},h=f.headers!=null&&typeof f.headers=="object"?f.headers:{},b=Array.isArray(f.args)?f.args.filter(v=>typeof v=="string"):[],x=v=>{t({...e,[c]:v})},g=s[c]===!0;return y.jsxs("div",{className:`config-view__record-card${g?" config-view__record-card--collapsed":""}`,children:[y.jsxs("div",{className:"config-view__record-title",children:[y.jsxs("div",{className:"config-view__record-title-left",children:[y.jsx(dt,{title:n(g?"config.editor.expand":"config.editor.collapse"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":n(g?"config.editor.expand":"config.editor.collapse"),icon:y.jsx("span",{className:"material-symbols-rounded",children:g?"chevron_right":"expand_more"}),onClick:()=>{l(v=>({...v,[c]:!g}))}})}),y.jsx("span",{children:c})]}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const v={...e};delete v[c],t(v)}})})]}),y.jsx("div",{className:"config-view__record-body",children:y.jsxs("div",{className:"config-view__record-fields",children:[y.jsx(kn,{title:n("config.fields.mcpServer.enabled.label"),description:n("config.fields.mcpServer.enabled.desc"),icon:Rn("boolean"),children:y.jsx(ta,{checked:!!f.enabled,onChange:v=>{x({...f,enabled:v})}})}),y.jsx(kn,{title:n("config.fields.mcpServer.type.label"),description:n("config.fields.mcpServer.type.desc"),icon:Rn("string"),children:y.jsx(Yn,{value:m,options:[{value:"command",label:n("config.options.mcp.command")},{value:"sse",label:n("config.options.mcp.sse")},{value:"http",label:n("config.options.mcp.http")}],onChange:v=>{const S={...f};v==="command"?(delete S.type,S.command==null&&(S.command=""),S.args==null&&(S.args=[]),delete S.url,delete S.headers):(S.type=v,S.url==null&&(S.url=""),S.headers==null&&(S.headers={}),delete S.command,delete S.args),x(S)}})}),m==="command"&&y.jsxs(y.Fragment,{children:[y.jsx(kn,{title:n("config.fields.mcpServer.command.label"),description:n("config.fields.mcpServer.command.desc"),icon:Rn("string"),children:y.jsx(Ft,{value:typeof f.command=="string"?f.command:"",onChange:v=>{x({...f,command:v.target.value})},placeholder:n("config.editor.commandPlaceholder")})}),y.jsx(kn,{title:n("config.fields.mcpServer.args.label"),description:n("config.fields.mcpServer.args.desc"),icon:Rn("array"),layout:"stacked",children:y.jsx(cy,{value:b,onChange:v=>{x({...f,args:v})},t:n})})]}),m!=="command"&&y.jsxs(y.Fragment,{children:[y.jsx(kn,{title:n("config.fields.mcpServer.url.label"),description:n("config.fields.mcpServer.url.desc"),icon:Rn("string"),children:y.jsx(Ft,{value:typeof f.url=="string"?f.url:"",onChange:v=>{x({...f,url:v.target.value})},placeholder:n("config.editor.urlPlaceholder")})}),y.jsx(kn,{title:n("config.fields.mcpServer.headers.label"),description:n("config.fields.mcpServer.headers.desc"),icon:Rn("object"),layout:"stacked",children:y.jsx(TC,{value:h,onChange:v=>{x({...f,headers:v})},t:n,keyPlaceholder:n("config.editor.newHeaderName")})})]}),y.jsx(kn,{title:n("config.fields.mcpServer.env.label"),description:n("config.fields.mcpServer.env.desc"),icon:Rn("object"),layout:"stacked",children:y.jsx(TC,{value:p,onChange:v=>{x({...f,env:v})},t:n,keyPlaceholder:n("config.editor.newEnvVarName")})})]})})]},c)}),y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:c=>i(c.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{t({...e,[o]:{enabled:!0,command:"",args:[]}}),i("")}})})]})})]})},uwe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),a=u.useMemo(()=>Object.entries(e),[e]),[s,l]=u.useState(()=>Object.fromEntries(a.map(([c])=>[c,!0])));return u.useEffect(()=>{l(c=>{const d={};for(const[f]of a)d[f]=c[f]??!0;return d})},[a]),y.jsxs("div",{className:"config-view__record-list",children:[a.map(([c,d])=>{const f=d!=null&&typeof d=="object"?d:{},m=typeof f.title=="string"?f.title:"",p=typeof f.description=="string"?f.description:"",h=m.trim()!==""?m:c,b=Array.isArray(f.models)?f.models.filter(g=>typeof g=="string"):[],x=s[c]===!0;return y.jsxs("div",{className:`config-view__record-card${x?" config-view__record-card--collapsed":""}`,children:[y.jsxs("div",{className:"config-view__record-title",children:[y.jsxs("div",{className:"config-view__record-title-left",children:[y.jsx(dt,{title:n(x?"config.editor.expand":"config.editor.collapse"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":n(x?"config.editor.expand":"config.editor.collapse"),icon:y.jsx("span",{className:"material-symbols-rounded",children:x?"chevron_right":"expand_more"}),onClick:()=>{l(g=>({...g,[c]:!x}))}})}),y.jsxs("div",{className:"config-view__record-heading",children:[y.jsx("div",{children:h}),h!==c&&y.jsx("div",{className:"config-view__record-subtitle",children:c}),p!==""&&y.jsx("div",{className:"config-view__record-desc",children:p})]})]}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const g={...e};delete g[c],t(g)}})})]}),y.jsx("div",{className:"config-view__record-body",children:y.jsxs("div",{className:"config-view__record-fields",children:[y.jsx(kn,{title:n("config.fields.modelServices.item.title.label"),description:n("config.fields.modelServices.item.title.desc"),icon:Rn("string"),children:y.jsx(Ft,{value:m,onChange:g=>{t({...e,[c]:{...f,title:g.target.value}})},placeholder:n("config.editor.titlePlaceholder")})}),y.jsx(kn,{title:n("config.fields.modelServices.item.description.label"),description:n("config.fields.modelServices.item.description.desc"),icon:Rn("string"),layout:"stacked",children:y.jsx(Ft.TextArea,{value:p,onChange:g=>{t({...e,[c]:{...f,description:g.target.value}})},autoSize:{minRows:2},placeholder:n("config.editor.descriptionPlaceholder")})}),y.jsx(kn,{title:n("config.fields.modelServices.item.apiBaseUrl.label"),description:n("config.fields.modelServices.item.apiBaseUrl.desc"),icon:Rn("string"),children:y.jsx(Ft,{value:typeof f.apiBaseUrl=="string"?f.apiBaseUrl:"",onChange:g=>{t({...e,[c]:{...f,apiBaseUrl:g.target.value}})}})}),y.jsx(kn,{title:n("config.fields.modelServices.item.apiKey.label"),description:n("config.fields.modelServices.item.apiKey.desc"),icon:Rn("string"),children:y.jsx(Ft.Password,{value:typeof f.apiKey=="string"?f.apiKey:"",onChange:g=>{t({...e,[c]:{...f,apiKey:g.target.value}})},placeholder:n("config.editor.secretPlaceholder")})}),y.jsx(kn,{title:n("config.fields.modelServices.item.models.label"),description:n("config.fields.modelServices.item.models.desc"),icon:Rn("array"),layout:"stacked",children:y.jsx(cy,{value:b,onChange:g=>{t({...e,[c]:{...f,models:g}})},t:n})}),y.jsx(kn,{title:n("config.fields.modelServices.item.modelsAlias.label"),description:n("config.fields.modelServices.item.modelsAlias.desc"),icon:Rn("object"),layout:"stacked",children:y.jsx(nu,{value:f.modelsAlias??{},onChange:g=>{t({...e,[c]:{...f,modelsAlias:g}})}})}),y.jsx(kn,{title:n("config.fields.modelServices.item.timeoutMs.label"),description:n("config.fields.modelServices.item.timeoutMs.desc"),icon:Rn("number"),children:y.jsx(Zc,{min:1,step:1e3,value:typeof f.timeoutMs=="number"?f.timeoutMs:void 0,onChange:g=>{t({...e,[c]:{...f,...typeof g=="number"?{timeoutMs:g}:{timeoutMs:void 0}}})}})}),y.jsx(kn,{title:n("config.fields.modelServices.item.maxOutputTokens.label"),description:n("config.fields.modelServices.item.maxOutputTokens.desc"),icon:Rn("number"),children:y.jsx(Zc,{min:1,step:256,value:typeof f.maxOutputTokens=="number"?f.maxOutputTokens:void 0,onChange:g=>{t({...e,[c]:{...f,...typeof g=="number"?{maxOutputTokens:g}:{maxOutputTokens:void 0}}})}})}),y.jsx(kn,{title:n("config.fields.modelServices.item.extra.label"),description:n("config.fields.modelServices.item.extra.desc"),icon:Rn("object"),layout:"stacked",children:y.jsx(nu,{value:f.extra??{},onChange:g=>{t({...e,[c]:{...f,extra:g}})}})})]})})]},c)}),y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:c=>i(c.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{t({...e,[o]:{title:"",description:"",apiBaseUrl:"",apiKey:"",models:[],modelsAlias:{},timeoutMs:void 0,maxOutputTokens:void 0,extra:{}}}),i("")}})})]})})]})},dwe=({value:e,onChange:t,t:n,keyPlaceholder:r})=>{const[o,i]=u.useState(""),a=u.useMemo(()=>Object.entries(e),[e]),[s,l]=u.useState(()=>Object.fromEntries(a.map(([c])=>[c,!0])));return u.useEffect(()=>{l(c=>{const d={};for(const[f]of a)d[f]=c[f]??!0;return d})},[a]),y.jsxs("div",{className:"config-view__record-list",children:[a.map(([c,d])=>{const f=s[c]===!0;return y.jsxs("div",{className:`config-view__record-card${f?" config-view__record-card--collapsed":""}`,children:[y.jsxs("div",{className:"config-view__record-title",children:[y.jsxs("div",{className:"config-view__record-title-left",children:[y.jsx(dt,{title:n(f?"config.editor.expand":"config.editor.collapse"),children:y.jsx(ct,{size:"small",type:"text",className:"config-view__icon-button config-view__icon-button--compact","aria-label":n(f?"config.editor.expand":"config.editor.collapse"),icon:y.jsx("span",{className:"material-symbols-rounded",children:f?"chevron_right":"expand_more"}),onClick:()=>{l(m=>({...m,[c]:!f}))}})}),y.jsx("span",{children:c})]}),y.jsx(dt,{title:n("config.editor.remove"),children:y.jsx(ct,{size:"small",type:"text",danger:!0,className:"config-view__icon-button config-view__icon-button--compact","aria-label":n("config.editor.remove"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete"}),onClick:()=>{const m={...e};delete m[c],t(m)}})})]}),y.jsx("div",{className:"config-view__record-body",children:y.jsx(nu,{value:d,onChange:m=>{t({...e,[c]:m})}})})]},c)}),y.jsx("div",{className:"config-view__record-add",children:y.jsxs("div",{className:"config-view__record-add-inputs",children:[y.jsx(Ft,{value:o,placeholder:r,onChange:c=>i(c.target.value)}),y.jsx(dt,{title:n("common.confirm"),children:y.jsx(ct,{size:"small",type:"primary",className:"config-view__icon-button","aria-label":n("common.confirm"),icon:y.jsx("span",{className:"material-symbols-rounded",children:"check"}),disabled:o.trim()===""||Object.hasOwn(e,o),onClick:()=>{t({...e,[o]:{}}),i("")}})})]})})]})},fwe=({sectionKey:e,fields:t,value:n,onChange:r,mergedModelServices:o,mergedAdapters:i,selectedModelService:a,t:s})=>{const l=t??kCe[e]??[];if(l.length===0)return y.jsx(bn,{description:s("common.noData"),image:null});const c=new Set(["models","modelServices","channels","adapters","plugins","mcp"]),f=Object.entries(o).map(([C,_])=>{const w=_!=null&&typeof _=="object"?_:{},N=typeof w.title=="string"&&w.title.trim()!==""?w.title:C,k=typeof w.description=="string"?w.description:"";return{value:C,label:y.jsxs("div",{className:"config-view__option",children:[y.jsx("div",{className:"config-view__option-title",children:N}),k!==""&&y.jsx("div",{className:"config-view__option-desc",children:k})]})}}),m=a?o[a]:void 0,p=m!=null&&typeof m=="object"?m.models:void 0,h=Array.isArray(p)?p.filter(C=>typeof C=="string").map(C=>({value:C,label:y.jsx("span",{children:C})})):[],b=Object.keys(i).map(C=>({value:C,label:y.jsx("span",{children:C})})),x=l.reduce((C,_)=>{const w=_.group??"default";return C[w]||(C[w]=[]),C[w].push(_),C},{}),g=["base","permissions","env","items","default"].filter(C=>{var _;return(_=x[C])==null?void 0:_.length}),v=C=>e==="models"?s("config.editor.newModelSelectorName"):e==="modelServices"?s("config.editor.newModelServiceName"):e==="channels"?s("config.editor.newChannelName"):e==="adapters"?s("config.editor.newAdapterName"):e==="plugins"?s("config.editor.newPluginName"):e==="mcp"?s("config.editor.newMcpServerName"):e==="general"&&C.path.join(".")==="env"?s("config.editor.newEnvVarName"):s("config.editor.fieldKey"),S=C=>{const _=qp(n,C.path),w=_!==void 0?_:C.defaultValue,N=C.labelKey?s(C.labelKey):QF(s,e,C.path,C.path[C.path.length-1]??""),k=C.descriptionKey?s(C.descriptionKey):ZF(s,e,C.path),E=C.icon??Rn(YF(w)),$=T=>{const I=JR(n,C.path,T);r(I)};let O=null;const R=["multiline","json","record","string[]"].includes(C.type);if(C.type==="string"){const T=C.placeholderKey?s(C.placeholderKey):void 0;C.sensitive===!0?O=y.jsx(Ft.Password,{value:typeof w=="string"?w:"",onChange:I=>$(I.target.value),placeholder:s("config.editor.secretPlaceholder")}):O=y.jsx(Ft,{value:typeof w=="string"?w:"",onChange:I=>$(I.target.value),placeholder:T})}else if(C.type==="multiline"){const T=typeof w=="string"?w:"",I=C.placeholderKey?s(C.placeholderKey):s("config.editor.multilinePlaceholder");O=y.jsx("div",{className:"config-view__multiline",children:y.jsx(Ft.TextArea,{className:"config-view__multiline-input",value:T,onChange:P=>$(P.target.value),autoSize:{minRows:3},placeholder:I})})}else if(C.type==="number")if(C.path.join(".")==="notifications.volume"){const I=typeof w=="number"?w:0;O=y.jsx(tne,{className:"config-view__slider",min:0,max:100,step:1,value:I,onChange:P=>$(typeof P=="number"?P:0)})}else O=y.jsx(Zc,{value:typeof w=="number"?w:0,onChange:I=>$(typeof I=="number"?I:0)});else if(C.type==="boolean")O=y.jsx(ta,{checked:!!w,onChange:T=>$(T)});else if(C.type==="string[]"){const T=Array.isArray(w)?w.filter(I=>typeof I=="string"):[];O=y.jsx(cy,{value:T,onChange:I=>$(I),t:s})}else if(C.type==="select"){const T=e==="general"&&C.path.join(".")==="defaultAdapter",I=e==="general"&&C.path.join(".")==="defaultModelService",P=e==="general"&&C.path.join(".")==="defaultModel",j=I?f:P?h:T?b:(C.options??[]).map(L=>({value:L.value,label:y.jsx("span",{children:s(L.label)})}));O=y.jsx(Yn,{value:typeof w=="string"&&w!==""?w:void 0,options:j,onChange:L=>$(L),allowClear:!0,disabled:P&&h.length===0,placeholder:s(T?"config.editor.defaultAdapterPlaceholder":I?"config.editor.defaultModelServicePlaceholder":"config.editor.defaultModelPlaceholder")})}else if(C.type==="json")O=y.jsx(nu,{value:w,onChange:$});else if(C.type==="record"){const T=w!=null&&typeof w=="object"?w:{};C.recordKind==="modelServices"?O=y.jsx(uwe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):C.recordKind==="channels"?O=y.jsx(lwe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):C.recordKind==="mcpServers"?O=y.jsx(cwe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):C.recordKind==="keyValue"?O=y.jsx(TC,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):C.recordKind==="boolean"?O=y.jsx(NCe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)}):O=y.jsx(dwe,{value:T,onChange:$,t:s,keyPlaceholder:v(C)})}else if(C.type==="shortcut"){const T=navigator.platform.includes("Mac");O=y.jsx(ECe,{value:typeof w=="string"?w:"",onChange:I=>$(I),placeholder:s("config.editor.shortcutPlaceholder"),isMac:T,t:s})}return c.has(e)&&C.type==="record"?y.jsx("div",{children:O},`${C.path.join(".")}-${C.type}-${C.recordKind??""}`):y.jsx(kn,{title:N,description:k,icon:E,layout:R?"stacked":"inline",children:O},`${C.path.join(".")}-${C.type}-${C.labelKey??""}-${C.recordKind??""}`)};return y.jsx("div",{className:"config-view__field-stack",children:g.map(C=>{const _=x[C]??[];if(new Set(["base","permissions"]).has(C)&&!_.some(I=>{const P=qp(n,I.path);return typeof P=="boolean"?P:!pg(P)}))return null;if(C==="default")return c.has(e)?y.jsx("div",{children:_.map(S)},C):y.jsx("div",{className:"config-view__field-list",children:_.map(S)},C);const N=(()=>{var I,P;const T=(P=(I=$Ce[e])==null?void 0:I[C])==null?void 0:P.labelKey;return s(T||(C==="base"?"config.sectionGroups.base":C==="permissions"?"config.sectionGroups.permissions":C==="env"?"config.sectionGroups.env":e==="plugins"?"config.sectionGroups.plugins":"config.sectionGroups.items"))})(),k=_.filter(T=>T.hidden!==!0),E=k.filter(T=>T.collapse!=null),$=k.filter(T=>T.collapse==null),O=E.reduce((T,I)=>{const P=I.collapse;if(!P)return T;const j=T.get(P.key);return j?j.fields.push(I):T.set(P.key,{meta:P,fields:[I]}),T},new Map),R=Array.from(O.values()).map(T=>({key:T.meta.key,collapsible:"header",label:y.jsxs("div",{className:"config-view__collapse-header",children:[y.jsxs("div",{className:"config-view__collapse-header-main",children:[y.jsx("div",{className:"config-view__collapse-title",children:s(T.meta.labelKey)}),T.meta.descKey&&y.jsx("div",{className:"config-view__collapse-desc",children:s(T.meta.descKey)})]}),T.meta.togglePath&&y.jsx(ta,{checked:!qp(n,T.meta.togglePath),onChange:I=>{const P=JR(n,T.meta.togglePath,!I);r(P)},onClick:(I,P)=>{P.stopPropagation()}})]}),children:y.jsx("div",{className:"config-view__field-list",children:T.fields.map(S)})}));return y.jsxs("div",{className:"config-view__subsection",children:[y.jsx("div",{className:"config-view__subsection-title",children:N}),y.jsxs("div",{className:"config-view__subsection-body",children:[$.map(S),R.length>0&&y.jsx(x7,{className:"config-view__collapse-group config-view__field-row",ghost:!0,items:R})]})]},C)})})};function i4({sectionKey:e,title:t,icon:n,fields:r,value:o,onChange:i,mergedModelServices:a,mergedAdapters:s,selectedModelService:l,headerExtra:c,t:d,className:f}){const m=["config-view__editor-wrap",f].filter(Boolean).join(" "),p=t!=null||n!=null||c!=null;return y.jsxs("div",{className:m,children:[p&&y.jsxs("div",{className:"config-view__section-header",children:[y.jsxs("div",{className:"config-view__section-title",children:[n!=null&&y.jsx("span",{className:"material-symbols-rounded config-view__section-icon",children:n}),y.jsx("span",{children:t})]}),c]}),y.jsx("div",{className:"config-view__card",children:y.jsx(fwe,{sectionKey:e,fields:r,value:o,onChange:i,mergedModelServices:a,mergedAdapters:s,selectedModelService:l,t:d})})]})}function mwe({value:e,onChange:t,options:n}){return y.jsx(Nl.Group,{value:e,optionType:"button",buttonStyle:"solid",size:"small",onChange:r=>{t(r.target.value)},options:n.map(r=>({value:r.value,label:y.jsxs("span",{className:"config-view__source-option",children:[y.jsx("span",{className:"material-symbols-rounded",children:r.icon}),y.jsx("span",{children:r.label})]})}))})}function pwe({sessionInfo:e,sessionId:t,sessionTitle:n,isStarred:r,isArchived:o,tags:i,lastMessage:a,lastUserMessage:s,activeView:l,onViewChange:c}){const{t:d}=Ot(),{message:f}=Eo.useApp(),m=vl(v1),p=vl(nB),[h,b]=u.useState(""),x=(e==null?void 0:e.type)==="summary"?e.summary:null,g=((e==null?void 0:e.type)==="init"?e.title:null)??n;(e==null?void 0:e.type)==="init"&&e.cwd;const v=g!=null&&g!==""?g:x!=null&&x!==""?x:s!=null&&s!==""?s:a!=null&&a!==""?a:d("common.newChat");u.useEffect(()=>{g!=null&&g!==""&&b(g)},[g]);const S=async()=>{if(!(t==null||t===""))try{await Sa(t,{isStarred:!r}),f.success(d(r?"common.unstarred":"common.starred"))}catch(w){f.error(Mr(w,d("common.operationFailed")))}},C=async()=>{if(!(t==null||t===""))try{await Sa(t,{isArchived:!o}),f.success(d(o?"common.restored":"common.archived"))}catch(w){f.error(Mr(w,d("common.operationFailed")))}},_=[{key:"star",label:d(r?"common.unstar":"common.star"),icon:y.jsx("span",{className:`material-symbols-rounded ${r?"is-filled":""}`,style:{fontSize:"18px"},children:r?"star":"star_border"}),onClick:()=>{S()}},{key:"archive",label:d(o?"common.restore":"common.archive"),icon:y.jsx("span",{className:"material-symbols-rounded",style:{fontSize:"18px"},children:o?"unarchive":"archive"}),onClick:()=>{C()}}];return y.jsxs("div",{className:`chat-header ${m?"is-collapsed":""} ${p?"is-resizing":""}`,children:[y.jsx("div",{style:{display:"flex",alignItems:"center",gap:"12px",flex:1,minWidth:0},children:y.jsxs("div",{className:"chat-header-info",children:[y.jsx("div",{className:"chat-header-title",children:v}),y.jsx("div",{className:"chat-header-subtitle",onDoubleClick:()=>{console.log("Session Full Info:",{sessionId:t,sessionTitle:n,isStarred:r,isArchived:o,tags:i,lastMessage:a,lastUserMessage:s,sessionInfo:e})},style:{cursor:"pointer",userSelect:"all"},children:t??d("chat.selectModel")})]})}),y.jsxs("div",{className:"chat-header-actions",children:[y.jsx(Nl.Group,{className:"chat-header-view-group",value:l,optionType:"button",buttonStyle:"solid",size:"small",onChange:w=>{c(w.target.value)},options:[{label:y.jsx("span",{className:"chat-header-view-option material-symbols-rounded",children:"forum"}),value:"history"},{label:y.jsx("span",{className:"chat-header-view-option material-symbols-rounded",children:"timeline"}),value:"timeline"},{label:y.jsx("span",{className:"chat-header-view-option material-symbols-rounded",children:"tune"}),value:"settings"}]}),y.jsx("div",{className:"chat-header-divider"}),y.jsx(Jc,{menu:{items:_},placement:"bottomRight",trigger:["click"],children:y.jsx(ct,{type:"text",icon:y.jsx("span",{className:"material-symbols-rounded",children:"more_vert"})})})]})]})}function hwe({sessionId:e,initialTitle:t,initialTags:n=[],onClose:r}){const{t:o}=Ot(),{message:i,modal:a}=Eo.useApp(),s=u.useMemo(()=>[{path:["title"],type:"string",defaultValue:"",icon:"edit_note",labelKey:"chat.title",placeholderKey:"chat.enterTitle"},{path:["tags"],type:"string[]",defaultValue:[],icon:"sell",labelKey:"chat.tags"}],[]),l=u.useMemo(()=>({title:t??"",tags:n}),[n,t]),[c,d]=u.useState(l),f=u.useRef(l),m=u.useRef(null),p=u.useRef(!1),h=u.useRef(null);u.useEffect(()=>{d(l)},[l]),u.useEffect(()=>{f.current=c},[c]),u.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const b=v=>{const S=JSON.stringify(v??{});h.current!==S&&(m.current&&clearTimeout(m.current),m.current=setTimeout(async()=>{if(p.current)return;const C=f.current,_=JSON.stringify(C??{});if(h.current!==_){p.current=!0;try{await Sa(e,{title:typeof C.title=="string"?C.title:"",tags:Array.isArray(C.tags)?C.tags:[]}),h.current=_}catch(w){i.error(Mr(w,o("common.operationFailed")))}finally{p.current=!1}}},500))},x=v=>{const S=v!=null&&typeof v=="object"?v:{},C={title:typeof S.title=="string"?S.title:"",tags:Array.isArray(S.tags)?S.tags.filter(_=>typeof _=="string"):[]};d(C),b(C)},g=()=>{a.confirm({title:o("common.deleteSession"),content:o("common.deleteSessionConfirm"),okText:o("common.delete"),okType:"danger",cancelText:o("common.cancel"),onOk:async()=>{try{await Qh(e),i.success(o("common.deleteSuccess")),r()}catch(v){i.error(Mr(v,o("common.deleteFailed")))}}})};return y.jsxs("div",{className:"session-settings-drawer",children:[y.jsx(i4,{sectionKey:"session",title:null,icon:void 0,fields:s,value:c,onChange:x,mergedModelServices:{},mergedAdapters:{},selectedModelService:void 0,t:o,className:"session-settings-drawer__form"}),y.jsx("div",{className:"settings-footer",children:y.jsx("div",{className:"danger-zone",children:y.jsxs("div",{className:"delete-session-row",children:[y.jsxs("div",{className:"delete-session-meta",children:[y.jsx("div",{className:"delete-session-title",children:o("chat.deleteSessionTitle")}),y.jsx("div",{className:"delete-session-desc",children:o("chat.deleteSessionDesc")})]}),y.jsx(ct,{danger:!0,type:"primary",size:"middle",icon:y.jsx("span",{className:"material-symbols-rounded",children:"delete_forever"}),onClick:g,className:"delete-session-btn",children:o("common.delete")})]})})})]})}const gwe=80;function vwe({messagesLength:e}){const t=u.useRef(null),n=u.useRef(null),r=u.useRef(null),[o,i]=u.useState(!1),a=u.useCallback(()=>{const l=n.current;if(!l)return;const c=l.scrollHeight-(l.scrollTop+l.clientHeight);i(c>gwe)},[]),s=u.useCallback((l="smooth")=>{setTimeout(()=>{n.current&&n.current.scrollTo({top:n.current.scrollHeight,behavior:l})},50)},[]);return u.useEffect(()=>{const l=n.current;if(!l)return;a();const c=()=>a();return l.addEventListener("scroll",c,{passive:!0}),()=>{l.removeEventListener("scroll",c)}},[a]),u.useEffect(()=>{a()},[a,e]),{messagesEndRef:t,messagesContainerRef:n,messagesContentRef:r,showScrollBottom:o,scrollToBottom:s}}class ywe{constructor(){Ae(this,"sockets",new Map);Ae(this,"subscribers",new Map);Ae(this,"disconnectTimers",new Map);Ae(this,"connectionParams",new Map);Ae(this,"DISCONNECT_DELAY",6e4)}connect(t,n,r){var l;this.disconnectTimers.has(t)&&(clearTimeout(this.disconnectTimers.get(t)),this.disconnectTimers.delete(t)),this.subscribers.has(t)||this.subscribers.set(t,new Set),this.subscribers.get(t).add(n);const o=this.normalizeParams({sessionId:t,...r??{}}),i=this.buildParamsKey(o),a=this.connectionParams.get(t);let s=this.sockets.get(t);return a!=null&&a!==i&&s&&(s.close(),this.sockets.delete(t),s=void 0),!s||s.readyState===WebSocket.CLOSED||s.readyState===WebSocket.CLOSING?this.createConnection(t,o):s.readyState===WebSocket.OPEN&&((l=n.onOpen)==null||l.call(n)),this.connectionParams.set(t,i),()=>this.disconnect(t,n)}createConnection(t,n){const r=sB({onOpen:()=>{this.broadcast(t,"onOpen")},onMessage:o=>{this.broadcast(t,"onMessage",o)},onError:o=>{this.broadcast(t,"onError",o)},onClose:()=>{this.broadcast(t,"onClose"),this.sockets.get(t)===r&&this.sockets.delete(t)}},n);this.sockets.set(t,r)}disconnect(t,n){const r=this.subscribers.get(t);r&&(r.delete(n),r.size===0&&this.disconnectTimers.set(t,setTimeout(()=>{const o=this.sockets.get(t);o&&(o.close(),this.sockets.delete(t)),this.disconnectTimers.delete(t),this.subscribers.delete(t),this.connectionParams.delete(t)},this.DISCONNECT_DELAY)))}broadcast(t,n,r){const o=this.subscribers.get(t);o&&Array.from(o).forEach(a=>{if(a[n])try{a[n](r)}catch(s){console.error(`Error in ${n} handler for session ${t}:`,s)}})}close(t){const n=this.sockets.get(t);n&&(n.close(),this.sockets.delete(t)),this.disconnectTimers.has(t)&&(clearTimeout(this.disconnectTimers.get(t)),this.disconnectTimers.delete(t)),this.subscribers.delete(t),this.connectionParams.delete(t)}send(t,n){const r=this.sockets.get(t);r&&r.readyState===WebSocket.OPEN?r.send(typeof n=="string"?n:JSON.stringify(n)):console.warn(`Cannot send message: Session ${t} not connected or ready`)}normalizeParams(t){return Object.entries(t).reduce((n,[r,o])=>{if(o==null)return n;const i=String(o).trim();return i===""||(n[r]=i),n},{})}buildParamsKey(t){return Object.entries(t).sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>`${n}=${r}`).join("&")}}const Ca=new ywe;function bwe({session:e,modelForQuery:t,hasAvailableModels:n,effort:r,permissionMode:o,adapter:i,onClearMessages:a}){const{message:s}=Eo.useApp(),{t:l}=Ot(),c=Ts(),{mutate:d}=Yv(),[f,m]=u.useState(!1),p=f||(e==null?void 0:e.status)==="running";u.useEffect(()=>{!f||(e==null?void 0:e.id)==null||e.id===""||m(!1)},[f,e==null?void 0:e.id]);const h=u.useCallback(async v=>{if(v.trim()===""||p)return!1;if(!n)return s.warning(l("chat.modelConfigRequired")),!1;if(!(e!=null&&e.id)){m(!0);try{const{session:S}=await LI(void 0,v.trim(),void 0,t,{effort:r==="default"?void 0:r,permissionMode:o,adapter:i});return await d("/api/sessions",C=>C!=null&&C.sessions?{...C,sessions:[S,...C.sessions]}:{sessions:[S]},!1),c(`/session/${S.id}`),!0}catch(S){return console.error(S),m(!1),s.error(Mr(S,"Failed to create session")),!1}}return Ca.send(e.id,{type:"user_message",text:v.trim()}),!0},[i,n,p,s,d,c,r,o,t,e==null?void 0:e.id,l]),b=u.useCallback(async v=>{if(v.length===0||p)return!1;if(!n)return s.warning(l("chat.modelConfigRequired")),!1;if(!(e!=null&&e.id)){m(!0);try{const{session:S}=await LI(void 0,void 0,v,t,{effort:r==="default"?void 0:r,permissionMode:o,adapter:i});return await d("/api/sessions",C=>C!=null&&C.sessions?{...C,sessions:[S,...C.sessions]}:{sessions:[S]},!1),c(`/session/${S.id}`),!0}catch(S){return console.error(S),m(!1),s.error(Mr(S,"Failed to create session")),!1}}return Ca.send(e.id,{type:"user_message",content:v}),!0},[i,n,p,s,d,c,r,o,t,e==null?void 0:e.id,l]),x=u.useCallback(()=>{!(e!=null&&e.id)||p===!1||Ca.send(e.id,{type:"interrupt"})},[p,e==null?void 0:e.id]),g=u.useCallback(()=>{a(),s.success("Messages cleared")},[s,a]);return{isCreating:f,isThinking:p,send:h,sendContent:b,interrupt:x,clearMessages:g}}function xwe({messages:e}){const{t}=Ot(),[n,r]=u.useState(!1);let o=[];for(let s=e.length-1;s>=0;s--){const l=e[s];if(l.role==="assistant"&&Array.isArray(l.content)){const c=l.content.find(d=>d!=null&&d.type==="tool_use"&&(d.name==="TodoWrite"||d.name==="todo_write"||d.name==="adapter:claude-code:TodoWrite"||d.name==="adapter:claude-code:todo_write"));if(c!=null&&c.type==="tool_use"&&c.input!=null&&typeof c.input=="object"){const d=c.input;if(Array.isArray(d.todos)){o=d.todos;break}}}}if(o.length===0)return null;const i=o.filter(s=>s.status==="completed").length,a=o.length;return a===0?y.jsx("div",{className:"current-todo-container empty",children:y.jsx("div",{className:"todo-progress-bar empty",children:y.jsxs("div",{className:"progress-info",children:[y.jsx("span",{className:"material-symbols-rounded",children:"assignment_late"}),y.jsx("span",{className:"text",children:t("chat.todo.noTasks")})]})})}):y.jsxs("div",{className:`current-todo-container ${n?"expanded":""}`,children:[y.jsxs("div",{className:"todo-progress-bar",onClick:()=>r(!n),children:[y.jsxs("div",{className:"progress-info",children:[y.jsx("span",{className:"material-symbols-rounded",children:"assignment"}),y.jsx("span",{className:"text",children:t("chat.todo.progress",{completed:i,total:a})})]}),y.jsx("div",{className:"progress-track",children:y.jsx("div",{className:"progress-fill",style:{width:`${i/a*100}%`}})}),y.jsx("button",{className:"expand-btn",children:y.jsx("span",{className:"material-symbols-rounded",children:n?"expand_more":"expand_less"})})]}),n&&y.jsx("div",{className:"todo-items-overlay",children:y.jsx("div",{className:"todo-items-scroll-container",children:o.map((s,l)=>y.jsxs("div",{className:`todo-item-vertical status-${s.status}`,children:[y.jsx("span",{className:"material-symbols-rounded icon",children:s.status==="completed"?"check_circle":s.status==="in_progress"?"clock_loader_40":"radio_button_unchecked"}),y.jsxs("div",{className:"todo-content-wrapper",children:[y.jsx("span",{className:"text",children:s.content}),s.priority!=null&&s.priority!==""&&y.jsx("span",{className:`priority-tag ${s.priority}`,children:s.priority})]})]},s.id||l))})})]})}function Swe(){var x;const{t:e}=Ot(),{message:t}=Eo.useApp(),[n,r]=um(rB),{data:o}=Qn("/api/ai/specs"),{data:i}=Qn("/api/ai/entities"),{data:a}=Qn("/api/config"),l=((o==null?void 0:o.specs)??[]).filter(g=>g.always),c=(i==null?void 0:i.entities)??[],d=o!=null,f=i!=null,{announcements:m=[]}=((x=a==null?void 0:a.sources.merged)==null?void 0:x.general)??{},p=[e("chat.newSessionGuide.help.item1"),e("chat.newSessionGuide.help.item2"),e("chat.newSessionGuide.help.item3")],h=()=>{t.info(e("chat.newSessionGuide.specs.createToast"))},b=()=>{t.info(e("chat.newSessionGuide.entities.createToast"))};return y.jsxs("div",{className:"new-session-guide",children:[n&&m.length>0&&y.jsxs("div",{className:"new-session-guide__announcements",children:[y.jsxs("div",{className:"new-session-guide__announcements-header",children:[y.jsxs("div",{className:"new-session-guide__announcements-title",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__announcements-icon",children:"campaign"}),y.jsx("span",{children:e("chat.newSessionGuide.announcements.title")})]}),y.jsx("button",{type:"button",className:"new-session-guide__announcements-close",onClick:()=>r(!1),children:y.jsx("span",{className:"material-symbols-rounded",children:"close"})})]}),y.jsx("div",{className:"new-session-guide__announcements-list",children:m.map((g,v)=>y.jsx("div",{className:"new-session-guide__announcements-item",children:y.jsx("span",{children:g})},`${g}-${v}`))})]}),y.jsxs("div",{className:"new-session-guide__grid",children:[y.jsxs("div",{className:"new-session-guide__card",children:[y.jsxs("div",{className:"new-session-guide__header",children:[y.jsxs("div",{className:"new-session-guide__title",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__title-icon",children:"account_tree"}),y.jsx("span",{children:e("chat.newSessionGuide.specs.title")})]}),y.jsx("div",{className:"new-session-guide__count",children:l.length})]}),y.jsxs("div",{className:"new-session-guide__body",children:[!d&&y.jsx("div",{className:"new-session-guide__loading",children:e("chat.newSessionGuide.loading")}),d&&l.length>0&&y.jsx("div",{className:"new-session-guide__list",children:l.map(g=>y.jsxs("div",{className:"new-session-guide__item",children:[y.jsx("div",{className:"new-session-guide__item-title",children:y.jsx("span",{children:g.name})}),y.jsx("div",{className:"new-session-guide__item-desc",children:g.description}),g.params.length>0&&y.jsx("div",{className:"new-session-guide__meta",children:e("chat.newSessionGuide.specs.params",{count:g.params.length})})]},g.id))}),d&&l.length===0&&y.jsxs("div",{className:"new-session-guide__empty",children:[y.jsx("div",{className:"new-session-guide__empty-desc",children:e("chat.newSessionGuide.specs.empty")}),y.jsx(ct,{type:"primary",size:"small",onClick:h,children:e("chat.newSessionGuide.specs.create")})]})]})]}),y.jsxs("div",{className:"new-session-guide__card",children:[y.jsxs("div",{className:"new-session-guide__header",children:[y.jsxs("div",{className:"new-session-guide__title",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__title-icon",children:"group_work"}),y.jsx("span",{children:e("chat.newSessionGuide.entities.title")})]}),y.jsx("div",{className:"new-session-guide__count",children:c.length})]}),y.jsxs("div",{className:"new-session-guide__body",children:[!f&&y.jsx("div",{className:"new-session-guide__loading",children:e("chat.newSessionGuide.loading")}),f&&c.length>0&&y.jsx("div",{className:"new-session-guide__list",children:c.map(g=>y.jsxs("div",{className:"new-session-guide__item",children:[y.jsx("div",{className:"new-session-guide__item-title",children:y.jsx("span",{children:g.name})}),y.jsx("div",{className:"new-session-guide__item-desc",children:g.description})]},g.id))}),f&&c.length===0&&y.jsxs("div",{className:"new-session-guide__empty",children:[y.jsx("div",{className:"new-session-guide__empty-desc",children:e("chat.newSessionGuide.entities.empty")}),y.jsx(ct,{type:"primary",size:"small",onClick:b,children:e("chat.newSessionGuide.entities.create")})]})]})]}),y.jsxs("div",{className:"new-session-guide__card",children:[y.jsx("div",{className:"new-session-guide__header",children:y.jsxs("div",{className:"new-session-guide__title",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__title-icon",children:"tips_and_updates"}),y.jsx("span",{children:e("chat.newSessionGuide.help.title")})]})}),y.jsxs("div",{className:"new-session-guide__body",children:[y.jsx("div",{className:"new-session-guide__help",children:p.map(g=>y.jsxs("div",{className:"new-session-guide__help-item",children:[y.jsx("span",{className:"material-symbols-rounded new-session-guide__help-icon",children:"check_circle"}),y.jsx("span",{children:g})]},g))}),y.jsx("div",{className:"new-session-guide__help-footer",children:e("chat.newSessionGuide.help.footer")})]})]})]})]})}function ts(e,t=new WeakSet){if(e==null)return e;const n=typeof e;if(n==="bigint"||n==="symbol")return e.toString();if(n==="function")return"[Function]";if(n!=="object")return e;if(e instanceof Date)return e.toISOString();if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e instanceof Map)return Array.from(e.entries()).map(([i,a])=>[ts(i,t),ts(a,t)]);if(e instanceof Set)return Array.from(e.values()).map(i=>ts(i,t));if(ArrayBuffer.isView(e))return Array.from(e);if(e instanceof ArrayBuffer)return Array.from(new Uint8Array(e));if(Array.isArray(e))return e.map(i=>ts(i,t));const r=e;if(t.has(r))return"[Circular]";if(t.add(r),typeof r.toJSON=="function")try{return ts(r.toJSON(),t)}catch{return String(r)}const o={};for(const[i,a]of Object.entries(r))o[i]=ts(a,t);return o}function ra(e,t=2){try{const n=ts(e);return JSON.stringify(n,null,t)??"null"}catch{return JSON.stringify(String(e))??"null"}}function _o({header:e,content:t,isError:n=!1,type:r="call",defaultExpanded:o=!1,collapsible:i=!0,onDoubleClick:a}){const[s,l]=u.useState(o||!i),c=!i||s;return y.jsxs("div",{className:`tool-call-box ${r==="result"?"result":""} ${c?"expanded":"collapsed"}`,onDoubleClick:d=>{a&&(d.stopPropagation(),a(d))},children:[y.jsxs("div",{className:`tool-call-header ${r==="result"&&n?"error":""}`,onClick:()=>i&&l(!s),children:[y.jsx("div",{className:"tool-call-header-main",children:e}),i&&y.jsx("span",{className:"material-symbols-rounded expand-icon",children:c?"expand_less":"expand_more"})]}),c&&y.jsx("div",{className:"tool-call-body",children:t})]})}function Cwe(e){if(typeof e!="string")return e;const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{return e}return e}function wwe(e){const t=typeof e.url=="string"?e.url:typeof e.src=="string"?e.src:typeof e.image_url=="string"?e.image_url:typeof e.imageUrl=="string"?e.imageUrl:typeof e.dataUrl=="string"?e.dataUrl:null;if(t)return t;const n=e.source!=null&&typeof e.source=="object"?e.source:null,r=typeof e.data=="string"?e.data:typeof e.base64=="string"?e.base64:n!=null&&typeof n.data=="string"?n.data:null;return r?`data:${typeof e.mimeType=="string"?e.mimeType:typeof e.mime_type=="string"?e.mime_type:n!=null&&typeof n.media_type=="string"?n.media_type:n!=null&&typeof n.mimeType=="string"?n.mimeType:n!=null&&typeof n.mime_type=="string"?n.mime_type:"image/png"};base64,${r}`:null}function _0(e){if(e==null||typeof e!="object")return null;const t=e,n=typeof t.type=="string"?t.type.toLowerCase():"";if(n==="text"||n==="markdown"||n==="md"){const r=typeof t.text=="string"?t.text:typeof t.content=="string"?t.content:null;if(r==null)return null;const o=typeof t.format=="string"?t.format.toLowerCase():"markdown";return{type:"text",text:r,format:n==="text"&&(o==="text"||o==="plain")?"text":"markdown"}}if(n==="image"){const r=wwe(t);if(!r)return null;const o=typeof t.alt=="string"?t.alt:void 0,i=typeof t.title=="string"?t.title:void 0,a=typeof t.width=="number"?t.width:void 0,s=typeof t.height=="number"?t.height:void 0;return{type:"image",src:r,alt:o,title:i,width:a,height:s}}return null}function _we(e){const t=ts(e),n=Cwe(t);if(Array.isArray(n)){const o=n.map(_0);return o.every(Boolean)?o:null}if(n!=null&&typeof n=="object"){const o=n,i=o.content??o.items??o.blocks;if(Array.isArray(i)){const a=i.map(_0);return a.every(Boolean)?a:null}}const r=_0(n);return r?[r]:null}function Ewe({blocks:e}){return y.jsx("div",{className:"tool-result-structured",children:e.map((t,n)=>t.type==="text"?y.jsx("div",{className:"tool-result-text",children:t.format==="markdown"?y.jsx(Xi,{content:t.text}):y.jsx("div",{className:"tool-result-text-content",children:t.text})},`text-${n}`):y.jsxs("div",{className:"tool-result-image-wrapper",children:[y.jsx("img",{className:"tool-result-image",src:t.src,alt:t.alt??"",width:t.width,height:t.height}),t.title!=null&&t.title.length>0&&y.jsx("div",{className:"tool-result-image-caption",children:t.title})]},`image-${n}`))})}function $we({item:e,resultItem:t}){const{t:n}=Ot(),r=t!=null?_we(t.content):null;return y.jsxs("div",{className:"tool-group",children:[y.jsx(_o,{header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"build"}),y.jsx("span",{className:"tool-header-title",children:e.name}),y.jsx("span",{className:"tool-header-hint",children:n("chat.tools.call")})]}),content:y.jsx("div",{className:"tool-content",children:y.jsx(wo,{code:ra(e.input!=null?e.input:{},2),lang:"json"})})}),t!=null&&y.jsx(_o,{type:"result",isError:t.is_error,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:t.is_error===!0?"error":"check_circle"}),y.jsx("span",{className:"tool-header-title",children:n("chat.result")})]}),content:y.jsx("div",{className:"tool-content",children:r!=null?y.jsx(Ewe,{blocks:r}):typeof t.content=="string"?t.content.startsWith("```")?y.jsx(Xi,{content:t.content}):y.jsx(wo,{code:t.content,lang:"text"}):y.jsx(wo,{code:ra(t.content,2),lang:"json"})})})]})}function Y1(e,t){const n=t==null?void 0:t.namespace,r=Object.entries(e).flatMap(([o,i])=>{const a=[[o,i]];return n&&a.push([`${n}${o}`,i]),a});return Object.fromEntries(r)}const a4=({item:e,resultItem:t})=>{const{t:n}=Ot(),r=e.input!=null?e.input:{},o=r.command??"",i=r.description!=null&&r.description!==""?r.description:r.reason!=null&&r.reason!==""?r.reason:r.thought!=null&&r.thought!==""?r.thought:"",a=r.timeout,s=r.run_in_background,l=r.dangerouslyDisableSandbox,c=i.replaceAll(`
|
|
501
501
|
`," ").replace(/\s+/g," ").trim(),d=o.split(`
|
|
502
502
|
`)[0]??"",f=o.trim()!==d.trim(),m=f||d.length>80,[p,h]=u.useState(!1);return y.jsx("div",{className:"tool-group bash-tool",children:y.jsx(_o,{defaultExpanded:!0,type:t!=null?"result":"call",isError:(t==null?void 0:t.is_error)??!1,header:y.jsxs("div",{className:"bash-tool__header",children:[y.jsx("span",{className:"material-symbols-rounded bash-tool__icon",children:"terminal"}),y.jsxs("div",{className:"bash-tool__header-main",children:[y.jsx("div",{className:"bash-tool__reason-row",children:y.jsx("span",{className:"bash-tool__reason-text tool-header-hint",children:c!==""?c:d})}),c!==""&&y.jsx("div",{className:"bash-tool__command-row",children:y.jsxs("span",{className:`bash-tool__command-text tool-header-mono${m?" bash-tool__command-text--clickable":""}`,title:m?n("chat.tools.viewCommand"):void 0,onClick:b=>{m&&(b.stopPropagation(),h(x=>!x))},children:[d,f?" …":""]})})]}),y.jsxs("div",{className:"bash-tool__header-tags",children:[typeof a=="number"&&Number.isFinite(a)&&y.jsxs("span",{className:"tool-icon-tag",title:`${n("chat.tools.timeout")}: ${a}ms`,children:[y.jsx("span",{className:"material-symbols-rounded tool-icon-tag__icon",children:"timer"}),y.jsx("span",{className:"tool-icon-tag__text",children:a%1e3===0?`${a/1e3}s`:`${a}ms`})]}),s===!0&&y.jsx("span",{className:"tool-icon-tag",title:n("chat.tools.runInBackground"),children:y.jsx("span",{className:"material-symbols-rounded tool-icon-tag__icon",children:"schedule"})}),l===!0&&y.jsx("span",{className:"tool-icon-tag",title:n("chat.tools.dangerouslyDisableSandbox"),children:y.jsx("span",{className:"material-symbols-rounded tool-icon-tag__icon",children:"shield_lock"})})]})]}),content:y.jsxs("div",{className:"tool-content",children:[p&&y.jsx("div",{className:"bash-tool__command-detail",children:y.jsx("div",{className:"tool-code-wrapper",children:y.jsx(wo,{code:o,lang:"shell",hideHeader:!0})})}),y.jsx("div",{className:"tool-scroll",children:y.jsx("div",{className:"tool-code-wrapper",children:t?typeof t.content=="string"?y.jsx(wo,{code:t.content,lang:"text",hideHeader:!0}):y.jsx(wo,{code:ra(t.content,2),lang:"json",hideHeader:!0}):y.jsx("div",{className:"tool-placeholder",children:n("chat.result")})})})]})})})};function Q1({content:e,removeRoot:t=!1,defaultCollapsed:n=!1}){const r=u.useMemo(()=>{let d=[];if(Array.isArray(e))d=e;else if(typeof e=="string")if(e.trim().startsWith("[")&&e.trim().endsWith("]"))try{const m=JSON.parse(e);Array.isArray(m)?d=m.map(String):d=e.split(`
|
|
503
503
|
`)}catch{d=e.split(`
|
|
504
504
|
`)}else d=e.split(`
|
|
505
505
|
`);d=d.filter(m=>m.trim()!=="");let f=[];if(d.forEach(m=>{var g;const p=((g=m.match(/^\s*/))==null?void 0:g[0].length)||0,h=Math.floor(p/2);let b=m.trim();b.startsWith("- ")&&(b=b.substring(2));const x=b.endsWith("/")||b.endsWith("\\");f.push({rawLine:m,name:b,path:b,depth:h,isDir:x})}),t&&f.length>1&&f[0].isDir&&f[1].depth>f[0].depth){f[0].depth,f.shift();const m=Math.min(...f.map(p=>p.depth));f=f.map(p=>({...p,depth:p.depth-m}))}return f},[e,t]),[o,i]=u.useState(new Set),a=u.useMemo(()=>r.some(d=>d.isDir),[r]);u.useEffect(()=>{if(n){const d=new Set;r.forEach((f,m)=>{f.isDir&&d.add(m)}),i(d)}else i(new Set)},[r,n]);const s=d=>{const f=new Set(o);f.has(d)?f.delete(d):f.add(d),i(f)};if(r.length===0)return y.jsx("div",{className:"file-list-empty",children:"No files found"});const l=d=>{var m;if(d.isDir)return{name:"folder",className:"folder"};const f=(m=d.name.split(".").pop())==null?void 0:m.toLowerCase();return f&&["ts","tsx","js","jsx","py","java","c","cpp","go","rs"].includes(f)?{name:"code",className:"file"}:f&&["md","txt","json","yml","yaml","xml","html","css","scss"].includes(f)?{name:"description",className:"file"}:f&&["png","jpg","jpeg","gif","svg","ico"].includes(f)?{name:"image",className:"file"}:{name:"draft",className:"file"}},c=()=>{const d=[];let f=null;return r.forEach((m,p)=>{if(f!==null){if(m.depth>f)return;f=null}const h=l(m),b=o.has(p);b&&(f=m.depth),d.push(y.jsxs("div",{className:`file-list-item ${m.isDir?"is-dir":""}`,style:{paddingLeft:`${m.depth*20+12}px`},onClick:()=>m.isDir&&s(p),children:[a&&y.jsxs(y.Fragment,{children:[m.isDir&&y.jsx("span",{className:"material-symbols-rounded toggle-icon",children:b?"arrow_right":"arrow_drop_down"}),!m.isDir&&y.jsx("span",{className:"spacer"})]}),y.jsx("span",{className:`material-symbols-rounded file-icon ${h.className}`,children:h.name}),y.jsx("span",{className:"file-path",children:m.name})]},p))}),d};return y.jsx("div",{className:"file-list-container",children:c()})}function s4(e){const t=e!=null&&e!==""?e:"unknown file",n=t.lastIndexOf("/"),r=n>=0?t.slice(n+1):t,o=n>=0?t.slice(0,n):"";return{filePath:t,fileName:r,dirPath:o}}function l4(e){const t=e.split(".").pop(),n=t!=null&&t!==""?t.toLowerCase():"";return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",md:"markdown",json:"json",scss:"scss",css:"css",html:"html",sh:"bash",yml:"yaml",yaml:"yaml",sql:"sql"}[n]||"text"}function c4(e){if(Array.isArray(e))return e.map(String);if(typeof e!="string")return[];const t=e.trim();if(t.startsWith("[")&&t.endsWith("]"))try{const n=JSON.parse(t);if(Array.isArray(n))return n.map(String)}catch{return e.split(`
|
|
506
506
|
`)}return e.split(`
|
|
507
|
-
`)}const
|
|
507
|
+
`)}const kwe=({item:e,resultItem:t})=>{const n=e.input!=null?e.input:{},r=n.pattern!=null&&n.pattern!==""?n.pattern:"*",o=n.path,i=u.useMemo(()=>t?c4(t.content).filter(l=>l.trim()!=="").length:null,[t]);return y.jsx("div",{className:"tool-group glob-tool",children:y.jsx(_o,{header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"search"}),y.jsx("span",{className:"tool-header-title",children:"Glob"}),y.jsx("span",{className:"tool-header-secondary",children:r}),i!==null&&y.jsxs("span",{className:"tool-header-chip",children:[i," files"]})]}),content:y.jsxs("div",{className:"tool-content",children:[o&&y.jsx("div",{className:"tool-input-grid",children:y.jsxs("div",{className:"tool-input-item",children:[y.jsx("span",{className:"tool-input-label",children:"Path"}),y.jsx("span",{className:"tool-input-value",children:o})]})}),t?y.jsx("div",{className:"result-content",children:y.jsx(Q1,{content:typeof t.content=="string"?t.content:ra(t.content)})}):y.jsx("div",{className:"tool-placeholder",children:"Searching..."})]})})})},Nwe=({item:e,resultItem:t})=>{const n=e.input!=null?e.input:{},r=n.pattern!=null&&n.pattern!==""?n.pattern:"",o=n.path,i=n.output_mode||"files_with_matches",a=n.glob,s=u.useMemo(()=>t?c4(t.content).filter(d=>d.trim()!=="").length:null,[t]);return y.jsx("div",{className:"tool-group grep-tool",children:y.jsx(_o,{header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"find_in_page"}),y.jsx("span",{className:"tool-header-title",children:"Grep"}),y.jsx("span",{className:"tool-header-secondary",children:r}),s!==null&&y.jsxs("span",{className:"tool-header-chip",children:[s," matches"]})]}),content:y.jsxs("div",{className:"tool-content",children:[y.jsxs("div",{className:"tool-input-grid",children:[o&&y.jsxs("div",{className:"tool-input-item",children:[y.jsx("span",{className:"tool-input-label",children:"Path"}),y.jsx("span",{className:"tool-input-value",children:o})]}),a&&y.jsxs("div",{className:"tool-input-item",children:[y.jsx("span",{className:"tool-input-label",children:"Glob"}),y.jsx("span",{className:"tool-input-value",children:a})]}),y.jsxs("div",{className:"tool-input-item",children:[y.jsx("span",{className:"tool-input-label",children:"Mode"}),y.jsx("span",{className:"tool-input-value",children:i})]})]}),t?y.jsx("div",{className:"result-content",children:i==="files_with_matches"?y.jsx(Q1,{content:typeof t.content=="string"?t.content:ra(t.content)}):y.jsx(wo,{code:typeof t.content=="string"?t.content:ra(t.content,2),lang:"text"})}):y.jsx("div",{className:"tool-placeholder",children:"Searching..."})]})})})},Owe=({item:e,resultItem:t})=>{const n=e.input!=null?e.input:{},r=n.path!=null&&n.path!==""?n.path:"current directory",o=n.ignore,i=l=>{if(typeof l!="string")return!1;const c=l.split(`
|
|
508
508
|
`).filter(d=>d.trim());return!(c.length>0&&c[0].includes("drwxr"))},a=l=>{const c=l.split(`
|
|
509
|
-
`).filter(d=>d.trim()!=="");return c.length>0&&c.pop(),c},s=u.useMemo(()=>!t||typeof t.content!="string"||!i(t.content)?null:a(t.content).length,[t]);return y.jsx("div",{className:"tool-group ls-tool",children:y.jsx(_o,{header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"folder_open"}),y.jsx("span",{className:"tool-header-title",children:"LS"}),y.jsx("span",{className:"tool-header-secondary",children:r}),s!==null&&y.jsxs("span",{className:"tool-header-chip",children:[s," files"]})]}),content:y.jsxs("div",{className:"tool-content",children:[o&&o.length>0&&y.jsx("div",{className:"tool-input-grid",children:y.jsxs("div",{className:"tool-input-item",children:[y.jsx("span",{className:"tool-input-label",children:"Ignore"}),y.jsx("span",{className:"tool-input-value",children:JSON.stringify(o)})]})}),t?y.jsx("div",{className:"result-content",children:i(t.content)?y.jsx(Q1,{content:a(t.content),removeRoot:!0,defaultCollapsed:!0}):y.jsx(wo,{code:typeof t.content=="string"?t.content:ra(t.content,2),lang:"text"})}):y.jsx("div",{className:"tool-placeholder",children:"Listing files..."})]})})})},
|
|
509
|
+
`).filter(d=>d.trim()!=="");return c.length>0&&c.pop(),c},s=u.useMemo(()=>!t||typeof t.content!="string"||!i(t.content)?null:a(t.content).length,[t]);return y.jsx("div",{className:"tool-group ls-tool",children:y.jsx(_o,{header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"folder_open"}),y.jsx("span",{className:"tool-header-title",children:"LS"}),y.jsx("span",{className:"tool-header-secondary",children:r}),s!==null&&y.jsxs("span",{className:"tool-header-chip",children:[s," files"]})]}),content:y.jsxs("div",{className:"tool-content",children:[o&&o.length>0&&y.jsx("div",{className:"tool-input-grid",children:y.jsxs("div",{className:"tool-input-item",children:[y.jsx("span",{className:"tool-input-label",children:"Ignore"}),y.jsx("span",{className:"tool-input-value",children:JSON.stringify(o)})]})}),t?y.jsx("div",{className:"result-content",children:i(t.content)?y.jsx(Q1,{content:a(t.content),removeRoot:!0,defaultCollapsed:!0}):y.jsx(wo,{code:typeof t.content=="string"?t.content:ra(t.content,2),lang:"text"})}):y.jsx("div",{className:"tool-placeholder",children:"Listing files..."})]})})})},Iwe=({item:e,resultItem:t})=>{const{t:n}=Ot(),r=e.input!=null?e.input:{},{filePath:o}=s4(r.file_path),i=l4(o),a=r.offset,s=r.limit,l=c=>typeof c!="string"?ra(c,2):c.split(`
|
|
510
510
|
`).filter(d=>/^\s*\d+→/.test(d)).map(d=>d.replace(/^\s*\d+→/,"")).join(`
|
|
511
|
-
`);return y.jsx("div",{className:"tool-group read-tool",children:y.jsx(_o,{header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"visibility"}),y.jsx("span",{className:"tool-header-primary tool-header-mono tool-header-row-text",children:o}),typeof a=="number"&&Number.isFinite(a)&&y.jsxs("span",{className:"tool-header-chip",children:[n("chat.tools.offset"),":",a]}),typeof s=="number"&&Number.isFinite(s)&&y.jsxs("span",{className:"tool-header-chip",children:[n("chat.tools.limit"),":",s]})]}),content:y.jsx("div",{className:"tool-content",children:t?y.jsx("div",{className:"result-content",children:y.jsx(wo,{code:l(t.content),lang:i,hideHeader:!0})}):y.jsx("div",{className:"tool-placeholder",children:n("chat.tools.reading")})})})})},
|
|
512
|
-
`)[0]||""}:{title:""}}function
|
|
513
|
-
`))??"").trim(),[f]);return u.useEffect(()=>{m(n??[])},[n]),u.useEffect(()=>{h(t)},[t]),u.useEffect(()=>{if(!r)return;const k=Ca.connect(r,{onMessage(E){var $,O;if(E.type==="message"){const R=E.message;if(R.id&&b.current.has(R.id))return;R.id&&b.current.add(R.id);const T=zwe(R);T!==""&&m(I=>[...I,T])}else if(E.type==="session_updated"&&(($=E.session)==null?void 0:$.id)===r){const R=(O=E.session)==null?void 0:O.status;R&&h(R)}}});return()=>{k==null||k()}},[r]),y.jsxs("div",{className:"task-row",children:[y.jsxs("div",{className:"task-row__header",children:[y.jsxs("div",{className:"task-row__left",children:[y.jsx("span",{className:`material-symbols-rounded task-row__status-icon ${p??"help_outline"}`,children:Dwe(p)}),a&&y.jsx("span",{className:`material-symbols-rounded task-row__execution-icon ${C}`,title:_,children:S?"desktop_windows":"schedule"})]}),y.jsx("span",{className:"task-row__title",children:g}),w&&y.jsx("button",{type:"button",className:"task-row__session-link",onClick:()=>d(`/session/${r}`),children:r}),v.length>0&&y.jsx("div",{className:"task-row__meta",children:v.map(k=>y.jsx("span",{className:"task-row__meta-chip",children:k},k))})]}),N!==""&&y.jsx("div",{className:"task-row__logs",children:y.jsx(Xi,{content:N})})]})}function zwe(e){return typeof e.content=="string"?e.content:Array.isArray(e.content)?e.content.map(t=>t.type==="text"?t.text:"").join(""):""}const Bwe=({item:e,resultItem:t})=>{const{t:n}=Ot(),o=(e.input!=null?e.input:{}).taskId,i=u.useMemo(()=>{if(!(t!=null&&t.content))return null;const l=t.content[0].text.trim();return JSON.parse(l)[0]??null},[t==null?void 0:t.content]),a=i?(()=>{const{exitCode:l,...c}=i;return[c.adapter,c.type==="default"?void 0:c.type,c.name,c.status,l!=null?n("chat.tools.taskExitCode",{code:l}):void 0,c.background===!1?n("chat.tools.startTasksForeground"):c.background===!0?n("chat.tools.startTasksBackground"):void 0]})():[],s=n("chat.tools.task");return y.jsx("div",{className:"tool-group get-task-info-tool",children:y.jsx(_o,{defaultExpanded:!0,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"info"}),y.jsx("span",{className:"tool-header-title",children:n("chat.tools.getTaskInfo")}),y.jsx("span",{className:"tool-header-chip",children:i?1:0})]}),content:y.jsx("div",{className:"tool-content",children:i?(()=>{const{taskId:l,exitCode:c,...d}=i;return y.jsx(Z1,{description:d.description,status:d.status,background:d.background,sessionId:l||o,logs:d.logs,titleFallback:s,metaChips:a,showExecutionIcon:!1})})():y.jsx("div",{className:"get-task-info-tool__empty",children:n("chat.tools.startTasksEmpty")})})})})},Fwe=({resultItem:e})=>{const{t}=Ot(),n=u.useMemo(()=>{if(!(e!=null&&e.content))return[];const r=e.content[0].text.trim();return JSON.parse(r)},[e==null?void 0:e.content]);return y.jsx("div",{className:"tool-group list-tasks-tool",children:y.jsx(_o,{defaultExpanded:!0,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"list_alt"}),y.jsx("span",{className:"tool-header-title",children:t("chat.tools.listTasks")}),y.jsx("span",{className:"tool-header-chip",children:n.length})]}),content:y.jsx("div",{className:"tool-content",children:y.jsxs("div",{className:"list-tasks-tool__list",children:[n.map(r=>{const{taskId:o,exitCode:i,...a}=r,s=[a.adapter,a.type==="default"?void 0:a.type,a.name,a.status,i!=null?t("chat.tools.taskExitCode",{code:i}):void 0,a.background===!1?t("chat.tools.startTasksForeground"):a.background===!0?t("chat.tools.startTasksBackground"):void 0];return y.jsx(Z1,{description:a.description,status:a.status,background:a.background,sessionId:o,logs:a.logs,titleFallback:t("chat.tools.task"),metaChips:s,showExecutionIcon:!1},o)}),n.length===0&&y.jsx("div",{className:"list-tasks-tool__empty",children:t("chat.tools.listTasksEmpty")})]})})})})},Hwe=({item:e,resultItem:t})=>{const{t:n}=Ot(),r=e.input!=null?e.input:{},o=Array.isArray(r.tasks)?r.tasks:[],i=u.useMemo(()=>{if(!(t!=null&&t.content))return{taskResults:null};const s=t.content[0].text.trim();return{taskResults:JSON.parse(s)}},[t==null?void 0:t.content]),{taskResults:a}=i;return y.jsx("div",{className:"tool-group start-tasks-tool",children:y.jsx(_o,{defaultExpanded:!0,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"playlist_add"}),y.jsx("span",{className:"tool-header-title",children:n("chat.tools.startTasks")}),y.jsx("span",{className:"tool-header-chip",children:o.length})]}),content:y.jsx("div",{className:"tool-content",children:y.jsxs("div",{className:"start-tasks-tool__list",children:[o.map((s,l)=>{const{description:c,type:d,name:f,adapter:m,background:p}=s,{status:h,taskId:b,logs:x=[]}=(a==null?void 0:a[l])??{},g=[m,d==="default"?void 0:d,f];return y.jsx(Z1,{description:c,status:h,background:p,sessionId:b,logs:x,titleFallback:n("chat.tools.startTasks"),metaChips:g,showExecutionIcon:!0,foregroundLabel:n("chat.tools.startTasksForeground"),backgroundLabel:n("chat.tools.startTasksBackground")},l)}),o.length===0&&y.jsx("div",{className:"start-tasks-tool__empty",children:n("chat.tools.startTasksEmpty")})]})})})})},Vwe=Y1({StartTasks:Hwe,GetTaskInfo:Bwe,ListTasks:Fwe},{namespace:"mcp__VibeForge__"}),Wwe={...Vwe,...Rwe,...Awe};function Tc({item:e,resultItem:t}){const n=e.name,o=Wwe[n]??Tc.findRendererByInput(e)??_we;return y.jsx(o,{item:e,resultItem:t})}Tc.findRendererByInput=e=>{const t=e.input;return t!=null&&typeof t=="object"&&"command"in t&&("description"in t&&t.description!=null||"reason"in t&&t.reason!=null)?a4:null};function jC({msg:e,isUser:t}){const{message:n}=Eo.useApp();return y.jsxs("div",{className:"msg-footer",children:[t&&e.model!=null&&y.jsx("span",{className:"msg-model",children:e.model.split(",").pop()}),t&&e.usage!=null&&y.jsxs("span",{className:"msg-usage",children:["Tokens: ",e.usage.input_tokens+e.usage.output_tokens]}),y.jsx("span",{className:"timestamp",onDoubleClick:()=>{console.log("Debug Message:",e),navigator.clipboard.writeText(new Date(e.createdAt).toISOString()),n.success("ISO 时间已复制到剪贴板")},title:"双击复制 ISO 时间 (控制台打印消息结构)",children:new Date(e.createdAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})})]})}function Kwe({msg:e,isFirstInGroup:t}){const n=e.role==="user",o=e.content==null?null:typeof e.content=="string"?y.jsx(Xi,{content:e.content}):!Array.isArray(e.content)||!(e.content.some(a=>a.type==="text"||a.type==="image")||e.toolCall!=null)?null:y.jsxs("div",{className:"message-contents",children:[e.content.map((a,s)=>a.type==="text"?y.jsx(Xi,{content:a.text},s):a.type==="image"?y.jsx("a",{className:"message-image",href:a.url,target:"_blank",rel:"noreferrer",children:y.jsx("img",{src:a.url,alt:a.name??"image"})},s):null),e.toolCall!=null&&y.jsx(Tc,{item:{type:"tool_use",id:e.toolCall.id??"legacy",name:e.toolCall.name,input:e.toolCall.args},resultItem:e.toolCall.output!=null?{type:"tool_result",tool_use_id:e.toolCall.id??"legacy",content:e.toolCall.output,is_error:e.toolCall.status==="error"}:void 0})]});return o==null?null:y.jsx("div",{className:`${n?"chat-message-user":"chat-message-assistant"} ${t?"":"consecutive"}`,children:y.jsxs("div",{className:"message-body-container",children:[y.jsx("div",{className:"bubble",children:o}),y.jsx(jC,{msg:e,isUser:n})]})})}const Uwe=(e,t)=>e.isFirstInGroup===t.isFirstInGroup&&e.msg.id===t.msg.id&&e.msg.role===t.msg.role&&e.msg.createdAt===t.msg.createdAt&&e.msg.model===t.msg.model&&e.msg.content===t.msg.content&&e.msg.toolCall===t.msg.toolCall&&e.msg.usage===t.msg.usage,Gwe=J.memo(Kwe,Uwe);function qwe(e){var i;const t=[],n=(a,s,l)=>{for(let c=s;c<l.length;c++){const d=l[c];if(Array.isArray(d.content)){const f=d.content.find(m=>m.type==="tool_result"&&m.tool_use_id===a);if(f)return f}}};let r=0;for(;r<e.length;){const a=e[r];if(!a||!a.content){a&&a.toolCall&&t.push({type:"message",message:a,isFirstInGroup:r===0||r>0&&((i=e[r-1])==null?void 0:i.role)!==a.role}),r++;continue}const s=r>0?e[r-1]:null,l=r===0||s!=null&&s.role!==a.role;if(typeof a.content=="string"){t.push({type:"message",message:a,isFirstInGroup:l}),r++;continue}if(Array.isArray(a.content)){const c=a.content,d=[];let f=[],m=0;const p=()=>{f.length>0&&(t.push({type:"tool-group",id:`group-${a.id}-${m}`,items:[...f],footer:void 0}),f=[],m++)},h=()=>{d.length>0&&(t.push({type:"message",message:{...a,id:`${a.id}-text-${m}`,content:[...d]},isFirstInGroup:l&&m===0}),d.length=0,m++)};for(const b of c)if(b.type==="text"||b.type==="image")p(),d.push(b);else if(b.type==="tool_use"){h();const x=n(b.id,r,e);f.push({item:b,resultItem:x})}if(h(),p(),m===0&&a.toolCall&&(t.push({type:"message",message:a,isFirstInGroup:l}),m++),m>0){const b=t[t.length-1];b.type==="tool-group"&&(b.footer={model:a.model,usage:a.usage,createdAt:a.createdAt,originalMessage:a})}}r++}const o=[];for(const a of t){if(a.type==="tool-group"){const s=o[o.length-1];if(s&&s.type==="tool-group"){s.items.push(...a.items),a.footer&&(s.footer=a.footer);continue}}o.push(a)}return o}function Xwe({items:e,onSelect:t,selectedIndex:n}){const r=u.useRef(null);return u.useEffect(()=>{var i;const o=(i=r.current)==null?void 0:i.querySelector(".active");o&&o.scrollIntoView({block:"nearest"})},[n]),e.length===0?null:y.jsx("div",{ref:r,className:"completion-menu",children:y.jsx("div",{className:"completion-menu-content",children:e.map((o,i)=>y.jsxs("div",{className:`completion-item ${i===n?"active":""}`,onClick:()=>t(o),children:[o.icon!=null&&o.icon!==""&&y.jsx("span",{className:"material-symbols-rounded icon",children:o.icon}),y.jsxs("div",{className:"item-info",children:[y.jsx("span",{className:"label",children:o.label}),o.description!=null&&o.description!==""&&y.jsx("span",{className:"description",children:o.description})]})]},o.value))})})}function Ywe(){const{t:e}=Ot();return y.jsxs("div",{className:"chat-thinking-status",children:[y.jsx("div",{className:"dot-flashing"}),y.jsx("span",{children:e("chat.thinking")})]})}const{TextArea:Qwe}=Ft,Zwe=e=>{const t=e.split("__");return t[t.length-1]||e},Jwe=e=>e==="chrome-devtools"?"web_traffic":"memory";function e_e({onSend:e,onSendContent:t,adapterLocked:n=!1,sessionStatus:r,onInterrupt:o,onClear:i,sessionInfo:a,connectionError:s,onRetryConnection:l,interactionRequest:c,onInteractionResponse:d,placeholder:f,modelOptions:m,selectedModel:p,onModelChange:h,effort:b,effortOptions:x,onEffortChange:g,permissionMode:v,permissionModeOptions:S,onPermissionModeChange:C,selectedAdapter:_,adapterOptions:w,onAdapterChange:N,modelUnavailable:k}){var _e,je,Fe,Ze,bt,$t,Le;const{t:E}=Ot(),{message:$}=Eo.useApp(),[O,R]=u.useState(""),[T,I]=u.useState(!1),[P,j]=u.useState([]),[L,D]=u.useState(0),[z,M]=u.useState(null),[H,F]=u.useState(!1),A=u.useRef(null),B=u.useRef(null),K=navigator.platform.includes("Mac"),[W,q]=u.useState([]),{data:U}=Qn("/api/config"),te=(Fe=(je=(_e=U==null?void 0:U.sources)==null?void 0:_e.merged)==null?void 0:je.shortcuts)==null?void 0:Fe.sendMessage,le=($t=(bt=(Ze=U==null?void 0:U.sources)==null?void 0:Ze.merged)==null?void 0:bt.shortcuts)==null?void 0:$t.clearInput,ie=te!=null&&te.trim()!==""?te:"mod+enter",ee=r==="running",se=_==="codex"||_==="claude-code"||_==="opencode",re=a!=null&&a.type==="init"?[{key:"chrome-devtools",label:E("chat.toolGroupChromeDevtools"),tools:a.tools.filter(ve=>ve.startsWith("mcp__ChromeDevtools__"))},{key:"system",label:E("chat.toolGroupSystem"),tools:a.tools.filter(ve=>!ve.startsWith("mcp__ChromeDevtools__"))}].filter(ve=>ve.tools.length>0):[],Z=a!=null&&a.type==="init"?(a.assetDiagnostics??[]).filter(ve=>ve.status==="skipped"):[],X=a!=null&&a.type==="init"?a.selectionWarnings??[]:[],ce=re.map(ve=>({value:ve.key,label:y.jsxs("span",{className:"sender-tool-group-option",children:[y.jsx("span",{className:"sender-tool-group-option__icon material-symbols-rounded",children:Jwe(ve.key)}),y.jsx("span",{className:"sender-tool-group-option__text",children:ve.label}),y.jsx("span",{className:"sender-tool-group-option__count",children:ve.tools.length})]}),children:ve.tools.map(Pe=>({value:Pe,label:y.jsxs("span",{className:"sender-tool-option",children:[y.jsx("span",{className:"sender-tool-option__dot"}),y.jsx("span",{className:"sender-tool-option__text",children:Zwe(Pe)})]})}))})),[pe,ge]=u.useState(-1),[we,ae]=u.useState(""),de=ve=>{const Pe=ve.reason==="excluded"?E("chat.selectionWarningReasonExcluded"):E("chat.selectionWarningReasonNotIncluded");return E("chat.selectionWarningFallback",{adapter:ve.adapter,requestedModel:ve.requestedModel,resolvedModel:ve.resolvedModel,reason:Pe})},ue=ve=>new Promise((Pe,Te)=>{const He=new FileReader;He.onload=()=>{Pe(typeof He.result=="string"?He.result:"")},He.onerror=()=>{Te(new Error("read_failed"))},He.readAsDataURL(ve)}),me=async ve=>{for(const Te of ve)if(Te.type.startsWith("image/")){if(Te.size>5242880){$.error(E("chat.imageTooLarge"));continue}try{const He=await ue(Te);if(He===""){$.error(E("chat.imageReadFailed"));continue}q(Xe=>{var qe;return[...Xe,{id:(qe=globalThis.crypto)!=null&&qe.randomUUID?globalThis.crypto.randomUUID():`img-${Date.now()}-${Math.random().toString(16).slice(2)}`,url:He,name:Te.name,size:Te.size,mimeType:Te.type}]})}catch{$.error(E("chat.imageReadFailed"))}}},Ce=()=>{if(!ee&&!(O.trim()===""&&W.length===0)){if(k){$.warning(E("chat.modelConfigRequired"));return}if(c!=null&&d!=null){if(W.length>0){$.warning(E("chat.imageNotSupportedInInteraction"));return}d(c.id,O.trim()),R("");return}if(W.length>0){const ve=[];O.trim()!==""&&ve.push({type:"text",text:O.trim()}),ve.push(...W.map(Pe=>({type:"image",url:Pe.url,name:Pe.name,size:Pe.size,mimeType:Pe.mimeType}))),t(ve)}else e(O);try{const ve=JSON.parse(localStorage.getItem("vf_chat_history")??"[]"),Pe=[O,...ve.filter(Te=>Te!==O)].slice(0,50);localStorage.setItem("vf_chat_history",JSON.stringify(Pe))}catch(ve){console.error("Failed to save chat history",ve)}R(""),q([]),ae(""),I(!1),ge(-1)}},ne=()=>{var ve;if(!ee){if(k){$.warning(E("chat.modelConfigRequired"));return}if(c!=null){$.warning(E("chat.imageNotSupportedInInteraction"));return}(ve=B.current)==null||ve.click()}},he=async ve=>{const Pe=Array.from(ve.target.files??[]);Pe.length!==0&&(await me(Pe),ve.target.value="")},ye=ve=>{q(Pe=>Pe.filter(Te=>Te.id!==ve))},xe=async ve=>{var He;const Te=Array.from(((He=ve.clipboardData)==null?void 0:He.items)??[]).filter(Xe=>Xe.kind==="file"&&Xe.type.startsWith("image/")).map(Xe=>Xe.getAsFile()).filter(Xe=>Xe!=null);Te.length>0&&(ve.preventDefault(),await me(Te))},$e=()=>{O!==""&&(R(""),ge(-1))},Se=ve=>{try{const Pe=JSON.parse(localStorage.getItem("vf_chat_history")??"[]");if(Pe.length===0)return;let Te=pe;if(ve==="up"?Te=Math.min(pe+1,Pe.length-1):Te=Math.max(pe-1,-1),Te!==pe){pe===-1&&ae(O),ge(Te);const He=Te===-1?we:Pe[Te];R(He),setTimeout(()=>{var Xe,qe;if(((qe=(Xe=A.current)==null?void 0:Xe.resizableTextArea)==null?void 0:qe.textArea)!=null){const De=A.current.resizableTextArea.textArea,tt=He.length;De.setSelectionRange(tt,tt),De.focus()}},0)}}catch(Pe){console.error("Failed to navigate chat history",Pe)}},be=ve=>{var De,tt;if(z==null||((tt=(De=A.current)==null?void 0:De.resizableTextArea)==null?void 0:tt.textArea)==null)return;const Te=A.current.resizableTextArea.textArea.selectionStart,He=O.slice(0,O.lastIndexOf(z,Te-1)),Xe=O.slice(Te),qe=`${He}${z}${ve.value} ${Xe}`;R(qe),I(!1),setTimeout(()=>{var nt,ze;if(((ze=(nt=A.current)==null?void 0:nt.resizableTextArea)==null?void 0:ze.textArea)!=null){const Ie=A.current.resizableTextArea.textArea,Re=He.length+z.length+ve.value.length+1;Ie.focus(),Ie.setSelectionRange(Re,Re)}},0)},ke=ve=>{var nt,ze;if(((ze=(nt=A.current)==null?void 0:nt.resizableTextArea)==null?void 0:ze.textArea)==null)return;const Te=A.current.resizableTextArea.textArea.selectionStart,He=O.slice(0,Te),Xe=O.slice(Te),De=He.length>0&&!He.endsWith(" ")?` ${ve}`:ve,tt=He+De+Xe;R(tt),setTimeout(()=>{var Ie,Re;if(((Re=(Ie=A.current)==null?void 0:Ie.resizableTextArea)==null?void 0:Re.textArea)!=null){const We=A.current.resizableTextArea.textArea,lt=Te+De.length;We.focus(),We.setSelectionRange(lt,lt),Me({target:We})}},0)},Oe=ve=>{if(aC(ve,ie,K)){ve.preventDefault(),Ce();return}if(le!=null&&le.trim()!==""&&aC(ve,le,K)){ve.preventDefault(),$e();return}if(T){if(ve.key==="ArrowDown"){ve.preventDefault(),D(Pe=>(Pe+1)%P.length);return}if(ve.key==="ArrowUp"){ve.preventDefault(),D(Pe=>(Pe-1+P.length)%P.length);return}if(ve.key==="Enter"||ve.key==="Tab"){ve.preventDefault();const Pe=P[L];Pe!=null&&be(Pe);return}if(ve.key==="Escape"){ve.preventDefault(),I(!1);return}}if(ve.key==="ArrowUp"){const Pe=ve.target,Te=Pe.selectionStart;if(!Pe.value.substring(0,Te).includes(`
|
|
511
|
+
`);return y.jsx("div",{className:"tool-group read-tool",children:y.jsx(_o,{header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"visibility"}),y.jsx("span",{className:"tool-header-primary tool-header-mono tool-header-row-text",children:o}),typeof a=="number"&&Number.isFinite(a)&&y.jsxs("span",{className:"tool-header-chip",children:[n("chat.tools.offset"),":",a]}),typeof s=="number"&&Number.isFinite(s)&&y.jsxs("span",{className:"tool-header-chip",children:[n("chat.tools.limit"),":",s]})]}),content:y.jsx("div",{className:"tool-content",children:t?y.jsx("div",{className:"result-content",children:y.jsx(wo,{code:l(t.content),lang:i,hideHeader:!0})}):y.jsx("div",{className:"tool-placeholder",children:n("chat.tools.reading")})})})})},Rwe=({item:e})=>{const{t}=Ot(),r=(e.input!=null?e.input:{}).todos??[],o=r.length,i=r.filter(l=>l.status==="completed").length,a=r.filter(l=>l.status==="in_progress").length,s=o-i-a;return y.jsx("div",{className:"tool-group todo-tool",children:y.jsx(_o,{defaultExpanded:!0,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"task_alt"}),y.jsx("span",{className:"tool-header-title",children:t("chat.tools.todo")}),o>0&&y.jsxs("span",{className:"tool-header-chip",children:[o," total"]}),a>0&&y.jsxs("span",{className:"tool-header-chip",children:[a," doing"]}),s>0&&y.jsxs("span",{className:"tool-header-chip",children:[s," todo"]}),i>0&&y.jsxs("span",{className:"tool-header-chip",children:[i," done"]})]}),content:y.jsx("div",{className:"tool-content",children:r.map((l,c)=>y.jsxs("div",{className:`todo-item ${l.status}`,children:[y.jsx("span",{className:"material-symbols-rounded status-icon",children:l.status==="completed"?"check_circle":l.status==="in_progress"?"clock_loader_40":"radio_button_unchecked"}),y.jsxs("div",{className:"todo-info",children:[y.jsx("span",{className:"todo-text",children:l.content}),l.activeForm!=null&&l.activeForm!==""&&l.status==="in_progress"&&y.jsx("span",{className:"active-form",children:l.activeForm})]})]},c))})})})},Pwe=({item:e,resultItem:t})=>{const n=e.input!=null?e.input:{},{filePath:r}=s4(n.file_path),o=n.content??"",i=l4(r);return y.jsx("div",{className:"tool-group write-tool",children:y.jsx(_o,{defaultExpanded:!1,header:y.jsxs("div",{className:"write-tool__header",children:[y.jsxs("div",{className:"write-tool__header-left",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"edit_note"}),y.jsx("span",{className:"tool-header-primary tool-header-mono tool-header-row-text",children:r})]}),t!=null&&y.jsx("span",{className:`write-tool__status-icon ${t.is_error?"error":"success"}`,children:y.jsx("span",{className:"material-symbols-rounded",children:t.is_error===!0?"error":"check_circle"})})]}),content:y.jsx("div",{className:"tool-content",children:y.jsx("div",{className:"tool-scroll",children:y.jsx("div",{className:"tool-code-wrapper",children:y.jsx(wo,{code:o,lang:i,showLineNumbers:!0})})})})})})},Twe=Y1({Bash:a4,LS:Owe,Glob:kwe,Grep:Nwe,Read:Iwe,Write:Pwe,TodoWrite:Rwe},{namespace:"adapter:claude-code:"}),jwe=e=>e.startsWith("mcp__ChromeDevtools__")?e.replace("mcp__ChromeDevtools__",""):e,Mwe=({item:e,resultItem:t})=>{const{t:n}=Ot(),r=jwe(e.name),o=e.input!=null?e.input:{};return y.jsxs("div",{className:"tool-group chrome-devtools-tool",children:[y.jsx(_o,{defaultExpanded:!0,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("i",{className:"tool-header-icon chrome-devtools-tool__icon devicon-chrome-plain colored"}),y.jsx("span",{className:"tool-header-title",children:r}),y.jsx("span",{className:"tool-header-hint",children:n("chat.tools.call")})]}),content:y.jsx("div",{className:"tool-content",children:y.jsx(wo,{code:ra(o,2),lang:"json"})})}),t!=null&&y.jsx(_o,{type:"result",isError:t.is_error,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:t.is_error===!0?"error":"check_circle"}),y.jsx("span",{className:"tool-header-title",children:n("chat.result")})]}),content:y.jsx("div",{className:"tool-content",children:typeof t.content=="string"?y.jsx(wo,{code:t.content,lang:"text"}):y.jsx(wo,{code:ra(t.content,2),lang:"json"})})})]})},Awe=["mcp__ChromeDevtools__click","mcp__ChromeDevtools__close_page","mcp__ChromeDevtools__drag","mcp__ChromeDevtools__emulate","mcp__ChromeDevtools__evaluate_script","mcp__ChromeDevtools__fill","mcp__ChromeDevtools__fill_form","mcp__ChromeDevtools__get_console_message","mcp__ChromeDevtools__get_network_request","mcp__ChromeDevtools__handle_dialog","mcp__ChromeDevtools__hover","mcp__ChromeDevtools__list_console_messages","mcp__ChromeDevtools__list_network_requests","mcp__ChromeDevtools__list_pages","mcp__ChromeDevtools__navigate_page","mcp__ChromeDevtools__new_page","mcp__ChromeDevtools__performance_analyze_insight","mcp__ChromeDevtools__performance_start_trace","mcp__ChromeDevtools__performance_stop_trace","mcp__ChromeDevtools__press_key","mcp__ChromeDevtools__resize_page","mcp__ChromeDevtools__select_page","mcp__ChromeDevtools__take_memory_snapshot","mcp__ChromeDevtools__take_screenshot","mcp__ChromeDevtools__take_snapshot","mcp__ChromeDevtools__type_text","mcp__ChromeDevtools__upload_file","mcp__ChromeDevtools__wait_for"],Lwe=Awe.reduce((e,t)=>(e[t]=Mwe,e),{}),Dwe=Y1(Lwe);function zwe(e){return e?{title:e.split(`
|
|
512
|
+
`)[0]||""}:{title:""}}function Bwe(e){switch(e){case"running":return"play_circle";case"completed":return"check_circle";case"failed":return"error";default:return"help_outline"}}function Z1({description:e,status:t,logs:n,sessionId:r,titleFallback:o,metaChips:i,showExecutionIcon:a,background:s,foregroundLabel:l,backgroundLabel:c}){const d=Ts(),[f,m]=u.useState(n??[]),[p,h]=u.useState(t),b=u.useRef(new Set),{title:x}=zwe(e),g=x||o||"",v=(i??[]).filter(k=>!!k),S=s===!1,C=S?"task-row__execution-icon--foreground":"task-row__execution-icon--background",_=S?l:c,w=r!=null&&r!=="",N=u.useMemo(()=>((f==null?void 0:f.join(`
|
|
513
|
+
`))??"").trim(),[f]);return u.useEffect(()=>{m(n??[])},[n]),u.useEffect(()=>{h(t)},[t]),u.useEffect(()=>{if(!r)return;const k=Ca.connect(r,{onMessage(E){var $,O;if(E.type==="message"){const R=E.message;if(R.id&&b.current.has(R.id))return;R.id&&b.current.add(R.id);const T=Fwe(R);T!==""&&m(I=>[...I,T])}else if(E.type==="session_updated"&&(($=E.session)==null?void 0:$.id)===r){const R=(O=E.session)==null?void 0:O.status;R&&h(R)}}});return()=>{k==null||k()}},[r]),y.jsxs("div",{className:"task-row",children:[y.jsxs("div",{className:"task-row__header",children:[y.jsxs("div",{className:"task-row__left",children:[y.jsx("span",{className:`material-symbols-rounded task-row__status-icon ${p??"help_outline"}`,children:Bwe(p)}),a&&y.jsx("span",{className:`material-symbols-rounded task-row__execution-icon ${C}`,title:_,children:S?"desktop_windows":"schedule"})]}),y.jsx("span",{className:"task-row__title",children:g}),w&&y.jsx("button",{type:"button",className:"task-row__session-link",onClick:()=>d(`/session/${r}`),children:r}),v.length>0&&y.jsx("div",{className:"task-row__meta",children:v.map(k=>y.jsx("span",{className:"task-row__meta-chip",children:k},k))})]}),N!==""&&y.jsx("div",{className:"task-row__logs",children:y.jsx(Xi,{content:N})})]})}function Fwe(e){return typeof e.content=="string"?e.content:Array.isArray(e.content)?e.content.map(t=>t.type==="text"?t.text:"").join(""):""}const Hwe=({item:e,resultItem:t})=>{const{t:n}=Ot(),o=(e.input!=null?e.input:{}).taskId,i=u.useMemo(()=>{if(!(t!=null&&t.content))return null;const l=t.content[0].text.trim();return JSON.parse(l)[0]??null},[t==null?void 0:t.content]),a=i?(()=>{const{exitCode:l,...c}=i;return[c.adapter,c.type==="default"?void 0:c.type,c.name,c.status,l!=null?n("chat.tools.taskExitCode",{code:l}):void 0,c.background===!1?n("chat.tools.startTasksForeground"):c.background===!0?n("chat.tools.startTasksBackground"):void 0]})():[],s=n("chat.tools.task");return y.jsx("div",{className:"tool-group get-task-info-tool",children:y.jsx(_o,{defaultExpanded:!0,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"info"}),y.jsx("span",{className:"tool-header-title",children:n("chat.tools.getTaskInfo")}),y.jsx("span",{className:"tool-header-chip",children:i?1:0})]}),content:y.jsx("div",{className:"tool-content",children:i?(()=>{const{taskId:l,exitCode:c,...d}=i;return y.jsx(Z1,{description:d.description,status:d.status,background:d.background,sessionId:l||o,logs:d.logs,titleFallback:s,metaChips:a,showExecutionIcon:!1})})():y.jsx("div",{className:"get-task-info-tool__empty",children:n("chat.tools.startTasksEmpty")})})})})},Vwe=({resultItem:e})=>{const{t}=Ot(),n=u.useMemo(()=>{if(!(e!=null&&e.content))return[];const r=e.content[0].text.trim();return JSON.parse(r)},[e==null?void 0:e.content]);return y.jsx("div",{className:"tool-group list-tasks-tool",children:y.jsx(_o,{defaultExpanded:!0,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"list_alt"}),y.jsx("span",{className:"tool-header-title",children:t("chat.tools.listTasks")}),y.jsx("span",{className:"tool-header-chip",children:n.length})]}),content:y.jsx("div",{className:"tool-content",children:y.jsxs("div",{className:"list-tasks-tool__list",children:[n.map(r=>{const{taskId:o,exitCode:i,...a}=r,s=[a.adapter,a.type==="default"?void 0:a.type,a.name,a.status,i!=null?t("chat.tools.taskExitCode",{code:i}):void 0,a.background===!1?t("chat.tools.startTasksForeground"):a.background===!0?t("chat.tools.startTasksBackground"):void 0];return y.jsx(Z1,{description:a.description,status:a.status,background:a.background,sessionId:o,logs:a.logs,titleFallback:t("chat.tools.task"),metaChips:s,showExecutionIcon:!1},o)}),n.length===0&&y.jsx("div",{className:"list-tasks-tool__empty",children:t("chat.tools.listTasksEmpty")})]})})})})},Wwe=({item:e,resultItem:t})=>{const{t:n}=Ot(),r=e.input!=null?e.input:{},o=Array.isArray(r.tasks)?r.tasks:[],i=u.useMemo(()=>{if(!(t!=null&&t.content))return{taskResults:null};const s=t.content[0].text.trim();return{taskResults:JSON.parse(s)}},[t==null?void 0:t.content]),{taskResults:a}=i;return y.jsx("div",{className:"tool-group start-tasks-tool",children:y.jsx(_o,{defaultExpanded:!0,header:y.jsxs("div",{className:"tool-header-content",children:[y.jsx("span",{className:"material-symbols-rounded tool-header-icon",children:"playlist_add"}),y.jsx("span",{className:"tool-header-title",children:n("chat.tools.startTasks")}),y.jsx("span",{className:"tool-header-chip",children:o.length})]}),content:y.jsx("div",{className:"tool-content",children:y.jsxs("div",{className:"start-tasks-tool__list",children:[o.map((s,l)=>{const{description:c,type:d,name:f,adapter:m,background:p}=s,{status:h,taskId:b,logs:x=[]}=(a==null?void 0:a[l])??{},g=[m,d==="default"?void 0:d,f];return y.jsx(Z1,{description:c,status:h,background:p,sessionId:b,logs:x,titleFallback:n("chat.tools.startTasks"),metaChips:g,showExecutionIcon:!0,foregroundLabel:n("chat.tools.startTasksForeground"),backgroundLabel:n("chat.tools.startTasksBackground")},l)}),o.length===0&&y.jsx("div",{className:"start-tasks-tool__empty",children:n("chat.tools.startTasksEmpty")})]})})})})},Kwe=Y1({StartTasks:Wwe,GetTaskInfo:Hwe,ListTasks:Vwe},{namespace:"mcp__VibeForge__"}),Uwe={...Kwe,...Twe,...Dwe};function Tc({item:e,resultItem:t}){const n=e.name,o=Uwe[n]??Tc.findRendererByInput(e)??$we;return y.jsx(o,{item:e,resultItem:t})}Tc.findRendererByInput=e=>{const t=e.input;return t!=null&&typeof t=="object"&&"command"in t&&("description"in t&&t.description!=null||"reason"in t&&t.reason!=null)?a4:null};function jC({msg:e,isUser:t}){const{message:n}=Eo.useApp();return y.jsxs("div",{className:"msg-footer",children:[t&&e.model!=null&&y.jsx("span",{className:"msg-model",children:e.model.split(",").pop()}),t&&e.usage!=null&&y.jsxs("span",{className:"msg-usage",children:["Tokens: ",e.usage.input_tokens+e.usage.output_tokens]}),y.jsx("span",{className:"timestamp",onDoubleClick:()=>{console.log("Debug Message:",e),navigator.clipboard.writeText(new Date(e.createdAt).toISOString()),n.success("ISO 时间已复制到剪贴板")},title:"双击复制 ISO 时间 (控制台打印消息结构)",children:new Date(e.createdAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})})]})}function Gwe({msg:e,isFirstInGroup:t}){const n=e.role==="user",o=e.content==null?null:typeof e.content=="string"?y.jsx(Xi,{content:e.content}):!Array.isArray(e.content)||!(e.content.some(a=>a.type==="text"||a.type==="image")||e.toolCall!=null)?null:y.jsxs("div",{className:"message-contents",children:[e.content.map((a,s)=>a.type==="text"?y.jsx(Xi,{content:a.text},s):a.type==="image"?y.jsx("a",{className:"message-image",href:a.url,target:"_blank",rel:"noreferrer",children:y.jsx("img",{src:a.url,alt:a.name??"image"})},s):null),e.toolCall!=null&&y.jsx(Tc,{item:{type:"tool_use",id:e.toolCall.id??"legacy",name:e.toolCall.name,input:e.toolCall.args},resultItem:e.toolCall.output!=null?{type:"tool_result",tool_use_id:e.toolCall.id??"legacy",content:e.toolCall.output,is_error:e.toolCall.status==="error"}:void 0})]});return o==null?null:y.jsx("div",{className:`${n?"chat-message-user":"chat-message-assistant"} ${t?"":"consecutive"}`,children:y.jsxs("div",{className:"message-body-container",children:[y.jsx("div",{className:"bubble",children:o}),y.jsx(jC,{msg:e,isUser:n})]})})}const qwe=(e,t)=>e.isFirstInGroup===t.isFirstInGroup&&e.msg.id===t.msg.id&&e.msg.role===t.msg.role&&e.msg.createdAt===t.msg.createdAt&&e.msg.model===t.msg.model&&e.msg.content===t.msg.content&&e.msg.toolCall===t.msg.toolCall&&e.msg.usage===t.msg.usage,Xwe=J.memo(Gwe,qwe);function Ywe(e){var i;const t=[],n=(a,s,l)=>{for(let c=s;c<l.length;c++){const d=l[c];if(Array.isArray(d.content)){const f=d.content.find(m=>m.type==="tool_result"&&m.tool_use_id===a);if(f)return f}}};let r=0;for(;r<e.length;){const a=e[r];if(!a||!a.content){a&&a.toolCall&&t.push({type:"message",message:a,isFirstInGroup:r===0||r>0&&((i=e[r-1])==null?void 0:i.role)!==a.role}),r++;continue}const s=r>0?e[r-1]:null,l=r===0||s!=null&&s.role!==a.role;if(typeof a.content=="string"){t.push({type:"message",message:a,isFirstInGroup:l}),r++;continue}if(Array.isArray(a.content)){const c=a.content,d=[];let f=[],m=0;const p=()=>{f.length>0&&(t.push({type:"tool-group",id:`group-${a.id}-${m}`,items:[...f],footer:void 0}),f=[],m++)},h=()=>{d.length>0&&(t.push({type:"message",message:{...a,id:`${a.id}-text-${m}`,content:[...d]},isFirstInGroup:l&&m===0}),d.length=0,m++)};for(const b of c)if(b.type==="text"||b.type==="image")p(),d.push(b);else if(b.type==="tool_use"){h();const x=n(b.id,r,e);f.push({item:b,resultItem:x})}if(h(),p(),m===0&&a.toolCall&&(t.push({type:"message",message:a,isFirstInGroup:l}),m++),m>0){const b=t[t.length-1];b.type==="tool-group"&&(b.footer={model:a.model,usage:a.usage,createdAt:a.createdAt,originalMessage:a})}}r++}const o=[];for(const a of t){if(a.type==="tool-group"){const s=o[o.length-1];if(s&&s.type==="tool-group"){s.items.push(...a.items),a.footer&&(s.footer=a.footer);continue}}o.push(a)}return o}function Qwe({items:e,onSelect:t,selectedIndex:n}){const r=u.useRef(null);return u.useEffect(()=>{var i;const o=(i=r.current)==null?void 0:i.querySelector(".active");o&&o.scrollIntoView({block:"nearest"})},[n]),e.length===0?null:y.jsx("div",{ref:r,className:"completion-menu",children:y.jsx("div",{className:"completion-menu-content",children:e.map((o,i)=>y.jsxs("div",{className:`completion-item ${i===n?"active":""}`,onClick:()=>t(o),children:[o.icon!=null&&o.icon!==""&&y.jsx("span",{className:"material-symbols-rounded icon",children:o.icon}),y.jsxs("div",{className:"item-info",children:[y.jsx("span",{className:"label",children:o.label}),o.description!=null&&o.description!==""&&y.jsx("span",{className:"description",children:o.description})]})]},o.value))})})}function Zwe(){const{t:e}=Ot();return y.jsxs("div",{className:"chat-thinking-status",children:[y.jsx("div",{className:"dot-flashing"}),y.jsx("span",{children:e("chat.thinking")})]})}const{TextArea:Jwe}=Ft,e_e=e=>{const t=e.split("__");return t[t.length-1]||e},t_e=e=>e==="chrome-devtools"?"web_traffic":"memory";function n_e({onSend:e,onSendContent:t,adapterLocked:n=!1,sessionStatus:r,onInterrupt:o,onClear:i,sessionInfo:a,connectionError:s,onRetryConnection:l,interactionRequest:c,onInteractionResponse:d,placeholder:f,modelOptions:m,selectedModel:p,onModelChange:h,effort:b,effortOptions:x,onEffortChange:g,permissionMode:v,permissionModeOptions:S,onPermissionModeChange:C,selectedAdapter:_,adapterOptions:w,onAdapterChange:N,modelUnavailable:k}){var _e,je,Fe,Ze,bt,$t,Le;const{t:E}=Ot(),{message:$}=Eo.useApp(),[O,R]=u.useState(""),[T,I]=u.useState(!1),[P,j]=u.useState([]),[L,D]=u.useState(0),[z,M]=u.useState(null),[H,F]=u.useState(!1),A=u.useRef(null),B=u.useRef(null),K=navigator.platform.includes("Mac"),[W,q]=u.useState([]),{data:U}=Qn("/api/config"),te=(Fe=(je=(_e=U==null?void 0:U.sources)==null?void 0:_e.merged)==null?void 0:je.shortcuts)==null?void 0:Fe.sendMessage,le=($t=(bt=(Ze=U==null?void 0:U.sources)==null?void 0:Ze.merged)==null?void 0:bt.shortcuts)==null?void 0:$t.clearInput,ie=te!=null&&te.trim()!==""?te:"mod+enter",ee=r==="running",se=_==="codex"||_==="claude-code"||_==="opencode",re=a!=null&&a.type==="init"?[{key:"chrome-devtools",label:E("chat.toolGroupChromeDevtools"),tools:a.tools.filter(ve=>ve.startsWith("mcp__ChromeDevtools__"))},{key:"system",label:E("chat.toolGroupSystem"),tools:a.tools.filter(ve=>!ve.startsWith("mcp__ChromeDevtools__"))}].filter(ve=>ve.tools.length>0):[],Z=a!=null&&a.type==="init"?(a.assetDiagnostics??[]).filter(ve=>ve.status==="skipped"):[],X=a!=null&&a.type==="init"?a.selectionWarnings??[]:[],ce=re.map(ve=>({value:ve.key,label:y.jsxs("span",{className:"sender-tool-group-option",children:[y.jsx("span",{className:"sender-tool-group-option__icon material-symbols-rounded",children:t_e(ve.key)}),y.jsx("span",{className:"sender-tool-group-option__text",children:ve.label}),y.jsx("span",{className:"sender-tool-group-option__count",children:ve.tools.length})]}),children:ve.tools.map(Pe=>({value:Pe,label:y.jsxs("span",{className:"sender-tool-option",children:[y.jsx("span",{className:"sender-tool-option__dot"}),y.jsx("span",{className:"sender-tool-option__text",children:e_e(Pe)})]})}))})),[pe,ge]=u.useState(-1),[we,ae]=u.useState(""),de=ve=>{const Pe=ve.reason==="excluded"?E("chat.selectionWarningReasonExcluded"):E("chat.selectionWarningReasonNotIncluded");return E("chat.selectionWarningFallback",{adapter:ve.adapter,requestedModel:ve.requestedModel,resolvedModel:ve.resolvedModel,reason:Pe})},ue=ve=>new Promise((Pe,Te)=>{const He=new FileReader;He.onload=()=>{Pe(typeof He.result=="string"?He.result:"")},He.onerror=()=>{Te(new Error("read_failed"))},He.readAsDataURL(ve)}),me=async ve=>{for(const Te of ve)if(Te.type.startsWith("image/")){if(Te.size>5242880){$.error(E("chat.imageTooLarge"));continue}try{const He=await ue(Te);if(He===""){$.error(E("chat.imageReadFailed"));continue}q(Xe=>{var qe;return[...Xe,{id:(qe=globalThis.crypto)!=null&&qe.randomUUID?globalThis.crypto.randomUUID():`img-${Date.now()}-${Math.random().toString(16).slice(2)}`,url:He,name:Te.name,size:Te.size,mimeType:Te.type}]})}catch{$.error(E("chat.imageReadFailed"))}}},Ce=()=>{if(!ee&&!(O.trim()===""&&W.length===0)){if(k){$.warning(E("chat.modelConfigRequired"));return}if(c!=null&&d!=null){if(W.length>0){$.warning(E("chat.imageNotSupportedInInteraction"));return}d(c.id,O.trim()),R("");return}if(W.length>0){const ve=[];O.trim()!==""&&ve.push({type:"text",text:O.trim()}),ve.push(...W.map(Pe=>({type:"image",url:Pe.url,name:Pe.name,size:Pe.size,mimeType:Pe.mimeType}))),t(ve)}else e(O);try{const ve=JSON.parse(localStorage.getItem("vf_chat_history")??"[]"),Pe=[O,...ve.filter(Te=>Te!==O)].slice(0,50);localStorage.setItem("vf_chat_history",JSON.stringify(Pe))}catch(ve){console.error("Failed to save chat history",ve)}R(""),q([]),ae(""),I(!1),ge(-1)}},ne=()=>{var ve;if(!ee){if(k){$.warning(E("chat.modelConfigRequired"));return}if(c!=null){$.warning(E("chat.imageNotSupportedInInteraction"));return}(ve=B.current)==null||ve.click()}},he=async ve=>{const Pe=Array.from(ve.target.files??[]);Pe.length!==0&&(await me(Pe),ve.target.value="")},ye=ve=>{q(Pe=>Pe.filter(Te=>Te.id!==ve))},xe=async ve=>{var He;const Te=Array.from(((He=ve.clipboardData)==null?void 0:He.items)??[]).filter(Xe=>Xe.kind==="file"&&Xe.type.startsWith("image/")).map(Xe=>Xe.getAsFile()).filter(Xe=>Xe!=null);Te.length>0&&(ve.preventDefault(),await me(Te))},$e=()=>{O!==""&&(R(""),ge(-1))},Se=ve=>{try{const Pe=JSON.parse(localStorage.getItem("vf_chat_history")??"[]");if(Pe.length===0)return;let Te=pe;if(ve==="up"?Te=Math.min(pe+1,Pe.length-1):Te=Math.max(pe-1,-1),Te!==pe){pe===-1&&ae(O),ge(Te);const He=Te===-1?we:Pe[Te];R(He),setTimeout(()=>{var Xe,qe;if(((qe=(Xe=A.current)==null?void 0:Xe.resizableTextArea)==null?void 0:qe.textArea)!=null){const De=A.current.resizableTextArea.textArea,tt=He.length;De.setSelectionRange(tt,tt),De.focus()}},0)}}catch(Pe){console.error("Failed to navigate chat history",Pe)}},be=ve=>{var De,tt;if(z==null||((tt=(De=A.current)==null?void 0:De.resizableTextArea)==null?void 0:tt.textArea)==null)return;const Te=A.current.resizableTextArea.textArea.selectionStart,He=O.slice(0,O.lastIndexOf(z,Te-1)),Xe=O.slice(Te),qe=`${He}${z}${ve.value} ${Xe}`;R(qe),I(!1),setTimeout(()=>{var nt,ze;if(((ze=(nt=A.current)==null?void 0:nt.resizableTextArea)==null?void 0:ze.textArea)!=null){const Ie=A.current.resizableTextArea.textArea,Re=He.length+z.length+ve.value.length+1;Ie.focus(),Ie.setSelectionRange(Re,Re)}},0)},ke=ve=>{var nt,ze;if(((ze=(nt=A.current)==null?void 0:nt.resizableTextArea)==null?void 0:ze.textArea)==null)return;const Te=A.current.resizableTextArea.textArea.selectionStart,He=O.slice(0,Te),Xe=O.slice(Te),De=He.length>0&&!He.endsWith(" ")?` ${ve}`:ve,tt=He+De+Xe;R(tt),setTimeout(()=>{var Ie,Re;if(((Re=(Ie=A.current)==null?void 0:Ie.resizableTextArea)==null?void 0:Re.textArea)!=null){const We=A.current.resizableTextArea.textArea,lt=Te+De.length;We.focus(),We.setSelectionRange(lt,lt),Me({target:We})}},0)},Oe=ve=>{if(aC(ve,ie,K)){ve.preventDefault(),Ce();return}if(le!=null&&le.trim()!==""&&aC(ve,le,K)){ve.preventDefault(),$e();return}if(T){if(ve.key==="ArrowDown"){ve.preventDefault(),D(Pe=>(Pe+1)%P.length);return}if(ve.key==="ArrowUp"){ve.preventDefault(),D(Pe=>(Pe-1+P.length)%P.length);return}if(ve.key==="Enter"||ve.key==="Tab"){ve.preventDefault();const Pe=P[L];Pe!=null&&be(Pe);return}if(ve.key==="Escape"){ve.preventDefault(),I(!1);return}}if(ve.key==="ArrowUp"){const Pe=ve.target,Te=Pe.selectionStart;if(!Pe.value.substring(0,Te).includes(`
|
|
514
514
|
`)){const Xe=localStorage.getItem("vf_chat_history"),qe=Xe!=null?JSON.parse(Xe):[],De=pe===-1?null:qe[pe];if(O.trim()===""||O===De){ve.preventDefault(),Se("up");return}}}if(ve.key==="ArrowDown"){const Pe=ve.target,Te=Pe.selectionEnd;if(!Pe.value.substring(Te).includes(`
|
|
515
|
-
`)){const Xe=localStorage.getItem("vf_chat_history"),qe=Xe!=null?JSON.parse(Xe):[],De=pe===-1?null:qe[pe];if(pe!==-1||O===De){ve.preventDefault(),Se("down");return}}}if(ve.key==="Escape"){O!==""&&(ve.preventDefault(),$e());return}if(ve.key==="l"&&(ve.metaKey||ve.ctrlKey)){ve.preventDefault(),R(""),ge(-1),i!=null?i():$.info("Clear screen is not supported in this context");return}ve.key==="Enter"&&(ve.metaKey||ve.ctrlKey)&&(ve.preventDefault(),Ce())},Me=ve=>{const Pe=ve.target.value;R(Pe);const Te=ve.target.selectionStart,He=Pe[Te-1];if(["/","@","#"].includes(He)){M(He);let Xe=[];if((a==null?void 0:a.type)==="init"){const qe=a;He==="/"?Xe=(qe.slashCommands!=null?qe.slashCommands:[]).map(De=>({label:`/${De}`,value:De,icon:"terminal"})):He==="@"?Xe=(qe.agents!=null?qe.agents:[]).map(De=>({label:`@${De}`,value:De,icon:"smart_toy"})):He==="#"&&(Xe=(qe.tools!=null?qe.tools:[]).map(De=>({label:`#${De}`,value:De,icon:"check_box"})))}Xe.length>0?(j(Xe),D(0),I(!0)):I(!1)}else T&&(Pe.includes(z??"")||I(!1))};return y.jsxs("div",{className:"chat-input-wrapper",children:[ee&&y.jsx(Ywe,{}),c!=null&&y.jsxs("div",{className:"interaction-panel",style:{display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",marginBottom:"10px",gap:"8px",padding:"8px",border:"1px solid var(--border-color)",borderRadius:"8px",backgroundColor:"var(--bg-color)"},children:[y.jsx("div",{className:"interaction-question",style:{fontWeight:"bold"},children:c.payload.question}),(Le=c.payload.options)==null?void 0:Le.map(ve=>y.jsxs(ct,{block:!0,style:{height:"auto",textAlign:"left",display:"block",padding:"8px 12px"},onClick:()=>d==null?void 0:d(c.id,ve.label),children:[y.jsx("div",{style:{fontWeight:500},children:ve.label}),ve.description&&y.jsx("div",{style:{fontSize:"12px",color:"var(--sub-text-color)",marginTop:"4px"},children:ve.description})]},ve.label))]}),y.jsxs("div",{className:"chat-input-container",children:[s&&s.trim()!==""&&y.jsxs("div",{className:"connection-error-banner",children:[y.jsxs("div",{className:"connection-error-content",children:[y.jsx("span",{className:"material-symbols-rounded",children:"error"}),y.jsxs("div",{className:"connection-error-copy",children:[y.jsx("div",{className:"connection-error-title",children:E("chat.connectionErrorTitle")}),y.jsx("div",{className:"connection-error-message",children:s})]})]}),y.jsx(ct,{size:"small",onClick:l,children:E("chat.retryConnection")})]}),k&&y.jsx("div",{className:"model-unavailable",children:E("chat.modelConfigRequired")}),W.length>0&&y.jsx("div",{className:"pending-images",children:W.map(ve=>y.jsxs("div",{className:"pending-image",children:[y.jsx("img",{src:ve.url,alt:ve.name??"image"}),y.jsx("div",{className:"pending-image-remove",onClick:()=>ye(ve.id),children:y.jsx("span",{className:"material-symbols-rounded",children:"close"})})]},ve.id))}),T&&y.jsx(Xwe,{items:P,selectedIndex:L,onSelect:be,onClose:()=>I(!1)}),y.jsx(Qwe,{ref:A,className:"chat-input-textarea",placeholder:f??(c==null?void 0:c.payload.question)??E("chat.inputPlaceholder"),value:O,onChange:Me,onKeyDown:Oe,onPaste:xe,autoSize:{minRows:1,maxRows:10},variant:"borderless",disabled:k}),y.jsxs("div",{className:"chat-input-toolbar",children:[y.jsx("input",{ref:B,type:"file",accept:"image/*",multiple:!0,onChange:he,className:"file-input-hidden"}),y.jsxs("div",{className:"toolbar-left",children:[y.jsx(dt,{title:"快捷指令",children:y.jsx("span",{children:y.jsx("div",{className:"toolbar-btn",onClick:()=>ke("/"),children:y.jsx("span",{className:"material-symbols-rounded",children:"terminal"})})})}),y.jsx(dt,{title:"提及代理",children:y.jsx("span",{children:y.jsx("div",{className:"toolbar-btn",onClick:()=>ke("@"),children:y.jsx("span",{className:"material-symbols-rounded",children:"smart_toy"})})})}),y.jsx(dt,{title:"注入上下文",children:y.jsx("span",{children:y.jsx("div",{className:"toolbar-btn",onClick:()=>ke("#"),children:y.jsx("span",{className:"material-symbols-rounded",children:"description"})})})}),y.jsx(dt,{title:"上传图片",children:y.jsx("span",{children:y.jsx("div",{className:"toolbar-btn",onClick:ne,children:y.jsx("span",{className:"material-symbols-rounded",children:"image"})})})}),a!=null&&a.type==="init"&&y.jsxs("div",{className:"session-info-toolbar",children:[X.length>0&&y.jsx(dt,{placement:"topLeft",title:y.jsxs("div",{className:"asset-warning-tooltip",children:[y.jsx("div",{className:"asset-warning-tooltip__title",children:E("chat.selectionWarningsTitle")}),X.slice(0,5).map((ve,Pe)=>y.jsx("div",{className:"asset-warning-tooltip__item",children:y.jsx("span",{children:de(ve)})},`${ve.adapter}:${ve.requestedModel}:${Pe}`)),X.length>5&&y.jsx("div",{className:"asset-warning-tooltip__more",children:E("chat.assetWarningsMore",{count:X.length-5})})]}),children:y.jsxs("div",{className:"info-item asset-warning-item",children:[y.jsx("span",{className:"info-item-leading",children:y.jsx("span",{className:"material-symbols-rounded",children:"warning"})}),y.jsx("span",{className:"info-text",children:E("chat.selectionWarningsCount",{count:X.length})})]})}),Z.length>0&&y.jsx(dt,{placement:"topLeft",title:y.jsxs("div",{className:"asset-warning-tooltip",children:[y.jsx("div",{className:"asset-warning-tooltip__title",children:E("chat.assetWarningsTitle")}),Z.slice(0,5).map(ve=>y.jsxs("div",{className:"asset-warning-tooltip__item",children:[y.jsx("code",{children:ve.assetId}),y.jsx("span",{children:ve.reason})]},ve.assetId)),Z.length>5&&y.jsx("div",{className:"asset-warning-tooltip__more",children:E("chat.assetWarningsMore",{count:Z.length-5})})]}),children:y.jsxs("div",{className:"info-item asset-warning-item",children:[y.jsx("span",{className:"info-item-leading",children:y.jsx("span",{className:"material-symbols-rounded",children:"warning"})}),y.jsx("span",{className:"info-text",children:E("chat.assetWarningsCount",{count:Z.length})})]})}),y.jsx(Eu,{open:H,options:ce,expandTrigger:"hover",placement:"topLeft",allowClear:!1,popupClassName:"sender-tools-cascader-popup",onOpenChange:F,onChange:()=>F(!1),children:y.jsxs("div",{className:`info-item ${H?"active":""}`,children:[y.jsx("span",{className:"info-item-leading",children:y.jsx("span",{className:"material-symbols-rounded",children:"build"})}),y.jsx("span",{className:"info-text",children:E("chat.toolsCount",{count:a.tools.length})}),y.jsx("span",{className:"material-symbols-rounded arrow-icon",children:"keyboard_arrow_up"})]})})]})]}),y.jsxs("div",{className:"toolbar-right",children:[w&&w.length>1&&y.jsx(Yn,{className:"adapter-select",classNames:{popup:{root:"adapter-select-popup"}},value:_,options:w,showSearch:!1,allowClear:!1,disabled:n||k||ee,onChange:ve=>N==null?void 0:N(ve),placeholder:E("chat.adapterSelectPlaceholder",{defaultValue:"Adapter"}),optionLabelProp:"label",popupMatchSelectWidth:!1}),y.jsx(Yn,{className:"model-select",classNames:{popup:{root:"model-select-popup"}},value:p,options:m??[],showSearch:!0,allowClear:!1,disabled:k||ee,onChange:ve=>h==null?void 0:h(ve),placeholder:E(k?"chat.modelUnavailable":"chat.modelSelectPlaceholder"),optionLabelProp:"displayLabel",filterOption:(ve,Pe)=>String((Pe==null?void 0:Pe.searchText)??"").toLowerCase().includes(ve.toLowerCase()),popupMatchSelectWidth:!1}),se&&y.jsx(Yn,{className:"effort-select",classNames:{popup:{root:"effort-select-popup"}},value:b,options:x,showSearch:!1,allowClear:!1,disabled:k||ee,onChange:ve=>g(ve),placeholder:"Effort",optionLabelProp:"label",popupMatchSelectWidth:!1}),y.jsx(Yn,{className:"permission-mode-select",classNames:{popup:{root:"permission-mode-select-popup"}},value:v,options:S,showSearch:!1,allowClear:!1,disabled:k||ee,onChange:ve=>C(ve),placeholder:"权限模式",optionLabelProp:"label",popupMatchSelectWidth:!1}),y.jsx("div",{className:`chat-send-btn ${O.trim()!==""&&!k?"active":""} ${ee?"thinking":""} ${k?"disabled":""}`,onClick:k?void 0:ee?o:Ce,children:y.jsx("span",{className:"material-symbols-rounded",children:ee?"stop_circle":"send"})})]})]})]}),y.jsx("div",{className:"chat-input-hint",children:E("chat.hint")})]})}function t_e({items:e,footer:t}){const{t:n}=Ot(),[r,o]=u.useState(!1);if(e.length===0)return null;if(e.length===1)return y.jsxs("div",{className:"tool-group-container",children:[y.jsx("div",{className:"tool-group-wrapper single-item",children:y.jsx(Tc,{item:e[0].item,resultItem:e[0].resultItem})}),t&&y.jsx("div",{className:"tool-group-footer-wrapper",children:y.jsx(jC,{msg:t.originalMessage,isUser:!1})})]});const i=e[e.length-1],a=e.slice(0,-1);return y.jsxs("div",{className:"tool-group-container",children:[y.jsxs("div",{className:"tool-group-wrapper card-style",children:[y.jsxs("div",{className:"tool-group-header",onClick:()=>o(!r),children:[y.jsxs("div",{className:"header-left",children:[y.jsx("span",{className:"material-symbols-rounded",children:"dataset"}),y.jsx("span",{children:n("chat.usedTools",{count:e.length})})]}),y.jsx("span",{className:"material-symbols-rounded expand-icon",children:r?"expand_less":"expand_more"})]}),r&&y.jsx("div",{className:"tool-group-list",children:a.map((s,l)=>y.jsx(Tc,{item:s.item,resultItem:s.resultItem},s.item.id||l))}),y.jsx("div",{className:"tool-group-last-item",children:y.jsx(Tc,{item:i.item,resultItem:i.resultItem})})]}),t&&y.jsx("div",{className:"tool-group-footer-wrapper",children:y.jsx(jC,{msg:t.originalMessage,isUser:!1})})]})}const n_e=(e,t)=>{if(e.items.length!==t.items.length)return!1;for(let n=0;n<e.items.length;n++)if(e.items[n].item!==t.items[n].item||e.items[n].resultItem!==t.items[n].resultItem)return!1;return e.footer==null&&t.footer==null?!0:e.footer==null||t.footer==null?!1:e.footer.originalMessage===t.footer.originalMessage&&e.footer.createdAt===t.footer.createdAt&&e.footer.model===t.footer.model&&e.footer.usage===t.footer.usage},r_e=J.memo(t_e,n_e);function o_e({isReady:e,messages:t,session:n,sessionInfo:r,connectionError:o,onRetryConnection:i,interactionRequest:a,onInteractionResponse:s,setMessages:l,onClearMessages:c,placeholder:d,modelOptions:f,selectedModel:m,modelForQuery:p,onModelChange:h,effort:b,effortOptions:x,onEffortChange:g,permissionMode:v,permissionModeOptions:S,onPermissionModeChange:C,selectedAdapter:_,adapterOptions:w,onAdapterChange:N,modelUnavailable:k,hasAvailableModels:E}){const{t:$}=Ot(),{messagesEndRef:O,messagesContainerRef:R,messagesContentRef:T,showScrollBottom:I,scrollToBottom:P}=hwe({messagesLength:t.length}),{isCreating:j,send:L,sendContent:D,interrupt:z,clearMessages:M}=vwe({session:n,modelForQuery:p,hasAvailableModels:E,effort:b,permissionMode:v,adapter:_,onClearMessages:c}),H=u.useRef(!1),F=W=>{var U;return{id:(U=globalThis.crypto)!=null&&U.randomUUID?globalThis.crypto.randomUUID():`local-${Date.now()}-${Math.random().toString(16).slice(2)}`,role:"user",content:W,createdAt:Date.now()}},A=async W=>{if(!(n!=null&&n.id)){const U=F(W);l(le=>[...le,U]),await L(W)||l(le=>le.filter(ie=>ie.id!==U.id));return}await L(W)&&l(U=>[...U,F(W)])},B=async W=>{if(!(n!=null&&n.id)){const U=F(W);l(le=>[...le,U]),await D(W)||l(le=>le.filter(ie=>ie.id!==U.id));return}await D(W)&&l(U=>[...U,F(W)])};u.useEffect(()=>{H.current=!1},[n==null?void 0:n.id]),u.useEffect(()=>{!H.current&&e&&(P("auto"),H.current=!0)},[e,t.length,P]),u.useEffect(()=>{I||P("auto")},[t.length,P,I]);const K=u.useMemo(()=>qwe(t),[t]);return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`chat-messages ${e?"ready":""}`,ref:R,children:[y.jsxs("div",{className:"chat-messages-content",ref:T,children:[!(n!=null&&n.id)&&j&&y.jsxs("div",{className:"chat-pending-session-banner",children:[y.jsx("span",{className:"material-symbols-rounded",children:"hourglass_top"}),y.jsx("span",{children:$("common.creatingChat")})]}),K.map((W,q)=>W.type==="message"?y.jsx(Gwe,{msg:W.message,isFirstInGroup:W.isFirstInGroup},W.message.id||q):W.type==="tool-group"?y.jsx(r_e,{items:W.items,footer:W.footer},W.id||`group-${q}`):null),y.jsx("div",{ref:O})]}),I&&y.jsx("div",{className:"scroll-bottom-btn",onClick:()=>P(),children:y.jsx("span",{className:"material-symbols-rounded",children:"arrow_downward"})})]}),!(n!=null&&n.id)&&t.length===0&&y.jsx("div",{className:"new-session-guide-wrapper",children:y.jsx(bwe,{})}),y.jsx(ywe,{messages:t}),y.jsx("div",{className:"sender-container",children:y.jsx(e_e,{onSend:A,onSendContent:B,adapterLocked:(n==null?void 0:n.id)!=null,sessionStatus:j?"running":n==null?void 0:n.status,onInterrupt:z,onClear:M,sessionInfo:r,connectionError:o,onRetryConnection:i,interactionRequest:a,onInteractionResponse:s,placeholder:d,modelOptions:f,selectedModel:m,onModelChange:h,effort:b,effortOptions:x,onEffortChange:g,permissionMode:v,permissionModeOptions:S,onPermissionModeChange:C,selectedAdapter:_,adapterOptions:w,onAdapterChange:N,modelUnavailable:k})})]})}function i_e({session:e,onClose:t}){return y.jsx("div",{className:"chat-settings-panel",children:y.jsx(mwe,{sessionId:e.id,initialTitle:e.title,initialTags:e.tags,onClose:t})})}function a_e(e){return e.replace(/\W/g,"_")}function Jo(e){const[t,n,r]=e.split(":").map(Number);return(t||0)*3600+(n||0)*60+(r||0)}function gc(e){const[t,n,r]=e.split(":"),o=i=>{const a=Number.parseInt(i??"0",10);return Number.isFinite(a)?`${a}`.padStart(2,"0"):"00"};return`${o(t)}:${o(n)}:${o(r)}`}function pP(){let e=0;return t=>`${t}_${e++}`}function s_e(e,t){const n=pP(),r=pP(),o=[],i=[],a="";let s=0;const l=()=>(s+=1,a.repeat(s)),c=h=>{o.push(h)},d=h=>{const b=[{start:h.startTime,end:h.endTime}],x=h.events??[],g=x.findIndex(_=>_.type==="tool__AskUserQuestion");if(g<0)return b;const v=x[g],S=Jo(v.startTime)<=Jo(v.endTime)?v.startTime:v.endTime,C=Jo(v.startTime)<=Jo(v.endTime)?v.endTime:v.startTime;return Jo(C)<=Jo(S)||(b[b.length-1]={start:b[b.length-1].start,end:S},b.push({start:C,end:h.endTime})),b},f=h=>{for(let b=0;b<h.length;b+=1){const x=h[b],{type:g,startTime:v,endTime:S}=x;switch(g){case"tool__StartTasks":{const{tasks:C={}}=x,_=r("section"),w=l();for(const[N,k]of Object.entries(C)){const E=d(k);E.forEach((O,R)=>{const T=n("task"),I=E.length>1?`${N} - ${R}`:N,P={id:T,label:N,payload:{kind:"task",name:N,task:k}};i.push({id:T,label:I,start:gc(O.start),end:gc(O.end),sectionId:_,sectionLabel:w,type:"task",interaction:P}),c(P)});const{events:$=[]}=k;$.length>0&&f($)}break}}}},m=n("main"),p=r("section");return i.push({id:m,label:t.ganttMainSection,start:gc(e.startTime),end:gc(e.endTime),sectionId:p,sectionLabel:t.ganttMainSection,type:"task"}),f(e.events??[]),{items:i,interactions:o}}function l_e(e){var r;const t=["gantt","dateFormat HH:mm:ss","axisFormat %H:%M:%S"],n=new Map;for(const o of e)n.has(o.sectionId)||n.set(o.sectionId,{label:o.sectionLabel,items:[]}),(r=n.get(o.sectionId))==null||r.items.push(o);for(const o of n.values()){t.push(o.label?`section ${o.label}`:"section");for(const i of o.items)i.end&&t.push(`${i.label} :${i.id}, ${i.start}, ${i.end}`)}return t.join(`
|
|
516
|
-
`)}function
|
|
517
|
-
`),interactions:n.interactions}}function gP(e){const{task:t,viewMode:n,className:r,style:o}=e,i=J.useRef(null),{t:a}=Ot(),s=J.useMemo(()=>({mainStart:a("chat.timeline.mainStart"),mainEnd:a("chat.timeline.mainEnd"),startTasks:a("chat.timeline.startTasks"),allTasksDone:a("chat.timeline.allTasksDone"),askUserQuestion:a("chat.timeline.askUserQuestion"),edit:a("chat.timeline.edit"),resumeTask:a("chat.timeline.resumeTask"),userPrompt:a("chat.timeline.userPrompt"),userAnswer:a("chat.timeline.userAnswer"),receiveReply:a("chat.timeline.receiveReply"),taskStart:a("chat.timeline.taskStart"),taskEnd:a("chat.timeline.taskEnd"),ganttTitle:a("chat.timeline.ganttTitle"),ganttMainSection:a("chat.timeline.ganttMainSection"),ganttTasksSection:a("chat.timeline.ganttTasksSection")}),[a]),l=J.useMemo(()=>n==="gantt"?
|
|
515
|
+
`)){const Xe=localStorage.getItem("vf_chat_history"),qe=Xe!=null?JSON.parse(Xe):[],De=pe===-1?null:qe[pe];if(pe!==-1||O===De){ve.preventDefault(),Se("down");return}}}if(ve.key==="Escape"){O!==""&&(ve.preventDefault(),$e());return}if(ve.key==="l"&&(ve.metaKey||ve.ctrlKey)){ve.preventDefault(),R(""),ge(-1),i!=null?i():$.info("Clear screen is not supported in this context");return}ve.key==="Enter"&&(ve.metaKey||ve.ctrlKey)&&(ve.preventDefault(),Ce())},Me=ve=>{const Pe=ve.target.value;R(Pe);const Te=ve.target.selectionStart,He=Pe[Te-1];if(["/","@","#"].includes(He)){M(He);let Xe=[];if((a==null?void 0:a.type)==="init"){const qe=a;He==="/"?Xe=(qe.slashCommands!=null?qe.slashCommands:[]).map(De=>({label:`/${De}`,value:De,icon:"terminal"})):He==="@"?Xe=(qe.agents!=null?qe.agents:[]).map(De=>({label:`@${De}`,value:De,icon:"smart_toy"})):He==="#"&&(Xe=(qe.tools!=null?qe.tools:[]).map(De=>({label:`#${De}`,value:De,icon:"check_box"})))}Xe.length>0?(j(Xe),D(0),I(!0)):I(!1)}else T&&(Pe.includes(z??"")||I(!1))};return y.jsxs("div",{className:"chat-input-wrapper",children:[ee&&y.jsx(Zwe,{}),c!=null&&y.jsxs("div",{className:"interaction-panel",style:{display:"flex",flexDirection:"column",maxHeight:"200px",overflowY:"auto",marginBottom:"10px",gap:"8px",padding:"8px",border:"1px solid var(--border-color)",borderRadius:"8px",backgroundColor:"var(--bg-color)"},children:[y.jsx("div",{className:"interaction-question",style:{fontWeight:"bold"},children:c.payload.question}),(Le=c.payload.options)==null?void 0:Le.map(ve=>y.jsxs(ct,{block:!0,style:{height:"auto",textAlign:"left",display:"block",padding:"8px 12px"},onClick:()=>d==null?void 0:d(c.id,ve.label),children:[y.jsx("div",{style:{fontWeight:500},children:ve.label}),ve.description&&y.jsx("div",{style:{fontSize:"12px",color:"var(--sub-text-color)",marginTop:"4px"},children:ve.description})]},ve.label))]}),y.jsxs("div",{className:"chat-input-container",children:[s&&s.trim()!==""&&y.jsxs("div",{className:"connection-error-banner",children:[y.jsxs("div",{className:"connection-error-content",children:[y.jsx("span",{className:"material-symbols-rounded",children:"error"}),y.jsxs("div",{className:"connection-error-copy",children:[y.jsx("div",{className:"connection-error-title",children:E("chat.connectionErrorTitle")}),y.jsx("div",{className:"connection-error-message",children:s})]})]}),y.jsx(ct,{size:"small",onClick:l,children:E("chat.retryConnection")})]}),k&&y.jsx("div",{className:"model-unavailable",children:E("chat.modelConfigRequired")}),W.length>0&&y.jsx("div",{className:"pending-images",children:W.map(ve=>y.jsxs("div",{className:"pending-image",children:[y.jsx("img",{src:ve.url,alt:ve.name??"image"}),y.jsx("div",{className:"pending-image-remove",onClick:()=>ye(ve.id),children:y.jsx("span",{className:"material-symbols-rounded",children:"close"})})]},ve.id))}),T&&y.jsx(Qwe,{items:P,selectedIndex:L,onSelect:be,onClose:()=>I(!1)}),y.jsx(Jwe,{ref:A,className:"chat-input-textarea",placeholder:f??(c==null?void 0:c.payload.question)??E("chat.inputPlaceholder"),value:O,onChange:Me,onKeyDown:Oe,onPaste:xe,autoSize:{minRows:1,maxRows:10},variant:"borderless",disabled:k}),y.jsxs("div",{className:"chat-input-toolbar",children:[y.jsx("input",{ref:B,type:"file",accept:"image/*",multiple:!0,onChange:he,className:"file-input-hidden"}),y.jsxs("div",{className:"toolbar-left",children:[y.jsx(dt,{title:"快捷指令",children:y.jsx("span",{children:y.jsx("div",{className:"toolbar-btn",onClick:()=>ke("/"),children:y.jsx("span",{className:"material-symbols-rounded",children:"terminal"})})})}),y.jsx(dt,{title:"提及代理",children:y.jsx("span",{children:y.jsx("div",{className:"toolbar-btn",onClick:()=>ke("@"),children:y.jsx("span",{className:"material-symbols-rounded",children:"smart_toy"})})})}),y.jsx(dt,{title:"注入上下文",children:y.jsx("span",{children:y.jsx("div",{className:"toolbar-btn",onClick:()=>ke("#"),children:y.jsx("span",{className:"material-symbols-rounded",children:"description"})})})}),y.jsx(dt,{title:"上传图片",children:y.jsx("span",{children:y.jsx("div",{className:"toolbar-btn",onClick:ne,children:y.jsx("span",{className:"material-symbols-rounded",children:"image"})})})}),a!=null&&a.type==="init"&&y.jsxs("div",{className:"session-info-toolbar",children:[X.length>0&&y.jsx(dt,{placement:"topLeft",title:y.jsxs("div",{className:"asset-warning-tooltip",children:[y.jsx("div",{className:"asset-warning-tooltip__title",children:E("chat.selectionWarningsTitle")}),X.slice(0,5).map((ve,Pe)=>y.jsx("div",{className:"asset-warning-tooltip__item",children:y.jsx("span",{children:de(ve)})},`${ve.adapter}:${ve.requestedModel}:${Pe}`)),X.length>5&&y.jsx("div",{className:"asset-warning-tooltip__more",children:E("chat.assetWarningsMore",{count:X.length-5})})]}),children:y.jsxs("div",{className:"info-item asset-warning-item",children:[y.jsx("span",{className:"info-item-leading",children:y.jsx("span",{className:"material-symbols-rounded",children:"warning"})}),y.jsx("span",{className:"info-text",children:E("chat.selectionWarningsCount",{count:X.length})})]})}),Z.length>0&&y.jsx(dt,{placement:"topLeft",title:y.jsxs("div",{className:"asset-warning-tooltip",children:[y.jsx("div",{className:"asset-warning-tooltip__title",children:E("chat.assetWarningsTitle")}),Z.slice(0,5).map(ve=>y.jsxs("div",{className:"asset-warning-tooltip__item",children:[y.jsx("code",{children:ve.assetId}),y.jsx("span",{children:ve.reason})]},ve.assetId)),Z.length>5&&y.jsx("div",{className:"asset-warning-tooltip__more",children:E("chat.assetWarningsMore",{count:Z.length-5})})]}),children:y.jsxs("div",{className:"info-item asset-warning-item",children:[y.jsx("span",{className:"info-item-leading",children:y.jsx("span",{className:"material-symbols-rounded",children:"warning"})}),y.jsx("span",{className:"info-text",children:E("chat.assetWarningsCount",{count:Z.length})})]})}),y.jsx(Eu,{open:H,options:ce,expandTrigger:"hover",placement:"topLeft",allowClear:!1,popupClassName:"sender-tools-cascader-popup",onOpenChange:F,onChange:()=>F(!1),children:y.jsxs("div",{className:`info-item ${H?"active":""}`,children:[y.jsx("span",{className:"info-item-leading",children:y.jsx("span",{className:"material-symbols-rounded",children:"build"})}),y.jsx("span",{className:"info-text",children:E("chat.toolsCount",{count:a.tools.length})}),y.jsx("span",{className:"material-symbols-rounded arrow-icon",children:"keyboard_arrow_up"})]})})]})]}),y.jsxs("div",{className:"toolbar-right",children:[w&&w.length>1&&y.jsx(Yn,{className:"adapter-select",classNames:{popup:{root:"adapter-select-popup"}},value:_,options:w,showSearch:!1,allowClear:!1,disabled:n||k||ee,onChange:ve=>N==null?void 0:N(ve),placeholder:E("chat.adapterSelectPlaceholder",{defaultValue:"Adapter"}),optionLabelProp:"label",popupMatchSelectWidth:!1}),y.jsx(Yn,{className:"model-select",classNames:{popup:{root:"model-select-popup"}},value:p,options:m??[],showSearch:!0,allowClear:!1,disabled:k||ee,onChange:ve=>h==null?void 0:h(ve),placeholder:E(k?"chat.modelUnavailable":"chat.modelSelectPlaceholder"),optionLabelProp:"displayLabel",filterOption:(ve,Pe)=>String((Pe==null?void 0:Pe.searchText)??"").toLowerCase().includes(ve.toLowerCase()),popupMatchSelectWidth:!1}),se&&y.jsx(Yn,{className:"effort-select",classNames:{popup:{root:"effort-select-popup"}},value:b,options:x,showSearch:!1,allowClear:!1,disabled:k||ee,onChange:ve=>g(ve),placeholder:"Effort",optionLabelProp:"label",popupMatchSelectWidth:!1}),y.jsx(Yn,{className:"permission-mode-select",classNames:{popup:{root:"permission-mode-select-popup"}},value:v,options:S,showSearch:!1,allowClear:!1,disabled:k||ee,onChange:ve=>C(ve),placeholder:"权限模式",optionLabelProp:"label",popupMatchSelectWidth:!1}),y.jsx("div",{className:`chat-send-btn ${O.trim()!==""&&!k?"active":""} ${ee?"thinking":""} ${k?"disabled":""}`,onClick:k?void 0:ee?o:Ce,children:y.jsx("span",{className:"material-symbols-rounded",children:ee?"stop_circle":"send"})})]})]})]}),y.jsx("div",{className:"chat-input-hint",children:E("chat.hint")})]})}function r_e({items:e,footer:t}){const{t:n}=Ot(),[r,o]=u.useState(!1);if(e.length===0)return null;if(e.length===1)return y.jsxs("div",{className:"tool-group-container",children:[y.jsx("div",{className:"tool-group-wrapper single-item",children:y.jsx(Tc,{item:e[0].item,resultItem:e[0].resultItem})}),t&&y.jsx("div",{className:"tool-group-footer-wrapper",children:y.jsx(jC,{msg:t.originalMessage,isUser:!1})})]});const i=e[e.length-1],a=e.slice(0,-1);return y.jsxs("div",{className:"tool-group-container",children:[y.jsxs("div",{className:"tool-group-wrapper card-style",children:[y.jsxs("div",{className:"tool-group-header",onClick:()=>o(!r),children:[y.jsxs("div",{className:"header-left",children:[y.jsx("span",{className:"material-symbols-rounded",children:"dataset"}),y.jsx("span",{children:n("chat.usedTools",{count:e.length})})]}),y.jsx("span",{className:"material-symbols-rounded expand-icon",children:r?"expand_less":"expand_more"})]}),r&&y.jsx("div",{className:"tool-group-list",children:a.map((s,l)=>y.jsx(Tc,{item:s.item,resultItem:s.resultItem},s.item.id||l))}),y.jsx("div",{className:"tool-group-last-item",children:y.jsx(Tc,{item:i.item,resultItem:i.resultItem})})]}),t&&y.jsx("div",{className:"tool-group-footer-wrapper",children:y.jsx(jC,{msg:t.originalMessage,isUser:!1})})]})}const o_e=(e,t)=>{if(e.items.length!==t.items.length)return!1;for(let n=0;n<e.items.length;n++)if(e.items[n].item!==t.items[n].item||e.items[n].resultItem!==t.items[n].resultItem)return!1;return e.footer==null&&t.footer==null?!0:e.footer==null||t.footer==null?!1:e.footer.originalMessage===t.footer.originalMessage&&e.footer.createdAt===t.footer.createdAt&&e.footer.model===t.footer.model&&e.footer.usage===t.footer.usage},i_e=J.memo(r_e,o_e);function a_e({isReady:e,messages:t,session:n,sessionInfo:r,connectionError:o,onRetryConnection:i,interactionRequest:a,onInteractionResponse:s,setMessages:l,onClearMessages:c,placeholder:d,modelOptions:f,selectedModel:m,modelForQuery:p,onModelChange:h,effort:b,effortOptions:x,onEffortChange:g,permissionMode:v,permissionModeOptions:S,onPermissionModeChange:C,selectedAdapter:_,adapterOptions:w,onAdapterChange:N,modelUnavailable:k,hasAvailableModels:E}){const{t:$}=Ot(),{messagesEndRef:O,messagesContainerRef:R,messagesContentRef:T,showScrollBottom:I,scrollToBottom:P}=vwe({messagesLength:t.length}),{isCreating:j,send:L,sendContent:D,interrupt:z,clearMessages:M}=bwe({session:n,modelForQuery:p,hasAvailableModels:E,effort:b,permissionMode:v,adapter:_,onClearMessages:c}),H=u.useRef(!1),F=W=>{var U;return{id:(U=globalThis.crypto)!=null&&U.randomUUID?globalThis.crypto.randomUUID():`local-${Date.now()}-${Math.random().toString(16).slice(2)}`,role:"user",content:W,createdAt:Date.now()}},A=async W=>{if(!(n!=null&&n.id)){const U=F(W);l(le=>[...le,U]),await L(W)||l(le=>le.filter(ie=>ie.id!==U.id));return}await L(W)&&l(U=>[...U,F(W)])},B=async W=>{if(!(n!=null&&n.id)){const U=F(W);l(le=>[...le,U]),await D(W)||l(le=>le.filter(ie=>ie.id!==U.id));return}await D(W)&&l(U=>[...U,F(W)])};u.useEffect(()=>{H.current=!1},[n==null?void 0:n.id]),u.useEffect(()=>{!H.current&&e&&(P("auto"),H.current=!0)},[e,t.length,P]),u.useEffect(()=>{I||P("auto")},[t.length,P,I]);const K=u.useMemo(()=>Ywe(t),[t]);return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:`chat-messages ${e?"ready":""}`,ref:R,children:[y.jsxs("div",{className:"chat-messages-content",ref:T,children:[!(n!=null&&n.id)&&j&&y.jsxs("div",{className:"chat-pending-session-banner",children:[y.jsx("span",{className:"material-symbols-rounded",children:"hourglass_top"}),y.jsx("span",{children:$("common.creatingChat")})]}),K.map((W,q)=>W.type==="message"?y.jsx(Xwe,{msg:W.message,isFirstInGroup:W.isFirstInGroup},W.message.id||q):W.type==="tool-group"?y.jsx(i_e,{items:W.items,footer:W.footer},W.id||`group-${q}`):null),y.jsx("div",{ref:O})]}),I&&y.jsx("div",{className:"scroll-bottom-btn",onClick:()=>P(),children:y.jsx("span",{className:"material-symbols-rounded",children:"arrow_downward"})})]}),!(n!=null&&n.id)&&t.length===0&&y.jsx("div",{className:"new-session-guide-wrapper",children:y.jsx(Swe,{})}),y.jsx(xwe,{messages:t}),y.jsx("div",{className:"sender-container",children:y.jsx(n_e,{onSend:A,onSendContent:B,adapterLocked:(n==null?void 0:n.id)!=null,sessionStatus:j?"running":n==null?void 0:n.status,onInterrupt:z,onClear:M,sessionInfo:r,connectionError:o,onRetryConnection:i,interactionRequest:a,onInteractionResponse:s,placeholder:d,modelOptions:f,selectedModel:m,onModelChange:h,effort:b,effortOptions:x,onEffortChange:g,permissionMode:v,permissionModeOptions:S,onPermissionModeChange:C,selectedAdapter:_,adapterOptions:w,onAdapterChange:N,modelUnavailable:k})})]})}function s_e({session:e,onClose:t}){return y.jsx("div",{className:"chat-settings-panel",children:y.jsx(hwe,{sessionId:e.id,initialTitle:e.title,initialTags:e.tags,onClose:t})})}function l_e(e){return e.replace(/\W/g,"_")}function Jo(e){const[t,n,r]=e.split(":").map(Number);return(t||0)*3600+(n||0)*60+(r||0)}function gc(e){const[t,n,r]=e.split(":"),o=i=>{const a=Number.parseInt(i??"0",10);return Number.isFinite(a)?`${a}`.padStart(2,"0"):"00"};return`${o(t)}:${o(n)}:${o(r)}`}function pP(){let e=0;return t=>`${t}_${e++}`}function c_e(e,t){const n=pP(),r=pP(),o=[],i=[],a="";let s=0;const l=()=>(s+=1,a.repeat(s)),c=h=>{o.push(h)},d=h=>{const b=[{start:h.startTime,end:h.endTime}],x=h.events??[],g=x.findIndex(_=>_.type==="tool__AskUserQuestion");if(g<0)return b;const v=x[g],S=Jo(v.startTime)<=Jo(v.endTime)?v.startTime:v.endTime,C=Jo(v.startTime)<=Jo(v.endTime)?v.endTime:v.startTime;return Jo(C)<=Jo(S)||(b[b.length-1]={start:b[b.length-1].start,end:S},b.push({start:C,end:h.endTime})),b},f=h=>{for(let b=0;b<h.length;b+=1){const x=h[b],{type:g,startTime:v,endTime:S}=x;switch(g){case"tool__StartTasks":{const{tasks:C={}}=x,_=r("section"),w=l();for(const[N,k]of Object.entries(C)){const E=d(k);E.forEach((O,R)=>{const T=n("task"),I=E.length>1?`${N} - ${R}`:N,P={id:T,label:N,payload:{kind:"task",name:N,task:k}};i.push({id:T,label:I,start:gc(O.start),end:gc(O.end),sectionId:_,sectionLabel:w,type:"task",interaction:P}),c(P)});const{events:$=[]}=k;$.length>0&&f($)}break}}}},m=n("main"),p=r("section");return i.push({id:m,label:t.ganttMainSection,start:gc(e.startTime),end:gc(e.endTime),sectionId:p,sectionLabel:t.ganttMainSection,type:"task"}),f(e.events??[]),{items:i,interactions:o}}function u_e(e){var r;const t=["gantt","dateFormat HH:mm:ss","axisFormat %H:%M:%S"],n=new Map;for(const o of e)n.has(o.sectionId)||n.set(o.sectionId,{label:o.sectionLabel,items:[]}),(r=n.get(o.sectionId))==null||r.items.push(o);for(const o of n.values()){t.push(o.label?`section ${o.label}`:"section");for(const i of o.items)i.end&&t.push(`${i.label} :${i.id}, ${i.start}, ${i.end}`)}return t.join(`
|
|
516
|
+
`)}function d_e(e,t){const{items:n,interactions:r}=c_e(e,t);return{code:u_e(n),interactions:r}}function f_e(e){if(e)return e.replace(/"/g,"'")}function m_e(e){return{normalizeCommitId:r=>r.replace(/\s+/g,"_"),allocateCommitId:r=>{let o=r,i=1;for(;e.has(o);)o=`${r}_${i}`,i+=1;return e.add(o),o}}}function mp(e,t){switch(t){case"tool__StartTasks":return e.startTasks;case"tool__AskUserQuestion":return e.askUserQuestion;case"tool__Edit":return e.edit;case"tool__ResumeTask":return e.resumeTask;case"user__Prompt":return e.userPrompt;default:return t}}function hP(e){switch(e.kind){case"merge":return e.target;case"branch":return e.name;default:return e.branch}}function p_e(e){return[...e].sort((t,n)=>{const r=Jo(t.time)-Jo(n.time);if(r!==0)return r;if(t.priority!==n.priority)return t.priority-n.priority;const o=hP(t),i=hP(n);return o!==i?o.localeCompare(i):t.seq-n.seq})}function h_e(e){const t=["gitGraph TB:"],n=new Set,r=new Set,{normalizeCommitId:o,allocateCommitId:i}=m_e(r),a=new Map,s=new Map,l=new Map,c=new Map;let d,f,m=0;const p=[],h=[],b=(O,R)=>{const T=f_e(R);return T?t.push(`commit id:"${O}" tag:"${T}"`):t.push(`commit id:"${O}"`),O},x=(O,R,T,I)=>{if(!d){d={id:O,branch:R,time:T,seq:I};return}const P=Jo(T)-Jo(d.time);(P>0||P===0&&I>d.seq)&&(d={id:O,branch:R,time:T,seq:I})},g=O=>{let R=O;for(;R;){const T=s.get(R);if(T)return{id:T,branch:l.get(T)??R};const I=c.get(R);if(!I||I===R)break;R=I}},v=O=>{if(O)return g(O);if(d)return{id:d.id,branch:d.branch}},S=(O,R,T,I)=>{const P=o(O),j=i(P);return T!=null&&T.branchName&&typeof T.priority=="number"?(p.push({kind:"commit",time:O,branch:T.branchName,commitId:j,action:R,priority:T.priority,seq:m++}),s.set(T.branchName,j),l.set(j,T.branchName),x(j,T.branchName,O,m-1),I&&h.push({id:j,label:R??j,payload:I}),j):(I&&h.push({id:j,label:R??j,payload:I}),b(j,R))},C=O=>{n.has(O)||(n.add(O),f=O,t.push(`branch ${O}`))},_=O=>{f=O,t.push(`checkout ${O}`)},w=(O,R,T,I)=>{const P=[];R&&P.push(`id:"${R}"`),T&&P.push(`tag:"${T}"`),t.push(`merge ${O} ${P.join(" ")}`),R&&(I!=null&&I.branchName)&&I.time&&typeof I.seq=="number"&&(s.set(I.branchName,R),l.set(R,I.branchName),x(R,I.branchName,I.time,I.seq))},N=(O,R,T,I)=>{p.push({kind:"branch",time:O,baseBranch:R,name:T,priority:I,seq:m++})},k=(O,R,T,I,P,j)=>{const L=o(O),D=i(L);return p.push({kind:"merge",time:O,target:R,source:T,action:I,mergeId:D,priority:P,seq:m++}),j&&h.push({id:D,label:I,payload:j}),D},E="main";return{get curBranch(){return f},labels:e,lines:t,ops:p,interactions:h,commit:b,branch:C,checkout:_,merge:w,addCommit:S,addBranch:N,addMerge:k,ensureBranch:O=>{O!==E&&C(O)},normalizeCommitId:o,allocateCommitId:i,findLatestCommitId:v,resumeCommitIds:a,parentByBranch:c}}function u4(e,t,n,r){const{labels:o,addCommit:i,addBranch:a,addMerge:s,parentByBranch:l,resumeCommitIds:c}=r;for(const d of e){const{type:f,startTime:m,endTime:p}=d;switch(f){case"tool__StartTasks":{i(m,o.taskStart,{branchName:t,priority:10},{kind:"event",event:d});const{tasks:h={}}=d;for(const[b,x]of Object.entries(h)){const g=l_e(b);l.set(g,t),a(m,t,g,15),i(x.startTime,o.taskStart,{branchName:g,priority:16},{kind:"task",name:b,task:x});const{events:v=[]}=x;v.length>0&&u4(v,g,t,r),i(x.endTime,o.taskEnd,{branchName:g,priority:60})}i(p,o.allTasksDone,{branchName:t,priority:70});break}case"tool__AskUserQuestion":i(m,o.askUserQuestion,{branchName:t,priority:20},{kind:"event",event:d}),s(p,n,t,o.userAnswer,80,{kind:"event",event:d});break;case"tool__Edit":i(m,mp(o,f),{branchName:t,priority:30},{kind:"event",event:d});break;case"tool__ResumeTask":{const h=i(m,mp(o,f),{branchName:t,priority:40},{kind:"event",event:d});c.set(t,h);break}case"user__Prompt":s(m,t,"<prev_branch>",mp(o,f),50,{kind:"event",event:d});break;default:i(p,mp(o,f),{branchName:t,priority:55},{kind:"event",event:d});break}}}function g_e(e){const t=p_e(e.ops);for(const n of t)switch(n.kind){case"commit":e.ensureBranch(n.branch),e.checkout(n.branch),e.commit(n.commitId,n.action);break;case"branch":e.checkout(n.baseBranch),e.ensureBranch(n.name);break;case"merge":{n.source==="<prev_branch>"&&(n.source=e.curBranch),e.ensureBranch(n.target),e.ensureBranch(n.source),e.checkout(n.target),e.merge(n.source,n.mergeId,n.action,{branchName:n.target,time:n.time,seq:n.seq});break}}}function v_e(e,t){const n=h_e(t),r="main";return n.checkout(r),n.addCommit(e.startTime,t.mainStart),u4(e.events??[],r,r,n),g_e(n),n.checkout(r),n.addCommit(e.endTime,t.mainEnd),{code:n.lines.join(`
|
|
517
|
+
`),interactions:n.interactions}}function gP(e){const{task:t,viewMode:n,className:r,style:o}=e,i=J.useRef(null),{t:a}=Ot(),s=J.useMemo(()=>({mainStart:a("chat.timeline.mainStart"),mainEnd:a("chat.timeline.mainEnd"),startTasks:a("chat.timeline.startTasks"),allTasksDone:a("chat.timeline.allTasksDone"),askUserQuestion:a("chat.timeline.askUserQuestion"),edit:a("chat.timeline.edit"),resumeTask:a("chat.timeline.resumeTask"),userPrompt:a("chat.timeline.userPrompt"),userAnswer:a("chat.timeline.userAnswer"),receiveReply:a("chat.timeline.receiveReply"),taskStart:a("chat.timeline.taskStart"),taskEnd:a("chat.timeline.taskEnd"),ganttTitle:a("chat.timeline.ganttTitle"),ganttMainSection:a("chat.timeline.ganttMainSection"),ganttTasksSection:a("chat.timeline.ganttTasksSection")}),[a]),l=J.useMemo(()=>n==="gantt"?d_e(t,s):v_e(t,s),[s,t,n]),c=J.useId(),d=J.useMemo(()=>c.replace(/\W/g,"_"),[c]),f=J.useRef(new Map),m=J.useMemo(()=>l.code,[l.code]);return J.useEffect(()=>{let p=!1;return(async()=>{const x=(await oe(()=>import("./mermaid.core-Bk0Y_0sz.js").then(w=>w.b5),[])).default,g=getComputedStyle(document.body).fontFamily;if(x.initialize({startOnLoad:!1,securityLevel:"loose",themeVariables:{fontFamily:g},gitGraph:{},gantt:{topAxis:!0,displayMode:"compact",gridLineStartPadding:0,leftPadding:16,rightPadding:16}}),p)return;const v=i.current;if(!v)return;const{svg:S,bindFunctions:C}=await x.render(d,m);if(p)return;v.innerHTML=S;const _=v.querySelector("svg");if(_){_.classList.add("session-timeline-mermaid__svg");for(const w of l.interactions){const N=_.querySelector(`#${CSS.escape(w.id)}`);N&&(N.classList.add("session-timeline-mermaid__interactive"),N.addEventListener("click",()=>{const k=f.current.get(w.id);k&&console.warn(k.payload)}))}}typeof C=="function"&&C(v)})(),()=>{p=!0}},[l.interactions,m,d]),J.useEffect(()=>{f.current=new Map(l.interactions.map(p=>[p.id,{label:p.label,payload:p.payload}]))},[l.interactions]),y.jsx("div",{ref:i,className:`session-timeline-panel session-timeline-panel--${n}${r?` ${r}`:""}`,style:o})}const y_e=(e,t)=>{const n=[];let r=0;const o=(a,s,l,c,d)=>{n.push({id:`${a}-${s}-${l}-${r}`,label:a,startTime:s,endTime:l,depth:c,payload:d}),r+=1},i=(a,s)=>{for(const l of a)l.type==="tool__StartTasks"?o(t.startTasks,l.startTime,l.endTime,s,l):l.type==="tool__AskUserQuestion"?o(t.askUserQuestion,l.startTime,l.endTime,s,l):l.type==="tool__Edit"?o(t.edit,l.startTime,l.endTime,s,l):l.type==="tool__ResumeTask"?o(t.resumeTask,l.startTime,l.endTime,s,l):l.type==="user__Prompt"&&o(t.userPrompt,l.startTime,l.endTime,s,l)};return o(t.mainStart,e.startTime,e.startTime,0),i(e.events??[],0),o(t.mainEnd,e.endTime,e.endTime,0),n.map((a,s)=>({...a,index:s})).sort((a,s)=>{const l=Jo(a.startTime)-Jo(s.startTime);return l!==0?l:a.index-s.index}).map(({index:a,...s})=>s)};function b_e({task:e}){const{t}=Ot(),[n,r]=J.useState(""),o=J.useRef(null),[i,a]=J.useState(240),s=J.useMemo(()=>({mainStart:t("chat.timeline.mainStart"),mainEnd:t("chat.timeline.mainEnd"),startTasks:t("chat.timeline.startTasks"),askUserQuestion:t("chat.timeline.askUserQuestion"),edit:t("chat.timeline.edit"),resumeTask:t("chat.timeline.resumeTask"),userPrompt:t("chat.timeline.userPrompt")}),[t]),l=J.useMemo(()=>y_e(e,s),[s,e]),c=J.useMemo(()=>{const m=n.trim().toLowerCase();return m?l.filter(p=>`${p.label} ${p.startTime} ${p.endTime}`.toLowerCase().includes(m)):l},[l,n]),d=t("chat.timelineEmptyValue"),f=J.useMemo(()=>[{title:t("chat.timelineEventName"),key:"label",width:180,render:(m,p)=>y.jsx("span",{className:"session-timeline-event-table__label",style:{paddingLeft:`${p.depth*16}px`},children:p.label})},{title:t("chat.timelineInput"),key:"input",width:180,render:(m,p)=>y.jsx("span",{className:"session-timeline-event-table__value",children:p.input??d})},{title:t("chat.timelineOutput"),key:"output",width:180,render:(m,p)=>y.jsx("span",{className:"session-timeline-event-table__value",children:p.output??d})},{title:t("chat.timelineTiming"),key:"time",width:160,render:(m,p)=>{const h=gc(p.startTime),b=gc(p.endTime);return y.jsx("span",{className:"session-timeline-event-table__time",children:h===b?h:`${h} → ${b}`})}}],[d,t]);return J.useEffect(()=>{const m=o.current;if(!m)return;const p=()=>{const b=m.querySelector(".session-timeline-event-table__header"),x=m.querySelector(".ant-table-pagination"),g=(b==null?void 0:b.offsetHeight)??0,v=(x==null?void 0:x.offsetHeight)??0,S=Math.max(160,m.clientHeight-g-v-16);a(C=>C===S?C:S)};p();const h=new ResizeObserver(p);return h.observe(m),()=>{h.disconnect()}},[]),y.jsxs("div",{ref:o,className:"session-timeline-event-table",children:[y.jsxs("div",{className:"session-timeline-event-table__header",children:[y.jsx("span",{className:"session-timeline-event-table__title",children:t("chat.timeline.eventListTitle")}),y.jsx(Ft,{className:"session-timeline-event-table__search",allowClear:!0,value:n,onChange:m=>r(m.target.value),placeholder:t("chat.timeline.eventListSearch")})]}),y.jsx(la,{className:"session-timeline-event-table__table",size:"small",columns:f,dataSource:c,rowKey:"id",onRow:m=>({onClick:()=>{m.payload&&console.warn(m.payload)}}),pagination:{pageSize:20,showSizeChanger:!0,pageSizeOptions:["10","20","50"]},scroll:{y:i},locale:{emptyText:t("chat.timelineEmpty")}})]})}const E0={startTime:"09:40:00",endTime:"11:30:48",events:[{type:"tool__StartTasks",startTime:"09:41:02",endTime:"10:10:25",tasks:{taskA:{startTime:"09:41:10",endTime:"09:55:02",description:"Task A"},taskB:{startTime:"09:41:10",endTime:"09:50:40",description:"Task B"},taskC:{startTime:"09:41:10",endTime:"10:10:20",description:"Task C",events:[{type:"tool__StartTasks",startTime:"09:48:00",endTime:"10:05:30",tasks:{taskC0:{startTime:"09:49:10",endTime:"10:05:25",events:[{type:"tool__AskUserQuestion",startTime:"09:57:00",endTime:"09:59:23"},{type:"user__Prompt",startTime:"09:58:10",endTime:"09:58:20"}]}}},{type:"tool__Edit",startTime:"09:57:10",endTime:"09:59:20"},{type:"tool__ResumeTask",startTime:"09:59:22",endTime:"10:05:30"}]}}},{type:"tool__StartTasks",startTime:"10:41:02",endTime:"11:10:25",tasks:{taskA1:{startTime:"10:41:10",endTime:"10:55:02",description:"Task A1"},taskB1:{startTime:"10:41:10",endTime:"10:50:40",description:"Task B1"},taskC1:{startTime:"10:41:10",endTime:"11:10:20",description:"Task C1",events:[{type:"tool__StartTasks",startTime:"10:48:00",endTime:"11:05:30",tasks:{taskC10:{startTime:"10:49:10",endTime:"11:05:25",events:[{type:"tool__AskUserQuestion",startTime:"10:57:00",endTime:"10:59:23"},{type:"user__Prompt",startTime:"10:58:10",endTime:"10:58:20"}]}}},{type:"tool__Edit",startTime:"10:57:10",endTime:"10:59:20"},{type:"tool__ResumeTask",startTime:"10:59:22",endTime:"11:05:30"}]}}}]};function x_e({messages:e}){return y.jsxs("div",{className:"chat-timeline-view",children:[y.jsx("section",{className:"session-timeline-section session-timeline-section--fixed",children:y.jsx(gP,{task:E0,viewMode:"gantt"})}),y.jsxs("section",{className:"session-timeline-section session-timeline-section--flex session-timeline-section--row",children:[y.jsx("div",{className:"session-timeline-column session-timeline-column--graph",children:y.jsx(gP,{task:E0,viewMode:"git"})}),y.jsx("div",{className:"session-timeline-column session-timeline-column--events",children:y.jsx(b_e,{task:E0})})]})]})}const vP="vf_chat_effort",yP=e=>e==="default"||e==="low"||e==="medium"||e==="high"||e==="max";function S_e(){const[e,t]=u.useState("default"),n=o=>{if(o!=null&&yP(o)){t(o);return}t("default")};u.useEffect(()=>{try{const o=localStorage.getItem(vP);o&&yP(o)&&n(o)}catch{}},[]),u.useEffect(()=>{try{localStorage.setItem(vP,e)}catch{}},[e]);const r=u.useMemo(()=>[{value:"default",label:"默认"},{value:"low",label:"低"},{value:"medium",label:"中"},{value:"high",label:"高"},{value:"max",label:"最高"}],[]);return{effort:e,setEffort:n,effortOptions:r}}function C_e({sessionId:e}){const[t,n]=u.useState(null),r=u.useCallback((o,i)=>{e&&(Ca.send(e,{type:"interaction_response",id:o,data:i}),n(null))},[e]);return{interactionRequest:t,setInteractionRequest:n,handleInteractionResponse:r}}const w_e=`
|
|
518
518
|
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
519
519
|
<g fill="#D97957">
|
|
520
520
|
<rect x="29" y="2" width="6" height="20" rx="3"/>
|
|
@@ -531,7 +531,7 @@ ${e.frontmatter.testCommand}
|
|
|
531
531
|
<rect x="29" y="2" width="6" height="20" rx="3" transform="rotate(-150 32 32)"/>
|
|
532
532
|
<circle cx="32" cy="32" r="11"/>
|
|
533
533
|
</g>
|
|
534
|
-
</svg>`.trim(),
|
|
534
|
+
</svg>`.trim(),__e=`data:image/svg+xml;utf8,${encodeURIComponent(w_e)}`,E_e="Claude Code",$_e=`
|
|
535
535
|
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg">
|
|
536
536
|
<path d="M19.503 0H4.496A4.496 4.496 0 000 4.496v15.007A4.496 4.496 0 004.496 24h15.007A4.496 4.496 0 0024 19.503V4.496A4.496 4.496 0 0019.503 0z" fill="#fff"></path>
|
|
537
537
|
<path d="M9.064 3.344a4.578 4.578 0 012.285-.312c1 .115 1.891.54 2.673 1.275.01.01.024.017.037.021a.09.09 0 00.043 0 4.55 4.55 0 013.046.275l.047.022.116.057a4.581 4.581 0 012.188 2.399c.209.51.313 1.041.315 1.595a4.24 4.24 0 01-.134 1.223.123.123 0 00.03.115c.594.607.988 1.33 1.183 2.17.289 1.425-.007 2.71-.887 3.854l-.136.166a4.548 4.548 0 01-2.201 1.388.123.123 0 00-.081.076c-.191.551-.383 1.023-.74 1.494-.9 1.187-2.222 1.846-3.711 1.838-1.187-.006-2.239-.44-3.157-1.302a.107.107 0 00-.105-.024c-.388.125-.78.143-1.204.138a4.441 4.441 0 01-1.945-.466 4.544 4.544 0 01-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81 5.81 0 01-.37-.961 4.582 4.582 0 01-.014-2.298.124.124 0 00.006-.056.085.085 0 00-.027-.048 4.467 4.467 0 01-1.034-1.651 3.896 3.896 0 01-.251-1.192 5.189 5.189 0 01.141-1.6c.337-1.112.982-1.985 1.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098 0 00.065-.066 4.51 4.51 0 01.829-1.615 4.535 4.535 0 011.837-1.388zm3.482 10.565a.637.637 0 000 1.272h3.636a.637.637 0 100-1.272h-3.636zM8.462 9.23a.637.637 0 00-1.106.631l1.272 2.224-1.266 2.136a.636.636 0 101.095.649l1.454-2.455a.636.636 0 00.005-.64L8.462 9.23z" fill="url(#lobe-icons-codex-fill)"></path>
|
|
@@ -542,7 +542,7 @@ ${e.frontmatter.testCommand}
|
|
|
542
542
|
<stop offset="1" stop-color="#3941FF"></stop>
|
|
543
543
|
</linearGradient>
|
|
544
544
|
</defs>
|
|
545
|
-
</svg>`.trim(),
|
|
545
|
+
</svg>`.trim(),k_e=`data:image/svg+xml;utf8,${encodeURIComponent($_e)}`,N_e="Codex",O_e=`
|
|
546
546
|
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg">
|
|
547
547
|
<rect width="24" height="24" rx="6" fill="#0F172A"></rect>
|
|
548
548
|
<path d="M12 3.25 4.75 7.5v9L12 20.75l7.25-4.25v-9L12 3.25Zm0 2.06 5.5 3.22-5.5 3.22-5.5-3.22L12 5.31Zm-6 4.97 5 2.93v5.46l-5-2.93v-5.4Zm7 8.39v-5.46l5-2.93v5.4l-5 2.99Z" fill="url(#opencode-fill)"></path>
|
|
@@ -554,4 +554,4 @@ ${e.frontmatter.testCommand}
|
|
|
554
554
|
</linearGradient>
|
|
555
555
|
</defs>
|
|
556
556
|
</svg>
|
|
557
|
-
`.trim(),N_e=`data:image/svg+xml;utf8,${encodeURIComponent(k_e)}`,O_e="OpenCode",I_e={"claude-code":{title:w_e,icon:C_e},codex:{title:$_e,icon:E_e},opencode:{title:O_e,icon:N_e}},R_e=e=>I_e[e]??{title:e,icon:void 0},J1=e=>e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},d4=e=>Array.isArray(e)?e.map(t=>yn(t)).filter(t=>!!t):[],yn=e=>typeof e=="string"&&e.trim()!==""?e.trim():void 0,Ld=(e,t)=>`${e},${t}`,iu=e=>{const t=yn(e);if(!t||!t.includes(","))return;const[n,r]=t.split(/,(.+)/),o=yn(n),i=yn(r);if(!(!o||!i))return{serviceKey:o,modelName:i,selectorValue:Ld(o,i)}},P_e=e=>{const t=[];for(const[n,r]of Object.entries(e)){const o=yn(n);if(!o)continue;const i=r!=null&&typeof r=="object"?r:void 0,a=Array.isArray(i==null?void 0:i.models)?i.models:[];for(const s of a){const l=yn(s);l&&t.push({serviceKey:o,model:l,selectorValue:Ld(o,l)})}}return t},T_e=(e,t,n)=>e.find(r=>r.serviceKey===t&&r.model===n),MC=e=>{var i;const t=yn(e.value);if(!t)return;const n=iu(t);if(n){const a=T_e(e.serviceModels,n.serviceKey,n.modelName);return a?a.selectorValue:void 0}const r=e.serviceModels.filter(a=>a.model===t);if(r.length===0)return;const o=yn(e.preferredServiceKey);if(o){const a=r.find(s=>s.serviceKey===o);if(a)return a.selectorValue}return(i=r[0])==null?void 0:i.selectorValue},eE=e=>{const t=yn(e.value);if(!t)return;const n=new Set(Array.from(e.builtinModels??[]).map(i=>yn(i)).filter(i=>!!i));if(n.has(t))return t;const r=MC({value:t,serviceModels:e.serviceModels,preferredServiceKey:e.preferredServiceKey});if(r)return r;const o=iu(t);return o!=null&&o.modelName&&n.has(o.modelName)?o.modelName:e.preserveUnknown===!1?void 0:t},j_e=e=>{var o;const t=Array.from(e.builtinModels??[]).map(i=>yn(i)).filter(i=>!!i),n=yn(e.defaultModel);if(n){const i=iu(n),a=eE({value:n,builtinModels:t,serviceModels:e.serviceModels,preferredServiceKey:(i==null?void 0:i.serviceKey)??e.defaultModelService,preserveUnknown:e.preserveUnknownDefaultModel});if(a)return a}const r=yn(e.defaultModelService);if(r){const i=e.serviceModels.find(a=>a.serviceKey===r);if(i)return i.selectorValue}return t.length>0?t[0]:(o=e.serviceModels[0])==null?void 0:o.selectorValue},M_e=e=>{var o;const t=yn(e.model);if(!t)return;const n=iu(t),r=n==null?[t]:[n.selectorValue,n.modelName,n.serviceKey];for(const i of r){const a=(o=e.models)==null?void 0:o[i];if(a!=null&&typeof a=="object"&&!Array.isArray(a))return a}},A_e=e=>{var t;return yn((t=M_e(e))==null?void 0:t.defaultAdapter)},tE=e=>{const t=J1(e);return yn(t.defaultModel)??yn(t.model)},bP=e=>d4(J1(e).includeModels),xP=e=>d4(J1(e).excludeModels),f4=e=>{const t=tE(e.adapterConfig);return eE({value:t,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preferredServiceKey:e.preferredServiceKey,preserveUnknown:e.preserveUnknown})},SP=e=>{const t=yn(e.model),n=yn(e.selector);if(!t||!n)return!1;const r=iu(t),o=iu(n);return r?o?r.serviceKey===o.serviceKey&&r.modelName===o.modelName:r.serviceKey===n||r.modelName===n||t===n:t===n},CP=e=>{const t=yn(e.model);if(!t||t==="default")return{allowed:!0,includeModels:bP(e.adapterConfig),excludeModels:xP(e.adapterConfig)};const n=bP(e.adapterConfig),r=xP(e.adapterConfig),o=t===tE(e.adapterConfig);return r.some(i=>SP({model:t,selector:i}))?{allowed:!1,reason:"excluded",includeModels:n,excludeModels:r}:!o&&n.length>0&&!n.some(i=>SP({model:t,selector:i}))?{allowed:!1,reason:"not_included",includeModels:n,excludeModels:r}:{allowed:!0,includeModels:n,excludeModels:r}},wP=e=>{const t=yn(e.model);if(!t)return{model:t};const n=CP({model:t,adapterConfig:e.adapterConfig});if(n.allowed)return{model:t};const r=f4({adapterConfig:e.adapterConfig,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preferredServiceKey:e.preferredServiceKey,preserveUnknown:e.preserveUnknownDefaultModel});if(!r)return{error:{type:"missing_default_model",adapter:e.adapter,requestedModel:t,defaultModel:tE(e.adapterConfig),reason:n.reason??"not_included",includeModels:n.includeModels.length>0?n.includeModels:void 0,excludeModels:n.excludeModels.length>0?n.excludeModels:void 0}};const o=CP({model:r,adapterConfig:e.adapterConfig});return o.allowed?{model:r,warning:{type:"adapter_model_fallback",adapter:e.adapter,requestedModel:t,resolvedModel:r,reason:n.reason??"not_included",includeModels:n.includeModels.length>0?n.includeModels:void 0,excludeModels:n.excludeModels.length>0?n.excludeModels:void 0}}:{error:{type:"default_model_not_allowed",adapter:e.adapter,requestedModel:t,defaultModel:r,reason:o.reason??"not_included",includeModels:o.includeModels.length>0?o.includeModels:void 0,excludeModels:o.excludeModels.length>0?o.excludeModels:void 0}}},L_e=e=>eE({value:e.value,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preferredServiceKey:e.defaultModelService,preserveUnknown:e.preserveUnknown}),m4=e=>j_e({defaultModel:e.defaultModel,defaultModelService:e.defaultModelService,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preserveUnknownDefaultModel:e.preserveUnknownDefaultModel}),p4=e=>{const t=yn(e.value),n=Array.from(e.availableAdapters),r=new Set(n),o=yn(e.defaultAdapter);return t&&(r.has(t)||e.preserveUnknown===!0)?t:o&&r.has(o)?o:n[0]},D_e=(e,t)=>{const n=yn(e);return n?Object.entries(t).filter(([,r])=>Array.isArray(r)&&r.some(o=>(o==null?void 0:o.value)===n)).map(([r])=>r):[]},z_e=e=>{const t=Array.from(e.availableAdapters),n=new Set(t),r=A_e({model:e.model,models:e.modelMetadata});if(r&&n.has(r))return r;const o=D_e(e.model,e.adapterBuiltinModels??{}),i=yn(e.defaultAdapter);return i&&o.includes(i)?i:o.length>0?o[0]:p4({availableAdapters:t,defaultAdapter:e.defaultAdapter})},B_e=e=>{var n;const t=f4({adapterConfig:e.adapter!=null?(n=e.adapters)==null?void 0:n[e.adapter]:void 0,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preferredServiceKey:e.defaultModelService,preserveUnknown:!1});return t||m4({defaultModel:e.defaultModel,defaultModelService:e.defaultModelService,builtinModels:e.builtinModels??e.fallbackBuiltinModels,serviceModels:e.serviceModels,preserveUnknownDefaultModel:!1})},$0="vf_chat_adapter",k0="vf_chat_selected_model",h4="vf_chat_selection_driver",AC=e=>{try{const t=localStorage.getItem(e);return t==null||t.trim()===""?void 0:t}catch{return}},F_e=()=>AC(h4)==="model"?"model":"adapter",ql=e=>Array.isArray(e)?e.map(t=>t.value):[];function H_e({adapterLocked:e=!1}={}){var H,F,A,B,K,W,q,U,te,le,ie,ee,se,re,Z,X,ce,pe,ge,we;const{t}=Ot(),[n,r]=u.useState(()=>AC($0)),[o,i]=u.useState(()=>AC(k0)),[a,s]=u.useState(()=>F_e()),{data:l}=Qn("/api/config",b1),c=u.useMemo(()=>{var ae,de;return((de=(ae=l==null?void 0:l.sources)==null?void 0:ae.merged)==null?void 0:de.adapters)??{}},[(F=(H=l==null?void 0:l.sources)==null?void 0:H.merged)==null?void 0:F.adapters]),d=u.useMemo(()=>{var ae,de;return((de=(ae=l==null?void 0:l.sources)==null?void 0:ae.merged)==null?void 0:de.models)??{}},[(B=(A=l==null?void 0:l.sources)==null?void 0:A.merged)==null?void 0:B.models]),f=u.useMemo(()=>{var ae,de;return((de=(ae=l==null?void 0:l.sources)==null?void 0:ae.merged)==null?void 0:de.modelServices)??{}},[(W=(K=l==null?void 0:l.sources)==null?void 0:K.merged)==null?void 0:W.modelServices]),m=u.useMemo(()=>{var de,ue,me;const ae=(me=(ue=(de=l==null?void 0:l.sources)==null?void 0:de.merged)==null?void 0:ue.general)==null?void 0:me.recommendedModels;return Array.isArray(ae)?ae.filter(Ce=>Ce!=null&&typeof Ce=="object"&&typeof Ce.model=="string"&&Ce.model.trim()!==""):[]},[(te=(U=(q=l==null?void 0:l.sources)==null?void 0:q.merged)==null?void 0:U.general)==null?void 0:te.recommendedModels]),p=u.useMemo(()=>{var ae,de;return((de=(ae=l==null?void 0:l.sources)==null?void 0:ae.merged)==null?void 0:de.adapterBuiltinModels)??{}},[(ie=(le=l==null?void 0:l.sources)==null?void 0:le.merged)==null?void 0:ie.adapterBuiltinModels]),h=yn((re=(se=(ee=l==null?void 0:l.sources)==null?void 0:ee.merged)==null?void 0:se.general)==null?void 0:re.defaultAdapter),b=yn((ce=(X=(Z=l==null?void 0:l.sources)==null?void 0:Z.merged)==null?void 0:X.general)==null?void 0:ce.defaultModelService),x=yn((we=(ge=(pe=l==null?void 0:l.sources)==null?void 0:pe.merged)==null?void 0:ge.general)==null?void 0:we.defaultModel),g=u.useMemo(()=>Object.keys(c),[c]),v=u.useMemo(()=>P_e(f),[f]),S=u.useMemo(()=>Object.values(p).flatMap(ae=>ql(ae)),[p]),C=u.useMemo(()=>n&&p[n]?{[n]:p[n]}:p,[p,n]),_=u.useMemo(()=>Object.values(C).flatMap(ae=>ql(ae)),[C]),w=v.length>0||_.length>0,N=u.useCallback(ae=>p4({value:ae,availableAdapters:g,defaultAdapter:h}),[g,h]),k=u.useCallback((ae,de,ue=!1)=>L_e({value:ae,builtinModels:de,serviceModels:v,defaultModelService:b,preserveUnknown:ue}),[v,b]),E=u.useCallback(ae=>{const de=ql(ae!=null?p[ae]:void 0),ue=B_e({adapter:ae,adapters:c,defaultModel:x,defaultModelService:b,builtinModels:de,fallbackBuiltinModels:S,serviceModels:v});return!ae||!ue?ue:wP({adapter:ae,model:ue,adapterConfig:c[ae],builtinModels:de,serviceModels:v,preferredServiceKey:b,preserveUnknownDefaultModel:!1}).model??ue},[p,S,v,x,b,c]),$=u.useCallback((ae,de)=>!ae||!de?de:wP({adapter:ae,model:de,adapterConfig:c[ae],builtinModels:ql(p[ae]),serviceModels:v,preferredServiceKey:b,preserveUnknownDefaultModel:!1}).model??de,[p,v,b,c]),O=u.useCallback(ae=>z_e({model:ae,availableAdapters:g,defaultAdapter:h,adapterBuiltinModels:p,modelMetadata:d}),[p,g,h,d]),R=u.useMemo(()=>m4({defaultModel:x,defaultModelService:b,builtinModels:S,serviceModels:v,preserveUnknownDefaultModel:!1}),[S,v,x,b]);u.useEffect(()=>{if(e)return;if(g.length===0){r(void 0),w||i(void 0);return}if(!w){i(void 0),r(ue=>N(ue));return}if(a==="model"){const ue=k(o,S,!1)??R,me=O(ue)??N(n),Ce=$(me,ue);i(ne=>ne===Ce?ne:Ce),r(ne=>ne===me?ne:me);return}const ae=N(n),de=E(ae);r(ue=>ue===ae?ue:ae),i(ue=>ue===de?ue:de)},[e,S,g.length,w,O,$,N,E,k,R,n,o,a]),u.useEffect(()=>{try{n==null||n.trim()===""?localStorage.removeItem($0):localStorage.setItem($0,n)}catch{}},[n]),u.useEffect(()=>{try{o==null||o.trim()===""?localStorage.removeItem(k0):localStorage.setItem(k0,o)}catch{}},[o]),u.useEffect(()=>{try{localStorage.setItem(h4,a)}catch{}},[a]);const T=u.useCallback(ae=>{const de=e?ql(n!=null?p[n]:void 0):S,ue=k(ae,de,!1);if(!ue)return;s("model");const me=e?n:O(ue)??N(n),Ce=$(me,ue);i(ne=>ne===Ce?ne:Ce),!e&&r(ne=>ne===me?ne:me)},[p,e,S,$,O,N,k,n]),I=u.useCallback(ae=>{const de=N(ae);if(s("adapter"),r(me=>me===de?me:de),e)return;const ue=E(de);i(me=>me===ue?me:ue)},[e,N,E]),P=u.useCallback(ae=>{const de=yn(ae.adapter)??N(void 0),ue=ql(de!=null?p[de]:void 0),me=k(ae.model,ue,!0)??k(ae.model,S,!0)??yn(ae.model)??E(de);r(Ce=>Ce===de?Ce:de),i(Ce=>Ce===me?Ce:me)},[p,S,N,E,k]),j=u.useMemo(()=>k(o,_,!0)??o,[_,k,o]),L=u.useMemo(()=>g.map(ae=>{const de=R_e(ae);return{value:ae,label:u.createElement("span",{className:"adapter-option"},[de.icon!=null?u.createElement("img",{key:"icon",className:"adapter-option__icon",src:de.icon,alt:"","aria-hidden":!0}):null,u.createElement("span",{key:"text",className:"adapter-option__text"},de.title)])}}),[g]),D=u.useMemo(()=>Object.entries(f),[f]),z=u.useMemo(()=>{var de;const ae=new Map;for(const ue of v){const me=f[ue.serviceKey],Ce=((de=me==null?void 0:me.title)==null?void 0:de.trim())!==""?(me==null?void 0:me.title)??"":ue.serviceKey;ae.has(ue.model)||ae.set(ue.model,{key:ue.serviceKey,title:Ce})}return ae},[v,f]),M=u.useMemo(()=>{const ae=ne=>{var $e;const he=($e=ne.description)==null?void 0:$e.trim(),ye=y.jsxs("div",{className:"model-option",children:[y.jsx("div",{className:"model-option-title",children:ne.title}),he&&y.jsx("div",{className:"model-option-desc",children:he})]}),xe=[ne.title,ne.value,ne.serviceTitle,ne.serviceKey,he].filter(Boolean).join(" ");return{value:ne.value,label:ye,searchText:xe,displayLabel:ne.title}},de=(ne,he)=>{if(ne){for(const[ye,xe]of Object.entries(ne))if(Array.isArray(xe)&&xe.includes(he))return ye}},ue=D.map(([ne,he])=>{var Oe;const ye=he!=null&&typeof he=="object"?he:void 0,xe=((Oe=ye==null?void 0:ye.title)==null?void 0:Oe.trim())!==""?(ye==null?void 0:ye.title)??"":ne,$e=(xe==null?void 0:xe.trim())!==""?xe:ne,Se=ye==null?void 0:ye.description,be=Array.isArray(ye==null?void 0:ye.models)?ye.models.filter(Me=>typeof Me=="string"):[];if(be.length===0)return null;const ke=be.map(Me=>{const _e=de(ye==null?void 0:ye.modelsAlias,Me),je=_e??Me,Fe=_e?Me:xe;return ae({value:Ld(ne,Me),title:je,description:Fe,serviceKey:ne,serviceTitle:xe})});return{label:y.jsxs("div",{className:"model-group-label",children:[y.jsx("div",{className:"model-group-title",children:$e}),Se&&y.jsx("div",{className:"model-group-desc",children:Se})]}),options:ke}}).filter(ne=>ne!=null),me=m.filter(ne=>ne.placement&&ne.placement!=="modelSelector"?!1:MC({value:ne.service?Ld(ne.service,ne.model):ne.model,serviceModels:v,preferredServiceKey:ne.service??b})!=null).map(ne=>{var ke,Oe,Me,_e,je;const he=ne.service?f[ne.service]:void 0,ye=ne.service?((ke=he==null?void 0:he.title)==null?void 0:ke.trim())!==""?(he==null?void 0:he.title)??"":ne.service:(Oe=z.get(ne.model))==null?void 0:Oe.title,xe=ne.service?de(he==null?void 0:he.modelsAlias,ne.model):void 0,$e=((Me=ne.title)==null?void 0:Me.trim())!==""?ne.title??"":xe??ne.model,Se=((_e=ne.description)==null?void 0:_e.trim())!==""?ne.description:ye,be=MC({value:ne.service?Ld(ne.service,ne.model):ne.model,serviceModels:v,preferredServiceKey:ne.service??b})??ne.model;return ae({value:be,title:$e,description:Se,serviceKey:ne.service??((je=z.get(ne.model))==null?void 0:je.key),serviceTitle:ye})}),Ce=[];if(me.length>0){const ne=t("chat.modelGroupRecommended",{defaultValue:"推荐模型"});Ce.push({label:y.jsx("div",{className:"model-group-label",children:y.jsx("div",{className:"model-group-title",children:ne})}),options:me})}for(const[ne,he]of Object.entries(C)){if(!Array.isArray(he)||he.length===0)continue;const ye=t("chat.modelGroupBuiltin",{adapter:ne,defaultValue:`${ne} (Default)`});Ce.push({label:y.jsx("div",{className:"model-group-label",children:y.jsx("div",{className:"model-group-title",children:ye})}),options:he.map(xe=>ae({value:xe.value,title:xe.title,description:xe.description}))})}return[...Ce,...ue]},[C,v,b,f,D,z,m,t]);return{adapterOptions:L,applySessionSelection:P,hasAvailableModels:w,modelOptions:M,selectedAdapter:n,selectedModel:o,selectedModelWithService:j,setSelectedAdapter:I,setSelectedModel:T}}const _P="vf_chat_permission_mode",EP=e=>e==="default"||e==="acceptEdits"||e==="plan"||e==="dontAsk"||e==="bypassPermissions";function V_e(){const[e,t]=u.useState("default"),n=o=>{if(o!=null&&EP(o)){t(o);return}t("default")};u.useEffect(()=>{try{const o=localStorage.getItem(_P);o&&EP(o)&&n(o)}catch{}},[]),u.useEffect(()=>{try{localStorage.setItem(_P,e)}catch{}},[e]);const r=u.useMemo(()=>[{value:"default",label:"默认"},{value:"acceptEdits",label:"接受编辑"},{value:"plan",label:"计划"},{value:"dontAsk",label:"不询问"},{value:"bypassPermissions",label:"跳过权限"}],[]);return{permissionMode:e,setPermissionMode:n,permissionModeOptions:r}}const $P=(e,t)=>t.type!=="message"?e:e.find(r=>r.id===t.message.id)!=null?e.map(r=>r.id===t.message.id?t.message:r):[...e,t.message],kP=(e,t)=>{if(t.type!=="tool_result")return e;const n=t.isError===!0?"error":"success";return e.map(r=>r.toolCall!=null&&r.toolCall.id===t.toolCallId?{...r,toolCall:{...r.toolCall,status:n,output:t.output}}:r)};function W_e({session:e,modelForQuery:t,effort:n,permissionMode:r,adapter:o,setInteractionRequest:i}){const{t:a}=Ot(),{mutate:s}=Yv(),[l,c]=u.useState([]),[d,f]=u.useState(null),[m,p]=u.useState(!1),[h,b]=u.useState(null),[x,g]=u.useState(0),v=u.useRef(!0),S=u.useRef(void 0),C=u.useRef(void 0),_=u.useRef(void 0),w=u.useRef(void 0),N=u.useRef(!1),k=u.useCallback(()=>{(e==null?void 0:e.id)==null||e.id===""||(N.current=!0,b(null),Ca.close(e.id),g(E=>E+1))},[e==null?void 0:e.id]);return u.useEffect(()=>{if(c([]),f(null),p(!1),b(null),i(null),v.current=!0,(e==null?void 0:e.id)==null||e.id===""){p(!0),S.current=void 0,C.current=void 0,_.current=void 0,w.current=void 0;return}let E=!1;return(async()=>{try{const O=await Hfe(e.id);if(E)return;const R=O.messages;if(O.session){const P=O.session;s("/api/sessions",j=>{if((j==null?void 0:j.sessions)==null)return j;const L=j.sessions.map(D=>D.id===P.id?{...D,...P}:D);return{...j,sessions:L}},!1)}O.interaction&&i(O.interaction);let T=[],I=null;for(const P of R)T=$P(T,P),T=kP(T,P),P.type==="session_info"&&P.info!=null&&P.info.type!=="summary"&&(I=P.info);c(T),f(I),setTimeout(()=>{E||(p(!0),v.current=!1)},100)}catch(O){console.error("Failed to fetch history messages:",O)}})(),()=>{E=!0}},[s,e==null?void 0:e.id,i]),u.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id==="")return;let E=!1,$;const O=t??"",R=t!=null&&S.current!=null&&O!==S.current&&(e==null?void 0:e.status)!=="running",T=n==="default"?"":n,I=C.current!=null&&T!==C.current&&(e==null?void 0:e.status)!=="running",P=r??"",j=r!=null&&_.current!=null&&P!==_.current&&(e==null?void 0:e.status)!=="running",L=o??"",D=o!=null&&w.current!=null&&L!==w.current&&(e==null?void 0:e.status)!=="running";(R||I||j||D)&&(N.current=!0,b(null),Ca.send(e.id,{type:"terminate_session"}),Ca.close(e.id)),S.current=O,C.current=T,_.current=P,w.current=L;const z=setTimeout(()=>{if(E)return;const M={};t&&(M.model=t),n!=="default"&&(M.effort=n),r&&(M.permissionMode=r),o&&(M.adapter=o),$=Ca.connect(e.id,{onOpen(){N.current=!1,b(null)},onMessage(H){var F;if(!E){if(H.type==="error"){b(((F=H.data)==null?void 0:F.message)??H.message??"Unknown error");return}if(H.type==="session_updated"){s("/api/sessions",A=>{if((A==null?void 0:A.sessions)==null)return A;const B=H.session;if("isDeleted"in B&&B.isDeleted)return{...A,sessions:A.sessions.filter(q=>q.id!==B.id)};const K=B,W=A.sessions.map(q=>q.id===K.id?{...q,...K}:q);return!W.some(q=>q.id===K.id)&&!("isDeleted"in B)&&W.unshift(K),{...A,sessions:W}},!1);return}if(H.type==="message"){c(A=>$P(A,H));return}if(H.type==="session_info"){H.info!=null&&H.info.type==="summary"?s("/api/sessions"):(f(H.info??null),v.current&&setTimeout(()=>{E||v.current&&(p(!0),v.current=!1)},100));return}if(H.type==="tool_result"){c(A=>kP(A,H));return}H.type==="interaction_request"&&i({id:H.id,payload:H.payload})}},onError(){E||b(a("chat.connectionError"))},onClose(){if(!E){if(N.current){N.current=!1;return}b(H=>H??a("chat.connectionClosed"))}}},Object.keys(M).length>0?M:void 0)},R||I||j||D?200:100);return()=>{E=!0,clearTimeout(z),$==null||$()}},[o,n,t,s,r,x,e==null?void 0:e.id,e==null?void 0:e.status,i,a]),{messages:l,setMessages:c,sessionInfo:d,isReady:m,connectionError:h,retryConnection:k}}const K_e=e=>e==="timeline"||e==="settings"||e==="history"?e:"history";function U_e(){const{values:e,update:t}=ju({keys:["view"],defaults:{view:"history"},omit:{view:o=>o==="history"}}),n=K_e(e.view),r=u.useCallback(o=>{t({view:o})},[t]);return u.useEffect(()=>{n!==e.view&&t({view:n})},[n,e.view,t]),{activeView:n,setActiveView:r}}function G_e({session:e}){const{t}=Ot(),{adapterOptions:n,applySessionSelection:r,selectedAdapter:o,selectedModel:i,selectedModelWithService:a,setSelectedModel:s,setSelectedAdapter:l,modelOptions:c,hasAvailableModels:d}=H_e({adapterLocked:(e==null?void 0:e.id)!=null}),{permissionMode:f,setPermissionMode:m,permissionModeOptions:p}=V_e(),{effort:h,setEffort:b,effortOptions:x}=b_e(),{activeView:g,setActiveView:v}=U_e(),{interactionRequest:S,setInteractionRequest:C,handleInteractionResponse:_}=x_e({sessionId:e==null?void 0:e.id}),{messages:w,setMessages:N,sessionInfo:k,isReady:E,connectionError:$,retryConnection:O}=W_e({session:e,modelForQuery:a,effort:h,permissionMode:f,adapter:o,setInteractionRequest:C}),R=u.useRef(null),T=(e==null?void 0:e.status)==="running";return u.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id===""){R.current=null;return}const I=R.current,P=(I==null?void 0:I.id)!==e.id;(P||(I==null?void 0:I.model)!==e.model||(I==null?void 0:I.adapter)!==e.adapter)&&r({model:e.model,adapter:e.adapter}),(P||(I==null?void 0:I.permissionMode)!==e.permissionMode)&&m(e.permissionMode),(P||(I==null?void 0:I.effort)!==e.effort)&&b(e.effort),R.current={id:e.id,model:e.model,permissionMode:e.permissionMode,adapter:e.adapter,effort:e.effort}},[e==null?void 0:e.adapter,e==null?void 0:e.effort,e==null?void 0:e.id,e==null?void 0:e.model,e==null?void 0:e.permissionMode,r,b,m]),{messages:w,sessionInfo:k,interactionRequest:S,isReady:E,connectionError:$,retryConnection:O,isThinking:T,activeView:g,setActiveView:v,handleInteractionResponse:_,setMessages:N,placeholder:e!=null&&e.id?void 0:t("chat.newSessionPlaceholder"),modelOptions:c,selectedModel:i,modelForQuery:a,setSelectedModel:s,effort:h,setEffort:b,effortOptions:x,permissionMode:f,setPermissionMode:m,permissionModeOptions:p,selectedAdapter:o,setSelectedAdapter:l,adapterOptions:n,hasAvailableModels:d,modelUnavailable:!d}}function NP(){const{t:e}=Ot(),{sessionId:t}=Sue(),n=Ts(),{data:r,isLoading:o}=Qn(t?"/api/sessions":null,()=>oB("active")),i=t==null||r==null?void 0:r.sessions.find(a=>a.id===t);return t!=null&&o?null:t!=null&&i==null?y.jsxs("div",{className:"chat-route__empty-state",children:[y.jsx(bn,{description:e("common.sessionNotFound")}),y.jsx(ct,{type:"primary",onClick:()=>void n("/"),children:e("common.backToHome")})]}):y.jsx(q_e,{session:i})}function q_e({session:e}){const{messages:t,sessionInfo:n,interactionRequest:r,isReady:o,connectionError:i,retryConnection:a,activeView:s,setActiveView:l,handleInteractionResponse:c,setMessages:d,placeholder:f,modelOptions:m,selectedModel:p,modelForQuery:h,setSelectedModel:b,effort:x,setEffort:g,effortOptions:v,permissionMode:S,setPermissionMode:C,permissionModeOptions:_,selectedAdapter:w,setSelectedAdapter:N,adapterOptions:k,hasAvailableModels:E,modelUnavailable:$}=G_e({session:e}),O=!(e!=null&&e.id)&&t.length===0;return y.jsxs("div",{className:`chat-container ${o?"ready":""} ${O?"is-new-session":""}`,children:[(e==null?void 0:e.id)&&y.jsx(fwe,{sessionInfo:n,sessionId:e.id,sessionTitle:e.title,isStarred:e.isStarred,isArchived:e.isArchived,tags:e.tags,lastMessage:e.lastMessage,lastUserMessage:e.lastUserMessage,activeView:s,onViewChange:l}),s==="history"&&y.jsx(o_e,{isReady:o,messages:t,session:e,sessionInfo:n,connectionError:i,onRetryConnection:a,interactionRequest:r,onInteractionResponse:c,setMessages:d,onClearMessages:()=>d([]),placeholder:f,modelOptions:m,selectedModel:p,modelForQuery:h,onModelChange:b,effort:x,effortOptions:v,onEffortChange:g,permissionMode:S,permissionModeOptions:_,onPermissionModeChange:C,selectedAdapter:w,adapterOptions:k,onAdapterChange:N,modelUnavailable:$,hasAvailableModels:E}),s==="timeline"&&y.jsx(y_e,{messages:t}),s==="settings"&&(e==null?void 0:e.id)&&y.jsx(i_e,{session:e,onClose:()=>l("history")})]})}function X_e({t:e}){const[t,n]=um(rB);return y.jsxs("div",{className:"config-view__editor-wrap",children:[y.jsx("div",{className:"config-view__section-header",children:y.jsxs("div",{className:"config-view__section-title",children:[y.jsx("span",{className:"material-symbols-rounded config-view__section-icon",children:"tune"}),y.jsx("span",{children:e("config.sections.appearance")})]})}),y.jsx("div",{className:"config-view__card",children:y.jsx(kn,{title:e("config.appSettings.announcements.label"),description:e("config.appSettings.announcements.desc"),icon:"campaign",children:y.jsx(ta,{checked:t,onChange:n})})})]})}function Y_e(){var j,L,D,z,M,H,F,A;const{t:e}=Ot(),{message:t}=Eo.useApp(),{data:n,isLoading:r,error:o,mutate:i}=Qn("/api/config",b1),{values:a,update:s,searchParams:l}=ju({keys:["tab","source"],defaults:{tab:"general",source:"project"}}),c=a.source==="user"?"user":"project",d=B=>s({source:B}),[f,m]=u.useState({}),p=(j=n==null?void 0:n.meta)==null?void 0:j.configPresent,h=(L=n==null?void 0:n.sources)==null?void 0:L[c],b=u.useRef(f),x=u.useRef({}),g=u.useRef({}),v=u.useRef({}),S=u.useMemo(()=>{var B,K;return((K=(B=n==null?void 0:n.sources)==null?void 0:B.merged)==null?void 0:K.modelServices)??{}},[(z=(D=n==null?void 0:n.sources)==null?void 0:D.merged)==null?void 0:z.modelServices]),C=u.useMemo(()=>{var B,K;return((K=(B=n==null?void 0:n.sources)==null?void 0:B.merged)==null?void 0:K.adapters)??{}},[(H=(M=n==null?void 0:n.sources)==null?void 0:M.merged)==null?void 0:H.adapters]);u.useEffect(()=>{l.get("source")==null&&(p!=null&&p.project?s({source:"project"}):p!=null&&p.user&&s({source:"user"}))},[p==null?void 0:p.project,p==null?void 0:p.user]);const _=u.useMemo(()=>new Set(["general","conversation","models","modelServices","channels","adapters","plugins","mcp","shortcuts"]),[]),w=u.useMemo(()=>{var B,K;return[{key:"group-config",type:"group",label:e("config.groups.config")},{key:"general",icon:"tune",label:e("config.sections.general"),value:h==null?void 0:h.general},{key:"conversation",icon:"forum",label:e("config.sections.conversation"),value:h==null?void 0:h.conversation},{key:"models",icon:"tune",label:e("config.sections.models"),value:h==null?void 0:h.models},{key:"modelServices",icon:"model_training",label:e("config.sections.modelServices"),value:h==null?void 0:h.modelServices},{key:"channels",icon:"campaign",label:e("config.sections.channels"),value:h==null?void 0:h.channels},{key:"adapters",icon:"settings_input_component",label:e("config.sections.adapters"),value:h==null?void 0:h.adapters},{key:"plugins",icon:"extension",label:e("config.sections.plugins"),value:h==null?void 0:h.plugins},{key:"mcp",icon:"account_tree",label:e("config.sections.mcp"),value:h==null?void 0:h.mcp},{key:"shortcuts",icon:"keyboard",label:e("config.sections.shortcuts"),value:h==null?void 0:h.shortcuts},{key:"group-app",type:"group",label:e("config.groups.app")},{key:"appearance",icon:"tune",label:e("config.sections.appearance")},{key:"experiments",icon:"science",label:e("config.sections.experiments"),value:(B=n==null?void 0:n.meta)==null?void 0:B.experiments},{key:"about",icon:"info",label:e("config.sections.about"),value:(K=n==null?void 0:n.meta)==null?void 0:K.about}]},[h,(F=n==null?void 0:n.meta)==null?void 0:F.about,(A=n==null?void 0:n.meta)==null?void 0:A.experiments,e]),k=u.useMemo(()=>new Set(w.filter(B=>B.type!=="group").map(B=>B.key)),[w]).has(a.tab)?a.tab:"general",E=B=>s({tab:B}),$=u.useMemo(()=>w.find(B=>B.key===k),[w,k]);u.useEffect(()=>{if($==null||!_.has($.key))return;const B=`${c}:${$.key}`;m(K=>{const W=K[B],q=$.value??{};return W!==void 0?pg(W)&&!pg(q)?{...K,[B]:fp(q)}:K:{...K,[B]:fp(q)}})},[$,_,c]),u.useEffect(()=>{b.current=f},[f]),u.useEffect(()=>()=>{Object.values(x.current).forEach(B=>{clearTimeout(B)})},[]);const O=(B,K=c)=>`${K}:${B}`,R=u.useMemo(()=>{const B=O("general");return f[B]??fp((h==null?void 0:h.general)??{})??{}},[f,h==null?void 0:h.general,c]),T=(()=>{const B=qp(R,["defaultModelService"]);return typeof B=="string"?B:void 0})(),I=(B,K,W)=>{const q=O(B,K),U=JSON.stringify(W??{});v.current[q]!==U&&(x.current[q]&&clearTimeout(x.current[q]),x.current[q]=setTimeout(async()=>{if(g.current[q])return;const te=b.current[q]??W,le=JSON.stringify(te??{});if(v.current[q]!==le){g.current[q]=!0;try{await zfe(K,B,te),v.current[q]=le,await i()}catch(ie){t.error(Mr(ie,e("config.saveFailed")))}finally{g.current[q]=!1}}},800))},P=(B,K)=>{const W=O(B);m(q=>({...q,[W]:K})),I(B,c,K)};return y.jsxs("div",{className:"config-view",children:[r&&y.jsx("div",{className:"config-view__state",children:y.jsx(tm,{})}),!r&&o!=null&&y.jsx("div",{className:"config-view__state",children:y.jsx(bn,{description:e("config.loadFailed")})}),!r&&o==null&&y.jsx("div",{className:"config-view__tabs-wrap",children:y.jsx(L_,{tabPosition:"left",tabBarGutter:4,indicator:{size:0},className:"config-view__tabs",activeKey:k,onChange:B=>{B!=="group-config"&&B!=="group-app"&&E(B)},items:w.map(B=>B.type==="group"?{key:B.key,label:y.jsx("span",{className:"config-view__group-label",children:B.label}),disabled:!0,children:y.jsx("div",{})}:{key:B.key,label:y.jsxs("span",{className:"config-view__tab-label",children:[y.jsx("span",{className:"material-symbols-rounded config-view__tab-icon",children:B.icon}),y.jsx("span",{className:"config-view__tab-text",children:B.label})]}),children:y.jsxs("div",{className:"config-view__content",children:[B.key==="about"&&y.jsx(CCe,{value:B.value}),B.key==="appearance"&&y.jsx(X_e,{t:e}),B.key!=="about"&&B.key!=="appearance"&&!_.has(B.key)&&y.jsx(e4,{value:B.value,sectionKey:B.key,t:e}),_.has(B.key)&&y.jsx(i4,{sectionKey:B.key,title:B.label,icon:B.icon,value:f[O(B.key)]??fp(B.value??{})??{},onChange:K=>P(B.key,K),mergedModelServices:S,mergedAdapters:C,selectedModelService:T,t:e,headerExtra:y.jsx(ea,{size:12,children:y.jsx(dwe,{value:c,onChange:d,options:[{value:"project",icon:"folder",label:(p==null?void 0:p.project)===!0?e("config.sources.project"):e("config.sources.projectMissing")},{value:"user",icon:"person",label:(p==null?void 0:p.user)===!0?e("config.sources.user"):e("config.sources.userMissing")}]})})})]})})})})]})}function Q_e(){return y.jsx(Y_e,{})}function oa({className:e,...t}){const n=["knowledge-base-view__action-button",e].filter(Boolean).join(" ");return y.jsx(ct,{...t,className:n})}function Sl({description:e,actionLabel:t,onAction:n,variant:r="default"}){return r==="simple"?y.jsx("div",{className:"knowledge-base-view__empty-simple",children:y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:e})}):y.jsxs("div",{className:"knowledge-base-view__empty",children:[y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:e}),t&&n&&y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:n,children:t})]})}function _g({items:e}){return y.jsx("div",{className:"knowledge-base-view__meta-list",children:e.map(t=>y.jsxs("div",{className:"knowledge-base-view__meta-item",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-item-icon",children:"check_circle"}),y.jsx("span",{children:t})]},t))})}function Z_e({entity:e}){const{t}=Ot(),n=e.tags??[],r=e.skills??[],o=e.rules??[];return y.jsx("div",{className:"knowledge-base-view__item",children:y.jsxs("div",{className:"knowledge-base-view__item-row",children:[y.jsxs("div",{className:"knowledge-base-view__item-main",children:[y.jsxs("div",{className:"knowledge-base-view__item-title",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__item-icon",children:"group_work"}),y.jsx("span",{children:e.name})]}),y.jsx("div",{className:"knowledge-base-view__item-desc",children:e.description}),n.length>0&&y.jsx("div",{className:"knowledge-base-view__tag-list",children:n.map(i=>y.jsxs(Do,{className:"knowledge-base-view__tag",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__tag-icon",children:"sell"}),y.jsx("span",{children:i})]},i))})]}),y.jsxs("div",{className:"knowledge-base-view__item-meta",children:[e.always&&y.jsx(Do,{color:"blue",children:t("knowledge.meta.always")}),y.jsxs("div",{className:"knowledge-base-view__meta-pills",children:[y.jsx(Gc,{content:y.jsx(_g,{items:r}),title:t("knowledge.meta.skills"),trigger:"click",placement:"bottomRight",children:y.jsxs(ct,{type:"text",className:"knowledge-base-view__meta-pill",disabled:r.length===0,children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-pill-icon",children:"psychology"}),y.jsx("span",{children:t("knowledge.meta.skillsCount",{count:r.length})})]})}),y.jsx(Gc,{content:y.jsx(_g,{items:o}),title:t("knowledge.meta.rules"),trigger:"click",placement:"bottomRight",children:y.jsxs(ct,{type:"text",className:"knowledge-base-view__meta-pill",disabled:o.length===0,children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-pill-icon",children:"gavel"}),y.jsx("span",{children:t("knowledge.meta.rulesCount",{count:o.length})})]})})]})]})]})})}function nE({data:e,renderItem:t}){return y.jsx(ji,{className:"knowledge-base-view__list",dataSource:e,renderItem:n=>t(n)})}function gm(){return y.jsx("div",{className:"knowledge-base-view__loading",children:y.jsx(tm,{})})}function J_e({isLoading:e,entities:t,filteredEntities:n,onCreate:r}){const{t:o}=Ot();return e?y.jsx("div",{className:"knowledge-base-view__entity-list",children:y.jsx(gm,{})}):t.length===0?y.jsx("div",{className:"knowledge-base-view__entity-list",children:y.jsx(Sl,{description:o("knowledge.entities.empty"),actionLabel:o("knowledge.entities.create"),onAction:r})}):n.length===0?y.jsx("div",{className:"knowledge-base-view__entity-list",children:y.jsx(Sl,{description:o("knowledge.filters.noResults"),variant:"simple"})}):y.jsx("div",{className:"knowledge-base-view__entity-list",children:y.jsx(nE,{data:n,renderItem:i=>y.jsx(ji.Item,{className:"knowledge-base-view__list-item",children:y.jsx(Z_e,{entity:i})})})})}function g4({query:e,tagOptions:t,tagFilter:n,searchPlaceholder:r,tagsPlaceholder:o,onQueryChange:i,onTagFilterChange:a}){return y.jsxs("div",{className:"knowledge-base-view__filters",children:[y.jsx(Ft,{className:"knowledge-base-view__filter-input",prefix:y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__filter-icon",children:"search"}),placeholder:r,allowClear:!0,value:e,onChange:s=>i(s.target.value)}),y.jsx(Yn,{className:"knowledge-base-view__filter-select",mode:"multiple",placeholder:o,options:t,value:n,onChange:a,maxTagCount:"responsive",disabled:t.length===0})]})}function uy({title:e,description:t,actions:n}){return y.jsxs("div",{className:"knowledge-base-view__section-header",children:[y.jsxs("div",{className:"knowledge-base-view__section-info",children:[y.jsx("div",{className:"knowledge-base-view__section-title",children:e}),y.jsx("div",{className:"knowledge-base-view__section-desc",children:t})]}),n]})}function dy({children:e,className:t}){const n=["knowledge-base-view__content",t].filter(Boolean).join(" ");return y.jsx("div",{className:n,children:e})}function e1e({entities:e,filteredEntities:t,isLoading:n,query:r,tagOptions:o,tagFilter:i,onQueryChange:a,onTagFilterChange:s,onCreate:l,onImport:c}){const{t:d}=Ot();return y.jsxs(dy,{className:"knowledge-base-view__entities-tab",children:[y.jsx(uy,{title:d("knowledge.entities.title"),description:d("knowledge.entities.desc"),actions:y.jsxs(ea,{children:[y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"download"}),onClick:c,children:d("knowledge.actions.import")}),y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:l,children:d("knowledge.entities.create")})]})}),y.jsx(g4,{query:r,tagOptions:o,tagFilter:i,searchPlaceholder:d("knowledge.filters.search"),tagsPlaceholder:d("knowledge.filters.tags"),onQueryChange:a,onTagFilterChange:s}),y.jsx(J_e,{isLoading:n,entities:e,filteredEntities:t,onCreate:l})]})}function t1e({spec:e}){const{t}=Ot(),[n,r]=J.useState(!1),{data:o,isLoading:i}=Qn(n?["spec-detail",e.id]:null,()=>Bfe(e.id)),a=o==null?void 0:o.spec,s=(a==null?void 0:a.body)??"",l=e.tags??[],c=e.skills??[],d=e.rules??[];return y.jsxs("div",{className:"knowledge-base-view__item",children:[y.jsxs("div",{className:"knowledge-base-view__item-row",children:[y.jsxs("div",{className:"knowledge-base-view__item-main",children:[y.jsxs("div",{className:"knowledge-base-view__item-title",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__item-icon",children:"account_tree"}),y.jsx("span",{children:e.name})]}),y.jsx("div",{className:"knowledge-base-view__item-desc",children:e.description}),e.params.length>0&&y.jsx("div",{className:"knowledge-base-view__params",children:e.params.map(f=>y.jsxs("div",{className:"knowledge-base-view__param",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__param-icon",children:"tune"}),y.jsxs("div",{className:"knowledge-base-view__param-text",children:[y.jsx("span",{className:"knowledge-base-view__param-name",children:f.name}),f.description&&y.jsx("span",{className:"knowledge-base-view__param-desc",children:f.description})]})]},f.name))}),l.length>0&&y.jsx("div",{className:"knowledge-base-view__tag-list",children:l.map(f=>y.jsxs(Do,{className:"knowledge-base-view__tag",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__tag-icon",children:"sell"}),y.jsx("span",{children:f})]},f))})]}),y.jsxs("div",{className:"knowledge-base-view__item-meta",children:[e.always&&y.jsx(Do,{color:"blue",children:t("knowledge.meta.always")}),y.jsxs("div",{className:"knowledge-base-view__meta-pills",children:[y.jsx(Gc,{content:y.jsx(_g,{items:c}),title:t("knowledge.meta.skills"),trigger:"click",placement:"bottomRight",children:y.jsxs(ct,{type:"text",className:"knowledge-base-view__meta-pill",disabled:c.length===0,children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-pill-icon",children:"psychology"}),y.jsx("span",{children:t("knowledge.meta.skillsCount",{count:c.length})})]})}),y.jsx(Gc,{content:y.jsx(_g,{items:d}),title:t("knowledge.meta.rules"),trigger:"click",placement:"bottomRight",children:y.jsxs(ct,{type:"text",className:"knowledge-base-view__meta-pill",disabled:d.length===0,children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-pill-icon",children:"gavel"}),y.jsx("span",{children:t("knowledge.meta.rulesCount",{count:d.length})})]})})]}),y.jsx(dt,{title:t(n?"knowledge.actions.collapse":"knowledge.actions.expand"),children:y.jsx(ct,{type:"text",className:"knowledge-base-view__icon-button",onClick:()=>r(f=>!f),icon:y.jsx("span",{className:"material-symbols-rounded",children:n?"expand_less":"expand_more"})})})]})]}),n&&y.jsxs("div",{className:"knowledge-base-view__detail",children:[i&&y.jsx(gm,{}),!i&&s.trim()===""&&y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:t("knowledge.flows.noContent")}),!i&&s.trim()!==""&&y.jsx("div",{className:"knowledge-base-view__markdown",children:y.jsx(Xi,{content:s})})]})]})}function n1e({isLoading:e,specs:t,filteredSpecs:n,onCreate:r}){const{t:o}=Ot();return e?y.jsx("div",{className:"knowledge-base-view__spec-list",children:y.jsx(gm,{})}):t.length===0?y.jsx("div",{className:"knowledge-base-view__spec-list",children:y.jsx(Sl,{description:o("knowledge.flows.empty"),actionLabel:o("knowledge.flows.create"),onAction:r})}):n.length===0?y.jsx("div",{className:"knowledge-base-view__spec-list",children:y.jsx(Sl,{description:o("knowledge.filters.noResults"),variant:"simple"})}):y.jsx("div",{className:"knowledge-base-view__spec-list",children:y.jsx(nE,{data:n,renderItem:i=>y.jsx(ji.Item,{className:"knowledge-base-view__list-item",children:y.jsx(t1e,{spec:i})})})})}function r1e({specs:e,filteredSpecs:t,isLoading:n,query:r,tagOptions:o,tagFilter:i,onQueryChange:a,onTagFilterChange:s,onCreate:l,onImport:c}){const{t:d}=Ot();return y.jsxs(dy,{className:"knowledge-base-view__flows-tab",children:[y.jsx(uy,{title:d("knowledge.flows.title"),description:d("knowledge.flows.desc"),actions:y.jsxs(ea,{children:[y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"download"}),onClick:c,children:d("knowledge.actions.import")}),y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:l,children:d("knowledge.flows.create")})]})}),y.jsx(g4,{query:r,tagOptions:o,tagFilter:i,searchPlaceholder:d("knowledge.filters.search"),tagsPlaceholder:d("knowledge.filters.tags"),onQueryChange:a,onTagFilterChange:s}),y.jsx(n1e,{isLoading:n,specs:e,filteredSpecs:t,onCreate:l})]})}function o1e({onRefresh:e}){const{t}=Ot();return y.jsxs("div",{className:"knowledge-base-view__header",children:[y.jsx("div",{className:"knowledge-base-view__title",children:y.jsx("div",{className:"knowledge-base-view__title-text",children:t("knowledge.title")})}),y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"refresh"}),onClick:e,children:t("knowledge.actions.refresh")})]})}function i1e({rule:e}){const{t}=Ot(),[n,r]=J.useState(!1),{data:o,isLoading:i}=Qn(n?["rule-detail",e.id]:null,()=>Ffe(e.id)),a=o==null?void 0:o.rule,s=(a==null?void 0:a.body)??"",l=e.globs??[];return y.jsxs("div",{className:"knowledge-base-view__item",children:[y.jsxs("div",{className:"knowledge-base-view__item-row",children:[y.jsxs("div",{className:"knowledge-base-view__item-main",children:[y.jsxs("div",{className:"knowledge-base-view__item-title",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__item-icon",children:"gavel"}),y.jsx("span",{children:e.name})]}),y.jsx("div",{className:"knowledge-base-view__item-desc",children:e.description}),l.length>0&&y.jsx("div",{className:"knowledge-base-view__tag-list",children:l.map(c=>y.jsxs(Do,{className:"knowledge-base-view__tag",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__tag-icon",children:"folder"}),y.jsx("span",{children:c})]},c))})]}),y.jsxs("div",{className:"knowledge-base-view__item-meta",children:[e.always&&y.jsx(Do,{color:"blue",children:t("knowledge.meta.always")}),y.jsx(dt,{title:t(n?"knowledge.actions.collapse":"knowledge.actions.expand"),children:y.jsx(ct,{type:"text",className:"knowledge-base-view__icon-button",onClick:()=>r(c=>!c),icon:y.jsx("span",{className:"material-symbols-rounded",children:n?"expand_less":"expand_more"})})})]})]}),n&&y.jsxs("div",{className:"knowledge-base-view__detail",children:[i&&y.jsx(gm,{}),!i&&s.trim()===""&&y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:t("knowledge.rules.empty")}),!i&&s.trim()!==""&&y.jsx("div",{className:"knowledge-base-view__markdown",children:y.jsx(Xi,{content:s})})]})]})}function a1e({isLoading:e,rules:t,filteredRules:n,onCreate:r}){const{t:o}=Ot();return e?y.jsx("div",{className:"knowledge-base-view__rule-list",children:y.jsx(gm,{})}):t.length===0?y.jsx("div",{className:"knowledge-base-view__rule-list",children:y.jsx(Sl,{description:o("knowledge.rules.empty"),actionLabel:o("knowledge.rules.create"),onAction:r})}):n.length===0?y.jsx("div",{className:"knowledge-base-view__rule-list",children:y.jsx(Sl,{description:o("knowledge.filters.noResults"),variant:"simple"})}):y.jsx("div",{className:"knowledge-base-view__rule-list",children:y.jsx(nE,{data:n,renderItem:i=>y.jsx(ji.Item,{className:"knowledge-base-view__list-item",children:y.jsx(i1e,{rule:i})})})})}function s1e({rules:e,filteredRules:t,isLoading:n,query:r,onQueryChange:o,onCreate:i,onImport:a}){const{t:s}=Ot();return y.jsxs(dy,{className:"knowledge-base-view__rules-tab",children:[y.jsx(uy,{title:s("knowledge.rules.title"),description:s("knowledge.rules.desc"),actions:y.jsxs(ea,{children:[y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"download"}),onClick:a,children:s("knowledge.actions.import")}),y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:i,children:s("knowledge.rules.create")})]})}),y.jsx("div",{className:"knowledge-base-view__filters",children:y.jsx(Ft,{className:"knowledge-base-view__filter-input",prefix:y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__filter-icon",children:"search"}),placeholder:s("knowledge.filters.search"),allowClear:!0,value:r,onChange:l=>o(l.target.value)})}),y.jsx(a1e,{isLoading:n,rules:e,filteredRules:t,onCreate:i})]})}function l1e({onCreate:e,onImport:t}){const{t:n}=Ot();return y.jsxs(dy,{className:"knowledge-base-view__skills-tab",children:[y.jsx(uy,{title:n("knowledge.skills.title"),description:n("knowledge.skills.desc"),actions:y.jsxs(ea,{children:[y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"download"}),onClick:t,children:n("knowledge.actions.import")}),y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:e,children:n("knowledge.skills.create")})]})}),y.jsx(Sl,{description:n("knowledge.skills.empty"),actionLabel:n("knowledge.skills.create"),onAction:e})]})}function pp({icon:e,label:t}){return y.jsxs("span",{className:"knowledge-base-view__tab-label",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__tab-icon",children:e}),y.jsx("span",{children:t})]})}function c1e(){const{t:e}=Ot(),{message:t}=Eo.useApp(),{data:n,isLoading:r,mutate:o}=Qn("/api/ai/specs"),{data:i,isLoading:a,mutate:s}=Qn("/api/ai/entities"),{data:l,isLoading:c,mutate:d}=Qn("/api/ai/rules"),f=(n==null?void 0:n.specs)??[],m=(i==null?void 0:i.entities)??[],p=(l==null?void 0:l.rules)??[],[h,b]=J.useState(""),[x,g]=J.useState([]),[v,S]=J.useState(""),[C,_]=J.useState([]),[w,N]=J.useState(""),{values:k,update:E}=ju({keys:["kbTab"],defaults:{kbTab:"skills"}}),$=J.useMemo(()=>{const q=new Set;return f.forEach(U=>{var te;(te=U.tags)==null||te.forEach(le=>q.add(le))}),Array.from(q).sort().map(U=>({label:U,value:U}))},[f]),O=J.useMemo(()=>{const q=new Set;return m.forEach(U=>{var te;(te=U.tags)==null||te.forEach(le=>q.add(le))}),Array.from(q).sort().map(U=>({label:U,value:U}))},[m]),R=J.useMemo(()=>{const q=h.trim().toLowerCase();return f.filter(U=>{const te=U.tags??[];if(x.length>0&&!x.every(Z=>te.includes(Z)))return!1;if(q==="")return!0;const le=U.params.map(Z=>`${Z.name} ${Z.description??""}`).join(" "),ie=te.join(" "),ee=(U.skills??[]).join(" "),se=(U.rules??[]).join(" ");return`${U.name} ${U.description} ${le} ${ie} ${ee} ${se}`.toLowerCase().includes(q)})},[h,x,f]),T=J.useMemo(()=>{const q=v.trim().toLowerCase();return m.filter(U=>{const te=U.tags??[];if(C.length>0&&!C.every(re=>te.includes(re)))return!1;if(q==="")return!0;const le=te.join(" "),ie=(U.skills??[]).join(" "),ee=(U.rules??[]).join(" ");return`${U.name} ${U.description} ${le} ${ie} ${ee}`.toLowerCase().includes(q)})},[v,C,m]),I=J.useMemo(()=>{const q=w.trim().toLowerCase();return p.filter(U=>{if(q==="")return!0;const te=(U.globs??[]).join(" ");return`${U.name} ${U.description} ${te}`.toLowerCase().includes(q)})},[w,p]),P=async()=>{await Promise.all([o(),s(),d()]),t.success(e("knowledge.actions.refreshed"))},j=()=>{t.info(e("knowledge.flows.createHint"))},L=()=>{t.info(e("knowledge.flows.importHint"))},D=()=>{t.info(e("knowledge.entities.createHint"))},z=()=>{t.info(e("knowledge.entities.importHint"))},M=()=>{t.info(e("knowledge.skills.createHint"))},H=()=>{t.info(e("knowledge.skills.importHint"))},F=()=>{t.info(e("knowledge.rules.createHint"))},A=()=>{t.info(e("knowledge.rules.importHint"))},B=[{key:"skills",label:y.jsx(pp,{icon:"psychology",label:e("knowledge.tabs.skills")}),children:y.jsx(l1e,{onCreate:M,onImport:H})},{key:"entities",label:y.jsx(pp,{icon:"group_work",label:e("knowledge.tabs.entities")}),children:y.jsx(e1e,{entities:m,filteredEntities:T,isLoading:a,query:v,tagOptions:O,tagFilter:C,onQueryChange:S,onTagFilterChange:_,onCreate:D,onImport:z})},{key:"flows",label:y.jsx(pp,{icon:"account_tree",label:e("knowledge.tabs.flows")}),children:y.jsx(r1e,{specs:f,filteredSpecs:R,isLoading:r,query:h,tagOptions:$,tagFilter:x,onQueryChange:b,onTagFilterChange:g,onCreate:j,onImport:L})},{key:"rules",label:y.jsx(pp,{icon:"gavel",label:e("knowledge.tabs.rules")}),children:y.jsx(s1e,{rules:p,filteredRules:I,isLoading:c,query:w,onQueryChange:N,onCreate:F,onImport:A})}],K=J.useMemo(()=>B.map(q=>q.key),[B]),W=K.includes(k.kbTab)?k.kbTab:K[0];return J.useEffect(()=>{k.kbTab!==W&&E({kbTab:W})},[W,E,k.kbTab]),y.jsxs("div",{className:"knowledge-base-view",children:[y.jsx(o1e,{onRefresh:P}),y.jsx(L_,{className:"knowledge-base-view__tabs",items:B,activeKey:W,onChange:q=>E({kbTab:q})})]})}function u1e(){return y.jsx(c1e,{})}function d1e(){return y.jsxs(Aue,{children:[y.jsx(Ya,{path:"/",element:y.jsx(NP,{})}),y.jsx(Ya,{path:"/session/:sessionId",element:y.jsx(NP,{})}),y.jsx(Ya,{path:"/archive",element:y.jsx(ume,{})}),y.jsx(Ya,{path:"/benchmark",element:y.jsx(SCe,{})}),y.jsx(Ya,{path:"/automation",element:y.jsx(bme,{})}),y.jsx(Ya,{path:"/knowledge",element:y.jsx(u1e,{})}),y.jsx(Ya,{path:"/config",element:y.jsx(Q_e,{})})]})}function f1e(){ame();const{isDarkMode:e,themeConfig:t}=eme(),n=lme();return y.jsx(Ai,{theme:t,children:y.jsx(Jfe,{activeSessionId:n.activeSessionId,isDarkMode:e,onDeletedSession:n.handleDeletedSession,onSelectSession:n.handleSelectSession,showSidebar:n.showSidebar,sidebarWidth:n.sidebarWidth,children:y.jsx(d1e,{})})})}const m1e=dz(document.getElementById("root")),p1e=Gde();m1e.render(y.jsx(J.StrictMode,{children:y.jsx(Ai,{locale:Dce,theme:{token:{colorPrimary:"#000000"}},children:y.jsx(Eo,{children:y.jsx(Vde,{value:{fetcher:async e=>Rr(e)},children:y.jsx(sde,{basename:p1e,children:y.jsx(f1e,{})})})})})}));export{oe as _,q6 as a,A1 as b,U6 as c,Js as d,Dd as e,Da as g,Mx as s};
|
|
557
|
+
`.trim(),I_e=`data:image/svg+xml;utf8,${encodeURIComponent(O_e)}`,R_e="OpenCode",P_e={"claude-code":{title:E_e,icon:__e},codex:{title:N_e,icon:k_e},opencode:{title:R_e,icon:I_e}},T_e=e=>P_e[e]??{title:e,icon:void 0},J1=e=>e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{},d4=e=>Array.isArray(e)?e.map(t=>yn(t)).filter(t=>!!t):[],yn=e=>typeof e=="string"&&e.trim()!==""?e.trim():void 0,Ld=(e,t)=>`${e},${t}`,iu=e=>{const t=yn(e);if(!t||!t.includes(","))return;const[n,r]=t.split(/,(.+)/),o=yn(n),i=yn(r);if(!(!o||!i))return{serviceKey:o,modelName:i,selectorValue:Ld(o,i)}},j_e=e=>{const t=[];for(const[n,r]of Object.entries(e)){const o=yn(n);if(!o)continue;const i=r!=null&&typeof r=="object"?r:void 0,a=Array.isArray(i==null?void 0:i.models)?i.models:[];for(const s of a){const l=yn(s);l&&t.push({serviceKey:o,model:l,selectorValue:Ld(o,l)})}}return t},M_e=(e,t,n)=>e.find(r=>r.serviceKey===t&&r.model===n),MC=e=>{var i;const t=yn(e.value);if(!t)return;const n=iu(t);if(n){const a=M_e(e.serviceModels,n.serviceKey,n.modelName);return a?a.selectorValue:void 0}const r=e.serviceModels.filter(a=>a.model===t);if(r.length===0)return;const o=yn(e.preferredServiceKey);if(o){const a=r.find(s=>s.serviceKey===o);if(a)return a.selectorValue}return(i=r[0])==null?void 0:i.selectorValue},eE=e=>{const t=yn(e.value);if(!t)return;const n=new Set(Array.from(e.builtinModels??[]).map(i=>yn(i)).filter(i=>!!i));if(n.has(t))return t;const r=MC({value:t,serviceModels:e.serviceModels,preferredServiceKey:e.preferredServiceKey});if(r)return r;const o=iu(t);return o!=null&&o.modelName&&n.has(o.modelName)?o.modelName:e.preserveUnknown===!1?void 0:t},A_e=e=>{var o;const t=Array.from(e.builtinModels??[]).map(i=>yn(i)).filter(i=>!!i),n=yn(e.defaultModel);if(n){const i=iu(n),a=eE({value:n,builtinModels:t,serviceModels:e.serviceModels,preferredServiceKey:(i==null?void 0:i.serviceKey)??e.defaultModelService,preserveUnknown:e.preserveUnknownDefaultModel});if(a)return a}const r=yn(e.defaultModelService);if(r){const i=e.serviceModels.find(a=>a.serviceKey===r);if(i)return i.selectorValue}return t.length>0?t[0]:(o=e.serviceModels[0])==null?void 0:o.selectorValue},L_e=e=>{var o;const t=yn(e.model);if(!t)return;const n=iu(t),r=n==null?[t]:[n.selectorValue,n.modelName,n.serviceKey];for(const i of r){const a=(o=e.models)==null?void 0:o[i];if(a!=null&&typeof a=="object"&&!Array.isArray(a))return a}},D_e=e=>{var t;return yn((t=L_e(e))==null?void 0:t.defaultAdapter)},tE=e=>{const t=J1(e);return yn(t.defaultModel)??yn(t.model)},bP=e=>d4(J1(e).includeModels),xP=e=>d4(J1(e).excludeModels),f4=e=>{const t=tE(e.adapterConfig);return eE({value:t,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preferredServiceKey:e.preferredServiceKey,preserveUnknown:e.preserveUnknown})},SP=e=>{const t=yn(e.model),n=yn(e.selector);if(!t||!n)return!1;const r=iu(t),o=iu(n);return r?o?r.serviceKey===o.serviceKey&&r.modelName===o.modelName:r.serviceKey===n||r.modelName===n||t===n:t===n},CP=e=>{const t=yn(e.model);if(!t||t==="default")return{allowed:!0,includeModels:bP(e.adapterConfig),excludeModels:xP(e.adapterConfig)};const n=bP(e.adapterConfig),r=xP(e.adapterConfig),o=t===tE(e.adapterConfig);return r.some(i=>SP({model:t,selector:i}))?{allowed:!1,reason:"excluded",includeModels:n,excludeModels:r}:!o&&n.length>0&&!n.some(i=>SP({model:t,selector:i}))?{allowed:!1,reason:"not_included",includeModels:n,excludeModels:r}:{allowed:!0,includeModels:n,excludeModels:r}},wP=e=>{const t=yn(e.model);if(!t)return{model:t};const n=CP({model:t,adapterConfig:e.adapterConfig});if(n.allowed)return{model:t};const r=f4({adapterConfig:e.adapterConfig,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preferredServiceKey:e.preferredServiceKey,preserveUnknown:e.preserveUnknownDefaultModel});if(!r)return{error:{type:"missing_default_model",adapter:e.adapter,requestedModel:t,defaultModel:tE(e.adapterConfig),reason:n.reason??"not_included",includeModels:n.includeModels.length>0?n.includeModels:void 0,excludeModels:n.excludeModels.length>0?n.excludeModels:void 0}};const o=CP({model:r,adapterConfig:e.adapterConfig});return o.allowed?{model:r,warning:{type:"adapter_model_fallback",adapter:e.adapter,requestedModel:t,resolvedModel:r,reason:n.reason??"not_included",includeModels:n.includeModels.length>0?n.includeModels:void 0,excludeModels:n.excludeModels.length>0?n.excludeModels:void 0}}:{error:{type:"default_model_not_allowed",adapter:e.adapter,requestedModel:t,defaultModel:r,reason:o.reason??"not_included",includeModels:o.includeModels.length>0?o.includeModels:void 0,excludeModels:o.excludeModels.length>0?o.excludeModels:void 0}}},z_e=e=>eE({value:e.value,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preferredServiceKey:e.defaultModelService,preserveUnknown:e.preserveUnknown}),m4=e=>A_e({defaultModel:e.defaultModel,defaultModelService:e.defaultModelService,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preserveUnknownDefaultModel:e.preserveUnknownDefaultModel}),p4=e=>{const t=yn(e.value),n=Array.from(e.availableAdapters),r=new Set(n),o=yn(e.defaultAdapter);return t&&(r.has(t)||e.preserveUnknown===!0)?t:o&&r.has(o)?o:n[0]},B_e=(e,t)=>{const n=yn(e);return n?Object.entries(t).filter(([,r])=>Array.isArray(r)&&r.some(o=>(o==null?void 0:o.value)===n)).map(([r])=>r):[]},F_e=e=>{const t=Array.from(e.availableAdapters),n=new Set(t),r=D_e({model:e.model,models:e.modelMetadata});if(r&&n.has(r))return r;const o=B_e(e.model,e.adapterBuiltinModels??{}),i=yn(e.defaultAdapter);return i&&o.includes(i)?i:o.length>0?o[0]:p4({availableAdapters:t,defaultAdapter:e.defaultAdapter})},H_e=e=>{var n;const t=f4({adapterConfig:e.adapter!=null?(n=e.adapters)==null?void 0:n[e.adapter]:void 0,builtinModels:e.builtinModels,serviceModels:e.serviceModels,preferredServiceKey:e.defaultModelService,preserveUnknown:!1});return t||m4({defaultModel:e.defaultModel,defaultModelService:e.defaultModelService,builtinModels:e.builtinModels??e.fallbackBuiltinModels,serviceModels:e.serviceModels,preserveUnknownDefaultModel:!1})},$0="vf_chat_adapter",k0="vf_chat_selected_model",h4="vf_chat_selection_driver",AC=e=>{try{const t=localStorage.getItem(e);return t==null||t.trim()===""?void 0:t}catch{return}},V_e=()=>AC(h4)==="model"?"model":"adapter",ql=e=>Array.isArray(e)?e.map(t=>t.value):[];function W_e({adapterLocked:e=!1}={}){var H,F,A,B,K,W,q,U,te,le,ie,ee,se,re,Z,X,ce,pe,ge,we;const{t}=Ot(),[n,r]=u.useState(()=>AC($0)),[o,i]=u.useState(()=>AC(k0)),[a,s]=u.useState(()=>V_e()),{data:l}=Qn("/api/config",b1),c=u.useMemo(()=>{var ae,de;return((de=(ae=l==null?void 0:l.sources)==null?void 0:ae.merged)==null?void 0:de.adapters)??{}},[(F=(H=l==null?void 0:l.sources)==null?void 0:H.merged)==null?void 0:F.adapters]),d=u.useMemo(()=>{var ae,de;return((de=(ae=l==null?void 0:l.sources)==null?void 0:ae.merged)==null?void 0:de.models)??{}},[(B=(A=l==null?void 0:l.sources)==null?void 0:A.merged)==null?void 0:B.models]),f=u.useMemo(()=>{var ae,de;return((de=(ae=l==null?void 0:l.sources)==null?void 0:ae.merged)==null?void 0:de.modelServices)??{}},[(W=(K=l==null?void 0:l.sources)==null?void 0:K.merged)==null?void 0:W.modelServices]),m=u.useMemo(()=>{var de,ue,me;const ae=(me=(ue=(de=l==null?void 0:l.sources)==null?void 0:de.merged)==null?void 0:ue.general)==null?void 0:me.recommendedModels;return Array.isArray(ae)?ae.filter(Ce=>Ce!=null&&typeof Ce=="object"&&typeof Ce.model=="string"&&Ce.model.trim()!==""):[]},[(te=(U=(q=l==null?void 0:l.sources)==null?void 0:q.merged)==null?void 0:U.general)==null?void 0:te.recommendedModels]),p=u.useMemo(()=>{var ae,de;return((de=(ae=l==null?void 0:l.sources)==null?void 0:ae.merged)==null?void 0:de.adapterBuiltinModels)??{}},[(ie=(le=l==null?void 0:l.sources)==null?void 0:le.merged)==null?void 0:ie.adapterBuiltinModels]),h=yn((re=(se=(ee=l==null?void 0:l.sources)==null?void 0:ee.merged)==null?void 0:se.general)==null?void 0:re.defaultAdapter),b=yn((ce=(X=(Z=l==null?void 0:l.sources)==null?void 0:Z.merged)==null?void 0:X.general)==null?void 0:ce.defaultModelService),x=yn((we=(ge=(pe=l==null?void 0:l.sources)==null?void 0:pe.merged)==null?void 0:ge.general)==null?void 0:we.defaultModel),g=u.useMemo(()=>Object.keys(c),[c]),v=u.useMemo(()=>j_e(f),[f]),S=u.useMemo(()=>Object.values(p).flatMap(ae=>ql(ae)),[p]),C=u.useMemo(()=>n&&p[n]?{[n]:p[n]}:p,[p,n]),_=u.useMemo(()=>Object.values(C).flatMap(ae=>ql(ae)),[C]),w=v.length>0||_.length>0,N=u.useCallback(ae=>p4({value:ae,availableAdapters:g,defaultAdapter:h}),[g,h]),k=u.useCallback((ae,de,ue=!1)=>z_e({value:ae,builtinModels:de,serviceModels:v,defaultModelService:b,preserveUnknown:ue}),[v,b]),E=u.useCallback(ae=>{const de=ql(ae!=null?p[ae]:void 0),ue=H_e({adapter:ae,adapters:c,defaultModel:x,defaultModelService:b,builtinModels:de,fallbackBuiltinModels:S,serviceModels:v});return!ae||!ue?ue:wP({adapter:ae,model:ue,adapterConfig:c[ae],builtinModels:de,serviceModels:v,preferredServiceKey:b,preserveUnknownDefaultModel:!1}).model??ue},[p,S,v,x,b,c]),$=u.useCallback((ae,de)=>!ae||!de?de:wP({adapter:ae,model:de,adapterConfig:c[ae],builtinModels:ql(p[ae]),serviceModels:v,preferredServiceKey:b,preserveUnknownDefaultModel:!1}).model??de,[p,v,b,c]),O=u.useCallback(ae=>F_e({model:ae,availableAdapters:g,defaultAdapter:h,adapterBuiltinModels:p,modelMetadata:d}),[p,g,h,d]),R=u.useMemo(()=>m4({defaultModel:x,defaultModelService:b,builtinModels:S,serviceModels:v,preserveUnknownDefaultModel:!1}),[S,v,x,b]);u.useEffect(()=>{if(e)return;if(g.length===0){r(void 0),w||i(void 0);return}if(!w){i(void 0),r(ue=>N(ue));return}if(a==="model"){const ue=k(o,S,!1)??R,me=O(ue)??N(n),Ce=$(me,ue);i(ne=>ne===Ce?ne:Ce),r(ne=>ne===me?ne:me);return}const ae=N(n),de=E(ae);r(ue=>ue===ae?ue:ae),i(ue=>ue===de?ue:de)},[e,S,g.length,w,O,$,N,E,k,R,n,o,a]),u.useEffect(()=>{try{n==null||n.trim()===""?localStorage.removeItem($0):localStorage.setItem($0,n)}catch{}},[n]),u.useEffect(()=>{try{o==null||o.trim()===""?localStorage.removeItem(k0):localStorage.setItem(k0,o)}catch{}},[o]),u.useEffect(()=>{try{localStorage.setItem(h4,a)}catch{}},[a]);const T=u.useCallback(ae=>{const de=e?ql(n!=null?p[n]:void 0):S,ue=k(ae,de,!1);if(!ue)return;s("model");const me=e?n:O(ue)??N(n),Ce=$(me,ue);i(ne=>ne===Ce?ne:Ce),!e&&r(ne=>ne===me?ne:me)},[p,e,S,$,O,N,k,n]),I=u.useCallback(ae=>{const de=N(ae);if(s("adapter"),r(me=>me===de?me:de),e)return;const ue=E(de);i(me=>me===ue?me:ue)},[e,N,E]),P=u.useCallback(ae=>{const de=yn(ae.adapter)??N(void 0),ue=ql(de!=null?p[de]:void 0),me=k(ae.model,ue,!0)??k(ae.model,S,!0)??yn(ae.model)??E(de);r(Ce=>Ce===de?Ce:de),i(Ce=>Ce===me?Ce:me)},[p,S,N,E,k]),j=u.useMemo(()=>k(o,_,!0)??o,[_,k,o]),L=u.useMemo(()=>g.map(ae=>{const de=T_e(ae);return{value:ae,label:u.createElement("span",{className:"adapter-option"},[de.icon!=null?u.createElement("img",{key:"icon",className:"adapter-option__icon",src:de.icon,alt:"","aria-hidden":!0}):null,u.createElement("span",{key:"text",className:"adapter-option__text"},de.title)])}}),[g]),D=u.useMemo(()=>Object.entries(f),[f]),z=u.useMemo(()=>{var de;const ae=new Map;for(const ue of v){const me=f[ue.serviceKey],Ce=((de=me==null?void 0:me.title)==null?void 0:de.trim())!==""?(me==null?void 0:me.title)??"":ue.serviceKey;ae.has(ue.model)||ae.set(ue.model,{key:ue.serviceKey,title:Ce})}return ae},[v,f]),M=u.useMemo(()=>{const ae=ne=>{var $e;const he=($e=ne.description)==null?void 0:$e.trim(),ye=y.jsxs("div",{className:"model-option",children:[y.jsx("div",{className:"model-option-title",children:ne.title}),he&&y.jsx("div",{className:"model-option-desc",children:he})]}),xe=[ne.title,ne.value,ne.serviceTitle,ne.serviceKey,he].filter(Boolean).join(" ");return{value:ne.value,label:ye,searchText:xe,displayLabel:ne.title}},de=(ne,he)=>{if(ne){for(const[ye,xe]of Object.entries(ne))if(Array.isArray(xe)&&xe.includes(he))return ye}},ue=D.map(([ne,he])=>{var Oe;const ye=he!=null&&typeof he=="object"?he:void 0,xe=((Oe=ye==null?void 0:ye.title)==null?void 0:Oe.trim())!==""?(ye==null?void 0:ye.title)??"":ne,$e=(xe==null?void 0:xe.trim())!==""?xe:ne,Se=ye==null?void 0:ye.description,be=Array.isArray(ye==null?void 0:ye.models)?ye.models.filter(Me=>typeof Me=="string"):[];if(be.length===0)return null;const ke=be.map(Me=>{const _e=de(ye==null?void 0:ye.modelsAlias,Me),je=_e??Me,Fe=_e?Me:xe;return ae({value:Ld(ne,Me),title:je,description:Fe,serviceKey:ne,serviceTitle:xe})});return{label:y.jsxs("div",{className:"model-group-label",children:[y.jsx("div",{className:"model-group-title",children:$e}),Se&&y.jsx("div",{className:"model-group-desc",children:Se})]}),options:ke}}).filter(ne=>ne!=null),me=m.filter(ne=>ne.placement&&ne.placement!=="modelSelector"?!1:MC({value:ne.service?Ld(ne.service,ne.model):ne.model,serviceModels:v,preferredServiceKey:ne.service??b})!=null).map(ne=>{var ke,Oe,Me,_e,je;const he=ne.service?f[ne.service]:void 0,ye=ne.service?((ke=he==null?void 0:he.title)==null?void 0:ke.trim())!==""?(he==null?void 0:he.title)??"":ne.service:(Oe=z.get(ne.model))==null?void 0:Oe.title,xe=ne.service?de(he==null?void 0:he.modelsAlias,ne.model):void 0,$e=((Me=ne.title)==null?void 0:Me.trim())!==""?ne.title??"":xe??ne.model,Se=((_e=ne.description)==null?void 0:_e.trim())!==""?ne.description:ye,be=MC({value:ne.service?Ld(ne.service,ne.model):ne.model,serviceModels:v,preferredServiceKey:ne.service??b})??ne.model;return ae({value:be,title:$e,description:Se,serviceKey:ne.service??((je=z.get(ne.model))==null?void 0:je.key),serviceTitle:ye})}),Ce=[];if(me.length>0){const ne=t("chat.modelGroupRecommended",{defaultValue:"推荐模型"});Ce.push({label:y.jsx("div",{className:"model-group-label",children:y.jsx("div",{className:"model-group-title",children:ne})}),options:me})}for(const[ne,he]of Object.entries(C)){if(!Array.isArray(he)||he.length===0)continue;const ye=t("chat.modelGroupBuiltin",{adapter:ne,defaultValue:`${ne} (Default)`});Ce.push({label:y.jsx("div",{className:"model-group-label",children:y.jsx("div",{className:"model-group-title",children:ye})}),options:he.map(xe=>ae({value:xe.value,title:xe.title,description:xe.description}))})}return[...Ce,...ue]},[C,v,b,f,D,z,m,t]);return{adapterOptions:L,applySessionSelection:P,hasAvailableModels:w,modelOptions:M,selectedAdapter:n,selectedModel:o,selectedModelWithService:j,setSelectedAdapter:I,setSelectedModel:T}}const _P="vf_chat_permission_mode",EP=e=>e==="default"||e==="acceptEdits"||e==="plan"||e==="dontAsk"||e==="bypassPermissions";function K_e(){const[e,t]=u.useState("default"),n=o=>{if(o!=null&&EP(o)){t(o);return}t("default")};u.useEffect(()=>{try{const o=localStorage.getItem(_P);o&&EP(o)&&n(o)}catch{}},[]),u.useEffect(()=>{try{localStorage.setItem(_P,e)}catch{}},[e]);const r=u.useMemo(()=>[{value:"default",label:"默认"},{value:"acceptEdits",label:"接受编辑"},{value:"plan",label:"计划"},{value:"dontAsk",label:"不询问"},{value:"bypassPermissions",label:"跳过权限"}],[]);return{permissionMode:e,setPermissionMode:n,permissionModeOptions:r}}const $P=(e,t)=>t.type!=="message"?e:e.find(r=>r.id===t.message.id)!=null?e.map(r=>r.id===t.message.id?t.message:r):[...e,t.message],kP=(e,t)=>{if(t.type!=="tool_result")return e;const n=t.isError===!0?"error":"success";return e.map(r=>r.toolCall!=null&&r.toolCall.id===t.toolCallId?{...r,toolCall:{...r.toolCall,status:n,output:t.output}}:r)};function U_e({session:e,modelForQuery:t,effort:n,permissionMode:r,adapter:o,setInteractionRequest:i}){const{t:a}=Ot(),{mutate:s}=Yv(),[l,c]=u.useState([]),[d,f]=u.useState(null),[m,p]=u.useState(!1),[h,b]=u.useState(null),[x,g]=u.useState(0),v=u.useRef(!0),S=u.useRef(void 0),C=u.useRef(void 0),_=u.useRef(void 0),w=u.useRef(void 0),N=u.useRef(!1),k=u.useCallback(()=>{(e==null?void 0:e.id)==null||e.id===""||(N.current=!0,b(null),Ca.close(e.id),g(E=>E+1))},[e==null?void 0:e.id]);return u.useEffect(()=>{if(c([]),f(null),p(!1),b(null),i(null),v.current=!0,(e==null?void 0:e.id)==null||e.id===""){p(!0),S.current=void 0,C.current=void 0,_.current=void 0,w.current=void 0;return}let E=!1;return(async()=>{try{const O=await Wfe(e.id);if(E)return;const R=O.messages;if(O.session){const P=O.session;s("/api/sessions",j=>{if((j==null?void 0:j.sessions)==null)return j;const L=j.sessions.map(D=>D.id===P.id?{...D,...P}:D);return{...j,sessions:L}},!1)}O.interaction&&i(O.interaction);let T=[],I=null;for(const P of R)T=$P(T,P),T=kP(T,P),P.type==="session_info"&&P.info!=null&&P.info.type!=="summary"&&(I=P.info);c(T),f(I),setTimeout(()=>{E||(p(!0),v.current=!1)},100)}catch(O){console.error("Failed to fetch history messages:",O)}})(),()=>{E=!0}},[s,e==null?void 0:e.id,i]),u.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id==="")return;let E=!1,$;const O=t??"",R=t!=null&&S.current!=null&&O!==S.current&&(e==null?void 0:e.status)!=="running",T=n==="default"?"":n,I=C.current!=null&&T!==C.current&&(e==null?void 0:e.status)!=="running",P=r??"",j=r!=null&&_.current!=null&&P!==_.current&&(e==null?void 0:e.status)!=="running",L=o??"",D=o!=null&&w.current!=null&&L!==w.current&&(e==null?void 0:e.status)!=="running";(R||I||j||D)&&(N.current=!0,b(null),Ca.send(e.id,{type:"terminate_session"}),Ca.close(e.id)),S.current=O,C.current=T,_.current=P,w.current=L;const z=setTimeout(()=>{if(E)return;const M={};t&&(M.model=t),n!=="default"&&(M.effort=n),r&&(M.permissionMode=r),o&&(M.adapter=o),$=Ca.connect(e.id,{onOpen(){N.current=!1,b(null)},onMessage(H){var F;if(!E){if(H.type==="error"){b(((F=H.data)==null?void 0:F.message)??H.message??"Unknown error");return}if(H.type==="session_updated"){s("/api/sessions",A=>{if((A==null?void 0:A.sessions)==null)return A;const B=H.session;if("isDeleted"in B&&B.isDeleted)return{...A,sessions:A.sessions.filter(q=>q.id!==B.id)};const K=B,W=A.sessions.map(q=>q.id===K.id?{...q,...K}:q);return!W.some(q=>q.id===K.id)&&!("isDeleted"in B)&&W.unshift(K),{...A,sessions:W}},!1);return}if(H.type==="message"){c(A=>$P(A,H));return}if(H.type==="session_info"){H.info!=null&&H.info.type==="summary"?s("/api/sessions"):(f(H.info??null),v.current&&setTimeout(()=>{E||v.current&&(p(!0),v.current=!1)},100));return}if(H.type==="tool_result"){c(A=>kP(A,H));return}H.type==="interaction_request"&&i({id:H.id,payload:H.payload})}},onError(){E||b(a("chat.connectionError"))},onClose(){if(!E){if(N.current){N.current=!1;return}b(H=>H??a("chat.connectionClosed"))}}},Object.keys(M).length>0?M:void 0)},R||I||j||D?200:100);return()=>{E=!0,clearTimeout(z),$==null||$()}},[o,n,t,s,r,x,e==null?void 0:e.id,e==null?void 0:e.status,i,a]),{messages:l,setMessages:c,sessionInfo:d,isReady:m,connectionError:h,retryConnection:k}}const G_e=e=>e==="timeline"||e==="settings"||e==="history"?e:"history";function q_e(){const{values:e,update:t}=ju({keys:["view"],defaults:{view:"history"},omit:{view:o=>o==="history"}}),n=G_e(e.view),r=u.useCallback(o=>{t({view:o})},[t]);return u.useEffect(()=>{n!==e.view&&t({view:n})},[n,e.view,t]),{activeView:n,setActiveView:r}}function X_e({session:e}){const{t}=Ot(),{adapterOptions:n,applySessionSelection:r,selectedAdapter:o,selectedModel:i,selectedModelWithService:a,setSelectedModel:s,setSelectedAdapter:l,modelOptions:c,hasAvailableModels:d}=W_e({adapterLocked:(e==null?void 0:e.id)!=null}),{permissionMode:f,setPermissionMode:m,permissionModeOptions:p}=K_e(),{effort:h,setEffort:b,effortOptions:x}=S_e(),{activeView:g,setActiveView:v}=q_e(),{interactionRequest:S,setInteractionRequest:C,handleInteractionResponse:_}=C_e({sessionId:e==null?void 0:e.id}),{messages:w,setMessages:N,sessionInfo:k,isReady:E,connectionError:$,retryConnection:O}=U_e({session:e,modelForQuery:a,effort:h,permissionMode:f,adapter:o,setInteractionRequest:C}),R=u.useRef(null),T=(e==null?void 0:e.status)==="running";return u.useEffect(()=>{if((e==null?void 0:e.id)==null||e.id===""){R.current=null;return}const I=R.current,P=(I==null?void 0:I.id)!==e.id;(P||(I==null?void 0:I.model)!==e.model||(I==null?void 0:I.adapter)!==e.adapter)&&r({model:e.model,adapter:e.adapter}),(P||(I==null?void 0:I.permissionMode)!==e.permissionMode)&&m(e.permissionMode),(P||(I==null?void 0:I.effort)!==e.effort)&&b(e.effort),R.current={id:e.id,model:e.model,permissionMode:e.permissionMode,adapter:e.adapter,effort:e.effort}},[e==null?void 0:e.adapter,e==null?void 0:e.effort,e==null?void 0:e.id,e==null?void 0:e.model,e==null?void 0:e.permissionMode,r,b,m]),{messages:w,sessionInfo:k,interactionRequest:S,isReady:E,connectionError:$,retryConnection:O,isThinking:T,activeView:g,setActiveView:v,handleInteractionResponse:_,setMessages:N,placeholder:e!=null&&e.id?void 0:t("chat.newSessionPlaceholder"),modelOptions:c,selectedModel:i,modelForQuery:a,setSelectedModel:s,effort:h,setEffort:b,effortOptions:x,permissionMode:f,setPermissionMode:m,permissionModeOptions:p,selectedAdapter:o,setSelectedAdapter:l,adapterOptions:n,hasAvailableModels:d,modelUnavailable:!d}}function NP(){const{t:e}=Ot(),{sessionId:t}=Sue(),n=Ts(),{data:r,isLoading:o}=Qn(t?"/api/sessions":null,()=>oB("active")),i=t==null||r==null?void 0:r.sessions.find(a=>a.id===t);return t!=null&&o?null:t!=null&&i==null?y.jsxs("div",{className:"chat-route__empty-state",children:[y.jsx(bn,{description:e("common.sessionNotFound")}),y.jsx(ct,{type:"primary",onClick:()=>void n("/"),children:e("common.backToHome")})]}):y.jsx(Y_e,{session:i})}function Y_e({session:e}){const{messages:t,sessionInfo:n,interactionRequest:r,isReady:o,connectionError:i,retryConnection:a,activeView:s,setActiveView:l,handleInteractionResponse:c,setMessages:d,placeholder:f,modelOptions:m,selectedModel:p,modelForQuery:h,setSelectedModel:b,effort:x,setEffort:g,effortOptions:v,permissionMode:S,setPermissionMode:C,permissionModeOptions:_,selectedAdapter:w,setSelectedAdapter:N,adapterOptions:k,hasAvailableModels:E,modelUnavailable:$}=X_e({session:e}),O=!(e!=null&&e.id)&&t.length===0;return y.jsxs("div",{className:`chat-container ${o?"ready":""} ${O?"is-new-session":""}`,children:[(e==null?void 0:e.id)&&y.jsx(pwe,{sessionInfo:n,sessionId:e.id,sessionTitle:e.title,isStarred:e.isStarred,isArchived:e.isArchived,tags:e.tags,lastMessage:e.lastMessage,lastUserMessage:e.lastUserMessage,activeView:s,onViewChange:l}),s==="history"&&y.jsx(a_e,{isReady:o,messages:t,session:e,sessionInfo:n,connectionError:i,onRetryConnection:a,interactionRequest:r,onInteractionResponse:c,setMessages:d,onClearMessages:()=>d([]),placeholder:f,modelOptions:m,selectedModel:p,modelForQuery:h,onModelChange:b,effort:x,effortOptions:v,onEffortChange:g,permissionMode:S,permissionModeOptions:_,onPermissionModeChange:C,selectedAdapter:w,adapterOptions:k,onAdapterChange:N,modelUnavailable:$,hasAvailableModels:E}),s==="timeline"&&y.jsx(x_e,{messages:t}),s==="settings"&&(e==null?void 0:e.id)&&y.jsx(s_e,{session:e,onClose:()=>l("history")})]})}function Q_e({t:e}){const[t,n]=um(rB);return y.jsxs("div",{className:"config-view__editor-wrap",children:[y.jsx("div",{className:"config-view__section-header",children:y.jsxs("div",{className:"config-view__section-title",children:[y.jsx("span",{className:"material-symbols-rounded config-view__section-icon",children:"tune"}),y.jsx("span",{children:e("config.sections.appearance")})]})}),y.jsx("div",{className:"config-view__card",children:y.jsx(kn,{title:e("config.appSettings.announcements.label"),description:e("config.appSettings.announcements.desc"),icon:"campaign",children:y.jsx(ta,{checked:t,onChange:n})})})]})}function Z_e(){var j,L,D,z,M,H,F,A;const{t:e}=Ot(),{message:t}=Eo.useApp(),{data:n,isLoading:r,error:o,mutate:i}=Qn("/api/config",b1),{values:a,update:s,searchParams:l}=ju({keys:["tab","source"],defaults:{tab:"general",source:"project"}}),c=a.source==="user"?"user":"project",d=B=>s({source:B}),[f,m]=u.useState({}),p=(j=n==null?void 0:n.meta)==null?void 0:j.configPresent,h=(L=n==null?void 0:n.sources)==null?void 0:L[c],b=u.useRef(f),x=u.useRef({}),g=u.useRef({}),v=u.useRef({}),S=u.useMemo(()=>{var B,K;return((K=(B=n==null?void 0:n.sources)==null?void 0:B.merged)==null?void 0:K.modelServices)??{}},[(z=(D=n==null?void 0:n.sources)==null?void 0:D.merged)==null?void 0:z.modelServices]),C=u.useMemo(()=>{var B,K;return((K=(B=n==null?void 0:n.sources)==null?void 0:B.merged)==null?void 0:K.adapters)??{}},[(H=(M=n==null?void 0:n.sources)==null?void 0:M.merged)==null?void 0:H.adapters]);u.useEffect(()=>{l.get("source")==null&&(p!=null&&p.project?s({source:"project"}):p!=null&&p.user&&s({source:"user"}))},[p==null?void 0:p.project,p==null?void 0:p.user]);const _=u.useMemo(()=>new Set(["general","conversation","models","modelServices","channels","adapters","plugins","mcp","shortcuts"]),[]),w=u.useMemo(()=>{var B,K;return[{key:"group-config",type:"group",label:e("config.groups.config")},{key:"general",icon:"tune",label:e("config.sections.general"),value:h==null?void 0:h.general},{key:"conversation",icon:"forum",label:e("config.sections.conversation"),value:h==null?void 0:h.conversation},{key:"models",icon:"tune",label:e("config.sections.models"),value:h==null?void 0:h.models},{key:"modelServices",icon:"model_training",label:e("config.sections.modelServices"),value:h==null?void 0:h.modelServices},{key:"channels",icon:"campaign",label:e("config.sections.channels"),value:h==null?void 0:h.channels},{key:"adapters",icon:"settings_input_component",label:e("config.sections.adapters"),value:h==null?void 0:h.adapters},{key:"plugins",icon:"extension",label:e("config.sections.plugins"),value:h==null?void 0:h.plugins},{key:"mcp",icon:"account_tree",label:e("config.sections.mcp"),value:h==null?void 0:h.mcp},{key:"shortcuts",icon:"keyboard",label:e("config.sections.shortcuts"),value:h==null?void 0:h.shortcuts},{key:"group-app",type:"group",label:e("config.groups.app")},{key:"appearance",icon:"tune",label:e("config.sections.appearance")},{key:"experiments",icon:"science",label:e("config.sections.experiments"),value:(B=n==null?void 0:n.meta)==null?void 0:B.experiments},{key:"about",icon:"info",label:e("config.sections.about"),value:(K=n==null?void 0:n.meta)==null?void 0:K.about}]},[h,(F=n==null?void 0:n.meta)==null?void 0:F.about,(A=n==null?void 0:n.meta)==null?void 0:A.experiments,e]),k=u.useMemo(()=>new Set(w.filter(B=>B.type!=="group").map(B=>B.key)),[w]).has(a.tab)?a.tab:"general",E=B=>s({tab:B}),$=u.useMemo(()=>w.find(B=>B.key===k),[w,k]);u.useEffect(()=>{if($==null||!_.has($.key))return;const B=`${c}:${$.key}`;m(K=>{const W=K[B],q=$.value??{};return W!==void 0?pg(W)&&!pg(q)?{...K,[B]:fp(q)}:K:{...K,[B]:fp(q)}})},[$,_,c]),u.useEffect(()=>{b.current=f},[f]),u.useEffect(()=>()=>{Object.values(x.current).forEach(B=>{clearTimeout(B)})},[]);const O=(B,K=c)=>`${K}:${B}`,R=u.useMemo(()=>{const B=O("general");return f[B]??fp((h==null?void 0:h.general)??{})??{}},[f,h==null?void 0:h.general,c]),T=(()=>{const B=qp(R,["defaultModelService"]);return typeof B=="string"?B:void 0})(),I=(B,K,W)=>{const q=O(B,K),U=JSON.stringify(W??{});v.current[q]!==U&&(x.current[q]&&clearTimeout(x.current[q]),x.current[q]=setTimeout(async()=>{if(g.current[q])return;const te=b.current[q]??W,le=JSON.stringify(te??{});if(v.current[q]!==le){g.current[q]=!0;try{await Ffe(K,B,te),v.current[q]=le,await i()}catch(ie){t.error(Mr(ie,e("config.saveFailed")))}finally{g.current[q]=!1}}},800))},P=(B,K)=>{const W=O(B);m(q=>({...q,[W]:K})),I(B,c,K)};return y.jsxs("div",{className:"config-view",children:[r&&y.jsx("div",{className:"config-view__state",children:y.jsx(tm,{})}),!r&&o!=null&&y.jsx("div",{className:"config-view__state",children:y.jsx(bn,{description:e("config.loadFailed")})}),!r&&o==null&&y.jsx("div",{className:"config-view__tabs-wrap",children:y.jsx(L_,{tabPosition:"left",tabBarGutter:4,indicator:{size:0},className:"config-view__tabs",activeKey:k,onChange:B=>{B!=="group-config"&&B!=="group-app"&&E(B)},items:w.map(B=>B.type==="group"?{key:B.key,label:y.jsx("span",{className:"config-view__group-label",children:B.label}),disabled:!0,children:y.jsx("div",{})}:{key:B.key,label:y.jsxs("span",{className:"config-view__tab-label",children:[y.jsx("span",{className:"material-symbols-rounded config-view__tab-icon",children:B.icon}),y.jsx("span",{className:"config-view__tab-text",children:B.label})]}),children:y.jsxs("div",{className:"config-view__content",children:[B.key==="about"&&y.jsx(_Ce,{value:B.value}),B.key==="appearance"&&y.jsx(Q_e,{t:e}),B.key!=="about"&&B.key!=="appearance"&&!_.has(B.key)&&y.jsx(e4,{value:B.value,sectionKey:B.key,t:e}),_.has(B.key)&&y.jsx(i4,{sectionKey:B.key,title:B.label,icon:B.icon,value:f[O(B.key)]??fp(B.value??{})??{},onChange:K=>P(B.key,K),mergedModelServices:S,mergedAdapters:C,selectedModelService:T,t:e,headerExtra:y.jsx(ea,{size:12,children:y.jsx(mwe,{value:c,onChange:d,options:[{value:"project",icon:"folder",label:(p==null?void 0:p.project)===!0?e("config.sources.project"):e("config.sources.projectMissing")},{value:"user",icon:"person",label:(p==null?void 0:p.user)===!0?e("config.sources.user"):e("config.sources.userMissing")}]})})})]})})})})]})}function J_e(){return y.jsx(Z_e,{})}function oa({className:e,...t}){const n=["knowledge-base-view__action-button",e].filter(Boolean).join(" ");return y.jsx(ct,{...t,className:n})}function Sl({description:e,actionLabel:t,onAction:n,variant:r="default"}){return r==="simple"?y.jsx("div",{className:"knowledge-base-view__empty-simple",children:y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:e})}):y.jsxs("div",{className:"knowledge-base-view__empty",children:[y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:e}),t&&n&&y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:n,children:t})]})}function _g({items:e}){return y.jsx("div",{className:"knowledge-base-view__meta-list",children:e.map(t=>y.jsxs("div",{className:"knowledge-base-view__meta-item",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-item-icon",children:"check_circle"}),y.jsx("span",{children:t})]},t))})}function e1e({entity:e}){const{t}=Ot(),n=e.tags??[],r=e.skills??[],o=e.rules??[];return y.jsx("div",{className:"knowledge-base-view__item",children:y.jsxs("div",{className:"knowledge-base-view__item-row",children:[y.jsxs("div",{className:"knowledge-base-view__item-main",children:[y.jsxs("div",{className:"knowledge-base-view__item-title",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__item-icon",children:"group_work"}),y.jsx("span",{children:e.name})]}),y.jsx("div",{className:"knowledge-base-view__item-desc",children:e.description}),n.length>0&&y.jsx("div",{className:"knowledge-base-view__tag-list",children:n.map(i=>y.jsxs(Do,{className:"knowledge-base-view__tag",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__tag-icon",children:"sell"}),y.jsx("span",{children:i})]},i))})]}),y.jsxs("div",{className:"knowledge-base-view__item-meta",children:[e.always&&y.jsx(Do,{color:"blue",children:t("knowledge.meta.always")}),y.jsxs("div",{className:"knowledge-base-view__meta-pills",children:[y.jsx(Gc,{content:y.jsx(_g,{items:r}),title:t("knowledge.meta.skills"),trigger:"click",placement:"bottomRight",children:y.jsxs(ct,{type:"text",className:"knowledge-base-view__meta-pill",disabled:r.length===0,children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-pill-icon",children:"psychology"}),y.jsx("span",{children:t("knowledge.meta.skillsCount",{count:r.length})})]})}),y.jsx(Gc,{content:y.jsx(_g,{items:o}),title:t("knowledge.meta.rules"),trigger:"click",placement:"bottomRight",children:y.jsxs(ct,{type:"text",className:"knowledge-base-view__meta-pill",disabled:o.length===0,children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-pill-icon",children:"gavel"}),y.jsx("span",{children:t("knowledge.meta.rulesCount",{count:o.length})})]})})]})]})]})})}function nE({data:e,renderItem:t}){return y.jsx(ji,{className:"knowledge-base-view__list",dataSource:e,renderItem:n=>t(n)})}function gm(){return y.jsx("div",{className:"knowledge-base-view__loading",children:y.jsx(tm,{})})}function t1e({isLoading:e,entities:t,filteredEntities:n,onCreate:r}){const{t:o}=Ot();return e?y.jsx("div",{className:"knowledge-base-view__entity-list",children:y.jsx(gm,{})}):t.length===0?y.jsx("div",{className:"knowledge-base-view__entity-list",children:y.jsx(Sl,{description:o("knowledge.entities.empty"),actionLabel:o("knowledge.entities.create"),onAction:r})}):n.length===0?y.jsx("div",{className:"knowledge-base-view__entity-list",children:y.jsx(Sl,{description:o("knowledge.filters.noResults"),variant:"simple"})}):y.jsx("div",{className:"knowledge-base-view__entity-list",children:y.jsx(nE,{data:n,renderItem:i=>y.jsx(ji.Item,{className:"knowledge-base-view__list-item",children:y.jsx(e1e,{entity:i})})})})}function g4({query:e,tagOptions:t,tagFilter:n,searchPlaceholder:r,tagsPlaceholder:o,onQueryChange:i,onTagFilterChange:a}){return y.jsxs("div",{className:"knowledge-base-view__filters",children:[y.jsx(Ft,{className:"knowledge-base-view__filter-input",prefix:y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__filter-icon",children:"search"}),placeholder:r,allowClear:!0,value:e,onChange:s=>i(s.target.value)}),y.jsx(Yn,{className:"knowledge-base-view__filter-select",mode:"multiple",placeholder:o,options:t,value:n,onChange:a,maxTagCount:"responsive",disabled:t.length===0})]})}function uy({title:e,description:t,actions:n}){return y.jsxs("div",{className:"knowledge-base-view__section-header",children:[y.jsxs("div",{className:"knowledge-base-view__section-info",children:[y.jsx("div",{className:"knowledge-base-view__section-title",children:e}),y.jsx("div",{className:"knowledge-base-view__section-desc",children:t})]}),n]})}function dy({children:e,className:t}){const n=["knowledge-base-view__content",t].filter(Boolean).join(" ");return y.jsx("div",{className:n,children:e})}function n1e({entities:e,filteredEntities:t,isLoading:n,query:r,tagOptions:o,tagFilter:i,onQueryChange:a,onTagFilterChange:s,onCreate:l,onImport:c}){const{t:d}=Ot();return y.jsxs(dy,{className:"knowledge-base-view__entities-tab",children:[y.jsx(uy,{title:d("knowledge.entities.title"),description:d("knowledge.entities.desc"),actions:y.jsxs(ea,{children:[y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"download"}),onClick:c,children:d("knowledge.actions.import")}),y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:l,children:d("knowledge.entities.create")})]})}),y.jsx(g4,{query:r,tagOptions:o,tagFilter:i,searchPlaceholder:d("knowledge.filters.search"),tagsPlaceholder:d("knowledge.filters.tags"),onQueryChange:a,onTagFilterChange:s}),y.jsx(t1e,{isLoading:n,entities:e,filteredEntities:t,onCreate:l})]})}function r1e({spec:e}){const{t}=Ot(),[n,r]=J.useState(!1),{data:o,isLoading:i}=Qn(n?["spec-detail",e.id]:null,()=>Hfe(e.id)),a=o==null?void 0:o.spec,s=(a==null?void 0:a.body)??"",l=e.tags??[],c=e.skills??[],d=e.rules??[];return y.jsxs("div",{className:"knowledge-base-view__item",children:[y.jsxs("div",{className:"knowledge-base-view__item-row",children:[y.jsxs("div",{className:"knowledge-base-view__item-main",children:[y.jsxs("div",{className:"knowledge-base-view__item-title",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__item-icon",children:"account_tree"}),y.jsx("span",{children:e.name})]}),y.jsx("div",{className:"knowledge-base-view__item-desc",children:e.description}),e.params.length>0&&y.jsx("div",{className:"knowledge-base-view__params",children:e.params.map(f=>y.jsxs("div",{className:"knowledge-base-view__param",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__param-icon",children:"tune"}),y.jsxs("div",{className:"knowledge-base-view__param-text",children:[y.jsx("span",{className:"knowledge-base-view__param-name",children:f.name}),f.description&&y.jsx("span",{className:"knowledge-base-view__param-desc",children:f.description})]})]},f.name))}),l.length>0&&y.jsx("div",{className:"knowledge-base-view__tag-list",children:l.map(f=>y.jsxs(Do,{className:"knowledge-base-view__tag",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__tag-icon",children:"sell"}),y.jsx("span",{children:f})]},f))})]}),y.jsxs("div",{className:"knowledge-base-view__item-meta",children:[e.always&&y.jsx(Do,{color:"blue",children:t("knowledge.meta.always")}),y.jsxs("div",{className:"knowledge-base-view__meta-pills",children:[y.jsx(Gc,{content:y.jsx(_g,{items:c}),title:t("knowledge.meta.skills"),trigger:"click",placement:"bottomRight",children:y.jsxs(ct,{type:"text",className:"knowledge-base-view__meta-pill",disabled:c.length===0,children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-pill-icon",children:"psychology"}),y.jsx("span",{children:t("knowledge.meta.skillsCount",{count:c.length})})]})}),y.jsx(Gc,{content:y.jsx(_g,{items:d}),title:t("knowledge.meta.rules"),trigger:"click",placement:"bottomRight",children:y.jsxs(ct,{type:"text",className:"knowledge-base-view__meta-pill",disabled:d.length===0,children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__meta-pill-icon",children:"gavel"}),y.jsx("span",{children:t("knowledge.meta.rulesCount",{count:d.length})})]})})]}),y.jsx(dt,{title:t(n?"knowledge.actions.collapse":"knowledge.actions.expand"),children:y.jsx(ct,{type:"text",className:"knowledge-base-view__icon-button",onClick:()=>r(f=>!f),icon:y.jsx("span",{className:"material-symbols-rounded",children:n?"expand_less":"expand_more"})})})]})]}),n&&y.jsxs("div",{className:"knowledge-base-view__detail",children:[i&&y.jsx(gm,{}),!i&&s.trim()===""&&y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:t("knowledge.flows.noContent")}),!i&&s.trim()!==""&&y.jsx("div",{className:"knowledge-base-view__markdown",children:y.jsx(Xi,{content:s})})]})]})}function o1e({isLoading:e,specs:t,filteredSpecs:n,onCreate:r}){const{t:o}=Ot();return e?y.jsx("div",{className:"knowledge-base-view__spec-list",children:y.jsx(gm,{})}):t.length===0?y.jsx("div",{className:"knowledge-base-view__spec-list",children:y.jsx(Sl,{description:o("knowledge.flows.empty"),actionLabel:o("knowledge.flows.create"),onAction:r})}):n.length===0?y.jsx("div",{className:"knowledge-base-view__spec-list",children:y.jsx(Sl,{description:o("knowledge.filters.noResults"),variant:"simple"})}):y.jsx("div",{className:"knowledge-base-view__spec-list",children:y.jsx(nE,{data:n,renderItem:i=>y.jsx(ji.Item,{className:"knowledge-base-view__list-item",children:y.jsx(r1e,{spec:i})})})})}function i1e({specs:e,filteredSpecs:t,isLoading:n,query:r,tagOptions:o,tagFilter:i,onQueryChange:a,onTagFilterChange:s,onCreate:l,onImport:c}){const{t:d}=Ot();return y.jsxs(dy,{className:"knowledge-base-view__flows-tab",children:[y.jsx(uy,{title:d("knowledge.flows.title"),description:d("knowledge.flows.desc"),actions:y.jsxs(ea,{children:[y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"download"}),onClick:c,children:d("knowledge.actions.import")}),y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:l,children:d("knowledge.flows.create")})]})}),y.jsx(g4,{query:r,tagOptions:o,tagFilter:i,searchPlaceholder:d("knowledge.filters.search"),tagsPlaceholder:d("knowledge.filters.tags"),onQueryChange:a,onTagFilterChange:s}),y.jsx(o1e,{isLoading:n,specs:e,filteredSpecs:t,onCreate:l})]})}function a1e({onRefresh:e}){const{t}=Ot();return y.jsxs("div",{className:"knowledge-base-view__header",children:[y.jsx("div",{className:"knowledge-base-view__title",children:y.jsx("div",{className:"knowledge-base-view__title-text",children:t("knowledge.title")})}),y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"refresh"}),onClick:e,children:t("knowledge.actions.refresh")})]})}function s1e({rule:e}){const{t}=Ot(),[n,r]=J.useState(!1),{data:o,isLoading:i}=Qn(n?["rule-detail",e.id]:null,()=>Vfe(e.id)),a=o==null?void 0:o.rule,s=(a==null?void 0:a.body)??"",l=e.globs??[];return y.jsxs("div",{className:"knowledge-base-view__item",children:[y.jsxs("div",{className:"knowledge-base-view__item-row",children:[y.jsxs("div",{className:"knowledge-base-view__item-main",children:[y.jsxs("div",{className:"knowledge-base-view__item-title",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__item-icon",children:"gavel"}),y.jsx("span",{children:e.name})]}),y.jsx("div",{className:"knowledge-base-view__item-desc",children:e.description}),l.length>0&&y.jsx("div",{className:"knowledge-base-view__tag-list",children:l.map(c=>y.jsxs(Do,{className:"knowledge-base-view__tag",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__tag-icon",children:"folder"}),y.jsx("span",{children:c})]},c))})]}),y.jsxs("div",{className:"knowledge-base-view__item-meta",children:[e.always&&y.jsx(Do,{color:"blue",children:t("knowledge.meta.always")}),y.jsx(dt,{title:t(n?"knowledge.actions.collapse":"knowledge.actions.expand"),children:y.jsx(ct,{type:"text",className:"knowledge-base-view__icon-button",onClick:()=>r(c=>!c),icon:y.jsx("span",{className:"material-symbols-rounded",children:n?"expand_less":"expand_more"})})})]})]}),n&&y.jsxs("div",{className:"knowledge-base-view__detail",children:[i&&y.jsx(gm,{}),!i&&s.trim()===""&&y.jsx(bn,{image:bn.PRESENTED_IMAGE_SIMPLE,description:t("knowledge.rules.empty")}),!i&&s.trim()!==""&&y.jsx("div",{className:"knowledge-base-view__markdown",children:y.jsx(Xi,{content:s})})]})]})}function l1e({isLoading:e,rules:t,filteredRules:n,onCreate:r}){const{t:o}=Ot();return e?y.jsx("div",{className:"knowledge-base-view__rule-list",children:y.jsx(gm,{})}):t.length===0?y.jsx("div",{className:"knowledge-base-view__rule-list",children:y.jsx(Sl,{description:o("knowledge.rules.empty"),actionLabel:o("knowledge.rules.create"),onAction:r})}):n.length===0?y.jsx("div",{className:"knowledge-base-view__rule-list",children:y.jsx(Sl,{description:o("knowledge.filters.noResults"),variant:"simple"})}):y.jsx("div",{className:"knowledge-base-view__rule-list",children:y.jsx(nE,{data:n,renderItem:i=>y.jsx(ji.Item,{className:"knowledge-base-view__list-item",children:y.jsx(s1e,{rule:i})})})})}function c1e({rules:e,filteredRules:t,isLoading:n,query:r,onQueryChange:o,onCreate:i,onImport:a}){const{t:s}=Ot();return y.jsxs(dy,{className:"knowledge-base-view__rules-tab",children:[y.jsx(uy,{title:s("knowledge.rules.title"),description:s("knowledge.rules.desc"),actions:y.jsxs(ea,{children:[y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"download"}),onClick:a,children:s("knowledge.actions.import")}),y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:i,children:s("knowledge.rules.create")})]})}),y.jsx("div",{className:"knowledge-base-view__filters",children:y.jsx(Ft,{className:"knowledge-base-view__filter-input",prefix:y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__filter-icon",children:"search"}),placeholder:s("knowledge.filters.search"),allowClear:!0,value:r,onChange:l=>o(l.target.value)})}),y.jsx(l1e,{isLoading:n,rules:e,filteredRules:t,onCreate:i})]})}function u1e({onCreate:e,onImport:t}){const{t:n}=Ot();return y.jsxs(dy,{className:"knowledge-base-view__skills-tab",children:[y.jsx(uy,{title:n("knowledge.skills.title"),description:n("knowledge.skills.desc"),actions:y.jsxs(ea,{children:[y.jsx(oa,{icon:y.jsx("span",{className:"material-symbols-rounded",children:"download"}),onClick:t,children:n("knowledge.actions.import")}),y.jsx(oa,{type:"primary",icon:y.jsx("span",{className:"material-symbols-rounded",children:"add_circle"}),onClick:e,children:n("knowledge.skills.create")})]})}),y.jsx(Sl,{description:n("knowledge.skills.empty"),actionLabel:n("knowledge.skills.create"),onAction:e})]})}function pp({icon:e,label:t}){return y.jsxs("span",{className:"knowledge-base-view__tab-label",children:[y.jsx("span",{className:"material-symbols-rounded knowledge-base-view__tab-icon",children:e}),y.jsx("span",{children:t})]})}function d1e(){const{t:e}=Ot(),{message:t}=Eo.useApp(),{data:n,isLoading:r,mutate:o}=Qn("/api/ai/specs"),{data:i,isLoading:a,mutate:s}=Qn("/api/ai/entities"),{data:l,isLoading:c,mutate:d}=Qn("/api/ai/rules"),f=(n==null?void 0:n.specs)??[],m=(i==null?void 0:i.entities)??[],p=(l==null?void 0:l.rules)??[],[h,b]=J.useState(""),[x,g]=J.useState([]),[v,S]=J.useState(""),[C,_]=J.useState([]),[w,N]=J.useState(""),{values:k,update:E}=ju({keys:["kbTab"],defaults:{kbTab:"skills"}}),$=J.useMemo(()=>{const q=new Set;return f.forEach(U=>{var te;(te=U.tags)==null||te.forEach(le=>q.add(le))}),Array.from(q).sort().map(U=>({label:U,value:U}))},[f]),O=J.useMemo(()=>{const q=new Set;return m.forEach(U=>{var te;(te=U.tags)==null||te.forEach(le=>q.add(le))}),Array.from(q).sort().map(U=>({label:U,value:U}))},[m]),R=J.useMemo(()=>{const q=h.trim().toLowerCase();return f.filter(U=>{const te=U.tags??[];if(x.length>0&&!x.every(Z=>te.includes(Z)))return!1;if(q==="")return!0;const le=U.params.map(Z=>`${Z.name} ${Z.description??""}`).join(" "),ie=te.join(" "),ee=(U.skills??[]).join(" "),se=(U.rules??[]).join(" ");return`${U.name} ${U.description} ${le} ${ie} ${ee} ${se}`.toLowerCase().includes(q)})},[h,x,f]),T=J.useMemo(()=>{const q=v.trim().toLowerCase();return m.filter(U=>{const te=U.tags??[];if(C.length>0&&!C.every(re=>te.includes(re)))return!1;if(q==="")return!0;const le=te.join(" "),ie=(U.skills??[]).join(" "),ee=(U.rules??[]).join(" ");return`${U.name} ${U.description} ${le} ${ie} ${ee}`.toLowerCase().includes(q)})},[v,C,m]),I=J.useMemo(()=>{const q=w.trim().toLowerCase();return p.filter(U=>{if(q==="")return!0;const te=(U.globs??[]).join(" ");return`${U.name} ${U.description} ${te}`.toLowerCase().includes(q)})},[w,p]),P=async()=>{await Promise.all([o(),s(),d()]),t.success(e("knowledge.actions.refreshed"))},j=()=>{t.info(e("knowledge.flows.createHint"))},L=()=>{t.info(e("knowledge.flows.importHint"))},D=()=>{t.info(e("knowledge.entities.createHint"))},z=()=>{t.info(e("knowledge.entities.importHint"))},M=()=>{t.info(e("knowledge.skills.createHint"))},H=()=>{t.info(e("knowledge.skills.importHint"))},F=()=>{t.info(e("knowledge.rules.createHint"))},A=()=>{t.info(e("knowledge.rules.importHint"))},B=[{key:"skills",label:y.jsx(pp,{icon:"psychology",label:e("knowledge.tabs.skills")}),children:y.jsx(u1e,{onCreate:M,onImport:H})},{key:"entities",label:y.jsx(pp,{icon:"group_work",label:e("knowledge.tabs.entities")}),children:y.jsx(n1e,{entities:m,filteredEntities:T,isLoading:a,query:v,tagOptions:O,tagFilter:C,onQueryChange:S,onTagFilterChange:_,onCreate:D,onImport:z})},{key:"flows",label:y.jsx(pp,{icon:"account_tree",label:e("knowledge.tabs.flows")}),children:y.jsx(i1e,{specs:f,filteredSpecs:R,isLoading:r,query:h,tagOptions:$,tagFilter:x,onQueryChange:b,onTagFilterChange:g,onCreate:j,onImport:L})},{key:"rules",label:y.jsx(pp,{icon:"gavel",label:e("knowledge.tabs.rules")}),children:y.jsx(c1e,{rules:p,filteredRules:I,isLoading:c,query:w,onQueryChange:N,onCreate:F,onImport:A})}],K=J.useMemo(()=>B.map(q=>q.key),[B]),W=K.includes(k.kbTab)?k.kbTab:K[0];return J.useEffect(()=>{k.kbTab!==W&&E({kbTab:W})},[W,E,k.kbTab]),y.jsxs("div",{className:"knowledge-base-view",children:[y.jsx(a1e,{onRefresh:P}),y.jsx(L_,{className:"knowledge-base-view__tabs",items:B,activeKey:W,onChange:q=>E({kbTab:q})})]})}function f1e(){return y.jsx(d1e,{})}function m1e(){return y.jsxs(Aue,{children:[y.jsx(Ya,{path:"/",element:y.jsx(NP,{})}),y.jsx(Ya,{path:"/session/:sessionId",element:y.jsx(NP,{})}),y.jsx(Ya,{path:"/archive",element:y.jsx(fme,{})}),y.jsx(Ya,{path:"/benchmark",element:y.jsx(wCe,{})}),y.jsx(Ya,{path:"/automation",element:y.jsx(Sme,{})}),y.jsx(Ya,{path:"/knowledge",element:y.jsx(f1e,{})}),y.jsx(Ya,{path:"/config",element:y.jsx(J_e,{})})]})}function p1e(){lme();const{isDarkMode:e,themeConfig:t}=nme(),n=ume();return y.jsx(Ai,{theme:t,children:y.jsx(tme,{activeSessionId:n.activeSessionId,isDarkMode:e,onDeletedSession:n.handleDeletedSession,onSelectSession:n.handleSelectSession,showSidebar:n.showSidebar,sidebarWidth:n.sidebarWidth,children:y.jsx(m1e,{})})})}const h1e=dz(document.getElementById("root")),g1e=Xde();h1e.render(y.jsx(J.StrictMode,{children:y.jsx(Ai,{locale:Dce,theme:{token:{colorPrimary:"#000000"}},children:y.jsx(Eo,{children:y.jsx(Vde,{value:{fetcher:async e=>Rr(e)},children:y.jsx(sde,{basename:g1e,children:y.jsx(p1e,{})})})})})}));export{oe as _,q6 as a,A1 as b,U6 as c,Js as d,Dd as e,Da as g,Mx as s};
|