import{j as s,s as k}from"./index-3808da28.js";import{r as l,R as F,y as be,B as he,E as Ve,S as qe,_ as xe,X as We,I as _e,Y as Ke,m as _,$ as me,Q as Ze,H as Ge,a0 as Qe,o as je,a1 as Xe,a2 as Je,a3 as Se,a4 as Ee}from"./vendor-61f0f29a.js";function et(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function Oe(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function Me(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Oe(Object(r),!0).forEach(function(e){et(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Oe(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function tt(t,n){if(t==null)return{};var r={},e=Object.keys(t),o,i;for(i=0;i<e.length;i++)o=e[i],!(n.indexOf(o)>=0)&&(r[o]=t[o]);return r}function rt(t,n){if(t==null)return{};var r=tt(t,n),e,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)e=i[o],!(n.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function nt(t,n){return ot(t)||at(t,n)||it(t,n)||st()}function ot(t){if(Array.isArray(t))return t}function at(t,n){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var r=[],e=!0,o=!1,i=void 0;try{for(var d=t[Symbol.iterator](),w;!(e=(w=d.next()).done)&&(r.push(w.value),!(n&&r.length===n));e=!0);}catch(b){o=!0,i=b}finally{try{!e&&d.return!=null&&d.return()}finally{if(o)throw i}}return r}}function it(t,n){if(t){if(typeof t=="string")return Te(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Te(t,n)}}function Te(t,n){(n==null||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}function st(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lt(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}function Le(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function Pe(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Le(Object(r),!0).forEach(function(e){lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Le(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ct(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(e){return n.reduceRight(function(o,i){return i(o)},e)}}function ne(t){return function n(){for(var r=this,e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return o.length>=t.length?t.apply(this,o):function(){for(var d=arguments.length,w=new Array(d),b=0;b<d;b++)w[b]=arguments[b];return n.apply(r,[].concat(o,w))}}}function de(t){return{}.toString.call(t).includes("Object")}function ut(t){return!Object.keys(t).length}function ie(t){return typeof t=="function"}function dt(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function ft(t,n){return de(n)||V("changeType"),Object.keys(n).some(function(r){return!dt(t,r)})&&V("changeField"),n}function pt(t){ie(t)||V("selectorType")}function ht(t){ie(t)||de(t)||V("handlerType"),de(t)&&Object.values(t).some(function(n){return!ie(n)})&&V("handlersType")}function mt(t){t||V("initialIsRequired"),de(t)||V("initialType"),ut(t)&&V("initialContent")}function gt(t,n){throw new Error(t[n]||t.default)}var vt={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},V=ne(gt)(vt),le={changes:ft,selector:pt,handler:ht,initial:mt};function wt(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};le.initial(t),le.handler(n);var r={current:t},e=ne(xt)(r,n),o=ne(bt)(r),i=ne(le.changes)(t),d=ne(yt)(r);function w(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(L){return L};return le.selector(E),E(r.current)}function b(E){ct(e,o,i,d)(E)}return[w,b]}function yt(t,n){return ie(n)?n(t.current):n}function bt(t,n){return t.current=Pe(Pe({},t.current),n),n}function xt(t,n,r){return ie(n)?n(t.current):Object.keys(r).forEach(function(e){var o;return(o=n[e])===null||o===void 0?void 0:o.call(n,t.current[e])}),r}var jt={create:wt},St={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function Et(t){return function n(){for(var r=this,e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return o.length>=t.length?t.apply(this,o):function(){for(var d=arguments.length,w=new Array(d),b=0;b<d;b++)w[b]=arguments[b];return n.apply(r,[].concat(o,w))}}}function Ot(t){return{}.toString.call(t).includes("Object")}function Mt(t){return t||Ce("configIsRequired"),Ot(t)||Ce("configType"),t.urls?(Tt(),{paths:{vs:t.urls.monacoBase}}):t}function Tt(){console.warn(Ie.deprecation)}function Lt(t,n){throw new Error(t[n]||t.default)}var Ie={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
    You are using deprecated way of configuration.

    Instead of using
      monaco.config({ urls: { monacoBase: '...' } })
    use
      monaco.config({ paths: { vs: '...' } })

    For more please check the link https://github.com/suren-atoyan/monaco-loader#config
  `},Ce=Et(Lt)(Ie),Pt={config:Mt},Ct=function(){for(var n=arguments.length,r=new Array(n),e=0;e<n;e++)r[e]=arguments[e];return function(o){return r.reduceRight(function(i,d){return d(i)},o)}};function Fe(t,n){return Object.keys(n).forEach(function(r){n[r]instanceof Object&&t[r]&&Object.assign(n[r],Fe(t[r],n[r]))}),Me(Me({},t),n)}var Dt={type:"cancelation",msg:"operation is manually canceled"};function ge(t){var n=!1,r=new Promise(function(e,o){t.then(function(i){return n?o(Dt):e(i)}),t.catch(o)});return r.cancel=function(){return n=!0},r}var Rt=jt.create({config:St,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ae=nt(Rt,2),se=Ae[0],fe=Ae[1];function Nt(t){var n=Pt.config(t),r=n.monaco,e=rt(n,["monaco"]);fe(function(o){return{config:Fe(o.config,e),monaco:r}})}function _t(){var t=se(function(n){var r=n.monaco,e=n.isInitialized,o=n.resolve;return{monaco:r,isInitialized:e,resolve:o}});if(!t.isInitialized){if(fe({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),ge(ve);if(window.monaco&&window.monaco.editor)return $e(window.monaco),t.resolve(window.monaco),ge(ve);Ct(It,At)($t)}return ge(ve)}function It(t){return document.body.appendChild(t)}function Ft(t){var n=document.createElement("script");return t&&(n.src=t),n}function At(t){var n=se(function(e){var o=e.config,i=e.reject;return{config:o,reject:i}}),r=Ft("".concat(n.config.paths.vs,"/loader.js"));return r.onload=function(){return t()},r.onerror=n.reject,r}function $t(){var t=se(function(r){var e=r.config,o=r.resolve,i=r.reject;return{config:e,resolve:o,reject:i}}),n=window.require;n.config(t.config),n(["vs/editor/editor.main"],function(r){$e(r),t.resolve(r)},function(r){t.reject(r)})}function $e(t){se().monaco||fe({monaco:t})}function Yt(){return se(function(t){var n=t.monaco;return n})}var ve=new Promise(function(t,n){return fe({resolve:t,reject:n})}),Ye={config:Nt,init:_t,__getMonacoInstance:Yt},kt={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},we=kt,Ht={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Bt=Ht;function Ut({children:t}){return F.createElement("div",{style:Bt.container},t)}var zt=Ut,Vt=zt;function qt({width:t,height:n,isEditorReady:r,loading:e,_ref:o,className:i,wrapperProps:d}){return F.createElement("section",{style:{...we.wrapper,width:t,height:n},...d},!r&&F.createElement(Vt,null,e),F.createElement("div",{ref:o,style:{...we.fullWidth,...!r&&we.hide},className:i}))}var Wt=qt,ke=l.memo(Wt);function Kt(t){l.useEffect(t,[])}var He=Kt;function Zt(t,n,r=!0){let e=l.useRef(!0);l.useEffect(e.current||!r?()=>{e.current=!1}:t,n)}var C=Zt;function oe(){}function ee(t,n,r,e){return Gt(t,e)||Qt(t,n,r,e)}function Gt(t,n){return t.editor.getModel(Be(t,n))}function Qt(t,n,r,e){return t.editor.createModel(n,r,e?Be(t,e):void 0)}function Be(t,n){return t.Uri.parse(n)}function Xt({original:t,modified:n,language:r,originalLanguage:e,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:d,keepCurrentOriginalModel:w=!1,keepCurrentModifiedModel:b=!1,theme:E="light",loading:L="Loading...",options:M={},height:D="100%",width:A="100%",className:H,wrapperProps:re={},beforeMount:P=oe,onMount:G=oe}){let[O,B]=l.useState(!1),[$,S]=l.useState(!0),x=l.useRef(null),j=l.useRef(null),q=l.useRef(null),y=l.useRef(G),p=l.useRef(P),U=l.useRef(!1);He(()=>{let u=Ye.init();return u.then(g=>(j.current=g)&&S(!1)).catch(g=>(g==null?void 0:g.type)!=="cancelation"&&console.error("Monaco initialization: error:",g)),()=>x.current?W():u.cancel()}),C(()=>{if(x.current&&j.current){let u=x.current.getOriginalEditor(),g=ee(j.current,t||"",e||r||"text",i||"");g!==u.getModel()&&u.setModel(g)}},[i],O),C(()=>{if(x.current&&j.current){let u=x.current.getModifiedEditor(),g=ee(j.current,n||"",o||r||"text",d||"");g!==u.getModel()&&u.setModel(g)}},[d],O),C(()=>{let u=x.current.getModifiedEditor();u.getOption(j.current.editor.EditorOption.readOnly)?u.setValue(n||""):n!==u.getValue()&&(u.executeEdits("",[{range:u.getModel().getFullModelRange(),text:n||"",forceMoveMarkers:!0}]),u.pushUndoStop())},[n],O),C(()=>{var u,g;(g=(u=x.current)==null?void 0:u.getModel())==null||g.original.setValue(t||"")},[t],O),C(()=>{let{original:u,modified:g}=x.current.getModel();j.current.editor.setModelLanguage(u,e||r||"text"),j.current.editor.setModelLanguage(g,o||r||"text")},[r,e,o],O),C(()=>{var u;(u=j.current)==null||u.editor.setTheme(E)},[E],O),C(()=>{var u;(u=x.current)==null||u.updateOptions(M)},[M],O);let Q=l.useCallback(()=>{var I;if(!j.current)return;p.current(j.current);let u=ee(j.current,t||"",e||r||"text",i||""),g=ee(j.current,n||"",o||r||"text",d||"");(I=x.current)==null||I.setModel({original:u,modified:g})},[r,n,o,t,e,i,d]),X=l.useCallback(()=>{var u;!U.current&&q.current&&(x.current=j.current.editor.createDiffEditor(q.current,{automaticLayout:!0,...M}),Q(),(u=j.current)==null||u.editor.setTheme(E),B(!0),U.current=!0)},[M,E,Q]);l.useEffect(()=>{O&&y.current(x.current,j.current)},[O]),l.useEffect(()=>{!$&&!O&&X()},[$,O,X]);function W(){var g,I,Y,K;let u=(g=x.current)==null?void 0:g.getModel();w||((I=u==null?void 0:u.original)==null||I.dispose()),b||((Y=u==null?void 0:u.modified)==null||Y.dispose()),(K=x.current)==null||K.dispose()}return F.createElement(ke,{width:A,height:D,isEditorReady:O,loading:L,_ref:q,className:H,wrapperProps:re})}var Jt=Xt;l.memo(Jt);function er(t){let n=l.useRef();return l.useEffect(()=>{n.current=t},[t]),n.current}var tr=er,ce=new Map;function rr({defaultValue:t,defaultLanguage:n,defaultPath:r,value:e,language:o,path:i,theme:d="light",line:w,loading:b="Loading...",options:E={},overrideServices:L={},saveViewState:M=!0,keepCurrentModel:D=!1,width:A="100%",height:H="100%",className:re,wrapperProps:P={},beforeMount:G=oe,onMount:O=oe,onChange:B,onValidate:$=oe}){let[S,x]=l.useState(!1),[j,q]=l.useState(!0),y=l.useRef(null),p=l.useRef(null),U=l.useRef(null),Q=l.useRef(O),X=l.useRef(G),W=l.useRef(),u=l.useRef(e),g=tr(i),I=l.useRef(!1),Y=l.useRef(!1);He(()=>{let f=Ye.init();return f.then(v=>(y.current=v)&&q(!1)).catch(v=>(v==null?void 0:v.type)!=="cancelation"&&console.error("Monaco initialization: error:",v)),()=>p.current?pe():f.cancel()}),C(()=>{var v,T,Z,z;let f=ee(y.current,t||e||"",n||o||"",i||r||"");f!==((v=p.current)==null?void 0:v.getModel())&&(M&&ce.set(g,(T=p.current)==null?void 0:T.saveViewState()),(Z=p.current)==null||Z.setModel(f),M&&((z=p.current)==null||z.restoreViewState(ce.get(i))))},[i],S),C(()=>{var f;(f=p.current)==null||f.updateOptions(E)},[E],S),C(()=>{!p.current||e===void 0||(p.current.getOption(y.current.editor.EditorOption.readOnly)?p.current.setValue(e):e!==p.current.getValue()&&(Y.current=!0,p.current.executeEdits("",[{range:p.current.getModel().getFullModelRange(),text:e,forceMoveMarkers:!0}]),p.current.pushUndoStop(),Y.current=!1))},[e],S),C(()=>{var v,T;let f=(v=p.current)==null?void 0:v.getModel();f&&o&&((T=y.current)==null||T.editor.setModelLanguage(f,o))},[o],S),C(()=>{var f;w!==void 0&&((f=p.current)==null||f.revealLine(w))},[w],S),C(()=>{var f;(f=y.current)==null||f.editor.setTheme(d)},[d],S);let K=l.useCallback(()=>{var f;if(!(!U.current||!y.current)&&!I.current){X.current(y.current);let v=i||r,T=ee(y.current,e||t||"",n||o||"",v||"");p.current=(f=y.current)==null?void 0:f.editor.create(U.current,{model:T,automaticLayout:!0,...E},L),M&&p.current.restoreViewState(ce.get(v)),y.current.editor.setTheme(d),w!==void 0&&p.current.revealLine(w),x(!0),I.current=!0}},[t,n,r,e,o,i,E,L,M,d,w]);l.useEffect(()=>{S&&Q.current(p.current,y.current)},[S]),l.useEffect(()=>{!j&&!S&&K()},[j,S,K]),u.current=e,l.useEffect(()=>{var f,v;S&&B&&((f=W.current)==null||f.dispose(),W.current=(v=p.current)==null?void 0:v.onDidChangeModelContent(T=>{Y.current||B(p.current.getValue(),T)}))},[S,B]),l.useEffect(()=>{if(S){let f=y.current.editor.onDidChangeMarkers(v=>{var Z;let T=(Z=p.current.getModel())==null?void 0:Z.uri;if(T&&v.find(z=>z.path===T.path)){let z=y.current.editor.getModelMarkers({resource:T});$==null||$(z)}});return()=>{f==null||f.dispose()}}return()=>{}},[S,$]);function pe(){var f,v;(f=W.current)==null||f.dispose(),D?M&&ce.set(i,p.current.saveViewState()):(v=p.current.getModel())==null||v.dispose(),p.current.dispose()}return F.createElement(ke,{width:A,height:H,isEditorReady:S,loading:b,_ref:U,className:re,wrapperProps:P})}var nr=rr,or=l.memo(nr),De=or;/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var ye=function(t,n){return ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,e){r.__proto__=e}||function(r,e){for(var o in e)e.hasOwnProperty(o)&&(r[o]=e[o])},ye(t,n)};function ar(t,n){ye(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}var ae=function(){return ae=Object.assign||function(n){for(var r,e=1,o=arguments.length;e<o;e++){r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])}return n},ae.apply(this,arguments)};function ir(t,n,r,e){var o,i=!1,d=0;function w(){o&&clearTimeout(o)}function b(){w(),i=!0}typeof n!="boolean"&&(e=r,r=n,n=void 0);function E(){var L=this,M=Date.now()-d,D=arguments;if(i)return;function A(){d=Date.now(),r.apply(L,D)}function H(){o=void 0}e&&!o&&A(),w(),e===void 0&&M>t?A():n!==!0&&(o=setTimeout(e?H:A,e===void 0?t-M:t))}return E.cancel=b,E}var te={Pixel:"Pixel",Percent:"Percent"},Re={unit:te.Percent,value:.8};function Ne(t){return typeof t=="number"?{unit:te.Percent,value:t*100}:typeof t=="string"?t.match(/^(\d*(\.\d+)?)px$/)?{unit:te.Pixel,value:parseFloat(t)}:t.match(/^(\d*(\.\d+)?)%$/)?{unit:te.Percent,value:parseFloat(t)}:(console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...'),Re):(console.warn("scrollThreshold should be string or number"),Re)}var sr=function(t){ar(n,t);function n(r){var e=t.call(this,r)||this;return e.lastScrollTop=0,e.actionTriggered=!1,e.startY=0,e.currentY=0,e.dragging=!1,e.maxPullDownDistance=0,e.getScrollableTarget=function(){return e.props.scrollableTarget instanceof HTMLElement?e.props.scrollableTarget:typeof e.props.scrollableTarget=="string"?document.getElementById(e.props.scrollableTarget):(e.props.scrollableTarget===null&&console.warn(`You are trying to pass scrollableTarget but it is null. This might
        happen because the element may not have been added to DOM yet.
        See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.
      `),null)},e.onStart=function(o){e.lastScrollTop||(e.dragging=!0,o instanceof MouseEvent?e.startY=o.pageY:o instanceof TouchEvent&&(e.startY=o.touches[0].pageY),e.currentY=e.startY,e._infScroll&&(e._infScroll.style.willChange="transform",e._infScroll.style.transition="transform 0.2s cubic-bezier(0,0,0.31,1)"))},e.onMove=function(o){e.dragging&&(o instanceof MouseEvent?e.currentY=o.pageY:o instanceof TouchEvent&&(e.currentY=o.touches[0].pageY),!(e.currentY<e.startY)&&(e.currentY-e.startY>=Number(e.props.pullDownToRefreshThreshold)&&e.setState({pullToRefreshThresholdBreached:!0}),!(e.currentY-e.startY>e.maxPullDownDistance*1.5)&&e._infScroll&&(e._infScroll.style.overflow="visible",e._infScroll.style.transform="translate3d(0px, "+(e.currentY-e.startY)+"px, 0px)")))},e.onEnd=function(){e.startY=0,e.currentY=0,e.dragging=!1,e.state.pullToRefreshThresholdBreached&&(e.props.refreshFunction&&e.props.refreshFunction(),e.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){e._infScroll&&(e._infScroll.style.overflow="auto",e._infScroll.style.transform="none",e._infScroll.style.willChange="unset")})},e.onScrollListener=function(o){typeof e.props.onScroll=="function"&&setTimeout(function(){return e.props.onScroll&&e.props.onScroll(o)},0);var i=e.props.height||e._scrollableNode?o.target:document.documentElement.scrollTop?document.documentElement:document.body;if(!e.actionTriggered){var d=e.props.inverse?e.isElementAtTop(i,e.props.scrollThreshold):e.isElementAtBottom(i,e.props.scrollThreshold);d&&e.props.hasMore&&(e.actionTriggered=!0,e.setState({showLoader:!0}),e.props.next&&e.props.next()),e.lastScrollTop=i.scrollTop}},e.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:r.dataLength},e.throttledOnScrollListener=ir(150,e.onScrollListener).bind(e),e.onStart=e.onStart.bind(e),e.onMove=e.onMove.bind(e),e.onEnd=e.onEnd.bind(e),e}return n.prototype.componentDidMount=function(){if(typeof this.props.dataLength>"u")throw new Error('mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage');if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener("scroll",this.throttledOnScrollListener),typeof this.props.initialScrollY=="number"&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener("touchstart",this.onStart),this.el.addEventListener("touchmove",this.onMove),this.el.addEventListener("touchend",this.onEnd),this.el.addEventListener("mousedown",this.onStart),this.el.addEventListener("mousemove",this.onMove),this.el.addEventListener("mouseup",this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),typeof this.props.refreshFunction!="function"))throw new Error(`Mandatory prop "refreshFunction" missing.
          Pull Down To Refresh functionality will not work
          as expected. Check README.md for usage'`)},n.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener("scroll",this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener("touchstart",this.onStart),this.el.removeEventListener("touchmove",this.onMove),this.el.removeEventListener("touchend",this.onEnd),this.el.removeEventListener("mousedown",this.onStart),this.el.removeEventListener("mousemove",this.onMove),this.el.removeEventListener("mouseup",this.onEnd)))},n.prototype.componentDidUpdate=function(r){this.props.dataLength!==r.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},n.getDerivedStateFromProps=function(r,e){var o=r.dataLength!==e.prevDataLength;return o?ae(ae({},e),{prevDataLength:r.dataLength}):null},n.prototype.isElementAtTop=function(r,e){e===void 0&&(e=.8);var o=r===document.body||r===document.documentElement?window.screen.availHeight:r.clientHeight,i=Ne(e);return i.unit===te.Pixel?r.scrollTop<=i.value+o-r.scrollHeight+1:r.scrollTop<=i.value/100+o-r.scrollHeight+1},n.prototype.isElementAtBottom=function(r,e){e===void 0&&(e=.8);var o=r===document.body||r===document.documentElement?window.screen.availHeight:r.clientHeight,i=Ne(e);return i.unit===te.Pixel?r.scrollTop+o>=r.scrollHeight-i.value:r.scrollTop+o>=i.value/100*r.scrollHeight},n.prototype.render=function(){var r=this,e=ae({height:this.props.height||"auto",overflow:"auto",WebkitOverflowScrolling:"touch"},this.props.style),o=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),i=this.props.pullDownToRefresh&&this.props.height?{overflow:"auto"}:{};return F.createElement("div",{style:i,className:"infinite-scroll-component__outerdiv"},F.createElement("div",{className:"infinite-scroll-component "+(this.props.className||""),ref:function(d){return r._infScroll=d},style:e},this.props.pullDownToRefresh&&F.createElement("div",{style:{position:"relative"},ref:function(d){return r._pullDown=d}},F.createElement("div",{style:{position:"absolute",left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!o&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},n}(l.Component);const{Dragger:lr}=Ke,{Search:cr}=_e,ue={图片:["image/jpeg","image/png","image/gif","image/svg+xml"],文档:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown"],表格:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"],代码:["text/html","text/javascript","text/css","application/json","text/jsx","text/tsx"]},fr=()=>{const[t,n]=l.useState([]),[r,e]=l.useState(!1),[o,i]=l.useState(null),[d,w]=l.useState(""),[b,E]=l.useState(!1),[L,M]=l.useState(""),[D,A]=l.useState("全部"),[H,re]=l.useState(!0),[P,G]=l.useState([]),O=200,B=100,[$,S]=l.useState(!1),[x,j]=l.useState(""),q=a=>{var m;const c=(m=a.metadata)==null?void 0:m.mimetype,h={"text/plain":s.jsx(je,{}),"text/markdown":s.jsx(Xe,{}),"application/pdf":s.jsx(Je,{}),"application/msword":s.jsx(Se,{}),"application/vnd.openxmlformats-officedocument.wordprocessingml.document":s.jsx(Se,{}),"application/vnd.ms-excel":s.jsx(Ee,{}),"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":s.jsx(Ee,{})};return c!=null&&c.startsWith("image/")?s.jsx(Qe,{}):h[c]||s.jsx(je,{})},y=async(a=!0)=>{e(!0);try{const{data:c,error:h}=await k.storage.from("file").list("",{limit:a?O:B,offset:a?0:P.length,sortBy:{column:"created_at",order:"desc"}});if(h)throw h;G(a?c||[]:m=>[...m,...c||[]]),re((c==null?void 0:c.length)===(a?O:B))}catch(c){_.error(`获取文件列表失败: ${c.message}`)}finally{e(!1)}},p=a=>{const{data:c}=k.storage.from("file").getPublicUrl(a);return c.publicUrl},U=async a=>{var c,h,m;try{if(((c=a.metadata)==null?void 0:c.mimetype)==="application/pdf"||(h=a.metadata)!=null&&h.mimetype.includes("msword")||(m=a.metadata)!=null&&m.mimetype.includes("spreadsheet")){window.open(p(a.name),"_blank");return}const{data:R,error:N}=await k.storage.from("file").download(a.name);if(N)throw N;const J=await R.text();i(a),w(J)}catch{_.error("文件预览失败")}},Q={name:"file",multiple:!0,showUploadList:!1,customRequest:async({file:a,onSuccess:c,onError:h})=>{try{const m=a.name;if(t.some(ze=>ze.name===m))throw new Error("文件已存在");const{data:N,error:J}=await k.storage.from("file").upload(m,a);if(J)throw J;_.success(`${m} 上传成功`),c(N),y()}catch(m){_.error(`${a.name} 上传失败: ${m.message}`),h(m)}},beforeUpload:a=>a.size/1024/1024<50?!0:(_.error("文件必须小于 50MB!"),!1)},X=l.useMemo(()=>P.filter(a=>{var R,N;const c=a.name.toLowerCase().includes(L.toLowerCase());if(D==="全部")return c;const h=(R=a.metadata)==null?void 0:R.mimetype,m=(N=ue[D])==null?void 0:N.includes(h);return c&&m}),[P,L,D]),W=l.useMemo(()=>{const a={全部:P.length};return Object.keys(ue).forEach(c=>{a[c]=0}),P.forEach(c=>{var R;const h=(R=c.metadata)==null?void 0:R.mimetype;let m=!1;Object.entries(ue).forEach(([N,J])=>{J.includes(h)&&(a[N]++,m=!0)}),m||a.其他++}),a},[P]);l.useEffect(()=>{y()},[]);const u=a=>{var c,h;return(h=(c=a.metadata)==null?void 0:c.mimetype)==null?void 0:h.startsWith("image/")},g=a=>{var c,h;return((c=a.metadata)==null?void 0:c.mimetype)==="text/html"||((h=a.metadata)==null?void 0:h.mimetype)==="text/plain"},I=async()=>{if(o)try{const a=new Blob([d],{type:"text/plain"}),c=new File([a],o.name,{type:"text/plain"}),{error:h}=await k.storage.from("file").update(o.name,c);if(h)throw h;_.success("保存成功"),y()}catch(a){console.error("保存文件错误:",a),_.error(`保存失败: ${a.message}`)}},Y=a=>{w(a)},K=async()=>{if(!(!o||!x))try{if(t.some(N=>N.name===x))throw new Error("文件名已存在");const{data:c,error:h}=await k.storage.from("file").download(o.name);if(h)throw h;const{error:m}=await k.storage.from("file").upload(x,c);if(m)throw m;const{error:R}=await k.storage.from("file").remove([o.name]);if(R)throw R;_.success("重命名成功"),S(!1),i({...o,name:x}),y()}catch(a){console.error("重命名错误:",a),_.error(`重命名失败: ${a.message}`)}},pe=()=>{j(o.name),S(!0)},f=async a=>{try{const{error:c}=await k.storage.from("file").remove([a]);if(c)throw c;_.success("文件删除成功"),y(),(o==null?void 0:o.name)===a&&(i(null),w(""))}catch(c){_.error(`删除失败: ${c.message}`)}},v=l.useMemo(()=>L!==""||D!=="全部",[L,D]),T=()=>{!H||r||v||y(!1)};l.useEffect(()=>{y(!0)},[]);const Z=a=>{A(a)},z=()=>s.jsx("div",{className:"flex-1 overflow-y-auto",id:"scrollableDiv",children:s.jsx(sr,{dataLength:P.length,next:T,hasMore:!v&&H,loader:s.jsx("div",{className:"text-center py-4",children:s.jsx("div",{className:"inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent"})}),scrollableTarget:"scrollableDiv",endMessage:s.jsx("p",{className:"text-center text-gray-500 py-4",children:P.length>0?v?"已显示所有匹配文件":"已加载全部文件":"暂无文件"}),children:s.jsx(me,{loading:r&&P.length===0,dataSource:X,locale:{emptyText:"暂无文件"},renderItem:a=>{var c,h;return s.jsx(me.Item,{className:`cursor-pointer hover:bg-gray-100 ${(o==null?void 0:o.name)===a.name?"bg-blue-50":""}`,onClick:()=>U(a),actions:[s.jsx(Ze,{title:"确认删除",description:`是否确认删除文件 "${a.name}"?`,onConfirm:m=>{m==null||m.stopPropagation(),f(a.name)},okText:"确认",cancelText:"取消",children:s.jsx(he,{type:"text",danger:!0,onClick:m=>m.stopPropagation(),children:"删除"})},"delete")],children:s.jsx(me.Item.Meta,{avatar:u(a)?s.jsx(xe,{src:p(a.name),alt:a.name,width:32,height:32,className:"object-cover rounded",preview:!1,loading:"lazy",placeholder:s.jsx("div",{className:"w-8 h-8 bg-gray-200 rounded animate-pulse"})}):q(a),title:a.name,description:s.jsxs("div",{className:"text-xs text-gray-500",children:[s.jsxs("span",{children:["类型: ",(c=a.metadata)==null?void 0:c.mimetype]}),s.jsxs("span",{className:"ml-2",children:["大小: ",(((h=a.metadata)==null?void 0:h.size)/1024).toFixed(2)," KB"]}),s.jsxs("span",{className:"ml-2",children:["创建时间: ",new Date(a.created_at).toLocaleString()]})]})})})}})})}),Ue=()=>s.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries({全部:null,...ue}).map(([a])=>s.jsx(Ge.CheckableTag,{checked:D===a,onChange:c=>Z(c?a:"全部"),className:"cursor-pointer",children:`${a} (${W[a]||0})`},a))});return s.jsxs("div",{className:"flex h-screen bg-gray-50",children:[s.jsxs("div",{className:"w-1/3  p-2 border-r border-gray-200 flex flex-col",children:[s.jsx("div",{className:"mb-4 h-[150px]",children:s.jsxs(lr,{...Q,className:"bg-white  p-2 rounded-lg shadow-sm",children:[s.jsx("p",{className:"text-base",children:"点击或者拖拽文件到此区域上传"}),s.jsx("p",{className:"ant-upload-hint text-xs text-gray-500",children:"支持单个或批量上传，文件大小不超过50MB"})]})}),s.jsxs("div",{className:"mb-4 space-y-3",children:[s.jsx(cr,{placeholder:"搜索文件名...",allowClear:!0,onChange:a=>{M(a.target.value)},className:"w-full",size:"large"}),Ue()]}),z()]}),s.jsx("div",{className:"flex-1 p-4 overflow-y-auto bg-white",children:o?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mb-4 border-b pb-4",children:s.jsxs(be,{size:"middle",align:"center",children:[s.jsxs(be,{children:[s.jsx("span",{className:"font-medium text-lg",children:o.name}),s.jsx(he,{type:"text",icon:s.jsx(Ve,{}),onClick:pe})]}),g(o)&&s.jsx(qe,{checkedChildren:"预览",unCheckedChildren:"代码",checked:b,onChange:E}),!u(o)&&s.jsx(he,{type:"primary",onClick:I,children:"保存"})]})}),s.jsx("div",{className:"mt-4",children:u(o)?s.jsx("div",{className:"flex justify-center",children:s.jsx(xe,{src:p(o.name),alt:o.name,className:"max-w-full max-h-[80vh] object-contain",loading:"lazy",preview:{toolbarRender:()=>null,maskClassName:"backdrop-blur-sm"},placeholder:s.jsx("div",{className:"w-full h-[80vh] bg-gray-100 rounded flex items-center justify-center",children:s.jsx("div",{className:"w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"})})})}):g(o)?b?s.jsx("iframe",{srcDoc:d,className:"w-full h-[calc(100vh-200px)] border rounded"}):s.jsx(De,{height:"calc(100vh - 200px)",language:"html",theme:"vs-light",value:d,onChange:Y,options:{minimap:{enabled:!0}}}):s.jsx(De,{height:"calc(100vh - 200px)",language:"plaintext",theme:"vs-light",value:d,onChange:Y,options:{minimap:{enabled:!1}}})})]}):s.jsx("div",{className:"h-full flex items-center justify-center text-gray-400",children:"选择文件以预览"})}),s.jsx(We,{title:"重命名文件",open:$,onOk:K,onCancel:()=>S(!1),okText:"确认",cancelText:"取消",children:s.jsx(_e,{value:x,onChange:a=>j(a.target.value),placeholder:"请输入新文件名",autoFocus:!0})})]})};export{fr as default};
//# sourceMappingURL=index-5f9ef69d.js.map
