(()=>{"use strict";var t={d:(e,a)=>{for(var r in a)t.o(a,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:a[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{portalAffiliate:()=>r,portalControl:()=>u,portalDataset:()=>f,portalSchemaColumns:()=>c,portalSchemaRows:()=>l,portalSection:()=>p,portalSectionFields:()=>i,portalSettings:()=>o,portalView:()=>n,submitSection:()=>s,validateControl:()=>d});const a=window.wp.url;function r(t={}){let e;return void 0===t.affiliate?e=affwp_portal_vars.affiliate_id:(e=t.affiliate,delete t.affiliate),AFFWP.portal.core.fetch({path:(0,a.addQueryArgs)(`/affwp/v1/affiliates/${e}`,t),skipAffiliateId:!0,cacheResult:!0})}function o(){return AFFWP.portal.core.fetch({path:"/affwp/v2/portal/settings",cacheResult:!0})}function l(t,e={}){const r={...e,rows:!0};return r.page&&(r.offset=r.number?(r.page-1)*r.number:20),AFFWP.portal.core.fetch({path:(0,a.addQueryArgs)(`/affwp/v2/portal/controls/${t}`,r),cacheResult:!0})}function c(t){return AFFWP.portal.core.fetch({path:(0,a.addQueryArgs)(`/affwp/v2/portal/controls/${t}`,{columns:!0}),cacheResult:!0})}function f(t={}){return AFFWP.portal.core.fetch({path:(0,a.addQueryArgs)("/affwp/v2/portal/datasets",t),cacheResult:!0})}function n(t){return AFFWP.portal.core.fetch({path:`/affwp/v2/portal/views/${t}`,cacheResult:!0})}function p(t){return AFFWP.portal.core.fetch({path:`/affwp/v2/portal/sections/${t}`,cacheResult:!0})}function i(t){return AFFWP.portal.core.fetch({path:`/affwp/v2/portal/sections/${t}/fields`})}function s(t,e){return AFFWP.portal.core.fetch({method:"POST",path:`/affwp/v2/portal/sections/${t}/submit`,data:e})}function u(t){return AFFWP.portal.core.fetch({path:`/affwp/v2/portal/controls/${t}`,cacheResult:!0})}function d(t,e){return AFFWP.portal.core.fetch({path:(0,a.addQueryArgs)(`/affwp/v2/portal/controls/${t}`,{validate:!0,data:e}),cacheResult:!0})}((window.AFFWP=window.AFFWP||{}).portal=window.AFFWP.portal||{}).sdk=e})();