(()=>{"use strict";const t=window.wp.i18n,e=window.wp.plugins,n=window.wp.editor,r=window.wp.data,o=window.wp.components,a=window.wp.element;function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}(0,e.registerPlugin)("matador-jobs-job-listing-post-editor-bullhorn-buttons",{render:function(){var e,c,l=(0,r.useSelect)((function(t){return t("core/editor").getEditedPostAttribute("meta")}))._matador_source_id,u=matadorAdminData,d=u.clientClusterURL,s=u.wpNonce,m=(e=(0,a.useState)(!1),c=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==e);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,c)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}(e,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),b=m[0],f=m[1];return React.createElement(n.PluginDocumentSettingPanel,{name:(0,t.__)("Sync / Edit this Job in your ATS","matador-jobs"),title:(0,t.__)("Sync / Edit this Job in your ATS","matador-jobs"),className:"matador-buttons"},React.createElement(o.__experimentalHStack,null,React.createElement(o.Button,{variant:"primary",id:"matador-sync-job","data-bhid":l,"data-nonce":s,onClick:function(){return t=l,e=s,f(!0),void fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"matador_api_job_sync",nonce:e,bhid:t})}).then((function(t){f(!1),window.location.reload()}));var t,e}},b?React.createElement(o.Spinner,null):(0,t.__)("Sync this Job","matador-jobs")),React.createElement(o.Button,{variant:"secondary",href:"".concat(d,"BullhornSTAFFING/OpenWindow.cfm?Entity=JobOrder&id=").concat(l),target:"_blank"},(0,t.__)("Edit this Job","matador-jobs"))))}})})();