/*! This file is auto-generated */ !function(){var e={4403:function(e,t){var n; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var i={}.hasOwnProperty;function r(){for(var e=[],t=0;t{var t;const n=null!==(t=e(d.store).getSettings()?.widgetTypesToHideFromLegacyWidgetBlock)&&void 0!==t?t:[];return e(g.store).getWidgetTypes({per_page:-1})?.filter((e=>!n.includes(e.id)))}),[]);return n?0===n.length?(0,h.__)("There are no widgets available."):(0,a.createElement)(u.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,h.__)("Select a legacy widget to display:"),value:null!=e?e:"",options:[{value:"",label:(0,h.__)("Select widget")},...n.map((e=>({value:e.id,label:e.name})))],onChange:e=>{if(e){const i=n.find((t=>t.id===e));t({selectedId:i.id,isMulti:i.is_multi})}else t({selectedId:null})}}):(0,a.createElement)(u.Spinner,null)}function f({name:e,description:t}){return(0,a.createElement)("div",{className:"wp-block-legacy-widget-inspector-card"},(0,a.createElement)("h3",{className:"wp-block-legacy-widget-inspector-card__name"},e),(0,a.createElement)("span",null,t))}var v=window.wp.notices,b=window.wp.compose,y=window.wp.apiFetch,E=n.n(y);class _{constructor({id:e,idBase:t,instance:n,onChangeInstance:i,onChangeHasPreview:r,onError:a}){this.id=e,this.idBase=t,this._instance=n,this._hasPreview=null,this.onChangeInstance=i,this.onChangeHasPreview=r,this.onError=a,this.number=++k,this.handleFormChange=(0,b.debounce)(this.handleFormChange.bind(this),200),this.handleFormSubmit=this.handleFormSubmit.bind(this),this.initDOM(),this.bindEvents(),this.loadContent()}destroy(){this.unbindEvents(),this.element.remove()}initDOM(){var e,t;this.element=B("div",{class:"widget open"},[B("div",{class:"widget-inside"},[this.form=B("form",{class:"form",method:"post"},[B("input",{class:"widget-id",type:"hidden",name:"widget-id",value:null!==(e=this.id)&&void 0!==e?e:`${this.idBase}-${this.number}`}),B("input",{class:"id_base",type:"hidden",name:"id_base",value:null!==(t=this.idBase)&&void 0!==t?t:this.id}),B("input",{class:"widget-width",type:"hidden",name:"widget-width",value:"250"}),B("input",{class:"widget-height",type:"hidden",name:"widget-height",value:"200"}),B("input",{class:"widget_number",type:"hidden",name:"widget_number",value:this.idBase?this.number.toString():""}),this.content=B("div",{class:"widget-content"}),this.id&&B("button",{class:"button is-primary",type:"submit"},(0,h.__)("Save"))])])])}bindEvents(){if(window.jQuery){const{jQuery:e}=window;e(this.form).on("change",null,this.handleFormChange),e(this.form).on("input",null,this.handleFormChange),e(this.form).on("submit",this.handleFormSubmit)}else this.form.addEventListener("change",this.handleFormChange),this.form.addEventListener("input",this.handleFormChange),this.form.addEventListener("submit",this.handleFormSubmit)}unbindEvents(){if(window.jQuery){const{jQuery:e}=window;e(this.form).off("change",null,this.handleFormChange),e(this.form).off("input",null,this.handleFormChange),e(this.form).off("submit",this.handleFormSubmit)}else this.form.removeEventListener("change",this.handleFormChange),this.form.removeEventListener("input",this.handleFormChange),this.form.removeEventListener("submit",this.handleFormSubmit)}async loadContent(){try{if(this.id){const{form:e}=await C(this.id);this.content.innerHTML=e}else if(this.idBase){const{form:e,preview:t}=await S({idBase:this.idBase,instance:this.instance,number:this.number});if(this.content.innerHTML=e,this.hasPreview=!T(t),!this.instance.hash){const{instance:e}=await S({idBase:this.idBase,instance:this.instance,number:this.number,formData:H(this.form)});this.instance=e}}if(window.jQuery){const{jQuery:e}=window;e(document).trigger("widget-added",[e(this.element)])}}catch(e){this.onError(e)}}handleFormChange(){this.idBase&&this.saveForm()}handleFormSubmit(e){e.preventDefault(),this.saveForm()}async saveForm(){const e=H(this.form);try{if(this.id){const{form:t}=await C(this.id,e);if(this.content.innerHTML=t,window.jQuery){const{jQuery:e}=window;e(document).trigger("widget-updated",[e(this.element)])}}else if(this.idBase){const{instance:t,preview:n}=await S({idBase:this.idBase,instance:this.instance,number:this.number,formData:e});this.instance=t,this.hasPreview=!T(n)}}catch(e){this.onError(e)}}get instance(){return this._instance}set instance(e){this._instance!==e&&(this._instance=e,this.onChangeInstance(e))}get hasPreview(){return this._hasPreview}set hasPreview(e){this._hasPreview!==e&&(this._hasPreview=e,this.onChangeHasPreview(e))}}let k=0;function B(e,t={},n=null){const i=document.createElement(e);for(const[e,n]of Object.entries(t))i.setAttribute(e,n);if(Array.isArray(n))for(const e of n)e&&i.appendChild(e);else"string"==typeof n&&(i.innerText=n);return i}async function C(e,t=null){let n;return n=t?await E()({path:`/wp/v2/widgets/${e}?context=edit`,method:"PUT",data:{form_data:t}}):await E()({path:`/wp/v2/widgets/${e}?context=edit`,method:"GET"}),{form:n.rendered_form}}async function S({idBase:e,instance:t,number:n,formData:i=null}){const r=await E()({path:`/wp/v2/widget-types/${e}/encode`,method:"POST",data:{instance:t,number:n,form_data:i}});return{instance:r.instance,form:r.form,preview:r.preview}}function T(e){const t=document.createElement("div");return t.innerHTML=e,M(t)}function M(e){switch(e.nodeType){case e.TEXT_NODE:return""===e.nodeValue.trim();case e.ELEMENT_NODE:return!["AUDIO","CANVAS","EMBED","IFRAME","IMG","MATH","OBJECT","SVG","VIDEO"].includes(e.tagName)&&(!e.hasChildNodes()||Array.from(e.childNodes).every(M));default:return!0}}function H(e){return new window.URLSearchParams(Array.from(new window.FormData(e))).toString()}function I({title:e,isVisible:t,id:n,idBase:i,instance:r,isWide:o,onChangeInstance:s,onChangeHasPreview:l}){const d=(0,a.useRef)(),m=(0,b.useViewportMatch)("small"),g=(0,a.useRef)(new Set),p=(0,a.useRef)(new Set),{createNotice:f}=(0,w.useDispatch)(v.store);return(0,a.useEffect)((()=>{if(p.current.has(r))return void p.current.delete(r);const e=new _({id:n,idBase:i,instance:r,onChangeInstance(e){g.current.add(r),p.current.add(e),s(e)},onChangeHasPreview:l,onError(e){window.console.error(e),f("error",(0,h.sprintf)((0,h.__)('The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'),i||n))}});return d.current.appendChild(e.element),()=>{g.current.has(r)?g.current.delete(r):e.destroy()}}),[n,i,r,s,l,m]),o&&m?(0,a.createElement)("div",{className:c()({"wp-block-legacy-widget__container":t})},t&&(0,a.createElement)("h3",{className:"wp-block-legacy-widget__edit-form-title"},e),(0,a.createElement)(u.Popover,{focusOnMount:!1,placement:"right",offset:32,resize:!1,flip:!1,shift:!0},(0,a.createElement)("div",{ref:d,className:"wp-block-legacy-widget__edit-form",hidden:!t}))):(0,a.createElement)("div",{ref:d,className:"wp-block-legacy-widget__edit-form",hidden:!t},(0,a.createElement)("h3",{className:"wp-block-legacy-widget__edit-form-title"},e))}function P({idBase:e,instance:t,isVisible:n}){const[i,r]=(0,a.useState)(!1),[o,s]=(0,a.useState)("");(0,a.useEffect)((()=>{const n=void 0===window.AbortController?void 0:new window.AbortController;return async function(){const i=`/wp/v2/widget-types/${e}/render`;return await E()({path:i,method:"POST",signal:n?.signal,data:t?{instance:t}:{}})}().then((e=>{s(e.preview)})).catch((e=>{if("AbortError"!==e.name)throw e})),()=>n?.abort()}),[e,t]);const l=(0,b.useRefEffect)((e=>{if(!i)return;function t(){var t,n;const i=Math.max(null!==(t=e.contentDocument.documentElement?.offsetHeight)&&void 0!==t?t:0,null!==(n=e.contentDocument.body?.offsetHeight)&&void 0!==n?n:0);e.style.height=`${0!==i?i:100}px`}const{IntersectionObserver:n}=e.ownerDocument.defaultView,r=new n((([e])=>{e.isIntersecting&&t()}),{threshold:1});return r.observe(e),e.addEventListener("load",t),()=>{r.disconnect(),e.removeEventListener("load",t)}}),[i]);return(0,a.createElement)(a.Fragment,null,n&&!i&&(0,a.createElement)(u.Placeholder,null,(0,a.createElement)(u.Spinner,null)),(0,a.createElement)("div",{className:c()("wp-block-legacy-widget__edit-preview",{"is-offscreen":!n||!i})},(0,a.createElement)(u.Disabled,null,(0,a.createElement)("iframe",{ref:l,className:"wp-block-legacy-widget__edit-preview-iframe",tabIndex:"-1",title:(0,h.__)("Legacy Widget Preview"),srcDoc:o,onLoad:e=>{e.target.contentDocument.body.style.overflow="hidden",r(!0)},height:100}))))}function V({name:e}){return(0,a.createElement)("div",{className:"wp-block-legacy-widget__edit-no-preview"},e&&(0,a.createElement)("h3",null,e),(0,a.createElement)("p",null,(0,h.__)("No preview available.")))}function F({clientId:e,rawInstance:t}){const{replaceBlocks:n}=(0,w.useDispatch)(d.store);return(0,a.createElement)(u.ToolbarButton,{onClick:()=>{t.title?n(e,[(0,r.createBlock)("core/heading",{content:t.title}),...(0,r.rawHandler)({HTML:t.text})]):n(e,(0,r.rawHandler)({HTML:t.text}))}},(0,h.__)("Convert to blocks"))}function x({attributes:{id:e,idBase:t},setAttributes:n}){return(0,a.createElement)(u.Placeholder,{icon:(0,a.createElement)(d.BlockIcon,{icon:m}),label:(0,h.__)("Legacy Widget")},(0,a.createElement)(u.Flex,null,(0,a.createElement)(u.FlexBlock,null,(0,a.createElement)(p,{selectedId:null!=e?e:t,onSelect:({selectedId:e,isMulti:t})=>{n(e?t?{id:null,idBase:e,instance:{}}:{id:e,idBase:null,instance:null}:{id:null,idBase:null,instance:null})}}))))}function N({attributes:{id:e,idBase:t,instance:n},setAttributes:i,clientId:r,isSelected:o,isWide:s=!1}){const[l,c]=(0,a.useState)(null),p=null!=e?e:t,{record:v,hasResolved:b}=(0,g.useEntityRecord)("root","widgetType",p),y=(0,w.useSelect)((e=>e(d.store).isNavigationMode()),[]),E=(0,a.useCallback)((e=>{i({instance:e})}),[]);if(!v&&b)return(0,a.createElement)(u.Placeholder,{icon:(0,a.createElement)(d.BlockIcon,{icon:m}),label:(0,h.__)("Legacy Widget")},(0,h.__)("Widget is missing."));if(!b)return(0,a.createElement)(u.Placeholder,null,(0,a.createElement)(u.Spinner,null));const _=!t||!y&&o?"edit":"preview";return(0,a.createElement)(a.Fragment,null,"text"===t&&(0,a.createElement)(d.BlockControls,{group:"other"},(0,a.createElement)(F,{clientId:r,rawInstance:n.raw})),(0,a.createElement)(d.InspectorControls,null,(0,a.createElement)(f,{name:v.name,description:v.description})),(0,a.createElement)(I,{title:v.name,isVisible:"edit"===_,id:e,idBase:t,instance:n,isWide:s,onChangeInstance:E,onChangeHasPreview:c}),t&&(0,a.createElement)(a.Fragment,null,null===l&&"preview"===_&&(0,a.createElement)(u.Placeholder,null,(0,a.createElement)(u.Spinner,null)),!0===l&&(0,a.createElement)(P,{idBase:t,instance:n,isVisible:"preview"===_}),!1===l&&"preview"===_&&(0,a.createElement)(V,{name:v.name})))}const L=[{block:"core/calendar",widget:"calendar"},{block:"core/search",widget:"search"},{block:"core/html",widget:"custom_html",transform:({content:e})=>({content:e})},{block:"core/archives",widget:"archives",transform:({count:e,dropdown:t})=>({displayAsDropdown:!!t,showPostCounts:!!e})},{block:"core/latest-posts",widget:"recent-posts",transform:({show_date:e,number:t})=>({displayPostDate:!!e,postsToShow:t})},{block:"core/latest-comments",widget:"recent-comments",transform:({number:e})=>({commentsToShow:e})},{block:"core/tag-cloud",widget:"tag_cloud",transform:({taxonomy:e,count:t})=>({showTagCounts:!!t,taxonomy:e})},{block:"core/categories",widget:"categories",transform:({count:e,dropdown:t,hierarchical:n})=>({displayAsDropdown:!!t,showPostCounts:!!e,showHierarchy:!!n})},{block:"core/audio",widget:"media_audio",transform:({url:e,preload:t,loop:n,attachment_id:i})=>({src:e,id:i,preload:t,loop:n})},{block:"core/video",widget:"media_video",transform:({url:e,preload:t,loop:n,attachment_id:i})=>({src:e,id:i,preload:t,loop:n})},{block:"core/image",widget:"media_image",transform:({alt:e,attachment_id:t,caption:n,height:i,link_classes:r,link_rel:a,link_target_blank:o,link_type:s,link_url:l,size:c,url:d,width:u})=>({alt:e,caption:n,height:i,id:t,link:l,linkClass:r,linkDestination:s,linkTarget:o?"_blank":void 0,rel:a,sizeSlug:c,url:d,width:u})},{block:"core/gallery",widget:"media_gallery",transform:({ids:e,link_type:t,size:n,number:i})=>({ids:e,columns:i,linkTo:t,sizeSlug:n,images:e.map((e=>({id:e})))})},{block:"core/rss",widget:"rss",transform:({url:e,show_author:t,show_date:n,show_summary:i,items:r})=>({feedURL:e,displayAuthor:!!t,displayDate:!!n,displayExcerpt:!!i,itemsToShow:r})}].map((({block:e,widget:t,transform:n})=>({type:"block",blocks:[e],isMatch:({idBase:e,instance:n})=>e===t&&!!n?.raw,transform:({instance:t})=>{const i=(0,r.createBlock)(e,n?n(t.raw):void 0);return t.raw?.title?[(0,r.createBlock)("core/heading",{content:t.raw.title}),i]:i}})));var D={to:L};const A={apiVersion:3,name:"core/legacy-widget",title:"Legacy Widget",category:"widgets",description:"Display a legacy widget.",textdomain:"default",attributes:{id:{type:"string",default:null},idBase:{type:"string",default:null},instance:{type:"object",default:null}},supports:{html:!1,customClassName:!1,reusable:!1},editorStyle:"wp-block-legacy-widget-editor"},{name:W}=A,O={icon:s,edit:function(e){const{id:t,idBase:n}=e.attributes,{isWide:i=!1}=e,r=(0,d.useBlockProps)({className:c()({"is-wide-widget":i})});return(0,a.createElement)("div",{...r},t||n?(0,a.createElement)(N,{...e}):(0,a.createElement)(x,{...e}))},transforms:D};var j=(0,a.createElement)(o.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(o.Path,{d:"M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"}));function z({clientId:e}){return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(u.Placeholder,{className:"wp-block-widget-group__placeholder",icon:(0,a.createElement)(d.BlockIcon,{icon:j}),label:(0,h.__)("Widget Group")},(0,a.createElement)(d.ButtonBlockAppender,{rootClientId:e})),(0,a.createElement)(d.InnerBlocks,{renderAppender:!1}))}function G({attributes:e,setAttributes:t}){var n;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(d.RichText,{tagName:"h2",className:"widget-title",allowedFormats:[],placeholder:(0,h.__)("Title"),value:null!==(n=e.title)&&void 0!==n?n:"",onChange:e=>t({title:e})}),(0,a.createElement)(d.InnerBlocks,null))}var R=[{attributes:{title:{type:"string"}},supports:{html:!1,inserter:!0,customClassName:!0,reusable:!1},save({attributes:e}){return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(d.RichText.Content,{tagName:"h2",className:"widget-title",value:e.title}),(0,a.createElement)(d.InnerBlocks.Content,null))}}];const Q={apiVersion:3,name:"core/widget-group",category:"widgets",attributes:{title:{type:"string"}},supports:{html:!1,inserter:!0,customClassName:!0,reusable:!1},editorStyle:"wp-block-widget-group-editor",style:"wp-block-widget-group"},{name:$}=Q,Z={title:(0,h.__)("Widget Group"),description:(0,h.__)("Create a classic widget layout with a title that’s styled by your theme for your widget areas."),icon:j,__experimentalLabel:({name:e})=>e,edit:function(e){const{clientId:t}=e,{innerBlocks:n}=(0,w.useSelect)((e=>e(d.store).getBlock(t)),[t]);return(0,a.createElement)("div",{...(0,d.useBlockProps)({className:"widget"})},0===n.length?(0,a.createElement)(z,{...e}):(0,a.createElement)(G,{...e}))},save:function({attributes:e}){return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(d.RichText.Content,{tagName:"h2",className:"widget-title",value:e.title}),(0,a.createElement)("div",{className:"wp-widget-group__inner-blocks"},(0,a.createElement)(d.InnerBlocks.Content,null)))},transforms:{from:[{type:"block",isMultiBlock:!0,blocks:["*"],isMatch(e,t){return!t.some((e=>"core/widget-group"===e.name))},__experimentalConvert(e){let t=[...e.map((e=>(0,r.createBlock)(e.name,e.attributes,e.innerBlocks)))];const n="core/heading"===t[0].name?t[0]:null;return t=t.filter((e=>e!==n)),(0,r.createBlock)("core/widget-group",{...n&&{title:n.attributes.content}},t)}}]},deprecated:R};var U=(0,a.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(o.Path,{d:"M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"}));function J({currentWidgetAreaId:e,widgetAreas:t,onSelect:n}){return(0,a.createElement)(u.ToolbarGroup,null,(0,a.createElement)(u.ToolbarItem,null,(i=>(0,a.createElement)(u.DropdownMenu,{icon:U,label:(0,h.__)("Move to widget area"),toggleProps:i},(({onClose:i})=>(0,a.createElement)(u.MenuGroup,{label:(0,h.__)("Move to")},(0,a.createElement)(u.MenuItemsChoice,{choices:t.map((e=>({value:e.id,label:e.name,info:e.description}))),value:e,onSelect:e=>{n(e),i()}})))))))}function X(e){return e.attributes.__internalWidgetId}function q(e,t){return{...e,attributes:{...e.attributes||{},__internalWidgetId:t}}}function K(e){const t=(0,w.subscribe)((()=>{var n;const i=null!==(n=e?.widgetTypesToHideFromLegacyWidgetBlock)&&void 0!==n?n:[],a=(0,w.select)(g.store).getWidgetTypes({per_page:-1})?.filter((e=>!i.includes(e.id)));a&&(t(),(0,w.dispatch)(r.store).addBlockVariations("core/legacy-widget",a.map((e=>({name:e.id,title:e.name,description:e.description,attributes:e.is_multi?{idBase:e.id,instance:{}}:{id:e.id}})))))}))}function Y(t={}){const{metadata:n,settings:i,name:a}=e;(0,r.registerBlockType)({name:a,...n},{...i,supports:{...i.supports,...t}})}function ee(e={}){const{metadata:n,settings:i,name:a}=t;(0,r.registerBlockType)({name:a,...n},{...i,supports:{...i.supports,...e}})}}(),(window.wp=window.wp||{}).widgets=i}();