woocommerce/8331.4b694286.iframe.bundle.js

1 line
16 KiB
JavaScript
Raw Normal View History

(self.webpackChunk_woocommerce_storybook=self.webpackChunk_woocommerce_storybook||[]).push([[8331],{"../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@18.3.1_react@17.0.2__react-with-d_2lvt2m6o33cg7sz6nsmi7nf4ga/node_modules/@wordpress/components/build-module/slot-fill/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{SQ:()=>slot_fill_Fill,DX:()=>slot_fill_Slot});var esm_extends=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/extends.js"),react=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),lodash=__webpack_require__("../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"),react_dom=__webpack_require__("../../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/index.js");const context=(0,react.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}}),use_slot=name=>{const{getSlot,subscribe}=(0,react.useContext)(context),[slot,setSlot]=(0,react.useState)(getSlot(name));return(0,react.useEffect)((()=>{setSlot(getSlot(name));return subscribe((()=>{setSlot(getSlot(name))}))}),[name]),slot};function FillComponent(_ref){let{name,children,registerFill,unregisterFill}=_ref;const slot=use_slot(name),ref=(0,react.useRef)({name,children});return(0,react.useLayoutEffect)((()=>(registerFill(name,ref.current),()=>unregisterFill(name,ref.current))),[]),(0,react.useLayoutEffect)((()=>{ref.current.children=children,slot&&slot.forceUpdate()}),[children]),(0,react.useLayoutEffect)((()=>{name!==ref.current.name&&(unregisterFill(ref.current.name,ref.current),ref.current.name=name,registerFill(name,ref.current))}),[name]),slot&&slot.node?((0,lodash.isFunction)(children)&&(children=children(slot.props.fillProps)),(0,react_dom.createPortal)(children,slot.node)):null}const fill=props=>(0,react.createElement)(context.Consumer,null,(_ref2=>{let{registerFill,unregisterFill}=_ref2;return(0,react.createElement)(FillComponent,(0,esm_extends.A)({},props,{registerFill,unregisterFill}))}));var utils=__webpack_require__("../../node_modules/.pnpm/@wordpress+element@4.4.1/node_modules/@wordpress/element/build-module/utils.js");class SlotComponent extends react.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot}=this.props;registerSlot(this.props.name,this)}componentWillUnmount(){const{unregisterSlot}=this.props;this.isUnmounted=!0,unregisterSlot(this.props.name,this)}componentDidUpdate(prevProps){const{name,unregisterSlot,registerSlot}=this.props;prevProps.name!==name&&(unregisterSlot(prevProps.name),registerSlot(name,this))}bindNode(node){this.node=node}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children,name,fillProps={},getFills}=this.props,fills=(0,lodash.map)(getFills(name,this),(fill=>{const fillChildren=(0,lodash.isFunction)(fill.children)?fill.children(fillProps):fill.children;return react.Children.map(fillChildren,((child,childIndex)=>{if(!child||(0,lodash.isString)(child))return child;const childKey=child.key||childIndex;return(0,react.cloneElement)(child,{key:childKey})}))})).filter((0,lodash.negate)(utils.s));return(0,react.createElement)(react.Fragment,null,(0,lodash.isFunction)(children)?children(fills):fills)}}const slot=props=>(0,react.createElement)(context.Consumer,null,(_ref=>{let{registerSlot,unregisterSlot,getFills}=_ref;return(0,react.createElement)(SlotComponent,(0,esm_extends.A)({},props,{registerSlot,unregisterSlot,getFills}))}));var process=__webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");const slot_fill_context=(0,react.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==process&&process.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});var emotion_element_c39617d8_browser_esm=__we