Files
Sillyv2/core/admin/p__Script__index.b379b183.async.js
2023-07-29 22:25:20 +08:00

16 lines
24 KiB
JavaScript

"use strict";var nt=Object.defineProperty,at=Object.defineProperties;var ot=Object.getOwnPropertyDescriptors;var Ve=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;var Fe=(l,_,o)=>_ in l?nt(l,_,{enumerable:!0,configurable:!0,writable:!0,value:o}):l[_]=o,q=(l,_)=>{for(var o in _||(_={}))it.call(_,o)&&Fe(l,o,_[o]);if(Ve)for(var o of Ve(_))ut.call(_,o)&&Fe(l,o,_[o]);return l},ze=(l,_)=>at(l,ot(_));(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[398],{25367:function(l,_,o){var y=o(68243),R=o(86981),I=o(11527),G=function(){return(0,I.jsxs)(y.Z,{size:"middle",children:[(0,I.jsx)(R.Z,{size:"small"}),(0,I.jsx)(R.Z,{}),(0,I.jsx)(R.Z,{size:"large"})]})};_.Z=G},34316:function(l,_,o){var y=o(86195),R=o(21362),I=function(){R.ZP.warning("\u767B\u5F55\u5931\u6548\uFF01",2);var T=new URL(window.location.href).searchParams,V=T.get("redirect");window.location.pathname!=="/user/login"&&!V&&y.history.replace({pathname:"/user/login"})};_.Z=I},83187:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){var _Users_a1_6_Code_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(54306),_Users_a1_6_Code_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_Users_a1_6_Code_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0__),_Users_a1_6_Code_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(54689),_Users_a1_6_Code_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_Users_a1_6_Code_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1__),_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(81308),_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(48989),_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(40792),antd__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(79112),lodash__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(32699),lodash__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__),react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(50959),_submit__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(87474),_umijs_max__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(86195),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(11527);__webpack_exports__.Z=function(props){for(var _props$data$script,content=(_props$data$script=props.data.script)!==null&&_props$data$script!==void 0?_props$data$script:props.editorRef.current?props.editorRef.current.getValue().replace(/\r\n/g,`
`):"",formRef=(0,react__WEBPACK_IMPORTED_MODULE_3__.useRef)(),result=[],keys=[],_i=0,_arr=[/@form\s+({[^*]+?}\n)/g,/Form\(([\s\S]+?)\)/g];_i<_arr.length;_i++){var pattern=_arr[_i],matches=content.matchAll(pattern),_iterator=_Users_a1_6_Code_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_createForOfIteratorHelper_js__WEBPACK_IMPORTED_MODULE_1___default()(matches),_step;try{var _loop=function _loop(){var match=_step.value;try{var _a=function(_){for(var o in _)_[o].dataIndex&&(_[o].key=_[o].dataIndex),_[o].key&&keys.push(_[o].key),_[o].required&&!_[o].formItemProps&&(_[o].formItemProps={rules:[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]}),_[o].columns&&(_[o].columns=_a(_[o].columns));return _},formObject=eval("(".concat(match[1],")"));(0,lodash__WEBPACK_IMPORTED_MODULE_2__.isArray)(formObject)||(formObject=[formObject]),result=result.concat(formObject),keys=[],result=_a(result)}catch(l){console.log("form\u8868\u5355\u89E3\u6790\u9519\u8BEF",l)}};for(_iterator.s();!(_step=_iterator.n()).done;)_loop()}catch(l){_iterator.e(l)}finally{_iterator.f()}}var dbkey="plugin_debug."+props.data.id;result.push({key:dbkey,title:"\u8C03\u8BD5\u5F00\u5173",valueType:"switch"}),keys.push(dbkey);var disable_key="plugin_disable."+props.data.id;keys.push(disable_key),(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(function(){disable==null&&(0,_umijs_max__WEBPACK_IMPORTED_MODULE_5__.request)("/api/storage",{params:{keys:keys.join(",")}}).then(function(l){if(l&&l.data){var _;for(var o in l.data)l.data[o]=="false"&&(l.data[o]=!1),l.data[o]==""&&delete l.data[o];(_=formRef.current)===null||_===void 0||_.setFieldsValue(l.data),setDisable(l.data[disable_key])}})});var _useState=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(void 0),_useState2=_Users_a1_6_Code_sillyPage_node_modules_pnpm_babel_runtime_7_21_0_node_modules_babel_runtime_helpers_slicedToArray_js__WEBPACK_IMPORTED_MODULE_0___default()(_useState,2),disable=_useState2[0],setDisable=_useState2[1];return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(antd__WEBPACK_IMPORTED_MODULE_7__.Z,{title:"\u53C2\u6570\u914D\u7F6E",open:props.open,onCancel:props.onCancel,onOk:function l(){var _,o=formRef==null||(_=formRef.current)===null||_===void 0?void 0:_.getFieldsValue();(0,_submit__WEBPACK_IMPORTED_MODULE_4__.Z)({values:o,params:{uuid:props.data.id}}).then(function(y){(y==null?void 0:y.changes[dbkey])==!0&&props.setDebug&&props.setDebug(o[dbkey]),(y==null?void 0:y.changes[disable_key])==!0&&props.setDebug&&props.setDisable(o[disable_key])}).finally(function(){props.onCancel()})},children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsxs)(_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_8__.A,{formRef,submitter:!1,children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_9__.Z,{layoutType:"Embed",columns:result}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_6__.jsx)(_ant_design_pro_components__WEBPACK_IMPORTED_MODULE_10__.Z,{label:"\u7981\u7528\u5F00\u5173",name:disable_key,fieldProps:{onChange:function l(_){setDisable(_)},style:{backgroundColor:disable?"red":""}}})]})})}},58160:function(l,_,o){o.r(_),o.d(_,{default:function(){return rt}});var y=o(25359),R=o.n(y),I=o(49811),G=o.n(I),T=o(54306),V=o.n(T),we=o(25367),je=o(34316),be=o(87474);function B(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ie(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function Y(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?ie(Object(t),!0).forEach(function(n){B(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ie(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function ue(e,r){if(e==null)return{};var t={},n=Object.keys(e),a,i;for(i=0;i<n.length;i++)a=n[i],!(r.indexOf(a)>=0)&&(t[a]=e[a]);return t}function _e(e,r){if(e==null)return{};var t=ue(e,r),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function se(e,r){return le(e)||ce(e,r)||de(e,r)||Ae()}function le(e){if(Array.isArray(e))return e}function ce(e,r){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(e)))){var t=[],n=!0,a=!1,i=void 0;try{for(var f=e[Symbol.iterator](),b;!(n=(b=f.next()).done)&&(t.push(b.value),!(r&&t.length===r));n=!0);}catch(h){a=!0,i=h}finally{try{!n&&f.return!=null&&f.return()}finally{if(a)throw i}}return t}}function de(e,r){if(e){if(typeof e=="string")return fe(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(e);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return fe(e,r)}}function fe(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Ae(){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 J(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Pe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function A(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?Pe(Object(t),!0).forEach(function(n){J(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Pe(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function pe(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return function(n){return r.reduceRight(function(a,i){return i(a)},n)}}function F(e){return function r(){for(var t=this,n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return a.length>=e.length?e.apply(this,a):function(){for(var f=arguments.length,b=new Array(f),h=0;h<f;h++)b[h]=arguments[h];return r.apply(t,[].concat(a,b))}}}function Q(e){return{}.toString.call(e).includes("Object")}function He(e){return!Object.keys(e).length}function ve(e){return typeof e=="function"}function Ne(e,r){return Object.prototype.hasOwnProperty.call(e,r)}function qe(e,r){return Q(r)||x("changeType"),Object.keys(r).some(function(t){return!Ne(e,t)})&&x("changeField"),r}function Ge(e){ve(e)||x("selectorType")}function Ye(e){ve(e)||Q(e)||x("handlerType"),Q(e)&&Object.values(e).some(function(r){return!ve(r)})&&x("handlersType")}function Je(e){e||x("initialIsRequired"),Q(e)||x("initialType"),He(e)&&x("initialContent")}function Qe(e,r){throw new Error(e[r]||e.default)}var Xe={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"},x=F(Qe)(Xe),Me={changes:qe,selector:Ge,handler:Ye,initial:Je};function er(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Me.initial(e),Me.handler(r);var t={current:e},n=F(nr)(t,r),a=F(tr)(t),i=F(Me.changes)(e),f=F(rr)(t);function b(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(U){return U};return Me.selector(M),M(t.current)}function h(M){pe(n,a,i,f)(M)}return[b,h]}function rr(e,r){return ve(r)?r(e.current):r}function tr(e,r){return e.current=A(A({},e.current),r),r}function nr(e,r,t){return ve(r)?r(e.current):Object.keys(t).forEach(function(n){var a;return(a=r[n])===null||a===void 0?void 0:a.call(r,e.current[n])}),t}var ar={create:er},or=ar,ir={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.36.1/min/vs"}},ur=ir;function _r(e){return function r(){for(var t=this,n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return a.length>=e.length?e.apply(this,a):function(){for(var f=arguments.length,b=new Array(f),h=0;h<f;h++)b[h]=arguments[h];return r.apply(t,[].concat(a,b))}}}var sr=_r;function lr(e){return{}.toString.call(e).includes("Object")}var cr=lr;function dr(e){return e||Ue("configIsRequired"),cr(e)||Ue("configType"),e.urls?(fr(),{paths:{vs:e.urls.monacoBase}}):e}function fr(){console.warn(Le.deprecation)}function pr(e,r){throw new Error(e[r]||e.default)}var Le={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
`},Ue=sr(pr)(Le),vr={config:dr},gr=vr,mr=function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return function(a){return t.reduceRight(function(i,f){return f(i)},a)}},hr=mr;function Se(e,r){return Object.keys(r).forEach(function(t){r[t]instanceof Object&&e[t]&&Object.assign(r[t],Se(e[t],r[t]))}),Y(Y({},e),r)}var Or=Se,Er={type:"cancelation",msg:"operation is manually canceled"};function br(e){var r=!1,t=new Promise(function(n,a){e.then(function(i){return r?a(Er):n(i)}),e.catch(a)});return t.cancel=function(){return r=!0},t}var Ce=br,Pr=or.create({config:ur,isInitialized:!1,resolve:null,reject:null,monaco:null}),Ke=se(Pr,2),ge=Ke[0],ye=Ke[1];function Mr(e){var r=gr.config(e),t=r.monaco,n=_e(r,["monaco"]);ye(function(a){return{config:Or(a.config,n),monaco:t}})}function yr(){var e=ge(function(r){var t=r.monaco,n=r.isInitialized,a=r.resolve;return{monaco:t,isInitialized:n,resolve:a}});if(!e.isInitialized){if(ye({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Ce(Re);if(window.monaco&&window.monaco.editor)return We(window.monaco),e.resolve(window.monaco),Ce(Re);hr(Dr,jr)(Cr)}return Ce(Re)}function Dr(e){return document.body.appendChild(e)}function wr(e){var r=document.createElement("script");return e&&(r.src=e),r}function jr(e){var r=ge(function(n){var a=n.config,i=n.reject;return{config:a,reject:i}}),t=wr("".concat(r.config.paths.vs,"/loader.js"));return t.onload=function(){return e()},t.onerror=r.reject,t}function Cr(){var e=ge(function(t){var n=t.config,a=t.resolve,i=t.reject;return{config:n,resolve:a,reject:i}}),r=window.require;r.config(e.config),r(["vs/editor/editor.main"],function(t){We(t),e.resolve(t)},function(t){e.reject(t)})}function We(e){ge().monaco||ye({monaco:e})}function Rr(){return ge(function(e){var r=e.monaco;return r})}var Re=new Promise(function(e,r){return ye({resolve:e,reject:r})}),Ir={config:Mr,init:yr,__getMonacoInstance:Rr},Be=Ir,s=o(50959),Tr={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Ie=Tr,Ar={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Lr=Ar;function Ur({children:e}){return s.createElement("div",{style:Lr.container},e)}var Sr=Ur,Kr=Sr;function Wr({width:e,height:r,isEditorReady:t,loading:n,_ref:a,className:i,wrapperProps:f}){return s.createElement("section",q({style:ze(q({},Ie.wrapper),{width:e,height:r})},f),!t&&s.createElement(Kr,null,n),s.createElement("div",{ref:a,style:q(q({},Ie.fullWidth),!t&&Ie.hide),className:i}))}var Br=Wr,xe=(0,s.memo)(Br);function xr(e){(0,s.useEffect)(e,[])}var Te=xr;function kr(e,r,t=!0){let n=(0,s.useRef)(!0);(0,s.useEffect)(n.current||!t?()=>{n.current=!1}:e,r)}var D=kr;function me(){}function X(e,r,t,n){return Zr(e,n)||$r(e,r,t,n)}function Zr(e,r){return e.editor.getModel(ke(e,r))}function $r(e,r,t,n){return e.editor.createModel(r,t,n?ke(e,n):void 0)}function ke(e,r){return e.Uri.parse(r)}function Vr({original:e,modified:r,language:t,originalLanguage:n,modifiedLanguage:a,originalModelPath:i,modifiedModelPath:f,keepCurrentOriginalModel:b=!1,keepCurrentModifiedModel:h=!1,theme:M="light",loading:U="Loading...",options:C={},height:ee="100%",width:z="100%",className:re,wrapperProps:Z={},beforeMount:te=me,onMount:H=me}){let[P,N]=(0,s.useState)(!1),[S,O]=(0,s.useState)(!0),E=(0,s.useRef)(null),m=(0,s.useRef)(null),w=(0,s.useRef)(null),p=(0,s.useRef)(H),c=(0,s.useRef)(te),L=(0,s.useRef)(!1);Te(()=>{let u=Be.init();return u.then(v=>(m.current=v)&&O(!1)).catch(v=>(v==null?void 0:v.type)!=="cancelation"&&console.error("Monaco initialization: error:",v)),()=>E.current?ne():u.cancel()}),D(()=>{let u=E.current.getModifiedEditor();u.getOption(m.current.editor.EditorOption.readOnly)?u.setValue(r||""):r!==u.getValue()&&(u.executeEdits("",[{range:u.getModel().getFullModelRange(),text:r||"",forceMoveMarkers:!0}]),u.pushUndoStop())},[r],P),D(()=>{var u,v;(v=(u=E.current)==null?void 0:u.getModel())==null||v.original.setValue(e||"")},[e],P),D(()=>{let{original:u,modified:v}=E.current.getModel();m.current.editor.setModelLanguage(u,n||t||"text"),m.current.editor.setModelLanguage(v,a||t||"text")},[t,n,a],P),D(()=>{var u;(u=m.current)==null||u.editor.setTheme(M)},[M],P),D(()=>{var u;(u=E.current)==null||u.updateOptions(C)},[C],P);let K=(0,s.useCallback)(()=>{var $;if(!m.current)return;c.current(m.current);let u=X(m.current,e||"",n||t||"text",i||""),v=X(m.current,r||"",a||t||"text",f||"");($=E.current)==null||$.setModel({original:u,modified:v})},[t,r,a,e,n,i,f]),W=(0,s.useCallback)(()=>{var u;!L.current&&w.current&&(E.current=m.current.editor.createDiffEditor(w.current,q({automaticLayout:!0},C)),K(),(u=m.current)==null||u.editor.setTheme(M),N(!0),L.current=!0)},[C,M,K]);(0,s.useEffect)(()=>{P&&p.current(E.current,m.current)},[P]),(0,s.useEffect)(()=>{!S&&!P&&W()},[S,P,W]),D(()=>{if(E.current&&m.current){let u=E.current.getOriginalEditor(),v=X(m.current,e||"",n||t||"text",i||"");v!==u.getModel()&&u.setModel(v)}},[i],P),D(()=>{if(E.current&&m.current){let u=E.current.getModifiedEditor(),v=X(m.current,r||"",a||t||"text",f||"");v!==u.getModel()&&u.setModel(v)}},[f],P);function ne(){var v,$,ae,Oe;let u=(v=E.current)==null?void 0:v.getModel();b||(($=u==null?void 0:u.original)==null||$.dispose()),h||((ae=u==null?void 0:u.modified)==null||ae.dispose()),(Oe=E.current)==null||Oe.dispose()}return s.createElement(xe,{width:z,height:ee,isEditorReady:P,loading:U,_ref:w,className:re,wrapperProps:Z})}var Fr=Vr,_t=(0,s.memo)(Fr);function st(){let[e,r]=It(ct.__getMonacoInstance());return Te(()=>{let t;return e||(t=ct.init(),t.then(n=>{r(n)})),()=>t==null?void 0:t.cancel()}),e}var lt=null;function zr(e){let r=(0,s.useRef)();return(0,s.useEffect)(()=>{r.current=e},[e]),r.current}var Hr=zr,De=new Map;function Nr({defaultValue:e,defaultLanguage:r,defaultPath:t,value:n,language:a,path:i,theme:f="light",line:b,loading:h="Loading...",options:M={},overrideServices:U={},saveViewState:C=!0,keepCurrentModel:ee=!1,width:z="100%",height:re="100%",className:Z,wrapperProps:te={},beforeMount:H=me,onMount:P=me,onChange:N,onValidate:S=me}){let[O,E]=(0,s.useState)(!1),[m,w]=(0,s.useState)(!0),p=(0,s.useRef)(null),c=(0,s.useRef)(null),L=(0,s.useRef)(null),K=(0,s.useRef)(P),W=(0,s.useRef)(H),ne=(0,s.useRef)(),u=(0,s.useRef)(n),v=Hr(i),$=(0,s.useRef)(!1),ae=(0,s.useRef)(!1);Te(()=>{let d=Be.init();return d.then(g=>(p.current=g)&&w(!1)).catch(g=>(g==null?void 0:g.type)!=="cancelation"&&console.error("Monaco initialization: error:",g)),()=>c.current?tt():d.cancel()}),D(()=>{var g,j,Ee,oe;let d=X(p.current,e||n||"",r||a||"",i||t||"");d!==((g=c.current)==null?void 0:g.getModel())&&(C&&De.set(v,(j=c.current)==null?void 0:j.saveViewState()),(Ee=c.current)==null||Ee.setModel(d),C&&((oe=c.current)==null||oe.restoreViewState(De.get(i))))},[i],O),D(()=>{var d;(d=c.current)==null||d.updateOptions(M)},[M],O),D(()=>{!c.current||n===void 0||(c.current.getOption(p.current.editor.EditorOption.readOnly)?c.current.setValue(n):n!==c.current.getValue()&&(ae.current=!0,c.current.executeEdits("",[{range:c.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),c.current.pushUndoStop(),ae.current=!1))},[n],O),D(()=>{var g,j;let d=(g=c.current)==null?void 0:g.getModel();d&&a&&((j=p.current)==null||j.editor.setModelLanguage(d,a))},[a],O),D(()=>{var d;b!==void 0&&((d=c.current)==null||d.revealLine(b))},[b],O),D(()=>{var d;(d=p.current)==null||d.editor.setTheme(f)},[f],O);let Oe=(0,s.useCallback)(()=>{var d;if(!(!L.current||!p.current)&&!$.current){W.current(p.current);let g=i||t,j=X(p.current,n||e||"",r||a||"",g||"");c.current=(d=p.current)==null?void 0:d.editor.create(L.current,q({model:j,automaticLayout:!0},M),U),C&&c.current.restoreViewState(De.get(g)),p.current.editor.setTheme(f),E(!0),$.current=!0}},[e,r,t,n,a,i,M,U,C,f]);(0,s.useEffect)(()=>{O&&K.current(c.current,p.current)},[O]),(0,s.useEffect)(()=>{!m&&!O&&Oe()},[m,O,Oe]),u.current=n,(0,s.useEffect)(()=>{var d,g;O&&N&&((d=ne.current)==null||d.dispose(),ne.current=(g=c.current)==null?void 0:g.onDidChangeModelContent(j=>{ae.current||N(c.current.getValue(),j)}))},[O,N]),(0,s.useEffect)(()=>{if(O){let d=p.current.editor.onDidChangeMarkers(g=>{var Ee;let j=(Ee=c.current.getModel())==null?void 0:Ee.uri;if(j&&g.find(oe=>oe.path===j.path)){let oe=p.current.editor.getModelMarkers({resource:j});S==null||S(oe)}});return()=>{d==null||d.dispose()}}return()=>{}},[O,S]);function tt(){var d,g;(d=ne.current)==null||d.dispose(),ee?C&&De.set(i,c.current.saveViewState()):(g=c.current.getModel())==null||g.dispose(),c.current.dispose()}return s.createElement(xe,{width:z,height:re,isEditorReady:O,loading:h,_ref:L,className:Z,wrapperProps:te})}var qr=Nr,Gr=(0,s.memo)(qr),Yr=Gr,Jr=o(12472),he=o(86195),Ze=o(26572),Qr=o(83187),k=o(11527),$e="???xxxooxox",Xr=`/**
* @title \u65E0\u540D\u811A\u672C
*/`,et=function(r){var t,n,a=(0,he.useModel)("@@initialState"),i=a.initialState,f=a.refresh,b=(0,s.useState)(!1),h=V()(b,2),M=h[0],U=h[1],C=(0,s.useState)($e),ee=V()(C,2),z=ee[0],re=ee[1],Z=(0,s.useRef)(null),te=i==null||(t=i.currentUser)===null||t===void 0?void 0:t.plugins[(i==null||(n=i.currentUser)===null||n===void 0?void 0:n.plugins.length)-1].path,H=te.indexOf(r.id)!=-1,P=(0,he.useRequest)(function(){return H?new Promise(function(w){var p={success:!0};p["plugins."+r.id]="",w(p)}):(0,he.request)("/api/storage",{params:{keys:["plugins."+r.id].join(",")}})}),N=P.data,S=P.error,O=P.loading;if(O)return(0,k.jsx)(we.Z,{});if(S)return(0,je.Z)(),null;z==$e&&re(H?Xr:N["plugins."+r.id]);var E=function(){var w=G()(R()().mark(function p(){var c,L,K,W;return R()().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return c=Z.current?Z.current.getValue().replace(/\r\n/g,`
`):z,L={},L["plugins."+r.id]=c,u.next=5,(0,be.Z)({values:L});case 5:K=u.sent,W=K==null?void 0:K.messages["plugins."+r.id],W?W=="\u6807\u9898\u53D8\u66F4\u3002"?f():re(W):H?f():c==""&&(he.history.push(te),f());case 8:case"end":return u.stop()}},p)}));return function(){return w.apply(this,arguments)}}(),m=function(p){p.key==="s"&&(p.ctrlKey||p.metaKey)&&(p.preventDefault(),E())};return(0,k.jsxs)(Jr._z,{extra:[(0,k.jsx)(Ze.ZP,{type:"primary",onClick:function(){U(!0)},children:"\u8868\u5355"},"2"),(0,k.jsx)(Ze.ZP,{type:"primary",onClick:E,children:"\u4FDD\u5B58"},"1")],children:[(0,k.jsx)("div",{onKeyDown:m,children:(0,k.jsx)(Yr,{defaultLanguage:"javascript",value:z,height:"1000px",options:{fontSize:12,lineNumbersMinChars:3,folding:!1,glyphMargin:!1},onMount:function(p){Z.current=p}})}),M&&(0,k.jsx)(Qr.Z,{data:{id:r.id},open:M,onCancel:function(){U(!1)},editorRef:Z})]})},rt=function(){var e=(0,he.useParams)();return(0,k.jsx)(et,{id:e.id},e.id)}},87474:function(l,_,o){var y=o(25359),R=o.n(y),I=o(49811),G=o.n(I),T=o(21362),V=o(86195),we=function(){var je=G()(R()().mark(function be(B){var ie,Y,ue,_e,se,le,ce,de,fe;return R()().wrap(function(J){for(;;)switch(J.prev=J.next){case 0:return ie=B.values,Y=B.loading,ue=Y===void 0?"\u6B63\u5728\u63D0\u4EA4\u66F4\u6539..":Y,_e=B.success,se=_e===void 0?"\u63D0\u4EA4\u6210\u529F\uFF01":_e,le=B.fail,ce=le===void 0?"\u63D0\u4EA4\u5931\u8D25":le,de=B.params,fe=de===void 0?{}:de,ue&&T.ZP.loading(ue,2e4),J.abrupt("return",new Promise(function(Pe){(0,V.request)("/api/storage",{params:fe,method:"put",data:ie}).then(function(A){var pe;if(T.ZP.destroy(),(A==null||(pe=A.data)===null||pe===void 0?void 0:pe.isLogin)==!1){T.ZP.warning("\u767B\u5F55\u5931\u6548\uFF01",2);var F=new URL(window.location.href).searchParams,Q=F.get("redirect");window.location.pathname!=="/user/login"&&!Q&&V.history.replace({pathname:"/user/login"});return}A!=null&&A.success?se&&T.ZP.success(se,1):ce&&T.ZP.warning(ce,2),Pe(A)})}));case 3:case"end":return J.stop()}},be)}));return function(B){return je.apply(this,arguments)}}();_.Z=we}}]);