2023年政策修订增补工作正在进行中,欢迎参与!
User:BearBin/js/FileInspector.js
< User:BearBin | js
注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox/Safari:按住“Shift”的同时单击“刷新”,或按“Ctrl-F5”或“Ctrl-R”(Mac为“⌘-R”)
- Google Chrome:按“Ctrl-Shift-R”(Mac为“⌘-Shift-R”)
- Internet Explorer:按住“Ctrl”的同时单击“刷新”,或按“Ctrl-F5”
- Opera:在“工具→首选项”中清除缓存
- 如果您已登录但该页面出现未登录状态,请尝试在地址栏的地址最后添加代码
?_=1
来访问最新页面。 - 添加代码后的本页地址如下:
-{R|https://moegirl.icu/User:BearBin/js/FileInspector.js?_=1}-
var _addText = '{{Documentation|content=* 工具介绍见[[User:BearBin/js#FileInspector]]。\n* 源代码见[https://github.com/BearBin1215/MoegirlPedia/blob/master/src/gadgets/FileInspector GitHub]。}}';
// <nowiki>
(()=>{"use strict";var e,t,n,r,o,_,u,i,l,c,a,s={},f=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d=Array.isArray;function m(e,t){for(var n in t)e[n]=t[n];return e}function h(e){var t=e.parentNode;t&&t.removeChild(e)}function v(t,n,r){var o,_,u,i={};for(u in n)"key"==u?o=n[u]:"ref"==u?_=n[u]:i[u]=n[u];if(arguments.length>2&&(i.children=arguments.length>3?e.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(u in t.defaultProps)void 0===i[u]&&(i[u]=t.defaultProps[u]);return y(t,i,o,_,null)}function y(e,r,o,_,u){var i={type:e,props:r,key:o,ref:_,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==u?++n:u,__i:-1,__u:0};return null==u&&null!=t.vnode&&t.vnode(i),i}function g(e){return e.children}function b(e,t){this.props=e,this.context=t}function k(e,t){if(null==t)return e.__?k(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?k(e):null}function w(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return w(e)}}function E(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!C.__r++||o!==t.debounceRendering)&&((o=t.debounceRendering)||_)(C)}function C(){var e,n,o,_,i,l,c,a;for(r.sort(u);e=r.shift();)e.__d&&(n=r.length,_=void 0,l=(i=(o=e).__v).__e,c=[],a=[],o.__P&&((_=m({},i)).__v=i.__v+1,t.vnode&&t.vnode(_),j(o.__P,_,i,o.__n,void 0!==o.__P.ownerSVGElement,32&i.__u?[l]:null,c,null==l?k(i):l,!!(32&i.__u),a),_.__v=i.__v,_.__.__k[_.__i]=_,D(c,_,a),_.__e!=l&&w(_)),r.length>n&&r.sort(u));C.__r=0}function N(e,t,n,r,o,_,u,i,l,c,a){var p,d,m,h,v,y=r&&r.__k||f,g=t.length;for(n.__d=l,x(n,t,y),l=n.__d,p=0;p<g;p++)null!=(m=n.__k[p])&&"boolean"!=typeof m&&"function"!=typeof m&&(d=-1===m.__i?s:y[m.__i]||s,m.__i=p,j(e,m,d,o,_,u,i,l,c,a),h=m.__e,m.ref&&d.ref!=m.ref&&(d.ref&&R(d.ref,null,m),a.push(m.ref,m.__c||h,m)),null==v&&null!=h&&(v=h),65536&m.__u||d.__k===m.__k?(l&&!l.isConnected&&(l=k(d)),l=S(m,l,e)):"function"==typeof m.type&&void 0!==m.__d?l=m.__d:h&&(l=h.nextSibling),m.__d=void 0,m.__u&=-196609);n.__d=l,n.__e=v}function x(e,t,n){var r,o,_,u,i,l=t.length,c=n.length,a=c,s=0;for(e.__k=[],r=0;r<l;r++)u=r+s,null!=(o=e.__k[r]=null==(o=t[r])||"boolean"==typeof o||"function"==typeof o?null:"string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?y(null,o,null,null,null):d(o)?y(g,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?y(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)?(o.__=e,o.__b=e.__b+1,i=U(o,n,u,a),o.__i=i,_=null,-1!==i&&(a--,(_=n[i])&&(_.__u|=131072)),null==_||null===_.__v?(-1==i&&s--,"function"!=typeof o.type&&(o.__u|=65536)):i!==u&&(i===u+1?s++:i>u?a>l-u?s+=i-u:s--:i<u?i==u-1&&(s=i-u):s=0,i!==r+s&&(o.__u|=65536))):(_=n[u])&&null==_.key&&_.__e&&!(131072&_.__u)&&(_.__e==e.__d&&(e.__d=k(_)),A(_,_,!1),n[u]=null,a--);if(a)for(r=0;r<c;r++)null!=(_=n[r])&&!(131072&_.__u)&&(_.__e==e.__d&&(e.__d=k(_)),A(_,_))}function S(e,t,n){var r,o;if("function"==typeof e.type){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=S(r[o],t,n));return t}e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8===t.nodeType);return t}function P(e,t){return t=t||[],null==e||"boolean"==typeof e||(d(e)?e.some((function(e){P(e,t)})):t.push(e)),t}function U(e,t,n,r){var o=e.key,_=e.type,u=n-1,i=n+1,l=t[n];if(null===l||l&&o==l.key&&_===l.type&&!(131072&l.__u))return n;if(r>(null==l||131072&l.__u?0:1))for(;u>=0||i<t.length;){if(u>=0){if((l=t[u])&&!(131072&l.__u)&&o==l.key&&_===l.type)return u;u--}if(i<t.length){if((l=t[i])&&!(131072&l.__u)&&o==l.key&&_===l.type)return i;i++}}return-1}function H(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||p.test(t)?n:n+"px"}function O(e,t,n,r,o){var _;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||H(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||H(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])_=t!==(t=t.replace(/(PointerCapture)$|Capture$/i,"$1")),t=t.toLowerCase()in e||"onFocusOut"===t||"onFocusIn"===t?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+_]=n,n?r?n.u=r.u:(n.u=i,e.addEventListener(t,_?c:l,_)):e.removeEventListener(t,_?c:l,_);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function T(e){return function(n){if(this.l){var r=this.l[n.type+e];if(null==n.t)n.t=i++;else if(n.t<r.u)return;return r(t.event?t.event(n):n)}}}function j(e,n,r,o,_,u,i,l,c,a){var s,f,p,h,v,y,k,w,E,C,x,S,P,U,H,$=n.type;if(void 0!==n.constructor)return null;128&r.__u&&(c=!!(32&r.__u),u=[l=n.__e=r.__e]),(s=t.__b)&&s(n);e:if("function"==typeof $)try{if(w=n.props,E=(s=$.contextType)&&o[s.__c],C=s?E?E.props.value:s.__:o,r.__c?k=(f=n.__c=r.__c).__=f.__E:("prototype"in $&&$.prototype.render?n.__c=f=new $(w,C):(n.__c=f=new b(w,C),f.constructor=$,f.render=L),E&&E.sub(f),f.props=w,f.state||(f.state={}),f.context=C,f.__n=o,p=f.__d=!0,f.__h=[],f._sb=[]),null==f.__s&&(f.__s=f.state),null!=$.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=m({},f.__s)),m(f.__s,$.getDerivedStateFromProps(w,f.__s))),h=f.props,v=f.state,f.__v=n,p)null==$.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),null!=f.componentDidMount&&f.__h.push(f.componentDidMount);else{if(null==$.getDerivedStateFromProps&&w!==h&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(w,C),!f.__e&&(null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(w,f.__s,C)||n.__v===r.__v)){for(n.__v!==r.__v&&(f.props=w,f.state=f.__s,f.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.forEach((function(e){e&&(e.__=n)})),x=0;x<f._sb.length;x++)f.__h.push(f._sb[x]);f._sb=[],f.__h.length&&i.push(f);break e}null!=f.componentWillUpdate&&f.componentWillUpdate(w,f.__s,C),null!=f.componentDidUpdate&&f.__h.push((function(){f.componentDidUpdate(h,v,y)}))}if(f.context=C,f.props=w,f.__P=e,f.__e=!1,S=t.__r,P=0,"prototype"in $&&$.prototype.render){for(f.state=f.__s,f.__d=!1,S&&S(n),s=f.render(f.props,f.state,f.context),U=0;U<f._sb.length;U++)f.__h.push(f._sb[U]);f._sb=[]}else do{f.__d=!1,S&&S(n),s=f.render(f.props,f.state,f.context),f.state=f.__s}while(f.__d&&++P<25);f.state=f.__s,null!=f.getChildContext&&(o=m(m({},o),f.getChildContext())),p||null==f.getSnapshotBeforeUpdate||(y=f.getSnapshotBeforeUpdate(h,v)),N(e,d(H=null!=s&&s.type===g&&null==s.key?s.props.children:s)?H:[H],n,r,o,_,u,i,l,c,a),f.base=n.__e,n.__u&=-161,f.__h.length&&i.push(f),k&&(f.__E=f.__=null)}catch(e){n.__v=null,c||null!=u?(n.__e=l,n.__u|=c?160:32,u[u.indexOf(l)]=null):(n.__e=r.__e,n.__k=r.__k),t.__e(e,n,r)}else null==u&&n.__v===r.__v?(n.__k=r.__k,n.__e=r.__e):n.__e=F(r.__e,n,r,o,_,u,i,c,a);(s=t.diffed)&&s(n)}function D(e,n,r){n.__d=void 0;for(var o=0;o<r.length;o++)R(r[o],r[++o],r[++o]);t.__c&&t.__c(n,e),e.some((function(n){try{e=n.__h,n.__h=[],e.some((function(e){e.call(n)}))}catch(e){t.__e(e,n.__v)}}))}function F(t,n,r,o,_,u,i,l,c){var a,f,p,m,v,y,g,b=r.props,w=n.props,E=n.type;if("svg"===E&&(_=!0),null!=u)for(a=0;a<u.length;a++)if((v=u[a])&&"setAttribute"in v==!!E&&(E?v.localName===E:3===v.nodeType)){t=v,u[a]=null;break}if(null==t){if(null===E)return document.createTextNode(w);t=_?document.createElementNS("http://www.w3.org/2000/svg",E):document.createElement(E,w.is&&w),u=null,l=!1}if(null===E)b===w||l&&t.data===w||(t.data=w);else{if(u=u&&e.call(t.childNodes),b=r.props||s,!l&&null!=u)for(b={},a=0;a<t.attributes.length;a++)b[(v=t.attributes[a]).name]=v.value;for(a in b)if(v=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)p=v;else if("key"!==a&&!(a in w)){if("value"==a&&"defaultValue"in w||"checked"==a&&"defaultChecked"in w)continue;O(t,a,null,v,_)}for(a in w)v=w[a],"children"==a?m=v:"dangerouslySetInnerHTML"==a?f=v:"value"==a?y=v:"checked"==a?g=v:"key"===a||l&&"function"!=typeof v||b[a]===v||O(t,a,v,b[a],_);if(f)l||p&&(f.__html===p.__html||f.__html===t.innerHTML)||(t.innerHTML=f.__html),n.__k=[];else if(p&&(t.innerHTML=""),N(t,d(m)?m:[m],n,r,o,_&&"foreignObject"!==E,u,i,u?u[0]:r.__k&&k(r,0),l,c),null!=u)for(a=u.length;a--;)null!=u[a]&&h(u[a]);l||(a="value",void 0!==y&&(y!==t[a]||"progress"===E&&!y||"option"===E&&y!==b[a])&&O(t,a,y,b[a],!1),a="checked",void 0!==g&&g!==t[a]&&O(t,a,g,b[a],!1))}return t}function R(e,n,r){try{"function"==typeof e?e(n):e.current=n}catch(e){t.__e(e,r)}}function A(e,n,r){var o,_;if(t.unmount&&t.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||R(o,null,n)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){t.__e(e,n)}o.base=o.__P=null}if(o=e.__k)for(_=0;_<o.length;_++)o[_]&&A(o[_],n,r||"function"!=typeof e.type);r||null==e.__e||h(e.__e),e.__c=e.__=e.__e=e.__d=void 0}function L(e,t,n){return this.constructor(e,n)}function W(n,r,o){var _,u,i,l;t.__&&t.__(n,r),u=(_="function"==typeof o)?null:o&&o.__k||r.__k,i=[],l=[],j(r,n=(!_&&o||r).__k=v(g,null,[n]),u||s,s,void 0!==r.ownerSVGElement,!_&&o?[o]:u?null:r.firstChild?e.call(r.childNodes):null,i,!_&&o?o:u?u.__e:r.firstChild,_,l),D(i,n,l)}function M(e,t){W(e,t,M)}function V(t,n,r){var o,_,u,i,l=m({},t.props);for(u in t.type&&t.type.defaultProps&&(i=t.type.defaultProps),n)"key"==u?o=n[u]:"ref"==u?_=n[u]:l[u]=void 0===n[u]&&void 0!==i?i[u]:n[u];return arguments.length>2&&(l.children=arguments.length>3?e.call(arguments,2):r),y(t.type,l,o||t.key,_||t.ref,null)}e=f.slice,t={__e:function(e,t,n,r){for(var o,_,u;t=t.__;)if((o=t.__c)&&!o.__)try{if((_=o.constructor)&&null!=_.getDerivedStateFromError&&(o.setState(_.getDerivedStateFromError(e)),u=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),u=o.__d),u)return o.__E=o}catch(t){e=t}throw e}},n=0,b.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=m({},this.state),"function"==typeof e&&(e=e(m({},n),this.props)),e&&m(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),E(this))},b.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),E(this))},b.prototype.render=g,r=[],_="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0,i=0,l=T(!1),c=T(!0),a=0;var q,I,B,z,G=0,Y=[],Z=[],J=t,K=J.__b,Q=J.__r,X=J.diffed,ee=J.__c,te=J.unmount,ne=J.__;function re(e,t){J.__h&&J.__h(I,e,G||t),G=0;var n=I.__H||(I.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Z}),n.__[e]}function oe(e){return G=1,_e(ke,e)}function _e(e,t,n){var r=re(q++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ke(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=I,!I.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter((function(e){return!!e.__c}));if(o.every((function(e){return!e.__N})))return!_||_.call(this,e,t,n);var u=!1;return o.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(u=!0)}})),!(!u&&r.__c.props===e)&&(!_||_.call(this,e,t,n))};I.u=!0;var _=I.shouldComponentUpdate,u=I.componentWillUpdate;I.componentWillUpdate=function(e,t,n){if(this.__e){var r=_;_=void 0,o(e,t,n),_=r}u&&u.call(this,e,t,n)},I.shouldComponentUpdate=o}return r.__N||r.__}function ue(e,t){var n=re(q++,3);!J.__s&&be(n.__H,t)&&(n.__=e,n.i=t,I.__H.__h.push(n))}function ie(e,t){var n=re(q++,4);!J.__s&&be(n.__H,t)&&(n.__=e,n.i=t,I.__h.push(n))}function le(e){return G=5,ae((function(){return{current:e}}),[])}function ce(e,t,n){G=6,ie((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==n?n:n.concat(e))}function ae(e,t){var n=re(q++,7);return be(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function se(e,t){return G=8,ae((function(){return e}),t)}function fe(e){var t=I.context[e.__c],n=re(q++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(I)),t.props.value):e.__}function pe(e,t){J.useDebugValue&&J.useDebugValue(t?t(e):e)}function de(){var e=re(q++,11);if(!e.__){for(var t=I.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function me(){for(var e;e=Y.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ye),e.__H.__h.forEach(ge),e.__H.__h=[]}catch(t){e.__H.__h=[],J.__e(t,e.__v)}}J.__b=function(e){I=null,K&&K(e)},J.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ne&&ne(e,t)},J.__r=function(e){Q&&Q(e),q=0;var t=(I=e.__c).__H;t&&(B===I?(t.__h=[],I.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Z,e.__N=e.i=void 0}))):(t.__h.forEach(ye),t.__h.forEach(ge),t.__h=[],q=0)),B=I},J.diffed=function(e){X&&X(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Y.push(t)&&z===J.requestAnimationFrame||((z=J.requestAnimationFrame)||ve)(me)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Z&&(e.__=e.__V),e.i=void 0,e.__V=Z}))),B=I=null},J.__c=function(e,t){t.some((function(e){try{e.__h.forEach(ye),e.__h=e.__h.filter((function(e){return!e.__||ge(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],J.__e(n,e.__v)}})),ee&&ee(e,t)},J.unmount=function(e){te&&te(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{ye(e)}catch(e){t=e}})),n.__H=void 0,t&&J.__e(t,n.__v))};var he="function"==typeof requestAnimationFrame;function ve(e){var t,n=function(){clearTimeout(r),he&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);he&&(t=requestAnimationFrame(n))}function ye(e){var t=I,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),I=t}function ge(e){var t=I;e.__c=e.__(),I=t}function be(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function ke(e,t){return"function"==typeof t?t(e):t}function we(e,t){for(var n in t)e[n]=t[n];return e}function Ee(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function Ce(e,t){this.props=e,this.context=t}(Ce.prototype=new b).isPureReactComponent=!0,Ce.prototype.shouldComponentUpdate=function(e,t){return Ee(this.props,e)||Ee(this.state,t)};var Ne=t.__b;t.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ne&&Ne(e)};var xe="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Se=function(e,t){return null==e?null:P(P(e).map(t))},Pe={map:Se,forEach:Se,count:function(e){return e?P(e).length:0},only:function(e){var t=P(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:P},Ue=t.__e;t.__e=function(e,t,n,r){if(e.then)for(var o,_=t;_=_.__;)if((o=_.__c)&&o.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t);Ue(e,t,n,r)};var He=t.unmount;function $e(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=we({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return $e(e,t,n)}))),e}function Oe(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return Oe(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Te(){this.__u=0,this.t=null,this.__b=null}function je(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function De(){this.u=null,this.o=null}t.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),He&&He(e)},(Te.prototype=new b).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var o=je(r.__v),_=!1,u=function(){_||(_=!0,n.__R=null,o?o(i):i())};n.__R=u;var i=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Oe(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(u,u)},Te.prototype.componentWillUnmount=function(){this.t=[]},Te.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=$e(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&v(g,null,e.fallback);return o&&(o.__u&=-33),[v(g,null,t.__a?null:e.children),o]};var Fe=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function Re(e){return this.getChildContext=function(){return e.context},e.children}function Ae(e){var t=this,n=e.i;t.componentWillUnmount=function(){W(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),W(v(Re,{context:t.context},e.__v),t.l)}(De.prototype=new b).__a=function(e){var t=this,n=je(t.__v),r=t.o.get(e);return r[0]++,function(o){var _=function(){t.props.revealOrder?(r.push(o),Fe(t,e,r)):o()};n?n(_):_()}},De.prototype.render=function(e){this.u=null,this.o=new Map;var t=P(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},De.prototype.componentDidUpdate=De.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){Fe(e,n,t)}))};var Le="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,We=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Me=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ve=/[A-Z0-9]/g,qe="undefined"!=typeof document,Ie=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};function Be(e,t,n){return null==t.__k&&(t.textContent=""),W(e,t),"function"==typeof n&&n(),e?e.__c:null}function ze(e,t,n){return M(e,t),"function"==typeof n&&n(),e?e.__c:null}b.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(b.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var Ge=t.event;function Ye(){}function Ze(){return this.cancelBubble}function Je(){return this.defaultPrevented}t.event=function(e){return Ge&&(e=Ge(e)),e.persist=Ye,e.isPropagationStopped=Ze,e.isDefaultPrevented=Je,e.nativeEvent=e};var Ke,Qe={enumerable:!1,configurable:!0,get:function(){return this.class}},Xe=t.vnode;t.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={};for(var o in t){var _=t[o];if(!("value"===o&&"defaultValue"in t&&null==_||qe&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var u=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===_?_="":"translate"===u&&"no"===_?_=!1:"ondoubleclick"===u?o="ondblclick":"onchange"!==u||"input"!==n&&"textarea"!==n||Ie(t.type)?"onfocus"===u?o="onfocusin":"onblur"===u?o="onfocusout":Me.test(o)?o=u:-1===n.indexOf("-")&&We.test(o)?o=o.replace(Ve,"-$&").toLowerCase():null===_&&(_=void 0):u=o="oninput","oninput"===u&&r[o=u]&&(o="oninputCapture"),r[o]=_}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=P(t.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==n&&null!=r.defaultValue&&(r.value=P(t.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Qe)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Le,Xe&&Xe(e)};var et=t.__r;t.__r=function(e){et&&et(e),Ke=e.__c};var tt=t.diffed;t.diffed=function(e){tt&&tt(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),Ke=null};var nt={ReactCurrentDispatcher:{current:{readContext:function(e){return Ke.__n[e.__c].props.value},useCallback:se,useContext:fe,useDebugValue:pe,useDeferredValue:it,useEffect:ue,useId:de,useImperativeHandle:ce,useInsertionEffect:ct,useLayoutEffect:ie,useMemo:ae,useReducer:_e,useRef:le,useState:oe,useSyncExternalStore:at,useTransition:lt}}};function rt(e){return!!e&&e.$$typeof===Le}function ot(e){return!!e.__k&&(W(null,e),!0)}var _t=g;function ut(e){e()}function it(e){return e}function lt(){return[!1,ut]}var ct=ie;function at(e,t){var n=t(),r=oe({h:{__:n,v:t}}),o=r[0].h,_=r[1];return ie((function(){o.__=n,o.v=t,st(o)&&_({h:o})}),[e,n,t]),ue((function(){return st(o)&&_({h:o}),e((function(){st(o)&&_({h:o})}))}),[e]),n}function st(e){var t,n,r=e.v,o=e.__;try{var _=r();return!((t=o)===(n=_)&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}}var ft={useState:oe,useId:de,useReducer:_e,useEffect:ue,useLayoutEffect:ie,useInsertionEffect:ct,useTransition:lt,useDeferredValue:it,useSyncExternalStore:at,startTransition:ut,useRef:le,useImperativeHandle:ce,useMemo:ae,useCallback:se,useContext:fe,useDebugValue:pe,version:"17.0.2",Children:Pe,render:Be,hydrate:ze,unmountComponentAtNode:ot,createPortal:function(e,t){var n=v(Ae,{__v:e,i:t});return n.containerInfo=t,n},createElement:v,createContext:function(e,t){var n={__c:t="__cC"+a++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,E(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n},createFactory:function(e){return v.bind(null,e)},cloneElement:function(e){return rt(e)?V.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:g,isValidElement:rt,isElement:rt,isFragment:function(e){return rt(e)&&e.type===g},isMemo:function(e){return!!e&&!!e.displayName&&("string"==typeof e.displayName||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:b,PureComponent:Ce,memo:function(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:Ee(this.props,e)}function r(t){return this.shouldComponentUpdate=n,v(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r},forwardRef:function(e){function t(t){var n=we({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=xe,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){return e(t)},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:_t,Suspense:Te,SuspenseList:De,lazy:function(e){var t,n,r;function o(o){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){r=e})),r)throw r;if(!n)throw t;return v(n,o)}return o.displayName="Lazy",o.__f=!0,o},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:nt};function pt(e){return{render(t){Be(t,e)},unmount(){ot(e)}}}const dt=function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var _=Array(o);++r<o;)_[r]=e[r+t];return _};const mt=function(e,t){return e===t||e!=e&&t!=t};const ht="object"==typeof global&&global&&global.Object===Object&&global;var vt="object"==typeof self&&self&&self.Object===Object&&self;const yt=(ht||vt||Function("return this")()).Symbol;var gt=Object.prototype,bt=gt.hasOwnProperty,kt=gt.toString,wt=yt?yt.toStringTag:void 0;const Et=function(e){var t=bt.call(e,wt),n=e[wt];try{e[wt]=void 0;var r=!0}catch(e){}var o=kt.call(e);return r&&(t?e[wt]=n:delete e[wt]),o};var Ct=Object.prototype.toString;const Nt=function(e){return Ct.call(e)};var xt=yt?yt.toStringTag:void 0;const St=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":xt&&xt in Object(e)?Et(e):Nt(e)};const Pt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};const Ut=function(e){if(!Pt(e))return!1;var t=St(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t};const Ht=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};const $t=function(e){return null!=e&&Ht(e.length)&&!Ut(e)};var Ot=/^(?:0|[1-9]\d*)$/;const Tt=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Ot.test(e))&&e>-1&&e%1==0&&e<t};const jt=function(e,t,n){if(!Pt(n))return!1;var r=typeof t;return!!("number"==r?$t(n)&&Tt(t,n.length):"string"==r&&t in n)&&mt(n[t],e)};var Dt=/\s/;const Ft=function(e){for(var t=e.length;t--&&Dt.test(e.charAt(t)););return t};var Rt=/^\s+/;const At=function(e){return e?e.slice(0,Ft(e)+1).replace(Rt,""):e};const Lt=function(e){return null!=e&&"object"==typeof e};const Wt=function(e){return"symbol"==typeof e||Lt(e)&&"[object Symbol]"==St(e)};var Mt=/^[-+]0x[0-9a-f]+$/i,Vt=/^0b[01]+$/i,qt=/^0o[0-7]+$/i,It=parseInt;const Bt=function(e){if("number"==typeof e)return e;if(Wt(e))return NaN;if(Pt(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Pt(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=At(e);var n=Vt.test(e);return n||qt.test(e)?It(e.slice(2),n?2:8):Mt.test(e)?NaN:+e};var zt=1/0;const Gt=function(e){return e?(e=Bt(e))===zt||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};const Yt=function(e){var t=Gt(e),n=t%1;return t==t?n?t-n:t:0};var Zt=Math.ceil,Jt=Math.max;const Kt=function(e,t,n){t=(n?jt(e,t,n):void 0===t)?1:Jt(Yt(t),0);var r=null==e?0:e.length;if(!r||t<1)return[];for(var o=0,_=0,u=Array(Zt(r/t));o<r;)u[_++]=dt(e,o,o+=t);return u},Qt=e=>new Promise((t=>setTimeout(t,e))),Xt=async(e,t=["page","subcat","file"])=>{const n=new mw.Api,r=[];if(mw.config.get("wgUserGroups").some((e=>["bot","flood","patroller","sysop"].includes(e)))){let o="";for(;void 0!==o;){const _=await n.post({action:"query",list:"categorymembers",cmlimit:"max",cmtitle:e,cmtype:t,cmcontinue:o});if(_.query.categorymembers[0])for(const e of _.query.categorymembers)r.push(e.title);o=_.continue?.cmcontinue}}else{const n=async e=>{const o=$(await $.ajax(e)),_=t.map((e=>{switch(e){case"page":return"#mw-pages li a";case"subcat":return"#mw-subcategories li a";case"file":return"#mw-category-media li a.galleryfilename"}})).join(","),u=o.find(_).map(((e,t)=>t.classList.contains("CategoryTreeLabel")?`Category:${$(t).text()}`:t.classList.contains("galleryfilename")?`File:${$(t).text()}`:$(t).text())).get();if(r.push(...u),t.includes("page")){const e=o.find('a[href*="&pagefrom="]');e.length&&await n(e.eq(0).attr("href"))}if(t.includes("subcat")){const e=o.find('a[href*="&subcatfrom="]');e.length&&await n(e.eq(0).attr("href"))}if(t.includes("file")){const e=o.find('a[href*="&filefrom="]');e.length&&await n(e.eq(0).attr("href"))}};await n(`/${e}?action=render`)}return r},en=({username:e})=>{const[t,n]=oe("ready"),[r,o]=oe("ready"),[_,u]=oe(""),[i,l]=oe([]),[c,a]=oe([]),[s,f]=oe("复制文件列表"),p=le([]),d=ae((()=>new mw.Api),[]),m=ae((()=>mw.config.get("wgUserGroups").some((e=>["sysop","patroller"].includes(e)))),[]),h=se((async()=>{const t=[];let n="|";for(;void 0!==n;){const r=await d.post({format:"json",utf8:!0,action:"query",list:"usercontribs",ucprop:["title","timestamp"],ucnamespace:6,ucuser:e,ucshow:"new",uclimit:"max",uccontinue:n});n=r.continue?.uccontinue,t.push(...r.query.usercontribs.map((({title:e,timestamp:t})=>({title:e,timestamp:t}))))}return t}),[]),v=se((async e=>{const t=mw.config.get("wgUserGroups").some((e=>["bot","flood","sysop"].includes(e)))?500:50,n=Kt(e,t),r=[];for(const t of n){let n="||";for(;n;){const o=await d.post({format:"json",utf8:!0,action:"query",prop:"globalusage",titles:t.map((({title:e})=>e)),gucontinue:n,gulimit:"max"});n=o.continue?.gucontinue;for(const{title:t,globalusage:n}of Object.values(o.query.pages)){const o=i.find((({fileName:e})=>e===t));o?o.usage.push(...n):r.push({fileName:t,uploadTime:moment(e.find((e=>e.title===t)).timestamp).format("YYYY年M月D日 HH:mm:ss"),usage:n||[],selected:!0,deleted:!1})}}}const o=Kt(r,t);for(const e of o){let t="";for(;void 0!==t;){const n=await d.post({format:"json",utf8:!0,action:"query",prop:"fileusage",titles:e.map((({fileName:e})=>e)),...t?{fucontinue:t}:{},fulimit:"max"});t=n.continue?.fucontinue;for(const{title:e,fileusage:t}of Object.values(n.query.pages))t?.length&&(r.find((({fileName:t})=>t===e)).cmused=!0)}}return r.filter((({fileName:e,usage:t,cmused:n})=>!n&&t.every((({title:e})=>e.match(/^User:/)))&&!p.current.includes(e)))}),[]),y=se((async e=>{e.preventDefault();try{n("querying"),p.current=await Xt("Category:非链入使用的文件");const e=await h(),t=await v(e);l(t),n("acquired")}catch(e){n("failed"),u(e)}}),[]),b=se(((e,t)=>{l((n=>n.map((n=>n.fileName===t?{...n,selected:e.target.checked}:n))))}),[]),k=se((async e=>{e.preventDefault();const t=mw.config.get("wgUserName"),n=i.filter((({selected:e})=>e));if(0===n.length)return;o("deleting");let r=0;for(const{fileName:e,usage:{length:o}}of n){const _=o?"仅用于用户、用户讨论名字空间内的用途不当文件":"无使用或不再使用的文件";try{await d.postWithToken("csrf",{action:"edit",assertUser:t,title:e,text:`<noinclude>{{即将删除|1=${_}|user=${t}}}</noinclude>`,summary:`[[User:BearBin/js#FileInspector|FileInspector]]: 挂删:${_}`,watchlist:"nochange",tags:"Automation tool",bot:!0}),l((t=>t.map((t=>t.fileName===e?{...t,deleted:!0}:t)))),a((t=>[...t,`${moment().format("HH:mm:ss")} - 【${e}】已挂删。`]))}catch(t){a((n=>[...n,`${moment().format("HH:mm:ss")} - 【${e}】挂删失败:${t}`]))}r++,r<n.length&&await Qt(5e3)}o("done")}),[i]),w=se((e=>{e.preventDefault(),(async(e="")=>{if("function"==typeof navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else{const t=document.createElement("input");t.style.position="fixed",t.style.top="-10000px",t.style.zIndex="-999",t.style.opacity="0",document.body.appendChild(t),t.value=e,t.focus(),t.select(),document.execCommand("copy"),t.remove()}})(i.map((({fileName:e})=>`* ${e}`)).join("\n")).then((()=>{f("复制成功")})).catch((e=>{f(`复制失败:${e}`)}))}),[i]);return ft.createElement(_t,null,ft.createElement("form",{id:"file-inspector"},ft.createElement("fieldset",null,ft.createElement("legend",null,"用户文件检查"),"ready"===t&&ft.createElement(ft.Fragment,null,"查询该用户所有未使用的文件信息",ft.createElement("br",null),ft.createElement("button",{onClick:y},"查询")),"querying"===t&&"正在查询……","failed"===t&&ft.createElement(ft.Fragment,null,"查询失败:",_,ft.createElement("br",null),ft.createElement("button",{onClick:y},"重试")),"acquired"===t&&ft.createElement(ft.Fragment,null,"获取成功!该用户上传的无使用或仅用于用户页的文件如下:",ft.createElement("dl",null,i.map((({fileName:e,usage:t,selected:n,deleted:o,uploadTime:_})=>ft.createElement(g,{key:"fileName"},ft.createElement("dt",null,m&&ft.createElement("input",{type:"checkbox",name:e,defaultChecked:!0,checked:n&&!o,disabled:o||"deleting"===r,onChange:t=>b(t,e)}),ft.createElement("a",{href:`/${e}`,style:{textDecoration:o?"line-through":""},target:"_blank",rel:"noreferrer"},e),ft.createElement("label",{style:{fontWeight:"normal"},htmlFor:e},"(上传于 ",_,")")),t.length?t.map((({url:e,title:t})=>ft.createElement("dd",{key:t},ft.createElement("a",{href:e,target:"_blank",rel:"noreferrer"},t)))):ft.createElement("dd",null,"无使用"))))),ft.createElement("hr",null),m&&ft.createElement("button",{onClick:k,disabled:"deleting"===r},"挂删选中的文件"),ft.createElement("button",{onClick:w,style:{marginLeft:"0.3em"}},s),"ready"!==r&&ft.createElement("ul",{className:"file-inspector-log"},c.map((e=>ft.createElement("li",{key:e},e))))))))};$((()=>(async()=>{const e=mw.config.get("wgRelevantUserName");if(!e||!["Listfiles","Contributions"].includes(mw.config.get("wgCanonicalSpecialPageName")))return;await mw.loader.using(["mediawiki.api","oojs-ui","moment"]);const t=document.createDocumentFragment();pt(t).render(ft.createElement(en,{username:e})),document.querySelector("#mw-content-text>.mw-contributions-form, #mw-listfiles-form").after(t)})()))})();
// </nowiki>