WordPress/wp-includes/js/dist/customize-widgets.min.js
youknowriad be0d5b2534 Block Editor: Update the packages with a number of fixes targeted for Beta 4.
It includes fixes from these two backport PRs: 

 - https://github.com/WordPress/gutenberg/pull/32992
 - https://github.com/WordPress/gutenberg/pull/32956

Props gziolo, ryelle, ntsekouras, desrosj, jorgefilipecosta.
See #53397

Built from https://develop.svn.wordpress.org/trunk@51241


git-svn-id: http://core.svn.wordpress.org/trunk@50850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 15:52:22 +00:00

7 lines
34 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.customizeWidgets=function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s="9pbN")}({"1CF3":function(e,t){e.exports=window.wp.dom},"1ZqX":function(e,t){e.exports=window.wp.data},"6aBm":function(e,t){e.exports=window.wp.mediaUtils},"9pbN":function(e,t,s){"use strict";s.r(t),s.d(t,"initialize",(function(){return xe}));var i={};s.r(i),s.d(i,"__unstableIsFeatureActive",(function(){return T}));var n={};s.r(n),s.d(n,"__unstableToggleFeature",(function(){return M}));var r=s("GRId"),o=s("QyPg"),c=s("GLVC"),a=s("tI+e"),l=s("YLtl"),d=s("jZUy"),u=s("1ZqX"),b=s("axFQ"),m=s("6aBm"),h=s("wx14"),p=s("l3Sj");var g=function({inspector:e,closeMenu:t,...s}){const i=Object(u.useSelect)(e=>e(b.store).getSelectedBlockClientId(),[]),n=Object(r.useMemo)(()=>document.getElementById("block-"+i),[i]);return Object(r.createElement)(a.MenuItem,Object(h.a)({onClick:()=>{e.open({returnFocusWhenClose:n}),t()}},s),Object(p.__)("Show more settings"))},O=s("TSYQ"),w=s.n(O),j=s("RxS6"),f=s("Ntru"),_=s("K2cm"),y=s("Q4Sy"),v=s("K9lf"),E=s("bWcr");var k=function e({setIsOpened:t}){const s=Object(v.useInstanceId)(e,"customize-widget-layout__inserter-panel-title");return Object(r.createElement)("div",{className:"customize-widgets-layout__inserter-panel","aria-labelledby":s},Object(r.createElement)("div",{className:"customize-widgets-layout__inserter-panel-header"},Object(r.createElement)("h2",{id:s,className:"customize-widgets-layout__inserter-panel-header-title"},Object(p.__)("Add a block")),Object(r.createElement)(a.Button,{className:"customize-widgets-layout__inserter-panel-header-close-button",icon:E.a,onClick:()=>t(!1),"aria-label":Object(p.__)("Close inserter")})),Object(r.createElement)("div",{className:"customize-widgets-layout__inserter-panel-content"},Object(r.createElement)(b.__experimentalLibrary,{showInserterHelpPanel:!0,onSelect:()=>t(!1)})))},C=s("VKE3"),x=s("K+tz"),S=s("hF7m"),z=s("RMJe"),W=s("gdqT");const B=Object(l.flow)([u.combineReducers,(I={features:{fixedToolbar:!1,welcomeGuide:!0}},e=>(t=I,s)=>e(t,s))])({features:(e,t)=>"TOGGLE_FEATURE"===t.type?{...e,[t.feature]:!e[t.feature]}:e});var I;function T(e,t){return Object(l.get)(e.preferences.features,[t],!1)}function M(e){return{type:"TOGGLE_FEATURE",feature:e}}const F={reducer:Object(u.combineReducers)({preferences:B}),selectors:i,actions:n,persist:["preferences"]},N=Object(u.createReduxStore)("core/customize-widgets",F);function A({label:e,info:t,messageActivated:s,messageDeactivated:i,shortcut:n,feature:o}){const c=Object(u.useSelect)(e=>e(N).__unstableIsFeatureActive(o),[o]),{__unstableToggleFeature:l}=Object(u.useDispatch)(N);return Object(r.createElement)(a.MenuItem,{icon:c&&z.a,isSelected:c,onClick:()=>{l(o),c?Object(W.speak)(i||Object(p.__)("Feature deactivated")):Object(W.speak)(s||Object(p.__)("Feature activated"))},role:"menuitemcheckbox",info:t,shortcut:n},e)}Object(u.registerStore)("core/customize-widgets",F);const G=[{keyCombination:{modifier:"primary",character:"b"},description:Object(p.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:Object(p.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:Object(p.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:Object(p.__)("Remove a link.")},{keyCombination:{modifier:"primary",character:"u"},description:Object(p.__)("Underline the selected text.")}];function P({keyCombination:e,forceAriaLabel:t}){const s=e.modifier?j.displayShortcutList[e.modifier](e.character):e.character,i=e.modifier?j.shortcutAriaLabel[e.modifier](e.character):e.character;return Object(r.createElement)("kbd",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||i},Object(l.castArray)(s).map((e,t)=>"+"===e?Object(r.createElement)(r.Fragment,{key:t},e):Object(r.createElement)("kbd",{key:t,className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key"},e)))}var L=function({description:e,keyCombination:t,aliases:s=[],ariaLabel:i}){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-description"},e),Object(r.createElement)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-term"},Object(r.createElement)(P,{keyCombination:t,forceAriaLabel:i}),s.map((e,t)=>Object(r.createElement)(P,{keyCombination:e,forceAriaLabel:i,key:t}))))};var R=function({name:e}){const{keyCombination:t,description:s,aliases:i}=Object(u.useSelect)(t=>{const{getShortcutKeyCombination:s,getShortcutDescription:i,getShortcutAliases:n}=t(S.store);return{keyCombination:s(e),aliases:n(e),description:i(e)}});return t?Object(r.createElement)(L,{keyCombination:t,description:s,aliases:i}):null};const H=({shortcuts:e})=>Object(r.createElement)("ul",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map((e,t)=>Object(r.createElement)("li",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut",key:t},Object(l.isString)(e)?Object(r.createElement)(R,{name:e}):Object(r.createElement)(L,e)))),D=({title:e,shortcuts:t,className:s})=>Object(r.createElement)("section",{className:w()("customize-widgets-keyboard-shortcut-help-modal__section",s)},!!e&&Object(r.createElement)("h2",{className:"customize-widgets-keyboard-shortcut-help-modal__section-title"},e),Object(r.createElement)(H,{shortcuts:t})),V=({title:e,categoryName:t,additionalShortcuts:s=[]})=>{const i=Object(u.useSelect)(e=>e(S.store).getCategoryShortcuts(t),[t]);return Object(r.createElement)(D,{title:e,shortcuts:i.concat(s)})};function U({isModalActive:e,toggleModal:t}){const{registerShortcut:s}=Object(u.useDispatch)(S.store);return s({name:"core/customize-widgets/keyboard-shortcuts",category:"main",description:Object(p.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),Object(S.useShortcut)("core/customize-widgets/keyboard-shortcuts",t,{bindGlobal:!0}),e?Object(r.createElement)(a.Modal,{className:"customize-widgets-keyboard-shortcut-help-modal",title:Object(p.__)("Keyboard shortcuts"),closeLabel:Object(p.__)("Close"),onRequestClose:t},Object(r.createElement)(D,{className:"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/customize-widgets/keyboard-shortcuts"]}),Object(r.createElement)(V,{title:Object(p.__)("Global shortcuts"),categoryName:"global"}),Object(r.createElement)(V,{title:Object(p.__)("Selection shortcuts"),categoryName:"selection"}),Object(r.createElement)(V,{title:Object(p.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:Object(p.__)("Change the block type after adding a new paragraph."),ariaLabel:Object(p.__)("Forward-slash")}]}),Object(r.createElement)(D,{title:Object(p.__)("Text formatting"),shortcuts:G})):null}const q={className:"customize-widgets-more-menu__content",position:"bottom left"},K={tooltipPosition:"bottom"};function $(){const[e,t]=Object(r.useState)(!1),s=()=>t(!e);return Object(S.useShortcut)("core/customize-widgets/keyboard-shortcuts",s,{bindGlobal:!0}),Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.ToolbarDropdownMenu,{className:"customize-widgets-more-menu",icon:C.a,label:Object(p.__)("Options"),popoverProps:q,toggleProps:K},()=>Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.MenuGroup,{label:Object(p._x)("View","noun")},Object(r.createElement)(A,{feature:"fixedToolbar",label:Object(p.__)("Top toolbar"),info:Object(p.__)("Access all block and document tools in a single place"),messageActivated:Object(p.__)("Top toolbar activated"),messageDeactivated:Object(p.__)("Top toolbar deactivated")})),Object(r.createElement)(a.MenuGroup,{label:Object(p.__)("Tools")},Object(r.createElement)(a.MenuItem,{onClick:()=>{t(!0)},shortcut:j.displayShortcut.access("h")},Object(p.__)("Keyboard shortcuts")),Object(r.createElement)(A,{feature:"welcomeGuide",label:Object(p.__)("Welcome Guide")}),Object(r.createElement)(a.MenuItem,{role:"menuitem",icon:x.a,href:Object(p.__)("https://wordpress.org/support/article/wordpress-editor/"),target:"_blank",rel:"noopener noreferrer"},Object(p.__)("Help"),Object(r.createElement)(a.VisuallyHidden,{as:"span"},Object(p.__)("(opens in a new tab)")))),Object(r.createElement)(a.MenuGroup,{label:Object(p.__)("Preferences")},Object(r.createElement)(A,{feature:"keepCaretInsideBlock",label:Object(p.__)("Contain text cursor inside block"),info:Object(p.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:Object(p.__)("Contain text cursor inside block activated"),messageDeactivated:Object(p.__)("Contain text cursor inside block deactivated")})))),Object(r.createElement)(U,{isModalActive:e,toggleModal:s}))}var Q=function({sidebar:e,inserter:t,isInserterOpened:s,setIsInserterOpened:i,isFixedToolbarActive:n}){const[[o,c],l]=Object(r.useState)([e.hasUndo(),e.hasRedo()]);return Object(r.useEffect)(()=>e.subscribeHistory(()=>{l([e.hasUndo(),e.hasRedo()])}),[e]),Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:w()("customize-widgets-header",{"is-fixed-toolbar-active":n})},Object(r.createElement)(b.NavigableToolbar,{className:"customize-widgets-header-toolbar","aria-label":Object(p.__)("Document tools")},Object(r.createElement)(a.ToolbarButton,{icon:Object(p.isRTL)()?_.a:f.a,label:Object(p.__)("Undo"),shortcut:j.displayShortcut.primary("z"),"aria-disabled":!o,onClick:e.undo,className:"customize-widgets-editor-history-button undo-button"}),Object(r.createElement)(a.ToolbarButton,{icon:Object(p.isRTL)()?f.a:_.a,label:Object(p.__)("Redo"),shortcut:j.displayShortcut.primaryShift("z"),"aria-disabled":!c,onClick:e.redo,className:"customize-widgets-editor-history-button redo-button"}),Object(r.createElement)(a.ToolbarButton,{className:"customize-widgets-header-toolbar__inserter-toggle",isPressed:s,isPrimary:!0,icon:y.a,label:Object(p._x)("Add block","Generic label for block inserter button"),onClick:()=>{i(e=>!e)}}),Object(r.createElement)($,null))),Object(r.createPortal)(Object(r.createElement)(k,{setIsOpened:i}),t.contentContainer[0]))};var Y=s("HSyU"),Z=s("rl8x"),J=s.n(Z);function X(e,t=null){let s;if("core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance))if(e.attributes.id)s={id:e.attributes.id};else{const{encoded:i,hash:n,raw:r,...o}=e.attributes.instance;s={idBase:e.attributes.idBase,instance:{...null==t?void 0:t.instance,is_widget_customizer_js_value:!0,encoded_serialized_instance:i,instance_hash_key:n,raw_instance:r,...o}}}else{s={idBase:"block",widgetClass:"WP_Widget_Block",instance:{raw_instance:{content:Object(Y.serialize)(e)}}}}return{...Object(l.omit)(t,["form","rendered"]),...s}}function ee({id:e,idBase:t,number:s,instance:i}){let n;const{encoded_serialized_instance:r,instance_hash_key:o,raw_instance:a,...l}=i;if("block"===t){const e=Object(Y.parse)(a.content);n=e.length?e[0]:Object(Y.createBlock)("core/paragraph",{})}else n=s?Object(Y.createBlock)("core/legacy-widget",{idBase:t,instance:{encoded:r,hash:o,raw:a,...l}}):Object(Y.createBlock)("core/legacy-widget",{id:e});return Object(c.addWidgetIdToBlock)(n,e)}function te(e){const[t,s]=Object(r.useState)(()=>e.getWidgets().map(e=>ee(e)));Object(r.useEffect)(()=>e.subscribe((e,t)=>{s(s=>{const i=new Map(e.map(e=>[e.id,e])),n=new Map(s.map(e=>[Object(c.getWidgetIdFromBlock)(e),e])),r=t.map(e=>{const t=i.get(e.id);return t&&t===e?n.get(e.id):ee(e)});return J()(s,r)?s:r})}),[e]);const i=Object(r.useCallback)(t=>{s(s=>{if(J()(s,t))return s;const i=new Map(s.map(e=>[Object(c.getWidgetIdFromBlock)(e),e])),n=t.map(t=>{const s=Object(c.getWidgetIdFromBlock)(t);if(s&&i.has(s)){const n=i.get(s),r=e.getWidget(s);return Object(l.isEqual)(t,n)&&r?r:X(t,r)}return X(t)});if(J()(e.getWidgets(),n))return s;const r=e.setWidgets(n);return t.reduce((e,s,i)=>{const n=r[i];return null!==n&&(e===t&&(e=t.slice()),e[i]=Object(c.addWidgetIdToBlock)(s,n)),e},t)})},[e]);return[t,i,i]}function se(e){const t=e.match(/^widget_(.+)(?:\[(\d+)\])$/);if(t){return`${t[1]}-${parseInt(t[2],10)}`}return e}const ie=Object(r.createContext)();function ne({api:e,sidebarControls:t,children:s}){const[i,n]=Object(r.useState)({current:null}),o=Object(r.useCallback)(e=>{for(const s of t){if(s.setting.get().includes(e)){s.sectionInstance.expand({completeCallback(){n({current:e})}});break}}},[t]);Object(r.useEffect)(()=>{function t(e){const t=se(e);o(t)}function s(){e.previewer.preview.bind("focus-control-for-setting",t)}return e.previewer.bind("ready",s),()=>{e.previewer.unbind("ready",s),e.previewer.preview.unbind("focus-control-for-setting",t)}},[e,o]);const c=Object(r.useMemo)(()=>[i,o],[i,o]);return Object(r.createElement)(ie.Provider,{value:c},s)}function re(e){const{selectBlock:t}=Object(u.useDispatch)(b.store),[s]=Object(r.useContext)(ie),i=Object(r.useRef)(e);Object(r.useEffect)(()=>{i.current=e},[e]),Object(r.useEffect)(()=>{if(s.current){const e=i.current.find(e=>Object(c.getWidgetIdFromBlock)(e)===s.current);if(e){t(e.clientId);const s=document.querySelector(`[data-block="${e.clientId}"]`);null==s||s.focus()}}},[s,t])}function oe({sidebar:e,settings:t,children:s}){const[i,n,o]=te(e);return re(i),Object(r.createElement)(b.BlockEditorProvider,{value:i,onInput:n,onChange:o,settings:t,useSubRegistry:!1},s)}function ce({sidebar:e}){const{__unstableToggleFeature:t}=Object(u.useDispatch)(N),s=e.getWidgets().every(e=>e.id.startsWith("block-"));return Object(r.createElement)("div",{className:"customize-widgets-welcome-guide"},Object(r.createElement)("div",{className:"customize-widgets-welcome-guide__image__wrapper"},Object(r.createElement)("picture",null,Object(r.createElement)("source",{srcSet:"https://s.w.org/images/block-editor/welcome-editor.svg",media:"(prefers-reduced-motion: reduce)"}),Object(r.createElement)("img",{className:"customize-widgets-welcome-guide__image",src:"https://s.w.org/images/block-editor/welcome-editor.gif",width:"312",height:"240",alt:""}))),Object(r.createElement)("h1",{className:"customize-widgets-welcome-guide__heading"},Object(p.__)("Welcome to block Widgets")),Object(r.createElement)("p",{className:"customize-widgets-welcome-guide__text"},s?Object(p.__)("Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how theyll look on your site."):Object(p.__)("You can now add any block to your sites widget areas. Dont worry, all of your favorite widgets still work flawlessly.")),Object(r.createElement)(a.Button,{className:"customize-widgets-welcome-guide__button",isPrimary:!0,onClick:()=>t("welcomeGuide")},Object(p.__)("Got it")),Object(r.createElement)("hr",{className:"customize-widgets-welcome-guide__separator"}),!s&&Object(r.createElement)("p",{className:"customize-widgets-welcome-guide__more-info"},Object(p.__)("Want to stick with the old widgets?"),Object(r.createElement)("br",null),Object(r.createElement)(a.ExternalLink,{href:Object(p.__)("https://wordpress.org/plugins/classic-widgets/")},Object(p.__)("Get the Classic Widgets plugin."))),Object(r.createElement)("p",{className:"customize-widgets-welcome-guide__more-info"},Object(p.__)("New to the block editor?"),Object(r.createElement)("br",null),Object(r.createElement)(a.ExternalLink,{href:Object(p.__)("https://wordpress.org/support/article/wordpress-editor/")},Object(p.__)("Here's a detailed guide."))))}function ae({undo:e,redo:t,save:s}){return Object(S.useShortcut)("core/customize-widgets/undo",t=>{e(),t.preventDefault()},{bindGlobal:!0}),Object(S.useShortcut)("core/customize-widgets/redo",e=>{t(),e.preventDefault()},{bindGlobal:!0}),Object(S.useShortcut)("core/customize-widgets/save",e=>{e.preventDefault(),s()},{bindGlobal:!0}),null}ae.Register=function(){const{registerShortcut:e,unregisterShortcut:t}=Object(u.useDispatch)(S.store);return Object(r.useEffect)(()=>(e({name:"core/customize-widgets/undo",category:"global",description:Object(p.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/customize-widgets/redo",category:"global",description:Object(p.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}}),e({name:"core/customize-widgets/save",category:"global",description:Object(p.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),()=>{t("core/customize-widgets/undo"),t("core/customize-widgets/redo"),t("core/customize-widgets/save")}),[e]),null};var le=ae;function de({blockEditorSettings:e,sidebar:t,inserter:s,inspector:i}){const[n,o]=function(e){const[t,s]=Object(r.useState)(()=>e.isOpen);return Object(r.useEffect)(()=>e.subscribe(s),[e]),[t,Object(r.useCallback)(t=>{let s=t;"function"==typeof t&&(s=t(e.isOpen)),s?e.open():e.close()},[e])]}(s),{hasUploadPermissions:c,isFixedToolbarActive:a,keepCaretInsideBlock:h,isWelcomeGuideActive:p}=Object(u.useSelect)(e=>({hasUploadPermissions:Object(l.defaultTo)(e(d.store).canUser("create","media"),!0),isFixedToolbarActive:e(N).__unstableIsFeatureActive("fixedToolbar"),keepCaretInsideBlock:e(N).__unstableIsFeatureActive("keepCaretInsideBlock"),isWelcomeGuideActive:e(N).__unstableIsFeatureActive("welcomeGuide")}),[]),O=Object(r.useMemo)(()=>{let t;return c&&(t=({onError:t,...s})=>{Object(m.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...s})}),{...e,__experimentalSetIsInserterOpened:o,mediaUpload:t,hasFixedToolbar:a,keepCaretInsideBlock:h}},[c,e,a,h]);return p?Object(r.createElement)(ce,{sidebar:t}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(b.BlockEditorKeyboardShortcuts.Register,null),Object(r.createElement)(le.Register,null),Object(r.createElement)(oe,{sidebar:t,settings:O},Object(r.createElement)(b.BlockEditorKeyboardShortcuts,null),Object(r.createElement)(le,{undo:t.undo,redo:t.redo,save:t.save}),Object(r.createElement)(Q,{sidebar:t,inserter:s,isInserterOpened:n,setIsInserterOpened:o,isFixedToolbarActive:a}),Object(r.createElement)(b.BlockTools,null,Object(r.createElement)(b.BlockSelectionClearer,null,Object(r.createElement)(b.WritingFlow,null,Object(r.createElement)(b.ObserveTyping,null,Object(r.createElement)(b.BlockList,{renderAppender:b.ButtonBlockAppender}))))),Object(r.createPortal)(Object(r.createElement)("form",{onSubmit:e=>e.preventDefault()},Object(r.createElement)(b.BlockInspector,null)),i.contentContainer[0])),Object(r.createElement)(b.__unstableBlockSettingsMenuFirstItem,null,({onClose:e})=>Object(r.createElement)(g,{inspector:i,closeMenu:e})))}const ue=Object(r.createContext)();function be({sidebarControls:e,activeSidebarControl:t,children:s}){const i=Object(r.useMemo)(()=>({sidebarControls:e,activeSidebarControl:t}),[e,t]);return Object(r.createElement)(ue.Provider,{value:i},s)}function me({api:e,sidebarControls:t,blockEditorSettings:s}){const[i,n]=Object(r.useState)(null),o=document.getElementById("customize-theme-controls"),c=Object(r.useRef)();!function(e,t){const{hasSelectedBlock:s,hasMultiSelection:i}=Object(u.useSelect)(b.store),{clearSelectedBlock:n}=Object(u.useDispatch)(b.store);Object(r.useEffect)(()=>{if(t.current&&e){const a=e.inspector,l=e.container[0],d=l.ownerDocument,u=d.defaultView;function r(e){!s()&&!i()||!e||!d.contains(e)||l.contains(e)||t.current.contains(e)||e.closest('[role="dialog"]')||a.expanded()||n()}function o(e){r(e.target)}function c(){r(d.activeElement)}return d.addEventListener("mousedown",o),u.addEventListener("blur",c),()=>{d.removeEventListener("mousedown",o),u.removeEventListener("blur",c)}}},[t,e,s,i,n])}(i,c),Object(r.useEffect)(()=>{const e=t.map(e=>e.subscribe(t=>{t&&n(e)}));return()=>{e.forEach(e=>e())}},[t]);const l=i&&Object(r.createPortal)(Object(r.createElement)(de,{key:i.id,blockEditorSettings:s,sidebar:i.sidebarAdapter,inserter:i.inserter,inspector:i.inspector}),i.container[0]),d=o&&Object(r.createPortal)(Object(r.createElement)("div",{className:"customize-widgets-popover",ref:c},Object(r.createElement)(a.Popover.Slot,null)),o);return Object(r.createElement)(a.SlotFillProvider,null,Object(r.createElement)(be,{sidebarControls:t,activeSidebarControl:i},Object(r.createElement)(ne,{api:e,sidebarControls:t},l,d)))}function he(){const{wp:{customize:e}}=window;return class extends e.Section{ready(){const t=function(){const{wp:{customize:e}}=window;return class extends e.Section{constructor(e,t){super(e,t),this.parentSection=t.parentSection,this.returnFocusWhenClose=null}ready(){this.contentContainer[0].classList.add("customize-widgets-layout__inspector")}onChangeExpanded(e,t){super.onChangeExpanded(e,t),this.parentSection&&!t.unchanged&&(e?this.parentSection.collapse({manualTransition:!0}):this.parentSection.expand({manualTransition:!0,completeCallback:()=>{this.returnFocusWhenClose&&!this.contentContainer[0].contains(this.returnFocusWhenClose)&&this.returnFocusWhenClose.focus()}}))}open({returnFocusWhenClose:e}={}){this.returnFocusWhenClose=e,this.expand({allowMultiple:!0})}close(){this.collapse({allowMultiple:!0})}}}();this.inspector=new t("widgets-inspector-"+this.id,{title:Object(p.__)("Block Settings"),parentSection:this,customizeAction:[Object(p.__)("Customizing"),Object(p.__)("Widgets"),this.params.title].join(" ▸ ")}),e.section.add(this.inspector),this.contentContainer[0].classList.add("customize-widgets__sidebar-section")}hasSubSectionOpened(){return this.inspector.expanded()}onChangeExpanded(e,t){const s=this.controls(),i={...t,completeCallback(){var n;s.forEach(t=>{t.onChangeSectionExpanded(e,i)}),null===(n=t.completeCallback)||void 0===n||n.call(t)}};i.manualTransition?e?(this.contentContainer.addClass(["busy","open"]),this.contentContainer.removeClass("is-sub-section-open"),this.contentContainer.closest(".wp-full-overlay").addClass("section-open"),this.contentContainer.one("transitionend",()=>{this.contentContainer.removeClass("busy"),i.completeCallback()})):(this.contentContainer.addClass(["busy","is-sub-section-open"]),this.contentContainer.closest(".wp-full-overlay").addClass("section-open"),this.contentContainer.removeClass("open"),this.contentContainer.one("transitionend",()=>{this.contentContainer.removeClass("busy"),i.completeCallback()})):super.onChangeExpanded(e,i)}}}const{wp:pe}=window;function ge(e){const t=e.match(/^(.+)-(\d+)$/);return t?{idBase:t[1],number:parseInt(t[2],10)}:{idBase:e}}function Oe(e){const{idBase:t,number:s}=ge(e);return s?`widget_${t}[${s}]`:"widget_"+t}class we{constructor(e,t){this.setting=e,this.api=t,this.locked=!1,this.widgetsCache=new WeakMap,this.subscribers=new Set,this.history=[this._getWidgetIds().map(e=>this.getWidget(e))],this.historyIndex=0,this.historySubscribers=new Set,this._debounceSetHistory=function(e,t,s){let i,n=!1;function r(...r){const o=(n?t:e).apply(this,r);return n=!0,clearTimeout(i),i=setTimeout(()=>{n=!1},s),o}return r.cancel=()=>{n=!1,clearTimeout(i)},r}(this._pushHistory,this._replaceHistory,1e3),this.setting.bind(this._handleSettingChange.bind(this)),this.api.bind("change",this._handleAllSettingsChange.bind(this)),this.undo=this.undo.bind(this),this.redo=this.redo.bind(this),this.save=this.save.bind(this)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}getWidgets(){return this.history[this.historyIndex]}_emit(...e){for(const t of this.subscribers)t(...e)}_getWidgetIds(){return this.setting.get()}_pushHistory(){this.history=[...this.history.slice(0,this.historyIndex+1),this._getWidgetIds().map(e=>this.getWidget(e))],this.historyIndex+=1,this.historySubscribers.forEach(e=>e())}_replaceHistory(){this.history[this.historyIndex]=this._getWidgetIds().map(e=>this.getWidget(e))}_handleSettingChange(){if(this.locked)return;const e=this.getWidgets();this._pushHistory(),this._emit(e,this.getWidgets())}_handleAllSettingsChange(e){if(this.locked)return;if(!e.id.startsWith("widget_"))return;const t=se(e.id);if(!this.setting.get().includes(t))return;const s=this.getWidgets();this._pushHistory(),this._emit(s,this.getWidgets())}_createWidget(e){const t=pe.customize.Widgets.availableWidgets.findWhere({id_base:e.idBase});let s=e.number;t.get("is_multi")&&!s&&(t.set("multi_number",t.get("multi_number")+1),s=t.get("multi_number"));const i=s?`widget_${e.idBase}[${s}]`:"widget_"+e.idBase,n={transport:pe.customize.Widgets.data.selectiveRefreshableWidgets[t.get("id_base")]?"postMessage":"refresh",previewer:this.setting.previewer};this.api.create(i,i,"",n).set(e.instance);return se(i)}_removeWidget(e){const t=Oe(e.id),s=this.api(t);if(s){const e=s.get();this.widgetsCache.delete(e)}this.api.remove(t)}_updateWidget(e){const t=this.getWidget(e.id);if(t===e)return e.id;if(t.idBase&&e.idBase&&t.idBase===e.idBase){const t=Oe(e.id);return this.api(t).set(e.instance),e.id}return this._removeWidget(e),this._createWidget(e)}getWidget(e){if(!e)return null;const{idBase:t,number:s}=ge(e),i=Oe(e),n=this.api(i);if(!n)return null;const r=n.get();if(this.widgetsCache.has(r))return this.widgetsCache.get(r);const o={id:e,idBase:t,number:s,instance:r};return this.widgetsCache.set(r,o),o}_updateWidgets(e){this.locked=!0;const t=[],s=e.map(e=>{if(e.id&&this.getWidget(e.id))return t.push(null),this._updateWidget(e);const s=this._createWidget(e);return t.push(s),s});return this.getWidgets().filter(e=>!s.includes(e.id)).forEach(e=>this._removeWidget(e)),this.setting.set(s),this.locked=!1,t}setWidgets(e){const t=this._updateWidgets(e);return this._debounceSetHistory(),t}hasUndo(){return this.historyIndex>0}hasRedo(){return this.historyIndex<this.history.length-1}_seek(e){const t=this.getWidgets();this.historyIndex=e;const s=this.history[this.historyIndex];this._updateWidgets(s),this._emit(t,this.getWidgets()),this.historySubscribers.forEach(e=>e()),this._debounceSetHistory.cancel()}undo(){this.hasUndo()&&this._seek(this.historyIndex-1)}redo(){this.hasRedo()&&this._seek(this.historyIndex+1)}subscribeHistory(e){return this.historySubscribers.add(e),()=>{this.historySubscribers.delete(e)}}save(){this.api.previewer.save()}}var je=s("1CF3");function fe(){const{wp:{customize:e}}=window;return class extends e.Control{constructor(...e){super(...e),this.subscribers=new Set}ready(){const t=function(){const{wp:{customize:e}}=window,t=e.OuterSection;return e.OuterSection=class extends t{onChangeExpanded(t,s){return t&&e.section.each(e=>{"outer"===e.params.type&&e.id!==this.id&&e.expanded()&&e.collapse()}),super.onChangeExpanded(t,s)}},e.sectionConstructor.outer=e.OuterSection,class extends e.OuterSection{constructor(...e){super(...e),this.params.type="outer",this.activeElementBeforeExpanded=null;this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown",e=>{!this.isOpen||e.keyCode!==j.ESCAPE&&"Escape"!==e.code||(e.stopPropagation(),this.close())},!0),this.contentContainer.addClass("widgets-inserter")}get isOpen(){return this.expanded()}subscribe(e){return this.expanded.bind(e),()=>this.expanded.unbind(e)}open(){if(!this.isOpen){const e=this.contentContainer[0];this.activeElementBeforeExpanded=e.ownerDocument.activeElement,this.expand({completeCallback(){const t=je.focus.tabbable.find(e)[1];t&&t.focus()}})}}close(){if(this.isOpen){const e=this.contentContainer[0],t=e.ownerDocument.activeElement;this.collapse({completeCallback(){e.contains(t)&&this.activeElementBeforeExpanded&&this.activeElementBeforeExpanded.focus()}})}}}}();this.inserter=new t("widgets-inserter-"+this.id,{}),e.section.add(this.inserter),this.sectionInstance=e.section(this.section()),this.inspector=this.sectionInstance.inspector,this.sidebarAdapter=new we(this.setting,e)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}onChangeSectionExpanded(e,t){t.unchanged||(e||this.inserter.close(),this.subscribers.forEach(s=>s(e,t)))}}}var _e=s("g56x");const ye=Object(v.createHigherOrderComponent)(e=>t=>{const s=Object(c.getWidgetIdFromBlock)(t),i=function(){const{sidebarControls:e}=Object(r.useContext)(ue);return e}(),n=function(){const{activeSidebarControl:e}=Object(r.useContext)(ue);return e}(),o=(null==i?void 0:i.length)>1,a=t.name,d=Object(u.useSelect)(e=>e(b.store).canInsertBlockType(a,""),[a]);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(e,t),o&&d&&Object(r.createElement)(b.BlockControls,null,Object(r.createElement)(c.MoveToWidgetArea,{widgetAreas:i.map(e=>({id:e.id,name:e.params.label,description:e.params.description})),currentWidgetAreaId:null==n?void 0:n.id,onSelect:function(e){const t=i.find(t=>t.id===e),r=n.setting,o=t.setting;r(Object(l.without)(r(),s)),o([...o(),s]),t.expand()}})))},"withMoveToSidebarToolbarItem");Object(_e.addFilter)("editor.BlockEdit","core/customize-widgets/block-edit",ye);Object(_e.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",()=>m.MediaUpload);const{wp:ve}=window,Ee=Object(v.createHigherOrderComponent)(e=>t=>{var s,i;const{idBase:n}=t.attributes,o=null!==(s=null===(i=ve.customize.Widgets.data.availableWidgets.find(e=>e.id_base===n))||void 0===i?void 0:i.is_wide)&&void 0!==s&&s;return Object(r.createElement)(e,Object(h.a)({},t,{isWide:o}))},"withWideWidgetDisplay");Object(_e.addFilter)("editor.BlockEdit","core/customize-widgets/wide-widget-display",Ee);const{wp:ke}=window,Ce=["core/more","core/block","core/freeform"];function xe(e,t){const s=Object(o.__experimentalGetCoreBlocks)().filter(e=>!(Ce.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")));Object(o.registerCoreBlocks)(s),Object(c.registerLegacyWidgetBlock)(),Object(c.registerLegacyWidgetVariations)(t);const i=fe();ke.customize.sectionConstructor.sidebar=he(),ke.customize.controlConstructor.sidebar_block_editor=i;const n=document.createElement("div");document.body.appendChild(n),ke.customize.bind("ready",()=>{const e=[];ke.customize.control.each(t=>{t instanceof i&&e.push(t)}),Object(r.render)(Object(r.createElement)(me,{api:ke.customize,sidebarControls:e,blockEditorSettings:t}),n)})}},GLVC:function(e,t){e.exports=window.wp.widgets},GRId:function(e,t){e.exports=window.wp.element},HSyU:function(e,t){e.exports=window.wp.blocks},"K+tz":function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const r=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"}));t.a=r},K2cm:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const r=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));t.a=r},K9lf:function(e,t){e.exports=window.wp.compose},Ntru:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const r=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"}));t.a=r},Q4Sy:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const r=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));t.a=r},QyPg:function(e,t){e.exports=window.wp.blockLibrary},RMJe:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const r=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"}));t.a=r},RxS6:function(e,t){e.exports=window.wp.keycodes},TSYQ:function(e,t,s){var i;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var s={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var r=typeof i;if("string"===r||"number"===r)e.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&e.push(o)}}else if("object"===r)if(i.toString===Object.prototype.toString)for(var c in i)s.call(i,c)&&i[c]&&e.push(c);else e.push(i.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(i=function(){return n}.apply(t,[]))||(e.exports=i)}()},Tqx9:function(e,t){e.exports=window.wp.primitives},VKE3:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const r=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));t.a=r},YLtl:function(e,t){e.exports=window.lodash},axFQ:function(e,t){e.exports=window.wp.blockEditor},bWcr:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const r=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=r},g56x:function(e,t){e.exports=window.wp.hooks},gdqT:function(e,t){e.exports=window.wp.a11y},hF7m:function(e,t){e.exports=window.wp.keyboardShortcuts},jZUy:function(e,t){e.exports=window.wp.coreData},l3Sj:function(e,t){e.exports=window.wp.i18n},rl8x:function(e,t){e.exports=window.wp.isShallowEqual},"tI+e":function(e,t){e.exports=window.wp.components},wx14:function(e,t,s){"use strict";function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e}).apply(this,arguments)}s.d(t,"a",(function(){return i}))}});