/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.cloudFullStory_bundle_jsonpfunction=window.cloudFullStory_bundle_jsonpfunction||[]).push([[1],{8:function(t,e,n){"use strict";n.r(e),n.d(e,"FullStoryShipper",(function(){return fullstory_shipper_FullStoryShipper}));var s=n(0),i=n.n(s),o=n(5),r=n(6),l=n(7),c=n.n(l);const u=["uid","displayName","email","acctId","website","pageName"];function a(t){return Object.fromEntries(Object.entries(t).map((([t,e])=>Array.isArray(e)?[t,e.filter((t=>void 0!==t))]:[t,e])).filter((([,t])=>void 0!==t&&(!Array.isArray(t)||t.length>0))).map((([t,e])=>{if(u.includes(t))return[t,e];if(function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&!d(t)}(e))return[t,a(e)];const n=function(t){const e=Array.isArray(t),n=e?t[0]:t;let s;switch(typeof n){case"string":s=c()(n,c.a.ISO_8601,!0).isValid()?"date":"str";break;case"number":s=Number.isInteger(n)?"int":"real";break;case"boolean":s="bool";break;case"object":if(d(n)){s="date";break}default:throw new Error("Unsupported type: "+typeof n)}return e?`${s}s`:s}(e);return[n?`${t}_${n}`:t,e]})))}function d(t){return t instanceof Date}function f(t){const[e,n,s]=t.split(".");return{version_str:t,version_major_int:parseInt(e,10),version_minor_int:parseInt(n,10),version_patch_int:parseInt(s,10)}}const p=["pageName","page","entityId","applicationId","version","buildNum","cloudId","deploymentId","cluster_name","cluster_uuid","cluster_version","labels.serverless","license_id","license_status","license_type","session_id","preferred_languages"];class fullstory_shipper_FullStoryShipper{constructor(t,e){i()(this,"fullStoryApi",void 0),i()(this,"lastUserId",void 0),i()(this,"eventTypesAllowlist",void 0),this.initContext=e;const{eventTypesAllowlist:n,...s}=t;this.fullStoryApi=function({scriptUrl:t="https://edge.fullstory.com/s/fs.js",fullStoryOrgId:e,host:n="fullstory.com",namespace:s="FS",debug:i=!1}){var o,r,l,c,u,a,d,f;window._fs_debug=i,window._fs_host=n,window._fs_script=t,window._fs_org=e,window._fs_namespace=s,o=window,r=document,l=window._fs_namespace,c="script",u="user",l in o?o.console&&o.console.log&&o.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'):((d=o[l]=function(t,e,n){d.q?d.q.push([t,e,n]):d._api(t,e,n)}).q=[],(a=r.createElement(c)).async=1,a.crossOrigin="anonymous",a.src=_fs_script,(f=r.getElementsByTagName(c)[0]).parentNode.insertBefore(a,f),d.identify=function(t,e,n){d(u,{uid:t},n),e&&d(u,e,n)},d.setUserVars=function(t,e){d(u,t,e)},d.event=function(t,e,n){d("event",{n:t,p:e},n)},d.anonymize=function(){d.identify(!1)},d.shutdown=function(){d("rec",!1)},d.restart=function(){d("rec",!0)},d.log=function(t,e){d("log",[t,e])},d.consent=function(t){d("consent",!arguments.length||t)},d.identifyAccount=function(t,e){a="account",(e=e||{}).acctId=t,d(a,e)},d.clearUserCookie=function(){},d.setVars=function(t,e){d("setVars",[t,e])},d._w={},f="XMLHttpRequest",d._w[f]=o[f],f="fetch",d._w[f]=o[f],o[f]&&(o[f]=function(){return d._w[f].apply(this,arguments)}),d._v="1.3.0");const p=window[s];if(!p)throw new Error("FullStory snippet failed to load. Check browser logs for more information.");return p}(s),this.eventTypesAllowlist=n}extendContext(t){this.initContext.logger.debug(`Received context ${JSON.stringify(t)}`);const{userId:e,isElasticCloudUser:n,cloudIsElasticStaffOwned:s,cloudTrialEndDate:i,...l}=t;if(e&&e!==this.lastUserId&&(this.initContext.logger.debug(`Calling FS.identify with userId ${e}`),this.fullStoryApi.identify(e),this.lastUserId=e),"boolean"==typeof n||"boolean"==typeof s||i){const t={isElasticCloudUser:n,cloudIsElasticStaffOwned:s,cloudTrialEndDate:i};this.initContext.logger.debug(`Calling FS.setUserVars with ${JSON.stringify(t)}`),this.fullStoryApi.setUserVars(a(t))}const c=p.reduce(((t,e)=>(Object(o.has)(l,e)&&Object(r.set)(t,e,Object(o.get)(l,e)),t)),{});Object.keys(c).length&&(this.initContext.logger.debug(`Calling FS.setVars with context ${JSON.stringify(c)}`),this.fullStoryApi.setVars("page",{...a(c),...c.version?f(c.version):{}}))}optIn(t){this.initContext.logger.debug(`Setting FS to optIn ${t}`),this.fullStoryApi.consent(t),t?this.fullStoryApi.restart():this.fullStoryApi.shutdown()}reportEvents(t){this.initContext.logger.debug(`Reporting ${t.length} events to FS`),t.filter((t=>{var e,n;return null===(e=null===(n=this.eventTypesAllowlist)||void 0===n?void 0:n.includes(t.event_type))||void 0===e||e})).forEach((t=>{this.fullStoryApi.event(t.event_type,a(t.properties))}))}async flush(){}shutdown(){}}i()(fullstory_shipper_FullStoryShipper,"shipperName","FullStory")}}]);