import{s as r,a as l}from"../../../common/index.CPcBO1Os.js";/* empty css                   */function _(){import.meta.url,import("_").catch(()=>1),async function*(){}().next()}((c,m,t)=>{const{__:o}=c.wp.i18n;t(()=>{t(".product-question-related-product").select2({ajax:{url:r().productsUrl,dataType:"json",delay:300,headers:{"X-WP-Nonce":r().wpNonce},data:e=>({search:e.term,page:e.page||1}),processResults:e=>({results:e.map(a=>({id:a.id,text:a.name}))})},placeholder:o("Search for related product","storeagent-ai-for-woocommerce")})}),t(document).on("click",".saai-product-data-sources-container .add-data-source",n),t(document).on("click",".saai-product-data-sources-container .remove-data-source",i),t(document).on("saai_init_autocomplete",".saai-product-data-sources-container .data-source-item input",u),t(".saai-product-data-sources-container .data-source-item input").trigger("saai_init_autocomplete");function n(){t(".saai-product-data-sources-container").find(".data-sources-list").append(s()),t(".data-source-item input").trigger("saai_init_autocomplete")}function s(){const e=o("Enter page URL or select a post/page","storeagent-ai-for-woocommerce");return'\n        <div class="data-source-item">\n          <input type="url" name="saai_product_questions_data_sources[]" class="widefat" placeholder="'.concat(e,'" />\n          <button type="button" class="button remove-data-source">\n            ').concat(o("Remove","storeagent-ai-for-woocommerce"),"\n          </button>\n        </div>\n      ")}function i(){t(this).closest(".data-source-item").remove()}function u(){t(this).autocomplete({source:function(a,d){l(a.term).then(p=>{d(p)})}})}})(window,document,jQuery);export{_ as __vite_legacy_guard};
