module.exports = "(function(e,r,t){var n=t(5894),i=t(4934),a=t(6474),o=t(4810),s=t(7887),d=t(8258),u=__CMAB_PREDICTION_URL__;r.getCmabPredictionUrl=function(){return u+\"/predict\"},r.getCmabPredictionUrlForExperiment=function(e){return e?r.getCmabPredictionUrl()+\"/\"+e:\"\"},r.createPayload=function(e,r){var t=n.map(e.variations,\"id\"),i=d.getVisitorCmabAttributesForExperiment(e),a=d.getDcpCustomerIds(),o=d.getDcpServiceId();return{instances:[{visitorId:s.getCurrentId(),experimentId:e.id,cmabUUID:r,variationIds:t,attributes:i,dcpCustomerIds:a,dcpServiceId:o}]}},r.parseApiResponse=function(e){var r=null;try{r=i.parse(e)}catch(e){return o.error(\"CMAB API / Error parsing response:\",e),null}return r&&r.predictions&&0!==r.predictions.length?r.predictions[0].variation_id.toString():(o.debug(\"CMAB API / No predictions found in API response\",r),null)},r.validateVariationId=function(e,r){return e&&n.find(r.variations,{id:e})?(o.debug(\"CMAB API / Variation ID:\",e,\"from API response found in experiment:\",r.id),e):(o.debug(\"CMAB API / Variation ID:\",e,\"from API response not found in experiment:\",r.id),null)},r.handleCmabApiResponse=function(e,t){if(200!==e.status)return o.error(\"CMAB API / API call failed with status:\",e.status,e.statusText),null;o.debug(\"CMAB API / API call successful:\",e.responseText);var n=r.parseApiResponse(e.responseText);return r.validateVariationId(n,t)},r.makeSyncApiCallWithXHR=function(e,t){o.debug(\"CMAB API / SYNC / Making a synchronous API call to get variation.\");try{var n=r.createPayload(e,t),a=r.getCmabPredictionUrlForExperiment(e.id),s=new XMLHttpRequest;return s.open(\"POST\",a,!1),s.send(i.stringify(n)),r.handleCmabApiResponse(s,e)}catch(e){return o.error(\"CMAB API / SYNC / API call encountered an error:\",e),null}},r.makeAsyncApiCall=function(e,t){o.debug(\"CMAB API / ASYNC / Making an asynchronous API call to get variation.\");var n=r.createPayload(e,t),i=r.getCmabPredictionUrlForExperiment(e.id);return a.request({url:i,contentType:\"application/json\",method:\"POST\",data:n})}})";