2024-10-31 00:09:28 -04:00
|
|
|
(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{duplicatePattern:()=>q,duplicatePost:()=>M,duplicatePostNative:()=>L,exportPattern:()=>Ee,exportPatternNative:()=>De,orderField:()=>l,permanentlyDeletePost:()=>T,reorderPage:()=>P,reorderPageNative:()=>A,titleField:()=>s,viewPost:()=>f,viewPostRevisions:()=>z});const n=window.wp.i18n,i=window.wp.htmlEntities,r="wp_template",o="wp_template_part";function a(e){return"string"==typeof e.title?(0,i.decodeEntities)(e.title):"rendered"in e.title?(0,i.decodeEntities)(e.title.rendered):"raw"in e.title?(0,i.decodeEntities)(e.title.raw):""}const s={type:"text",id:"title",label:(0,n.__)("Title"),placeholder:(0,n.__)("No title"),getValue:({item:e})=>a(e)},l={type:"integer",id:"menu_order",label:(0,n.__)("Order"),description:(0,n.__)("Determines the order of pages.")},c=window.wp.primitives,d=window.ReactJSXRuntime,u=(0,d.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,d.jsx)(c.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})}),f={id:"view-post",label:(0,n._x)("View","verb"),isPrimary:!0,icon:u,isEligible:e=>"trash"!==e.status,callback(e,{onActionPerformed:t}){const n=e[0];window.open(n?.link,"_blank"),t&&t(e)}},p=window.wp.data,m=window.wp.coreData,g=window.wp.notices,h=window.wp.element;const w={sort:function(e,t,n){return"asc"===n?e-t:t-e},isValid:function(e,t){if(""===e)return!1;if(!Number.isInteger(Number(e)))return!1;if(t?.elements){const n=t?.elements.map((e=>e.value));if(!n.includes(Number(e)))return!1}return!0},Edit:"integer"};const y={sort:function(e,t,n){return"asc"===n?e.localeCompare(t):t.localeCompare(e)},isValid:function(e,t){if(t?.elements){const n=t?.elements?.map((e=>e.value));if(!n.includes(e))return!1}return!0},Edit:"text"};const _={sort:function(e,t,n){const i=new Date(e).getTime(),r=new Date(t).getTime();return"asc"===n?i-r:r-i},isValid:function(e,t){if(t?.elements){const n=t?.elements.map((e=>e.value));if(!n.includes(e))return!1}return!0},Edit:"datetime"};const b=window.wp.components;const v={datetime:function({data:e,field:t,onChange:n,hideLabelFromVision:i}){const{id:r,label:o}=t,a=t.getValue({item:e}),s=(0,h.useCallback)((e=>n({[r]:e})),[r,n]);return(0,d.jsxs)("fieldset",{className:"dataviews-controls__datetime",children:[!i&&(0,d.jsx)(b.BaseControl.VisualLabel,{as:"legend",children:o}),i&&(0,d.jsx)(b.VisuallyHidden,{as:"legend",children:o}),(0,d.jsx)(b.TimePicker,{currentTime:a,onChange:s,hideLabelFromVision:!0})]})},integer:function({data:e,field:t,onChange:n,hideLabelFromVision:i}){var r;const{id:o,label:a,description:s}=t,l=null!==(r=t.getValue({item:e}))&&void 0!==r?r:"",c=(0,h.useCallback)((e=>n({[o]:Number(e)})),[o,n]);return(0,d.jsx)(b.__experimentalNumberControl,{label:a,help:s,value:l,onChange:c,__next40pxDefaultSize:!0,hideLabelFromVision:i})},radio:function({data:e,field:t,onChange:n,hideLabelFromVision:i}){const{id:r,label:o}=t,a=t.getValue({item:e}),s=(0,h.useCallback)((e=>n({[r]:e})),[r,n]);return t.elements?(0,d.jsx)(b.RadioControl,{label:o,onChange:s,options:t.elements,selected:a,hideLabelFromVision:i}):null},select:function({data:e,field:t,onChange:i,hideLabelFromVision:r}){var o,a;const{id:s,label:l}=t,c=null!==(o=t.getValue({item:e}))&&void 0!==o?o:"",u=(0,h.useCallback)((e=>i({[s]:e})),[s,i]),f=[{label:(0,n.__)("Select item"),value:""},...null!==(a=t?.elements)&&void 0!==a?a:[]];return(0,d.jsx)(b.SelectControl,{label:l,value:c,options:f,onChange:u,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,hideLabelFromVision:r})},text:function({data:e,field:t,onChange:n,hideLabelFromVision:i}){const{id:r,label:o,placeholder:a}=t,s=t.getValue({item:e}),l=(0,h
|