github.com/oinume/lekcije@v0.0.0-20231017100347-5b4c5eb6ab24/backend/infrastructure/dmm_eikaiwa/testdata/49393_files/track.js (about)

     1  !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}r.r(t);var c=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document.domain,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:location.search.substring(1),a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:document;i(this,e),this.key=t,this.expireSeconds=r,this.domain=n,this.query=o,this.cookieHolder=a}var t,r,o;return t=e,(r=[{key:"track",value:function(){var e=this.getAidFromQuery(this.query),t=this.getAidFrom1stCookie(this.cookieHolder.cookie);return e?(this.setAidInto1stCookie(e),e):t?(this.setAidInto1stCookie(t),t):null}},{key:"getAidFromQuery",value:function(e){for(var t=e.split("&"),r=0;r<t.length;r++){var o=n(t[r].split("="),2),i=o[0],a=o[1];if(i===this.key)return a}return null}},{key:"getAidFrom1stCookie",value:function(e){for(var t=e.split("; "),r=0;r<t.length;r++){var o=n(t[r].split("="),2),i=o[0],a=o[1];if(i===this.key)return a}return null}},{key:"setAidInto1stCookie",value:function(e){this.cookieHolder.cookie=this.createCookie(e)}},{key:"createCookie",value:function(e){return"".concat(this.key,"=").concat(e,"; domain=").concat(this.domain,"; path=/; max-age=").concat(this.expireSeconds)}}])&&a(t.prototype,r),o&&a(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return new Image};u(this,e),this.endpoint=t,this.imageFactory=r}var t,r,n;return t=e,(r=[{key:"notify",value:function(e,t){var r="".concat(this.endpoint,"?").concat(this.createQuery(e)),n=this.imageFactory();return n.src=r,n.onload=t(),n}},{key:"createQuery",value:function(e){return Object.keys(e).filter((function(t){return null!==e[t]&&void 0!==e[t]})).map((function(t){return"".concat(t,"=").concat(e[t])})).join("&")}}])&&l(t.prototype,r),n&&l(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var y=function(){function e(t,r,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:location.href,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:document.referrer;f(this,e),this.serviceId=t.service_id,this.urlMacro="${URL_MACRO}"===t.url_macro?null:t.url_macro,this.referrerMacro="${REFERRER_MACRO}"===t.referrer_macro?null:t.referrer_macro,this.propertyId=this._propertyId(t.property_id),this.keyValueSet=r||[],this.url=o,this.referrer=i,this.cacheBuster=n}var t,r,n;return t=e,(r=[{key:"_propertyId",value:function(e){return null==e||e.includes("${PROPERTY_ID}")?null:this._toArrayString(e)}},{key:"_toArrayString",value:function(e){var t=this._toArray(e);return t?"[".concat(t,"]"):null}},{key:"_toArray",value:function(e){try{return Array.prototype.concat.apply([],JSON.parse("[".concat(e,"]")))}catch(e){return null}}},{key:"collect",value:function(e,t){return{service_id:this.serviceId,url:this.url?encodeURIComponent(this.url):null,url_macro:this.urlMacro?encodeURIComponent(this.urlMacro):null,referrer:this.referrer?encodeURIComponent(this.referrer):null,referrer_macro:this.referrerMacro?encodeURIComponent(this.referrerMacro):null,property_id:this.propertyId?encodeURIComponent(this.propertyId):null,enc_aid:e||null,cbt:this.cacheBuster.generate(),kv_set:encodeURIComponent(JSON.stringify(this.keyValueSet)),aids:t&&t.length>0?encodeURIComponent(JSON.stringify(t)):null}}}])&&p(t.prototype,r),n&&p(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var h=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,(r=[{key:"generate",value:function(){return""+Math.floor(100*Math.random()+100)+(new Date).getTime()}}])&&d(t.prototype,r),n&&d(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),v={japan:{endpoint:"universe.send.microad.jp/tr"},china:{endpoint:"universe.send.microad-cn.com/tr"},apac:{endpoint:"universe.send.microadinc.com/tr"}},b={type:6,script:{customerId:1011503,url:"https://dmp.im-apps.net/sdk/im-uid.js"}};function m(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var g=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queue=[],this.send_uri="https://cache.send.microad.jp/js/";var r=document.createElement("iframe");r.width="1",r.height="1",r.frameborder=0,r.setAttribute("style","position:absolute; top:-9999px; left: -9999px; border-style: none"),r.id="universe_cookie_sync",r.src=this.send_uri+"universe_cookie_sync.html",r.addEventListener("load",(function(){t.overwriteTriggerSync()})),document.body.appendChild(r),this.iframe=r}var t,r,n;return t=e,(r=[{key:"triggerSync",value:function(e){this.queue.push(e)}},{key:"doTriggerSync",value:function(e){this.iframe.contentWindow.postMessage({processId:e},"*")}},{key:"overwriteTriggerSync",value:function(){for(this.triggerSync=this.doTriggerSync;this.queue&&this.queue.length>0;)this.triggerSync(this.queue.shift())}}])&&m(t.prototype,r),n&&m(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function w(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return k(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var j=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;_(this,e),this._doneComplete=!1,this._trackers=t,this._timeoutMs=o,this._onProcess=r,this._onComplete=n}var t,r,n;return t=e,(r=[{key:"track",value:function(){if(this._trackers&&this._trackers.length>0){var e,t=w(this._trackers);try{for(t.s();!(e=t.n()).done;){var r=e.value;this._addTracker(r)}}catch(e){t.e(e)}finally{t.f()}setTimeout(this._onceComplete.bind(this),this._timeoutMs)}else this._onceComplete()}},{key:"_onceComplete",value:function(){this._doneComplete||(this._doneComplete=!0,this._onComplete())}},{key:"_done",value:function(e){this._removeTracker(e.type),e.isValid()&&this._onProcess(e),this._trackers.length<=0&&this._onceComplete()}},{key:"_addTracker",value:function(e){e.track(this._done.bind(this))}},{key:"_removeTracker",value:function(e){this._trackers=this._trackers.filter((function(t){return t.audienceType!==e}))}}])&&O(t.prototype,r),n&&O(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function S(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var C=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.audienceType=t}var t,r,n;return t=e,(r=[{key:"track",value:function(e){}},{key:"_appendScriptTag",value:function(e,t,r){var n=t.createElement("script");n.src=e,r.appendChild(n)}}])&&S(t.prototype,r),n&&S(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function I(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var P=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.type=t,this.id=r}var t,r,n;return t=e,(r=[{key:"isValid",value:function(){return this.type>0&&!!this.id&&this.id.length>0}}])&&I(t.prototype,r),n&&I(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function T(e){return(T="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 A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function M(e,t){return(M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function E(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=U(e);if(t){var o=U(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return x(this,r)}}function x(e,t){if(t&&("object"===T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&M(e,t)}(i,e);var t,r,n,o=E(i);function i(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.document,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.document.body;return A(this,i),(e=o.call(this,b.type))._scriptSrc=b.script.url,e._customerId=b.script.customerId,e._document=t,e._body=r,e}return t=i,(r=[{key:"track",value:function(e){this._appendScriptTag(this._scriptSrc,this._document,this._body),window.IMUIDRequest=window.IMUIDRequest||[],window.IMUIDRequest.push({customerId:this._customerId,callback:function(t){e(new P(this.audienceType,t.uid))}.bind(this),callbackTimeout:1e3})}}])&&R(t.prototype,r),n&&R(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(C),F=window.microAdUniverseTracker||{};if(F.iframe=new g,F.audiences=[],F.track=function(e,t){var r="https://".concat(v.japan.endpoint),n=new h,o=n.generate();F.iframe.triggerSync(o),new j([new q],(function(e){var t=F.audiences.findIndex((function(t){return t.type===e.type}));t>=0&&F.audiences.splice(t,1),F.audiences.push(e)}),(function(){var i=new c("microad_enc_aid",31536e3).track(),a=new y(e,t,n).collect(i,F.audiences);new s(r).notify(a,(function(){F.iframe.triggerSync(o)}))})).track()},Array.isArray(F.queue))for(var D;void 0!==(D=F.queue.shift());)F.track(D[0],D[1])}]);