@constructor-io/constructorio-ui-quizzes 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -40,7 +40,7 @@ Error generating stack: `+o.message+`
|
|
|
40
40
|
`,"data-question-key":n.key},i?lo(n.images,"cio-question-image-container"):"",I.createElement("div",{className:"cio-question-content"},I.createElement(Fl,{title:n.title}),I.createElement(jl,{description:n.description}),t&&I.createElement("input",{...t()})))}return null}function xh(){var r;const{state:e}=D.useContext(Re);let t;e!=null&&e.quiz.currentQuestion&&(t=e==null?void 0:e.quiz.currentQuestion.next_question);const n=(r=t==null?void 0:t.images)==null?void 0:r.primary_url;return t?I.createElement("div",{className:`
|
|
41
41
|
cio-container${n?"--with-image":""}
|
|
42
42
|
cio-cover-question-container${n?"--with-image":""}
|
|
43
|
-
`,"data-question-key":t.key},n?lo(t.images,"cio-question-image-container"):"",I.createElement("div",{className:"cio-question-content"},I.createElement(Fl,{title:t==null?void 0:t.title}),I.createElement(jl,{description:t.description}))):null}function Rh(){var o;const{state:e,getSelectInputProps:t}=D.useContext(Re);let n,r=!1,i;return e!=null&&e.quiz.currentQuestion&&(n=e.quiz.currentQuestion.next_question,r=n==null?void 0:n.options.some(s=>s.images),i=(n==null?void 0:n.type)===b.MultipleSelect&&"Select one or more options"),n?I.createElement("div",{className:"cio-select-question-container","data-question-key":n.key},I.createElement("div",{className:"cio-select-question-text"},I.createElement(Fl,{title:n.title}),n!=null&&n.description?I.createElement(jl,{description:n.description}):""),i&&I.createElement("div",{className:"cio-select-question-instructions"},i),I.createElement("div",{className:`${r?"cio-question-options-container":"cio-question-options-container-text-only"}`},(o=n==null?void 0:n.options)==null?void 0:o.map(s=>t&&I.createElement("div",{...t(s)},s.images?lo(s.images,"cio-question-option-image"):"",I.createElement("div",{className:"cio-question-option-value"},s==null?void 0:s.value))))):null}function zh(){var r;const{state:e}=D.useContext(Re),t=(r=e==null?void 0:e.quiz.currentQuestion)==null?void 0:r.next_question,n=Df(t==null?void 0:t.type);return t?I.createElement(I.Fragment,null,n.isOpenQuestion&&I.createElement(Ch,{key:t==null?void 0:t.id}),n.isCoverQuestion&&I.createElement(xh,{key:t==null?void 0:t.id}),n.isSelectQuestion&&I.createElement(Rh,{key:t==null?void 0:t.id})):null}function Nh(){return I.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},I.createElement("g",{clipPath:"url(#clip0_7495_177230)"},I.createElement("path",{d:"M0.667969 2.66699V6.66699H4.66797",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),I.createElement("path",{d:"M15.332 13.333V9.33301H11.332",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),I.createElement("path",{d:"M13.6613 6.00038C13.3232 5.0449 12.7485 4.19064 11.991 3.51732C11.2334 2.844 10.3177 2.37355 9.32911 2.14988C8.34056 1.92621 7.31147 1.9566 6.33784 2.23823C5.36422 2.51985 4.4778 3.04352 3.7613 3.76038L0.667969 6.66704M15.3346 9.33371L12.2413 12.2404C11.5248 12.9572 10.6384 13.4809 9.66476 13.7625C8.69114 14.0441 7.66204 14.0745 6.67349 13.8509C5.68495 13.6272 4.76917 13.1568 4.01161 12.4834C3.25406 11.8101 2.67941 10.9559 2.3413 10.0004",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"})),I.createElement("defs",null,I.createElement("clipPath",{id:"clip0_7495_177230"},I.createElement("rect",{width:"16",height:"16",fill:"white"}))))}function Th(e){const{redoText:t="Retake Quiz",disabled:n,...r}=e,{getResetQuizButtonProps:i}=D.useContext(Re);return i?I.createElement("button",{...r,...i("secondary")},I.createElement(Nh,null),I.createElement("span",null,t)):null}function qh({hasNoResults:e}){var n;const{state:t}=D.useContext(Re);return I.createElement("div",{className:"cio-results-filter-container"},I.createElement("p",null,e?"Your preferences":"Because you answered"),I.createElement("div",{className:"cio-results-filter-options"},(n=t==null?void 0:t.quiz.selectedOptionsWithAttributes)==null?void 0:n.map(r=>I.createElement("div",{className:"cio-results-filter-option",key:r},r))))}function Pi(e){const{propsGetters:t,ctaText:n="Continue",disabled:r,className:i="cio-button-container",...o}=e;return I.createElement("div",{className:`${i||""}`},t&&I.createElement("button",{...o,...t()},n||"Continue"))}function Ph(){const{getResetQuizButtonProps:e}=D.useContext(Re);return I.createElement("div",{className:"cio-zero-results"},I.createElement("h3",{className:"cio-zero-results-subtitle"},"Sorry, we couldn’t find products that perfectly match your preferences."),I.createElement(Pi,{ctaText:"Retake Quiz",propsGetters:e}))}function Ih(e){const{item:t,price:n}=e,{getAddToCartButtonProps:r}=D.useContext(Re);return r?I.createElement("button",{...r(t,n)},"Add to Cart"):null}function Oh(e){const{item:t,price:n}=e,{getAddToFavoritesButtonProps:r}=D.useContext(Re);return r?I.createElement("button",{...r(t,n)},I.createElement("svg",{width:"21",height:"21",viewBox:"0 0 24 24",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},I.createElement("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"}))):null}function Ah(e){var p,g,m,S;const{result:t,salePriceKey:n,regularPriceKey:r,resultPosition:i,ratingCountKey:o,ratingScoreKey:s,renderResultCardPriceDetails:l}=e,{customAddToFavoritesCallback:u,customClickItemCallback:c,getQuizResultButtonProps:v,getQuizResultLinkProps:_}=D.useContext(Re),E=n&&((p=t==null?void 0:t.data)==null?void 0:p[n]),x=r&&((g=t==null?void 0:t.data)==null?void 0:g[r]),k=o&&((m=t==null?void 0:t.data)==null?void 0:m[o]),a=s&&((S=t==null?void 0:t.data)==null?void 0:S[s]),h=()=>{var w;return I.createElement(I.Fragment,null,I.createElement("div",{className:"cio-result-card-image"},I.createElement("img",{src:(w=t.data)==null?void 0:w.image_url,alt:"product"})),I.createElement("div",{className:"cio-result-card-text"},I.createElement("p",{className:"cio-result-card-title"},t.value),I.createElement("div",{className:"cio-result-card-details"},I.createElement("div",{className:"cio-result-card-rating"},a&&I.createElement("span",{className:"cio-result-card-rating-score"},Array(Number(a)).fill("★"),Array(5-Number(a)).fill("☆")),k&&I.createElement("span",{className:"cio-result-card-rating-count"},"(",k,")")),l?l(t):I.createElement("div",{className:"cio-result-card-prices"},E&&I.createElement("span",{className:"cio-result-card-sale-price"},"$",E),x&&I.createElement("span",{className:`cio-result-card-regular-price${E?"--strike-through":""}`},"$",x)))))},d=()=>v&&I.createElement("div",{...v({result:t,position:i,type:"button"})},h()),f=()=>_&&I.createElement("a",{className:"cio-result-card-anchor",rel:"noreferrer",target:"_blank",..._({result:t,position:i,type:"link"})},h());return I.createElement("div",{className:"cio-result-card"},u&&I.createElement(Oh,{item:t,price:E||x}),c?d():f(),I.createElement(Ih,{item:t,price:E||x}))}function Lh(e){var l,u,c,v;const{resultCardSalePriceKey:t,resultCardRegularPriceKey:n,resultCardRatingCountKey:r,resultCardRatingScoreKey:i,renderResultCardPriceDetails:o}=e,{state:s}=D.useContext(Re);return I.createElement("div",{className:"cio-results"},(v=(c=(u=(l=s==null?void 0:s.quiz)==null?void 0:l.results)==null?void 0:u.response)==null?void 0:c.results)==null?void 0:v.map((_,E)=>{var x;return I.createElement(Ah,{result:_,key:(x=_.data)==null?void 0:x.id,salePriceKey:t,regularPriceKey:n,ratingCountKey:r,ratingScoreKey:i,renderResultCardPriceDetails:o,resultPosition:E+1})}))}function Hf(){return I.createElement("div",{className:"cio-spinner"},I.createElement("div",null),I.createElement("div",null),I.createElement("div",null),I.createElement("div",null))}function Bh(e){var _,E,x;const{options:t}=e,{resultCardSalePriceKey:n,resultCardRegularPriceKey:r,resultCardRatingCountKey:i,resultCardRatingScoreKey:o,renderResultCardPriceDetails:s}=t,{state:l}=D.useContext(Re),u=(x=(E=(_=l==null?void 0:l.quiz.results)==null?void 0:_.response)==null?void 0:E.results)==null?void 0:x.length,c=!u,v=c?"":"Here are your results";return l!=null&&l.quiz.results?I.createElement("div",{className:"cio-results-container"},I.createElement("h1",{className:"cio-results-title"},v),I.createElement("div",{className:"cio-results-filter-and-redo-container"},I.createElement(qh,{hasNoResults:c}),I.createElement(Th,null)),!c&&I.createElement(I.Fragment,null,I.createElement("div",{className:"cio-results-num-results"},u," ",u===1?"result":"results"),I.createElement(Lh,{resultCardSalePriceKey:n,resultCardRegularPriceKey:r,resultCardRatingCountKey:i,resultCardRatingScoreKey:o,renderResultCardPriceDetails:s})),c&&I.createElement(Ph,null)):I.createElement("div",{className:"cio-results-container"},I.createElement(Hf,null))}function Uh(){const{getPreviousQuestionButtonProps:e}=D.useContext(Re);return e?e&&I.createElement("button",{...e()},I.createElement("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},I.createElement("path",{d:"M6.06313 1.06268L0.964522 5.43176C0.882383 5.50218 0.816449 5.58954 0.771245 5.68785C0.726041 5.78615 0.702637 5.89306 0.702637 6.00126C0.702637 6.10946 0.726041 6.21637 0.771245 6.31467C0.816449 6.41297 0.882383 6.50033 0.964522 6.57076L6.06313 10.9398C6.5498 11.3568 7.30153 11.0111 7.30153 10.3703V1.63093C7.30153 0.990168 6.5498 0.644468 6.06313 1.06268Z",fill:"currentColor"}))):null}function Mh(e){const{propsGetters:t,className:n="cio-button-container",...r}=e;return I.createElement("div",{className:`${n||""}`},t&&I.createElement("button",{...r,...t()},"Skip",I.createElement("span",null," question")))}function Fh(e){const{ctaButtonText:t}=e,{getNextQuestionButtonProps:n,getSkipQuestionButtonProps:r}=D.useContext(Re);return I.createElement("div",{className:"cio-question-buttons-container"},I.createElement(Uh,null),I.createElement("div",{className:"cio-question-buttons-group"},I.createElement(Mh,{propsGetters:r}),I.createElement(Pi,{ctaText:t,propsGetters:n})))}const jh="constructorIOQuizState";var Pt=(e=>(e.Stale="STALE",e.Loading="LOADING",e.Success="SUCCESS",e.Error="ERROR",e))(Pt||{}),He={},Dh={get exports(){return He},set exports(e){He=e}};(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(Dh);var Ii={},Hh={get exports(){return Ii},set exports(e){Ii=e}},ra;function ft(){return ra||(ra=1,function(e){function t(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Hh)),Ii}var Oi={},Vh={get exports(){return Oi},set exports(e){Oi=e}},Ai={},Qh={get exports(){return Ai},set exports(e){Ai=e}},Li={},bh={get exports(){return Li},set exports(e){Li=e}},ia;function qr(){return ia||(ia=1,function(e){function t(n){return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(bh)),Li}var Bi={},Wh={get exports(){return Bi},set exports(e){Bi=e}},oa;function Kh(){return oa||(oa=1,function(e){var t=qr().default;function n(r,i){if(t(r)!=="object"||r===null)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var s=o.call(r,i||"default");if(t(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Wh)),Bi}var sa;function Vf(){return sa||(sa=1,function(e){var t=qr().default,n=Kh();function r(i){var o=n(i,"string");return t(o)==="symbol"?o:String(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Qh)),Ai}var la;function dt(){return la||(la=1,function(e){var t=Vf();function n(i,o){for(var s=0;s<o.length;s++){var l=o[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(i,t(l.key),l)}}function r(i,o,s){return o&&n(i.prototype,o),s&&n(i,s),Object.defineProperty(i,"prototype",{writable:!1}),i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Vh)),Oi}function Gh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ui={},Yh={get exports(){return Ui},set exports(e){Ui=e}},ua;function Xh(){return ua||(ua=1,function(e){(function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n==null)throw new TypeError("Cannot convert first argument to object");for(var r=Object(n),i=1;i<arguments.length;i++){var o=arguments[i];if(o!=null){o=Object(o);for(var s=Object.keys(Object(o)),l=0,u=s.length;u>l;l++){var c=s[l],v=Object.getOwnPropertyDescriptor(o,c);v!==void 0&&v.enumerable&&(r[c]=o[c])}}}return r}});var t=function(n){var r={user_agent:null,persist:!0,cookie_name_client_id:"ConstructorioID_client_id",cookie_name_session_id:"ConstructorioID_session_id",cookie_name_session_data:"ConstructorioID_session",cookie_domain:null,cookie_days_to_live:365,local_name_client_id:"_constructorio_search_client_id",local_name_session_id:"_constructorio_search_session_id",local_name_session_data:"_constructorio_search_session",on_node:typeof window>"u",session_is_new:null,client_id_storage_location:"cookie",session_id_storage_location:"local"};if(Object.assign(this,r,n),!this.client_id)if(!this.on_node&&this.persist){var i;this.client_id_storage_location==="cookie"&&(i=this.get_cookie(this.cookie_name_client_id)),this.client_id_storage_location==="local"&&(i=this.get_local_object(this.local_name_client_id)),this.client_id=i||this.generate_client_id()}else this.client_id=this.generate_client_id();this.session_id||(!this.on_node&&this.persist?this.session_id=this.generate_session_id():this.session_id=1),this.on_node||(this.user_agent=this.user_agent||window&&window.navigator&&window.navigator.userAgent)};t.prototype.set_cookie=function(n,r){if(!this.on_node&&this.persist){var i=new Date(Date.now()+this.cookie_days_to_live*24*60*60*1e3),o=n+"="+r+"; expires="+i.toUTCString()+"; path=/";return this.cookie_domain&&(o+="; domain="+this.cookie_domain),document.cookie=o,o}return null},t.prototype.get_cookie=function(n){for(var r=n+"=",i=document.cookie.split(";"),o=0;o<i.length;o++){var s=i[o];try{for(var l=decodeURIComponent(s);l.charAt(0)===" ";)l=l.substring(1);if(l.indexOf(r)===0)return l.substring(r.length,l.length)}catch{}}},t.prototype.delete_cookie=function(n){document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"},t.prototype.generate_client_id=function(){var n;if(!this.on_node){var r=this.get_cookie(this.cookie_name_client_id),i=this.get_local_object(this.local_name_client_id);this.client_id_storage_location==="cookie"&&i&&(n=i,this.set_cookie(this.cookie_name_client_id,n),this.delete_local_object(this.local_name_client_id)),this.client_id_storage_location==="local"&&r&&(n=r,this.set_local_object(this.local_name_client_id,n),this.delete_cookie(this.cookie_name_client_id))}return n||(n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(o){var s=Math.random()*16|0,l=o==="x"?s:s&3|8;return l.toString(16)}),this.client_id_storage_location==="cookie"&&this.set_cookie(this.cookie_name_client_id,n),this.client_id_storage_location==="local"&&this.set_local_object(this.local_name_client_id,n)),n},t.prototype.get_local_object=function(n){var r,i=window&&window.localStorage;if(i&&typeof n=="string")try{r=JSON.parse(i.getItem(n))}catch{r=i.getItem(n)}return r},t.prototype.set_local_object=function(n,r){var i=window&&window.localStorage;if(i&&typeof n=="string"){if(typeof r=="object")try{i.setItem(n,JSON.stringify(r))}catch{}if(typeof r=="string"||typeof r=="number")try{i.setItem(n,r)}catch{}}},t.prototype.delete_local_object=function(n){var r=window&&window.localStorage;if(r&&typeof n=="string")try{r.removeItem(n)}catch{}},t.prototype.generate_session_id=function(){var n=this.get_cookie(this.cookie_name_session_data),r=this.get_local_object(this.local_name_session_data),i=Date.now(),o=1e3*60*30,s;if(this.session_id_storage_location==="local"&&(s=this.get_local_object(this.local_name_session_data),!s&&n&&(s=n,this.delete_cookie(this.cookie_name_session_data))),this.session_id_storage_location==="cookie"){s=this.get_cookie(this.cookie_name_session_data);try{s=JSON.parse(s)}catch{}!s&&r&&(s=r,this.delete_local_object(this.local_name_session_data))}var l=1,u=1;return s&&typeof s=="object"&&(u=parseInt(s.sessionId,10)||1,s.lastTime>i-o?l=u:l=u+1),this.session_id=l,this.session_is_new=!(s&&u===l),this.session_id_storage_location==="local"&&(this.set_local_object(this.local_name_session_id,l),this.set_local_object(this.local_name_session_data,{sessionId:l,lastTime:i})),this.session_id_storage_location==="cookie"&&(this.set_cookie(this.cookie_name_session_id,l),this.set_cookie(this.cookie_name_session_data,JSON.stringify({sessionId:l,lastTime:i}))),l},typeof Gh<"u"&&(e.exports=t)})()}(Yh)),Ui}var sr={},Jh={get exports(){return sr},set exports(e){sr=e}},aa;function Zh(){return aa||(aa=1,function(e,t){(function(n){function r(i){var o=i&&i.Promise||n.Promise,s=i&&i.XMLHttpRequest||n.XMLHttpRequest;return function(){var l=Object.create(n,{fetch:{value:void 0,writable:!0}});return function(u,c){c(t)}(this,function(u){var c=typeof l<"u"&&l||typeof self<"u"&&self||typeof c<"u"&&c,v={searchParams:"URLSearchParams"in c,iterable:"Symbol"in c&&"iterator"in Symbol,blob:"FileReader"in c&&"Blob"in c&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in c,arrayBuffer:"ArrayBuffer"in c};function _(R){return R&&DataView.prototype.isPrototypeOf(R)}if(v.arrayBuffer)var E=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],x=ArrayBuffer.isView||function(R){return R&&E.indexOf(Object.prototype.toString.call(R))>-1};function k(R){if(typeof R!="string"&&(R=String(R)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(R)||R==="")throw new TypeError("Invalid character in header field name");return R.toLowerCase()}function a(R){return typeof R!="string"&&(R=String(R)),R}function h(R){var z={next:function(){var P=R.shift();return{done:P===void 0,value:P}}};return v.iterable&&(z[Symbol.iterator]=function(){return z}),z}function d(R){this.map={},R instanceof d?R.forEach(function(z,P){this.append(P,z)},this):Array.isArray(R)?R.forEach(function(z){this.append(z[0],z[1])},this):R&&Object.getOwnPropertyNames(R).forEach(function(z){this.append(z,R[z])},this)}d.prototype.append=function(R,z){R=k(R),z=a(z);var P=this.map[R];this.map[R]=P?P+", "+z:z},d.prototype.delete=function(R){delete this.map[k(R)]},d.prototype.get=function(R){return R=k(R),this.has(R)?this.map[R]:null},d.prototype.has=function(R){return this.map.hasOwnProperty(k(R))},d.prototype.set=function(R,z){this.map[k(R)]=a(z)},d.prototype.forEach=function(R,z){for(var P in this.map)this.map.hasOwnProperty(P)&&R.call(z,this.map[P],P,this)},d.prototype.keys=function(){var R=[];return this.forEach(function(z,P){R.push(P)}),h(R)},d.prototype.values=function(){var R=[];return this.forEach(function(z){R.push(z)}),h(R)},d.prototype.entries=function(){var R=[];return this.forEach(function(z,P){R.push([P,z])}),h(R)},v.iterable&&(d.prototype[Symbol.iterator]=d.prototype.entries);function f(R){if(R.bodyUsed)return o.reject(new TypeError("Already read"));R.bodyUsed=!0}function p(R){return new o(function(z,P){R.onload=function(){z(R.result)},R.onerror=function(){P(R.error)}})}function g(R){var z=new FileReader,P=p(z);return z.readAsArrayBuffer(R),P}function m(R){var z=new FileReader,P=p(z);return z.readAsText(R),P}function S(R){for(var z=new Uint8Array(R),P=new Array(z.length),A=0;A<z.length;A++)P[A]=String.fromCharCode(z[A]);return P.join("")}function w(R){if(R.slice)return R.slice(0);var z=new Uint8Array(R.byteLength);return z.set(new Uint8Array(R)),z.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(R){this.bodyUsed=this.bodyUsed,this._bodyInit=R,R?typeof R=="string"?this._bodyText=R:v.blob&&Blob.prototype.isPrototypeOf(R)?this._bodyBlob=R:v.formData&&FormData.prototype.isPrototypeOf(R)?this._bodyFormData=R:v.searchParams&&URLSearchParams.prototype.isPrototypeOf(R)?this._bodyText=R.toString():v.arrayBuffer&&v.blob&&_(R)?(this._bodyArrayBuffer=w(R.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):v.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(R)||x(R))?this._bodyArrayBuffer=w(R):this._bodyText=R=Object.prototype.toString.call(R):this._bodyText="",this.headers.get("content-type")||(typeof R=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):v.searchParams&&URLSearchParams.prototype.isPrototypeOf(R)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},v.blob&&(this.blob=function(){var R=f(this);if(R)return R;if(this._bodyBlob)return o.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return o.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var R=f(this);return R||(ArrayBuffer.isView(this._bodyArrayBuffer)?o.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):o.resolve(this._bodyArrayBuffer))}else return this.blob().then(g)}),this.text=function(){var R=f(this);if(R)return R;if(this._bodyBlob)return m(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(S(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return o.resolve(this._bodyText)},v.formData&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function C(R){var z=R.toUpperCase();return N.indexOf(z)>-1?z:R}function q(R,z){if(!(this instanceof q))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');z=z||{};var P=z.body;if(R instanceof q){if(R.bodyUsed)throw new TypeError("Already read");this.url=R.url,this.credentials=R.credentials,z.headers||(this.headers=new d(R.headers)),this.method=R.method,this.mode=R.mode,this.signal=R.signal,!P&&R._bodyInit!=null&&(P=R._bodyInit,R.bodyUsed=!0)}else this.url=String(R);if(this.credentials=z.credentials||this.credentials||"same-origin",(z.headers||!this.headers)&&(this.headers=new d(z.headers)),this.method=C(z.method||this.method||"GET"),this.mode=z.mode||this.mode||null,this.signal=z.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&P)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(P),(this.method==="GET"||this.method==="HEAD")&&(z.cache==="no-store"||z.cache==="no-cache")){var A=/([?&])_=[^&]*/;if(A.test(this.url))this.url=this.url.replace(A,"$1_="+new Date().getTime());else{var F=/\?/;this.url+=(F.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}q.prototype.clone=function(){return new q(this,{body:this._bodyInit})};function T(R){var z=new FormData;return R.trim().split("&").forEach(function(P){if(P){var A=P.split("="),F=A.shift().replace(/\+/g," "),U=A.join("=").replace(/\+/g," ");z.append(decodeURIComponent(F),decodeURIComponent(U))}}),z}function O(R){var z=new d,P=R.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(A){return A.indexOf(`
|
|
43
|
+
`,"data-question-key":t.key},n?lo(t.images,"cio-question-image-container"):"",I.createElement("div",{className:"cio-question-content"},I.createElement(Fl,{title:t==null?void 0:t.title}),I.createElement(jl,{description:t.description}))):null}function Rh(){var o;const{state:e,getSelectInputProps:t}=D.useContext(Re);let n,r=!1,i;return e!=null&&e.quiz.currentQuestion&&(n=e.quiz.currentQuestion.next_question,r=n==null?void 0:n.options.some(s=>s.images),i=(n==null?void 0:n.type)===b.MultipleSelect&&"Select one or more options"),n?I.createElement("div",{className:"cio-select-question-container","data-question-key":n.key},I.createElement("div",{className:"cio-select-question-text"},I.createElement(Fl,{title:n.title}),n!=null&&n.description?I.createElement(jl,{description:n.description}):""),i&&I.createElement("div",{className:"cio-select-question-instructions"},i),I.createElement("div",{className:`${r?"cio-question-options-container":"cio-question-options-container-text-only"}`},(o=n==null?void 0:n.options)==null?void 0:o.map(s=>t&&I.createElement("div",{...t(s)},s.images?lo(s.images,"cio-question-option-image"):"",I.createElement("div",{className:"cio-question-option-value"},s==null?void 0:s.value))))):null}function zh(){var r;const{state:e}=D.useContext(Re),t=(r=e==null?void 0:e.quiz.currentQuestion)==null?void 0:r.next_question,n=Df(t==null?void 0:t.type);return t?I.createElement(I.Fragment,null,n.isOpenQuestion&&I.createElement(Ch,{key:t==null?void 0:t.id}),n.isCoverQuestion&&I.createElement(xh,{key:t==null?void 0:t.id}),n.isSelectQuestion&&I.createElement(Rh,{key:t==null?void 0:t.id})):null}function Nh(){return I.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},I.createElement("g",{clipPath:"url(#clip0_7495_177230)"},I.createElement("path",{d:"M0.667969 2.66699V6.66699H4.66797",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),I.createElement("path",{d:"M15.332 13.333V9.33301H11.332",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),I.createElement("path",{d:"M13.6613 6.00038C13.3232 5.0449 12.7485 4.19064 11.991 3.51732C11.2334 2.844 10.3177 2.37355 9.32911 2.14988C8.34056 1.92621 7.31147 1.9566 6.33784 2.23823C5.36422 2.51985 4.4778 3.04352 3.7613 3.76038L0.667969 6.66704M15.3346 9.33371L12.2413 12.2404C11.5248 12.9572 10.6384 13.4809 9.66476 13.7625C8.69114 14.0441 7.66204 14.0745 6.67349 13.8509C5.68495 13.6272 4.76917 13.1568 4.01161 12.4834C3.25406 11.8101 2.67941 10.9559 2.3413 10.0004",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"})),I.createElement("defs",null,I.createElement("clipPath",{id:"clip0_7495_177230"},I.createElement("rect",{width:"16",height:"16",fill:"white"}))))}function Th(e){const{redoText:t="Retake Quiz",disabled:n,...r}=e,{getResetQuizButtonProps:i}=D.useContext(Re);return i?I.createElement("button",{...r,...i("secondary")},I.createElement(Nh,null),I.createElement("span",null,t)):null}function qh({hasNoResults:e}){var n;const{state:t}=D.useContext(Re);return I.createElement("div",{className:"cio-results-filter-container"},I.createElement("p",null,e?"Your preferences":"Because you answered"),I.createElement("div",{className:"cio-results-filter-options"},(n=t==null?void 0:t.quiz.selectedOptionsWithAttributes)==null?void 0:n.map(r=>I.createElement("div",{className:"cio-results-filter-option",key:r},r))))}function Pi(e){const{propsGetters:t,ctaText:n="Continue",disabled:r,className:i="cio-button-container",...o}=e;return I.createElement("div",{className:`${i||""}`},t&&I.createElement("button",{...o,...t()},n||"Continue"))}function Ph(){const{getResetQuizButtonProps:e}=D.useContext(Re);return I.createElement("div",{className:"cio-zero-results"},I.createElement("h3",{className:"cio-zero-results-subtitle"},"Sorry, we couldn’t find products that perfectly match your preferences."),I.createElement(Pi,{ctaText:"Retake Quiz",propsGetters:e}))}function Ih(e){const{item:t,price:n}=e,{getAddToCartButtonProps:r}=D.useContext(Re);return r?I.createElement("button",{...r(t,n)},"Add to Cart"):null}function Oh(e){const{item:t,price:n}=e,{getAddToFavoritesButtonProps:r}=D.useContext(Re);return r?I.createElement("button",{...r(t,n)},I.createElement("svg",{width:"21",height:"21",viewBox:"0 0 24 24",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},I.createElement("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"}))):null}function Ah(e){var p,g,m,S;const{result:t,salePriceKey:n,regularPriceKey:r,resultPosition:i,ratingCountKey:o,ratingScoreKey:s,renderResultCardPriceDetails:l}=e,{customAddToFavoritesCallback:u,customClickItemCallback:c,getQuizResultButtonProps:v,getQuizResultLinkProps:_}=D.useContext(Re),E=n&&((p=t==null?void 0:t.data)==null?void 0:p[n]),x=r&&((g=t==null?void 0:t.data)==null?void 0:g[r]),k=o&&((m=t==null?void 0:t.data)==null?void 0:m[o]),a=s&&((S=t==null?void 0:t.data)==null?void 0:S[s]),h=()=>{var w;return I.createElement(I.Fragment,null,I.createElement("div",{className:"cio-result-card-image"},I.createElement("img",{src:(w=t.data)==null?void 0:w.image_url,alt:"product"})),I.createElement("div",{className:"cio-result-card-text"},I.createElement("p",{className:"cio-result-card-title"},t.value),I.createElement("div",{className:"cio-result-card-details"},I.createElement("div",{className:"cio-result-card-rating"},a&&I.createElement("span",{className:"cio-result-card-rating-score"},Array(Number(a)).fill("★"),Array(5-Number(a)).fill("☆")),k&&I.createElement("span",{className:"cio-result-card-rating-count"},"(",k,")")),l?l(t):I.createElement("div",{className:"cio-result-card-prices"},E&&I.createElement("span",{className:"cio-result-card-sale-price"},"$",E),x&&I.createElement("span",{className:`cio-result-card-regular-price${E?"--strike-through":""}`},"$",x)))))},d=()=>v&&I.createElement("div",{...v({result:t,position:i,type:"button"})},h()),f=()=>_&&I.createElement("a",{className:"cio-result-card-anchor",rel:"noreferrer",target:"_blank",..._({result:t,position:i,type:"link"})},h());return I.createElement("div",{className:"cio-result-card"},u&&I.createElement(Oh,{item:t,price:E||x}),c?d():f(),I.createElement(Ih,{item:t,price:E||x}))}function Lh(e){var l,u,c,v;const{resultCardSalePriceKey:t,resultCardRegularPriceKey:n,resultCardRatingCountKey:r,resultCardRatingScoreKey:i,renderResultCardPriceDetails:o}=e,{state:s}=D.useContext(Re);return I.createElement("div",{className:"cio-results"},(v=(c=(u=(l=s==null?void 0:s.quiz)==null?void 0:l.results)==null?void 0:u.response)==null?void 0:c.results)==null?void 0:v.map((_,E)=>{var x;return I.createElement(Ah,{result:_,key:(x=_.data)==null?void 0:x.id,salePriceKey:t,regularPriceKey:n,ratingCountKey:r,ratingScoreKey:i,renderResultCardPriceDetails:o,resultPosition:E+1})}))}function Hf(){return I.createElement("div",{className:"cio-spinner"},I.createElement("div",null),I.createElement("div",null),I.createElement("div",null),I.createElement("div",null))}function Bh(e){var _,E,x;const{options:t}=e,{resultCardSalePriceKey:n,resultCardRegularPriceKey:r,resultCardRatingCountKey:i,resultCardRatingScoreKey:o,renderResultCardPriceDetails:s}=t,{state:l}=D.useContext(Re),u=(x=(E=(_=l==null?void 0:l.quiz.results)==null?void 0:_.response)==null?void 0:E.results)==null?void 0:x.length,c=!u,v=c?"":"Here are your results";return l!=null&&l.quiz.results?I.createElement("div",{className:"cio-results-container"},I.createElement("h1",{className:"cio-results-title"},v),I.createElement("div",{className:"cio-results-filter-and-redo-container"},I.createElement(qh,{hasNoResults:c}),I.createElement(Th,null)),!c&&I.createElement(I.Fragment,null,I.createElement("div",{className:"cio-results-num-results"},u," ",u===1?"result":"results"),I.createElement(Lh,{resultCardSalePriceKey:n,resultCardRegularPriceKey:r,resultCardRatingCountKey:i,resultCardRatingScoreKey:o,renderResultCardPriceDetails:s})),c&&I.createElement(Ph,null)):I.createElement("div",{className:"cio-results-container"},I.createElement(Hf,null))}function Uh(){const{getPreviousQuestionButtonProps:e}=D.useContext(Re);return e?e&&I.createElement("button",{...e()},I.createElement("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},I.createElement("path",{d:"M6.06313 1.06268L0.964522 5.43176C0.882383 5.50218 0.816449 5.58954 0.771245 5.68785C0.726041 5.78615 0.702637 5.89306 0.702637 6.00126C0.702637 6.10946 0.726041 6.21637 0.771245 6.31467C0.816449 6.41297 0.882383 6.50033 0.964522 6.57076L6.06313 10.9398C6.5498 11.3568 7.30153 11.0111 7.30153 10.3703V1.63093C7.30153 0.990168 6.5498 0.644468 6.06313 1.06268Z",fill:"currentColor"}))):null}function Mh(e){const{propsGetters:t,className:n="cio-button-container",...r}=e;return I.createElement("div",{className:`${n||""}`},t&&I.createElement("button",{...r,...t()},"Skip question"))}function Fh(e){const{ctaButtonText:t}=e,{getNextQuestionButtonProps:n,getSkipQuestionButtonProps:r}=D.useContext(Re);return I.createElement("div",{className:"cio-question-buttons-container"},I.createElement(Uh,null),I.createElement("div",{className:"cio-question-buttons-group"},I.createElement(Mh,{propsGetters:r}),I.createElement(Pi,{ctaText:t,propsGetters:n})))}const jh="constructorIOQuizState";var Pt=(e=>(e.Stale="STALE",e.Loading="LOADING",e.Success="SUCCESS",e.Error="ERROR",e))(Pt||{}),He={},Dh={get exports(){return He},set exports(e){He=e}};(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(Dh);var Ii={},Hh={get exports(){return Ii},set exports(e){Ii=e}},ra;function ft(){return ra||(ra=1,function(e){function t(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Hh)),Ii}var Oi={},Vh={get exports(){return Oi},set exports(e){Oi=e}},Ai={},Qh={get exports(){return Ai},set exports(e){Ai=e}},Li={},bh={get exports(){return Li},set exports(e){Li=e}},ia;function qr(){return ia||(ia=1,function(e){function t(n){return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(bh)),Li}var Bi={},Wh={get exports(){return Bi},set exports(e){Bi=e}},oa;function Kh(){return oa||(oa=1,function(e){var t=qr().default;function n(r,i){if(t(r)!=="object"||r===null)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var s=o.call(r,i||"default");if(t(s)!=="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Wh)),Bi}var sa;function Vf(){return sa||(sa=1,function(e){var t=qr().default,n=Kh();function r(i){var o=n(i,"string");return t(o)==="symbol"?o:String(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Qh)),Ai}var la;function dt(){return la||(la=1,function(e){var t=Vf();function n(i,o){for(var s=0;s<o.length;s++){var l=o[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(i,t(l.key),l)}}function r(i,o,s){return o&&n(i.prototype,o),s&&n(i,s),Object.defineProperty(i,"prototype",{writable:!1}),i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}(Vh)),Oi}function Gh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ui={},Yh={get exports(){return Ui},set exports(e){Ui=e}},ua;function Xh(){return ua||(ua=1,function(e){(function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n==null)throw new TypeError("Cannot convert first argument to object");for(var r=Object(n),i=1;i<arguments.length;i++){var o=arguments[i];if(o!=null){o=Object(o);for(var s=Object.keys(Object(o)),l=0,u=s.length;u>l;l++){var c=s[l],v=Object.getOwnPropertyDescriptor(o,c);v!==void 0&&v.enumerable&&(r[c]=o[c])}}}return r}});var t=function(n){var r={user_agent:null,persist:!0,cookie_name_client_id:"ConstructorioID_client_id",cookie_name_session_id:"ConstructorioID_session_id",cookie_name_session_data:"ConstructorioID_session",cookie_domain:null,cookie_days_to_live:365,local_name_client_id:"_constructorio_search_client_id",local_name_session_id:"_constructorio_search_session_id",local_name_session_data:"_constructorio_search_session",on_node:typeof window>"u",session_is_new:null,client_id_storage_location:"cookie",session_id_storage_location:"local"};if(Object.assign(this,r,n),!this.client_id)if(!this.on_node&&this.persist){var i;this.client_id_storage_location==="cookie"&&(i=this.get_cookie(this.cookie_name_client_id)),this.client_id_storage_location==="local"&&(i=this.get_local_object(this.local_name_client_id)),this.client_id=i||this.generate_client_id()}else this.client_id=this.generate_client_id();this.session_id||(!this.on_node&&this.persist?this.session_id=this.generate_session_id():this.session_id=1),this.on_node||(this.user_agent=this.user_agent||window&&window.navigator&&window.navigator.userAgent)};t.prototype.set_cookie=function(n,r){if(!this.on_node&&this.persist){var i=new Date(Date.now()+this.cookie_days_to_live*24*60*60*1e3),o=n+"="+r+"; expires="+i.toUTCString()+"; path=/";return this.cookie_domain&&(o+="; domain="+this.cookie_domain),document.cookie=o,o}return null},t.prototype.get_cookie=function(n){for(var r=n+"=",i=document.cookie.split(";"),o=0;o<i.length;o++){var s=i[o];try{for(var l=decodeURIComponent(s);l.charAt(0)===" ";)l=l.substring(1);if(l.indexOf(r)===0)return l.substring(r.length,l.length)}catch{}}},t.prototype.delete_cookie=function(n){document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"},t.prototype.generate_client_id=function(){var n;if(!this.on_node){var r=this.get_cookie(this.cookie_name_client_id),i=this.get_local_object(this.local_name_client_id);this.client_id_storage_location==="cookie"&&i&&(n=i,this.set_cookie(this.cookie_name_client_id,n),this.delete_local_object(this.local_name_client_id)),this.client_id_storage_location==="local"&&r&&(n=r,this.set_local_object(this.local_name_client_id,n),this.delete_cookie(this.cookie_name_client_id))}return n||(n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(o){var s=Math.random()*16|0,l=o==="x"?s:s&3|8;return l.toString(16)}),this.client_id_storage_location==="cookie"&&this.set_cookie(this.cookie_name_client_id,n),this.client_id_storage_location==="local"&&this.set_local_object(this.local_name_client_id,n)),n},t.prototype.get_local_object=function(n){var r,i=window&&window.localStorage;if(i&&typeof n=="string")try{r=JSON.parse(i.getItem(n))}catch{r=i.getItem(n)}return r},t.prototype.set_local_object=function(n,r){var i=window&&window.localStorage;if(i&&typeof n=="string"){if(typeof r=="object")try{i.setItem(n,JSON.stringify(r))}catch{}if(typeof r=="string"||typeof r=="number")try{i.setItem(n,r)}catch{}}},t.prototype.delete_local_object=function(n){var r=window&&window.localStorage;if(r&&typeof n=="string")try{r.removeItem(n)}catch{}},t.prototype.generate_session_id=function(){var n=this.get_cookie(this.cookie_name_session_data),r=this.get_local_object(this.local_name_session_data),i=Date.now(),o=1e3*60*30,s;if(this.session_id_storage_location==="local"&&(s=this.get_local_object(this.local_name_session_data),!s&&n&&(s=n,this.delete_cookie(this.cookie_name_session_data))),this.session_id_storage_location==="cookie"){s=this.get_cookie(this.cookie_name_session_data);try{s=JSON.parse(s)}catch{}!s&&r&&(s=r,this.delete_local_object(this.local_name_session_data))}var l=1,u=1;return s&&typeof s=="object"&&(u=parseInt(s.sessionId,10)||1,s.lastTime>i-o?l=u:l=u+1),this.session_id=l,this.session_is_new=!(s&&u===l),this.session_id_storage_location==="local"&&(this.set_local_object(this.local_name_session_id,l),this.set_local_object(this.local_name_session_data,{sessionId:l,lastTime:i})),this.session_id_storage_location==="cookie"&&(this.set_cookie(this.cookie_name_session_id,l),this.set_cookie(this.cookie_name_session_data,JSON.stringify({sessionId:l,lastTime:i}))),l},typeof Gh<"u"&&(e.exports=t)})()}(Yh)),Ui}var sr={},Jh={get exports(){return sr},set exports(e){sr=e}},aa;function Zh(){return aa||(aa=1,function(e,t){(function(n){function r(i){var o=i&&i.Promise||n.Promise,s=i&&i.XMLHttpRequest||n.XMLHttpRequest;return function(){var l=Object.create(n,{fetch:{value:void 0,writable:!0}});return function(u,c){c(t)}(this,function(u){var c=typeof l<"u"&&l||typeof self<"u"&&self||typeof c<"u"&&c,v={searchParams:"URLSearchParams"in c,iterable:"Symbol"in c&&"iterator"in Symbol,blob:"FileReader"in c&&"Blob"in c&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in c,arrayBuffer:"ArrayBuffer"in c};function _(R){return R&&DataView.prototype.isPrototypeOf(R)}if(v.arrayBuffer)var E=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],x=ArrayBuffer.isView||function(R){return R&&E.indexOf(Object.prototype.toString.call(R))>-1};function k(R){if(typeof R!="string"&&(R=String(R)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(R)||R==="")throw new TypeError("Invalid character in header field name");return R.toLowerCase()}function a(R){return typeof R!="string"&&(R=String(R)),R}function h(R){var z={next:function(){var P=R.shift();return{done:P===void 0,value:P}}};return v.iterable&&(z[Symbol.iterator]=function(){return z}),z}function d(R){this.map={},R instanceof d?R.forEach(function(z,P){this.append(P,z)},this):Array.isArray(R)?R.forEach(function(z){this.append(z[0],z[1])},this):R&&Object.getOwnPropertyNames(R).forEach(function(z){this.append(z,R[z])},this)}d.prototype.append=function(R,z){R=k(R),z=a(z);var P=this.map[R];this.map[R]=P?P+", "+z:z},d.prototype.delete=function(R){delete this.map[k(R)]},d.prototype.get=function(R){return R=k(R),this.has(R)?this.map[R]:null},d.prototype.has=function(R){return this.map.hasOwnProperty(k(R))},d.prototype.set=function(R,z){this.map[k(R)]=a(z)},d.prototype.forEach=function(R,z){for(var P in this.map)this.map.hasOwnProperty(P)&&R.call(z,this.map[P],P,this)},d.prototype.keys=function(){var R=[];return this.forEach(function(z,P){R.push(P)}),h(R)},d.prototype.values=function(){var R=[];return this.forEach(function(z){R.push(z)}),h(R)},d.prototype.entries=function(){var R=[];return this.forEach(function(z,P){R.push([P,z])}),h(R)},v.iterable&&(d.prototype[Symbol.iterator]=d.prototype.entries);function f(R){if(R.bodyUsed)return o.reject(new TypeError("Already read"));R.bodyUsed=!0}function p(R){return new o(function(z,P){R.onload=function(){z(R.result)},R.onerror=function(){P(R.error)}})}function g(R){var z=new FileReader,P=p(z);return z.readAsArrayBuffer(R),P}function m(R){var z=new FileReader,P=p(z);return z.readAsText(R),P}function S(R){for(var z=new Uint8Array(R),P=new Array(z.length),A=0;A<z.length;A++)P[A]=String.fromCharCode(z[A]);return P.join("")}function w(R){if(R.slice)return R.slice(0);var z=new Uint8Array(R.byteLength);return z.set(new Uint8Array(R)),z.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(R){this.bodyUsed=this.bodyUsed,this._bodyInit=R,R?typeof R=="string"?this._bodyText=R:v.blob&&Blob.prototype.isPrototypeOf(R)?this._bodyBlob=R:v.formData&&FormData.prototype.isPrototypeOf(R)?this._bodyFormData=R:v.searchParams&&URLSearchParams.prototype.isPrototypeOf(R)?this._bodyText=R.toString():v.arrayBuffer&&v.blob&&_(R)?(this._bodyArrayBuffer=w(R.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):v.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(R)||x(R))?this._bodyArrayBuffer=w(R):this._bodyText=R=Object.prototype.toString.call(R):this._bodyText="",this.headers.get("content-type")||(typeof R=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):v.searchParams&&URLSearchParams.prototype.isPrototypeOf(R)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},v.blob&&(this.blob=function(){var R=f(this);if(R)return R;if(this._bodyBlob)return o.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return o.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var R=f(this);return R||(ArrayBuffer.isView(this._bodyArrayBuffer)?o.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):o.resolve(this._bodyArrayBuffer))}else return this.blob().then(g)}),this.text=function(){var R=f(this);if(R)return R;if(this._bodyBlob)return m(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(S(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return o.resolve(this._bodyText)},v.formData&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function C(R){var z=R.toUpperCase();return N.indexOf(z)>-1?z:R}function q(R,z){if(!(this instanceof q))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');z=z||{};var P=z.body;if(R instanceof q){if(R.bodyUsed)throw new TypeError("Already read");this.url=R.url,this.credentials=R.credentials,z.headers||(this.headers=new d(R.headers)),this.method=R.method,this.mode=R.mode,this.signal=R.signal,!P&&R._bodyInit!=null&&(P=R._bodyInit,R.bodyUsed=!0)}else this.url=String(R);if(this.credentials=z.credentials||this.credentials||"same-origin",(z.headers||!this.headers)&&(this.headers=new d(z.headers)),this.method=C(z.method||this.method||"GET"),this.mode=z.mode||this.mode||null,this.signal=z.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&P)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(P),(this.method==="GET"||this.method==="HEAD")&&(z.cache==="no-store"||z.cache==="no-cache")){var A=/([?&])_=[^&]*/;if(A.test(this.url))this.url=this.url.replace(A,"$1_="+new Date().getTime());else{var F=/\?/;this.url+=(F.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}q.prototype.clone=function(){return new q(this,{body:this._bodyInit})};function T(R){var z=new FormData;return R.trim().split("&").forEach(function(P){if(P){var A=P.split("="),F=A.shift().replace(/\+/g," "),U=A.join("=").replace(/\+/g," ");z.append(decodeURIComponent(F),decodeURIComponent(U))}}),z}function O(R){var z=new d,P=R.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(A){return A.indexOf(`
|
|
44
44
|
`)===0?A.substr(1,A.length):A}).forEach(function(A){var F=A.split(":"),U=F.shift().trim();if(U){var Q=F.join(":").trim();z.append(U,Q)}}),z}y.call(q.prototype);function j(R,z){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');z||(z={}),this.type="default",this.status=z.status===void 0?200:z.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in z?z.statusText:"",this.headers=new d(z.headers),this.url=z.url||"",this._initBody(R)}y.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},j.error=function(){var R=new j(null,{status:0,statusText:""});return R.type="error",R};var M=[301,302,303,307,308];j.redirect=function(R,z){if(M.indexOf(z)===-1)throw new RangeError("Invalid status code");return new j(null,{status:z,headers:{location:R}})},u.DOMException=c.DOMException;try{new u.DOMException}catch{u.DOMException=function(z,P){this.message=z,this.name=P;var A=Error(z);this.stack=A.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function B(R,z){return new o(function(P,A){var F=new q(R,z);if(F.signal&&F.signal.aborted)return A(new u.DOMException("Aborted","AbortError"));var U=new s;function Q(){U.abort()}U.onload=function(){var V={status:U.status,statusText:U.statusText,headers:O(U.getAllResponseHeaders()||"")};V.url="responseURL"in U?U.responseURL:V.headers.get("X-Request-URL");var K="response"in U?U.response:U.responseText;setTimeout(function(){P(new j(K,V))},0)},U.onerror=function(){setTimeout(function(){A(new TypeError("Network request failed"))},0)},U.ontimeout=function(){setTimeout(function(){A(new TypeError("Network request failed"))},0)},U.onabort=function(){setTimeout(function(){A(new u.DOMException("Aborted","AbortError"))},0)};function W(V){try{return V===""&&c.location.href?c.location.href:V}catch{return V}}U.open(F.method,W(F.url),!0),F.credentials==="include"?U.withCredentials=!0:F.credentials==="omit"&&(U.withCredentials=!1),"responseType"in U&&(v.blob?U.responseType="blob":v.arrayBuffer&&F.headers.get("Content-Type")&&F.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(U.responseType="arraybuffer")),z&&typeof z.headers=="object"&&!(z.headers instanceof d)?Object.getOwnPropertyNames(z.headers).forEach(function(V){U.setRequestHeader(V,a(z.headers[V]))}):F.headers.forEach(function(V,K){U.setRequestHeader(K,V)}),F.signal&&(F.signal.addEventListener("abort",Q),U.onreadystatechange=function(){U.readyState===4&&F.signal.removeEventListener("abort",Q)}),U.send(typeof F._bodyInit>"u"?null:F._bodyInit)})}B.polyfill=!0,c.fetch||(c.fetch=B,c.Headers=d,c.Request=q,c.Response=j),u.Headers=d,u.Request=q,u.Response=j,u.fetch=B,Object.defineProperty(u,"__esModule",{value:!0})}),{fetch:l.fetch,Headers:l.Headers,Request:l.Request,Response:l.Response,DOMException:l.DOMException}}()}e.exports=r})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:It)}(Jh,sr)),sr}var Lo={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var ca;function $h(){return ca||(ca=1,function(e){(function(t){t(typeof DO_NOT_EXPORT_CRC>"u"?e:{})})(function(t){t.version="1.2.2";function n(){for(var y=0,N=new Array(256),C=0;C!=256;++C)y=C,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,N[C]=y;return typeof Int32Array<"u"?new Int32Array(N):N}var r=n();function i(y){var N=0,C=0,q=0,T=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(q=0;q!=256;++q)T[q]=y[q];for(q=0;q!=256;++q)for(C=y[q],N=256+q;N<4096;N+=256)C=T[N]=C>>>8^y[C&255];var O=[];for(q=1;q!=16;++q)O[q-1]=typeof Int32Array<"u"?T.subarray(q*256,q*256+256):T.slice(q*256,q*256+256);return O}var o=i(r),s=o[0],l=o[1],u=o[2],c=o[3],v=o[4],_=o[5],E=o[6],x=o[7],k=o[8],a=o[9],h=o[10],d=o[11],f=o[12],p=o[13],g=o[14];function m(y,N){for(var C=N^-1,q=0,T=y.length;q<T;)C=C>>>8^r[(C^y.charCodeAt(q++))&255];return~C}function S(y,N){for(var C=N^-1,q=y.length-15,T=0;T<q;)C=g[y[T++]^C&255]^p[y[T++]^C>>8&255]^f[y[T++]^C>>16&255]^d[y[T++]^C>>>24]^h[y[T++]]^a[y[T++]]^k[y[T++]]^x[y[T++]]^E[y[T++]]^_[y[T++]]^v[y[T++]]^c[y[T++]]^u[y[T++]]^l[y[T++]]^s[y[T++]]^r[y[T++]];for(q+=15;T<q;)C=C>>>8^r[(C^y[T++])&255];return~C}function w(y,N){for(var C=N^-1,q=0,T=y.length,O=0,j=0;q<T;)O=y.charCodeAt(q++),O<128?C=C>>>8^r[(C^O)&255]:O<2048?(C=C>>>8^r[(C^(192|O>>6&31))&255],C=C>>>8^r[(C^(128|O&63))&255]):O>=55296&&O<57344?(O=(O&1023)+64,j=y.charCodeAt(q++)&1023,C=C>>>8^r[(C^(240|O>>8&7))&255],C=C>>>8^r[(C^(128|O>>2&63))&255],C=C>>>8^r[(C^(128|j>>6&15|(O&3)<<4))&255],C=C>>>8^r[(C^(128|j&63))&255]):(C=C>>>8^r[(C^(224|O>>12&15))&255],C=C>>>8^r[(C^(128|O>>6&63))&255],C=C>>>8^r[(C^(128|O&63))&255]);return~C}t.table=r,t.bstr=m,t.buf=S,t.str=w})}(Lo)),Lo}var Mi={},ev={get exports(){return Mi},set exports(e){Mi=e}};/*! store2 - v2.14.2 - 2022-07-18
|
|
45
45
|
* Copyright (c) 2022 Nathan Bubna; Licensed (MIT OR GPL-3.0) */var fa;function tv(){return fa||(fa=1,function(e){(function(t,n){var r={version:"2.14.2",areas:{},apis:{},nsdelim:".",inherit:function(o,s){for(var l in o)s.hasOwnProperty(l)||Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(o,l));return s},stringify:function(o,s){return o===void 0||typeof o=="function"?o+"":JSON.stringify(o,s||r.replace)},parse:function(o,s){try{return JSON.parse(o,s||r.revive)}catch{return o}},fn:function(o,s){r.storeAPI[o]=s;for(var l in r.apis)r.apis[l][o]=s},get:function(o,s){return o.getItem(s)},set:function(o,s,l){o.setItem(s,l)},remove:function(o,s){o.removeItem(s)},key:function(o,s){return o.key(s)},length:function(o){return o.length},clear:function(o){o.clear()},Store:function(o,s,l){var u=r.inherit(r.storeAPI,function(v,_,E){return arguments.length===0?u.getAll():typeof _=="function"?u.transact(v,_,E):_!==void 0?u.set(v,_,E):typeof v=="string"||typeof v=="number"?u.get(v):typeof v=="function"?u.each(v):v?u.setAll(v,_):u.clear()});u._id=o;try{var c="__store2_test";s.setItem(c,"ok"),u._area=s,s.removeItem(c)}catch{u._area=r.storage("fake")}return u._ns=l||"",r.areas[o]||(r.areas[o]=u._area),r.apis[u._ns+u._id]||(r.apis[u._ns+u._id]=u),u},storeAPI:{area:function(o,s){var l=this[o];return(!l||!l.area)&&(l=r.Store(o,s,this._ns),this[o]||(this[o]=l)),l},namespace:function(o,s,l){if(l=l||this._delim||r.nsdelim,!o)return this._ns?this._ns.substring(0,this._ns.length-l.length):"";var u=o,c=this[u];if((!c||!c.namespace)&&(c=r.Store(this._id,this._area,this._ns+u+l),c._delim=l,this[u]||(this[u]=c),!s))for(var v in r.areas)c.area(v,r.areas[v]);return c},isFake:function(o){return o?(this._real=this._area,this._area=r.storage("fake")):o===!1&&(this._area=this._real||this._area),this._area.name==="fake"},toString:function(){return"store"+(this._ns?"."+this.namespace():"")+"["+this._id+"]"},has:function(o){return this._area.has?this._area.has(this._in(o)):this._in(o)in this._area},size:function(){return this.keys().length},each:function(o,s){for(var l=0,u=r.length(this._area);l<u;l++){var c=this._out(r.key(this._area,l));if(c!==void 0&&o.call(this,c,this.get(c),s)===!1)break;u>r.length(this._area)&&(u--,l--)}return s||this},keys:function(o){return this.each(function(s,l,u){u.push(s)},o||[])},get:function(o,s){var l=r.get(this._area,this._in(o)),u;return typeof s=="function"&&(u=s,s=null),l!==null?r.parse(l,u):s??l},getAll:function(o){return this.each(function(s,l,u){u[s]=l},o||{})},transact:function(o,s,l){var u=this.get(o,l),c=s(u);return this.set(o,c===void 0?u:c),this},set:function(o,s,l){var u=this.get(o),c;return u!=null&&l===!1?s:(typeof l=="function"&&(c=l,l=void 0),r.set(this._area,this._in(o),r.stringify(s,c),l)||u)},setAll:function(o,s){var l,u;for(var c in o)u=o[c],this.set(c,u,s)!==u&&(l=!0);return l},add:function(o,s,l){var u=this.get(o);if(u instanceof Array)s=u.concat(s);else if(u!==null){var c=typeof u;if(c===typeof s&&c==="object"){for(var v in s)u[v]=s[v];s=u}else s=u+s}return r.set(this._area,this._in(o),r.stringify(s,l)),s},remove:function(o,s){var l=this.get(o,s);return r.remove(this._area,this._in(o)),l},clear:function(){return this._ns?this.each(function(o){r.remove(this._area,this._in(o))},1):r.clear(this._area),this},clearAll:function(){var o=this._area;for(var s in r.areas)r.areas.hasOwnProperty(s)&&(this._area=r.areas[s],this.clear());return this._area=o,this},_in:function(o){return typeof o!="string"&&(o=r.stringify(o)),this._ns?this._ns+o:o},_out:function(o){return this._ns?o&&o.indexOf(this._ns)===0?o.substring(this._ns.length):void 0:o}},storage:function(o){return r.inherit(r.storageAPI,{items:{},name:o})},storageAPI:{length:0,has:function(o){return this.items.hasOwnProperty(o)},key:function(o){var s=0;for(var l in this.items)if(this.has(l)&&o===s++)return l},setItem:function(o,s){this.has(o)||this.length++,this.items[o]=s},removeItem:function(o){this.has(o)&&(delete this.items[o],this.length--)},getItem:function(o){return this.has(o)?this.items[o]:null},clear:function(){for(var o in this.items)this.removeItem(o)}}},i=r.Store("local",function(){try{return localStorage}catch{}}());i.local=i,i._=r,i.area("session",function(){try{return sessionStorage}catch{}}()),i.area("page",r.storage("page")),typeof n=="function"&&n.amd!==void 0?n("store2",[],function(){return i}):e.exports?e.exports=i:(t.store&&(r.conflict=t.store),t.store=i)})(It,It&&It.define)}(ev)),Mi}var Bo,da;function nv(){return da||(da=1,Bo=function(e,t){var n=t.set,r=t.get,i=t.remove,o=t.key,s=t.length,l=t.clear;t.overflow=function(u,c){var v=u===t.areas.local?"+local+":u===t.areas.session?"+session+":!1;if(v){var _=t.areas[v];return c&&!_?_=e.area(v)._area:c===!1&&(delete t.areas[v],delete e[v]),_}},t.set=function(u,c,v){try{n.apply(this,arguments)}catch(_){if(_.name==="QUOTA_EXCEEDED_ERR"||_.name==="NS_ERROR_DOM_QUOTA_REACHED"||_.toString().indexOf("QUOTA_EXCEEDED_ERR")!==-1||_.toString().indexOf("QuotaExceededError")!==-1)return t.set(t.overflow(u,!0),c,v);throw _}},t.get=function(u,c){var v=t.overflow(u);return v&&r.call(this,v,c)||r.apply(this,arguments)},t.remove=function(u,c){var v=t.overflow(u);v&&i.call(this,v,c),i.apply(this,arguments)},t.key=function(u,c){var v=t.overflow(u);if(v){var _=s.call(this,u);if(c>=_){c=c-_;for(var E=0,x=s.call(this,v);E<x;E++)if(E===c)return o.call(this,v,E)}}return o.apply(this,arguments)},t.length=function(u){var c=s(u),v=t.overflow(u);return v?c+s(v):c},t.clear=function(u){t.overflow(u,!1),l.apply(this,arguments)}}),Bo}var Uo,pa;function Dl(){if(pa)return Uo;pa=1;var e=tv(),t=nv();return t(e,e._),Uo=e,Uo}var Mo,ha;function pt(){if(ha)return Mo;ha=1;var e=He,t=e(qr()),n=$h(),r=Dl(),i="_constructorio_purchase_order_ids",o={trimNonBreakingSpaces:function(l){return l.replace(/\s/g," ").trim()},encodeURIComponentRFC3986:function(l){return encodeURIComponent(l).replace(/[!'()*]/g,function(u){return"%".concat(u.charCodeAt(0).toString(16).toUpperCase())})},cleanParams:function(l){var u={};return Object.keys(l).forEach(function(c){var v=l[c];typeof v=="string"?u[c]=o.trimNonBreakingSpaces(v):u[c]=v}),u},throwHttpErrorFromResponse:function(l,u){return u.json().then(function(c){throw l.message=c.message,l.status=u.status,l.statusText=u.statusText,l.url=u.url,l.headers=u.headers,l})},canUseDOM:function(){return!!(typeof window<"u"&&window.document&&window.document.createElement)},addEventListener:function(l,u,c){o.canUseDOM()&&window.addEventListener(l,u,c)},removeEventListener:function(l,u,c){o.canUseDOM()&&window.removeEventListener(l,u,c)},getNavigator:function(){return o.canUseDOM()?window.navigator:{userAgent:"",webdriver:!1}},isNil:function(l){return l==null},getWindowLocation:function(){return o.canUseDOM()?window.location:{}},dispatchEvent:function(l){o.canUseDOM()&&window.dispatchEvent(l)},createCustomEvent:function(l,u){if(o.canUseDOM())try{return new window.CustomEvent(l,{detail:u})}catch{var c=document.createEvent("CustomEvent");return c.initCustomEvent(l,!1,!1,u),c}return null},hasOrderIdRecord:function(l){var u=n.str(l.toString()),c=r.local.get(i);return typeof c=="string"&&(c=JSON.parse(c)),c&&c.includes(u)?!0:null},addOrderIdRecord:function(l){var u=n.str(l.toString()),c=r.local.get(i);if(typeof c=="string"&&(c=JSON.parse(c)),c){if(c.includes(u))return;c.length>=10&&(c=c.slice(-9)),c.push(u)}else c=[u];r.local.set(i,c)},applyNetworkTimeout:function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,v=l&&l.networkParameters&&l.networkParameters.timeout,_=u&&u.timeout,E=_||v;typeof E=="number"&&c&&setTimeout(function(){return c.abort()},E)},stringify:function(l,u,c){if(!l)return"";var v=[];return Object.keys(l).forEach(function(_){var E=l[_],x=o.encodeURIComponentRFC3986(_),k;if(E!=null){var a=u?"".concat(u,"%5B").concat(x,"%5D"):x;Array.isArray(E)?k=o.stringify(E,a,"array"):(0,t.default)(E)==="object"?k=o.stringify(E,a,"object"):c==="object"?k="".concat(a,"=").concat(o.encodeURIComponentRFC3986(E)):k="".concat(u||x,"=").concat(o.encodeURIComponentRFC3986(E)),v.push(k)}}),v.join("&")},toSnakeCase:function(l){return l.replace(/[A-Z]/g,function(u){return"_".concat(u.toLowerCase())})},toSnakeCaseKeys:function(l){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c={};return Object.keys(l).forEach(function(v){var _=o.toSnakeCase(v);c[_]=u&&(0,t.default)(l[v])==="object"&&!Array.isArray(l[v])?o.toSnakeCaseKeys(l[v],u):l[v]}),c}};return Mo=o,Mo}var Fo,va;function Un(){if(va)return Fo;va=1;var e=He,t=e(ft()),n=e(dt()),r=pt(),i=function(){function o(s){var l=this;(0,t.default)(this,o),this.events=[],this.enabled=!(s&&s.enabled===!1),this.waitForBeacon=!(s&&s.waitForBeacon===!1),this.active=this.enabled,this.waitForBeacon&&(this.active=!1,r.canUseDOM()&&(window.ConstructorioAutocomplete||window.ConstructorioBeacon||window.ConstructorioTracker)&&this.enabled&&(this.active=!0,this.dispatchEvents()),r.addEventListener("cio.beacon.loaded",function(){l.enabled&&(l.active=!0,l.dispatchEvents())}))}return(0,n.default)(o,[{key:"queue",value:function(l,u){this.events.push({name:l,data:u}),this.active&&this.dispatchEvents()}},{key:"dispatchEvents",value:function(){for(;this.events.length;){var l=this.events.shift(),u=l.name,c=l.data,v="cio.client.".concat(u);r.dispatchEvent(r.createCustomEvent(v,c))}}}]),o}();return Fo=i,Fo}var jo,ga;function rv(){if(ga)return jo;ga=1;var e=He,t=e(ft()),n=e(dt()),r=Un(),i=pt();function o(l,u,c){var v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,_=c.apiKey,E=c.version,x=c.serviceUrl,k=c.sessionId,a=c.clientId,h=c.userId,d=c.segments,f=c.testCells,p={c:E};if(p.key=_,p.i=a,p.s=k,!l||typeof l!="string")throw new Error("query is a required parameter of type string");if(f&&Object.keys(f).forEach(function(P){p["ef-".concat(P)]=f[P]}),d&&d.length&&(p.us=d),h&&(p.ui=String(h)),u){var g=u.offset,m=u.page,S=u.resultsPerPage,w=u.filters,y=u.sortBy,N=u.sortOrder,C=u.section,q=u.fmtOptions,T=u.hiddenFields,O=u.hiddenFacets,j=u.variationsMap,M=u.qsParam,B=u.preFilterExpression;i.isNil(g)||(p.offset=g),i.isNil(m)||(p.page=m),i.isNil(S)||(p.num_results_per_page=S),w&&(p.filters=w),y&&(p.sort_by=y),N&&(p.sort_order=N),C&&(p.section=C),q&&(p.fmt_options=q),T&&(p.fmt_options?p.fmt_options.hidden_fields=T:p.fmt_options={hidden_fields:T}),O&&(p.fmt_options?p.fmt_options.hidden_facets=O:p.fmt_options={hidden_facets:O}),j&&(p.variations_map=JSON.stringify(j)),B&&(p.pre_filter_expression=JSON.stringify(B)),M&&(p.qs=JSON.stringify(M))}p._dt=Date.now(),p=i.cleanParams(p);var R=i.stringify(p),z=v?"search/natural_language":"search";return"".concat(x,"/").concat(z,"/").concat(i.encodeURIComponentRFC3986(i.trimNonBreakingSpaces(l)),"?").concat(R)}var s=function(){function l(u){(0,t.default)(this,l),this.options=u||{},this.eventDispatcher=new r(u.eventDispatcher)}return(0,n.default)(l,[{key:"getSearchResults",value:function(c,v){var _=this,E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x,k=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,E,h)}try{x=o(c,v,this.options)}catch(d){return Promise.reject(d)}return k(x,{signal:a}).then(function(d){return d.ok?d.json():i.throwHttpErrorFromResponse(new Error,d)}).then(function(d){if(d.response&&d.response.results)return d.result_id&&d.response.results.forEach(function(f){f.result_id=d.result_id}),_.eventDispatcher.queue("search.getSearchResults.completed",d),d;if(d.response&&d.response.redirect)return _.eventDispatcher.queue("search.getSearchResults.completed",d),d;throw new Error("getSearchResults response data is malformed")})}},{key:"getVoiceSearchResults",value:function(c,v){var _=this,E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x,k=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,E,h)}try{var d=!0;x=o(c,v,this.options,d)}catch(f){return Promise.reject(f)}return k(x,{signal:a}).then(function(f){return f.ok?f.json():i.throwHttpErrorFromResponse(new Error,f)}).then(function(f){if(f.response&&f.response.results)return f.result_id&&f.response.results.forEach(function(p){p.result_id=f.result_id}),_.eventDispatcher.queue("search.getVoiceSearchResults.completed",f),f;if(f.response&&f.response.redirect)return _.eventDispatcher.queue("search.getVoiceSearchResults.completed",f),f;throw new Error("getVoiceSearchResults response data is malformed")})}}]),l}();return jo=s,jo}var Fi={},iv={get exports(){return Fi},set exports(e){Fi=e}},ya;function Qf(){return ya||(ya=1,function(e){var t=Vf();function n(r,i,o){return i=t(i),i in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(iv)),Fi}var Do,ma;function ov(){if(ma)return Do;ma=1;var e=He,t=e(ft()),n=e(dt()),r=e(Qf());function i(k,a){var h=Object.keys(k);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(k);a&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(k,f).enumerable})),h.push.apply(h,d)}return h}function o(k){for(var a=1;a<arguments.length;a++){var h=arguments[a]!=null?arguments[a]:{};a%2?i(Object(h),!0).forEach(function(d){(0,r.default)(k,d,h[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(k,Object.getOwnPropertyDescriptors(h)):i(Object(h)).forEach(function(d){Object.defineProperty(k,d,Object.getOwnPropertyDescriptor(h,d))})}return k}var s=Un(),l=pt();function u(k,a){var h=a.apiKey,d=a.version,f=a.sessionId,p=a.clientId,g=a.userId,m=a.segments,S=a.testCells,w={c:d};if(w.key=h,w.i=p,w.s=f,S&&Object.keys(S).forEach(function(F){w["ef-".concat(F)]=S[F]}),m&&m.length&&(w.us=m),g&&(w.ui=String(g)),k){var y=k.page,N=k.offset,C=k.resultsPerPage,q=k.filters,T=k.sortBy,O=k.sortOrder,j=k.section,M=k.fmtOptions,B=k.hiddenFields,R=k.hiddenFacets,z=k.variationsMap,P=k.qsParam,A=k.preFilterExpression;l.isNil(y)||(w.page=y),l.isNil(N)||(w.offset=N),l.isNil(C)||(w.num_results_per_page=C),q&&(w.filters=q),T&&(w.sort_by=T),O&&(w.sort_order=O),j&&(w.section=j),M&&(w.fmt_options=M),B&&(w.fmt_options?w.fmt_options.hidden_fields=B:w.fmt_options={hidden_fields:B}),R&&(w.fmt_options?w.fmt_options.hidden_facets=R:w.fmt_options={hidden_facets:R}),z&&(w.variations_map=JSON.stringify(z)),A&&(w.pre_filter_expression=JSON.stringify(A)),P&&(w.qs=JSON.stringify(P))}return w._dt=Date.now(),w=l.cleanParams(w),w}function c(k,a,h,d){var f=d.serviceUrl;if(!k||typeof k!="string")throw new Error("filterName is a required parameter of type string");if(!a||typeof a!="string")throw new Error("filterValue is a required parameter of type string");var p=u(h,d),g=l.stringify(p);return"".concat(f,"/browse/").concat(l.encodeURIComponentRFC3986(l.trimNonBreakingSpaces(k)),"/").concat(l.encodeURIComponentRFC3986(l.trimNonBreakingSpaces(a)),"?").concat(g)}function v(k,a,h){var d=h.serviceUrl;if(!k||!Array.isArray(k)||!k.length)throw new Error("ids is a required parameter of type array");var f=o(o({},u(a,h)),{},{ids:k}),p=l.stringify(f);return"".concat(d,"/browse/items?").concat(p)}function _(k,a){var h=a.serviceUrl,d=o({},u(k,a));delete d._dt;var f=l.stringify(d);return"".concat(h,"/browse/facets?").concat(f)}function E(k,a,h){var d=h.serviceUrl;if(!k||typeof k!="string")throw new Error("facetName is a required parameter of type string");var f=o({},u(a,h));f.facet_name=k,delete f._dt;var p=l.stringify(f);return"".concat(d,"/browse/facet_options?").concat(p)}var x=function(){function k(a){(0,t.default)(this,k),this.options=a||{},this.eventDispatcher=new s(a.eventDispatcher)}return(0,n.default)(k,[{key:"getBrowseResults",value:function(h,d,f){var p=this,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},m,S=this.options.fetch,w;if(typeof AbortController=="function"){var y=new AbortController;w=y&&y.signal,l.applyNetworkTimeout(this.options,g,y)}try{m=c(h,d,f,this.options)}catch(N){return Promise.reject(N)}return S(m,{signal:w}).then(function(N){return N.ok?N.json():l.throwHttpErrorFromResponse(new Error,N)}).then(function(N){if(N.response&&N.response.results)return N.result_id&&N.response.results.forEach(function(C){C.result_id=N.result_id}),p.eventDispatcher.queue("browse.getBrowseResults.completed",N),N;throw new Error("getBrowseResults response data is malformed")})}},{key:"getBrowseResultsForItemIds",value:function(h,d){var f=this,p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},g,m=this.options.fetch,S;if(typeof AbortController=="function"){var w=new AbortController;S=w&&w.signal,l.applyNetworkTimeout(this.options,p,w)}try{g=v(h,d,this.options)}catch(y){return Promise.reject(y)}return m(g,{signal:S}).then(function(y){return y.ok?y.json():l.throwHttpErrorFromResponse(new Error,y)}).then(function(y){if(y.response&&y.response.results)return y.result_id&&y.response.results.forEach(function(N){N.result_id=y.result_id}),f.eventDispatcher.queue("browse.getBrowseResultsForItemIds.completed",y),y;throw new Error("getBrowseResultsForItemIds response data is malformed")})}},{key:"getBrowseGroups",value:function(h){var d=this,f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=this.options.fetch,g=this.options.serviceUrl,m=u(h,this.options),S;if(typeof AbortController=="function"){var w=new AbortController;S=w&&w.signal,l.applyNetworkTimeout(this.options,f,w)}delete m._dt;var y=l.stringify(m),N="".concat(g,"/browse/groups?").concat(y);return p(N,{signal:S}).then(function(C){return C.ok?C.json():l.throwHttpErrorFromResponse(new Error,C)}).then(function(C){if(C.response&&C.response.groups)return d.eventDispatcher.queue("browse.getBrowseGroups.completed",C),C;throw new Error("getBrowseGroups response data is malformed")})}},{key:"getBrowseFacets",value:function(h,d){var f=this,p,g=this.options.fetch,m;if(typeof AbortController=="function"){var S=new AbortController;m=S&&S.signal,l.applyNetworkTimeout(this.options,d,S)}try{p=_(h,this.options)}catch(w){return Promise.reject(w)}return g(p,{signal:m}).then(function(w){return w.ok?w.json():l.throwHttpErrorFromResponse(new Error,w)}).then(function(w){if(w.response&&w.response.facets)return f.eventDispatcher.queue("browse.getBrowseFacets.completed",w),w;throw new Error("getBrowseFacets response data is malformed")})}},{key:"getBrowseFacetOptions",value:function(h){var d=this,f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},g,m=this.options.fetch,S;if(typeof AbortController=="function"){var w=new AbortController;S=w&&w.signal,l.applyNetworkTimeout(this.options,p,w)}try{g=E(h,f,this.options)}catch(y){return Promise.reject(y)}return m(g,{signal:S}).then(function(y){return y.ok?y.json():l.throwHttpErrorFromResponse(new Error,y)}).then(function(y){if(y.response&&y.response.facets)return d.eventDispatcher.queue("browse.getBrowseFacetOptions.completed",y),y;throw new Error("getBrowseFacetOptions response data is malformed")})}}]),k}();return Do=x,Do}var Ho,_a;function sv(){if(_a)return Ho;_a=1;var e=He,t=e(ft()),n=e(dt()),r=Un(),i=pt(),o=i.throwHttpErrorFromResponse,s=i.cleanParams,l=i.applyNetworkTimeout,u=i.trimNonBreakingSpaces,c=i.encodeURIComponentRFC3986,v=i.stringify;function _(x,k,a){var h=a.apiKey,d=a.version,f=a.serviceUrl,p=a.sessionId,g=a.clientId,m=a.userId,S=a.segments,w=a.testCells,y={c:d};if(y.key=h,y.i=g,y.s=p,!x||typeof x!="string")throw new Error("query is a required parameter of type string");if(w&&Object.keys(w).forEach(function(B){y["ef-".concat(B)]=w[B]}),S&&S.length&&(y.us=S),m&&(y.ui=String(m)),k){var N=k.numResults,C=k.resultsPerSection,q=k.filters,T=k.hiddenFields,O=k.variationsMap;N&&(y.num_results=N),C&&Object.keys(C).forEach(function(B){y["num_results_".concat(B)]=C[B]}),q&&(y.filters=q),T&&(y.fmt_options?y.fmt_options.hidden_fields=T:y.fmt_options={hidden_fields:T}),O&&(y.variations_map=JSON.stringify(O))}y._dt=Date.now(),y=s(y);var j=v(y),M=x.replace(/^\//,"|");return"".concat(f,"/autocomplete/").concat(c(u(M)),"?").concat(j)}var E=function(){function x(k){(0,t.default)(this,x),this.options=k||{},this.eventDispatcher=new r(k.eventDispatcher)}return(0,n.default)(x,[{key:"getAutocompleteResults",value:function(a,h){var d=this,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},p,g=this.options.fetch,m;if(typeof AbortController=="function"){var S=new AbortController;m=S&&S.signal,l(this.options,f,S)}try{p=_(a,h,this.options)}catch(w){return Promise.reject(w)}return g(p,{signal:m}).then(function(w){return w.ok?w.json():o(new Error,w)}).then(function(w){if(w.sections){if(w.result_id){var y=Object.keys(w.sections);y.forEach(function(N){var C=w.sections[N];C.length&&C.forEach(function(q){q.result_id=w.result_id})})}return d.eventDispatcher.queue("autocomplete.getAutocompleteResults.completed",w),w}throw new Error("getAutocompleteResults response data is malformed")})}}]),x}();return Ho=E,Ho}var Vo,wa;function lv(){if(wa)return Vo;wa=1;var e=He,t=e(ft()),n=e(dt()),r=Un(),i=pt();function o(l,u,c){var v=c.apiKey,_=c.version,E=c.serviceUrl,x=c.sessionId,k=c.userId,a=c.clientId,h=c.segments,d={c:_};if(d.key=v,d.i=a,d.s=x,!l||typeof l!="string")throw new Error("podId is a required parameter of type string");if(h&&h.length&&(d.us=h),k&&(d.ui=String(k)),u){var f=u.numResults,p=u.itemIds,g=u.section,m=u.term,S=u.filters,w=u.variationsMap,y=u.hiddenFields;i.isNil(f)||(d.num_results=f),p&&(d.item_id=p),g&&(d.section=g),m&&(d.term=m),S&&(d.filters=S),y&&(d.fmt_options?d.fmt_options.hidden_fields=y:d.fmt_options={hidden_fields:y}),w&&(d.variations_map=JSON.stringify(w))}d=i.cleanParams(d);var N=i.stringify(d);return"".concat(E,"/recommendations/v1/pods/").concat(i.encodeURIComponentRFC3986(i.trimNonBreakingSpaces(l)),"?").concat(N)}var s=function(){function l(u){(0,t.default)(this,l),this.options=u||{},this.eventDispatcher=new r(u.eventDispatcher)}return(0,n.default)(l,[{key:"getRecommendations",value:function(c,v){var _=this,E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x,k=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,E,h)}try{x=o(c,v,this.options)}catch(d){return Promise.reject(d)}return k(x,{signal:a}).then(function(d){return d.ok?d.json():i.throwHttpErrorFromResponse(new Error,d)}).then(function(d){if(d.response&&d.response.results)return d.result_id&&d.response.results.forEach(function(f){f.result_id=d.result_id}),_.eventDispatcher.queue("recommendations.getRecommendations.completed",d),d;throw new Error("getRecommendations response data is malformed")})}}]),l}();return Vo=s,Vo}var lr={},uv={get exports(){return lr},set exports(e){lr=e}},ka;function av(){if(ka)return lr;ka=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(m,S,w){return Function.prototype.apply.call(m,S,w)},n;e&&typeof e.ownKeys=="function"?n=e.ownKeys:Object.getOwnPropertySymbols?n=function(m){return Object.getOwnPropertyNames(m).concat(Object.getOwnPropertySymbols(m))}:n=function(m){return Object.getOwnPropertyNames(m)};function r(g){console&&console.warn&&console.warn(g)}var i=Number.isNaN||function(m){return m!==m};function o(){o.init.call(this)}uv.exports=o,lr.once=d,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function l(g){if(typeof g!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof g)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(g){if(typeof g!="number"||g<0||i(g))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+g+".");s=g}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(m){if(typeof m!="number"||m<0||i(m))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+m+".");return this._maxListeners=m,this};function u(g){return g._maxListeners===void 0?o.defaultMaxListeners:g._maxListeners}o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(m){for(var S=[],w=1;w<arguments.length;w++)S.push(arguments[w]);var y=m==="error",N=this._events;if(N!==void 0)y=y&&N.error===void 0;else if(!y)return!1;if(y){var C;if(S.length>0&&(C=S[0]),C instanceof Error)throw C;var q=new Error("Unhandled error."+(C?" ("+C.message+")":""));throw q.context=C,q}var T=N[m];if(T===void 0)return!1;if(typeof T=="function")t(T,this,S);else for(var O=T.length,j=k(T,O),w=0;w<O;++w)t(j[w],this,S);return!0};function c(g,m,S,w){var y,N,C;if(l(S),N=g._events,N===void 0?(N=g._events=Object.create(null),g._eventsCount=0):(N.newListener!==void 0&&(g.emit("newListener",m,S.listener?S.listener:S),N=g._events),C=N[m]),C===void 0)C=N[m]=S,++g._eventsCount;else if(typeof C=="function"?C=N[m]=w?[S,C]:[C,S]:w?C.unshift(S):C.push(S),y=u(g),y>0&&C.length>y&&!C.warned){C.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+C.length+" "+String(m)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=g,q.type=m,q.count=C.length,r(q)}return g}o.prototype.addListener=function(m,S){return c(this,m,S,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(m,S){return c(this,m,S,!0)};function v(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(g,m,S){var w={fired:!1,wrapFn:void 0,target:g,type:m,listener:S},y=v.bind(w);return y.listener=S,w.wrapFn=y,y}o.prototype.once=function(m,S){return l(S),this.on(m,_(this,m,S)),this},o.prototype.prependOnceListener=function(m,S){return l(S),this.prependListener(m,_(this,m,S)),this},o.prototype.removeListener=function(m,S){var w,y,N,C,q;if(l(S),y=this._events,y===void 0)return this;if(w=y[m],w===void 0)return this;if(w===S||w.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete y[m],y.removeListener&&this.emit("removeListener",m,w.listener||S));else if(typeof w!="function"){for(N=-1,C=w.length-1;C>=0;C--)if(w[C]===S||w[C].listener===S){q=w[C].listener,N=C;break}if(N<0)return this;N===0?w.shift():a(w,N),w.length===1&&(y[m]=w[0]),y.removeListener!==void 0&&this.emit("removeListener",m,q||S)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(m){var S,w,y;if(w=this._events,w===void 0)return this;if(w.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):w[m]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete w[m]),this;if(arguments.length===0){var N=Object.keys(w),C;for(y=0;y<N.length;++y)C=N[y],C!=="removeListener"&&this.removeAllListeners(C);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=w[m],typeof S=="function")this.removeListener(m,S);else if(S!==void 0)for(y=S.length-1;y>=0;y--)this.removeListener(m,S[y]);return this};function E(g,m,S){var w=g._events;if(w===void 0)return[];var y=w[m];return y===void 0?[]:typeof y=="function"?S?[y.listener||y]:[y]:S?h(y):k(y,y.length)}o.prototype.listeners=function(m){return E(this,m,!0)},o.prototype.rawListeners=function(m){return E(this,m,!1)},o.listenerCount=function(g,m){return typeof g.listenerCount=="function"?g.listenerCount(m):x.call(g,m)},o.prototype.listenerCount=x;function x(g){var m=this._events;if(m!==void 0){var S=m[g];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function k(g,m){for(var S=new Array(m),w=0;w<m;++w)S[w]=g[w];return S}function a(g,m){for(;m+1<g.length;m++)g[m]=g[m+1];g.pop()}function h(g){for(var m=new Array(g.length),S=0;S<m.length;++S)m[S]=g[S].listener||g[S];return m}function d(g,m){return new Promise(function(S,w){function y(C){g.removeListener(m,N),w(C)}function N(){typeof g.removeListener=="function"&&g.removeListener("error",y),S([].slice.call(arguments))}p(g,m,N,{once:!0}),m!=="error"&&f(g,y,{once:!0})})}function f(g,m,S){typeof g.on=="function"&&p(g,"error",m,S)}function p(g,m,S,w){if(typeof g.on=="function")w.once?g.once(m,S):g.on(m,S);else if(typeof g.addEventListener=="function")g.addEventListener(m,function y(N){w.once&&g.removeEventListener(m,y),S(N)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof g)}return lr}var Qo,Sa;function cv(){return Sa||(Sa=1,Qo=["Googlebot/","Googlebot-Mobile","Googlebot-Image","Googlebot-News","Googlebot-Video","AdsBot-Google([^-]|$)","AdsBot-Google-Mobile","Feedfetcher-Google","Mediapartners-Google","Mediapartners \\(Googlebot\\)","APIs-Google","bingbot","Slurp","[wW]get","curl","LinkedInBot","Python-urllib","python-requests","libwww","httpunit","nutch","Go-http-client","phpcrawl","msnbot","jyxobot","FAST-WebCrawler","FAST Enterprise Crawler","BIGLOTRON","Teoma","convera","seekbot","Gigabot","Gigablast","exabot","ia_archiver","GingerCrawler","webmon ","HTTrack","grub\\.org","UsineNouvelleCrawler","antibot","netresearchserver","speedy","fluffy","bibnum\\.bnf","findlink","msrbot","panscient","yacybot","AISearchBot","ips-agent","tagoobot","MJ12bot","woriobot","yanga","buzzbot","mlbot","YandexBot","yandex\\.com/bots","purebot","Linguee Bot","CyberPatrol","voilabot","Baiduspider","citeseerxbot","spbot","twengabot","postrank","turnitinbot","scribdbot","page2rss","sitebot","linkdex","Adidxbot","blekkobot","ezooms","dotbot","Mail\\.RU_Bot","discobot","heritrix","findthatfile","europarchive\\.org","NerdByNature\\.Bot","sistrix crawler","Ahrefs(Bot|SiteAudit)","fuelbot","CrunchBot","centurybot9","IndeedBot","mappydata","woobot","ZoominfoBot","PrivacyAwareBot","Multiviewbot","SWIMGBot","Grobbot","eright","Apercite","semanticbot","Aboundex","domaincrawler","wbsearchbot","summify","CCBot","edisterbot","seznambot","ec2linkfinder","gslfbot","aiHitBot","intelium_bot","facebookexternalhit","Yeti","RetrevoPageAnalyzer","lb-spider","Sogou","lssbot","careerbot","wotbox","wocbot","ichiro","DuckDuckBot","lssrocketcrawler","drupact","webcompanycrawler","acoonbot","openindexspider","gnam gnam spider","web-archive-net\\.com\\.bot","backlinkcrawler","coccoc","integromedb","content crawler spider","toplistbot","it2media-domain-crawler","ip-web-crawler\\.com","siteexplorer\\.info","elisabot","proximic","changedetection","arabot","WeSEE:Search","niki-bot","CrystalSemanticsBot","rogerbot","360Spider","psbot","InterfaxScanBot","CC Metadata Scaper","g00g1e\\.net","GrapeshotCrawler","urlappendbot","brainobot","fr-crawler","binlar","SimpleCrawler","Twitterbot","cXensebot","smtbot","bnf\\.fr_bot","A6-Indexer","ADmantX","Facebot","OrangeBot/","memorybot","AdvBot","MegaIndex","SemanticScholarBot","ltx71","nerdybot","xovibot","BUbiNG","Qwantify","archive\\.org_bot","Applebot","TweetmemeBot","crawler4j","findxbot","S[eE][mM]rushBot","yoozBot","lipperhey","Y!J","Domain Re-Animator Bot","AddThis","Screaming Frog SEO Spider","MetaURI","Scrapy","Livelap[bB]ot","OpenHoseBot","CapsuleChecker","collection@infegy\\.com","IstellaBot","DeuSu/","betaBot","Cliqzbot/","MojeekBot/","netEstate NE Crawler","SafeSearch microdata crawler","Gluten Free Crawler/","Sonic","Sysomos","Trove","deadlinkchecker","Slack-ImgProxy","Embedly","RankActiveLinkBot","iskanie","SafeDNSBot","SkypeUriPreview","Veoozbot","Slackbot","redditbot","datagnionbot","Google-Adwords-Instant","adbeat_bot","WhatsApp","contxbot","pinterest","electricmonk","GarlikCrawler","BingPreview/","vebidoobot","FemtosearchBot","Yahoo Link Preview","MetaJobBot","DomainStatsBot","mindUpBot","Daum/","Jugendschutzprogramm-Crawler","Xenu Link Sleuth","Pcore-HTTP","moatbot","KosmioBot","pingdom","PhantomJS","Gowikibot","PiplBot","Discordbot","TelegramBot","Jetslide","newsharecounts","James BOT","Barkrowler","TinEye","SocialRankIOBot","trendictionbot","Ocarinabot","epicbot","Primalbot","DuckDuckGo-Favicons-Bot","GnowitNewsbot","Leikibot","LinkArchiver","YaK/","PaperLiBot","Digg Deeper","dcrawl","Snacktory","AndersPinkBot","Fyrebot","EveryoneSocialBot","Mediatoolkitbot","Luminator-robots","ExtLinksBot","SurveyBot","NING/","okhttp","Nuzzel","omgili","PocketParser","YisouSpider","um-LN","ToutiaoSpider","MuckRack","Jamie's Spider","AHC/","NetcraftSurveyAgent","Laserlikebot","Apache-HttpClient","AppEngine-Google","Jetty","Upflow","Thinklab","Traackr\\.com","Twurly","Mastodon","http_get","DnyzBot","botify","007ac9 Crawler","BehloolBot","BrandVerity","check_http","BDCbot","ZumBot","EZID","ICC-Crawler","ArchiveBot","^LCC ","filterdb\\.iss\\.net/crawler","BLP_bbot","BomboraBot","Buck/","Companybook-Crawler","Genieo","magpie-crawler","MeltwaterNews","Moreover","newspaper/","ScoutJet","(^| )sentry/","StorygizeBot","UptimeRobot","OutclicksBot","seoscanners","Hatena","Google Web Preview","MauiBot","AlphaBot","SBL-BOT","IAS crawler","adscanner","Netvibes","acapbot","Baidu-YunGuanCe","bitlybot","blogmuraBot","Bot\\.AraTurka\\.com","bot-pge\\.chlooe\\.com","BoxcarBot","BTWebClient","ContextAd Bot","Digincore bot","Disqus","Feedly","Fetch/","Fever","Flamingo_SearchEngine","FlipboardProxy","g2reader-bot","imrbot","K7MLWCBot","Kemvibot","Landau-Media-Spider","linkapediabot","vkShare","Siteimprove\\.com","BLEXBot/","DareBoost","ZuperlistBot/","Miniflux/","Feedspotbot/","Diffbot/","SEOkicks","tracemyfile","Nimbostratus-Bot"]),Qo}var bo,Ea;function fv(){if(Ea)return bo;Ea=1;var e=He,t=e(ft()),n=e(dt()),r=Dl(),i=cv(),o=pt(),s="_constructorio_is_human",l=["scroll","resize","touchmove","mouseover","mousemove","keydown","keypress","keyup","focus"],u=function(){function c(){var v=this;(0,t.default)(this,c),this.isHumanBoolean=this.getIsHumanFromSessionStorage();var _=function E(){v.isHumanBoolean=!0,r.session.set(s,!0),l.forEach(function(x){o.removeEventListener(x,E,!0)})};this.isHumanBoolean||l.forEach(function(E){o.addEventListener(E,_,!0)})}return(0,n.default)(c,[{key:"getIsHumanFromSessionStorage",value:function(){return!!r.session.get(s)||!1}},{key:"isHuman",value:function(){return this.isHumanBoolean||!!r.session.get(s)}},{key:"isBot",value:function(){if(this.getIsHumanFromSessionStorage())return!1;var _=o.getNavigator(),E=_.userAgent,x=_.webdriver,k=new RegExp("(".concat(i.join("|"),")"));return!!E.match(k)||!!x}}]),c}();return bo=u,bo}var Wo,Ca;function dv(){if(Ca)return Wo;Ca=1;var e=He,t=e(ft()),n=e(dt()),r=Dl(),i=fv(),o=pt(),s="_constructorio_requests",l=18e4,u=function(){function c(v,_){var E=this;(0,t.default)(this,c),this.options=v,this.eventemitter=_,this.humanity=new i,this.requestPending=!1,this.pageUnloading=!1,this.sendTrackingEvents=!!(v&&v.sendTrackingEvents===!0),o.addEventListener("beforeunload",function(){E.pageUnloading=!0}),this.sendTrackingEvents&&this.send()}return(0,n.default)(c,[{key:"queue",value:function(_){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GET",x=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},k=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};if(this.sendTrackingEvents&&!this.humanity.isBot()){var a=c.get();a.push({url:_,method:E,body:x,networkParameters:k}),c.set(a)}}},{key:"sendEvents",value:function(){var _=this,E=this.options.fetch,x=c.get();if((!o.canUseDOM()||this.humanity.isHuman())&&!this.requestPending&&!this.pageUnloading&&x.length){var k,a=x.shift(),h=a,d=h.networkParameters,f,p=this;if(c.set(x),d&&typeof AbortController=="function"){var g=new AbortController;f=g.signal,o.applyNetworkTimeout(this.options,d,g)}if(typeof a=="string"&&(a={url:a,method:"GET"}),a.url){var m=a.url.match(/\?.*_dt=([^&]+)/),S=parseInt(m&&m[1],10),w=+new Date;if(S&&Number.isInteger(S)&&w-S>l){this.sendTrackingEvents=!1,c.remove();return}}a.method==="GET"&&(k=E(a.url,{signal:f})),a.method==="POST"&&(k=E(a.url,{method:a.method,body:JSON.stringify(a.body),mode:"cors",headers:{"Content-Type":"text/plain"},signal:f})),k&&(this.requestPending=!0,k.then(function(y){y.ok?(p.eventemitter&&p.eventemitter.emit("success",{url:a.url,method:a.method,message:"ok"}),_.requestPending=!1,_.send()):y.json().then(function(N){p.eventemitter&&p.eventemitter.emit("error",{url:a.url,method:a.method,message:N&&N.message}),_.requestPending=!1,_.send()}).catch(function(N){p.eventemitter&&p.eventemitter.emit("error",{url:a.url,method:a.method,message:N.type}),_.requestPending=!1,_.send()})}).catch(function(y){p.eventemitter&&p.eventemitter.emit("error",{url:a.url,method:a.method,message:y&&y.toString&&y.toString()}),_.requestPending=!1,_.send()}))}}},{key:"send",value:function(){this.sendTrackingEvents&&(this.options&&this.options.trackingSendDelay===0?this.sendEvents():setTimeout(this.sendEvents.bind(this),this.options&&this.options.trackingSendDelay||250))}}],[{key:"get",value:function(){return r.local.get(s)||[]}},{key:"set",value:function(_){!_||Array.isArray(_)&&_.length===0?c.remove():r.local.set(s,_);var E=c.get();Array.isArray(E)&&E.length!==_.length&&(this.sendTrackingEvents=!1,c.remove())}},{key:"remove",value:function(){r.local.remove(s)}}]),c}();return Wo=u,Wo}var Ko,xa;function pv(){if(xa)return Ko;xa=1;var e=He,t=e(Qf()),n=e(qr()),r=e(ft()),i=e(dt());function o(x,k){var a=Object.keys(x);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(x);k&&(h=h.filter(function(d){return Object.getOwnPropertyDescriptor(x,d).enumerable})),a.push.apply(a,h)}return a}function s(x){for(var k=1;k<arguments.length;k++){var a=arguments[k]!=null?arguments[k]:{};k%2?o(Object(a),!0).forEach(function(h){(0,t.default)(x,h,a[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach(function(h){Object.defineProperty(x,h,Object.getOwnPropertyDescriptor(a,h))})}return x}var l=av(),u=pt(),c=dv();function v(x,k){var a=k.apiKey,h=k.version,d=k.sessionId,f=k.clientId,p=k.userId,g=k.segments,m=k.testCells,S=k.requestMethod,w=k.beaconMode,y=u.getWindowLocation(),N=y.host,C=y.pathname,q=k.sendReferrerWithTrackingEvents!==!1,T=Object.assign(x);return h&&(T.c=h),f&&(T.i=f),d&&(T.s=d),p&&(T.ui=String(p)),g&&g.length&&(T.us=g),a&&(T.key=a),m&&Object.keys(m).forEach(function(O){T["ef-".concat(O)]=m[O]}),w&&S&&S.match(/POST/i)&&(T.beacon=!0),q&&N&&(T.origin_referrer=N,C&&(T.origin_referrer+=C)),T._dt=Date.now(),T=u.cleanParams(T),T}function _(x,k){return u.stringify(v(x,k))}var E=function(){function x(k){(0,r.default)(this,x),this.options=k||{},this.eventemitter=new l,this.requests=new c(k,this.eventemitter),this.behavioralV2Url="https://ac.cnstrc.com/v2/behavioral_action/"}return(0,i.default)(x,[{key:"trackSessionStartV2",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.behavioralV2Url,"session_start?");return this.requests.queue("".concat(h).concat(_({},this.options)),"POST",void 0,a),this.requests.send(),!0}},{key:"trackSessionStart",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.options.serviceUrl,"/behavior?"),d={action:"session_start"};return this.requests.queue("".concat(h).concat(_(d,this.options)),void 0,void 0,a),this.requests.send(),!0}},{key:"trackInputFocusV2",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d="".concat(this.behavioralV2Url,"focus?"),f={},p=h,g=a;(0,n.default)(a)==="object"&&(p=a,g=""),f.user_input=g;var m="POST",S=v(f,s(s({},this.options),{},{requestMethod:m}));return this.requests.queue("".concat(d).concat(_({},this.options)),m,S,p),this.requests.send(),!0}},{key:"trackInputFocus",value:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h="".concat(this.options.serviceUrl,"/behavior?"),d={action:"focus"};return this.requests.queue("".concat(h).concat(_(d,this.options)),void 0,void 0,a),this.requests.send(),!0}},{key:"trackItemDetailLoad",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/item_detail_load?"),f={},p={},g=a.item_name,m=a.name,S=a.item_id,w=a.customer_id,y=a.customerId,N=y===void 0?w:y,C=a.variation_id,q=a.itemName,T=q===void 0?g||m:q,O=a.itemId,j=O===void 0?S||N:O,M=a.variationId,B=M===void 0?C:M,R=a.url;T&&(p.item_name=T),j&&(p.item_id=j),B&&(p.variation_id=B),R&&(p.url=R);var z="".concat(d).concat(_(f,this.options)),P="POST",A=v(p,s(s({},this.options),{},{requestMethod:P}));return this.requests.queue(z,P,A,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackAutocompleteSelectV2",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f="".concat(this.behavioralV2Url,"autocomplete_select?"),p=h.original_query,g=h.originalQuery,m=g===void 0?p:g,S=h.user_input,w=h.userInput,y=w===void 0?m||S:w,N=h.original_section,C=h.section,q=C===void 0?N:C,T=h.tr,O=h.group_id,j=h.groupId,M=j===void 0?O:j,B=h.item_id,R=h.itemId,z=R===void 0?B:R,P=h.variation_id,A=h.variationId,F=A===void 0?P:A,U={},Q={user_input:y,tr:T,group_id:M,item_id:z,variation_id:F,item_name:a,section:q};q&&(U.section=q);var W="".concat(f).concat(_(U,this.options)),V="POST",K=v(Q,s(s({},this.options),{},{requestMethod:V}));return this.requests.queue(W,V,K,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackAutocompleteSelect",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/select?"),p={},g=h.original_query,m=h.originalQuery,S=m===void 0?g:m,w=h.section,y=h.original_section,N=h.originalSection,C=N===void 0?y:N,q=h.tr,T=h.group_id,O=h.groupId,j=O===void 0?T:O,M=h.display_name,B=h.displayName,R=B===void 0?M:B;return S&&(p.original_query=S),q&&(p.tr=q),(C||w)&&(p.section=C||w),j&&(p.group={group_id:j,display_name:R}),this.requests.queue("".concat(f).concat(_(p,this.options)),void 0,void 0,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchSubmitV2",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f="".concat(this.behavioralV2Url,"search_submit?"),p=h.original_query,g=h.originalQuery,m=g===void 0?p:g,S=h.user_input,w=h.userInput,y=w===void 0?m||S:w,N=h.group_id,C=h.groupId,q=C===void 0?N:C,T=h.section,O={},j={user_input:y,search_term:a,section:T};q&&(j.filters={group_id:q}),T&&(O.section=T);var M="".concat(f).concat(_(O,this.options)),B="POST",R=v(j,s(s({},this.options),{},{requestMethod:B}));return this.requests.queue(M,B,R,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchSubmit",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/search?"),p={},g=h.original_query,m=h.originalQuery,S=m===void 0?g:m,w=h.group_id,y=h.groupId,N=y===void 0?w:y,C=h.display_name,q=h.displayName,T=q===void 0?C:q;return S&&(p.original_query=S),N&&(p.group={group_id:N,display_name:T}),this.requests.queue("".concat(f).concat(_(p,this.options)),void 0,void 0,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultsLoadedV2",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f="".concat(this.behavioralV2Url,"search_result_load?"),p=h.num_results,g=h.numResults,m=g===void 0?p:g,S=h.result_count,w=h.resultCount,y=w===void 0?m||S:w,N=h.customer_ids,C=h.item_ids,q=h.items,T=q===void 0?N||C:q,O=h.result_page,j=h.resultPage,M=j===void 0?O:j,B=h.result_id,R=h.resultId,z=R===void 0?B:R,P=h.sort_order,A=h.sortOrder,F=A===void 0?P:A,U=h.sort_by,Q=h.sortBy,W=Q===void 0?U:Q,V=h.selected_filters,K=h.selectedFilters,Z=K===void 0?V:K,ee=h.url,le=h.section,ue={},Y;T&&Array.isArray(T)&&T.length!==0&&(Y=T,typeof T[0]=="string"||typeof T[0]=="number"?Y=T.map(function(Ue){return{item_id:String(Ue)}}):Y=T.map(function(Ue){return u.toSnakeCaseKeys(Ue,!1)})),le&&(ue.section=le);var ze={search_term:a,result_count:y,items:Y,result_page:M,result_id:z,sort_order:F,sort_by:W,selected_filters:Z,url:ee,section:le},de="".concat(f).concat(_(ue,this.options)),ke="POST",ce=v(ze,s(s({},this.options),{},{requestMethod:ke}));return this.requests.queue(de,ke,ce,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultsLoaded",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f="".concat(this.options.serviceUrl,"/behavior?"),p={action:"search-results",term:a},g=h.num_results,m=h.numResults,S=m===void 0?g:m,w=h.customer_ids,y=h.customerIds,N=y===void 0?w:y,C=h.item_ids,q=h.itemIds,T=q===void 0?C:q,O;return u.isNil(S)||(p.num_results=S),T&&Array.isArray(T)?O=T:N&&Array.isArray(N)&&(O=N),O&&Array.isArray(O)&&O.length&&(p.customer_ids=O.slice(0,100).join(",")),this.requests.queue("".concat(f).concat(_(p,this.options)),void 0,void 0,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultClickV2",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f="".concat(this.behavioralV2Url,"search_result_click?"),p=h.num_results,g=h.customer_id,m=h.item_id,S=h.itemId,w=S===void 0?g||m:S,y=h.name,N=h.item_name,C=h.itemName,q=C===void 0?y||N:C,T=h.variation_id,O=h.variationId,j=O===void 0?T:O,M=h.result_id,B=h.resultId,R=B===void 0?M:B,z=h.result_count,P=h.resultCount,A=P===void 0?p||z:P,F=h.result_page,U=h.resultPage,Q=U===void 0?F:U,W=h.result_position_on_page,V=h.resultPositionOnPage,K=V===void 0?W:V,Z=h.num_results_per_page,ee=h.numResultsPerPage,le=ee===void 0?Z:ee,ue=h.selected_filters,Y=h.selectedFilters,ze=Y===void 0?ue:Y,de=h.section,ke={item_name:q,item_id:w,variation_id:j,result_id:R,result_count:A,result_page:Q,result_position_on_page:K,num_results_per_page:le,selected_filters:ze,section:de,search_term:a},ce={};de&&(ce.section=de);var Ue="".concat(f).concat(_(ce,this.options)),ot="POST",Mn=v(ke,s(s({},this.options),{},{requestMethod:ot}));return this.requests.queue(Ue,ot,Mn,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackSearchResultClick",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(a&&typeof a=="string"){if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f="".concat(this.options.serviceUrl,"/autocomplete/").concat(u.encodeURIComponentRFC3986(u.trimNonBreakingSpaces(a)),"/click_through?"),p={},g=h.item_name,m=h.name,S=h.itemName,w=S===void 0?g||m:S,y=h.item_id,N=h.itemId,C=N===void 0?y:N,q=h.customer_id,T=h.customerId,O=T===void 0?q||C:T,j=h.variation_id,M=h.variationId,B=M===void 0?j:M,R=h.result_id,z=h.resultId,P=z===void 0?R:z,A=h.item_is_convertible,F=h.itemIsConvertible,U=F===void 0?A:F,Q=h.section;return w&&(p.name=w),O&&(p.customer_id=O),B&&(p.variation_id=B),P&&(p.result_id=P),typeof U=="boolean"&&(p.item_is_convertible=U),Q&&(p.section=Q),this.requests.queue("".concat(f).concat(_(p,this.options)),void 0,void 0,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}return this.requests.send(),new Error("term is a required parameter of type string")}},{key:"trackConversion",value:function(a,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(h&&(0,n.default)(h)==="object"&&!Array.isArray(h)){var f=a||"TERM_UNKNOWN",p="".concat(this.options.serviceUrl,"/v2/behavioral_action/conversion?"),g={},m={},S=h.name,w=h.item_name,y=h.itemName,N=y===void 0?w||S:y,C=h.customer_id,q=h.customerId,T=q===void 0?C:q,O=h.item_id,j=h.itemId,M=j===void 0?O||T:j,B=h.variation_id,R=h.variationId,z=R===void 0?B:R,P=h.revenue,A=h.section,F=A===void 0?"Products":A,U=h.display_name,Q=h.displayName,W=Q===void 0?U:Q,V=h.type,K=h.is_custom_type,Z=h.isCustomType,ee=Z===void 0?K:Z;M&&(m.item_id=M),N&&(m.item_name=N),z&&(m.variation_id=z),(P||P===0)&&(m.revenue=P.toString()),F&&(g.section=F,m.section=F),f&&(m.search_term=f),V&&(m.type=V),ee&&(m.is_custom_type=ee),W&&(m.display_name=W);var le="".concat(p).concat(_(g,this.options)),ue="POST",Y=v(m,s(s({},this.options),{},{requestMethod:ue}));return this.requests.queue(le,ue,Y,d),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackPurchase",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/purchase?"),f={},p={},g=a.items,m=a.revenue,S=a.order_id,w=a.orderId,y=w===void 0?S:w,N=a.section;if(y){if(u.hasOrderIdRecord(y))return!1;u.addOrderIdRecord(y),p.order_id=y}g&&Array.isArray(g)&&(p.items=g.slice(0,100).map(function(O){return u.toSnakeCaseKeys(O,!1)})),(m||m===0)&&(p.revenue=m),N?f.section=N:f.section="Products";var C="".concat(d).concat(_(f,this.options)),q="POST",T=v(p,s(s({},this.options),{},{requestMethod:q}));return this.requests.queue(C,q,T,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackRecommendationView",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/recommendation_result_view?"),f={},p=a.result_count,g=a.resultCount,m=g===void 0?p:g,S=a.result_page,w=a.resultPage,y=w===void 0?S:w,N=a.result_id,C=a.resultId,q=C===void 0?N:C,T=a.section,O=a.url,j=a.pod_id,M=a.podId,B=M===void 0?j:M,R=a.num_results_viewed,z=a.numResultsViewed,P=z===void 0?R:z,A=a.items;u.isNil(m)||(f.result_count=m),u.isNil(y)||(f.result_page=y),q&&(f.result_id=q),T?f.section=T:f.section="Products",O&&(f.url=O),B&&(f.pod_id=B),u.isNil(P)||(f.num_results_viewed=P),A&&Array.isArray(A)&&(f.items=A.slice(0,100).map(function(W){return u.toSnakeCaseKeys(W,!1)}));var F="".concat(d).concat(_({},this.options)),U="POST",Q=v(f,s(s({},this.options),{},{requestMethod:U}));return this.requests.queue(F,U,Q,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackRecommendationClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/recommendation_result_click?"),f={},p=a.variation_id,g=a.variationId,m=g===void 0?p:g,S=a.section,w=S===void 0?"Products":S,y=a.result_id,N=a.resultId,C=N===void 0?y:N,q=a.result_count,T=a.resultCount,O=T===void 0?q:T,j=a.result_page,M=a.resultPage,B=M===void 0?j:M,R=a.result_position_on_page,z=a.resultPositionOnPage,P=z===void 0?R:z,A=a.num_results_per_page,F=a.numResultsPerPage,U=F===void 0?A:F,Q=a.pod_id,W=a.podId,V=W===void 0?Q:W,K=a.strategy_id,Z=a.strategyId,ee=Z===void 0?K:Z,le=a.item_id,ue=a.itemId,Y=ue===void 0?le:ue,ze=a.item_name,de=a.itemName,ke=de===void 0?ze:de;m&&(f.variation_id=m),w&&(f.section=w),C&&(f.result_id=C),u.isNil(O)||(f.result_count=O),u.isNil(B)||(f.result_page=B),u.isNil(P)||(f.result_position_on_page=P),u.isNil(U)||(f.num_results_per_page=U),V&&(f.pod_id=V),ee&&(f.strategy_id=ee),Y&&(f.item_id=Y),ke&&(f.item_name=ke);var ce="".concat(d).concat(_({},this.options)),Ue="POST",ot=v(f,s(s({},this.options),{},{requestMethod:Ue}));return this.requests.queue(ce,Ue,ot,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackBrowseResultsLoaded",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/browse_result_load?"),f={},p=a.section,g=p===void 0?"Products":p,m=a.result_count,S=a.resultCount,w=S===void 0?m:S,y=a.result_page,N=a.resultPage,C=N===void 0?y:N,q=a.result_id,T=a.resultId,O=T===void 0?q:T,j=a.selected_filters,M=a.selectedFilters,B=M===void 0?j:M,R=a.url,z=a.sort_order,P=a.sortOrder,A=P===void 0?z:P,F=a.sort_by,U=a.sortBy,Q=U===void 0?F:U,W=a.filter_name,V=a.filterName,K=V===void 0?W:V,Z=a.filter_value,ee=a.filterValue,le=ee===void 0?Z:ee,ue=a.items;g&&(f.section=g),u.isNil(w)||(f.result_count=w),u.isNil(C)||(f.result_page=C),O&&(f.result_id=O),B&&(f.selected_filters=B),R&&(f.url=R),A&&(f.sort_order=A),Q&&(f.sort_by=Q),K&&(f.filter_name=K),le&&(f.filter_value=le),ue&&Array.isArray(ue)&&(f.items=ue.slice(0,100).map(function(ke){return u.toSnakeCaseKeys(ke,!1)}));var Y="".concat(d).concat(_({},this.options)),ze="POST",de=v(f,s(s({},this.options),{},{requestMethod:ze}));return this.requests.queue(Y,ze,de,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackBrowseResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/browse_result_click?"),f={},p=a.section,g=p===void 0?"Products":p,m=a.variation_id,S=a.variationId,w=S===void 0?m:S,y=a.result_id,N=a.resultId,C=N===void 0?y:N,q=a.result_count,T=a.resultCount,O=T===void 0?q:T,j=a.result_page,M=a.resultPage,B=M===void 0?j:M,R=a.result_position_on_page,z=a.resultPositionOnPage,P=z===void 0?R:z,A=a.num_results_per_page,F=a.numResultsPerPage,U=F===void 0?A:F,Q=a.selected_filters,W=a.selectedFilters,V=W===void 0?Q:W,K=a.filter_name,Z=a.filterName,ee=Z===void 0?K:Z,le=a.filter_value,ue=a.filterValue,Y=ue===void 0?le:ue,ze=a.customer_id,de=a.customerId,ke=de===void 0?ze:de,ce=a.item_id,Ue=a.itemId,ot=Ue===void 0?ke||ce:Ue,Mn=a.item_name,Jf=a.name,Ql=a.itemName,bl=Ql===void 0?Mn||Jf:Ql;g&&(f.section=g),w&&(f.variation_id=w),C&&(f.result_id=C),u.isNil(O)||(f.result_count=O),u.isNil(B)||(f.result_page=B),u.isNil(P)||(f.result_position_on_page=P),u.isNil(U)||(f.num_results_per_page=U),V&&(f.selected_filters=V),ee&&(f.filter_name=ee),Y&&(f.filter_value=Y),ot&&(f.item_id=ot),bl&&(f.item_name=bl);var Zf="".concat(d).concat(_({},this.options)),Wl="POST",$f=v(f,s(s({},this.options),{},{requestMethod:Wl}));return this.requests.queue(Zf,Wl,$f,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackGenericResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if((0,n.default)(a)==="object"){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/result_click?"),f={},p=a.item_id,g=a.itemId,m=g===void 0?p:g,S=a.item_name,w=a.itemName,y=w===void 0?S:w,N=a.variation_id,C=a.variationId,q=C===void 0?N:C,T=a.section,O=T===void 0?"Products":T;if(m){f.section=O,f.item_id=m,y&&(f.item_name=y),q&&(f.variation_id=q);var j="".concat(d).concat(_({},this.options)),M="POST",B=v(f,s(s({},this.options),{},{requestMethod:M}));return this.requests.queue(j,M,B,h),this.requests.send(),!0}}return this.requests.send(),new Error('A parameters object with an "itemId" property is required.')}},{key:"trackQuizResultsLoaded",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_result_load?"),f=a.quiz_id,p=a.quizId,g=p===void 0?f:p,m=a.quiz_version_id,S=a.quizVersionId,w=S===void 0?m:S,y=a.quiz_session_id,N=a.quizSessionId,C=N===void 0?y:N,q=a.url,T=a.section,O=T===void 0?"Products":T,j=a.result_count,M=a.resultCount,B=M===void 0?j:M,R=a.result_id,z=a.resultId,P=z===void 0?R:z,A=a.result_page,F=a.resultPage,U=F===void 0?A:F,Q=a.items,W={},V={};if(Q&&Array.isArray(Q)&&(V.items=Q.slice(0,100).map(function(le){return u.toSnakeCaseKeys(le,!1)})),typeof g!="string")return new Error('"quizId" is a required parameter of type string');if(typeof w!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof C!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof q!="string")return new Error('"url" is a required parameter of type string');if(V.quiz_id=g,V.quiz_version_id=w,V.quiz_session_id=C,V.url=q,!u.isNil(O)){if(typeof O!="string")return new Error('"section" must be a string');W.section=O,V.section=O}if(!u.isNil(B)){if(typeof B!="number")return new Error('"resultCount" must be a number');V.result_count=B}if(!u.isNil(P)){if(typeof P!="string")return new Error('"resultId" must be a string');V.result_id=P}if(!u.isNil(U)){if(typeof U!="number")return new Error('"resultPage" must be a number');V.result_page=U}V.action_class="result_load";var K="".concat(d).concat(_(W,this.options)),Z="POST",ee=v(V,s(s({},this.options),{},{requestMethod:Z}));return this.requests.queue(K,Z,ee,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackQuizResultClick",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_result_click?"),f=a.quiz_id,p=a.quizId,g=p===void 0?f:p,m=a.quiz_version_id,S=a.quizVersionId,w=S===void 0?m:S,y=a.quiz_session_id,N=a.quizSessionId,C=N===void 0?y:N,q=a.item_id,T=a.itemId,O=T===void 0?q:T,j=a.item_name,M=a.itemName,B=M===void 0?j:M,R=a.result_count,z=a.resultCount,P=z===void 0?R:z,A=a.result_id,F=a.resultId,U=F===void 0?A:F,Q=a.result_page,W=a.resultPage,V=W===void 0?Q:W,K=a.num_results_per_page,Z=a.numResultsPerPage,ee=Z===void 0?K:Z,le=a.result_position_on_page,ue=a.resultPositionOnPage,Y=ue===void 0?le:ue,ze=a.section,de=ze===void 0?"Products":ze,ke={},ce={};if(typeof g!="string")return new Error('"quizId" is a required parameter of type string');if(typeof w!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof C!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof O!="string"&&typeof B!="string")return new Error('"itemId" or "itemName" is a required parameter of type string');if(ce.quiz_id=g,ce.quiz_version_id=w,ce.quiz_session_id=C,!u.isNil(O)){if(typeof O!="string")return new Error('"itemId" must be a string');ce.item_id=O}if(!u.isNil(B)){if(typeof B!="string")return new Error('"itemName" must be a string');ce.item_name=B}if(!u.isNil(de)){if(typeof de!="string")return new Error('"section" must be a string');ke.section=de}if(!u.isNil(P)){if(typeof P!="number")return new Error('"resultCount" must be a number');ce.result_count=P}if(!u.isNil(U)){if(typeof U!="string")return new Error('"resultId" must be a string');ce.result_id=U}if(!u.isNil(V)){if(typeof V!="number")return new Error('"resultPage" must be a number');ce.result_page=V}if(!u.isNil(ee)){if(typeof ee!="number")return new Error('"numResultsPerPage" must be a number');ce.num_results_per_page=ee}if(!u.isNil(Y)){if(typeof Y!="number")return new Error('"resultPositionOnPage" must be a number');ce.result_position_on_page=Y}ce.action_class="result_click";var Ue="".concat(d).concat(_(ke,this.options)),ot="POST",Mn=v(ce,s(s({},this.options),{},{requestMethod:ot}));return this.requests.queue(Ue,ot,Mn,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"trackQuizConversion",value:function(a){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a&&(0,n.default)(a)==="object"&&!Array.isArray(a)){var d="".concat(this.options.serviceUrl,"/v2/behavioral_action/quiz_conversion?"),f=a.quiz_id,p=a.quizId,g=p===void 0?f:p,m=a.quiz_version_id,S=a.quizVersionId,w=S===void 0?m:S,y=a.quiz_session_id,N=a.quizSessionId,C=N===void 0?y:N,q=a.item_id,T=a.itemId,O=T===void 0?q:T,j=a.item_name,M=a.itemName,B=M===void 0?j:M,R=a.variation_id,z=a.variationId,P=z===void 0?R:z,A=a.revenue,F=a.section,U=F===void 0?"Products":F,Q=a.type,W=a.is_custom_type,V=a.isCustomType,K=V===void 0?W:V,Z=a.display_name,ee=a.displayName,le=ee===void 0?Z:ee,ue={},Y={};if(typeof g!="string")return new Error('"quizId" is a required parameter of type string');if(typeof w!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof C!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof O!="string"&&typeof B!="string")return new Error('"itemId" or "itemName" is a required parameter of type string');if(Y.quiz_id=g,Y.quiz_version_id=w,Y.quiz_session_id=C,!u.isNil(O)){if(typeof O!="string")return new Error('"itemId" must be a string');Y.item_id=O}if(!u.isNil(B)){if(typeof B!="string")return new Error('"itemName" must be a string');Y.item_name=B}if(!u.isNil(P)){if(typeof P!="string")return new Error('"variationId" must be a string');Y.variation_id=P}if(!u.isNil(A)){if(typeof A!="string")return new Error('"revenue" must be a string');Y.revenue=A}if(!u.isNil(U)){if(typeof U!="string")return new Error('"section" must be a string');Y.section=U}if(!u.isNil(Q)){if(typeof Q!="string")return new Error('"type" must be a string');Y.type=Q}if(!u.isNil(K)){if(typeof K!="boolean")return new Error('"isCustomType" must be a boolean');Y.is_custom_type=K}if(!u.isNil(le)){if(typeof le!="string")return new Error('"displayName" must be a string');Y.display_name=le}Y.action_class="conversion";var ze="".concat(d).concat(_(ue,this.options)),de="POST",ke=v(Y,s(s({},this.options),{},{requestMethod:de}));return this.requests.queue(ze,de,ke,h),this.requests.send(),!0}return this.requests.send(),new Error("parameters are required of type object")}},{key:"on",value:function(a,h){return a!=="success"&&a!=="error"?new Error('messageType must be a string of value "success" or "error"'):!h||typeof h!="function"?new Error("callback is required and must be a function"):(this.eventemitter.on(a,h),!0)}}]),x}();return E.RequestQueue=c,Ko=E,Ko}const hv="@constructor-io/constructorio-client-javascript",vv="2.35.17",gv="Constructor.io JavaScript client",yv="lib/constructorio.js",mv="lib/types/constructorio.d.ts",_v={clean:"sudo rm -rf node_modules package-lock.json",version:"npm run verify-node-version && npm run docs && git add ./docs/* && npm run bundle && git add -A ./dist","check-license":"license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT;0BSD;BSD-2-Clause'","verify-node-version":"chmod +x ./scripts/verify-node-version.sh && ./scripts/verify-node-version.sh",lint:"eslint 'src/**/*.js' 'spec/**/*.js' 'src/**/*.d.ts'",test:"npm run compile && mkdir -p test && cp -rf lib/* test && mocha ./spec/*","test:types":"tsd .","test:parallel":"npm run compile && mkdir -p test && cp -rf lib/* test && mocha --parallel ./spec/*","test:src":"mkdir -p test && cp -rf src/* test && mocha ./spec/*","test:src:parallel":"mkdir -p test && cp -rf src/* test && mocha --parallel ./spec/*","test:bundled":"npm run bundle && BUNDLED=true PACKAGE_VERSION=$(echo $npm_package_version) mocha ./spec/*","test:bundled:parallel":"npm run bundle && BUNDLED=true PACKAGE_VERSION=$(echo $npm_package_version) mocha --parallel ./spec/*","test:all":"npm run test && npm run test:bundled","test:all:parallel":"npm run test:parallel && npm run test:bundled:parallel",precoverage:"rm -rf ./coverage && rm -rf ./.nyc_output",coverage:"nyc --all --reporter=html npm run test:src",postcoverage:"open coverage/index.html && rm -rf test",docs:"jsdoc --configure ./.jsdoc.json ./README.md --recurse ./src --destination ./docs",compile:"babel src/ -d lib/ --copy-files && rm -rf lib/types/tests",prepublish:"npm run compile",bundle:"rm -rf ./dist/* && npm run compile && node bundle.js",prepare:"husky install"},wv={type:"git",url:"git+https://github.com/Constructor-io/constructorio-client-javascript.git"},kv="constructor.io",Sv="MIT",Ev={url:"https://github.com/Constructor-io/constructorio-client-javascript/issues"},Cv="https://github.com/Constructor-io/constructorio-client-javascript#readme",xv=["lib/**/*"],Rv={"@babel/cli":"^7.15.7","@babel/core":"^7.15.8","@babel/plugin-transform-runtime":"^7.16.4","@babel/preset-env":"^7.15.8","@babel/register":"^7.15.3","@cspell/eslint-plugin":"^6.8.2","@types/events":"^3.0.0","@typescript-eslint/eslint-plugin":"^5.48.1","@typescript-eslint/parser":"^5.48.1",chai:"^4.2.0","chai-as-promised":"^7.1.1",docdash:"^2.0.1",dotenv:"^8.6.0",esbuild:"^0.12.28",eslint:"^8.17.0","eslint-config-airbnb-base":"^15.0.0","eslint-plugin-import":"^2.25.2",husky:"^7.0.4",jsdoc:"^4.0.2",jsdom:"^16.7.0","license-checker":"^25.0.1","lodash.clonedeep":"^4.5.0",mocha:"^9.1.3",nyc:"^15.1.0",qs:"^6.11.0",sinon:"^7.5.0","sinon-chai":"^3.7.0",tsd:"^0.24.1"},zv={"@constructor-io/constructorio-id":"^2.4.10","crc-32":"^1.2.2",events:"^3.0.0","fetch-ponyfill":"^7.1.0",store2:"^2.14.2"},Nv={"@babel/runtime":"^7.19.0"},Tv={directory:"src/types/tests"},qv={name:hv,version:vv,description:gv,main:yv,types:mv,scripts:_v,repository:wv,author:kv,license:Sv,bugs:Ev,homepage:Cv,files:xv,devDependencies:Rv,dependencies:zv,peerDependencies:Nv,tsd:Tv};var ji={},Pv={get exports(){return ji},set exports(e){ji=e}},Di={},Iv={get exports(){return Di},set exports(e){Di=e}},Hi={},Ov={get exports(){return Hi},set exports(e){Hi=e}},Ra;function bf(){return Ra||(Ra=1,function(e){function t(n,r){(r==null||r>n.length)&&(r=n.length);for(var i=0,o=new Array(r);i<r;i++)o[i]=n[i];return o}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Ov)),Hi}var za;function Av(){return za||(za=1,function(e){var t=bf();function n(r){if(Array.isArray(r))return t(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Iv)),Di}var Vi={},Lv={get exports(){return Vi},set exports(e){Vi=e}},Na;function Bv(){return Na||(Na=1,function(e){function t(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Lv)),Vi}var Qi={},Uv={get exports(){return Qi},set exports(e){Qi=e}},Ta;function Mv(){return Ta||(Ta=1,function(e){var t=bf();function n(r,i){if(r){if(typeof r=="string")return t(r,i);var o=Object.prototype.toString.call(r).slice(8,-1);if(o==="Object"&&r.constructor&&(o=r.constructor.name),o==="Map"||o==="Set")return Array.from(r);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return t(r,i)}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Uv)),Qi}var bi={},Fv={get exports(){return bi},set exports(e){bi=e}},qa;function jv(){return qa||(qa=1,function(e){function t(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
46
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Fv)),bi}var Pa;function Dv(){return Pa||(Pa=1,function(e){var t=Av(),n=Bv(),r=Mv(),i=jv();function o(s){return t(s)||n(s)||r(s)||i()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}(Pv)),ji}var Go,Ia;function Hv(){if(Ia)return Go;Ia=1;var e=He,t=e(ft()),n=e(dt()),r=e(Dv()),i=e(qr()),o=Un(),s=pt();function l(c,v,_,E){var x=_.apiKey,k=_.clientId,a=_.sessionId,h=_.segments,d=_.userId,f=_.version,p=_.quizzesServiceUrl,g={c:f},m="";if(g.key=x,g.i=k,g.s=a,h&&h.length&&(g.us=h),d&&(g.ui=String(d)),!c||typeof c!="string")throw new Error("quizId is a required parameter of type string");if(E==="results"&&((0,i.default)(v.answers)!=="object"||!Array.isArray(v.answers)||v.answers.length===0))throw new Error("answers is a required parameter of type array");if(v){var S=v.section,w=v.answers,y=v.quizSessionId,N=v.quizVersionId,C=v.page,q=v.resultsPerPage,T=v.filters;S&&(g.section=S),N&&(g.quiz_version_id=N),y&&(g.quiz_session_id=y),w&&w.length&&(m="&".concat(s.stringify({a:w.map(function(j){return(0,r.default)(j).join(",")})}))),s.isNil(C)||(g.page=C),s.isNil(q)||(g.num_results_per_page=q),T&&(g.filters=T)}g._dt=Date.now(),g=s.cleanParams(g);var O=s.stringify(g);return"".concat(p,"/v1/quizzes/").concat(encodeURIComponent(c),"/").concat(encodeURIComponent(E),"/?").concat(O).concat(m)}var u=function(){function c(v){(0,t.default)(this,c),this.options=v||{},this.eventDispatcher=new o(v.eventDispatcher)}return(0,n.default)(c,[{key:"getQuizNextQuestion",value:function(_,E){var x=this,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,d=new AbortController,f=d.signal;try{a=l(_,E,this.options,"next")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,k,d),h(a,{signal:f}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return x.eventDispatcher.queue("quizzes.getQuizNextQuestion.completed",p),p;throw new Error("getQuizNextQuestion response data is malformed")})}},{key:"getQuizResults",value:function(_,E){var x=this,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,d=new AbortController,f=d.signal;try{a=l(_,E,this.options,"results")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,k,d),h(a,{signal:f}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return x.eventDispatcher.queue("quizzes.getQuizResults.completed",p),p;throw new Error("getQuizResults response data is malformed")})}}]),c}();return Go=u,Go}var Wf=He,Vv=Wf(ft()),Qv=Wf(dt()),bv=Xh(),Wv=Zh(),Kv=rv(),Gv=ov(),Yv=sv(),Xv=lv(),Kf=pv(),Jv=Un(),Hl=pt(),Zv=qv,$v=Zv.version,eg=Hv(),tg=function(){var t="ciojs-client-",n=[];return Hl.canUseDOM()||n.push("domless"),typeof process<"u"&&typeof process.env<"u"&&{}.BUNDLED&&n.push("bundled"),"".concat(t).concat(n.join("-")).concat(n.length?"-":"").concat($v)},Vl=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,Vv.default)(this,e);var n=t.apiKey,r=t.version,i=t.serviceUrl,o=t.quizzesServiceUrl,s=t.segments,l=t.testCells,u=t.clientId,c=t.sessionId,v=t.userId,_=t.fetch,E=t.trackingSendDelay,x=t.sendReferrerWithTrackingEvents,k=t.sendTrackingEvents,a=t.eventDispatcher,h=t.idOptions,d=t.beaconMode,f=t.networkParameters;if(!n||typeof n!="string")throw new Error("API key is a required parameter of type string");var p,g,m=typeof It<"u"&&It.CLIENT_VERSION;if(Hl.canUseDOM()){var S=new bv(h||{});p=S.session_id,g=S.client_id}else{if(!c||typeof c!="number")throw new Error("sessionId is a required user parameter of type number");if(!u||typeof u!="string")throw new Error("clientId is a required user parameter of type string")}this.options={apiKey:n,version:r||m||tg(),serviceUrl:i&&i.replace(/\/$/,"")||"https://ac.cnstrc.com",quizzesServiceUrl:o&&o.replace(/\/$/,"")||"https://quizzes.cnstrc.com",sessionId:c||p,clientId:u||g,userId:v,segments:s,testCells:l,fetch:_||Wv({Promise}).fetch,trackingSendDelay:E,sendTrackingEvents:k,sendReferrerWithTrackingEvents:x,eventDispatcher:a,beaconMode:d!==!1,networkParameters:f||{}},this.search=new Kv(this.options),this.browse=new Gv(this.options),this.autocomplete=new Yv(this.options),this.recommendations=new Xv(this.options),this.tracker=new Kf(this.options),this.quizzes=new eg(this.options),new Jv(t.eventDispatcher).queue("instantiated",this.options)}return(0,Qv.default)(e,[{key:"setClientOptions",value:function(n){if(Object.keys(n).length){var r=n.apiKey,i=n.segments,o=n.testCells,s=n.userId;r&&(this.options.apiKey=r),i&&(this.options.segments=i),o&&(this.options.testCells=o),s&&(this.options.userId=s)}}}]),e}();Vl.Tracker=Kf;Hl.canUseDOM()&&(window.ConstructorioClient=Vl);var ng=Vl;const rg="1.9.1",ig=e=>{if(e)return new ng({apiKey:e,sendTrackingEvents:!0,version:`cio-ui-quizzes-${rg}`})},og=(e,t,n)=>e==null?void 0:e.quizzes.getQuizNextQuestion(t,n),sg=async(e,t,n)=>e==null?void 0:e.quizzes.getQuizResults(t,n),lg=(e,t)=>{var c;const{quiz_id:n,quiz_session_id:r,quiz_version_id:i,result_id:o,request:s,response:l}=t,u=(c=l==null?void 0:l.results)==null?void 0:c.map(v=>{var _,E;return{itemId:(_=v==null?void 0:v.data)==null?void 0:_.id,variationId:(E=v==null?void 0:v.data)==null?void 0:E.variation_id,itemName:v==null?void 0:v.value}});e==null||e.tracker.trackQuizResultsLoaded({quizId:n,quizVersionId:i,quizSessionId:r,url:window.location.href,section:s==null?void 0:s.section,resultCount:l==null?void 0:l.total_num_results,resultPage:s==null?void 0:s.page,resultId:o,items:u})},ug=(e,t,n,r)=>{var i;if(t.request&&t.response){const{quiz_id:o,quiz_session_id:s,quiz_version_id:l,result_id:u,request:{section:c,page:v,num_results_per_page:_},response:{total_num_results:E}}=t;e==null||e.tracker.trackQuizResultClick({quizId:o,quizVersionId:l,quizSessionId:s,itemId:(i=n.data)==null?void 0:i.id,itemName:n==null?void 0:n.value,section:c,resultCount:E,resultPage:v,resultId:u,resultPositionOnPage:r,numResultsPerPage:_})}},Gf=(e,t,n,r,i)=>{var o,s;if(t.request){const{quiz_id:l,quiz_session_id:u,quiz_version_id:c,request:{section:v}}=t;e==null||e.tracker.trackQuizConversion({quizId:l,quizVersionId:c,quizSessionId:u,itemId:(o=n.data)==null?void 0:o.id,itemName:n.value,section:v,variationId:(s=n.data)==null?void 0:s.variation_id,revenue:r&&String(r)||void 0,type:i})}},ag=({apiKey:e,cioJsClient:t})=>{if(!e&&!t)throw new Error("Either apiKey or cioJsClient is required");return D.useMemo(()=>t||ig(e),[e,t])},cg=e=>{const{quizId:t,resultsPageOptions:n}=e;D.useEffect(()=>{t||console.error("quizId is a required field of type string"),(!n||Object.keys(n).length===0)&&console.error("resultsPageOptions is a required field of type object"),n&&!(n!=null&&n.onAddToCartClick)&&console.error("resultsPageOptions.onAddToCartClick is a required field of type function")},[t,n,n==null?void 0:n.onAddToCartClick])};function fg(e,t,n,r){var E;const i=n==null?void 0:n.type,o=(E=n==null?void 0:n.options)==null?void 0:E.some(x=>x.images),[s,l]=D.useState({}),u=D.useRef({}),c=D.useCallback(x=>{if(i===b.SingleSelect)u.current=!0,l({[x]:!0});else if(i===b.MultipleSelect)if(s[x]){const k={...s};delete k[x],l(k)}else l({...s,[x]:!0})},[s,i]),v=(x,k)=>{((x==null?void 0:x.key)===" "||(x==null?void 0:x.key)==="Enter")&&c(k)};return D.useEffect(()=>{var x;if(n!=null&&n.type){const k=n.id,a=r==null?void 0:r[k],h={};Array.isArray(a==null?void 0:a.value)&&((x=a==null?void 0:a.value)==null||x.forEach(d=>{h[Number(d)]=!0,l(h)}))}return u.current=!1,function(){l({})}},[n==null?void 0:n.id]),D.useEffect(()=>{if((n==null?void 0:n.type)==="multiple"||(n==null?void 0:n.type)==="single"){const x=Object.keys(s).filter(k=>s[Number(k)]);e(x)}},[s,n==null?void 0:n.id,n==null?void 0:n.type,e]),D.useEffect(()=>{(n==null?void 0:n.type)==="single"&&u.current&&t()},[r]),D.useCallback(x=>({className:`${o?"cio-question-option-container":"cio-question-option-container-text-only"} ${s[x.id]?"selected":""}`,onClick:()=>{c(x.id)},onKeyDown:k=>{v(k,x.id)},role:"button",tabIndex:0,key:x.id}),[n==null?void 0:n.id,s])}function dg(e,t){return D.useEffect(()=>{(t==null?void 0:t.type)==="cover"&&e("")},[e,t]),D.useCallback(()=>({}),[])}function pg(e,t,n,r){const[i,o]=D.useState(""),s=D.useCallback(c=>{o(c.target.value)},[]),l=D.useCallback(c=>{const{key:v}=c;v==="Enter"&&i&&(n==null?void 0:n.type)==="open"&&t()},[n==null?void 0:n.type,i,t]);return D.useEffect(()=>{(n==null?void 0:n.type)==="open"&&e(i)},[i,n==null?void 0:n.type,n==null?void 0:n.id,e]),D.useEffect(()=>{var c;if(r&&(n!=null&&n.id)){const v=(c=r[n.id])==null?void 0:c.value;o(v||"")}},[n==null?void 0:n.id]),D.useCallback(()=>({className:"cio-question-input-text",placeholder:(n==null?void 0:n.input_placeholder)||"Answer here...",value:i,onChange:s,onKeyDown:l}),[n==null?void 0:n.input_placeholder,n==null?void 0:n.id,i,l])}function hg(e,t,n){return D.useCallback(()=>{var s,l,u,c,v,_;const i=(l=(s=t.quizCurrentQuestion)==null?void 0:s.next_question)==null?void 0:l.id;let o;return i&&!((u=t.quizCurrentQuestion)!=null&&u.isCoverQuestion)&&(o=!((c=n.answerInputs[i])!=null&&c.value)||!((_=(v=n.answerInputs[i])==null?void 0:v.value)!=null&&_.length)),{className:o?"cio-question-cta-button disabled":"cio-question-cta-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,n.answerInputs,e])}function vg(e,t){return D.useCallback(()=>{var i;return{title:"Quiz Back Button",role:"button",className:`cio-question-back-button ${((i=e.quizCurrentQuestion)==null?void 0:i.isFirstQuestion)?"disabled":""}`,type:"button",onClick:()=>t()}},[e,t])}function gg(e,t){const n=i=>{var o,s;return((o=i==null?void 0:i.data)==null?void 0:o.id)&&(t==null?void 0:t.includes((s=i==null?void 0:i.data)==null?void 0:s.id))};return D.useCallback((i,o)=>({className:`cio-result-card-favorites-button ${n(i)?"favorited":""}`,onClick:s=>{e(s,i,o,!n(i))},type:"button"}),[e])}function yg(e,t){return D.useCallback(()=>{var o,s,l,u;return{className:((s=(o=t.quizCurrentQuestion)==null?void 0:o.next_question)==null?void 0:s.id)&&(((l=t.quizCurrentQuestion)==null?void 0:l.isCoverQuestion)||!((u=t.quizCurrentQuestion)!=null&&u.next_question.is_skippable))?"cio-question-skip-button hide":"cio-question-skip-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,e])}const mg=(e,t,n,r)=>{var T,O,j;const{quizAnswerChanged:i,nextQuestion:o,skipQuestion:s,previousQuestion:l,resetQuiz:u,hydrateQuiz:c,addToCart:v,addToFavorites:_,resultClick:E}=e,x=pg(i,o,(T=t.quizCurrentQuestion)==null?void 0:T.next_question,n.answerInputs),k=dg(i,(O=t.quizCurrentQuestion)==null?void 0:O.next_question),a=fg(i,o,(j=t.quizCurrentQuestion)==null?void 0:j.next_question,n.answerInputs),h=hg(o,t,n),d=yg(s,t),f=vg(t,l),p=D.useCallback((M="primary")=>({className:M==="primary"?"cio-question-cta-button":"cio-question-redo-button",type:"button",onClick:()=>u()}),[u]),g=D.useCallback(()=>({className:"",type:"button",onClick:()=>c()}),[c]),m=D.useCallback((M,B)=>({className:"cio-result-card-cta-button",type:"button",onClick:R=>v(R,M,B)}),[v]),S=gg(_,r),w=D.useCallback((M,B,R)=>{((M==null?void 0:M.key)===" "||(M==null?void 0:M.key)==="Enter")&&E&&E(B,R)},[E]),y=D.useCallback(({result:M,position:B})=>({className:"cio-result-card-container",role:"button",tabIndex:0,onClick:()=>E(M,B),onKeyDown:R=>w(R,M,B)}),[w,E]),N=D.useCallback(({result:M,position:B})=>{var R;return{href:(R=M.data)==null?void 0:R.url,onClick:()=>E(M,B),onKeyDown:z=>w(z,M,B)}},[w,E]),C=D.useCallback(()=>{var M,B,R,z,P,A;return{src:((R=(B=(M=t.quizCurrentQuestion)==null?void 0:M.next_question)==null?void 0:B.images)==null?void 0:R.primary_url)||void 0,alt:((A=(P=(z=t.quizCurrentQuestion)==null?void 0:z.next_question)==null?void 0:P.images)==null?void 0:A.primary_alt)||void 0}},[t.quizCurrentQuestion]),q=D.useCallback(M=>{var B,R;return{className:"cio-question-option-image",src:((B=M==null?void 0:M.images)==null?void 0:B.primary_url)||void 0,alt:((R=M==null?void 0:M.images)==null?void 0:R.primary_alt)||void 0}},[]);return{getOpenTextInputProps:x,getNextQuestionButtonProps:h,getPreviousQuestionButtonProps:f,getQuizImageProps:C,getSelectQuestionImageProps:q,getSelectInputProps:a,getCoverQuestionProps:k,getResetQuizButtonProps:p,getHydrateQuizButtonProps:g,getAddToCartButtonProps:m,getAddToFavoritesButtonProps:S,getQuizResultButtonProps:y,getQuizResultLinkProps:N,getSkipQuestionButtonProps:d}},_g=e=>D.useMemo(()=>{var r;let n={"--primary-color-h":"227","--primary-color-s":"70%","--primary-color-l":"46%"};if(e){const i=/^\s*\(?(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)?/,o=(r=e.trim().match(i))==null?void 0:r.slice(1);if(o&&o.length===3){const[s,l,u]=o,[c,v,_]=Sh(Number(s),Number(l),Number(u));n={"--primary-color-h":`${c}`,"--primary-color-s":`${v}%`,"--primary-color-l":`${_}%`}}}return n},[e]),wg=(e,t,n)=>{D.useEffect(()=>{var r;t.quizResults&&(lg(e,t.quizResults),n&&Bn(n)&&((r=t.quizResults.response)!=null&&r.results)&&n(t.quizResults.response.results))},[t,e,n])},kg=(e,t,n)=>D.useCallback((i,o)=>{t.quizResults&&(ug(e,t.quizResults,i,o),Bn(n)&&n(i,o))},[t,e,n]),Sg=(e,t,n)=>D.useCallback((i,o,s)=>{i.preventDefault(),t.quizResults&&(Gf(e,t.quizResults,o,s),Bn(n)&&n(o))},[t,e,n]),Eg=(e,t)=>D.useCallback(()=>{t&&t({type:b.Back,payload:e.quizCurrentQuestion})},[t,e.quizCurrentQuestion]),Cg=(e,t)=>D.useCallback(r=>{var s,l;const i=(l=(s=e.quizCurrentQuestion)==null?void 0:s.next_question)==null?void 0:l.type,o=e.quizCurrentQuestion;if(o!=null&&o.next_question)switch(i){case b.Cover:t({type:b.Cover,payload:{questionId:o.next_question.id,input:"",isLastQuestion:o.is_last_question}});break;case b.OpenText:t({type:b.OpenText,payload:{questionId:o.next_question.id,input:r,isLastQuestion:o.is_last_question}});break;case b.SingleSelect:case b.MultipleSelect:t({type:o.next_question.type,payload:{questionId:o.next_question.id,input:r,isLastQuestion:o.is_last_question}});break}},[e,t]),xg=(e,t,n,r)=>D.useCallback(()=>{var l,u;const o=(l=e.quizCurrentQuestion)==null?void 0:l.next_question,s=o==null?void 0:o.id;if(n&&s){const c=t.answerInputs[s];((u=c==null?void 0:c.value)!=null&&u.length||(o==null?void 0:o.type)==="cover")&&n({type:b.Next,payload:e.quizCurrentQuestion}),o&&Bn(r)&&r({...o,answer:c})}},[n,e.quizCurrentQuestion,t.answerInputs,r]),Rg=(e,t,n,r)=>D.useCallback(()=>{r&&(t({type:b.Reset}),n({type:Ke.RESET_QUIZ}),e())},[t,n,e,r]),zg=(e,t)=>{const n=Qs(e);return D.useCallback(()=>{n&&t({type:b.Hydrate,payload:n})},[t,n])},Ng=(e,t,n)=>D.useCallback((i,o,s,l=!0)=>{i.preventDefault(),t.quizResults&&(l&&Gf(e,t.quizResults,o,s,"add_to_wishlist"),Bn(n)&&n(o))},[t,e,n]),Tg=(e,t,n,r)=>D.useCallback(()=>{var l;const o=(l=e.quizCurrentQuestion)==null?void 0:l.next_question,s=o==null?void 0:o.id;if(n&&s){(o==null?void 0:o.type)!=="cover"&&n({type:b.Skip,payload:e.quizCurrentQuestion});const u={...t.answerInputs[s],value:(o==null?void 0:o.type)==="open"?"false":null};o&&Bn(r)&&r({...o,answer:u})}},[n,r,e.quizCurrentQuestion,t.answerInputs]),qg=(e,t,n)=>{const{quizApiState:r,dispatchLocalState:i,dispatchApiState:o,quizLocalState:s,quizSessionStorageState:l}=n,{resultsPageOptions:u,callbacks:c}=e,{onAddToCartClick:v,onQuizResultClick:_,onQuizResultsLoaded:E,onAddToFavoritesClick:x}=u,k=Cg(r,i),a=xg(r,s,i,c==null?void 0:c.onQuizNextQuestion),h=Tg(r,s,i,c==null?void 0:c.onQuizSkipQuestion),d=Eg(r,i),f=Sg(t,r,v),p=kg(t,r,_),g=Ng(t,r,x);wg(t,r,E);const m=Rg(na(l.key),i,o,r.quizResults),S=zg(l.key,i);return{addToCart:f,addToFavorites:g,resultClick:p,quizAnswerChanged:k,previousQuestion:d,nextQuestion:a,skipQuestion:h,resetQuiz:m,hydrateQuiz:S,resetSessionStorageState:na(l.key)}},Yf={quizRequestState:Pt.Stale};function Pg(e,t){var n,r,i,o,s,l,u,c,v,_,E;switch(t.type){case Ke.SET_IS_LOADING:return{...e,quizRequestState:Pt.Loading,quizCurrentQuestion:void 0,quizResults:void 0};case Ke.SET_IS_ERROR:return{...e,quizRequestState:Pt.Error,quizCurrentQuestion:void 0,quizResults:void 0,selectedOptionsWithAttributes:void 0};case Ke.SET_CURRENT_QUESTION:{const{isOpenQuestion:x,isCoverQuestion:k,isSingleQuestion:a,isMultipleQuestion:h,isSelectQuestion:d}=Df((i=(r=(n=t.payload)==null?void 0:n.quizCurrentQuestion)==null?void 0:r.next_question)==null?void 0:i.type),f=e.quizFirstQuestion||((o=t.payload)==null?void 0:o.quizCurrentQuestion);return{...e,quizRequestState:Pt.Success,quizCurrentQuestion:{...(s=t.payload)==null?void 0:s.quizCurrentQuestion,isFirstQuestion:((l=f==null?void 0:f.next_question)==null?void 0:l.id)===((v=(c=(u=t.payload)==null?void 0:u.quizCurrentQuestion)==null?void 0:c.next_question)==null?void 0:v.id),isOpenQuestion:x,isCoverQuestion:k,isSingleQuestion:a,isMultipleQuestion:h,isSelectQuestion:d},quizFirstQuestion:f,quizResults:void 0,selectedOptionsWithAttributes:void 0}}case Ke.SET_QUIZ_RESULTS:{const x=((_=t.payload)==null?void 0:_.quizResults.quiz_selected_options.filter(k=>k.has_attribute).map(k=>k.value))||[];return{...e,quizRequestState:Pt.Success,quizResults:(E=t.payload)==null?void 0:E.quizResults,quizCurrentQuestion:void 0,selectedOptionsWithAttributes:x}}case Ke.RESET_QUIZ:return Yf;default:return e}}const Ig=(e,t,n,r,i)=>{const[o,s]=D.useReducer(Pg,Yf),{quizId:l,quizVersionId:u,resultsPageOptions:c}=e,v=async()=>{try{const _=await sg(t,l,{answers:n.answers,resultsPerPage:c==null?void 0:c.numResultsToDisplay,quizVersionId:n.quizVersionId,quizSessionId:n.quizSessionId});s({type:Ke.SET_QUIZ_RESULTS,payload:{quizResults:_}}),n.isQuizCompleted||i({type:b.Complete})}catch{s({type:Ke.SET_IS_ERROR})}};return D.useEffect(()=>{(async()=>{if(s({type:Ke.SET_IS_LOADING}),n.isLastAnswer||r)await v();else try{const _=n.quizVersionId||u,{quizSessionId:E}=n,x=await og(t,l,{answers:n.answers,quizVersionId:_,quizSessionId:E});if(!x.next_question){await v();return}(!E&&(x!=null&&x.quiz_session_id)||!_&&x.quiz_version_id)&&i({type:b.Hydrate,payload:{quizVersionId:x==null?void 0:x.quiz_version_id,quizSessionId:x==null?void 0:x.quiz_session_id}}),s({type:Ke.SET_CURRENT_QUESTION,payload:{quizCurrentQuestion:x}})}catch{s({type:Ke.SET_IS_ERROR})}})()},[t,l,n.answers,c==null?void 0:c.numResultsToDisplay]),{quizApiState:o,dispatchApiState:s}},Xf={answers:[],answerInputs:{},prevAnswerInputs:{},isLastAnswer:!1,isQuizCompleted:!1};function Gr(e,t){return{...e,[String(t.payload.questionId)]:{type:t.type,value:t.payload.input}}}function Og(e,t){var n,r,i,o,s;switch(t.type){case b.OpenText:return{...e,answerInputs:Gr(e.answerInputs,t),isLastAnswer:!!((n=t.payload)!=null&&n.isLastQuestion),isQuizCompleted:!1};case b.Cover:return{...e,answerInputs:Gr(e.answerInputs,t),isLastAnswer:!!((r=t.payload)!=null&&r.isLastQuestion),isQuizCompleted:!1};case b.SingleSelect:return{...e,answerInputs:Gr(e.answerInputs,t),isLastAnswer:!!((i=t.payload)!=null&&i.isLastQuestion),isQuizCompleted:!1};case b.MultipleSelect:return{...e,answerInputs:Gr(e.answerInputs,t),isLastAnswer:!!((o=t.payload)!=null&&o.isLastQuestion),isQuizCompleted:!1};case b.Next:{const{answers:l,answerInputs:u}=e,c=[...l],v=l.length,_=(s=Object.values(e.answerInputs))==null?void 0:s[v];switch(_.type){case b.OpenText:c.push(["true"]);break;case b.Cover:c.push(["seen"]);break;case b.SingleSelect:c.push(_.value);break;case b.MultipleSelect:c.push(_.value);break;default:c.push([])}return{...e,prevAnswerInputs:u,answers:c,isQuizCompleted:!1}}case b.Skip:{const{answers:l,answerInputs:u}=e,c=[...l],v=l.length;switch(Object.values(e.answerInputs)[v].type){case b.OpenText:c.push(["false"]);break;case b.Cover:c.push(["seen"]);break;case b.SingleSelect:case b.MultipleSelect:default:c.push([])}return{...e,prevAnswerInputs:u,answers:c,isQuizCompleted:!1}}case b.Back:{const l={...e.prevAnswerInputs};return{...e,answerInputs:l,answers:[...e.answers.slice(0,-1)],isLastAnswer:!1,isQuizCompleted:!1}}case b.Reset:return{...Xf};case b.Hydrate:return{...e,...t.payload};case b.Complete:return{...e,isQuizCompleted:!0};default:return e}}const Ag=()=>{const[e,t]=D.useReducer(Og,Xf),n=D.useCallback(r=>{kh(r),t(r)},[]);return{quizLocalState:e,dispatchLocalState:n}},Lg=(e,t,n)=>{var o;const r=(t==null?void 0:t.sessionStateKey)||jh;return D.useEffect(()=>{var s,l;n&&((s=e==null?void 0:e.answers)!=null&&s.length)&&((l=window==null?void 0:window.sessionStorage)==null||l.setItem(r,JSON.stringify(e)))},[e,r,n]),{skipToResults:!!n&&!!((o=Qs(r))!=null&&o.isQuizCompleted)&&!(t!=null&&t.showSessionModalOnResults),quizSessionStorageStateKey:r,hasSessionStorageState:()=>Qs(r)!==null}},Bg=(e,t)=>{const{sessionStateOptions:n,enableHydration:r}=e,{quizLocalState:i,dispatchLocalState:o}=Ag(),{skipToResults:s,quizSessionStorageStateKey:l,hasSessionStorageState:u}=Lg(i,n,r===void 0?!0:r),{quizApiState:c,dispatchApiState:v}=Ig(e,t,i,s,o);return{quizApiState:c,quizLocalState:i,dispatchApiState:v,dispatchLocalState:o,quizSessionStorageState:{skipToResults:s,key:l,hasSessionStorageState:u}}},Ug=e=>{const{apiKey:t,cioJsClient:n,primaryColor:r,resultsPageOptions:{favoriteItems:i}}=e;cg(e);const o=ag({apiKey:t,cioJsClient:n}),s=Bg(e,o),l=qg(e,o,s),{quizApiState:u,quizLocalState:c,quizSessionStorageState:v}=s,{skipToResults:_}=v,E=mg(l,u,c,i),x=_g(r);return D.useEffect(()=>{_&&l.hydrateQuiz()},[]),{cioClient:o,state:{answers:{inputs:c.answerInputs,isLastAnswer:c.isLastAnswer},quiz:{requestState:u.quizRequestState,versionId:c.quizVersionId,sessionId:c.quizSessionId,currentQuestion:u.quizCurrentQuestion,results:u.quizResults,selectedOptionsWithAttributes:u.selectedOptionsWithAttributes},quizSessionStorageState:v},events:{...l},...E,primaryColorStyles:x}};function Mg({continueSession:e,resetStoredState:t,setShowSessionPrompt:n,showSessionPrompt:r}){const i=()=>{t(),n(!1)};if(r){const o=()=>({className:"cio-question-cta-button",onClick:()=>{e(),n(!1)}}),s=()=>({className:"cio-question-cta-button",onClick:()=>{t(),n(!1)}});return I.createElement("div",{className:"cio-session-prompt-modal",role:"presentation",onClick:i},I.createElement("div",{className:"cio-session-prompt-container"},I.createElement("div",{className:"cio-session-prompt-content",role:"presentation",onClick:l=>l.stopPropagation()},I.createElement("div",null,"Do you want to continue where you left off?"),I.createElement("div",{className:"cio-session-prompt-controls-container"},I.createElement(Pi,{ctaText:"No",type:"button",propsGetters:s}),I.createElement(Pi,{type:"button",ctaText:"Yes",propsGetters:o})))))}return null}function Fg(){const{state:e}=D.useContext(Re),t=e==null?void 0:e.quiz.currentQuestion;return t!=null&&t.next_question?I.createElement("div",{className:"cio-question-progress-affixed-container"},I.createElement("div",{className:"cio-question-progress-progress-container"},I.createElement("div",{className:"cio-question-progress-progress-bar",style:{width:`${(t.next_question.id-1)/t.total_questions*100}%`}}))):null}function jg(e){var j;const{cioClient:t,state:n,events:{hydrateQuiz:r,resetSessionStorageState:i},getAddToCartButtonProps:o,getAddToFavoritesButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:c,getSkipQuestionButtonProps:v,getOpenTextInputProps:_,getPreviousQuestionButtonProps:E,getQuizImageProps:x,getQuizResultButtonProps:k,getQuizResultLinkProps:a,getResetQuizButtonProps:h,getSelectInputProps:d,primaryColorStyles:f}=Ug(e),[p,g]=D.useState(!1),{resultsPageOptions:m,sessionStateOptions:S}=e,{quizSessionStorageState:{hasSessionStorageState:w,skipToResults:y}}=n;D.useEffect(()=>{(S==null?void 0:S.showSessionModal)!==void 0?g((S==null?void 0:S.showSessionModal)&&w()&&!y):g(w()&&!y)},[]);const N={cioClient:t,state:n,getAddToCartButtonProps:o,getAddToFavoritesButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:c,getSkipQuestionButtonProps:v,getOpenTextInputProps:_,getPreviousQuestionButtonProps:E,getQuizImageProps:x,getQuizResultButtonProps:k,getQuizResultLinkProps:a,getResetQuizButtonProps:h,getSelectInputProps:d,customClickItemCallback:!!(m!=null&&m.onQuizResultClick),customAddToFavoritesCallback:!!(m!=null&&m.onAddToFavoritesClick),primaryColorStyles:f};if(n.quiz.requestState===Pt.Loading)return I.createElement("div",{className:"cio-quiz cio-quiz-loading"},I.createElement(Hf,null));const C=(j=n.quiz.currentQuestion)==null?void 0:j.next_question,q=C==null?void 0:C.type,T=C==null?void 0:C.images,O=(q==="single"||q==="multiple")&&T;return n.quiz.requestState===Pt.Success?I.createElement("div",{className:"cio-quiz"},O&&lo(T,"cio-question-background-image"),I.createElement("style",null,".cio-quiz ",Eh(f)),I.createElement(Mg,{resetStoredState:i,continueSession:r,showSessionPrompt:p,setShowSessionPrompt:g}),I.createElement(Re.Provider,{value:N},n.quiz.results||y?I.createElement(Bh,{options:m}):n.quiz.currentQuestion&&I.createElement(I.Fragment,null,I.createElement(Fg,null),I.createElement(zh,null),I.createElement(Fh,{ctaButtonText:(C==null?void 0:C.cta_text)||void 0})))):null}const Dg=({selector:e,includeCSS:t=!0,...n})=>{if(document){const r=document.getElementById("cio-quizzes-styles"),i=document.querySelector(e);if(!i){console.error("CioQuiz: There were no elements found for the provided selector");return}r&&(t?r.disabled=!1:r.disabled=!0),Yo.createRoot(i).render(I.createElement(I.StrictMode,null,I.createElement(jg,{...n})))}};window&&(window.CioQuiz=Dg);export{Dg as default};
|
|
46
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Fv)),bi}var Pa;function Dv(){return Pa||(Pa=1,function(e){var t=Av(),n=Bv(),r=Mv(),i=jv();function o(s){return t(s)||n(s)||r(s)||i()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}(Pv)),ji}var Go,Ia;function Hv(){if(Ia)return Go;Ia=1;var e=He,t=e(ft()),n=e(dt()),r=e(Dv()),i=e(qr()),o=Un(),s=pt();function l(c,v,_,E){var x=_.apiKey,k=_.clientId,a=_.sessionId,h=_.segments,d=_.userId,f=_.version,p=_.quizzesServiceUrl,g={c:f},m="";if(g.key=x,g.i=k,g.s=a,h&&h.length&&(g.us=h),d&&(g.ui=String(d)),!c||typeof c!="string")throw new Error("quizId is a required parameter of type string");if(E==="results"&&((0,i.default)(v.answers)!=="object"||!Array.isArray(v.answers)||v.answers.length===0))throw new Error("answers is a required parameter of type array");if(v){var S=v.section,w=v.answers,y=v.quizSessionId,N=v.quizVersionId,C=v.page,q=v.resultsPerPage,T=v.filters;S&&(g.section=S),N&&(g.quiz_version_id=N),y&&(g.quiz_session_id=y),w&&w.length&&(m="&".concat(s.stringify({a:w.map(function(j){return(0,r.default)(j).join(",")})}))),s.isNil(C)||(g.page=C),s.isNil(q)||(g.num_results_per_page=q),T&&(g.filters=T)}g._dt=Date.now(),g=s.cleanParams(g);var O=s.stringify(g);return"".concat(p,"/v1/quizzes/").concat(encodeURIComponent(c),"/").concat(encodeURIComponent(E),"/?").concat(O).concat(m)}var u=function(){function c(v){(0,t.default)(this,c),this.options=v||{},this.eventDispatcher=new o(v.eventDispatcher)}return(0,n.default)(c,[{key:"getQuizNextQuestion",value:function(_,E){var x=this,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,d=new AbortController,f=d.signal;try{a=l(_,E,this.options,"next")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,k,d),h(a,{signal:f}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return x.eventDispatcher.queue("quizzes.getQuizNextQuestion.completed",p),p;throw new Error("getQuizNextQuestion response data is malformed")})}},{key:"getQuizResults",value:function(_,E){var x=this,k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a,h=this.options.fetch,d=new AbortController,f=d.signal;try{a=l(_,E,this.options,"results")}catch(p){return Promise.reject(p)}return s.applyNetworkTimeout(this.options,k,d),h(a,{signal:f}).then(function(p){return p.ok?p.json():s.throwHttpErrorFromResponse(new Error,p)}).then(function(p){if(p.quiz_version_id)return x.eventDispatcher.queue("quizzes.getQuizResults.completed",p),p;throw new Error("getQuizResults response data is malformed")})}}]),c}();return Go=u,Go}var Wf=He,Vv=Wf(ft()),Qv=Wf(dt()),bv=Xh(),Wv=Zh(),Kv=rv(),Gv=ov(),Yv=sv(),Xv=lv(),Kf=pv(),Jv=Un(),Hl=pt(),Zv=qv,$v=Zv.version,eg=Hv(),tg=function(){var t="ciojs-client-",n=[];return Hl.canUseDOM()||n.push("domless"),typeof process<"u"&&typeof process.env<"u"&&{}.BUNDLED&&n.push("bundled"),"".concat(t).concat(n.join("-")).concat(n.length?"-":"").concat($v)},Vl=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,Vv.default)(this,e);var n=t.apiKey,r=t.version,i=t.serviceUrl,o=t.quizzesServiceUrl,s=t.segments,l=t.testCells,u=t.clientId,c=t.sessionId,v=t.userId,_=t.fetch,E=t.trackingSendDelay,x=t.sendReferrerWithTrackingEvents,k=t.sendTrackingEvents,a=t.eventDispatcher,h=t.idOptions,d=t.beaconMode,f=t.networkParameters;if(!n||typeof n!="string")throw new Error("API key is a required parameter of type string");var p,g,m=typeof It<"u"&&It.CLIENT_VERSION;if(Hl.canUseDOM()){var S=new bv(h||{});p=S.session_id,g=S.client_id}else{if(!c||typeof c!="number")throw new Error("sessionId is a required user parameter of type number");if(!u||typeof u!="string")throw new Error("clientId is a required user parameter of type string")}this.options={apiKey:n,version:r||m||tg(),serviceUrl:i&&i.replace(/\/$/,"")||"https://ac.cnstrc.com",quizzesServiceUrl:o&&o.replace(/\/$/,"")||"https://quizzes.cnstrc.com",sessionId:c||p,clientId:u||g,userId:v,segments:s,testCells:l,fetch:_||Wv({Promise}).fetch,trackingSendDelay:E,sendTrackingEvents:k,sendReferrerWithTrackingEvents:x,eventDispatcher:a,beaconMode:d!==!1,networkParameters:f||{}},this.search=new Kv(this.options),this.browse=new Gv(this.options),this.autocomplete=new Yv(this.options),this.recommendations=new Xv(this.options),this.tracker=new Kf(this.options),this.quizzes=new eg(this.options),new Jv(t.eventDispatcher).queue("instantiated",this.options)}return(0,Qv.default)(e,[{key:"setClientOptions",value:function(n){if(Object.keys(n).length){var r=n.apiKey,i=n.segments,o=n.testCells,s=n.userId;r&&(this.options.apiKey=r),i&&(this.options.segments=i),o&&(this.options.testCells=o),s&&(this.options.userId=s)}}}]),e}();Vl.Tracker=Kf;Hl.canUseDOM()&&(window.ConstructorioClient=Vl);var ng=Vl;const rg="1.9.2",ig=e=>{if(e)return new ng({apiKey:e,sendTrackingEvents:!0,version:`cio-ui-quizzes-${rg}`})},og=(e,t,n)=>e==null?void 0:e.quizzes.getQuizNextQuestion(t,n),sg=async(e,t,n)=>e==null?void 0:e.quizzes.getQuizResults(t,n),lg=(e,t)=>{var c;const{quiz_id:n,quiz_session_id:r,quiz_version_id:i,result_id:o,request:s,response:l}=t,u=(c=l==null?void 0:l.results)==null?void 0:c.map(v=>{var _,E;return{itemId:(_=v==null?void 0:v.data)==null?void 0:_.id,variationId:(E=v==null?void 0:v.data)==null?void 0:E.variation_id,itemName:v==null?void 0:v.value}});e==null||e.tracker.trackQuizResultsLoaded({quizId:n,quizVersionId:i,quizSessionId:r,url:window.location.href,section:s==null?void 0:s.section,resultCount:l==null?void 0:l.total_num_results,resultPage:s==null?void 0:s.page,resultId:o,items:u})},ug=(e,t,n,r)=>{var i;if(t.request&&t.response){const{quiz_id:o,quiz_session_id:s,quiz_version_id:l,result_id:u,request:{section:c,page:v,num_results_per_page:_},response:{total_num_results:E}}=t;e==null||e.tracker.trackQuizResultClick({quizId:o,quizVersionId:l,quizSessionId:s,itemId:(i=n.data)==null?void 0:i.id,itemName:n==null?void 0:n.value,section:c,resultCount:E,resultPage:v,resultId:u,resultPositionOnPage:r,numResultsPerPage:_})}},Gf=(e,t,n,r,i)=>{var o,s;if(t.request){const{quiz_id:l,quiz_session_id:u,quiz_version_id:c,request:{section:v}}=t;e==null||e.tracker.trackQuizConversion({quizId:l,quizVersionId:c,quizSessionId:u,itemId:(o=n.data)==null?void 0:o.id,itemName:n.value,section:v,variationId:(s=n.data)==null?void 0:s.variation_id,revenue:r&&String(r)||void 0,type:i})}},ag=({apiKey:e,cioJsClient:t})=>{if(!e&&!t)throw new Error("Either apiKey or cioJsClient is required");return D.useMemo(()=>t||ig(e),[e,t])},cg=e=>{const{quizId:t,resultsPageOptions:n}=e;D.useEffect(()=>{t||console.error("quizId is a required field of type string"),(!n||Object.keys(n).length===0)&&console.error("resultsPageOptions is a required field of type object"),n&&!(n!=null&&n.onAddToCartClick)&&console.error("resultsPageOptions.onAddToCartClick is a required field of type function")},[t,n,n==null?void 0:n.onAddToCartClick])};function fg(e,t,n,r){var E;const i=n==null?void 0:n.type,o=(E=n==null?void 0:n.options)==null?void 0:E.some(x=>x.images),[s,l]=D.useState({}),u=D.useRef({}),c=D.useCallback(x=>{if(i===b.SingleSelect)u.current=!0,l({[x]:!0});else if(i===b.MultipleSelect)if(s[x]){const k={...s};delete k[x],l(k)}else l({...s,[x]:!0})},[s,i]),v=(x,k)=>{((x==null?void 0:x.key)===" "||(x==null?void 0:x.key)==="Enter")&&c(k)};return D.useEffect(()=>{var x;if(n!=null&&n.type){const k=n.id,a=r==null?void 0:r[k],h={};Array.isArray(a==null?void 0:a.value)&&((x=a==null?void 0:a.value)==null||x.forEach(d=>{h[Number(d)]=!0,l(h)}))}return u.current=!1,function(){l({})}},[n==null?void 0:n.id]),D.useEffect(()=>{if((n==null?void 0:n.type)==="multiple"||(n==null?void 0:n.type)==="single"){const x=Object.keys(s).filter(k=>s[Number(k)]);e(x)}},[s,n==null?void 0:n.id,n==null?void 0:n.type,e]),D.useEffect(()=>{(n==null?void 0:n.type)==="single"&&u.current&&t()},[r]),D.useCallback(x=>({className:`${o?"cio-question-option-container":"cio-question-option-container-text-only"} ${s[x.id]?"selected":""}`,onClick:()=>{c(x.id)},onKeyDown:k=>{v(k,x.id)},role:"button",tabIndex:0,key:x.id}),[n==null?void 0:n.id,s])}function dg(e,t){return D.useEffect(()=>{(t==null?void 0:t.type)==="cover"&&e("")},[e,t]),D.useCallback(()=>({}),[])}function pg(e,t,n,r){const[i,o]=D.useState(""),s=D.useCallback(c=>{o(c.target.value)},[]),l=D.useCallback(c=>{const{key:v}=c;v==="Enter"&&i&&(n==null?void 0:n.type)==="open"&&t()},[n==null?void 0:n.type,i,t]);return D.useEffect(()=>{(n==null?void 0:n.type)==="open"&&e(i)},[i,n==null?void 0:n.type,n==null?void 0:n.id,e]),D.useEffect(()=>{var c;if(r&&(n!=null&&n.id)){const v=(c=r[n.id])==null?void 0:c.value;o(v||"")}},[n==null?void 0:n.id]),D.useCallback(()=>({className:"cio-question-input-text",placeholder:(n==null?void 0:n.input_placeholder)||"Answer here...",value:i,onChange:s,onKeyDown:l}),[n==null?void 0:n.input_placeholder,n==null?void 0:n.id,i,l])}function hg(e,t,n){return D.useCallback(()=>{var s,l,u,c,v,_;const i=(l=(s=t.quizCurrentQuestion)==null?void 0:s.next_question)==null?void 0:l.id;let o;return i&&!((u=t.quizCurrentQuestion)!=null&&u.isCoverQuestion)&&(o=!((c=n.answerInputs[i])!=null&&c.value)||!((_=(v=n.answerInputs[i])==null?void 0:v.value)!=null&&_.length)),{className:o?"cio-question-cta-button disabled":"cio-question-cta-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,n.answerInputs,e])}function vg(e,t){return D.useCallback(()=>{var i;return{title:"Quiz Back Button",role:"button",className:`cio-question-back-button ${((i=e.quizCurrentQuestion)==null?void 0:i.isFirstQuestion)?"disabled":""}`,type:"button",onClick:()=>t()}},[e,t])}function gg(e,t){const n=i=>{var o,s;return((o=i==null?void 0:i.data)==null?void 0:o.id)&&(t==null?void 0:t.includes((s=i==null?void 0:i.data)==null?void 0:s.id))};return D.useCallback((i,o)=>({className:`cio-result-card-favorites-button ${n(i)?"favorited":""}`,onClick:s=>{e(s,i,o,!n(i))},type:"button"}),[e])}function yg(e,t){return D.useCallback(()=>{var o,s,l,u;return{className:((s=(o=t.quizCurrentQuestion)==null?void 0:o.next_question)==null?void 0:s.id)&&(((l=t.quizCurrentQuestion)==null?void 0:l.isCoverQuestion)||!((u=t.quizCurrentQuestion)!=null&&u.next_question.is_skippable))?"cio-question-skip-button hide":"cio-question-skip-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,e])}const mg=(e,t,n,r)=>{var T,O,j;const{quizAnswerChanged:i,nextQuestion:o,skipQuestion:s,previousQuestion:l,resetQuiz:u,hydrateQuiz:c,addToCart:v,addToFavorites:_,resultClick:E}=e,x=pg(i,o,(T=t.quizCurrentQuestion)==null?void 0:T.next_question,n.answerInputs),k=dg(i,(O=t.quizCurrentQuestion)==null?void 0:O.next_question),a=fg(i,o,(j=t.quizCurrentQuestion)==null?void 0:j.next_question,n.answerInputs),h=hg(o,t,n),d=yg(s,t),f=vg(t,l),p=D.useCallback((M="primary")=>({className:M==="primary"?"cio-question-cta-button":"cio-question-redo-button",type:"button",onClick:()=>u()}),[u]),g=D.useCallback(()=>({className:"",type:"button",onClick:()=>c()}),[c]),m=D.useCallback((M,B)=>({className:"cio-result-card-cta-button",type:"button",onClick:R=>v(R,M,B)}),[v]),S=gg(_,r),w=D.useCallback((M,B,R)=>{((M==null?void 0:M.key)===" "||(M==null?void 0:M.key)==="Enter")&&E&&E(B,R)},[E]),y=D.useCallback(({result:M,position:B})=>({className:"cio-result-card-container",role:"button",tabIndex:0,onClick:()=>E(M,B),onKeyDown:R=>w(R,M,B)}),[w,E]),N=D.useCallback(({result:M,position:B})=>{var R;return{href:(R=M.data)==null?void 0:R.url,onClick:()=>E(M,B),onKeyDown:z=>w(z,M,B)}},[w,E]),C=D.useCallback(()=>{var M,B,R,z,P,A;return{src:((R=(B=(M=t.quizCurrentQuestion)==null?void 0:M.next_question)==null?void 0:B.images)==null?void 0:R.primary_url)||void 0,alt:((A=(P=(z=t.quizCurrentQuestion)==null?void 0:z.next_question)==null?void 0:P.images)==null?void 0:A.primary_alt)||void 0}},[t.quizCurrentQuestion]),q=D.useCallback(M=>{var B,R;return{className:"cio-question-option-image",src:((B=M==null?void 0:M.images)==null?void 0:B.primary_url)||void 0,alt:((R=M==null?void 0:M.images)==null?void 0:R.primary_alt)||void 0}},[]);return{getOpenTextInputProps:x,getNextQuestionButtonProps:h,getPreviousQuestionButtonProps:f,getQuizImageProps:C,getSelectQuestionImageProps:q,getSelectInputProps:a,getCoverQuestionProps:k,getResetQuizButtonProps:p,getHydrateQuizButtonProps:g,getAddToCartButtonProps:m,getAddToFavoritesButtonProps:S,getQuizResultButtonProps:y,getQuizResultLinkProps:N,getSkipQuestionButtonProps:d}},_g=e=>D.useMemo(()=>{var r;let n={"--primary-color-h":"227","--primary-color-s":"70%","--primary-color-l":"46%"};if(e){const i=/^\s*\(?(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\)?/,o=(r=e.trim().match(i))==null?void 0:r.slice(1);if(o&&o.length===3){const[s,l,u]=o,[c,v,_]=Sh(Number(s),Number(l),Number(u));n={"--primary-color-h":`${c}`,"--primary-color-s":`${v}%`,"--primary-color-l":`${_}%`}}}return n},[e]),wg=(e,t,n)=>{D.useEffect(()=>{var r;t.quizResults&&(lg(e,t.quizResults),n&&Bn(n)&&((r=t.quizResults.response)!=null&&r.results)&&n(t.quizResults.response.results))},[t,e,n])},kg=(e,t,n)=>D.useCallback((i,o)=>{t.quizResults&&(ug(e,t.quizResults,i,o),Bn(n)&&n(i,o))},[t,e,n]),Sg=(e,t,n)=>D.useCallback((i,o,s)=>{i.preventDefault(),t.quizResults&&(Gf(e,t.quizResults,o,s),Bn(n)&&n(o))},[t,e,n]),Eg=(e,t)=>D.useCallback(()=>{t&&t({type:b.Back,payload:e.quizCurrentQuestion})},[t,e.quizCurrentQuestion]),Cg=(e,t)=>D.useCallback(r=>{var s,l;const i=(l=(s=e.quizCurrentQuestion)==null?void 0:s.next_question)==null?void 0:l.type,o=e.quizCurrentQuestion;if(o!=null&&o.next_question)switch(i){case b.Cover:t({type:b.Cover,payload:{questionId:o.next_question.id,input:"",isLastQuestion:o.is_last_question}});break;case b.OpenText:t({type:b.OpenText,payload:{questionId:o.next_question.id,input:r,isLastQuestion:o.is_last_question}});break;case b.SingleSelect:case b.MultipleSelect:t({type:o.next_question.type,payload:{questionId:o.next_question.id,input:r,isLastQuestion:o.is_last_question}});break}},[e,t]),xg=(e,t,n,r)=>D.useCallback(()=>{var l,u;const o=(l=e.quizCurrentQuestion)==null?void 0:l.next_question,s=o==null?void 0:o.id;if(n&&s){const c=t.answerInputs[s];((u=c==null?void 0:c.value)!=null&&u.length||(o==null?void 0:o.type)==="cover")&&n({type:b.Next,payload:e.quizCurrentQuestion}),o&&Bn(r)&&r({...o,answer:c})}},[n,e.quizCurrentQuestion,t.answerInputs,r]),Rg=(e,t,n,r)=>D.useCallback(()=>{r&&(t({type:b.Reset}),n({type:Ke.RESET_QUIZ}),e())},[t,n,e,r]),zg=(e,t)=>{const n=Qs(e);return D.useCallback(()=>{n&&t({type:b.Hydrate,payload:n})},[t,n])},Ng=(e,t,n)=>D.useCallback((i,o,s,l=!0)=>{i.preventDefault(),t.quizResults&&(l&&Gf(e,t.quizResults,o,s,"add_to_wishlist"),Bn(n)&&n(o))},[t,e,n]),Tg=(e,t,n,r)=>D.useCallback(()=>{var l;const o=(l=e.quizCurrentQuestion)==null?void 0:l.next_question,s=o==null?void 0:o.id;if(n&&s){(o==null?void 0:o.type)!=="cover"&&n({type:b.Skip,payload:e.quizCurrentQuestion});const u={...t.answerInputs[s],value:(o==null?void 0:o.type)==="open"?"false":null};o&&Bn(r)&&r({...o,answer:u})}},[n,r,e.quizCurrentQuestion,t.answerInputs]),qg=(e,t,n)=>{const{quizApiState:r,dispatchLocalState:i,dispatchApiState:o,quizLocalState:s,quizSessionStorageState:l}=n,{resultsPageOptions:u,callbacks:c}=e,{onAddToCartClick:v,onQuizResultClick:_,onQuizResultsLoaded:E,onAddToFavoritesClick:x}=u,k=Cg(r,i),a=xg(r,s,i,c==null?void 0:c.onQuizNextQuestion),h=Tg(r,s,i,c==null?void 0:c.onQuizSkipQuestion),d=Eg(r,i),f=Sg(t,r,v),p=kg(t,r,_),g=Ng(t,r,x);wg(t,r,E);const m=Rg(na(l.key),i,o,r.quizResults),S=zg(l.key,i);return{addToCart:f,addToFavorites:g,resultClick:p,quizAnswerChanged:k,previousQuestion:d,nextQuestion:a,skipQuestion:h,resetQuiz:m,hydrateQuiz:S,resetSessionStorageState:na(l.key)}},Yf={quizRequestState:Pt.Stale};function Pg(e,t){var n,r,i,o,s,l,u,c,v,_,E;switch(t.type){case Ke.SET_IS_LOADING:return{...e,quizRequestState:Pt.Loading,quizCurrentQuestion:void 0,quizResults:void 0};case Ke.SET_IS_ERROR:return{...e,quizRequestState:Pt.Error,quizCurrentQuestion:void 0,quizResults:void 0,selectedOptionsWithAttributes:void 0};case Ke.SET_CURRENT_QUESTION:{const{isOpenQuestion:x,isCoverQuestion:k,isSingleQuestion:a,isMultipleQuestion:h,isSelectQuestion:d}=Df((i=(r=(n=t.payload)==null?void 0:n.quizCurrentQuestion)==null?void 0:r.next_question)==null?void 0:i.type),f=e.quizFirstQuestion||((o=t.payload)==null?void 0:o.quizCurrentQuestion);return{...e,quizRequestState:Pt.Success,quizCurrentQuestion:{...(s=t.payload)==null?void 0:s.quizCurrentQuestion,isFirstQuestion:((l=f==null?void 0:f.next_question)==null?void 0:l.id)===((v=(c=(u=t.payload)==null?void 0:u.quizCurrentQuestion)==null?void 0:c.next_question)==null?void 0:v.id),isOpenQuestion:x,isCoverQuestion:k,isSingleQuestion:a,isMultipleQuestion:h,isSelectQuestion:d},quizFirstQuestion:f,quizResults:void 0,selectedOptionsWithAttributes:void 0}}case Ke.SET_QUIZ_RESULTS:{const x=((_=t.payload)==null?void 0:_.quizResults.quiz_selected_options.filter(k=>k.has_attribute).map(k=>k.value))||[];return{...e,quizRequestState:Pt.Success,quizResults:(E=t.payload)==null?void 0:E.quizResults,quizCurrentQuestion:void 0,selectedOptionsWithAttributes:x}}case Ke.RESET_QUIZ:return Yf;default:return e}}const Ig=(e,t,n,r,i)=>{const[o,s]=D.useReducer(Pg,Yf),{quizId:l,quizVersionId:u,resultsPageOptions:c}=e,v=async()=>{try{const _=await sg(t,l,{answers:n.answers,resultsPerPage:c==null?void 0:c.numResultsToDisplay,quizVersionId:n.quizVersionId,quizSessionId:n.quizSessionId});s({type:Ke.SET_QUIZ_RESULTS,payload:{quizResults:_}}),n.isQuizCompleted||i({type:b.Complete})}catch{s({type:Ke.SET_IS_ERROR})}};return D.useEffect(()=>{(async()=>{if(s({type:Ke.SET_IS_LOADING}),n.isLastAnswer||r)await v();else try{const _=n.quizVersionId||u,{quizSessionId:E}=n,x=await og(t,l,{answers:n.answers,quizVersionId:_,quizSessionId:E});if(!x.next_question){await v();return}(!E&&(x!=null&&x.quiz_session_id)||!_&&x.quiz_version_id)&&i({type:b.Hydrate,payload:{quizVersionId:x==null?void 0:x.quiz_version_id,quizSessionId:x==null?void 0:x.quiz_session_id}}),s({type:Ke.SET_CURRENT_QUESTION,payload:{quizCurrentQuestion:x}})}catch{s({type:Ke.SET_IS_ERROR})}})()},[t,l,n.answers,c==null?void 0:c.numResultsToDisplay]),{quizApiState:o,dispatchApiState:s}},Xf={answers:[],answerInputs:{},prevAnswerInputs:{},isLastAnswer:!1,isQuizCompleted:!1};function Gr(e,t){return{...e,[String(t.payload.questionId)]:{type:t.type,value:t.payload.input}}}function Og(e,t){var n,r,i,o,s;switch(t.type){case b.OpenText:return{...e,answerInputs:Gr(e.answerInputs,t),isLastAnswer:!!((n=t.payload)!=null&&n.isLastQuestion),isQuizCompleted:!1};case b.Cover:return{...e,answerInputs:Gr(e.answerInputs,t),isLastAnswer:!!((r=t.payload)!=null&&r.isLastQuestion),isQuizCompleted:!1};case b.SingleSelect:return{...e,answerInputs:Gr(e.answerInputs,t),isLastAnswer:!!((i=t.payload)!=null&&i.isLastQuestion),isQuizCompleted:!1};case b.MultipleSelect:return{...e,answerInputs:Gr(e.answerInputs,t),isLastAnswer:!!((o=t.payload)!=null&&o.isLastQuestion),isQuizCompleted:!1};case b.Next:{const{answers:l,answerInputs:u}=e,c=[...l],v=l.length,_=(s=Object.values(e.answerInputs))==null?void 0:s[v];switch(_.type){case b.OpenText:c.push(["true"]);break;case b.Cover:c.push(["seen"]);break;case b.SingleSelect:c.push(_.value);break;case b.MultipleSelect:c.push(_.value);break;default:c.push([])}return{...e,prevAnswerInputs:u,answers:c,isQuizCompleted:!1}}case b.Skip:{const{answers:l,answerInputs:u}=e,c=[...l],v=l.length;switch(Object.values(e.answerInputs)[v].type){case b.OpenText:c.push(["false"]);break;case b.Cover:c.push(["seen"]);break;case b.SingleSelect:case b.MultipleSelect:default:c.push([])}return{...e,prevAnswerInputs:u,answers:c,isQuizCompleted:!1}}case b.Back:{const l={...e.prevAnswerInputs};return{...e,answerInputs:l,answers:[...e.answers.slice(0,-1)],isLastAnswer:!1,isQuizCompleted:!1}}case b.Reset:return{...Xf};case b.Hydrate:return{...e,...t.payload};case b.Complete:return{...e,isQuizCompleted:!0};default:return e}}const Ag=()=>{const[e,t]=D.useReducer(Og,Xf),n=D.useCallback(r=>{kh(r),t(r)},[]);return{quizLocalState:e,dispatchLocalState:n}},Lg=(e,t,n)=>{var o;const r=(t==null?void 0:t.sessionStateKey)||jh;return D.useEffect(()=>{var s,l;n&&((s=e==null?void 0:e.answers)!=null&&s.length)&&((l=window==null?void 0:window.sessionStorage)==null||l.setItem(r,JSON.stringify(e)))},[e,r,n]),{skipToResults:!!n&&!!((o=Qs(r))!=null&&o.isQuizCompleted)&&!(t!=null&&t.showSessionModalOnResults),quizSessionStorageStateKey:r,hasSessionStorageState:()=>Qs(r)!==null}},Bg=(e,t)=>{const{sessionStateOptions:n,enableHydration:r}=e,{quizLocalState:i,dispatchLocalState:o}=Ag(),{skipToResults:s,quizSessionStorageStateKey:l,hasSessionStorageState:u}=Lg(i,n,r===void 0?!0:r),{quizApiState:c,dispatchApiState:v}=Ig(e,t,i,s,o);return{quizApiState:c,quizLocalState:i,dispatchApiState:v,dispatchLocalState:o,quizSessionStorageState:{skipToResults:s,key:l,hasSessionStorageState:u}}},Ug=e=>{const{apiKey:t,cioJsClient:n,primaryColor:r,resultsPageOptions:{favoriteItems:i}}=e;cg(e);const o=ag({apiKey:t,cioJsClient:n}),s=Bg(e,o),l=qg(e,o,s),{quizApiState:u,quizLocalState:c,quizSessionStorageState:v}=s,{skipToResults:_}=v,E=mg(l,u,c,i),x=_g(r);return D.useEffect(()=>{_&&l.hydrateQuiz()},[]),{cioClient:o,state:{answers:{inputs:c.answerInputs,isLastAnswer:c.isLastAnswer},quiz:{requestState:u.quizRequestState,versionId:c.quizVersionId,sessionId:c.quizSessionId,currentQuestion:u.quizCurrentQuestion,results:u.quizResults,selectedOptionsWithAttributes:u.selectedOptionsWithAttributes},quizSessionStorageState:v},events:{...l},...E,primaryColorStyles:x}};function Mg({continueSession:e,resetStoredState:t,setShowSessionPrompt:n,showSessionPrompt:r}){const i=()=>{t(),n(!1)};if(r){const o=()=>({className:"cio-question-cta-button",onClick:()=>{e(),n(!1)}}),s=()=>({className:"cio-question-cta-button",onClick:()=>{t(),n(!1)}});return I.createElement("div",{className:"cio-session-prompt-modal",role:"presentation",onClick:i},I.createElement("div",{className:"cio-session-prompt-container"},I.createElement("div",{className:"cio-session-prompt-content",role:"presentation",onClick:l=>l.stopPropagation()},I.createElement("div",null,"Do you want to continue where you left off?"),I.createElement("div",{className:"cio-session-prompt-controls-container"},I.createElement(Pi,{ctaText:"No",type:"button",propsGetters:s}),I.createElement(Pi,{type:"button",ctaText:"Yes",propsGetters:o})))))}return null}function Fg(){const{state:e}=D.useContext(Re),t=e==null?void 0:e.quiz.currentQuestion;return t!=null&&t.next_question?I.createElement("div",{className:"cio-question-progress-affixed-container"},I.createElement("div",{className:"cio-question-progress-progress-container"},I.createElement("div",{className:"cio-question-progress-progress-bar",style:{width:`${(t.next_question.id-1)/t.total_questions*100}%`}}))):null}function jg(e){var j;const{cioClient:t,state:n,events:{hydrateQuiz:r,resetSessionStorageState:i},getAddToCartButtonProps:o,getAddToFavoritesButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:c,getSkipQuestionButtonProps:v,getOpenTextInputProps:_,getPreviousQuestionButtonProps:E,getQuizImageProps:x,getQuizResultButtonProps:k,getQuizResultLinkProps:a,getResetQuizButtonProps:h,getSelectInputProps:d,primaryColorStyles:f}=Ug(e),[p,g]=D.useState(!1),{resultsPageOptions:m,sessionStateOptions:S}=e,{quizSessionStorageState:{hasSessionStorageState:w,skipToResults:y}}=n;D.useEffect(()=>{(S==null?void 0:S.showSessionModal)!==void 0?g((S==null?void 0:S.showSessionModal)&&w()&&!y):g(w()&&!y)},[]);const N={cioClient:t,state:n,getAddToCartButtonProps:o,getAddToFavoritesButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:c,getSkipQuestionButtonProps:v,getOpenTextInputProps:_,getPreviousQuestionButtonProps:E,getQuizImageProps:x,getQuizResultButtonProps:k,getQuizResultLinkProps:a,getResetQuizButtonProps:h,getSelectInputProps:d,customClickItemCallback:!!(m!=null&&m.onQuizResultClick),customAddToFavoritesCallback:!!(m!=null&&m.onAddToFavoritesClick),primaryColorStyles:f};if(n.quiz.requestState===Pt.Loading)return I.createElement("div",{className:"cio-quiz cio-quiz-loading"},I.createElement(Hf,null));const C=(j=n.quiz.currentQuestion)==null?void 0:j.next_question,q=C==null?void 0:C.type,T=C==null?void 0:C.images,O=(q==="single"||q==="multiple")&&T;return n.quiz.requestState===Pt.Success?I.createElement("div",{className:"cio-quiz"},O&&lo(T,"cio-question-background-image"),I.createElement("style",null,".cio-quiz ",Eh(f)),I.createElement(Mg,{resetStoredState:i,continueSession:r,showSessionPrompt:p,setShowSessionPrompt:g}),I.createElement(Re.Provider,{value:N},n.quiz.results||y?I.createElement(Bh,{options:m}):n.quiz.currentQuestion&&I.createElement(I.Fragment,null,I.createElement(Fg,null),I.createElement(zh,null),I.createElement(Fh,{ctaButtonText:(C==null?void 0:C.cta_text)||void 0})))):null}const Dg=({selector:e,includeCSS:t=!0,...n})=>{if(document){const r=document.getElementById("cio-quizzes-styles"),i=document.querySelector(e);if(!i){console.error("CioQuiz: There were no elements found for the provided selector");return}r&&(t?r.disabled=!1:r.disabled=!0),Yo.createRoot(i).render(I.createElement(I.StrictMode,null,I.createElement(jg,{...n})))}};window&&(window.CioQuiz=Dg);export{Dg as default};
|
package/lib/cjs/package.json
CHANGED
|
@@ -6,8 +6,6 @@ function SkipButton(props) {
|
|
|
6
6
|
const { propsGetters, className = 'cio-button-container' } = props, rest = tslib_1.__rest(props, ["propsGetters", "className"]);
|
|
7
7
|
return (react_1.default.createElement("div", { className: `${className || ''}` }, propsGetters && (
|
|
8
8
|
// eslint-disable-next-line react/button-has-type
|
|
9
|
-
react_1.default.createElement("button", Object.assign({}, rest, propsGetters()),
|
|
10
|
-
"Skip",
|
|
11
|
-
react_1.default.createElement("span", null, " question")))));
|
|
9
|
+
react_1.default.createElement("button", Object.assign({}, rest, propsGetters()), "Skip question"))));
|
|
12
10
|
}
|
|
13
11
|
exports.default = SkipButton;
|
package/lib/mjs/package.json
CHANGED
|
@@ -3,8 +3,6 @@ function SkipButton(props) {
|
|
|
3
3
|
const { propsGetters, className = 'cio-button-container', ...rest } = props;
|
|
4
4
|
return (React.createElement("div", { className: `${className || ''}` }, propsGetters && (
|
|
5
5
|
// eslint-disable-next-line react/button-has-type
|
|
6
|
-
React.createElement("button", { ...rest, ...propsGetters() },
|
|
7
|
-
"Skip",
|
|
8
|
-
React.createElement("span", null, " question")))));
|
|
6
|
+
React.createElement("button", { ...rest, ...propsGetters() }, "Skip question"))));
|
|
9
7
|
}
|
|
10
8
|
export default SkipButton;
|