index of
/
home
/
thefkyzp
/
hulmvisaadvisor.com
/
wp-content
/
plugins
/
surecart
/
dist
/
File: /home/thefkyzp/hulmvisaadvisor.com/wp-content/plugins/surecart/dist/6453.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[6453],{4805:function(e,n,t){t.d(n,{a:function(){return p},b:function(){return s},g:function(){return l}});var r=t(4467),o=t(296);function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){(0,r.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function c(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return u(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}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(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(a)throw o}}}}function u(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function s(e){for(var n,t="",r=Object.entries(e);n=r.shift();){var i=n,a=(0,o.A)(i,2),u=a[0],s=a[1];if(Array.isArray(s)||s&&s.constructor===Object){var d,l=c(Object.entries(s).reverse());try{for(l.s();!(d=l.n()).done;){var p=(0,o.A)(d.value,2),f=p[0],h=p[1];r.unshift(["".concat(u,"[").concat(f,"]"),h])}}catch(e){l.e(e)}finally{l.f()}}else void 0!==s&&(null===s&&(s=""),t+="&"+[u,s].map(encodeURIComponent).join("="))}return t.substr(1)}function d(e){try{return decodeURIComponent(e)}catch(n){return e}}function l(e){return(function(e){var n;try{n=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(n)return n}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,n){var t=n.split("=").filter(Boolean).map(d),r=(0,o.A)(t,2),i=r[0],c=r[1],u=void 0===c?"":c;return i&&function(e,n,t){for(var r=n.length,o=r-1,i=0;i<r;i++){var c=n[i];!c&&Array.isArray(e)&&(c=e.length.toString()),c=["__proto__","constructor","prototype"].includes(c)?c.toUpperCase():c;var u=!isNaN(Number(n[i+1]));e[c]=i===o?t:e[c]||(u?[]:{}),Array.isArray(e[c])&&!u&&(e[c]=a({},e[c])),e=e[c]}}(e,i.replace(/\]/g,"").split("["),u),e}),Object.create(null))}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;if(!n||!Object.keys(n).length)return e;var t=e,r=e.indexOf("?");return-1!==r&&(n=Object.assign(l(e),n),t=t.substr(0,r)),t+"?"+s(n)}},581:function(e,n,t){t.d(n,{o:function(){return o}});var r=t(1346),o=function(e,n,t){void 0===t&&(t=!0);var o="Function"===e.constructor.name?e.prototype:e,i=o.componentWillLoad;o.componentWillLoad=function(){var e,o=this,a=(0,r.a)(this),c={promise:new Promise((function(n){e=n})),resolve:e},u=new CustomEvent("openWormhole",{bubbles:!0,composed:!0,detail:{consumer:this,fields:n,updater:function(e,n){(e in a?a:o)[e]=n},onOpen:c}});a.dispatchEvent(u);var s=function(){if(i)return i.call(o)};return t?c.promise.then((function(){return s()})):s()}}},3:function(e,n,t){t.d(n,{a:function(){return q},h:function(){return W}});var r=t(467),o=t(45),i=t(296),a=t(4467),c=t(9280),u=t.n(c),s=t(4805),d=t(3506),l=["rest_route"],p=["path","url"],f=["url","path","data","parse"];function h(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function v(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?h(Object(t),!0).forEach((function(n){(0,a.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function w(e,n){return void 0!==(0,d.g)(e,n)}function m(e){var n=e.split("?"),t=n[1],r=n[0];return t?r+"?"+t.split("&").map((function(e){return e.split("=")})).map((function(e){return e.map(decodeURIComponent)})).sort((function(e,n){return e[0].localeCompare(n[0])})).map((function(e){return e.map(encodeURIComponent)})).map((function(e){return e.join("=")})).join("&"):r}var y=function(e,n){var t,r,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(t=e.namespace.replace(/^\/|\/$/g,""),o=(r=e.endpoint.replace(/^\//,""))?t+"/"+r:t),delete e.namespace,delete e.endpoint,n(v(v({},e),{},{path:o}))};function b(e,n){return Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var g=function(e){return e.json?e.json():Promise.reject(e)},_=function(e){return function(e){if(!e)return{};var n=e.match(/<([^>]+)>; rel="next"/);return n?{next:n[1]}:{}}(e.headers.get("link")).next},O=function(e){var n=!!e.path&&-1!==e.path.indexOf("per_page=-1"),t=!!e.url&&-1!==e.url.indexOf("per_page=-1");return n||t},j=function(){var e=(0,r.A)(u().mark((function e(n,t){var r,i,a,c,d,l;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==n.parse){e.next=2;break}return e.abrupt("return",t(n));case 2:if(O(n)){e.next=4;break}return e.abrupt("return",t(n));case 4:return e.next=6,q(v(v({},(f={per_page:100},void 0,void 0,h=(u=n).path,w=u.url,v(v({},(0,o.A)(u,p)),{},{url:w&&(0,s.a)(w,f),path:h&&(0,s.a)(h,f)}))),{},{parse:!1}));case 6:return r=e.sent,e.next=9,g(r);case 9:if(i=e.sent,Array.isArray(i)){e.next=12;break}return e.abrupt("return",i);case 12:if(a=_(r)){e.next=15;break}return e.abrupt("return",i);case 15:c=[].concat(i);case 16:if(!a){e.next=27;break}return e.next=19,q(v(v({},n),{},{path:void 0,url:a,parse:!1}));case 19:return d=e.sent,e.next=22,g(d);case 22:l=e.sent,c=c.concat(l),a=_(d),e.next=16;break;case 27:return e.abrupt("return",c);case 28:case"end":return e.stop()}var u,f,h,w}),e)})));return function(_x,n){return e.apply(this,arguments)}}(),P=new Set(["PATCH","PUT","DELETE"]),x=function(e){var n=!(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,n)).catch((function(e){return k(e,n)}))};function k(e){if(arguments.length>1&&void 0!==arguments[1]&&!arguments[1])throw e;return function(e){var n={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.")};if(!e||!e.json)throw n;return e.json().catch((function(){throw n}))}(e).then((function(e){var n={code:"unknown_error",message:wp.i18n.__("An unknown error occurred.")};throw e||n}))}var A,I,E,S,T,C,D,M={Accept:"application/json, */*;q=0.1"},U={credentials:"include"},L=[function(e,n){return"string"!=typeof e.url||w(e.url,"_locale")||(e.url=(0,s.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||w(e.path,"_locale")||(e.path=(0,s.a)(e.path,{_locale:"user"})),n(e)},y,function(e,n){var t=e.method,r=void 0===t?"GET":t;return P.has(r.toUpperCase())&&(e=v(v({},e),{},{headers:v(v({},e.headers),{},{"X-HTTP-Method-Override":r,"Content-Type":"application/json"}),method:"POST"})),n(e)},j],N=function(e){if(e.status>=200&&e.status<300)return e;throw e},R=function(e){var n=e.url,t=e.path,r=e.data,i=e.parse,a=void 0===i||i,c=(0,o.A)(e,f),u=e.body,s=e.headers;return s=v(v({},M),s),r&&(u=JSON.stringify(r),s["Content-Type"]="application/json"),window.fetch(n||t||window.location.href,v(v(v({},U),c),{},{body:u,headers:s})).then((function(e){return Promise.resolve(e).then(N).catch((function(e){return k(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 q(e){return L.reduceRight((function(e,n){return function(t){return n(t,e)}}),R)(e).catch((function(n){return"rest_cookie_invalid_nonce"!==n.code?Promise.reject(n):window.fetch(q.nonceEndpoint).then(N).then((function(e){return e.text()})).then((function(n){return q.nonceMiddleware.nonce=n,q(e)}))}))}q.use=function(e){L.unshift(e)},q.setFetchHandler=function(e){R=e},q.createNonceMiddleware=function(e){var n=function e(n,t){var r=n.headers,o=void 0===r?{}:r;for(var i in o)if("x-wp-nonce"===i.toLowerCase()&&o[i]===e.nonce)return t(n);return t(v(v({},n),{},{headers:v(v({},o),{},{"X-WP-Nonce":e.nonce})}))};return n.nonce=e,n},q.createPreloadingMiddleware=function(e){var n=Object.fromEntries(Object.entries(e).map((function(e){var n=(0,i.A)(e,2),t=n[0],r=n[1];return[m(t),r]})));return function(e,t){var r=e.parse,i=void 0===r||r,a=e.path;if(!a&&e.url){var c=(0,s.g)(e.url),u=c.rest_route,d=(0,o.A)(c,l);"string"==typeof u&&(a=(0,s.a)(u,d))}if("string"!=typeof a)return t(e);var p=e.method||"GET",f=m(a);if("GET"===p&&n[f]){var h=n[f];return delete n[f],b(h,!!i)}if("OPTIONS"===p&&n[p]&&n[p][f]){var v=n[p][f];return delete n[p][f],b(v,!!i)}return t(e)}},q.createRootURLMiddleware=function(e){return function(n,t){return y(n,(function(n){var r,o=n.url,i=n.path;return"string"==typeof i&&(r=e,-1!==e.indexOf("?")&&(i=i.replace("?","&")),i=i.replace(/^\//,""),"string"==typeof r&&-1!==r.indexOf("?")&&(i=i.replace("?","&")),o=r+i),t(v(v({},n),{},{url:o}))}))}},q.fetchAllMiddleware=j,q.mediaUploadMiddleware=function(e,n){if(!function(e){var n=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&n}(e))return n(e);var t=0,r=function e(r){return t++,n({path:"/wp/v2/media/".concat(r,"/post-process"),method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((function(){return t<5?e(r):(n({path:"/wp/v2/media/".concat(r,"?force=true"),method:"DELETE"}),Promise.reject())}))};return n(v(v({},e),{},{parse:!1})).catch((function(n){var t=n.headers.get("x-wp-upload-attachment-id");return n.status>=500&&n.status<600&&t?r(t).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(n)})):k(n,e.parse)})).then((function(n){return x(n,e.parse)}))},q.createThemePreviewMiddleware=function(e){return function(n,t){if("string"==typeof n.url){var r=(0,d.g)(n.url,"wp_theme_preview");void 0===r?n.url=(0,s.a)(n.url,{wp_theme_preview:e}):""===r&&(n.url=(0,d.r)(n.url,"wp_theme_preview"))}if("string"==typeof n.path){var o=(0,d.g)(n.path,"wp_theme_preview");void 0===o?n.path=(0,s.a)(n.path,{wp_theme_preview:e}):""===o&&(n.path=(0,d.r)(n.path,"wp_theme_preview"))}return t(n)}},q.fetchAllMiddleware=null,q.use(q.createRootURLMiddleware((null===(I=null===(A=null===window||void 0===window?void 0:window.parent)||void 0===A?void 0:A.scData)||void 0===I?void 0:I.root_url)||(null===(E=null===window||void 0===window?void 0:window.scData)||void 0===E?void 0:E.root_url))),(null===(S=null===window||void 0===window?void 0:window.scData)||void 0===S?void 0:S.nonce)&&(q.nonceMiddleware=q.createNonceMiddleware(null===(T=null===window||void 0===window?void 0:window.scData)||void 0===T?void 0:T.nonce),q.use(q.nonceMiddleware)),(null===(C=null===window||void 0===window?void 0:window.scData)||void 0===C?void 0:C.nonce_endpoint)&&(q.nonceEndpoint=null===(D=null===window||void 0===window?void 0:window.scData)||void 0===D?void 0:D.nonce_endpoint),q.use((function(e,n){return e.path=(0,s.a)(e.path,{t:Date.now()}),n(e)})),q.use((function(e,n){var t=n(e);return t.catch((function(e){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=[{code:"checkout.finalize_error",message:e.message}],e.message=wp.i18n.__("We were not able to process this order","surecart")),Promise.reject(e)})),t}));var J=function(e){var n={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 n;return e.json().catch((function(){throw n}))},W=function(){var e=(0,r.A)(u().mark((function e(n){var t;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,J(n);case 2:if("rest_cookie_invalid_nonce"===(t=e.sent).code){e.next=5;break}throw t;case 5:return e.abrupt("return",window.fetch(q.nonceEndpoint).then((function(e){if(e.status>=200&&e.status<300)return e;throw e})).then((function(e){return e.text()})).then((function(e){q.nonceMiddleware.nonce=e})));case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}()},3506:function(e,n,t){t.d(n,{g:function(){return o},r:function(){return i}});var r=t(4805);function o(e,n){return(0,r.g)(e)[n]}function i(e){var n=e.indexOf("?");if(-1===n)return e;for(var t=(0,r.g)(e),o=e.substr(0,n),i=arguments.length,a=new Array(i>1?i-1:0),c=1;c<i;c++)a[c-1]=arguments[c];a.forEach((function(e){return delete t[e]}));var u=(0,r.b)(t);return u?o+"?"+u:o}},6453:function(e,n,t){t.r(n),t.d(n,{sc_custom_order_price_input:function(){return l}});var r=t(467),o=t(3029),i=t(2901),a=t(9280),c=t.n(a),u=t(1346),s=t(3),d=t(581),l=function(){return(0,i.A)((function e(n){(0,o.A)(this,e),(0,u.r)(this,n),this.scUpdateLineItem=(0,u.c)(this,"scUpdateLineItem",7),this.priceId=void 0,this.price=void 0,this.loading=!1,this.busy=!1,this.label=void 0,this.placeholder=void 0,this.required=void 0,this.help=void 0,this.showCode=void 0,this.lineItems=[],this.fetching=!1,this.lineItem=void 0}),[{key:"handleBlur",value:function(e){var n,t=parseInt(e.target.value);isNaN(t)||(null===(n=this.lineItem)||void 0===n?void 0:n.ad_hoc_amount)!==t&&this.scUpdateLineItem.emit({price_id:this.priceId,quantity:1,ad_hoc_amount:t})}},{key:"handleLineItemsChange",value:function(){var e,n=this;(null===(e=this.lineItems)||void 0===e?void 0:e.length)&&(this.lineItem=(this.lineItems||[]).find((function(e){return e.price.id===n.priceId})))}},{key:"componentDidLoad",value:function(){this.price||this.fetchPrice()}},{key:"fetchPrice",value:(e=(0,r.A)(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.priceId){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.fetching=!0,e.next=6,(0,s.a)({path:"surecart/v1/prices/".concat(this.priceId)});case 6:this.price=e.sent,e.next=11;break;case 9:e.prev=9,e.t0=e.catch(2);case 11:return e.prev=11,this.fetching=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,this,[[2,9,11,14]])}))),function(){return e.apply(this,arguments)})},{key:"renderEmpty",value:function(){var e;return(null===(e=null===window||void 0===window?void 0:window.wp)||void 0===e?void 0:e.blocks)?(0,u.h)("sc-alert",{type:"danger",open:!0,style:{margin:"0px"}},wp.i18n.__("This price has been archived.","surecart")):(0,u.h)(u.H,{style:{display:"none"}})}},{key:"render",value:function(){var e,n,t,r,o,i;return this.loading||this.fetching?(0,u.h)("div",null,(0,u.h)("sc-skeleton",{style:{width:"20%",marginBottom:"0.75em"}}),(0,u.h)("sc-skeleton",{style:{width:"100%"}})):!(null===(e=null==this?void 0:this.price)||void 0===e?void 0:e.id)||(null===(n=this.price)||void 0===n?void 0:n.archived)?this.renderEmpty():(0,u.h)("div",{class:"sc-custom-order-price-input"},(0,u.h)("sc-price-input",{"currency-code":(null===(t=this.price)||void 0===t?void 0:t.currency)||"usd",label:this.label,min:null===(r=null==this?void 0:this.price)||void 0===r?void 0:r.ad_hoc_min_amount,max:null===(o=null==this?void 0:this.price)||void 0===o?void 0:o.ad_hoc_max_amount,placeholder:this.placeholder,required:this.required,value:null===(i=this.lineItem)||void 0===i?void 0:i.ad_hoc_amount.toString(),"show-code":this.showCode,help:this.help}),this.busy&&(0,u.h)("sc-block-ui",{style:{zIndex:"9"}}))}}],[{key:"watchers",get:function(){return{lineItems:["handleLineItemsChange"]}}}]);var e}();(0,d.o)(l,["busy","lineItems"],!1),l.style="sc-custom-order-price-input{display:block}"},45:function(e,n,t){t.d(n,{A:function(){return o}});var r=t(8587);function o(e,n){if(null==e)return{};var t,o,i=(0,r.A)(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)t=a[o],n.indexOf(t)>=0||{}.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}},8587:function(e,n,t){function r(e,n){if(null==e)return{};var t={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)>=0)continue;t[r]=e[r]}return t}t.d(n,{A:function(){return r}})}}]);