File: /home/zeusxp5/tour.kamille.us/wp-content/plugins/surecart/dist/5585.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[5585],{4805:function(e,t,r){r.d(t,{a:function(){return d},b:function(){return s},g:function(){return l}});var n=r(4467),o=r(3453);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var _n=0,n=function(){};return{s:n,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e){for(var t,r="",n=Object.entries(e);t=n.shift();){var i=t,a=(0,o.A)(i,2),c=a[0],s=a[1];if(Array.isArray(s)||s&&s.constructor===Object){var p,l=u(Object.entries(s).reverse());try{for(l.s();!(p=l.n()).done;){var d=(0,o.A)(p.value,2),f=d[0],h=d[1];n.unshift(["".concat(c,"[").concat(f,"]"),h])}}catch(e){l.e(e)}finally{l.f()}}else void 0!==s&&(null===s&&(s=""),r+="&"+[c,s].map(encodeURIComponent).join("="))}return r.substr(1)}function p(e){try{return decodeURIComponent(e)}catch(t){return e}}function l(e){return(function(e){var t;try{t=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(t)return t}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,t){var r=t.split("=").filter(Boolean).map(p),n=(0,o.A)(r,2),i=n[0],u=n[1],c=void 0===u?"":u;return i&&function(e,t,r){for(var n=t.length,o=n-1,i=0;i<n;i++){var u=t[i];!u&&Array.isArray(e)&&(u=e.length.toString()),u=["__proto__","constructor","prototype"].includes(u)?u.toUpperCase():u;var c=!isNaN(Number(t[i+1]));e[u]=i===o?r:e[u]||(c?[]:{}),Array.isArray(e[u])&&!c&&(e[u]=a({},e[u])),e=e[u]}}(e,i.replace(/\]/g,"").split("["),c),e}),Object.create(null))}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!t||!Object.keys(t).length)return e;var r=e,n=e.indexOf("?");return-1!==n&&(t=Object.assign(l(e),t),r=r.substr(0,n)),r+"?"+s(t)}},8803:function(e,t,r){r.d(t,{a:function(){return J},h:function(){return X}});var n=r(9394),o=r(467),i=r(45),a=r(3453),u=r(4467),c=r(9280),s=r.n(c),p=r(4805),l=r(3506),d=["rest_route"],f=["path","url"],h=["url","path","data","parse"];function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){(0,u.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t){return void 0!==(0,l.g)(e,t)}function y(e){var t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map((function(e){return e.split("=")})).map((function(e){return e.map(decodeURIComponent)})).sort((function(e,t){return e[0].localeCompare(t[0])})).map((function(e){return e.map(encodeURIComponent)})).map((function(e){return e.join("=")})).join("&"):n}var b=function(e,t){var r,n,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),o=(n=e.endpoint.replace(/^\//,""))?r+"/"+n:r),delete e.namespace,delete e.endpoint,t(w(w({},e),{},{path:o}))};function m(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var O=function(e){return e.json?e.json():Promise.reject(e)},_=function(e){return function(e){if(!e)return{};var t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}}(e.headers.get("link")).next},j=function(e){var t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r},P=function(){var e=(0,o.A)(s().mark((function e(t,r){var n,o,a,u,c,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==t.parse){e.next=2;break}return e.abrupt("return",r(t));case 2:if(j(t)){e.next=4;break}return e.abrupt("return",r(t));case 4:return e.next=6,J(w(w({},(d={per_page:100},void 0,void 0,h=(s=t).path,v=s.url,w(w({},(0,i.A)(s,f)),{},{url:v&&(0,p.a)(v,d),path:h&&(0,p.a)(h,d)}))),{},{parse:!1}));case 6:return n=e.sent,e.next=9,O(n);case 9:if(o=e.sent,Array.isArray(o)){e.next=12;break}return e.abrupt("return",o);case 12:if(a=_(n)){e.next=15;break}return e.abrupt("return",o);case 15:u=[].concat(o);case 16:if(!a){e.next=27;break}return e.next=19,J(w(w({},t),{},{path:void 0,url:a,parse:!1}));case 19:return c=e.sent,e.next=22,O(c);case 22:l=e.sent,u=u.concat(l),a=_(c),e.next=16;break;case 27:return e.abrupt("return",u);case 28:case"end":return e.stop()}var s,d,h,v}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),k=new Set(["PATCH","PUT","DELETE"]),x=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Promise.resolve(function(e){return arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?e:204===e.status?null:e.json?e.json():Promise.reject(e)}(e,t)).catch((function(e){return A(e,t)}))};function A(e){if(arguments.length>1&&void 0!==arguments[1]&&!arguments[1])throw e;return function(e){var t={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch((function(){throw t}))}(e).then((function(e){var t={code:"unknown_error",message:wp.i18n.__("An unknown error occurred.")};throw e||t}))}var S,E,T,D,I,C,M,N={Accept:"application/json, */*;q=0.1"},q={credentials:"include"},R=[function(e,t){return"string"!=typeof e.url||g(e.url,"_locale")||(e.url=(0,p.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||g(e.path,"_locale")||(e.path=(0,p.a)(e.path,{_locale:"user"})),t(e)},b,function(e,t){var r=e.method,n=void 0===r?"GET":r;return k.has(n.toUpperCase())&&(e=w(w({},e),{},{headers:w(w({},e.headers),{},{"X-HTTP-Method-Override":n,"Content-Type":"application/json"}),method:"POST"})),t(e)},P],U=function(e){if(e.status>=200&&e.status<300)return e;throw e},L=function(e){var t=e.url,r=e.path,n=e.data,o=e.parse,a=void 0===o||o,u=(0,i.A)(e,h),c=e.body,s=e.headers;return s=w(w({},N),s),n&&(c=JSON.stringify(n),s["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,w(w(w({},q),u),{},{body:c,headers:s})).then((function(e){return Promise.resolve(e).then(U).catch((function(e){return A(e,a)})).then((function(e){return x(e,a)}))}),(function(e){if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:wp.i18n.__("You are probably offline.")}}))};function J(e){return R.reduceRight((function(e,t){return function(r){return t(r,e)}}),L)(e).catch((function(t){return"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(J.nonceEndpoint).then(U).then((function(e){return e.text()})).then((function(t){return J.nonceMiddleware.nonce=t,J(e)}))}))}J.use=function(e){R.unshift(e)},J.setFetchHandler=function(e){L=e},J.createNonceMiddleware=function(e){var t=function e(t,r){var n=t.headers,o=void 0===n?{}:n;for(var i in o)if("x-wp-nonce"===i.toLowerCase()&&o[i]===e.nonce)return r(t);return r(w(w({},t),{},{headers:w(w({},o),{},{"X-WP-Nonce":e.nonce})}))};return t.nonce=e,t},J.createPreloadingMiddleware=function(e){var t=Object.fromEntries(Object.entries(e).map((function(e){var t=(0,a.A)(e,2),r=t[0],n=t[1];return[y(r),n]})));return function(e,r){var n=e.parse,o=void 0===n||n,a=e.path;if(!a&&e.url){var u=(0,p.g)(e.url),c=u.rest_route,s=(0,i.A)(u,d);"string"==typeof c&&(a=(0,p.a)(c,s))}if("string"!=typeof a)return r(e);var l=e.method||"GET",f=y(a);if("GET"===l&&t[f]){var h=t[f];return delete t[f],m(h,!!o)}if("OPTIONS"===l&&t[l]&&t[l][f]){var v=t[l][f];return delete t[l][f],m(v,!!o)}return r(e)}},J.createRootURLMiddleware=function(e){return function(t,r){return b(t,(function(t){var n,o=t.url,i=t.path;return"string"==typeof i&&(n=e,-1!==e.indexOf("?")&&(i=i.replace("?","&")),i=i.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(i=i.replace("?","&")),o=n+i),r(w(w({},t),{},{url:o}))}))}},J.fetchAllMiddleware=P,J.mediaUploadMiddleware=function(e,t){if(!function(e){var t=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&t}(e))return t(e);var r=0,n=function e(n){return r++,t({path:"/wp/v2/media/".concat(n,"/post-process"),method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((function(){return r<5?e(n):(t({path:"/wp/v2/media/".concat(n,"?force=true"),method:"DELETE"}),Promise.reject())}))};return t(w(w({},e),{},{parse:!1})).catch((function(t){var r=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&r?n(r).catch((function(){return!1!==e.parse?Promise.reject({code:"post_process",message:wp.i18n.__("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t)})):A(t,e.parse)})).then((function(t){return x(t,e.parse)}))},J.createThemePreviewMiddleware=function(e){return function(t,r){if("string"==typeof t.url){var n=(0,l.g)(t.url,"wp_theme_preview");void 0===n?t.url=(0,p.a)(t.url,{wp_theme_preview:e}):""===n&&(t.url=(0,l.r)(t.url,"wp_theme_preview"))}if("string"==typeof t.path){var o=(0,l.g)(t.path,"wp_theme_preview");void 0===o?t.path=(0,p.a)(t.path,{wp_theme_preview:e}):""===o&&(t.path=(0,l.r)(t.path,"wp_theme_preview"))}return r(t)}},J.fetchAllMiddleware=null,J.use(J.createRootURLMiddleware((null===(E=null===(S=null===window||void 0===window?void 0:window.parent)||void 0===S?void 0:S.scData)||void 0===E?void 0:E.root_url)||(null===(T=null===window||void 0===window?void 0:window.scData)||void 0===T?void 0:T.root_url))),(null===(D=null===window||void 0===window?void 0:window.scData)||void 0===D?void 0:D.nonce)&&(J.nonceMiddleware=J.createNonceMiddleware(null===(I=null===window||void 0===window?void 0:window.scData)||void 0===I?void 0:I.nonce),J.use(J.nonceMiddleware)),(null===(C=null===window||void 0===window?void 0:window.scData)||void 0===C?void 0:C.nonce_endpoint)&&(J.nonceEndpoint=null===(M=null===window||void 0===window?void 0:window.scData)||void 0===M?void 0:M.nonce_endpoint),J.use((function(e,t){return e.path=(0,p.a)(e.path,{t:Date.now()}),t(e)})),J.use((function(e,t){return e.path=(0,p.a)(e.path,w({},!!(0,l.g)(window.location.href,"currency")&&{currency:(0,l.g)(window.location.href,"currency")})),t(e)})),J.use((function(e,t){var r=t(e);return r.catch((function(e){var t;return"invalid_json"===e.code&&(e.message=wp.i18n.__("The response is not a valid JSON response.","surecart"),e.additional_errors=[{code:"invalid_json",message:wp.i18n.sprintf(/* translators: %s: URL to debug settings page */
wp.i18n.__("Please ensure that your site is not in debug mode as this may interfere with API responses. %s","surecart"),'<a href="'.concat("https://surecart.com/docs/is-not-a-valid-json-response/",'" target="_blank" rel="noopener noreferrer">').concat(wp.i18n.__("More Information","surecart"),"</a>"))}]),"checkout.finalize_error"===e.code&&(e.additional_errors=[].concat((0,n.A)((null===(t=null==e?void 0:e.additional_errors)||void 0===t?void 0:t.length)?[]:[{code:"checkout.finalize_error",message:e.message}]),(0,n.A)(e.additional_errors||[])),e.message=wp.i18n.__("We were not able to process this order","surecart")),Promise.reject(e)})),r}));var W=function(e){var t={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.","surecart")};if((null==e?void 0:e.code)&&(null==e?void 0:e.message))throw e;if(!e||!e.json)throw t;return e.json().catch((function(){throw t}))},X=function(){var e=(0,o.A)(s().mark((function e(t){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,W(t);case 2:if("rest_cookie_invalid_nonce"===(r=e.sent).code){e.next=5;break}throw r;case 5:return e.abrupt("return",window.fetch(J.nonceEndpoint).then((function(e){if(e.status>=200&&e.status<300)return e;throw e})).then((function(e){return e.text()})).then((function(e){J.nonceMiddleware.nonce=e})));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},2942:function(e,t,r){r.d(t,{o:function(){return n}});var n=function(e,t){new window.IntersectionObserver((function(e,r){e[0].intersectionRatio>0&&(t(),r.unobserve(e[0].target))})).observe(e)}},3506:function(e,t,r){r.d(t,{g:function(){return o},r:function(){return i}});var n=r(4805);function o(e,t){return(0,n.g)(e)[t]}function i(e){var t=e.indexOf("?");if(-1===t)return e;for(var r=(0,n.g)(e),o=e.substr(0,t),i=arguments.length,a=new Array(i>1?i-1:0),u=1;u<i;u++)a[u-1]=arguments[u];a.forEach((function(e){return delete r[e]}));var c=(0,n.b)(r);return c?o+"?"+c:o}},5585:function(e,t,r){r.r(t),r.d(t,{sc_dashboard_downloads_list:function(){return v}});var n=r(4467),o=r(467),i=r(3029),a=r(2901),u=r(9280),c=r.n(u),s=r(1346),p=r(8803),l=r(2942),d=r(4805);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var v=function(){return(0,a.A)((function e(t){(0,i.A)(this,e),(0,s.r)(this,t),this.query={page:1,per_page:10},this.allLink=void 0,this.heading=void 0,this.isCustomer=void 0,this.requestNonce=void 0,this.purchases=[],this.loading=void 0,this.busy=void 0,this.error=void 0,this.pagination={total:0,total_pages:0}}),[{key:"componentWillLoad",value:function(){var e=this;(0,l.o)(this.el,(function(){e.initialFetch()}))}},{key:"initialFetch",value:(r=(0,o.A)(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isCustomer){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.loading=!0,e.next=6,this.getItems();case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),console.error(this.error),this.error=(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("Something went wrong","surecart");case 12:return e.prev=12,this.loading=!1,e.finish(12);case 15:case"end":return e.stop()}}),e,this,[[2,8,12,15]])}))),function(){return r.apply(this,arguments)})},{key:"fetchItems",value:(t=(0,o.A)(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isCustomer){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.busy=!0,e.next=6,this.getItems();case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),console.error(this.error),this.error=(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("Something went wrong","surecart");case 12:return e.prev=12,this.busy=!1,e.finish(12);case 15:case"end":return e.stop()}}),e,this,[[2,8,12,15]])}))),function(){return t.apply(this,arguments)})},{key:"getItems",value:(e=(0,o.A)(c().mark((function e(){var t;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,p.a)({path:(0,d.a)("surecart/v1/purchases/",h({expand:["product","product.downloads","download.media"],downloadable:!0,revoked:!1},this.query)),parse:!1});case 2:return e.next=4,e.sent;case 4:return t=e.sent,this.pagination={total:parseInt(t.headers.get("X-WP-Total")),total_pages:parseInt(t.headers.get("X-WP-TotalPages"))},e.next=8,t.json();case 8:return this.purchases=e.sent,e.abrupt("return",this.purchases);case 10:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"nextPage",value:function(){this.query.page=this.query.page+1,this.fetchItems()}},{key:"prevPage",value:function(){this.query.page=this.query.page-1,this.fetchItems()}},{key:"render",value:function(){var e,t=this;return(0,s.h)("sc-purchase-downloads-list",{key:"e92fc4dfc5d7d64b7b8fa6f5313d4bbec68ec952",heading:this.heading,allLink:this.allLink&&this.pagination.total_pages>1?this.allLink:"",loading:this.loading,busy:this.busy,requestNonce:this.requestNonce,error:this.error,purchases:this.purchases},(0,s.h)("span",{key:"b084ae3d8b4f160f69b85af444a07dea8f23ea16",slot:"heading"},(0,s.h)("slot",{key:"f950ea34f3f079e310ba433ad1f99f7adb808435",name:"heading"},this.heading||wp.i18n.__("Downloads","surecart"))),(0,s.h)("sc-pagination",{key:"2ced9d46edf5480141be7679007c3804000652d1",slot:"after",page:this.query.page,perPage:this.query.per_page,total:this.pagination.total,totalPages:this.pagination.total_pages,totalShowing:null===(e=null==this?void 0:this.purchases)||void 0===e?void 0:e.length,onScNextPage:function(){return t.nextPage()},onScPrevPage:function(){return t.prevPage()}}))}},{key:"el",get:function(){return(0,s.a)(this)}}]);var e,t,r}();v.style=":host{display:block}.download__details{opacity:0.75}"},45:function(e,t,r){r.d(t,{A:function(){return o}});var n=r(8587);function o(e,t){if(null==e)return{};var r,o,i=(0,n.A)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}},8587:function(e,t,r){function n(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}r.d(t,{A:function(){return n}})}}]);