From 433fd94980a1b73d567463207415661cd21ce0b1 Mon Sep 17 00:00:00 2001
From: youknowriad
`.split("
");return t.shift(),t.pop(),t.join("
")}const $v={attributes:{value:{type:"string",source:"html",selector:"blockquote",multiline:"p",__experimentalRole:"content"},citation:{type:"string",source:"html",selector:"cite",default:"",__experimentalRole:"content"},textAlign:{type:"string"}},save({attributes:e}){const{textAlign:t,citation:n,value:a}=e,o=!nt.RichText.isEmpty(n);return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:mt()({[`has-text-align-${t}`]:t})})},(0,Ke.createElement)("blockquote",null,(0,Ke.createElement)(nt.RichText.Content,{value:a,multiline:!0}),o&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:n})))},migrate:({value:e,...t})=>({value:Fv(e),...t})},Gv={attributes:{...Dv},save({attributes:e}){const{mainColor:t,customMainColor:n,customTextColor:a,textColor:o,value:r,citation:l,className:i}=e,s=i?.includes(Lv);let c,u;if(s){const e=(0,nt.getColorClassName)("background-color",t);c=mt()({"has-background":e||n,[e]:e}),u={backgroundColor:e?void 0:n}}else n&&(u={borderColor:n});const m=(0,nt.getColorClassName)("color",o),p=mt()({"has-text-color":o||a,[m]:m}),d=m?void 0:{color:a};return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:c,style:u})},(0,Ke.createElement)("blockquote",{className:p,style:d},(0,Ke.createElement)(nt.RichText.Content,{value:r,multiline:!0}),!nt.RichText.isEmpty(l)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:l})))},migrate({value:e,className:t,mainColor:n,customMainColor:a,customTextColor:o,...r}){const l=t?.includes(Lv);let i;return a&&(i=l?{color:{background:a}}:{border:{color:a}}),o&&i&&(i.color={...i.color,text:o}),{value:Fv(e),className:t,backgroundColor:l?n:void 0,borderColor:l?void 0:n,textAlign:l?"left":void 0,style:i,...r}}},Ov={attributes:{...Dv,figureStyle:{source:"attribute",selector:"figure",attribute:"style"}},save({attributes:e}){const{mainColor:t,customMainColor:n,textColor:a,customTextColor:o,value:r,citation:l,className:i,figureStyle:s}=e,c=i?.includes(Lv);let u,m;if(c){const e=(0,nt.getColorClassName)("background-color",t);u=mt()({"has-background":e||n,[e]:e}),m={backgroundColor:e?void 0:n}}else if(n)m={borderColor:n};else if(t){m={borderColor:Vv(s)}}const p=(0,nt.getColorClassName)("color",a),d=(a||o)&&mt()("has-text-color",{[p]:p}),g=p?void 0:{color:o};return(0,Ke.createElement)("figure",{className:u,style:m},(0,Ke.createElement)("blockquote",{className:d,style:g},(0,Ke.createElement)(nt.RichText.Content,{value:r,multiline:!0}),!nt.RichText.isEmpty(l)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:l})))},migrate({value:e,className:t,figureStyle:n,mainColor:a,customMainColor:o,customTextColor:r,...l}){const i=t?.includes(Lv);let s;if(o&&(s=i?{color:{background:o}}:{border:{color:o}}),r&&s&&(s.color={...s.color,text:r}),!i&&a&&n){const a=Vv(n);if(a)return{value:Fv(e),...l,className:t,style:{border:{color:a}}}}return{value:Fv(e),className:t,backgroundColor:i?a:void 0,borderColor:i?void 0:a,textAlign:i?"left":void 0,style:s,...l}}},Uv={attributes:Dv,save({attributes:e}){const{mainColor:t,customMainColor:n,textColor:a,customTextColor:o,value:r,citation:l,className:i}=e,s=i?.includes(Lv);let c,u;if(s)c=(0,nt.getColorClassName)("background-color",t),c||(u={backgroundColor:n});else if(n)u={borderColor:n};else if(t){var m;const e=null!==(m=(0,gt.select)(nt.store).getSettings().colors)&&void 0!==m?m:[];u={borderColor:(0,nt.getColorObjectByAttributeValues)(e,t).color}}const p=(0,nt.getColorClassName)("color",a),d=a||o?mt()("has-text-color",{[p]:p}):void 0,g=p?void 0:{color:o};return(0,Ke.createElement)("figure",{className:c,style:u},(0,Ke.createElement)("blockquote",{className:d,style:g},(0,Ke.createElement)(nt.RichText.Content,{value:r,multiline:!0}),!nt.RichText.isEmpty(l)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:l})))},migrate({value:e,className:t,mainColor:n,customMainColor:a,customTextColor:o,...r}){const l=t?.includes(Lv);let i={};return a&&(i=l?{color:{background:a}}:{border:{color:a}}),o&&i&&(i.color={...i.color,text:o}),{value:Fv(e),className:t,backgroundColor:l?n:void 0,borderColor:l?void 0:n,textAlign:l?"left":void 0,style:i,...r}}},qv={attributes:{...Dv},save({attributes:e}){const{value:t,citation:n}=e;return(0,Ke.createElement)("blockquote",null,(0,Ke.createElement)(nt.RichText.Content,{value:t,multiline:!0}),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:n}))},migrate:({value:e,...t})=>({value:Fv(e),...t})},jv={attributes:{...Dv,citation:{type:"string",source:"html",selector:"footer"},align:{type:"string",default:"none"}},save({attributes:e}){const{value:t,citation:n,align:a}=e;return(0,Ke.createElement)("blockquote",{className:`align${a}`},(0,Ke.createElement)(nt.RichText.Content,{value:t,multiline:!0}),!nt.RichText.isEmpty(n)&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"footer",value:n}))},migrate:({value:e,...t})=>({value:Fv(e),...t})},Wv=[$v,Gv,Ov,Uv,qv,jv],Zv="web"===_t.Platform.OS;const Qv=function({attributes:e,setAttributes:t,isSelected:n,insertBlocksAfter:a}){const{textAlign:o,citation:r,value:l}=e,i=(0,nt.useBlockProps)({className:mt()({[`has-text-align-${o}`]:o})}),s=!nt.RichText.isEmpty(r)||n;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(nt.BlockControls,{group:"block"},(0,Ke.createElement)(nt.AlignmentControl,{value:o,onChange:e=>{t({textAlign:e})}})),(0,Ke.createElement)("figure",{...i},(0,Ke.createElement)("blockquote",null,(0,Ke.createElement)(nt.RichText,{identifier:"value",tagName:"p",value:l,onChange:e=>t({value:e}),"aria-label":(0,tt.__)("Pullquote text"),placeholder:(0,tt.__)("Add quote"),textAlign:"center"}),s&&(0,Ke.createElement)(nt.RichText,{identifier:"citation",tagName:Zv?"cite":void 0,style:{display:"block"},value:r,"aria-label":(0,tt.__)("Pullquote citation text"),placeholder:(0,tt.__)("Add citation"),onChange:e=>t({citation:e}),className:"wp-block-pullquote__citation",__unstableMobileNoFocusOnMount:!0,textAlign:"center",__unstableOnSplitAtEnd:()=>a((0,Qe.createBlock)((0,Qe.getDefaultBlockName)()))}))))};const Kv={from:[{type:"block",isMultiBlock:!0,blocks:["core/paragraph"],transform:e=>(0,Qe.createBlock)("core/pullquote",{value:(0,zn.toHTMLString)({value:(0,zn.join)(e.map((({content:e})=>(0,zn.create)({html:e}))),"\n")}),anchor:e.anchor})},{type:"block",blocks:["core/heading"],transform:({content:e,anchor:t})=>(0,Qe.createBlock)("core/pullquote",{value:e,anchor:t})}],to:[{type:"block",blocks:["core/paragraph"],transform:({value:e,citation:t})=>{const n=[];return e&&n.push((0,Qe.createBlock)("core/paragraph",{content:e})),t&&n.push((0,Qe.createBlock)("core/paragraph",{content:t})),0===n.length?(0,Qe.createBlock)("core/paragraph",{content:""}):n}},{type:"block",blocks:["core/heading"],transform:({value:e,citation:t})=>{if(!e)return(0,Qe.createBlock)("core/heading",{content:t});const n=(0,Qe.createBlock)("core/heading",{content:e});return t?[n,(0,Qe.createBlock)("core/heading",{content:t})]:n}}]},Yv=Kv,Jv={$schema:"https://schemas.wp.org/trunk/block.json",apiVersion:3,name:"core/pullquote",title:"Pullquote",category:"text",description:"Give special visual emphasis to a quote from your text.",textdomain:"default",attributes:{value:{type:"rich-text",source:"rich-text",selector:"p",__experimentalRole:"content"},citation:{type:"rich-text",source:"rich-text",selector:"cite",__experimentalRole:"content"},textAlign:{type:"string"}},supports:{anchor:!0,align:["left","right","wide","full"],color:{gradients:!0,background:!0,link:!0,__experimentalDefaultControls:{background:!0,text:!0}},spacing:{margin:!0,padding:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontFamily:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalTextTransform:!0,__experimentalTextDecoration:!0,__experimentalLetterSpacing:!0,__experimentalDefaultControls:{fontSize:!0}},__experimentalBorder:{color:!0,radius:!0,style:!0,width:!0,__experimentalDefaultControls:{color:!0,radius:!0,style:!0,width:!0}},__experimentalStyle:{typography:{fontSize:"1.5em",lineHeight:"1.6"}},interactivity:{clientNavigation:!0}},editorStyle:"wp-block-pullquote-editor",style:"wp-block-pullquote"},{name:Xv}=Jv,ef={icon:Hv,example:{attributes:{value:(0,tt.__)("One of the hardest things to do in technology is disrupt yourself."),citation:(0,tt.__)("Matt Mullenweg")}},transforms:Yv,edit:Qv,save:function({attributes:e}){const{textAlign:t,citation:n,value:a}=e,o=!nt.RichText.isEmpty(n);return(0,Ke.createElement)("figure",{...nt.useBlockProps.save({className:mt()({[`has-text-align-${t}`]:t})})},(0,Ke.createElement)("blockquote",null,(0,Ke.createElement)(nt.RichText.Content,{tagName:"p",value:a}),o&&(0,Ke.createElement)(nt.RichText.Content,{tagName:"cite",value:n})))},deprecated:Wv},tf=()=>Xe({name:Xv,metadata:Jv,settings:ef}),nf=(0,Ke.createElement)(Ye.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,Ke.createElement)(Ye.Path,{d:"M18.1823 11.6392C18.1823 13.0804 17.0139 14.2487 15.5727 14.2487C14.3579 14.2487 13.335 13.4179 13.0453 12.2922L13.0377 12.2625L13.0278 12.2335L12.3985 10.377L12.3942 10.3785C11.8571 8.64997 10.246 7.39405 8.33961 7.39405C5.99509 7.39405 4.09448 9.29465 4.09448 11.6392C4.09448 13.9837 5.99509 15.8843 8.33961 15.8843C8.88499 15.8843 9.40822 15.781 9.88943 15.5923L9.29212 14.0697C8.99812 14.185 8.67729 14.2487 8.33961 14.2487C6.89838 14.2487 5.73003 13.0804 5.73003 11.6392C5.73003 10.1979 6.89838 9.02959 8.33961 9.02959C9.55444 9.02959 10.5773 9.86046 10.867 10.9862L10.8772 10.9836L11.4695 12.7311C11.9515 14.546 13.6048 15.8843 15.5727 15.8843C17.9172 15.8843 19.8178 13.9837 19.8178 11.6392C19.8178 9.29465 17.9172 7.39404 15.5727 7.39404C15.0287 7.39404 14.5066 7.4968 14.0264 7.6847L14.6223 9.20781C14.9158 9.093 15.2358 9.02959 15.5727 9.02959C17.0139 9.02959 18.1823 10.1979 18.1823 11.6392Z"})),af=(0,Ke.createElement)(Ye.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,Ke.createElement)(Ye.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,Ke.createElement)(Ye.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})),of=e=>{const t=e?.reduce(((e,t)=>{const{mapById:n,mapByName:a,names:o}=e;return n[t.id]=t,a[t.name]=t,o.push(t.name),e}),{mapById:{},mapByName:{},names:[]});return{entities:e,...t}},rf=(e,t)=>{const n=t.split(".");let a=e;return n.forEach((e=>{a=a?.[e]})),a},lf=(e,t)=>(e||[]).map((e=>({...e,name:(0,Kn.decodeEntities)(rf(e,t))}))),sf=()=>{const e=(0,gt.useSelect)((e=>{const{getPostTypes:t}=e(dt.store),n=["attachment"],a=t({per_page:-1})?.filter((({viewable:e,slug:t})=>e&&!n.includes(t)));return a}),[]);return{postTypesTaxonomiesMap:(0,_t.useMemo)((()=>{if(e?.length)return e.reduce(((e,t)=>(e[t.slug]=t.taxonomies,e)),{})}),[e]),postTypesSelectOptions:(0,_t.useMemo)((()=>(e||[]).map((({labels:e,slug:t})=>({label:e.singular_name,value:t})))),[e])}},cf=e=>(0,gt.useSelect)((t=>{const{getTaxonomies:n}=t(dt.store);return n({type:e,per_page:-1,context:"view"})}),[e]);function uf(e,t){return!e||e.includes(t)}function mf(e,t){const n=(0,gt.useSelect)((e=>e(Qe.store).getActiveBlockVariation("core/query",t)?.name),[t]),a=`core/query/${n}`;return(0,gt.useSelect)((t=>{if(!n)return!1;const{getBlockRootClientId:o,getPatternsByBlockTypes:r}=t(nt.store),l=o(e);return r(a,l).length>0}),[e,n,a])?a:"core/query"}const pf=(e,t)=>(0,gt.useSelect)((n=>{const{getBlockRootClientId:a,getPatternsByBlockTypes:o}=n(nt.store),r=a(e);return o(t,r)}),[t,e]),df=e=>(0,gt.useSelect)((t=>{const{getClientIdsOfDescendants:n,getBlockName:a}=t(nt.store),o={};return n(e).forEach((e=>{const t=a(e);t.startsWith("core/")?"core/post-content"===t&&(o.hasPostContentBlock=!0):o.hasBlocksFromPlugins=!0})),o.hasUnsupportedBlocks=o.hasBlocksFromPlugins||o.hasPostContentBlock,o}),[e]);function gf({attributes:{query:e},setQuery:t,openPatternSelectionModal:n,name:a,clientId:o}){const r=!!pf(o,a).length,l=(0,jt.useInstanceId)(gf,"blocks-query-pagination-max-page-input");return(0,Ke.createElement)(Ke.Fragment,null,!e.inherit&&(0,Ke.createElement)(et.ToolbarGroup,null,(0,Ke.createElement)(et.Dropdown,{contentClassName:"block-library-query-toolbar__popover",renderToggle:({onToggle:e})=>(0,Ke.createElement)(et.ToolbarButton,{icon:af,label:(0,tt.__)("Display settings"),onClick:e}),renderContent:()=>(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.BaseControl,null,(0,Ke.createElement)(et.__experimentalNumberControl,{__unstableInputWidth:"60px",label:(0,tt.__)("Items per Page"),labelPosition:"edge",min:1,max:100,onChange:e=>{isNaN(e)||e<1||e>100||t({perPage:e})},step:"1",value:e.perPage,isDragEnabled:!1})),(0,Ke.createElement)(et.BaseControl,null,(0,Ke.createElement)(et.__experimentalNumberControl,{__unstableInputWidth:"60px",label:(0,tt.__)("Offset"),labelPosition:"edge",min:0,max:100,onChange:e=>{isNaN(e)||e<0||e>100||t({offset:e})},step:"1",value:e.offset,isDragEnabled:!1})),(0,Ke.createElement)(et.BaseControl,{id:l,help:(0,tt.__)("Limit the pages you want to show, even if the query has more results. To show all pages use 0 (zero).")},(0,Ke.createElement)(et.__experimentalNumberControl,{id:l,__unstableInputWidth:"60px",label:(0,tt.__)("Max page to show"),labelPosition:"edge",min:0,onChange:e=>{isNaN(e)||e<0||t({pages:e})},step:"1",value:e.pages,isDragEnabled:!1})))})),r&&(0,Ke.createElement)(et.ToolbarGroup,{className:"wp-block-template-part__block-control-group"},(0,Ke.createElement)(et.ToolbarButton,{onClick:n},(0,tt.__)("Replace"))))}const hf=[{label:(0,tt.__)("Newest to oldest"),value:"date/desc"},{label:(0,tt.__)("Oldest to newest"),value:"date/asc"},{label:(0,tt.__)("A → Z"),value:"title/asc"},{label:(0,tt.__)("Z → A"),value:"title/desc"}];const bf=function({order:e,orderBy:t,onChange:n}){return(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Order by"),value:`${t}/${e}`,options:hf,onChange:e=>{const[t,a]=e.split("/");n({order:a,orderBy:t})}})},_f={who:"authors",per_page:-1,_fields:"id,name",context:"view"};const yf=function({value:e,onChange:t}){const n=(0,gt.useSelect)((e=>{const{getUsers:t}=e(dt.store);return t(_f)}),[]);if(!n)return null;const a=of(n),o=(e?e.toString().split(","):[]).reduce(((e,t)=>{const n=a.mapById[t];return n&&e.push({id:t,value:n.name}),e}),[]);return(0,Ke.createElement)(et.FormTokenField,{label:(0,tt.__)("Authors"),value:o,suggestions:a.names,onChange:e=>{const n=Array.from(e.reduce(((e,t)=>{const n=((e,t)=>{const n=t?.id||e[t]?.id;if(n)return n})(a.mapByName,t);return n&&e.add(n),e}),new Set));t({author:n.join(",")})},__experimentalShowHowTo:!1})},vf=[],ff={order:"asc",_fields:"id,title",context:"view"};const kf=function({parents:e,postType:t,onChange:n}){const[a,o]=(0,_t.useState)(""),[r,l]=(0,_t.useState)(vf),[i,s]=(0,_t.useState)(vf),c=(0,jt.useDebounce)(o,250),{searchResults:u,searchHasResolved:m}=(0,gt.useSelect)((n=>{if(!a)return{searchResults:vf,searchHasResolved:!0};const{getEntityRecords:o,hasFinishedResolution:r}=n(dt.store),l=["postType",t,{...ff,search:a,orderby:"relevance",exclude:e,per_page:20}];return{searchResults:o(...l),searchHasResolved:r("getEntityRecords",l)}}),[a,e]),p=(0,gt.useSelect)((n=>{if(!e?.length)return vf;const{getEntityRecords:a}=n(dt.store);return a("postType",t,{...ff,include:e,per_page:e.length})}),[e]);(0,_t.useEffect)((()=>{if(e?.length||l(vf),!p?.length)return;const t=of(lf(p,"title.rendered")),n=e.reduce(((e,n)=>{const a=t.mapById[n];return a&&e.push({id:n,value:a.name}),e}),[]);l(n)}),[e,p]);const d=(0,_t.useMemo)((()=>u?.length?of(lf(u,"title.rendered")):vf),[u]);return(0,_t.useEffect)((()=>{m&&s(d.names)}),[d.names,m]),(0,Ke.createElement)(et.FormTokenField,{label:(0,tt.__)("Parents"),value:r,onInputChange:c,suggestions:i,onChange:e=>{const t=Array.from(e.reduce(((e,t)=>{const n=((e,t)=>{const n=t?.id||e?.[t]?.id;if(n)return n})(d.mapByName,t);return n&&e.add(n),e}),new Set));s(vf),n({parents:t})},__experimentalShowHowTo:!1})},xf=[],wf={order:"asc",_fields:"id,name",context:"view"},Ef=(e,t)=>{const n=t?.id||e?.find((e=>e.name===t))?.id;if(n)return n;const a=t.toLocaleLowerCase();return e?.find((e=>e.name.toLocaleLowerCase()===a))?.id};function Cf({onChange:e,query:t}){const{postType:n,taxQuery:a}=t,o=cf(n);return o&&0!==o.length?(0,Ke.createElement)(Ke.Fragment,null,o.map((t=>{const n=a?.[t.slug]||[];return(0,Ke.createElement)(Sf,{key:t.slug,taxonomy:t,termIds:n,onChange:n=>e({taxQuery:{...a,[t.slug]:n}})})}))):null}function Sf({taxonomy:e,termIds:t,onChange:n}){const[a,o]=(0,_t.useState)(""),[r,l]=(0,_t.useState)(xf),[i,s]=(0,_t.useState)(xf),c=(0,jt.useDebounce)(o,250),{searchResults:u,searchHasResolved:m}=(0,gt.useSelect)((n=>{if(!a)return{searchResults:xf,searchHasResolved:!0};const{getEntityRecords:o,hasFinishedResolution:r}=n(dt.store),l=["taxonomy",e.slug,{...wf,search:a,orderby:"name",exclude:t,per_page:20}];return{searchResults:o(...l),searchHasResolved:r("getEntityRecords",l)}}),[a,t]),p=(0,gt.useSelect)((n=>{if(!t?.length)return xf;const{getEntityRecords:a}=n(dt.store);return a("taxonomy",e.slug,{...wf,include:t,per_page:t.length})}),[t]);(0,_t.useEffect)((()=>{if(t?.length||l(xf),!p?.length)return;const e=t.reduce(((e,t)=>{const n=p.find((e=>e.id===t));return n&&e.push({id:t,value:n.name}),e}),[]);l(e)}),[t,p]),(0,_t.useEffect)((()=>{m&&s(u.map((e=>e.name)))}),[u,m]);return(0,Ke.createElement)("div",{className:"block-library-query-inspector__taxonomy-control"},(0,Ke.createElement)(et.FormTokenField,{label:e.name,value:r,onInputChange:c,suggestions:i,displayTransform:Kn.decodeEntities,onChange:e=>{const t=new Set;for(const n of e){const e=Ef(u,n);e&&t.add(e)}s(xf),n(Array.from(t))},__experimentalShowHowTo:!1}))}const Bf=[{label:(0,tt.__)("Include"),value:""},{label:(0,tt.__)("Exclude"),value:"exclude"},{label:(0,tt.__)("Only"),value:"only"}];function Nf({value:e,onChange:t}){return(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Sticky posts"),options:Bf,value:e,onChange:t,help:(0,tt.__)("Blog posts can be “stickied”, a feature that places them at the top of the front page of posts, keeping it there until new sticky posts are published.")})}function Tf({enhancedPagination:e,setAttributes:t,clientId:n}){const{hasUnsupportedBlocks:a}=df(n);let o=(0,tt.__)("Browsing between pages requires a full page reload.");return e?o=(0,tt.__)("Browsing between pages won't require a full page reload, unless non-compatible blocks are detected."):a&&(o=(0,tt.__)("Force page reload can't be disabled because there are non-compatible blocks inside the Query block.")),(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(et.ToggleControl,{label:(0,tt.__)("Force page reload"),help:o,checked:!e,disabled:a,onChange:e=>{t({enhancedPagination:!e})}}))}const If=({attributes:{query:{postType:e}={}}={}})=>{if(!e)return null;const t=(0,pt.addQueryArgs)("post-new.php",{post_type:e});return(0,Ke.createElement)("div",{className:"wp-block-query__create-new-link"},(0,_t.createInterpolateElement)((0,tt.__)("Add new post"),{a:(0,Ke.createElement)("a",{href:t})}))},{BlockInfo:Pf}=Vt(nt.privateApis);function Mf(e){const{attributes:t,setQuery:n,setDisplayLayout:a,setAttributes:o,clientId:r}=e,{query:l,displayLayout:i,enhancedPagination:s}=t,{order:c,orderBy:u,author:m,postType:p,sticky:d,inherit:g,taxQuery:h,parents:b}=l,_=function(e){return(0,gt.useSelect)((t=>t(Qe.store).getActiveBlockVariation("core/query",e)?.allowedControls),[e])}(t),[y,v]=(0,_t.useState)("post"===p),{postTypesTaxonomiesMap:f,postTypesSelectOptions:k}=sf(),x=cf(p),w=function(e){return(0,gt.useSelect)((t=>{const n=t(dt.store).getPostType(e);return n?.viewable&&n?.hierarchical}),[e])}(p);(0,_t.useEffect)((()=>{v("post"===p)}),[p]);const[E,C]=(0,_t.useState)(l.search),S=(0,_t.useCallback)((0,jt.debounce)((()=>{l.search!==E&&n({search:E})}),250),[E,l.search]);(0,_t.useEffect)((()=>(S(),S.cancel)),[E,S]);const B=uf(_,"inherit"),N=!g&&uf(_,"postType"),T=!g&&uf(_,"order"),I=!g&&y&&uf(_,"sticky"),P=B||N||T||I,M=!!x?.length&&uf(_,"taxQuery"),z=uf(_,"author"),R=uf(_,"search"),A=uf(_,"parents")&&w,H=M||z||R||A;return(0,Ke.createElement)(Ke.Fragment,null,(0,Ke.createElement)(Pf,null,(0,Ke.createElement)(If,{...e})),P&&(0,Ke.createElement)(et.PanelBody,{title:(0,tt.__)("Settings")},B&&(0,Ke.createElement)(et.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Inherit query from template"),help:(0,tt.__)("Toggle to use the global query context that is set with the current template, such as an archive or search. Disable to customize the settings independently."),checked:!!g,onChange:e=>n({inherit:!!e})}),N&&(0,Ke.createElement)(et.SelectControl,{__nextHasNoMarginBottom:!0,options:k,value:p,label:(0,tt.__)("Post type"),onChange:e=>{const t={postType:e},a=f[e],o=Object.entries(h||{}).reduce(((e,[t,n])=>(a.includes(t)&&(e[t]=n),e)),{});t.taxQuery=Object.keys(o).length?o:void 0,"post"!==e&&(t.sticky=""),t.parents=[],n(t)},help:(0,tt.__)("WordPress contains different types of content and they are divided into collections called “Post types”. By default there are a few different ones such as blog posts and pages, but plugins could add more.")}),false,T&&(0,Ke.createElement)(bf,{order:c,orderBy:u,onChange:n}),I&&(0,Ke.createElement)(Nf,{value:d,onChange:e=>n({sticky:e})}),(0,Ke.createElement)(Tf,{enhancedPagination:s,setAttributes:o,clientId:r})),!g&&H&&(0,Ke.createElement)(et.__experimentalToolsPanel,{className:"block-library-query-toolspanel__filters",label:(0,tt.__)("Filters"),resetAll:()=>{n({author:"",parents:[],search:"",taxQuery:null}),C("")},dropdownMenuProps:ep},M&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{label:(0,tt.__)("Taxonomies"),hasValue:()=>Object.values(h||{}).some((e=>!!e.length)),onDeselect:()=>n({taxQuery:null})},(0,Ke.createElement)(Cf,{onChange:n,query:l})),z&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!m,label:(0,tt.__)("Authors"),onDeselect:()=>n({author:""})},(0,Ke.createElement)(yf,{value:m,onChange:n})),R&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!E,label:(0,tt.__)("Keyword"),onDeselect:()=>C("")},(0,Ke.createElement)(et.TextControl,{__nextHasNoMarginBottom:!0,label:(0,tt.__)("Keyword"),value:E,onChange:C})),A&&(0,Ke.createElement)(et.__experimentalToolsPanelItem,{hasValue:()=>!!b?.length,label:(0,tt.__)("Parents"),onDeselect:()=>n({parents:[]})},(0,Ke.createElement)(kf,{parents:b,postType:p,onChange:n}))))}const zf="wp-block-query-enhanced-pagination-modal__description";function Rf({clientId:e,attributes:{enhancedPagination:t},setAttributes:n}){const[a,o]=(0,_t.useState)(!1),{hasBlocksFromPlugins:r,hasPostContentBlock:l,hasUnsupportedBlocks:i}=df(e);(0,_t.useEffect)((()=>{t&&i&&(n({enhancedPagination:!1}),o(!0))}),[t,i,n]);const s=()=>{o(!1)};let c=(0,tt.__)('If you still want to prevent full page reloads, remove that block, then disable "Force page reload" again in the Query Block settings.');return r?c=(0,tt.__)("Currently, avoiding full page reloads is not possible when blocks from plugins are present inside the Query block.")+" "+c:l&&(c=(0,tt.__)("Currently, avoiding full page reloads is not possible when a Content block is present inside the Query block.")+" "+c),a&&(0,Ke.createElement)(et.Modal,{title:(0,tt.__)("Query block: Force page reload enabled"),className:"wp-block-query__enhanced-pagination-modal",aria:{describedby:zf},role:"alertdialog",focusOnMount:"firstElement",isDismissible:!1,onRequestClose:s},(0,Ke.createElement)(et.__experimentalVStack,{alignment:"right",spacing:5},(0,Ke.createElement)("span",{id:zf},c),(0,Ke.createElement)(et.Button,{variant:"primary",onClick:s},(0,tt.__)("OK"))))}const Af=[["core/post-template"]];function Hf({attributes:e,setAttributes:t,openPatternSelectionModal:n,name:a,clientId:o}){const{queryId:r,query:l,displayLayout:i,tagName:s="div",query:{inherit:c}={}}=e,{__unstableMarkNextChangeAsNotPersistent:u}=(0,gt.useDispatch)(nt.store),m=(0,jt.useInstanceId)(Hf),p=(0,nt.useBlockProps)(),d=(0,nt.useInnerBlocksProps)(p,{template:Af}),{postsPerPage:g}=(0,gt.useSelect)((e=>{const{getSettings:t}=e(nt.store),{getEntityRecord:n,canUser:a}=e(dt.store);return{postsPerPage:(a("read","settings")?+n("root","site")?.posts_per_page:+t().postsPerPage)||3}}),[]);(0,_t.useEffect)((()=>{const e={};(c&&l.perPage!==g||!l.perPage&&g)&&(e.perPage=g),Object.keys(e).length&&(u(),h(e))}),[l.perPage,g,c]),(0,_t.useEffect)((()=>{Number.isFinite(r)||(u(),t({queryId:m}))}),[r,m]);const h=e=>t({query:{...l,...e}}),b={main:(0,tt.__)("The