index of
/
home
/
thefkyzp
/
hulmvisaadvisor.com
/
wp-content
/
plugins
/
surecart
/
dist
/
store
/
File: /home/thefkyzp/hulmvisaadvisor.com/wp-content/plugins/surecart/dist/store/data.js
!function(){var t={827:function(t){function e(t,e,r){e="number"==typeof e?o(e.toString()):"string"==typeof e?o(e):e;const i=(t,e,r,o)=>{let u,c=e[o];return e.length>o?(Array.isArray(t)?(c=n(c,t),u=t.slice()):u=Object.assign({},t),u[c]=i(void 0!==t[c]?t[c]:{},e,r,o+1),u):"function"==typeof r?r(t):r};return i(t,e,r,0)}function r(t,e,r){e="number"==typeof e?o(e.toString()):"string"==typeof e?o(e):e;for(var n=0;n<e.length;n++){if(null===t||"object"!=typeof t)return r;let o=e[n];Array.isArray(t)&&"$end"===o&&(o=t.length-1),t=t[o]}return void 0===t?r:t}function n(t,e){if("$end"===t&&(t=Math.max(e.length-1,0)),!/^\+?\d+$/.test(t))throw new Error(`Array index '${t}' has to be an integer`);return parseInt(t)}function o(t){return t.split(".").reduce(((t,e,r,n)=>{const o=r>0&&n[r-1];if(o&&/(?:^|[^\\])\\$/.test(o)){const r=t.pop();t.push(r.slice(0,-1)+"."+e)}else t.push(e);return t}),[])}t.exports={set:e,get:r,delete:function(t,e){e="number"==typeof e?o(e.toString()):"string"==typeof e?o(e):e;const r=(t,e,o)=>{let i,u=e[o];return null===t||"object"!=typeof t||!Array.isArray(t)&&void 0===t[u]?t:e.length-1>o?(Array.isArray(t)?(u=n(u,t),i=t.slice()):i=Object.assign({},t),i[u]=r(t[u],e,o+1),i):(Array.isArray(t)?(u=n(u,t),i=[].concat(t.slice(0,u),t.slice(u+1))):(i=Object.assign({},t),delete i[u]),i)};return r(t,e,0)},toggle:function(t,n){const o=r(t,n);return e(t,n,!Boolean(o))},merge:function(t,n,o){const i=r(t,n);return"object"==typeof i?Array.isArray(i)?e(t,n,i.concat(o)):e(t,n,null===i?o:Object.assign({},i,o)):void 0===i?e(t,n,o):t}}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},function(){"use strict";var t={};r.r(t),r.d(t,{flash:function(){return k},getError:function(){return T},isInvalid:function(){return P},isSaving:function(){return x},selectErrors:function(){return I},selectModelErrors:function(){return M},selectValidationErrors:function(){return L},showUpgradeModal:function(){return j},snackbarNotices:function(){return R}});var e={};r.r(e),r.d(e,{addErrors:function(){return q},addModelErrors:function(){return H},addSnackbarNotice:function(){return G},addValidationErrors:function(){return Y},clearErrors:function(){return B},clearModelErrors:function(){return Q},clearValidationErrors:function(){return $},removeSnackbarNotice:function(){return K},setError:function(){return F},setFlash:function(){return z},setInvalid:function(){return N},setSaving:function(){return U},setUpgradeModal:function(){return V}});var n={};r.r(n),r.d(n,{getEditedEntityRecords:function(){return kt},getEntities:function(){return lt},getEntity:function(){return at},getEntityEditLink:function(){return dt},hasDirtyModels:function(){return At},isCreated:function(){return yt},isDirty:function(){return Dt},isSaving:function(){return Rt},prepareFetchRequest:function(){return xt},prepareUpdateRequest:function(){return jt},selectAllDrafts:function(){return wt},selectAllModels:function(){return ht},selectCollection:function(){return bt},selectDirty:function(){return Ot},selectDraft:function(){return _t},selectDrafts:function(){return St},selectEntities:function(){return ft},selectEntity:function(){return st},selectError:function(){return vt},selectModel:function(){return gt},selectPageId:function(){return pt},selectRelation:function(){return mt},selectSingleRelation:function(){return Et}});var o={};r.r(o),r.d(o,{addDraft:function(){return Le},addModel:function(){return Ie},addModels:function(){return Pe},clearDirty:function(){return Be},clearDrafts:function(){return Qe},deleteModel:function(){return ze},duplicateModel:function(){return Ce},isDirty:function(){return Xe},makeRequest:function(){return Ge},prepareSaveRequest:function(){return Ze},receiveModel:function(){return We},receiveModels:function(){return Ve},registerEntities:function(){return xe},removeDirty:function(){return qe},removeDraft:function(){return He},saveData:function(){return Ye},saveDraft:function(){return Je},saveDrafts:function(){return Ke},saveModel:function(){return $e},setError:function(){return je},setModels:function(){return ke},updateDirty:function(){return Ne},updateDraft:function(){return Fe},updateModel:function(){return Ue},updateModels:function(){return Me},updateModelsProperty:function(){return Te}});var i=window.wp.data;function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(t){return function(t){if(Array.isArray(t))return u(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function s(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var l=window.wp.i18n,f=r(827),d=r.n(f);function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var v=(0,i.combineReducers)({config:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1?arguments[1]:void 0,r=e.type,n=e.payload;return"REGISTER_ENTITIES"===r?[].concat(c(t),c(n)):t},error:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=e.payload;return"SET_ERROR"===e.type?r:t},drafts:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=e.type,n=e.name,o=e.index,i=e.payload;switch(r){case"ADD_DRAFT":return y(y({},t),{},s({},n,[].concat(c(t[n]||[]),[i])));case"UPDATE_DRAFT":return d().merge(t,"".concat(n,".").concat(o),i);case"REMOVE_DRAFT":return d().delete(t,"".concat(n,".").concat(o));case"CLEAR_DRAFTS":return d().delete(t,n)}return t},entities:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=e.type,n=e.name,o=e.id,i=e.payload;switch(r){case"SET_MODELS":return i;case"ADD_MODELS":return y(y({},t),i);case"UPDATE_MODEL":return d().merge(t,"".concat(n,".").concat(o),i);case"ADD_MODEL":case"SET_MODEL":return d().set(t,"".concat(null==i?void 0:i.object,".").concat(null==i?void 0:i.id),i);case"DELETE_MODEL":return d().delete(t,"".concat(n,".").concat(o))}return t},dirty:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=e.type,n=e.id,o=e.payload;switch(r){case"UPDATE_DIRTY":return d().merge(t,n,o);case"REMOVE_DIRTY":return"string"!=typeof n?t:d().delete(t,n);case"CLEAR_DIRTY":return{}}return t},saving:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"REQUEST_POST_UPDATE_START":case"REQUEST_POST_UPDATE_FINISH":return{pending:"REQUEST_POST_UPDATE_START"===e.type,options:e.options||{}}}return t}});function h(t,e,r,n,o,i,u){try{var c=t[i](u),a=c.value}catch(t){return void r(t)}c.done?e(a):Promise.resolve(a).then(n,o)}function b(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){h(i,n,o,u,c,"next",t)}function c(t){h(i,n,o,u,c,"throw",t)}u(void 0)}))}}function g(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var m=window.regeneratorRuntime,E=r.n(m),O=window.wp.apiFetch,w=r.n(O),S=window.wp.url,_=window.lodash;function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function D(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function R(t){return t.snackbar||[]}function j(t){return"upgrade"===t.modal}function x(t){return t.saving.isSaving}function k(t){return t.errors.flash}function P(t){return t.errors.isInvalid}function T(t){return t.error}function M(t,e){return t.modelErrors[e]||[]}function I(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return t.errors.errors;var n=t.errors.errors.filter((function(t){return(null==t?void 0:t.key)&&t.key===e}));return null===r?n:n.filter((function(t){return(null==t?void 0:t.index)===r}))}function L(t,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=I(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null),o=[];return n.length?(n.forEach((function(t){var e,n,i=t.error;null!=i&&null!==(e=i.additional_errors)&&void 0!==e&&e.length&&(o=[].concat(c(o),c(r?null==i||null===(n=i.additional_errors)||void 0===n?void 0:n.filter((function(t){var e;return(null==t||null===(e=t.data)||void 0===e?void 0:e.attribute)===r})):null==i?void 0:i.additional_errors)))})),o):o}(0,i.combineReducers)({saving:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{isSaving:!1},e=arguments.length>1?arguments[1]:void 0;return"SET_SAVING"===e.type?D(D({},t),{},{isSaving:e.value}):t},error:function(t,e){return"SET_ERROR"===e.type?e.value:t},errors:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{flash:{},validation:[],isInvalid:0,errors:[]},e=arguments.length>1?arguments[1]:void 0;switch(e.type){case"SET_INVALID":return D(D({},t),{},{isInvalid:(null==t?void 0:t.isInvalid)+1});case"SET_SAVING":return D(D({},t),{},{isSaving:e.value});case"SET_FLASH":return D(D({},t),{},{flash:e.value});case"ADD_ERRORS":return D(D({},t),{},{errors:[].concat(c(t.errors),c(e.value))});case"CLEAR_ERRORS":return null!==(null==e?void 0:e.index)?D(D({},t),{},{errors:(t.errors||[]).filter((function(t){return t.index!==e.index}))}):D(D({},t),{},{errors:[]});case"ADD_VALIDATION_ERRORS":return D(D({},t),{},{validation:[].concat(c(t.validation),c(e.value))});case"CLEAR_VALIDATION_ERRORS":return e.attribute?D(D({},t),{},{isInvalid:0,validation:t.validation.filter((function(t){var r;return(null==t||null===(r=t.data)||void 0===r?void 0:r.attribute)!==e.attribute}))}):D(D({},t),{},{isInvalid:0,validation:[]})}return t},modelErrors:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0,r=e.type,n=e.name,o=e.payload;switch(r){case"ADD_MODEL_ERRORS":return D(D({},t),{},s({},n,[].concat(c(t[n]||[]),c((0,_.castArray)(o)))));case"CLEAR_MODEL_ERRORS":return D(D({},t),{},s({},n,[]))}return t},modal:function(t,e){return"SET_MODAL"===e.type?e.value:t},snackbar:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1?arguments[1]:void 0;switch(r.type){case"ADD_SNACKBAR_NOTICE":return[].concat(c(e),[D({id:e.length,className:"error"===(null==r||null===(t=r.notice)||void 0===t?void 0:t.type)?"is-snackbar-error":""},r.notice)]);case"REMOVE_SNACKBAR_NOTICE":return e.filter((function(t){return t.id!==r.id}));case"SAVE_ERROR":return[].concat(c(e),[{id:e.length,className:"is-snackbar-error",content:(null==r?void 0:r.message)||__("Something went wrong.","surecart")}])}return e}});var C=E().mark(H);function U(t){return{type:"SET_SAVING",value:t}}function V(t){return{type:"SET_MODAL",value:!!t&&"upgrade"}}function N(t){return{type:"SET_INVALID",value:t}}function F(t){return{type:"SET_ERROR",value:t}}function z(t){return{type:"SET_FLASH",value:t}}function q(t){return{type:"ADD_ERRORS",value:t}}function H(t,e){return E().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",{type:"ADD_MODEL_ERRORS",name:t,payload:e});case 1:case"end":return r.stop()}}),C)}function Q(t){return{type:"CLEAR_MODEL_ERRORS",name:t}}function B(){return{type:"CLEAR_ERRORS",index:arguments.length>0&&void 0!==arguments[0]?arguments[0]:null}}function Y(t){return{type:"ADD_VALIDATION_ERRORS",value:t}}function $(){return{type:"CLEAR_VALIDATION_ERRORS",attribute:arguments.length>0&&void 0!==arguments[0]?arguments[0]:""}}function G(t){return{type:"ADD_SNACKBAR_NOTICE",notice:t}}function K(t){return{type:"REMOVE_SNACKBAR_NOTICE",id:t}}var J="surecart/ui",W=["path","query"];function X(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?X(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var tt=function(){return{type:"FETCH_FROM_API",options:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}}},et=function(t){return{type:"BATCH_SAVE",batches:t}},rt=function(t){var e=t.path,r=t.query,n=g(t,W);return w()(Z(Z({},n||{}),{},{path:(0,S.addQueryArgs)("surecart/v1/".concat(e),r)}))},nt={FETCH_FROM_API:function(t){return b(E().mark((function e(){var r;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.options,e.next=3,rt(r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))()},BATCH_SAVE:function(t){return b(E().mark((function e(){var r;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.batches,e.next=3,Promise.all(r.map(function(){var t=b(E().mark((function t(e){var r,n,o,u,c;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.key,n=e.request,o=e.index,u=void 0===o?null:o,t.prev=1,t.next=4,rt(n);case 4:if(!(c=t.sent)||null==c||!c.id){t.next=10;break}return t.next=8,(0,i.dispatch)(tr).updateModel(r,c,u);case 8:return t.next=10,(0,i.dispatch)(tr).removeDirty(r,u);case 10:t.next=16;break;case 12:throw t.prev=12,t.t0=t.catch(1),null!==t.t0&&void 0!==t.t0&&t.t0.message&&(0,i.dispatch)(J).addErrors([s(s({index:u,key:r},"index",u),"error",t.t0)]),t.t0;case 16:case"end":return t.stop()}}),t,null,[[1,12]])})));return function(_x){return t.apply(this,arguments)}}()));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))()},BATCH_SAVE_DRAFTS:function(t){return b(E().mark((function e(){var r;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.batches,e.next=3,Promise.all(r.map(function(){var t=b(E().mark((function t(e){var r,n,o,u,c;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.key,n=e.request,o=e.index,u=void 0===o?null:o,t.prev=1,t.next=4,rt(n);case 4:if(!(c=t.sent)||null==c||!c.id){t.next=8;break}return t.next=8,(0,i.dispatch)(tr).updateDraft(r,c,u);case 8:t.next=13;break;case 10:throw t.prev=10,t.t0=t.catch(1),t.t0;case 13:case"end":return t.stop()}}),t,null,[[1,10]])})));return function(e){return t.apply(this,arguments)}}()));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})))()}},ot=window.wp.coreData,it=["id"];function ut(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ct(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ut(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var at=function(t,e){return t.config.find((function(t){return t.name===e}))},st=function(t,e){return t.config.find((function(t){return t.name===e}))},lt=function(t){return t.config},ft=function(t,e){return t.config.find((function(t){return t.name===e}))},dt=function(t,e,r){var n=at(t,e);return n?(0,S.addQueryArgs)(n.editLink,{id:r}):null},pt=function(){return(0,S.getQueryArg)(window.location,"id")},yt=function(){return!!pt()},vt=function(t){return t.error},ht=function(t){return t.entities},bt=function(t,e){var r;return Object.values((null===(r=t.entities)||void 0===r?void 0:r[e])||{})},gt=function(t,e,r){var n;return null===(n=t.entities)||void 0===n||null===(n=n[e])||void 0===n?void 0:n[r]},mt=function(t,e,r,n){var o=gt(t,e,r);return!!o&&(n.split(".").forEach((function(e){o=Et(t,o,e)})),o)},Et=function(t,e,r){var n,o=r;return"current_period"===r&&(o="period"),Object.values((null==t||null===(n=t.entities)||void 0===n?void 0:n[o])||{}).find((function(t){return t.id===(null==e?void 0:e[r])}))},Ot=function(t){return t.dirty},wt=function(t){return Object.values(t.drafts||{}).filter((function(t){return t.some((function(t){return!(null!=t&&t.id)}))}))},St=function(t,e){var r;return Object.values((null===(r=t.drafts)||void 0===r?void 0:r[e])||{}).filter((function(t){return!(null!=t&&t.id)}))},_t=function(t,e,r){var n;return(null===(n=t.drafts)||void 0===n||null===(n=n[e])||void 0===n?void 0:n[r])||[]},At=function(t){return!!Object.keys(t.dirty||{}).length},Dt=function(t,e){var r,n,o=gt(t,e);return null==o||!o.id||(null===(r=Object.keys((null==t||null===(n=t.dirty)||void 0===n?void 0:n[o.id])||{}))||void 0===r?void 0:r.length)},Rt=(0,i.createRegistrySelector)((function(t){return function(){return t(J).isSaving()}}));function jt(t,e,r){var n,o,i=r.id?"".concat(null===(n=entity)||void 0===n?void 0:n.baseURL,"/").concat(r.id):null===(o=entity)||void 0===o?void 0:o.baseURL;return{path:(0,S.addQueryArgs)(i,entity.baseURLParams),method:r.id?"PATCH":"POST",data:r}}function xt(t,e,r){var n=r.id,o=g(r,it),i=at(t,e),u=n?"".concat(null==i?void 0:i.baseURL,"/").concat(n):null==i?void 0:i.baseURL;return{path:(0,S.addQueryArgs)(u,ct(ct({},null!=i&&i.baseURLParams?i.baseURLParams:{}),o))}}var kt=(0,i.createRegistrySelector)((function(t){return function(e,r,n,o){return t(ot.store).getEntityRecords(r,n,o).map((function(t){}))}}));function Pt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Tt(t,e,r){return e&&Pt(t.prototype,e),r&&Pt(t,r),t}function Mt(){return Mt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Mt.apply(this,arguments)}function It(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function Lt(t){return!(!t||"function"!=typeof t.hasOwnProperty||!(t.hasOwnProperty("__ownerID")||t._map&&t._map.hasOwnProperty("__ownerID")))}function Ct(t,e,r){return Object.keys(t).reduce((function(e,n){var o=""+n;return e.has(o)?e.set(o,r(e.get(o),t[o])):e}),e)}var Ut=function(){function t(t,e,r){if(void 0===e&&(e={}),void 0===r&&(r={}),!t||"string"!=typeof t)throw new Error("Expected a string key for Entity, but found "+t+".");var n=r,o=n.idAttribute,i=void 0===o?"id":o,u=n.mergeStrategy,c=void 0===u?function(t,e){return Mt({},t,e)}:u,a=n.processStrategy,s=void 0===a?function(t){return Mt({},t)}:a,l=n.fallbackStrategy,f=void 0===l?function(t,e){}:l;this._key=t,this._getId="function"==typeof i?i:function(t){return function(e){return Lt(e)?e.get(t):e[t]}}(i),this._idAttribute=i,this._mergeStrategy=c,this._processStrategy=s,this._fallbackStrategy=f,this.define(e)}var e=t.prototype;return e.define=function(t){this.schema=Object.keys(t).reduce((function(e,r){var n,o=t[r];return Mt({},e,((n={})[r]=o,n))}),this.schema||{})},e.getId=function(t,e,r){return this._getId(t,e,r)},e.merge=function(t,e){return this._mergeStrategy(t,e)},e.fallback=function(t,e){return this._fallbackStrategy(t,e)},e.normalize=function(t,e,r,n,o,i){var u=this,c=this.getId(t,e,r),a=this.key;if(a in i||(i[a]={}),c in i[a]||(i[a][c]=[]),i[a][c].some((function(e){return e===t})))return c;i[a][c].push(t);var s=this._processStrategy(t,e,r);return Object.keys(this.schema).forEach((function(e){if(s.hasOwnProperty(e)&&"object"==typeof s[e]){var r=u.schema[e],c="function"==typeof r?r(t):r;s[e]=n(s[e],s,e,c,o,i)}})),o(this,s,t,e,r),c},e.denormalize=function(t,e){var r=this;return Lt(t)?Ct(this.schema,t,e):(Object.keys(this.schema).forEach((function(n){if(t.hasOwnProperty(n)){var o=r.schema[n];t[n]=e(t[n],o)}})),t)},Tt(t,[{key:"key",get:function(){return this._key}},{key:"idAttribute",get:function(){return this._idAttribute}}]),t}(),Vt=function(){function t(t,e){e&&(this._schemaAttribute="string"==typeof e?function(t){return t[e]}:e),this.define(t)}var e=t.prototype;return e.define=function(t){this.schema=t},e.getSchemaAttribute=function(t,e,r){return!this.isSingleSchema&&this._schemaAttribute(t,e,r)},e.inferSchema=function(t,e,r){if(this.isSingleSchema)return this.schema;var n=this.getSchemaAttribute(t,e,r);return this.schema[n]},e.normalizeValue=function(t,e,r,n,o,i){var u=this.inferSchema(t,e,r);if(!u)return t;var c=n(t,e,r,u,o,i);return this.isSingleSchema||null==c?c:{id:c,schema:this.getSchemaAttribute(t,e,r)}},e.denormalizeValue=function(t,e){var r=Lt(t)?t.get("schema"):t.schema;return this.isSingleSchema||r?e((this.isSingleSchema?void 0:Lt(t)?t.get("id"):t.id)||t,this.isSingleSchema?this.schema:this.schema[r]):t},Tt(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),Nt=function(t){function e(e,r){if(!r)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return t.call(this,e,r)||this}It(e,t);var r=e.prototype;return r.normalize=function(t,e,r,n,o,i){return this.normalizeValue(t,e,r,n,o,i)},r.denormalize=function(t,e){return this.denormalizeValue(t,e)},e}(Vt),Ft=function(t){function e(){return t.apply(this,arguments)||this}It(e,t);var r=e.prototype;return r.normalize=function(t,e,r,n,o,i){var u=this;return Object.keys(t).reduce((function(e,r,c){var a,s=t[r];return null!=s?Mt({},e,((a={})[r]=u.normalizeValue(s,t,r,n,o,i),a)):e}),{})},r.denormalize=function(t,e){var r=this;return Object.keys(t).reduce((function(n,o){var i,u=t[o];return Mt({},n,((i={})[o]=r.denormalizeValue(u,e),i))}),{})},e}(Vt),zt=function(t){return Array.isArray(t)?t:Object.keys(t).map((function(e){return t[e]}))},qt=function(t,e,r,n,o,i,u){return t=function(t){if(Array.isArray(t)&&t.length>1)throw new Error("Expected schema definition to be a single schema, but found "+t.length+".");return t[0]}(t),zt(e).map((function(e,c){return o(e,r,n,t,i,u)}))},Ht=function(t){function e(){return t.apply(this,arguments)||this}It(e,t);var r=e.prototype;return r.normalize=function(t,e,r,n,o,i){var u=this;return zt(t).map((function(t,c){return u.normalizeValue(t,e,r,n,o,i)})).filter((function(t){return null!=t}))},r.denormalize=function(t,e){var r=this;return t&&t.map?t.map((function(t){return r.denormalizeValue(t,e)})):t},e}(Vt),Qt=function(t,e,r,n,o,i,u){var c=Mt({},e);return Object.keys(t).forEach((function(r){var n=t[r],a="function"==typeof n?n(e):n,s=o(e[r],e,r,a,i,u);null==s?delete c[r]:c[r]=s})),c},Bt=function(t,e,r){if(Lt(e))return Ct(t,e,r);var n=Mt({},e);return Object.keys(t).forEach((function(e){null!=n[e]&&(n[e]=r(n[e],t[e]))})),n},Yt=function(){function t(t){this.define(t)}var e=t.prototype;return e.define=function(t){this.schema=Object.keys(t).reduce((function(e,r){var n,o=t[r];return Mt({},e,((n={})[r]=o,n))}),this.schema||{})},e.normalize=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Qt.apply(void 0,[this.schema].concat(e))},e.denormalize=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Bt.apply(void 0,[this.schema].concat(e))},t}(),$t=function t(e,r,n,o,i,u){return"object"==typeof e&&e?"object"!=typeof o||o.normalize&&"function"==typeof o.normalize?o.normalize(e,r,n,t,i,u):(Array.isArray(o)?qt:Qt)(o,e,r,n,t,i,u):e},Gt={Array:Ht,Entity:Ut,Object:Yt,Union:Nt,Values:Ft},Kt=s({integration:new Gt.Entity("integration"),account:new Gt.Entity("account"),price:new Gt.Entity("price"),product:new Gt.Entity("product"),product_group:new Gt.Entity("product_group"),purchase:new Gt.Entity("purchase"),payment_method:new Gt.Entity("payment_method"),card:new Gt.Entity("card"),invoice:new Gt.Entity("invoice"),current_period:new Gt.Entity("current_period"),refund:new Gt.Entity("refund"),charge:new Gt.Entity("charge"),coupon:new Gt.Entity("coupon"),promotion:new Gt.Entity("promotion"),order:new Gt.Entity("order"),customer:new Gt.Entity("customer"),subscription:new Gt.Entity("subscription")},"product_group",new Gt.Entity("product_group")),Jt=Kt.price,Wt=Kt.product,Xt=Kt.purchase,Zt=Kt.payment_method,te=Kt.card,ee=Kt.invoice,re=Kt.refund,ne=Kt.charge,oe=Kt.coupon,ie=Kt.promotion,ue=Kt.order,ce=Kt.integration,ae=Kt.customer,se=Kt.product_group,le=Kt.subscription;Wt.define({prices:{data:[Jt]},product_group:se}),Jt.define({product:Wt}),ee.define({purchases:{data:[Xt]},charge:ne,customer:ae,subscription:le}),ue.define({purchases:{data:[Xt]},charge:ne,customer:ae,subscription:le}),ne.define({order:ue,invoice:ee}),le.define({current_period:ee,purchase:Xt,price:Jt,payment_method:Zt,order:ue,customer:ae}),re.define({charge:ne,customer:ae}),Xt.define({order:ue,product:Wt,subscription:le}),Zt.define({card:te}),oe.define({promotions:{data:[ie]}}),se.define({}),ce.define({});var fe=function(t){var e,r;return null!=Kt&&Kt[null==t||null===(e=t[0])||void 0===e?void 0:e.object]?function(t,e){if(!t||"object"!=typeof t)throw new Error('Unexpected input given to normalize. Expected type to be "object", found "'+(null===t?"null":typeof t)+'".');var r={},n=function(t){return function(e,r,n,o,i){var u=e.key,c=e.getId(n,o,i);u in t||(t[u]={});var a=t[u][c];t[u][c]=a?e.merge(a,r):r}}(r);return{entities:r,result:$t(t,t,null,e,n,{})}}(t,[Kt[null==t||null===(r=t[0])||void 0===r?void 0:r.object]]):{}},de=["query"],pe=["query","data","path"],ye=["id","key","query","data","path"],ve=["query","data","path"],he=["query","data","path"];function be(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ge(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?be(Object(r),!0).forEach((function(e){s(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):be(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var me=E().mark(Te),Ee=E().mark(Ue),Oe=E().mark(Ve),we=E().mark(Ne),Se=E().mark(ze),_e=E().mark(qe),Ae=E().mark(He),De=E().mark(Qe),Re=E().mark(We);function je(t){return{type:"SET_ERROR",payload:t}}function xe(t){return{type:"REGISTER_ENTITIES",payload:t}}function ke(t){return{type:"SET_MODELS",payload:t}}function Pe(t){return{type:"ADD_MODELS",payload:t}}function Te(t,e,r){return E().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",{type:"UPDATE_MODELS_PROPERTY",payload:r,key:t,prop:e});case 1:case"end":return n.stop()}}),me)}function Me(t,e){return{type:"UPDATE_MODELS",payload:e,key:t}}function Ie(t){return{type:"ADD_MODEL",payload:t}}function Le(t,e){return{type:"ADD_DRAFT",name:t,payload:e}}function Ce(t){return Ie(t)}function Ue(t,e,r){return E().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i.controls.dispatch(tr,"updateDirty",e,r);case 2:return n.abrupt("return",{type:"UPDATE_MODEL",name:t,id:e,payload:r});case 3:case"end":return n.stop()}}),Ee)}function Ve(t){var e,r,n,o,u,c,a,s,l,f,d;return E().wrap((function(p){for(;;)switch(p.prev=p.next){case 0:e=Array.isArray(t)?t:[t],r=fe(e)||{},n=r.entities,o=0,u=Object.keys(n||{});case 3:if(!(o<u.length)){p.next=19;break}c=u[o],a=n[c],s=0,l=Object.keys(a||{});case 7:if(!(s<l.length)){p.next=16;break}return d=l[s],p.next=11,i.controls.dispatch(tr,"addModel",a[d]);case 11:return p.next=13,i.controls.dispatch(tr,"removeDirty",null===(f=a[d])||void 0===f?void 0:f.id);case 13:s++,p.next=7;break;case 16:o++,p.next=3;break;case 19:case"end":return p.stop()}}),Oe)}function Ne(t,e){return E().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,{type:"UPDATE_DIRTY",id:t,payload:e};case 2:case"end":return r.stop()}}),we)}function Fe(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return E().mark((function n(){return E().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,{type:"UPDATE_DRAFT",name:t,index:e,payload:r};case 2:case"end":return n.stop()}}),n)}))()}function ze(t,e){var r;return E().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,tt({path:(0,S.addQueryArgs)("".concat(t,"s/").concat(e),{context:"edit"}),method:"DELETE"});case 3:r=n.sent,n.next=9;break;case 6:throw n.prev=6,n.t0=n.catch(0),n.t0;case 9:if(!r){n.next=13;break}return n.next=12,i.controls.dispatch(J,"addSnackbarNotice",{content:(0,l.__)("Deleted.","surecart")});case 12:return n.abrupt("return",{type:"DELETE_MODEL",id:e,name:t});case 13:throw{message:"Failed to delete."};case 14:case"end":return n.stop()}}),Se,null,[[0,6]])}function qe(t){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,{type:"REMOVE_DIRTY",id:t};case 2:case"end":return e.stop()}}),_e)}function He(t,e){return E().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,{type:"REMOVE_DRAFT",name:t,index:e};case 2:case"end":return r.stop()}}),Ae)}function Qe(t){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,{type:"CLEAR_DRAFTS",name:t};case 2:case"end":return e.stop()}}),De)}function Be(){return{type:"CLEAR_DIRTY"}}function Ye(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.query,o=g(r,de);return E().mark((function r(){var u,c;return E().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,i.controls.dispatch(J,"clearModelErrors",t);case 2:return u=null!=e&&e.id?"".concat(t,"s/").concat(null==e?void 0:e.id):"".concat(t,"s"),r.next=5,tt(ge({path:(0,S.addQueryArgs)(u,ge({context:"edit"},n||{})),method:null!=e&&e.id?"PATCH":"POST",data:e},o));case 5:if((c=r.sent)&&null!=c&&c.id){r.next=8;break}throw{message:(0,l.__)("Failed to save.","surecart")};case 8:return r.next=10,i.controls.dispatch(tr,"receiveModels",c);case 10:return r.abrupt("return",c);case 11:case"end":return r.stop()}}),r)}))()}function $e(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.query,o=r.data,u=r.path,c=g(r,pe);return E().mark((function r(){var a,s,f,d,p;return E().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,i.controls.dispatch(J,"clearModelErrors",t);case 2:return r.next=4,i.controls.resolveSelect(tr,"selectDirty");case 4:if(a=r.sent,s=e?"".concat(t,"s/").concat(e):"".concat(t,"s"),f=u||s,d=Object.keys(o||{}).length?o:null==a?void 0:a[e],Object.keys(d||{}).length||u){r.next=10;break}return r.abrupt("return");case 10:return r.next=12,tt(ge({path:(0,S.addQueryArgs)(f,ge({context:"edit"},n||{})),method:e?"PATCH":"POST",data:d},c));case 12:if((p=r.sent)&&null!=p&&p.id){r.next=15;break}throw{message:(0,l.__)("Failed to save.","surecart")};case 15:return r.next=17,i.controls.dispatch(tr,"receiveModels",p);case 17:case"end":return r.stop()}}),r)}))()}function Ge(t){var e=t.id,r=t.key,n=t.query,o=t.data,i=t.path,u=g(t,ye);return E().mark((function t(){var c,a;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=e?"".concat(r,"s/").concat(e):"".concat(r,"s"),a=i||c,t.next=4,tt(ge({path:(0,S.addQueryArgs)(a,ge({context:"edit"},n||{})),method:e?"PATCH":"POST",data:o},u));case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),t)}))()}function Ke(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.query,e.data,e.path,g(e,ve),E().mark((function t(){var e,r;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i.controls.dispatch(J,"setSaving",!0);case 2:return t.next=4,i.controls.dispatch(J,"clearModelErrors",key);case 4:return t.next=6,i.controls.resolveSelect(tr,"selectDrafts",key);case 6:if(null!=(e=t.sent)&&e.length){t.next=9;break}return t.abrupt("return",!1);case 9:return r=[],e.forEach((function(t){e.forEach((function(e,n){r.push({key:t,request:Ze(e,entity),index:n})}))})),t.next=13,et(r);case 13:return t.abrupt("return",t.sent);case 14:case"end":return t.stop()}}),t)}))()}function Je(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.query,o=r.data,u=(r.path,g(r,he));return E().mark((function r(){var c,a;return E().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,i.controls.dispatch(J,"clearModelErrors",t);case 2:return r.next=4,i.controls.resolveSelect(tr,"selectDraft",t,e);case 4:if(c=r.sent,Object.keys(c||{}).length){r.next=7;break}return r.abrupt("return",!1);case 7:return r.next=9,Ge(ge({key:t,query:n,data:ge(ge({},c),o)},u));case 9:if((a=r.sent)&&null!=a&&a.id){r.next=12;break}throw{message:(0,l.__)("Failed to save.","surecart")};case 12:return r.next=14,i.controls.dispatch(tr,"updateDraft",t,e,a);case 14:return r.next=16,i.controls.dispatch(tr,"receiveModels",a);case 16:return r.abrupt("return",a);case 17:case"end":return r.stop()}}),r)}))()}function We(t){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.controls.dispatch(tr,"updateModel",t);case 2:return e.next=4,i.controls.dispatch(tr,"removeDirty",null==t?void 0:t.id);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),Re)}function Xe(t,e){return null==t||!t.id||Object.keys((null==e?void 0:e[null==t?void 0:t.id])||{}).length}function Ze(t,e){var r=t.id?"".concat(null==e?void 0:e.baseURL,"/").concat(t.id):null==e?void 0:e.baseURL;return{path:(0,S.addQueryArgs)(r,e.baseURLParams),method:t.id?"PATCH":"POST",data:t}}var tr="surecart/core-data",er={reducer:v,selectors:n,controls:nt,actions:o};(0,i.registerStore)(tr,er)}()}();