@aigne/afs-explorer 1.11.0-beta.6 → 1.11.0-beta.7
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.
|
@@ -182,10 +182,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
182
182
|
`))+1))}const u="#".repeat(o),c=n.enter("headingAtx"),f=n.enter("phrasing");l.move(u+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
|
|
183
183
|
`,...l.current()});return/^[\t ]/.test(p)&&(p=Ns(p.charCodeAt(0))+p.slice(1)),p=p?u+" "+p:u,n.options.closeAtx&&(p+=" "+u),f(),c(),p}S0.peek=H5;function S0(e){return e.value||""}function H5(){return"<"}E0.peek=G5;function E0(e,t,n,a){const o=Kv(n),l=o==='"'?"Quote":"Apostrophe",u=n.enter("image");let c=n.enter("label");const f=n.createTracker(a);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(c=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),c(),e.title&&(c=n.enter(`title${l}`),p+=f.move(" "+o),p+=f.move(n.safe(e.title,{before:p,after:o,...f.current()})),p+=f.move(o),c()),p+=f.move(")"),u(),p}function G5(){return"!"}v0.peek=V5;function v0(e,t,n,a){const o=e.referenceType,l=n.enter("imageReference");let u=n.enter("label");const c=n.createTracker(a);let f=c.move("![");const p=n.safe(e.alt,{before:f,after:"]",...c.current()});f+=c.move(p+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...c.current()});return u(),n.stack=g,l(),o==="full"||!p||p!==m?f+=c.move(m+"]"):o==="shortcut"?f=f.slice(0,-1):f+=c.move("]"),f}function V5(){return"!"}T0.peek=q5;function T0(e,t,n){let a=e.value||"",o="`",l=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(a);)o+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++l<n.unsafe.length;){const u=n.unsafe[l],c=n.compilePattern(u);let f;if(u.atBreak)for(;f=c.exec(a);){let p=f.index;a.charCodeAt(p)===10&&a.charCodeAt(p-1)===13&&p--,a=a.slice(0,p)+" "+a.slice(f.index+1)}}return o+a+o}function q5(){return"`"}function w0(e,t){const n=$h(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))}x0.peek=W5;function x0(e,t,n,a){const o=Kv(n),l=o==='"'?"Quote":"Apostrophe",u=n.createTracker(a);let c,f;if(w0(e,n)){const g=n.stack;n.stack=[],c=n.enter("autolink");let m=u.move("<");return m+=u.move(n.containerPhrasing(e,{before:m,after:">",...u.current()})),m+=u.move(">"),c(),n.stack=g,m}c=n.enter("link"),f=n.enter("label");let p=u.move("[");return p+=u.move(n.containerPhrasing(e,{before:p,after:"](",...u.current()})),p+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=u.move("<"),p+=u.move(n.safe(e.url,{before:p,after:">",...u.current()})),p+=u.move(">")):(f=n.enter("destinationRaw"),p+=u.move(n.safe(e.url,{before:p,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=n.enter(`title${l}`),p+=u.move(" "+o),p+=u.move(n.safe(e.title,{before:p,after:o,...u.current()})),p+=u.move(o),f()),p+=u.move(")"),c(),p}function W5(e,t,n){return w0(e,n)?"<":"["}A0.peek=Y5;function A0(e,t,n,a){const o=e.referenceType,l=n.enter("linkReference");let u=n.enter("label");const c=n.createTracker(a);let f=c.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...c.current()});f+=c.move(p+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...c.current()});return u(),n.stack=g,l(),o==="full"||!p||p!==m?f+=c.move(m+"]"):o==="shortcut"?f=f.slice(0,-1):f+=c.move("]"),f}function Y5(){return"["}function Xv(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 K5(e){const t=Xv(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 X5(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 k0(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 Z5(e,t,n,a){const o=n.enter("list"),l=n.bulletCurrent;let u=e.ordered?X5(n):Xv(n);const c=e.ordered?u==="."?")":".":K5(n);let f=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),k0(n)===u&&g){let m=-1;for(;++m<e.children.length;){const y=e.children[m];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(u=c),n.bulletCurrent=u;const p=n.containerFlow(e,a);return n.bulletLastUsed=u,n.bulletCurrent=l,o(),p}function Q5(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 J5(e,t,n,a){const o=Q5(n);let l=n.bulletCurrent||Xv(n);t&&t.type==="list"&&t.ordered&&(l=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+l);let u=l.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const c=n.createTracker(a);c.move(l+" ".repeat(u-l.length)),c.shift(u);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,c.current()),g);return f(),p;function g(m,y,S){return y?(S?"":" ".repeat(u))+m:(S?l:l+" ".repeat(u-l.length))+m}}function e6(e,t,n,a){const o=n.enter("paragraph"),l=n.enter("phrasing"),u=n.containerPhrasing(e,a);return l(),o(),u}const t6=Hd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function n6(e,t,n,a){return(e.children.some(function(u){return t6(u)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function r6(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}R0.peek=a6;function R0(e,t,n,a){const o=r6(n),l=n.enter("strong"),u=n.createTracker(a),c=u.move(o+o);let f=u.move(n.containerPhrasing(e,{after:o,before:c,...u.current()}));const p=f.charCodeAt(0),g=ld(a.before.charCodeAt(a.before.length-1),p,o);g.inside&&(f=Ns(p)+f.slice(1));const m=f.charCodeAt(f.length-1),y=ld(a.after.charCodeAt(0),m,o);y.inside&&(f=f.slice(0,-1)+Ns(m));const S=u.move(o+o);return l(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},c+f+S}function a6(e,t,n){return n.options.strong||"*"}function i6(e,t,n,a){return n.safe(e.value,a)}function o6(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 l6(e,t,n){const a=(k0(n)+(n.options.ruleSpaces?" ":"")).repeat(o6(n));return n.options.ruleSpaces?a.slice(0,-1):a}const C0={blockquote:_5,break:vC,code:B5,definition:U5,emphasis:y0,hardBreak:vC,heading:j5,html:S0,image:E0,imageReference:v0,inlineCode:T0,link:x0,linkReference:A0,list:Z5,listItem:J5,paragraph:e6,root:n6,strong:R0,text:i6,thematicBreak:l6};function s6(){return{enter:{table:u6,tableData:TC,tableHeader:TC,tableRow:d6},exit:{codeText:p6,table:c6,tableData:Jg,tableHeader:Jg,tableRow:Jg}}}function u6(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 c6(e){this.exit(e),this.data.inTable=void 0}function d6(e){this.enter({type:"tableRow",children:[]},e)}function Jg(e){this.exit(e)}function TC(e){this.enter({type:"tableCell",children:[]},e)}function p6(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,f6));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function f6(e,t){return t==="|"?t:e}function g6(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,o=t.stringLength,l=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
184
184
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:u,tableCell:f,tableRow:c}};function u(S,E,v,T){return p(g(S,v,T),S.align)}function c(S,E,v,T){const w=m(S,v,T),C=p([w]);return C.slice(0,C.indexOf(`
|
|
185
|
-
`))}function f(S,E,v,T){const w=v.enter("tableCell"),C=v.enter("phrasing"),k=v.containerPhrasing(S,{...T,before:l,after:l});return C(),w(),k}function p(S,E){return C5(S,{align:E,alignDelimiters:a,padding:n,stringLength:o})}function g(S,E,v){const T=S.children;let w=-1;const C=[],k=E.enter("table");for(;++w<T.length;)C[w]=m(T[w],E,v);return k(),C}function m(S,E,v){const T=S.children;let w=-1;const C=[],k=E.enter("tableRow");for(;++w<T.length;)C[w]=f(T[w],S,E,v);return k(),C}function y(S,E,v){let T=C0.inlineCode(S,E,v);return v.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function m6(){return{exit:{taskListCheckValueChecked:wC,taskListCheckValueUnchecked:wC,paragraph:b6}}}function h6(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:y6}}}function wC(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function b6(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 a=n.children[0];if(a&&a.type==="text"){const o=t.children;let l=-1,u;for(;++l<o.length;){const c=o[l];if(c.type==="paragraph"){u=c;break}}u===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function y6(e,t,n,a){const o=e.children[0],l=typeof e.checked=="boolean"&&o&&o.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",c=n.createTracker(a);l&&c.move(u);let f=C0.listItem(e,t,n,{...a,...c.current()});return l&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(g){return g+u}}function S6(){return[ZG(),y5(),T5(),s6(),m6()]}function E6(e){return{extensions:[QG(),S5(e),w5(),g6(e),h6()]}}const v6={tokenize:R6,partial:!0},I0={tokenize:C6,partial:!0},_0={tokenize:I6,partial:!0},N0={tokenize:_6,partial:!0},T6={tokenize:N6,partial:!0},O0={name:"wwwAutolink",tokenize:A6,previous:D0},L0={name:"protocolAutolink",tokenize:k6,previous:M0},Ca={name:"emailAutolink",tokenize:x6,previous:B0},ta={};function w6(){return{text:ta}}let Ii=48;for(;Ii<123;)ta[Ii]=Ca,Ii++,Ii===58?Ii=65:Ii===91&&(Ii=97);ta[43]=Ca;ta[45]=Ca;ta[46]=Ca;ta[95]=Ca;ta[72]=[Ca,L0];ta[104]=[Ca,L0];ta[87]=[Ca,O0];ta[119]=[Ca,O0];function x6(e,t,n){const a=this;let o,l;return u;function u(m){return!Wm(m)||!B0.call(a,a.previous)||Zv(a.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(m))}function c(m){return Wm(m)?(e.consume(m),c):m===64?(e.consume(m),f):n(m)}function f(m){return m===46?e.check(T6,g,p)(m):m===45||m===95||kn(m)?(l=!0,e.consume(m),f):g(m)}function p(m){return e.consume(m),o=!0,f}function g(m){return l&&o&&Dn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function A6(e,t,n){const a=this;return o;function o(u){return u!==87&&u!==119||!D0.call(a,a.previous)||Zv(a.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(v6,e.attempt(I0,e.attempt(_0,l),n),n)(u))}function l(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function k6(e,t,n){const a=this;let o="",l=!1;return u;function u(m){return(m===72||m===104)&&M0.call(a,a.previous)&&!Zv(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(m),e.consume(m),c):n(m)}function c(m){if(Dn(m)&&o.length<5)return o+=String.fromCodePoint(m),e.consume(m),c;if(m===58){const y=o.toLowerCase();if(y==="http"||y==="https")return e.consume(m),f}return n(m)}function f(m){return m===47?(e.consume(m),l?p:(l=!0,f)):n(m)}function p(m){return m===null||ad(m)||Lt(m)||Mi(m)||Pd(m)?n(m):e.attempt(I0,e.attempt(_0,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function R6(e,t,n){let a=0;return o;function o(u){return(u===87||u===119)&&a<3?(a++,e.consume(u),o):u===46&&a===3?(e.consume(u),l):n(u)}function l(u){return u===null?n(u):t(u)}}function C6(e,t,n){let a,o,l;return u;function u(p){return p===46||p===95?e.check(N0,f,c)(p):p===null||Lt(p)||Mi(p)||p!==45&&Pd(p)?f(p):(l=!0,e.consume(p),u)}function c(p){return p===95?a=!0:(o=a,a=void 0),e.consume(p),u}function f(p){return o||a||!l?n(p):t(p)}}function I6(e,t){let n=0,a=0;return o;function o(u){return u===40?(n++,e.consume(u),o):u===41&&a<n?l(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(N0,t,l)(u):u===null||Lt(u)||Mi(u)?t(u):(e.consume(u),o)}function l(u){return u===41&&a++,e.consume(u),o}}function _6(e,t,n){return a;function a(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),a):c===38?(e.consume(c),l):c===93?(e.consume(c),o):c===60||c===null||Lt(c)||Mi(c)?t(c):n(c)}function o(c){return c===null||c===40||c===91||Lt(c)||Mi(c)?t(c):a(c)}function l(c){return Dn(c)?u(c):n(c)}function u(c){return c===59?(e.consume(c),a):Dn(c)?(e.consume(c),u):n(c)}}function N6(e,t,n){return a;function a(l){return e.consume(l),o}function o(l){return kn(l)?n(l):t(l)}}function D0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function M0(e){return!Dn(e)}function B0(e){return!(e===47||Wm(e))}function Wm(e){return e===43||e===45||e===46||e===95||kn(e)}function Zv(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const O6={tokenize:P6,partial:!0};function L6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:F6,continuation:{tokenize:U6},exit:z6}},text:{91:{name:"gfmFootnoteCall",tokenize:B6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:D6,resolveTo:M6}}}}function D6(e,t,n){const a=this;let o=a.events.length;const l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u;for(;o--;){const f=a.events[o][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return c;function c(f){if(!u||!u._balanced)return n(f);const p=Dr(a.sliceSerialize({start:u.end,end:a.now()}));return p.codePointAt(0)!==94||!l.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function M6(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 a={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 l={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},c=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...c),e}function B6(e,t,n){const a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l=0,u;return c;function c(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),f}function f(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(m){if(l>999||m===93&&!u||m===null||m===91||Lt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return o.includes(Dr(a.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Lt(m)||(u=!0),l++,e.consume(m),m===92?g:p}function g(m){return m===91||m===92||m===93?(e.consume(m),l++,p):p(m)}}function F6(e,t,n){const a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l,u=0,c;return f;function f(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(E)}function g(E){if(u>999||E===93&&!c||E===null||E===91||Lt(E))return n(E);if(E===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return l=Dr(a.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Lt(E)||(c=!0),u++,e.consume(E),E===92?m:g}function m(E){return E===91||E===92||E===93?(e.consume(E),u++,g):g(E)}function y(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),o.includes(l)||o.push(l),pt(e,S,"gfmFootnoteDefinitionWhitespace")):n(E)}function S(E){return t(E)}}function U6(e,t,n){return e.check(Ys,t,e.attempt(O6,t,n))}function z6(e){e.exit("gfmFootnoteDefinition")}function P6(e,t,n){const a=this;return pt(e,o,"gfmFootnoteDefinitionIndent",5);function o(l){const u=a.events[a.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function $6(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:l,resolveAll:o};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function o(u,c){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let p=f;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[f][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[f][1].end)},m={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[f][1].start)},y=[["enter",g,c],["enter",u[p][1],c],["exit",u[p][1],c],["enter",m,c]],S=c.parser.constructs.insideSpan.null;S&&ir(y,y.length,0,$d(S,u.slice(p+1,f),c)),ir(y,y.length,0,[["exit",m,c],["enter",u[f][1],c],["exit",u[f][1],c],["exit",g,c]]),ir(u,p-1,f-p+3,y),f=p+y.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function l(u,c,f){const p=this.previous,g=this.events;let m=0;return y;function y(E){return p===126&&g[g.length-1][1].type!=="characterEscape"?f(E):(u.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const v=qo(p);if(E===126)return m>1?f(E):(u.consume(E),m++,S);if(m<2&&!n)return f(E);const T=u.exit("strikethroughSequenceTemporary"),w=qo(E);return T._open=!w||w===2&&!!v,T._close=!v||v===2&&!!w,c(E)}}}class j6{constructor(){this.map=[]}add(t,n,a){H6(this,t,n,a)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let o=a.pop();for(;o;){for(const l of o)t.push(l);o=a.pop()}this.map.length=0}}function H6(e,t,n,a){let o=0;if(!(n===0&&a.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...a);return}o+=1}e.map.push([t,n,a])}}function G6(e,t){let n=!1;const a=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=a.length-1;a[l]=a[l]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function V6(){return{flow:{null:{name:"table",tokenize:q6,resolveAll:W6}}}}function q6(e,t,n){const a=this;let o=0,l=0,u;return c;function c(L){let W=a.events.length-1;for(;W>-1;){const H=a.events[W][1].type;if(H==="lineEnding"||H==="linePrefix")W--;else break}const R=W>-1?a.events[W][1].type:null,V=R==="tableHead"||R==="tableRow"?I:f;return V===I&&a.parser.lazy[a.now().line]?n(L):V(L)}function f(L){return e.enter("tableHead"),e.enter("tableRow"),p(L)}function p(L){return L===124||(u=!0,l+=1),g(L)}function g(L){return L===null?n(L):Me(L)?l>1?(l=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),S):n(L):it(L)?pt(e,g,"whitespace")(L):(l+=1,u&&(u=!1,o+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),m(L)))}function m(L){return L===null||L===124||Lt(L)?(e.exit("data"),g(L)):(e.consume(L),L===92?y:m)}function y(L){return L===92||L===124?(e.consume(L),m):m(L)}function S(L){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(L):(e.enter("tableDelimiterRow"),u=!1,it(L)?pt(e,E,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):E(L))}function E(L){return L===45||L===58?T(L):L===124?(u=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),v):N(L)}function v(L){return it(L)?pt(e,T,"whitespace")(L):T(L)}function T(L){return L===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),w):L===45?(l+=1,w(L)):L===null||Me(L)?_(L):N(L)}function w(L){return L===45?(e.enter("tableDelimiterFiller"),C(L)):N(L)}function C(L){return L===45?(e.consume(L),C):L===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(L))}function k(L){return it(L)?pt(e,_,"whitespace")(L):_(L)}function _(L){return L===124?E(L):L===null||Me(L)?!u||o!==l?N(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):N(L)}function N(L){return n(L)}function I(L){return e.enter("tableRow"),D(L)}function D(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),D):L===null||Me(L)?(e.exit("tableRow"),t(L)):it(L)?pt(e,D,"whitespace")(L):(e.enter("data"),j(L))}function j(L){return L===null||L===124||Lt(L)?(e.exit("data"),D(L)):(e.consume(L),L===92?$:j)}function $(L){return L===92||L===124?(e.consume(L),j):j(L)}}function W6(e,t){let n=-1,a=!0,o=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,f=0,p,g,m;const y=new j6;for(;++n<e.length;){const S=e[n],E=S[1];S[0]==="enter"?E.type==="tableHead"?(c=!1,f!==0&&(xC(y,t,f,p,g),g=void 0,f=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},y.add(n,0,[["enter",p,t]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(a=!0,m=void 0,l=[0,0,0,0],u=[0,n+1,0,0],c&&(c=!1,g={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},y.add(n,0,[["enter",g,t]])),o=E.type==="tableDelimiterRow"?2:g?3:1):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(a=!1,u[2]===0&&(l[1]!==0&&(u[0]=u[1],m=Nc(y,t,l,o,void 0,m),l=[0,0,0,0]),u[2]=n)):E.type==="tableCellDivider"&&(a?a=!1:(l[1]!==0&&(u[0]=u[1],m=Nc(y,t,l,o,void 0,m)),l=u,u=[l[1],n,0,0])):E.type==="tableHead"?(c=!0,f=n):E.type==="tableRow"||E.type==="tableDelimiterRow"?(f=n,l[1]!==0?(u[0]=u[1],m=Nc(y,t,l,o,n,m)):u[1]!==0&&(m=Nc(y,t,u,o,n,m)),o=0):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&xC(y,t,f,p,g),y.consume(t.events),n=-1;++n<t.events.length;){const S=t.events[n];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=G6(t.events,n))}return e}function Nc(e,t,n,a,o,l){const u=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(l.end=Object.assign({},Bo(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const f=Bo(t.events,n[1]);if(l={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const p=Bo(t.events,n[2]),g=Bo(t.events,n[3]),m={type:c,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",m,t]]),a!==2){const y=t.events[n[2]],S=t.events[n[3]];if(y[1].end=Object.assign({},S[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const E=n[2]+1,v=n[3]-n[2]-1;e.add(E,v,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return o!==void 0&&(l.end=Object.assign({},Bo(t.events,o)),e.add(o,0,[["exit",l,t]]),l=void 0),l}function xC(e,t,n,a,o){const l=[],u=Bo(t.events,n);o&&(o.end=Object.assign({},u),l.push(["exit",o,t])),a.end=Object.assign({},u),l.push(["exit",a,t]),e.add(n+1,0,l)}function Bo(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const Y6={name:"tasklistCheck",tokenize:X6};function K6(){return{text:{91:Y6}}}function X6(e,t,n){const a=this;return o;function o(f){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),l)}function l(f){return Lt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),u):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),u):n(f)}function u(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(f)}function c(f){return Me(f)?t(f):it(f)?e.check({tokenize:Z6},t,n)(f):n(f)}}function Z6(e,t,n){return pt(e,a,"whitespace");function a(o){return o===null?n(o):t(o)}}function Q6(e){return B_([w6(),L6(),$6(e),V6(),K6()])}const J6={};function eV(e){const t=this,n=e||J6,a=t.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),l=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),u=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(Q6(n)),l.push(S6()),u.push(E6(n))}const AC=jt(B.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-5 14H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"})),tV=jt(B.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 11h-3v3.75c0 1.24-1.01 2.25-2.25 2.25S8.5 17.99 8.5 16.75s1.01-2.25 2.25-2.25c.46 0 .89.14 1.25.38V11h4zm-3-4V3.5L18.5 9z"})),kC=jt(B.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),RC=jt(B.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"})),nV=jt(B.jsx("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z"})),rV=jt(B.jsx("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm7 7V3.5L18.5 9z"})),aV=jt(B.jsx("path",{d:"M12 14v-1h1.5v.5h2v-1H13c-.55 0-1-.45-1-1V10c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1h-1.5v-.5h-2v1H16c.55 0 1 .45 1 1V14c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1M9 9v4.5H7.5v-1H6v1c0 .83.67 1.5 1.5 1.5H9c.83 0 1.5-.67 1.5-1.5V9z"})),iV=jt(B.jsx("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5zm4-3H19v1h1.5V11H19v2h-1.5V7h3zM9 9.5h1v-1H9zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm10 5.5h1v-3h-1z"})),oV=jt(B.jsx("path",{d:"M14 2H6.01c-1.1 0-2 .89-2 2L4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8zm-1 7V3.5L18.5 9zm1 5 2-1.06v4.12L14 16v1c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h4c.55 0 1 .45 1 1z"}));function F0(e,t){const n=[".png",".jpg",".jpeg",".gif",".bmp",".webp",".svg",".ico"],a=e.toLowerCase();return n.some(o=>a.endsWith(o))||t?.startsWith("image/")||!1}function U0(e,t,n="small"){const a=e.split(".").pop()?.toLowerCase();return F0(e,t)?B.jsx(nV,{fontSize:n,color:"info"}):a==="pdf"||t==="application/pdf"?B.jsx(iV,{fontSize:n,color:"error"}):["doc","docx","odt","rtf"].includes(a||"")?B.jsx(RC,{fontSize:n,color:"primary"}):["md","markdown"].includes(a||"")||t==="text/markdown"?B.jsx(AC,{fontSize:n,color:"action"}):["js","jsx","ts","tsx","mjs","cjs"].includes(a||"")?B.jsx(aV,{fontSize:n,sx:{color:"#f7df1e"}}):["py","java","c","cpp","h","hpp","cs","go","rs","php","rb","swift","kt","scala"].includes(a||"")?B.jsx(kC,{fontSize:n,color:"secondary"}):["html","css","scss","sass","less"].includes(a||"")?B.jsx(kC,{fontSize:n,color:"primary"}):["json","yaml","yml","xml","toml","ini","conf","config"].includes(a||"")?B.jsx(AC,{fontSize:n,color:"warning"}):["mp4","avi","mov","mkv","wmv","flv","webm"].includes(a||"")||t?.startsWith("video/")?B.jsx(oV,{fontSize:n,color:"secondary"}):["mp3","wav","flac","aac","ogg","m4a","wma"].includes(a||"")||t?.startsWith("audio/")?B.jsx(tV,{fontSize:n,color:"success"}):["txt","log","csv","tsv"].includes(a||"")||t?.startsWith("text/")?B.jsx(RC,{fontSize:n}):B.jsx(rV,{fontSize:n})}function sd(e){const t=e.path,a=(t.split("/").filter(Boolean).pop()||t).replace(/~/g,"/"),l=e.metadata?.type!=="file",u=e.content!==void 0&&e.content!==null&&!Array.isArray(e.content),c=e.metadata?.size??(u?JSON.stringify(e.content).length:void 0);return{...e,name:a,hasChildren:l,hasContent:u,size:c}}function lV(e){return e?(typeof e=="string"?new Date(e):e).toLocaleString():"-"}function z0(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`:"-"}const sV=jt(B.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),uV=jt(B.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),CC={};function Qv(e,t){const n=A.useRef(CC);return n.current===CC&&(n.current=e(t)),n}function ud(e,t,n,a){const o=Qv(cV).current;return dV(o,e,t,n,a)&&pV(o,[e,t,n,a]),o.callback}function cV(){return{callback:null,cleanup:null,refs:[]}}function dV(e,t,n,a,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==a||e.refs[3]!==o}function pV(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const a=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const l=t[o];if(l!=null)switch(typeof l){case"function":{const u=l(n);typeof u=="function"&&(a[o]=u);break}case"object":{l.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const l=t[o];if(l!=null)switch(typeof l){case"function":{const u=a[o];typeof u=="function"?u():l(null);break}case"object":{l.current=null;break}}}}}}}function P0(e){return HM}function fV(e){return Pe("MuiSimpleTreeView",e)}Fe("MuiSimpleTreeView",["root","item","itemContent","itemGroupTransition","itemIconContainer","itemLabel","itemCheckbox"]);const Ym=Object.freeze([]),Es=Object.freeze({}),$0=A.createContext(null),ol=()=>{const e=A.useContext($0);if(e==null)throw new Error(["MUI X: Could not find the Tree View context.","It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
185
|
+
`))}function f(S,E,v,T){const w=v.enter("tableCell"),C=v.enter("phrasing"),k=v.containerPhrasing(S,{...T,before:l,after:l});return C(),w(),k}function p(S,E){return C5(S,{align:E,alignDelimiters:a,padding:n,stringLength:o})}function g(S,E,v){const T=S.children;let w=-1;const C=[],k=E.enter("table");for(;++w<T.length;)C[w]=m(T[w],E,v);return k(),C}function m(S,E,v){const T=S.children;let w=-1;const C=[],k=E.enter("tableRow");for(;++w<T.length;)C[w]=f(T[w],S,E,v);return k(),C}function y(S,E,v){let T=C0.inlineCode(S,E,v);return v.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function m6(){return{exit:{taskListCheckValueChecked:wC,taskListCheckValueUnchecked:wC,paragraph:b6}}}function h6(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:y6}}}function wC(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function b6(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 a=n.children[0];if(a&&a.type==="text"){const o=t.children;let l=-1,u;for(;++l<o.length;){const c=o[l];if(c.type==="paragraph"){u=c;break}}u===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function y6(e,t,n,a){const o=e.children[0],l=typeof e.checked=="boolean"&&o&&o.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",c=n.createTracker(a);l&&c.move(u);let f=C0.listItem(e,t,n,{...a,...c.current()});return l&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(g){return g+u}}function S6(){return[ZG(),y5(),T5(),s6(),m6()]}function E6(e){return{extensions:[QG(),S5(e),w5(),g6(e),h6()]}}const v6={tokenize:R6,partial:!0},I0={tokenize:C6,partial:!0},_0={tokenize:I6,partial:!0},N0={tokenize:_6,partial:!0},T6={tokenize:N6,partial:!0},O0={name:"wwwAutolink",tokenize:A6,previous:D0},L0={name:"protocolAutolink",tokenize:k6,previous:M0},Ca={name:"emailAutolink",tokenize:x6,previous:B0},ta={};function w6(){return{text:ta}}let Ii=48;for(;Ii<123;)ta[Ii]=Ca,Ii++,Ii===58?Ii=65:Ii===91&&(Ii=97);ta[43]=Ca;ta[45]=Ca;ta[46]=Ca;ta[95]=Ca;ta[72]=[Ca,L0];ta[104]=[Ca,L0];ta[87]=[Ca,O0];ta[119]=[Ca,O0];function x6(e,t,n){const a=this;let o,l;return u;function u(m){return!Wm(m)||!B0.call(a,a.previous)||Zv(a.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(m))}function c(m){return Wm(m)?(e.consume(m),c):m===64?(e.consume(m),f):n(m)}function f(m){return m===46?e.check(T6,g,p)(m):m===45||m===95||kn(m)?(l=!0,e.consume(m),f):g(m)}function p(m){return e.consume(m),o=!0,f}function g(m){return l&&o&&Dn(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function A6(e,t,n){const a=this;return o;function o(u){return u!==87&&u!==119||!D0.call(a,a.previous)||Zv(a.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(v6,e.attempt(I0,e.attempt(_0,l),n),n)(u))}function l(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function k6(e,t,n){const a=this;let o="",l=!1;return u;function u(m){return(m===72||m===104)&&M0.call(a,a.previous)&&!Zv(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(m),e.consume(m),c):n(m)}function c(m){if(Dn(m)&&o.length<5)return o+=String.fromCodePoint(m),e.consume(m),c;if(m===58){const y=o.toLowerCase();if(y==="http"||y==="https")return e.consume(m),f}return n(m)}function f(m){return m===47?(e.consume(m),l?p:(l=!0,f)):n(m)}function p(m){return m===null||ad(m)||Lt(m)||Mi(m)||Pd(m)?n(m):e.attempt(I0,e.attempt(_0,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function R6(e,t,n){let a=0;return o;function o(u){return(u===87||u===119)&&a<3?(a++,e.consume(u),o):u===46&&a===3?(e.consume(u),l):n(u)}function l(u){return u===null?n(u):t(u)}}function C6(e,t,n){let a,o,l;return u;function u(p){return p===46||p===95?e.check(N0,f,c)(p):p===null||Lt(p)||Mi(p)||p!==45&&Pd(p)?f(p):(l=!0,e.consume(p),u)}function c(p){return p===95?a=!0:(o=a,a=void 0),e.consume(p),u}function f(p){return o||a||!l?n(p):t(p)}}function I6(e,t){let n=0,a=0;return o;function o(u){return u===40?(n++,e.consume(u),o):u===41&&a<n?l(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(N0,t,l)(u):u===null||Lt(u)||Mi(u)?t(u):(e.consume(u),o)}function l(u){return u===41&&a++,e.consume(u),o}}function _6(e,t,n){return a;function a(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),a):c===38?(e.consume(c),l):c===93?(e.consume(c),o):c===60||c===null||Lt(c)||Mi(c)?t(c):n(c)}function o(c){return c===null||c===40||c===91||Lt(c)||Mi(c)?t(c):a(c)}function l(c){return Dn(c)?u(c):n(c)}function u(c){return c===59?(e.consume(c),a):Dn(c)?(e.consume(c),u):n(c)}}function N6(e,t,n){return a;function a(l){return e.consume(l),o}function o(l){return kn(l)?n(l):t(l)}}function D0(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Lt(e)}function M0(e){return!Dn(e)}function B0(e){return!(e===47||Wm(e))}function Wm(e){return e===43||e===45||e===46||e===95||kn(e)}function Zv(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const O6={tokenize:P6,partial:!0};function L6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:F6,continuation:{tokenize:U6},exit:z6}},text:{91:{name:"gfmFootnoteCall",tokenize:B6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:D6,resolveTo:M6}}}}function D6(e,t,n){const a=this;let o=a.events.length;const l=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u;for(;o--;){const f=a.events[o][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return c;function c(f){if(!u||!u._balanced)return n(f);const p=Dr(a.sliceSerialize({start:u.end,end:a.now()}));return p.codePointAt(0)!==94||!l.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function M6(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 a={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 l={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},c=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...c),e}function B6(e,t,n){const a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l=0,u;return c;function c(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),f}function f(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(m){if(l>999||m===93&&!u||m===null||m===91||Lt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return o.includes(Dr(a.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Lt(m)||(u=!0),l++,e.consume(m),m===92?g:p}function g(m){return m===91||m===92||m===93?(e.consume(m),l++,p):p(m)}}function F6(e,t,n){const a=this,o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l,u=0,c;return f;function f(E){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(E){return E===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(E)}function g(E){if(u>999||E===93&&!c||E===null||E===91||Lt(E))return n(E);if(E===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return l=Dr(a.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(E),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Lt(E)||(c=!0),u++,e.consume(E),E===92?m:g}function m(E){return E===91||E===92||E===93?(e.consume(E),u++,g):g(E)}function y(E){return E===58?(e.enter("definitionMarker"),e.consume(E),e.exit("definitionMarker"),o.includes(l)||o.push(l),pt(e,S,"gfmFootnoteDefinitionWhitespace")):n(E)}function S(E){return t(E)}}function U6(e,t,n){return e.check(Ys,t,e.attempt(O6,t,n))}function z6(e){e.exit("gfmFootnoteDefinition")}function P6(e,t,n){const a=this;return pt(e,o,"gfmFootnoteDefinitionIndent",5);function o(l){const u=a.events[a.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function $6(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:l,resolveAll:o};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function o(u,c){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let p=f;for(;p--;)if(u[p][0]==="exit"&&u[p][1].type==="strikethroughSequenceTemporary"&&u[p][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[p][1].end.offset-u[p][1].start.offset){u[f][1].type="strikethroughSequence",u[p][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[p][1].start),end:Object.assign({},u[f][1].end)},m={type:"strikethroughText",start:Object.assign({},u[p][1].end),end:Object.assign({},u[f][1].start)},y=[["enter",g,c],["enter",u[p][1],c],["exit",u[p][1],c],["enter",m,c]],S=c.parser.constructs.insideSpan.null;S&&ir(y,y.length,0,$d(S,u.slice(p+1,f),c)),ir(y,y.length,0,[["exit",m,c],["enter",u[f][1],c],["exit",u[f][1],c],["exit",g,c]]),ir(u,p-1,f-p+3,y),f=p+y.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function l(u,c,f){const p=this.previous,g=this.events;let m=0;return y;function y(E){return p===126&&g[g.length-1][1].type!=="characterEscape"?f(E):(u.enter("strikethroughSequenceTemporary"),S(E))}function S(E){const v=qo(p);if(E===126)return m>1?f(E):(u.consume(E),m++,S);if(m<2&&!n)return f(E);const T=u.exit("strikethroughSequenceTemporary"),w=qo(E);return T._open=!w||w===2&&!!v,T._close=!v||v===2&&!!w,c(E)}}}class j6{constructor(){this.map=[]}add(t,n,a){H6(this,t,n,a)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let o=a.pop();for(;o;){for(const l of o)t.push(l);o=a.pop()}this.map.length=0}}function H6(e,t,n,a){let o=0;if(!(n===0&&a.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...a);return}o+=1}e.map.push([t,n,a])}}function G6(e,t){let n=!1;const a=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=a.length-1;a[l]=a[l]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function V6(){return{flow:{null:{name:"table",tokenize:q6,resolveAll:W6}}}}function q6(e,t,n){const a=this;let o=0,l=0,u;return c;function c(L){let W=a.events.length-1;for(;W>-1;){const H=a.events[W][1].type;if(H==="lineEnding"||H==="linePrefix")W--;else break}const R=W>-1?a.events[W][1].type:null,V=R==="tableHead"||R==="tableRow"?I:f;return V===I&&a.parser.lazy[a.now().line]?n(L):V(L)}function f(L){return e.enter("tableHead"),e.enter("tableRow"),p(L)}function p(L){return L===124||(u=!0,l+=1),g(L)}function g(L){return L===null?n(L):Me(L)?l>1?(l=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),S):n(L):it(L)?pt(e,g,"whitespace")(L):(l+=1,u&&(u=!1,o+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),m(L)))}function m(L){return L===null||L===124||Lt(L)?(e.exit("data"),g(L)):(e.consume(L),L===92?y:m)}function y(L){return L===92||L===124?(e.consume(L),m):m(L)}function S(L){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(L):(e.enter("tableDelimiterRow"),u=!1,it(L)?pt(e,E,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):E(L))}function E(L){return L===45||L===58?T(L):L===124?(u=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),v):N(L)}function v(L){return it(L)?pt(e,T,"whitespace")(L):T(L)}function T(L){return L===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),w):L===45?(l+=1,w(L)):L===null||Me(L)?_(L):N(L)}function w(L){return L===45?(e.enter("tableDelimiterFiller"),C(L)):N(L)}function C(L){return L===45?(e.consume(L),C):L===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(L))}function k(L){return it(L)?pt(e,_,"whitespace")(L):_(L)}function _(L){return L===124?E(L):L===null||Me(L)?!u||o!==l?N(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):N(L)}function N(L){return n(L)}function I(L){return e.enter("tableRow"),D(L)}function D(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),D):L===null||Me(L)?(e.exit("tableRow"),t(L)):it(L)?pt(e,D,"whitespace")(L):(e.enter("data"),j(L))}function j(L){return L===null||L===124||Lt(L)?(e.exit("data"),D(L)):(e.consume(L),L===92?$:j)}function $(L){return L===92||L===124?(e.consume(L),j):j(L)}}function W6(e,t){let n=-1,a=!0,o=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,f=0,p,g,m;const y=new j6;for(;++n<e.length;){const S=e[n],E=S[1];S[0]==="enter"?E.type==="tableHead"?(c=!1,f!==0&&(xC(y,t,f,p,g),g=void 0,f=0),p={type:"table",start:Object.assign({},E.start),end:Object.assign({},E.end)},y.add(n,0,[["enter",p,t]])):E.type==="tableRow"||E.type==="tableDelimiterRow"?(a=!0,m=void 0,l=[0,0,0,0],u=[0,n+1,0,0],c&&(c=!1,g={type:"tableBody",start:Object.assign({},E.start),end:Object.assign({},E.end)},y.add(n,0,[["enter",g,t]])),o=E.type==="tableDelimiterRow"?2:g?3:1):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")?(a=!1,u[2]===0&&(l[1]!==0&&(u[0]=u[1],m=Nc(y,t,l,o,void 0,m),l=[0,0,0,0]),u[2]=n)):E.type==="tableCellDivider"&&(a?a=!1:(l[1]!==0&&(u[0]=u[1],m=Nc(y,t,l,o,void 0,m)),l=u,u=[l[1],n,0,0])):E.type==="tableHead"?(c=!0,f=n):E.type==="tableRow"||E.type==="tableDelimiterRow"?(f=n,l[1]!==0?(u[0]=u[1],m=Nc(y,t,l,o,n,m)):u[1]!==0&&(m=Nc(y,t,u,o,n,m)),o=0):o&&(E.type==="data"||E.type==="tableDelimiterMarker"||E.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&xC(y,t,f,p,g),y.consume(t.events),n=-1;++n<t.events.length;){const S=t.events[n];S[0]==="enter"&&S[1].type==="table"&&(S[1]._align=G6(t.events,n))}return e}function Nc(e,t,n,a,o,l){const u=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(l.end=Object.assign({},Bo(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const f=Bo(t.events,n[1]);if(l={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const p=Bo(t.events,n[2]),g=Bo(t.events,n[3]),m={type:c,start:Object.assign({},p),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",m,t]]),a!==2){const y=t.events[n[2]],S=t.events[n[3]];if(y[1].end=Object.assign({},S[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const E=n[2]+1,v=n[3]-n[2]-1;e.add(E,v,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return o!==void 0&&(l.end=Object.assign({},Bo(t.events,o)),e.add(o,0,[["exit",l,t]]),l=void 0),l}function xC(e,t,n,a,o){const l=[],u=Bo(t.events,n);o&&(o.end=Object.assign({},u),l.push(["exit",o,t])),a.end=Object.assign({},u),l.push(["exit",a,t]),e.add(n+1,0,l)}function Bo(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const Y6={name:"tasklistCheck",tokenize:X6};function K6(){return{text:{91:Y6}}}function X6(e,t,n){const a=this;return o;function o(f){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),l)}function l(f){return Lt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),u):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),u):n(f)}function u(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(f)}function c(f){return Me(f)?t(f):it(f)?e.check({tokenize:Z6},t,n)(f):n(f)}}function Z6(e,t,n){return pt(e,a,"whitespace");function a(o){return o===null?n(o):t(o)}}function Q6(e){return B_([w6(),L6(),$6(e),V6(),K6()])}const J6={};function eV(e){const t=this,n=e||J6,a=t.data(),o=a.micromarkExtensions||(a.micromarkExtensions=[]),l=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),u=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);o.push(Q6(n)),l.push(S6()),u.push(E6(n))}const AC=jt(B.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-5 14H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"})),tV=jt(B.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 11h-3v3.75c0 1.24-1.01 2.25-2.25 2.25S8.5 17.99 8.5 16.75s1.01-2.25 2.25-2.25c.46 0 .89.14 1.25.38V11h4zm-3-4V3.5L18.5 9z"})),kC=jt(B.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"})),RC=jt(B.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"})),nV=jt(B.jsx("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z"})),rV=jt(B.jsx("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm7 7V3.5L18.5 9z"})),aV=jt(B.jsx("path",{d:"M12 14v-1h1.5v.5h2v-1H13c-.55 0-1-.45-1-1V10c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1h-1.5v-.5h-2v1H16c.55 0 1 .45 1 1V14c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1M9 9v4.5H7.5v-1H6v1c0 .83.67 1.5 1.5 1.5H9c.83 0 1.5-.67 1.5-1.5V9z"})),iV=jt(B.jsx("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5zm4-3H19v1h1.5V11H19v2h-1.5V7h3zM9 9.5h1v-1H9zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm10 5.5h1v-3h-1z"})),oV=jt(B.jsx("path",{d:"M14 2H6.01c-1.1 0-2 .89-2 2L4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8zm-1 7V3.5L18.5 9zm1 5 2-1.06v4.12L14 16v1c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h4c.55 0 1 .45 1 1z"}));function F0(e,t){const n=[".png",".jpg",".jpeg",".gif",".bmp",".webp",".svg",".ico"],a=e.toLowerCase();return n.some(o=>a.endsWith(o))||t?.startsWith("image/")||!1}function U0(e,t,n="small"){const a=e.split(".").pop()?.toLowerCase();return F0(e,t)?B.jsx(nV,{fontSize:n,color:"info"}):a==="pdf"||t==="application/pdf"?B.jsx(iV,{fontSize:n,color:"error"}):["doc","docx","odt","rtf"].includes(a||"")?B.jsx(RC,{fontSize:n,color:"primary"}):["md","markdown"].includes(a||"")||t==="text/markdown"?B.jsx(AC,{fontSize:n,color:"action"}):["js","jsx","ts","tsx","mjs","cjs"].includes(a||"")?B.jsx(aV,{fontSize:n,sx:{color:"#f7df1e"}}):["py","java","c","cpp","h","hpp","cs","go","rs","php","rb","swift","kt","scala"].includes(a||"")?B.jsx(kC,{fontSize:n,color:"secondary"}):["html","css","scss","sass","less"].includes(a||"")?B.jsx(kC,{fontSize:n,color:"primary"}):["json","yaml","yml","xml","toml","ini","conf","config"].includes(a||"")?B.jsx(AC,{fontSize:n,color:"warning"}):["mp4","avi","mov","mkv","wmv","flv","webm"].includes(a||"")||t?.startsWith("video/")?B.jsx(oV,{fontSize:n,color:"secondary"}):["mp3","wav","flac","aac","ogg","m4a","wma"].includes(a||"")||t?.startsWith("audio/")?B.jsx(tV,{fontSize:n,color:"success"}):["txt","log","csv","tsv"].includes(a||"")||t?.startsWith("text/")?B.jsx(RC,{fontSize:n}):B.jsx(rV,{fontSize:n})}function sd(e){const t=e.path,a=(t.split("/").filter(Boolean).pop()||t).replace(/~/g,"/"),l=e.meta?.type!=="file",u=e.content!==void 0&&e.content!==null&&!Array.isArray(e.content),c=e.meta?.size??(u?JSON.stringify(e.content).length:void 0);return{...e,name:a,hasChildren:l,hasContent:u,size:c}}function lV(e){return e?(typeof e=="string"?new Date(e):e).toLocaleString():"-"}function z0(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(2)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`:"-"}const sV=jt(B.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),uV=jt(B.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),CC={};function Qv(e,t){const n=A.useRef(CC);return n.current===CC&&(n.current=e(t)),n}function ud(e,t,n,a){const o=Qv(cV).current;return dV(o,e,t,n,a)&&pV(o,[e,t,n,a]),o.callback}function cV(){return{callback:null,cleanup:null,refs:[]}}function dV(e,t,n,a,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==a||e.refs[3]!==o}function pV(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const a=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const l=t[o];if(l!=null)switch(typeof l){case"function":{const u=l(n);typeof u=="function"&&(a[o]=u);break}case"object":{l.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const l=t[o];if(l!=null)switch(typeof l){case"function":{const u=a[o];typeof u=="function"?u():l(null);break}case"object":{l.current=null;break}}}}}}}function P0(e){return HM}function fV(e){return Pe("MuiSimpleTreeView",e)}Fe("MuiSimpleTreeView",["root","item","itemContent","itemGroupTransition","itemIconContainer","itemLabel","itemCheckbox"]);const Ym=Object.freeze([]),Es=Object.freeze({}),$0=A.createContext(null),ol=()=>{const e=A.useContext($0);if(e==null)throw new Error(["MUI X: Could not find the Tree View context.","It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
186
186
|
`));return e},j0=A.createContext({classes:{},slots:{},slotProps:{}}),H0=()=>A.useContext(j0),gV=e=>{const{store:t,apiRef:n,rootRef:a}=e,o=Qv(()=>t.buildPublicAPI()).current;mV(o,n);const l=A.useCallback(c=>{let f=null,p=null;const g=[],m={};t.itemPluginManager.listPlugins().forEach(E=>{const v=E({props:c,rootRef:f,contentRef:p});v?.rootRef&&(f=v.rootRef),v?.contentRef&&(p=v.contentRef),v?.propsEnhancers&&(g.push(v.propsEnhancers),Object.keys(v.propsEnhancers).forEach(T=>{m[T]=!0}))});const y=E=>v=>{const T={};return g.forEach(w=>{const C=w[E];C!=null&&Object.assign(T,C(v))}),T},S=Object.fromEntries(Object.keys(m).map(E=>[E,y(E)]));return{contentRef:p,rootRef:f,propsEnhancers:S}},[t]),u=A.useCallback(({itemId:c,children:f,idAttribute:p})=>{let g=f;const m=t.itemPluginManager.listWrappers();for(let y=m.length-1;y>=0;y-=1){const S=m[y];g=S({store:t,itemId:c,children:g,idAttribute:p})}return g},[t]);return A.useMemo(()=>({runItemPlugins:l,wrapItem:u,publicAPI:o,store:t,rootRef:a}),[l,u,o,t,a])};function mV(e,t){t!=null&&t.current==null&&(t.current=e)}function hV(e){const{store:t,apiRef:n,rootRef:a,classes:o=Es,slots:l=Es,slotProps:u=Es,children:c}=e,f=gV({store:t,apiRef:n,rootRef:a}),p=A.useMemo(()=>({classes:o,slots:{collapseIcon:l.collapseIcon,expandIcon:l.expandIcon,endIcon:l.endIcon},slotProps:{collapseIcon:u.collapseIcon,expandIcon:u.expandIcon,endIcon:u.endIcon}}),[o,l.collapseIcon,l.expandIcon,l.endIcon,u.collapseIcon,u.expandIcon,u.endIcon]);return B.jsx($0.Provider,{value:f,children:B.jsx(j0.Provider,{value:p,children:c})})}const bV=["apiRef","slots","slotProps","disabledItemsFocusable","onItemClick","itemChildrenIndentation","id","expandedItems","defaultExpandedItems","onExpandedItemsChange","onItemExpansionToggle","expansionTrigger","disableSelection","selectedItems","defaultSelectedItems","multiSelect","checkboxSelection","selectionPropagation","onSelectedItemsChange","onItemSelectionToggle","onItemFocus"];function yV(e){const{apiRef:t,slots:n,slotProps:a,disabledItemsFocusable:o,onItemClick:l,itemChildrenIndentation:u,id:c,expandedItems:f,defaultExpandedItems:p,onExpandedItemsChange:g,onItemExpansionToggle:m,expansionTrigger:y,disableSelection:S,selectedItems:E,defaultSelectedItems:v,multiSelect:T,checkboxSelection:w,selectionPropagation:C,onSelectedItemsChange:k,onItemSelectionToggle:_,onItemFocus:N}=e,I=Bi(e,bV),D=A.useMemo(()=>({disabledItemsFocusable:o,onItemClick:l,itemChildrenIndentation:u,id:c,expandedItems:f,defaultExpandedItems:p,onExpandedItemsChange:g,onItemExpansionToggle:m,expansionTrigger:y,disableSelection:S,selectedItems:E,defaultSelectedItems:v,multiSelect:T,checkboxSelection:w,selectionPropagation:C,onSelectedItemsChange:k,onItemSelectionToggle:_,onItemFocus:N}),[o,l,u,c,f,p,g,m,y,S,E,v,T,w,C,k,_,N]);return{apiRef:t,slots:n,slotProps:a,parameters:D,forwardedProps:I}}var cd=Symbol("NOT_FOUND");function SV(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function EV(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function vV(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(a=>typeof a=="function"?`function ${a.name||"unnamed"}()`:typeof a).join(", ");throw new TypeError(`${t}[${n}]`)}}var IC=e=>Array.isArray(e)?e:[e];function TV(e){const t=Array.isArray(e[0])?e[0]:e;return vV(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function wV(e,t){const n=[],{length:a}=e;for(let o=0;o<a;o++)n.push(e[o].apply(null,t));return n}function xV(e){let t;return{get(n){return t&&e(t.key,n)?t.value:cd},put(n,a){t={key:n,value:a}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function AV(e,t){let n=[];function a(c){const f=n.findIndex(p=>t(c,p.key));if(f>-1){const p=n[f];return f>0&&(n.splice(f,1),n.unshift(p)),p.value}return cd}function o(c,f){a(c)===cd&&(n.unshift({key:c,value:f}),n.length>e&&n.pop())}function l(){return n}function u(){n=[]}return{get:a,put:o,getEntries:l,clear:u}}var kV=(e,t)=>e===t;function RV(e){return function(n,a){if(n===null||a===null||n.length!==a.length)return!1;const{length:o}=n;for(let l=0;l<o;l++)if(!e(n[l],a[l]))return!1;return!0}}function CV(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:a=kV,maxSize:o=1,resultEqualityCheck:l}=n,u=RV(a);let c=0;const f=o<=1?xV(u):AV(o,u);function p(){let g=f.get(arguments);if(g===cd){if(g=e.apply(null,arguments),c++,l){const y=f.getEntries().find(S=>l(S.value,g));y&&(g=y.value,c!==0&&c--)}f.put(arguments,g)}return g}return p.clearCache=()=>{f.clear(),p.resetResultsCount()},p.resultsCount=()=>c,p.resetResultsCount=()=>{c=0},p}var IV=class{constructor(e){this.value=e}deref(){return this.value}},_V=typeof WeakRef<"u"?WeakRef:IV,NV=0,_C=1;function Oc(){return{s:NV,v:void 0,o:null,p:null}}function G0(e,t={}){let n=Oc();const{resultEqualityCheck:a}=t;let o,l=0;function u(){let c=n;const{length:f}=arguments;for(let m=0,y=f;m<y;m++){const S=arguments[m];if(typeof S=="function"||typeof S=="object"&&S!==null){let E=c.o;E===null&&(c.o=E=new WeakMap);const v=E.get(S);v===void 0?(c=Oc(),E.set(S,c)):c=v}else{let E=c.p;E===null&&(c.p=E=new Map);const v=E.get(S);v===void 0?(c=Oc(),E.set(S,c)):c=v}}const p=c;let g;if(c.s===_C)g=c.v;else if(g=e.apply(null,arguments),l++,a){const m=o?.deref?.()??o;m!=null&&a(m,g)&&(g=m,l!==0&&l--),o=typeof g=="object"&&g!==null||typeof g=="function"?new _V(g):g}return p.s=_C,p.v=g,g}return u.clearCache=()=>{n=Oc(),u.resetResultsCount()},u.resultsCount=()=>l,u.resetResultsCount=()=>{l=0},u}function V0(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,a=(...o)=>{let l=0,u=0,c,f={},p=o.pop();typeof p=="object"&&(f=p,p=o.pop()),SV(p,`createSelector expects an output function after the inputs, but received: [${typeof p}]`);const g={...n,...f},{memoize:m,memoizeOptions:y=[],argsMemoize:S=G0,argsMemoizeOptions:E=[]}=g,v=IC(y),T=IC(E),w=TV(o),C=m(function(){return l++,p.apply(null,arguments)},...v),k=S(function(){u++;const N=wV(w,arguments);return c=C.apply(null,N),c},...T);return Object.assign(k,{resultFunc:p,memoizedResultFunc:C,dependencies:w,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>c,recomputations:()=>l,resetRecomputations:()=>{l=0},memoize:m,argsMemoize:S})};return Object.assign(a,{withTypes:()=>a}),a}var OV=V0(G0),LV=Object.assign((e,t=OV)=>{EV(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),a=n.map(l=>e[l]);return t(a,(...l)=>l.reduce((u,c,f)=>(u[n[f]]=c,u),{}))},{withTypes:()=>LV});const DV=V0({memoize:CV,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),tt=(e,t,n,a,o,l,u,c,...f)=>{if(f.length>0)throw new Error("Unsupported number of selectors");let p;if(e&&t&&n&&a&&o&&l&&u&&c)p=(g,m,y,S)=>{const E=e(g,m,y,S),v=t(g,m,y,S),T=n(g,m,y,S),w=a(g,m,y,S),C=o(g,m,y,S),k=l(g,m,y,S),_=u(g,m,y,S);return c(E,v,T,w,C,k,_,m,y,S)};else if(e&&t&&n&&a&&o&&l&&u)p=(g,m,y,S)=>{const E=e(g,m,y,S),v=t(g,m,y,S),T=n(g,m,y,S),w=a(g,m,y,S),C=o(g,m,y,S),k=l(g,m,y,S);return u(E,v,T,w,C,k,m,y,S)};else if(e&&t&&n&&a&&o&&l)p=(g,m,y,S)=>{const E=e(g,m,y,S),v=t(g,m,y,S),T=n(g,m,y,S),w=a(g,m,y,S),C=o(g,m,y,S);return l(E,v,T,w,C,m,y,S)};else if(e&&t&&n&&a&&o)p=(g,m,y,S)=>{const E=e(g,m,y,S),v=t(g,m,y,S),T=n(g,m,y,S),w=a(g,m,y,S);return o(E,v,T,w,m,y,S)};else if(e&&t&&n&&a)p=(g,m,y,S)=>{const E=e(g,m,y,S),v=t(g,m,y,S),T=n(g,m,y,S);return a(E,v,T,m,y,S)};else if(e&&t&&n)p=(g,m,y,S)=>{const E=e(g,m,y,S),v=t(g,m,y,S);return n(E,v,m,y,S)};else if(e&&t)p=(g,m,y,S)=>{const E=e(g,m,y,S);return t(E,m,y,S)};else if(e)p=e;else throw new Error("Missing arguments");return p},MV=e=>(...t)=>{const n=new WeakMap;let a=1;const o=t[t.length-1],l=t.length-1||1,u=Math.max(o.length-l,0);if(u>3)throw new Error("Unsupported number of arguments");return(f,p,g,m)=>{let y=f.__cacheKey__;y||(y={id:a},f.__cacheKey__=y,a+=1);let S=n.get(y);if(!S){const E=t.length===1?[w=>w,o]:t;let v=t;const T=[void 0,void 0,void 0];switch(u){case 0:break;case 1:{v=[...E.slice(0,-1),()=>T[0],o];break}case 2:{v=[...E.slice(0,-1),()=>T[0],()=>T[1],o];break}case 3:{v=[...E.slice(0,-1),()=>T[0],()=>T[1],()=>T[2],o];break}default:throw new Error("Unsupported number of arguments")}S=DV(...v),S.selectorArgs=T,n.set(y,S)}switch(u){case 3:S.selectorArgs[2]=m;case 2:S.selectorArgs[1]=g;case 1:S.selectorArgs[0]=p}switch(u){case 0:return S(f);case 1:return S(f,p);case 2:return S(f,p,g);case 3:return S(f,p,g,m);default:throw new Error("unreachable")}}},nu=MV();var em={exports:{}},tm={};var NC;function BV(){if(NC)return tm;NC=1;var e=Os();function t(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function c(m,y){var S=y(),E=a({inst:{value:S,getSnapshot:y}}),v=E[0].inst,T=E[1];return l(function(){v.value=S,v.getSnapshot=y,f(v)&&T({inst:v})},[m,S,y]),o(function(){return f(v)&&T({inst:v}),m(function(){f(v)&&T({inst:v})})},[m]),u(S),S}function f(m){var y=m.getSnapshot;m=m.value;try{var S=y();return!n(m,S)}catch{return!0}}function p(m,y){return y()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:c;return tm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,tm}var OC;function q0(){return OC||(OC=1,em.exports=BV()),em.exports}var FV=q0(),nm={exports:{}},rm={};var LC;function UV(){if(LC)return rm;LC=1;var e=Os(),t=q0();function n(p,g){return p===g&&(p!==0||1/p===1/g)||p!==p&&g!==g}var a=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,c=e.useMemo,f=e.useDebugValue;return rm.useSyncExternalStoreWithSelector=function(p,g,m,y,S){var E=l(null);if(E.current===null){var v={hasValue:!1,value:null};E.current=v}else v=E.current;E=c(function(){function w(I){if(!C){if(C=!0,k=I,I=y(I),S!==void 0&&v.hasValue){var D=v.value;if(S(D,I))return _=D}return _=I}if(D=_,a(k,I))return D;var j=y(I);return S!==void 0&&S(D,j)?(k=I,D):(k=I,_=j)}var C=!1,k,_,N=m===void 0?null:m;return[function(){return w(g())},N===null?void 0:function(){return w(N())}]},[g,m,y,S]);var T=o(p,E[0],E[1]);return u(function(){v.hasValue=!0,v.value=T},[T]),f(T),T},rm}var DC;function zV(){return DC||(DC=1,nm.exports=UV()),nm.exports}var PV=zV();const $V=parseInt(A.version,10),jV=$V>=19,HV=jV?GV:VV;function Gt(e,t,n,a,o){return HV(e,t,n,a,o)}function GV(e,t,n,a,o){const l=A.useCallback(()=>t(e.getSnapshot(),n,a,o),[e,t,n,a,o]);return FV.useSyncExternalStore(e.subscribe,l,l)}function VV(e,t,n,a,o){return PV.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,l=>t(l,n,a,o))}class Jv{static create(t){return new Jv(t)}constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){this.state=t,this.updateTick+=1;const n=this.updateTick,a=this.listeners.values();let o;for(;o=a.next(),!o.done;){if(n!==this.updateTick)return;const l=o.value;l(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState(Se({},this.state,t));return}}set(t,n){Object.is(this.state[t],n)||this.setState(Se({},this.state,{[t]:n}))}use=(t,n,a,o)=>Gt(this,t,n,a,o)}const MC=tt(e=>e.providedTreeId??e.treeId),ru={treeId:MC,treeItemIdAttribute:tt(MC,(e,t,n)=>n??`${e??""}-${t}`)},Mr="__TREE_VIEW_ROOT_PARENT_ID__",W0=e=>{const t={};return e.forEach((n,a)=>{t[n]=a}),t},dd=(e,t)=>{if(t==null)return!1;let n=e[t];if(!n)return!1;if(n.disabled)return!0;for(;n.parentId!=null;){if(n=e[n.parentId],!n)return!1;if(n.disabled)return!0}return!1};function BC(e){const{storeParameters:t,items:n,parentId:a,depth:o,isItemExpandable:l,otherItemsMetaLookup:u}=e,c={},f={},p=[],g=[],m=y=>{const S=t.getItemId?t.getItemId(y):y.id;qV({id:S,parentId:a,item:y,itemMetaLookup:u,siblingsMetaLookup:c});const E=t.getItemLabel?t.getItemLabel(y):y.label;if(E==null)throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.","Alternatively, you can use the `getItemLabel` prop to specify a custom label for each item.","An item was provided without label in the `items` prop:",JSON.stringify(y)].join(`
|
|
187
187
|
`));const v=(t.getItemChildren?t.getItemChildren(y):y.children)||[];g.push({id:S,children:v}),f[S]=y,c[S]={id:S,label:E,parentId:a,idAttribute:void 0,expandable:l(y,v),disabled:t.isItemDisabled?t.isItemDisabled(y):!1,selectable:t.isItemSelectionDisabled?!t.isItemSelectionDisabled(y):!0,depth:o},p.push(S)};for(const y of n)m(y);return{metaLookup:c,modelLookup:f,orderedChildrenIds:p,childrenIndexes:W0(p),itemsChildren:g}}function qV({id:e,parentId:t,item:n,itemMetaLookup:a,siblingsMetaLookup:o}){if(e==null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.","An item was provided without id in the `items` prop:",JSON.stringify(n)].join(`
|
|
188
188
|
`));if(o[e]!=null||a[e]!=null&&a[e].parentId!==t)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${e}"`].join(`
|
|
189
189
|
`))}const WV=[],xe={domStructure:tt(e=>e.domStructure),disabledItemFocusable:tt(e=>e.disabledItemsFocusable),itemMetaLookup:tt(e=>e.itemMetaLookup),itemOrderedChildrenIdsLookup:tt(e=>e.itemOrderedChildrenIdsLookup),itemMeta:tt((e,t)=>e.itemMetaLookup[t??Mr]??null),itemOrderedChildrenIds:tt((e,t)=>e.itemOrderedChildrenIdsLookup[t??Mr]??WV),itemModel:tt((e,t)=>e.itemModelLookup[t]),isItemDisabled:tt((e,t)=>dd(e.itemMetaLookup,t)),itemIndex:tt((e,t)=>{const n=e.itemMetaLookup[t];return n==null?-1:e.itemChildrenIndexesLookup[n.parentId??Mr][n.id]}),itemParentId:tt((e,t)=>e.itemMetaLookup[t]?.parentId??null),itemDepth:tt((e,t)=>e.itemMetaLookup[t]?.depth??0),canItemBeFocused:tt((e,t)=>e.disabledItemsFocusable||!dd(e.itemMetaLookup,t)),itemChildrenIndentation:tt(e=>e.itemChildrenIndentation)};class Gc{constructor(t){this.store=t}static shouldRebuildItemsState=(t,n)=>["items","isItemDisabled","isItemSelectionDisabled","getItemId","getItemLabel","getItemChildren"].some(a=>{const o=a;return t[o]!==n[o]});static buildItemsStateIfNeeded=t=>{const n={},a={},o={},l={};function u(c,f,p){const g=f??Mr,{metaLookup:m,modelLookup:y,orderedChildrenIds:S,childrenIndexes:E,itemsChildren:v}=BC({storeParameters:t,items:c,parentId:f,depth:p,isItemExpandable:(T,w)=>!!w&&w.length>0,otherItemsMetaLookup:n});Object.assign(n,m),Object.assign(a,y),o[g]=S,l[g]=E;for(const T of v)u(T.children||[],T.id,p+1)}return u(t.items,null,0),{itemMetaLookup:n,itemModelLookup:a,itemOrderedChildrenIdsLookup:o,itemChildrenIndexesLookup:l}};getItem=t=>xe.itemModel(this.store.state,t);getItemTree=()=>{const t=n=>{const a=xe.itemModel(this.store.state,n),o=Se({},a),l=xe.itemOrderedChildrenIds(this.store.state,n);return l.length>0?o.children=l.map(t):delete o.children,o};return xe.itemOrderedChildrenIds(this.store.state,null).map(t)};getItemOrderedChildrenIds=t=>xe.itemOrderedChildrenIds(this.store.state,t);getParentId=t=>xe.itemMeta(this.store.state,t)?.parentId||null;setIsItemDisabled=({itemId:t,shouldBeDisabled:n})=>{if(!this.store.state.itemMetaLookup[t])return;const a=Se({},this.store.state.itemMetaLookup);a[t]=Se({},a[t],{disabled:n??!a[t].disabled}),this.store.set("itemMetaLookup",a)};buildPublicAPI=()=>({getItem:this.getItem,getItemDOMElement:this.getItemDOMElement,getItemOrderedChildrenIds:this.getItemOrderedChildrenIds,getItemTree:this.getItemTree,getParentId:this.getParentId,setIsItemDisabled:this.setIsItemDisabled});getItemDOMElement=t=>{const n=xe.itemMeta(this.store.state,t);if(n==null)return null;const a=ru.treeItemIdAttribute(this.store.state,t,n.idAttribute);return document.getElementById(a)};setItemChildren=({items:t,parentId:n,getChildrenCount:a})=>{const o=n??Mr,l=n==null?-1:xe.itemDepth(this.store.state,n),{metaLookup:u,modelLookup:c,orderedChildrenIds:f,childrenIndexes:p}=BC({storeParameters:this.store.parameters,items:t,parentId:n,depth:l+1,isItemExpandable:a?g=>a(g)!==0:()=>!1,otherItemsMetaLookup:xe.itemMetaLookup(this.store.state)});this.store.update({itemModelLookup:Se({},this.store.state.itemModelLookup,c),itemMetaLookup:Se({},this.store.state.itemMetaLookup,u),itemOrderedChildrenIdsLookup:Se({},this.store.state.itemOrderedChildrenIdsLookup,{[o]:f}),itemChildrenIndexesLookup:Se({},this.store.state.itemChildrenIndexesLookup,{[o]:p})})};removeChildren=t=>{const n=this.store.state.itemMetaLookup,a=Object.keys(n).reduce((c,f)=>{const p=n[f];return p.parentId===t?c:Se({},c,{[p.id]:p})},{}),o=Se({},this.store.state.itemOrderedChildrenIdsLookup),l=Se({},this.store.state.itemChildrenIndexesLookup),u=t??Mr;delete l[u],delete o[u],this.store.update({itemMetaLookup:a,itemOrderedChildrenIdsLookup:o,itemChildrenIndexesLookup:l})};handleItemClick=(t,n)=>{this.store.parameters.onItemClick?.(t,n)}}const Y0=nu(e=>e.selectedItems,e=>Array.isArray(e)?e:e!=null?[e]:[]),FC=nu(Y0,e=>{const t=new Map;return e.forEach(n=>{t.set(n,!0)}),t}),am=tt((e,t)=>e.itemMetaLookup[t]?.selectable??!0),ft={selectedItemsRaw:tt(e=>e.selectedItems),selectedItems:Y0,selectedItemsMap:FC,enabled:tt(e=>!e.disableSelection),isMultiSelectEnabled:tt(e=>e.multiSelect),isCheckboxSelectionEnabled:tt(e=>e.checkboxSelection),propagationRules:tt(e=>e.selectionPropagation),isItemSelected:tt(FC,(e,t)=>e.has(t)),isFeatureEnabledForItem:tt(am,e=>!e.disableSelection,(e,t,n)=>t&&e),canItemBeSelected:tt(xe.isItemDisabled,am,e=>!e.disableSelection,(e,t,n,a)=>n&&!e&&t),isItemSelectable:am},YV=tt((e,t)=>{if(ft.isItemSelected(e,t))return"checked";let n=!1,a=!1;const o=u=>{u!==t&&(ft.isItemSelected(e,u)?n=!0:a=!0),xe.itemOrderedChildrenIds(e,u).forEach(o)};return o(t),ft.propagationRules(e).parents?n&&a?"indeterminate":n&&!a?"checked":"empty":n?"indeterminate":"empty"}),KV=({props:e})=>{const{itemId:t}=e,{store:n}=ol(),a=Gt(n,ft.isCheckboxSelectionEnabled),o=Gt(n,ft.isFeatureEnabledForItem,t),l=Gt(n,ft.canItemBeSelected,t),u=Gt(n,YV,t);return{propsEnhancers:{root:()=>{let c;return u==="checked"?c=!0:u==="indeterminate"?c="mixed":l?c=!1:c=void 0,{"aria-checked":c}},checkbox:({externalEventHandlers:c,interactions:f})=>({tabIndex:-1,onChange:g=>{c.onChange?.(g),!g.defaultMuiPrevented&&ft.canItemBeSelected(n.state,t)&&f.handleCheckboxSelection(g)},visible:a&&o,disabled:!l,checked:u==="checked",indeterminate:u==="indeterminate"})}}},im=nu(e=>e.expandedItems,e=>{const t=new Map;return e.forEach(n=>{t.set(n,!0)}),t}),en={expandedItemsRaw:tt(e=>e.expandedItems),expandedItemsMap:im,flatList:nu(xe.itemOrderedChildrenIdsLookup,im,(e,t)=>{function n(a){if(!t.has(a))return[a];const o=[a],l=e[a]||[];for(const u of l)o.push(...n(u));return o}return(e[Mr]??[]).flatMap(n)}),triggerSlot:tt(e=>e.expansionTrigger),isItemExpanded:tt(im,(e,t)=>e.has(t)),isItemExpandable:tt(xe.itemMeta,(e,t)=>e?.expandable??!1)},Km=(e,t)=>{let n=t.length-1;for(;n>=0&&!xe.canItemBeFocused(e,t[n]);)n-=1;if(n!==-1)return t[n]},K0=(e,t)=>{const n=xe.itemMeta(e,t);if(!n)return null;const a=xe.itemOrderedChildrenIds(e,n.parentId),o=xe.itemIndex(e,t);if(o===0)return n.parentId;let l=o-1;for(;!xe.canItemBeFocused(e,a[l])&&l>=0;)l-=1;if(l===-1)return n.parentId==null?null:K0(e,n.parentId);let u=a[l],c=Km(e,xe.itemOrderedChildrenIds(e,u));for(;en.isItemExpanded(e,u)&&c!=null;)u=c,c=Km(e,xe.itemOrderedChildrenIds(e,u));return u},Vc=(e,t)=>{if(en.isItemExpanded(e,t)){const a=xe.itemOrderedChildrenIds(e,t).find(o=>xe.canItemBeFocused(e,o));if(a!=null)return a}let n=xe.itemMeta(e,t);for(;n!=null;){const a=xe.itemOrderedChildrenIds(e,n.parentId),o=xe.itemIndex(e,n.id);if(o<a.length-1){let l=o+1;for(;!xe.canItemBeFocused(e,a[l])&&l<a.length-1;)l+=1;if(xe.canItemBeFocused(e,a[l]))return a[l]}n=xe.itemMeta(e,n.parentId)}return null},X0=e=>{let t=null;for(;t==null||en.isItemExpanded(e,t);){const n=xe.itemOrderedChildrenIds(e,t),a=Km(e,n);if(a==null)return t;t=a}return t},pd=e=>xe.itemOrderedChildrenIds(e,null).find(t=>xe.canItemBeFocused(e,t)),Z0=(e,t,n)=>{if(t===n)return[t,n];const a=xe.itemMeta(e,t),o=xe.itemMeta(e,n);if(!a||!o)return[t,n];if(a.parentId===o.id||o.parentId===a.id)return o.parentId===a.id?[a.id,o.id]:[o.id,a.id];const l=[a.id],u=[o.id];let c=a.parentId,f=o.parentId,p=u.indexOf(c)!==-1,g=l.indexOf(f)!==-1,m=!0,y=!0;for(;!g&&!p;)m&&(l.push(c),p=u.indexOf(c)!==-1,m=c!==null,!p&&m&&(c=xe.itemParentId(e,c))),y&&!p&&(u.push(f),g=l.indexOf(f)!==-1,y=f!==null,!g&&y&&(f=xe.itemParentId(e,f)));const S=p?c:f,E=xe.itemOrderedChildrenIds(e,S),v=l[l.indexOf(S)-1],T=u[u.indexOf(S)-1];return E.indexOf(v)<E.indexOf(T)?[t,n]:[n,t]},XV=(e,t,n)=>{const a=f=>{if(en.isItemExpandable(e,f)&&en.isItemExpanded(e,f))return xe.itemOrderedChildrenIds(e,f)[0];let p=xe.itemMeta(e,f);for(;p!=null;){const g=xe.itemOrderedChildrenIds(e,p.parentId),m=xe.itemIndex(e,p.id);if(m<g.length-1)return g[m+1];p=p.parentId?xe.itemMeta(e,p.parentId):null}throw new Error("Invalid range")},[o,l]=Z0(e,t,n),u=[o];let c=o;for(;c!==l;)c=a(c),xe.isItemDisabled(e,c)||u.push(c);return u},ZV=e=>{let t=pd(e);const n=[];for(;t!=null;)n.push(t),t=Vc(e,t);return n},Xm=(e,t)=>t!==e.closest('*[role="treeitem"]');class QV{lastSelectedItem=null;lastSelectedRange={};constructor(t){this.store=t,t.itemPluginManager.register(KV,null)}setSelectedItems=(t,n,a)=>{const{selectionPropagation:o=Es,selectedItems:l,onItemSelectionToggle:u,onSelectedItemsChange:c}=this.store.parameters,f=ft.selectedItemsRaw(this.store.state);let p;const g=ft.isMultiSelectEnabled(this.store.state);if(g&&(o.descendants||o.parents)?p=JV({store:this.store,selectionPropagation:o,newModel:n,oldModel:f,additionalItemsToPropagate:a}):p=n,u)if(g){const m=Q0({store:this.store,newModel:p,oldModel:f});u&&(m.added.forEach(y=>{u(t,y,!0)}),m.removed.forEach(y=>{u(t,y,!1)}))}else p!==f&&(f!=null&&u(t,f,!1),p!=null&&u(t,p,!0));l===void 0&&this.store.set("selectedItems",p),c?.(t,p)};selectRange=(t,[n,a])=>{if(!ft.isMultiSelectEnabled(this.store.state))return;let l=ft.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length>0&&(l=l.filter(p=>!this.lastSelectedRange[p]));const u=qc(l),c=XV(this.store.state,n,a).filter(p=>ft.isItemSelectable(this.store.state,p)),f=c.filter(p=>!u[p]);l=l.concat(f),this.setSelectedItems(t,l),this.lastSelectedRange=qc(c)};buildPublicAPI=()=>({setItemSelection:this.setItemSelection});setItemSelection=({itemId:t,event:n=null,keepExistingSelection:a=!1,shouldBeSelected:o})=>{if(!ft.enabled(this.store.state))return;let l;const u=ft.isMultiSelectEnabled(this.store.state);if(a){const c=ft.selectedItems(this.store.state),f=ft.isItemSelected(this.store.state,t);f&&(o===!1||o==null)?l=c.filter(p=>p!==t):!f&&(o===!0||o==null)?l=[t].concat(c):l=c}else o===!1||o==null&&ft.isItemSelected(this.store.state,t)?l=u?[]:null:l=u?[t]:t;this.setSelectedItems(n,l,[t]),this.lastSelectedItem=t,this.lastSelectedRange={}};selectAllNavigableItems=t=>{if(!ft.isMultiSelectEnabled(this.store.state))return;const a=ZV(this.store.state);this.setSelectedItems(t,a),this.lastSelectedRange=qc(a)};expandSelectionRange=(t,n)=>{if(this.lastSelectedItem!=null){const[a,o]=Z0(this.store.state,n,this.lastSelectedItem);this.selectRange(t,[a,o])}};selectRangeFromStartToItem=(t,n)=>{this.selectRange(t,[pd(this.store.state),n])};selectRangeFromItemToEnd=(t,n)=>{this.selectRange(t,[n,X0(this.store.state)])};selectItemFromArrowNavigation=(t,n,a)=>{if(!ft.isMultiSelectEnabled(this.store.state))return;let l=ft.selectedItems(this.store.state).slice();Object.keys(this.lastSelectedRange).length===0?(l.push(a),this.lastSelectedRange={[n]:!0,[a]:!0}):(this.lastSelectedRange[n]||(this.lastSelectedRange={}),this.lastSelectedRange[a]?(l=l.filter(u=>u!==n),delete this.lastSelectedRange[n]):(l.push(a),this.lastSelectedRange[a]=!0)),this.setSelectedItems(t,l)}}function JV({store:e,selectionPropagation:t,newModel:n,oldModel:a,additionalItemsToPropagate:o}){if(!t.descendants&&!t.parents)return n;let l=!1;const u=qc(n),c=Q0({store:e,newModel:n,oldModel:a});return o?.forEach(f=>{u[f]?c.added.includes(f)||c.added.push(f):c.removed.includes(f)||c.removed.push(f)}),c.added.forEach(f=>{if(t.descendants){const p=g=>{g!==f&&(l=!0,u[g]=!0),xe.itemOrderedChildrenIds(e.state,g).forEach(p)};p(f)}if(t.parents){const p=m=>u[m]?xe.itemOrderedChildrenIds(e.state,m).every(p):!1,g=m=>{const y=xe.itemParentId(e.state,m);if(y==null)return;xe.itemOrderedChildrenIds(e.state,y).every(p)&&(l=!0,u[y]=!0,g(y))};g(f)}}),c.removed.forEach(f=>{if(t.parents){let p=xe.itemParentId(e.state,f);for(;p!=null;)u[p]&&(l=!0,delete u[p]),p=xe.itemParentId(e.state,p)}if(t.descendants){const p=g=>{g!==f&&(l=!0,delete u[g]),xe.itemOrderedChildrenIds(e.state,g).forEach(p)};p(f)}}),l?Object.keys(u):n}function Q0({store:e,oldModel:t,newModel:n}){const a=new Map;return n.forEach(o=>{a.set(o,!0)}),{added:n.filter(o=>!ft.isItemSelected(e.state,o)),removed:t.filter(o=>!a.has(o))}}function qc(e){const t={};return e.forEach(n=>{t[n]=!0}),t}function e9(e,t,n){const a=Gt(e,ru.treeId),o=Gt(e,xe.itemChildrenIndentation),l=Gt(e,ft.isMultiSelectEnabled);return u=>Se({ref:n,role:"tree",id:a,"aria-multiselectable":l},t,u,{style:Se({},t.style,{"--TreeView-itemChildrenIndentation":typeof o=="number"?`${o}px`:o}),onFocus:c=>{u.onFocus?.(c),e.focus.handleRootFocus(c)},onBlur:c=>{u.onBlur?.(c),e.focus.handleRootBlur(c)}})}function t9(e){return e.replace(/["\\]/g,"\\$&")}const J0=A.createContext(null);function eN(e){const{children:t,itemId:n=null,idAttribute:a}=e,{store:o,rootRef:l}=ol(),u=A.useRef(new Map);A.useEffect(()=>{if(!l.current)return;const f=xe.itemOrderedChildrenIds(o.state,n??null)??[],p=t9(a??l.current.id);if(n!=null){const S=l.current.querySelector(`*[id="${p}"][role="treeitem"]`);if(S&&S.getAttribute("aria-expanded")==="false")return}const g=l.current.querySelectorAll(`${n==null?"":`*[id="${p}"] `}[role="treeitem"]:not(*[id="${p}"] [role="treeitem"] [role="treeitem"])`),m=Array.from(g).map(S=>u.current.get(S.id));(m.length!==f.length||m.some((S,E)=>S!==f[E]))&&o.jsxItems.setJSXItemsOrderedChildrenIds(n??null,m)});const c=A.useMemo(()=>({registerChild:(f,p)=>u.current.set(f,p),unregisterChild:f=>u.current.delete(f),parentId:n}),[n]);return B.jsx(J0.Provider,{value:c,children:t})}const fd=A.createContext(()=>-1),n9=()=>{},Zm=typeof document<"u"?A.useLayoutEffect:n9,r9=[];function a9(e){A.useEffect(e,r9)}function i9(e,t){const n=Ps(),a=Qv(()=>new e(Se({},t,{isRtl:n}))).current;return Zm(()=>a.updateStateFromParameters(Se({},t,{isRtl:n})),[a,n,t]),a9(a.disposeEffect),a}class o9{maxListeners=20;warnOnce=!1;events={};on(t,n,a={}){let o=this.events[t];o||(o={highPriority:new Map,regular:new Map},this.events[t]=o),a.isFirst?o.highPriority.set(n,!0):o.regular.set(n,!0)}removeListener(t,n){this.events[t]&&(this.events[t].regular.delete(n),this.events[t].highPriority.delete(n))}removeAllListeners(){this.events={}}emit(t,...n){const a=this.events[t];if(!a)return;const o=Array.from(a.highPriority.keys()),l=Array.from(a.regular.keys());for(let u=o.length-1;u>=0;u-=1){const c=o[u];a.highPriority.has(c)&&c.apply(this,n)}for(let u=0;u<l.length;u+=1){const c=l[u];a.regular.has(c)&&c.apply(this,n)}}once(t,n){const a=this;this.on(t,function o(...l){a.removeListener(t,o),n.apply(a,l)})}}const l9=({isItemEditable:e,expansionTrigger:t})=>t||(e?"iconContainer":"content");function tN(e){return{disabledItemsFocusable:e.disabledItemsFocusable??!1,domStructure:"nested",itemChildrenIndentation:e.itemChildrenIndentation??"12px",providedTreeId:e.id,expansionTrigger:l9({isItemEditable:e.isItemEditable,expansionTrigger:e.expansionTrigger}),disableSelection:e.disableSelection??!1,multiSelect:e.multiSelect??!1,checkboxSelection:e.checkboxSelection??!1,selectionPropagation:e.selectionPropagation??Es}}function UC(e,t,n){return e!==void 0?e:t!==void 0?t:n}function s9(e){return Se({treeId:void 0,focusedItemId:null},tN(e),Gc.buildItemsStateIfNeeded(e),{expandedItems:UC(e.expandedItems,e.defaultExpandedItems,[]),selectedItems:UC(e.selectedItems,e.defaultSelectedItems,e.multiSelect?Ym:null)})}let zC=0;const u9=()=>(zC+=1,`mui-tree-view-${zC}`);class c9{timeoutIds=new Map;intervalIds=new Map;startTimeout=(t,n,a)=>{this.clearTimeout(t);const o=setTimeout(()=>{this.timeoutIds.delete(t),a()},n);this.timeoutIds.set(t,o)};startInterval=(t,n,a)=>{this.clearTimeout(t);const o=setInterval(a,n);this.intervalIds.set(t,o)};clearTimeout=t=>{const n=this.timeoutIds.get(t);n!=null&&(clearTimeout(n),this.timeoutIds.delete(t))};clearInterval=t=>{const n=this.intervalIds.get(t);n!=null&&(clearInterval(n),this.intervalIds.delete(t))};clearAll=()=>{this.timeoutIds.forEach(clearTimeout),this.timeoutIds.clear(),this.intervalIds.forEach(clearInterval),this.intervalIds.clear()}}class d9{constructor(t){this.store=t}setExpandedItems=(t,n)=>{this.store.parameters.expandedItems===void 0&&this.store.set("expandedItems",n),this.store.parameters.onExpandedItemsChange?.(t,n)};isItemExpanded=t=>en.isItemExpanded(this.store.state,t);buildPublicAPI=()=>({isItemExpanded:this.isItemExpanded,setItemExpansion:this.setItemExpansion});setItemExpansion=({itemId:t,event:n=null,shouldBeExpanded:a})=>{const o=en.isItemExpanded(this.store.state,t),l=a??!o;if(o===l)return;const u={isExpansionPrevented:!1,shouldBeExpanded:l,itemId:t};this.store.publishEvent("beforeItemToggleExpansion",u,n),!u.isExpansionPrevented&&this.applyItemExpansion({itemId:t,event:n,shouldBeExpanded:l})};applyItemExpansion=({itemId:t,event:n,shouldBeExpanded:a})=>{const o=en.expandedItemsRaw(this.store.state);let l;a?l=[t].concat(o):l=o.filter(u=>u!==t),this.store.parameters.onItemExpansionToggle?.(n,t,a),this.setExpandedItems(n,l)};expandAllSiblings=(t,n)=>{const a=xe.itemMeta(this.store.state,n);if(a==null)return;const l=xe.itemOrderedChildrenIds(this.store.state,a.parentId).filter(c=>en.isItemExpandable(this.store.state,c)&&!en.isItemExpanded(this.store.state,c)),u=en.expandedItemsRaw(this.store.state).concat(l);l.length>0&&(this.store.parameters.onItemExpansionToggle&&l.forEach(c=>{this.store.parameters.onItemExpansionToggle(t,c,!0)}),this.setExpandedItems(t,u))};addExpandableItems=t=>{const n=Se({},this.store.state.itemMetaLookup);for(const a of t)n[a]=Se({},n[a],{expandable:!0});this.store.set("itemMetaLookup",n)}}const zo={isItemEditable:tt(e=>e.isItemEditable,xe.itemModel,(e,t,n)=>!t||e==null?!1:typeof e=="boolean"?e:e(t)),isItemBeingEdited:tt((e,t)=>t==null?!1:e.editedItemId===t),isAnyItemBeingEdited:tt(e=>!!e.editedItemId)},p9=500;class f9{typeaheadQuery="";constructor(t){this.store=t,this.labelMap=PC(xe.itemMetaLookup(this.store.state)),this.store.registerStoreEffect(xe.itemMetaLookup,(n,a)=>{this.store.shouldIgnoreItemsStateUpdate()||(this.labelMap=PC(a))})}canToggleItemSelection=t=>ft.canItemBeSelected(this.store.state,t);canToggleItemExpansion=t=>!xe.isItemDisabled(this.store.state,t)&&en.isItemExpandable(this.store.state,t);getFirstItemMatchingTypeaheadQuery=(t,n)=>{const a=p=>{const g=Vc(this.store.state,p);return g===null?pd(this.store.state):g},o=p=>{let g=null;const m={};let y=p.length>1?t:a(t);for(;g==null&&!m[y];)this.labelMap[y]?.startsWith(p)?g=y:(m[y]=!0,y=a(y));return g},l=n.toLowerCase(),u=`${this.typeaheadQuery}${l}`,c=o(u);if(c!=null)return this.typeaheadQuery=u,c;const f=o(l);return f!=null?(this.typeaheadQuery=l,f):(this.typeaheadQuery="",null)};updateLabelMap=t=>{this.labelMap=t(this.labelMap)};handleItemKeyDown=async(t,n)=>{if(t.defaultMuiPrevented||t.altKey||Xm(t.target,t.currentTarget))return;const a=t.ctrlKey||t.metaKey,o=t.key,l=ft.isMultiSelectEnabled(this.store.state);switch(!0){case(o===" "&&this.canToggleItemSelection(n)):{t.preventDefault(),l&&t.shiftKey?this.store.selection.expandSelectionRange(t,n):this.store.selection.setItemSelection({event:t,itemId:n,keepExistingSelection:l,shouldBeSelected:void 0});break}case o==="Enter":{this.store.labelEditing?.setEditedItem&&zo.isItemEditable(this.store.state,n)&&!zo.isItemBeingEdited(this.store.state,n)?this.store.labelEditing.setEditedItem(n):this.canToggleItemExpansion(n)?(this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault()):this.canToggleItemSelection(n)&&(l?(t.preventDefault(),this.store.selection.setItemSelection({event:t,itemId:n,keepExistingSelection:!0})):ft.isItemSelected(this.store.state,n)||(this.store.selection.setItemSelection({event:t,itemId:n}),t.preventDefault()));break}case o==="ArrowDown":{const u=Vc(this.store.state,n);u&&(t.preventDefault(),this.store.focus.focusItem(t,u),l&&t.shiftKey&&this.canToggleItemSelection(u)&&this.store.selection.selectItemFromArrowNavigation(t,n,u));break}case o==="ArrowUp":{const u=K0(this.store.state,n);u&&(t.preventDefault(),this.store.focus.focusItem(t,u),l&&t.shiftKey&&this.canToggleItemSelection(u)&&this.store.selection.selectItemFromArrowNavigation(t,n,u));break}case(o==="ArrowRight"&&!this.store.parameters.isRtl||o==="ArrowLeft"&&this.store.parameters.isRtl):{if(a)return;if(en.isItemExpanded(this.store.state,n)){const u=Vc(this.store.state,n);u&&(this.store.focus.focusItem(t,u),t.preventDefault())}else this.canToggleItemExpansion(n)&&(this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault());break}case(o==="ArrowLeft"&&!this.store.parameters.isRtl||o==="ArrowRight"&&this.store.parameters.isRtl):{if(a)return;if(this.canToggleItemExpansion(n)&&en.isItemExpanded(this.store.state,n))this.store.expansion.setItemExpansion({event:t,itemId:n}),t.preventDefault();else{const u=xe.itemParentId(this.store.state,n);u&&(this.store.focus.focusItem(t,u),t.preventDefault())}break}case o==="Home":{this.canToggleItemSelection(n)&&l&&a&&t.shiftKey?this.store.selection.selectRangeFromStartToItem(t,n):this.store.focus.focusItem(t,pd(this.store.state)),t.preventDefault();break}case o==="End":{this.canToggleItemSelection(n)&&l&&a&&t.shiftKey?this.store.selection.selectRangeFromItemToEnd(t,n):this.store.focus.focusItem(t,X0(this.store.state)),t.preventDefault();break}case o==="*":{this.store.expansion.expandAllSiblings(t,n),t.preventDefault();break}case(String.fromCharCode(t.keyCode)==="A"&&a&&l&&ft.enabled(this.store.state)):{this.store.selection.selectAllNavigableItems(t),t.preventDefault();break}case(!a&&!t.shiftKey&&g9(o)):{this.store.timeoutManager.clearTimeout("typeahead");const u=this.getFirstItemMatchingTypeaheadQuery(n,o);u!=null?(this.store.focus.focusItem(t,u),t.preventDefault()):this.typeaheadQuery="",this.store.timeoutManager.startTimeout("typeahead",p9,()=>{this.typeaheadQuery=""});break}}}}function g9(e){return!!e&&e.length===1&&!!e.match(/\S/)}function PC(e){const t={},n=a=>{t[a.id]=a.label.toLowerCase()};return Object.values(e).forEach(n),t}const $C=nu(ft.selectedItems,en.expandedItemsMap,xe.itemMetaLookup,xe.disabledItemFocusable,e=>xe.itemOrderedChildrenIds(e,null),(e,t,n,a,o)=>{const l=e.find(c=>{if(!a&&dd(n,c))return!1;const f=n[c];return f&&(f.parentId==null||t.has(f.parentId))});if(l!=null)return l;const u=o.find(c=>a||!dd(n,c));return u??null}),Oi={defaultFocusableItemId:$C,isItemTheDefaultFocusableItem:tt($C,(e,t)=>e===t),focusedItemId:tt(e=>e.focusedItemId),isItemFocused:tt((e,t)=>e.focusedItemId===t)};class m9{constructor(t){this.store=t,this.store.registerStoreEffect(xe.itemMetaLookup,()=>{const n=Oi.focusedItemId(t.state);if(n==null||!!xe.itemMeta(t.state,n))return;const o=Oi.defaultFocusableItemId(t.state);if(o==null){this.setFocusedItemId(null);return}this.applyItemFocus(null,o)})}setFocusedItemId=t=>{Oi.focusedItemId(this.store.state)!==t&&this.store.set("focusedItemId",t)};applyItemFocus=(t,n)=>{this.store.items.getItemDOMElement(n)?.focus(),this.setFocusedItemId(n),this.store.parameters.onItemFocus?.(t,n)};buildPublicAPI=()=>({focusItem:this.focusItem});focusItem=(t,n)=>{const a=xe.itemMeta(this.store.state,n);a&&(a.parentId==null||en.isItemExpanded(this.store.state,a.parentId))&&this.applyItemFocus(t,n)};removeFocusedItem=()=>{const t=Oi.focusedItemId(this.store.state);if(t==null)return;if(xe.itemMeta(this.store.state,t)){const a=this.store.items.getItemDOMElement(t);a&&a.blur()}this.setFocusedItemId(null)};handleRootFocus=t=>{if(t.defaultMuiPrevented)return;const n=Oi.defaultFocusableItemId(this.store.state);t.target===t.currentTarget&&n!=null&&this.applyItemFocus(t,n)};handleRootBlur=t=>{t.defaultMuiPrevented||this.setFocusedItemId(null)}}class h9{itemPlugins=[];itemWrappers=[];register=(t,n)=>{this.itemPlugins.push(t),n&&this.itemWrappers.push(n)};listPlugins=()=>this.itemPlugins;listWrappers=()=>this.itemWrappers}class b9 extends Jv{initialParameters=null;eventManager=new o9;timeoutManager=new c9;itemPluginManager=new h9;constructor(t,n,a){const o=s9(t),l=a.getInitialState(o,t);super(l),this.parameters=t,this.instanceName=n,this.mapper=a,this.items=new Gc(this),this.focus=new m9(this),this.expansion=new d9(this),this.selection=new QV(this),this.keyboardNavigation=new f9(this)}buildPublicAPI(){return Se({},this.items.buildPublicAPI(),this.focus.buildPublicAPI(),this.expansion.buildPublicAPI(),this.selection.buildPublicAPI())}updateStateFromParameters(t){const n=(l,u,c)=>{t[u]!==void 0&&(l[u]=t[u])},a=tN(t);n(a,"expandedItems"),n(a,"selectedItems"),(this.state.providedTreeId!==t.id||this.state.treeId===void 0)&&(a.treeId=u9()),!this.mapper.shouldIgnoreItemsStateUpdate(t)&&Gc.shouldRebuildItemsState(t,this.parameters)&&Object.assign(a,Gc.buildItemsStateIfNeeded(t));const o=this.mapper.updateStateFromParameters(a,t,n);this.update(o),this.parameters=t}disposeEffect=()=>this.timeoutManager.clearAll;shouldIgnoreItemsStateUpdate=()=>this.mapper.shouldIgnoreItemsStateUpdate(this.parameters);registerStoreEffect=(t,n)=>{let a=t(this.state);this.subscribe(o=>{const l=t(o);l!==a&&(n(a,l),a=l)})};publishEvent=(t,n,a)=>{y9(a)&&a.isPropagationStopped()||this.eventManager.emit(t,n,a)};subscribeEvent=(t,n)=>{this.eventManager.on(t,n)}}function y9(e){return e.isPropagationStopped!==void 0}const jC={isEmpty:tt(e=>e.lazyLoadedItems==null?!0:Object.keys(e.lazyLoadedItems.loading).length===0&&Object.keys(e.lazyLoadedItems.errors).length===0),isItemLoading:tt((e,t)=>e.lazyLoadedItems?.loading[t??Mr]??!1),itemHasError:tt((e,t)=>!!e.lazyLoadedItems?.errors[t??Mr]),itemError:tt((e,t)=>e.lazyLoadedItems?.errors[t??Mr])},eT=e=>Array.isArray(e)?e.length>0&&e.some(eT):!!e,S9=({itemId:e,children:t})=>{const{store:n,publicAPI:a}=ol(),o=Gt(n,en.isItemExpandable,e),l=Gt(n,jC.isItemLoading,e),u=Gt(n,jC.itemHasError,e),c=eT(t)||o,f=Gt(n,en.isItemExpanded,e),p=Gt(n,Oi.isItemFocused,e),g=Gt(n,ft.isItemSelected,e),m=Gt(n,xe.isItemDisabled,e),y=Gt(n,zo.isItemBeingEdited,e),S=Gt(n,zo.isItemEditable,e),E={expandable:c,expanded:f,focused:p,selected:g,disabled:m,editing:y,editable:S,loading:l,error:u},v=I=>{if(E.disabled)return;E.focused||n.focus.focusItem(I,e);const D=ft.isMultiSelectEnabled(n.state)&&(I.shiftKey||I.ctrlKey||I.metaKey);E.expandable&&!(D&&en.isItemExpanded(n.state,e))&&n.expansion.setItemExpansion({event:I,itemId:e})},T=I=>{if(!ft.canItemBeSelected(n.state,e))return;!E.focused&&!E.editing&&n.focus.focusItem(I,e),ft.isMultiSelectEnabled(n.state)&&(I.shiftKey||I.ctrlKey||I.metaKey)?I.shiftKey?n.selection.expandSelectionRange(I,e):n.selection.setItemSelection({event:I,itemId:e,keepExistingSelection:!0}):n.selection.setItemSelection({event:I,itemId:e,shouldBeSelected:!0})},w=I=>{const D=I.nativeEvent.shiftKey,j=ft.isMultiSelectEnabled(n.state);j&&D?n.selection.expandSelectionRange(I,e):n.selection.setItemSelection({event:I,itemId:e,keepExistingSelection:j,shouldBeSelected:I.target.checked})},C=()=>{n.labelEditing&&(y?n.labelEditing.setEditedItem(null):n.labelEditing.setEditedItem(e))};return{interactions:{handleExpansion:v,handleSelection:T,handleCheckboxSelection:w,toggleItemEditing:C,handleSaveItemLabel:(I,D)=>{n.labelEditing&&zo.isItemBeingEdited(n.state,e)&&(n.labelEditing.updateItemLabel(e,D),C(),n.focus.focusItem(I,e))},handleCancelItemLabelEditing:I=>{n.labelEditing&&zo.isItemBeingEdited(n.state,e)&&(C(),n.focus.focusItem(I,e))}},status:E,publicAPI:a}},E9=({props:e,rootRef:t,contentRef:n})=>{const{store:a}=ol(),{children:o,disabled:l=!1,disableSelection:u=!1,label:c,itemId:f,id:p}=e,g=A.useContext(J0);if(g==null)throw new Error(["MUI X: Could not find the Tree View Children Item context.","It looks like you rendered your component outside of a SimpleTreeView parent component.","This can also happen if you are bundling multiple versions of the Tree View."].join(`
|
|
190
190
|
`));const{registerChild:m,unregisterChild:y,parentId:S}=g,E=eT(o),v=A.useRef(null),T=ud(v,n),w=Gt(a,ru.treeItemIdAttribute,f,p);return Zm(()=>(m(w,f),()=>{y(w),y(w)}),[a,m,y,w,f]),Zm(()=>a.jsxItems.insertJSXItem({id:f,idAttribute:p,parentId:S,expandable:E,disabled:l,selectable:!u}),[a,S,f,E,l,u,p]),A.useEffect(()=>{if(c)return a.jsxItems.mapLabelFromJSX(f,(v.current?.textContent??"").toLowerCase())},[a,f,c]),{contentRef:T,rootRef:t}},v9=({children:e,itemId:t,idAttribute:n})=>{const a=A.useContext(fd);return B.jsx(eN,{itemId:t,idAttribute:n,children:B.jsx(fd.Provider,{value:a+1,children:e})})};class T9{constructor(t){this.store=t,t.itemPluginManager.register(E9,v9)}insertJSXItem=t=>{if(this.store.state.itemMetaLookup[t.id]!=null)throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.","Alternatively, you can use the `getItemId` prop to specify a custom id for each item.",`Two items were provided with the same id in the \`items\` prop: "${t.id}"`].join(`
|
|
191
|
-
`));return this.store.update({itemMetaLookup:Se({},this.store.state.itemMetaLookup,{[t.id]:t}),itemModelLookup:Se({},this.store.state.itemModelLookup,{[t.id]:{id:t.id,label:t.label??""}})}),()=>{const n=Se({},this.store.state.itemMetaLookup),a=Se({},this.store.state.itemModelLookup);delete n[t.id],delete a[t.id],this.store.update({itemMetaLookup:n,itemModelLookup:a})}};mapLabelFromJSX=(t,n)=>(this.store.keyboardNavigation.updateLabelMap(a=>(a[t]=n,a)),()=>{this.store.keyboardNavigation.updateLabelMap(a=>{const o=Se({},a);return delete o[t],o})});setJSXItemsOrderedChildrenIds=(t,n)=>{const a=t??Mr;this.store.update({itemOrderedChildrenIdsLookup:Se({},this.store.state.itemOrderedChildrenIdsLookup,{[a]:n}),itemChildrenIndexesLookup:Se({},this.store.state.itemChildrenIndexesLookup,{[a]:W0(n)})})}}const w9={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0};class x9 extends b9{jsxItems=new T9(this);constructor(t){super(Se({},t,{items:Ym}),"SimpleTreeView",w9)}updateStateFromParameters(t){super.updateStateFromParameters(Se({},t,{items:Ym}))}}const A9=P0(),k9=e=>{const{classes:t}=e;return A.useMemo(()=>$e({root:["root"],item:["item"],itemContent:["itemContent"],itemGroupTransition:["itemGroupTransition"],itemIconContainer:["itemIconContainer"],itemLabel:["itemLabel"],itemCheckbox:["itemCheckbox"]},fV,t),[t])},R9=me("ul",{name:"MuiSimpleTreeView",slot:"Root"})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),C9=A.forwardRef(function(t,n){const a=A9({props:t,name:"MuiSimpleTreeView"}),{slots:o,slotProps:l,apiRef:u,parameters:c,forwardedProps:f}=yV(a),p=i9(x9,c),g=A.useRef(null),m=ud(n,g),y=e9(p,f,m),S=k9(a),E=o?.root??R9,v=gn({elementType:E,externalSlotProps:l?.root,className:S.root,getSlotProps:y,ownerState:a});return B.jsx(hV,{store:p,classes:S,slots:o,slotProps:l,apiRef:u,rootRef:g,children:B.jsx(eN,{itemId:null,idAttribute:null,children:B.jsx(fd.Provider,{value:0,children:B.jsx(E,Se({},v))})})})}),I9=(e,t,n)=>typeof n=="function"?n(e,t):n,_9=e=>{const{runItemPlugins:t,publicAPI:n,store:a}=ol(),o=A.useContext(fd),l=Gt(a,I9,e.itemId,o),{id:u,itemId:c,label:f,children:p,rootRef:g}=e,{rootRef:m,contentRef:y,propsEnhancers:S}=t(e),{interactions:E,status:v}=S9({itemId:c,children:p}),T=A.useRef(null),w=A.useRef(null),C=ud(g,m,T),k=ud(y,w),_=A.useRef(null),N=Gt(a,ft.isCheckboxSelectionEnabled),I=Gt(a,ru.treeItemIdAttribute,c,u),D=Gt(a,Oi.isItemTheDefaultFocusableItem,c),j={rootRefObject:T,contentRefObject:w,interactions:E},$=se=>ie=>{se.onFocus?.(ie),!ie.defaultMuiPrevented&&!v.focused&&xe.canItemBeFocused(a.state,c)&&ie.currentTarget===ie.target&&a.focus.focusItem(ie,c)},L=se=>ie=>{if(se.onBlur?.(ie),ie.defaultMuiPrevented)return;const be=a.items.getItemDOMElement(c);v.editing||ie.relatedTarget&&Xm(ie.relatedTarget,be)&&(ie.target&&ie.target?.dataset?.element==="labelInput"&&Xm(ie.target,be)||ie.relatedTarget?.dataset?.element==="labelInput")||a.focus.removeFocusedItem()},W=se=>ie=>{se.onKeyDown?.(ie),!(ie.defaultMuiPrevented||ie.target?.dataset?.element==="labelInput")&&a.keyboardNavigation.handleItemKeyDown(ie,c)},R=se=>ie=>{se.onDoubleClick?.(ie),!ie.defaultMuiPrevented&&E.toggleItemEditing()},V=se=>ie=>{se.onClick?.(ie),a.items.handleItemClick(ie,c),!(ie.defaultMuiPrevented||_.current?.contains(ie.target))&&(en.triggerSlot(a.state)==="content"&&E.handleExpansion(ie),N||E.handleSelection(ie))},H=se=>ie=>{se.onMouseDown?.(ie),!ie.defaultMuiPrevented&&(ie.shiftKey||ie.ctrlKey||ie.metaKey||v.disabled)&&ie.preventDefault()},G=se=>ie=>{se.onClick?.(ie),!ie.defaultMuiPrevented&&en.triggerSlot(a.state)==="iconContainer"&&E.handleExpansion(ie)};return{getContextProviderProps:()=>({itemId:c,id:u}),getRootProps:(se={})=>{const ie=Se({},nr(e),nr(se)),be=Se({},ie,{ref:C,role:"treeitem",tabIndex:D?0:-1,id:I,"aria-expanded":v.expandable?v.expanded:void 0,"aria-disabled":v.disabled||void 0},se,{style:Se({},se.style??{},{"--TreeView-itemDepth":l}),onFocus:$(ie),onBlur:L(ie),onKeyDown:W(ie)}),ye=S.root?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},be,ye)},getContentProps:(se={})=>{const ie=nr(se),be=Se({},ie,se,{ref:k,onClick:V(ie),onMouseDown:H(ie),status:v});["expanded","selected","focused","disabled","editing","editable"].forEach(Oe=>{v[Oe]&&(be[`data-${Oe}`]="")});const ye=S.content?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},be,ye)},getGroupTransitionProps:(se={})=>{const ie=nr(se);return Se({},ie,{unmountOnExit:!0,component:"ul",role:"group",in:v.expanded,children:p},se)},getIconContainerProps:(se={})=>{const ie=nr(se);return Se({},ie,se,{onClick:G(ie)})},getCheckboxProps:(se={})=>{const ie=nr(se),be=Se({},ie,{ref:_,"aria-hidden":!0},se),ye=S.checkbox?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},be,ye)},getLabelProps:(se={})=>{const ie=Se({},nr(se)),be=Se({},ie,{children:f},se,{onDoubleClick:R(ie)}),ye=S.label?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},ye,be)},getLabelInputProps:(se={})=>{const ie=nr(se),be=S.labelInput?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},se,be)},getDragAndDropOverlayProps:(se={})=>{const ie=nr(se),be=S.dragAndDropOverlay?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},se,be)},getErrorContainerProps:(se={})=>{const ie=nr(se);return Se({},ie,se)},getLoadingContainerProps:(se={})=>{const ie=nr(se);return Se({size:"12px",thickness:6},ie,se)},rootRef:C,status:v,publicAPI:n}};function N9(e){return Pe("MuiTreeItem",e)}Fe("MuiTreeItem",["root","content","groupTransition","iconContainer","label","checkbox","labelInput","dragAndDropOverlay","errorIcon","loadingIcon","expanded","selected","focused","disabled","editable","editing"]);const O9=jt(B.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),L9=jt(B.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),D9=["ownerState"];function om(e,t,n){return e!==void 0?e:t!==void 0?t:n}function M9(e){const{slots:t,slotProps:n,status:a}=e,{slots:o,slotProps:l}=H0(),u={collapseIcon:om(t?.collapseIcon,o.collapseIcon,L9),expandIcon:om(t?.expandIcon,o.expandIcon,O9),endIcon:om(t?.endIcon,o.endIcon),icon:t?.icon};let c;u?.icon?c="icon":a.expandable?a.expanded?c="collapseIcon":c="expandIcon":c="endIcon";const f=u[c],p=gn({elementType:f,externalSlotProps:m=>Se({},Jc(l[c],m),Jc(n?.[c],m)),ownerState:{}}),g=Bi(p,D9);return f?B.jsx(f,Se({},g)):null}const B9=me("div",{name:"MuiTreeItemDragAndDropOverlay",slot:"Root",shouldForwardProp:e=>jo(e)&&e!=="action"})(({theme:e})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:e.shape.borderRadius,backgroundColor:e.vars?`rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})`:Yr(e.palette.primary.dark,e.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function F9(e){return e.action==null?null:B.jsx(B9,Se({},e))}function U9(e){const{children:t,itemId:n,id:a}=e,{wrapItem:o,store:l}=ol(),u=Gt(l,ru.treeItemIdAttribute,n,a);return B.jsx(A.Fragment,{children:o({children:t,itemId:n,store:l,idAttribute:u})})}const z9=me("input",{name:"MuiTreeItem",slot:"LabelInput"})(({theme:e})=>Se({},e.typography.body1,{width:"100%",backgroundColor:(e.vars||e).palette.background.paper,borderRadius:e.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${(e.vars||e).palette.primary.main}`}})),P9=["visible"],$9=["id","itemId","label","disabled","disableSelection","children","slots","slotProps","classes"],j9=P0(),H9=me("li",{name:"MuiTreeItem",slot:"Root"})({listStyle:"none",margin:0,padding:0,outline:0}),G9=me("div",{name:"MuiTreeItem",slot:"Content",shouldForwardProp:e=>jo(e)&&e!=="status"})(({theme:e})=>({padding:e.spacing(.5,1),paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`,borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},"&[data-disabled]":{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent",cursor:"auto"},"&[data-focused]":{backgroundColor:(e.vars||e).palette.action.focus},"&[data-selected]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Yr(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Yr(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Yr(e.palette.primary.main,e.palette.action.selectedOpacity)}}},"&[data-selected][data-focused]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Yr(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}})),V9=me("div",{name:"MuiTreeItem",slot:"Label",shouldForwardProp:e=>jo(e)&&e!=="editable"})(({theme:e})=>Se({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),q9=me("div",{name:"MuiTreeItem",slot:"IconContainer"})({width:16,display:"flex",flexShrink:0,justifyContent:"center",position:"relative",cursor:"inherit","& svg":{fontSize:18}}),W9=me(vm,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),Y9=me("div",{name:"MuiTreeItem",slot:"ErrorIcon"})({position:"absolute",right:-3,width:7,height:7,borderRadius:"50%",backgroundColor:"red"}),K9=me(As,{name:"MuiTreeItem",slot:"LoadingIcon"})({color:"text.primary"}),X9=me(A.forwardRef((e,t)=>{const{visible:n}=e,a=Bi(e,P9);return n?B.jsx(HB,Se({},a,{ref:t})):null}),{name:"MuiTreeItem",slot:"Checkbox"})({padding:0}),Z9=e=>{const{classes:t}=H0(),n=Se({},e,{root:Ee(e?.root,t.root),content:Ee(e?.content,t.itemContent),iconContainer:Ee(e?.iconContainer,t.itemIconContainer),checkbox:Ee(e?.checkbox,t.itemCheckbox),label:Ee(e?.label,t.itemLabel),groupTransition:Ee(e?.groupTransition,t.itemGroupTransition),labelInput:Ee(e?.labelInput,t.itemLabelInput),dragAndDropOverlay:Ee(e?.dragAndDropOverlay,t.itemDragAndDropOverlay),errorIcon:Ee(e?.errorIcon,t.itemErrorIcon),loadingIcon:Ee(e?.loadingIcon,t.itemLoadingIcon)});return $e({root:["root"],content:["content"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],groupTransition:["groupTransition"],labelInput:["labelInput"],dragAndDropOverlay:["dragAndDropOverlay"],errorIcon:["errorIcon"],loadingIcon:["loadingIcon"],expanded:["expanded"],editing:["editing"],editable:["editable"],selected:["selected"],focused:["focused"],disabled:["disabled"]},N9,n)},HC=A.forwardRef(function(t,n){const a=j9({props:t,name:"MuiTreeItem"}),{id:o,itemId:l,label:u,disabled:c,disableSelection:f,children:p,slots:g={},slotProps:m={},classes:y}=a,S=Bi(a,$9),{getContextProviderProps:E,getRootProps:v,getContentProps:T,getIconContainerProps:w,getCheckboxProps:C,getLabelProps:k,getGroupTransitionProps:_,getLabelInputProps:N,getDragAndDropOverlayProps:I,getErrorContainerProps:D,getLoadingContainerProps:j,status:$}=_9({id:o,itemId:l,children:p,label:u,disabled:c,disableSelection:f}),L=Z9(y),W=g.root??H9,R=gn({elementType:W,getSlotProps:v,externalForwardedProps:S,externalSlotProps:m.root,additionalProps:{ref:n},ownerState:{},className:L.root}),V=g.content??G9,H=gn({elementType:V,getSlotProps:T,externalSlotProps:m.content,ownerState:{},className:Ee(L.content,$.expanded&&L.expanded,$.selected&&L.selected,$.focused&&L.focused,$.disabled&&L.disabled,$.editing&&L.editing,$.editable&&L.editable)}),G=g.iconContainer??q9,z=gn({elementType:G,getSlotProps:w,externalSlotProps:m.iconContainer,ownerState:{},className:L.iconContainer}),K=g.label??V9,Q=gn({elementType:K,getSlotProps:k,externalSlotProps:m.label,ownerState:{},className:L.label}),J=g.checkbox??X9,F=gn({elementType:J,getSlotProps:C,externalSlotProps:m.checkbox,ownerState:{},className:L.checkbox}),P=g.groupTransition??void 0,X=gn({elementType:P,getSlotProps:_,externalSlotProps:m.groupTransition,ownerState:{},className:L.groupTransition}),M=g.labelInput??z9,pe=gn({elementType:M,getSlotProps:N,externalSlotProps:m.labelInput,ownerState:{},className:L.labelInput}),ge=g.dragAndDropOverlay??F9,fe=gn({elementType:ge,getSlotProps:I,externalSlotProps:m.dragAndDropOverlay,ownerState:{},className:L.dragAndDropOverlay}),se=g.errorIcon??Y9,ie=gn({elementType:se,getSlotProps:D,externalSlotProps:m.errorIcon,ownerState:{},className:L.errorIcon}),be=g.loadingIcon??K9,ye=gn({elementType:be,getSlotProps:j,externalSlotProps:m.loadingIcon,ownerState:{},className:L.loadingIcon});return B.jsx(U9,Se({},E(),{children:B.jsxs(W,Se({},R,{children:[B.jsxs(V,Se({},H,{children:[B.jsxs(G,Se({},z,{children:[$.error&&B.jsx(se,Se({},ie)),$.loading?B.jsx(be,Se({},ye)):B.jsx(M9,{status:$,slots:g,slotProps:m})]})),B.jsx(J,Se({},F)),$.editing?B.jsx(M,Se({},pe)):B.jsx(K,Se({},Q)),B.jsx(ge,Se({},fe))]})),p&&B.jsx(W9,Se({as:P},X))]}))}))});function Q9({currentPath:e}){const t=Nh(),[n,a]=A.useState([]),[o,l]=A.useState([]),[u,c]=A.useState(!1),f=A.useCallback(async()=>{c(!0);try{const C=(await(await fetch("/api/list?path=/&maxDepth=2")).json()).data||[],k=new Map,_=[],N=[];for(const I of C){const D=sd(I),j={id:D.path,name:D.name,path:D.path,hasChildren:D.hasChildren,children:[],loaded:!1,metadata:D.metadata};k.set(D.path,j)}for(const I of C){const D=k.get(I.path),j=I.path.split("/").filter(Boolean);if(j.length===1)_.push(D),N.push(I.path);else if(j.length===2){const $=`/${j[0]}`,L=k.get($);L&&L.children.push(D)}}for(const I of N){const D=k.get(I);D&&(D.loaded=!0,D.hasChildren&&(D.hasChildren=D.children.length>0),D.children&&D.children.sort((j,$)=>{const L=C.find(H=>H.path===j.path),W=C.find(H=>H.path===$.path),R=L?.metadata?.type==="directory",V=W?.metadata?.type==="directory";return R&&!V?-1:!R&&V?1:j.name.localeCompare($.name)}))}_.sort((I,D)=>{const j=C.find(R=>R.path===I.path),$=C.find(R=>R.path===D.path),L=j?.metadata?.type==="directory",W=$?.metadata?.type==="directory";return L&&!W?-1:!L&&W?1:I.name.localeCompare(D.name)}),a(_),l(N)}catch(T){console.error("Failed to load root:",T)}finally{c(!1)}},[]),p=A.useCallback(async T=>{try{const N=((await(await fetch(`/api/list?path=${encodeURIComponent(T)}&maxDepth=1`)).json()).data||[]).filter(D=>D.path!==T).map(sd),I=N.map(D=>({id:D.path,name:D.name,path:D.path,hasChildren:D.hasChildren,children:[],loaded:!1,metadata:D.metadata}));return I.sort((D,j)=>{const $=N.find(V=>V.path===D.path),L=N.find(V=>V.path===j.path),W=$?.metadata?.type==="directory",R=L?.metadata?.type==="directory";return W&&!R?-1:!W&&R?1:D.name.localeCompare(j.name)}),I}catch(w){return console.error(`Failed to load children for ${T}:`,w),[]}},[]),g=A.useCallback((T,w,C)=>T.map(k=>k.id===w?{...k,children:C,loaded:!0,loading:!1,hasChildren:k.hasChildren?C.length>0:!1}:k.children&&k.children.length>0?{...k,children:g(k.children,w,C)}:k),[]),m=A.useCallback((T,w,C)=>T.map(k=>k.id===w?{...k,loading:C}:k.children&&k.children.length>0?{...k,children:m(k.children,w,C)}:k),[]),y=A.useCallback((T,w)=>{for(const C of T){if(C.id===w)return C;if(C.children){const k=y(C.children,w);if(k)return k}}return null},[]),S=A.useCallback((T,w)=>{const C=w.filter(k=>{const _=k.split("/").filter(Boolean);if(_.length<=1)return!0;for(let N=1;N<_.length;N++){const I=`/${_.slice(0,N).join("/")}`;if(!w.includes(I))return!1}return!0});l(k=>{const _=C.filter(N=>!k.includes(N));return _.length>0&&a(N=>{for(const I of _){const D=y(N,I);if(D&&!D.loaded&&!D.loading){const j=m(N,I,!0);return p(D.path).then($=>{a(L=>g(L,I,$))}),j}}return N}),C})},[y,p,m,g]),E=A.useCallback((T,w)=>{t(w)},[t]),v=T=>T.map(w=>B.jsx(HC,{itemId:w.id,label:B.jsxs(cn,{sx:{display:"flex",alignItems:"center",gap:.5,fontSize:16},children:[w.metadata?.type==="file"?U0(w.path,w.metadata?.mimeType,"inherit"):B.jsx(S_,{fontSize:"inherit",color:"primary"}),B.jsx(Ln,{variant:"body2",sx:{py:.5,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w.name})]}),slots:{expandIcon:w.loading?()=>B.jsx(As,{size:16}):void 0},children:w.children&&w.children.length>0?v(w.children):w.hasChildren&&!w.loaded?B.jsx(HC,{itemId:`${w.id}-placeholder`,label:"",sx:{height:0,overflow:"hidden"}},`${w.id}-placeholder`):null},w.id));return A.useEffect(()=>{f()},[f]),A.useEffect(()=>{if(e&&e!=="/"){const T=e.split("/").filter(Boolean),w=[];for(let C=0;C<T.length-1;C++)w.push(`/${T.slice(0,C+1).join("/")}`);if(w.length===0)return;l(C=>w.some(N=>!C.includes(N))?[...new Set([...C,...w])]:C)}},[e]),A.useEffect(()=>{l(T=>{const w=T.filter(C=>{const k=y(n,C);return!k||!k.loaded||k.hasChildren});return w.length!==T.length?w:T})},[n,y]),u&&n.length===0?B.jsx(cn,{sx:{display:"flex",justifyContent:"center",p:4},children:B.jsx(As,{size:24})}):B.jsx(C9,{expandedItems:o,selectedItems:e,onExpandedItemsChange:(T,w)=>{T&&S(T,w)},onSelectedItemsChange:(T,w)=>{T&&w&&E(T,w)},sx:{flexGrow:1,overflowY:"auto"},slots:{collapseIcon:uV,expandIcon:sV},children:v(n)})}const J9=jt(B.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function eq({file:e,onClose:t}){const n=()=>{if(!e.content)return B.jsx(Ln,{color:"text.secondary",align:"center",children:"No content available"});const a=e.name.endsWith(".json")||e.mimeType==="application/json"||typeof e.content=="object"&&e.content!==null,o=e.name.endsWith(".yaml")||e.name.endsWith(".yml");if(a){const l=typeof e.content=="string"?JSON.parse(e.content):e.content;return B.jsx(cn,{component:"pre",sx:{p:2,overflow:"auto",bgcolor:"grey.100",borderRadius:1,fontSize:"0.875rem",fontFamily:"monospace"},children:JSON.stringify(l,null,2)})}return o||typeof e.content=="string"?B.jsx(cn,{component:"pre",sx:{p:2,overflow:"auto",bgcolor:"grey.100",borderRadius:1,fontSize:"0.875rem",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:String(e.content)}):B.jsx(cn,{component:"pre",sx:{p:2,overflow:"auto",bgcolor:"grey.100",borderRadius:1,fontSize:"0.875rem",fontFamily:"monospace"},children:JSON.stringify(e.content,null,2)})};return B.jsxs(vF,{fullScreen:!0,open:!0,onClose:t,children:[B.jsx(zI,{sx:{position:"relative"},children:B.jsxs(Nm,{children:[B.jsx(Ln,{sx:{ml:2,flex:1},variant:"h6",component:"div",children:e.name}),B.jsx(Am,{edge:"end",color:"inherit",onClick:t,"aria-label":"close",children:B.jsx(J9,{})})]})}),B.jsxs(cn,{sx:{p:3},children:[B.jsxs(oi,{sx:{mb:2,p:2},children:[B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:[B.jsx("strong",{children:"Path:"})," ",e.path]}),B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:[B.jsx("strong",{children:"Type:"})," ",e.mimeType||e.type]}),e.size!==void 0&&B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:[B.jsx("strong",{children:"Size:"})," ",z0(e.size)]}),e.createdAt&&B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:[B.jsx("strong",{children:"Created:"})," ",new Date(e.createdAt).toLocaleString()]})]}),n()]})]})}const lm=280;function tq(e,t){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",java:"java",c:"c",cpp:"cpp",cs:"csharp",go:"go",rs:"rust",php:"php",html:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",sql:"sql",sh:"bash",bash:"bash",md:"markdown",txt:"text"}[n||""]||"text"}function nq(e,t){return e.endsWith(".md")||e.endsWith(".markdown")||t==="text/markdown"}function rq(e,t,n){return!!(e.endsWith(".json")||t==="application/json"||n&&typeof n=="object"&&!Array.isArray(n))}function aq(){const e=Qr(),t=aP(e.breakpoints.down("md")),n=Nh(),a=$P(),o=a["*"]?`/${a["*"]}`:"/",[l,u]=A.useState([]),[c,f]=A.useState(!1),[p,g]=A.useState(null),[m,y]=A.useState(null),[S,E]=A.useState(""),[v,T]=A.useState(!t),[w,C]=A.useState("preview"),k=A.useCallback(async $=>{f(!0);try{const[L,W]=await Promise.all([fetch(`/api/list?path=${encodeURIComponent($)}&maxDepth=1`),fetch(`/api/read?path=${encodeURIComponent($)}`)]),R=await L.json(),V=await W.json(),z=(R.data||[]).filter(K=>K.path!==$).map(sd).sort((K,Q)=>{const J=K.metadata?.type==="directory",F=Q.metadata?.type==="directory";return J&&!F?-1:!J&&F?1:K.name.localeCompare(Q.name)});u(z),g(V.data||null)}catch(L){console.error("Failed to load directory:",L)}finally{f(!1)}},[]),_=A.useCallback(async()=>{if(!S.trim()){k(o);return}f(!0);try{const R=((await(await fetch(`/api/search?path=${encodeURIComponent(o)}&query=${encodeURIComponent(S)}`)).json()).data||[]).map(sd).sort((V,H)=>{const G=V.metadata?.type==="directory",z=H.metadata?.type==="directory";return G&&!z?-1:!G&&z?1:V.name.localeCompare(H.name)});u(R),g(null)}catch($){console.error("Failed to search:",$)}finally{f(!1)}},[o,S,k]);A.useEffect(()=>{k(o)},[o,k]);const N=$=>{n($),y(null),E("")},I=async $=>{N($.path)},D=o.split("/").filter(Boolean),j=B.jsxs(cn,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:[B.jsx(Nm,{children:B.jsx(Ln,{variant:"h6",noWrap:!0,children:"File Tree"})}),B.jsx(Cm,{}),B.jsx(cn,{sx:{flexGrow:1,overflow:"auto",p:2},children:B.jsx(Q9,{currentPath:o})})]});return B.jsxs(cn,{sx:{display:"flex",flexDirection:"column",height:"100vh"},children:[B.jsx(zI,{position:"static",sx:{zIndex:e.zIndex.drawer+1},children:B.jsxs(Nm,{children:[B.jsx(Am,{color:"inherit",edge:"start",onClick:()=>T(!v),sx:{mr:2,display:{md:"none"}},children:B.jsx(B$,{})}),B.jsx(Ln,{variant:"h6",component:"div",sx:{flexGrow:1},children:"AFS Explorer"})]})}),B.jsxs(cn,{sx:{display:"flex",flexGrow:1,overflow:"hidden"},children:[B.jsx(BF,{variant:t?"temporary":"permanent",open:v,onClose:()=>T(!1),sx:{width:lm,flexShrink:0,"& .MuiDrawer-paper":{width:lm,boxSizing:"border-box"}},children:j}),B.jsxs(cn,{component:"main",sx:{flexGrow:1,p:3,overflow:"auto",width:{sm:`calc(100% - ${lm}px)`}},children:[B.jsxs(CB,{sx:{mb:2},children:[B.jsx(nR,{component:"button",variant:"body1",onClick:()=>N("/"),sx:{cursor:"pointer"},children:"Root"}),D.map(($,L)=>{const W=`/${D.slice(0,L+1).join("/")}`,R=L===D.length-1,V=$.replace(/~/g,"/");return R?B.jsx(Ln,{color:"text.primary",children:V},W):B.jsx(nR,{component:"button",variant:"body1",onClick:()=>N(W),sx:{cursor:"pointer"},children:V},W)})]}),B.jsx(rP,{fullWidth:!0,variant:"outlined",placeholder:"Search files and folders...",value:S,onChange:$=>E($.target.value),onKeyPress:$=>{$.key==="Enter"&&_()},sx:{mb:3},slotProps:{input:{endAdornment:B.jsx(lU,{position:"end",children:B.jsx(Am,{onClick:_,edge:"end",children:B.jsx(F$,{})})})}}}),p?.content&&B.jsxs(oi,{sx:{mb:3},children:[B.jsxs(cn,{sx:{px:3,pt:2,pb:1},children:[B.jsx(Ln,{variant:"h6",gutterBottom:!0,children:"Content"}),p.metadata?.mimeType&&B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:["Type: ",p.metadata?.mimeType]})]}),B.jsxs(Qz,{value:w,onChange:($,L)=>C(L),sx:{borderBottom:1,borderColor:"divider",px:3},children:[B.jsx(cR,{label:"Preview",value:"preview"}),B.jsx(cR,{label:"Raw",value:"raw"})]}),B.jsx(cn,{sx:{p:3},children:w==="preview"?B.jsx(cn,{sx:{maxHeight:"500px",overflow:"auto"},children:(()=>{const $=typeof p.content=="string"?p.content:JSON.stringify(p.content,null,2),L=p.metadata?.mimeType,W=p.metadata?.contentType;if(F0(o,L)){let V=$;return W==="base64"?V=`data:${L||"image/png"};base64,${$}`:L==="image/svg+xml"&&(V=`data:image/svg+xml,${encodeURIComponent($)}`),B.jsx(cn,{sx:{display:"flex",justifyContent:"center",alignItems:"center",p:2},children:B.jsx("img",{src:V,alt:o,style:{maxWidth:"100%",maxHeight:"500px",objectFit:"contain"}})})}if(nq(o,L))return B.jsx(cn,{sx:{"& h1":{fontSize:"2em",fontWeight:"bold",mb:2},"& h2":{fontSize:"1.5em",fontWeight:"bold",mb:1.5},"& h3":{fontSize:"1.25em",fontWeight:"bold",mb:1},"& p":{mb:2},"& ul, & ol":{mb:2,pl:3},"& li":{mb:.5},"& code":{bgcolor:"#f5f5f5",px:.5,py:.25,borderRadius:.5,fontSize:"0.875em",color:"#d73a49",fontFamily:"Consolas, Monaco, 'Courier New', monospace"},"& pre":{mb:2},"& blockquote":{borderLeft:"4px solid",borderColor:"grey.300",pl:2,py:1,mb:2,color:"text.secondary"},"& a":{color:"primary.main",textDecoration:"none"},"& table":{borderCollapse:"collapse",mb:2,width:"100%"},"& th, & td":{border:"1px solid",borderColor:"grey.300",px:1,py:.5},"& th":{bgcolor:"grey.100",fontWeight:"bold"}},children:B.jsx(qH,{remarkPlugins:[eV],components:{code({className:V,children:H,...G}){const z=/language-(\w+)/.exec(V||""),K=!z,{ref:Q,...J}=G;return!K&&z?B.jsx(Hc,{style:Kg,language:z[1],PreTag:"div",customStyle:{backgroundColor:"#fafafa",border:"1px solid #e0e0e0",borderRadius:"4px"},children:String(H).replace(/\n$/,"")}):B.jsx("code",{className:V,...J,children:H})}},children:$})});if(rq(o,p.metadata?.mimeType,p.content))return B.jsx(Hc,{language:"json",style:Kg,customStyle:{margin:0,borderRadius:"4px",backgroundColor:"#fafafa",border:"1px solid #e0e0e0"},showLineNumbers:!0,children:$});const R=tq(o,p.metadata?.mimeType);return B.jsx(Hc,{language:R,style:Kg,customStyle:{margin:0,borderRadius:"4px",backgroundColor:"#fafafa",border:"1px solid #e0e0e0"},showLineNumbers:!0,children:$})})()}):B.jsx(cn,{sx:{p:2,bgcolor:"grey.50",borderRadius:1,maxHeight:"500px",overflow:"auto"},children:B.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:typeof p.content=="string"?p.content:JSON.stringify(p.content,null,2)})})})]}),c?B.jsx(cn,{sx:{display:"flex",justifyContent:"center",p:4},children:B.jsx(As,{})}):l.length>0?B.jsx(Tz,{component:oi,children:B.jsxs(uz,{children:[B.jsx(Rz,{children:B.jsxs(hR,{children:[B.jsx(Oo,{children:"Name"}),B.jsx(Oo,{children:"Size"}),B.jsx(Oo,{children:"Modified"})]})}),B.jsx(gz,{children:l.map($=>B.jsxs(hR,{hover:!0,onClick:()=>I($),sx:{cursor:"pointer"},children:[B.jsx(Oo,{children:B.jsxs(cn,{sx:{display:"flex",alignItems:"center",gap:1},children:[$.metadata?.type==="file"?U0($.path,$.metadata?.mimeType):B.jsx(S_,{fontSize:"small",color:"primary"}),$.name]})}),B.jsx(Oo,{children:z0($.size)}),B.jsx(Oo,{children:lV($.createdAt)})]},$.path))})]})}):null]})]}),m&&B.jsx(eq,{file:m,onClose:()=>y(null)})]})}const iq=Id({palette:{mode:"light",primary:{main:"#1976d2"}}});function oq(){return B.jsx(k$,{children:B.jsxs(WM,{theme:iq,children:[B.jsx(YB,{}),B.jsx(n$,{children:B.jsx(f_,{path:"/*",element:B.jsx(aq,{})})})]})})}const nN=document.getElementById("root");if(!nN)throw new Error("Root element not found");w1.createRoot(nN).render(B.jsx(A.StrictMode,{children:B.jsx(oq,{})}));
|
|
191
|
+
`));return this.store.update({itemMetaLookup:Se({},this.store.state.itemMetaLookup,{[t.id]:t}),itemModelLookup:Se({},this.store.state.itemModelLookup,{[t.id]:{id:t.id,label:t.label??""}})}),()=>{const n=Se({},this.store.state.itemMetaLookup),a=Se({},this.store.state.itemModelLookup);delete n[t.id],delete a[t.id],this.store.update({itemMetaLookup:n,itemModelLookup:a})}};mapLabelFromJSX=(t,n)=>(this.store.keyboardNavigation.updateLabelMap(a=>(a[t]=n,a)),()=>{this.store.keyboardNavigation.updateLabelMap(a=>{const o=Se({},a);return delete o[t],o})});setJSXItemsOrderedChildrenIds=(t,n)=>{const a=t??Mr;this.store.update({itemOrderedChildrenIdsLookup:Se({},this.store.state.itemOrderedChildrenIdsLookup,{[a]:n}),itemChildrenIndexesLookup:Se({},this.store.state.itemChildrenIndexesLookup,{[a]:W0(n)})})}}const w9={getInitialState:e=>e,updateStateFromParameters:e=>e,shouldIgnoreItemsStateUpdate:()=>!0};class x9 extends b9{jsxItems=new T9(this);constructor(t){super(Se({},t,{items:Ym}),"SimpleTreeView",w9)}updateStateFromParameters(t){super.updateStateFromParameters(Se({},t,{items:Ym}))}}const A9=P0(),k9=e=>{const{classes:t}=e;return A.useMemo(()=>$e({root:["root"],item:["item"],itemContent:["itemContent"],itemGroupTransition:["itemGroupTransition"],itemIconContainer:["itemIconContainer"],itemLabel:["itemLabel"],itemCheckbox:["itemCheckbox"]},fV,t),[t])},R9=me("ul",{name:"MuiSimpleTreeView",slot:"Root"})({padding:0,margin:0,listStyle:"none",outline:0,position:"relative"}),C9=A.forwardRef(function(t,n){const a=A9({props:t,name:"MuiSimpleTreeView"}),{slots:o,slotProps:l,apiRef:u,parameters:c,forwardedProps:f}=yV(a),p=i9(x9,c),g=A.useRef(null),m=ud(n,g),y=e9(p,f,m),S=k9(a),E=o?.root??R9,v=gn({elementType:E,externalSlotProps:l?.root,className:S.root,getSlotProps:y,ownerState:a});return B.jsx(hV,{store:p,classes:S,slots:o,slotProps:l,apiRef:u,rootRef:g,children:B.jsx(eN,{itemId:null,idAttribute:null,children:B.jsx(fd.Provider,{value:0,children:B.jsx(E,Se({},v))})})})}),I9=(e,t,n)=>typeof n=="function"?n(e,t):n,_9=e=>{const{runItemPlugins:t,publicAPI:n,store:a}=ol(),o=A.useContext(fd),l=Gt(a,I9,e.itemId,o),{id:u,itemId:c,label:f,children:p,rootRef:g}=e,{rootRef:m,contentRef:y,propsEnhancers:S}=t(e),{interactions:E,status:v}=S9({itemId:c,children:p}),T=A.useRef(null),w=A.useRef(null),C=ud(g,m,T),k=ud(y,w),_=A.useRef(null),N=Gt(a,ft.isCheckboxSelectionEnabled),I=Gt(a,ru.treeItemIdAttribute,c,u),D=Gt(a,Oi.isItemTheDefaultFocusableItem,c),j={rootRefObject:T,contentRefObject:w,interactions:E},$=se=>ie=>{se.onFocus?.(ie),!ie.defaultMuiPrevented&&!v.focused&&xe.canItemBeFocused(a.state,c)&&ie.currentTarget===ie.target&&a.focus.focusItem(ie,c)},L=se=>ie=>{if(se.onBlur?.(ie),ie.defaultMuiPrevented)return;const be=a.items.getItemDOMElement(c);v.editing||ie.relatedTarget&&Xm(ie.relatedTarget,be)&&(ie.target&&ie.target?.dataset?.element==="labelInput"&&Xm(ie.target,be)||ie.relatedTarget?.dataset?.element==="labelInput")||a.focus.removeFocusedItem()},W=se=>ie=>{se.onKeyDown?.(ie),!(ie.defaultMuiPrevented||ie.target?.dataset?.element==="labelInput")&&a.keyboardNavigation.handleItemKeyDown(ie,c)},R=se=>ie=>{se.onDoubleClick?.(ie),!ie.defaultMuiPrevented&&E.toggleItemEditing()},V=se=>ie=>{se.onClick?.(ie),a.items.handleItemClick(ie,c),!(ie.defaultMuiPrevented||_.current?.contains(ie.target))&&(en.triggerSlot(a.state)==="content"&&E.handleExpansion(ie),N||E.handleSelection(ie))},H=se=>ie=>{se.onMouseDown?.(ie),!ie.defaultMuiPrevented&&(ie.shiftKey||ie.ctrlKey||ie.metaKey||v.disabled)&&ie.preventDefault()},G=se=>ie=>{se.onClick?.(ie),!ie.defaultMuiPrevented&&en.triggerSlot(a.state)==="iconContainer"&&E.handleExpansion(ie)};return{getContextProviderProps:()=>({itemId:c,id:u}),getRootProps:(se={})=>{const ie=Se({},nr(e),nr(se)),be=Se({},ie,{ref:C,role:"treeitem",tabIndex:D?0:-1,id:I,"aria-expanded":v.expandable?v.expanded:void 0,"aria-disabled":v.disabled||void 0},se,{style:Se({},se.style??{},{"--TreeView-itemDepth":l}),onFocus:$(ie),onBlur:L(ie),onKeyDown:W(ie)}),ye=S.root?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},be,ye)},getContentProps:(se={})=>{const ie=nr(se),be=Se({},ie,se,{ref:k,onClick:V(ie),onMouseDown:H(ie),status:v});["expanded","selected","focused","disabled","editing","editable"].forEach(Oe=>{v[Oe]&&(be[`data-${Oe}`]="")});const ye=S.content?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},be,ye)},getGroupTransitionProps:(se={})=>{const ie=nr(se);return Se({},ie,{unmountOnExit:!0,component:"ul",role:"group",in:v.expanded,children:p},se)},getIconContainerProps:(se={})=>{const ie=nr(se);return Se({},ie,se,{onClick:G(ie)})},getCheckboxProps:(se={})=>{const ie=nr(se),be=Se({},ie,{ref:_,"aria-hidden":!0},se),ye=S.checkbox?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},be,ye)},getLabelProps:(se={})=>{const ie=Se({},nr(se)),be=Se({},ie,{children:f},se,{onDoubleClick:R(ie)}),ye=S.label?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},ye,be)},getLabelInputProps:(se={})=>{const ie=nr(se),be=S.labelInput?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},se,be)},getDragAndDropOverlayProps:(se={})=>{const ie=nr(se),be=S.dragAndDropOverlay?.(Se({},j,{externalEventHandlers:ie}))??{};return Se({},se,be)},getErrorContainerProps:(se={})=>{const ie=nr(se);return Se({},ie,se)},getLoadingContainerProps:(se={})=>{const ie=nr(se);return Se({size:"12px",thickness:6},ie,se)},rootRef:C,status:v,publicAPI:n}};function N9(e){return Pe("MuiTreeItem",e)}Fe("MuiTreeItem",["root","content","groupTransition","iconContainer","label","checkbox","labelInput","dragAndDropOverlay","errorIcon","loadingIcon","expanded","selected","focused","disabled","editable","editing"]);const O9=jt(B.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),L9=jt(B.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"})),D9=["ownerState"];function om(e,t,n){return e!==void 0?e:t!==void 0?t:n}function M9(e){const{slots:t,slotProps:n,status:a}=e,{slots:o,slotProps:l}=H0(),u={collapseIcon:om(t?.collapseIcon,o.collapseIcon,L9),expandIcon:om(t?.expandIcon,o.expandIcon,O9),endIcon:om(t?.endIcon,o.endIcon),icon:t?.icon};let c;u?.icon?c="icon":a.expandable?a.expanded?c="collapseIcon":c="expandIcon":c="endIcon";const f=u[c],p=gn({elementType:f,externalSlotProps:m=>Se({},Jc(l[c],m),Jc(n?.[c],m)),ownerState:{}}),g=Bi(p,D9);return f?B.jsx(f,Se({},g)):null}const B9=me("div",{name:"MuiTreeItemDragAndDropOverlay",slot:"Root",shouldForwardProp:e=>jo(e)&&e!=="action"})(({theme:e})=>({position:"absolute",left:0,display:"flex",top:0,bottom:0,right:0,pointerEvents:"none",variants:[{props:{action:"make-child"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderRadius:e.shape.borderRadius,backgroundColor:e.vars?`rgba(${e.vars.palette.primary.darkChannel} / ${e.vars.palette.action.focusOpacity})`:Yr(e.palette.primary.dark,e.palette.action.focusOpacity)}},{props:{action:"reorder-above"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderTop:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"reorder-below"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}},{props:{action:"move-to-parent"},style:{marginLeft:"calc(var(--TreeView-indentMultiplier) * calc(var(--TreeView-itemDepth) - 1))",borderBottom:`1px solid ${(e.vars||e).palette.action.active}`}}]}));function F9(e){return e.action==null?null:B.jsx(B9,Se({},e))}function U9(e){const{children:t,itemId:n,id:a}=e,{wrapItem:o,store:l}=ol(),u=Gt(l,ru.treeItemIdAttribute,n,a);return B.jsx(A.Fragment,{children:o({children:t,itemId:n,store:l,idAttribute:u})})}const z9=me("input",{name:"MuiTreeItem",slot:"LabelInput"})(({theme:e})=>Se({},e.typography.body1,{width:"100%",backgroundColor:(e.vars||e).palette.background.paper,borderRadius:e.shape.borderRadius,border:"none",padding:"0 2px",boxSizing:"border-box","&:focus":{outline:`1px solid ${(e.vars||e).palette.primary.main}`}})),P9=["visible"],$9=["id","itemId","label","disabled","disableSelection","children","slots","slotProps","classes"],j9=P0(),H9=me("li",{name:"MuiTreeItem",slot:"Root"})({listStyle:"none",margin:0,padding:0,outline:0}),G9=me("div",{name:"MuiTreeItem",slot:"Content",shouldForwardProp:e=>jo(e)&&e!=="status"})(({theme:e})=>({padding:e.spacing(.5,1),paddingLeft:`calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`,borderRadius:e.shape.borderRadius,width:"100%",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",gap:e.spacing(1),cursor:"pointer",WebkitTapHighlightColor:"transparent","&:hover":{backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},"&[data-disabled]":{opacity:(e.vars||e).palette.action.disabledOpacity,backgroundColor:"transparent",cursor:"auto"},"&[data-focused]":{backgroundColor:(e.vars||e).palette.action.focus},"&[data-selected]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Yr(e.palette.primary.main,e.palette.action.selectedOpacity),"&:hover":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.hoverOpacity}))`:Yr(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / ${e.vars.palette.action.selectedOpacity})`:Yr(e.palette.primary.main,e.palette.action.selectedOpacity)}}},"&[data-selected][data-focused]":{backgroundColor:e.vars?`rgba(${e.vars.palette.primary.mainChannel} / calc(${e.vars.palette.action.selectedOpacity} + ${e.vars.palette.action.focusOpacity}))`:Yr(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}})),V9=me("div",{name:"MuiTreeItem",slot:"Label",shouldForwardProp:e=>jo(e)&&e!=="editable"})(({theme:e})=>Se({width:"100%",boxSizing:"border-box",minWidth:0,position:"relative",overflow:"hidden"},e.typography.body1,{variants:[{props:({editable:t})=>t,style:{paddingLeft:"2px"}}]})),q9=me("div",{name:"MuiTreeItem",slot:"IconContainer"})({width:16,display:"flex",flexShrink:0,justifyContent:"center",position:"relative",cursor:"inherit","& svg":{fontSize:18}}),W9=me(vm,{name:"MuiTreeItem",slot:"GroupTransition",overridesResolver:(e,t)=>t.groupTransition})({margin:0,padding:0}),Y9=me("div",{name:"MuiTreeItem",slot:"ErrorIcon"})({position:"absolute",right:-3,width:7,height:7,borderRadius:"50%",backgroundColor:"red"}),K9=me(As,{name:"MuiTreeItem",slot:"LoadingIcon"})({color:"text.primary"}),X9=me(A.forwardRef((e,t)=>{const{visible:n}=e,a=Bi(e,P9);return n?B.jsx(HB,Se({},a,{ref:t})):null}),{name:"MuiTreeItem",slot:"Checkbox"})({padding:0}),Z9=e=>{const{classes:t}=H0(),n=Se({},e,{root:Ee(e?.root,t.root),content:Ee(e?.content,t.itemContent),iconContainer:Ee(e?.iconContainer,t.itemIconContainer),checkbox:Ee(e?.checkbox,t.itemCheckbox),label:Ee(e?.label,t.itemLabel),groupTransition:Ee(e?.groupTransition,t.itemGroupTransition),labelInput:Ee(e?.labelInput,t.itemLabelInput),dragAndDropOverlay:Ee(e?.dragAndDropOverlay,t.itemDragAndDropOverlay),errorIcon:Ee(e?.errorIcon,t.itemErrorIcon),loadingIcon:Ee(e?.loadingIcon,t.itemLoadingIcon)});return $e({root:["root"],content:["content"],iconContainer:["iconContainer"],checkbox:["checkbox"],label:["label"],groupTransition:["groupTransition"],labelInput:["labelInput"],dragAndDropOverlay:["dragAndDropOverlay"],errorIcon:["errorIcon"],loadingIcon:["loadingIcon"],expanded:["expanded"],editing:["editing"],editable:["editable"],selected:["selected"],focused:["focused"],disabled:["disabled"]},N9,n)},HC=A.forwardRef(function(t,n){const a=j9({props:t,name:"MuiTreeItem"}),{id:o,itemId:l,label:u,disabled:c,disableSelection:f,children:p,slots:g={},slotProps:m={},classes:y}=a,S=Bi(a,$9),{getContextProviderProps:E,getRootProps:v,getContentProps:T,getIconContainerProps:w,getCheckboxProps:C,getLabelProps:k,getGroupTransitionProps:_,getLabelInputProps:N,getDragAndDropOverlayProps:I,getErrorContainerProps:D,getLoadingContainerProps:j,status:$}=_9({id:o,itemId:l,children:p,label:u,disabled:c,disableSelection:f}),L=Z9(y),W=g.root??H9,R=gn({elementType:W,getSlotProps:v,externalForwardedProps:S,externalSlotProps:m.root,additionalProps:{ref:n},ownerState:{},className:L.root}),V=g.content??G9,H=gn({elementType:V,getSlotProps:T,externalSlotProps:m.content,ownerState:{},className:Ee(L.content,$.expanded&&L.expanded,$.selected&&L.selected,$.focused&&L.focused,$.disabled&&L.disabled,$.editing&&L.editing,$.editable&&L.editable)}),G=g.iconContainer??q9,z=gn({elementType:G,getSlotProps:w,externalSlotProps:m.iconContainer,ownerState:{},className:L.iconContainer}),K=g.label??V9,Q=gn({elementType:K,getSlotProps:k,externalSlotProps:m.label,ownerState:{},className:L.label}),J=g.checkbox??X9,F=gn({elementType:J,getSlotProps:C,externalSlotProps:m.checkbox,ownerState:{},className:L.checkbox}),P=g.groupTransition??void 0,X=gn({elementType:P,getSlotProps:_,externalSlotProps:m.groupTransition,ownerState:{},className:L.groupTransition}),M=g.labelInput??z9,pe=gn({elementType:M,getSlotProps:N,externalSlotProps:m.labelInput,ownerState:{},className:L.labelInput}),ge=g.dragAndDropOverlay??F9,fe=gn({elementType:ge,getSlotProps:I,externalSlotProps:m.dragAndDropOverlay,ownerState:{},className:L.dragAndDropOverlay}),se=g.errorIcon??Y9,ie=gn({elementType:se,getSlotProps:D,externalSlotProps:m.errorIcon,ownerState:{},className:L.errorIcon}),be=g.loadingIcon??K9,ye=gn({elementType:be,getSlotProps:j,externalSlotProps:m.loadingIcon,ownerState:{},className:L.loadingIcon});return B.jsx(U9,Se({},E(),{children:B.jsxs(W,Se({},R,{children:[B.jsxs(V,Se({},H,{children:[B.jsxs(G,Se({},z,{children:[$.error&&B.jsx(se,Se({},ie)),$.loading?B.jsx(be,Se({},ye)):B.jsx(M9,{status:$,slots:g,slotProps:m})]})),B.jsx(J,Se({},F)),$.editing?B.jsx(M,Se({},pe)):B.jsx(K,Se({},Q)),B.jsx(ge,Se({},fe))]})),p&&B.jsx(W9,Se({as:P},X))]}))}))});function Q9({currentPath:e}){const t=Nh(),[n,a]=A.useState([]),[o,l]=A.useState([]),[u,c]=A.useState(!1),f=A.useCallback(async()=>{c(!0);try{const C=(await(await fetch("/api/list?path=/&maxDepth=2")).json()).data||[],k=new Map,_=[],N=[];for(const I of C){const D=sd(I),j={id:D.path,name:D.name,path:D.path,hasChildren:D.hasChildren,children:[],loaded:!1,meta:D.meta};k.set(D.path,j)}for(const I of C){const D=k.get(I.path),j=I.path.split("/").filter(Boolean);if(j.length===1)_.push(D),N.push(I.path);else if(j.length===2){const $=`/${j[0]}`,L=k.get($);L&&L.children.push(D)}}for(const I of N){const D=k.get(I);D&&(D.loaded=!0,D.hasChildren&&(D.hasChildren=D.children.length>0),D.children&&D.children.sort((j,$)=>{const L=C.find(H=>H.path===j.path),W=C.find(H=>H.path===$.path),R=L?.meta?.type==="directory",V=W?.meta?.type==="directory";return R&&!V?-1:!R&&V?1:j.name.localeCompare($.name)}))}_.sort((I,D)=>{const j=C.find(R=>R.path===I.path),$=C.find(R=>R.path===D.path),L=j?.meta?.type==="directory",W=$?.meta?.type==="directory";return L&&!W?-1:!L&&W?1:I.name.localeCompare(D.name)}),a(_),l(N)}catch(T){console.error("Failed to load root:",T)}finally{c(!1)}},[]),p=A.useCallback(async T=>{try{const N=((await(await fetch(`/api/list?path=${encodeURIComponent(T)}&maxDepth=1`)).json()).data||[]).filter(D=>D.path!==T).map(sd),I=N.map(D=>({id:D.path,name:D.name,path:D.path,hasChildren:D.hasChildren,children:[],loaded:!1,metadata:D.meta}));return I.sort((D,j)=>{const $=N.find(V=>V.path===D.path),L=N.find(V=>V.path===j.path),W=$?.meta?.type==="directory",R=L?.meta?.type==="directory";return W&&!R?-1:!W&&R?1:D.name.localeCompare(j.name)}),I}catch(w){return console.error(`Failed to load children for ${T}:`,w),[]}},[]),g=A.useCallback((T,w,C)=>T.map(k=>k.id===w?{...k,children:C,loaded:!0,loading:!1,hasChildren:k.hasChildren?C.length>0:!1}:k.children&&k.children.length>0?{...k,children:g(k.children,w,C)}:k),[]),m=A.useCallback((T,w,C)=>T.map(k=>k.id===w?{...k,loading:C}:k.children&&k.children.length>0?{...k,children:m(k.children,w,C)}:k),[]),y=A.useCallback((T,w)=>{for(const C of T){if(C.id===w)return C;if(C.children){const k=y(C.children,w);if(k)return k}}return null},[]),S=A.useCallback((T,w)=>{const C=w.filter(k=>{const _=k.split("/").filter(Boolean);if(_.length<=1)return!0;for(let N=1;N<_.length;N++){const I=`/${_.slice(0,N).join("/")}`;if(!w.includes(I))return!1}return!0});l(k=>{const _=C.filter(N=>!k.includes(N));return _.length>0&&a(N=>{for(const I of _){const D=y(N,I);if(D&&!D.loaded&&!D.loading){const j=m(N,I,!0);return p(D.path).then($=>{a(L=>g(L,I,$))}),j}}return N}),C})},[y,p,m,g]),E=A.useCallback((T,w)=>{t(w)},[t]),v=T=>T.map(w=>B.jsx(HC,{itemId:w.id,label:B.jsxs(cn,{sx:{display:"flex",alignItems:"center",gap:.5,fontSize:16},children:[w.meta?.type==="file"?U0(w.path,w.meta?.mimeType,"inherit"):B.jsx(S_,{fontSize:"inherit",color:"primary"}),B.jsx(Ln,{variant:"body2",sx:{py:.5,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w.name})]}),slots:{expandIcon:w.loading?()=>B.jsx(As,{size:16}):void 0},children:w.children&&w.children.length>0?v(w.children):w.hasChildren&&!w.loaded?B.jsx(HC,{itemId:`${w.id}-placeholder`,label:"",sx:{height:0,overflow:"hidden"}},`${w.id}-placeholder`):null},w.id));return A.useEffect(()=>{f()},[f]),A.useEffect(()=>{if(e&&e!=="/"){const T=e.split("/").filter(Boolean),w=[];for(let C=0;C<T.length-1;C++)w.push(`/${T.slice(0,C+1).join("/")}`);if(w.length===0)return;l(C=>w.some(N=>!C.includes(N))?[...new Set([...C,...w])]:C)}},[e]),A.useEffect(()=>{l(T=>{const w=T.filter(C=>{const k=y(n,C);return!k||!k.loaded||k.hasChildren});return w.length!==T.length?w:T})},[n,y]),u&&n.length===0?B.jsx(cn,{sx:{display:"flex",justifyContent:"center",p:4},children:B.jsx(As,{size:24})}):B.jsx(C9,{expandedItems:o,selectedItems:e,onExpandedItemsChange:(T,w)=>{T&&S(T,w)},onSelectedItemsChange:(T,w)=>{T&&w&&E(T,w)},sx:{flexGrow:1,overflowY:"auto"},slots:{collapseIcon:uV,expandIcon:sV},children:v(n)})}const J9=jt(B.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function eq({file:e,onClose:t}){const n=()=>{if(!e.content)return B.jsx(Ln,{color:"text.secondary",align:"center",children:"No content available"});const a=e.name.endsWith(".json")||e.mimeType==="application/json"||typeof e.content=="object"&&e.content!==null,o=e.name.endsWith(".yaml")||e.name.endsWith(".yml");if(a){const l=typeof e.content=="string"?JSON.parse(e.content):e.content;return B.jsx(cn,{component:"pre",sx:{p:2,overflow:"auto",bgcolor:"grey.100",borderRadius:1,fontSize:"0.875rem",fontFamily:"monospace"},children:JSON.stringify(l,null,2)})}return o||typeof e.content=="string"?B.jsx(cn,{component:"pre",sx:{p:2,overflow:"auto",bgcolor:"grey.100",borderRadius:1,fontSize:"0.875rem",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:String(e.content)}):B.jsx(cn,{component:"pre",sx:{p:2,overflow:"auto",bgcolor:"grey.100",borderRadius:1,fontSize:"0.875rem",fontFamily:"monospace"},children:JSON.stringify(e.content,null,2)})};return B.jsxs(vF,{fullScreen:!0,open:!0,onClose:t,children:[B.jsx(zI,{sx:{position:"relative"},children:B.jsxs(Nm,{children:[B.jsx(Ln,{sx:{ml:2,flex:1},variant:"h6",component:"div",children:e.name}),B.jsx(Am,{edge:"end",color:"inherit",onClick:t,"aria-label":"close",children:B.jsx(J9,{})})]})}),B.jsxs(cn,{sx:{p:3},children:[B.jsxs(oi,{sx:{mb:2,p:2},children:[B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:[B.jsx("strong",{children:"Path:"})," ",e.path]}),B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:[B.jsx("strong",{children:"Type:"})," ",e.mimeType||e.type]}),e.size!==void 0&&B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:[B.jsx("strong",{children:"Size:"})," ",z0(e.size)]}),e.createdAt&&B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:[B.jsx("strong",{children:"Created:"})," ",new Date(e.createdAt).toLocaleString()]})]}),n()]})]})}const lm=280;function tq(e,t){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",java:"java",c:"c",cpp:"cpp",cs:"csharp",go:"go",rs:"rust",php:"php",html:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",sql:"sql",sh:"bash",bash:"bash",md:"markdown",txt:"text"}[n||""]||"text"}function nq(e,t){return e.endsWith(".md")||e.endsWith(".markdown")||t==="text/markdown"}function rq(e,t,n){return!!(e.endsWith(".json")||t==="application/json"||n&&typeof n=="object"&&!Array.isArray(n))}function aq(){const e=Qr(),t=aP(e.breakpoints.down("md")),n=Nh(),a=$P(),o=a["*"]?`/${a["*"]}`:"/",[l,u]=A.useState([]),[c,f]=A.useState(!1),[p,g]=A.useState(null),[m,y]=A.useState(null),[S,E]=A.useState(""),[v,T]=A.useState(!t),[w,C]=A.useState("preview"),k=A.useCallback(async $=>{f(!0);try{const[L,W]=await Promise.all([fetch(`/api/list?path=${encodeURIComponent($)}&maxDepth=1`),fetch(`/api/read?path=${encodeURIComponent($)}`)]),R=await L.json(),V=await W.json(),z=(R.data||[]).filter(K=>K.path!==$).map(sd).sort((K,Q)=>{const J=K.meta?.type==="directory",F=Q.meta?.type==="directory";return J&&!F?-1:!J&&F?1:K.name.localeCompare(Q.name)});u(z),g(V.data||null)}catch(L){console.error("Failed to load directory:",L)}finally{f(!1)}},[]),_=A.useCallback(async()=>{if(!S.trim()){k(o);return}f(!0);try{const R=((await(await fetch(`/api/search?path=${encodeURIComponent(o)}&query=${encodeURIComponent(S)}`)).json()).data||[]).map(sd).sort((V,H)=>{const G=V.meta?.type==="directory",z=H.meta?.type==="directory";return G&&!z?-1:!G&&z?1:V.name.localeCompare(H.name)});u(R),g(null)}catch($){console.error("Failed to search:",$)}finally{f(!1)}},[o,S,k]);A.useEffect(()=>{k(o)},[o,k]);const N=$=>{n($),y(null),E("")},I=async $=>{N($.path)},D=o.split("/").filter(Boolean),j=B.jsxs(cn,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:[B.jsx(Nm,{children:B.jsx(Ln,{variant:"h6",noWrap:!0,children:"File Tree"})}),B.jsx(Cm,{}),B.jsx(cn,{sx:{flexGrow:1,overflow:"auto",p:2},children:B.jsx(Q9,{currentPath:o})})]});return B.jsxs(cn,{sx:{display:"flex",flexDirection:"column",height:"100vh"},children:[B.jsx(zI,{position:"static",sx:{zIndex:e.zIndex.drawer+1},children:B.jsxs(Nm,{children:[B.jsx(Am,{color:"inherit",edge:"start",onClick:()=>T(!v),sx:{mr:2,display:{md:"none"}},children:B.jsx(B$,{})}),B.jsx(Ln,{variant:"h6",component:"div",sx:{flexGrow:1},children:"AFS Explorer"})]})}),B.jsxs(cn,{sx:{display:"flex",flexGrow:1,overflow:"hidden"},children:[B.jsx(BF,{variant:t?"temporary":"permanent",open:v,onClose:()=>T(!1),sx:{width:lm,flexShrink:0,"& .MuiDrawer-paper":{width:lm,boxSizing:"border-box"}},children:j}),B.jsxs(cn,{component:"main",sx:{flexGrow:1,p:3,overflow:"auto",width:{sm:`calc(100% - ${lm}px)`}},children:[B.jsxs(CB,{sx:{mb:2},children:[B.jsx(nR,{component:"button",variant:"body1",onClick:()=>N("/"),sx:{cursor:"pointer"},children:"Root"}),D.map(($,L)=>{const W=`/${D.slice(0,L+1).join("/")}`,R=L===D.length-1,V=$.replace(/~/g,"/");return R?B.jsx(Ln,{color:"text.primary",children:V},W):B.jsx(nR,{component:"button",variant:"body1",onClick:()=>N(W),sx:{cursor:"pointer"},children:V},W)})]}),B.jsx(rP,{fullWidth:!0,variant:"outlined",placeholder:"Search files and folders...",value:S,onChange:$=>E($.target.value),onKeyPress:$=>{$.key==="Enter"&&_()},sx:{mb:3},slotProps:{input:{endAdornment:B.jsx(lU,{position:"end",children:B.jsx(Am,{onClick:_,edge:"end",children:B.jsx(F$,{})})})}}}),p?.content&&B.jsxs(oi,{sx:{mb:3},children:[B.jsxs(cn,{sx:{px:3,pt:2,pb:1},children:[B.jsx(Ln,{variant:"h6",gutterBottom:!0,children:"Content"}),p.meta?.mimeType&&B.jsxs(Ln,{variant:"body2",color:"text.secondary",children:["Type: ",p.meta?.mimeType]})]}),B.jsxs(Qz,{value:w,onChange:($,L)=>C(L),sx:{borderBottom:1,borderColor:"divider",px:3},children:[B.jsx(cR,{label:"Preview",value:"preview"}),B.jsx(cR,{label:"Raw",value:"raw"})]}),B.jsx(cn,{sx:{p:3},children:w==="preview"?B.jsx(cn,{sx:{maxHeight:"500px",overflow:"auto"},children:(()=>{const $=typeof p.content=="string"?p.content:JSON.stringify(p.content,null,2),L=p.meta?.mimeType,W=p.meta?.contentType;if(F0(o,L)){let V=$;return W==="base64"?V=`data:${L||"image/png"};base64,${$}`:L==="image/svg+xml"&&(V=`data:image/svg+xml,${encodeURIComponent($)}`),B.jsx(cn,{sx:{display:"flex",justifyContent:"center",alignItems:"center",p:2},children:B.jsx("img",{src:V,alt:o,style:{maxWidth:"100%",maxHeight:"500px",objectFit:"contain"}})})}if(nq(o,L))return B.jsx(cn,{sx:{"& h1":{fontSize:"2em",fontWeight:"bold",mb:2},"& h2":{fontSize:"1.5em",fontWeight:"bold",mb:1.5},"& h3":{fontSize:"1.25em",fontWeight:"bold",mb:1},"& p":{mb:2},"& ul, & ol":{mb:2,pl:3},"& li":{mb:.5},"& code":{bgcolor:"#f5f5f5",px:.5,py:.25,borderRadius:.5,fontSize:"0.875em",color:"#d73a49",fontFamily:"Consolas, Monaco, 'Courier New', monospace"},"& pre":{mb:2},"& blockquote":{borderLeft:"4px solid",borderColor:"grey.300",pl:2,py:1,mb:2,color:"text.secondary"},"& a":{color:"primary.main",textDecoration:"none"},"& table":{borderCollapse:"collapse",mb:2,width:"100%"},"& th, & td":{border:"1px solid",borderColor:"grey.300",px:1,py:.5},"& th":{bgcolor:"grey.100",fontWeight:"bold"}},children:B.jsx(qH,{remarkPlugins:[eV],components:{code({className:V,children:H,...G}){const z=/language-(\w+)/.exec(V||""),K=!z,{ref:Q,...J}=G;return!K&&z?B.jsx(Hc,{style:Kg,language:z[1],PreTag:"div",customStyle:{backgroundColor:"#fafafa",border:"1px solid #e0e0e0",borderRadius:"4px"},children:String(H).replace(/\n$/,"")}):B.jsx("code",{className:V,...J,children:H})}},children:$})});if(rq(o,p.meta?.mimeType,p.content))return B.jsx(Hc,{language:"json",style:Kg,customStyle:{margin:0,borderRadius:"4px",backgroundColor:"#fafafa",border:"1px solid #e0e0e0"},showLineNumbers:!0,children:$});const R=tq(o,p.meta?.mimeType);return B.jsx(Hc,{language:R,style:Kg,customStyle:{margin:0,borderRadius:"4px",backgroundColor:"#fafafa",border:"1px solid #e0e0e0"},showLineNumbers:!0,children:$})})()}):B.jsx(cn,{sx:{p:2,bgcolor:"grey.50",borderRadius:1,maxHeight:"500px",overflow:"auto"},children:B.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:typeof p.content=="string"?p.content:JSON.stringify(p.content,null,2)})})})]}),c?B.jsx(cn,{sx:{display:"flex",justifyContent:"center",p:4},children:B.jsx(As,{})}):l.length>0?B.jsx(Tz,{component:oi,children:B.jsxs(uz,{children:[B.jsx(Rz,{children:B.jsxs(hR,{children:[B.jsx(Oo,{children:"Name"}),B.jsx(Oo,{children:"Size"}),B.jsx(Oo,{children:"Modified"})]})}),B.jsx(gz,{children:l.map($=>B.jsxs(hR,{hover:!0,onClick:()=>I($),sx:{cursor:"pointer"},children:[B.jsx(Oo,{children:B.jsxs(cn,{sx:{display:"flex",alignItems:"center",gap:1},children:[$.meta?.type==="file"?U0($.path,$.meta?.mimeType):B.jsx(S_,{fontSize:"small",color:"primary"}),$.name]})}),B.jsx(Oo,{children:z0($.size)}),B.jsx(Oo,{children:lV($.createdAt)})]},$.path))})]})}):null]})]}),m&&B.jsx(eq,{file:m,onClose:()=>y(null)})]})}const iq=Id({palette:{mode:"light",primary:{main:"#1976d2"}}});function oq(){return B.jsx(k$,{children:B.jsxs(WM,{theme:iq,children:[B.jsx(YB,{}),B.jsx(n$,{children:B.jsx(f_,{path:"/*",element:B.jsx(aq,{})})})]})})}const nN=document.getElementById("root");if(!nN)throw new Error("Root element not found");w1.createRoot(nN).render(B.jsx(A.StrictMode,{children:B.jsx(oq,{})}));
|
package/html/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>AFS Explorer</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-spiiiNWx.js"></script>
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/afs-explorer",
|
|
3
|
-
"version": "1.11.0-beta.
|
|
3
|
+
"version": "1.11.0-beta.7",
|
|
4
4
|
"description": "Explore and manage AFS file systems",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"cors": "^2.8.5",
|
|
39
39
|
"express": "^5.1.0",
|
|
40
|
-
"@aigne/afs": "^1.11.0-beta.
|
|
40
|
+
"@aigne/afs": "^1.11.0-beta.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@emotion/react": "^11.14.0",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"tsdown": "0.20.0-beta.3",
|
|
66
66
|
"typescript": "^5.9.2",
|
|
67
67
|
"vite": "^7.1.5",
|
|
68
|
-
"@aigne/afs-git": "^1.11.0-beta.
|
|
69
|
-
"@aigne/afs-json": "^1.11.0-beta.
|
|
70
|
-
"@aigne/afs-fs": "^1.11.0-beta.
|
|
68
|
+
"@aigne/afs-git": "^1.11.0-beta.7",
|
|
69
|
+
"@aigne/afs-json": "^1.11.0-beta.7",
|
|
70
|
+
"@aigne/afs-fs": "^1.11.0-beta.7",
|
|
71
71
|
"@aigne/scripts": "0.0.0",
|
|
72
72
|
"@aigne/typescript-config": "0.0.0"
|
|
73
73
|
},
|