!function(){"use strict";function e(){if(!function(){const e=document.body.className;return e.includes("woocommerce_page_wc-settings")&&e.includes("arraysubs_")}())return;const e=function(){const e=new Set;return document.querySelectorAll(".woocommerce-help-tip").forEach(function(t){const n=(t.getAttribute("aria-label")||"").match(/\{[a-z_]+\}/g);n&&n.forEach(function(t){e.add(t)})}),Array.from(e)}();if(0===e.length)return;const t=document.querySelector(".form-table");if(!t)return;const n=function(e){const t=document.createElement("div");t.className="arraysubs-placeholders-panel",t.style.cssText="\n      background: #f0f6fc;\n      border: 1px solid #c3c4c7;\n      border-left: 4px solid #2271b1;\n      border-radius: 4px;\n      padding: 15px 20px;\n      margin: 20px 0;\n    ";const n=document.createElement("h3");n.textContent="📋 Available Placeholders",n.style.cssText="margin: 0 0 8px 0; font-size: 14px; color: #1d2327;",t.appendChild(n);const a=document.createElement("p");a.textContent="Click a placeholder to insert it into the focused field. Click on Subject, Heading, or Additional Content first.",a.style.cssText="margin: 0 0 12px 0; font-size: 13px; color: #50575e;",t.appendChild(a);const r=document.createElement("div");return r.style.cssText="display: flex; flex-wrap: wrap; gap: 4px;",e.forEach(function(e){r.appendChild(function(e){const t=document.createElement("button");return t.type="button",t.className="arraysubs-placeholder-btn button button-secondary",t.textContent=e,t.title=function(e){return{"{site_title}":"Website name","{site_address}":"Website address","{site_url}":"Website URL","{store_email}":"Store email address","{customer_name}":"Customer's full name","{customer_first_name}":"Customer's first name","{customer_email}":"Customer's email address","{subscription_id}":"Subscription ID number","{subscription_status}":"Current subscription status","{product_name}":"Subscription product name","{billing_period}":"Billing period (e.g., 'every month')","{next_payment_date}":"Next payment due date","{next_payment_amount}":"Next payment amount","{recurring_amount}":"Recurring payment amount","{last_payment_date}":"Last successful payment date","{last_payment_amount}":"Last payment amount","{trial_end_date}":"Trial expiration date","{expiration_date}":"Subscription expiration date","{my_account_url}":"Link to My Account page","{manage_subscription_url}":"Link to manage subscription","{update_payment_url}":"Link to update payment method","{credit_amount}":"Store credit amount","{new_balance}":"New credit balance after change","{credit_balance}":"Current store credit balance","{credit_source}":"Source of the credit","{order_id}":"Order ID number","{order_url}":"Link to order details","{shop_url}":"Link to shop page","{days_remaining}":"Days until expiration","{skipped_cycles}":"Number of skipped billing cycles","{pause_date}":"Date subscription was paused","{resume_date}":"Date subscription will resume"}[e]||"Email placeholder"}(e),t.style.cssText="margin: 3px; font-size: 12px; padding: 4px 10px; line-height: 1.4;",t.addEventListener("click",function(t){t.preventDefault();const n=window.arraysubsLastFocusedInput||document.querySelector('textarea[id$="_additional_content"]')||document.querySelector('input[id$="_subject"]');n&&(function(e,t){const n=e.selectionStart,a=e.selectionEnd,r=e.value;e.value=r.substring(0,n)+t+r.substring(a),e.selectionStart=e.selectionEnd=n+t.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}(n,e),n.focus())}),t}(e))}),t.appendChild(r),t}(e);t.parentNode.insertBefore(n,t),document.querySelectorAll('.form-table input[type="text"], .form-table textarea').forEach(function(e){e.addEventListener("focus",function(){window.arraysubsLastFocusedInput=e})})}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}();