piano-analytics-js
Advanced tools
Comparing version
# Changelog | ||
## 6.15.1 | ||
### Fixes | ||
- [browser] Fix a specific case when consent is disabled | ||
## 6.15.0 | ||
@@ -3,0 +7,0 @@ ### New |
@@ -1,1 +0,1 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0});var https=require("https");function _interopNamespace(r){var i;return r&&r.__esModule?r:(i=Object.create(null),r&&Object.keys(r).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(r,e),Object.defineProperty(i,e,t.get?t:{enumerable:!0,get:function(){return r[e]}}))}),i.default=r,Object.freeze(i))}var https__namespace=_interopNamespace(https),Config={site:"",collectDomain:"",path:"event",visitorStorageMode:"fixed",storageLifetimeVisitor:395,storageLifetimeUser:395,storageLifetimePrivacy:395,privacyDefaultMode:"optin",sendEventWhenOptout:!0,isVisitorClientSide:!0,enableCallbacks:!0,cookieDomain:"",cookieSecure:!0,cookiePath:"/",cookieSameSite:"lax",encodeStorageBase64:!1,addEventURL:"withoutQS",clickAutoManagement:!0,enableUTMTracking:!0,campaignPrefix:["at_"],storageVisitor:"pa_vid",storageUser:"pa_user",version:"6.15.0",minHeartbeat:5,minBufferingHeartbeat:1,queueVarName:"_paq",globalVarName:"pa",enableAutomaticPageRefresh:!0,allowHighEntropyClientHints:!0,sendEmptyProperties:!0,enableExtendedOptout:!1,privacy:{storageKey:"pa_privacy",legacyKeys:{pa_vid:!0,pa_privacy:!0,atuserid:!0},storageKeys:{pa_user:!0},modes:{optin:{name:"optin",properties:{include:{visitor_privacy_consent:!0,visitor_privacy_mode:"optin"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{"*":!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},optout:{name:"optout",visitorId:"OPT-OUT",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"optout"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},"no-consent":{name:"no-consent",visitorId:"no-consent",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-consent"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},"no-storage":{name:"no-storage",visitorId:"no-storage",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-storage"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},exempt:{name:"exempt",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"exempt"},allowed:{"*":{app_crash:!0,app_crash_class:!0,app_crash_screen:!0,app_version:!0,browser:!0,browser_cookie_acceptance:!0,browser_group:!0,browser_version:!0,click:!0,click_chapter1:!0,click_chapter2:!0,click_chapter3:!0,click_full_name:!0,connection_monitor:!0,connection_organisation:!0,cookie_creation_date:!0,date:!0,date_day:!0,date_daynumber:!0,date_month:!0,date_monthnumber:!0,date_week:!0,date_year:!0,date_yearofweek:!0,device_brand:!0,device_display_height:!0,device_display_width:!0,device_name:!0,device_name_tech:!0,device_screen_diagonal:!0,device_screen_height:!0,device_screen_width:!0,device_type:!0,event_collection_platform:!0,event_collection_version:!0,event_hour:!0,event_id:!0,event_minute:!0,event_position:!0,event_second:!0,event_time:!0,event_time_utc:!0,event_url:!0,event_url_domain:!0,event_url_full:!0,exclusion_cause:!0,exclusion_type:!0,geo_city:!0,geo_continent:!0,geo_country:!0,geo_metro:!0,geo_region:!0,goal_type:!0,hit_time_utc:!0,os:!0,os_group:!0,os_version:!0,os_version_name:!0,page:!0,page_chapter1:!0,page_chapter2:!0,page_chapter3:!0,page_duration:!0,page_full_name:!0,page_position:!0,page_title_html:!0,page_url:!0,pageview_id:!0,previous_url:!0,privacy_status:!0,site:!0,site_env:!0,site_id:!0,site_platform:!0,src:!0,src_detail:!0,src_direct_access:!0,src_organic:!0,src_organic_detail:!0,src_portal_domain:!0,src_portal_site:!0,src_portal_site_id:!0,src_portal_url:!0,src_referrer_site_domain:!0,src_referrer_site_url:!0,src_referrer_url:!0,src_se:!0,src_se_category:!0,src_se_country:!0,src_type:!0,src_url:!0,src_url_domain:!0,src_webmail:!0}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0,atuserid:!0},forbidden:{}},events:{allowed:{"click.exit":!0,"click.navigation":!0,"click.download":!0,"click.action":!0,"page.display":!0},forbidden:{}}},"*":{properties:{allowed:{"*":{connection_type:!0,device_timestamp_utc:!0,visitor_privacy_consent:!0,visitor_privacy_mode:!0,"ch_ua*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{}},events:{allowed:{},forbidden:{}}}}}};function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function _createForOfIteratorHelper(e,t){var r,i,n,o,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return n=!(i=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return i=e.done,e},e:function(e){n=!0,r=e},f:function(){try{i||null==a.return||a.return()}finally{if(n)throw r}}};if(Array.isArray(e)||(a=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),o=0,{s:t=function(){},n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}var _cloneObject=function(e,t){if("object"!==_typeof(e)||null===e||e instanceof Date)return e;var r,i=new e.constructor;for(r in e)!Object.prototype.hasOwnProperty.call(e,r)||void 0===r||t&&void 0===e[r]||(i[r]=_cloneObject(e[r]));return i},http={post:function(t,r,i){var e=r,n=new URL(t),n={hostname:n.hostname,port:443,path:n.pathname+n.search,method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"}},n=https__namespace.request(n,function(e){i&&i(t,r,e)});n.write(e),n.end()}},_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encoding={encodeURIComponent:encodeURIComponent,utf8:{encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t+=String.fromCharCode(i):t=127<i&&i<2048?(t+=String.fromCharCode(i>>6|192))+String.fromCharCode(63&i|128):(t=(t+=String.fromCharCode(i>>12|224))+String.fromCharCode(i>>6&63|128))+String.fromCharCode(63&i|128)}return t},decode:function(e){var t,r,i,n="",o=0;for(t=0;o<e.length;)(i=e.charCodeAt(o))<128?(n+=String.fromCharCode(i),o++):191<i&&i<224?(t=e.charCodeAt(o+1),n+=String.fromCharCode((31&i)<<6|63&t),o+=2):(t=e.charCodeAt(o+1),r=e.charCodeAt(o+2),n+=String.fromCharCode((15&i)<<12|(63&t)<<6|63&r),o+=3);return n}},base64:{encode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=encoding.utf8.encode(e);u<e.length;)i=(t=e.charCodeAt(u++))>>2,n=(3&t)<<4|(t=e.charCodeAt(u++))>>4,o=(15&t)<<2|(r=e.charCodeAt(u++))>>6,a=63&r,isNaN(t)?o=a=64:isNaN(r)&&(a=64),s=s+_keyStr.charAt(i)+_keyStr.charAt(n)+_keyStr.charAt(o)+_keyStr.charAt(a);return s},decode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)i=_keyStr.indexOf(e.charAt(u++)),t=(15&(n=_keyStr.indexOf(e.charAt(u++))))<<4|(o=_keyStr.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(a=_keyStr.indexOf(e.charAt(u++))),s+=String.fromCharCode(i<<2|n>>4),64!=o&&(s+=String.fromCharCode(t)),64!=a&&(s+=String.fromCharCode(r));return s=encoding.utf8.decode(s)}}},uuid={v4:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}};function Configuration(e){var r=e;function i(e,t){null!==t&&""!==t&&void 0!==t&&(r[e]=t)}return{setConfiguration:i,setConfigurations:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i(t,e[t])},getConfiguration:function(e){return void 0!==r[e]?_cloneObject(r[e]):null},cloneData:function(){return _cloneObject(r)},deleteProperty:function(e){delete r[e]}}}function PianoAnalyticsQueue(t){var r=[];return{push:function(e){r.push(e),1===r.length&&t[e[0]].apply(t,e.slice(1))},next:function(){var e;r.shift(),0<r.length&&t[(e=r[0])[0]].apply(t,e.slice(1))}}}function Model(o,e,t){this.properties=_cloneObject(o._properties),this.addEventsProperty=function(e,t){if(o._privacy.call("isPropAllowed",e)){var r,i=_createForOfIteratorHelper(this.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;this.isPropertyAbsentForEvent(e,n)&&(n.data[e]=t)}}catch(e){i.e(e)}finally{i.f()}}},this.hasProperty=function(e){return Object.prototype.hasOwnProperty.call(this.properties,e)},this.getConfiguration=t.getConfiguration,this.setConfiguration=t.setConfiguration,this.options=e.options||{},this.visitorId=null,this.build={url:"",data:{}},this.events=e.events||[],this.isPropertyAbsentForEvent=function(e,t){if(void 0!==t.data[e])return!1;if(this.hasProperty(e)){if(void 0===this.properties[e].options.events)return!1;var r,i=_createForOfIteratorHelper(this.properties[e].options.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;if(t.name===n||"*"===n.charAt(n.length-1)&&0===t.name.indexOf(n.substring(0,n.length-1)))return!1}}catch(e){i.e(e)}finally{i.f()}}return!0}}function nextStep(e,t,r,i){!1!==i&&0<r.length&&"function"==typeof r[0]?r[0](e,t,r.slice(1)):e._queue.next()}function buildStep(e,t,r){var i=t.getConfiguration("collectDomain"),n=i.startsWith("https://")||i.startsWith("http://")?"":"https://",n="".concat(n).concat(i,"/").concat(t.getConfiguration("path")),i="?s=".concat(t.getConfiguration("site")).concat(t.visitorId?"&idclient="+t.visitorId:"");t.build.url=n+i,t.build.data={events:t.events},nextStep(e,t,r)}function campaignsStep(e,t,r){nextStep(e,t,r)}function metadataStep(e,t,r){t.addEventsProperty("event_collection_platform","js-browserless"),t.addEventsProperty("event_collection_version",t.getConfiguration("version"));var i=new Date;t.addEventsProperty("device_timestamp_utc",i.getTime()),t.addEventsProperty("device_local_hour",i.getTime()),t.addEventsProperty("device_hour",i.getHours()),nextStep(e,t,r)}function onBeforeBuildStep(t,r,i){function e(e){nextStep(t,r,i,e)}r.options&&r.options.onBeforeBuild?r.options.onBeforeBuild(t,r,e):e()}function onBeforeSendStep(t,r,i){function e(e){nextStep(t,r,i,e)}r.options&&r.options.onBeforeSend?r.options.onBeforeSend(t,r,e):e()}function privacyStep(e,t,r){e._privacy.call("filterEvents",t.events),e._privacy.call("filterProps",t.properties);for(var i=t.events,n=0;n<i.length;n++){e._privacy.call("filterProps",i[n].data,i[n].name);var o,a=e._privacy.call("getModeMetadata")||{};for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&t.addEventsProperty(o,a[o])}nextStep(e,t,r)}function propertiesStep(e,t,r){var i,n=[];for(i in t.properties)if(Object.prototype.hasOwnProperty.call(t.properties,i)){var o,a=!1,s=_createForOfIteratorHelper(t.events);try{for(s.s();!(o=s.n()).done;){var u=o.value,c=!1,l=t.properties[i].options.events;if(l)if(-1<l.indexOf(u.name))c=!0;else{var p,f=_createForOfIteratorHelper(l);try{for(f.s();!(p=f.n()).done;){var d=p.value;if("*"===d.charAt(d.length-1)&&0===u.name.indexOf(d.substring(0,d.length-1))){c=!0;break}}}catch(e){f.e(e)}finally{f.f()}}else c=!0;c&&void 0===u.data[i]&&(u.data[i]=t.properties[i].value,a=!0)}}catch(e){s.e(e)}finally{s.f()}a&&!t.properties[i].options.persistent&&n.push(i)}for(var v=0,g=n;v<g.length;v++)delete e._properties[g[v]];if(!t.getConfiguration("sendEmptyProperties")){var y,_=_createForOfIteratorHelper(t.events);try{for(_.s();!(y=_.n()).done;){var h,b=y.value;for(h in b.data)!Object.prototype.hasOwnProperty.call(b.data,h)||""!==b.data[h]&&void 0!==b.data[h]||delete b.data[h]}}catch(e){_.e(e)}finally{_.f()}}nextStep(e,t,r)}function sendStep(e,t,r){(e._privacy.call("getMode")!==e._privacy.modeEnum.OPTOUT||e._privacy.call("getMode")===e._privacy.modeEnum.OPTOUT&&t.getConfiguration("sendEventWhenOptout"))&&0<t.build.data.events.length&&http.post(t.build.url,JSON.stringify(t.build.data)),nextStep(e,t,r)}function userStep(r,i,n){void 0!==i.properties.user_id?nextStep(r,i,n):r.getUser(function(e){var t;null!==e&&(i.addEventsProperty("user_id",e.id,t={persistent:!0}),i.addEventsProperty("user_category",e.category,t),i.addEventsProperty("user_recognition",!0,t)),nextStep(r,i,n)})}function visitorStep(r,i,n){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){var t;!i.getConfiguration("isVisitorClientSide")||(i.visitorId=r._visitorId.value||e||uuid.v4(),t="OPT-OUT"!==i.visitorId&&"no-consent"!==i.visitorId&&"no-storage"!==i.visitorId&&i.visitorId!==r._visitorId.value,i.visitorId===e&&"relative"!==i.getConfiguration("visitorStorageMode"))||!t?nextStep(r,i,n):((e=new Date).setTime(e.getTime()+24*i.getConfiguration("storageLifetimeVisitor")*60*60*1e3),r._privacy.call("setItem",i.getConfiguration("storageVisitor"),i.visitorId,e,function(){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){null===e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i.visitorId)&&(i.visitorId=i.visitorId+"-NO"),nextStep(r,i,n)})}))})}var localVariable={};function LocalVariable(n){this.setItem=function(e,t,r,i){t=JSON.stringify({data:t,expires:r?r.getTime():0});localVariable[e]=n.getConfiguration("encodeStorageBase64")?encoding.base64.encode(t):t,i&&i()},this.getItem=function(t,e){var r,i=null;if(void 0!==localVariable[t]){try{r=JSON.parse(localVariable[t])}catch(e){r=JSON.parse(encoding.base64.decode(localVariable[t]))}0===r.expires||(new Date).getTime()<r.expires?(i=r.data,e&&e(i)):(new Date).getTime()>r.expires&&this.deleteItem(t,function(){e&&e(i)})}else e&&e(i)},this.deleteItem=function(e,t){delete localVariable[e],t&&t()}}var Storage=LocalVariable;function User(n){var o=n.getConfiguration("storageUser");n.setUser=function(e,t,r){var i={id:e,category:t};n.setProperties({user_id:e,user_category:t,user_recognition:!1},{persistent:!0}),!1!==r&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimeUser")*60*60*1e3),n._privacy.call("setItem",o,i,e))},n.getUser=function(r){n._storage.getItem(o,function(e){var t=e;!e&&n._properties.user_id&&(t={id:n._properties.user_id.value,category:n._properties.user_category.value}),r&&r(t)})},n.deleteUser=function(e){n.deleteProperty("user_id"),n.deleteProperty("user_category"),n.deleteProperty("user_recognition"),n._storage.deleteItem(o,function(){e&&e()})}}var AVInsights=function(C){function k(){this.debugError={trigger:"AvInsights:Media:setContentValues:Error",level:"ERROR",messageObject:"Not an object"},this.processHeartbeatValue=function(e,t){e=parseInt(e,10);return e?Math.max(e,t):0},this.value2Number=function(e){var t=0;return isNaN(Number(e))||(t=Number(e)),Math.max(t,0)}}var w={minHeartbeat:C.getConfiguration("minHeartbeat"),minBufferingHeartbeat:C.getConfiguration("minBufferingHeartbeat")},O="_ATVALUE",S="_ATPREFIX";function x(e,t){var r,e=e.length<2||":"!==e[1]?(r="",e):e.length<4||":"!==e[3]?(r=e.substring(0,1),e.substring(2,e.length)):(r=e.substring(0,3),e.substring(4,e.length));return t&&(r=r.toLowerCase(),e=e.toLowerCase()),{prefix:r,key:e}}function A(e){return null!==e&&"object"===_typeof(e)&&!(e instanceof Array)}function T(e,t,r,i,n){var o,a,s,u="",c="",l="",p=0;for(s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(u=(o=x(s,n)).prefix||i||"",c=(t?t+"_":"")+o.key,A(e[s]))T(e[s],c,r,u,n);else{for(a=c.split("_"),l="",p=0;p<a.length;p++)u=(o=x(a[p],n)).prefix||u,l+=o.key+(p<a.length-1?"_":"");r[c=l||c]=r[c]||{},r[c][O]=e[s],r[c][S]=u}}C.avInsights={},C.avInsights.Media=function(e,t,r){function i(){d.previousCursorPosition=0,d.currentCursorPosition=0,d.eventDuration=0,d.previousEvent="",d.sessionId=uuid.v4()}function n(e){e?d.delayBufferingConfiguration=_cloneObject(d.delayBufferingConfigurationBackup):d.delayConfiguration=_cloneObject(d.delayConfigurationBackup)}function o(e,t){if(t){_(e);var r,i={};for(r in A(t)?i=t:isNaN(t)?i=JSON.parse(t):i[0]=t,i)Object.prototype.hasOwnProperty.call(i,r)&&(e?d.delayBufferingConfiguration.push({delay:f.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:f.processHeartbeatValue(i[r],w.minBufferingHeartbeat)}):d.delayConfiguration.push({delay:f.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:f.processHeartbeatValue(i[r],w.minHeartbeat)}));h(e),y(e)}}function a(e,t,r,i){var n=_cloneObject(g),t=(n.av_session_id={},n.av_session_id[O]=d.sessionId,n.av_session_id[S]="",t&&(m(n),d.previousEvent=e),A(i)&&T(i,null,n,null,!0),P(n));C.sendEvent(e,t,r)}function s(){var e=this,t=0,r=0;e.getEventDuration=function(){var e=(new Date).getTime()-t-r;return r+=e,e},e.initBaseTime=function(){0===t&&(t=(new Date).getTime())},e.resetProperties=function(){r=t=0},e.initHeartbeatTimer=function(e,t){var r=t?d.delayBufferingConfiguration:d.delayConfiguration;0<r.length&&(b(t),clearTimeout(r[0].timeout),r[0].timeout=setTimeout(function(){0===r[0].number&&r.splice(0,1),e&&e()},1e3*r[0].refresh))},e.stopHeartbeatTimer=function(e){for(var t=e?d.delayBufferingConfiguration:d.delayConfiguration,r=0;r<t.length;r++)clearTimeout(t[r].timeout),t[r].timeout=-1}}function u(e,t,r,i,n){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e?d.previousCursorPosition+Math.floor(d.playbackSpeed*d.eventDuration):r,t&&v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.heartbeat",!0,i,n)}function c(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),e&&v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.heartbeat",!0,t,r)}function l(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,e&&v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.heartbeat",!0,t,r)}var p=this,f=new k,d=null,v=null,g=null,y=function(e){e?d.delayBufferingConfigurationBackup=_cloneObject(d.delayBufferingConfiguration):d.delayConfigurationBackup=_cloneObject(d.delayConfiguration)},_=function(e){e?(d.delayBufferingConfiguration=[],d.delayBufferingConfigurationBackup=[]):(d.delayConfiguration=[],d.delayConfigurationBackup=[])},h=function(e){(e?d.delayBufferingConfiguration:d.delayConfiguration).sort(function(e,t){return e.delay<t.delay?-1:t.delay<e.delay?1:0})},b=function(e){var t,e=e?d.delayBufferingConfiguration:d.delayConfiguration;void 0===(t=void 0!==e[1]?e[1].delay:t)?e[0].number=1:0<e[0].number?e[0].number--:"number"==typeof t&&(e[0].number=Math.floor(60*(t-e[0].delay)/e[0].refresh)-1)},m=function(e){e.av_previous_position={},e.av_previous_position[O]=d.previousCursorPosition,e.av_previous_position[S]="",e.av_position={},e.av_position[O]=d.currentCursorPosition,e.av_position[S]="",e.av_duration={},e.av_duration[O]=d.eventDuration,e.av_duration[S]="",e.av_previous_event={},e.av_previous_event[O]=d.previousEvent,e.av_previous_event[S]=""},P=function(e){var t,r={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Object.prototype.hasOwnProperty.call(e[t],O)?r[e[t][S]?"".concat(e[t][S],":").concat(t):t]=e[t][O]:r[t]=e[t]);return r};p.set=function(e,t){e=x(e,!0);g[e.key]=g[e.key]||{},g[e.key][O]=t,g[e.key][S]=e.prefix},p.get=function(e){var t=null,e=x(e,!0);return t=void 0!==g[e.key]?g[e.key][O]:t},p.del=function(e){e=x(e,!0);void 0!==g[e.key]&&delete g[e.key]},p.setProps=function(e){A(e)&&T(e,null,g,null,!0)},p.getProps=function(){var e,t=null;for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&((t=t||{})[e]=g[e][O]);return t},p.delProps=function(){g={}};p.setPlaybackSpeed=function(e){e=f.value2Number(e)||d.playbackSpeed;e!==d.playbackSpeed&&(v.stopHeartbeatTimer(!1),d.isPlaying&&(u(!0,!1),v.initHeartbeatTimer(function(){u(!0,!0)},!1)),d.playbackSpeed=e)},p.getSessionID=function(){return d.sessionId},p.track=function(e,t,r,i){var n=t||{};switch(e){case"av.heartbeat":p.heartbeat(n.av_position,r,i);break;case"av.buffer.heartbeat":p.bufferHeartbeat(r,i);break;case"av.rebuffer.heartbeat":p.rebufferHeartbeat(r,i);break;case"av.play":p.play(n.av_position,r,i);break;case"av.buffer.start":p.bufferStart(n.av_position,r,i);break;case"av.start":p.playbackStart(n.av_position,r,i);break;case"av.resume":p.playbackResumed(n.av_position,r,i);break;case"av.pause":p.playbackPaused(n.av_position,r,i);break;case"av.stop":p.playbackStopped(n.av_position,r,i);break;case"av.backward":p.seekBackward(n.av_previous_position,n.av_position,r,i);break;case"av.forward":p.seekForward(n.av_previous_position,n.av_position,r,i);break;case"av.seek.start":p.seekStart(n.av_previous_position,r,i);break;case"av.error":p.error(n.av_player_error,r,i);break;default:a(e,!1,r,i)}},p.heartbeat=function(e,t,r){var i,n=!0;null!=e&&0<=e&&(n=!1,i=f.value2Number(e)),u(n,!1,i,t,r)},p.bufferHeartbeat=function(e,t){c(!1,e,t)},p.rebufferHeartbeat=function(e,t){l(!1,e,t)},p.play=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=0,d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.play",!0,t,r)},p.bufferStart=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),d.isPlaybackActivated?(v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.start",!0,t,r)):(v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.start",!0,t,r))},p.playbackStart=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.start",!0,t,r)},p.playbackResumed=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.resume",!0,t,r)},p.playbackPaused=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.pause",!0,t,r)},p.playbackStopped=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),a("av.stop",!0,t,r),i()},p.playbackKill=function(){v.initBaseTime(),d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),i()},p.seek=function(e,t,r,i){e=f.value2Number(e),t=f.value2Number(t);t<e?p.seekBackward(e,t,r,i):p.seekForward(e,t,r,i)},p.seekBackward=function(e,t,r,i){p.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=f.value2Number(e),d.currentCursorPosition=f.value2Number(t),a("av.backward",!0,r,i)},p.seekForward=function(e,t,r,i){p.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=f.value2Number(e),d.currentCursorPosition=f.value2Number(t),a("av.forward",!0,r,i)},p.seekStart=function(e,t,r){e=f.value2Number(e);d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying?d.eventDuration=v.getEventDuration():d.eventDuration=0,a("av.seek.start",!0,t,r)},p.adClick=function(e,t){a("av.ad.click",!1,e,t)},p.adSkip=function(e,t){a("av.ad.skip",!1,e,t)},p.error=function(e,t,r){var i={};(i=A(r)?r:i).av_player_error=String(e),a("av.error",!1,t,i)},p.display=function(e,t){a("av.display",!1,e,t)},p.close=function(e,t){a("av.close",!1,e,t)},p.volume=function(e,t){a("av.volume",!1,e,t)},p.subtitleOn=function(e,t){a("av.subtitle.on",!1,e,t)},p.subtitleOff=function(e,t){a("av.subtitle.off",!1,e,t)},p.fullscreenOn=function(e,t){a("av.fullscreen.on",!1,e,t)},p.fullscreenOff=function(e,t){a("av.fullscreen.off",!1,e,t)},p.quality=function(e,t){a("av.quality",!1,e,t)},p.speed=function(e,t){a("av.speed",!1,e,t)},o(!(d={previousCursorPosition:0,currentCursorPosition:0,eventDuration:0,playbackSpeed:1,previousEvent:"",isPlaybackActivated:!(p.share=function(e,t){a("av.share",!1,e,t)}),isPlaying:!1,sessionId:"",delayConfiguration:[],delayConfigurationBackup:[],delayBufferingConfiguration:[],delayBufferingConfigurationBackup:[]}),e),o(!0,t),d.sessionId=r||uuid.v4(),v=new s,g={}}};function VisitorId(n){this.value=null,n.getVisitorId=function(t){var r=this.value,i=null;if(n._storage.getItem(n.getConfiguration("storageVisitor"),function(e){i=_processCallbackIfPresent(r||e,t)}.bind(n)),void 0===t)return i}.bind(this),n.setVisitorId=function(e){this.value=e;var t=new Date;t.setTime(t.getTime()+24*n.getConfiguration("storageLifetimeVisitor")*60*60*1e3),n._privacy.call("setItem",n.getConfiguration("storageVisitor"),e,t,function(){})}.bind(this)}function _processCallbackIfPresent(e,t){return t&&t(e),e}function AtPrivacy(n){function r(e,t,r,i){return r=u(t[r].events[e],i),t=u(t["*"].events[e],i),r||t}function i(e,t,r,i,n){var o,n=n?(o=c(t[r].properties,e,i,n),c(t["*"].properties,e,i,n)):(o=l(t[r].properties,e,i),l(t["*"].properties,e,i));return o||n}function o(e,t,r,i){return r=p(t[r].storage,e,i),t=p(t["*"].storage,e,i),r||t}var a=n.getConfiguration("privacy"),s=(this.currentMode="",this.modes=a.modes,this._storageKeys=Object.assign(a.legacyKeys,a.storageKeys),this.init=function(){n._privacy.isLegacyPrivacy&&n._storage.getItem(a.storageKey,function(e){this.setMode(e&&this.modes[e]?e:n.getConfiguration("privacyDefaultMode"))}.bind(this))},this.setMode=function(t){t!==this.currentMode&&this.modes[t]&&(this.currentMode=t,n._storage.getItem(a.storageKey,function(e){"optout"===t||"no-consent"===t||"no-storage"===t?n._visitorId.value=this.modes[t].visitorId:"OPT-OUT"!==n._visitorId.value&&"no-consent"!==n._visitorId.value&&"no-storage"!==n._visitorId.value||(n._visitorId.value=null),this.filterProps(n._properties),this.filterKeys(),e!==t&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimePrivacy")*60*60*1e3),this.setItem(a.storageKey,t,e))}.bind(this)))},this.createMode=function(e,t){var r;this.modes[e]||((r=_cloneObject(this.modes.exempt)).name=e,r.properties.include.visitor_privacy_mode=e,r.properties.include.visitor_privacy_consent=t,this.modes[e]=r)},this.getMode=function(){return this.currentMode},function(e,t,r,i,n,o){var a=["*"],s=["*"],u="properties",c=i?"forbidden":"allowed";t&&(a="string"==typeof t?[t]:t),r&&(s="string"==typeof r?[r]:r),n&&(u="storage"),o&&(u="events");for(var l=0;l<a.length;l++)if(void 0!==this.modes[a[l]])for(var p=this.modes[a[l]],f=0;f<s.length;f++){var d=p[u][c];void 0!==d[s[f]]||n||o||(d[s[f]]={});for(var v=0;v<e.length;v++)n||o?d[e[v]]=!0:d[s[f]][e[v]]=!0}}.bind(this)),u=(this.include={properties:function(e,t,r){s(e,t,r)},property:function(e,t,r){s([e],t,r)},storageKeys:function(e,t){s(e,t,null,!1,!0)},storageKey:function(e,t){s([e],t,null,!1,!0)},events:function(e,t){s(e,t,null,!1,!1,!0)},event:function(e,t){s([e],t,null,!1,!1,!0)}},this.exclude={properties:function(e,t,r){s(e,t,r,!0)},property:function(e,t,r){s([e],t,r,!0)},storageKeys:function(e,t){s(e,t,null,!0,!0)},storageKey:function(e,t){s([e],t,null,!0,!0)},events:function(e,t){s(e,t,null,!0,!1,!0)},event:function(e,t){s([e],t,null,!0,!1,!0)}},function(e,t){if(e[t])return!0;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&"*"===r.charAt(r.length-1)&&0===t.indexOf(r.substring(0,r.length-1)))return!0;return!1}),c=(this.isEventAllowed=function(e){var t=r("forbidden",this.modes,this.currentMode,e),e=r("allowed",this.modes,this.currentMode,e);return!t&&e},function(e,t,r,i){var n,o=e[t];if(o[i]&&o[i][r]||o["*"][r])return!0;for(n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&"*"===n.charAt(n.length-1)&&0===i.indexOf(n.substring(0,n.length-1))||n===i)for(var a in o[n])if(Object.prototype.hasOwnProperty.call(o[n],a)&&("*"===a.charAt(a.length-1)&&0===r.indexOf(a.substring(0,a.length-1))||r===a))return!0;return!1}),l=function(e,t,r){if("forbidden"===t&&e[t]["*"][r])return!0;for(var i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)){if(e[t][i][r])return!0;for(var n in e[t][i])if("*"===n.charAt(n.length-1)&&0===r.indexOf(n.substring(0,n.length-1)))return!0}return!1},p=(this.isPropAllowed=function(e,t){var r=i("forbidden",this.modes,this.currentMode,e,t),e=i("allowed",this.modes,this.currentMode,e,t);return!r&&e},function(e,t,r){var i,n=e[t];if(n[r])return!0;for(i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"*"===i.charAt(i.length-1)&&0===r.indexOf(i.substring(0,i.length-1)))return!0;return!1});this.isKeyAllowed=function(e){var t=o("forbidden",this.modes,this.currentMode,e),e=o("allowed",this.modes,this.currentMode,e);return!t&&e},this.setItem=function(e,t,r,i){this.isKeyAllowed(e)?n._storage.setItem(e,t,r,i):i&&i()},this.filterProps=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&!this.isPropAllowed(r,t||void 0)&&delete e[r]},this.filterKeys=function(){for(var e in this._storageKeys)Object.prototype.hasOwnProperty.call(this._storageKeys,e)&&!this.isKeyAllowed(e)&&n._storage.deleteItem(e)},this.filterEvents=function(e){for(var t=e.length-1;0<=t;t--)this.isEventAllowed(e[t].name)||e.splice(t,1)},this.getModeMetadata=function(){return this.modes[this.getMode()].properties.include},this.init()}function Privacy(o){var e=this;this.isLegacyPrivacy=!0,this.modeEnum={OPTOUT:e.isLegacyPrivacy?"optout":"opt-out"},this.call=function(e){for(var t=this.isLegacyPrivacy?"privacy":"consent",r=arguments.length,i=new Array(1<r?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o[t][e].apply(o[t],i)}}function initPrivacy(e){e._privacy=new Privacy(e),e.privacy=new AtPrivacy(e)}function PianoAnalytics(e){_initConfig(this,e),this._storage=new Storage(this),this._queue=new PianoAnalyticsQueue(this),this._properties={},this._sendEvent=_sendEvent,this._setProperty=_setProperty,this._deleteProperty=_deleteProperty,this._visitorId=new VisitorId(this),initPrivacy(this),this.user=new User(this),AVInsights(this)}function _initConfig(e,t){e.cfg=new Configuration(_cloneObject(t)||Config),e.setConfiguration=e.cfg.setConfiguration,e.setConfigurations=e.cfg.setConfigurations,e.getConfiguration=e.cfg.getConfiguration}function _sendEvent(e,t){for(var r=[privacyStep,visitorStep,userStep,campaignsStep,metadataStep,propertiesStep,onBeforeBuildStep,buildStep,onBeforeSendStep,sendStep],i=0;i<e.length;i++){var n={name:"",data:{}};if("string"==typeof e[i])n.name=e[i];else{if(void 0!==e[i].data)continue;n.name=e[i].name}e[i]=n}var o,t={events:_cloneObject(e),options:_cloneObject(t)};0<r.length&&"function"==typeof r[0]&&(o=new Configuration(this.cfg.cloneData()),r[0](this,new Model(this,t,o),r.slice(1)))}function _setProperty(e,t,r,i){e._privacy.call("isPropAllowed",t)&&(e._properties[t]={value:r,options:i||{}}),e._queue.next()}function _deleteProperty(e,t){delete e._properties[t],e._queue.next()}PianoAnalytics.prototype.setProperty=function(e,t,r){this._queue.push(["_setProperty",this,e,t,r])},PianoAnalytics.prototype.setProperties=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setProperty(r,e[r],t)},PianoAnalytics.prototype.deleteProperty=function(e){this._queue.push(["_deleteProperty",this,e])},PianoAnalytics.prototype.sendEvent=function(e,t,r){this._queue.push(["_sendEvent",[{name:e,data:t}],r])},PianoAnalytics.prototype.sendEvents=function(e,t){this._queue.push(["_sendEvent",e,t])};var pianoAnalytics=new(PianoAnalytics.prototype.PA=PianoAnalytics)(Config);exports.pianoAnalytics=pianoAnalytics; | ||
Object.defineProperty(exports,"__esModule",{value:!0});var https=require("https");function _interopNamespace(r){var i;return r&&r.__esModule?r:(i=Object.create(null),r&&Object.keys(r).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(r,e),Object.defineProperty(i,e,t.get?t:{enumerable:!0,get:function(){return r[e]}}))}),i.default=r,Object.freeze(i))}var https__namespace=_interopNamespace(https),Config={site:"",collectDomain:"",path:"event",visitorStorageMode:"fixed",storageLifetimeVisitor:395,storageLifetimeUser:395,storageLifetimePrivacy:395,privacyDefaultMode:"optin",sendEventWhenOptout:!0,isVisitorClientSide:!0,enableCallbacks:!0,cookieDomain:"",cookieSecure:!0,cookiePath:"/",cookieSameSite:"lax",encodeStorageBase64:!1,addEventURL:"withoutQS",clickAutoManagement:!0,enableUTMTracking:!0,campaignPrefix:["at_"],storageVisitor:"pa_vid",storageUser:"pa_user",version:"6.15.1",minHeartbeat:5,minBufferingHeartbeat:1,queueVarName:"_paq",globalVarName:"pa",enableAutomaticPageRefresh:!0,allowHighEntropyClientHints:!0,sendEmptyProperties:!0,enableExtendedOptout:!1,privacy:{storageKey:"pa_privacy",legacyKeys:{pa_vid:!0,pa_privacy:!0,atuserid:!0},storageKeys:{pa_user:!0},modes:{optin:{name:"optin",properties:{include:{visitor_privacy_consent:!0,visitor_privacy_mode:"optin"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{"*":!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},optout:{name:"optout",visitorId:"OPT-OUT",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"optout"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},"no-consent":{name:"no-consent",visitorId:"no-consent",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-consent"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},"no-storage":{name:"no-storage",visitorId:"no-storage",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-storage"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},exempt:{name:"exempt",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"exempt"},allowed:{"*":{app_crash:!0,app_crash_class:!0,app_crash_screen:!0,app_version:!0,browser:!0,browser_cookie_acceptance:!0,browser_group:!0,browser_version:!0,click:!0,click_chapter1:!0,click_chapter2:!0,click_chapter3:!0,click_full_name:!0,connection_monitor:!0,connection_organisation:!0,cookie_creation_date:!0,date:!0,date_day:!0,date_daynumber:!0,date_month:!0,date_monthnumber:!0,date_week:!0,date_year:!0,date_yearofweek:!0,device_brand:!0,device_display_height:!0,device_display_width:!0,device_name:!0,device_name_tech:!0,device_screen_diagonal:!0,device_screen_height:!0,device_screen_width:!0,device_type:!0,event_collection_platform:!0,event_collection_version:!0,event_hour:!0,event_id:!0,event_minute:!0,event_position:!0,event_second:!0,event_time:!0,event_time_utc:!0,event_url:!0,event_url_domain:!0,event_url_full:!0,exclusion_cause:!0,exclusion_type:!0,geo_city:!0,geo_continent:!0,geo_country:!0,geo_metro:!0,geo_region:!0,goal_type:!0,hit_time_utc:!0,os:!0,os_group:!0,os_version:!0,os_version_name:!0,page:!0,page_chapter1:!0,page_chapter2:!0,page_chapter3:!0,page_duration:!0,page_full_name:!0,page_position:!0,page_title_html:!0,page_url:!0,pageview_id:!0,previous_url:!0,privacy_status:!0,site:!0,site_env:!0,site_id:!0,site_platform:!0,src:!0,src_detail:!0,src_direct_access:!0,src_organic:!0,src_organic_detail:!0,src_portal_domain:!0,src_portal_site:!0,src_portal_site_id:!0,src_portal_url:!0,src_referrer_site_domain:!0,src_referrer_site_url:!0,src_referrer_url:!0,src_se:!0,src_se_category:!0,src_se_country:!0,src_type:!0,src_url:!0,src_url_domain:!0,src_webmail:!0}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0,atuserid:!0},forbidden:{}},events:{allowed:{"click.exit":!0,"click.navigation":!0,"click.download":!0,"click.action":!0,"page.display":!0},forbidden:{}}},"*":{properties:{allowed:{"*":{connection_type:!0,device_timestamp_utc:!0,visitor_privacy_consent:!0,visitor_privacy_mode:!0,"ch_ua*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{}},events:{allowed:{},forbidden:{}}}}}};function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function _createForOfIteratorHelper(e,t){var r,i,n,o,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return n=!(i=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return i=e.done,e},e:function(e){n=!0,r=e},f:function(){try{i||null==a.return||a.return()}finally{if(n)throw r}}};if(Array.isArray(e)||(a=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),o=0,{s:t=function(){},n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}var _cloneObject=function(e,t){if("object"!==_typeof(e)||null===e||e instanceof Date)return e;var r,i=new e.constructor;for(r in e)!Object.prototype.hasOwnProperty.call(e,r)||void 0===r||t&&void 0===e[r]||(i[r]=_cloneObject(e[r]));return i},http={post:function(t,r,i){var e=r,n=new URL(t),n={hostname:n.hostname,port:443,path:n.pathname+n.search,method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"}},n=https__namespace.request(n,function(e){i&&i(t,r,e)});n.write(e),n.end()}},_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encoding={encodeURIComponent:encodeURIComponent,utf8:{encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t+=String.fromCharCode(i):t=127<i&&i<2048?(t+=String.fromCharCode(i>>6|192))+String.fromCharCode(63&i|128):(t=(t+=String.fromCharCode(i>>12|224))+String.fromCharCode(i>>6&63|128))+String.fromCharCode(63&i|128)}return t},decode:function(e){var t,r,i,n="",o=0;for(t=0;o<e.length;)(i=e.charCodeAt(o))<128?(n+=String.fromCharCode(i),o++):191<i&&i<224?(t=e.charCodeAt(o+1),n+=String.fromCharCode((31&i)<<6|63&t),o+=2):(t=e.charCodeAt(o+1),r=e.charCodeAt(o+2),n+=String.fromCharCode((15&i)<<12|(63&t)<<6|63&r),o+=3);return n}},base64:{encode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=encoding.utf8.encode(e);u<e.length;)i=(t=e.charCodeAt(u++))>>2,n=(3&t)<<4|(t=e.charCodeAt(u++))>>4,o=(15&t)<<2|(r=e.charCodeAt(u++))>>6,a=63&r,isNaN(t)?o=a=64:isNaN(r)&&(a=64),s=s+_keyStr.charAt(i)+_keyStr.charAt(n)+_keyStr.charAt(o)+_keyStr.charAt(a);return s},decode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)i=_keyStr.indexOf(e.charAt(u++)),t=(15&(n=_keyStr.indexOf(e.charAt(u++))))<<4|(o=_keyStr.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(a=_keyStr.indexOf(e.charAt(u++))),s+=String.fromCharCode(i<<2|n>>4),64!=o&&(s+=String.fromCharCode(t)),64!=a&&(s+=String.fromCharCode(r));return s=encoding.utf8.decode(s)}}},uuid={v4:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}};function Configuration(e){var r=e;function i(e,t){null!==t&&""!==t&&void 0!==t&&(r[e]=t)}return{setConfiguration:i,setConfigurations:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i(t,e[t])},getConfiguration:function(e){return void 0!==r[e]?_cloneObject(r[e]):null},cloneData:function(){return _cloneObject(r)},deleteProperty:function(e){delete r[e]}}}function PianoAnalyticsQueue(t){var r=[];return{push:function(e){r.push(e),1===r.length&&t[e[0]].apply(t,e.slice(1))},next:function(){var e;r.shift(),0<r.length&&t[(e=r[0])[0]].apply(t,e.slice(1))}}}function Model(o,e,t){this.properties=_cloneObject(o._properties),this.addEventsProperty=function(e,t){if(o._privacy.call("isPropAllowed",e)){var r,i=_createForOfIteratorHelper(this.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;this.isPropertyAbsentForEvent(e,n)&&(n.data[e]=t)}}catch(e){i.e(e)}finally{i.f()}}},this.hasProperty=function(e){return Object.prototype.hasOwnProperty.call(this.properties,e)},this.getConfiguration=t.getConfiguration,this.setConfiguration=t.setConfiguration,this.options=e.options||{},this.visitorId=null,this.build={url:"",data:{}},this.events=e.events||[],this.isPropertyAbsentForEvent=function(e,t){if(void 0!==t.data[e])return!1;if(this.hasProperty(e)){if(void 0===this.properties[e].options.events)return!1;var r,i=_createForOfIteratorHelper(this.properties[e].options.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;if(t.name===n||"*"===n.charAt(n.length-1)&&0===t.name.indexOf(n.substring(0,n.length-1)))return!1}}catch(e){i.e(e)}finally{i.f()}}return!0}}function nextStep(e,t,r,i){!1!==i&&0<r.length&&"function"==typeof r[0]?r[0](e,t,r.slice(1)):e._queue.next()}function buildStep(e,t,r){var i=t.getConfiguration("collectDomain"),n=i.startsWith("https://")||i.startsWith("http://")?"":"https://",n="".concat(n).concat(i,"/").concat(t.getConfiguration("path")),i="?s=".concat(t.getConfiguration("site")).concat(t.visitorId?"&idclient="+t.visitorId:"");t.build.url=n+i,t.build.data={events:t.events},nextStep(e,t,r)}function campaignsStep(e,t,r){nextStep(e,t,r)}function metadataStep(e,t,r){t.addEventsProperty("event_collection_platform","js-browserless"),t.addEventsProperty("event_collection_version",t.getConfiguration("version"));var i=new Date;t.addEventsProperty("device_timestamp_utc",i.getTime()),t.addEventsProperty("device_local_hour",i.getTime()),t.addEventsProperty("device_hour",i.getHours()),nextStep(e,t,r)}function onBeforeBuildStep(t,r,i){function e(e){nextStep(t,r,i,e)}r.options&&r.options.onBeforeBuild?r.options.onBeforeBuild(t,r,e):e()}function onBeforeSendStep(t,r,i){function e(e){nextStep(t,r,i,e)}r.options&&r.options.onBeforeSend?r.options.onBeforeSend(t,r,e):e()}function privacyStep(e,t,r){e._privacy.call("filterEvents",t.events),e._privacy.call("filterProps",t.properties);for(var i=t.events,n=0;n<i.length;n++){e._privacy.call("filterProps",i[n].data,i[n].name);var o,a=e._privacy.call("getModeMetadata")||{};for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&t.addEventsProperty(o,a[o])}nextStep(e,t,r)}function propertiesStep(e,t,r){var i,n=[];for(i in t.properties)if(Object.prototype.hasOwnProperty.call(t.properties,i)){var o,a=!1,s=_createForOfIteratorHelper(t.events);try{for(s.s();!(o=s.n()).done;){var u=o.value,c=!1,l=t.properties[i].options.events;if(l)if(-1<l.indexOf(u.name))c=!0;else{var p,f=_createForOfIteratorHelper(l);try{for(f.s();!(p=f.n()).done;){var d=p.value;if("*"===d.charAt(d.length-1)&&0===u.name.indexOf(d.substring(0,d.length-1))){c=!0;break}}}catch(e){f.e(e)}finally{f.f()}}else c=!0;c&&void 0===u.data[i]&&(u.data[i]=t.properties[i].value,a=!0)}}catch(e){s.e(e)}finally{s.f()}a&&!t.properties[i].options.persistent&&n.push(i)}for(var v=0,g=n;v<g.length;v++)delete e._properties[g[v]];if(!t.getConfiguration("sendEmptyProperties")){var y,_=_createForOfIteratorHelper(t.events);try{for(_.s();!(y=_.n()).done;){var h,b=y.value;for(h in b.data)!Object.prototype.hasOwnProperty.call(b.data,h)||""!==b.data[h]&&void 0!==b.data[h]||delete b.data[h]}}catch(e){_.e(e)}finally{_.f()}}nextStep(e,t,r)}function sendStep(e,t,r){(e._privacy.call("getMode")!==e._privacy.modeEnum.OPTOUT||e._privacy.call("getMode")===e._privacy.modeEnum.OPTOUT&&t.getConfiguration("sendEventWhenOptout"))&&0<t.build.data.events.length&&http.post(t.build.url,JSON.stringify(t.build.data)),nextStep(e,t,r)}function userStep(r,i,n){void 0!==i.properties.user_id?nextStep(r,i,n):r.getUser(function(e){var t;null!==e&&(i.addEventsProperty("user_id",e.id,t={persistent:!0}),i.addEventsProperty("user_category",e.category,t),i.addEventsProperty("user_recognition",!0,t)),nextStep(r,i,n)})}function visitorStep(r,i,n){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){var t;!i.getConfiguration("isVisitorClientSide")||(i.visitorId=r._visitorId.value||e||uuid.v4(),t="OPT-OUT"!==i.visitorId&&"no-consent"!==i.visitorId&&"no-storage"!==i.visitorId&&i.visitorId!==r._visitorId.value,i.visitorId===e&&"relative"!==i.getConfiguration("visitorStorageMode"))||!t?nextStep(r,i,n):((e=new Date).setTime(e.getTime()+24*i.getConfiguration("storageLifetimeVisitor")*60*60*1e3),r._privacy.call("setItem",i.getConfiguration("storageVisitor"),i.visitorId,e,function(){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){null===e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i.visitorId)&&(i.visitorId=i.visitorId+"-NO"),nextStep(r,i,n)})}))})}var localVariable={};function LocalVariable(n){this.setItem=function(e,t,r,i){t=JSON.stringify({data:t,expires:r?r.getTime():0});localVariable[e]=n.getConfiguration("encodeStorageBase64")?encoding.base64.encode(t):t,i&&i()},this.getItem=function(t,e){var r,i=null;if(void 0!==localVariable[t]){try{r=JSON.parse(localVariable[t])}catch(e){r=JSON.parse(encoding.base64.decode(localVariable[t]))}0===r.expires||(new Date).getTime()<r.expires?(i=r.data,e&&e(i)):(new Date).getTime()>r.expires&&this.deleteItem(t,function(){e&&e(i)})}else e&&e(i)},this.deleteItem=function(e,t){delete localVariable[e],t&&t()}}var Storage=LocalVariable;function User(n){var o=n.getConfiguration("storageUser");n.setUser=function(e,t,r){var i={id:e,category:t};n.setProperties({user_id:e,user_category:t,user_recognition:!1},{persistent:!0}),!1!==r&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimeUser")*60*60*1e3),n._privacy.call("setItem",o,i,e))},n.getUser=function(r){n._storage.getItem(o,function(e){var t=e;!e&&n._properties.user_id&&(t={id:n._properties.user_id.value,category:n._properties.user_category.value}),r&&r(t)})},n.deleteUser=function(e){n.deleteProperty("user_id"),n.deleteProperty("user_category"),n.deleteProperty("user_recognition"),n._storage.deleteItem(o,function(){e&&e()})}}var AVInsights=function(C){function k(){this.debugError={trigger:"AvInsights:Media:setContentValues:Error",level:"ERROR",messageObject:"Not an object"},this.processHeartbeatValue=function(e,t){e=parseInt(e,10);return e?Math.max(e,t):0},this.value2Number=function(e){var t=0;return isNaN(Number(e))||(t=Number(e)),Math.max(t,0)}}var w={minHeartbeat:C.getConfiguration("minHeartbeat"),minBufferingHeartbeat:C.getConfiguration("minBufferingHeartbeat")},O="_ATVALUE",S="_ATPREFIX";function x(e,t){var r,e=e.length<2||":"!==e[1]?(r="",e):e.length<4||":"!==e[3]?(r=e.substring(0,1),e.substring(2,e.length)):(r=e.substring(0,3),e.substring(4,e.length));return t&&(r=r.toLowerCase(),e=e.toLowerCase()),{prefix:r,key:e}}function A(e){return null!==e&&"object"===_typeof(e)&&!(e instanceof Array)}function T(e,t,r,i,n){var o,a,s,u="",c="",l="",p=0;for(s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(u=(o=x(s,n)).prefix||i||"",c=(t?t+"_":"")+o.key,A(e[s]))T(e[s],c,r,u,n);else{for(a=c.split("_"),l="",p=0;p<a.length;p++)u=(o=x(a[p],n)).prefix||u,l+=o.key+(p<a.length-1?"_":"");r[c=l||c]=r[c]||{},r[c][O]=e[s],r[c][S]=u}}C.avInsights={},C.avInsights.Media=function(e,t,r){function i(){d.previousCursorPosition=0,d.currentCursorPosition=0,d.eventDuration=0,d.previousEvent="",d.sessionId=uuid.v4()}function n(e){e?d.delayBufferingConfiguration=_cloneObject(d.delayBufferingConfigurationBackup):d.delayConfiguration=_cloneObject(d.delayConfigurationBackup)}function o(e,t){if(t){_(e);var r,i={};for(r in A(t)?i=t:isNaN(t)?i=JSON.parse(t):i[0]=t,i)Object.prototype.hasOwnProperty.call(i,r)&&(e?d.delayBufferingConfiguration.push({delay:f.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:f.processHeartbeatValue(i[r],w.minBufferingHeartbeat)}):d.delayConfiguration.push({delay:f.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:f.processHeartbeatValue(i[r],w.minHeartbeat)}));h(e),y(e)}}function a(e,t,r,i){var n=_cloneObject(g),t=(n.av_session_id={},n.av_session_id[O]=d.sessionId,n.av_session_id[S]="",t&&(m(n),d.previousEvent=e),A(i)&&T(i,null,n,null,!0),P(n));C.sendEvent(e,t,r)}function s(){var e=this,t=0,r=0;e.getEventDuration=function(){var e=(new Date).getTime()-t-r;return r+=e,e},e.initBaseTime=function(){0===t&&(t=(new Date).getTime())},e.resetProperties=function(){r=t=0},e.initHeartbeatTimer=function(e,t){var r=t?d.delayBufferingConfiguration:d.delayConfiguration;0<r.length&&(b(t),clearTimeout(r[0].timeout),r[0].timeout=setTimeout(function(){0===r[0].number&&r.splice(0,1),e&&e()},1e3*r[0].refresh))},e.stopHeartbeatTimer=function(e){for(var t=e?d.delayBufferingConfiguration:d.delayConfiguration,r=0;r<t.length;r++)clearTimeout(t[r].timeout),t[r].timeout=-1}}function u(e,t,r,i,n){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e?d.previousCursorPosition+Math.floor(d.playbackSpeed*d.eventDuration):r,t&&v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.heartbeat",!0,i,n)}function c(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),e&&v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.heartbeat",!0,t,r)}function l(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,e&&v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.heartbeat",!0,t,r)}var p=this,f=new k,d=null,v=null,g=null,y=function(e){e?d.delayBufferingConfigurationBackup=_cloneObject(d.delayBufferingConfiguration):d.delayConfigurationBackup=_cloneObject(d.delayConfiguration)},_=function(e){e?(d.delayBufferingConfiguration=[],d.delayBufferingConfigurationBackup=[]):(d.delayConfiguration=[],d.delayConfigurationBackup=[])},h=function(e){(e?d.delayBufferingConfiguration:d.delayConfiguration).sort(function(e,t){return e.delay<t.delay?-1:t.delay<e.delay?1:0})},b=function(e){var t,e=e?d.delayBufferingConfiguration:d.delayConfiguration;void 0===(t=void 0!==e[1]?e[1].delay:t)?e[0].number=1:0<e[0].number?e[0].number--:"number"==typeof t&&(e[0].number=Math.floor(60*(t-e[0].delay)/e[0].refresh)-1)},m=function(e){e.av_previous_position={},e.av_previous_position[O]=d.previousCursorPosition,e.av_previous_position[S]="",e.av_position={},e.av_position[O]=d.currentCursorPosition,e.av_position[S]="",e.av_duration={},e.av_duration[O]=d.eventDuration,e.av_duration[S]="",e.av_previous_event={},e.av_previous_event[O]=d.previousEvent,e.av_previous_event[S]=""},P=function(e){var t,r={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Object.prototype.hasOwnProperty.call(e[t],O)?r[e[t][S]?"".concat(e[t][S],":").concat(t):t]=e[t][O]:r[t]=e[t]);return r};p.set=function(e,t){e=x(e,!0);g[e.key]=g[e.key]||{},g[e.key][O]=t,g[e.key][S]=e.prefix},p.get=function(e){var t=null,e=x(e,!0);return t=void 0!==g[e.key]?g[e.key][O]:t},p.del=function(e){e=x(e,!0);void 0!==g[e.key]&&delete g[e.key]},p.setProps=function(e){A(e)&&T(e,null,g,null,!0)},p.getProps=function(){var e,t=null;for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&((t=t||{})[e]=g[e][O]);return t},p.delProps=function(){g={}};p.setPlaybackSpeed=function(e){e=f.value2Number(e)||d.playbackSpeed;e!==d.playbackSpeed&&(v.stopHeartbeatTimer(!1),d.isPlaying&&(u(!0,!1),v.initHeartbeatTimer(function(){u(!0,!0)},!1)),d.playbackSpeed=e)},p.getSessionID=function(){return d.sessionId},p.track=function(e,t,r,i){var n=t||{};switch(e){case"av.heartbeat":p.heartbeat(n.av_position,r,i);break;case"av.buffer.heartbeat":p.bufferHeartbeat(r,i);break;case"av.rebuffer.heartbeat":p.rebufferHeartbeat(r,i);break;case"av.play":p.play(n.av_position,r,i);break;case"av.buffer.start":p.bufferStart(n.av_position,r,i);break;case"av.start":p.playbackStart(n.av_position,r,i);break;case"av.resume":p.playbackResumed(n.av_position,r,i);break;case"av.pause":p.playbackPaused(n.av_position,r,i);break;case"av.stop":p.playbackStopped(n.av_position,r,i);break;case"av.backward":p.seekBackward(n.av_previous_position,n.av_position,r,i);break;case"av.forward":p.seekForward(n.av_previous_position,n.av_position,r,i);break;case"av.seek.start":p.seekStart(n.av_previous_position,r,i);break;case"av.error":p.error(n.av_player_error,r,i);break;default:a(e,!1,r,i)}},p.heartbeat=function(e,t,r){var i,n=!0;null!=e&&0<=e&&(n=!1,i=f.value2Number(e)),u(n,!1,i,t,r)},p.bufferHeartbeat=function(e,t){c(!1,e,t)},p.rebufferHeartbeat=function(e,t){l(!1,e,t)},p.play=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=0,d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.play",!0,t,r)},p.bufferStart=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),d.isPlaybackActivated?(v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.start",!0,t,r)):(v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.start",!0,t,r))},p.playbackStart=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.start",!0,t,r)},p.playbackResumed=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.resume",!0,t,r)},p.playbackPaused=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.pause",!0,t,r)},p.playbackStopped=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),a("av.stop",!0,t,r),i()},p.playbackKill=function(){v.initBaseTime(),d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),i()},p.seek=function(e,t,r,i){e=f.value2Number(e),t=f.value2Number(t);t<e?p.seekBackward(e,t,r,i):p.seekForward(e,t,r,i)},p.seekBackward=function(e,t,r,i){p.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=f.value2Number(e),d.currentCursorPosition=f.value2Number(t),a("av.backward",!0,r,i)},p.seekForward=function(e,t,r,i){p.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=f.value2Number(e),d.currentCursorPosition=f.value2Number(t),a("av.forward",!0,r,i)},p.seekStart=function(e,t,r){e=f.value2Number(e);d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying?d.eventDuration=v.getEventDuration():d.eventDuration=0,a("av.seek.start",!0,t,r)},p.adClick=function(e,t){a("av.ad.click",!1,e,t)},p.adSkip=function(e,t){a("av.ad.skip",!1,e,t)},p.error=function(e,t,r){var i={};(i=A(r)?r:i).av_player_error=String(e),a("av.error",!1,t,i)},p.display=function(e,t){a("av.display",!1,e,t)},p.close=function(e,t){a("av.close",!1,e,t)},p.volume=function(e,t){a("av.volume",!1,e,t)},p.subtitleOn=function(e,t){a("av.subtitle.on",!1,e,t)},p.subtitleOff=function(e,t){a("av.subtitle.off",!1,e,t)},p.fullscreenOn=function(e,t){a("av.fullscreen.on",!1,e,t)},p.fullscreenOff=function(e,t){a("av.fullscreen.off",!1,e,t)},p.quality=function(e,t){a("av.quality",!1,e,t)},p.speed=function(e,t){a("av.speed",!1,e,t)},o(!(d={previousCursorPosition:0,currentCursorPosition:0,eventDuration:0,playbackSpeed:1,previousEvent:"",isPlaybackActivated:!(p.share=function(e,t){a("av.share",!1,e,t)}),isPlaying:!1,sessionId:"",delayConfiguration:[],delayConfigurationBackup:[],delayBufferingConfiguration:[],delayBufferingConfigurationBackup:[]}),e),o(!0,t),d.sessionId=r||uuid.v4(),v=new s,g={}}};function VisitorId(n){this.value=null,n.getVisitorId=function(t){var r=this.value,i=null;if(n._storage.getItem(n.getConfiguration("storageVisitor"),function(e){i=_processCallbackIfPresent(r||e,t)}.bind(n)),void 0===t)return i}.bind(this),n.setVisitorId=function(e){this.value=e;var t=new Date;t.setTime(t.getTime()+24*n.getConfiguration("storageLifetimeVisitor")*60*60*1e3),n._privacy.call("setItem",n.getConfiguration("storageVisitor"),e,t,function(){})}.bind(this)}function _processCallbackIfPresent(e,t){return t&&t(e),e}function AtPrivacy(n){function r(e,t,r,i){return r=u(t[r].events[e],i),t=u(t["*"].events[e],i),r||t}function i(e,t,r,i,n){var o,n=n?(o=c(t[r].properties,e,i,n),c(t["*"].properties,e,i,n)):(o=l(t[r].properties,e,i),l(t["*"].properties,e,i));return o||n}function o(e,t,r,i){return r=p(t[r].storage,e,i),t=p(t["*"].storage,e,i),r||t}var a=n.getConfiguration("privacy"),s=(this.currentMode="",this.modes=a.modes,this._storageKeys=Object.assign(a.legacyKeys,a.storageKeys),this.init=function(){n._privacy.isLegacyPrivacy&&n._storage.getItem(a.storageKey,function(e){this.setMode(e&&this.modes[e]?e:n.getConfiguration("privacyDefaultMode"))}.bind(this))},this.setMode=function(t){t!==this.currentMode&&this.modes[t]&&(this.currentMode=t,n._storage.getItem(a.storageKey,function(e){"optout"===t||"no-consent"===t||"no-storage"===t?n._visitorId.value=this.modes[t].visitorId:"OPT-OUT"!==n._visitorId.value&&"no-consent"!==n._visitorId.value&&"no-storage"!==n._visitorId.value||(n._visitorId.value=null),this.filterProps(n._properties),this.filterKeys(),e!==t&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimePrivacy")*60*60*1e3),this.setItem(a.storageKey,t,e))}.bind(this)))},this.createMode=function(e,t){var r;this.modes[e]||((r=_cloneObject(this.modes.exempt)).name=e,r.properties.include.visitor_privacy_mode=e,r.properties.include.visitor_privacy_consent=t,this.modes[e]=r)},this.getMode=function(){return this.currentMode},function(e,t,r,i,n,o){var a=["*"],s=["*"],u="properties",c=i?"forbidden":"allowed";t&&(a="string"==typeof t?[t]:t),r&&(s="string"==typeof r?[r]:r),n&&(u="storage"),o&&(u="events");for(var l=0;l<a.length;l++)if(void 0!==this.modes[a[l]])for(var p=this.modes[a[l]],f=0;f<s.length;f++){var d=p[u][c];void 0!==d[s[f]]||n||o||(d[s[f]]={});for(var v=0;v<e.length;v++)n||o?d[e[v]]=!0:d[s[f]][e[v]]=!0}}.bind(this)),u=(this.include={properties:function(e,t,r){s(e,t,r)},property:function(e,t,r){s([e],t,r)},storageKeys:function(e,t){s(e,t,null,!1,!0)},storageKey:function(e,t){s([e],t,null,!1,!0)},events:function(e,t){s(e,t,null,!1,!1,!0)},event:function(e,t){s([e],t,null,!1,!1,!0)}},this.exclude={properties:function(e,t,r){s(e,t,r,!0)},property:function(e,t,r){s([e],t,r,!0)},storageKeys:function(e,t){s(e,t,null,!0,!0)},storageKey:function(e,t){s([e],t,null,!0,!0)},events:function(e,t){s(e,t,null,!0,!1,!0)},event:function(e,t){s([e],t,null,!0,!1,!0)}},function(e,t){if(e[t])return!0;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&"*"===r.charAt(r.length-1)&&0===t.indexOf(r.substring(0,r.length-1)))return!0;return!1}),c=(this.isEventAllowed=function(e){var t=r("forbidden",this.modes,this.currentMode,e),e=r("allowed",this.modes,this.currentMode,e);return!t&&e},function(e,t,r,i){var n,o=e[t];if(o[i]&&o[i][r]||o["*"][r])return!0;for(n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&"*"===n.charAt(n.length-1)&&0===i.indexOf(n.substring(0,n.length-1))||n===i)for(var a in o[n])if(Object.prototype.hasOwnProperty.call(o[n],a)&&("*"===a.charAt(a.length-1)&&0===r.indexOf(a.substring(0,a.length-1))||r===a))return!0;return!1}),l=function(e,t,r){if("forbidden"===t&&e[t]["*"][r])return!0;for(var i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)){if(e[t][i][r])return!0;for(var n in e[t][i])if("*"===n.charAt(n.length-1)&&0===r.indexOf(n.substring(0,n.length-1)))return!0}return!1},p=(this.isPropAllowed=function(e,t){var r=i("forbidden",this.modes,this.currentMode,e,t),e=i("allowed",this.modes,this.currentMode,e,t);return!r&&e},function(e,t,r){var i,n=e[t];if(n[r])return!0;for(i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"*"===i.charAt(i.length-1)&&0===r.indexOf(i.substring(0,i.length-1)))return!0;return!1});this.isKeyAllowed=function(e){var t=o("forbidden",this.modes,this.currentMode,e),e=o("allowed",this.modes,this.currentMode,e);return!t&&e},this.setItem=function(e,t,r,i){this.isKeyAllowed(e)?n._storage.setItem(e,t,r,i):i&&i()},this.filterProps=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&!this.isPropAllowed(r,t||void 0)&&delete e[r]},this.filterKeys=function(){for(var e in this._storageKeys)Object.prototype.hasOwnProperty.call(this._storageKeys,e)&&!this.isKeyAllowed(e)&&n._storage.deleteItem(e)},this.filterEvents=function(e){for(var t=e.length-1;0<=t;t--)this.isEventAllowed(e[t].name)||e.splice(t,1)},this.getModeMetadata=function(){return this.modes[this.getMode()].properties.include},this.init()}function Privacy(o){var e=this;this.isLegacyPrivacy=!0,this.modeEnum={OPTOUT:e.isLegacyPrivacy?"optout":"opt-out"},this.call=function(e){for(var t=this.isLegacyPrivacy?"privacy":"consent",r=arguments.length,i=new Array(1<r?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o[t][e].apply(o[t],i)}}function initPrivacy(e){e._privacy=new Privacy(e),e.privacy=new AtPrivacy(e)}function PianoAnalytics(e){_initConfig(this,e),this._storage=new Storage(this),this._queue=new PianoAnalyticsQueue(this),this._properties={},this._sendEvent=_sendEvent,this._setProperty=_setProperty,this._deleteProperty=_deleteProperty,this._visitorId=new VisitorId(this),initPrivacy(this),this.user=new User(this),AVInsights(this)}function _initConfig(e,t){e.cfg=new Configuration(_cloneObject(t)||Config),e.setConfiguration=e.cfg.setConfiguration,e.setConfigurations=e.cfg.setConfigurations,e.getConfiguration=e.cfg.getConfiguration}function _sendEvent(e,t){for(var r=[privacyStep,visitorStep,userStep,campaignsStep,metadataStep,propertiesStep,onBeforeBuildStep,buildStep,onBeforeSendStep,sendStep],i=0;i<e.length;i++){var n={name:"",data:{}};if("string"==typeof e[i])n.name=e[i];else{if(void 0!==e[i].data)continue;n.name=e[i].name}e[i]=n}var o,t={events:_cloneObject(e),options:_cloneObject(t)};0<r.length&&"function"==typeof r[0]&&(o=new Configuration(this.cfg.cloneData()),r[0](this,new Model(this,t,o),r.slice(1)))}function _setProperty(e,t,r,i){e._privacy.call("isPropAllowed",t)&&(e._properties[t]={value:r,options:i||{}}),e._queue.next()}function _deleteProperty(e,t){delete e._properties[t],e._queue.next()}PianoAnalytics.prototype.setProperty=function(e,t,r){this._queue.push(["_setProperty",this,e,t,r])},PianoAnalytics.prototype.setProperties=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setProperty(r,e[r],t)},PianoAnalytics.prototype.deleteProperty=function(e){this._queue.push(["_deleteProperty",this,e])},PianoAnalytics.prototype.sendEvent=function(e,t,r){this._queue.push(["_sendEvent",[{name:e,data:t}],r])},PianoAnalytics.prototype.sendEvents=function(e,t){this._queue.push(["_sendEvent",e,t])};var pianoAnalytics=new(PianoAnalytics.prototype.PA=PianoAnalytics)(Config);exports.pianoAnalytics=pianoAnalytics; |
@@ -1,1 +0,1 @@ | ||
import*as https from"https";var Config={site:"",collectDomain:"",path:"event",visitorStorageMode:"fixed",storageLifetimeVisitor:395,storageLifetimeUser:395,storageLifetimePrivacy:395,privacyDefaultMode:"optin",sendEventWhenOptout:!0,isVisitorClientSide:!0,enableCallbacks:!0,cookieDomain:"",cookieSecure:!0,cookiePath:"/",cookieSameSite:"lax",encodeStorageBase64:!1,addEventURL:"withoutQS",clickAutoManagement:!0,enableUTMTracking:!0,campaignPrefix:["at_"],storageVisitor:"pa_vid",storageUser:"pa_user",version:"6.15.0",minHeartbeat:5,minBufferingHeartbeat:1,queueVarName:"_paq",globalVarName:"pa",enableAutomaticPageRefresh:!0,allowHighEntropyClientHints:!0,sendEmptyProperties:!0,enableExtendedOptout:!1,privacy:{storageKey:"pa_privacy",legacyKeys:{pa_vid:!0,pa_privacy:!0,atuserid:!0},storageKeys:{pa_user:!0},modes:{optin:{name:"optin",properties:{include:{visitor_privacy_consent:!0,visitor_privacy_mode:"optin"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{"*":!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},optout:{name:"optout",visitorId:"OPT-OUT",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"optout"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},"no-consent":{name:"no-consent",visitorId:"no-consent",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-consent"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},"no-storage":{name:"no-storage",visitorId:"no-storage",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-storage"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},exempt:{name:"exempt",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"exempt"},allowed:{"*":{app_crash:!0,app_crash_class:!0,app_crash_screen:!0,app_version:!0,browser:!0,browser_cookie_acceptance:!0,browser_group:!0,browser_version:!0,click:!0,click_chapter1:!0,click_chapter2:!0,click_chapter3:!0,click_full_name:!0,connection_monitor:!0,connection_organisation:!0,cookie_creation_date:!0,date:!0,date_day:!0,date_daynumber:!0,date_month:!0,date_monthnumber:!0,date_week:!0,date_year:!0,date_yearofweek:!0,device_brand:!0,device_display_height:!0,device_display_width:!0,device_name:!0,device_name_tech:!0,device_screen_diagonal:!0,device_screen_height:!0,device_screen_width:!0,device_type:!0,event_collection_platform:!0,event_collection_version:!0,event_hour:!0,event_id:!0,event_minute:!0,event_position:!0,event_second:!0,event_time:!0,event_time_utc:!0,event_url:!0,event_url_domain:!0,event_url_full:!0,exclusion_cause:!0,exclusion_type:!0,geo_city:!0,geo_continent:!0,geo_country:!0,geo_metro:!0,geo_region:!0,goal_type:!0,hit_time_utc:!0,os:!0,os_group:!0,os_version:!0,os_version_name:!0,page:!0,page_chapter1:!0,page_chapter2:!0,page_chapter3:!0,page_duration:!0,page_full_name:!0,page_position:!0,page_title_html:!0,page_url:!0,pageview_id:!0,previous_url:!0,privacy_status:!0,site:!0,site_env:!0,site_id:!0,site_platform:!0,src:!0,src_detail:!0,src_direct_access:!0,src_organic:!0,src_organic_detail:!0,src_portal_domain:!0,src_portal_site:!0,src_portal_site_id:!0,src_portal_url:!0,src_referrer_site_domain:!0,src_referrer_site_url:!0,src_referrer_url:!0,src_se:!0,src_se_category:!0,src_se_country:!0,src_type:!0,src_url:!0,src_url_domain:!0,src_webmail:!0}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0,atuserid:!0},forbidden:{}},events:{allowed:{"click.exit":!0,"click.navigation":!0,"click.download":!0,"click.action":!0,"page.display":!0},forbidden:{}}},"*":{properties:{allowed:{"*":{connection_type:!0,device_timestamp_utc:!0,visitor_privacy_consent:!0,visitor_privacy_mode:!0,"ch_ua*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{}},events:{allowed:{},forbidden:{}}}}}};function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function _createForOfIteratorHelper(e,t){var r,i,n,o,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return n=!(i=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return i=e.done,e},e:function(e){n=!0,r=e},f:function(){try{i||null==a.return||a.return()}finally{if(n)throw r}}};if(Array.isArray(e)||(a=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),o=0,{s:t=function(){},n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}var _cloneObject=function(e,t){if("object"!==_typeof(e)||null===e||e instanceof Date)return e;var r,i=new e.constructor;for(r in e)!Object.prototype.hasOwnProperty.call(e,r)||void 0===r||t&&void 0===e[r]||(i[r]=_cloneObject(e[r]));return i},http={post:function(t,r,i){var e=r,n=new URL(t),n={hostname:n.hostname,port:443,path:n.pathname+n.search,method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"}},n=https.request(n,function(e){i&&i(t,r,e)});n.write(e),n.end()}},_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encoding={encodeURIComponent:encodeURIComponent,utf8:{encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t+=String.fromCharCode(i):t=127<i&&i<2048?(t+=String.fromCharCode(i>>6|192))+String.fromCharCode(63&i|128):(t=(t+=String.fromCharCode(i>>12|224))+String.fromCharCode(i>>6&63|128))+String.fromCharCode(63&i|128)}return t},decode:function(e){var t,r,i,n="",o=0;for(t=0;o<e.length;)(i=e.charCodeAt(o))<128?(n+=String.fromCharCode(i),o++):191<i&&i<224?(t=e.charCodeAt(o+1),n+=String.fromCharCode((31&i)<<6|63&t),o+=2):(t=e.charCodeAt(o+1),r=e.charCodeAt(o+2),n+=String.fromCharCode((15&i)<<12|(63&t)<<6|63&r),o+=3);return n}},base64:{encode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=encoding.utf8.encode(e);u<e.length;)i=(t=e.charCodeAt(u++))>>2,n=(3&t)<<4|(t=e.charCodeAt(u++))>>4,o=(15&t)<<2|(r=e.charCodeAt(u++))>>6,a=63&r,isNaN(t)?o=a=64:isNaN(r)&&(a=64),s=s+_keyStr.charAt(i)+_keyStr.charAt(n)+_keyStr.charAt(o)+_keyStr.charAt(a);return s},decode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)i=_keyStr.indexOf(e.charAt(u++)),t=(15&(n=_keyStr.indexOf(e.charAt(u++))))<<4|(o=_keyStr.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(a=_keyStr.indexOf(e.charAt(u++))),s+=String.fromCharCode(i<<2|n>>4),64!=o&&(s+=String.fromCharCode(t)),64!=a&&(s+=String.fromCharCode(r));return s=encoding.utf8.decode(s)}}},uuid={v4:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}};function Configuration(e){var r=e;function i(e,t){null!==t&&""!==t&&void 0!==t&&(r[e]=t)}return{setConfiguration:i,setConfigurations:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i(t,e[t])},getConfiguration:function(e){return void 0!==r[e]?_cloneObject(r[e]):null},cloneData:function(){return _cloneObject(r)},deleteProperty:function(e){delete r[e]}}}function PianoAnalyticsQueue(t){var r=[];return{push:function(e){r.push(e),1===r.length&&t[e[0]].apply(t,e.slice(1))},next:function(){var e;r.shift(),0<r.length&&t[(e=r[0])[0]].apply(t,e.slice(1))}}}function Model(o,e,t){this.properties=_cloneObject(o._properties),this.addEventsProperty=function(e,t){if(o._privacy.call("isPropAllowed",e)){var r,i=_createForOfIteratorHelper(this.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;this.isPropertyAbsentForEvent(e,n)&&(n.data[e]=t)}}catch(e){i.e(e)}finally{i.f()}}},this.hasProperty=function(e){return Object.prototype.hasOwnProperty.call(this.properties,e)},this.getConfiguration=t.getConfiguration,this.setConfiguration=t.setConfiguration,this.options=e.options||{},this.visitorId=null,this.build={url:"",data:{}},this.events=e.events||[],this.isPropertyAbsentForEvent=function(e,t){if(void 0!==t.data[e])return!1;if(this.hasProperty(e)){if(void 0===this.properties[e].options.events)return!1;var r,i=_createForOfIteratorHelper(this.properties[e].options.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;if(t.name===n||"*"===n.charAt(n.length-1)&&0===t.name.indexOf(n.substring(0,n.length-1)))return!1}}catch(e){i.e(e)}finally{i.f()}}return!0}}function nextStep(e,t,r,i){!1!==i&&0<r.length&&"function"==typeof r[0]?r[0](e,t,r.slice(1)):e._queue.next()}function buildStep(e,t,r){var i=t.getConfiguration("collectDomain"),n=i.startsWith("https://")||i.startsWith("http://")?"":"https://",n="".concat(n).concat(i,"/").concat(t.getConfiguration("path")),i="?s=".concat(t.getConfiguration("site")).concat(t.visitorId?"&idclient="+t.visitorId:"");t.build.url=n+i,t.build.data={events:t.events},nextStep(e,t,r)}function campaignsStep(e,t,r){nextStep(e,t,r)}function metadataStep(e,t,r){t.addEventsProperty("event_collection_platform","js-browserless"),t.addEventsProperty("event_collection_version",t.getConfiguration("version"));var i=new Date;t.addEventsProperty("device_timestamp_utc",i.getTime()),t.addEventsProperty("device_local_hour",i.getTime()),t.addEventsProperty("device_hour",i.getHours()),nextStep(e,t,r)}function onBeforeBuildStep(t,r,i){function e(e){nextStep(t,r,i,e)}r.options&&r.options.onBeforeBuild?r.options.onBeforeBuild(t,r,e):e()}function onBeforeSendStep(t,r,i){function e(e){nextStep(t,r,i,e)}r.options&&r.options.onBeforeSend?r.options.onBeforeSend(t,r,e):e()}function privacyStep(e,t,r){e._privacy.call("filterEvents",t.events),e._privacy.call("filterProps",t.properties);for(var i=t.events,n=0;n<i.length;n++){e._privacy.call("filterProps",i[n].data,i[n].name);var o,a=e._privacy.call("getModeMetadata")||{};for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&t.addEventsProperty(o,a[o])}nextStep(e,t,r)}function propertiesStep(e,t,r){var i,n=[];for(i in t.properties)if(Object.prototype.hasOwnProperty.call(t.properties,i)){var o,a=!1,s=_createForOfIteratorHelper(t.events);try{for(s.s();!(o=s.n()).done;){var u=o.value,c=!1,l=t.properties[i].options.events;if(l)if(-1<l.indexOf(u.name))c=!0;else{var p,f=_createForOfIteratorHelper(l);try{for(f.s();!(p=f.n()).done;){var d=p.value;if("*"===d.charAt(d.length-1)&&0===u.name.indexOf(d.substring(0,d.length-1))){c=!0;break}}}catch(e){f.e(e)}finally{f.f()}}else c=!0;c&&void 0===u.data[i]&&(u.data[i]=t.properties[i].value,a=!0)}}catch(e){s.e(e)}finally{s.f()}a&&!t.properties[i].options.persistent&&n.push(i)}for(var v=0,g=n;v<g.length;v++)delete e._properties[g[v]];if(!t.getConfiguration("sendEmptyProperties")){var y,_=_createForOfIteratorHelper(t.events);try{for(_.s();!(y=_.n()).done;){var h,b=y.value;for(h in b.data)!Object.prototype.hasOwnProperty.call(b.data,h)||""!==b.data[h]&&void 0!==b.data[h]||delete b.data[h]}}catch(e){_.e(e)}finally{_.f()}}nextStep(e,t,r)}function sendStep(e,t,r){(e._privacy.call("getMode")!==e._privacy.modeEnum.OPTOUT||e._privacy.call("getMode")===e._privacy.modeEnum.OPTOUT&&t.getConfiguration("sendEventWhenOptout"))&&0<t.build.data.events.length&&http.post(t.build.url,JSON.stringify(t.build.data)),nextStep(e,t,r)}function userStep(r,i,n){void 0!==i.properties.user_id?nextStep(r,i,n):r.getUser(function(e){var t;null!==e&&(i.addEventsProperty("user_id",e.id,t={persistent:!0}),i.addEventsProperty("user_category",e.category,t),i.addEventsProperty("user_recognition",!0,t)),nextStep(r,i,n)})}function visitorStep(r,i,n){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){var t;!i.getConfiguration("isVisitorClientSide")||(i.visitorId=r._visitorId.value||e||uuid.v4(),t="OPT-OUT"!==i.visitorId&&"no-consent"!==i.visitorId&&"no-storage"!==i.visitorId&&i.visitorId!==r._visitorId.value,i.visitorId===e&&"relative"!==i.getConfiguration("visitorStorageMode"))||!t?nextStep(r,i,n):((e=new Date).setTime(e.getTime()+24*i.getConfiguration("storageLifetimeVisitor")*60*60*1e3),r._privacy.call("setItem",i.getConfiguration("storageVisitor"),i.visitorId,e,function(){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){null===e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i.visitorId)&&(i.visitorId=i.visitorId+"-NO"),nextStep(r,i,n)})}))})}var localVariable={};function LocalVariable(n){this.setItem=function(e,t,r,i){t=JSON.stringify({data:t,expires:r?r.getTime():0});localVariable[e]=n.getConfiguration("encodeStorageBase64")?encoding.base64.encode(t):t,i&&i()},this.getItem=function(t,e){var r,i=null;if(void 0!==localVariable[t]){try{r=JSON.parse(localVariable[t])}catch(e){r=JSON.parse(encoding.base64.decode(localVariable[t]))}0===r.expires||(new Date).getTime()<r.expires?(i=r.data,e&&e(i)):(new Date).getTime()>r.expires&&this.deleteItem(t,function(){e&&e(i)})}else e&&e(i)},this.deleteItem=function(e,t){delete localVariable[e],t&&t()}}var Storage=LocalVariable;function User(n){var o=n.getConfiguration("storageUser");n.setUser=function(e,t,r){var i={id:e,category:t};n.setProperties({user_id:e,user_category:t,user_recognition:!1},{persistent:!0}),!1!==r&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimeUser")*60*60*1e3),n._privacy.call("setItem",o,i,e))},n.getUser=function(r){n._storage.getItem(o,function(e){var t=e;!e&&n._properties.user_id&&(t={id:n._properties.user_id.value,category:n._properties.user_category.value}),r&&r(t)})},n.deleteUser=function(e){n.deleteProperty("user_id"),n.deleteProperty("user_category"),n.deleteProperty("user_recognition"),n._storage.deleteItem(o,function(){e&&e()})}}var AVInsights=function(C){function k(){this.debugError={trigger:"AvInsights:Media:setContentValues:Error",level:"ERROR",messageObject:"Not an object"},this.processHeartbeatValue=function(e,t){e=parseInt(e,10);return e?Math.max(e,t):0},this.value2Number=function(e){var t=0;return isNaN(Number(e))||(t=Number(e)),Math.max(t,0)}}var w={minHeartbeat:C.getConfiguration("minHeartbeat"),minBufferingHeartbeat:C.getConfiguration("minBufferingHeartbeat")},S="_ATVALUE",O="_ATPREFIX";function x(e,t){var r,e=e.length<2||":"!==e[1]?(r="",e):e.length<4||":"!==e[3]?(r=e.substring(0,1),e.substring(2,e.length)):(r=e.substring(0,3),e.substring(4,e.length));return t&&(r=r.toLowerCase(),e=e.toLowerCase()),{prefix:r,key:e}}function A(e){return null!==e&&"object"===_typeof(e)&&!(e instanceof Array)}function T(e,t,r,i,n){var o,a,s,u="",c="",l="",p=0;for(s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(u=(o=x(s,n)).prefix||i||"",c=(t?t+"_":"")+o.key,A(e[s]))T(e[s],c,r,u,n);else{for(a=c.split("_"),l="",p=0;p<a.length;p++)u=(o=x(a[p],n)).prefix||u,l+=o.key+(p<a.length-1?"_":"");r[c=l||c]=r[c]||{},r[c][S]=e[s],r[c][O]=u}}C.avInsights={},C.avInsights.Media=function(e,t,r){function i(){d.previousCursorPosition=0,d.currentCursorPosition=0,d.eventDuration=0,d.previousEvent="",d.sessionId=uuid.v4()}function n(e){e?d.delayBufferingConfiguration=_cloneObject(d.delayBufferingConfigurationBackup):d.delayConfiguration=_cloneObject(d.delayConfigurationBackup)}function o(e,t){if(t){_(e);var r,i={};for(r in A(t)?i=t:isNaN(t)?i=JSON.parse(t):i[0]=t,i)Object.prototype.hasOwnProperty.call(i,r)&&(e?d.delayBufferingConfiguration.push({delay:f.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:f.processHeartbeatValue(i[r],w.minBufferingHeartbeat)}):d.delayConfiguration.push({delay:f.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:f.processHeartbeatValue(i[r],w.minHeartbeat)}));h(e),y(e)}}function a(e,t,r,i){var n=_cloneObject(g),t=(n.av_session_id={},n.av_session_id[S]=d.sessionId,n.av_session_id[O]="",t&&(m(n),d.previousEvent=e),A(i)&&T(i,null,n,null,!0),P(n));C.sendEvent(e,t,r)}function s(){var e=this,t=0,r=0;e.getEventDuration=function(){var e=(new Date).getTime()-t-r;return r+=e,e},e.initBaseTime=function(){0===t&&(t=(new Date).getTime())},e.resetProperties=function(){r=t=0},e.initHeartbeatTimer=function(e,t){var r=t?d.delayBufferingConfiguration:d.delayConfiguration;0<r.length&&(b(t),clearTimeout(r[0].timeout),r[0].timeout=setTimeout(function(){0===r[0].number&&r.splice(0,1),e&&e()},1e3*r[0].refresh))},e.stopHeartbeatTimer=function(e){for(var t=e?d.delayBufferingConfiguration:d.delayConfiguration,r=0;r<t.length;r++)clearTimeout(t[r].timeout),t[r].timeout=-1}}function u(e,t,r,i,n){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e?d.previousCursorPosition+Math.floor(d.playbackSpeed*d.eventDuration):r,t&&v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.heartbeat",!0,i,n)}function c(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),e&&v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.heartbeat",!0,t,r)}function l(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,e&&v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.heartbeat",!0,t,r)}var p=this,f=new k,d=null,v=null,g=null,y=function(e){e?d.delayBufferingConfigurationBackup=_cloneObject(d.delayBufferingConfiguration):d.delayConfigurationBackup=_cloneObject(d.delayConfiguration)},_=function(e){e?(d.delayBufferingConfiguration=[],d.delayBufferingConfigurationBackup=[]):(d.delayConfiguration=[],d.delayConfigurationBackup=[])},h=function(e){(e?d.delayBufferingConfiguration:d.delayConfiguration).sort(function(e,t){return e.delay<t.delay?-1:t.delay<e.delay?1:0})},b=function(e){var t,e=e?d.delayBufferingConfiguration:d.delayConfiguration;void 0===(t=void 0!==e[1]?e[1].delay:t)?e[0].number=1:0<e[0].number?e[0].number--:"number"==typeof t&&(e[0].number=Math.floor(60*(t-e[0].delay)/e[0].refresh)-1)},m=function(e){e.av_previous_position={},e.av_previous_position[S]=d.previousCursorPosition,e.av_previous_position[O]="",e.av_position={},e.av_position[S]=d.currentCursorPosition,e.av_position[O]="",e.av_duration={},e.av_duration[S]=d.eventDuration,e.av_duration[O]="",e.av_previous_event={},e.av_previous_event[S]=d.previousEvent,e.av_previous_event[O]=""},P=function(e){var t,r={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Object.prototype.hasOwnProperty.call(e[t],S)?r[e[t][O]?"".concat(e[t][O],":").concat(t):t]=e[t][S]:r[t]=e[t]);return r};p.set=function(e,t){e=x(e,!0);g[e.key]=g[e.key]||{},g[e.key][S]=t,g[e.key][O]=e.prefix},p.get=function(e){var t=null,e=x(e,!0);return t=void 0!==g[e.key]?g[e.key][S]:t},p.del=function(e){e=x(e,!0);void 0!==g[e.key]&&delete g[e.key]},p.setProps=function(e){A(e)&&T(e,null,g,null,!0)},p.getProps=function(){var e,t=null;for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&((t=t||{})[e]=g[e][S]);return t},p.delProps=function(){g={}};p.setPlaybackSpeed=function(e){e=f.value2Number(e)||d.playbackSpeed;e!==d.playbackSpeed&&(v.stopHeartbeatTimer(!1),d.isPlaying&&(u(!0,!1),v.initHeartbeatTimer(function(){u(!0,!0)},!1)),d.playbackSpeed=e)},p.getSessionID=function(){return d.sessionId},p.track=function(e,t,r,i){var n=t||{};switch(e){case"av.heartbeat":p.heartbeat(n.av_position,r,i);break;case"av.buffer.heartbeat":p.bufferHeartbeat(r,i);break;case"av.rebuffer.heartbeat":p.rebufferHeartbeat(r,i);break;case"av.play":p.play(n.av_position,r,i);break;case"av.buffer.start":p.bufferStart(n.av_position,r,i);break;case"av.start":p.playbackStart(n.av_position,r,i);break;case"av.resume":p.playbackResumed(n.av_position,r,i);break;case"av.pause":p.playbackPaused(n.av_position,r,i);break;case"av.stop":p.playbackStopped(n.av_position,r,i);break;case"av.backward":p.seekBackward(n.av_previous_position,n.av_position,r,i);break;case"av.forward":p.seekForward(n.av_previous_position,n.av_position,r,i);break;case"av.seek.start":p.seekStart(n.av_previous_position,r,i);break;case"av.error":p.error(n.av_player_error,r,i);break;default:a(e,!1,r,i)}},p.heartbeat=function(e,t,r){var i,n=!0;null!=e&&0<=e&&(n=!1,i=f.value2Number(e)),u(n,!1,i,t,r)},p.bufferHeartbeat=function(e,t){c(!1,e,t)},p.rebufferHeartbeat=function(e,t){l(!1,e,t)},p.play=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=0,d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.play",!0,t,r)},p.bufferStart=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),d.isPlaybackActivated?(v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.start",!0,t,r)):(v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.start",!0,t,r))},p.playbackStart=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.start",!0,t,r)},p.playbackResumed=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.resume",!0,t,r)},p.playbackPaused=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.pause",!0,t,r)},p.playbackStopped=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),a("av.stop",!0,t,r),i()},p.playbackKill=function(){v.initBaseTime(),d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),i()},p.seek=function(e,t,r,i){e=f.value2Number(e),t=f.value2Number(t);t<e?p.seekBackward(e,t,r,i):p.seekForward(e,t,r,i)},p.seekBackward=function(e,t,r,i){p.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=f.value2Number(e),d.currentCursorPosition=f.value2Number(t),a("av.backward",!0,r,i)},p.seekForward=function(e,t,r,i){p.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=f.value2Number(e),d.currentCursorPosition=f.value2Number(t),a("av.forward",!0,r,i)},p.seekStart=function(e,t,r){e=f.value2Number(e);d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying?d.eventDuration=v.getEventDuration():d.eventDuration=0,a("av.seek.start",!0,t,r)},p.adClick=function(e,t){a("av.ad.click",!1,e,t)},p.adSkip=function(e,t){a("av.ad.skip",!1,e,t)},p.error=function(e,t,r){var i={};(i=A(r)?r:i).av_player_error=String(e),a("av.error",!1,t,i)},p.display=function(e,t){a("av.display",!1,e,t)},p.close=function(e,t){a("av.close",!1,e,t)},p.volume=function(e,t){a("av.volume",!1,e,t)},p.subtitleOn=function(e,t){a("av.subtitle.on",!1,e,t)},p.subtitleOff=function(e,t){a("av.subtitle.off",!1,e,t)},p.fullscreenOn=function(e,t){a("av.fullscreen.on",!1,e,t)},p.fullscreenOff=function(e,t){a("av.fullscreen.off",!1,e,t)},p.quality=function(e,t){a("av.quality",!1,e,t)},p.speed=function(e,t){a("av.speed",!1,e,t)},o(!(d={previousCursorPosition:0,currentCursorPosition:0,eventDuration:0,playbackSpeed:1,previousEvent:"",isPlaybackActivated:!(p.share=function(e,t){a("av.share",!1,e,t)}),isPlaying:!1,sessionId:"",delayConfiguration:[],delayConfigurationBackup:[],delayBufferingConfiguration:[],delayBufferingConfigurationBackup:[]}),e),o(!0,t),d.sessionId=r||uuid.v4(),v=new s,g={}}};function VisitorId(n){this.value=null,n.getVisitorId=function(t){var r=this.value,i=null;if(n._storage.getItem(n.getConfiguration("storageVisitor"),function(e){i=_processCallbackIfPresent(r||e,t)}.bind(n)),void 0===t)return i}.bind(this),n.setVisitorId=function(e){this.value=e;var t=new Date;t.setTime(t.getTime()+24*n.getConfiguration("storageLifetimeVisitor")*60*60*1e3),n._privacy.call("setItem",n.getConfiguration("storageVisitor"),e,t,function(){})}.bind(this)}function _processCallbackIfPresent(e,t){return t&&t(e),e}function AtPrivacy(n){function r(e,t,r,i){return r=u(t[r].events[e],i),t=u(t["*"].events[e],i),r||t}function i(e,t,r,i,n){var o,n=n?(o=c(t[r].properties,e,i,n),c(t["*"].properties,e,i,n)):(o=l(t[r].properties,e,i),l(t["*"].properties,e,i));return o||n}function o(e,t,r,i){return r=p(t[r].storage,e,i),t=p(t["*"].storage,e,i),r||t}var a=n.getConfiguration("privacy"),s=(this.currentMode="",this.modes=a.modes,this._storageKeys=Object.assign(a.legacyKeys,a.storageKeys),this.init=function(){n._privacy.isLegacyPrivacy&&n._storage.getItem(a.storageKey,function(e){this.setMode(e&&this.modes[e]?e:n.getConfiguration("privacyDefaultMode"))}.bind(this))},this.setMode=function(t){t!==this.currentMode&&this.modes[t]&&(this.currentMode=t,n._storage.getItem(a.storageKey,function(e){"optout"===t||"no-consent"===t||"no-storage"===t?n._visitorId.value=this.modes[t].visitorId:"OPT-OUT"!==n._visitorId.value&&"no-consent"!==n._visitorId.value&&"no-storage"!==n._visitorId.value||(n._visitorId.value=null),this.filterProps(n._properties),this.filterKeys(),e!==t&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimePrivacy")*60*60*1e3),this.setItem(a.storageKey,t,e))}.bind(this)))},this.createMode=function(e,t){var r;this.modes[e]||((r=_cloneObject(this.modes.exempt)).name=e,r.properties.include.visitor_privacy_mode=e,r.properties.include.visitor_privacy_consent=t,this.modes[e]=r)},this.getMode=function(){return this.currentMode},function(e,t,r,i,n,o){var a=["*"],s=["*"],u="properties",c=i?"forbidden":"allowed";t&&(a="string"==typeof t?[t]:t),r&&(s="string"==typeof r?[r]:r),n&&(u="storage"),o&&(u="events");for(var l=0;l<a.length;l++)if(void 0!==this.modes[a[l]])for(var p=this.modes[a[l]],f=0;f<s.length;f++){var d=p[u][c];void 0!==d[s[f]]||n||o||(d[s[f]]={});for(var v=0;v<e.length;v++)n||o?d[e[v]]=!0:d[s[f]][e[v]]=!0}}.bind(this)),u=(this.include={properties:function(e,t,r){s(e,t,r)},property:function(e,t,r){s([e],t,r)},storageKeys:function(e,t){s(e,t,null,!1,!0)},storageKey:function(e,t){s([e],t,null,!1,!0)},events:function(e,t){s(e,t,null,!1,!1,!0)},event:function(e,t){s([e],t,null,!1,!1,!0)}},this.exclude={properties:function(e,t,r){s(e,t,r,!0)},property:function(e,t,r){s([e],t,r,!0)},storageKeys:function(e,t){s(e,t,null,!0,!0)},storageKey:function(e,t){s([e],t,null,!0,!0)},events:function(e,t){s(e,t,null,!0,!1,!0)},event:function(e,t){s([e],t,null,!0,!1,!0)}},function(e,t){if(e[t])return!0;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&"*"===r.charAt(r.length-1)&&0===t.indexOf(r.substring(0,r.length-1)))return!0;return!1}),c=(this.isEventAllowed=function(e){var t=r("forbidden",this.modes,this.currentMode,e),e=r("allowed",this.modes,this.currentMode,e);return!t&&e},function(e,t,r,i){var n,o=e[t];if(o[i]&&o[i][r]||o["*"][r])return!0;for(n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&"*"===n.charAt(n.length-1)&&0===i.indexOf(n.substring(0,n.length-1))||n===i)for(var a in o[n])if(Object.prototype.hasOwnProperty.call(o[n],a)&&("*"===a.charAt(a.length-1)&&0===r.indexOf(a.substring(0,a.length-1))||r===a))return!0;return!1}),l=function(e,t,r){if("forbidden"===t&&e[t]["*"][r])return!0;for(var i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)){if(e[t][i][r])return!0;for(var n in e[t][i])if("*"===n.charAt(n.length-1)&&0===r.indexOf(n.substring(0,n.length-1)))return!0}return!1},p=(this.isPropAllowed=function(e,t){var r=i("forbidden",this.modes,this.currentMode,e,t),e=i("allowed",this.modes,this.currentMode,e,t);return!r&&e},function(e,t,r){var i,n=e[t];if(n[r])return!0;for(i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"*"===i.charAt(i.length-1)&&0===r.indexOf(i.substring(0,i.length-1)))return!0;return!1});this.isKeyAllowed=function(e){var t=o("forbidden",this.modes,this.currentMode,e),e=o("allowed",this.modes,this.currentMode,e);return!t&&e},this.setItem=function(e,t,r,i){this.isKeyAllowed(e)?n._storage.setItem(e,t,r,i):i&&i()},this.filterProps=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&!this.isPropAllowed(r,t||void 0)&&delete e[r]},this.filterKeys=function(){for(var e in this._storageKeys)Object.prototype.hasOwnProperty.call(this._storageKeys,e)&&!this.isKeyAllowed(e)&&n._storage.deleteItem(e)},this.filterEvents=function(e){for(var t=e.length-1;0<=t;t--)this.isEventAllowed(e[t].name)||e.splice(t,1)},this.getModeMetadata=function(){return this.modes[this.getMode()].properties.include},this.init()}function Privacy(o){var e=this;this.isLegacyPrivacy=!0,this.modeEnum={OPTOUT:e.isLegacyPrivacy?"optout":"opt-out"},this.call=function(e){for(var t=this.isLegacyPrivacy?"privacy":"consent",r=arguments.length,i=new Array(1<r?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o[t][e].apply(o[t],i)}}function initPrivacy(e){e._privacy=new Privacy(e),e.privacy=new AtPrivacy(e)}function PianoAnalytics(e){_initConfig(this,e),this._storage=new Storage(this),this._queue=new PianoAnalyticsQueue(this),this._properties={},this._sendEvent=_sendEvent,this._setProperty=_setProperty,this._deleteProperty=_deleteProperty,this._visitorId=new VisitorId(this),initPrivacy(this),this.user=new User(this),AVInsights(this)}function _initConfig(e,t){e.cfg=new Configuration(_cloneObject(t)||Config),e.setConfiguration=e.cfg.setConfiguration,e.setConfigurations=e.cfg.setConfigurations,e.getConfiguration=e.cfg.getConfiguration}function _sendEvent(e,t){for(var r=[privacyStep,visitorStep,userStep,campaignsStep,metadataStep,propertiesStep,onBeforeBuildStep,buildStep,onBeforeSendStep,sendStep],i=0;i<e.length;i++){var n={name:"",data:{}};if("string"==typeof e[i])n.name=e[i];else{if(void 0!==e[i].data)continue;n.name=e[i].name}e[i]=n}var o,t={events:_cloneObject(e),options:_cloneObject(t)};0<r.length&&"function"==typeof r[0]&&(o=new Configuration(this.cfg.cloneData()),r[0](this,new Model(this,t,o),r.slice(1)))}function _setProperty(e,t,r,i){e._privacy.call("isPropAllowed",t)&&(e._properties[t]={value:r,options:i||{}}),e._queue.next()}function _deleteProperty(e,t){delete e._properties[t],e._queue.next()}PianoAnalytics.prototype.setProperty=function(e,t,r){this._queue.push(["_setProperty",this,e,t,r])},PianoAnalytics.prototype.setProperties=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setProperty(r,e[r],t)},PianoAnalytics.prototype.deleteProperty=function(e){this._queue.push(["_deleteProperty",this,e])},PianoAnalytics.prototype.sendEvent=function(e,t,r){this._queue.push(["_sendEvent",[{name:e,data:t}],r])},PianoAnalytics.prototype.sendEvents=function(e,t){this._queue.push(["_sendEvent",e,t])};var pianoAnalytics=new(PianoAnalytics.prototype.PA=PianoAnalytics)(Config);export{pianoAnalytics}; | ||
import*as https from"https";var Config={site:"",collectDomain:"",path:"event",visitorStorageMode:"fixed",storageLifetimeVisitor:395,storageLifetimeUser:395,storageLifetimePrivacy:395,privacyDefaultMode:"optin",sendEventWhenOptout:!0,isVisitorClientSide:!0,enableCallbacks:!0,cookieDomain:"",cookieSecure:!0,cookiePath:"/",cookieSameSite:"lax",encodeStorageBase64:!1,addEventURL:"withoutQS",clickAutoManagement:!0,enableUTMTracking:!0,campaignPrefix:["at_"],storageVisitor:"pa_vid",storageUser:"pa_user",version:"6.15.1",minHeartbeat:5,minBufferingHeartbeat:1,queueVarName:"_paq",globalVarName:"pa",enableAutomaticPageRefresh:!0,allowHighEntropyClientHints:!0,sendEmptyProperties:!0,enableExtendedOptout:!1,privacy:{storageKey:"pa_privacy",legacyKeys:{pa_vid:!0,pa_privacy:!0,atuserid:!0},storageKeys:{pa_user:!0},modes:{optin:{name:"optin",properties:{include:{visitor_privacy_consent:!0,visitor_privacy_mode:"optin"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{"*":!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},optout:{name:"optout",visitorId:"OPT-OUT",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"optout"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},"no-consent":{name:"no-consent",visitorId:"no-consent",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-consent"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},"no-storage":{name:"no-storage",visitorId:"no-storage",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-storage"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},exempt:{name:"exempt",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"exempt"},allowed:{"*":{app_crash:!0,app_crash_class:!0,app_crash_screen:!0,app_version:!0,browser:!0,browser_cookie_acceptance:!0,browser_group:!0,browser_version:!0,click:!0,click_chapter1:!0,click_chapter2:!0,click_chapter3:!0,click_full_name:!0,connection_monitor:!0,connection_organisation:!0,cookie_creation_date:!0,date:!0,date_day:!0,date_daynumber:!0,date_month:!0,date_monthnumber:!0,date_week:!0,date_year:!0,date_yearofweek:!0,device_brand:!0,device_display_height:!0,device_display_width:!0,device_name:!0,device_name_tech:!0,device_screen_diagonal:!0,device_screen_height:!0,device_screen_width:!0,device_type:!0,event_collection_platform:!0,event_collection_version:!0,event_hour:!0,event_id:!0,event_minute:!0,event_position:!0,event_second:!0,event_time:!0,event_time_utc:!0,event_url:!0,event_url_domain:!0,event_url_full:!0,exclusion_cause:!0,exclusion_type:!0,geo_city:!0,geo_continent:!0,geo_country:!0,geo_metro:!0,geo_region:!0,goal_type:!0,hit_time_utc:!0,os:!0,os_group:!0,os_version:!0,os_version_name:!0,page:!0,page_chapter1:!0,page_chapter2:!0,page_chapter3:!0,page_duration:!0,page_full_name:!0,page_position:!0,page_title_html:!0,page_url:!0,pageview_id:!0,previous_url:!0,privacy_status:!0,site:!0,site_env:!0,site_id:!0,site_platform:!0,src:!0,src_detail:!0,src_direct_access:!0,src_organic:!0,src_organic_detail:!0,src_portal_domain:!0,src_portal_site:!0,src_portal_site_id:!0,src_portal_url:!0,src_referrer_site_domain:!0,src_referrer_site_url:!0,src_referrer_url:!0,src_se:!0,src_se_category:!0,src_se_country:!0,src_type:!0,src_url:!0,src_url_domain:!0,src_webmail:!0}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0,atuserid:!0},forbidden:{}},events:{allowed:{"click.exit":!0,"click.navigation":!0,"click.download":!0,"click.action":!0,"page.display":!0},forbidden:{}}},"*":{properties:{allowed:{"*":{connection_type:!0,device_timestamp_utc:!0,visitor_privacy_consent:!0,visitor_privacy_mode:!0,"ch_ua*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{}},events:{allowed:{},forbidden:{}}}}}};function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function _createForOfIteratorHelper(e,t){var r,i,n,o,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return n=!(i=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return i=e.done,e},e:function(e){n=!0,r=e},f:function(){try{i||null==a.return||a.return()}finally{if(n)throw r}}};if(Array.isArray(e)||(a=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),o=0,{s:t=function(){},n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}var _cloneObject=function(e,t){if("object"!==_typeof(e)||null===e||e instanceof Date)return e;var r,i=new e.constructor;for(r in e)!Object.prototype.hasOwnProperty.call(e,r)||void 0===r||t&&void 0===e[r]||(i[r]=_cloneObject(e[r]));return i},http={post:function(t,r,i){var e=r,n=new URL(t),n={hostname:n.hostname,port:443,path:n.pathname+n.search,method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"}},n=https.request(n,function(e){i&&i(t,r,e)});n.write(e),n.end()}},_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encoding={encodeURIComponent:encodeURIComponent,utf8:{encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t+=String.fromCharCode(i):t=127<i&&i<2048?(t+=String.fromCharCode(i>>6|192))+String.fromCharCode(63&i|128):(t=(t+=String.fromCharCode(i>>12|224))+String.fromCharCode(i>>6&63|128))+String.fromCharCode(63&i|128)}return t},decode:function(e){var t,r,i,n="",o=0;for(t=0;o<e.length;)(i=e.charCodeAt(o))<128?(n+=String.fromCharCode(i),o++):191<i&&i<224?(t=e.charCodeAt(o+1),n+=String.fromCharCode((31&i)<<6|63&t),o+=2):(t=e.charCodeAt(o+1),r=e.charCodeAt(o+2),n+=String.fromCharCode((15&i)<<12|(63&t)<<6|63&r),o+=3);return n}},base64:{encode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=encoding.utf8.encode(e);u<e.length;)i=(t=e.charCodeAt(u++))>>2,n=(3&t)<<4|(t=e.charCodeAt(u++))>>4,o=(15&t)<<2|(r=e.charCodeAt(u++))>>6,a=63&r,isNaN(t)?o=a=64:isNaN(r)&&(a=64),s=s+_keyStr.charAt(i)+_keyStr.charAt(n)+_keyStr.charAt(o)+_keyStr.charAt(a);return s},decode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)i=_keyStr.indexOf(e.charAt(u++)),t=(15&(n=_keyStr.indexOf(e.charAt(u++))))<<4|(o=_keyStr.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(a=_keyStr.indexOf(e.charAt(u++))),s+=String.fromCharCode(i<<2|n>>4),64!=o&&(s+=String.fromCharCode(t)),64!=a&&(s+=String.fromCharCode(r));return s=encoding.utf8.decode(s)}}},uuid={v4:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}};function Configuration(e){var r=e;function i(e,t){null!==t&&""!==t&&void 0!==t&&(r[e]=t)}return{setConfiguration:i,setConfigurations:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i(t,e[t])},getConfiguration:function(e){return void 0!==r[e]?_cloneObject(r[e]):null},cloneData:function(){return _cloneObject(r)},deleteProperty:function(e){delete r[e]}}}function PianoAnalyticsQueue(t){var r=[];return{push:function(e){r.push(e),1===r.length&&t[e[0]].apply(t,e.slice(1))},next:function(){var e;r.shift(),0<r.length&&t[(e=r[0])[0]].apply(t,e.slice(1))}}}function Model(o,e,t){this.properties=_cloneObject(o._properties),this.addEventsProperty=function(e,t){if(o._privacy.call("isPropAllowed",e)){var r,i=_createForOfIteratorHelper(this.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;this.isPropertyAbsentForEvent(e,n)&&(n.data[e]=t)}}catch(e){i.e(e)}finally{i.f()}}},this.hasProperty=function(e){return Object.prototype.hasOwnProperty.call(this.properties,e)},this.getConfiguration=t.getConfiguration,this.setConfiguration=t.setConfiguration,this.options=e.options||{},this.visitorId=null,this.build={url:"",data:{}},this.events=e.events||[],this.isPropertyAbsentForEvent=function(e,t){if(void 0!==t.data[e])return!1;if(this.hasProperty(e)){if(void 0===this.properties[e].options.events)return!1;var r,i=_createForOfIteratorHelper(this.properties[e].options.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;if(t.name===n||"*"===n.charAt(n.length-1)&&0===t.name.indexOf(n.substring(0,n.length-1)))return!1}}catch(e){i.e(e)}finally{i.f()}}return!0}}function nextStep(e,t,r,i){!1!==i&&0<r.length&&"function"==typeof r[0]?r[0](e,t,r.slice(1)):e._queue.next()}function buildStep(e,t,r){var i=t.getConfiguration("collectDomain"),n=i.startsWith("https://")||i.startsWith("http://")?"":"https://",n="".concat(n).concat(i,"/").concat(t.getConfiguration("path")),i="?s=".concat(t.getConfiguration("site")).concat(t.visitorId?"&idclient="+t.visitorId:"");t.build.url=n+i,t.build.data={events:t.events},nextStep(e,t,r)}function campaignsStep(e,t,r){nextStep(e,t,r)}function metadataStep(e,t,r){t.addEventsProperty("event_collection_platform","js-browserless"),t.addEventsProperty("event_collection_version",t.getConfiguration("version"));var i=new Date;t.addEventsProperty("device_timestamp_utc",i.getTime()),t.addEventsProperty("device_local_hour",i.getTime()),t.addEventsProperty("device_hour",i.getHours()),nextStep(e,t,r)}function onBeforeBuildStep(t,r,i){function e(e){nextStep(t,r,i,e)}r.options&&r.options.onBeforeBuild?r.options.onBeforeBuild(t,r,e):e()}function onBeforeSendStep(t,r,i){function e(e){nextStep(t,r,i,e)}r.options&&r.options.onBeforeSend?r.options.onBeforeSend(t,r,e):e()}function privacyStep(e,t,r){e._privacy.call("filterEvents",t.events),e._privacy.call("filterProps",t.properties);for(var i=t.events,n=0;n<i.length;n++){e._privacy.call("filterProps",i[n].data,i[n].name);var o,a=e._privacy.call("getModeMetadata")||{};for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&t.addEventsProperty(o,a[o])}nextStep(e,t,r)}function propertiesStep(e,t,r){var i,n=[];for(i in t.properties)if(Object.prototype.hasOwnProperty.call(t.properties,i)){var o,a=!1,s=_createForOfIteratorHelper(t.events);try{for(s.s();!(o=s.n()).done;){var u=o.value,c=!1,l=t.properties[i].options.events;if(l)if(-1<l.indexOf(u.name))c=!0;else{var p,f=_createForOfIteratorHelper(l);try{for(f.s();!(p=f.n()).done;){var d=p.value;if("*"===d.charAt(d.length-1)&&0===u.name.indexOf(d.substring(0,d.length-1))){c=!0;break}}}catch(e){f.e(e)}finally{f.f()}}else c=!0;c&&void 0===u.data[i]&&(u.data[i]=t.properties[i].value,a=!0)}}catch(e){s.e(e)}finally{s.f()}a&&!t.properties[i].options.persistent&&n.push(i)}for(var v=0,g=n;v<g.length;v++)delete e._properties[g[v]];if(!t.getConfiguration("sendEmptyProperties")){var y,_=_createForOfIteratorHelper(t.events);try{for(_.s();!(y=_.n()).done;){var h,b=y.value;for(h in b.data)!Object.prototype.hasOwnProperty.call(b.data,h)||""!==b.data[h]&&void 0!==b.data[h]||delete b.data[h]}}catch(e){_.e(e)}finally{_.f()}}nextStep(e,t,r)}function sendStep(e,t,r){(e._privacy.call("getMode")!==e._privacy.modeEnum.OPTOUT||e._privacy.call("getMode")===e._privacy.modeEnum.OPTOUT&&t.getConfiguration("sendEventWhenOptout"))&&0<t.build.data.events.length&&http.post(t.build.url,JSON.stringify(t.build.data)),nextStep(e,t,r)}function userStep(r,i,n){void 0!==i.properties.user_id?nextStep(r,i,n):r.getUser(function(e){var t;null!==e&&(i.addEventsProperty("user_id",e.id,t={persistent:!0}),i.addEventsProperty("user_category",e.category,t),i.addEventsProperty("user_recognition",!0,t)),nextStep(r,i,n)})}function visitorStep(r,i,n){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){var t;!i.getConfiguration("isVisitorClientSide")||(i.visitorId=r._visitorId.value||e||uuid.v4(),t="OPT-OUT"!==i.visitorId&&"no-consent"!==i.visitorId&&"no-storage"!==i.visitorId&&i.visitorId!==r._visitorId.value,i.visitorId===e&&"relative"!==i.getConfiguration("visitorStorageMode"))||!t?nextStep(r,i,n):((e=new Date).setTime(e.getTime()+24*i.getConfiguration("storageLifetimeVisitor")*60*60*1e3),r._privacy.call("setItem",i.getConfiguration("storageVisitor"),i.visitorId,e,function(){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){null===e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i.visitorId)&&(i.visitorId=i.visitorId+"-NO"),nextStep(r,i,n)})}))})}var localVariable={};function LocalVariable(n){this.setItem=function(e,t,r,i){t=JSON.stringify({data:t,expires:r?r.getTime():0});localVariable[e]=n.getConfiguration("encodeStorageBase64")?encoding.base64.encode(t):t,i&&i()},this.getItem=function(t,e){var r,i=null;if(void 0!==localVariable[t]){try{r=JSON.parse(localVariable[t])}catch(e){r=JSON.parse(encoding.base64.decode(localVariable[t]))}0===r.expires||(new Date).getTime()<r.expires?(i=r.data,e&&e(i)):(new Date).getTime()>r.expires&&this.deleteItem(t,function(){e&&e(i)})}else e&&e(i)},this.deleteItem=function(e,t){delete localVariable[e],t&&t()}}var Storage=LocalVariable;function User(n){var o=n.getConfiguration("storageUser");n.setUser=function(e,t,r){var i={id:e,category:t};n.setProperties({user_id:e,user_category:t,user_recognition:!1},{persistent:!0}),!1!==r&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimeUser")*60*60*1e3),n._privacy.call("setItem",o,i,e))},n.getUser=function(r){n._storage.getItem(o,function(e){var t=e;!e&&n._properties.user_id&&(t={id:n._properties.user_id.value,category:n._properties.user_category.value}),r&&r(t)})},n.deleteUser=function(e){n.deleteProperty("user_id"),n.deleteProperty("user_category"),n.deleteProperty("user_recognition"),n._storage.deleteItem(o,function(){e&&e()})}}var AVInsights=function(C){function k(){this.debugError={trigger:"AvInsights:Media:setContentValues:Error",level:"ERROR",messageObject:"Not an object"},this.processHeartbeatValue=function(e,t){e=parseInt(e,10);return e?Math.max(e,t):0},this.value2Number=function(e){var t=0;return isNaN(Number(e))||(t=Number(e)),Math.max(t,0)}}var w={minHeartbeat:C.getConfiguration("minHeartbeat"),minBufferingHeartbeat:C.getConfiguration("minBufferingHeartbeat")},S="_ATVALUE",O="_ATPREFIX";function x(e,t){var r,e=e.length<2||":"!==e[1]?(r="",e):e.length<4||":"!==e[3]?(r=e.substring(0,1),e.substring(2,e.length)):(r=e.substring(0,3),e.substring(4,e.length));return t&&(r=r.toLowerCase(),e=e.toLowerCase()),{prefix:r,key:e}}function A(e){return null!==e&&"object"===_typeof(e)&&!(e instanceof Array)}function T(e,t,r,i,n){var o,a,s,u="",c="",l="",p=0;for(s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(u=(o=x(s,n)).prefix||i||"",c=(t?t+"_":"")+o.key,A(e[s]))T(e[s],c,r,u,n);else{for(a=c.split("_"),l="",p=0;p<a.length;p++)u=(o=x(a[p],n)).prefix||u,l+=o.key+(p<a.length-1?"_":"");r[c=l||c]=r[c]||{},r[c][S]=e[s],r[c][O]=u}}C.avInsights={},C.avInsights.Media=function(e,t,r){function i(){d.previousCursorPosition=0,d.currentCursorPosition=0,d.eventDuration=0,d.previousEvent="",d.sessionId=uuid.v4()}function n(e){e?d.delayBufferingConfiguration=_cloneObject(d.delayBufferingConfigurationBackup):d.delayConfiguration=_cloneObject(d.delayConfigurationBackup)}function o(e,t){if(t){_(e);var r,i={};for(r in A(t)?i=t:isNaN(t)?i=JSON.parse(t):i[0]=t,i)Object.prototype.hasOwnProperty.call(i,r)&&(e?d.delayBufferingConfiguration.push({delay:f.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:f.processHeartbeatValue(i[r],w.minBufferingHeartbeat)}):d.delayConfiguration.push({delay:f.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:f.processHeartbeatValue(i[r],w.minHeartbeat)}));h(e),y(e)}}function a(e,t,r,i){var n=_cloneObject(g),t=(n.av_session_id={},n.av_session_id[S]=d.sessionId,n.av_session_id[O]="",t&&(m(n),d.previousEvent=e),A(i)&&T(i,null,n,null,!0),P(n));C.sendEvent(e,t,r)}function s(){var e=this,t=0,r=0;e.getEventDuration=function(){var e=(new Date).getTime()-t-r;return r+=e,e},e.initBaseTime=function(){0===t&&(t=(new Date).getTime())},e.resetProperties=function(){r=t=0},e.initHeartbeatTimer=function(e,t){var r=t?d.delayBufferingConfiguration:d.delayConfiguration;0<r.length&&(b(t),clearTimeout(r[0].timeout),r[0].timeout=setTimeout(function(){0===r[0].number&&r.splice(0,1),e&&e()},1e3*r[0].refresh))},e.stopHeartbeatTimer=function(e){for(var t=e?d.delayBufferingConfiguration:d.delayConfiguration,r=0;r<t.length;r++)clearTimeout(t[r].timeout),t[r].timeout=-1}}function u(e,t,r,i,n){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e?d.previousCursorPosition+Math.floor(d.playbackSpeed*d.eventDuration):r,t&&v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.heartbeat",!0,i,n)}function c(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),e&&v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.heartbeat",!0,t,r)}function l(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,e&&v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.heartbeat",!0,t,r)}var p=this,f=new k,d=null,v=null,g=null,y=function(e){e?d.delayBufferingConfigurationBackup=_cloneObject(d.delayBufferingConfiguration):d.delayConfigurationBackup=_cloneObject(d.delayConfiguration)},_=function(e){e?(d.delayBufferingConfiguration=[],d.delayBufferingConfigurationBackup=[]):(d.delayConfiguration=[],d.delayConfigurationBackup=[])},h=function(e){(e?d.delayBufferingConfiguration:d.delayConfiguration).sort(function(e,t){return e.delay<t.delay?-1:t.delay<e.delay?1:0})},b=function(e){var t,e=e?d.delayBufferingConfiguration:d.delayConfiguration;void 0===(t=void 0!==e[1]?e[1].delay:t)?e[0].number=1:0<e[0].number?e[0].number--:"number"==typeof t&&(e[0].number=Math.floor(60*(t-e[0].delay)/e[0].refresh)-1)},m=function(e){e.av_previous_position={},e.av_previous_position[S]=d.previousCursorPosition,e.av_previous_position[O]="",e.av_position={},e.av_position[S]=d.currentCursorPosition,e.av_position[O]="",e.av_duration={},e.av_duration[S]=d.eventDuration,e.av_duration[O]="",e.av_previous_event={},e.av_previous_event[S]=d.previousEvent,e.av_previous_event[O]=""},P=function(e){var t,r={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Object.prototype.hasOwnProperty.call(e[t],S)?r[e[t][O]?"".concat(e[t][O],":").concat(t):t]=e[t][S]:r[t]=e[t]);return r};p.set=function(e,t){e=x(e,!0);g[e.key]=g[e.key]||{},g[e.key][S]=t,g[e.key][O]=e.prefix},p.get=function(e){var t=null,e=x(e,!0);return t=void 0!==g[e.key]?g[e.key][S]:t},p.del=function(e){e=x(e,!0);void 0!==g[e.key]&&delete g[e.key]},p.setProps=function(e){A(e)&&T(e,null,g,null,!0)},p.getProps=function(){var e,t=null;for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&((t=t||{})[e]=g[e][S]);return t},p.delProps=function(){g={}};p.setPlaybackSpeed=function(e){e=f.value2Number(e)||d.playbackSpeed;e!==d.playbackSpeed&&(v.stopHeartbeatTimer(!1),d.isPlaying&&(u(!0,!1),v.initHeartbeatTimer(function(){u(!0,!0)},!1)),d.playbackSpeed=e)},p.getSessionID=function(){return d.sessionId},p.track=function(e,t,r,i){var n=t||{};switch(e){case"av.heartbeat":p.heartbeat(n.av_position,r,i);break;case"av.buffer.heartbeat":p.bufferHeartbeat(r,i);break;case"av.rebuffer.heartbeat":p.rebufferHeartbeat(r,i);break;case"av.play":p.play(n.av_position,r,i);break;case"av.buffer.start":p.bufferStart(n.av_position,r,i);break;case"av.start":p.playbackStart(n.av_position,r,i);break;case"av.resume":p.playbackResumed(n.av_position,r,i);break;case"av.pause":p.playbackPaused(n.av_position,r,i);break;case"av.stop":p.playbackStopped(n.av_position,r,i);break;case"av.backward":p.seekBackward(n.av_previous_position,n.av_position,r,i);break;case"av.forward":p.seekForward(n.av_previous_position,n.av_position,r,i);break;case"av.seek.start":p.seekStart(n.av_previous_position,r,i);break;case"av.error":p.error(n.av_player_error,r,i);break;default:a(e,!1,r,i)}},p.heartbeat=function(e,t,r){var i,n=!0;null!=e&&0<=e&&(n=!1,i=f.value2Number(e)),u(n,!1,i,t,r)},p.bufferHeartbeat=function(e,t){c(!1,e,t)},p.rebufferHeartbeat=function(e,t){l(!1,e,t)},p.play=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=0,d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.play",!0,t,r)},p.bufferStart=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),d.isPlaybackActivated?(v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.start",!0,t,r)):(v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.start",!0,t,r))},p.playbackStart=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.start",!0,t,r)},p.playbackResumed=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.resume",!0,t,r)},p.playbackPaused=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.pause",!0,t,r)},p.playbackStopped=function(e,t,r){v.initBaseTime();e=f.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),a("av.stop",!0,t,r),i()},p.playbackKill=function(){v.initBaseTime(),d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),i()},p.seek=function(e,t,r,i){e=f.value2Number(e),t=f.value2Number(t);t<e?p.seekBackward(e,t,r,i):p.seekForward(e,t,r,i)},p.seekBackward=function(e,t,r,i){p.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=f.value2Number(e),d.currentCursorPosition=f.value2Number(t),a("av.backward",!0,r,i)},p.seekForward=function(e,t,r,i){p.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=f.value2Number(e),d.currentCursorPosition=f.value2Number(t),a("av.forward",!0,r,i)},p.seekStart=function(e,t,r){e=f.value2Number(e);d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying?d.eventDuration=v.getEventDuration():d.eventDuration=0,a("av.seek.start",!0,t,r)},p.adClick=function(e,t){a("av.ad.click",!1,e,t)},p.adSkip=function(e,t){a("av.ad.skip",!1,e,t)},p.error=function(e,t,r){var i={};(i=A(r)?r:i).av_player_error=String(e),a("av.error",!1,t,i)},p.display=function(e,t){a("av.display",!1,e,t)},p.close=function(e,t){a("av.close",!1,e,t)},p.volume=function(e,t){a("av.volume",!1,e,t)},p.subtitleOn=function(e,t){a("av.subtitle.on",!1,e,t)},p.subtitleOff=function(e,t){a("av.subtitle.off",!1,e,t)},p.fullscreenOn=function(e,t){a("av.fullscreen.on",!1,e,t)},p.fullscreenOff=function(e,t){a("av.fullscreen.off",!1,e,t)},p.quality=function(e,t){a("av.quality",!1,e,t)},p.speed=function(e,t){a("av.speed",!1,e,t)},o(!(d={previousCursorPosition:0,currentCursorPosition:0,eventDuration:0,playbackSpeed:1,previousEvent:"",isPlaybackActivated:!(p.share=function(e,t){a("av.share",!1,e,t)}),isPlaying:!1,sessionId:"",delayConfiguration:[],delayConfigurationBackup:[],delayBufferingConfiguration:[],delayBufferingConfigurationBackup:[]}),e),o(!0,t),d.sessionId=r||uuid.v4(),v=new s,g={}}};function VisitorId(n){this.value=null,n.getVisitorId=function(t){var r=this.value,i=null;if(n._storage.getItem(n.getConfiguration("storageVisitor"),function(e){i=_processCallbackIfPresent(r||e,t)}.bind(n)),void 0===t)return i}.bind(this),n.setVisitorId=function(e){this.value=e;var t=new Date;t.setTime(t.getTime()+24*n.getConfiguration("storageLifetimeVisitor")*60*60*1e3),n._privacy.call("setItem",n.getConfiguration("storageVisitor"),e,t,function(){})}.bind(this)}function _processCallbackIfPresent(e,t){return t&&t(e),e}function AtPrivacy(n){function r(e,t,r,i){return r=u(t[r].events[e],i),t=u(t["*"].events[e],i),r||t}function i(e,t,r,i,n){var o,n=n?(o=c(t[r].properties,e,i,n),c(t["*"].properties,e,i,n)):(o=l(t[r].properties,e,i),l(t["*"].properties,e,i));return o||n}function o(e,t,r,i){return r=p(t[r].storage,e,i),t=p(t["*"].storage,e,i),r||t}var a=n.getConfiguration("privacy"),s=(this.currentMode="",this.modes=a.modes,this._storageKeys=Object.assign(a.legacyKeys,a.storageKeys),this.init=function(){n._privacy.isLegacyPrivacy&&n._storage.getItem(a.storageKey,function(e){this.setMode(e&&this.modes[e]?e:n.getConfiguration("privacyDefaultMode"))}.bind(this))},this.setMode=function(t){t!==this.currentMode&&this.modes[t]&&(this.currentMode=t,n._storage.getItem(a.storageKey,function(e){"optout"===t||"no-consent"===t||"no-storage"===t?n._visitorId.value=this.modes[t].visitorId:"OPT-OUT"!==n._visitorId.value&&"no-consent"!==n._visitorId.value&&"no-storage"!==n._visitorId.value||(n._visitorId.value=null),this.filterProps(n._properties),this.filterKeys(),e!==t&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimePrivacy")*60*60*1e3),this.setItem(a.storageKey,t,e))}.bind(this)))},this.createMode=function(e,t){var r;this.modes[e]||((r=_cloneObject(this.modes.exempt)).name=e,r.properties.include.visitor_privacy_mode=e,r.properties.include.visitor_privacy_consent=t,this.modes[e]=r)},this.getMode=function(){return this.currentMode},function(e,t,r,i,n,o){var a=["*"],s=["*"],u="properties",c=i?"forbidden":"allowed";t&&(a="string"==typeof t?[t]:t),r&&(s="string"==typeof r?[r]:r),n&&(u="storage"),o&&(u="events");for(var l=0;l<a.length;l++)if(void 0!==this.modes[a[l]])for(var p=this.modes[a[l]],f=0;f<s.length;f++){var d=p[u][c];void 0!==d[s[f]]||n||o||(d[s[f]]={});for(var v=0;v<e.length;v++)n||o?d[e[v]]=!0:d[s[f]][e[v]]=!0}}.bind(this)),u=(this.include={properties:function(e,t,r){s(e,t,r)},property:function(e,t,r){s([e],t,r)},storageKeys:function(e,t){s(e,t,null,!1,!0)},storageKey:function(e,t){s([e],t,null,!1,!0)},events:function(e,t){s(e,t,null,!1,!1,!0)},event:function(e,t){s([e],t,null,!1,!1,!0)}},this.exclude={properties:function(e,t,r){s(e,t,r,!0)},property:function(e,t,r){s([e],t,r,!0)},storageKeys:function(e,t){s(e,t,null,!0,!0)},storageKey:function(e,t){s([e],t,null,!0,!0)},events:function(e,t){s(e,t,null,!0,!1,!0)},event:function(e,t){s([e],t,null,!0,!1,!0)}},function(e,t){if(e[t])return!0;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&"*"===r.charAt(r.length-1)&&0===t.indexOf(r.substring(0,r.length-1)))return!0;return!1}),c=(this.isEventAllowed=function(e){var t=r("forbidden",this.modes,this.currentMode,e),e=r("allowed",this.modes,this.currentMode,e);return!t&&e},function(e,t,r,i){var n,o=e[t];if(o[i]&&o[i][r]||o["*"][r])return!0;for(n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&"*"===n.charAt(n.length-1)&&0===i.indexOf(n.substring(0,n.length-1))||n===i)for(var a in o[n])if(Object.prototype.hasOwnProperty.call(o[n],a)&&("*"===a.charAt(a.length-1)&&0===r.indexOf(a.substring(0,a.length-1))||r===a))return!0;return!1}),l=function(e,t,r){if("forbidden"===t&&e[t]["*"][r])return!0;for(var i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)){if(e[t][i][r])return!0;for(var n in e[t][i])if("*"===n.charAt(n.length-1)&&0===r.indexOf(n.substring(0,n.length-1)))return!0}return!1},p=(this.isPropAllowed=function(e,t){var r=i("forbidden",this.modes,this.currentMode,e,t),e=i("allowed",this.modes,this.currentMode,e,t);return!r&&e},function(e,t,r){var i,n=e[t];if(n[r])return!0;for(i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"*"===i.charAt(i.length-1)&&0===r.indexOf(i.substring(0,i.length-1)))return!0;return!1});this.isKeyAllowed=function(e){var t=o("forbidden",this.modes,this.currentMode,e),e=o("allowed",this.modes,this.currentMode,e);return!t&&e},this.setItem=function(e,t,r,i){this.isKeyAllowed(e)?n._storage.setItem(e,t,r,i):i&&i()},this.filterProps=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&!this.isPropAllowed(r,t||void 0)&&delete e[r]},this.filterKeys=function(){for(var e in this._storageKeys)Object.prototype.hasOwnProperty.call(this._storageKeys,e)&&!this.isKeyAllowed(e)&&n._storage.deleteItem(e)},this.filterEvents=function(e){for(var t=e.length-1;0<=t;t--)this.isEventAllowed(e[t].name)||e.splice(t,1)},this.getModeMetadata=function(){return this.modes[this.getMode()].properties.include},this.init()}function Privacy(o){var e=this;this.isLegacyPrivacy=!0,this.modeEnum={OPTOUT:e.isLegacyPrivacy?"optout":"opt-out"},this.call=function(e){for(var t=this.isLegacyPrivacy?"privacy":"consent",r=arguments.length,i=new Array(1<r?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o[t][e].apply(o[t],i)}}function initPrivacy(e){e._privacy=new Privacy(e),e.privacy=new AtPrivacy(e)}function PianoAnalytics(e){_initConfig(this,e),this._storage=new Storage(this),this._queue=new PianoAnalyticsQueue(this),this._properties={},this._sendEvent=_sendEvent,this._setProperty=_setProperty,this._deleteProperty=_deleteProperty,this._visitorId=new VisitorId(this),initPrivacy(this),this.user=new User(this),AVInsights(this)}function _initConfig(e,t){e.cfg=new Configuration(_cloneObject(t)||Config),e.setConfiguration=e.cfg.setConfiguration,e.setConfigurations=e.cfg.setConfigurations,e.getConfiguration=e.cfg.getConfiguration}function _sendEvent(e,t){for(var r=[privacyStep,visitorStep,userStep,campaignsStep,metadataStep,propertiesStep,onBeforeBuildStep,buildStep,onBeforeSendStep,sendStep],i=0;i<e.length;i++){var n={name:"",data:{}};if("string"==typeof e[i])n.name=e[i];else{if(void 0!==e[i].data)continue;n.name=e[i].name}e[i]=n}var o,t={events:_cloneObject(e),options:_cloneObject(t)};0<r.length&&"function"==typeof r[0]&&(o=new Configuration(this.cfg.cloneData()),r[0](this,new Model(this,t,o),r.slice(1)))}function _setProperty(e,t,r,i){e._privacy.call("isPropAllowed",t)&&(e._properties[t]={value:r,options:i||{}}),e._queue.next()}function _deleteProperty(e,t){delete e._properties[t],e._queue.next()}PianoAnalytics.prototype.setProperty=function(e,t,r){this._queue.push(["_setProperty",this,e,t,r])},PianoAnalytics.prototype.setProperties=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setProperty(r,e[r],t)},PianoAnalytics.prototype.deleteProperty=function(e){this._queue.push(["_deleteProperty",this,e])},PianoAnalytics.prototype.sendEvent=function(e,t,r){this._queue.push(["_sendEvent",[{name:e,data:t}],r])},PianoAnalytics.prototype.sendEvents=function(e,t){this._queue.push(["_sendEvent",e,t])};var pianoAnalytics=new(PianoAnalytics.prototype.PA=PianoAnalytics)(Config);export{pianoAnalytics}; |
@@ -1,1 +0,1 @@ | ||
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react-native")):"function"==typeof define&&define.amd?define(["exports","react-native"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pianoAnalytics={},e.reactNative)})(this,function(e,i){var n={site:"",collectDomain:"",path:"event",visitorStorageMode:"fixed",storageLifetimeVisitor:395,storageLifetimeUser:395,storageLifetimePrivacy:395,privacyDefaultMode:"optin",sendEventWhenOptout:!0,isVisitorClientSide:!0,enableCallbacks:!0,cookieDomain:"",cookieSecure:!0,cookiePath:"/",cookieSameSite:"lax",encodeStorageBase64:!1,addEventURL:"withoutQS",clickAutoManagement:!0,enableUTMTracking:!0,campaignPrefix:["at_"],storageVisitor:"pa_vid",storageUser:"pa_user",version:"6.15.0",minHeartbeat:5,minBufferingHeartbeat:1,queueVarName:"_paq",globalVarName:"pa",enableAutomaticPageRefresh:!0,allowHighEntropyClientHints:!0,sendEmptyProperties:!0,enableExtendedOptout:!1,privacy:{storageKey:"pa_privacy",legacyKeys:{pa_vid:!0,pa_privacy:!0,atuserid:!0},storageKeys:{pa_user:!0},modes:{optin:{name:"optin",properties:{include:{visitor_privacy_consent:!0,visitor_privacy_mode:"optin"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{"*":!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},optout:{name:"optout",visitorId:"OPT-OUT",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"optout"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},"no-consent":{name:"no-consent",visitorId:"no-consent",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-consent"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},"no-storage":{name:"no-storage",visitorId:"no-storage",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-storage"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},exempt:{name:"exempt",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"exempt"},allowed:{"*":{app_crash:!0,app_crash_class:!0,app_crash_screen:!0,app_version:!0,browser:!0,browser_cookie_acceptance:!0,browser_group:!0,browser_version:!0,click:!0,click_chapter1:!0,click_chapter2:!0,click_chapter3:!0,click_full_name:!0,connection_monitor:!0,connection_organisation:!0,cookie_creation_date:!0,date:!0,date_day:!0,date_daynumber:!0,date_month:!0,date_monthnumber:!0,date_week:!0,date_year:!0,date_yearofweek:!0,device_brand:!0,device_display_height:!0,device_display_width:!0,device_name:!0,device_name_tech:!0,device_screen_diagonal:!0,device_screen_height:!0,device_screen_width:!0,device_type:!0,event_collection_platform:!0,event_collection_version:!0,event_hour:!0,event_id:!0,event_minute:!0,event_position:!0,event_second:!0,event_time:!0,event_time_utc:!0,event_url:!0,event_url_domain:!0,event_url_full:!0,exclusion_cause:!0,exclusion_type:!0,geo_city:!0,geo_continent:!0,geo_country:!0,geo_metro:!0,geo_region:!0,goal_type:!0,hit_time_utc:!0,os:!0,os_group:!0,os_version:!0,os_version_name:!0,page:!0,page_chapter1:!0,page_chapter2:!0,page_chapter3:!0,page_duration:!0,page_full_name:!0,page_position:!0,page_title_html:!0,page_url:!0,pageview_id:!0,previous_url:!0,privacy_status:!0,site:!0,site_env:!0,site_id:!0,site_platform:!0,src:!0,src_detail:!0,src_direct_access:!0,src_organic:!0,src_organic_detail:!0,src_portal_domain:!0,src_portal_site:!0,src_portal_site_id:!0,src_portal_url:!0,src_referrer_site_domain:!0,src_referrer_site_url:!0,src_referrer_url:!0,src_se:!0,src_se_category:!0,src_se_country:!0,src_type:!0,src_url:!0,src_url_domain:!0,src_webmail:!0}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0,atuserid:!0},forbidden:{}},events:{allowed:{"click.exit":!0,"click.navigation":!0,"click.download":!0,"click.action":!0,"page.display":!0},forbidden:{}}},"*":{properties:{allowed:{"*":{connection_type:!0,device_timestamp_utc:!0,visitor_privacy_consent:!0,visitor_privacy_mode:!0,"ch_ua*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{}},events:{allowed:{},forbidden:{}}}}}};function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function b(e,t){var r,i,n,o,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return n=!(i=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return i=e.done,e},e:function(e){n=!0,r=e},f:function(){try{i||null==a.return||a.return()}finally{if(n)throw r}}};if(Array.isArray(e)||(a=((e,t)=>{var r;if(e)return"string"==typeof e?s(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0})(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),o=0,{s:t=function(){},n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var I=function(e,t){if("object"!==o(e)||null===e||e instanceof Date)return e;var r,i=new e.constructor;for(r in e)!Object.prototype.hasOwnProperty.call(e,r)||void 0===r||t&&void 0===e[r]||(i[r]=I(e[r]));return i},a={post:function(t,e,r){e={method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:e};return"android"===i.Platform.OS&&(e.headers["User-Agent"]="PA SDK React Native Android/".concat(n.version)),fetch(t,e).then(function(e){r&&r(t,e)}).catch(function(e){console.error(e)})}},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l={encodeURIComponent:encodeURIComponent,utf8:{encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t+=String.fromCharCode(i):t=127<i&&i<2048?(t+=String.fromCharCode(i>>6|192))+String.fromCharCode(63&i|128):(t=(t+=String.fromCharCode(i>>12|224))+String.fromCharCode(i>>6&63|128))+String.fromCharCode(63&i|128)}return t},decode:function(e){var t,r,i,n="",o=0;for(t=0;o<e.length;)(i=e.charCodeAt(o))<128?(n+=String.fromCharCode(i),o++):191<i&&i<224?(t=e.charCodeAt(o+1),n+=String.fromCharCode((31&i)<<6|63&t),o+=2):(t=e.charCodeAt(o+1),r=e.charCodeAt(o+2),n+=String.fromCharCode((15&i)<<12|(63&t)<<6|63&r),o+=3);return n}},base64:{encode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=l.utf8.encode(e);u<e.length;)i=(t=e.charCodeAt(u++))>>2,n=(3&t)<<4|(t=e.charCodeAt(u++))>>4,o=(15&t)<<2|(r=e.charCodeAt(u++))>>6,a=63&r,isNaN(t)?o=a=64:isNaN(r)&&(a=64),s=s+c.charAt(i)+c.charAt(n)+c.charAt(o)+c.charAt(a);return s},decode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)i=c.indexOf(e.charAt(u++)),t=(15&(n=c.indexOf(e.charAt(u++))))<<4|(o=c.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(a=c.indexOf(e.charAt(u++))),s+=String.fromCharCode(i<<2|n>>4),64!=o&&(s+=String.fromCharCode(t)),64!=a&&(s+=String.fromCharCode(r));return s=l.utf8.decode(s)}}},E={v4:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}};function u(e){var r=e;function i(e,t){null!==t&&""!==t&&void 0!==t&&(r[e]=t)}return{setConfiguration:i,setConfigurations:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i(t,e[t])},getConfiguration:function(e){return void 0!==r[e]?I(r[e]):null},cloneData:function(){return I(r)},deleteProperty:function(e){delete r[e]}}}function r(t){var r=[];return{push:function(e){r.push(e),1===r.length&&t[e[0]].apply(t,e.slice(1))},next:function(){var e;r.shift(),0<r.length&&t[(e=r[0])[0]].apply(t,e.slice(1))}}}function f(o,e,t){this.properties=I(o._properties),this.addEventsProperty=function(e,t){if(o._privacy.call("isPropAllowed",e)){var r,i=b(this.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;this.isPropertyAbsentForEvent(e,n)&&(n.data[e]=t)}}catch(e){i.e(e)}finally{i.f()}}},this.hasProperty=function(e){return Object.prototype.hasOwnProperty.call(this.properties,e)},this.getConfiguration=t.getConfiguration,this.setConfiguration=t.setConfiguration,this.options=e.options||{},this.visitorId=null,this.build={url:"",data:{}},this.events=e.events||[],this.isPropertyAbsentForEvent=function(e,t){if(void 0!==t.data[e])return!1;if(this.hasProperty(e)){if(void 0===this.properties[e].options.events)return!1;var r,i=b(this.properties[e].options.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;if(t.name===n||"*"===n.charAt(n.length-1)&&0===t.name.indexOf(n.substring(0,n.length-1)))return!1}}catch(e){i.e(e)}finally{i.f()}}return!0}}function C(e,t,r,i){!1!==i&&0<r.length&&"function"==typeof r[0]?r[0](e,t,r.slice(1)):e._queue.next()}function p(e,t,r){var i=t.getConfiguration("collectDomain"),n=i.startsWith("https://")||i.startsWith("http://")?"":"https://",n="".concat(n).concat(i,"/").concat(t.getConfiguration("path")),i="?s=".concat(t.getConfiguration("site")).concat(t.visitorId?"&idclient="+t.visitorId:"");t.build.url=n+i,t.build.data={events:t.events},C(e,t,r)}function d(e,t,r){C(e,t,r)}function v(e,t,r){t.addEventsProperty("event_collection_platform","js-browserless"),t.addEventsProperty("event_collection_version",t.getConfiguration("version"));var i=new Date;t.addEventsProperty("device_timestamp_utc",i.getTime()),t.addEventsProperty("device_local_hour",i.getTime()),t.addEventsProperty("device_hour",i.getHours()),C(e,t,r)}function g(t,r,i){function e(e){C(t,r,i,e)}r.options&&r.options.onBeforeBuild?r.options.onBeforeBuild(t,r,e):e()}function y(t,r,i){function e(e){C(t,r,i,e)}r.options&&r.options.onBeforeSend?r.options.onBeforeSend(t,r,e):e()}function h(e,t,r){e._privacy.call("filterEvents",t.events),e._privacy.call("filterProps",t.properties);for(var i=t.events,n=0;n<i.length;n++){e._privacy.call("filterProps",i[n].data,i[n].name);var o,a=e._privacy.call("getModeMetadata")||{};for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&t.addEventsProperty(o,a[o])}C(e,t,r)}function _(e,t,r){var i,n=[];for(i in t.properties)if(Object.prototype.hasOwnProperty.call(t.properties,i)){var o,a=!1,s=b(t.events);try{for(s.s();!(o=s.n()).done;){var u=o.value,c=!1,l=t.properties[i].options.events;if(l)if(-1<l.indexOf(u.name))c=!0;else{var f,p=b(l);try{for(p.s();!(f=p.n()).done;){var d=f.value;if("*"===d.charAt(d.length-1)&&0===u.name.indexOf(d.substring(0,d.length-1))){c=!0;break}}}catch(e){p.e(e)}finally{p.f()}}else c=!0;c&&void 0===u.data[i]&&(u.data[i]=t.properties[i].value,a=!0)}}catch(e){s.e(e)}finally{s.f()}a&&!t.properties[i].options.persistent&&n.push(i)}for(var v=0,g=n;v<g.length;v++)delete e._properties[g[v]];if(!t.getConfiguration("sendEmptyProperties")){var y,h=b(t.events);try{for(h.s();!(y=h.n()).done;){var _,m=y.value;for(_ in m.data)!Object.prototype.hasOwnProperty.call(m.data,_)||""!==m.data[_]&&void 0!==m.data[_]||delete m.data[_]}}catch(e){h.e(e)}finally{h.f()}}C(e,t,r)}function m(e,t,r){(e._privacy.call("getMode")!==e._privacy.modeEnum.OPTOUT||e._privacy.call("getMode")===e._privacy.modeEnum.OPTOUT&&t.getConfiguration("sendEventWhenOptout"))&&0<t.build.data.events.length&&a.post(t.build.url,JSON.stringify(t.build.data)),C(e,t,r)}function P(r,i,n){void 0!==i.properties.user_id?C(r,i,n):r.getUser(function(e){var t;null!==e&&(i.addEventsProperty("user_id",e.id,t={persistent:!0}),i.addEventsProperty("user_category",e.category,t),i.addEventsProperty("user_recognition",!0,t)),C(r,i,n)})}function w(r,i,n){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){var t;!i.getConfiguration("isVisitorClientSide")||(i.visitorId=r._visitorId.value||e||E.v4(),t="OPT-OUT"!==i.visitorId&&"no-consent"!==i.visitorId&&"no-storage"!==i.visitorId&&i.visitorId!==r._visitorId.value,i.visitorId===e&&"relative"!==i.getConfiguration("visitorStorageMode"))||!t?C(r,i,n):((e=new Date).setTime(e.getTime()+24*i.getConfiguration("storageLifetimeVisitor")*60*60*1e3),r._privacy.call("setItem",i.getConfiguration("storageVisitor"),i.visitorId,e,function(){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){null===e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i.visitorId)&&(i.visitorId=i.visitorId+"-NO"),C(r,i,n)})}))})}var k={};var O=function(n){this.setItem=function(e,t,r,i){t=JSON.stringify({data:t,expires:r?r.getTime():0});k[e]=n.getConfiguration("encodeStorageBase64")?l.base64.encode(t):t,i&&i()},this.getItem=function(t,e){var r,i=null;if(void 0!==k[t]){try{r=JSON.parse(k[t])}catch(e){r=JSON.parse(l.base64.decode(k[t]))}0===r.expires||(new Date).getTime()<r.expires?(i=r.data,e&&e(i)):(new Date).getTime()>r.expires&&this.deleteItem(t,function(){e&&e(i)})}else e&&e(i)},this.deleteItem=function(e,t){delete k[e],t&&t()}};function T(n){var o=n.getConfiguration("storageUser");n.setUser=function(e,t,r){var i={id:e,category:t};n.setProperties({user_id:e,user_category:t,user_recognition:!1},{persistent:!0}),!1!==r&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimeUser")*60*60*1e3),n._privacy.call("setItem",o,i,e))},n.getUser=function(r){n._storage.getItem(o,function(e){var t=e;!e&&n._properties.user_id&&(t={id:n._properties.user_id.value,category:n._properties.user_category.value}),r&&r(t)})},n.deleteUser=function(e){n.deleteProperty("user_id"),n.deleteProperty("user_category"),n.deleteProperty("user_recognition"),n._storage.deleteItem(o,function(){e&&e()})}}function x(P){function w(){this.debugError={trigger:"AvInsights:Media:setContentValues:Error",level:"ERROR",messageObject:"Not an object"},this.processHeartbeatValue=function(e,t){e=parseInt(e,10);return e?Math.max(e,t):0},this.value2Number=function(e){var t=0;return isNaN(Number(e))||(t=Number(e)),Math.max(t,0)}}var k={minHeartbeat:P.getConfiguration("minHeartbeat"),minBufferingHeartbeat:P.getConfiguration("minBufferingHeartbeat")},O="_ATVALUE",T="_ATPREFIX";function x(e,t){var r,e=e.length<2||":"!==e[1]?(r="",e):e.length<4||":"!==e[3]?(r=e.substring(0,1),e.substring(2,e.length)):(r=e.substring(0,3),e.substring(4,e.length));return t&&(r=r.toLowerCase(),e=e.toLowerCase()),{prefix:r,key:e}}function A(e){return null!==e&&"object"===o(e)&&!(e instanceof Array)}function S(e,t,r,i,n){var o,a,s,u="",c="",l="",f=0;for(s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(u=(o=x(s,n)).prefix||i||"",c=(t?t+"_":"")+o.key,A(e[s]))S(e[s],c,r,u,n);else{for(a=c.split("_"),l="",f=0;f<a.length;f++)u=(o=x(a[f],n)).prefix||u,l+=o.key+(f<a.length-1?"_":"");r[c=l||c]=r[c]||{},r[c][O]=e[s],r[c][T]=u}}P.avInsights={},P.avInsights.Media=function(e,t,r){function i(){d.previousCursorPosition=0,d.currentCursorPosition=0,d.eventDuration=0,d.previousEvent="",d.sessionId=E.v4()}function n(e){e?d.delayBufferingConfiguration=I(d.delayBufferingConfigurationBackup):d.delayConfiguration=I(d.delayConfigurationBackup)}function o(e,t){if(t){h(e);var r,i={};for(r in A(t)?i=t:isNaN(t)?i=JSON.parse(t):i[0]=t,i)Object.prototype.hasOwnProperty.call(i,r)&&(e?d.delayBufferingConfiguration.push({delay:p.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:p.processHeartbeatValue(i[r],k.minBufferingHeartbeat)}):d.delayConfiguration.push({delay:p.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:p.processHeartbeatValue(i[r],k.minHeartbeat)}));_(e),y(e)}}function a(e,t,r,i){var n=I(g),t=(n.av_session_id={},n.av_session_id[O]=d.sessionId,n.av_session_id[T]="",t&&(b(n),d.previousEvent=e),A(i)&&S(i,null,n,null,!0),C(n));P.sendEvent(e,t,r)}function s(){var e=this,t=0,r=0;e.getEventDuration=function(){var e=(new Date).getTime()-t-r;return r+=e,e},e.initBaseTime=function(){0===t&&(t=(new Date).getTime())},e.resetProperties=function(){r=t=0},e.initHeartbeatTimer=function(e,t){var r=t?d.delayBufferingConfiguration:d.delayConfiguration;0<r.length&&(m(t),clearTimeout(r[0].timeout),r[0].timeout=setTimeout(function(){0===r[0].number&&r.splice(0,1),e&&e()},1e3*r[0].refresh))},e.stopHeartbeatTimer=function(e){for(var t=e?d.delayBufferingConfiguration:d.delayConfiguration,r=0;r<t.length;r++)clearTimeout(t[r].timeout),t[r].timeout=-1}}function u(e,t,r,i,n){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e?d.previousCursorPosition+Math.floor(d.playbackSpeed*d.eventDuration):r,t&&v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.heartbeat",!0,i,n)}function c(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),e&&v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.heartbeat",!0,t,r)}function l(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,e&&v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.heartbeat",!0,t,r)}var f=this,p=new w,d=null,v=null,g=null,y=function(e){e?d.delayBufferingConfigurationBackup=I(d.delayBufferingConfiguration):d.delayConfigurationBackup=I(d.delayConfiguration)},h=function(e){e?(d.delayBufferingConfiguration=[],d.delayBufferingConfigurationBackup=[]):(d.delayConfiguration=[],d.delayConfigurationBackup=[])},_=function(e){(e?d.delayBufferingConfiguration:d.delayConfiguration).sort(function(e,t){return e.delay<t.delay?-1:t.delay<e.delay?1:0})},m=function(e){var t,e=e?d.delayBufferingConfiguration:d.delayConfiguration;void 0===(t=void 0!==e[1]?e[1].delay:t)?e[0].number=1:0<e[0].number?e[0].number--:"number"==typeof t&&(e[0].number=Math.floor(60*(t-e[0].delay)/e[0].refresh)-1)},b=function(e){e.av_previous_position={},e.av_previous_position[O]=d.previousCursorPosition,e.av_previous_position[T]="",e.av_position={},e.av_position[O]=d.currentCursorPosition,e.av_position[T]="",e.av_duration={},e.av_duration[O]=d.eventDuration,e.av_duration[T]="",e.av_previous_event={},e.av_previous_event[O]=d.previousEvent,e.av_previous_event[T]=""},C=function(e){var t,r={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Object.prototype.hasOwnProperty.call(e[t],O)?r[e[t][T]?"".concat(e[t][T],":").concat(t):t]=e[t][O]:r[t]=e[t]);return r};f.set=function(e,t){e=x(e,!0);g[e.key]=g[e.key]||{},g[e.key][O]=t,g[e.key][T]=e.prefix},f.get=function(e){var t=null,e=x(e,!0);return t=void 0!==g[e.key]?g[e.key][O]:t},f.del=function(e){e=x(e,!0);void 0!==g[e.key]&&delete g[e.key]},f.setProps=function(e){A(e)&&S(e,null,g,null,!0)},f.getProps=function(){var e,t=null;for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&((t=t||{})[e]=g[e][O]);return t},f.delProps=function(){g={}};f.setPlaybackSpeed=function(e){e=p.value2Number(e)||d.playbackSpeed;e!==d.playbackSpeed&&(v.stopHeartbeatTimer(!1),d.isPlaying&&(u(!0,!1),v.initHeartbeatTimer(function(){u(!0,!0)},!1)),d.playbackSpeed=e)},f.getSessionID=function(){return d.sessionId},f.track=function(e,t,r,i){var n=t||{};switch(e){case"av.heartbeat":f.heartbeat(n.av_position,r,i);break;case"av.buffer.heartbeat":f.bufferHeartbeat(r,i);break;case"av.rebuffer.heartbeat":f.rebufferHeartbeat(r,i);break;case"av.play":f.play(n.av_position,r,i);break;case"av.buffer.start":f.bufferStart(n.av_position,r,i);break;case"av.start":f.playbackStart(n.av_position,r,i);break;case"av.resume":f.playbackResumed(n.av_position,r,i);break;case"av.pause":f.playbackPaused(n.av_position,r,i);break;case"av.stop":f.playbackStopped(n.av_position,r,i);break;case"av.backward":f.seekBackward(n.av_previous_position,n.av_position,r,i);break;case"av.forward":f.seekForward(n.av_previous_position,n.av_position,r,i);break;case"av.seek.start":f.seekStart(n.av_previous_position,r,i);break;case"av.error":f.error(n.av_player_error,r,i);break;default:a(e,!1,r,i)}},f.heartbeat=function(e,t,r){var i,n=!0;null!=e&&0<=e&&(n=!1,i=p.value2Number(e)),u(n,!1,i,t,r)},f.bufferHeartbeat=function(e,t){c(!1,e,t)},f.rebufferHeartbeat=function(e,t){l(!1,e,t)},f.play=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=0,d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.play",!0,t,r)},f.bufferStart=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),d.isPlaybackActivated?(v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.start",!0,t,r)):(v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.start",!0,t,r))},f.playbackStart=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.start",!0,t,r)},f.playbackResumed=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.resume",!0,t,r)},f.playbackPaused=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.pause",!0,t,r)},f.playbackStopped=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),a("av.stop",!0,t,r),i()},f.playbackKill=function(){v.initBaseTime(),d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),i()},f.seek=function(e,t,r,i){e=p.value2Number(e),t=p.value2Number(t);t<e?f.seekBackward(e,t,r,i):f.seekForward(e,t,r,i)},f.seekBackward=function(e,t,r,i){f.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=p.value2Number(e),d.currentCursorPosition=p.value2Number(t),a("av.backward",!0,r,i)},f.seekForward=function(e,t,r,i){f.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=p.value2Number(e),d.currentCursorPosition=p.value2Number(t),a("av.forward",!0,r,i)},f.seekStart=function(e,t,r){e=p.value2Number(e);d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying?d.eventDuration=v.getEventDuration():d.eventDuration=0,a("av.seek.start",!0,t,r)},f.adClick=function(e,t){a("av.ad.click",!1,e,t)},f.adSkip=function(e,t){a("av.ad.skip",!1,e,t)},f.error=function(e,t,r){var i={};(i=A(r)?r:i).av_player_error=String(e),a("av.error",!1,t,i)},f.display=function(e,t){a("av.display",!1,e,t)},f.close=function(e,t){a("av.close",!1,e,t)},f.volume=function(e,t){a("av.volume",!1,e,t)},f.subtitleOn=function(e,t){a("av.subtitle.on",!1,e,t)},f.subtitleOff=function(e,t){a("av.subtitle.off",!1,e,t)},f.fullscreenOn=function(e,t){a("av.fullscreen.on",!1,e,t)},f.fullscreenOff=function(e,t){a("av.fullscreen.off",!1,e,t)},f.quality=function(e,t){a("av.quality",!1,e,t)},f.speed=function(e,t){a("av.speed",!1,e,t)},o(!(d={previousCursorPosition:0,currentCursorPosition:0,eventDuration:0,playbackSpeed:1,previousEvent:"",isPlaybackActivated:!(f.share=function(e,t){a("av.share",!1,e,t)}),isPlaying:!1,sessionId:"",delayConfiguration:[],delayConfigurationBackup:[],delayBufferingConfiguration:[],delayBufferingConfigurationBackup:[]}),e),o(!0,t),d.sessionId=r||E.v4(),v=new s,g={}}}function A(n){this.value=null,n.getVisitorId=function(t){var r=this.value,i=null;if(n._storage.getItem(n.getConfiguration("storageVisitor"),function(e){i=((e,t)=>(t&&t(e),e))(r||e,t)}.bind(n)),void 0===t)return i}.bind(this),n.setVisitorId=function(e){this.value=e;var t=new Date;t.setTime(t.getTime()+24*n.getConfiguration("storageLifetimeVisitor")*60*60*1e3),n._privacy.call("setItem",n.getConfiguration("storageVisitor"),e,t,function(){})}.bind(this)}function S(n){function r(e,t,r,i){return r=u(t[r].events[e],i),t=u(t["*"].events[e],i),r||t}function i(e,t,r,i,n){var o,n=n?(o=c(t[r].properties,e,i,n),c(t["*"].properties,e,i,n)):(o=l(t[r].properties,e,i),l(t["*"].properties,e,i));return o||n}function o(e,t,r,i){return r=f(t[r].storage,e,i),t=f(t["*"].storage,e,i),r||t}var a=n.getConfiguration("privacy"),s=(this.currentMode="",this.modes=a.modes,this._storageKeys=Object.assign(a.legacyKeys,a.storageKeys),this.init=function(){n._privacy.isLegacyPrivacy&&n._storage.getItem(a.storageKey,function(e){this.setMode(e&&this.modes[e]?e:n.getConfiguration("privacyDefaultMode"))}.bind(this))},this.setMode=function(t){t!==this.currentMode&&this.modes[t]&&(this.currentMode=t,n._storage.getItem(a.storageKey,function(e){"optout"===t||"no-consent"===t||"no-storage"===t?n._visitorId.value=this.modes[t].visitorId:"OPT-OUT"!==n._visitorId.value&&"no-consent"!==n._visitorId.value&&"no-storage"!==n._visitorId.value||(n._visitorId.value=null),this.filterProps(n._properties),this.filterKeys(),e!==t&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimePrivacy")*60*60*1e3),this.setItem(a.storageKey,t,e))}.bind(this)))},this.createMode=function(e,t){var r;this.modes[e]||((r=I(this.modes.exempt)).name=e,r.properties.include.visitor_privacy_mode=e,r.properties.include.visitor_privacy_consent=t,this.modes[e]=r)},this.getMode=function(){return this.currentMode},function(e,t,r,i,n,o){var a=["*"],s=["*"],u="properties",c=i?"forbidden":"allowed";t&&(a="string"==typeof t?[t]:t),r&&(s="string"==typeof r?[r]:r),n&&(u="storage"),o&&(u="events");for(var l=0;l<a.length;l++)if(void 0!==this.modes[a[l]])for(var f=this.modes[a[l]],p=0;p<s.length;p++){var d=f[u][c];void 0!==d[s[p]]||n||o||(d[s[p]]={});for(var v=0;v<e.length;v++)n||o?d[e[v]]=!0:d[s[p]][e[v]]=!0}}.bind(this)),u=(this.include={properties:function(e,t,r){s(e,t,r)},property:function(e,t,r){s([e],t,r)},storageKeys:function(e,t){s(e,t,null,!1,!0)},storageKey:function(e,t){s([e],t,null,!1,!0)},events:function(e,t){s(e,t,null,!1,!1,!0)},event:function(e,t){s([e],t,null,!1,!1,!0)}},this.exclude={properties:function(e,t,r){s(e,t,r,!0)},property:function(e,t,r){s([e],t,r,!0)},storageKeys:function(e,t){s(e,t,null,!0,!0)},storageKey:function(e,t){s([e],t,null,!0,!0)},events:function(e,t){s(e,t,null,!0,!1,!0)},event:function(e,t){s([e],t,null,!0,!1,!0)}},function(e,t){if(e[t])return!0;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&"*"===r.charAt(r.length-1)&&0===t.indexOf(r.substring(0,r.length-1)))return!0;return!1}),c=(this.isEventAllowed=function(e){var t=r("forbidden",this.modes,this.currentMode,e),e=r("allowed",this.modes,this.currentMode,e);return!t&&e},function(e,t,r,i){var n,o=e[t];if(o[i]&&o[i][r]||o["*"][r])return!0;for(n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&"*"===n.charAt(n.length-1)&&0===i.indexOf(n.substring(0,n.length-1))||n===i)for(var a in o[n])if(Object.prototype.hasOwnProperty.call(o[n],a)&&("*"===a.charAt(a.length-1)&&0===r.indexOf(a.substring(0,a.length-1))||r===a))return!0;return!1}),l=function(e,t,r){if("forbidden"===t&&e[t]["*"][r])return!0;for(var i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)){if(e[t][i][r])return!0;for(var n in e[t][i])if("*"===n.charAt(n.length-1)&&0===r.indexOf(n.substring(0,n.length-1)))return!0}return!1},f=(this.isPropAllowed=function(e,t){var r=i("forbidden",this.modes,this.currentMode,e,t),e=i("allowed",this.modes,this.currentMode,e,t);return!r&&e},function(e,t,r){var i,n=e[t];if(n[r])return!0;for(i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"*"===i.charAt(i.length-1)&&0===r.indexOf(i.substring(0,i.length-1)))return!0;return!1});this.isKeyAllowed=function(e){var t=o("forbidden",this.modes,this.currentMode,e),e=o("allowed",this.modes,this.currentMode,e);return!t&&e},this.setItem=function(e,t,r,i){this.isKeyAllowed(e)?n._storage.setItem(e,t,r,i):i&&i()},this.filterProps=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&!this.isPropAllowed(r,t||void 0)&&delete e[r]},this.filterKeys=function(){for(var e in this._storageKeys)Object.prototype.hasOwnProperty.call(this._storageKeys,e)&&!this.isKeyAllowed(e)&&n._storage.deleteItem(e)},this.filterEvents=function(e){for(var t=e.length-1;0<=t;t--)this.isEventAllowed(e[t].name)||e.splice(t,1)},this.getModeMetadata=function(){return this.modes[this.getMode()].properties.include},this.init()}function B(o){var e=this;this.isLegacyPrivacy=!0,this.modeEnum={OPTOUT:e.isLegacyPrivacy?"optout":"opt-out"},this.call=function(e){for(var t=this.isLegacyPrivacy?"privacy":"consent",r=arguments.length,i=new Array(1<r?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o[t][e].apply(o[t],i)}}function t(e){var t;(t=this).cfg=new u(I(e)||n),t.setConfiguration=t.cfg.setConfiguration,t.setConfigurations=t.cfg.setConfigurations,t.getConfiguration=t.cfg.getConfiguration,this._storage=new O(this),this._queue=new r(this),this._properties={},this._sendEvent=D,this._setProperty=H,this._deleteProperty=N,this._visitorId=new A(this),(e=this)._privacy=new B(e),e.privacy=new S(e),this.user=new T(this),x(this)}function D(e,t){for(var r=[h,w,P,d,v,_,g,p,y,m],i=0;i<e.length;i++){var n={name:"",data:{}};if("string"==typeof e[i])n.name=e[i];else{if(void 0!==e[i].data)continue;n.name=e[i].name}e[i]=n}var o,t={events:I(e),options:I(t)};0<r.length&&"function"==typeof r[0]&&(o=new u(this.cfg.cloneData()),r[0](this,new f(this,t,o),r.slice(1)))}function H(e,t,r,i){e._privacy.call("isPropAllowed",t)&&(e._properties[t]={value:r,options:i||{}}),e._queue.next()}function N(e,t){delete e._properties[t],e._queue.next()}t.prototype.setProperty=function(e,t,r){this._queue.push(["_setProperty",this,e,t,r])},t.prototype.setProperties=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setProperty(r,e[r],t)},t.prototype.deleteProperty=function(e){this._queue.push(["_deleteProperty",this,e])},t.prototype.sendEvent=function(e,t,r){this._queue.push(["_sendEvent",[{name:e,data:t}],r])},t.prototype.sendEvents=function(e,t){this._queue.push(["_sendEvent",e,t])};var M=new(t.prototype.PA=t)(n);e.pianoAnalytics=M,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react-native")):"function"==typeof define&&define.amd?define(["exports","react-native"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pianoAnalytics={},e.reactNative)})(this,function(e,i){var n={site:"",collectDomain:"",path:"event",visitorStorageMode:"fixed",storageLifetimeVisitor:395,storageLifetimeUser:395,storageLifetimePrivacy:395,privacyDefaultMode:"optin",sendEventWhenOptout:!0,isVisitorClientSide:!0,enableCallbacks:!0,cookieDomain:"",cookieSecure:!0,cookiePath:"/",cookieSameSite:"lax",encodeStorageBase64:!1,addEventURL:"withoutQS",clickAutoManagement:!0,enableUTMTracking:!0,campaignPrefix:["at_"],storageVisitor:"pa_vid",storageUser:"pa_user",version:"6.15.1",minHeartbeat:5,minBufferingHeartbeat:1,queueVarName:"_paq",globalVarName:"pa",enableAutomaticPageRefresh:!0,allowHighEntropyClientHints:!0,sendEmptyProperties:!0,enableExtendedOptout:!1,privacy:{storageKey:"pa_privacy",legacyKeys:{pa_vid:!0,pa_privacy:!0,atuserid:!0},storageKeys:{pa_user:!0},modes:{optin:{name:"optin",properties:{include:{visitor_privacy_consent:!0,visitor_privacy_mode:"optin"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{"*":!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},optout:{name:"optout",visitorId:"OPT-OUT",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"optout"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0},forbidden:{}},events:{allowed:{"*":!0},forbidden:{}}},"no-consent":{name:"no-consent",visitorId:"no-consent",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-consent"},allowed:{"*":{}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},"no-storage":{name:"no-storage",visitorId:"no-storage",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"no-storage"},allowed:{"*":{"*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{"*":!0}},events:{allowed:{"*":!0},forbidden:{}}},exempt:{name:"exempt",properties:{include:{visitor_privacy_consent:!1,visitor_privacy_mode:"exempt"},allowed:{"*":{app_crash:!0,app_crash_class:!0,app_crash_screen:!0,app_version:!0,browser:!0,browser_cookie_acceptance:!0,browser_group:!0,browser_version:!0,click:!0,click_chapter1:!0,click_chapter2:!0,click_chapter3:!0,click_full_name:!0,connection_monitor:!0,connection_organisation:!0,cookie_creation_date:!0,date:!0,date_day:!0,date_daynumber:!0,date_month:!0,date_monthnumber:!0,date_week:!0,date_year:!0,date_yearofweek:!0,device_brand:!0,device_display_height:!0,device_display_width:!0,device_name:!0,device_name_tech:!0,device_screen_diagonal:!0,device_screen_height:!0,device_screen_width:!0,device_type:!0,event_collection_platform:!0,event_collection_version:!0,event_hour:!0,event_id:!0,event_minute:!0,event_position:!0,event_second:!0,event_time:!0,event_time_utc:!0,event_url:!0,event_url_domain:!0,event_url_full:!0,exclusion_cause:!0,exclusion_type:!0,geo_city:!0,geo_continent:!0,geo_country:!0,geo_metro:!0,geo_region:!0,goal_type:!0,hit_time_utc:!0,os:!0,os_group:!0,os_version:!0,os_version_name:!0,page:!0,page_chapter1:!0,page_chapter2:!0,page_chapter3:!0,page_duration:!0,page_full_name:!0,page_position:!0,page_title_html:!0,page_url:!0,pageview_id:!0,previous_url:!0,privacy_status:!0,site:!0,site_env:!0,site_id:!0,site_platform:!0,src:!0,src_detail:!0,src_direct_access:!0,src_organic:!0,src_organic_detail:!0,src_portal_domain:!0,src_portal_site:!0,src_portal_site_id:!0,src_portal_url:!0,src_referrer_site_domain:!0,src_referrer_site_url:!0,src_referrer_url:!0,src_se:!0,src_se_category:!0,src_se_country:!0,src_type:!0,src_url:!0,src_url_domain:!0,src_webmail:!0}},forbidden:{"*":{}}},storage:{allowed:{pa_vid:!0,pa_privacy:!0,atuserid:!0},forbidden:{}},events:{allowed:{"click.exit":!0,"click.navigation":!0,"click.download":!0,"click.action":!0,"page.display":!0},forbidden:{}}},"*":{properties:{allowed:{"*":{connection_type:!0,device_timestamp_utc:!0,visitor_privacy_consent:!0,visitor_privacy_mode:!0,"ch_ua*":!0}},forbidden:{"*":{}}},storage:{allowed:{},forbidden:{}},events:{allowed:{},forbidden:{}}}}}};function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function b(e,t){var r,i,n,o,a="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(a)return n=!(i=!0),{s:function(){a=a.call(e)},n:function(){var e=a.next();return i=e.done,e},e:function(e){n=!0,r=e},f:function(){try{i||null==a.return||a.return()}finally{if(n)throw r}}};if(Array.isArray(e)||(a=((e,t)=>{var r;if(e)return"string"==typeof e?s(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0})(e))||t&&e&&"number"==typeof e.length)return a&&(e=a),o=0,{s:t=function(){},n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var I=function(e,t){if("object"!==o(e)||null===e||e instanceof Date)return e;var r,i=new e.constructor;for(r in e)!Object.prototype.hasOwnProperty.call(e,r)||void 0===r||t&&void 0===e[r]||(i[r]=I(e[r]));return i},a={post:function(t,e,r){e={method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:e};return"android"===i.Platform.OS&&(e.headers["User-Agent"]="PA SDK React Native Android/".concat(n.version)),fetch(t,e).then(function(e){r&&r(t,e)}).catch(function(e){console.error(e)})}},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l={encodeURIComponent:encodeURIComponent,utf8:{encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t+=String.fromCharCode(i):t=127<i&&i<2048?(t+=String.fromCharCode(i>>6|192))+String.fromCharCode(63&i|128):(t=(t+=String.fromCharCode(i>>12|224))+String.fromCharCode(i>>6&63|128))+String.fromCharCode(63&i|128)}return t},decode:function(e){var t,r,i,n="",o=0;for(t=0;o<e.length;)(i=e.charCodeAt(o))<128?(n+=String.fromCharCode(i),o++):191<i&&i<224?(t=e.charCodeAt(o+1),n+=String.fromCharCode((31&i)<<6|63&t),o+=2):(t=e.charCodeAt(o+1),r=e.charCodeAt(o+2),n+=String.fromCharCode((15&i)<<12|(63&t)<<6|63&r),o+=3);return n}},base64:{encode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=l.utf8.encode(e);u<e.length;)i=(t=e.charCodeAt(u++))>>2,n=(3&t)<<4|(t=e.charCodeAt(u++))>>4,o=(15&t)<<2|(r=e.charCodeAt(u++))>>6,a=63&r,isNaN(t)?o=a=64:isNaN(r)&&(a=64),s=s+c.charAt(i)+c.charAt(n)+c.charAt(o)+c.charAt(a);return s},decode:function(e){var t,r,i,n,o,a,s="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)i=c.indexOf(e.charAt(u++)),t=(15&(n=c.indexOf(e.charAt(u++))))<<4|(o=c.indexOf(e.charAt(u++)))>>2,r=(3&o)<<6|(a=c.indexOf(e.charAt(u++))),s+=String.fromCharCode(i<<2|n>>4),64!=o&&(s+=String.fromCharCode(t)),64!=a&&(s+=String.fromCharCode(r));return s=l.utf8.decode(s)}}},E={v4:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}};function u(e){var r=e;function i(e,t){null!==t&&""!==t&&void 0!==t&&(r[e]=t)}return{setConfiguration:i,setConfigurations:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i(t,e[t])},getConfiguration:function(e){return void 0!==r[e]?I(r[e]):null},cloneData:function(){return I(r)},deleteProperty:function(e){delete r[e]}}}function r(t){var r=[];return{push:function(e){r.push(e),1===r.length&&t[e[0]].apply(t,e.slice(1))},next:function(){var e;r.shift(),0<r.length&&t[(e=r[0])[0]].apply(t,e.slice(1))}}}function f(o,e,t){this.properties=I(o._properties),this.addEventsProperty=function(e,t){if(o._privacy.call("isPropAllowed",e)){var r,i=b(this.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;this.isPropertyAbsentForEvent(e,n)&&(n.data[e]=t)}}catch(e){i.e(e)}finally{i.f()}}},this.hasProperty=function(e){return Object.prototype.hasOwnProperty.call(this.properties,e)},this.getConfiguration=t.getConfiguration,this.setConfiguration=t.setConfiguration,this.options=e.options||{},this.visitorId=null,this.build={url:"",data:{}},this.events=e.events||[],this.isPropertyAbsentForEvent=function(e,t){if(void 0!==t.data[e])return!1;if(this.hasProperty(e)){if(void 0===this.properties[e].options.events)return!1;var r,i=b(this.properties[e].options.events);try{for(i.s();!(r=i.n()).done;){var n=r.value;if(t.name===n||"*"===n.charAt(n.length-1)&&0===t.name.indexOf(n.substring(0,n.length-1)))return!1}}catch(e){i.e(e)}finally{i.f()}}return!0}}function C(e,t,r,i){!1!==i&&0<r.length&&"function"==typeof r[0]?r[0](e,t,r.slice(1)):e._queue.next()}function p(e,t,r){var i=t.getConfiguration("collectDomain"),n=i.startsWith("https://")||i.startsWith("http://")?"":"https://",n="".concat(n).concat(i,"/").concat(t.getConfiguration("path")),i="?s=".concat(t.getConfiguration("site")).concat(t.visitorId?"&idclient="+t.visitorId:"");t.build.url=n+i,t.build.data={events:t.events},C(e,t,r)}function d(e,t,r){C(e,t,r)}function v(e,t,r){t.addEventsProperty("event_collection_platform","js-browserless"),t.addEventsProperty("event_collection_version",t.getConfiguration("version"));var i=new Date;t.addEventsProperty("device_timestamp_utc",i.getTime()),t.addEventsProperty("device_local_hour",i.getTime()),t.addEventsProperty("device_hour",i.getHours()),C(e,t,r)}function g(t,r,i){function e(e){C(t,r,i,e)}r.options&&r.options.onBeforeBuild?r.options.onBeforeBuild(t,r,e):e()}function y(t,r,i){function e(e){C(t,r,i,e)}r.options&&r.options.onBeforeSend?r.options.onBeforeSend(t,r,e):e()}function h(e,t,r){e._privacy.call("filterEvents",t.events),e._privacy.call("filterProps",t.properties);for(var i=t.events,n=0;n<i.length;n++){e._privacy.call("filterProps",i[n].data,i[n].name);var o,a=e._privacy.call("getModeMetadata")||{};for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&t.addEventsProperty(o,a[o])}C(e,t,r)}function _(e,t,r){var i,n=[];for(i in t.properties)if(Object.prototype.hasOwnProperty.call(t.properties,i)){var o,a=!1,s=b(t.events);try{for(s.s();!(o=s.n()).done;){var u=o.value,c=!1,l=t.properties[i].options.events;if(l)if(-1<l.indexOf(u.name))c=!0;else{var f,p=b(l);try{for(p.s();!(f=p.n()).done;){var d=f.value;if("*"===d.charAt(d.length-1)&&0===u.name.indexOf(d.substring(0,d.length-1))){c=!0;break}}}catch(e){p.e(e)}finally{p.f()}}else c=!0;c&&void 0===u.data[i]&&(u.data[i]=t.properties[i].value,a=!0)}}catch(e){s.e(e)}finally{s.f()}a&&!t.properties[i].options.persistent&&n.push(i)}for(var v=0,g=n;v<g.length;v++)delete e._properties[g[v]];if(!t.getConfiguration("sendEmptyProperties")){var y,h=b(t.events);try{for(h.s();!(y=h.n()).done;){var _,m=y.value;for(_ in m.data)!Object.prototype.hasOwnProperty.call(m.data,_)||""!==m.data[_]&&void 0!==m.data[_]||delete m.data[_]}}catch(e){h.e(e)}finally{h.f()}}C(e,t,r)}function m(e,t,r){(e._privacy.call("getMode")!==e._privacy.modeEnum.OPTOUT||e._privacy.call("getMode")===e._privacy.modeEnum.OPTOUT&&t.getConfiguration("sendEventWhenOptout"))&&0<t.build.data.events.length&&a.post(t.build.url,JSON.stringify(t.build.data)),C(e,t,r)}function P(r,i,n){void 0!==i.properties.user_id?C(r,i,n):r.getUser(function(e){var t;null!==e&&(i.addEventsProperty("user_id",e.id,t={persistent:!0}),i.addEventsProperty("user_category",e.category,t),i.addEventsProperty("user_recognition",!0,t)),C(r,i,n)})}function w(r,i,n){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){var t;!i.getConfiguration("isVisitorClientSide")||(i.visitorId=r._visitorId.value||e||E.v4(),t="OPT-OUT"!==i.visitorId&&"no-consent"!==i.visitorId&&"no-storage"!==i.visitorId&&i.visitorId!==r._visitorId.value,i.visitorId===e&&"relative"!==i.getConfiguration("visitorStorageMode"))||!t?C(r,i,n):((e=new Date).setTime(e.getTime()+24*i.getConfiguration("storageLifetimeVisitor")*60*60*1e3),r._privacy.call("setItem",i.getConfiguration("storageVisitor"),i.visitorId,e,function(){r._storage.getItem(i.getConfiguration("storageVisitor"),function(e){null===e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(i.visitorId)&&(i.visitorId=i.visitorId+"-NO"),C(r,i,n)})}))})}var k={};var O=function(n){this.setItem=function(e,t,r,i){t=JSON.stringify({data:t,expires:r?r.getTime():0});k[e]=n.getConfiguration("encodeStorageBase64")?l.base64.encode(t):t,i&&i()},this.getItem=function(t,e){var r,i=null;if(void 0!==k[t]){try{r=JSON.parse(k[t])}catch(e){r=JSON.parse(l.base64.decode(k[t]))}0===r.expires||(new Date).getTime()<r.expires?(i=r.data,e&&e(i)):(new Date).getTime()>r.expires&&this.deleteItem(t,function(){e&&e(i)})}else e&&e(i)},this.deleteItem=function(e,t){delete k[e],t&&t()}};function T(n){var o=n.getConfiguration("storageUser");n.setUser=function(e,t,r){var i={id:e,category:t};n.setProperties({user_id:e,user_category:t,user_recognition:!1},{persistent:!0}),!1!==r&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimeUser")*60*60*1e3),n._privacy.call("setItem",o,i,e))},n.getUser=function(r){n._storage.getItem(o,function(e){var t=e;!e&&n._properties.user_id&&(t={id:n._properties.user_id.value,category:n._properties.user_category.value}),r&&r(t)})},n.deleteUser=function(e){n.deleteProperty("user_id"),n.deleteProperty("user_category"),n.deleteProperty("user_recognition"),n._storage.deleteItem(o,function(){e&&e()})}}function x(P){function w(){this.debugError={trigger:"AvInsights:Media:setContentValues:Error",level:"ERROR",messageObject:"Not an object"},this.processHeartbeatValue=function(e,t){e=parseInt(e,10);return e?Math.max(e,t):0},this.value2Number=function(e){var t=0;return isNaN(Number(e))||(t=Number(e)),Math.max(t,0)}}var k={minHeartbeat:P.getConfiguration("minHeartbeat"),minBufferingHeartbeat:P.getConfiguration("minBufferingHeartbeat")},O="_ATVALUE",T="_ATPREFIX";function x(e,t){var r,e=e.length<2||":"!==e[1]?(r="",e):e.length<4||":"!==e[3]?(r=e.substring(0,1),e.substring(2,e.length)):(r=e.substring(0,3),e.substring(4,e.length));return t&&(r=r.toLowerCase(),e=e.toLowerCase()),{prefix:r,key:e}}function A(e){return null!==e&&"object"===o(e)&&!(e instanceof Array)}function S(e,t,r,i,n){var o,a,s,u="",c="",l="",f=0;for(s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(u=(o=x(s,n)).prefix||i||"",c=(t?t+"_":"")+o.key,A(e[s]))S(e[s],c,r,u,n);else{for(a=c.split("_"),l="",f=0;f<a.length;f++)u=(o=x(a[f],n)).prefix||u,l+=o.key+(f<a.length-1?"_":"");r[c=l||c]=r[c]||{},r[c][O]=e[s],r[c][T]=u}}P.avInsights={},P.avInsights.Media=function(e,t,r){function i(){d.previousCursorPosition=0,d.currentCursorPosition=0,d.eventDuration=0,d.previousEvent="",d.sessionId=E.v4()}function n(e){e?d.delayBufferingConfiguration=I(d.delayBufferingConfigurationBackup):d.delayConfiguration=I(d.delayConfigurationBackup)}function o(e,t){if(t){h(e);var r,i={};for(r in A(t)?i=t:isNaN(t)?i=JSON.parse(t):i[0]=t,i)Object.prototype.hasOwnProperty.call(i,r)&&(e?d.delayBufferingConfiguration.push({delay:p.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:p.processHeartbeatValue(i[r],k.minBufferingHeartbeat)}):d.delayConfiguration.push({delay:p.processHeartbeatValue(r,0),number:0,timeout:-1,refresh:p.processHeartbeatValue(i[r],k.minHeartbeat)}));_(e),y(e)}}function a(e,t,r,i){var n=I(g),t=(n.av_session_id={},n.av_session_id[O]=d.sessionId,n.av_session_id[T]="",t&&(b(n),d.previousEvent=e),A(i)&&S(i,null,n,null,!0),C(n));P.sendEvent(e,t,r)}function s(){var e=this,t=0,r=0;e.getEventDuration=function(){var e=(new Date).getTime()-t-r;return r+=e,e},e.initBaseTime=function(){0===t&&(t=(new Date).getTime())},e.resetProperties=function(){r=t=0},e.initHeartbeatTimer=function(e,t){var r=t?d.delayBufferingConfiguration:d.delayConfiguration;0<r.length&&(m(t),clearTimeout(r[0].timeout),r[0].timeout=setTimeout(function(){0===r[0].number&&r.splice(0,1),e&&e()},1e3*r[0].refresh))},e.stopHeartbeatTimer=function(e){for(var t=e?d.delayBufferingConfiguration:d.delayConfiguration,r=0;r<t.length;r++)clearTimeout(t[r].timeout),t[r].timeout=-1}}function u(e,t,r,i,n){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e?d.previousCursorPosition+Math.floor(d.playbackSpeed*d.eventDuration):r,t&&v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.heartbeat",!0,i,n)}function c(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),e&&v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.heartbeat",!0,t,r)}function l(e,t,r){v.initBaseTime(),d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,e&&v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.heartbeat",!0,t,r)}var f=this,p=new w,d=null,v=null,g=null,y=function(e){e?d.delayBufferingConfigurationBackup=I(d.delayBufferingConfiguration):d.delayConfigurationBackup=I(d.delayConfiguration)},h=function(e){e?(d.delayBufferingConfiguration=[],d.delayBufferingConfigurationBackup=[]):(d.delayConfiguration=[],d.delayConfigurationBackup=[])},_=function(e){(e?d.delayBufferingConfiguration:d.delayConfiguration).sort(function(e,t){return e.delay<t.delay?-1:t.delay<e.delay?1:0})},m=function(e){var t,e=e?d.delayBufferingConfiguration:d.delayConfiguration;void 0===(t=void 0!==e[1]?e[1].delay:t)?e[0].number=1:0<e[0].number?e[0].number--:"number"==typeof t&&(e[0].number=Math.floor(60*(t-e[0].delay)/e[0].refresh)-1)},b=function(e){e.av_previous_position={},e.av_previous_position[O]=d.previousCursorPosition,e.av_previous_position[T]="",e.av_position={},e.av_position[O]=d.currentCursorPosition,e.av_position[T]="",e.av_duration={},e.av_duration[O]=d.eventDuration,e.av_duration[T]="",e.av_previous_event={},e.av_previous_event[O]=d.previousEvent,e.av_previous_event[T]=""},C=function(e){var t,r={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Object.prototype.hasOwnProperty.call(e[t],O)?r[e[t][T]?"".concat(e[t][T],":").concat(t):t]=e[t][O]:r[t]=e[t]);return r};f.set=function(e,t){e=x(e,!0);g[e.key]=g[e.key]||{},g[e.key][O]=t,g[e.key][T]=e.prefix},f.get=function(e){var t=null,e=x(e,!0);return t=void 0!==g[e.key]?g[e.key][O]:t},f.del=function(e){e=x(e,!0);void 0!==g[e.key]&&delete g[e.key]},f.setProps=function(e){A(e)&&S(e,null,g,null,!0)},f.getProps=function(){var e,t=null;for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&((t=t||{})[e]=g[e][O]);return t},f.delProps=function(){g={}};f.setPlaybackSpeed=function(e){e=p.value2Number(e)||d.playbackSpeed;e!==d.playbackSpeed&&(v.stopHeartbeatTimer(!1),d.isPlaying&&(u(!0,!1),v.initHeartbeatTimer(function(){u(!0,!0)},!1)),d.playbackSpeed=e)},f.getSessionID=function(){return d.sessionId},f.track=function(e,t,r,i){var n=t||{};switch(e){case"av.heartbeat":f.heartbeat(n.av_position,r,i);break;case"av.buffer.heartbeat":f.bufferHeartbeat(r,i);break;case"av.rebuffer.heartbeat":f.rebufferHeartbeat(r,i);break;case"av.play":f.play(n.av_position,r,i);break;case"av.buffer.start":f.bufferStart(n.av_position,r,i);break;case"av.start":f.playbackStart(n.av_position,r,i);break;case"av.resume":f.playbackResumed(n.av_position,r,i);break;case"av.pause":f.playbackPaused(n.av_position,r,i);break;case"av.stop":f.playbackStopped(n.av_position,r,i);break;case"av.backward":f.seekBackward(n.av_previous_position,n.av_position,r,i);break;case"av.forward":f.seekForward(n.av_previous_position,n.av_position,r,i);break;case"av.seek.start":f.seekStart(n.av_previous_position,r,i);break;case"av.error":f.error(n.av_player_error,r,i);break;default:a(e,!1,r,i)}},f.heartbeat=function(e,t,r){var i,n=!0;null!=e&&0<=e&&(n=!1,i=p.value2Number(e)),u(n,!1,i,t,r)},f.bufferHeartbeat=function(e,t){c(!1,e,t)},f.rebufferHeartbeat=function(e,t){l(!1,e,t)},f.play=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=0,d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.play",!0,t,r)},f.bufferStart=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),d.isPlaybackActivated?(v.initHeartbeatTimer(function(){l(!0)},!0),a("av.rebuffer.start",!0,t,r)):(v.initHeartbeatTimer(function(){c(!0)},!0),a("av.buffer.start",!0,t,r))},f.playbackStart=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=e,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.start",!0,t,r)},f.playbackResumed=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!0,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.initHeartbeatTimer(function(){u(!0,!0)},!1),a("av.resume",!0,t,r)},f.playbackPaused=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!0,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),a("av.pause",!0,t,r)},f.playbackStopped=function(e,t,r){v.initBaseTime();e=p.value2Number(e);d.eventDuration=v.getEventDuration(),d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),a("av.stop",!0,t,r),i()},f.playbackKill=function(){v.initBaseTime(),d.isPlaying=!1,d.isPlaybackActivated=!1,v.stopHeartbeatTimer(!1),v.stopHeartbeatTimer(!0),v.resetProperties(),n(!1),n(!0),i()},f.seek=function(e,t,r,i){e=p.value2Number(e),t=p.value2Number(t);t<e?f.seekBackward(e,t,r,i):f.seekForward(e,t,r,i)},f.seekBackward=function(e,t,r,i){f.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=p.value2Number(e),d.currentCursorPosition=p.value2Number(t),a("av.backward",!0,r,i)},f.seekForward=function(e,t,r,i){f.seekStart(e,null,i),d.eventDuration=0,d.previousCursorPosition=p.value2Number(e),d.currentCursorPosition=p.value2Number(t),a("av.forward",!0,r,i)},f.seekStart=function(e,t,r){e=p.value2Number(e);d.previousCursorPosition=d.currentCursorPosition,d.currentCursorPosition=e,d.isPlaying?d.eventDuration=v.getEventDuration():d.eventDuration=0,a("av.seek.start",!0,t,r)},f.adClick=function(e,t){a("av.ad.click",!1,e,t)},f.adSkip=function(e,t){a("av.ad.skip",!1,e,t)},f.error=function(e,t,r){var i={};(i=A(r)?r:i).av_player_error=String(e),a("av.error",!1,t,i)},f.display=function(e,t){a("av.display",!1,e,t)},f.close=function(e,t){a("av.close",!1,e,t)},f.volume=function(e,t){a("av.volume",!1,e,t)},f.subtitleOn=function(e,t){a("av.subtitle.on",!1,e,t)},f.subtitleOff=function(e,t){a("av.subtitle.off",!1,e,t)},f.fullscreenOn=function(e,t){a("av.fullscreen.on",!1,e,t)},f.fullscreenOff=function(e,t){a("av.fullscreen.off",!1,e,t)},f.quality=function(e,t){a("av.quality",!1,e,t)},f.speed=function(e,t){a("av.speed",!1,e,t)},o(!(d={previousCursorPosition:0,currentCursorPosition:0,eventDuration:0,playbackSpeed:1,previousEvent:"",isPlaybackActivated:!(f.share=function(e,t){a("av.share",!1,e,t)}),isPlaying:!1,sessionId:"",delayConfiguration:[],delayConfigurationBackup:[],delayBufferingConfiguration:[],delayBufferingConfigurationBackup:[]}),e),o(!0,t),d.sessionId=r||E.v4(),v=new s,g={}}}function A(n){this.value=null,n.getVisitorId=function(t){var r=this.value,i=null;if(n._storage.getItem(n.getConfiguration("storageVisitor"),function(e){i=((e,t)=>(t&&t(e),e))(r||e,t)}.bind(n)),void 0===t)return i}.bind(this),n.setVisitorId=function(e){this.value=e;var t=new Date;t.setTime(t.getTime()+24*n.getConfiguration("storageLifetimeVisitor")*60*60*1e3),n._privacy.call("setItem",n.getConfiguration("storageVisitor"),e,t,function(){})}.bind(this)}function S(n){function r(e,t,r,i){return r=u(t[r].events[e],i),t=u(t["*"].events[e],i),r||t}function i(e,t,r,i,n){var o,n=n?(o=c(t[r].properties,e,i,n),c(t["*"].properties,e,i,n)):(o=l(t[r].properties,e,i),l(t["*"].properties,e,i));return o||n}function o(e,t,r,i){return r=f(t[r].storage,e,i),t=f(t["*"].storage,e,i),r||t}var a=n.getConfiguration("privacy"),s=(this.currentMode="",this.modes=a.modes,this._storageKeys=Object.assign(a.legacyKeys,a.storageKeys),this.init=function(){n._privacy.isLegacyPrivacy&&n._storage.getItem(a.storageKey,function(e){this.setMode(e&&this.modes[e]?e:n.getConfiguration("privacyDefaultMode"))}.bind(this))},this.setMode=function(t){t!==this.currentMode&&this.modes[t]&&(this.currentMode=t,n._storage.getItem(a.storageKey,function(e){"optout"===t||"no-consent"===t||"no-storage"===t?n._visitorId.value=this.modes[t].visitorId:"OPT-OUT"!==n._visitorId.value&&"no-consent"!==n._visitorId.value&&"no-storage"!==n._visitorId.value||(n._visitorId.value=null),this.filterProps(n._properties),this.filterKeys(),e!==t&&((e=new Date).setTime(e.getTime()+24*n.getConfiguration("storageLifetimePrivacy")*60*60*1e3),this.setItem(a.storageKey,t,e))}.bind(this)))},this.createMode=function(e,t){var r;this.modes[e]||((r=I(this.modes.exempt)).name=e,r.properties.include.visitor_privacy_mode=e,r.properties.include.visitor_privacy_consent=t,this.modes[e]=r)},this.getMode=function(){return this.currentMode},function(e,t,r,i,n,o){var a=["*"],s=["*"],u="properties",c=i?"forbidden":"allowed";t&&(a="string"==typeof t?[t]:t),r&&(s="string"==typeof r?[r]:r),n&&(u="storage"),o&&(u="events");for(var l=0;l<a.length;l++)if(void 0!==this.modes[a[l]])for(var f=this.modes[a[l]],p=0;p<s.length;p++){var d=f[u][c];void 0!==d[s[p]]||n||o||(d[s[p]]={});for(var v=0;v<e.length;v++)n||o?d[e[v]]=!0:d[s[p]][e[v]]=!0}}.bind(this)),u=(this.include={properties:function(e,t,r){s(e,t,r)},property:function(e,t,r){s([e],t,r)},storageKeys:function(e,t){s(e,t,null,!1,!0)},storageKey:function(e,t){s([e],t,null,!1,!0)},events:function(e,t){s(e,t,null,!1,!1,!0)},event:function(e,t){s([e],t,null,!1,!1,!0)}},this.exclude={properties:function(e,t,r){s(e,t,r,!0)},property:function(e,t,r){s([e],t,r,!0)},storageKeys:function(e,t){s(e,t,null,!0,!0)},storageKey:function(e,t){s([e],t,null,!0,!0)},events:function(e,t){s(e,t,null,!0,!1,!0)},event:function(e,t){s([e],t,null,!0,!1,!0)}},function(e,t){if(e[t])return!0;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&"*"===r.charAt(r.length-1)&&0===t.indexOf(r.substring(0,r.length-1)))return!0;return!1}),c=(this.isEventAllowed=function(e){var t=r("forbidden",this.modes,this.currentMode,e),e=r("allowed",this.modes,this.currentMode,e);return!t&&e},function(e,t,r,i){var n,o=e[t];if(o[i]&&o[i][r]||o["*"][r])return!0;for(n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&"*"===n.charAt(n.length-1)&&0===i.indexOf(n.substring(0,n.length-1))||n===i)for(var a in o[n])if(Object.prototype.hasOwnProperty.call(o[n],a)&&("*"===a.charAt(a.length-1)&&0===r.indexOf(a.substring(0,a.length-1))||r===a))return!0;return!1}),l=function(e,t,r){if("forbidden"===t&&e[t]["*"][r])return!0;for(var i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)){if(e[t][i][r])return!0;for(var n in e[t][i])if("*"===n.charAt(n.length-1)&&0===r.indexOf(n.substring(0,n.length-1)))return!0}return!1},f=(this.isPropAllowed=function(e,t){var r=i("forbidden",this.modes,this.currentMode,e,t),e=i("allowed",this.modes,this.currentMode,e,t);return!r&&e},function(e,t,r){var i,n=e[t];if(n[r])return!0;for(i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"*"===i.charAt(i.length-1)&&0===r.indexOf(i.substring(0,i.length-1)))return!0;return!1});this.isKeyAllowed=function(e){var t=o("forbidden",this.modes,this.currentMode,e),e=o("allowed",this.modes,this.currentMode,e);return!t&&e},this.setItem=function(e,t,r,i){this.isKeyAllowed(e)?n._storage.setItem(e,t,r,i):i&&i()},this.filterProps=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&!this.isPropAllowed(r,t||void 0)&&delete e[r]},this.filterKeys=function(){for(var e in this._storageKeys)Object.prototype.hasOwnProperty.call(this._storageKeys,e)&&!this.isKeyAllowed(e)&&n._storage.deleteItem(e)},this.filterEvents=function(e){for(var t=e.length-1;0<=t;t--)this.isEventAllowed(e[t].name)||e.splice(t,1)},this.getModeMetadata=function(){return this.modes[this.getMode()].properties.include},this.init()}function B(o){var e=this;this.isLegacyPrivacy=!0,this.modeEnum={OPTOUT:e.isLegacyPrivacy?"optout":"opt-out"},this.call=function(e){for(var t=this.isLegacyPrivacy?"privacy":"consent",r=arguments.length,i=new Array(1<r?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o[t][e].apply(o[t],i)}}function t(e){var t;(t=this).cfg=new u(I(e)||n),t.setConfiguration=t.cfg.setConfiguration,t.setConfigurations=t.cfg.setConfigurations,t.getConfiguration=t.cfg.getConfiguration,this._storage=new O(this),this._queue=new r(this),this._properties={},this._sendEvent=D,this._setProperty=H,this._deleteProperty=N,this._visitorId=new A(this),(e=this)._privacy=new B(e),e.privacy=new S(e),this.user=new T(this),x(this)}function D(e,t){for(var r=[h,w,P,d,v,_,g,p,y,m],i=0;i<e.length;i++){var n={name:"",data:{}};if("string"==typeof e[i])n.name=e[i];else{if(void 0!==e[i].data)continue;n.name=e[i].name}e[i]=n}var o,t={events:I(e),options:I(t)};0<r.length&&"function"==typeof r[0]&&(o=new u(this.cfg.cloneData()),r[0](this,new f(this,t,o),r.slice(1)))}function H(e,t,r,i){e._privacy.call("isPropAllowed",t)&&(e._properties[t]={value:r,options:i||{}}),e._queue.next()}function N(e,t){delete e._properties[t],e._queue.next()}t.prototype.setProperty=function(e,t,r){this._queue.push(["_setProperty",this,e,t,r])},t.prototype.setProperties=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setProperty(r,e[r],t)},t.prototype.deleteProperty=function(e){this._queue.push(["_deleteProperty",this,e])},t.prototype.sendEvent=function(e,t,r){this._queue.push(["_sendEvent",[{name:e,data:t}],r])},t.prototype.sendEvents=function(e,t){this._queue.push(["_sendEvent",e,t])};var M=new(t.prototype.PA=t)(n);e.pianoAnalytics=M,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "piano-analytics-js", | ||
"description": "JavaScript library for Piano Analytics", | ||
"version": "6.15.0", | ||
"version": "6.15.1", | ||
"main": "dist/browserless/piano-analytics.cjs.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/browserless/piano-analytics.esm.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
516959
0.02%