(()=>{"use strict";var t={n:i=>{var e=i&&i.__esModule?()=>i.default:()=>i;return t.d(e,{a:e}),e},d:(i,e)=>{for(var o in e)t.o(e,o)&&!t.o(i,o)&&Object.defineProperty(i,o,{enumerable:!0,get:e[o]})},o:(t,i)=>Object.prototype.hasOwnProperty.call(t,i)};const i=jQuery;var e=t.n(i);const o=devowlWp_utils;let n;const a=(...t)=>(n||(n=(0,o.createLocalizationFactory)("devowl-wp-real-utils"))).__(...t),s=()=>window[o.BaseOptions.getPureSlug("real-utils",!0)].others;let l;const r={path:"/cross/:slug/:action/dismiss",method:o.RouteHttpVerb.DELETE},c="crossSellingPointer";class p{constructor(t,i,e,o){this.slug=i,this.action=e,this.position=o,this.$handler=t,this.init()}static waitForVisibleElement(t,i,o,n){if(!this.isActionAvailable(i,o))return!1;const a=e()(t);return a.length&&!a.data(c)&&(a.data(c,!0),new p(a,i,o,n)),a.length>0}static isActionAvailable(t,i){return!!s().cross?.[t]?.[i]}close(t,i){t.preventDefault();const e=this.$handler.pointer("widget").find('input[type="checkbox"]').is(":checked");if(this.$handler.pointer("close"),this.$handler.pointer("destroy"),i){const{link:t}=this.getAction();window.open(t,"_blank")}((...t)=>{(l||(l=(0,o.createRequestFactory)(window[o.BaseOptions.getPureSlug("real-utils",!0)]))).request(...t)})({location:r,params:{slug:this.slug,action:this.action,force:e}})}buttons(){const t=e()(`<a class="button" href="#">${a("Not now")}</a>`).click(t=>{this.close(t,!1)}),i=e()(`<a class="button button-primary" href="#">${a("Learn more!")}</a>`).click(t=>{this.close(t,!0)});return e()('<div class="real-utils-pointer-buttons" />').append(i,t)}getAction(){return s().cross?.[this.slug][this.action]}init(){const{position:t}=this,{title:i,description:e,image:o}=this.getAction(),n=`<label><input type="checkbox" /> ${a("Never show this popup again")}</label>`;this.$handler.pointer({pointerClass:"wp-pointer real-utils-cross-pointer",content:`<h3>${i}</h3><p><img src="${o}" />${e}${n}</p>`,buttons:this.buttons.bind(this),position:t}).pointer("open").pointer("widget").find("img").get(0).onload=()=>this.$handler.pointer("reposition")}}const d="real-category-library",h="real-media-library",b="real-physical-media",m=()=>e()("select#parent").length&&p.isActionAvailable(d,"add-category")&&e()("body.wp-admin.edit-tags-php:not(.woocommerce-page,.post-type-attachment) form#addtag #submit").one("click",function(){new p(e()(this),d,"add-category","bottom")}),u=()=>e()("select#parent").length&&p.isActionAvailable(d,"add-wc-category")&&e()("body.wp-admin.edit-tags-php.woocommerce-page form#addtag #submit").one("click",function(){new p(e()(this),d,"add-wc-category","bottom")});class g{static{this.SELECTOR='body.wp-admin.post-php:not(.post-type-attachment) #categorychecklist input[type="checkbox"]'}static onChange(){new p(e()(this),d,"assign"),e()(g.SELECTOR).off("change",g.onChange)}static bind(){p.isActionAvailable(d,"assign")&&e()(this.SELECTOR).one("change",this.onChange)}}class w{static{this.SELECTOR="body.wp-admin.edit-php:not(.post-type-attachment) .tablenav-pages .pagination-links a"}static onClick(t){const i=e()(this).attr("href");return new p(e()(this),d,"pagination"),e()(this).pointer("widget").find(".button").click(()=>{setTimeout(()=>window.open(i,"_self"),1e3)}),e()(w.SELECTOR).off("click",w.onClick),t.preventDefault(),!1}static bind(){p.isActionAvailable(d,"pagination")&&e()(this.SELECTOR).one("click",this.onClick)}}e()(document).ready(()=>{setTimeout(function t(){let i=!1;!i&&(i=p.waitForVisibleElement("body.wp-admin.upload-php .attachment-info > .details:visible, body.wp-admin.post-php.post-type-attachment #post-body-content #titlewrap:visible",h,"attachment-details")),!i&&(i=p.waitForVisibleElement("body.wp-admin.plugins-php #wpbody-content > div.wrap > h1:first","real-cookie-banner","gdpr-compliant")),!i&&(i=p.waitForVisibleElement('body > div > .media-modal.wp-core-ui .media-frame-router button[role="tab"]:eq(1).active',h,"insert-dialog")),!i&&(i=p.waitForVisibleElement("body.wp-admin .editor-post-taxonomies__hierarchical-terms-list:visible",d,"assign","bottom")),!i&&(i=p.waitForVisibleElement("body.wp-admin.upload-php #wpbody-content .upload-ui .button-hero:visible, body.wp-admin.media-new-php #media-items .media-item:first:visible",b,"upload")),!i&&setTimeout(t,1e3)},1e3),m(),u(),p.isActionAvailable(b,"move")&&window.rml?.hooks.register("attachment/move/finished",(t,i)=>{new p(e()(`.rml-container:visible li[data-li-id="${i}"]`),b,"move")}),g.bind(),w.bind()})})();
//# sourceMappingURL=https://sourcemap.devowl.io/real-category-library/4.2.77/2a5b12458bf7c6f61d42ac955d4d8cd8/cross.js.map
