(()=>{"use strict";const e=window.wp.plugins,a=window.wp.editor,l=window.wp.components,t=window.wp.data,s=window.wp.coreData,r=window.wp.i18n,n=window.ReactJSXRuntime;(0,e.registerPlugin)("recast-paywall-meta",{render:function(){var e,c;const{meta:o,update:i}=function(){const e=(0,t.useSelect)(e=>e("core/editor").getCurrentPostType(),[]),[a,l]=(0,s.useEntityProp)("postType",e,"meta");return{meta:a||{},update:(e,t)=>l({...a||{},[e]:t})}}(),_=(0,t.useSelect)(e=>{const{getActiveGeneralSidebarName:a}=e("core/edit-post");return"recast-paywall-meta/recast-paywall-meta-panel"===a()},[]);return(0,n.jsx)(a.PluginSidebar,{name:"recast-paywall-meta-panel",title:(0,r.__)("Recast Paywall","recast-paywall"),icon:"undefined"!=typeof recastPaywallMeta&&recastPaywallMeta.iconUrl?(0,n.jsx)("img",{className:"recast-paywall-icon",src:recastPaywallMeta.iconUrl,alt:"",style:{width:20,height:20,filter:_?"brightness(0) invert(1)":"none"}}):void 0,className:"recast-paywall-meta-panel",children:(0,n.jsxs)(l.PanelBody,{initialOpen:!0,children:[(0,n.jsx)(l.CheckboxControl,{label:(0,r.__)("Enable paywall for this post","recast-paywall"),checked:!!o._recast_paywall_enabled,onChange:e=>i("_recast_paywall_enabled",!!e)}),(0,n.jsxs)("div",{style:{opacity:o._recast_paywall_enabled?1:.5,pointerEvents:o._recast_paywall_enabled?"auto":"none"},children:[(0,n.jsx)(l.SelectControl,{label:(0,r.__)("Mode","recast-paywall"),value:o._recast_gating_mode||"post",options:[{label:(0,r.__)("Post (entire article)","recast-paywall"),value:"post"},{label:(0,r.__)("Block (only selected blocks)","recast-paywall"),value:"block"}],onChange:e=>i("_recast_gating_mode",e)}),(0,n.jsx)(l.__experimentalNumberControl,{label:(0,r.__)("Price","recast-paywall"),value:null!==(e=o._recast_price)&&void 0!==e?e:0,onChange:e=>i("_recast_price",Number(e)),min:0}),(0,n.jsx)(l.SelectControl,{label:(0,r.__)("Status","recast-paywall"),value:o._recast_status||"",options:[{label:"PRESALE",value:"PRESALE"},{label:"PURCHASEABLE",value:"PURCHASEABLE"},{label:"UNPURCHASEABLE",value:"UNPURCHASEABLE"}],onChange:e=>i("_recast_status",e)}),(0,n.jsx)(l.TextControl,{label:(0,r.__)("Geo availability","recast-paywall"),value:o._recast_geo_availability||"",onChange:e=>i("_recast_geo_availability",e),help:(0,r.__)("Use ISO 3166-1 alpha-2 codes (e.g., US, GB, CA, AU). Leave empty for global availability.","recast-paywall")}),(0,n.jsx)(l.__experimentalNumberControl,{label:(0,r.__)("Affiliate share %","recast-paywall"),value:null!==(c=o._recast_affiliate_share_pct)&&void 0!==c?c:0,onChange:e=>i("_recast_affiliate_share_pct",Number(e)),min:0,max:100})]}),(0,n.jsxs)("p",{style:{marginBottom:"16px",fontSize:"13px",color:"#646970"},children:[(0,r.__)("Manage your content paywall settings. ","recast-paywall"),o._recast_inventory_item_id?(0,n.jsxs)("small",{children:[(0,n.jsx)("a",{href:"https://business.recast.tv/inventory",target:"_blank",rel:"noopener noreferrer",style:{color:"#0073aa"},children:(0,r.__)(`${o._recast_inventory_item_id} →`,"recast-paywall")}),(0,n.jsx)("br",{}),(0,r.__)("Last synced: ","recast-paywall"),o._recast_last_synced_at?o._recast_last_synced_at:(0,r.__)("Not synced","recast-paywall")]}):(0,r.__)("Not synced","recast-paywall")]})]})})}})})();