@constructor-io/constructorio-ui-quizzes 1.4.0 → 1.4.1
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.
- package/dist/constructorio-ui-quizzes-bundled.js +2 -2
- package/lib/cjs/components/RedoButton/RedoButton.js +1 -1
- package/lib/cjs/hooks/usePropsGetters/index.js +2 -2
- package/lib/mjs/components/RedoButton/RedoButton.js +1 -1
- package/lib/mjs/hooks/usePropsGetters/index.js +2 -2
- package/lib/types/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ Error generating stack: `+o.message+`
|
|
|
40
40
|
`,"data-question-key":n.key},i?Fl(n.images,"cio-question-image-container"):"",O.createElement("div",{className:"cio-question-content"},O.createElement(Ul,{title:n.title}),O.createElement(Ml,{description:n.description}),t&&O.createElement("input",{...t()}),O.createElement(Dl,{ctaButtonText:n==null?void 0:n.cta_text})))}return null}function Th(){var r;const{state:e}=D.useContext(Be);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?O.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?Fl(t.images,"cio-question-image-container"):"",O.createElement("div",{className:"cio-question-content"},O.createElement(Ul,{title:t==null?void 0:t.title}),O.createElement(Ml,{description:t.description}),O.createElement(Dl,{ctaButtonText:t==null?void 0:t.cta_text}))):null}function qh(){var o;const{state:e,getSelectInputProps:t}=D.useContext(Be);let n,r=!1,i;return e!=null&&e.quiz.currentQuestion&&(n=e.quiz.currentQuestion.next_question,r=n.options.some(s=>s.images),i=n.type===Y.MultipleSelect&&"Select one or more options"),n?O.createElement("div",{className:"cio-select-question-container","data-question-key":n.key},O.createElement("div",{className:"cio-select-question-text"},O.createElement(Ul,{title:n.title}),n!=null&&n.description?O.createElement(Ml,{description:n.description}):""),i&&O.createElement("div",{className:"cio-select-question-instructions"},i),O.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&&O.createElement("div",{...t(s)},s.images?Fl(s.images,"cio-question-option-image"):"",O.createElement("div",{className:"cio-question-option-value"},s==null?void 0:s.value)))),O.createElement(Dl,{ctaButtonText:(n==null?void 0:n.cta_text)||"Continue"})):null}function Ph(){var r;const{state:e}=D.useContext(Be),t=(r=e==null?void 0:e.quiz.currentQuestion)==null?void 0:r.next_question,n=Df(t==null?void 0:t.type);return O.createElement(O.Fragment,null,n.isOpenQuestion&&O.createElement(Nh,{key:t==null?void 0:t.id}),n.isCoverQuestion&&O.createElement(Th,{key:t==null?void 0:t.id}),n.isSelectQuestion&&O.createElement(qh,{key:t==null?void 0:t.id}))}function Ih(){return O.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},O.createElement("g",{clipPath:"url(#clip0_7495_177230)"},O.createElement("path",{d:"M0.667969 2.66699V6.66699H4.66797",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),O.createElement("path",{d:"M15.332 13.333V9.33301H11.332",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),O.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"})),O.createElement("defs",null,O.createElement("clipPath",{id:"clip0_7495_177230"},O.createElement("rect",{width:"16",height:"16",fill:"white"}))))}function Oh(e){const{redoText:t="Redo Quiz",disabled:n,...r}=e,{getResetQuizButtonProps:i}=D.useContext(Be);return i?O.createElement("button",{...r,...i()},O.createElement(Ih,null),O.createElement("span",null,t)):null}function Lh(){var t;const{state:e}=D.useContext(Be);return O.createElement("div",{className:"cio-results-filter-container"},O.createElement("p",null,"Because you answered"),O.createElement("div",{className:"cio-results-filter-options"},(t=e==null?void 0:e.quiz.resultsFilters)==null?void 0:t.map(n=>O.createElement("div",{className:"cio-results-filter-option",key:n},n))))}function Ah(){const{getResetQuizButtonProps:e}=D.useContext(Be);return O.createElement("div",{className:"cio-zero-results"},O.createElement("h3",{className:"cio-zero-results-subtitle"},"Sorry, it seems like we couldn’t find results based on your answers."),O.createElement("p",{className:"cio-zero-results-description"},"This is embarrassing 😢. It might be that some of the questions are not properly set up from our end. Would you give us another try?"),O.createElement(qi,{ctaText:"Try Again",propsGetters:e}))}function Bh(e){const{item:t,price:n}=e,{getAddToCartButtonProps:r}=D.useContext(Be);return r?O.createElement("button",{...r(t,n)},"Add to Cart"):null}function Uh(e){var R,k;const{result:t,salePriceKey:n,regularPriceKey:r,resultPosition:i}=e,{customClickItemCallback:o,getQuizResultButtonProps:s,getQuizResultLinkProps:l}=D.useContext(Be),u=n&&((R=t==null?void 0:t.data)==null?void 0:R[n]),c=r&&((k=t==null?void 0:t.data)==null?void 0:k[r]),y=()=>{var a;return O.createElement(O.Fragment,null,O.createElement("div",{className:"cio-result-card-image"},O.createElement("img",{src:(a=t.data)==null?void 0:a.image_url,alt:"product"})),O.createElement("div",{className:"cio-result-card-text"},O.createElement("p",{className:"cio-result-card-title"},t.value),O.createElement("div",{className:"cio-result-card-prices"},u&&O.createElement("span",{className:"cio-result-card-sale-price"},"$",u),c&&O.createElement("span",{className:`cio-result-card-regular-price${u?"--strike-through":""}`},"$",c))))},w=()=>s&&O.createElement("div",{...s({result:t,position:i,type:"button"})},y()),C=()=>l&&O.createElement("a",{className:"cio-result-card-anchor",...l({result:t,position:i,type:"link"})},y());return O.createElement("div",{className:"cio-result-card"},o?w():C(),O.createElement(Bh,{item:t,price:u||c}))}function Mh(e){var i,o,s,l;const{resultCardSalePriceKey:t,resultCardRegularPriceKey:n}=e,{state:r}=D.useContext(Be);return O.createElement("div",{className:"cio-results"},(l=(s=(o=(i=r==null?void 0:r.quiz)==null?void 0:i.results)==null?void 0:o.response)==null?void 0:s.results)==null?void 0:l.map((u,c)=>{var y;return O.createElement(Uh,{result:u,key:(y=u.data)==null?void 0:y.id,salePriceKey:t,regularPriceKey:n,resultPosition:c+1})}))}function Fh(e){var l,u,c;const{options:t}=e,{resultCardSalePriceKey:n,resultCardRegularPriceKey:r}=t,{state:i}=D.useContext(Be),o=!((c=(u=(l=i==null?void 0:i.quiz.results)==null?void 0:l.response)==null?void 0:u.results)!=null&&c.length),s=o?"Oops, there are no results":"Here are your results";return i!=null&&i.quiz.results?O.createElement("div",{className:"cio-results-container"},O.createElement("h1",{className:"cio-results-title"},s),O.createElement("div",{className:"cio-results-filter-and-redo-container"},O.createElement(Lh,null),O.createElement(Oh,null)),!o&&O.createElement(Mh,{resultCardSalePriceKey:n,resultCardRegularPriceKey:r}),o&&O.createElement(Ah,null)):O.createElement("div",null,"Loading")}const jh="constructorIOQuizState";var Pt=(e=>(e.Stale="STALE",e.Loading="LOADING",e.Success="SUCCESS",e.Error="ERROR",e))(Pt||{});function Dh(){return O.createElement("div",{className:"cio-spinner"},O.createElement("div",null),O.createElement("div",null),O.createElement("div",null),O.createElement("div",null))}var He={},Hh={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})(Hh);var Pi={},Vh={get exports(){return Pi},set exports(e){Pi=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}(Vh)),Pi}var Ii={},Qh={get exports(){return Ii},set exports(e){Ii=e}},Oi={},Wh={get exports(){return Oi},set exports(e){Oi=e}},Li={},bh={get exports(){return Li},set exports(e){Li=e}},ia;function Tr(){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 Ai={},Kh={get exports(){return Ai},set exports(e){Ai=e}},oa;function Gh(){return oa||(oa=1,function(e){var t=Tr().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}(Kh)),Ai}var sa;function Vf(){return sa||(sa=1,function(e){var t=Tr().default,n=Gh();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}(Wh)),Oi}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}(Qh)),Ii}function Xh(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 Bi={},Yh={get exports(){return Bi},set exports(e){Bi=e}},ua;function Jh(){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],y=Object.getOwnPropertyDescriptor(o,c);y!==void 0&&y.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 Xh<"u"&&(e.exports=t)})()}(Yh)),Bi}var or={},Zh={get exports(){return or},set exports(e){or=e}},aa;function $h(){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,y={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 w(z){return z&&DataView.prototype.isPrototypeOf(z)}if(y.arrayBuffer)var C=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],R=ArrayBuffer.isView||function(z){return z&&C.indexOf(Object.prototype.toString.call(z))>-1};function k(z){if(typeof z!="string"&&(z=String(z)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(z)||z==="")throw new TypeError("Invalid character in header field name");return z.toLowerCase()}function a(z){return typeof z!="string"&&(z=String(z)),z}function h(z){var x={next:function(){var P=z.shift();return{done:P===void 0,value:P}}};return y.iterable&&(x[Symbol.iterator]=function(){return x}),x}function d(z){this.map={},z instanceof d?z.forEach(function(x,P){this.append(P,x)},this):Array.isArray(z)?z.forEach(function(x){this.append(x[0],x[1])},this):z&&Object.getOwnPropertyNames(z).forEach(function(x){this.append(x,z[x])},this)}d.prototype.append=function(z,x){z=k(z),x=a(x);var P=this.map[z];this.map[z]=P?P+", "+x:x},d.prototype.delete=function(z){delete this.map[k(z)]},d.prototype.get=function(z){return z=k(z),this.has(z)?this.map[z]:null},d.prototype.has=function(z){return this.map.hasOwnProperty(k(z))},d.prototype.set=function(z,x){this.map[k(z)]=a(x)},d.prototype.forEach=function(z,x){for(var P in this.map)this.map.hasOwnProperty(P)&&z.call(x,this.map[P],P,this)},d.prototype.keys=function(){var z=[];return this.forEach(function(x,P){z.push(P)}),h(z)},d.prototype.values=function(){var z=[];return this.forEach(function(x){z.push(x)}),h(z)},d.prototype.entries=function(){var z=[];return this.forEach(function(x,P){z.push([P,x])}),h(z)},y.iterable&&(d.prototype[Symbol.iterator]=d.prototype.entries);function f(z){if(z.bodyUsed)return o.reject(new TypeError("Already read"));z.bodyUsed=!0}function p(z){return new o(function(x,P){z.onload=function(){x(z.result)},z.onerror=function(){P(z.error)}})}function v(z){var x=new FileReader,P=p(x);return x.readAsArrayBuffer(z),P}function m(z){var x=new FileReader,P=p(x);return x.readAsText(z),P}function E(z){for(var x=new Uint8Array(z),P=new Array(x.length),L=0;L<x.length;L++)P[L]=String.fromCharCode(x[L]);return P.join("")}function _(z){if(z.slice)return z.slice(0);var x=new Uint8Array(z.byteLength);return x.set(new Uint8Array(z)),x.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(z){this.bodyUsed=this.bodyUsed,this._bodyInit=z,z?typeof z=="string"?this._bodyText=z:y.blob&&Blob.prototype.isPrototypeOf(z)?this._bodyBlob=z:y.formData&&FormData.prototype.isPrototypeOf(z)?this._bodyFormData=z:y.searchParams&&URLSearchParams.prototype.isPrototypeOf(z)?this._bodyText=z.toString():y.arrayBuffer&&y.blob&&w(z)?(this._bodyArrayBuffer=_(z.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):y.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(z)||R(z))?this._bodyArrayBuffer=_(z):this._bodyText=z=Object.prototype.toString.call(z):this._bodyText="",this.headers.get("content-type")||(typeof z=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):y.searchParams&&URLSearchParams.prototype.isPrototypeOf(z)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},y.blob&&(this.blob=function(){var z=f(this);if(z)return z;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 z=f(this);return z||(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(v)}),this.text=function(){var z=f(this);if(z)return z;if(this._bodyBlob)return m(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return o.resolve(this._bodyText)},y.formData&&(this.formData=function(){return this.text().then(q)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function S(z){var x=z.toUpperCase();return N.indexOf(x)>-1?x:z}function T(z,x){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x=x||{};var P=x.body;if(z instanceof T){if(z.bodyUsed)throw new TypeError("Already read");this.url=z.url,this.credentials=z.credentials,x.headers||(this.headers=new d(z.headers)),this.method=z.method,this.mode=z.mode,this.signal=z.signal,!P&&z._bodyInit!=null&&(P=z._bodyInit,z.bodyUsed=!0)}else this.url=String(z);if(this.credentials=x.credentials||this.credentials||"same-origin",(x.headers||!this.headers)&&(this.headers=new d(x.headers)),this.method=S(x.method||this.method||"GET"),this.mode=x.mode||this.mode||null,this.signal=x.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")&&(x.cache==="no-store"||x.cache==="no-cache")){var L=/([?&])_=[^&]*/;if(L.test(this.url))this.url=this.url.replace(L,"$1_="+new Date().getTime());else{var U=/\?/;this.url+=(U.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}T.prototype.clone=function(){return new T(this,{body:this._bodyInit})};function q(z){var x=new FormData;return z.trim().split("&").forEach(function(P){if(P){var L=P.split("="),U=L.shift().replace(/\+/g," "),B=L.join("=").replace(/\+/g," ");x.append(decodeURIComponent(U),decodeURIComponent(B))}}),x}function I(z){var x=new d,P=z.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(L){return L.indexOf(`
|
|
43
|
+
`,"data-question-key":t.key},n?Fl(t.images,"cio-question-image-container"):"",O.createElement("div",{className:"cio-question-content"},O.createElement(Ul,{title:t==null?void 0:t.title}),O.createElement(Ml,{description:t.description}),O.createElement(Dl,{ctaButtonText:t==null?void 0:t.cta_text}))):null}function qh(){var o;const{state:e,getSelectInputProps:t}=D.useContext(Be);let n,r=!1,i;return e!=null&&e.quiz.currentQuestion&&(n=e.quiz.currentQuestion.next_question,r=n.options.some(s=>s.images),i=n.type===Y.MultipleSelect&&"Select one or more options"),n?O.createElement("div",{className:"cio-select-question-container","data-question-key":n.key},O.createElement("div",{className:"cio-select-question-text"},O.createElement(Ul,{title:n.title}),n!=null&&n.description?O.createElement(Ml,{description:n.description}):""),i&&O.createElement("div",{className:"cio-select-question-instructions"},i),O.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&&O.createElement("div",{...t(s)},s.images?Fl(s.images,"cio-question-option-image"):"",O.createElement("div",{className:"cio-question-option-value"},s==null?void 0:s.value)))),O.createElement(Dl,{ctaButtonText:(n==null?void 0:n.cta_text)||"Continue"})):null}function Ph(){var r;const{state:e}=D.useContext(Be),t=(r=e==null?void 0:e.quiz.currentQuestion)==null?void 0:r.next_question,n=Df(t==null?void 0:t.type);return O.createElement(O.Fragment,null,n.isOpenQuestion&&O.createElement(Nh,{key:t==null?void 0:t.id}),n.isCoverQuestion&&O.createElement(Th,{key:t==null?void 0:t.id}),n.isSelectQuestion&&O.createElement(qh,{key:t==null?void 0:t.id}))}function Ih(){return O.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},O.createElement("g",{clipPath:"url(#clip0_7495_177230)"},O.createElement("path",{d:"M0.667969 2.66699V6.66699H4.66797",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),O.createElement("path",{d:"M15.332 13.333V9.33301H11.332",stroke:"#0A0B0C",strokeWidth:"1.33333",strokeLinecap:"round",strokeLinejoin:"round"}),O.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"})),O.createElement("defs",null,O.createElement("clipPath",{id:"clip0_7495_177230"},O.createElement("rect",{width:"16",height:"16",fill:"white"}))))}function Oh(e){const{redoText:t="Redo Quiz",disabled:n,...r}=e,{getResetQuizButtonProps:i}=D.useContext(Be);return i?O.createElement("button",{...r,...i("secondary")},O.createElement(Ih,null),O.createElement("span",null,t)):null}function Lh(){var t;const{state:e}=D.useContext(Be);return O.createElement("div",{className:"cio-results-filter-container"},O.createElement("p",null,"Because you answered"),O.createElement("div",{className:"cio-results-filter-options"},(t=e==null?void 0:e.quiz.resultsFilters)==null?void 0:t.map(n=>O.createElement("div",{className:"cio-results-filter-option",key:n},n))))}function Ah(){const{getResetQuizButtonProps:e}=D.useContext(Be);return O.createElement("div",{className:"cio-zero-results"},O.createElement("h3",{className:"cio-zero-results-subtitle"},"Sorry, it seems like we couldn’t find results based on your answers."),O.createElement("p",{className:"cio-zero-results-description"},"This is embarrassing 😢. It might be that some of the questions are not properly set up from our end. Would you give us another try?"),O.createElement(qi,{ctaText:"Try Again",propsGetters:e}))}function Bh(e){const{item:t,price:n}=e,{getAddToCartButtonProps:r}=D.useContext(Be);return r?O.createElement("button",{...r(t,n)},"Add to Cart"):null}function Uh(e){var R,k;const{result:t,salePriceKey:n,regularPriceKey:r,resultPosition:i}=e,{customClickItemCallback:o,getQuizResultButtonProps:s,getQuizResultLinkProps:l}=D.useContext(Be),u=n&&((R=t==null?void 0:t.data)==null?void 0:R[n]),c=r&&((k=t==null?void 0:t.data)==null?void 0:k[r]),y=()=>{var a;return O.createElement(O.Fragment,null,O.createElement("div",{className:"cio-result-card-image"},O.createElement("img",{src:(a=t.data)==null?void 0:a.image_url,alt:"product"})),O.createElement("div",{className:"cio-result-card-text"},O.createElement("p",{className:"cio-result-card-title"},t.value),O.createElement("div",{className:"cio-result-card-prices"},u&&O.createElement("span",{className:"cio-result-card-sale-price"},"$",u),c&&O.createElement("span",{className:`cio-result-card-regular-price${u?"--strike-through":""}`},"$",c))))},w=()=>s&&O.createElement("div",{...s({result:t,position:i,type:"button"})},y()),C=()=>l&&O.createElement("a",{className:"cio-result-card-anchor",...l({result:t,position:i,type:"link"})},y());return O.createElement("div",{className:"cio-result-card"},o?w():C(),O.createElement(Bh,{item:t,price:u||c}))}function Mh(e){var i,o,s,l;const{resultCardSalePriceKey:t,resultCardRegularPriceKey:n}=e,{state:r}=D.useContext(Be);return O.createElement("div",{className:"cio-results"},(l=(s=(o=(i=r==null?void 0:r.quiz)==null?void 0:i.results)==null?void 0:o.response)==null?void 0:s.results)==null?void 0:l.map((u,c)=>{var y;return O.createElement(Uh,{result:u,key:(y=u.data)==null?void 0:y.id,salePriceKey:t,regularPriceKey:n,resultPosition:c+1})}))}function Fh(e){var l,u,c;const{options:t}=e,{resultCardSalePriceKey:n,resultCardRegularPriceKey:r}=t,{state:i}=D.useContext(Be),o=!((c=(u=(l=i==null?void 0:i.quiz.results)==null?void 0:l.response)==null?void 0:u.results)!=null&&c.length),s=o?"Oops, there are no results":"Here are your results";return i!=null&&i.quiz.results?O.createElement("div",{className:"cio-results-container"},O.createElement("h1",{className:"cio-results-title"},s),O.createElement("div",{className:"cio-results-filter-and-redo-container"},O.createElement(Lh,null),O.createElement(Oh,null)),!o&&O.createElement(Mh,{resultCardSalePriceKey:n,resultCardRegularPriceKey:r}),o&&O.createElement(Ah,null)):O.createElement("div",null,"Loading")}const jh="constructorIOQuizState";var Pt=(e=>(e.Stale="STALE",e.Loading="LOADING",e.Success="SUCCESS",e.Error="ERROR",e))(Pt||{});function Dh(){return O.createElement("div",{className:"cio-spinner"},O.createElement("div",null),O.createElement("div",null),O.createElement("div",null),O.createElement("div",null))}var He={},Hh={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})(Hh);var Pi={},Vh={get exports(){return Pi},set exports(e){Pi=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}(Vh)),Pi}var Ii={},Qh={get exports(){return Ii},set exports(e){Ii=e}},Oi={},Wh={get exports(){return Oi},set exports(e){Oi=e}},Li={},bh={get exports(){return Li},set exports(e){Li=e}},ia;function Tr(){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 Ai={},Kh={get exports(){return Ai},set exports(e){Ai=e}},oa;function Gh(){return oa||(oa=1,function(e){var t=Tr().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}(Kh)),Ai}var sa;function Vf(){return sa||(sa=1,function(e){var t=Tr().default,n=Gh();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}(Wh)),Oi}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}(Qh)),Ii}function Xh(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 Bi={},Yh={get exports(){return Bi},set exports(e){Bi=e}},ua;function Jh(){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],y=Object.getOwnPropertyDescriptor(o,c);y!==void 0&&y.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 Xh<"u"&&(e.exports=t)})()}(Yh)),Bi}var or={},Zh={get exports(){return or},set exports(e){or=e}},aa;function $h(){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,y={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 w(z){return z&&DataView.prototype.isPrototypeOf(z)}if(y.arrayBuffer)var C=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],R=ArrayBuffer.isView||function(z){return z&&C.indexOf(Object.prototype.toString.call(z))>-1};function k(z){if(typeof z!="string"&&(z=String(z)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(z)||z==="")throw new TypeError("Invalid character in header field name");return z.toLowerCase()}function a(z){return typeof z!="string"&&(z=String(z)),z}function h(z){var x={next:function(){var P=z.shift();return{done:P===void 0,value:P}}};return y.iterable&&(x[Symbol.iterator]=function(){return x}),x}function d(z){this.map={},z instanceof d?z.forEach(function(x,P){this.append(P,x)},this):Array.isArray(z)?z.forEach(function(x){this.append(x[0],x[1])},this):z&&Object.getOwnPropertyNames(z).forEach(function(x){this.append(x,z[x])},this)}d.prototype.append=function(z,x){z=k(z),x=a(x);var P=this.map[z];this.map[z]=P?P+", "+x:x},d.prototype.delete=function(z){delete this.map[k(z)]},d.prototype.get=function(z){return z=k(z),this.has(z)?this.map[z]:null},d.prototype.has=function(z){return this.map.hasOwnProperty(k(z))},d.prototype.set=function(z,x){this.map[k(z)]=a(x)},d.prototype.forEach=function(z,x){for(var P in this.map)this.map.hasOwnProperty(P)&&z.call(x,this.map[P],P,this)},d.prototype.keys=function(){var z=[];return this.forEach(function(x,P){z.push(P)}),h(z)},d.prototype.values=function(){var z=[];return this.forEach(function(x){z.push(x)}),h(z)},d.prototype.entries=function(){var z=[];return this.forEach(function(x,P){z.push([P,x])}),h(z)},y.iterable&&(d.prototype[Symbol.iterator]=d.prototype.entries);function f(z){if(z.bodyUsed)return o.reject(new TypeError("Already read"));z.bodyUsed=!0}function p(z){return new o(function(x,P){z.onload=function(){x(z.result)},z.onerror=function(){P(z.error)}})}function v(z){var x=new FileReader,P=p(x);return x.readAsArrayBuffer(z),P}function m(z){var x=new FileReader,P=p(x);return x.readAsText(z),P}function E(z){for(var x=new Uint8Array(z),P=new Array(x.length),L=0;L<x.length;L++)P[L]=String.fromCharCode(x[L]);return P.join("")}function _(z){if(z.slice)return z.slice(0);var x=new Uint8Array(z.byteLength);return x.set(new Uint8Array(z)),x.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(z){this.bodyUsed=this.bodyUsed,this._bodyInit=z,z?typeof z=="string"?this._bodyText=z:y.blob&&Blob.prototype.isPrototypeOf(z)?this._bodyBlob=z:y.formData&&FormData.prototype.isPrototypeOf(z)?this._bodyFormData=z:y.searchParams&&URLSearchParams.prototype.isPrototypeOf(z)?this._bodyText=z.toString():y.arrayBuffer&&y.blob&&w(z)?(this._bodyArrayBuffer=_(z.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):y.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(z)||R(z))?this._bodyArrayBuffer=_(z):this._bodyText=z=Object.prototype.toString.call(z):this._bodyText="",this.headers.get("content-type")||(typeof z=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):y.searchParams&&URLSearchParams.prototype.isPrototypeOf(z)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},y.blob&&(this.blob=function(){var z=f(this);if(z)return z;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 z=f(this);return z||(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(v)}),this.text=function(){var z=f(this);if(z)return z;if(this._bodyBlob)return m(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return o.resolve(this._bodyText)},y.formData&&(this.formData=function(){return this.text().then(q)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function S(z){var x=z.toUpperCase();return N.indexOf(x)>-1?x:z}function T(z,x){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x=x||{};var P=x.body;if(z instanceof T){if(z.bodyUsed)throw new TypeError("Already read");this.url=z.url,this.credentials=z.credentials,x.headers||(this.headers=new d(z.headers)),this.method=z.method,this.mode=z.mode,this.signal=z.signal,!P&&z._bodyInit!=null&&(P=z._bodyInit,z.bodyUsed=!0)}else this.url=String(z);if(this.credentials=x.credentials||this.credentials||"same-origin",(x.headers||!this.headers)&&(this.headers=new d(x.headers)),this.method=S(x.method||this.method||"GET"),this.mode=x.mode||this.mode||null,this.signal=x.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")&&(x.cache==="no-store"||x.cache==="no-cache")){var L=/([?&])_=[^&]*/;if(L.test(this.url))this.url=this.url.replace(L,"$1_="+new Date().getTime());else{var U=/\?/;this.url+=(U.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}T.prototype.clone=function(){return new T(this,{body:this._bodyInit})};function q(z){var x=new FormData;return z.trim().split("&").forEach(function(P){if(P){var L=P.split("="),U=L.shift().replace(/\+/g," "),B=L.join("=").replace(/\+/g," ");x.append(decodeURIComponent(U),decodeURIComponent(B))}}),x}function I(z){var x=new d,P=z.replace(/\r?\n[\t ]+/g," ");return P.split("\r").map(function(L){return L.indexOf(`
|
|
44
44
|
`)===0?L.substr(1,L.length):L}).forEach(function(L){var U=L.split(":"),B=U.shift().trim();if(B){var W=U.join(":").trim();x.append(B,W)}}),x}g.call(T.prototype);function M(z,x){if(!(this instanceof M))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x||(x={}),this.type="default",this.status=x.status===void 0?200:x.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in x?x.statusText:"",this.headers=new d(x.headers),this.url=x.url||"",this._initBody(z)}g.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},M.error=function(){var z=new M(null,{status:0,statusText:""});return z.type="error",z};var H=[301,302,303,307,308];M.redirect=function(z,x){if(H.indexOf(x)===-1)throw new RangeError("Invalid status code");return new M(null,{status:x,headers:{location:z}})},u.DOMException=c.DOMException;try{new u.DOMException}catch{u.DOMException=function(x,P){this.message=x,this.name=P;var L=Error(x);this.stack=L.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function F(z,x){return new o(function(P,L){var U=new T(z,x);if(U.signal&&U.signal.aborted)return L(new u.DOMException("Aborted","AbortError"));var B=new s;function W(){B.abort()}B.onload=function(){var V={status:B.status,statusText:B.statusText,headers:I(B.getAllResponseHeaders()||"")};V.url="responseURL"in B?B.responseURL:V.headers.get("X-Request-URL");var b="response"in B?B.response:B.responseText;setTimeout(function(){P(new M(b,V))},0)},B.onerror=function(){setTimeout(function(){L(new TypeError("Network request failed"))},0)},B.ontimeout=function(){setTimeout(function(){L(new TypeError("Network request failed"))},0)},B.onabort=function(){setTimeout(function(){L(new u.DOMException("Aborted","AbortError"))},0)};function Q(V){try{return V===""&&c.location.href?c.location.href:V}catch{return V}}B.open(U.method,Q(U.url),!0),U.credentials==="include"?B.withCredentials=!0:U.credentials==="omit"&&(B.withCredentials=!1),"responseType"in B&&(y.blob?B.responseType="blob":y.arrayBuffer&&U.headers.get("Content-Type")&&U.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(B.responseType="arraybuffer")),x&&typeof x.headers=="object"&&!(x.headers instanceof d)?Object.getOwnPropertyNames(x.headers).forEach(function(V){B.setRequestHeader(V,a(x.headers[V]))}):U.headers.forEach(function(V,b){B.setRequestHeader(b,V)}),U.signal&&(U.signal.addEventListener("abort",W),B.onreadystatechange=function(){B.readyState===4&&U.signal.removeEventListener("abort",W)}),B.send(typeof U._bodyInit>"u"?null:U._bodyInit)})}F.polyfill=!0,c.fetch||(c.fetch=F,c.Headers=d,c.Request=T,c.Response=M),u.Headers=d,u.Request=T,u.Response=M,u.fetch=F,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)}(Zh,or)),or}var Oo={};/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */var ca;function ev(){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 g=0,N=new Array(256),S=0;S!=256;++S)g=S,g=g&1?-306674912^g>>>1:g>>>1,g=g&1?-306674912^g>>>1:g>>>1,g=g&1?-306674912^g>>>1:g>>>1,g=g&1?-306674912^g>>>1:g>>>1,g=g&1?-306674912^g>>>1:g>>>1,g=g&1?-306674912^g>>>1:g>>>1,g=g&1?-306674912^g>>>1:g>>>1,g=g&1?-306674912^g>>>1:g>>>1,N[S]=g;return typeof Int32Array<"u"?new Int32Array(N):N}var r=n();function i(g){var N=0,S=0,T=0,q=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(T=0;T!=256;++T)q[T]=g[T];for(T=0;T!=256;++T)for(S=g[T],N=256+T;N<4096;N+=256)S=q[N]=S>>>8^g[S&255];var I=[];for(T=1;T!=16;++T)I[T-1]=typeof Int32Array<"u"?q.subarray(T*256,T*256+256):q.slice(T*256,T*256+256);return I}var o=i(r),s=o[0],l=o[1],u=o[2],c=o[3],y=o[4],w=o[5],C=o[6],R=o[7],k=o[8],a=o[9],h=o[10],d=o[11],f=o[12],p=o[13],v=o[14];function m(g,N){for(var S=N^-1,T=0,q=g.length;T<q;)S=S>>>8^r[(S^g.charCodeAt(T++))&255];return~S}function E(g,N){for(var S=N^-1,T=g.length-15,q=0;q<T;)S=v[g[q++]^S&255]^p[g[q++]^S>>8&255]^f[g[q++]^S>>16&255]^d[g[q++]^S>>>24]^h[g[q++]]^a[g[q++]]^k[g[q++]]^R[g[q++]]^C[g[q++]]^w[g[q++]]^y[g[q++]]^c[g[q++]]^u[g[q++]]^l[g[q++]]^s[g[q++]]^r[g[q++]];for(T+=15;q<T;)S=S>>>8^r[(S^g[q++])&255];return~S}function _(g,N){for(var S=N^-1,T=0,q=g.length,I=0,M=0;T<q;)I=g.charCodeAt(T++),I<128?S=S>>>8^r[(S^I)&255]:I<2048?(S=S>>>8^r[(S^(192|I>>6&31))&255],S=S>>>8^r[(S^(128|I&63))&255]):I>=55296&&I<57344?(I=(I&1023)+64,M=g.charCodeAt(T++)&1023,S=S>>>8^r[(S^(240|I>>8&7))&255],S=S>>>8^r[(S^(128|I>>2&63))&255],S=S>>>8^r[(S^(128|M>>6&15|(I&3)<<4))&255],S=S>>>8^r[(S^(128|M&63))&255]):(S=S>>>8^r[(S^(224|I>>12&15))&255],S=S>>>8^r[(S^(128|I>>6&63))&255],S=S>>>8^r[(S^(128|I&63))&255]);return~S}t.table=r,t.bstr=m,t.buf=E,t.str=_})}(Oo)),Oo}var Ui={},tv={get exports(){return Ui},set exports(e){Ui=e}};/*! store2 - v2.14.2 - 2022-07-18
|
|
45
45
|
* Copyright (c) 2022 Nathan Bubna; Licensed (MIT OR GPL-3.0) */var fa;function nv(){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(y,w,C){return arguments.length===0?u.getAll():typeof w=="function"?u.transact(y,w,C):w!==void 0?u.set(y,w,C):typeof y=="string"||typeof y=="number"?u.get(y):typeof y=="function"?u.each(y):y?u.setAll(y,w):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 y in r.areas)c.area(y,r.areas[y]);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 y in s)u[y]=s[y];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)}(tv)),Ui}var Lo,da;function rv(){return da||(da=1,Lo=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 y=u===t.areas.local?"+local+":u===t.areas.session?"+session+":!1;if(y){var w=t.areas[y];return c&&!w?w=e.area(y)._area:c===!1&&(delete t.areas[y],delete e[y]),w}},t.set=function(u,c,y){try{n.apply(this,arguments)}catch(w){if(w.name==="QUOTA_EXCEEDED_ERR"||w.name==="NS_ERROR_DOM_QUOTA_REACHED"||w.toString().indexOf("QUOTA_EXCEEDED_ERR")!==-1||w.toString().indexOf("QuotaExceededError")!==-1)return t.set(t.overflow(u,!0),c,y);throw w}},t.get=function(u,c){var y=t.overflow(u);return y&&r.call(this,y,c)||r.apply(this,arguments)},t.remove=function(u,c){var y=t.overflow(u);y&&i.call(this,y,c),i.apply(this,arguments)},t.key=function(u,c){var y=t.overflow(u);if(y){var w=s.call(this,u);if(c>=w){c=c-w;for(var C=0,R=s.call(this,y);C<R;C++)if(C===c)return o.call(this,y,C)}}return o.apply(this,arguments)},t.length=function(u){var c=s(u),y=t.overflow(u);return y?c+s(y):c},t.clear=function(u){t.overflow(u,!1),l.apply(this,arguments)}}),Lo}var Ao,pa;function Hl(){if(pa)return Ao;pa=1;var e=nv(),t=rv();return t(e,e._),Ao=e,Ao}var Bo,ha;function pt(){if(ha)return Bo;ha=1;var e=He,t=e(Tr()),n=ev(),r=Hl(),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 y=l[c];typeof y=="string"?u[c]=o.trimNonBreakingSpaces(y):u[c]=y}),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,y=l&&l.networkParameters&&l.networkParameters.timeout,w=u&&u.timeout,C=w||y;typeof C=="number"&&c&&setTimeout(function(){return c.abort()},C)},stringify:function(l,u,c){if(!l)return"";var y=[];return Object.keys(l).forEach(function(w){var C=l[w],R=o.encodeURIComponentRFC3986(w),k;if(C!=null){var a=u?"".concat(u,"%5B").concat(R,"%5D"):R;Array.isArray(C)?k=o.stringify(C,a,"array"):(0,t.default)(C)==="object"?k=o.stringify(C,a,"object"):c==="object"?k="".concat(a,"=").concat(o.encodeURIComponentRFC3986(C)):k="".concat(u||R,"=").concat(o.encodeURIComponentRFC3986(C)),y.push(k)}}),y.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(y){var w=o.toSnakeCase(y);c[w]=u&&(0,t.default)(l[y])==="object"&&!Array.isArray(l[y])?o.toSnakeCaseKeys(l[y],u):l[y]}),c}};return Bo=o,Bo}var Uo,va;function Bn(){if(va)return Uo;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,y="cio.client.".concat(u);r.dispatchEvent(r.createCustomEvent(y,c))}}}]),o}();return Uo=i,Uo}var Mo,ga;function iv(){if(ga)return Mo;ga=1;var e=He,t=e(ft()),n=e(dt()),r=Bn(),i=pt();function o(l,u,c){var y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,w=c.apiKey,C=c.version,R=c.serviceUrl,k=c.sessionId,a=c.clientId,h=c.userId,d=c.segments,f=c.testCells,p={c:C};if(p.key=w,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 v=u.offset,m=u.page,E=u.resultsPerPage,_=u.filters,g=u.sortBy,N=u.sortOrder,S=u.section,T=u.fmtOptions,q=u.hiddenFields,I=u.hiddenFacets,M=u.variationsMap,H=u.qsParam,F=u.preFilterExpression;i.isNil(v)||(p.offset=v),i.isNil(m)||(p.page=m),i.isNil(E)||(p.num_results_per_page=E),_&&(p.filters=_),g&&(p.sort_by=g),N&&(p.sort_order=N),S&&(p.section=S),T&&(p.fmt_options=T),q&&(p.fmt_options?p.fmt_options.hidden_fields=q:p.fmt_options={hidden_fields:q}),I&&(p.fmt_options?p.fmt_options.hidden_facets=I:p.fmt_options={hidden_facets:I}),M&&(p.variations_map=JSON.stringify(M)),F&&(p.pre_filter_expression=JSON.stringify(F)),H&&(p.qs=JSON.stringify(H))}p._dt=Date.now(),p=i.cleanParams(p);var z=i.stringify(p),x=y?"search/natural_language":"search";return"".concat(R,"/").concat(x,"/").concat(i.encodeURIComponentRFC3986(i.trimNonBreakingSpaces(l)),"?").concat(z)}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,y){var w=this,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R,k=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,C,h)}try{R=o(c,y,this.options)}catch(d){return Promise.reject(d)}return k(R,{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}),w.eventDispatcher.queue("search.getSearchResults.completed",d),d;if(d.response&&d.response.redirect)return w.eventDispatcher.queue("search.getSearchResults.completed",d),d;throw new Error("getSearchResults response data is malformed")})}},{key:"getVoiceSearchResults",value:function(c,y){var w=this,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R,k=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,C,h)}try{var d=!0;R=o(c,y,this.options,d)}catch(f){return Promise.reject(f)}return k(R,{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}),w.eventDispatcher.queue("search.getVoiceSearchResults.completed",f),f;if(f.response&&f.response.redirect)return w.eventDispatcher.queue("search.getVoiceSearchResults.completed",f),f;throw new Error("getVoiceSearchResults response data is malformed")})}}]),l}();return Mo=s,Mo}var Mi={},ov={get exports(){return Mi},set exports(e){Mi=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}(ov)),Mi}var Fo,ma;function sv(){if(ma)return Fo;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=Bn(),l=pt();function u(k,a){var h=a.apiKey,d=a.version,f=a.sessionId,p=a.clientId,v=a.userId,m=a.segments,E=a.testCells,_={c:d};if(_.key=h,_.i=p,_.s=f,E&&Object.keys(E).forEach(function(U){_["ef-".concat(U)]=E[U]}),m&&m.length&&(_.us=m),v&&(_.ui=String(v)),k){var g=k.page,N=k.offset,S=k.resultsPerPage,T=k.filters,q=k.sortBy,I=k.sortOrder,M=k.section,H=k.fmtOptions,F=k.hiddenFields,z=k.hiddenFacets,x=k.variationsMap,P=k.qsParam,L=k.preFilterExpression;l.isNil(g)||(_.page=g),l.isNil(N)||(_.offset=N),l.isNil(S)||(_.num_results_per_page=S),T&&(_.filters=T),q&&(_.sort_by=q),I&&(_.sort_order=I),M&&(_.section=M),H&&(_.fmt_options=H),F&&(_.fmt_options?_.fmt_options.hidden_fields=F:_.fmt_options={hidden_fields:F}),z&&(_.fmt_options?_.fmt_options.hidden_facets=z:_.fmt_options={hidden_facets:z}),x&&(_.variations_map=JSON.stringify(x)),L&&(_.pre_filter_expression=JSON.stringify(L)),P&&(_.qs=JSON.stringify(P))}return _._dt=Date.now(),_=l.cleanParams(_),_}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),v=l.stringify(p);return"".concat(f,"/browse/").concat(l.encodeURIComponentRFC3986(l.trimNonBreakingSpaces(k)),"/").concat(l.encodeURIComponentRFC3986(l.trimNonBreakingSpaces(a)),"?").concat(v)}function y(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 w(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 C(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 R=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,v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},m,E=this.options.fetch,_;if(typeof AbortController=="function"){var g=new AbortController;_=g&&g.signal,l.applyNetworkTimeout(this.options,v,g)}try{m=c(h,d,f,this.options)}catch(N){return Promise.reject(N)}return E(m,{signal:_}).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(S){S.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]:{},v,m=this.options.fetch,E;if(typeof AbortController=="function"){var _=new AbortController;E=_&&_.signal,l.applyNetworkTimeout(this.options,p,_)}try{v=y(h,d,this.options)}catch(g){return Promise.reject(g)}return m(v,{signal:E}).then(function(g){return g.ok?g.json():l.throwHttpErrorFromResponse(new Error,g)}).then(function(g){if(g.response&&g.response.results)return g.result_id&&g.response.results.forEach(function(N){N.result_id=g.result_id}),f.eventDispatcher.queue("browse.getBrowseResultsForItemIds.completed",g),g;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,v=this.options.serviceUrl,m=u(h,this.options),E;if(typeof AbortController=="function"){var _=new AbortController;E=_&&_.signal,l.applyNetworkTimeout(this.options,f,_)}delete m._dt;var g=l.stringify(m),N="".concat(v,"/browse/groups?").concat(g);return p(N,{signal:E}).then(function(S){return S.ok?S.json():l.throwHttpErrorFromResponse(new Error,S)}).then(function(S){if(S.response&&S.response.groups)return d.eventDispatcher.queue("browse.getBrowseGroups.completed",S),S;throw new Error("getBrowseGroups response data is malformed")})}},{key:"getBrowseFacets",value:function(h,d){var f=this,p,v=this.options.fetch,m;if(typeof AbortController=="function"){var E=new AbortController;m=E&&E.signal,l.applyNetworkTimeout(this.options,d,E)}try{p=w(h,this.options)}catch(_){return Promise.reject(_)}return v(p,{signal:m}).then(function(_){return _.ok?_.json():l.throwHttpErrorFromResponse(new Error,_)}).then(function(_){if(_.response&&_.response.facets)return f.eventDispatcher.queue("browse.getBrowseFacets.completed",_),_;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]:{},v,m=this.options.fetch,E;if(typeof AbortController=="function"){var _=new AbortController;E=_&&_.signal,l.applyNetworkTimeout(this.options,p,_)}try{v=C(h,f,this.options)}catch(g){return Promise.reject(g)}return m(v,{signal:E}).then(function(g){return g.ok?g.json():l.throwHttpErrorFromResponse(new Error,g)}).then(function(g){if(g.response&&g.response.facets)return d.eventDispatcher.queue("browse.getBrowseFacetOptions.completed",g),g;throw new Error("getBrowseFacetOptions response data is malformed")})}}]),k}();return Fo=R,Fo}var jo,_a;function lv(){if(_a)return jo;_a=1;var e=He,t=e(ft()),n=e(dt()),r=Bn(),i=pt(),o=i.throwHttpErrorFromResponse,s=i.cleanParams,l=i.applyNetworkTimeout,u=i.trimNonBreakingSpaces,c=i.encodeURIComponentRFC3986,y=i.stringify;function w(R,k,a){var h=a.apiKey,d=a.version,f=a.serviceUrl,p=a.sessionId,v=a.clientId,m=a.userId,E=a.segments,_=a.testCells,g={c:d};if(g.key=h,g.i=v,g.s=p,!R||typeof R!="string")throw new Error("query is a required parameter of type string");if(_&&Object.keys(_).forEach(function(F){g["ef-".concat(F)]=_[F]}),E&&E.length&&(g.us=E),m&&(g.ui=String(m)),k){var N=k.numResults,S=k.resultsPerSection,T=k.filters,q=k.hiddenFields,I=k.variationsMap;N&&(g.num_results=N),S&&Object.keys(S).forEach(function(F){g["num_results_".concat(F)]=S[F]}),T&&(g.filters=T),q&&(g.fmt_options?g.fmt_options.hidden_fields=q:g.fmt_options={hidden_fields:q}),I&&(g.variations_map=JSON.stringify(I))}g._dt=Date.now(),g=s(g);var M=y(g),H=R.replace(/^\//,"|");return"".concat(f,"/autocomplete/").concat(c(u(H)),"?").concat(M)}var C=function(){function R(k){(0,t.default)(this,R),this.options=k||{},this.eventDispatcher=new r(k.eventDispatcher)}return(0,n.default)(R,[{key:"getAutocompleteResults",value:function(a,h){var d=this,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},p,v=this.options.fetch,m;if(typeof AbortController=="function"){var E=new AbortController;m=E&&E.signal,l(this.options,f,E)}try{p=w(a,h,this.options)}catch(_){return Promise.reject(_)}return v(p,{signal:m}).then(function(_){return _.ok?_.json():o(new Error,_)}).then(function(_){if(_.sections){if(_.result_id){var g=Object.keys(_.sections);g.forEach(function(N){var S=_.sections[N];S.length&&S.forEach(function(T){T.result_id=_.result_id})})}return d.eventDispatcher.queue("autocomplete.getAutocompleteResults.completed",_),_}throw new Error("getAutocompleteResults response data is malformed")})}}]),R}();return jo=C,jo}var Do,wa;function uv(){if(wa)return Do;wa=1;var e=He,t=e(ft()),n=e(dt()),r=Bn(),i=pt();function o(l,u,c){var y=c.apiKey,w=c.version,C=c.serviceUrl,R=c.sessionId,k=c.userId,a=c.clientId,h=c.segments,d={c:w};if(d.key=y,d.i=a,d.s=R,!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,v=u.section,m=u.term,E=u.filters,_=u.variationsMap,g=u.hiddenFields;i.isNil(f)||(d.num_results=f),p&&(d.item_id=p),v&&(d.section=v),m&&(d.term=m),E&&(d.filters=E),g&&(d.fmt_options?d.fmt_options.hidden_fields=g:d.fmt_options={hidden_fields:g}),_&&(d.variations_map=JSON.stringify(_))}d=i.cleanParams(d);var N=i.stringify(d);return"".concat(C,"/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,y){var w=this,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R,k=this.options.fetch,a;if(typeof AbortController=="function"){var h=new AbortController;a=h&&h.signal,i.applyNetworkTimeout(this.options,C,h)}try{R=o(c,y,this.options)}catch(d){return Promise.reject(d)}return k(R,{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}),w.eventDispatcher.queue("recommendations.getRecommendations.completed",d),d;throw new Error("getRecommendations response data is malformed")})}}]),l}();return Do=s,Do}var sr={},av={get exports(){return sr},set exports(e){sr=e}},ka;function cv(){if(ka)return sr;ka=1;var e=typeof Reflect=="object"?Reflect:null,t=e&&typeof e.apply=="function"?e.apply:function(m,E,_){return Function.prototype.apply.call(m,E,_)},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(v){console&&console.warn&&console.warn(v)}var i=Number.isNaN||function(m){return m!==m};function o(){o.init.call(this)}av.exports=o,sr.once=d,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function l(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(v){if(typeof v!="number"||v<0||i(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");s=v}}),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(v){return v._maxListeners===void 0?o.defaultMaxListeners:v._maxListeners}o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(m){for(var E=[],_=1;_<arguments.length;_++)E.push(arguments[_]);var g=m==="error",N=this._events;if(N!==void 0)g=g&&N.error===void 0;else if(!g)return!1;if(g){var S;if(E.length>0&&(S=E[0]),S instanceof Error)throw S;var T=new Error("Unhandled error."+(S?" ("+S.message+")":""));throw T.context=S,T}var q=N[m];if(q===void 0)return!1;if(typeof q=="function")t(q,this,E);else for(var I=q.length,M=k(q,I),_=0;_<I;++_)t(M[_],this,E);return!0};function c(v,m,E,_){var g,N,S;if(l(E),N=v._events,N===void 0?(N=v._events=Object.create(null),v._eventsCount=0):(N.newListener!==void 0&&(v.emit("newListener",m,E.listener?E.listener:E),N=v._events),S=N[m]),S===void 0)S=N[m]=E,++v._eventsCount;else if(typeof S=="function"?S=N[m]=_?[E,S]:[S,E]:_?S.unshift(E):S.push(E),g=u(v),g>0&&S.length>g&&!S.warned){S.warned=!0;var T=new Error("Possible EventEmitter memory leak detected. "+S.length+" "+String(m)+" listeners added. Use emitter.setMaxListeners() to increase limit");T.name="MaxListenersExceededWarning",T.emitter=v,T.type=m,T.count=S.length,r(T)}return v}o.prototype.addListener=function(m,E){return c(this,m,E,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(m,E){return c(this,m,E,!0)};function y(){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 w(v,m,E){var _={fired:!1,wrapFn:void 0,target:v,type:m,listener:E},g=y.bind(_);return g.listener=E,_.wrapFn=g,g}o.prototype.once=function(m,E){return l(E),this.on(m,w(this,m,E)),this},o.prototype.prependOnceListener=function(m,E){return l(E),this.prependListener(m,w(this,m,E)),this},o.prototype.removeListener=function(m,E){var _,g,N,S,T;if(l(E),g=this._events,g===void 0)return this;if(_=g[m],_===void 0)return this;if(_===E||_.listener===E)--this._eventsCount===0?this._events=Object.create(null):(delete g[m],g.removeListener&&this.emit("removeListener",m,_.listener||E));else if(typeof _!="function"){for(N=-1,S=_.length-1;S>=0;S--)if(_[S]===E||_[S].listener===E){T=_[S].listener,N=S;break}if(N<0)return this;N===0?_.shift():a(_,N),_.length===1&&(g[m]=_[0]),g.removeListener!==void 0&&this.emit("removeListener",m,T||E)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(m){var E,_,g;if(_=this._events,_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[m]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[m]),this;if(arguments.length===0){var N=Object.keys(_),S;for(g=0;g<N.length;++g)S=N[g],S!=="removeListener"&&this.removeAllListeners(S);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(E=_[m],typeof E=="function")this.removeListener(m,E);else if(E!==void 0)for(g=E.length-1;g>=0;g--)this.removeListener(m,E[g]);return this};function C(v,m,E){var _=v._events;if(_===void 0)return[];var g=_[m];return g===void 0?[]:typeof g=="function"?E?[g.listener||g]:[g]:E?h(g):k(g,g.length)}o.prototype.listeners=function(m){return C(this,m,!0)},o.prototype.rawListeners=function(m){return C(this,m,!1)},o.listenerCount=function(v,m){return typeof v.listenerCount=="function"?v.listenerCount(m):R.call(v,m)},o.prototype.listenerCount=R;function R(v){var m=this._events;if(m!==void 0){var E=m[v];if(typeof E=="function")return 1;if(E!==void 0)return E.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};function k(v,m){for(var E=new Array(m),_=0;_<m;++_)E[_]=v[_];return E}function a(v,m){for(;m+1<v.length;m++)v[m]=v[m+1];v.pop()}function h(v){for(var m=new Array(v.length),E=0;E<m.length;++E)m[E]=v[E].listener||v[E];return m}function d(v,m){return new Promise(function(E,_){function g(S){v.removeListener(m,N),_(S)}function N(){typeof v.removeListener=="function"&&v.removeListener("error",g),E([].slice.call(arguments))}p(v,m,N,{once:!0}),m!=="error"&&f(v,g,{once:!0})})}function f(v,m,E){typeof v.on=="function"&&p(v,"error",m,E)}function p(v,m,E,_){if(typeof v.on=="function")_.once?v.once(m,E):v.on(m,E);else if(typeof v.addEventListener=="function")v.addEventListener(m,function g(N){_.once&&v.removeEventListener(m,g),E(N)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof v)}return sr}var Ho,Sa;function fv(){return Sa||(Sa=1,Ho=["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"]),Ho}var Vo,Ea;function dv(){if(Ea)return Vo;Ea=1;var e=He,t=e(ft()),n=e(dt()),r=Hl(),i=fv(),o=pt(),s="_constructorio_is_human",l=["scroll","resize","touchmove","mouseover","mousemove","keydown","keypress","keyup","focus"],u=function(){function c(){var y=this;(0,t.default)(this,c),this.isHumanBoolean=this.getIsHumanFromSessionStorage();var w=function C(){y.isHumanBoolean=!0,r.session.set(s,!0),l.forEach(function(R){o.removeEventListener(R,C,!0)})};this.isHumanBoolean||l.forEach(function(C){o.addEventListener(C,w,!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 w=o.getNavigator(),C=w.userAgent,R=w.webdriver,k=new RegExp("(".concat(i.join("|"),")"));return!!C.match(k)||!!R}}]),c}();return Vo=u,Vo}var Qo,Ca;function pv(){if(Ca)return Qo;Ca=1;var e=He,t=e(ft()),n=e(dt()),r=Hl(),i=dv(),o=pt(),s="_constructorio_requests",l=18e4,u=function(){function c(y,w){var C=this;(0,t.default)(this,c),this.options=y,this.eventemitter=w,this.humanity=new i,this.requestPending=!1,this.pageUnloading=!1,this.sendTrackingEvents=!!(y&&y.sendTrackingEvents===!0),o.addEventListener("beforeunload",function(){C.pageUnloading=!0}),this.sendTrackingEvents&&this.send()}return(0,n.default)(c,[{key:"queue",value:function(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GET",R=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:w,method:C,body:R,networkParameters:k}),c.set(a)}}},{key:"sendEvents",value:function(){var w=this,C=this.options.fetch,R=c.get();if((!o.canUseDOM()||this.humanity.isHuman())&&!this.requestPending&&!this.pageUnloading&&R.length){var k,a=R.shift(),h=a,d=h.networkParameters,f,p=this;if(c.set(R),d&&typeof AbortController=="function"){var v=new AbortController;f=v.signal,o.applyNetworkTimeout(this.options,d,v)}if(typeof a=="string"&&(a={url:a,method:"GET"}),a.url){var m=a.url.match(/\?.*_dt=([^&]+)/),E=parseInt(m&&m[1],10),_=+new Date;if(E&&Number.isInteger(E)&&_-E>l){this.sendTrackingEvents=!1,c.remove();return}}a.method==="GET"&&(k=C(a.url,{signal:f})),a.method==="POST"&&(k=C(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(g){g.ok?(p.eventemitter&&p.eventemitter.emit("success",{url:a.url,method:a.method,message:"ok"}),w.requestPending=!1,w.send()):g.json().then(function(N){p.eventemitter&&p.eventemitter.emit("error",{url:a.url,method:a.method,message:N&&N.message}),w.requestPending=!1,w.send()}).catch(function(N){p.eventemitter&&p.eventemitter.emit("error",{url:a.url,method:a.method,message:N.type}),w.requestPending=!1,w.send()})}).catch(function(g){p.eventemitter&&p.eventemitter.emit("error",{url:a.url,method:a.method,message:g&&g.toString&&g.toString()}),w.requestPending=!1,w.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(w){!w||Array.isArray(w)&&w.length===0?c.remove():r.local.set(s,w);var C=c.get();Array.isArray(C)&&C.length!==w.length&&(this.sendTrackingEvents=!1,c.remove())}},{key:"remove",value:function(){r.local.remove(s)}}]),c}();return Qo=u,Qo}var Wo,xa;function hv(){if(xa)return Wo;xa=1;var e=He,t=e(Qf()),n=e(Tr()),r=e(ft()),i=e(dt());function o(R,k){var a=Object.keys(R);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(R);k&&(h=h.filter(function(d){return Object.getOwnPropertyDescriptor(R,d).enumerable})),a.push.apply(a,h)}return a}function s(R){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)(R,h,a[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(R,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach(function(h){Object.defineProperty(R,h,Object.getOwnPropertyDescriptor(a,h))})}return R}var l=cv(),u=pt(),c=pv();function y(R,k){var a=k.apiKey,h=k.version,d=k.sessionId,f=k.clientId,p=k.userId,v=k.segments,m=k.testCells,E=k.requestMethod,_=k.beaconMode,g=u.getWindowLocation(),N=g.host,S=g.pathname,T=k.sendReferrerWithTrackingEvents!==!1,q=Object.assign(R);return h&&(q.c=h),f&&(q.i=f),d&&(q.s=d),p&&(q.ui=String(p)),v&&v.length&&(q.us=v),a&&(q.key=a),m&&Object.keys(m).forEach(function(I){q["ef-".concat(I)]=m[I]}),_&&E&&E.match(/POST/i)&&(q.beacon=!0),T&&N&&(q.origin_referrer=N,S&&(q.origin_referrer+=S)),q._dt=Date.now(),q=u.cleanParams(q),q}function w(R,k){return u.stringify(y(R,k))}var C=function(){function R(k){(0,r.default)(this,R),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)(R,[{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(w({},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(w(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,v=a;(0,n.default)(a)==="object"&&(p=a,v=""),f.user_input=v;var m="POST",E=y(f,s(s({},this.options),{},{requestMethod:m}));return this.requests.queue("".concat(d).concat(w({},this.options)),m,E,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(w(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={},v=a.item_name,m=a.name,E=a.item_id,_=a.customer_id,g=a.customerId,N=g===void 0?_:g,S=a.variation_id,T=a.itemName,q=T===void 0?v||m:T,I=a.itemId,M=I===void 0?E||N:I,H=a.variationId,F=H===void 0?S:H,z=a.url;q&&(p.item_name=q),M&&(p.item_id=M),F&&(p.variation_id=F),z&&(p.url=z);var x="".concat(d).concat(w(f,this.options)),P="POST",L=y(p,s(s({},this.options),{},{requestMethod:P}));return this.requests.queue(x,P,L,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,v=h.originalQuery,m=v===void 0?p:v,E=h.user_input,_=h.userInput,g=_===void 0?m||E:_,N=h.original_section,S=h.section,T=S===void 0?N:S,q=h.tr,I=h.group_id,M=h.groupId,H=M===void 0?I:M,F=h.item_id,z=h.itemId,x=z===void 0?F:z,P=h.variation_id,L=h.variationId,U=L===void 0?P:L,B={},W={user_input:g,tr:q,group_id:H,item_id:x,variation_id:U,item_name:a,section:T};T&&(B.section=T);var Q="".concat(f).concat(w(B,this.options)),V="POST",b=y(W,s(s({},this.options),{},{requestMethod:V}));return this.requests.queue(Q,V,b,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={},v=h.original_query,m=h.originalQuery,E=m===void 0?v:m,_=h.section,g=h.original_section,N=h.originalSection,S=N===void 0?g:N,T=h.tr,q=h.group_id,I=h.groupId,M=I===void 0?q:I,H=h.display_name,F=h.displayName,z=F===void 0?H:F;return E&&(p.original_query=E),T&&(p.tr=T),(S||_)&&(p.section=S||_),M&&(p.group={group_id:M,display_name:z}),this.requests.queue("".concat(f).concat(w(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,v=h.originalQuery,m=v===void 0?p:v,E=h.user_input,_=h.userInput,g=_===void 0?m||E:_,N=h.group_id,S=h.groupId,T=S===void 0?N:S,q=h.section,I={},M={user_input:g,search_term:a,section:q};T&&(M.filters={group_id:T}),q&&(I.section=q);var H="".concat(f).concat(w(I,this.options)),F="POST",z=y(M,s(s({},this.options),{},{requestMethod:F}));return this.requests.queue(H,F,z,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={},v=h.original_query,m=h.originalQuery,E=m===void 0?v:m,_=h.group_id,g=h.groupId,N=g===void 0?_:g,S=h.display_name,T=h.displayName,q=T===void 0?S:T;return E&&(p.original_query=E),N&&(p.group={group_id:N,display_name:q}),this.requests.queue("".concat(f).concat(w(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,v=h.numResults,m=v===void 0?p:v,E=h.result_count,_=h.resultCount,g=_===void 0?m||E:_,N=h.customer_ids,S=h.item_ids,T=h.items,q=T===void 0?N||S:T,I=h.result_page,M=h.resultPage,H=M===void 0?I:M,F=h.result_id,z=h.resultId,x=z===void 0?F:z,P=h.sort_order,L=h.sortOrder,U=L===void 0?P:L,B=h.sort_by,W=h.sortBy,Q=W===void 0?B:W,V=h.selected_filters,b=h.selectedFilters,Z=b===void 0?V:b,re=h.url,fe=h.section,le={},G;q&&Array.isArray(q)&&q.length!==0&&(G=q,typeof q[0]=="string"||typeof q[0]=="number"?G=q.map(function(Ue){return{item_id:String(Ue)}}):G=q.map(function(Ue){return u.toSnakeCaseKeys(Ue,!1)})),fe&&(le.section=fe);var Re={search_term:a,result_count:g,items:G,result_page:H,result_id:x,sort_order:U,sort_by:Q,selected_filters:Z,url:re,section:fe},de="".concat(f).concat(w(le,this.options)),ke="POST",ae=y(Re,s(s({},this.options),{},{requestMethod:ke}));return this.requests.queue(de,ke,ae,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},v=h.num_results,m=h.numResults,E=m===void 0?v:m,_=h.customer_ids,g=h.customerIds,N=g===void 0?_:g,S=h.item_ids,T=h.itemIds,q=T===void 0?S:T,I;return u.isNil(E)||(p.num_results=E),q&&Array.isArray(q)?I=q:N&&Array.isArray(N)&&(I=N),I&&Array.isArray(I)&&I.length&&(p.customer_ids=I.slice(0,100).join(",")),this.requests.queue("".concat(f).concat(w(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,v=h.customer_id,m=h.item_id,E=h.itemId,_=E===void 0?v||m:E,g=h.name,N=h.item_name,S=h.itemName,T=S===void 0?g||N:S,q=h.variation_id,I=h.variationId,M=I===void 0?q:I,H=h.result_id,F=h.resultId,z=F===void 0?H:F,x=h.result_count,P=h.resultCount,L=P===void 0?p||x:P,U=h.result_page,B=h.resultPage,W=B===void 0?U:B,Q=h.result_position_on_page,V=h.resultPositionOnPage,b=V===void 0?Q:V,Z=h.num_results_per_page,re=h.numResultsPerPage,fe=re===void 0?Z:re,le=h.selected_filters,G=h.selectedFilters,Re=G===void 0?le:G,de=h.section,ke={item_name:T,item_id:_,variation_id:M,result_id:z,result_count:L,result_page:W,result_position_on_page:b,num_results_per_page:fe,selected_filters:Re,section:de,search_term:a},ae={};de&&(ae.section=de);var Ue="".concat(f).concat(w(ae,this.options)),ot="POST",Un=y(ke,s(s({},this.options),{},{requestMethod:ot}));return this.requests.queue(Ue,ot,Un,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={},v=h.item_name,m=h.name,E=h.itemName,_=E===void 0?v||m:E,g=h.item_id,N=h.itemId,S=N===void 0?g:N,T=h.customer_id,q=h.customerId,I=q===void 0?T||S:q,M=h.variation_id,H=h.variationId,F=H===void 0?M:H,z=h.result_id,x=h.resultId,P=x===void 0?z:x,L=h.item_is_convertible,U=h.itemIsConvertible,B=U===void 0?L:U,W=h.section;return _&&(p.name=_),I&&(p.customer_id=I),F&&(p.variation_id=F),P&&(p.result_id=P),typeof B=="boolean"&&(p.item_is_convertible=B),W&&(p.section=W),this.requests.queue("".concat(f).concat(w(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?"),v={},m={},E=h.name,_=h.item_name,g=h.itemName,N=g===void 0?_||E:g,S=h.customer_id,T=h.customerId,q=T===void 0?S:T,I=h.item_id,M=h.itemId,H=M===void 0?I||q:M,F=h.variation_id,z=h.variationId,x=z===void 0?F:z,P=h.revenue,L=h.section,U=L===void 0?"Products":L,B=h.display_name,W=h.displayName,Q=W===void 0?B:W,V=h.type,b=h.is_custom_type,Z=h.isCustomType,re=Z===void 0?b:Z;H&&(m.item_id=H),N&&(m.item_name=N),x&&(m.variation_id=x),P&&(m.revenue=P.toString()),U&&(v.section=U,m.section=U),f&&(m.search_term=f),V&&(m.type=V),re&&(m.is_custom_type=re),Q&&(m.display_name=Q);var fe="".concat(p).concat(w(v,this.options)),le="POST",G=y(m,s(s({},this.options),{},{requestMethod:le}));return this.requests.queue(fe,le,G,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={},v=a.items,m=a.revenue,E=a.order_id,_=a.orderId,g=_===void 0?E:_,N=a.section;if(g){if(u.hasOrderIdRecord(g))return!1;u.addOrderIdRecord(g),p.order_id=g}v&&Array.isArray(v)&&(p.items=v.slice(0,100).map(function(I){return u.toSnakeCaseKeys(I,!1)})),m&&(p.revenue=m),N?f.section=N:f.section="Products";var S="".concat(d).concat(w(f,this.options)),T="POST",q=y(p,s(s({},this.options),{},{requestMethod:T}));return this.requests.queue(S,T,q,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,v=a.resultCount,m=v===void 0?p:v,E=a.result_page,_=a.resultPage,g=_===void 0?E:_,N=a.result_id,S=a.resultId,T=S===void 0?N:S,q=a.section,I=a.url,M=a.pod_id,H=a.podId,F=H===void 0?M:H,z=a.num_results_viewed,x=a.numResultsViewed,P=x===void 0?z:x,L=a.items;u.isNil(m)||(f.result_count=m),u.isNil(g)||(f.result_page=g),T&&(f.result_id=T),q?f.section=q:f.section="Products",I&&(f.url=I),F&&(f.pod_id=F),u.isNil(P)||(f.num_results_viewed=P),L&&Array.isArray(L)&&(f.items=L.slice(0,100).map(function(Q){return u.toSnakeCaseKeys(Q,!1)}));var U="".concat(d).concat(w({},this.options)),B="POST",W=y(f,s(s({},this.options),{},{requestMethod:B}));return this.requests.queue(U,B,W,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,v=a.variationId,m=v===void 0?p:v,E=a.section,_=E===void 0?"Products":E,g=a.result_id,N=a.resultId,S=N===void 0?g:N,T=a.result_count,q=a.resultCount,I=q===void 0?T:q,M=a.result_page,H=a.resultPage,F=H===void 0?M:H,z=a.result_position_on_page,x=a.resultPositionOnPage,P=x===void 0?z:x,L=a.num_results_per_page,U=a.numResultsPerPage,B=U===void 0?L:U,W=a.pod_id,Q=a.podId,V=Q===void 0?W:Q,b=a.strategy_id,Z=a.strategyId,re=Z===void 0?b:Z,fe=a.item_id,le=a.itemId,G=le===void 0?fe:le,Re=a.item_name,de=a.itemName,ke=de===void 0?Re:de;m&&(f.variation_id=m),_&&(f.section=_),S&&(f.result_id=S),u.isNil(I)||(f.result_count=I),u.isNil(F)||(f.result_page=F),u.isNil(P)||(f.result_position_on_page=P),u.isNil(B)||(f.num_results_per_page=B),V&&(f.pod_id=V),re&&(f.strategy_id=re),G&&(f.item_id=G),ke&&(f.item_name=ke);var ae="".concat(d).concat(w({},this.options)),Ue="POST",ot=y(f,s(s({},this.options),{},{requestMethod:Ue}));return this.requests.queue(ae,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,v=p===void 0?"Products":p,m=a.result_count,E=a.resultCount,_=E===void 0?m:E,g=a.result_page,N=a.resultPage,S=N===void 0?g:N,T=a.result_id,q=a.resultId,I=q===void 0?T:q,M=a.selected_filters,H=a.selectedFilters,F=H===void 0?M:H,z=a.url,x=a.sort_order,P=a.sortOrder,L=P===void 0?x:P,U=a.sort_by,B=a.sortBy,W=B===void 0?U:B,Q=a.filter_name,V=a.filterName,b=V===void 0?Q:V,Z=a.filter_value,re=a.filterValue,fe=re===void 0?Z:re,le=a.items;v&&(f.section=v),u.isNil(_)||(f.result_count=_),u.isNil(S)||(f.result_page=S),I&&(f.result_id=I),F&&(f.selected_filters=F),z&&(f.url=z),L&&(f.sort_order=L),W&&(f.sort_by=W),b&&(f.filter_name=b),fe&&(f.filter_value=fe),le&&Array.isArray(le)&&(f.items=le.slice(0,100).map(function(ke){return u.toSnakeCaseKeys(ke,!1)}));var G="".concat(d).concat(w({},this.options)),Re="POST",de=y(f,s(s({},this.options),{},{requestMethod:Re}));return this.requests.queue(G,Re,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,v=p===void 0?"Products":p,m=a.variation_id,E=a.variationId,_=E===void 0?m:E,g=a.result_id,N=a.resultId,S=N===void 0?g:N,T=a.result_count,q=a.resultCount,I=q===void 0?T:q,M=a.result_page,H=a.resultPage,F=H===void 0?M:H,z=a.result_position_on_page,x=a.resultPositionOnPage,P=x===void 0?z:x,L=a.num_results_per_page,U=a.numResultsPerPage,B=U===void 0?L:U,W=a.selected_filters,Q=a.selectedFilters,V=Q===void 0?W:Q,b=a.filter_name,Z=a.filterName,re=Z===void 0?b:Z,fe=a.filter_value,le=a.filterValue,G=le===void 0?fe:le,Re=a.customer_id,de=a.customerId,ke=de===void 0?Re:de,ae=a.item_id,Ue=a.itemId,ot=Ue===void 0?ke||ae:Ue,Un=a.item_name,Yf=a.name,Wl=a.itemName,bl=Wl===void 0?Un||Yf:Wl;v&&(f.section=v),_&&(f.variation_id=_),S&&(f.result_id=S),u.isNil(I)||(f.result_count=I),u.isNil(F)||(f.result_page=F),u.isNil(P)||(f.result_position_on_page=P),u.isNil(B)||(f.num_results_per_page=B),V&&(f.selected_filters=V),re&&(f.filter_name=re),G&&(f.filter_value=G),ot&&(f.item_id=ot),bl&&(f.item_name=bl);var Jf="".concat(d).concat(w({},this.options)),Kl="POST",Zf=y(f,s(s({},this.options),{},{requestMethod:Kl}));return this.requests.queue(Jf,Kl,Zf,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,v=a.itemId,m=v===void 0?p:v,E=a.item_name,_=a.itemName,g=_===void 0?E:_,N=a.variation_id,S=a.variationId,T=S===void 0?N:S,q=a.section,I=q===void 0?"Products":q;if(m){f.section=I,f.item_id=m,g&&(f.item_name=g),T&&(f.variation_id=T);var M="".concat(d).concat(w({},this.options)),H="POST",F=y(f,s(s({},this.options),{},{requestMethod:H}));return this.requests.queue(M,H,F,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,v=p===void 0?f:p,m=a.quiz_version_id,E=a.quizVersionId,_=E===void 0?m:E,g=a.quiz_session_id,N=a.quizSessionId,S=N===void 0?g:N,T=a.url,q=a.section,I=q===void 0?"Products":q,M=a.result_count,H=a.resultCount,F=H===void 0?M:H,z=a.result_id,x=a.resultId,P=x===void 0?z:x,L=a.result_page,U=a.resultPage,B=U===void 0?L:U,W={},Q={};if(typeof v!="string")return new Error('"quizId" is a required parameter of type string');if(typeof _!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof S!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof T!="string")return new Error('"url" is a required parameter of type string');if(Q.quiz_id=v,Q.quiz_version_id=_,Q.quiz_session_id=S,Q.url=T,!u.isNil(I)){if(typeof I!="string")return new Error('"section" must be a string');W.section=I,Q.section=I}if(!u.isNil(F)){if(typeof F!="number")return new Error('"resultCount" must be a number');Q.result_count=F}if(!u.isNil(P)){if(typeof P!="string")return new Error('"resultId" must be a string');Q.result_id=P}if(!u.isNil(B)){if(typeof B!="number")return new Error('"resultPage" must be a number');Q.result_page=B}Q.action_class="result_load";var V="".concat(d).concat(w(W,this.options)),b="POST",Z=y(Q,s(s({},this.options),{},{requestMethod:b}));return this.requests.queue(V,b,Z,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,v=p===void 0?f:p,m=a.quiz_version_id,E=a.quizVersionId,_=E===void 0?m:E,g=a.quiz_session_id,N=a.quizSessionId,S=N===void 0?g:N,T=a.item_id,q=a.itemId,I=q===void 0?T:q,M=a.item_name,H=a.itemName,F=H===void 0?M:H,z=a.result_count,x=a.resultCount,P=x===void 0?z:x,L=a.result_id,U=a.resultId,B=U===void 0?L:U,W=a.result_page,Q=a.resultPage,V=Q===void 0?W:Q,b=a.num_results_per_page,Z=a.numResultsPerPage,re=Z===void 0?b:Z,fe=a.result_position_on_page,le=a.resultPositionOnPage,G=le===void 0?fe:le,Re=a.section,de=Re===void 0?"Products":Re,ke={},ae={};if(typeof v!="string")return new Error('"quizId" is a required parameter of type string');if(typeof _!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof S!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof I!="string"&&typeof F!="string")return new Error('"itemId" or "itemName" is a required parameter of type string');if(ae.quiz_id=v,ae.quiz_version_id=_,ae.quiz_session_id=S,!u.isNil(I)){if(typeof I!="string")return new Error('"itemId" must be a string');ae.item_id=I}if(!u.isNil(F)){if(typeof F!="string")return new Error('"itemName" must be a string');ae.item_name=F}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');ae.result_count=P}if(!u.isNil(B)){if(typeof B!="string")return new Error('"resultId" must be a string');ae.result_id=B}if(!u.isNil(V)){if(typeof V!="number")return new Error('"resultPage" must be a number');ae.result_page=V}if(!u.isNil(re)){if(typeof re!="number")return new Error('"numResultsPerPage" must be a number');ae.num_results_per_page=re}if(!u.isNil(G)){if(typeof G!="number")return new Error('"resultPositionOnPage" must be a number');ae.result_position_on_page=G}ae.action_class="result_click";var Ue="".concat(d).concat(w(ke,this.options)),ot="POST",Un=y(ae,s(s({},this.options),{},{requestMethod:ot}));return this.requests.queue(Ue,ot,Un,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,v=p===void 0?f:p,m=a.quiz_version_id,E=a.quizVersionId,_=E===void 0?m:E,g=a.quiz_session_id,N=a.quizSessionId,S=N===void 0?g:N,T=a.item_id,q=a.itemId,I=q===void 0?T:q,M=a.item_name,H=a.itemName,F=H===void 0?M:H,z=a.variation_id,x=a.variationId,P=x===void 0?z:x,L=a.revenue,U=a.section,B=U===void 0?"Products":U,W=a.type,Q=a.is_custom_type,V=a.isCustomType,b=V===void 0?Q:V,Z=a.display_name,re=a.displayName,fe=re===void 0?Z:re,le={},G={};if(typeof v!="string")return new Error('"quizId" is a required parameter of type string');if(typeof _!="string")return new Error('"quizVersionId" is a required parameter of type string');if(typeof S!="string")return new Error('"quizSessionId" is a required parameter of type string');if(typeof I!="string"&&typeof F!="string")return new Error('"itemId" or "itemName" is a required parameter of type string');if(G.quiz_id=v,G.quiz_version_id=_,G.quiz_session_id=S,!u.isNil(I)){if(typeof I!="string")return new Error('"itemId" must be a string');G.item_id=I}if(!u.isNil(F)){if(typeof F!="string")return new Error('"itemName" must be a string');G.item_name=F}if(!u.isNil(P)){if(typeof P!="string")return new Error('"variationId" must be a string');G.variation_id=P}if(!u.isNil(L)){if(typeof L!="string")return new Error('"revenue" must be a string');G.revenue=L}if(!u.isNil(B)){if(typeof B!="string")return new Error('"section" must be a string');G.section=B}if(!u.isNil(W)){if(typeof W!="string")return new Error('"type" must be a string');G.type=W}if(!u.isNil(b)){if(typeof b!="boolean")return new Error('"isCustomType" must be a boolean');G.is_custom_type=b}if(!u.isNil(fe)){if(typeof fe!="string")return new Error('"displayName" must be a string');G.display_name=fe}G.action_class="conversion";var Re="".concat(d).concat(w(le,this.options)),de="POST",ke=y(G,s(s({},this.options),{},{requestMethod:de}));return this.requests.queue(Re,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)}}]),R}();return C.RequestQueue=c,Wo=C,Wo}const vv="@constructor-io/constructorio-client-javascript",gv="2.35.12",yv="Constructor.io JavaScript client",mv="lib/constructorio.js",_v="lib/types/constructorio.d.ts",wv={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"},kv={type:"git",url:"git+https://github.com/Constructor-io/constructorio-client-javascript.git"},Sv="constructor.io",Ev="MIT",Cv={url:"https://github.com/Constructor-io/constructorio-client-javascript/issues"},xv="https://github.com/Constructor-io/constructorio-client-javascript#readme",Rv=["lib/**/*"],zv={"@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"},Nv={"@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"},Tv={"@babel/runtime":"^7.19.0"},qv={directory:"src/types/tests"},Pv={name:vv,version:gv,description:yv,main:mv,types:_v,scripts:wv,repository:kv,author:Sv,license:Ev,bugs:Cv,homepage:xv,files:Rv,devDependencies:zv,dependencies:Nv,peerDependencies:Tv,tsd:qv};var Fi={},Iv={get exports(){return Fi},set exports(e){Fi=e}},ji={},Ov={get exports(){return ji},set exports(e){ji=e}},Di={},Lv={get exports(){return Di},set exports(e){Di=e}},Ra;function Wf(){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}(Lv)),Di}var za;function Av(){return za||(za=1,function(e){var t=Wf();function n(r){if(Array.isArray(r))return t(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Ov)),ji}var Hi={},Bv={get exports(){return Hi},set exports(e){Hi=e}},Na;function Uv(){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}(Bv)),Hi}var Vi={},Mv={get exports(){return Vi},set exports(e){Vi=e}},Ta;function Fv(){return Ta||(Ta=1,function(e){var t=Wf();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}(Mv)),Vi}var Qi={},jv={get exports(){return Qi},set exports(e){Qi=e}},qa;function Dv(){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}(jv)),Qi}var Pa;function Hv(){return Pa||(Pa=1,function(e){var t=Av(),n=Uv(),r=Fv(),i=Dv();function o(s){return t(s)||n(s)||r(s)||i()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}(Iv)),Fi}var bo,Ia;function Vv(){if(Ia)return bo;Ia=1;var e=He,t=e(ft()),n=e(dt()),r=e(Hv()),i=e(Tr()),o=Bn(),s=pt();function l(c,y,w,C){var R=w.apiKey,k=w.clientId,a=w.sessionId,h=w.segments,d=w.userId,f=w.version,p=w.quizzesServiceUrl,v={c:f},m="";if(v.key=R,v.i=k,v.s=a,h&&h.length&&(v.us=h),d&&(v.ui=String(d)),!c||typeof c!="string")throw new Error("quizId is a required parameter of type string");if(C==="results"&&((0,i.default)(y.answers)!=="object"||!Array.isArray(y.answers)||y.answers.length===0))throw new Error("answers is a required parameter of type array");if(y){var E=y.section,_=y.answers,g=y.quizSessionId,N=y.quizVersionId,S=y.page,T=y.resultsPerPage,q=y.filters;E&&(v.section=E),N&&(v.quiz_version_id=N),g&&(v.quiz_session_id=g),_&&_.length&&(m="&".concat(s.stringify({a:_.map(function(M){return(0,r.default)(M).join(",")})}))),s.isNil(S)||(v.page=S),s.isNil(T)||(v.num_results_per_page=T),q&&(v.filters=q)}v._dt=Date.now(),v=s.cleanParams(v);var I=s.stringify(v);return"".concat(p,"/v1/quizzes/").concat(encodeURIComponent(c),"/").concat(encodeURIComponent(C),"/?").concat(I).concat(m)}var u=function(){function c(y){(0,t.default)(this,c),this.options=y||{},this.eventDispatcher=new o(y.eventDispatcher)}return(0,n.default)(c,[{key:"getQuizNextQuestion",value:function(w,C){var R=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(w,C,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 R.eventDispatcher.queue("quizzes.getQuizNextQuestion.completed",p),p;throw new Error("getQuizNextQuestion response data is malformed")})}},{key:"getQuizResults",value:function(w,C){var R=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(w,C,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 R.eventDispatcher.queue("quizzes.getQuizResults.completed",p),p;throw new Error("getQuizResults response data is malformed")})}}]),c}();return bo=u,bo}var bf=He,Qv=bf(ft()),Wv=bf(dt()),bv=Jh(),Kv=$h(),Gv=iv(),Xv=sv(),Yv=lv(),Jv=uv(),Kf=hv(),Zv=Bn(),Vl=pt(),$v=Pv,eg=$v.version,tg=Vv(),ng=function(){var t="ciojs-client-",n=[];return Vl.canUseDOM()||n.push("domless"),typeof process<"u"&&typeof process.env<"u"&&{}.BUNDLED&&n.push("bundled"),"".concat(t).concat(n.join("-")).concat(n.length?"-":"").concat(eg)},Ql=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,Qv.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,y=t.userId,w=t.fetch,C=t.trackingSendDelay,R=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,v,m=typeof It<"u"&&It.CLIENT_VERSION;if(Vl.canUseDOM()){var E=new bv(h||{});p=E.session_id,v=E.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||ng(),serviceUrl:i&&i.replace(/\/$/,"")||"https://ac.cnstrc.com",quizzesServiceUrl:o&&o.replace(/\/$/,"")||"https://quizzes.cnstrc.com",sessionId:c||p,clientId:u||v,userId:y,segments:s,testCells:l,fetch:w||Kv({Promise}).fetch,trackingSendDelay:C,sendTrackingEvents:k,sendReferrerWithTrackingEvents:R,eventDispatcher:a,beaconMode:d!==!1,networkParameters:f||{}},this.search=new Gv(this.options),this.browse=new Xv(this.options),this.autocomplete=new Yv(this.options),this.recommendations=new Jv(this.options),this.tracker=new Kf(this.options),this.quizzes=new tg(this.options),new Zv(t.eventDispatcher).queue("instantiated",this.options)}return(0,Wv.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}();Ql.Tracker=Kf;Vl.canUseDOM()&&(window.ConstructorioClient=Ql);var rg=Ql;const ig=e=>{if(e)return new rg({apiKey:e,sendTrackingEvents:!0})},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)=>{const{quiz_id:n,quiz_session_id:r,quiz_version_id:i,result_id:o,request:s,response:l}=t;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})},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:y,num_results_per_page:w},response:{total_num_results:C}}=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:C,resultPage:y,resultId:u,resultPositionOnPage:r,numResultsPerPage:w})}},ag=(e,t,n,r)=>{var i,o;if(t.request){const{quiz_id:s,quiz_session_id:l,quiz_version_id:u,request:{section:c}}=t;e==null||e.tracker.trackQuizConversion({quizId:s,quizVersionId:u,quizSessionId:l,itemId:(i=n.data)==null?void 0:i.id,itemName:n.value,section:c,variationId:(o=n.data)==null?void 0:o.variation_id,revenue:r&&String(r)||void 0})}},cg=({apiKey:e,cioJsClient:t})=>{if(!e&&!t)throw new Error("Either apiKey or cioJsClient is required");return D.useMemo(()=>t||ig(e),[e,t])},fg=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 dg(e,t,n,r){var C;const i=n==null?void 0:n.type,o=(C=n==null?void 0:n.options)==null?void 0:C.some(R=>R.images),[s,l]=D.useState({}),u=D.useRef({}),c=D.useCallback(R=>{if(i===Y.SingleSelect)u.current=!0,l({[R]:!0});else if(i===Y.MultipleSelect)if(s[R]){const k={...s};delete k[R],l(k)}else l({...s,[R]:!0})},[s,i]),y=(R,k)=>{((R==null?void 0:R.key)===" "||(R==null?void 0:R.key)==="Enter")&&c(k)};return D.useEffect(()=>{var R;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)&&((R=a==null?void 0:a.value)==null||R.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 R=Object.keys(s).filter(k=>s[Number(k)]);e(R)}},[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(R=>({className:`${o?"cio-question-option-container":"cio-question-option-container-text-only"} ${s[R.id]?"selected":""}`,onClick:()=>{c(R.id)},onKeyDown:k=>{y(k,R.id)},role:"button",tabIndex:0,key:R.id}),[n==null?void 0:n.id,s])}function pg(e,t){return D.useEffect(()=>{(t==null?void 0:t.type)==="cover"&&e("")},[e,t]),D.useCallback(()=>({}),[])}function hg(e,t,n,r){const[i,o]=D.useState(""),s=D.useCallback(c=>{o(c.target.value)},[]),l=D.useCallback(c=>{const{key:y}=c;y==="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 y=(c=r[n.id])==null?void 0:c.value;o(y||"")}},[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 vg(e,t,n){return D.useCallback(()=>{var s,l,u,c,y;const i=(s=t.quizCurrentQuestion)==null?void 0:s.next_question.id;let o;return i&&!((l=t.quizCurrentQuestion)!=null&&l.isCoverQuestion)&&(o=!((u=n.answerInputs[i])!=null&&u.value)||!((y=(c=n.answerInputs[i])==null?void 0:c.value)!=null&&y.length)),{className:o?"cio-question-cta-button disabled":"cio-question-cta-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,n.answerInputs,e])}function gg(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])}const yg=(e,t,n)=>{var _,g,N;const{quizAnswerChanged:r,nextQuestion:i,previousQuestion:o,resetQuiz:s,hydrateQuiz:l,addToCart:u,resultClick:c}=e,y=hg(r,i,(_=t.quizCurrentQuestion)==null?void 0:_.next_question,n.answerInputs),w=pg(r,(g=t.quizCurrentQuestion)==null?void 0:g.next_question),C=dg(r,i,(N=t.quizCurrentQuestion)==null?void 0:N.next_question,n.answerInputs),R=vg(i,t,n),k=gg(t,o),a=D.useCallback(()=>({className:"cio-question-redo-button",type:"button",onClick:()=>s()}),[s]),h=D.useCallback(()=>({className:"",type:"button",onClick:()=>l()}),[l]),d=D.useCallback((S,T)=>({className:"cio-result-card-cta-button",type:"button",onClick:q=>u(q,S,T)}),[u]),f=D.useCallback((S,T,q)=>{((S==null?void 0:S.key)===" "||(S==null?void 0:S.key)==="Enter")&&c&&c(T,q)},[c]),p=D.useCallback(({result:S,position:T})=>({className:"cio-result-card-container",role:"button",tabIndex:0,onClick:()=>c(S,T),onKeyDown:q=>f(q,S,T)}),[f,c]),v=D.useCallback(({result:S,position:T})=>{var q;return{href:(q=S.data)==null?void 0:q.url,onClick:()=>c(S,T),onKeyDown:I=>f(I,S,T)}},[f,c]),m=D.useCallback(()=>{var S,T,q,I,M,H;return{src:(q=(T=(S=t.quizCurrentQuestion)==null?void 0:S.next_question)==null?void 0:T.images)==null?void 0:q.primary_url,alt:(H=(M=(I=t.quizCurrentQuestion)==null?void 0:I.next_question)==null?void 0:M.images)==null?void 0:H.primary_alt}},[t.quizCurrentQuestion]),E=D.useCallback(S=>{var T,q;return{className:"cio-question-option-image",src:(T=S==null?void 0:S.images)==null?void 0:T.primary_url,alt:(q=S==null?void 0:S.images)==null?void 0:q.primary_alt}},[]);return{getOpenTextInputProps:y,getNextQuestionButtonProps:R,getPreviousQuestionButtonProps:k,getQuizImageProps:m,getSelectQuestionImageProps:E,getSelectInputProps:C,getCoverQuestionProps:w,getResetQuizButtonProps:a,getHydrateQuizButtonProps:h,getAddToCartButtonProps:d,getQuizResultButtonProps:p,getQuizResultLinkProps:v}},mg=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,y,w]=xh(Number(s),Number(l),Number(u));n={"--primary-color-h":`${c}`,"--primary-color-s":`${y}%`,"--primary-color-l":`${w}%`}}}return n},[e]),_g=(e,t,n)=>{D.useEffect(()=>{var r;t.quizResults&&(lg(e,t.quizResults),n&&jl(n)&&((r=t.quizResults.response)!=null&&r.results)&&n(t.quizResults.response.results))},[t,e,n])},wg=(e,t,n)=>D.useCallback((i,o)=>{t.quizResults&&(ug(e,t.quizResults,i,o),jl(n)&&n(i,o))},[t,e,n]),kg=(e,t,n)=>D.useCallback((i,o,s)=>{i.preventDefault(),t.quizResults&&(ag(e,t.quizResults,o,s),jl(n)&&n(o))},[t,e,n]),Sg=(e,t)=>D.useCallback(()=>{t&&t({type:Y.Back,payload:e.quizCurrentQuestion})},[t,e.quizCurrentQuestion]),Eg=(e,t)=>D.useCallback(r=>{var s;const i=(s=e.quizCurrentQuestion)==null?void 0:s.next_question.type,o=e.quizCurrentQuestion;switch(i){case Y.Cover:t({type:Y.Cover,payload:{questionId:o.next_question.id,input:"",isLastQuestion:o.is_last_question}});break;case Y.OpenText:t({type:Y.OpenText,payload:{questionId:o.next_question.id,input:r,isLastQuestion:o.is_last_question}});break;case Y.SingleSelect:case Y.MultipleSelect:t({type:o.next_question.type,payload:{questionId:o.next_question.id,input:r,isLastQuestion:o.is_last_question}});break}},[e,t]),Cg=(e,t,n)=>D.useCallback(()=>{var s,l;const i=(s=e.quizCurrentQuestion)==null?void 0:s.next_question,o=i==null?void 0:i.id;if(n&&o){const u=t.answerInputs[o];((l=u==null?void 0:u.value)!=null&&l.length||(i==null?void 0:i.type)==="cover")&&n({type:Y.Next,payload:e.quizCurrentQuestion})}},[n,e.quizCurrentQuestion,t.answerInputs]),xg=(e,t,n,r)=>D.useCallback(()=>{r&&(t({type:Y.Reset}),n({type:Ke.RESET_QUIZ}))},[t,n,e,r]),Rg=(e,t)=>{const n=Hf(e);return D.useCallback(()=>{n&&t({type:Y.Hydrate,payload:n})},[t,n])},zg=(e,t,n)=>{const{quizApiState:r,dispatchLocalState:i,dispatchApiState:o,hasQuizStoredState:s,quizStateKey:l,quizLocalState:u}=n,{resultsPageOptions:c}=e,{onAddToCartClick:y,onQuizResultClick:w,onQuizResultsLoaded:C}=c,R=Eg(r,i),k=Cg(r,u,i),a=Sg(r,i),h=kg(t,r,y),d=wg(t,r,w);_g(t,r,C);const f=xg(l,i,o,r.quizResults),p=Rg(l,i);return{addToCart:h,resultClick:d,quizAnswerChanged:R,previousQuestion:a,nextQuestion:k,resetQuiz:f,hydrateQuiz:p,hasSessionStorageState:s,resetSessionStorageState:Eh(l)}},Gf={quizRequestState:Pt.Stale};function Ng(e,t){var n,r,i,o,s,l,u,c,y,w,C,R;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};case Ke.SET_CURRENT_QUESTION:{const{isOpenQuestion:k,isCoverQuestion:a,isSingleQuestion:h,isMultipleQuestion:d,isSelectQuestion:f}=Df((i=(r=(n=t.payload)==null?void 0:n.quizCurrentQuestion)==null?void 0:r.next_question)==null?void 0:i.type),p=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:(p==null?void 0:p.next_question.id)===((c=(u=(l=t.payload)==null?void 0:l.quizCurrentQuestion)==null?void 0:u.next_question)==null?void 0:c.id),isOpenQuestion:k,isCoverQuestion:a,isSingleQuestion:h,isMultipleQuestion:d,isSelectQuestion:f},quizFirstQuestion:p,quizResults:void 0}}case Ke.SET_QUIZ_RESULTS:{const k=((C=(w=(y=t.payload)==null?void 0:y.quizResults)==null?void 0:w.request)==null?void 0:C.collection_filter_expression)||null,a=[...new Set(Hs(k))];return{...e,quizRequestState:Pt.Success,quizResults:(R=t.payload)==null?void 0:R.quizResults,quizResultsFilters:a,quizCurrentQuestion:void 0}}case Ke.RESET_QUIZ:return Gf;default:return e}}const Tg=(e,t,n,r)=>{const[i,o]=D.useReducer(Ng,Gf),{quizId:s,quizVersionId:l,resultsPageOptions:u}=e;return D.useEffect(()=>{(async()=>{if(o({type:Ke.SET_IS_LOADING}),n.isLastAnswer)try{const c=await sg(t,s,{answers:n.answers,resultsPerPage:u==null?void 0:u.numResultsToDisplay,quizVersionId:n.quizVersionId,quizSessionId:n.quizSessionId});o({type:Ke.SET_QUIZ_RESULTS,payload:{quizResults:c}})}catch{o({type:Ke.SET_IS_ERROR})}else try{const c=n.quizVersionId||l,{quizSessionId:y}=n,w=await og(t,s,{answers:n.answers,quizVersionId:c,quizSessionId:y});(!y&&(w!=null&&w.quiz_session_id)||!c&&w.quiz_version_id)&&r({type:Y.Hydrate,payload:{quizVersionId:w==null?void 0:w.quiz_version_id,quizSessionId:w==null?void 0:w.quiz_session_id}}),o({type:Ke.SET_CURRENT_QUESTION,payload:{quizCurrentQuestion:w}})}catch{o({type:Ke.SET_IS_ERROR})}})()},[t,s,n.answers,u==null?void 0:u.numResultsToDisplay]),{quizApiState:i,dispatchApiState:o}},Xf={answers:[],answerInputs:{},isLastAnswer:!1};function Kr(e,t){return{...e,[String(t.payload.questionId)]:{type:t.type,value:t.payload.input}}}function qg(e,t){var n,r,i,o,s;switch(t.type){case Y.OpenText:return{...e,answerInputs:Kr(e.answerInputs,t),isLastAnswer:!!((n=t.payload)!=null&&n.isLastQuestion)};case Y.Cover:return{...e,answerInputs:Kr(e.answerInputs,t),isLastAnswer:!!((r=t.payload)!=null&&r.isLastQuestion)};case Y.SingleSelect:return{...e,answerInputs:Kr(e.answerInputs,t),isLastAnswer:!!((i=t.payload)!=null&&i.isLastQuestion)};case Y.MultipleSelect:return{...e,answerInputs:Kr(e.answerInputs,t),isLastAnswer:!!((o=t.payload)!=null&&o.isLastQuestion)};case Y.Next:{const{answers:l}=e,u=[...l],c=l.length,y=(s=Object.values(e.answerInputs))==null?void 0:s[c];switch(y.type){case Y.OpenText:u.push(["true"]);break;case Y.Cover:u.push(["seen"]);break;case Y.SingleSelect:u.push(y.value);break;case Y.MultipleSelect:u.push(y.value);break;default:u.push([])}return{...e,answers:u}}case Y.Back:{const l={...e.answerInputs};return{...e,answerInputs:l,answers:[...e.answers.slice(0,-1)],isLastAnswer:!1}}case Y.Reset:return{...Xf};case Y.Hydrate:return{...e,...t.payload};default:return e}}const Pg=e=>{const[t,n]=D.useReducer(qg,Xf),r=e||jh;D.useEffect(()=>{var s,l;(s=t==null?void 0:t.answers)!=null&&s.length&&((l=window==null?void 0:window.sessionStorage)==null||l.setItem(r,JSON.stringify(t)))},[t,r]);const i=()=>Hf(r)!==null,o=D.useCallback(s=>{Ch(s),n(s)},[]);return{quizLocalState:t,hasQuizStoredState:i,dispatchLocalState:o,quizStateKey:r}},Ig=(e,t)=>{const{sessionStateOptions:n}=e,{quizLocalState:r,dispatchLocalState:i,hasQuizStoredState:o,quizStateKey:s}=Pg(n==null?void 0:n.sessionStateKey),{quizApiState:l,dispatchApiState:u}=Tg(e,t,r,i);return{quizApiState:l,quizLocalState:r,dispatchApiState:u,dispatchLocalState:i,hasQuizStoredState:o,quizStateKey:s}},Og=e=>{const{apiKey:t,cioJsClient:n,primaryColor:r}=e;fg(e);const i=cg({apiKey:t,cioJsClient:n}),o=Ig(e,i),s=zg(e,i,o),{quizApiState:l,quizLocalState:u}=o,c=yg(s,l,u),y=mg(r);return console.log("quizLocalState.answerInputs",u.answerInputs),{cioClient:i,state:{answers:{inputs:u.answerInputs,isLastAnswer:u.isLastAnswer},quiz:{requestState:l.quizRequestState,versionId:u.quizVersionId,sessionId:u.quizSessionId,currentQuestion:l.quizCurrentQuestion,results:l.quizResults,resultsFilters:l.quizResultsFilters}},events:{...s},...c,primaryColorStyles:y}};function Lg({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 O.createElement("div",{className:"cio-session-prompt-modal",role:"presentation",onClick:i},O.createElement("div",{className:"cio-session-prompt-container"},O.createElement("div",{className:"cio-session-prompt-content",role:"presentation",onClick:l=>l.stopPropagation()},O.createElement("div",null,"Do you want to continue where you left off?"),O.createElement("div",{className:"cio-session-prompt-controls-container"},O.createElement(qi,{ctaText:"No",type:"button",propsGetters:s}),O.createElement(qi,{type:"button",ctaText:"Yes",propsGetters:o})))))}return null}function Ag(e){const{cioClient:t,state:n,events:{hydrateQuiz:r,hasSessionStorageState:i,resetSessionStorageState:o},getAddToCartButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:c,getOpenTextInputProps:y,getPreviousQuestionButtonProps:w,getQuizImageProps:C,getQuizResultButtonProps:R,getQuizResultLinkProps:k,getResetQuizButtonProps:a,getSelectInputProps:h,primaryColorStyles:d}=Og(e),[f,p]=D.useState(!1),{resultsPageOptions:v,sessionStateOptions:m}=e;D.useEffect(()=>{(m==null?void 0:m.showSessionModal)!==void 0?p((m==null?void 0:m.showSessionModal)&&i()):p(i())},[]);const E={cioClient:t,state:n,getAddToCartButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:c,getOpenTextInputProps:y,getPreviousQuestionButtonProps:w,getQuizImageProps:C,getQuizResultButtonProps:R,getQuizResultLinkProps:k,getResetQuizButtonProps:a,getSelectInputProps:h,customClickItemCallback:!!(v!=null&&v.onQuizResultClick),primaryColorStyles:d};return n.quiz.requestState===Pt.Loading?O.createElement("div",{className:"cio-quiz"},O.createElement(Dh,null)):n.quiz.requestState===Pt.Success?O.createElement("div",{className:"cio-quiz"},O.createElement("style",null,".cio-quiz ",Rh(d)),O.createElement(Lg,{resetStoredState:o,continueSession:r,showSessionPrompt:f,setShowSessionPrompt:p}),O.createElement(Be.Provider,{value:E},n.quiz.results&&O.createElement(Fh,{options:v}),n.quiz.currentQuestion&&O.createElement(Ph,null))):null}const Bg=({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),Ko.createRoot(i).render(O.createElement(O.StrictMode,null,O.createElement(Ag,{...n})))}};window&&(window.CioQuiz=Bg);export{Bg 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}(jv)),Qi}var Pa;function Hv(){return Pa||(Pa=1,function(e){var t=Av(),n=Uv(),r=Fv(),i=Dv();function o(s){return t(s)||n(s)||r(s)||i()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}(Iv)),Fi}var bo,Ia;function Vv(){if(Ia)return bo;Ia=1;var e=He,t=e(ft()),n=e(dt()),r=e(Hv()),i=e(Tr()),o=Bn(),s=pt();function l(c,y,w,C){var R=w.apiKey,k=w.clientId,a=w.sessionId,h=w.segments,d=w.userId,f=w.version,p=w.quizzesServiceUrl,v={c:f},m="";if(v.key=R,v.i=k,v.s=a,h&&h.length&&(v.us=h),d&&(v.ui=String(d)),!c||typeof c!="string")throw new Error("quizId is a required parameter of type string");if(C==="results"&&((0,i.default)(y.answers)!=="object"||!Array.isArray(y.answers)||y.answers.length===0))throw new Error("answers is a required parameter of type array");if(y){var E=y.section,_=y.answers,g=y.quizSessionId,N=y.quizVersionId,S=y.page,T=y.resultsPerPage,q=y.filters;E&&(v.section=E),N&&(v.quiz_version_id=N),g&&(v.quiz_session_id=g),_&&_.length&&(m="&".concat(s.stringify({a:_.map(function(M){return(0,r.default)(M).join(",")})}))),s.isNil(S)||(v.page=S),s.isNil(T)||(v.num_results_per_page=T),q&&(v.filters=q)}v._dt=Date.now(),v=s.cleanParams(v);var I=s.stringify(v);return"".concat(p,"/v1/quizzes/").concat(encodeURIComponent(c),"/").concat(encodeURIComponent(C),"/?").concat(I).concat(m)}var u=function(){function c(y){(0,t.default)(this,c),this.options=y||{},this.eventDispatcher=new o(y.eventDispatcher)}return(0,n.default)(c,[{key:"getQuizNextQuestion",value:function(w,C){var R=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(w,C,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 R.eventDispatcher.queue("quizzes.getQuizNextQuestion.completed",p),p;throw new Error("getQuizNextQuestion response data is malformed")})}},{key:"getQuizResults",value:function(w,C){var R=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(w,C,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 R.eventDispatcher.queue("quizzes.getQuizResults.completed",p),p;throw new Error("getQuizResults response data is malformed")})}}]),c}();return bo=u,bo}var bf=He,Qv=bf(ft()),Wv=bf(dt()),bv=Jh(),Kv=$h(),Gv=iv(),Xv=sv(),Yv=lv(),Jv=uv(),Kf=hv(),Zv=Bn(),Vl=pt(),$v=Pv,eg=$v.version,tg=Vv(),ng=function(){var t="ciojs-client-",n=[];return Vl.canUseDOM()||n.push("domless"),typeof process<"u"&&typeof process.env<"u"&&{}.BUNDLED&&n.push("bundled"),"".concat(t).concat(n.join("-")).concat(n.length?"-":"").concat(eg)},Ql=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};(0,Qv.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,y=t.userId,w=t.fetch,C=t.trackingSendDelay,R=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,v,m=typeof It<"u"&&It.CLIENT_VERSION;if(Vl.canUseDOM()){var E=new bv(h||{});p=E.session_id,v=E.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||ng(),serviceUrl:i&&i.replace(/\/$/,"")||"https://ac.cnstrc.com",quizzesServiceUrl:o&&o.replace(/\/$/,"")||"https://quizzes.cnstrc.com",sessionId:c||p,clientId:u||v,userId:y,segments:s,testCells:l,fetch:w||Kv({Promise}).fetch,trackingSendDelay:C,sendTrackingEvents:k,sendReferrerWithTrackingEvents:R,eventDispatcher:a,beaconMode:d!==!1,networkParameters:f||{}},this.search=new Gv(this.options),this.browse=new Xv(this.options),this.autocomplete=new Yv(this.options),this.recommendations=new Jv(this.options),this.tracker=new Kf(this.options),this.quizzes=new tg(this.options),new Zv(t.eventDispatcher).queue("instantiated",this.options)}return(0,Wv.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}();Ql.Tracker=Kf;Vl.canUseDOM()&&(window.ConstructorioClient=Ql);var rg=Ql;const ig=e=>{if(e)return new rg({apiKey:e,sendTrackingEvents:!0})},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)=>{const{quiz_id:n,quiz_session_id:r,quiz_version_id:i,result_id:o,request:s,response:l}=t;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})},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:y,num_results_per_page:w},response:{total_num_results:C}}=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:C,resultPage:y,resultId:u,resultPositionOnPage:r,numResultsPerPage:w})}},ag=(e,t,n,r)=>{var i,o;if(t.request){const{quiz_id:s,quiz_session_id:l,quiz_version_id:u,request:{section:c}}=t;e==null||e.tracker.trackQuizConversion({quizId:s,quizVersionId:u,quizSessionId:l,itemId:(i=n.data)==null?void 0:i.id,itemName:n.value,section:c,variationId:(o=n.data)==null?void 0:o.variation_id,revenue:r&&String(r)||void 0})}},cg=({apiKey:e,cioJsClient:t})=>{if(!e&&!t)throw new Error("Either apiKey or cioJsClient is required");return D.useMemo(()=>t||ig(e),[e,t])},fg=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 dg(e,t,n,r){var C;const i=n==null?void 0:n.type,o=(C=n==null?void 0:n.options)==null?void 0:C.some(R=>R.images),[s,l]=D.useState({}),u=D.useRef({}),c=D.useCallback(R=>{if(i===Y.SingleSelect)u.current=!0,l({[R]:!0});else if(i===Y.MultipleSelect)if(s[R]){const k={...s};delete k[R],l(k)}else l({...s,[R]:!0})},[s,i]),y=(R,k)=>{((R==null?void 0:R.key)===" "||(R==null?void 0:R.key)==="Enter")&&c(k)};return D.useEffect(()=>{var R;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)&&((R=a==null?void 0:a.value)==null||R.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 R=Object.keys(s).filter(k=>s[Number(k)]);e(R)}},[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(R=>({className:`${o?"cio-question-option-container":"cio-question-option-container-text-only"} ${s[R.id]?"selected":""}`,onClick:()=>{c(R.id)},onKeyDown:k=>{y(k,R.id)},role:"button",tabIndex:0,key:R.id}),[n==null?void 0:n.id,s])}function pg(e,t){return D.useEffect(()=>{(t==null?void 0:t.type)==="cover"&&e("")},[e,t]),D.useCallback(()=>({}),[])}function hg(e,t,n,r){const[i,o]=D.useState(""),s=D.useCallback(c=>{o(c.target.value)},[]),l=D.useCallback(c=>{const{key:y}=c;y==="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 y=(c=r[n.id])==null?void 0:c.value;o(y||"")}},[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 vg(e,t,n){return D.useCallback(()=>{var s,l,u,c,y;const i=(s=t.quizCurrentQuestion)==null?void 0:s.next_question.id;let o;return i&&!((l=t.quizCurrentQuestion)!=null&&l.isCoverQuestion)&&(o=!((u=n.answerInputs[i])!=null&&u.value)||!((y=(c=n.answerInputs[i])==null?void 0:c.value)!=null&&y.length)),{className:o?"cio-question-cta-button disabled":"cio-question-cta-button",type:"button",onClick:()=>{e()}}},[t.quizCurrentQuestion,n.answerInputs,e])}function gg(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])}const yg=(e,t,n)=>{var _,g,N;const{quizAnswerChanged:r,nextQuestion:i,previousQuestion:o,resetQuiz:s,hydrateQuiz:l,addToCart:u,resultClick:c}=e,y=hg(r,i,(_=t.quizCurrentQuestion)==null?void 0:_.next_question,n.answerInputs),w=pg(r,(g=t.quizCurrentQuestion)==null?void 0:g.next_question),C=dg(r,i,(N=t.quizCurrentQuestion)==null?void 0:N.next_question,n.answerInputs),R=vg(i,t,n),k=gg(t,o),a=D.useCallback((S="primary")=>({className:S==="primary"?"cio-question-cta-button":"cio-question-redo-button",type:"button",onClick:()=>s()}),[s]),h=D.useCallback(()=>({className:"",type:"button",onClick:()=>l()}),[l]),d=D.useCallback((S,T)=>({className:"cio-result-card-cta-button",type:"button",onClick:q=>u(q,S,T)}),[u]),f=D.useCallback((S,T,q)=>{((S==null?void 0:S.key)===" "||(S==null?void 0:S.key)==="Enter")&&c&&c(T,q)},[c]),p=D.useCallback(({result:S,position:T})=>({className:"cio-result-card-container",role:"button",tabIndex:0,onClick:()=>c(S,T),onKeyDown:q=>f(q,S,T)}),[f,c]),v=D.useCallback(({result:S,position:T})=>{var q;return{href:(q=S.data)==null?void 0:q.url,onClick:()=>c(S,T),onKeyDown:I=>f(I,S,T)}},[f,c]),m=D.useCallback(()=>{var S,T,q,I,M,H;return{src:(q=(T=(S=t.quizCurrentQuestion)==null?void 0:S.next_question)==null?void 0:T.images)==null?void 0:q.primary_url,alt:(H=(M=(I=t.quizCurrentQuestion)==null?void 0:I.next_question)==null?void 0:M.images)==null?void 0:H.primary_alt}},[t.quizCurrentQuestion]),E=D.useCallback(S=>{var T,q;return{className:"cio-question-option-image",src:(T=S==null?void 0:S.images)==null?void 0:T.primary_url,alt:(q=S==null?void 0:S.images)==null?void 0:q.primary_alt}},[]);return{getOpenTextInputProps:y,getNextQuestionButtonProps:R,getPreviousQuestionButtonProps:k,getQuizImageProps:m,getSelectQuestionImageProps:E,getSelectInputProps:C,getCoverQuestionProps:w,getResetQuizButtonProps:a,getHydrateQuizButtonProps:h,getAddToCartButtonProps:d,getQuizResultButtonProps:p,getQuizResultLinkProps:v}},mg=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,y,w]=xh(Number(s),Number(l),Number(u));n={"--primary-color-h":`${c}`,"--primary-color-s":`${y}%`,"--primary-color-l":`${w}%`}}}return n},[e]),_g=(e,t,n)=>{D.useEffect(()=>{var r;t.quizResults&&(lg(e,t.quizResults),n&&jl(n)&&((r=t.quizResults.response)!=null&&r.results)&&n(t.quizResults.response.results))},[t,e,n])},wg=(e,t,n)=>D.useCallback((i,o)=>{t.quizResults&&(ug(e,t.quizResults,i,o),jl(n)&&n(i,o))},[t,e,n]),kg=(e,t,n)=>D.useCallback((i,o,s)=>{i.preventDefault(),t.quizResults&&(ag(e,t.quizResults,o,s),jl(n)&&n(o))},[t,e,n]),Sg=(e,t)=>D.useCallback(()=>{t&&t({type:Y.Back,payload:e.quizCurrentQuestion})},[t,e.quizCurrentQuestion]),Eg=(e,t)=>D.useCallback(r=>{var s;const i=(s=e.quizCurrentQuestion)==null?void 0:s.next_question.type,o=e.quizCurrentQuestion;switch(i){case Y.Cover:t({type:Y.Cover,payload:{questionId:o.next_question.id,input:"",isLastQuestion:o.is_last_question}});break;case Y.OpenText:t({type:Y.OpenText,payload:{questionId:o.next_question.id,input:r,isLastQuestion:o.is_last_question}});break;case Y.SingleSelect:case Y.MultipleSelect:t({type:o.next_question.type,payload:{questionId:o.next_question.id,input:r,isLastQuestion:o.is_last_question}});break}},[e,t]),Cg=(e,t,n)=>D.useCallback(()=>{var s,l;const i=(s=e.quizCurrentQuestion)==null?void 0:s.next_question,o=i==null?void 0:i.id;if(n&&o){const u=t.answerInputs[o];((l=u==null?void 0:u.value)!=null&&l.length||(i==null?void 0:i.type)==="cover")&&n({type:Y.Next,payload:e.quizCurrentQuestion})}},[n,e.quizCurrentQuestion,t.answerInputs]),xg=(e,t,n,r)=>D.useCallback(()=>{r&&(t({type:Y.Reset}),n({type:Ke.RESET_QUIZ}))},[t,n,e,r]),Rg=(e,t)=>{const n=Hf(e);return D.useCallback(()=>{n&&t({type:Y.Hydrate,payload:n})},[t,n])},zg=(e,t,n)=>{const{quizApiState:r,dispatchLocalState:i,dispatchApiState:o,hasQuizStoredState:s,quizStateKey:l,quizLocalState:u}=n,{resultsPageOptions:c}=e,{onAddToCartClick:y,onQuizResultClick:w,onQuizResultsLoaded:C}=c,R=Eg(r,i),k=Cg(r,u,i),a=Sg(r,i),h=kg(t,r,y),d=wg(t,r,w);_g(t,r,C);const f=xg(l,i,o,r.quizResults),p=Rg(l,i);return{addToCart:h,resultClick:d,quizAnswerChanged:R,previousQuestion:a,nextQuestion:k,resetQuiz:f,hydrateQuiz:p,hasSessionStorageState:s,resetSessionStorageState:Eh(l)}},Gf={quizRequestState:Pt.Stale};function Ng(e,t){var n,r,i,o,s,l,u,c,y,w,C,R;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};case Ke.SET_CURRENT_QUESTION:{const{isOpenQuestion:k,isCoverQuestion:a,isSingleQuestion:h,isMultipleQuestion:d,isSelectQuestion:f}=Df((i=(r=(n=t.payload)==null?void 0:n.quizCurrentQuestion)==null?void 0:r.next_question)==null?void 0:i.type),p=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:(p==null?void 0:p.next_question.id)===((c=(u=(l=t.payload)==null?void 0:l.quizCurrentQuestion)==null?void 0:u.next_question)==null?void 0:c.id),isOpenQuestion:k,isCoverQuestion:a,isSingleQuestion:h,isMultipleQuestion:d,isSelectQuestion:f},quizFirstQuestion:p,quizResults:void 0}}case Ke.SET_QUIZ_RESULTS:{const k=((C=(w=(y=t.payload)==null?void 0:y.quizResults)==null?void 0:w.request)==null?void 0:C.collection_filter_expression)||null,a=[...new Set(Hs(k))];return{...e,quizRequestState:Pt.Success,quizResults:(R=t.payload)==null?void 0:R.quizResults,quizResultsFilters:a,quizCurrentQuestion:void 0}}case Ke.RESET_QUIZ:return Gf;default:return e}}const Tg=(e,t,n,r)=>{const[i,o]=D.useReducer(Ng,Gf),{quizId:s,quizVersionId:l,resultsPageOptions:u}=e;return D.useEffect(()=>{(async()=>{if(o({type:Ke.SET_IS_LOADING}),n.isLastAnswer)try{const c=await sg(t,s,{answers:n.answers,resultsPerPage:u==null?void 0:u.numResultsToDisplay,quizVersionId:n.quizVersionId,quizSessionId:n.quizSessionId});o({type:Ke.SET_QUIZ_RESULTS,payload:{quizResults:c}})}catch{o({type:Ke.SET_IS_ERROR})}else try{const c=n.quizVersionId||l,{quizSessionId:y}=n,w=await og(t,s,{answers:n.answers,quizVersionId:c,quizSessionId:y});(!y&&(w!=null&&w.quiz_session_id)||!c&&w.quiz_version_id)&&r({type:Y.Hydrate,payload:{quizVersionId:w==null?void 0:w.quiz_version_id,quizSessionId:w==null?void 0:w.quiz_session_id}}),o({type:Ke.SET_CURRENT_QUESTION,payload:{quizCurrentQuestion:w}})}catch{o({type:Ke.SET_IS_ERROR})}})()},[t,s,n.answers,u==null?void 0:u.numResultsToDisplay]),{quizApiState:i,dispatchApiState:o}},Xf={answers:[],answerInputs:{},isLastAnswer:!1};function Kr(e,t){return{...e,[String(t.payload.questionId)]:{type:t.type,value:t.payload.input}}}function qg(e,t){var n,r,i,o,s;switch(t.type){case Y.OpenText:return{...e,answerInputs:Kr(e.answerInputs,t),isLastAnswer:!!((n=t.payload)!=null&&n.isLastQuestion)};case Y.Cover:return{...e,answerInputs:Kr(e.answerInputs,t),isLastAnswer:!!((r=t.payload)!=null&&r.isLastQuestion)};case Y.SingleSelect:return{...e,answerInputs:Kr(e.answerInputs,t),isLastAnswer:!!((i=t.payload)!=null&&i.isLastQuestion)};case Y.MultipleSelect:return{...e,answerInputs:Kr(e.answerInputs,t),isLastAnswer:!!((o=t.payload)!=null&&o.isLastQuestion)};case Y.Next:{const{answers:l}=e,u=[...l],c=l.length,y=(s=Object.values(e.answerInputs))==null?void 0:s[c];switch(y.type){case Y.OpenText:u.push(["true"]);break;case Y.Cover:u.push(["seen"]);break;case Y.SingleSelect:u.push(y.value);break;case Y.MultipleSelect:u.push(y.value);break;default:u.push([])}return{...e,answers:u}}case Y.Back:{const l={...e.answerInputs};return{...e,answerInputs:l,answers:[...e.answers.slice(0,-1)],isLastAnswer:!1}}case Y.Reset:return{...Xf};case Y.Hydrate:return{...e,...t.payload};default:return e}}const Pg=e=>{const[t,n]=D.useReducer(qg,Xf),r=e||jh;D.useEffect(()=>{var s,l;(s=t==null?void 0:t.answers)!=null&&s.length&&((l=window==null?void 0:window.sessionStorage)==null||l.setItem(r,JSON.stringify(t)))},[t,r]);const i=()=>Hf(r)!==null,o=D.useCallback(s=>{Ch(s),n(s)},[]);return{quizLocalState:t,hasQuizStoredState:i,dispatchLocalState:o,quizStateKey:r}},Ig=(e,t)=>{const{sessionStateOptions:n}=e,{quizLocalState:r,dispatchLocalState:i,hasQuizStoredState:o,quizStateKey:s}=Pg(n==null?void 0:n.sessionStateKey),{quizApiState:l,dispatchApiState:u}=Tg(e,t,r,i);return{quizApiState:l,quizLocalState:r,dispatchApiState:u,dispatchLocalState:i,hasQuizStoredState:o,quizStateKey:s}},Og=e=>{const{apiKey:t,cioJsClient:n,primaryColor:r}=e;fg(e);const i=cg({apiKey:t,cioJsClient:n}),o=Ig(e,i),s=zg(e,i,o),{quizApiState:l,quizLocalState:u}=o,c=yg(s,l,u),y=mg(r);return console.log("quizLocalState.answerInputs",u.answerInputs),{cioClient:i,state:{answers:{inputs:u.answerInputs,isLastAnswer:u.isLastAnswer},quiz:{requestState:l.quizRequestState,versionId:u.quizVersionId,sessionId:u.quizSessionId,currentQuestion:l.quizCurrentQuestion,results:l.quizResults,resultsFilters:l.quizResultsFilters}},events:{...s},...c,primaryColorStyles:y}};function Lg({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 O.createElement("div",{className:"cio-session-prompt-modal",role:"presentation",onClick:i},O.createElement("div",{className:"cio-session-prompt-container"},O.createElement("div",{className:"cio-session-prompt-content",role:"presentation",onClick:l=>l.stopPropagation()},O.createElement("div",null,"Do you want to continue where you left off?"),O.createElement("div",{className:"cio-session-prompt-controls-container"},O.createElement(qi,{ctaText:"No",type:"button",propsGetters:s}),O.createElement(qi,{type:"button",ctaText:"Yes",propsGetters:o})))))}return null}function Ag(e){const{cioClient:t,state:n,events:{hydrateQuiz:r,hasSessionStorageState:i,resetSessionStorageState:o},getAddToCartButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:c,getOpenTextInputProps:y,getPreviousQuestionButtonProps:w,getQuizImageProps:C,getQuizResultButtonProps:R,getQuizResultLinkProps:k,getResetQuizButtonProps:a,getSelectInputProps:h,primaryColorStyles:d}=Og(e),[f,p]=D.useState(!1),{resultsPageOptions:v,sessionStateOptions:m}=e;D.useEffect(()=>{(m==null?void 0:m.showSessionModal)!==void 0?p((m==null?void 0:m.showSessionModal)&&i()):p(i())},[]);const E={cioClient:t,state:n,getAddToCartButtonProps:s,getCoverQuestionProps:l,getHydrateQuizButtonProps:u,getNextQuestionButtonProps:c,getOpenTextInputProps:y,getPreviousQuestionButtonProps:w,getQuizImageProps:C,getQuizResultButtonProps:R,getQuizResultLinkProps:k,getResetQuizButtonProps:a,getSelectInputProps:h,customClickItemCallback:!!(v!=null&&v.onQuizResultClick),primaryColorStyles:d};return n.quiz.requestState===Pt.Loading?O.createElement("div",{className:"cio-quiz"},O.createElement(Dh,null)):n.quiz.requestState===Pt.Success?O.createElement("div",{className:"cio-quiz"},O.createElement("style",null,".cio-quiz ",Rh(d)),O.createElement(Lg,{resetStoredState:o,continueSession:r,showSessionPrompt:f,setShowSessionPrompt:p}),O.createElement(Be.Provider,{value:E},n.quiz.results&&O.createElement(Fh,{options:v}),n.quiz.currentQuestion&&O.createElement(Ph,null))):null}const Bg=({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),Ko.createRoot(i).render(O.createElement(O.StrictMode,null,O.createElement(Ag,{...n})))}};window&&(window.CioQuiz=Bg);export{Bg as default};
|
|
@@ -10,7 +10,7 @@ function RedoButton(props) {
|
|
|
10
10
|
if (getResetQuizButtonProps) {
|
|
11
11
|
return (
|
|
12
12
|
// eslint-disable-next-line react/button-has-type
|
|
13
|
-
react_1.default.createElement("button", Object.assign({}, rest, getResetQuizButtonProps()),
|
|
13
|
+
react_1.default.createElement("button", Object.assign({}, rest, getResetQuizButtonProps('secondary')),
|
|
14
14
|
react_1.default.createElement(RedoSVG_1.default, null),
|
|
15
15
|
react_1.default.createElement("span", null, redoText)));
|
|
16
16
|
}
|
|
@@ -15,8 +15,8 @@ const usePropsGetters = (quizEvents, quizApiState, quizLocalState) => {
|
|
|
15
15
|
const getSelectInputProps = (0, useSelectInputProps_1.default)(quizAnswerChanged, nextQuestion, (_c = quizApiState.quizCurrentQuestion) === null || _c === void 0 ? void 0 : _c.next_question, quizLocalState.answerInputs);
|
|
16
16
|
const getNextQuestionButtonProps = (0, useNextQuestionButtonProps_1.default)(nextQuestion, quizApiState, quizLocalState);
|
|
17
17
|
const getPreviousQuestionButtonProps = (0, usePreviousQuestionButtonProps_1.default)(quizApiState, previousQuestion);
|
|
18
|
-
const getResetQuizButtonProps = (0, react_1.useCallback)(() => ({
|
|
19
|
-
className: 'cio-question-redo-button',
|
|
18
|
+
const getResetQuizButtonProps = (0, react_1.useCallback)((stylesType = 'primary') => ({
|
|
19
|
+
className: stylesType === 'primary' ? 'cio-question-cta-button' : 'cio-question-redo-button',
|
|
20
20
|
type: 'button',
|
|
21
21
|
onClick: () => resetQuiz(),
|
|
22
22
|
}), [resetQuiz]);
|
|
@@ -7,7 +7,7 @@ function RedoButton(props) {
|
|
|
7
7
|
if (getResetQuizButtonProps) {
|
|
8
8
|
return (
|
|
9
9
|
// eslint-disable-next-line react/button-has-type
|
|
10
|
-
React.createElement("button", { ...rest, ...getResetQuizButtonProps() },
|
|
10
|
+
React.createElement("button", { ...rest, ...getResetQuizButtonProps('secondary') },
|
|
11
11
|
React.createElement(RedoSVG, null),
|
|
12
12
|
React.createElement("span", null, redoText)));
|
|
13
13
|
}
|
|
@@ -11,8 +11,8 @@ const usePropsGetters = (quizEvents, quizApiState, quizLocalState) => {
|
|
|
11
11
|
const getSelectInputProps = useSelectInputProps(quizAnswerChanged, nextQuestion, quizApiState.quizCurrentQuestion?.next_question, quizLocalState.answerInputs);
|
|
12
12
|
const getNextQuestionButtonProps = useNextQuestionButtonProps(nextQuestion, quizApiState, quizLocalState);
|
|
13
13
|
const getPreviousQuestionButtonProps = usePreviousQuestionButtonProps(quizApiState, previousQuestion);
|
|
14
|
-
const getResetQuizButtonProps = useCallback(() => ({
|
|
15
|
-
className: 'cio-question-redo-button',
|
|
14
|
+
const getResetQuizButtonProps = useCallback((stylesType = 'primary') => ({
|
|
15
|
+
className: stylesType === 'primary' ? 'cio-question-cta-button' : 'cio-question-redo-button',
|
|
16
16
|
type: 'button',
|
|
17
17
|
onClick: () => resetQuiz(),
|
|
18
18
|
}), [resetQuiz]);
|
package/lib/types/types.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ export type GetCoverQuestionProps = () => CoverQuestionProps;
|
|
|
154
154
|
export type GetSelectInputProps = (option: QuestionOption) => SelectInputProps;
|
|
155
155
|
export type GetNextQuestionButtonProps = () => NextQuestionButtonProps;
|
|
156
156
|
export type GetPreviousQuestionButtonProps = () => PreviousQuestionButtonProps;
|
|
157
|
-
export type GetResetQuizButtonProps = () => ResetQuizButtonProps;
|
|
157
|
+
export type GetResetQuizButtonProps = (stylesType?: 'primary' | 'secondary') => ResetQuizButtonProps;
|
|
158
158
|
export type GetHydrateQuizButtonProps = () => HydrateQuizButtonProps;
|
|
159
159
|
export type GetAddToCartButtonProps = (result: QuizResultDataPartial, price?: number) => AddToCartButtonProps;
|
|
160
160
|
export type GetQuizImageProps = () => QuizImageProps;
|