WordPress/wp-includes/js/dist/plugins.min.js

2 lines
5.2 KiB
JavaScript

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.plugins=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="ey5A")}({"4eJC":function(e,t,n){e.exports=function(e,t){var n,r,i=0;function o(){var o,u,l=n,s=arguments.length;e:for(;l;){if(l.args.length===arguments.length){for(u=0;u<s;u++)if(l.args[u]!==arguments[u]){l=l.next;continue e}return l!==n&&(l===r&&(r=l.prev),l.prev.next=l.next,l.next&&(l.next.prev=l.prev),l.next=n,l.prev=null,n.prev=l,n=l),l.val}l=l.next}for(o=new Array(s),u=0;u<s;u++)o[u]=arguments[u];return l={args:o,val:e.apply(null,o)},n?(n.prev=l,l.next=n):r=l,i===t.maxSize?(r=r.prev).next=null:i++,n=l,l.val}return t=t||{},o.clear=function(){n=null,r=null,i=0},o}},GRId:function(e,t){e.exports=window.wp.element},K9lf:function(e,t){e.exports=window.wp.compose},Tqx9:function(e,t){e.exports=window.wp.primitives},YLtl:function(e,t){e.exports=window.lodash},ey5A:function(e,t,n){"use strict";n.r(t),n.d(t,"PluginArea",(function(){return j})),n.d(t,"withPluginContext",(function(){return g})),n.d(t,"registerPlugin",(function(){return v})),n.d(t,"unregisterPlugin",(function(){return h})),n.d(t,"getPlugin",(function(){return b})),n.d(t,"getPlugins",(function(){return x}));var r=n("GRId"),i=n("YLtl"),o=n("4eJC"),u=n.n(o),l=n("g56x"),s=n("wx14"),c=n("K9lf");const{Consumer:a,Provider:p}=Object(r.createContext)({name:null,icon:null}),g=e=>Object(c.createHigherOrderComponent)(t=>n=>Object(r.createElement)(a,null,i=>Object(r.createElement)(t,Object(s.a)({},n,e(i,n)))),"withPluginContext");var d=n("Tqx9");var f=Object(r.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(d.Path,{d:"M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"}));const m={};function v(e,t){if("object"!=typeof t)return console.error("No settings object provided!"),null;if("string"!=typeof e)return console.error("Plugin name must be string."),null;if(!/^[a-z][a-z0-9-]*$/.test(e))return console.error('Plugin name must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".'),null;m[e]&&console.error(`Plugin "${e}" is already registered.`),t=Object(l.applyFilters)("plugins.registerPlugin",t,e);const{render:n,scope:r}=t;if(!Object(i.isFunction)(n))return console.error('The "render" property must be specified and must be a valid function.'),null;if(r){if("string"!=typeof r)return console.error("Plugin scope must be string."),null;if(!/^[a-z][a-z0-9-]*$/.test(r))return console.error('Plugin scope must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-page".'),null}return m[e]={name:e,icon:f,...t},Object(l.doAction)("plugins.pluginRegistered",t,e),t}function h(e){if(!m[e])return void console.error('Plugin "'+e+'" is not registered.');const t=m[e];return delete m[e],Object(l.doAction)("plugins.pluginUnregistered",t,e),t}function b(e){return m[e]}function x(e){return Object.values(m).filter(t=>t.scope===e)}class w extends r.Component{constructor(){super(...arguments),this.setPlugins=this.setPlugins.bind(this),this.memoizedContext=u()((e,t)=>({name:e,icon:t})),this.state=this.getCurrentPluginsState()}getCurrentPluginsState(){return{plugins:Object(i.map)(x(this.props.scope),e=>{let{icon:t,name:n,render:r}=e;return{Plugin:r,context:this.memoizedContext(n,t)}})}}componentDidMount(){Object(l.addAction)("plugins.pluginRegistered","core/plugins/plugin-area/plugins-registered",this.setPlugins),Object(l.addAction)("plugins.pluginUnregistered","core/plugins/plugin-area/plugins-unregistered",this.setPlugins)}componentWillUnmount(){Object(l.removeAction)("plugins.pluginRegistered","core/plugins/plugin-area/plugins-registered"),Object(l.removeAction)("plugins.pluginUnregistered","core/plugins/plugin-area/plugins-unregistered")}setPlugins(){this.setState(this.getCurrentPluginsState)}render(){return Object(r.createElement)("div",{style:{display:"none"}},Object(i.map)(this.state.plugins,e=>{let{context:t,Plugin:n}=e;return Object(r.createElement)(p,{key:t.name,value:t},Object(r.createElement)(n,null))}))}}var j=w},g56x:function(e,t){e.exports=window.wp.hooks},wx14:function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))}});