UNPKG

filecat

Version:
2 lines 26.5 kB
/*! For license information please see 962.a01d935236eddfcd5325.js.LICENSE.txt */ (self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[627,962],{5219(t){!function(){var e=function(t,n){var r=this;e.count=(e.count||0)+1,this.count=e.count,this.isOpened=!1,this.input=i(t),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("aria-autocomplete","list"),this.input.setAttribute("aria-expanded","false"),this.input.setAttribute("aria-controls","awesomplete_list_"+this.count),this.input.setAttribute("aria-owns","awesomplete_list_"+this.count),this.input.setAttribute("role","combobox"),this.options=n=n||{},function(t,e,n){for(var r in e){var i=e[r],o=t.input.getAttribute("data-"+r.toLowerCase());t[r]="number"==typeof i?parseInt(o):!1===i?null!==o:i instanceof Function?null:o,t[r]||0===t[r]||(t[r]=r in n?n[r]:i)}}(this,{minChars:2,maxItems:10,autoFirst:!1,data:e.DATA,filter:e.FILTER_CONTAINS,sort:!1!==n.sort&&e.SORT_BYLENGTH,container:e.CONTAINER,item:e.ITEM,replace:e.REPLACE,tabSelect:!1,listLabel:"Results List",statusNoResults:"No results found",statusXResults:"{0} results found",statusTypeXChar:"Type {0} or more characters for results"},n),this.index=-1,this.container=this.container(t),this.ul=i.create("ul",{hidden:"hidden",role:"listbox",id:"awesomplete_list_"+this.count,inside:this.container,"aria-label":this.listLabel}),this.status=i.create("span",{className:"visually-hidden",role:"status","aria-live":"assertive","aria-atomic":!0,inside:this.container,textContent:""}),this._events={input:{input:this.evaluate.bind(this),blur:this.close.bind(this,{reason:"blur"}),keydown:function(t){var e=t.keyCode;r.opened&&(13===e&&r.selected||9===e&&r.selected&&r.tabSelect?(t.preventDefault(),r.select(void 0,void 0,t)):27===e?r.close({reason:"esc"}):38!==e&&40!==e||(t.preventDefault(),r[38===e?"previous":"next"]()))}},form:{submit:this.close.bind(this,{reason:"submit"})},ul:{mousedown:function(t){t.preventDefault()},click:function(t){var e=t.target;if(e!==this){for(;e&&!/li/i.test(e.nodeName);)e=e.parentNode;e&&0===t.button&&(t.preventDefault(),r.select(e,t.target,t))}}}},i.bind(this.input,this._events.input),i.bind(this.input.form,this._events.form),i.bind(this.ul,this._events.ul),this.input.hasAttribute("list")?(this.list="#"+this.input.getAttribute("list"),this.input.removeAttribute("list")):this.list=this.input.getAttribute("data-list")||n.list||[],e.all.push(this)};function n(t){var e=Array.isArray(t)?{label:t[0],value:t[1]}:"object"==typeof t&&"label"in t&&"value"in t?t:{label:t,value:t};this.label=e.label||e.value,this.value=e.value}e.prototype={set list(t){if(Array.isArray(t))this._list=t;else if("string"==typeof t&&t.indexOf(",")>-1)this._list=t.split(/\s*,\s*/);else if((t=i(t))&&t.children){var e=[];r.apply(t.children).forEach(function(t){if(!t.disabled){var n=t.textContent.trim(),r=t.value||n,i=t.label||n;""!==r&&e.push({label:i,value:r})}}),this._list=e}document.activeElement===this.input&&this.evaluate()},get selected(){return this.index>-1},get opened(){return this.isOpened},close:function(t){this.opened&&(this.input.setAttribute("aria-expanded","false"),this.ul.setAttribute("hidden",""),this.isOpened=!1,this.index=-1,this.status.setAttribute("hidden",""),this.input.setAttribute("aria-activedescendant",""),i.fire(this.input,"awesomplete-close",t||{}))},open:function(){this.input.setAttribute("aria-expanded","true"),this.ul.removeAttribute("hidden"),this.isOpened=!0,this.status.removeAttribute("hidden"),this.autoFirst&&-1===this.index&&this.goto(0),i.fire(this.input,"awesomplete-open")},destroy:function(){if(i.unbind(this.input,this._events.input),i.unbind(this.input.form,this._events.form),!this.options.container){var t=this.container.parentNode;t.insertBefore(this.input,this.container),t.removeChild(this.container)}this.input.removeAttribute("autocomplete"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-owns"),this.input.removeAttribute("role");var n=e.all.indexOf(this);-1!==n&&e.all.splice(n,1)},next:function(){var t=this.ul.children.length;this.goto(this.index<t-1?this.index+1:t?0:-1)},previous:function(){var t=this.ul.children.length,e=this.index-1;this.goto(this.selected&&-1!==e?e:t-1)},goto:function(t){var e=this.ul.children;this.selected&&e[this.index].setAttribute("aria-selected","false"),this.index=t,t>-1&&e.length>0&&(e[t].setAttribute("aria-selected","true"),this.input.setAttribute("aria-activedescendant",this.ul.id+"_item_"+this.index),this.ul.scrollTop=e[t].offsetTop-this.ul.clientHeight+e[t].clientHeight,i.fire(this.input,"awesomplete-highlight",{text:this.suggestions[this.index]}))},select:function(t,e,n){if(t?this.index=i.siblingIndex(t):t=this.ul.children[this.index],t){var r=this.suggestions[this.index];i.fire(this.input,"awesomplete-select",{text:r,origin:e||t,originalEvent:n})&&(this.replace(r),this.close({reason:"select"}),i.fire(this.input,"awesomplete-selectcomplete",{text:r,originalEvent:n}))}},evaluate:function(){var t=this,e=this.input.value;e.length>=this.minChars&&this._list&&this._list.length>0?(this.index=-1,this.ul.innerHTML="",this.suggestions=this._list.map(function(r){return new n(t.data(r,e))}).filter(function(n){return t.filter(n,e)}),!1!==this.sort&&(this.suggestions=this.suggestions.sort(this.sort)),this.suggestions=this.suggestions.slice(0,this.maxItems),this.suggestions.forEach(function(n,r){t.ul.appendChild(t.item(n,e,r))}),0===this.ul.children.length?(this.status.textContent=this.statusNoResults,this.close({reason:"nomatches"})):(this.input.setAttribute("aria-activedescendant",""),this.open(),this.status.textContent=this.statusXResults.replaceAll("{0}",this.ul.children.length))):(this.close({reason:"nomatches"}),this.minChar<=1||e.length>=this.minChars?this.status.textContent=this.statusNoResults:this.status.textContent=this.statusTypeXChar.replaceAll("{0}",this.minChars))}},e.all=[],e.FILTER_CONTAINS=function(t,e){return RegExp(i.regExpEscape(e.trim()),"i").test(t)},e.FILTER_STARTSWITH=function(t,e){return RegExp("^"+i.regExpEscape(e.trim()),"i").test(t)},e.SORT_BYLENGTH=function(t,e){return t.length!==e.length?t.length-e.length:t<e?-1:1},e.CONTAINER=function(t){return i.create("div",{className:"awesomplete",around:t})},e.ITEM=function(t,e,n){var r=""===e.trim()?t:t.replace(RegExp(i.regExpEscape(e.trim()),"gi"),"<mark>$&</mark>");return i.create("li",{innerHTML:r,role:"option","aria-selected":"false",tabindex:"-1",id:"awesomplete_list_"+this.count+"_item_"+n})},e.REPLACE=function(t){this.input.value=t.value},e.DATA=function(t){return t},Object.defineProperty(n.prototype=Object.create(String.prototype),"length",{get:function(){return this.label.length}}),n.prototype.toString=n.prototype.valueOf=function(){return""+this.label};var r=Array.prototype.slice;function i(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function o(t,e){return r.call((e||document).querySelectorAll(t))}function a(){o("input.awesomplete").forEach(function(t){new e(t)})}i.create=function(t,e){var n=document.createElement(t);for(var r in e){var o=e[r];if("inside"===r)i(o).appendChild(n);else if("around"===r){var a=i(o);a.parentNode.insertBefore(n,a),n.appendChild(a),null!=a.getAttribute("autofocus")&&a.focus()}else r in n?n[r]=o:n.setAttribute(r,o)}return n},i.bind=function(t,e){if(t)for(var n in e){var r=e[n];n.split(/\s+/).forEach(function(e){t.addEventListener(e,r)})}},i.unbind=function(t,e){if(t)for(var n in e){var r=e[n];n.split(/\s+/).forEach(function(e){t.removeEventListener(e,r)})}},i.fire=function(t,e,n){var r=document.createEvent("HTMLEvents");for(var i in r.initEvent(e,!0,!0),n)r[i]=n[i];return t.dispatchEvent(r)},i.regExpEscape=function(t){return t.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")},i.siblingIndex=function(t){for(var e=0;t=t.previousElementSibling;e++);return e},"undefined"!=typeof self&&(self.Awesomplete=e),"undefined"!=typeof Document&&("loading"!==document.readyState?a():document.addEventListener("DOMContentLoaded",a)),e.$=i,e.$$=o,t.exports&&(t.exports=e)}()},2674(t,e,n){"use strict";n.r(e),n.d(e,{default:()=>M});var r=n(6540),i=n(6417),o=n(7444),a=n(5997),s=n(7952),l=n(7022),u=n(4251);function c(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return f(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,s=0,l=t,h.n=n,a}};function p(n,r){for(s=n,l=r,e=0;!f&&u&&!i&&e<c.length;e++){var i,o=c[e],p=h.p,d=o[2];n>3?(i=d===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=n<2&&p<o[1])?(s=0,h.v=r,h.n=o[1]):p<d&&(i=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,h.n=d,s=0))}if(i||n>1)return a;throw f=!0,r}return function(i,c,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,d),s=c,l=d;(e=s<2?t:l)||!f;){o||(s?s<3?(s>1&&(h.n=-1),p(s,l)):h.n=l:h.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:f}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var h=[][r]?e(e([][r]())):(f(e={},r,function(){return this}),e),p=u.prototype=s.prototype=Object.create(h);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,f(t,i,"GeneratorFunction")),t.prototype=Object.create(p),t}return l.prototype=u,f(p,"constructor",u),f(u,"constructor",l),l.displayName="GeneratorFunction",f(u,i,"GeneratorFunction"),f(p),f(p,i,"Generator"),f(p,r,function(){return this}),f(p,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:d}})()}function f(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}f=function(t,e,n,r){function o(e,n){f(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},f(t,e,n,r)}function h(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function p(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){h(o,r,i,a,s,"next",t)}function s(t){h(o,r,i,a,s,"throw",t)}a(void 0)})}}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return m(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function v(t){var e=d((0,r.useState)(!1),2),n=e[0],i=e[1],o=d((0,r.useState)([]),2),a=o[0],s=o[1],f=function(t){s(t)},h=function(){var e=p(c().m(function e(){return c().w(function(e){for(;;)switch(e.n){case 0:if("folder"!==t.type){e.n=2;break}if(n||!t.click||a){e.n=1;break}return e.n=1,t.click(t,f,t.pre_path);case 1:i(!n),e.n=3;break;case 2:if(!t.click){e.n=3;break}return e.n=3,t.click(t,f,t.pre_path);case 3:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),m=function(){var e=p(c().m(function e(){var n,r=arguments;return c().w(function(e){for(;;)switch(e.n){case 0:if(n=r.length>0&&void 0!==r[0]&&r[0],"folder"!==t.type||n){e.n=2;break}return e.n=1,t.click(t,f,t.pre_path);case 1:e.n=3;break;case 2:t.fatherNowToggleExpansion&&t.fatherNowToggleExpansion();case 3:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return(0,r.useEffect)(function(){s(t.children)},[t.children]),r.createElement("div",{className:"studio-item"},r.createElement("div",{onClick:h,onContextMenu:function(e){e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),t.handleContextMenu&&t.handleContextMenu(e,t.name,t.pre_path,t.type===l.Iw.folder,m)},className:"studio-item-title"},r.createElement("i",{className:"material-icons studio-item-title-tag"},"file"==t.type?"":n?"arrow_drop_down":"arrow_right"),r.createElement("span",{className:"file-icons"},r.createElement("span",{"data-type":(0,u.uL)(t.name),"data-dir":"folder"===t.type,"aria-label":t.name},r.createElement("i",{className:"material-icons","aria-label":t.name}))),r.createElement("span",{className:"studio-item-name"},t.name)),n&&a&&r.createElement("div",{style:{marginLeft:20}},a.map(function(e,n){return r.createElement(r.Fragment,{key:n},r.createElement(v,{type:e.type,size:e.size,click:t.click,name:e.name,key:n,children:e.children,pre_path:"".concat(t.pre_path).concat(e.name).concat(e.type===l.Iw.folder?"/":""),handleContextMenu:t.handleContextMenu,fatherNowToggleExpansion:m}))})))}function y(t){return r.createElement("div",null,t.list.map(function(e,n){return r.createElement(v,{pre_path:"".concat(t.pre_path).concat(e.name).concat(e.type===l.Iw.folder?"/":""),key:n,name:e.name,type:e.type,handleContextMenu:t.handleContextMenu,fatherNowToggleExpansion:t.fatherNowToggleExpansion,children:e.children,click:t.click,size:e.size})}))}var b=n(4284),g=n(4289),w=n(3459),E=n(8247),x=n(2543),A=n.n(x),k=n(7690),_=n(2389),S=n(8815),C=n(7767);function T(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return N(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,s=0,l=t,h.n=n,a}};function p(n,r){for(s=n,l=r,e=0;!f&&u&&!i&&e<c.length;e++){var i,o=c[e],p=h.p,d=o[2];n>3?(i=d===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=n<2&&p<o[1])?(s=0,h.v=r,h.n=o[1]):p<d&&(i=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,h.n=d,s=0))}if(i||n>1)return a;throw f=!0,r}return function(i,c,d){if(u>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,d),s=c,l=d;(e=s<2?t:l)||!f;){o||(s?s<3?(s>1&&(h.n=-1),p(s,l)):h.n=l:h.v=l);try{if(u=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,l)))throw TypeError("iterator result is not an object");if(!e.done)return e;l=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(f=h.n<0)?l:n.call(r,h))!==a)break}catch(e){o=t,s=1,l=e}finally{u=1}}return{value:e,done:f}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}e=Object.getPrototypeOf;var c=[][r]?e(e([][r]())):(N(e={},r,function(){return this}),e),f=u.prototype=s.prototype=Object.create(c);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,N(t,i,"GeneratorFunction")),t.prototype=Object.create(f),t}return l.prototype=u,N(f,"constructor",u),N(u,"constructor",l),l.displayName="GeneratorFunction",N(u,i,"GeneratorFunction"),N(f),N(f,i,"Generator"),N(f,r,function(){return this}),N(f,"toString",function(){return"[object Generator]"}),(T=function(){return{w:o,m:h}})()}function N(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}N=function(t,e,n,r){function o(e,n){N(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},N(t,e,n,r)}function O(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=L(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function I(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function j(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){I(o,r,i,a,s,"next",t)}function s(t){I(o,r,i,a,s,"throw",t)}a(void 0)})}}function P(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(t,e)||L(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(t,e){if(t){if("string"==typeof t)return R(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(t,e):void 0}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var G=r.lazy(function(){return Promise.all([n.e(301),n.e(91)]).then(n.bind(n,4091))});function M(t){var e=P((0,r.useState)([]),2),n=e[0],c=e[1],f=P((0,r.useState)(""),2),h=f[0],p=f[1],d=P((0,r.useState)(""),2),m=(d[0],d[1]),v=P((0,r.useState)(!1),2),x=(v[0],v[1],P((0,r.useState)({path:"",name:""}),2)),N=x[0],I=x[1],L=P((0,r.useState)(""),2),R=L[0],M=L[1],F=P((0,o.L4)(i.AG.confirm),2),D=(F[0],F[1]),z=P((0,r.useState)(!1),2),$=z[0],H=z[1],B=P((0,o.L4)(i.AG.fileShellShow),2),U=B[0],X=B[1],K=P((0,o.L4)(i.AG.file_shell_hidden),2),Y=K[0],W=K[1],q=(0,r.useRef)(null),Z=(0,r.useRef)(null),J=P((0,r.useState)(!1),2),Q=J[0],V=J[1],tt=P((0,r.useState)(16),2),et=tt[0],nt=tt[1],rt=P((0,o.L4)(i.AG.showPrompt),2),it=(rt[0],rt[1]),ot=(0,_.Bd)().t,at=(0,C.Zp)(),st=(0,C.zy)().pathname.split("/").filter(Boolean).pop();st=decodeURIComponent(st);var lt=function(){var t=j(T().m(function t(){var e,n,r,i,o,a,s;return T().w(function(t){for(;;)switch(t.n){case 0:return e=(0,g.GG)("file",st),p(e),t.n=1,b.$M.post("studio/get/item",{path:e});case 1:if((n=t.v).code===w.m.Success){r=[],i=[],o=O(n.data.list);try{for(o.s();!(a=o.n()).done;)"folder"===(s=a.value).type?r.push(s):"file"===s.type&&i.push(s)}catch(t){o.e(t)}finally{o.f()}c([].concat(r,i))}case 2:return t.a(2)}},t)}));return function(){return t.apply(this,arguments)}}();(0,r.useEffect)(function(){m(""),I({}),H(!1),lt()},[]);var ut=function(){var t=j(T().m(function t(e,n){var r;return T().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,b.$M.get("".concat(encodeURIComponent(n)));case 1:r=t.v,m(r.data),E.xK.set_value_temp(r.data),I({path:n,name:e}),M(n);case 2:return t.a(2)}},t)}));return function(e,n){return t.apply(this,arguments)}}(),ct=function(t,e){t.size>S.o5?D({open:!0,handle:function(){ut(t.name,e),D({open:!1,handle:null}),H(!1)},title:"超过20MB了还要打开吗?"}):ut(t.name,e)},ft=function(){var t=j(T().m(function t(e,n,r){var i,o,a,s,l,u;return T().w(function(t){for(;;)switch(t.n){case 0:if("folder"!==e.type){t.n=2;break}return t.n=1,b.$M.post("studio/get/item",{path:"".concat(r)});case 1:if((i=t.v).code===w.m.Success){o=[],a=[],s=O(i.data.list);try{for(s.s();!(l=s.n()).done;)"folder"===(u=l.value).type?o.push(u):"file"===u.type&&a.push(u)}catch(t){s.e(t)}finally{s.f()}n([].concat(o,a))}t.n=4;break;case 2:if(!$){t.n=3;break}return D({open:!0,handle:function(){D({open:!1,handle:null}),H(!1),ct(e,r)},title:"确定不保存就切换吗?"}),t.a(2);case 3:ct(e,r);case 4:return t.a(2)}},t)}));return function(e,n,r){return t.apply(this,arguments)}}();function ht(){return pt.apply(this,arguments)}function pt(){return(pt=j(T().m(function t(){var e;return T().w(function(t){for(;;)switch(t.n){case 0:if($){t.n=1;break}return t.a(2);case 1:return e={context:E.xK.get_editor_value()},t.n=2,b.$M.post("save/".concat(encodeURIComponent(R)),e);case 2:0===t.v.code&&H(!1);case 3:return t.a(2)}},t)}))).apply(this,arguments)}var dt=function(t){t.ctrlKey&&"s"===t.key&&(t.preventDefault(),$&&ht())};(0,r.useEffect)(function(){return document.addEventListener("keydown",dt),function(){document.removeEventListener("keydown",dt)}},[$]);var mt=(0,r.useCallback)(A().throttle(function(t){var e=parseFloat(getComputedStyle(Z.current).fontSize),n=window.innerWidth/e-4,r=t.clientX/e,i=2.25+q.current.offsetWidth/e;r<=n&&r>=i&&nt(parseFloat(r.toFixed(2)))},32),[]),vt=function(){V(!1),Z.current.removeEventListener("pointermove",mt)},yt=[{r:ot("创建文件"),v:"创建文件"},{r:ot("创建目录"),v:"创建目录"},{r:ot("重命名"),v:"重命名"},{r:ot("删除"),v:"删除"}],bt=[{r:ot("重命名"),v:"重命名"},{r:ot("删除"),v:"删除"}],gt=function(t,e,n,r,i){t.preventDefault();var o=new u.ik;o.path=n,o.filename=e,o.x=t.clientX,o.y=t.clientY,o.items=r?yt:bt,i===lt&&(o.items=o.items.slice(0,2)),o.type=r?l.Iw.studio_folder:l.Iw.studio_file;var a=function(t){i(t)};o.textClick=function(t){switch(t){case"创建文件":it({show:!0,type:k.PromptEnum.FileNew,overlay:!0,data:{dir:n,call:a}});break;case"创建目录":it({show:!0,type:k.PromptEnum.DirNew,overlay:!0,data:{dir:n,call:a}});break;case"删除":if($&&(N.path===n||N.path.includes(n))){it({show:!0,type:k.PromptEnum.FilesDelete,overlay:!0,data:{path:n,call:function(){a(r),H(!1),I({}),m(""),E.xK.set_value_temp("")},filename:e}});break}it({show:!0,type:k.PromptEnum.FilesDelete,overlay:!0,data:{path:n,filename:e,call:r?function(){a(!0)}:a}});break;case"重命名":it({show:!0,type:k.PromptEnum.FileRename,overlay:!0,data:{path:n,dir:(0,g.Yp)(n),call:function(){a(!0)},filename:e}})}},it({show:!0,type:k.PromptEnum.FileMenu,overlay:!1,data:o})};return r.createElement("div",{className:"studio"},r.createElement(s.A,{ignore_tags:!0,left_children:[r.createElement(a.rA,{key:1,title:"取消",icon:"close",onClick:function(){X({show:!1,path:""}),W(void 0),at(-1)}}),r.createElement("title",{key:2},N.name)]},(0,u.zr)(N.name)&&r.createElement(a.rA,{title:"格式化",icon:"data_object",onClick:function(){var t;null===(t=E.xK.get_editor())||void 0===t||t.formatCode()}}),r.createElement(a.rA,{icon:"terminal",title:"shell",onClick:function(){void 0===Y?U.show?X({show:!1,path:""}):(X({show:!0,path:(0,g.GG)("file",st)}),W(!1)):W(!Y)}}),$&&r.createElement(a.rA,{title:"保存",icon:"save",onClick:ht})),r.createElement("div",{className:"studio-body",ref:Z},r.createElement("div",{className:"studio-nav",style:{width:"".concat(et-1,"em")},onContextMenu:function(t){gt(t,N.name,(0,g.GG)("file",st),!0,lt)}},r.createElement(y,{pre_path:h,list:n,click:ft,handleContextMenu:gt,fatherNowToggleExpansion:lt})),r.createElement("div",{className:"studio__divider",ref:q,onPointerDown:function(){V(!0),Z.current.addEventListener("pointermove",mt)},onPointerUp:vt}),Q&&r.createElement("div",{className:"shell__overlay",onPointerUp:vt}),r.createElement("div",{className:"studio-editor",key:N.path},N.name&&r.createElement(G,{name:N.name,on_change:function(){$||H(!0)}}))))}},1028(t,e,n){"use strict";n.d(e,{A:()=>s});var r=n(1601),i=n.n(r),o=n(6314),a=n.n(o)()(i());a.push([t.id,'.awesomplete [hidden] {\n display: none;\n}\n\n.awesomplete .visually-hidden {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n}\n\n.awesomplete {\n display: inline-block;\n position: relative;\n}\n\n.awesomplete > input {\n display: block;\n}\n\n.awesomplete > ul {\n position: absolute;\n left: 0;\n z-index: 1;\n min-width: 100%;\n box-sizing: border-box;\n list-style: none;\n padding: 0;\n margin: 0;\n background: #fff;\n}\n\n.awesomplete > ul:empty {\n display: none;\n}\n\n.awesomplete > ul {\n\tborder-radius: .3em;\n\tmargin: .2em 0 0;\n\tbackground: hsla(0,0%,100%,.9);\n\tbackground: linear-gradient(to bottom right, white, hsla(0,0%,100%,.8));\n\tborder: 1px solid rgba(0,0,0,.3);\n\tbox-shadow: .05em .2em .6em rgba(0,0,0,.2);\n\ttext-shadow: none;\n}\n\n@supports (transform: scale(0)) {\n\t.awesomplete > ul {\n\t\ttransition: .3s cubic-bezier(.4,.2,.5,1.4);\n\t\ttransform-origin: 1.43em -.43em;\n\t}\n\t\n\t.awesomplete > ul[hidden],\n\t.awesomplete > ul:empty {\n\t\topacity: 0;\n\t\ttransform: scale(0);\n\t\tdisplay: block;\n\t\tvisibility: hidden;\n\t\ttransition-timing-function: ease;\n\t}\n}\n\n\t/* Pointer */\n\t.awesomplete > ul:before {\n\t\tcontent: "";\n\t\tposition: absolute;\n\t\ttop: -.43em;\n\t\tleft: 1em;\n\t\twidth: 0; height: 0;\n\t\tpadding: .4em;\n\t\tbackground: white;\n\t\tborder: inherit;\n\t\tborder-right: 0;\n\t\tborder-bottom: 0;\n\t\t-webkit-transform: rotate(45deg);\n\t\ttransform: rotate(45deg);\n\t}\n\n\t.awesomplete > ul > li {\n\t\tposition: relative;\n\t\tpadding: .2em .5em;\n\t\tcursor: pointer;\n\t}\n\t\n\t.awesomplete > ul > li:hover {\n\t\tbackground: hsl(200, 40%, 80%);\n\t\tcolor: black;\n\t}\n\t\n\t.awesomplete > ul > li[aria-selected="true"] {\n\t\tbackground: hsl(205, 40%, 40%);\n\t\tcolor: white;\n\t}\n\t\n\t\t.awesomplete mark {\n\t\t\tbackground: hsl(65, 100%, 50%);\n\t\t}\n\t\t\n\t\t.awesomplete li:hover mark {\n\t\t\tbackground: hsl(68, 100%, 41%);\n\t\t}\n\t\t\n\t\t.awesomplete li[aria-selected="true"] mark {\n\t\t\tbackground: hsl(86, 100%, 21%);\n\t\t\tcolor: inherit;\n\t\t}\n',""]);const s=a},9145(t,e,n){"use strict";var r=n(5072),i=n.n(r),o=n(7825),a=n.n(o),s=n(7659),l=n.n(s),u=n(5056),c=n.n(u),f=n(540),h=n.n(f),p=n(1113),d=n.n(p),m=n(1028),v={};v.styleTagTransform=d(),v.setAttributes=c(),v.insert=l().bind(null,"head"),v.domAPI=a(),v.insertStyleElement=h();i()(m.A,v),m.A&&m.A.locals&&m.A.locals}}]);