@datafinder/embed-sdk
Version:
Embed SDK for DataFinder
3 lines (2 loc) • 24.6 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).embedSDK={})}(this,(function(e){"use strict";var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function o(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((r=r.apply(e,t||[])).next())}))}function a(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}var i=["dashboard","report","behavior-detail","user-cohort/edit-cohort/:type/:id?","fusion-dashboard","event-analysis","retention-analysis","funnel-analysis"],s={width:"100%",height:"100%",frameBorder:"0"};function c(e){var t=Object.keys(e).filter((function(t){return null!=e[t]})).reduce((function(t,n){var o;return r(r({},t),((o={})[n]=e[n],o))}),{});return new URLSearchParams(t)}var u,l=function(e){return Object.entries(e).map((function(e){var t=e[0],n=e[1];return void 0===n||!1===n?"":"".concat(t,"=").concat(n)})).filter(Boolean).join("&")},d=function(e){var t=e.dashboardId,n=e.filterId,o=e.crossOrigin,a=e.proxyPath,i=e.dorToken,s=e.from,c=e.customRequestHeaders,u=e.locale,l=e.embedQueryParams;return r({filter_id:n,dashboardId:t,crossOrigin:o,proxyPath:a,dorToken:i,from:s,locale:u,crh:c?JSON.stringify(c):void 0},l)},p=function(e,t){var n=e.resultId,r=e.reportId,o=d(e);return n?"".concat(t,"/result/").concat(n,"?").concat(l(o)):r?"".concat(t,"/").concat(r,"?").concat(l(o)):"".concat(t,"?").concat(l(o))};function f(e){var t=e.targetNode;if(function(e){if(!(e.targetNode instanceof HTMLElement))return console.error("Given targetNode is not a valid HTMLElement."),!1;return!0}(e)){e.proxyPath;var n=e.iframeOptions,o=void 0===n?s:n,a=e.onSuccess,i=e.onError;try{var c=document.createElement("iframe");return Object.assign(c,r({src:v(e)},o)),t.appendChild(c),null==a||a(),c}catch(e){null==i||i(e.message),console.error(e)}}}function v(e){var t=e.basePath,n=void 0===t?"/datafinder":t,o=e.needsMinibaseRedirect,a=void 0!==o&&o,s=e.host,c=e.proxyPath,u=e.appId,d=e.projectId,f=e.dashboardId,v=e.reportId,h=e.filterId,m=e.crossOrigin,y=void 0===m||m,_=e.customRequestHeaders,g=e.dorToken,T=e.from,E=e.locale,b=e.embedQueryParams,I=e.showOriginUrl,w=void 0!==I&&I,O=s?s.replace(/\/*$/,""):"",C=function(e){if(e.page)return e.page;if(e.reportId)return"report";return"dashboard"}(e),N=b||{};Object.entries(N).forEach((function(e){var t=e[0],n=e[1];N[t]=n&&"object"==typeof n?encodeURIComponent(JSON.stringify(n)):encodeURIComponent(n)}));var A=r({dashboardId:f,reportId:v,filter_id:h,crossOrigin:y,proxyPath:c,dorToken:g,from:T,crh:_?JSON.stringify(_):void 0,hideBelongTo:C!==i[4],locale:E},N),R=void 0===d||null==d;if(R&&(void 0===u||null==u))throw new Error("At least one argument must be proviced in appId or projectId");var P=function(){var t="";switch(t=R?"".concat(O).concat(n,"/app/").concat(u,"/").concat(w?"":"embed-").concat(C):"".concat(O).concat(n,"/project/").concat(d,"/").concat(w?"":"embed-").concat(C),C){case i[5]:return p(e,t);case i[6]:return p(e,"".concat(t,"/custom"));default:return"".concat(t,"?").concat(l(A))}}();return a?"".concat(O).concat("/minibase/fronted-check/iframe","?app=datafinder&redirectURI=").concat(encodeURIComponent(P)):P}e.PostDataType=void 0,(u=e.PostDataType||(e.PostDataType={})).ExtensionInit="__uba_extension_init__",u.SendReportData="__uba_dash_report_data__",u.ExtensionLoaded="__uba_dash_extension_loaded__";var h={init:function(){var t;return null===(t=window.parent)||void 0===t||t.postMessage({type:e.PostDataType.ExtensionInit,data:{}},"*"),{fetchData:function(){return new Promise((function(t){var n=function(r){var o=r.data;o.type===e.PostDataType.SendReportData&&(null==t||t(o)),window.removeEventListener("message",n)};window.addEventListener("message",n)}))},loaded:function(){var t;null===(t=window.parent)||void 0===t||t.postMessage({type:e.PostDataType.ExtensionLoaded,data:{}},"*")}}}},m={iframe:null},y=("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self,{exports:{}});!function(e,t){!function(e){const t=Symbol("Comlink.proxy"),n=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.thrown"),a=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:e=>a(e)&&e[t],serialize(e){const{port1:t,port2:n}=new MessageChannel;return s(e,t),[n,[n]]},deserialize:e=>(e.start(),l(e))}],["throw",{canHandle:e=>a(e)&&o in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function s(e,t=self){t.addEventListener("message",(function n(r){if(!r||!r.data)return;const{id:a,type:i,path:c}=Object.assign({path:[]},r.data),l=(r.data.argumentList||[]).map(T);let d;try{const t=c.slice(0,-1).reduce(((e,t)=>e[t]),e),n=c.reduce(((e,t)=>e[t]),e);switch(i){case"GET":d=n;break;case"SET":t[c.slice(-1)[0]]=T(r.data.value),d=!0;break;case"APPLY":d=n.apply(t,l);break;case"CONSTRUCT":d=y(new n(...l));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;s(e,n),d=m(t,[t])}break;case"RELEASE":d=void 0;break;default:return}}catch(e){d={value:e,[o]:0}}Promise.resolve(d).catch((e=>({value:e,[o]:0}))).then((e=>{const[r,o]=g(e);t.postMessage(Object.assign(Object.assign({},r),{id:a}),o),"RELEASE"===i&&(t.removeEventListener("message",n),u(t))}))})),t.start&&t.start()}function c(e){return"MessagePort"===e.constructor.name}function u(e){c(e)&&e.close()}function l(e,t){return p(e,[],t)}function d(e){if(e)throw new Error("Proxy has been released and is not useable")}function p(e,t=[],o=function(){}){let a=!1;const i=new Proxy(o,{get(n,o){if(d(a),o===r)return()=>E(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{u(e),a=!0}));if("then"===o){if(0===t.length)return{then:()=>i};const n=E(e,{type:"GET",path:t.map((e=>e.toString()))}).then(T);return n.then.bind(n)}return p(e,[...t,o])},set(n,r,o){d(a);const[i,s]=g(o);return E(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:i},s).then(T)},apply(r,o,i){d(a);const s=t[t.length-1];if(s===n)return E(e,{type:"ENDPOINT"}).then(T);if("bind"===s)return p(e,t.slice(0,-1));const[c,u]=v(i);return E(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:c},u).then(T)},construct(n,r){d(a);const[o,i]=v(r);return E(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:o},i).then(T)}});return i}function f(e){return Array.prototype.concat.apply([],e)}function v(e){const t=e.map(g);return[t.map((e=>e[0])),f(t.map((e=>e[1])))]}const h=new WeakMap;function m(e,t){return h.set(e,t),e}function y(e){return Object.assign(e,{[t]:!0})}function _(e,t=self,n="*"){return{postMessage:(t,r)=>e.postMessage(t,n,r),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function g(e){for(const[t,n]of i)if(n.canHandle(e)){const[r,o]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},o]}return[{type:"RAW",value:e},h.get(e)||[]]}function T(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function E(e,t,n){return new Promise((r=>{const o=b();e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===o&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)}))}function b(){return new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-")}e.createEndpoint=n,e.expose=s,e.proxy=y,e.proxyMarker=t,e.releaseProxy=r,e.transfer=m,e.transferHandlers=i,e.windowEndpoint=_,e.wrap=l,Object.defineProperty(e,"__esModule",{value:!0})}(t)}(0,y.exports);var _,g,T,E=function(){var e=this;this.openPage=function(t){return o(e,void 0,void 0,(function(){var e,n,i,c,u,l,d,p,f,h=this;return a(this,(function(m){switch(m.label){case 0:return n=(e=this).state,i=e.eventTrace,n.proxyPath,c=n.targetNode,u=n.iframeOptions,l=void 0===u?s:u,d=n.onSuccess,n.onError,[4,new Promise((function(e){h.iframe=t||document.createElement("iframe"),Object.assign(h.iframe,r({src:v(n)},l)),c.appendChild(h.iframe),h.iframe.onload=function(){console.log("iframe init success"),null==d||d(),e()}}))];case 1:return m.sent(),p=this.iframe,this.comlinkController=y.exports.wrap(y.exports.windowEndpoint(p.contentWindow,self,"*"),self),f=this.comlinkController,[2,new Promise((function(e,t){y.exports.expose(y.exports.proxy({onReady:function(r){return o(this,void 0,void 0,(function(){var o;return a(this,(function(a){switch(a.label){case 0:if(r!==p.name)return console.log("iframeName ".concat(r," not equals iframe.name ").concat(null==p?void 0:p.name)),[2];a.label=1;case 1:return a.trys.push([1,5,,6]),console.log("tea-next init ready",f),[4,f.setSdkState()];case 2:return a.sent(),[4,f.updateInterfaceConfig(n.interfaceSetting)];case 3:return a.sent(),[4,f.getSdkState()];case 4:if(!a.sent())throw new Error("tea-embed-sdk init failed");return console.log("update interface setting end",n.interfaceSetting),console.log("iframe src:",null==p?void 0:p.src),i(),e(),[3,6];case 5:return o=a.sent(),console.log(o),t(),[3,6];case 6:return[2]}}))}))}}),y.exports.windowEndpoint(p.contentWindow,self,n.host))}))]}}))}))},this.getDsl=function(){var t;return null===(t=e.comlinkController)||void 0===t?void 0:t.getDsl()},this.getResultId=function(){var t;return null===(t=e.comlinkController)||void 0===t?void 0:t.getResultId()},this.getCurrentUrl=function(){var t;return null===(t=e.comlinkController)||void 0===t?void 0:t.getCurrentUrl()},this.getTeaUrl=function(){var t;return null===(t=e.comlinkController)||void 0===t?void 0:t.getTeaUrl()},this.updateResultId=function(t,n){var r;return null===(r=e.comlinkController)||void 0===r?void 0:r.updateResultId(t,n)},this.setFilters=function(t){var n;return console.log(t,"setFilters by custom"),null===(n=e.comlinkController)||void 0===n?void 0:n.setFilters(t)},this.copyResultId=function(t){var n;return null===(n=e.comlinkController)||void 0===n?void 0:n.copyResultId(t)}},b=function(e){function t(t){var n=e.call(this)||this;return n.eventTrace=function(){var e=n,t=e.comlinkController;e.state,null==t||t.eventTracer()},n.getDsl=function(){var e;return null===(e=n.comlinkController)||void 0===e?void 0:e.getDsl()},n.state=r(r({},t),{page:"event-analysis"}),n}return n(t,e),t}(E),I=function(e){function t(t){var n=e.call(this)||this;return n.eventTrace=function(){var e=n,t=e.comlinkController;e.state,null==t||t.eventTracer()},n.getDsl=function(){var e;return null===(e=n.comlinkController)||void 0===e?void 0:e.getDsl()},n.state=r(r({},t),{page:"retention-analysis"}),n}return n(t,e),t}(E),w=function(e){function t(t){var n=e.call(this)||this;return n.eventTrace=function(){var e=n,t=e.comlinkController;e.state,null==t||t.eventTracer()},n.getDsl=function(){var e;return null===(e=n.comlinkController)||void 0===e?void 0:e.getDsl()},n.state=r(r({},t),{page:"funnel-analysis"}),n}return n(t,e),t}(E);e.EAttrOp=void 0,(_=e.EAttrOp||(e.EAttrOp={})).EQ="=",_.NE="!=",_.NEQ_CONTAIN_NULL="not_equal_contain_null",_.NEQ_NOT_CONTAIN_NULL="not_equal_not_contain_null",_.GT=">",_.LT="<",_.GE=">=",_.LE="<=",_.CONTAIN="contain",_.CUSTOM_CONTAIN="custom_contain",_.NOT_CONTAIN="not_contain",_.NOT_CONTAIN_NOT_CONTAIN_NULL="not_contain_not_contain_null",_.NOT_CONTAIN_CONTAIN_NULL="not_contain_contain_null",_.LIST_CONTAIN="list_contain",_.LIST_NOT_CONTAIN="list_not_contain",_.BETWEEN="between",_.TIME_FIXED="time_fixed",_.TIME_NOT_FIXED="time_not_fixed",_.TIME_RELATIVE_TO_TODAY="time_relative_to_today",_.TIME_NOT_RELATIVE_TO_TODAY="time_not_relative_to_today",_.TIME_WITH_TODAY="time_with_today",_.TIME_NOT_WITH_TODAY="time_not_with_today",_.TIME_RELATIVE_TO_EVENT="time_relative_to_event",_.TIME_NOT_RELATIVE_TO_EVENT="time_not_relative_to_event",_.IS_NULL="is_null",_.IS_NOT_NULL="is_not_null",_.MATCH="match",_.NOT_MATCH="not_match",_.TIME="time",e.MetaPropertyType=void 0,(g=e.MetaPropertyType||(e.MetaPropertyType={})).PROFILE="profile",g.COMMON_PARAM="common_param",g.EVENT_PARAM="event_param",g.ITEM_PARAM="item_param",g.USER_TAG="user_tag",g.CDP_TAG="cdp_tag",g.COHORT="cohort",g.USER_PROFILE="user_profile",g.PARAM="param",g.CDP_COHORT="cdp_cohort",g.CUSTOM_PROPERTY_GROUP="custom_property_group",e.MetaPropertyComposeType=void 0,(T=e.MetaPropertyComposeType||(e.MetaPropertyComposeType={})).ORIGIN="origin",T.VIRTUAL="virtual",T.PROFILE="profile",T.ITEM="item";var O,C,N,A=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r._targetNode=t,r._options=n,r.exposeFunction("onCohortCreate",r._options.onCohortCreate),r}return n(t,e),t.prototype.setTitle=function(e){var t;null===(t=this._remote)||void 0===t||t.setTitle(e)},t.prototype.getViewPath=function(){var e=this._options,t=e.cohortType,n=e.cohortId;return null==n?"/embed-user-cohort/edit-cohort/".concat(t):"/embed-user-cohort/edit-cohort/".concat(t,"/").concat(n)},t.prototype.getViewSearchParams=function(){return null},t}(function(){function e(e,t){var n;this._targetNode=e,this._options=t,this._createIframe(),(null===(n=this._iframeElement)||void 0===n?void 0:n.contentWindow)&&(this._endpoint=y.exports.windowEndpoint(this._iframeElement.contentWindow),this._remote=y.exports.wrap(this._endpoint)),this.exposeFunction("onReady",this._options.onReady)}return e.prototype.destroy=function(){var e;null===(e=this._iframeElement)||void 0===e||e.remove()},Object.defineProperty(e.prototype,"iframe",{get:function(){return this._iframeElement},enumerable:!1,configurable:!0}),e.prototype.exposeFunction=function(e,t){var n;t&&y.exports.expose(y.exports.proxy(((n={})[e]=t,n)),this._endpoint)},e.prototype._createIframe=function(){var e=this._options.iframeAttrs,t=void 0===e?s:e,n=document.createElement("iframe");Object.assign(n,r({src:this._getIFrameURL()},t)),this._targetNode.appendChild(n),this._iframeElement=n},e.prototype._getIFrameURL=function(){var e=this._options,t=e.basePath,n=void 0===t?"/datafinder":t,o=e.appId,a=e.dorToken,i=e.from,s=e.customSearchParams,u=e.customRequestHeaders,l=r(r({dorToken:a,from:i,crh:u?JSON.stringify(u):void 0},this.getViewSearchParams()),s);return[this._getIFrameOrigin(),n,"/app/".concat(o),this.getViewPath(),"?".concat(c(l))].join("")},e.prototype._getIFrameOrigin=function(){var e=this._options.customDomain;return e||""},e}());!function(e){e.SINGLETON="singleton",e.PARALLEL="parallel"}(O||(O={})),function(e){e.AND="and",e.OR="or"}(C||(C={}));var R=new Uint8Array(16);function P(){if(!N&&!(N="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return N(R)}var L=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function x(e){return"string"==typeof e&&L.test(e)}for(var S=[],M=0;M<256;++M)S.push((M+256).toString(16).substr(1));function k(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+"-"+S[e[t+4]]+S[e[t+5]]+"-"+S[e[t+6]]+S[e[t+7]]+"-"+S[e[t+8]]+S[e[t+9]]+"-"+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[e[t+15]]).toLowerCase();if(!x(n))throw TypeError("Stringified UUID is invalid");return n}function U(e,t,n){function r(e,r,o,a){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof r&&(r=function(e){if(!x(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var i=new Uint8Array(16+e.length);if(i.set(r),i.set(e,r.length),(i=n(i))[6]=15&i[6]|t,i[8]=63&i[8]|128,o){a=a||0;for(var s=0;s<16;++s)o[a+s]=i[s];return o}return k(i)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function D(e){return 14+(e+64>>>9<<4)+1}function j(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function F(e,t,n,r,o,a){return j((i=j(j(t,e),j(r,a)))<<(s=o)|i>>>32-s,n);var i,s}function V(e,t,n,r,o,a,i){return F(t&n|~t&r,e,t,o,a,i)}function H(e,t,n,r,o,a,i){return F(t&r|n&~r,e,t,o,a,i)}function G(e,t,n,r,o,a,i){return F(t^n^r,e,t,o,a,i)}function W(e,t,n,r,o,a,i){return F(n^(t|~r),e,t,o,a,i)}function Y(e,t,n){var r=(e=e||{}).random||(e.rng||P)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return k(r)}function q(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function z(e,t){return e<<t|e>>>32-t}U("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){for(var t=[],n=32*e.length,r="0123456789abcdef",o=0;o<n;o+=8){var a=e[o>>5]>>>o%32&255,i=parseInt(r.charAt(a>>>4&15)+r.charAt(15&a),16);t.push(i)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[D(t)-1]=t;for(var n=1732584193,r=-271733879,o=-1732584194,a=271733878,i=0;i<e.length;i+=16){var s=n,c=r,u=o,l=a;n=V(n,r,o,a,e[i],7,-680876936),a=V(a,n,r,o,e[i+1],12,-389564586),o=V(o,a,n,r,e[i+2],17,606105819),r=V(r,o,a,n,e[i+3],22,-1044525330),n=V(n,r,o,a,e[i+4],7,-176418897),a=V(a,n,r,o,e[i+5],12,1200080426),o=V(o,a,n,r,e[i+6],17,-1473231341),r=V(r,o,a,n,e[i+7],22,-45705983),n=V(n,r,o,a,e[i+8],7,1770035416),a=V(a,n,r,o,e[i+9],12,-1958414417),o=V(o,a,n,r,e[i+10],17,-42063),r=V(r,o,a,n,e[i+11],22,-1990404162),n=V(n,r,o,a,e[i+12],7,1804603682),a=V(a,n,r,o,e[i+13],12,-40341101),o=V(o,a,n,r,e[i+14],17,-1502002290),n=H(n,r=V(r,o,a,n,e[i+15],22,1236535329),o,a,e[i+1],5,-165796510),a=H(a,n,r,o,e[i+6],9,-1069501632),o=H(o,a,n,r,e[i+11],14,643717713),r=H(r,o,a,n,e[i],20,-373897302),n=H(n,r,o,a,e[i+5],5,-701558691),a=H(a,n,r,o,e[i+10],9,38016083),o=H(o,a,n,r,e[i+15],14,-660478335),r=H(r,o,a,n,e[i+4],20,-405537848),n=H(n,r,o,a,e[i+9],5,568446438),a=H(a,n,r,o,e[i+14],9,-1019803690),o=H(o,a,n,r,e[i+3],14,-187363961),r=H(r,o,a,n,e[i+8],20,1163531501),n=H(n,r,o,a,e[i+13],5,-1444681467),a=H(a,n,r,o,e[i+2],9,-51403784),o=H(o,a,n,r,e[i+7],14,1735328473),n=G(n,r=H(r,o,a,n,e[i+12],20,-1926607734),o,a,e[i+5],4,-378558),a=G(a,n,r,o,e[i+8],11,-2022574463),o=G(o,a,n,r,e[i+11],16,1839030562),r=G(r,o,a,n,e[i+14],23,-35309556),n=G(n,r,o,a,e[i+1],4,-1530992060),a=G(a,n,r,o,e[i+4],11,1272893353),o=G(o,a,n,r,e[i+7],16,-155497632),r=G(r,o,a,n,e[i+10],23,-1094730640),n=G(n,r,o,a,e[i+13],4,681279174),a=G(a,n,r,o,e[i],11,-358537222),o=G(o,a,n,r,e[i+3],16,-722521979),r=G(r,o,a,n,e[i+6],23,76029189),n=G(n,r,o,a,e[i+9],4,-640364487),a=G(a,n,r,o,e[i+12],11,-421815835),o=G(o,a,n,r,e[i+15],16,530742520),n=W(n,r=G(r,o,a,n,e[i+2],23,-995338651),o,a,e[i],6,-198630844),a=W(a,n,r,o,e[i+7],10,1126891415),o=W(o,a,n,r,e[i+14],15,-1416354905),r=W(r,o,a,n,e[i+5],21,-57434055),n=W(n,r,o,a,e[i+12],6,1700485571),a=W(a,n,r,o,e[i+3],10,-1894986606),o=W(o,a,n,r,e[i+10],15,-1051523),r=W(r,o,a,n,e[i+1],21,-2054922799),n=W(n,r,o,a,e[i+8],6,1873313359),a=W(a,n,r,o,e[i+15],10,-30611744),o=W(o,a,n,r,e[i+6],15,-1560198380),r=W(r,o,a,n,e[i+13],21,1309151649),n=W(n,r,o,a,e[i+4],6,-145523070),a=W(a,n,r,o,e[i+11],10,-1120210379),o=W(o,a,n,r,e[i+2],15,718787259),r=W(r,o,a,n,e[i+9],21,-343485551),n=j(n,s),r=j(r,c),o=j(o,u),a=j(a,l)}return[n,r,o,a]}(function(e){if(0===e.length)return[];for(var t=8*e.length,n=new Uint32Array(D(t)),r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))})),U("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var o=0;o<r.length;++o)e.push(r.charCodeAt(o))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var a=e.length/4+2,i=Math.ceil(a/16),s=new Array(i),c=0;c<i;++c){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=e[64*c+4*l]<<24|e[64*c+4*l+1]<<16|e[64*c+4*l+2]<<8|e[64*c+4*l+3];s[c]=u}s[i-1][14]=8*(e.length-1)/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=8*(e.length-1)&4294967295;for(var d=0;d<i;++d){for(var p=new Uint32Array(80),f=0;f<16;++f)p[f]=s[d][f];for(var v=16;v<80;++v)p[v]=z(p[v-3]^p[v-8]^p[v-14]^p[v-16],1);for(var h=n[0],m=n[1],y=n[2],_=n[3],g=n[4],T=0;T<80;++T){var E=Math.floor(T/20),b=z(h,5)+q(E,m,y,_)+g+t[E]+p[T]>>>0;g=_,_=y,y=z(m,30)>>>0,m=h,h=b}n[0]=n[0]+h>>>0,n[1]=n[1]+m>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+_>>>0,n[4]=n[4]+g>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}));var Q={render:f,getFinderIFrameURL:v,ExtensionClient:h,ExtensionContainer:m,PostDataType:e.PostDataType};e.CohortEditor=A,e.EventAnalysisController=b,e.ExtensionClient=h,e.ExtensionContainer=m,e.FunnelAnalysisController=w,e.RetentionAnalysisController=I,e.default=Q,e.generateFunnelQueryEvents=function(e){return e.map((function(e,t){var n;return{label:"".concat(t+1),type:O.SINGLETON,uuid:Y(),events:[{label:"".concat(t+1),label_alias:e.eventName,uuid:Y(),data_archive_id:e.dataArchiveId,event:{event_name:e.eventName,show_name:e.showName,event_type:e.eventType,data_archive_id:e.dataArchiveId},conditions:{logic:C.AND,conditions:(null===(n=e.paramFilters)||void 0===n?void 0:n.map((function(t){var n,r=t.operation||"=";return{logic:C.OR,uuid:Y(),data_archive_id:e.dataArchiveId,conditions:[{uuid:Y(),filter:{property_type:t.propertyType,property_compose_type:t.propertyComposeType,name:t.name,data_archive_id:e.dataArchiveId},operation:{label:r,value:r},operationValues:null===(n=t.propertyValues)||void 0===n?void 0:n.map((function(e){return{value:e,label:e}}))}]}})))||[]}}]}}))},e.getFinderIFrameURL=v,e.handleAnalysis=p,e.handleRetentionAnalysis=function(e,t){var n=e.resultId,r=e.reportId,o=d(e);return n?"".concat(t,"/result/").concat(n,"?").concat(l(o)):r?"".concat(t,"/").concat(r,"?").concat(l(o)):t},e.render=f,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map