(()=>{"use strict";const e=window.wp.blocks,t=JSON.parse('{"apiVersion":3,"name":"jobus/shortcode-candidate-archive","title":"Candidate Archive Shortcode (Jobus)","category":"jobus-blocks","icon":"dashicons dashicons-shortcode","description":"Display the Candidate Archive candidate posts on the website frontend","supports":{"html":false,"anchor":true},"attributes":{"candidate_layout":{"type":"string","default":"1"},"preview":{"type":"boolean","default":false}},"example":{"attributes":{"preview":true}},"keywords":["jobus","Shortcode","candidate Archive"],"textdomain":"jobus","editorScript":"file:./index.js","editorStyle":"file:./editor.css"}'),o=window.wp.i18n,a=window.wp.blockEditor,i=window.wp.components,s=window.React,l=window.wp.element,r=window.ReactJSXRuntime,n=()=>(0,r.jsxs)("h3",{children:["Here is a set of ",(0,r.jsx)("strong",{children:"candidate archive layout"})," shortcodes for your block widgets. These shortcodes are designed specifically to display candidate archive layouts"]});(0,e.registerBlockType)(t,{edit:function({attributes:e,setAttributes:t}){const{candidate_layout:d,preview:c}=e,u=(0,a.useBlockProps)(),p=jobus_block_params.jobus_is_premium,[b,h]=(0,s.useState)(null),[j,m]=(0,s.useState)({top:0,left:0}),y=(0,s.useRef)({}),_=[{label:(0,o.__)("Sidebar Filter Layout","jobus"),value:"1",img:jobus_block_params.jobus_image_dir+"/layout/candidate/archive-layout-1.png",pro:!1},{label:(0,o.__)("Grid Layout","jobus"),value:"2",img:jobus_block_params.jobus_image_dir+"/layout/candidate/archive-layout-2.png",pro:!0}];return c?(0,r.jsx)("div",{className:"block-preview",children:(0,r.jsx)(n,{})}):(0,r.jsxs)(s.Fragment,{children:[(0,r.jsx)(a.InspectorControls,{children:(0,r.jsx)(i.PanelBody,{title:(0,o.__)("Candidate Archive Layout","jobus"),initialOpen:!0,children:(0,r.jsx)(i.BaseControl,{label:(0,o.__)("Select Layout","jobus"),children:(0,r.jsx)("div",{className:"jbs-layout-options",style:{display:"flex",gap:"1rem",position:"relative"},children:_.map((e=>(0,r.jsxs)("div",{ref:t=>y.current[e.value]=t,className:`layout-option ${d===e.value?"active":""} ${e.pro&&!p?"locked":""}`,onClick:()=>(e=>{if(!e.pro||p)t({candidate_layout:e.value}),h(null);else if(y.current[e.value]){const t=y.current[e.value].getBoundingClientRect();m({top:t.top,left:t.left-280}),h(e.value)}})(e),style:{position:"relative",cursor:e.pro&&!p?"not-allowed":"pointer"},children:[(0,r.jsx)("img",{src:e.img,alt:e.label}),(0,r.jsx)("span",{className:"layout-label",style:{display:"block",textAlign:"center"},children:e.label})]},e.value)))})})})}),(0,r.jsx)("div",{...u,children:"[jobus_candidate_archive]"}),b&&y.current[b]&&(0,l.createPortal)((0,r.jsx)("div",{style:{position:"fixed",top:j.top+"px",left:j.left+"px",width:"280px",zIndex:99999},children:(0,r.jsxs)(i.Notice,{status:"info",isDismissible:!0,onRemove:()=>h(null),className:"jbs-pro-notice",children:[(0,r.jsxs)("h4",{style:{margin:"0 0 0.5rem 0",fontWeight:"bold"},children:[(0,o.__)("Pro Feature","jobus")," 🔒"]}),(0,r.jsx)("p",{style:{marginBottom:"0.5rem"},children:(0,o.__)("This candidate layout is part of Jobus Pro. Upgrade today to unlock premium layouts and advanced customization options!","jobus")}),(0,r.jsx)(i.Button,{isPrimary:!0,href:jobus_block_params.jobus_upgrade_url,target:"_blank",style:{marginTop:"0.25rem"},className:"jobus-upgrade-button",children:(0,o.__)("Upgrade Now","jobus")})]})}),document.body)]})},save:function(e){const{candidate_layout:t}=e.attributes,o=a.useBlockProps.save(),i=`[jobus_candidate_archive candidate_layout="${t}"]`;return(0,r.jsx)(s.Fragment,{children:(0,r.jsx)("div",{...o,children:i})})}})})();
//# sourceMappingURL=index.js.map