/*! This file is auto-generated */ this.wp=this.wp||{},this.wp.widgets=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},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="4g8P")}({"1ZqX":function(e,t){e.exports=window.wp.data},"4g8P":function(e,t,n){"use strict";n.r(t),n.d(t,"MoveToWidgetArea",(function(){return Q})),n.d(t,"getWidgetIdFromBlock",(function(){return R})),n.d(t,"addWidgetIdToBlock",(function(){return G})),n.d(t,"registerLegacyWidgetBlock",(function(){return q})),n.d(t,"registerLegacyWidgetVariations",(function(){return U}));var i={};n.r(i),n.d(i,"metadata",(function(){return D})),n.d(i,"name",(function(){return A})),n.d(i,"settings",(function(){return N}));var r=n("HSyU"),o=n("GRId"),a=n("Tqx9");var s=Object(o.createElement)(a.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(o.createElement)(a.Path,{d:"M7 11h2v2H7v-2zm14-5v14l-2 2H5l-2-2V6l2-2h1V2h2v2h8V2h2v2h1l2 2zM5 8h14V6H5v2zm14 12V10H5v10h14zm-4-7h2v-2h-2v2zm-4 0h2v-2h-2v2z"})),c=n("TSYQ"),l=n.n(c),d=n("axFQ"),u=n("tI+e");var m=Object(o.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(a.Path,{d:"M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"}));var h=Object(o.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(o.createElement)(a.Path,{d:"M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4-3.5-4h2.32c-.45-1.97-2.21-3.45-4.32-3.45-1.45 0-2.73.71-3.54 1.78L4.95 5.66C6.23 4.2 8.11 3.28 10.2 3.28zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48c.45 1.97 2.21 3.45 4.32 3.45 1.45 0 2.73-.71 3.54-1.78l1.71 1.95c-1.28 1.46-3.15 2.38-5.25 2.38z"})),w=n("l3Sj"),g=n("1ZqX"),b=n("jZUy");function p({selectedId:e,onSelect:t}){const n=Object(g.useSelect)(e=>{var t,n,i;const r=null!==(t=null===(n=e(d.store).getSettings())||void 0===n?void 0:n.widgetTypesToHideFromLegacyWidgetBlock)&&void 0!==t?t:[];return null===(i=e(b.store).getWidgetTypes({per_page:-1}))||void 0===i?void 0:i.filter(e=>!r.includes(e.id))},[]);return n?0===n.length?Object(w.__)("There are no widgets available."):Object(o.createElement)(u.SelectControl,{label:Object(w.__)("Select a legacy widget to display:"),value:null!=e?e:"",options:[{value:"",label:Object(w.__)("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})}}):Object(o.createElement)(u.Spinner,null)}function f({name:e,description:t}){return Object(o.createElement)("div",{className:"wp-block-legacy-widget-inspector-card"},Object(o.createElement)("h3",{className:"wp-block-legacy-widget-inspector-card__name"},e),Object(o.createElement)("span",null,t))}var v=n("onLe"),j=n("K9lf"),y=n("YLtl"),O=n("ywyh"),_=n.n(O);class E{constructor({id:e,idBase:t,instance:n,onChangeInstance:i,onChangeHasPreview:r,onError:o}){this.id=e,this.idBase=t,this._instance=n,this._hasPreview=null,this.onChangeInstance=i,this.onChangeHasPreview=r,this.onError=o,this.number=++k,this.handleFormChange=Object(y.debounce)(this.saveForm.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=S("div",{class:"widget open"},[S("div",{class:"widget-inside"},[this.form=S("form",{class:"form",method:"post"},[S("input",{class:"widget-id",type:"hidden",name:"widget-id",value:null!==(e=this.id)&&void 0!==e?e:`${this.idBase}-${this.number}`}),S("input",{class:"id_base",type:"hidden",name:"id_base",value:null!==(t=this.idBase)&&void 0!==t?t:this.id}),S("input",{class:"widget-width",type:"hidden",name:"widget-width",value:"250"}),S("input",{class:"widget-height",type:"hidden",name:"widget-height",value:"200"}),S("input",{class:"widget_number",type:"hidden",name:"widget_number",value:this.idBase?this.number.toString():""}),this.content=S("div",{class:"widget-content"}),this.id&&S("button",{class:"button is-primary",type:"submit"},Object(w.__)("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 B(this.id);this.content.innerHTML=e}else if(this.idBase){const{form:e,preview:t}=await T({idBase:this.idBase,instance:this.instance,number:this.number});if(this.content.innerHTML=e,this.hasPreview=!x(t),!this.instance.hash){const{instance:e}=await T({idBase:this.idBase,instance:this.instance,number:this.number,formData:C(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)}}handleFormSubmit(e){e.preventDefault(),this.saveForm()}async saveForm(){const e=C(this.form);try{if(this.id){const{form:t}=await B(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 T({idBase:this.idBase,instance:this.instance,number:this.number,formData:e});this.instance=t,this.hasPreview=!x(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 S(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 B(e,t=null){let n;return n=t?await _()({path:`/wp/v2/widgets/${e}?context=edit`,method:"PUT",data:{form_data:t}}):await _()({path:`/wp/v2/widgets/${e}?context=edit`,method:"GET"}),{form:n.rendered_form}}async function T({idBase:e,instance:t,number:n,formData:i=null}){const r=await _()({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 x(e){const t=document.createElement("div");return t.innerHTML=e,""===t.innerText.trim()}function C(e){return new window.URLSearchParams(Array.from(new window.FormData(e))).toString()}function P({title:e,isVisible:t,id:n,idBase:i,instance:r,isWide:a,onChangeInstance:s,onChangeHasPreview:c}){const d=Object(o.useRef)(),m=Object(j.useViewportMatch)("small"),h=Object(o.useRef)(new Set),b=Object(o.useRef)(new Set),{createNotice:p}=Object(g.useDispatch)(v.store);return Object(o.useEffect)(()=>{if(b.current.has(r))return void b.current.delete(r);const e=new E({id:n,idBase:i,instance:r,onChangeInstance(e){h.current.add(r),b.current.add(e),s(e)},onChangeHasPreview:c,onError(e){var t;p("error",null!==(t=null==e?void 0:e.message)&&void 0!==t?t:Object(w.__)("An error occured while fetching or updating the widget."))}});return d.current.appendChild(e.element),()=>{h.current.has(r)?h.current.delete(r):e.destroy()}},[n,i,r,s,c,m]),a&&m?Object(o.createElement)("div",{className:l()({"wp-block-legacy-widget__container":t})},t&&Object(o.createElement)("h3",{className:"wp-block-legacy-widget__edit-form-title"},e),Object(o.createElement)(u.Popover,{focusOnMount:!1,position:"middle right",__unstableForceXAlignment:!0},Object(o.createElement)("div",{ref:d,className:"wp-block-legacy-widget__edit-form",hidden:!t}))):Object(o.createElement)("div",{ref:d,className:"wp-block-legacy-widget__edit-form",hidden:!t},Object(o.createElement)("h3",{className:"wp-block-legacy-widget__edit-form-title"},e))}var M=n("Mmq9");function L({idBase:e,instance:t,isVisible:n}){const[i,r]=Object(o.useState)(),a=Object(j.useRefEffect)(e=>{function t(){var t,n;const i=null==e||null===(t=e.contentDocument)||void 0===t||null===(n=t.body)||void 0===n?void 0:n.getBoundingClientRect();i&&r(i.top+i.height)}const{IntersectionObserver:n}=e.ownerDocument.defaultView;return new n(t,{threshold:1}).observe(e),e.addEventListener("load",t),()=>{e.removeEventListener("load",t)}},[]);return Object(o.createElement)(o.Fragment,null,n&&null===i&&Object(o.createElement)(u.Placeholder,null,Object(o.createElement)(u.Spinner,null)),Object(o.createElement)("div",{className:l()("wp-block-legacy-widget__edit-preview",{"is-offscreen":!n||null===i})},Object(o.createElement)(u.Disabled,null,Object(o.createElement)("iframe",{ref:a,className:"wp-block-legacy-widget__edit-preview-iframe",title:Object(w.__)("Legacy Widget Preview"),src:Object(M.addQueryArgs)("widgets.php",{"legacy-widget-preview":{idBase:e,instance:t}}),height:i||100}))))}function F({name:e}){return Object(o.createElement)("div",{className:"wp-block-legacy-widget__edit-no-preview"},e&&Object(o.createElement)("h3",null,e),Object(o.createElement)("p",null,Object(w.__)("No preview available.")))}function H({clientId:e,rawInstance:t}){const{replaceBlocks:n}=Object(g.useDispatch)(d.store);return Object(o.createElement)(u.ToolbarButton,{onClick:()=>{t.title?n(e,[Object(r.createBlock)("core/heading",{content:t.title}),...Object(r.rawHandler)({HTML:t.text})]):n(e,Object(r.rawHandler)({HTML:t.text}))}},Object(w.__)("Convert to blocks"))}function I({attributes:{id:e,idBase:t},setAttributes:n}){return Object(o.createElement)(u.Placeholder,{icon:Object(o.createElement)(d.BlockIcon,{icon:m}),label:Object(w.__)("Legacy Widget")},Object(o.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 W({attributes:{id:e,idBase:t,instance:n},setAttributes:i,clientId:r,isSelected:a,isWide:s=!1}){const[c,l]=Object(o.useState)(null),{widgetType:p,hasResolvedWidgetType:v,isWidgetTypeHidden:j,isNavigationMode:y}=Object(g.useSelect)(n=>{var i,r;const o=null!=e?e:t,a=null!==(i=null===(r=n(d.store).getSettings())||void 0===r?void 0:r.widgetTypesToHideFromLegacyWidgetBlock)&&void 0!==i?i:[];return{widgetType:n(b.store).getWidgetType(o),hasResolvedWidgetType:n(b.store).hasFinishedResolution("getWidgetType",[o]),isWidgetTypeHidden:a.includes(o),isNavigationMode:n(d.store).isNavigationMode()}},[e,t]),O=Object(o.useCallback)(e=>{i({instance:e})},[]);if(!p&&v)return Object(o.createElement)(u.Placeholder,{icon:Object(o.createElement)(d.BlockIcon,{icon:m}),label:Object(w.__)("Legacy Widget")},Object(w.__)("Widget is missing."));if(!v)return Object(o.createElement)(u.Placeholder,null,Object(o.createElement)(u.Spinner,null));const _=y||!a?"preview":"edit";return Object(o.createElement)(o.Fragment,null,!j&&Object(o.createElement)(d.BlockControls,{group:"block"},Object(o.createElement)(u.ToolbarButton,{label:Object(w.__)("Change widget"),icon:h,onClick:()=>i({id:null,idBase:null,instance:null})})),"text"===t&&Object(o.createElement)(d.BlockControls,{group:"other"},Object(o.createElement)(H,{clientId:r,rawInstance:n.raw})),Object(o.createElement)(d.InspectorControls,null,Object(o.createElement)(f,{name:p.name,description:p.description})),Object(o.createElement)(P,{title:p.name,isVisible:"edit"===_,id:e,idBase:t,instance:n,isWide:s,onChangeInstance:O,onChangeHasPreview:l}),t&&Object(o.createElement)(o.Fragment,null,null===c&&"preview"===_&&Object(o.createElement)(u.Placeholder,null,Object(o.createElement)(u.Spinner,null)),!0===c&&Object(o.createElement)(L,{idBase:t,instance:n,isVisible:"preview"===_}),!1===c&&"preview"===_&&Object(o.createElement)(F,{name:p.name})))}var V={to:[{block:"core/calendar",widget:"calendar"},{block:"core/search",widget:"search"},{block:"core/html",widget:"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:o,link_target_blank:a,link_type:s,link_url:c,size:l,url:d,width:u})=>({alt:e,caption:n,height:i,id:t,link:c,linkClass:r,linkDestination:s,linkTarget:a?"_blank":void 0,rel:o,sizeSlug:l,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&&!(null==n||!n.raw),transform:({instance:t})=>{var i;const o=Object(r.createBlock)(e,n?n(t.raw):void 0);return null!==(i=t.raw)&&void 0!==i&&i.title?[Object(r.createBlock)("core/heading",{content:t.raw.title}),o]:o}}))};const D={apiVersion:2,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:A}=D,N={icon:s,edit:function(e){const{id:t,idBase:n}=e.attributes,{isWide:i=!1}=e,r=Object(d.useBlockProps)({className:l()({"is-wide-widget":i})});return Object(o.createElement)("div",r,t||n?Object(o.createElement)(W,e):Object(o.createElement)(I,e))},transforms:V};var z=Object(o.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(a.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 Q({currentWidgetAreaId:e,widgetAreas:t,onSelect:n}){return Object(o.createElement)(u.ToolbarGroup,null,Object(o.createElement)(u.ToolbarItem,null,i=>Object(o.createElement)(u.DropdownMenu,{icon:z,label:Object(w.__)("Move to widget area"),toggleProps:i},({onClose:i})=>Object(o.createElement)(u.MenuGroup,{label:Object(w.__)("Move to")},Object(o.createElement)(u.MenuItemsChoice,{choices:t.map(e=>({value:e.id,label:e.name,info:e.description})),value:e,onSelect:e=>{n(e),i()}})))))}function R(e){return e.attributes.__internalWidgetId}function G(e,t){return{...e,attributes:{...e.attributes||{},__internalWidgetId:t}}}function U(e){const t=Object(g.subscribe)(()=>{var n,i;const o=null!==(n=null==e?void 0:e.widgetTypesToHideFromLegacyWidgetBlock)&&void 0!==n?n:[],a=null===(i=Object(g.select)(b.store).getWidgetTypes({per_page:-1}))||void 0===i?void 0:i.filter(e=>!o.includes(e.id));a&&(t(),Object(g.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 q(){const{metadata:e,settings:t,name:n}=i;Object(r.registerBlockType)({name:n,...e},t)}},GRId:function(e,t){e.exports=window.wp.element},HSyU:function(e,t){e.exports=window.wp.blocks},K9lf:function(e,t){e.exports=window.wp.compose},Mmq9:function(e,t){e.exports=window.wp.url},TSYQ:function(e,t,n){var i; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t