@levi-gemcommerce/analytics 1.0.0-dev.12 → 1.0.0-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/GTimePicker/GTimePicker.d.ts +17 -0
- package/dist/esm/components/GTimePicker/components/BaseTimePicker.d.ts +10 -0
- package/dist/esm/components/GTimePicker/components/CompareTimePicker.d.ts +5 -0
- package/dist/esm/components/GTimePicker/components/DateTimeFilterAddition.d.ts +2 -0
- package/dist/esm/components/GTimePicker/components/DateTimeFilterInputs.d.ts +9 -0
- package/dist/esm/components/GTimePicker/components/DateTimeFilters.d.ts +15 -0
- package/dist/esm/components/GTimePicker/components/MainTimePicker.d.ts +3 -0
- package/dist/esm/components/GTimePicker/components/index.d.ts +2 -0
- package/dist/esm/components/GTimePicker/constants/compareDateTimePicker.d.ts +12 -0
- package/dist/esm/components/GTimePicker/constants/datePicker.d.ts +14 -0
- package/dist/esm/components/GTimePicker/constants/index.d.ts +2 -0
- package/dist/esm/components/GTimePicker/constants/mainDataTimePicker.d.ts +14 -0
- package/dist/esm/components/GTimePicker/contexts/DateTimePickerProvider.d.ts +15 -0
- package/dist/esm/components/GTimePicker/contexts/index.d.ts +1 -0
- package/dist/esm/components/GTimePicker/helpers/date-range-info.d.ts +16 -0
- package/dist/esm/components/GTimePicker/helpers/index.d.ts +4 -0
- package/dist/esm/components/GTimePicker/helpers/parse-date.d.ts +24 -0
- package/dist/esm/components/GTimePicker/helpers/time-picker.d.ts +76 -0
- package/dist/esm/components/GTimePicker/helpers/version.d.ts +2 -0
- package/dist/esm/components/GTimePicker/hooks/index.d.ts +3 -0
- package/dist/esm/components/GTimePicker/hooks/useCompareDateTimePicker.d.ts +25 -0
- package/dist/esm/components/GTimePicker/hooks/useDateTimeFilter.d.ts +18 -0
- package/dist/esm/components/GTimePicker/hooks/useDateTimePicker.d.ts +30 -0
- package/dist/esm/components/GTimePicker/hooks/useVersionDateTimeFilters.d.ts +9 -0
- package/dist/esm/components/GTimePicker/index.d.ts +7 -0
- package/dist/esm/components/GTimePicker/types/index.d.ts +38 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/core/gemxql/helpers/getTimeDimension.d.ts +1 -1
- package/dist/esm/core/gemxql/index.d.ts +0 -2
- package/dist/esm/core/gemxql/types/date-filter.d.ts +1 -1
- package/dist/esm/gemxql.js +38 -53
- package/dist/esm/gemxql.mjs +38 -53
- package/dist/esm/index.d.ts +1 -4
- package/dist/esm/index.js +1377 -1414
- package/dist/esm/index.mjs +1377 -1414
- package/dist/esm/shared/charts/components/GPolarisViz/utilities/getFontSize.d.ts +1 -1
- package/dist/esm/shared/components/GTimePicker/GTimePicker.d.ts +1 -1
- package/dist/esm/shared/components/GTimePicker/helpers/parse-date.d.ts +2 -2
- package/dist/esm/shared/components/GTimePicker/hooks/useCompareDateTimePicker.d.ts +1 -2
- package/dist/esm/shared/components/GTimePicker/types/index.d.ts +1 -1
- package/dist/esm/shared/components/index.d.ts +0 -1
- package/dist/esm/utils/dayjs.d.ts +10 -0
- package/dist/esm/utils/index.d.ts +1 -0
- package/dist/umd/esm/components/GTimePicker/GTimePicker.d.ts +17 -0
- package/dist/umd/esm/components/GTimePicker/components/BaseTimePicker.d.ts +10 -0
- package/dist/umd/esm/components/GTimePicker/components/CompareTimePicker.d.ts +5 -0
- package/dist/umd/esm/components/GTimePicker/components/DateTimeFilterAddition.d.ts +2 -0
- package/dist/umd/esm/components/GTimePicker/components/DateTimeFilterInputs.d.ts +9 -0
- package/dist/umd/esm/components/GTimePicker/components/DateTimeFilters.d.ts +15 -0
- package/dist/umd/esm/components/GTimePicker/components/MainTimePicker.d.ts +3 -0
- package/dist/umd/esm/components/GTimePicker/components/index.d.ts +2 -0
- package/dist/umd/esm/components/GTimePicker/constants/compareDateTimePicker.d.ts +12 -0
- package/dist/umd/esm/components/GTimePicker/constants/datePicker.d.ts +14 -0
- package/dist/umd/esm/components/GTimePicker/constants/index.d.ts +2 -0
- package/dist/umd/esm/components/GTimePicker/constants/mainDataTimePicker.d.ts +14 -0
- package/dist/umd/esm/components/GTimePicker/contexts/DateTimePickerProvider.d.ts +15 -0
- package/dist/umd/esm/components/GTimePicker/contexts/index.d.ts +1 -0
- package/dist/umd/esm/components/GTimePicker/helpers/date-range-info.d.ts +16 -0
- package/dist/umd/esm/components/GTimePicker/helpers/index.d.ts +4 -0
- package/dist/umd/esm/components/GTimePicker/helpers/parse-date.d.ts +24 -0
- package/dist/umd/esm/components/GTimePicker/helpers/time-picker.d.ts +76 -0
- package/dist/umd/esm/components/GTimePicker/helpers/version.d.ts +2 -0
- package/dist/umd/esm/components/GTimePicker/hooks/index.d.ts +3 -0
- package/dist/umd/esm/components/GTimePicker/hooks/useCompareDateTimePicker.d.ts +25 -0
- package/dist/umd/esm/components/GTimePicker/hooks/useDateTimeFilter.d.ts +18 -0
- package/dist/umd/esm/components/GTimePicker/hooks/useDateTimePicker.d.ts +30 -0
- package/dist/umd/esm/components/GTimePicker/hooks/useVersionDateTimeFilters.d.ts +9 -0
- package/dist/umd/esm/components/GTimePicker/index.d.ts +7 -0
- package/dist/umd/esm/components/GTimePicker/types/index.d.ts +38 -0
- package/dist/umd/esm/components/index.d.ts +1 -0
- package/dist/umd/esm/core/gemxql/helpers/getTimeDimension.d.ts +1 -1
- package/dist/umd/esm/core/gemxql/index.d.ts +0 -2
- package/dist/umd/esm/core/gemxql/types/date-filter.d.ts +1 -1
- package/dist/umd/esm/index.d.ts +1 -4
- package/dist/umd/esm/shared/charts/components/GPolarisViz/utilities/getFontSize.d.ts +1 -1
- package/dist/umd/esm/shared/components/GTimePicker/GTimePicker.d.ts +1 -1
- package/dist/umd/esm/shared/components/GTimePicker/helpers/parse-date.d.ts +2 -2
- package/dist/umd/esm/shared/components/GTimePicker/hooks/useCompareDateTimePicker.d.ts +1 -2
- package/dist/umd/esm/shared/components/GTimePicker/types/index.d.ts +1 -1
- package/dist/umd/esm/shared/components/index.d.ts +0 -1
- package/dist/umd/esm/utils/dayjs.d.ts +10 -0
- package/dist/umd/esm/utils/index.d.ts +1 -0
- package/dist/umd/gemxql.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
package/dist/umd/gemxql.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tanstack/react-query"),require("dayjs"),require("dayjs/plugin/quarterOfYear.js"),require("dayjs/plugin/timezone.js"),require("dayjs/plugin/utc.js"),require("react")):"function"==typeof define&&define.amd?define(["exports","@tanstack/react-query","dayjs","dayjs/plugin/quarterOfYear.js","dayjs/plugin/timezone.js","dayjs/plugin/utc.js","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GemAnalytics={},e.reactQuery,e.dayjs,e.quarterOfYear,e.timezone,e.utc,e.React)}(this,function(e,t,r,i,a,n,o){"use strict";const s="\n fragment ColumnSelect on Column {\n dataType\n displayName\n name\n}\n ",l="\n fragment TableDataSelect on TableData {\n columns {\n ...ColumnSelect\n }\n rows\n}\n ",E="\n fragment GemXQLResultSelect on GemxQLResult {\n tableData {\n ...TableDataSelect\n }\n}\n ",u=`\n query GemxQL($input: String!) {\n gemxQLQuery(query: $input) {\n ...GemXQLResultSelect\n }\n}\n ${E}\n${l}\n${s}`,c=(e,r,i)=>t.useQuery({queryKey:["GemXQlCustom",e],queryFn:r(u,e),...i});c.getKey=e=>["GemXQlCustom",e];const m=({name:e,variables:r,fetcher:i},a)=>{const n=u.replace(/query\s+GemxQL\b/,`query ${e}`);return t.useQuery({queryKey:[e,r],queryFn:i(n,r),retry:0,...a})};m.getKey=(e,t)=>[e,t];const d="None",p="___totals",A="comparison___",T="___previous_period",R=`${T}${p}`,O="is",f="is_one_of";var y,I,S,D,F,M,_,g,N,C,P,v,h,G,Y,$,L;e.EAnalyticDataType=void 0,(y=e.EAnalyticDataType||(e.EAnalyticDataType={})).DATE="DATE",y.ARRAY="ARRAY",y.OBJECT="OBJECT",y.STRING="STRING",y.INTEGER="INTEGER",y.CURRENCY="CURRENCY",y.PERCENT="PERCENT",y.DURATION="DURATION",y.MONTH="MONTH_TIMESTAMP",y.QUARTER="QUARTER_TIMESTAMP",y.DAY="DAY_TIMESTAMP",y.WEEK="WEEK_TIMESTAMP",y.YEAR="YEAR_TIMESTAMP",y.HOUR="HOUR_TIMESTAMP",e.EAnalyticColumnKey=void 0,(I=e.EAnalyticColumnKey||(e.EAnalyticColumnKey={})).CAMPAIGNS="experiments",I.VISITOR_ITEMS="visitor_items",I.DEVICE_ITEMS="device_items",I.TRAFFIC_SOURCE_ITEMS="traffic_source_items",e.EAnalyticMode=void 0,(S=e.EAnalyticMode||(e.EAnalyticMode={})).ALL_SESSION="ALL_SESSION",S.FIRST_SESSION="FIRST_SESSION",S.PAGE_ONLY="PAGE_ONLY",e.EAnalyticSource=void 0,(D=e.EAnalyticSource||(e.EAnalyticSource={})).SESSIONS="sessions",D.SALES="sales",e.EVisitorType=void 0,(F=e.EVisitorType||(e.EVisitorType={})).NEW="new",F.RETURNING="returning",e.EDeviceType=void 0,(M=e.EDeviceType||(e.EDeviceType={})).DESKTOP="desktop",M.MOBILE="mobile",M.TABLET="tablet",e.ETrafficSourceType=void 0,(_=e.ETrafficSourceType||(e.ETrafficSourceType={})).DIRECT="direct",_.EMAIL="email",_.REFERRAL="referral",_.ORGANIC_SOCIAL="organic-social",_.ORGANIC_SEARCH="organic-search",_.PAID_SOCIAL="paid-social",_.PAID_SEARCH="paid-search",_.SMS="sms",e.EComparisonOperator=void 0,(g=e.EComparisonOperator||(e.EComparisonOperator={})).EQ="=",g.IN="IN",g.LIKE="LIKE",e.EGroupOperator=void 0,(N=e.EGroupOperator||(e.EGroupOperator={})).OR="OR",N.AND="AND",e.EFilterField=void 0,(C=e.EFilterField||(e.EFilterField={})).DEVICE="device",C.DEVICES="devices",C.VISITOR="visitor_type",C.VISITORS="visitor_types",C.TRAFFIC_SOURCE="traffic_source",C.TRAFFIC_SOURCES="traffic_sources",C.VERSION="version",C.VERSIONS="versions",C.SINGLE_PAGE="page_path",C.LIST_PAGE="page_paths",C.GROUP_CAMPAIGN_ITEM="group_campaign_item",C.GROUP_CAMPAIGN_ITEMS="group_campaign_items",C.SINGLE_CAMPAIGN="experiment_id",C.GROUP_CAMPAIGN="experiment_group_id",C.CAMPAIGN_VERSION_ID="version_id",C.GROUP_CAMPAIGN_VERSION_ID="group_version_id",e.EOperatorField=void 0,(P=e.EOperatorField||(e.EOperatorField={})).DEVICE_OPERATOR="deviceOperator",P.VISITOR_OPERATOR="visitorOperator",P.TRAFFIC_SOURCE_OPERATOR="trafficSourceOperator",P.VERSION_OPERATOR="versionOperator",P.PAGE_OPERATOR="pageOperator",P.CAMPAIGN_ITEM_OPERATOR="campaignItemOperator",e.EGroupWithClause=void 0,(v=e.EGroupWithClause||(e.EGroupWithClause={})).NONE="",v.TOTALS="TOTALS",v.ALL="WITH GROUP_TOTALS, TOTALS",e.EOrderDirectionType=void 0,(h=e.EOrderDirectionType||(e.EOrderDirectionType={})).ASC="ASC",h.DESC="DESC",e.EPageMetric=void 0,(G=e.EPageMetric||(e.EPageMetric={})).PAGE_ITEMS="page_items",G.PAGE_PATHS="page_paths",e.EPageDimension=void 0,(e.EPageDimension||(e.EPageDimension={})).PAGE_PATH="page_path",e.EPageField=void 0,(Y=e.EPageField||(e.EPageField={})).SHOPIFY_PAGE_ID="shopify_page_id",Y.LOCATION_PATH="location_path",Y.PAGE_TYPE="page_type",Y.PAGE_TITLE="page_title",Y.PAGE_PATH="page_path",Y.TEMPLATE_SUFFIX="template_suffix",e.ERowReaderMode=void 0,($=e.ERowReaderMode||(e.ERowReaderMode={})).DEFAULT="DEFAULT",$.COMPARISON="COMPARISON",$.TOTALS="TOTALS",$.COMPARISON_TOTALS="COMPARISON_TOTALS",e.ETimeDimension=void 0,(L=e.ETimeDimension||(e.ETimeDimension={})).HOUR="hour",L.DAY="day",L.WEEK="week",L.MONTH="month",L.QUARTER="quarter",L.YEAR="year";const b={[e.ERowReaderMode.DEFAULT]:{prefix:"",suffix:""},[e.ERowReaderMode.COMPARISON]:{prefix:A,suffix:T},[e.ERowReaderMode.TOTALS]:{prefix:"",suffix:p},[e.ERowReaderMode.COMPARISON_TOTALS]:{prefix:A,suffix:R}},U="YYYY-MM-DDTHH:mm:ss",Q=["MODE","FROM","SHOW","GROUP BY","TIMESERIES","SINCE","DURING","TIMEZONE","WHERE","ORDER BY","LIMIT","OFFSET"],x=Q.join("|"),H=1e3,V=e.EGroupOperator.OR,j=(e,t=V)=>e.length?1===e.length?e[0]??"":`(${e.join(` ${t} `)})`:"",W=t=>{switch(t.operator){case e.EComparisonOperator.EQ:return(({fields:e,value:t,groupOperator:r})=>e.length?j(e.map(e=>`${e} = ${t}`),r):"")(t);case e.EComparisonOperator.IN:return(({fields:e,values:t,groupOperator:r})=>e.length&&t.length?j(e.map(e=>`${e} IN (${t.join(", ")})`),r):"")(t);case e.EComparisonOperator.LIKE:return(({fields:e,value:t,groupOperator:r})=>{const i=t.trim();return i&&e.length?j(e.map(e=>`${e} LIKE '%${i}%'`),r):""})(t)}},B=e=>e?.length?e.map(W).filter(Boolean):[],K=[{operator:e.EOperatorField.DEVICE_OPERATOR,singleField:e.EFilterField.DEVICE,multiField:e.EFilterField.DEVICES,fieldName:e.EFilterField.DEVICE},{operator:e.EOperatorField.VISITOR_OPERATOR,singleField:e.EFilterField.VISITOR,multiField:e.EFilterField.VISITORS,fieldName:e.EFilterField.VISITOR},{operator:e.EOperatorField.TRAFFIC_SOURCE_OPERATOR,singleField:e.EFilterField.TRAFFIC_SOURCE,multiField:e.EFilterField.TRAFFIC_SOURCES,fieldName:e.EFilterField.TRAFFIC_SOURCE},{operator:e.EOperatorField.VERSION_OPERATOR,singleField:e.EFilterField.VERSION,multiField:e.EFilterField.VERSIONS,fieldName:e.EFilterField.VERSION},{operator:e.EOperatorField.PAGE_OPERATOR,singleField:e.EFilterField.SINGLE_PAGE,multiField:e.EFilterField.LIST_PAGE,fieldName:e.EFilterField.SINGLE_PAGE},{operator:e.EOperatorField.CAMPAIGN_ITEM_OPERATOR,singleField:e.EFilterField.GROUP_CAMPAIGN_ITEM,multiField:e.EFilterField.GROUP_CAMPAIGN_ITEMS,condition:e.EFilterField.GROUP_CAMPAIGN,fieldName:e.EFilterField.SINGLE_CAMPAIGN},{operatorVal:O,singleField:e.EFilterField.SINGLE_CAMPAIGN,multiField:e.EFilterField.GROUP_CAMPAIGN}],w=(e,t)=>{const r=[],i=Object.keys(e).length>0,a=!!t&&Object.keys(t).length>0;if(!i&&!a)return r;const n=(e=>e?Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e).map(([e,t])=>[e,Array.isArray(t)?`${e} IN (${t.join(", ")})`:`${e} = ${t}`])):{})(t);return K.forEach(({operator:t,operatorVal:i,singleField:a,multiField:o,condition:s,fieldName:l})=>{if(n[a])return void r.push(n[a]);const E=t?e[t]:i;let u=e[a];const c=e[o],m=s&&e[s];if(s&&!m)return;const d=l??(u?a:o);i&&!u&&(u=e[o]);const p=(e=>{const{operatorValue:t,singleValue:r,multiValue:i,fieldName:a}=e;return t===O&&r?`${a} = ${r}`:t===f&&Array.isArray(i)&&i.length>0?`${a} IN (${i.join(", ")})`:""})({operatorValue:E,singleValue:Array.isArray(u)?void 0:u,multiValue:Array.isArray(c)?c:void 0,fieldName:d});p&&r.push(p)}),r},q=e=>{const t=[];return e?(Object.entries(e).forEach(([e,r])=>{r&&t.push(`${e} = ${r}`)}),t):t},z=(e,t)=>{if(!e||0===t.length)return[];const r=t.find(t=>e[t]);return r?[r]:[]},X=({filters:e,overrideFilters:t,versionIds:r,extraConditions:i})=>{const a=[...w(e,t),...q(r),...B(i)];return a.length>0?`WHERE ${a.join(" AND ")}`:""},k=e=>{const t=e.match(new RegExp(`\\bWHERE\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b|$)`,"i"));if(!t)return{filters:{}};const r=(t[1]??"").trim().split(/\s+AND\s+/i),i={},a={};return r.forEach(e=>{const t=e.trim(),r=t.match(/^(\S+)\s+IN\s+\((.+)\)$/i);if(r){const e=r[1]??"",t=(r[2]??"").split(",").map(e=>e.trim()),a=K.find(t=>t.fieldName===e||t.multiField===e);return void(a?.operator&&(i[a.multiField]=t,i[a.operator]=f))}const n=t.match(/^(\S+)\s+=\s+(.+)$/);if(n){const e=n[1]??"",t=n[2]??"",r=K.find(t=>t.fieldName===e||t.singleField===e);r?(i[r.singleField]=t,r.operator&&(i[r.operator]=O)):e&&(a[e]=t)}}),{filters:i,versionIds:Object.keys(a).length>0?a:void 0}},J=e=>`FROM ${e.join(", ")}`,Z=e=>{const t=e.match(new RegExp(`\\bFROM\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b)`,"i"));return t?(t[1]??"").split(",").map(e=>e.trim()).filter(Boolean):[]},ee=(t,r=e.EGroupWithClause.ALL)=>0===t.length?"":`GROUP BY ${t.join(", ")} ${r}`,te=t=>{const r=t.match(new RegExp(`\\bGROUP BY\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b)`,"i"));if(!r)return{dimensions:[]};const i=(r[1]??"").trim(),a=i.toUpperCase().indexOf(" WITH ");return-1===a?{dimensions:i.split(",").map(e=>e.trim()).filter(Boolean),groupWithClause:e.EGroupWithClause.NONE}:{dimensions:i.slice(0,a).split(",").map(e=>e.trim()).filter(Boolean),groupWithClause:i.slice(a+1).trim()}},re=e=>e?`LIMIT ${e}`:"",ie=e=>{const t=e.match(/\bLIMIT\s+(\d+)/i);return t?parseInt(t[1]??"0",10):void 0},ae=e=>`MODE ${e}`,ne=e=>{const t=e.match(/\bMODE\s+(\S+)/i);return t?.[1]},oe=e=>!e||e<0?"":`OFFSET ${e}`,se=e=>{const t=e.match(/\bOFFSET\s+(\d+)/i);return t?parseInt(t[1]??"0",10):void 0},le=(e,t)=>{if(!e)return"";const r=Object.values(e).filter(e=>t?.includes(e.field)).map(e=>`${e.field} ${e.direction}`).join(", ");return r?`ORDER BY ${r}`:""},Ee=e=>{const t=e.match(new RegExp(`\\bORDER BY\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b|$)`,"i"));if(!t)return;const r={};return(t[1]??"").split(",").forEach(e=>{const t=e.trim().split(/\s+/);if(2===t.length){const e=t[0]??"",i=t[1]??"";e&&(r[e]={field:e,direction:i})}}),Object.keys(r).length>0?r:void 0},ue=e=>`SHOW ${e.join(", ")}`,ce=e=>{const t=e.match(new RegExp(`\\bSHOW\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b)`,"i"));return t?(t[1]??"").split(",").map(e=>e.trim()).filter(Boolean):[]};r.extend(n),r.extend(a),r.extend(i);let me="UTC";const de="YYYY-MM-DD HH:mm:ss";function pe(){return me}const Ae=e=>e?r(e).tz(me):r().tz(me),Te=e=>"string"==typeof e?Ae(e):e,Re=(e,t=!1)=>t&&(e=>0===e.hour()&&0===e.minute())(e)?e.endOf("day").format(U):e.format(U),Oe=e=>{const t=Te(e.startDate),r=Te(e.endDate);return t.isSame(r)?{dateGTE:Re(t),dateLTE:(i=r,Re(i?Ae(i).endOf("day"):Ae().endOf("day")))}:{dateGTE:Re(t),dateLTE:Re(r,!0)};var i},fe=e=>{const{dateRange:t,compareDateRange:r,overrideFilters:i,timeDimension:a}=e,n=a?i?.[a]:void 0;if(a&&n)return`DURING (${n}, ${a})`;if(!t)return"";const{dateGTE:o,dateLTE:s}=Oe(t),{dateGTE:l,dateLTE:E}=r?Oe(r):{};return`SINCE ${o} UNTIL ${s} ${r?`COMPARE TO ${l} UNTIL ${E}`:""}`},ye=e=>{const t=e.match(/\bDURING\s+\(([^,]+),\s*([^)]+)\)/i);if(t){const e=t[1]??"",r=t[2]??"";return{timeDimension:r.trim(),overrideFilters:{[r.trim()]:e.trim()}}}const r=e.match(/\bSINCE\s+(\S+)\s+UNTIL\s+(\S+)/i);if(!r)return{};const i={startDate:Ae(r[1]??""),endDate:Ae(r[2]??"")},a=e.match(/\bCOMPARE TO\s+(\S+)\s+UNTIL\s+(\S+)/i);return{dateRange:i,compareDateRange:a?{startDate:Ae(a[1]??""),endDate:Ae(a[2]??"")}:void 0}},Ie=e=>e?`TIMESERIES ${e}`:"",Se=e=>{const t=e.match(/\bTIMESERIES\s+(\S+)/i);return t?.[1]},De=e=>{const t=e??pe();return t?`TIMEZONE ${t}`:""},Fe=e=>{const t=e.match(/\bTIMEZONE\s+(\S+)/i);return t?.[1]};function Me(e){if("string"!=typeof e)return!1;const t=e.trim();return/^MODE\b[\s\S]*\bFROM\b[\s\S]*\bSHOW\b[\s\S]*$/.test(t)}const _e=e=>e?.gemxQLQuery?.tableData?.columns??[],ge=/\.0+$/,Ne=(e,t=2)=>(e=>`${e}`.replace(ge,""))(e.toFixed(t)),Ce=(e,t,r=2)=>{const i=((e,t,r=2)=>{if("number"!=typeof e||!t)return;return 0===e?0:parseFloat(Ne(e/t*100,r))})(e,t,r);if("number"==typeof i)return(e=>e>0&&e<.005)(i)?"~0%":`${i}%`};var Pe;function ve(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}e.AnalyticInterval=void 0,(Pe=e.AnalyticInterval||(e.AnalyticInterval={})).DAY="DAY",Pe.HOUR="HOUR",Pe.MONTH="MONTH",Pe.QUARTER="QUARTER",Pe.WEEK="WEEK",Pe.YEAR="YEAR";const he=60,Ge=3600,Ye=e=>{let t=e;Number.isFinite(e)&&null!=e||(t=0);const r=Ne(t);if(t>=Ge){return`${Math.floor(t/Ge)}h ${Math.floor(t%Ge/he)}m ${Math.floor(t%he)}s`}if(t>=he){return`${Math.floor(t/he)}m ${Math.floor(t%he)}s`}return`${r}s`},$e=(t,r,i)=>{if(!t)return"";const a=i?.isExpandDetail?{formatHouse:"MMM D, h:mm A",formatDay:"MMM D, YYYY",formatMonth:"MMM YYYY",formatYear:"MMM YYYY"}:{formatHouse:"h A",formatDay:"MMM D",formatMonth:"MMM YYYY",formatYear:"YYYY"};switch(r){case e.AnalyticInterval.HOUR:return Ae(t).format(a.formatHouse);case e.AnalyticInterval.DAY:case e.AnalyticInterval.WEEK:return Ae(t).format(a.formatDay);case e.AnalyticInterval.MONTH:return Ae(t).format(a.formatMonth);case e.AnalyticInterval.QUARTER:{const e=Ae(t);return`Q${e.quarter()} ${e.format("YYYY")}`}case e.AnalyticInterval.YEAR:return Ae(t).format(a.formatYear)}return Ae(t).format(a.formatMonth)},Le=e=>{if(!e)return"None";const t=Ae(e),r=Ae(),i=Ae().subtract(1,"day"),a=t.format("YYYY-MM-DD")===r.format("YYYY-MM-DD"),n=t.format("YYYY-MM-DD")===i.format("YYYY-MM-DD");if(a)return`Today at ${t.format("HH:mm")}`;if(n)return`Yesterday at ${t.format("HH:mm")}`;const o=r.diff(t,"day");return o>=0&&o<7?`${t.format("dddd")} at ${t.format("HH:mm")}`:`${t.format("MMM D")} at ${t.format("hh:mm a")}`},be=({value:t,formatter:r,getTextPrice:i,name:a})=>{if(null!==t&&("object"==typeof t||Array.isArray(t)))return t;switch(r){case e.EAnalyticDataType.INTEGER:return ve((t??0).toString());case e.EAnalyticDataType.CURRENCY:return i?i(t,!1):`${t??0}`;case e.EAnalyticDataType.DATE:return Le(t);case e.EAnalyticDataType.PERCENT:return"number"!=typeof t?Ce(0,1,2)??"":Ce(t/100,1,2)??"";case e.EAnalyticDataType.DURATION:return Ye(Number(t));case e.EAnalyticDataType.STRING:{const r=a===e.EAnalyticColumnKey.CAMPAIGNS?"":d;return t??r}case e.EAnalyticDataType.DAY:return $e(t,e.AnalyticInterval.DAY,{isExpandDetail:!0});case e.EAnalyticDataType.HOUR:return $e(t,e.AnalyticInterval.HOUR,{isExpandDetail:!0});case e.EAnalyticDataType.MONTH:return $e(t,e.AnalyticInterval.MONTH,{isExpandDetail:!0});case e.EAnalyticDataType.YEAR:return $e(t,e.AnalyticInterval.YEAR);case e.EAnalyticDataType.WEEK:return $e(t,e.AnalyticInterval.WEEK,{isExpandDetail:!0});case e.EAnalyticDataType.QUARTER:return $e(t,e.AnalyticInterval.QUARTER,{isExpandDetail:!0});case e.EAnalyticDataType.OBJECT:case e.EAnalyticDataType.ARRAY:return t;default:return`${t}`}},Ue=e=>{const t=e?.sessions;return"number"==typeof t&&t>0},Qe=e=>{if(e)return"string"==typeof e?JSON.parse(e):e},xe=e=>{try{const t=Qe(e);return t&&"object"==typeof t?t:null}catch{return null}},He=e=>{try{const t=Qe(e);if(!Array.isArray(t))return;return t}catch{return}},Ve=(e,t)=>{const r=e?.[t];return"number"==typeof r?r:0};var je;e.GPaginationDirection=void 0,(je=e.GPaginationDirection||(e.GPaginationDirection={})).NEXT="NEXT",je.PREV="PREV";e.CLAUSE_KEYWORDS=Q,e.CLAUSE_KEYWORD_BOUNDARY=x,e.COMPARE_PREFIX=A,e.COMPARE_SUFFIX=T,e.COMPARE_TOTALS_SUFFIX=R,e.ColumnSelectFragmentDoc=s,e.DATE_QUERY_FORMAT=U,e.DEFAULT_QUERY_LIMIT=H,e.GemXqlResultSelectFragmentDoc=E,e.GemxQlDocument=u,e.NONE_VALUE=d,e.OPERATOR_IS=O,e.OPERATOR_IS_ONE_OF=f,e.PLACEHOLDER_VALUE="-",e.ROW_READER_MODE_CONFIG=b,e.TOTALS_SUFFIX=p,e.TableDataSelectFragmentDoc=l,e.buildConditionQuery=X,e.buildExtraCondition=W,e.buildExtraConditions=B,e.buildFromQuery=J,e.buildGemXQlQuery=e=>{const{mode:t,metrics:r,dimensions:i,dateRange:a,compareDateRange:n,filters:o,overrideFilters:s,versionIds:l,extraConditions:E,orderBy:u,sources:c,timeDimension:m,groupWithClause:d,timezone:p,limit:A=H,offset:T,extraOrderByFields:R}=e,O=[...i,...z(u,r),...R??[]],f=[ae(t),J(c),ue(r),ee(i,d),Ie(m),fe({dateRange:a,compareDateRange:n,timeDimension:m,overrideFilters:s}),De(p),X({filters:o,overrideFilters:s,versionIds:l,extraConditions:E}),le(u,O),re(A),oe(T)].filter(Boolean).join(" ");return Me(f)?f:""},e.buildGroupQuery=ee,e.buildLimitQuery=re,e.buildModeQuery=ae,e.buildOffsetQuery=oe,e.buildOrderByQuery=le,e.buildShowQuery=ue,e.buildTimeQuery=fe,e.buildTimeSeriesQuery=Ie,e.buildTimezoneQuery=De,e.buildVersionIdCondition=q,e.convertDateToTz=e=>e?r.tz(r(e).format(de),me):r.tz(r().format(de),me),e.createNumericRowReader=(t,r=e.ERowReaderMode.DEFAULT)=>e=>{const{prefix:i,suffix:a}=b[r],n=t[`${i}${e}${a}`];if("number"==typeof n)return n;if("string"==typeof n){const e=parseFloat(n);return isNaN(e)?0:e}return 0},e.dayjsTz=Ae,e.dayjsTzToLocalTZ=e=>r(e?Ae(e).format(de):Ae().format(de)),e.extractColumnTypes=e=>{const t=_e(e),r={};for(const e of t)e?.name&&(r[e.name]=e.dataType);return r},e.extractQueryColumns=_e,e.extractQueryRows=e=>e?.gemxQLQuery?.tableData?.rows??[],e.filterConfigs=K,e.formatAnalyticData=be,e.formatAnalyticDate=Le,e.generateFilterConditions=w,e.getComparisonKey=e=>`${A}${e}${T}`,e.getComparisonTotalsKey=e=>`${A}${e}${T}${p}`,e.getFirstMetricInOrderBy=z,e.getFormattedByInterval=$e,e.getInitialTimezone=pe,e.getTimeDimensionByDate=(t,r)=>{const i=r.diff(t,"day");return i<=3?e.ETimeDimension.HOUR:i<=93?e.ETimeDimension.DAY:e.ETimeDimension.MONTH},e.getTimeDurationLabel=Ye,e.getTotalsKey=e=>`${e}${p}`,e.hasMetricData=Ue,e.isValidQueryInput=Me,e.numberWithCommas=ve,e.parseBreakdownItems=e=>He(e)?.map(e=>({...e,total:Number(e.total)})),e.parseConditionQuery=k,e.parseFromQuery=Z,e.parseGemXQlQuery=e=>{const{dateRange:t,compareDateRange:r,timeDimension:i,overrideFilters:a}=ye(e),n=i??Se(e),{dimensions:o,groupWithClause:s}=te(e),{filters:l,versionIds:E}=k(e);return{mode:ne(e),sources:Z(e),metrics:ce(e),dimensions:o,groupWithClause:s,timeDimension:n,dateRange:t,compareDateRange:r,overrideFilters:a,filters:l,versionIds:E,timezone:Fe(e),orderBy:Ee(e),limit:ie(e),offset:se(e)}},e.parseGroupQuery=te,e.parseJsonArray=He,e.parseJsonObject=xe,e.parseLimitQuery=ie,e.parseModeQuery=ne,e.parseOffsetQuery=se,e.parseOrderByQuery=Ee,e.parsePageItems=e=>xe(e),e.parseShowQuery=ce,e.parseTimeQuery=ye,e.parseTimeSeriesQuery=Se,e.parseTimezoneQuery=Fe,e.readNumeric=Ve,e.setTz=function(e){me=e,r.tz.setDefault(e)},e.useAnalyticData=e=>{const t=({value:t,formatter:r,name:i})=>be({value:t,formatter:r,getTextPrice:e,name:i});return{formatData:t,computeMetric:({metric:e,previousMetric:r,metricKey:i,formatter:a})=>{if(!Ue(e))return{value:0,change:"-"};const n=Ve(e,i),o=Ve(r,i),s=t({value:n,formatter:a,name:i});if(0===n&&0!==o)return{value:s,change:-100};if(0===o)return{value:s,change:"-"};return{value:s,change:(n-o)/o*100}}}},e.useCustomGemXQlQuery=c,e.useGemXQlPagination=({resetKey:t,itemsPerPage:r})=>{const[i,a]=o.useState(1),n=o.useRef(),s=i>1&&void 0!==n.current&&n.current!==t?1:i,l=(s-1)*r,E=o.useCallback(t=>r=>{a(i=>{const a=r===e.GPaginationDirection.NEXT?i+1:i-1;return Math.min(Math.max(a,1),t)})},[]);o.useEffect(()=>{n.current!==t&&(n.current=t,a(1))},[t]);const u=o.useCallback(({totalRecords:e,isLoading:t})=>{const i=Math.max(1,Math.ceil(e/r));return{currentPage:s,totalPages:i,loading:t,handlePageChange:E(i)}},[s,r,E]);return{currentPage:s,offset:l,buildPagination:u}},e.useGemxQlNamedQuery=m});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@tanstack/react-query"),require("dayjs"),require("dayjs/plugin/quarterOfYear.js"),require("dayjs/plugin/timezone.js"),require("dayjs/plugin/utc.js"),require("react")):"function"==typeof define&&define.amd?define(["exports","@tanstack/react-query","dayjs","dayjs/plugin/quarterOfYear.js","dayjs/plugin/timezone.js","dayjs/plugin/utc.js","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GemAnalytics={},e.reactQuery,e.dayjs,e.quarterOfYear,e.timezone,e.utc,e.React)}(this,function(e,t,r,i,a,n,o){"use strict";const s="\n fragment ColumnSelect on Column {\n dataType\n displayName\n name\n}\n ",l="\n fragment TableDataSelect on TableData {\n columns {\n ...ColumnSelect\n }\n rows\n}\n ",E="\n fragment GemXQLResultSelect on GemxQLResult {\n tableData {\n ...TableDataSelect\n }\n}\n ",u=`\n query GemxQL($input: String!) {\n gemxQLQuery(query: $input) {\n ...GemXQLResultSelect\n }\n}\n ${E}\n${l}\n${s}`,c=(e,r,i)=>t.useQuery({queryKey:["GemXQlCustom",e],queryFn:r(u,e),...i});c.getKey=e=>["GemXQlCustom",e];const d=({name:e,variables:r,fetcher:i},a)=>{const n=u.replace(/query\s+GemxQL\b/,`query ${e}`);return t.useQuery({queryKey:[e,r],queryFn:i(n,r),retry:0,...a})};d.getKey=(e,t)=>[e,t];const m="None",p="___totals",A="comparison___",R="___previous_period",T=`${R}${p}`,O="is",f="is_one_of";var y,I,S,D,F,M,_,g,N,C,P,h,v,G,Y,$,L;e.EAnalyticDataType=void 0,(y=e.EAnalyticDataType||(e.EAnalyticDataType={})).DATE="DATE",y.ARRAY="ARRAY",y.OBJECT="OBJECT",y.STRING="STRING",y.INTEGER="INTEGER",y.CURRENCY="CURRENCY",y.PERCENT="PERCENT",y.DURATION="DURATION",y.MONTH="MONTH_TIMESTAMP",y.QUARTER="QUARTER_TIMESTAMP",y.DAY="DAY_TIMESTAMP",y.WEEK="WEEK_TIMESTAMP",y.YEAR="YEAR_TIMESTAMP",y.HOUR="HOUR_TIMESTAMP",e.EAnalyticColumnKey=void 0,(I=e.EAnalyticColumnKey||(e.EAnalyticColumnKey={})).CAMPAIGNS="experiments",I.VISITOR_ITEMS="visitor_items",I.DEVICE_ITEMS="device_items",I.TRAFFIC_SOURCE_ITEMS="traffic_source_items",e.EAnalyticMode=void 0,(S=e.EAnalyticMode||(e.EAnalyticMode={})).ALL_SESSION="ALL_SESSION",S.FIRST_SESSION="FIRST_SESSION",S.PAGE_ONLY="PAGE_ONLY",e.EAnalyticSource=void 0,(D=e.EAnalyticSource||(e.EAnalyticSource={})).SESSIONS="sessions",D.SALES="sales",e.EVisitorType=void 0,(F=e.EVisitorType||(e.EVisitorType={})).NEW="new",F.RETURNING="returning",e.EDeviceType=void 0,(M=e.EDeviceType||(e.EDeviceType={})).DESKTOP="desktop",M.MOBILE="mobile",M.TABLET="tablet",e.ETrafficSourceType=void 0,(_=e.ETrafficSourceType||(e.ETrafficSourceType={})).DIRECT="direct",_.EMAIL="email",_.REFERRAL="referral",_.ORGANIC_SOCIAL="organic-social",_.ORGANIC_SEARCH="organic-search",_.PAID_SOCIAL="paid-social",_.PAID_SEARCH="paid-search",_.SMS="sms",e.EComparisonOperator=void 0,(g=e.EComparisonOperator||(e.EComparisonOperator={})).EQ="=",g.IN="IN",g.LIKE="LIKE",e.EGroupOperator=void 0,(N=e.EGroupOperator||(e.EGroupOperator={})).OR="OR",N.AND="AND",e.EFilterField=void 0,(C=e.EFilterField||(e.EFilterField={})).DEVICE="device",C.DEVICES="devices",C.VISITOR="visitor_type",C.VISITORS="visitor_types",C.TRAFFIC_SOURCE="traffic_source",C.TRAFFIC_SOURCES="traffic_sources",C.VERSION="version",C.VERSIONS="versions",C.SINGLE_PAGE="page_path",C.LIST_PAGE="page_paths",C.GROUP_CAMPAIGN_ITEM="group_campaign_item",C.GROUP_CAMPAIGN_ITEMS="group_campaign_items",C.SINGLE_CAMPAIGN="experiment_id",C.GROUP_CAMPAIGN="experiment_group_id",C.CAMPAIGN_VERSION_ID="version_id",C.GROUP_CAMPAIGN_VERSION_ID="group_version_id",e.EOperatorField=void 0,(P=e.EOperatorField||(e.EOperatorField={})).DEVICE_OPERATOR="deviceOperator",P.VISITOR_OPERATOR="visitorOperator",P.TRAFFIC_SOURCE_OPERATOR="trafficSourceOperator",P.VERSION_OPERATOR="versionOperator",P.PAGE_OPERATOR="pageOperator",P.CAMPAIGN_ITEM_OPERATOR="campaignItemOperator",e.EGroupWithClause=void 0,(h=e.EGroupWithClause||(e.EGroupWithClause={})).NONE="",h.TOTALS="TOTALS",h.ALL="WITH GROUP_TOTALS, TOTALS",e.EOrderDirectionType=void 0,(v=e.EOrderDirectionType||(e.EOrderDirectionType={})).ASC="ASC",v.DESC="DESC",e.EPageMetric=void 0,(G=e.EPageMetric||(e.EPageMetric={})).PAGE_ITEMS="page_items",G.PAGE_PATHS="page_paths",e.EPageDimension=void 0,(e.EPageDimension||(e.EPageDimension={})).PAGE_PATH="page_path",e.EPageField=void 0,(Y=e.EPageField||(e.EPageField={})).SHOPIFY_PAGE_ID="shopify_page_id",Y.LOCATION_PATH="location_path",Y.PAGE_TYPE="page_type",Y.PAGE_TITLE="page_title",Y.PAGE_PATH="page_path",Y.TEMPLATE_SUFFIX="template_suffix",e.ERowReaderMode=void 0,($=e.ERowReaderMode||(e.ERowReaderMode={})).DEFAULT="DEFAULT",$.COMPARISON="COMPARISON",$.TOTALS="TOTALS",$.COMPARISON_TOTALS="COMPARISON_TOTALS",e.ETimeDimension=void 0,(L=e.ETimeDimension||(e.ETimeDimension={})).HOUR="hour",L.DAY="day",L.WEEK="week",L.MONTH="month",L.QUARTER="quarter",L.YEAR="year";const b={[e.ERowReaderMode.DEFAULT]:{prefix:"",suffix:""},[e.ERowReaderMode.COMPARISON]:{prefix:A,suffix:R},[e.ERowReaderMode.TOTALS]:{prefix:"",suffix:p},[e.ERowReaderMode.COMPARISON_TOTALS]:{prefix:A,suffix:T}},U="YYYY-MM-DDTHH:mm:ss",Q=["MODE","FROM","SHOW","GROUP BY","TIMESERIES","SINCE","DURING","TIMEZONE","WHERE","ORDER BY","LIMIT","OFFSET"],x=Q.join("|"),H=1e3,V=e.EGroupOperator.OR,j=(e,t=V)=>e.length?1===e.length?e[0]??"":`(${e.join(` ${t} `)})`:"",W=t=>{switch(t.operator){case e.EComparisonOperator.EQ:return(({fields:e,value:t,groupOperator:r})=>e.length?j(e.map(e=>`${e} = ${t}`),r):"")(t);case e.EComparisonOperator.IN:return(({fields:e,values:t,groupOperator:r})=>e.length&&t.length?j(e.map(e=>`${e} IN (${t.join(", ")})`),r):"")(t);case e.EComparisonOperator.LIKE:return(({fields:e,value:t,groupOperator:r})=>{const i=t.trim();return i&&e.length?j(e.map(e=>`${e} LIKE '%${i}%'`),r):""})(t)}},B=e=>e?.length?e.map(W).filter(Boolean):[],K=[{operator:e.EOperatorField.DEVICE_OPERATOR,singleField:e.EFilterField.DEVICE,multiField:e.EFilterField.DEVICES,fieldName:e.EFilterField.DEVICE},{operator:e.EOperatorField.VISITOR_OPERATOR,singleField:e.EFilterField.VISITOR,multiField:e.EFilterField.VISITORS,fieldName:e.EFilterField.VISITOR},{operator:e.EOperatorField.TRAFFIC_SOURCE_OPERATOR,singleField:e.EFilterField.TRAFFIC_SOURCE,multiField:e.EFilterField.TRAFFIC_SOURCES,fieldName:e.EFilterField.TRAFFIC_SOURCE},{operator:e.EOperatorField.VERSION_OPERATOR,singleField:e.EFilterField.VERSION,multiField:e.EFilterField.VERSIONS,fieldName:e.EFilterField.VERSION},{operator:e.EOperatorField.PAGE_OPERATOR,singleField:e.EFilterField.SINGLE_PAGE,multiField:e.EFilterField.LIST_PAGE,fieldName:e.EFilterField.SINGLE_PAGE},{operator:e.EOperatorField.CAMPAIGN_ITEM_OPERATOR,singleField:e.EFilterField.GROUP_CAMPAIGN_ITEM,multiField:e.EFilterField.GROUP_CAMPAIGN_ITEMS,condition:e.EFilterField.GROUP_CAMPAIGN,fieldName:e.EFilterField.SINGLE_CAMPAIGN},{operatorVal:O,singleField:e.EFilterField.SINGLE_CAMPAIGN,multiField:e.EFilterField.GROUP_CAMPAIGN}],w=(e,t)=>{const r=[],i=Object.keys(e).length>0,a=!!t&&Object.keys(t).length>0;if(!i&&!a)return r;const n=(e=>e?Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e).map(([e,t])=>[e,Array.isArray(t)?`${e} IN (${t.join(", ")})`:`${e} = ${t}`])):{})(t);return K.forEach(({operator:t,operatorVal:i,singleField:a,multiField:o,condition:s,fieldName:l})=>{if(n[a])return void r.push(n[a]);const E=t?e[t]:i;let u=e[a];const c=e[o],d=s&&e[s];if(s&&!d)return;const m=l??(u?a:o);i&&!u&&(u=e[o]);const p=(e=>{const{operatorValue:t,singleValue:r,multiValue:i,fieldName:a}=e;return t===O&&r?`${a} = ${r}`:t===f&&Array.isArray(i)&&i.length>0?`${a} IN (${i.join(", ")})`:""})({operatorValue:E,singleValue:Array.isArray(u)?void 0:u,multiValue:Array.isArray(c)?c:void 0,fieldName:m});p&&r.push(p)}),r},q=e=>{const t=[];return e?(Object.entries(e).forEach(([e,r])=>{r&&t.push(`${e} = ${r}`)}),t):t},X=(e,t)=>{if(!e||0===t.length)return[];const r=t.find(t=>e[t]);return r?[r]:[]},k=({filters:e,overrideFilters:t,versionIds:r,extraConditions:i})=>{const a=[...w(e,t),...q(r),...B(i)];return a.length>0?`WHERE ${a.join(" AND ")}`:""},z=e=>{const t=e.match(new RegExp(`\\bWHERE\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b|$)`,"i"));if(!t)return{filters:{}};const r=(t[1]??"").trim().split(/\s+AND\s+/i),i={},a={};return r.forEach(e=>{const t=e.trim(),r=t.match(/^(\S+)\s+IN\s+\((.+)\)$/i);if(r){const e=r[1]??"",t=(r[2]??"").split(",").map(e=>e.trim()),a=K.find(t=>t.fieldName===e||t.multiField===e);return void(a?.operator&&(i[a.multiField]=t,i[a.operator]=f))}const n=t.match(/^(\S+)\s+=\s+(.+)$/);if(n){const e=n[1]??"",t=n[2]??"",r=K.find(t=>t.fieldName===e||t.singleField===e);r?(i[r.singleField]=t,r.operator&&(i[r.operator]=O)):e&&(a[e]=t)}}),{filters:i,versionIds:Object.keys(a).length>0?a:void 0}},J=e=>`FROM ${e.join(", ")}`,Z=e=>{const t=e.match(new RegExp(`\\bFROM\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b)`,"i"));return t?(t[1]??"").split(",").map(e=>e.trim()).filter(Boolean):[]},ee=(t,r=e.EGroupWithClause.ALL)=>0===t.length?"":`GROUP BY ${t.join(", ")} ${r}`,te=t=>{const r=t.match(new RegExp(`\\bGROUP BY\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b)`,"i"));if(!r)return{dimensions:[]};const i=(r[1]??"").trim(),a=i.toUpperCase().indexOf(" WITH ");return-1===a?{dimensions:i.split(",").map(e=>e.trim()).filter(Boolean),groupWithClause:e.EGroupWithClause.NONE}:{dimensions:i.slice(0,a).split(",").map(e=>e.trim()).filter(Boolean),groupWithClause:i.slice(a+1).trim()}},re=e=>e?`LIMIT ${e}`:"",ie=e=>{const t=e.match(/\bLIMIT\s+(\d+)/i);return t?parseInt(t[1]??"0",10):void 0},ae=e=>`MODE ${e}`,ne=e=>{const t=e.match(/\bMODE\s+(\S+)/i);return t?.[1]},oe=e=>!e||e<0?"":`OFFSET ${e}`,se=e=>{const t=e.match(/\bOFFSET\s+(\d+)/i);return t?parseInt(t[1]??"0",10):void 0},le=(e,t)=>{if(!e)return"";const r=Object.values(e).filter(e=>t?.includes(e.field)).map(e=>`${e.field} ${e.direction}`).join(", ");return r?`ORDER BY ${r}`:""},Ee=e=>{const t=e.match(new RegExp(`\\bORDER BY\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b|$)`,"i"));if(!t)return;const r={};return(t[1]??"").split(",").forEach(e=>{const t=e.trim().split(/\s+/);if(2===t.length){const e=t[0]??"",i=t[1]??"";e&&(r[e]={field:e,direction:i})}}),Object.keys(r).length>0?r:void 0},ue=e=>`SHOW ${e.join(", ")}`,ce=e=>{const t=e.match(new RegExp(`\\bSHOW\\s+([\\s\\S]+?)(?=\\s+(?:${x})\\b)`,"i"));return t?(t[1]??"").split(",").map(e=>e.trim()).filter(Boolean):[]},de=/\.0+$/,me=(e,t=2)=>(e=>`${e}`.replace(de,""))(e.toFixed(t)),pe=(e,t,r=2)=>{const i=((e,t,r=2)=>{if("number"!=typeof e||!t)return;return 0===e?0:parseFloat(me(e/t*100,r))})(e,t,r);if("number"==typeof i)return(e=>e>0&&e<.005)(i)?"~0%":`${i}%`};r.extend(n),r.extend(a),r.extend(i);let Ae="UTC";function Re(){return Ae}const Te=e=>e?r(e).tz(Ae):r().tz(Ae),Oe=e=>"string"==typeof e?Te(e):e,fe=(e,t=!1)=>t&&(e=>0===e.hour()&&0===e.minute())(e)?e.endOf("day").format(U):e.format(U),ye=e=>{const t=Oe(e.startDate),r=Oe(e.endDate);return t.isSame(r)?{dateGTE:fe(t),dateLTE:(i=r,fe(i?Te(i).endOf("day"):Te().endOf("day")))}:{dateGTE:fe(t),dateLTE:fe(r,!0)};var i},Ie=e=>{const{dateRange:t,compareDateRange:r,overrideFilters:i,timeDimension:a}=e,n=a?i?.[a]:void 0;if(a&&n)return`DURING (${n}, ${a})`;if(!t)return"";const{dateGTE:o,dateLTE:s}=ye(t),{dateGTE:l,dateLTE:E}=r?ye(r):{};return`SINCE ${o} UNTIL ${s} ${r?`COMPARE TO ${l} UNTIL ${E}`:""}`},Se=e=>{const t=e.match(/\bDURING\s+\(([^,]+),\s*([^)]+)\)/i);if(t){const e=t[1]??"",r=t[2]??"";return{timeDimension:r.trim(),overrideFilters:{[r.trim()]:e.trim()}}}const r=e.match(/\bSINCE\s+(\S+)\s+UNTIL\s+(\S+)/i);if(!r)return{};const i={startDate:Te(r[1]??""),endDate:Te(r[2]??"")},a=e.match(/\bCOMPARE TO\s+(\S+)\s+UNTIL\s+(\S+)/i);return{dateRange:i,compareDateRange:a?{startDate:Te(a[1]??""),endDate:Te(a[2]??"")}:void 0}},De=e=>e?`TIMESERIES ${e}`:"",Fe=e=>{const t=e.match(/\bTIMESERIES\s+(\S+)/i);return t?.[1]},Me=e=>{const t=e??Re();return t?`TIMEZONE ${t}`:""},_e=e=>{const t=e.match(/\bTIMEZONE\s+(\S+)/i);return t?.[1]};function ge(e){if("string"!=typeof e)return!1;const t=e.trim();return/^MODE\b[\s\S]*\bFROM\b[\s\S]*\bSHOW\b[\s\S]*$/.test(t)}const Ne=e=>e?.gemxQLQuery?.tableData?.columns??[];var Ce;function Pe(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}e.AnalyticInterval=void 0,(Ce=e.AnalyticInterval||(e.AnalyticInterval={})).DAY="DAY",Ce.HOUR="HOUR",Ce.MONTH="MONTH",Ce.QUARTER="QUARTER",Ce.WEEK="WEEK",Ce.YEAR="YEAR";const he=60,ve=3600,Ge=e=>{let t=e;Number.isFinite(e)&&null!=e||(t=0);const r=me(t);if(t>=ve){return`${Math.floor(t/ve)}h ${Math.floor(t%ve/he)}m ${Math.floor(t%he)}s`}if(t>=he){return`${Math.floor(t/he)}m ${Math.floor(t%he)}s`}return`${r}s`},Ye=(t,r,i)=>{if(!t)return"";const a=i?.isExpandDetail?{formatHouse:"MMM D, h:mm A",formatDay:"MMM D, YYYY",formatMonth:"MMM YYYY",formatYear:"MMM YYYY"}:{formatHouse:"h A",formatDay:"MMM D",formatMonth:"MMM YYYY",formatYear:"YYYY"};switch(r){case e.AnalyticInterval.HOUR:return Te(t).format(a.formatHouse);case e.AnalyticInterval.DAY:case e.AnalyticInterval.WEEK:return Te(t).format(a.formatDay);case e.AnalyticInterval.MONTH:return Te(t).format(a.formatMonth);case e.AnalyticInterval.QUARTER:{const e=Te(t);return`Q${e.quarter()} ${e.format("YYYY")}`}case e.AnalyticInterval.YEAR:return Te(t).format(a.formatYear)}return Te(t).format(a.formatMonth)},$e=e=>{if(!e)return"None";const t=Te(e),r=Te(),i=Te().subtract(1,"day"),a=t.format("YYYY-MM-DD")===r.format("YYYY-MM-DD"),n=t.format("YYYY-MM-DD")===i.format("YYYY-MM-DD");if(a)return`Today at ${t.format("HH:mm")}`;if(n)return`Yesterday at ${t.format("HH:mm")}`;const o=r.diff(t,"day");return o>=0&&o<7?`${t.format("dddd")} at ${t.format("HH:mm")}`:`${t.format("MMM D")} at ${t.format("hh:mm a")}`},Le=({value:t,formatter:r,getTextPrice:i,name:a})=>{if(null!==t&&("object"==typeof t||Array.isArray(t)))return t;switch(r){case e.EAnalyticDataType.INTEGER:return Pe((t??0).toString());case e.EAnalyticDataType.CURRENCY:return i?i(t,!1):`${t??0}`;case e.EAnalyticDataType.DATE:return $e(t);case e.EAnalyticDataType.PERCENT:return"number"!=typeof t?pe(0,1,2)??"":pe(t/100,1,2)??"";case e.EAnalyticDataType.DURATION:return Ge(Number(t));case e.EAnalyticDataType.STRING:{const r=a===e.EAnalyticColumnKey.CAMPAIGNS?"":m;return t??r}case e.EAnalyticDataType.DAY:return Ye(t,e.AnalyticInterval.DAY,{isExpandDetail:!0});case e.EAnalyticDataType.HOUR:return Ye(t,e.AnalyticInterval.HOUR,{isExpandDetail:!0});case e.EAnalyticDataType.MONTH:return Ye(t,e.AnalyticInterval.MONTH,{isExpandDetail:!0});case e.EAnalyticDataType.YEAR:return Ye(t,e.AnalyticInterval.YEAR);case e.EAnalyticDataType.WEEK:return Ye(t,e.AnalyticInterval.WEEK,{isExpandDetail:!0});case e.EAnalyticDataType.QUARTER:return Ye(t,e.AnalyticInterval.QUARTER,{isExpandDetail:!0});case e.EAnalyticDataType.OBJECT:case e.EAnalyticDataType.ARRAY:return t;default:return`${t}`}},be=e=>{const t=e?.sessions;return"number"==typeof t&&t>0},Ue=e=>{if(e)return"string"==typeof e?JSON.parse(e):e},Qe=e=>{try{const t=Ue(e);return t&&"object"==typeof t?t:null}catch{return null}},xe=e=>{try{const t=Ue(e);if(!Array.isArray(t))return;return t}catch{return}},He=(e,t)=>{const r=e?.[t];return"number"==typeof r?r:0};var Ve;e.GPaginationDirection=void 0,(Ve=e.GPaginationDirection||(e.GPaginationDirection={})).NEXT="NEXT",Ve.PREV="PREV";e.CLAUSE_KEYWORDS=Q,e.CLAUSE_KEYWORD_BOUNDARY=x,e.COMPARE_PREFIX=A,e.COMPARE_SUFFIX=R,e.COMPARE_TOTALS_SUFFIX=T,e.ColumnSelectFragmentDoc=s,e.DATE_QUERY_FORMAT=U,e.DEFAULT_QUERY_LIMIT=H,e.GemXqlResultSelectFragmentDoc=E,e.GemxQlDocument=u,e.NONE_VALUE=m,e.OPERATOR_IS=O,e.OPERATOR_IS_ONE_OF=f,e.PLACEHOLDER_VALUE="-",e.ROW_READER_MODE_CONFIG=b,e.TOTALS_SUFFIX=p,e.TableDataSelectFragmentDoc=l,e.buildConditionQuery=k,e.buildExtraCondition=W,e.buildExtraConditions=B,e.buildFromQuery=J,e.buildGemXQlQuery=e=>{const{mode:t,metrics:r,dimensions:i,dateRange:a,compareDateRange:n,filters:o,overrideFilters:s,versionIds:l,extraConditions:E,orderBy:u,sources:c,timeDimension:d,groupWithClause:m,timezone:p,limit:A=H,offset:R,extraOrderByFields:T}=e,O=[...i,...X(u,r),...T??[]],f=[ae(t),J(c),ue(r),ee(i,m),De(d),Ie({dateRange:a,compareDateRange:n,timeDimension:d,overrideFilters:s}),Me(p),k({filters:o,overrideFilters:s,versionIds:l,extraConditions:E}),le(u,O),re(A),oe(R)].filter(Boolean).join(" ");return ge(f)?f:""},e.buildGroupQuery=ee,e.buildLimitQuery=re,e.buildModeQuery=ae,e.buildOffsetQuery=oe,e.buildOrderByQuery=le,e.buildShowQuery=ue,e.buildTimeQuery=Ie,e.buildTimeSeriesQuery=De,e.buildTimezoneQuery=Me,e.buildVersionIdCondition=q,e.createNumericRowReader=(t,r=e.ERowReaderMode.DEFAULT)=>e=>{const{prefix:i,suffix:a}=b[r],n=t[`${i}${e}${a}`];if("number"==typeof n)return n;if("string"==typeof n){const e=parseFloat(n);return isNaN(e)?0:e}return 0},e.extractColumnTypes=e=>{const t=Ne(e),r={};for(const e of t)e?.name&&(r[e.name]=e.dataType);return r},e.extractQueryColumns=Ne,e.extractQueryRows=e=>e?.gemxQLQuery?.tableData?.rows??[],e.filterConfigs=K,e.formatAnalyticData=Le,e.formatAnalyticDate=$e,e.generateFilterConditions=w,e.getComparisonKey=e=>`${A}${e}${R}`,e.getComparisonTotalsKey=e=>`${A}${e}${R}${p}`,e.getFirstMetricInOrderBy=X,e.getFormattedByInterval=Ye,e.getTimeDimensionByDate=(t,r)=>{const i=r.diff(t,"day");return i<=3?e.ETimeDimension.HOUR:i<=93?e.ETimeDimension.DAY:e.ETimeDimension.MONTH},e.getTimeDurationLabel=Ge,e.getTotalsKey=e=>`${e}${p}`,e.hasMetricData=be,e.isValidQueryInput=ge,e.numberWithCommas=Pe,e.parseBreakdownItems=e=>xe(e)?.map(e=>({...e,total:Number(e.total)})),e.parseConditionQuery=z,e.parseFromQuery=Z,e.parseGemXQlQuery=e=>{const{dateRange:t,compareDateRange:r,timeDimension:i,overrideFilters:a}=Se(e),n=i??Fe(e),{dimensions:o,groupWithClause:s}=te(e),{filters:l,versionIds:E}=z(e);return{mode:ne(e),sources:Z(e),metrics:ce(e),dimensions:o,groupWithClause:s,timeDimension:n,dateRange:t,compareDateRange:r,overrideFilters:a,filters:l,versionIds:E,timezone:_e(e),orderBy:Ee(e),limit:ie(e),offset:se(e)}},e.parseGroupQuery=te,e.parseJsonArray=xe,e.parseJsonObject=Qe,e.parseLimitQuery=ie,e.parseModeQuery=ne,e.parseOffsetQuery=se,e.parseOrderByQuery=Ee,e.parsePageItems=e=>Qe(e),e.parseShowQuery=ce,e.parseTimeQuery=Se,e.parseTimeSeriesQuery=Fe,e.parseTimezoneQuery=_e,e.readNumeric=He,e.useAnalyticData=e=>{const t=({value:t,formatter:r,name:i})=>Le({value:t,formatter:r,getTextPrice:e,name:i});return{formatData:t,computeMetric:({metric:e,previousMetric:r,metricKey:i,formatter:a})=>{if(!be(e))return{value:0,change:"-"};const n=He(e,i),o=He(r,i),s=t({value:n,formatter:a,name:i});if(0===n&&0!==o)return{value:s,change:-100};if(0===o)return{value:s,change:"-"};return{value:s,change:(n-o)/o*100}}}},e.useCustomGemXQlQuery=c,e.useGemXQlPagination=({resetKey:t,itemsPerPage:r})=>{const[i,a]=o.useState(1),n=o.useRef(),s=i>1&&void 0!==n.current&&n.current!==t?1:i,l=(s-1)*r,E=o.useCallback(t=>r=>{a(i=>{const a=r===e.GPaginationDirection.NEXT?i+1:i-1;return Math.min(Math.max(a,1),t)})},[]);o.useEffect(()=>{n.current!==t&&(n.current=t,a(1))},[t]);const u=o.useCallback(({totalRecords:e,isLoading:t})=>{const i=Math.max(1,Math.ceil(e/r));return{currentPage:s,totalPages:i,loading:t,handlePageChange:E(i)}},[s,r,E]);return{currentPage:s,offset:l,buildPagination:u}},e.useGemxQlNamedQuery=d});
|
package/dist/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("@tanstack/react-query"),require("dayjs"),require("dayjs/plugin/quarterOfYear.js"),require("dayjs/plugin/timezone.js"),require("dayjs/plugin/utc.js"),require("react"),require("@shopify/polaris"),require("react-i18next"),require("@shopify/polaris-viz")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@tanstack/react-query","dayjs","dayjs/plugin/quarterOfYear.js","dayjs/plugin/timezone.js","dayjs/plugin/utc.js","react","@shopify/polaris","react-i18next","@shopify/polaris-viz"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GemAnalytics={},e.jsxRuntime,null,e.dayjs,e.quarterOfYear,e.timezone,e.utc,e.React,e.Polaris,e.reactI18next,e.polarisViz)}(this,function(e,t,i,n,a,r,s,o,l,c,d){"use strict";var u;e.EMetricKey=void 0,(u=e.EMetricKey||(e.EMetricKey={})).SESSION="sessions",u.ORDERS="orders",u.PAGE_VIEWS="pageviews",u.VISITORS="visitors",u.BOUNCE_RATE="bounce_rate",u.CTR="ctr",u.CONVERSION_RATE="conversion_rate",u.AVG_TIME_ON_PAGE="average_time_on_page",u.ADDED_TO_CART="added_to_cart",u.ADD_TO_CART_RATE="added_to_cart_rate",u.REACHED_CHECKOUT="sessions_that_reached_checkout",u.COMPLETE_CHECKOUT="sessions_that_completed_checkout",u.CART_ADDITION="sessions_with_cart_additions",u.AOV="aov",u.REVENUE="revenue",u.RPV="revenue_per_visitor",u.VISITOR_ITEMS="visitor_items",u.DEVICE_ITEMS="device_items",u.TRAFFIC_SOURCE_ITEMS="traffic_source_items";const h={[e.EMetricKey.SESSION]:{title:"Sessions",content:"A period during which a visitor interacts with your online store"},[e.EMetricKey.VISITORS]:{title:"Visitors",content:"Number of unique individuals who visit your online store"},[e.EMetricKey.BOUNCE_RATE]:{title:"Bounce rate",content:"Percentage of visitors who leave your store after viewing only one page, without interacting further",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Bounce rate"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"sessions with a pageview"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total sessions"})]})},[e.EMetricKey.CTR]:{title:"Click-through rate",content:"Percentage of clicks to open new page, compared to the number of times the page was viewed",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Click-through rate"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"total clicks"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total pageviews"})]})},[e.EMetricKey.AVG_TIME_ON_PAGE]:{title:"Average time on page",content:"Average duration that visitors spend on a page before clicking to open new page",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Average time on page"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"total time on page"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"(total pageviews - total exits)"})]})},[e.EMetricKey.PAGE_VIEWS]:{title:"Pageviews",content:"Number of times a page on your online store has been viewed by visitors"},[e.EMetricKey.RPV]:{title:"Revenue per visitor",content:"Average revenue generated from each visitor",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Revenue per visitor"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"total revenue"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total visitors"})]})},[e.EMetricKey.ADDED_TO_CART]:{title:"Added to cart",content:"Total number of the event when a customer adds a product to their cart on your online store"},[e.EMetricKey.REACHED_CHECKOUT]:{title:"Sessions that reached checkout",content:"Sessions in your online store in which the checkout page was reached"},[e.EMetricKey.COMPLETE_CHECKOUT]:{title:"Sessions that completed checkout",content:"Sessions in your online store in which a purchase was completed"},[e.EMetricKey.ORDERS]:{title:"Orders",content:"Number of orders that went through this pages"},[e.EMetricKey.CONVERSION_RATE]:{title:"Conversion rate",content:"Percentage of online store sessions that completed an order",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Conversion rate"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"sessions that completed checkout"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total sessions"})]})},[e.EMetricKey.AOV]:{title:"Average order value",content:"Average value of orders placed in your online store",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Average order value"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"total revenue"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total orders"})]})},[e.EMetricKey.REVENUE]:{title:"Revenue",content:"Total income generated from sales after discounts",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Revenue"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"gross sales"}),t.jsx("span",{className:"formula-operator",children:" - "}),t.jsx("span",{className:"formula-input",children:"discounts"})]})},[e.EMetricKey.ADD_TO_CART_RATE]:{title:"Add to cart rate",content:"Percentage of sessions in which the customer added item to the cart",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Added to cart rate"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"sessions with cart additions"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total sessions"})]})},[e.EMetricKey.CART_ADDITION]:{title:"Sessions with cart additions",content:"Sessions in your online store in which a visitor added item to the cart"},[e.EMetricKey.VISITOR_ITEMS]:{title:"Sessions by visitor type",content:"<p>Numbers of new and returning visitors</p>",contentList:["New visitor: who accesses your store for the first time after GemX installation","Returning visitor: who comes back to your store after GemX installation"]},[e.EMetricKey.DEVICE_ITEMS]:{title:"Sessions by device type",content:"Sessions in your online store by the visitor's device type"},[e.EMetricKey.TRAFFIC_SOURCE_ITEMS]:{title:"Sessions by traffic source",content:"Sessions on your page by where visitors come from"}};var m,A,g,p,M,T,f,x,I,E,N,j,S,D,v,y,O,C;!function(e){e.DATE="DATE",e.ARRAY="ARRAY",e.OBJECT="OBJECT",e.STRING="STRING",e.INTEGER="INTEGER",e.CURRENCY="CURRENCY",e.PERCENT="PERCENT",e.DURATION="DURATION",e.MONTH="MONTH_TIMESTAMP",e.QUARTER="QUARTER_TIMESTAMP",e.DAY="DAY_TIMESTAMP",e.WEEK="WEEK_TIMESTAMP",e.YEAR="YEAR_TIMESTAMP",e.HOUR="HOUR_TIMESTAMP"}(m||(m={})),e.EAnalyticColumnKey=void 0,(A=e.EAnalyticColumnKey||(e.EAnalyticColumnKey={})).CAMPAIGNS="experiments",A.VISITOR_ITEMS="visitor_items",A.DEVICE_ITEMS="device_items",A.TRAFFIC_SOURCE_ITEMS="traffic_source_items",function(e){e.ALL_SESSION="ALL_SESSION",e.FIRST_SESSION="FIRST_SESSION",e.PAGE_ONLY="PAGE_ONLY"}(g||(g={})),function(e){e.SESSIONS="sessions",e.SALES="sales"}(p||(p={})),e.EVisitorType=void 0,(M=e.EVisitorType||(e.EVisitorType={})).NEW="new",M.RETURNING="returning",e.EDeviceType=void 0,(T=e.EDeviceType||(e.EDeviceType={})).DESKTOP="desktop",T.MOBILE="mobile",T.TABLET="tablet",e.ETrafficSourceType=void 0,(f=e.ETrafficSourceType||(e.ETrafficSourceType={})).DIRECT="direct",f.EMAIL="email",f.REFERRAL="referral",f.ORGANIC_SOCIAL="organic-social",f.ORGANIC_SEARCH="organic-search",f.PAID_SOCIAL="paid-social",f.PAID_SEARCH="paid-search",f.SMS="sms",function(e){e.EQ="=",e.IN="IN",e.LIKE="LIKE"}(x||(x={})),function(e){e.OR="OR",e.AND="AND"}(I||(I={})),function(e){e.DEVICE="device",e.DEVICES="devices",e.VISITOR="visitor_type",e.VISITORS="visitor_types",e.TRAFFIC_SOURCE="traffic_source",e.TRAFFIC_SOURCES="traffic_sources",e.VERSION="version",e.VERSIONS="versions",e.SINGLE_PAGE="page_path",e.LIST_PAGE="page_paths",e.GROUP_CAMPAIGN_ITEM="group_campaign_item",e.GROUP_CAMPAIGN_ITEMS="group_campaign_items",e.SINGLE_CAMPAIGN="experiment_id",e.GROUP_CAMPAIGN="experiment_group_id",e.CAMPAIGN_VERSION_ID="version_id",e.GROUP_CAMPAIGN_VERSION_ID="group_version_id"}(E||(E={})),function(e){e.DEVICE_OPERATOR="deviceOperator",e.VISITOR_OPERATOR="visitorOperator",e.TRAFFIC_SOURCE_OPERATOR="trafficSourceOperator",e.VERSION_OPERATOR="versionOperator",e.PAGE_OPERATOR="pageOperator",e.CAMPAIGN_ITEM_OPERATOR="campaignItemOperator"}(N||(N={})),function(e){e.NONE="",e.TOTALS="TOTALS",e.ALL="WITH GROUP_TOTALS, TOTALS"}(j||(j={})),function(e){e.ASC="ASC",e.DESC="DESC"}(S||(S={})),function(e){e.PAGE_ITEMS="page_items",e.PAGE_PATHS="page_paths"}(D||(D={})),function(e){e.PAGE_PATH="page_path"}(v||(v={})),function(e){e.SHOPIFY_PAGE_ID="shopify_page_id",e.LOCATION_PATH="location_path",e.PAGE_TYPE="page_type",e.PAGE_TITLE="page_title",e.PAGE_PATH="page_path",e.TEMPLATE_SUFFIX="template_suffix"}(y||(y={})),function(e){e.DEFAULT="DEFAULT",e.COMPARISON="COMPARISON",e.TOTALS="TOTALS",e.COMPARISON_TOTALS="COMPARISON_TOTALS"}(O||(O={})),function(e){e.HOUR="hour",e.DAY="day",e.WEEK="week",e.MONTH="month",e.QUARTER="quarter",e.YEAR="year"}(C||(C={})),O.DEFAULT,O.COMPARISON,O.TOTALS,O.COMPARISON_TOTALS,I.OR,N.DEVICE_OPERATOR,E.DEVICE,E.DEVICES,E.DEVICE,N.VISITOR_OPERATOR,E.VISITOR,E.VISITORS,E.VISITOR,N.TRAFFIC_SOURCE_OPERATOR,E.TRAFFIC_SOURCE,E.TRAFFIC_SOURCES,E.TRAFFIC_SOURCE,N.VERSION_OPERATOR,E.VERSION,E.VERSIONS,E.VERSION,N.PAGE_OPERATOR,E.SINGLE_PAGE,E.LIST_PAGE,E.SINGLE_PAGE,N.CAMPAIGN_ITEM_OPERATOR,E.GROUP_CAMPAIGN_ITEM,E.GROUP_CAMPAIGN_ITEMS,E.GROUP_CAMPAIGN,E.SINGLE_CAMPAIGN,E.SINGLE_CAMPAIGN,E.GROUP_CAMPAIGN,n.extend(s),n.extend(r),n.extend(a);let R="UTC";const k="YYYY-MM-DD HH:mm:ss",b=e=>e?n(e).tz(R):n().tz(R),P=e=>e?n.tz(n(e).format(k),R):n.tz(n().format(k),R),w=e=>n(e?b(e).format(k):b().format(k)),L=/\.0+$/,Y=(e,t=2)=>(e=>`${e}`.replace(L,""))(e.toFixed(t)),z=e=>{const[t,i,n]=e.split(".").map(e=>Number(e));return 1e6*(t??0)+1e3*(i??0)+(n??0)},B=e=>e>0&&e<.005,U=(e,t,i=2)=>{const n=((e,t,i=2)=>{if("number"!=typeof e||!t)return;return 0===e?0:parseFloat(Y(e/t*100,i))})(e,t,i);if("number"==typeof n)return B(n)?"~0%":`${n}%`},G=(e,t=2)=>B(e)?"~0%":`${Y(e,t)}%`;var H;function _(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}!function(e){e.DAY="DAY",e.HOUR="HOUR",e.MONTH="MONTH",e.QUARTER="QUARTER",e.WEEK="WEEK",e.YEAR="YEAR"}(H||(H={}));const Q=60,V=3600,W=(e,t,i)=>{if(!e)return"";const n=i?.isExpandDetail?{formatHouse:"MMM D, h:mm A",formatDay:"MMM D, YYYY",formatMonth:"MMM YYYY",formatYear:"MMM YYYY"}:{formatHouse:"h A",formatDay:"MMM D",formatMonth:"MMM YYYY",formatYear:"YYYY"};switch(t){case H.HOUR:return b(e).format(n.formatHouse);case H.DAY:case H.WEEK:return b(e).format(n.formatDay);case H.MONTH:return b(e).format(n.formatMonth);case H.QUARTER:{const t=b(e);return`Q${t.quarter()} ${t.format("YYYY")}`}case H.YEAR:return b(e).format(n.formatYear)}return b(e).format(n.formatMonth)},F=({value:t,formatter:i,getTextPrice:n,name:a})=>{if(null!==t&&("object"==typeof t||Array.isArray(t)))return t;switch(i){case m.INTEGER:return _((t??0).toString());case m.CURRENCY:return n?n(t,!1):`${t??0}`;case m.DATE:return(e=>{if(!e)return"None";const t=b(e),i=b(),n=b().subtract(1,"day"),a=t.format("YYYY-MM-DD")===i.format("YYYY-MM-DD"),r=t.format("YYYY-MM-DD")===n.format("YYYY-MM-DD");if(a)return`Today at ${t.format("HH:mm")}`;if(r)return`Yesterday at ${t.format("HH:mm")}`;const s=i.diff(t,"day");return s>=0&&s<7?`${t.format("dddd")} at ${t.format("HH:mm")}`:`${t.format("MMM D")} at ${t.format("hh:mm a")}`})(t);case m.PERCENT:return"number"!=typeof t?U(0,1,2)??"":U(t/100,1,2)??"";case m.DURATION:return(e=>{let t=e;Number.isFinite(e)&&null!=e||(t=0);const i=Y(t);if(t>=V)return`${Math.floor(t/V)}h ${Math.floor(t%V/Q)}m ${Math.floor(t%Q)}s`;if(t>=Q)return`${Math.floor(t/Q)}m ${Math.floor(t%Q)}s`;return`${i}s`})(Number(t));case m.STRING:{const i=a===e.EAnalyticColumnKey.CAMPAIGNS?"":"None";return t??i}case m.DAY:return W(t,H.DAY,{isExpandDetail:!0});case m.HOUR:return W(t,H.HOUR,{isExpandDetail:!0});case m.MONTH:return W(t,H.MONTH,{isExpandDetail:!0});case m.YEAR:return W(t,H.YEAR);case m.WEEK:return W(t,H.WEEK,{isExpandDetail:!0});case m.QUARTER:return W(t,H.QUARTER,{isExpandDetail:!0});case m.OBJECT:case m.ARRAY:return t;default:return`${t}`}},J=e=>{try{const t=(e=>{if(e)return"string"==typeof e?JSON.parse(e):e})(e);if(!Array.isArray(t))return;return t}catch{return}},K=e=>J(e)?.map(e=>({...e,total:Number(e.total)})),q=(e,t)=>{const i=e?.[t];return"number"==typeof i?i:0};var X;!function(e){e.NEXT="NEXT",e.PREV="PREV"}(X||(X={}));const Z=[{value:e.EVisitorType.NEW,label:"New"},{value:e.EVisitorType.RETURNING,label:"Returning"}],$=[{value:e.EDeviceType.DESKTOP,label:"Desktop"},{value:e.EDeviceType.TABLET,label:"Tablet"},{value:e.EDeviceType.MOBILE,label:"Mobile"}],ee=[{value:e.ETrafficSourceType.DIRECT,label:"Direct"},{value:e.ETrafficSourceType.EMAIL,label:"Email"},{value:e.ETrafficSourceType.REFERRAL,label:"Referral"},{value:e.ETrafficSourceType.ORGANIC_SOCIAL,label:"Organic social"},{value:e.ETrafficSourceType.ORGANIC_SEARCH,label:"Organic search"},{value:e.ETrafficSourceType.PAID_SOCIAL,label:"Paid social"},{value:e.ETrafficSourceType.PAID_SEARCH,label:"Paid search"},{value:e.ETrafficSourceType.SMS,label:"SMS"}],te="Current",ie="Previous",ne={current:"rgba(64, 176, 230, 1)",comparison:"rgba(161, 202, 231, 1)",all:["#2C7DFF","#F34A70"]},ae={POSITIVE:"#007F5F",NEUTRAL:"#4A4A4A"},re="USD";var se="data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSI5MCIKICBoZWlnaHQ9IjcyIgogIHZpZXdCb3g9IjAgMCA5MCA3MiIKICBmaWxsPSJub25lIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKPgogIDxwYXRoCiAgICBkPSJNNDguNzUgMzQuNUM0OS45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NzVDNDIuMjk2MyA0My41IDQxLjQwNSA0My40OTkxIDQwLjcxMSA0My40NDI0QzQwLjAzMDIgNDMuMzg2OCAzOS42MzkxIDQzLjI4MzEgMzkuMzQyOCA0My4xMzIxQzM4LjcwNzcgNDIuODA4NiAzOC4xOTE0IDQyLjI5MjMgMzcuODY3OSA0MS42NTcyQzM3LjcxNjkgNDEuMzYwOSAzNy42MTMyIDQwLjk2OTggMzcuNTU3NiA0MC4yODlaIgogICAgZmlsbD0iIzYxNjE2MSIKICAvPgo8L3N2Zz4K",oe=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M3.5 10a.75.75 0 0 1 .75-.75h9.69l-2.72-2.72a.75.75 0 1 1 1.06-1.06l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06-1.06l2.72-2.72h-9.69a.75.75 0 0 1-.75-.75Z"}))};oe.displayName="ArrowRightIcon";var le=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M7.75 3.5a.75.75 0 0 0-1.5 0v.407a3.075 3.075 0 0 0-.702.252 3.75 3.75 0 0 0-1.64 1.639c-.226.444-.32.924-.365 1.47-.043.531-.043 1.187-.043 2v1.464c0 .813 0 1.469.043 2 .045.546.14 1.026.366 1.47a3.75 3.75 0 0 0 1.639 1.64c.444.226.924.32 1.47.365.531.043 1.187.043 2 .043h3.383c.323 0 .542 0 .735-.02a3.75 3.75 0 0 0 3.344-3.344c.02-.193.02-.412.02-.735v-2.883c0-.813 0-1.469-.043-2-.045-.546-.14-1.026-.366-1.47a3.75 3.75 0 0 0-1.639-1.64 3.076 3.076 0 0 0-.702-.251v-.407a.75.75 0 0 0-1.5 0v.259c-.373-.009-.794-.009-1.268-.009h-1.964c-.474 0-.895 0-1.268.009v-.259Zm-1.521 1.995c.197-.1.458-.17.912-.207.462-.037 1.057-.038 1.909-.038h1.9c.853 0 1.447 0 1.91.038.453.037.714.107.912.207.423.216.767.56.983.984.1.197.17.458.207.912.014.18.024.38.029.609h-9.982c.006-.228.015-.429.03-.61.036-.453.106-.714.206-.911a2.25 2.25 0 0 1 .984-.984Zm-1.229 4.005v1.2c0 .853 0 1.447.038 1.91.037.453.107.714.207.912.216.423.56.767.984.983.197.1.458.17.912.207.462.037 1.057.038 1.909.038h3.306c.385 0 .52-.001.626-.012a2.25 2.25 0 0 0 2.006-2.006c.011-.106.012-.241.012-.626v-2.606h-10Z"}))};le.displayName="CalendarIcon";var ce=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M15.78 5.97a.75.75 0 0 1 0 1.06l-6.5 6.5a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 1 1 1.06-1.06l2.72 2.72 5.97-5.97a.75.75 0 0 1 1.06 0Z"}))};ce.displayName="CheckIcon";var de=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M5.72 8.47a.75.75 0 0 1 1.06 0l3.47 3.47 3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06Z"}))};de.displayName="ChevronDownIcon";var ue=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M7.72 14.53a.75.75 0 0 1 0-1.06l3.47-3.47-3.47-3.47a.75.75 0 0 1 1.06-1.06l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06 0Z"}))};ue.displayName="ChevronRightIcon";var he=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M14.53 12.28a.75.75 0 0 1-1.06 0l-3.47-3.47-3.47 3.47a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06Z"}))};function me(e){return"string"==typeof e?e:"object"==typeof e&&null!==e&&Object.keys(e).filter(t=>e[t]).join(" ")}function Ae(...e){return e.map(me).filter(Boolean).join(" ")}function ge(e,t,i="asc"){if(e===t)return 0;if(void 0===e||void 0===t)return void 0===e&&void 0!==t?"asc"===i?-1:1:void 0===t&&void 0!==e?"asc"===i?1:-1:0;const n=e=>"boolean"!=typeof e&&!isNaN(Date.parse(e)),a=e=>"string"==typeof e;let r=0;if(n(e)&&n(t)){r=(e instanceof Date?e:new Date(e))>(t instanceof Date?t:new Date(t))?1:-1}else r=(a(e)&&a(t),e>t?1:-1);return"asc"===i?-r:r}function pe(e,t){return"string"==typeof t?t.replace(/\[(\d+)\]/g,".$1").split(".").reduce((e,t)=>e?.[t],e):e[t]}function Me(e,t){return t.reduce((e,t)=>function(e,t){const{attr:i,order:n="asc",preferredValue:a,backupAttr:r,orderArrayAttr:s,orderArray:o}=t;return e.slice().sort((e,t)=>{const l=pe(e,i),c=pe(t,i);if(void 0!==a){if(l===a&&c!==a)return-1;if(c===a&&l!==a)return 1}if(s===i&&o){const e=o[n];return e.indexOf(l)-e.indexOf(c)}const d=ge(l,c,n);return 0!==d?d:r?ge(e[r],t[r],n):0})}(e,t),e.slice())}he.displayName="ChevronUpIcon";const Te=({children:e,fullWidth:i=!1,cursor:n="pointer",onClick:a,onMouseEnter:r,onMouseLeave:s})=>t.jsx("div",{role:"button",tabIndex:0,className:Ae({"w-full":i,"cursor-pointer":"pointer"===n,"cursor-default":"default"===n,"cursor-not-allowed":"not-allowed"===n}),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())},onClick:a,onMouseEnter:r,onMouseLeave:s,children:e}),fe=({onClick:e,active:i,content:n,textProps:a,boxProps:r,disabled:s,icon:c})=>{const d=o.useMemo(()=>s?{borderColor:"border-disabled",background:"bg-surface-disabled",...r}:{shadow:i?"button-inset":"button",background:i?"bg-fill-active":"bg-fill",...r},[i,s,r]),u=o.useMemo(()=>s?"text-[var(--p-color-text-disabled)]":i?"text-[var(--p-color-text-subdued)]":"text-[var(--p-color-text)]",[i,s]),h=o.useMemo(()=>t.jsx(l.Text,{as:"span",variant:"bodyMd",fontWeight:"medium",tone:s?"inherit":a?.tone,truncate:!0,...a?.variant&&{variant:a.variant},children:n}),[n,a,s]),m=o.useCallback(()=>{s||e()},[s,e]);return t.jsx(Te,{cursor:s?"default":"pointer",onClick:m,children:t.jsx("div",{className:Ae(u),children:t.jsxs(l.Box,{padding:"150",paddingInline:"300",paddingInlineEnd:"150",borderRadius:"200",...d,children:[c&&t.jsxs(l.InlineStack,{gap:"200",align:"center",wrap:!1,children:[t.jsx(l.Box,{children:t.jsx(l.Icon,{source:c})}),h]}),!c&&t.jsxs(l.InlineGrid,{columns:"1fr 20px",gap:"200",alignItems:"center",children:[h,t.jsx(l.Icon,{source:i?he:de})]})]})})})},xe=({height:e,align:i,inlineAlign:n,display:a,...r})=>{const s=o.useMemo(()=>{if("sticky"!==r.position)return{};const e={position:"sticky"};return r.insetInlineStart&&(e.insetInlineStart=4*Number(r.insetInlineStart)),r.insetInlineEnd&&(e.insetInlineEnd=4*Number(r.insetInlineEnd)),r.insetBlockStart&&(e.insetBlockStart=4*Number(r.insetBlockStart)),r.insetBlockEnd&&(e.insetBlockEnd=4*Number(r.insetBlockEnd)),e},[r.position,r.insetInlineStart,r.insetInlineEnd,r.insetBlockStart,r.insetBlockEnd]);return t.jsx("div",{className:"Polaris-GBlockCenter",style:{...s,"--gp-block-center-height":e,"--gp-block-center-display":a,"--gp-block-center-align":i,"--gp-block-center-inline-align":n,"--gp-block-center-overflow-x":r.overflowX,"--gp-block-center-overflow-y":r.overflowY},children:t.jsx(l.Box,{...r})})},Ie=({isEnabled:e=!0,content:i,maxWidth:n,...a})=>e&&!!i?t.jsx(l.Tooltip,{width:"wide",hoverDelay:500,content:i,...a,accessibilityLabel:n?.toString()}):a.children,Ee=({activatorWrapper:e,children:i,iconRight:n,inset:a,stopPropagation:r=!0,onClick:s,themeTone:o="light",variant:c,...d})=>{const u=e||"div",h="neutral"===c,m=h?void 0:c,A=t.jsx(Ie,{activatorWrapper:"tooltip-content",...d.tooltip,children:t.jsx(u,{className:Ae("Polaris-GButton",{"Polaris-GButton--icon-right":n,"Polaris-GButton--dark":"dark"===o,"Polaris-GButton--neutral":h,"cursor-default":d.disabled,"Polaris-GButton--fullWidth":d.fullWidth,flex:a}),onClick:e=>{r&&e.stopPropagation(),d.disabled||s?.()},children:t.jsx(l.Button,{variant:m,...d,children:i})})});return a?t.jsx(l.Box,{padding:"100",children:A}):A},Ne=({...e})=>e.multiple?t.jsx(je,{...e}):t.jsx(Se,{...e}),je=({options:e,onChange:i,onChangeSingleValue:n,emptySelected:a,selected:r,onHover:s,itemHovered:c,dependentDisabledValues:d})=>{const[u,h]=o.useState([]),m=e=>{s&&s(e)};return o.useEffect(()=>{h(()=>r?e.filter(e=>r.includes(e.value)).map(e=>e.value):[])},[r]),t.jsx(l.BlockStack,{children:e.map(r=>{const s=d?.has(r.value),o=a&&1===e.filter(e=>e.selected).length&&a,A=()=>{o||(e=>{n&&n(e);const t=u.includes(e)?u.filter(t=>t!==e):[...u,e];h(t),i(t)})(r.value)};return t.jsx("div",{className:Ae("flex w-full items-center justify-between",{"cursor-not-allowed":o,"cursor-pointer":!o,"bg-surface-hover rounded-lg":c===r.value}),onClick:()=>{o||r.disabled||A()},onMouseEnter:()=>m(r.value),onMouseLeave:()=>m(void 0),children:o?t.jsx(Ie,{isEnabled:r.tooltip?.isEnabled,...r.tooltip,children:t.jsx(l.Box,{paddingBlock:"150",paddingInline:"200",width:"100%",children:t.jsxs(l.InlineStack,{blockAlign:"center",gap:"150",children:[t.jsx(l.Checkbox,{label:r.label,labelHidden:!0,checked:r.selected,disabled:!0}),t.jsx(l.Text,{as:"p",variant:"bodyMd",tone:"subdued",children:r.label})]})})}):t.jsx(l.Box,{paddingBlock:"150",paddingInline:"200",minWidth:"0",children:t.jsxs(l.InlineStack,{blockAlign:"center",gap:"150",wrap:!1,children:[t.jsx(l.Checkbox,{label:r.label,labelHidden:!0,checked:!s&&u.includes(r.value),onChange:A,disabled:r.disabled}),t.jsxs(l.Box,{minWidth:"0",children:[t.jsx(l.Text,{as:"p",variant:"bodyMd",truncate:!0,tone:s?"disabled":"inherit",children:r.label}),r.description&&t.jsx(l.Text,{as:"p",variant:"bodySm",tone:"disabled",truncate:!0,children:r.description})]})]})})},r.value)})})},Se=({options:e,onChange:i})=>t.jsx(l.BlockStack,{gap:"300",children:e.map(e=>t.jsx(l.RadioButton,{label:e.label,checked:e.selected,onChange:()=>i(e.value),helpText:e.helpText?t.jsx(Bt,{item:e}):void 0},e.value))}),De=o.forwardRef(({children:e,onClick:i,...n},a)=>{const r=o.useCallback(e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i?.())},[i]);return t.jsx("div",{ref:a,...n,role:"button",tabIndex:0,onKeyDown:r,onClick:i,children:e})});De.displayName="GDiv";const ve=/\[(\d+)\](.*?)\[\]/g,ye=e=>{const{children:i,transformers:n}=e;if(!n||0===Object.values(n).length)return t.jsx(l.Text,{...e,children:i});return t.jsx(l.Text,{...e,children:"string"==typeof i?(e=>{const i=[];let a=0;return e.replace(ve,(t,r,s,o)=>{i.push(e.slice(a,o));const l=n[r];return"function"==typeof l?i.push(l(s)):i.push(t),a=o+t.length,t}),i.push(e.slice(a)),i.map((e,i)=>t.jsx(o.Fragment,{children:e},i))})(i):i})};function Oe({options:e,selected:i,onChange:n}){const a=e=>{n([e])};return t.jsx(l.Box,{padding:"150",children:t.jsx(l.BlockStack,{gap:"100",children:e.map(e=>{const n=i.includes(e.value);return t.jsx("div",{role:"option","aria-selected":n,tabIndex:0,onClick:()=>a(e.value),onKeyDown:t=>{return i=t,n=e.value,void("Enter"!==i.key&&" "!==i.key||(i.preventDefault(),a(n)));var i,n},className:Ae("p-1.5 pl-4 rounded-lg cursor-pointer",{"bg-[#F1F1F1]":n,"hover:bg-[#F1F1F1]":!n}),children:t.jsxs(l.InlineStack,{align:"space-between",blockAlign:"center",wrap:!1,gap:"200",children:[t.jsx(l.Box,{minWidth:"0",children:e.label}),n&&t.jsx(l.Box,{children:t.jsx(l.Icon,{source:ce})})]})},e.value)})})})}const Ce=e=>{const[i,n]=o.useState(!1),{activatorText:a,selected:r,options:s,emptyLabel:c,preferredAlignment:d="right",formatActivatorContent:u=e=>e.join(", ")}=e,h=o.useCallback(()=>n(e=>!e),[]),m=o.useMemo(()=>s.filter(e=>e.active||e.id===r).map(e=>e.content||"").filter(e=>!!e),[s,r]),A=o.useMemo(()=>{if(m.length){const e=u(m);return a?`${a}: ${e}`:e}return c?a?`${a}: ${c}`:c:a},[m,c,a,u]),g=o.useMemo(()=>{switch(e.variant){case"choice":return t.jsx(Re,{...e,setPopoverActive:h});case"action-list":return t.jsx(ke,{...e,setPopoverActive:h})}},[e,h]);return t.jsx(l.Popover,{active:i,activator:t.jsx("div",{className:"flex items-center gap-1",children:t.jsx(l.Button,{onClick:h,disclosure:i?"up":"down",children:A})}),autofocusTarget:"first-node",fluidContent:!0,onClose:h,preferredAlignment:d,children:g})},Re=({options:e,selected:i,onSelect:n,maxWidth:a,minWidth:r,clearable:s,setPopoverActive:d})=>{const{t:u}=c.useTranslation(),h=o.useMemo(()=>e?.length?e.map(e=>({value:e.id,label:e.content||"",selected:!1})):[],[e]),m=o.useCallback(e=>{n(e)},[n]);return t.jsx(l.Box,{maxWidth:a,minWidth:r,paddingBlock:"150",children:t.jsxs(l.BlockStack,{children:[t.jsx(l.BlockStack,{gap:"0",children:t.jsx(Ne,{multiple:!0,options:h,selected:i,onChange:m})}),s&&t.jsx(l.Box,{paddingBlock:"150",paddingInline:"200",children:t.jsx(l.InlineStack,{blockAlign:"center",align:"start",children:t.jsx(l.Button,{disabled:!i?.length,onClick:()=>{m([]),d(!1)},variant:"plain",children:u("Clear")})})})]})})},ke=({options:e,selected:i,onSelect:n,helpText:a,maxWidth:r,minWidth:s,setPopoverActive:c})=>{const d=o.useCallback(e=>{n(e),c(!1)},[n,c]),u=o.useMemo(()=>e?.length?e.map(e=>({id:e.id,content:e.content,helpText:e.helpText,onAction:()=>d(e.id),active:e.active||e.id===i,suffix:(e.active||e.id===i)&&t.jsx(l.Icon,{source:ce,tone:"success"})})):[],[e,i,d]);return t.jsx(l.Box,{maxWidth:r,minWidth:s,children:t.jsxs(l.BlockStack,{gap:"0",children:[t.jsx(l.ActionList,{actionRole:"menuitem",items:u}),a]})})},be=({linkAction:e,isDisabled:i,disabledFocus:n,children:a})=>!e||i?t.jsx(t.Fragment,{children:a}):t.jsx("span",{className:Ae("GTextLink",{"GTextLink--disabled-focus":n}),children:t.jsx(l.Link,{...e,children:t.jsx(t.Fragment,{children:a})})}),Pe=e=>{const i=e.height??"50px";return t.jsxs("div",{className:"Polaris-GSkeletonDisplayText",children:[t.jsx("style",{children:`.Polaris-GSkeletonDisplayText .Polaris-SkeletonDisplayText__DisplayText { height: ${i} !important; }`}),t.jsx(l.SkeletonDisplayText,{maxWidth:"100%",size:"extraLarge"})]})};function we(e,t){return`${e}${t.charAt(0).toUpperCase()}${t.slice(1)}`}const Le=({source:e,alt:i,size:n,grayscale:a,defaultSource:r=se,width:s="80",height:o="80",classRemoved:l=!1})=>{const c=a&&"Polaris-GThumbnail--filter",d=Ae("Polaris-Thumbnail",n&&we("Polaris-Thumbnail--size",n)),u=t.jsx("img",{onError:e=>{e.currentTarget.src=r},alt:i??"Thumbnail",src:`${e??r}`,width:s,height:o,style:{"--gp-grayscale-percentage":a||"100%"},className:Ae("Polaris-GThumbnail",c)});return l?u:t.jsx("span",{className:d,children:u})},Ye={default:"w-[210px]",wide:"w-[320px]",large:"w-[328px]"},ze={start:"flex justify-start",center:"flex justify-center",end:"flex justify-end"},Be=o.forwardRef((e,i)=>{const{tooltip:n,wrapper:a="div",activatorProps:r,isHideBorder:s,alignment:c,delay:d=500,textDecoration:u="none",popoverRef:h,preferredAlignment:m="left",showArrow:A=!1}=e,{width:g="default"}=n??{},[p,M]=o.useState(!1),T=a,f=Ye[g],x=o.useRef(null),I=()=>{x.current&&(clearTimeout(x.current),x.current=null),M(!1)};return o.useImperativeHandle(i,()=>({onClose:I})),t.jsx(T,{className:Ae("GTooltipCard cursor-pointer",c&&ze[c],{"GTooltipCard--text-underline":"underline"===u}),onMouseEnter:()=>{x.current=setTimeout(()=>{M(!0)},d)},onMouseLeave:I,children:t.jsx(l.Popover,{ref:h,activator:s?t.jsx(l.InlineStack,{children:e.children}):t.jsx(l.Box,{borderBlockEndWidth:"025",borderStyle:"dashed",borderColor:"border-tertiary",as:a,...r,children:e.children}),activatorWrapper:a,onClose:()=>{},active:p,preferredPosition:"below",preferredAlignment:m,children:n&&t.jsx("div",{className:Ae(f,{"GTooltipCard-arrow":A}),children:t.jsx(l.Box,{padding:"400",children:t.jsxs(l.BlockStack,{gap:"200",children:[t.jsxs(l.BlockStack,{gap:"100",children:[t.jsx(l.Text,{as:"span",variant:"headingSm",fontWeight:"semibold",children:n.title}),t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx(l.Text,{as:"span",variant:"bodyMd",tone:"subdued",fontWeight:"medium",children:t.jsx("span",{dangerouslySetInnerHTML:{__html:n.content}})}),n.contentList&&t.jsx(l.List,{type:"bullet",children:n.contentList.map(e=>t.jsx(l.List.Item,{children:t.jsx(l.Text,{as:"span",variant:"bodyMd",tone:"subdued",fontWeight:"medium",children:e})},e))})]})]}),n.formula&&t.jsx("div",{className:"rounded-md font-mono",style:{fontSize:"12px"},children:n.formula})]})})})})})});var Ue;function Ge(){return{[e.MainDateTimePickerAlias.TODAY]:{title:"Today",alias:e.MainDateTimePickerAlias.TODAY,getDateRange:mt},[e.MainDateTimePickerAlias.YESTERDAY]:{title:"Yesterday",alias:e.MainDateTimePickerAlias.YESTERDAY,getDateRange:At},[e.MainDateTimePickerAlias.LAST_7_DAYS]:{title:"Last 7 days",alias:e.MainDateTimePickerAlias.LAST_7_DAYS,getDateRange:gt},[e.MainDateTimePickerAlias.LAST_30_DAYS]:{title:"Last 30 days",alias:e.MainDateTimePickerAlias.LAST_30_DAYS,getDateRange:pt},[e.MainDateTimePickerAlias.LAST_90_DAYS]:{title:"Last 90 days",alias:e.MainDateTimePickerAlias.LAST_90_DAYS,getDateRange:Mt},[e.MainDateTimePickerAlias.LAST_365_DAYS]:{title:"Last 365 days",alias:e.MainDateTimePickerAlias.LAST_365_DAYS,getDateRange:Tt},[e.MainDateTimePickerAlias.LAST_MONTH]:{title:"Last month",alias:e.MainDateTimePickerAlias.LAST_MONTH,getDateRange:ft},[e.MainDateTimePickerAlias.LAST_12_MONTHS]:{title:"Last 12 months",alias:e.MainDateTimePickerAlias.LAST_12_MONTHS,getDateRange:xt},[e.MainDateTimePickerAlias.LAST_YEAR]:{title:"Last year",alias:e.MainDateTimePickerAlias.LAST_YEAR,getDateRange:It}}}function He(e){return Ge()[e]}Be.displayName="GTooltipCard",e.MainDateTimePickerAlias=void 0,(Ue=e.MainDateTimePickerAlias||(e.MainDateTimePickerAlias={})).TODAY="today",Ue.YESTERDAY="yesterday",Ue.LAST_7_DAYS="last7days",Ue.LAST_30_DAYS="last30days",Ue.LAST_90_DAYS="last90days",Ue.LAST_365_DAYS="last365days",Ue.LAST_MONTH="lastMonth",Ue.LAST_12_MONTHS="last12Months",Ue.LAST_YEAR="lastYear";const _e={YMD:"YYYY-MM-DD",MONTH_YEAR:"MMM YYYY",FULL:"MMMM D, YYYY",FULL_WITH_TIME:"MMMM D, YYYY [at] h:mm A",SHORT:"MMM DD, YYYY",SHORT_NO_PAD:"MMM D, YYYY",SHORT_WITH_TIME:"MMM D, YYYY [at] h:mm A",MONTH_DAY:"MMM D",DAY_YEAR:"D, YYYY",TIME:"h:mm A",MONTH_DAY_WITH_TIME:"MMM D [at] h:mm A",YEAR:"YYYY"};const Qe=/^\d{4}-\d{1,2}-\d{1,2}/;function Ve(e){return!isNaN(new Date(e).getDate())}function We(e){return Qe.test(e)&&Ve(e)}function Fe(e){return 10===e.length&&We(e)}function Je(e,t){const i=P(e);return"YMD"===t?i.format(_e.YMD):"MY"===t?i.format(_e.MONTH_YEAR):"FULL"===t?i.format(_e.FULL):"FULL_WITH_TIME"===t?i.format(_e.FULL_WITH_TIME):i.format(_e.SHORT)}function Ke(e,t){const i=P(e),n=P(t);return i.isSame(n,"day")}function qe(e){const{since:t,until:i,format:n=_e.TIME,showNow:a=!1}=e,r=P(t),s=P(i);return`${r.format(n)} - ${a?"Now":s.format(n)}`}function Xe(e){const{since:t,until:i,isShowNow:n}=e,a=P(t),r=P(i),s=a.isSame(b(),"day"),o=a.format(_e.TIME),l=r.format(_e.TIME);if(s){return`Today at ${o} - ${n?"Now":l}`}if(n)return`${a.format(_e.SHORT_WITH_TIME)} - Now`;if(a.isSame(r,"day"))return`${a.format(_e.SHORT_WITH_TIME)} - ${l}`;if(a.isSame(r,"day")){const e=qe({since:t,until:i});return`${a.format(_e.SHORT)} (${e})`}return a.isSame(r,"year")?`${a.format(_e.MONTH_DAY_WITH_TIME)} - ${r.format(_e.MONTH_DAY_WITH_TIME)}, ${r.format(_e.YEAR)}`:`${a.format(_e.SHORT_WITH_TIME)} - ${r.format(_e.SHORT_WITH_TIME)}`}const Ze=(e,t=!1,i)=>t&&et(e)?e.endOf("day").format(i):e.format(i),$e=(e,t)=>Ze(e?b(e).endOf("day"):b().endOf("day"),!1,t),et=e=>0===e.hour()&&0===e.minute();function tt(e,t){const i=P(e),n=P(t);return i.isSame(n,"day")?i.format(_e.SHORT):i.isSame(n,"month")&&i.isSame(n,"year")?`${i.format(_e.MONTH_DAY)} - ${n.format(_e.DAY_YEAR)}`:i.isSame(n,"year")?`${i.format(_e.MONTH_DAY)} - ${n.format(_e.SHORT_NO_PAD)}`:`${i.format(_e.SHORT_NO_PAD)} - ${n.format(_e.SHORT_NO_PAD)}`}function it(t){const{since:i,until:n,isShowNow:a}=t,r=P(i);return r.isSame(b(),"day")?He(e.MainDateTimePickerAlias.TODAY).title:a?`${r.format(_e.SHORT_NO_PAD)} - Now`:tt(i,n)}const nt=({since:e,until:t,isShowNow:i})=>{if(Ke(e,t))return qe({since:e,until:t,showNow:i})},at=e=>[...e].sort((e,t)=>z(t.version)-z(e.version)).map(e=>{if(!e.startedAt)return!1;const t=!e.completedAt,i=w(e.startedAt).valueOf(),n=t?w($e()).valueOf():w(e.completedAt).valueOf(),a=it({since:i,until:n,isShowNow:t}),r=nt({since:i,until:n,isShowNow:t});return{title:a,alias:`${e.version}`,since:i,until:n,isVersion:!0,isCurrentVersion:t,description:r,versionId:e.id}}).filter(Boolean),rt=()=>({since:0,until:0}),st=t=>{const{since:i,until:a,alias:r}=t,s=n(i),o=n(a);if(r===e.MainDateTimePickerAlias.LAST_MONTH)return ft(s);if(r===e.MainDateTimePickerAlias.LAST_12_MONTHS)return xt(s);if(r===e.MainDateTimePickerAlias.LAST_YEAR)return It(s);const l=o.diff(s,"day")+1,c=s.subtract(l,"day"),d=o.subtract(l,"day");return{since:c.valueOf(),until:d.valueOf()}},ot=(e,t)=>i=>{const{since:a,until:r}=i,s=n(a),o=n(r).diff(s,"day"),l=s.subtract(e,t),c=l.add(o,"day");return{since:l.valueOf(),until:c.valueOf()}},lt=ot(7,"day"),ct=ot(3,"month"),dt=ot(1,"month"),ut=ot(1,"year"),ht=e=>t=>({since:t.subtract(e,"day").valueOf(),until:t.valueOf()}),mt=e=>({since:e.valueOf(),until:e.valueOf()}),At=e=>({since:e.subtract(1,"day").valueOf(),until:e.subtract(1,"day").valueOf()}),gt=ht(6),pt=ht(29),Mt=ht(89),Tt=ht(364);function ft(e){return{since:e.subtract(1,"month").startOf("month").valueOf(),until:e.subtract(1,"month").endOf("month").valueOf()}}function xt(e){return{since:e.subtract(12,"month").startOf("month").valueOf(),until:e.subtract(1,"month").endOf("month").valueOf()}}function It(e){return{since:e.subtract(1,"year").startOf("year").valueOf(),until:e.subtract(1,"year").endOf("year").valueOf()}}const Et=(e,t,i)=>{const a=n(i),r=a.month();if(a.year()!==t||r!==e){const e=a.subtract(1,"month");return{month:e.month(),year:e.year()}}return{month:e,year:t}};var Nt;e.CompareDateTimePickerAlias=void 0,(Nt=e.CompareDateTimePickerAlias||(e.CompareDateTimePickerAlias={})).NO_COMPARISON="noComparison",Nt.PREVIOUS_PERIOD="previousPeriod",Nt.PREVIOUS_WEEK="previousWeek",Nt.PREVIOUS_MONTH="previousMonth",Nt.PREVIOUS_QUARTER="previousQuarter",Nt.PREVIOUS_YEAR="previousYear";const jt={title:"Previous period",alias:e.CompareDateTimePickerAlias.PREVIOUS_PERIOD,since:0,until:0},St=[{title:"No comparison",alias:e.CompareDateTimePickerAlias.NO_COMPARISON,since:0,until:0},jt,{title:"Previous week",alias:e.CompareDateTimePickerAlias.PREVIOUS_WEEK,since:0,until:0},{title:"Previous quarter",alias:e.CompareDateTimePickerAlias.PREVIOUS_QUARTER,since:0,until:0},{title:"Previous month",alias:e.CompareDateTimePickerAlias.PREVIOUS_MONTH,since:0,until:0},{title:"Previous year",alias:e.CompareDateTimePickerAlias.PREVIOUS_YEAR,since:0,until:0}],Dt={[e.CompareDateTimePickerAlias.NO_COMPARISON]:rt,[e.CompareDateTimePickerAlias.PREVIOUS_PERIOD]:st,[e.CompareDateTimePickerAlias.PREVIOUS_WEEK]:lt,[e.CompareDateTimePickerAlias.PREVIOUS_QUARTER]:ct,[e.CompareDateTimePickerAlias.PREVIOUS_MONTH]:dt,[e.CompareDateTimePickerAlias.PREVIOUS_YEAR]:ut},vt=()=>{const t=w().startOf("day"),i=Ge(),n=i[e.MainDateTimePickerAlias.TODAY],a={...n,...n.getDateRange(t)},r=i[e.MainDateTimePickerAlias.YESTERDAY],s={...r,...r.getDateRange(t)},o=i[e.MainDateTimePickerAlias.LAST_7_DAYS],l={...o,...o.getDateRange(t)},c=i[e.MainDateTimePickerAlias.LAST_30_DAYS],d={...c,...c.getDateRange(t)},u=i[e.MainDateTimePickerAlias.LAST_90_DAYS],h={...u,...u.getDateRange(t)},m=i[e.MainDateTimePickerAlias.LAST_365_DAYS],A={...m,...m.getDateRange(t)},g=i[e.MainDateTimePickerAlias.LAST_MONTH],p={...g,...g.getDateRange(t)},M=i[e.MainDateTimePickerAlias.LAST_12_MONTHS],T={...M,...M.getDateRange(t)},f=i[e.MainDateTimePickerAlias.LAST_YEAR];return{DATE_TIME_FILTERS:[a,s,l,d,h,A,p,T,{...f,...f.getDateRange(t)}],LAST_7_DAYS_DATE_RANGE:l,LAST_30_DAYS_DATE_RANGE:d}},yt=o.createContext({dateTimePicked:{since:b().valueOf(),until:b().valueOf(),title:"Today",alias:"today"},compareDateTimePicked:jt,setDateTimePicked:()=>{},setCompareDateTimePicked:()=>{},resetDateVersion:()=>{}}),Ot=()=>{const e=o.useContext(yt);if(!e)throw new Error("useDateTimePickerContext must be used within a DateTimePickerProvider");return e},Ct=({ranges:e,initialPicked:t,onApply:i})=>{const{DATE_TIME_FILTERS:a}=vt(),r=e||a,{dateTimePicked:s,setDateTimePicked:l}=Ot(),[c,d]=o.useState(s),[{month:u,year:h},m]=o.useState({month:n(s.since).month(),year:n(s.since).year()});o.useEffect(()=>{if(s){const e=new Date(s.until);((e,t)=>t.month-e.month+12*(e.year-t.year))({year:h,month:u},{year:e.getFullYear(),month:e.getMonth()})}},[s,u,h]);return o.useEffect(()=>{s&&(d(s),m({month:n(s.since).month(),year:n(s.since).year()}))},[s]),{month:u,year:h,setDate:m,dateRange:c,apply:()=>{l(c),i?.(c)},cancel:()=>{d(s)},dateTimePicked:s,onChange:({end:e})=>{m(Et(u,h,e))},onMonthChange:(e,t)=>{m({month:e,year:t})},onCalendarChange:e=>{const{start:i,end:n,alias:a}=e,s={alias:"custom",title:"Custom",since:i.getTime(),until:n.getTime()},o=r.find(e=>{const t=e.alias===a,r=e.until===n.getTime(),s=e.since===i.getTime();return t||s&&r});d(o||t||s)}}};function Rt({onBlur:e,dateRange:i,setDateTimePicked:n}){const[a,r]=o.useState(!1),[s,c]=o.useState({}),d=o.useCallback((e,t=!1)=>!i.isVersion||t&&i.isCurrentVersion?Je(e,"FULL"):Je(e,"FULL_WITH_TIME"),[i.isVersion,i.isCurrentVersion]);function u(){r(!1),c({since:d(i.since),until:d(i.until,!0)}),e&&e()}return o.useEffect(()=>{a||c({since:d(i.since),until:d(i.until,!0)})},[i,d]),t.jsxs(l.InlineGrid,{gap:"200",columns:"1fr auto 1fr",children:[t.jsx(l.TextField,{role:"combobox",label:"Since",labelHidden:!0,value:i.since?s.since:"MMMM D, YYYY",onChange:function(e){if(c(t=>({...t,since:e})),Fe(e)){const t=P(e).startOf("day"),a=P(i.until).endOf("day"),r=t.isAfter(a)?t.endOf("day"):a;n({start:w(t).toDate(),end:w(r).toDate()})}},onBlur:()=>u(),onFocus:()=>(r(!0),void c({...s,since:Je(i.since,"YMD")})),autoComplete:"off"}),t.jsx(l.InlineStack,{children:t.jsx(l.Icon,{source:oe,tone:"subdued"})}),t.jsx(l.TextField,{role:"combobox",label:"Until",labelHidden:!0,value:i.until?s.until:"MMMM D, YYYY",onChange:function(e){if(c(t=>({...t,until:e})),Fe(e)){const t=b().endOf("day"),a=P(e).endOf("day"),r=a.isAfter(t)?t:a,s=P(i.since).startOf("day"),o=r.isBefore(s)?r.startOf("day"):s;n({start:w(o).toDate(),end:w(r).toDate()})}},onBlur:()=>u(),onFocus:()=>(r(!0),void c({...s,until:Je(i.until,"YMD")})),autoComplete:"off"})]})}function kt(e){const{setDateTimePicked:i,dateTimePicked:n,rangeAddition:a,allRanges:r}=e,{value:s,toggle:c}=function(e){const[t,i]=o.useState(e);return{value:t,toggle:o.useCallback(()=>i(e=>!e),[]),setTrue:o.useCallback(()=>i(!0),[]),setFalse:o.useCallback(()=>i(!1),[])}}(!0),d=a?.rangers||[],u=d.map(e=>{const i=n.alias===e.alias;return{value:e.alias,label:t.jsxs(l.Text,{as:"span",truncate:!0,children:[t.jsx(l.Text,{as:"span",variant:"bodyMd",fontWeight:i?"semibold":"regular",children:e.title}),e.description&&t.jsxs(t.Fragment,{children:[" ",t.jsx(l.Text,{as:"span",variant:"bodyXs",fontWeight:"regular",tone:"subdued",children:`(${e.description})`})]})]})}});if(a&&0!==d.length)return t.jsxs(l.Box,{borderBlockEndWidth:"025",borderColor:"border",paddingBlock:"200",children:[t.jsx("div",{className:"px-1.5",children:t.jsx(De,{onClick:c,"aria-expanded":s,className:Ae("hover:bg-surface-hover cursor-pointer rounded-lg p-1.5"),children:t.jsxs(l.InlineStack,{align:"space-between",blockAlign:"center",children:[t.jsx(l.Text,{as:"span",variant:"bodyMd",children:a.title}),t.jsx(l.Box,{children:t.jsx(l.Icon,{source:s?he:de})})]})})}),t.jsx(l.Collapsible,{open:s,id:"date-time-filter-periods-collapsible",transition:{duration:"200ms",timingFunction:"ease-in-out"},children:t.jsx(Oe,{options:u,selected:n?[n.alias]:[],onChange:e=>{const t=e[0],n=r.find(e=>e.alias===t)||r[0];i({start:b(n?.since).toDate(),end:b(n?.until).toDate(),alias:n?.alias})}})})]})}function bt(e){const{setDateTimePicked:i,dateTimePicked:n,allRanges:a,isCompare:r}=e,{DATE_TIME_FILTERS:s}=vt(),{mdDown:o}=l.useBreakpoints(),c=r?[...St]:[...s];return t.jsx(l.Box,{maxWidth:o?"516px":"250px",width:o?"100%":"250px",padding:{xs:"500",md:"0"},paddingBlockEnd:{xs:"100",md:"0"},children:o?t.jsx(l.Select,{label:"dateRangeLabel",labelHidden:!0,onChange:e=>(e=>{const t=a.find(({title:t,alias:i})=>t===e||i===e)||a[0];i({start:b(t?.since).toDate(),end:b(t?.until).toDate(),alias:t?.alias})})(e),value:n?.title||n?.alias||"",options:a.map(({alias:e,title:t})=>t||e)}):t.jsx(l.Scrollable,{style:{maxHeight:"356px"},children:t.jsx(l.Box,{children:t.jsxs(l.BlockStack,{children:[t.jsx(kt,{...e}),t.jsx(l.OptionList,{options:c.map(e=>({value:e.alias,label:e.title})),selected:n?[n.alias]:[],onChange:e=>(e=>{const t=a.find(t=>t.alias===e[0])||a[0];i({start:b(t?.since).toDate(),end:b(t?.until).toDate(),alias:t?.alias})})(e)})]})})})})}const Pt=({ranges:e,onApply:t})=>{const i=e||St,{compareDateTimePicked:n,setCompareDateTimePicked:a}=Ot(),{dateTimePicked:r}=Ot(),[s,l]=o.useState(n),[{month:c,year:d},u]=o.useState({month:b(n.since).month(),year:b(n.since).year()});return{month:c,year:d,setDate:u,dateRange:s,apply:()=>{a(s),t?.(s)},cancel:()=>{l(n)},compareDateTimePicked:n,onChange:({end:e})=>{u(Et(c,d,e))},onMonthChange:(e,t)=>{u({month:e,year:t})},onCalendarChange:({start:e,end:t,alias:n})=>{const a=i.find(e=>e.alias===n);l(a?{...a,...Dt[n]({since:r.since,until:r.until})}:{alias:"custom",title:"Custom",since:e.getTime(),until:t.getTime()})}}},wt=e=>{const{dateTimeFilters:i,rangeAddition:a,popoverProps:r,activatorProps:s,actionProps:d,isCompare:u,buttonValue:h,activator:m}=e,A=a?.initialPicked,g=[...i||[],...a?.rangers||[]],p=u?Pt:Ct,{month:M,year:T,dateRange:f,apply:x,cancel:I,onMonthChange:E,onCalendarChange:N,onChange:j}=p({ranges:g,initialPicked:A,onApply:e.onApply}),{t:S}=c.useTranslation(),{mdDown:D,lgUp:v}=l.useBreakpoints(),y=v,O=o.useMemo(()=>{if(f.isVersion&&f.since&&f.until)return Xe({since:f.since,until:f.until,isShowNow:f.isCurrentVersion})},[f.since,f.until,f.isVersion,f.isCurrentVersion]),[C,R]=o.useState(!1),k=o.useRef(null),b=o.useRef(O);C||(b.current=O);const P=b.current;function L({relatedTarget:e}){var t;null!=e&&(t=e,!!k?.current&&function(e,t){if(e===t)return!0;let i=t.parentNode;for(;null!=i;){if(i===e)return!0;i=i.parentNode}return!1}(k.current,t))||R(!1)}function Y(){I(),R(!1)}const z=()=>{u||R(!C)};return t.jsx(l.Popover,{active:C,autofocusTarget:"none",preferredAlignment:"right",preferredPosition:"below",fluidContent:!0,sectioned:!1,fullHeight:!0,activator:t.jsx(xe,{height:"100%",minHeight:"28px",align:"center",children:t.jsx(Ie,{content:P,maxWidth:m?"large":"extra-large",children:t.jsx(l.Box,{children:m?m({onClick:z,value:h}):t.jsx(l.Button,{size:"slim",icon:u?void 0:le,onClick:z,...s,children:h})})})}),onClose:Y,...r,children:t.jsxs(l.Scrollable,{vertical:!0,scrollbarWidth:"thin",className:"max-w-[100%]",children:[t.jsx(l.Popover.Pane,{fixed:!0,children:t.jsx("div",{ref:k,children:t.jsxs(l.InlineGrid,{columns:{xs:"1fr",md:"max-content max-content"},gap:"0",children:[t.jsx(bt,{setDateTimePicked:e=>{N(e),j(e)},dateTimePicked:f,rangeAddition:a,allRanges:g,isCompare:u}),t.jsx(l.Box,{padding:"400",maxWidth:D?"320px":"516px",borderInlineStartWidth:"025",borderColor:"border-secondary",children:t.jsxs(l.BlockStack,{gap:"400",children:[t.jsx(Rt,{setDateTimePicked:N,dateRange:f,onBlur:()=>L}),t.jsx("div",{children:t.jsx(l.DatePicker,{month:M,year:T,selected:f.since||f.until?{start:n(f.since).toDate(),end:n(f.until).toDate()}:void 0,onMonthChange:E,onChange:N,multiMonth:y,allowRange:!0,disableDatesAfter:w(B).toDate()})}),d&&t.jsx(Ee,{...d,onClick:()=>{R(!1),d.onClick?.()}})]})})]})})}),t.jsx(l.Popover.Pane,{fixed:!0,children:t.jsx(l.Box,{padding:"400",borderBlockStartWidth:"025",borderColor:"border-secondary",children:t.jsx(l.InlineStack,{align:"end",gap:"200",children:t.jsxs(l.ButtonGroup,{children:[t.jsx(l.Button,{onClick:Y,children:S("Cancel")}),t.jsx(l.Button,{variant:"primary",onClick:function(){x(),R(!1)},children:S("Apply")})]})})})})]})});var B},Lt=i=>{const{rangeAddition:n,popoverProps:a}=i,r=n?.initialPicked,s=St,l=[...s,...n?.rangers||[]],{t:d}=c.useTranslation(),{compareDateTimePicked:u}=Pt({ranges:l,initialPicked:r}),h=o.useMemo(()=>u.alias===e.CompareDateTimePickerAlias.NO_COMPARISON?d("No comparison"):d("Compare to: {{value}}",{value:tt(u.since,u.until)}),[u,d]);return t.jsx(wt,{dateTimeFilters:s,rangeAddition:n,popoverProps:a,isCompare:!0,buttonValue:h})},Yt=e=>{const{rangeAddition:i,popoverProps:n,activator:a,onApply:r,activatorProps:s,actionProps:o}=e,{DATE_TIME_FILTERS:l}=vt(),c=l,d=i?.rangers||[],u=i?.initialPicked,h=[...c,...d],{dateTimePicked:m}=Ct({ranges:h,initialPicked:u});return t.jsx(wt,{activatorProps:s,dateTimeFilters:c,rangeAddition:i,popoverProps:n,actionProps:o,buttonValue:(()=>{if(m.isVersion&&d.length>0){const e=m.description?`at ${m.description}`:"";return`Period: ${m.title} ${e}`}return"custom"===m.alias?tt(m.since,m.until):m.title})(),activator:a,onApply:r})},zt=({activatorText:e,selected:i,options:n,minWidth:a,maxWidth:r,preferredAlignment:s="right",onSelect:c})=>{const[d,u]=o.useState(!1),[h,m]=o.useState(null),A=()=>u(e=>!e),g=o.useMemo(()=>n.find(e=>e.id===i),[n,i]),p=o.useMemo(()=>{if(g){const t=g.title??g.content;return e?`${e}: ${t}`:t}return e},[g,e]);return t.jsx(l.Popover,{active:d,activator:t.jsx(fe,{active:d,content:p,textProps:{variant:"bodySm"},onClick:A}),autofocusTarget:"first-node",fluidContent:!0,onClose:A,preferredAlignment:s,children:t.jsx(l.Box,{maxWidth:r,minWidth:a,padding:"200",children:t.jsx(l.BlockStack,{gap:"200",children:n.map(e=>{const n=e.id===i,a=h===e.id,r=n?"input-border":a?"border-hover":"transparent";return t.jsx(l.Box,{padding:"150",borderWidth:"025",borderColor:r,borderRadius:"100",children:t.jsx("div",{onClick:()=>{return t=e.id,c(t),void u(!1);var t},className:"cursor-pointer",onMouseEnter:()=>m(e.id),onMouseLeave:()=>m(null),children:t.jsxs(l.InlineStack,{gap:"300",align:"space-between",blockAlign:"center",wrap:!1,children:[t.jsxs(l.InlineStack,{gap:"300",blockAlign:"center",wrap:!1,children:[t.jsx("div",{className:"bg-surface-secondary flex items-center justify-center rounded-md min-w-[184px] h-[92px]",children:t.jsx("img",{src:e.icon,alt:e.content,className:"w-full h-full object-contain"})}),t.jsxs(l.BlockStack,{gap:"100",children:[t.jsx(l.Text,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:e.content}),t.jsx(l.Text,{as:"p",variant:"bodyMd",tone:"subdued",children:e.helpText})]})]}),n&&t.jsx(l.Box,{children:t.jsx(l.Icon,{source:ce})})]})})},e.id)})})})})},Bt=({item:e})=>t.jsxs(l.Text,{as:"p",variant:"bodyMd",children:[e.description,e.inlineAction&&t.jsx(l.Link,{monochrome:!0,onClick:()=>{e.inlineAction?.onAction?e.inlineAction?.onAction():window.open(e.inlineAction?.url,e.inlineAction?.target??"_blank")},children:e.inlineAction?.content})]}),Ut=()=>t.jsx(Pe,{height:"188px"}),Gt={comparison:ne.comparison,single:ne.current,all:[...ne.all]},Ht=({children:e,minHeight:i=228,seriesColors:n=Gt})=>t.jsx(d.PolarisVizProvider,{themes:{Light:{chartContainer:{minHeight:i},grid:{horizontalOverflow:!0,verticalOverflow:!0,horizontalMargin:0},seriesColors:n}},children:e}),_t=({metricKey:e,columnTypes:t})=>{const{formatData:i}=(e=>{const t=({value:t,formatter:i,name:n})=>F({value:t,formatter:i,getTextPrice:e,name:n});return{formatData:t,computeMetric:({metric:e,previousMetric:i,metricKey:n,formatter:a})=>{if(!(e=>{const t=e?.sessions;return"number"==typeof t&&t>0})(e))return{value:0,change:"-"};const r=q(e,n),s=q(i,n),o=t({value:r,formatter:a,name:n});return 0===r&&0!==s?{value:o,change:-100}:0===s?{value:o,change:"-"}:{value:o,change:(r-s)/s*100}}}})(),n=e?t?.[e]:void 0,a=e=>String(i({value:e,formatter:n})),r={labelFormatter:e=>a(Number(e)||0)};return{formatValue:a,yAxisOptions:r}},Qt=({lineChartData:e,isLoading:i,isEmptyMetricData:n,columnTypes:a,metricKey:r})=>{const{formatValue:s,yAxisOptions:o}=_t({metricKey:r,columnTypes:a||{}});return r?i?t.jsx(Ut,{}):n?t.jsx(Vt,{title:"No data yet",description:"Data needs time to gather"}):t.jsx(Ht,{children:t.jsx(d.LineChart,{data:e,yAxisOptions:o,theme:"Light",tooltipOptions:{titleFormatter:()=>`${h[r]?.title??""}`,keyFormatter:e=>e,renderTooltipContent:e=>t.jsx(Kt,{data:e,formatValue:s})},showLegend:!0})}):t.jsx(t.Fragment,{})};const Vt=({boxProps:e,minHeight:i,description:n,title:a})=>t.jsx(l.Box,{minWidth:"100%",...e,children:t.jsx(xe,{minHeight:i,children:t.jsx(l.Box,{padding:"400",children:t.jsxs(l.BlockStack,{gap:"400",align:"center",inlineAlign:"center",children:[t.jsx("div",{className:"h-[80px] w-[80px]",children:t.jsx(Le,{source:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKEAAACgCAYAAABkDQwTAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABvtSURBVHgB7V3NjyRFdo+oqq7u6fmg5wOzMINA8oDkA2hXSICstTS+GWRp17CyLIF89on1P2DBybKslS0h37hYFsg37PUBfIQbYCFZIPkCQoM0MAzM0D3Tw/RMT1el3y8iXubLqMjPqu7Mro6fOjuzMiMys7J++b7iRYRW+4DNzc0NWv02SZJLtP45LRsq4rBji5YPptPp78+dO/evaoHQasEgAoJ8b6hIvGXGZa31n54+ffqyWgAWSkIi4OuOgBHLjy1HxP9Vc2JhJLx+/fqvB4PBf6iIowRIxF8QEbfUHBioBYEI+M8q4qjhcbIR/1bNiYWQkNTwJVo9riKOHEgS/lbNiYWQkN6GSyriqGKDhNDP1RxYlDp+XEUcWUwmk16QMCKiNSIJIzpHJGFE54gkjOgcI9URyLVXa2tranV11WxHdAtyLtTdu3fV7u6uOmh0RsKTJ0+q4XCoIvoB/BbHjx83AuHevXvqINGJOh6Px5GAPcWxY8cOXDN1QsLRqDMBHFEBEPCgf5/omETM4EhIwogIiUjCiM4RSRjROSIJIzpHJGFE54gkjOgckYQRnWNposbT6dS0fwIrKysq4vDg0JIQpLt165a6c+eO2t7eNp+Bc+fOqQcffNBsb21tqdu3b6sTJ06oU6dOoT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c4E5HwtKzQ+Zx7BFrJhwP3s4A+WD70bpNNrIpI0fv9w+GTujbhqG6ET0Dk5HVM9ZMyDYA8SBN3WyePtlCvChNmR8VHCgiVhnhokTsOUAe2VeF256LpByrbJaYIB5neAv4DmvImS1Nmf9/PWJzbd+1lKUAAAAASUVORK5CYII=",width:"80px",height:"80px",alt:a,classRemoved:!0})}),t.jsxs(l.BlockStack,{gap:"200",align:"center",inlineAlign:"center",children:[t.jsx(l.Text,{as:"h4",variant:"headingSm",fontWeight:"semibold",children:a}),t.jsx(l.Text,{as:"h4",variant:"bodyMd",tone:"subdued",children:n})]})]})})})}),Wt=()=>t.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("g",{clipPath:"url(#clip0_18114_1160)",children:t.jsx("path",{d:"M1 1L6.5 6.5M6.5 6.5V1.5M6.5 6.5H1.5",stroke:"#8A8A8A",strokeWidth:"1.5"})}),t.jsx("defs",{children:t.jsx("clipPath",{id:"clip0_18114_1160",children:t.jsx("rect",{width:"8",height:"8",fill:"white"})})})]}),Ft=()=>t.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("g",{clipPath:"url(#clip0_18114_1146)",children:t.jsx("path",{d:"M1 7L6.5 1.5M6.5 1.5H1.5M6.5 1.5V6.5",stroke:"#29845A",strokeWidth:"1.5"})}),t.jsx("defs",{children:t.jsx("clipPath",{id:"clip0_18114_1146",children:t.jsx("rect",{width:"8",height:"8",fill:"white",transform:"matrix(0 -1 1 0 0 8)"})})})]}),Jt=({change:e})=>"number"!=typeof e?t.jsx("div",{style:{height:"2px",width:"11px",backgroundColor:"#8A8A8A"}}):t.jsxs("div",{style:{display:"flex",maxHeight:"20px",width:"fit-content",alignItems:"center",gap:"4px",borderRadius:"8px",fontSize:"12px",color:e>0?ae.POSITIVE:ae.NEUTRAL},children:[e<0&&t.jsx(l.InlineStack,{align:"center",children:t.jsx(Wt,{})}),e>0&&t.jsx(l.InlineStack,{align:"center",children:t.jsx(Ft,{})}),t.jsx(l.Text,{as:"span",variant:"bodyXs",fontWeight:"semibold",children:G(Math.abs(e||0))})]}),Kt=({data:e,formatValue:i})=>{const{activeIndex:n}=e,a=e?.dataSeries[0]?.data[n],r=e?.dataSeries[1]?.data[n],s=()=>{const e=a.trend?.value;if(!e)return"-";const t=Number(e.replace(/[%~]/g,""));return"negative"===a.trend?.trend?-1*t:t};return t.jsx("div",{className:"w-fit min-w-[175px]",children:t.jsx(l.Card,{padding:"200",children:t.jsxs(l.BlockStack,{gap:"100",children:[t.jsx(l.Text,{as:"p",variant:"bodySm",fontWeight:"semibold",children:e.formatters?.titleFormatter?.(e.title||"")||e.title}),t.jsxs(l.BlockStack,{gap:"100",children:[t.jsxs(l.InlineStack,{gap:"400",align:"space-between",blockAlign:"center",children:[t.jsxs(l.InlineStack,{gap:"100",blockAlign:"center",children:[t.jsx("div",{className:"h-[2px] w-[12px] rounded-[10px] bg-[#4FA9EA]"}),t.jsx(l.Text,{as:"p",variant:"bodySm",fontWeight:"medium",tone:"subdued",children:a.tooltipKey})]}),t.jsxs(l.InlineStack,{blockAlign:"center",gap:"100",children:[t.jsx(l.Text,{as:"span",variant:"bodySm",fontWeight:"semibold",children:i(a.value)}),t.jsx(Jt,{change:s()})]})]}),t.jsxs(l.InlineStack,{gap:"400",align:"space-between",blockAlign:"center",children:[t.jsxs(l.InlineStack,{gap:"100",blockAlign:"center",children:[t.jsx("div",{className:"w-[12px] border border-dashed border-[#A1CAE7]"}),t.jsx(l.Text,{as:"p",variant:"bodySm",tone:"subdued",fontWeight:"medium",children:r.tooltipKey})]}),t.jsxs(l.InlineStack,{blockAlign:"center",gap:"100",children:[t.jsx(l.Text,{as:"span",variant:"bodySm",fontWeight:"semibold",children:i(r.value)}),t.jsx("div",{className:"opacity-0",children:t.jsx(Jt,{change:s()})})]})]})]})]})})})},qt=({isShowOneLine:e})=>e?t.jsx(l.Box,{width:"40%",children:t.jsx(l.SkeletonBodyText,{lines:1})}):t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx(l.Box,{width:"60%",children:t.jsx(l.SkeletonBodyText,{lines:1})}),t.jsx(l.Box,{width:"40%",children:t.jsx(l.SkeletonBodyText,{lines:1})})]}),Xt=()=>t.jsx(l.Card,{children:t.jsxs(l.BlockStack,{gap:"400",children:[t.jsx(qt,{isShowOneLine:!0}),t.jsx(Ut,{})]})}),Zt=({totalValue:e,hideComparison:i})=>t.jsx(l.BlockStack,{gap:"200",children:t.jsxs(l.InlineStack,{blockAlign:"center",gap:"200",wrap:!1,children:[t.jsx(l.InlineStack,{blockAlign:"center",gap:"200",children:t.jsx(l.Text,{as:"span",variant:"headingSm",children:e.value})}),!i&&t.jsx(Jt,{change:e.change})]})}),$t=({item:e,isHovered:i,isLoading:n,hideComparison:a,titleVariant:r="headingMd",titleFontWeight:s,onClickTitle:o})=>{const{key:c,title:d,totalValue:u}=e,m=h[c];return n?t.jsx(qt,{}):t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx("div",{className:"hover:cursor-pointer hover:text-[--p-color-text-link-hover]",onClick:e=>{e?.stopPropagation(),o?.(c)},children:t.jsxs(l.InlineStack,{wrap:!1,children:[t.jsx(l.Box,{maxWidth:"100%",overflowX:"hidden",children:t.jsx(Be,{tooltip:m,children:t.jsx(l.Text,{as:"span",variant:r,fontWeight:s,truncate:!0,children:d})})}),i&&t.jsx("div",{className:"flex h-[20px] w-[20px] items-center",children:t.jsx(l.Icon,{source:ue,tone:"inherit"})})]})}),t.jsx(Zt,{totalValue:u,hideComparison:a})]})},ei=({item:e,isActive:i,isLoading:n,hideComparison:a,onSelect:r,onClickTitle:s})=>{const[c,d]=o.useState(!1),u=i||c;return t.jsx("div",{className:"w-full cursor-pointer overflow-hidden",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:()=>r(e.key),children:t.jsx(l.Box,{paddingBlock:"150",paddingInline:"300",borderRadius:"200",background:u?"bg-surface-active":void 0,children:t.jsx($t,{item:e,isHovered:c,isLoading:n,hideComparison:a,titleVariant:"headingSm",titleFontWeight:"semibold",onClickTitle:s})})})},ti=(e,t)=>{if(0===e&&0===t)return;if(0===t)return e>0?"100%":"0%";const i=(e-t)/t*100;return`${Math.abs(i).toFixed(0)}%`},ii=(e,t)=>{const i=e?.find(e=>e?.type?.toLowerCase()===t.toLowerCase());return i?.total??0},ni=({targets:e,metricKey:t,totalsRow:i,comparisonTotalsRow:n,sort:a})=>{const r=K(i?.[t]),s=K(n?.[t]),o=!!n?.[t],l=e.map(({value:e,label:t})=>(({name:e,currentValue:t,prevValue:i,hasPreviousData:n})=>({name:e,data:[{key:"value",value:t}],metadata:{trend:{value:n?ti(t,i):void 0,direction:t>=i?"upward":"downward",trend:t>=i?"positive":"negative"}}}))({name:t,currentValue:ii(r,e),prevValue:ii(s,e),hasPreviousData:o})),c=e=>e.data[0]?.value??0;return a?[...l].sort((e,t)=>c(t)-c(e)):l};e.EAnalyticMode=void 0,function(e){e.ALL_SESSION="ALL_SESSION",e.FIRST_SESSION="FIRST_SESSION",e.PAGE_ONLY="PAGE_ONLY"}(e.EAnalyticMode||(e.EAnalyticMode={}));const ai=[{id:e.EAnalyticMode.ALL_SESSION,content:"All sessions",helpText:"Count metrics for all sessions where this page shows up anywhere in the journey: before, during, or after other pages.",icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXAAAAC4CAMAAADNC0dgAAAAw1BMVEUAAAD39/f39/f39/f39/f39/f39/f39/f8/Pz39/fb5P////+WrPjj4+MaHB319vfe5v/s7/rp7Ovy8vLx8/nn5+fu7u7n7PzKzdDi6f1wcXL7+/vEzOTGxscphFrd5Pni4+o2OTtTnHpjZnCcsfjQ2fby9/VEk2/f5PFSVFaktvd4spewwPd6gI9mboa6yPWGmt2pqqsuMTbW3OCSwavDz/iwvcJKVHOpqqrl6feLkaGMjo6bm5x+gIA8QUqOo+t3iMFQsBsaAAAAC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Count metrics for sessions only where this page was the very first page visited, then track how they moved through the funnel.",icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXAAAAC4CAMAAADNC0dgAAAAulBMVEUAAAD39/f39/f39/f39/f39/f8/Pz39/fb5P+WrPj///8aHB3j4+P09vfKzdDo6Ojy8vLl5ebd5f7h6P7n7Pzr6+vu7u5wcXLx8/nt8PsxNDn7+/vGxscphFrEzOS8yfakt/je5Pecsfjh4+zQ2fZjZnDr7vdSVFaHm95UnXt4sZd6f41Ek2/H0visvfTk7+vZ3OSOkJZXY4ipqqvX6OBIUm+u0cGRwKqpqqo3i2Vvc4CwtcGFkba82cvy+RBRAAAAB3RSTlMAduu/IJ8QQSls1wAACLJJREFUeNrs1kEKwEAIBEHdNfH/P84lhJzmtsJA1xMaUeN1516NQ9bOir/ajcOuX/JkuAes/Ho3RiS9tTPFi30yZlVEXI0xO6Iag242+KwMPvBROziZo1Y0RhFcI7g7gmsEd0dwjeDuCK4R3B3BNYK7I7hGcHcE1wjujuAawd0RXCO4O4JrBHdHcI3g7giuEdwdwTWCuyO4RnB3BNcI7u5h1+x2nIaBMHo5ThkrcVpbLVGbJlsVFthQEFqEBO//WnizTUddb6bEPyJInKv26kvPTMZu4v/Cef4L/9dJK1wanVtMAYmRRSHBZYY5KYUbhRfydM4Lrc4ZWgIx05x0wg0iKlP0baERMU9jw6BF5VrnV3WdbU4q4TJH1LAYqJ6+G4hOoWxMUT1ngLEhfffNOCeRcKkw73WTcoOoITKmrypRFYhKAsw4J7Zw8l0tXgAqmnHyULwIqXJUBcB8c9IIt2oXLqBCpgrvgTB97802J4lw3fe3CyBG7L6i9+Bi0wFgrjkphEvE3reLielCDR7cu90AzDUnhfB8uEKHSsVrcYP5SAogSoCZ5iQQLlFVixGKeC2uEMZSNBqAmeYkEG7QOJf2+Ovc4tGar6DGcwBEAJhnTgLhudsS37f3sZtPu3Pr86chpZ9c88xJIByxcnz/+HaZKRqioLByPGy/XxZnAzDPnPjCJeZjvi0y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A0G09LF12vzTXTA2vs3NDQP9QihEa3cOvubgu3PwNQffnYOvOfjuHFyMHBNKakyoiDGh4BwTarwpSgfQfpsy2YBXXCfAxYWCW3hVBDLg0cfYx6qBV0f5zL/yy4oTLn9JSvy4U7oaTQAAAABJRU5ErkJggg=="}];e.ANALYTICS_METRIC_TOOLTIP=h,e.AnalyticModeSelector=({activatorText:e="View by",value:i,onChange:n})=>{const a=o.useMemo(()=>ai.map(e=>({...e})),[]);return t.jsx(zt,{activatorText:e,options:a,selected:i,onSelect:e=>{n(e)},maxWidth:"650px"})},e.CAMPAIGN_BACKGROUND_MAIN={ORIGIN:"#2C7DFF",VARIANT:"#F34A70"},e.CHART_MIN_HEIGHT=228,e.COMPARE_DATE_TIME_FILTERS_MAP=Dt,e.ChoiceHelpText=Bt,e.CurrencySelector=({currencies:e,selected:i,preferredAlignment:n="left",activatorText:a,onSelect:r})=>{const{t:s}=c.useTranslation(),d=o.useRef(r),u=o.useCallback(e=>{d.current?.(e)},[]),h=o.useMemo(()=>{if(!e)return[];const t=e.map(e=>({content:e,id:e}));return t.some(e=>e.id===re)||t.push({content:re,id:re}),Me(t,[{attr:"content",order:"asc",preferredValue:re}])},[e]),m=o.useMemo(()=>h.map(e=>({id:e.id,content:e.content,onAction:()=>u(e.id),active:e.id===i,suffix:e.id===i&&t.jsx(l.Icon,{source:ce,tone:"success"}),helpText:e.id===re&&t.jsx(l.Text,{as:"p",fontWeight:"semibold",children:s("Default")})})),[h,i,u,s]),A=o.useMemo(()=>!h?.length||1===h.length&&h[0]?.id===re,[h]);return o.useEffect(()=>{d.current=r}),A?null:t.jsx(Ce,{options:m,selected:i,variant:"action-list",onSelect:e=>u(e),activatorText:a??s("Currency"),maxWidth:"225px",preferredAlignment:n,helpText:t.jsx(l.Box,{padding:"200",paddingBlockStart:"300",paddingBlockEnd:"300",borderColor:"border-tertiary",background:"bg",children:t.jsx(ye,{as:"p",variant:"bodyMd",transformers:{1:e=>t.jsx(be,{linkAction:{url:"https://help.shopify.com/en/manual/international/pricing/exchange-rates#auto-convert",target:"_blank"},children:e},e+"text-link")},children:s("This will follow Shopify's current exchange rate. [1]Read more[]")})})})},e.DATE_TIME_COMPARISON_FILTERS=St,e.DEFAULT_CURRENCY_ANALYTIC=re,e.DEFAULT_CURRENT_PERIOD_LABEL=te,e.DEFAULT_PREVIOUS_PERIOD_LABEL=ie,e.DateTimeFilterInputs=Rt,e.DateTimeFilters=bt,e.DateTimePickerContext=yt,e.DateTimePickerProvider=({children:i,initDate:a,initDateCompare:r})=>{const[s,l]=o.useState(a||{since:b().set("hour",0).valueOf(),until:b().set("hour",0).valueOf(),title:"Today",alias:"today"}),{DATE_TIME_FILTERS:c}=vt(),d=o.useCallback((e,t=s)=>({...jt,...Dt[e]({since:t.since,until:t.until,alias:t.alias})}),[s]),[u,h]=o.useState(r||d(e.CompareDateTimePickerAlias.PREVIOUS_PERIOD)),m=o.useCallback(t=>{"custom"!==u.alias&&u.alias!==e.CompareDateTimePickerAlias.NO_COMPARISON&&h(d(u.alias,t))},[u,d]),A=o.useCallback(e=>{l(e),m(e)},[m]);return t.jsx(yt.Provider,{value:{dateTimePicked:s,setDateTimePicked:A,compareDateTimePicked:u,setCompareDateTimePicked:h,resetDateVersion:()=>{const e=n(s.since).startOf("day").valueOf(),t=n(s.until).startOf("day").valueOf(),i=c.find(i=>i.since===e&&i.until===t);l({...s,isVersion:!1,versionId:void 0,isCurrentVersion:!1,description:"",title:i?.title||s.title,alias:i?.alias||"custom"})}},children:i})},e.GActivatorPopover=fe,e.GBlockCenter=xe,e.GButton=Ee,e.GCheckbox=Ne,e.GCheckboxMultiple=je,e.GCheckboxSingle=Se,e.GChoice=({item:e,disabled:i,isActive:n,suffix:a,isMultipleSelect:r,onClick:s,children:c,position:d="right",boxProps:u,activeStyle:h})=>{const m=o.useMemo(()=>n?h||{box:{outlineWidth:"050",outlineColor:"border-inverse"},text:{fontWeight:"semibold"}}:{box:{outlineWidth:"025",outlineColor:"border"},text:{fontWeight:"regular"}},[h,n]);return t.jsx("div",{onClick:t=>(t=>{t.preventDefault(),t.stopPropagation(),i||s?.(e.value,e.type)})(t),className:"GChoice-ChoiceBox",children:t.jsx(l.Box,{borderRadius:"300",padding:"050",children:t.jsx(l.Box,{paddingBlockStart:"200",paddingBlockEnd:"200",paddingInlineStart:"400",paddingInlineEnd:"400",...m.box,shadow:"100",borderRadius:"300",...u,children:t.jsx(l.BlockStack,{gap:"0",children:t.jsxs(l.InlineStack,{align:"space-between",children:["left"===d&&c,r?t.jsx(l.Checkbox,{label:t.jsx(l.InlineStack,{gap:"100",children:t.jsx(l.Text,{truncate:!0,as:"p",variant:"bodyMd",fontWeight:m.text.fontWeight,children:e.label})}),disabled:i,checked:n,name:e.type,...e.description&&{helpText:t.jsx(Bt,{item:e})}}):t.jsx(l.RadioButton,{label:t.jsxs(l.InlineStack,{gap:"100",children:[t.jsx(l.Text,{truncate:!0,as:"p",variant:"bodyMd",fontWeight:m.text.fontWeight,children:e.label}),e.icon]}),disabled:i,checked:n,name:e.type,...e.description&&{helpText:t.jsx(Bt,{item:e})}}),"right"===d&&c,a]})})})},e.value)})},e.GClickable=Te,e.GDiv=De,e.GI18NText=ye,e.GOptionList=Oe,e.GSelectableMetricChartCard=({metricInfo:e,dataChart:i,defaultActiveTab:n,isLoading:a,isEmptyMetricData:r,hideComparison:s,currentPeriodLabel:c=te,previousPeriodLabel:d=ie,columnTypes:u})=>{const[h,m]=o.useState(n),A=o.useMemo(()=>{const e=h?i[h]:void 0;if(!e)return[];const t={name:c,data:e.current};return s?[t]:[t,{name:d,data:e.previous,isComparison:!0}]},[h,i,s,c,d]);return t.jsxs(l.Card,{children:[t.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${e.length}, 1fr)`,gap:"16px",marginBottom:"16px"},children:e.map(e=>t.jsx(ei,{item:e,isActive:h===e.key,isLoading:a,hideComparison:s,onSelect:m},e.key))}),t.jsx(Qt,{lineChartData:A,isLoading:a,isEmptyMetricData:r,metricKey:h,columnTypes:u})]})},e.GSelector=Ce,e.GSkeletonDisplayText=Pe,e.GTextLink=be,e.GThumbnail=Le,e.GTimePicker=e=>{const{isCompare:i,...n}=e;return t.jsxs(l.InlineStack,{gap:"200",children:[t.jsx(Yt,{...n}),i&&t.jsx(Lt,{rangeAddition:n.rangeAddition,popoverProps:n.popoverProps})]})},e.GTooltip=Ie,e.GTooltipCard=Be,e.GViewBySelector=zt,e.MetricDonutChartCard=({label:e,metricKey:i,targets:n,totalsRow:a,comparisonTotalsRow:r,sort:s,isLoading:c,isEmptyMetricData:u,minHeight:m=294,onClick:A})=>{const g=h[i],{windowWidth:p,windowSize:M}=(()=>{const[e,t]=o.useState(()=>({width:"undefined"!=typeof window?window.innerWidth:0,height:"undefined"!=typeof window?window.innerHeight:0})),i=o.useMemo(()=>({xs:e.width<=768,md:768<e.width&&e.width<=1024,lg:e.width>1024,xsDown:e.width<768,"1200Down":e.width<1200,"1040Down":e.width<1040}),[e.width]),n=!i.lg,a=i.xs;return o.useEffect(()=>{const e=()=>{t({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),{windowSize:e,windowWidth:i,isMobileTabletView:n,isMobileView:a}})(),[T,f]=o.useState(!1),x=o.useMemo(()=>ni({targets:n,metricKey:i,totalsRow:a,comparisonTotalsRow:r,sort:s}),[n,i,a,r,s]);if(c)return t.jsx(Xt,{});const I=e=>_(`${e}`),E=p.lg&&M.width<1500;return t.jsx("div",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:t.jsx(l.Card,{children:t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx(l.InlineStack,{children:t.jsx("div",{className:"hover:cursor-pointer hover:text-[--p-color-text-link-hover]",onClick:e=>{e.stopPropagation(),A()},children:t.jsxs(l.InlineStack,{children:[t.jsx(Be,{tooltip:g,children:t.jsx(l.Text,{as:"h3",variant:"headingMd",children:e})}),T&&t.jsx(l.Icon,{source:ue,tone:"inherit"})]})})}),t.jsx("div",{className:Ae("flex items-center justify-center",{"max-h-[250px] overflow-hidden":E}),children:u?t.jsx(Vt,{title:"No data yet",description:"Data needs time to gather"}):t.jsx(Ht,{minHeight:m,seriesColors:{},children:t.jsx(d.DonutChart,{data:x,legendPosition:"left",showLegendValues:!0,showLegend:!0,theme:"Light",tooltipOptions:{valueFormatter:I},labelFormatter:I})})})]})})})},e.PLACEHOLDER_VALUE="-",e.PREVIOUS_PERIOD_FILTER=jt,e.SERIES_COLORS=ne,e.SingleMetricChartCard=({metricInfo:e,lineChartData:i,isLoading:n,hideComparison:a,columnTypes:r,isEmptyMetricData:s,onClickTitle:c})=>{const[d,u]=o.useState(!1);return t.jsx("div",{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:t.jsx(l.Card,{children:t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx($t,{item:e,isHovered:d,isLoading:n,hideComparison:a,onClickTitle:c}),t.jsx(Qt,{lineChartData:i,isLoading:n,isEmptyMetricData:s,columnTypes:r,metricKey:e.key})]})})})},e.TARGET_CHANNEL=ee,e.TARGET_DEVICES=$,e.TARGET_VISITOR=Z,e.THUMB_PRODUCT_DEFAULT=se,e.TREND_TONE=ae,e.convertToDateTimeFilters=at,e.createLastDaysRange=ht,e.formatDate=Je,e.formatDateTimeRange=Xe,e.formatDayjs=Ze,e.formatMs=e=>{const t=Math.floor(e/1e3);return[Math.floor(t/3600),Math.floor(t%3600/60),t%60].map(e=>String(e).padStart(2,"0")).join(":")},e.formatTime=function(e){return P(e).format(_e.TIME)},e.formatTimeRange=qe,e.getDateRangeTitle=tt,e.getDateTimeFilterBase=function(e,t){const i=b(),n=P(e),a=P(t),r=Ge();for(const e of Object.values(r)){const t=e.getDateRange(i),r=P(t.since),s=P(t.until),o=n.isSame(r,"day"),l=a.isSame(s,"day");if(o&&l)return{title:e.title,alias:e.alias}}return{title:tt(e,t),alias:"custom"}},e.getDateTimeFilterByAlias=He,e.getDateTimeFilterMapping=Ge,e.getEndOfDayBy=$e,e.getLast12Months=xt,e.getLast30Days=pt,e.getLast365Days=Tt,e.getLast7Days=gt,e.getLast90Days=Mt,e.getLastMonth=ft,e.getLastYear=It,e.getMonthAndYearByDateFilter=Et,e.getNoComparison=rt,e.getPreviousMonth=dt,e.getPreviousPeriod=st,e.getPreviousQuarter=ct,e.getPreviousWeek=lt,e.getPreviousYear=ut,e.getToday=mt,e.getVersionDateDescription=nt,e.getVersionDateRangeTitle=it,e.getYesterday=At,e.isDate=Ve,e.isMidnight=et,e.isSameDayTimestamp=Ke,e.isValidDate=Fe,e.isValidYearMonthDayDateString=We,e.parseYearMonthDayDateString=function(e){return n(e).valueOf()},e.useDateTimeFilter=vt,e.useDateTimePicker=Ct,e.useDateTimePickerContext=Ot,e.useVersionDateTimeFilters=e=>{const{t:t}=c.useTranslation(),i=o.useMemo(()=>e?.length?at(e):[],[e]);return{rangeAddition:{title:t("Experiment periods"),rangers:i}}},e.variationName=we});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("@tanstack/react-query"),require("dayjs"),require("dayjs/plugin/quarterOfYear.js"),require("dayjs/plugin/timezone.js"),require("dayjs/plugin/utc.js"),require("react"),require("@shopify/polaris"),require("react-i18next"),require("@shopify/polaris-viz")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","@tanstack/react-query","dayjs","dayjs/plugin/quarterOfYear.js","dayjs/plugin/timezone.js","dayjs/plugin/utc.js","react","@shopify/polaris","react-i18next","@shopify/polaris-viz"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).GemAnalytics={},e.jsxRuntime,null,e.dayjs,e.quarterOfYear,e.timezone,e.utc,e.React,e.Polaris,e.reactI18next,e.polarisViz)}(this,function(e,t,i,n,a,r,s,o,l,c,d){"use strict";var u;!function(e){e.SESSION="sessions",e.ORDERS="orders",e.PAGE_VIEWS="pageviews",e.VISITORS="visitors",e.BOUNCE_RATE="bounce_rate",e.CTR="ctr",e.CONVERSION_RATE="conversion_rate",e.AVG_TIME_ON_PAGE="average_time_on_page",e.ADDED_TO_CART="added_to_cart",e.ADD_TO_CART_RATE="added_to_cart_rate",e.REACHED_CHECKOUT="sessions_that_reached_checkout",e.COMPLETE_CHECKOUT="sessions_that_completed_checkout",e.CART_ADDITION="sessions_with_cart_additions",e.AOV="aov",e.REVENUE="revenue",e.RPV="revenue_per_visitor",e.VISITOR_ITEMS="visitor_items",e.DEVICE_ITEMS="device_items",e.TRAFFIC_SOURCE_ITEMS="traffic_source_items"}(u||(u={}));const m={[u.SESSION]:{title:"Sessions",content:"A period during which a visitor interacts with your online store"},[u.VISITORS]:{title:"Visitors",content:"Number of unique individuals who visit your online store"},[u.BOUNCE_RATE]:{title:"Bounce rate",content:"Percentage of visitors who leave your store after viewing only one page, without interacting further",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Bounce rate"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"sessions with a pageview"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total sessions"})]})},[u.CTR]:{title:"Click-through rate",content:"Percentage of clicks to open new page, compared to the number of times the page was viewed",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Click-through rate"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"total clicks"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total pageviews"})]})},[u.AVG_TIME_ON_PAGE]:{title:"Average time on page",content:"Average duration that visitors spend on a page before clicking to open new page",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Average time on page"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"total time on page"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"(total pageviews - total exits)"})]})},[u.PAGE_VIEWS]:{title:"Pageviews",content:"Number of times a page on your online store has been viewed by visitors"},[u.RPV]:{title:"Revenue per visitor",content:"Average revenue generated from each visitor",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Revenue per visitor"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"total revenue"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total visitors"})]})},[u.ADDED_TO_CART]:{title:"Added to cart",content:"Total number of the event when a customer adds a product to their cart on your online store"},[u.REACHED_CHECKOUT]:{title:"Sessions that reached checkout",content:"Sessions in your online store in which the checkout page was reached"},[u.COMPLETE_CHECKOUT]:{title:"Sessions that completed checkout",content:"Sessions in your online store in which a purchase was completed"},[u.ORDERS]:{title:"Orders",content:"Number of orders that went through this pages"},[u.CONVERSION_RATE]:{title:"Conversion rate",content:"Percentage of online store sessions that completed an order",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Conversion rate"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"sessions that completed checkout"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total sessions"})]})},[u.AOV]:{title:"Average order value",content:"Average value of orders placed in your online store",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Average order value"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"total revenue"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total orders"})]})},[u.REVENUE]:{title:"Revenue",content:"Total income generated from sales after discounts",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Revenue"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"gross sales"}),t.jsx("span",{className:"formula-operator",children:" - "}),t.jsx("span",{className:"formula-input",children:"discounts"})]})},[u.ADD_TO_CART_RATE]:{title:"Add to cart rate",content:"Percentage of sessions in which the customer added item to the cart",formula:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"formula-variable",children:"Added to cart rate"}),t.jsx("span",{children:" = "}),t.jsx("span",{className:"formula-input",children:"sessions with cart additions"}),t.jsx("span",{className:"formula-operator",children:" / "}),t.jsx("span",{className:"formula-input",children:"total sessions"})]})},[u.CART_ADDITION]:{title:"Sessions with cart additions",content:"Sessions in your online store in which a visitor added item to the cart"},[u.VISITOR_ITEMS]:{title:"Sessions by visitor type",content:"<p>Numbers of new and returning visitors</p>",contentList:["New visitor: who accesses your store for the first time after GemX installation","Returning visitor: who comes back to your store after GemX installation"]},[u.DEVICE_ITEMS]:{title:"Sessions by device type",content:"Sessions in your online store by the visitor's device type"},[u.TRAFFIC_SOURCE_ITEMS]:{title:"Sessions by traffic source",content:"Sessions on your page by where visitors come from"}};var h,A,g,p,M,T,f,x,I,j,N,D,S,E,v,O,y,C;!function(e){e.DATE="DATE",e.ARRAY="ARRAY",e.OBJECT="OBJECT",e.STRING="STRING",e.INTEGER="INTEGER",e.CURRENCY="CURRENCY",e.PERCENT="PERCENT",e.DURATION="DURATION",e.MONTH="MONTH_TIMESTAMP",e.QUARTER="QUARTER_TIMESTAMP",e.DAY="DAY_TIMESTAMP",e.WEEK="WEEK_TIMESTAMP",e.YEAR="YEAR_TIMESTAMP",e.HOUR="HOUR_TIMESTAMP"}(h||(h={})),function(e){e.CAMPAIGNS="experiments",e.VISITOR_ITEMS="visitor_items",e.DEVICE_ITEMS="device_items",e.TRAFFIC_SOURCE_ITEMS="traffic_source_items"}(A||(A={})),function(e){e.ALL_SESSION="ALL_SESSION",e.FIRST_SESSION="FIRST_SESSION",e.PAGE_ONLY="PAGE_ONLY"}(g||(g={})),function(e){e.SESSIONS="sessions",e.SALES="sales"}(p||(p={})),function(e){e.NEW="new",e.RETURNING="returning"}(M||(M={})),function(e){e.DESKTOP="desktop",e.MOBILE="mobile",e.TABLET="tablet"}(T||(T={})),function(e){e.DIRECT="direct",e.EMAIL="email",e.REFERRAL="referral",e.ORGANIC_SOCIAL="organic-social",e.ORGANIC_SEARCH="organic-search",e.PAID_SOCIAL="paid-social",e.PAID_SEARCH="paid-search",e.SMS="sms"}(f||(f={})),function(e){e.EQ="=",e.IN="IN",e.LIKE="LIKE"}(x||(x={})),function(e){e.OR="OR",e.AND="AND"}(I||(I={})),function(e){e.DEVICE="device",e.DEVICES="devices",e.VISITOR="visitor_type",e.VISITORS="visitor_types",e.TRAFFIC_SOURCE="traffic_source",e.TRAFFIC_SOURCES="traffic_sources",e.VERSION="version",e.VERSIONS="versions",e.SINGLE_PAGE="page_path",e.LIST_PAGE="page_paths",e.GROUP_CAMPAIGN_ITEM="group_campaign_item",e.GROUP_CAMPAIGN_ITEMS="group_campaign_items",e.SINGLE_CAMPAIGN="experiment_id",e.GROUP_CAMPAIGN="experiment_group_id",e.CAMPAIGN_VERSION_ID="version_id",e.GROUP_CAMPAIGN_VERSION_ID="group_version_id"}(j||(j={})),function(e){e.DEVICE_OPERATOR="deviceOperator",e.VISITOR_OPERATOR="visitorOperator",e.TRAFFIC_SOURCE_OPERATOR="trafficSourceOperator",e.VERSION_OPERATOR="versionOperator",e.PAGE_OPERATOR="pageOperator",e.CAMPAIGN_ITEM_OPERATOR="campaignItemOperator"}(N||(N={})),function(e){e.NONE="",e.TOTALS="TOTALS",e.ALL="WITH GROUP_TOTALS, TOTALS"}(D||(D={})),function(e){e.ASC="ASC",e.DESC="DESC"}(S||(S={})),function(e){e.PAGE_ITEMS="page_items",e.PAGE_PATHS="page_paths"}(E||(E={})),function(e){e.PAGE_PATH="page_path"}(v||(v={})),function(e){e.SHOPIFY_PAGE_ID="shopify_page_id",e.LOCATION_PATH="location_path",e.PAGE_TYPE="page_type",e.PAGE_TITLE="page_title",e.PAGE_PATH="page_path",e.TEMPLATE_SUFFIX="template_suffix"}(O||(O={})),function(e){e.DEFAULT="DEFAULT",e.COMPARISON="COMPARISON",e.TOTALS="TOTALS",e.COMPARISON_TOTALS="COMPARISON_TOTALS"}(y||(y={})),function(e){e.HOUR="hour",e.DAY="day",e.WEEK="week",e.MONTH="month",e.QUARTER="quarter",e.YEAR="year"}(C||(C={})),y.DEFAULT,y.COMPARISON,y.TOTALS,y.COMPARISON_TOTALS,I.OR,N.DEVICE_OPERATOR,j.DEVICE,j.DEVICES,j.DEVICE,N.VISITOR_OPERATOR,j.VISITOR,j.VISITORS,j.VISITOR,N.TRAFFIC_SOURCE_OPERATOR,j.TRAFFIC_SOURCE,j.TRAFFIC_SOURCES,j.TRAFFIC_SOURCE,N.VERSION_OPERATOR,j.VERSION,j.VERSIONS,j.VERSION,N.PAGE_OPERATOR,j.SINGLE_PAGE,j.LIST_PAGE,j.SINGLE_PAGE,N.CAMPAIGN_ITEM_OPERATOR,j.GROUP_CAMPAIGN_ITEM,j.GROUP_CAMPAIGN_ITEMS,j.GROUP_CAMPAIGN,j.SINGLE_CAMPAIGN,j.SINGLE_CAMPAIGN,j.GROUP_CAMPAIGN;const R=/\.0+$/,k=(e,t=2)=>(e=>`${e}`.replace(R,""))(e.toFixed(t)),b=e=>{const[t,i,n]=e.split(".").map(e=>Number(e));return 1e6*(t??0)+1e3*(i??0)+(n??0)},P=e=>e>0&&e<.005,w=(e,t,i=2)=>{const n=((e,t,i=2)=>{if("number"!=typeof e||!t)return;return 0===e?0:parseFloat(k(e/t*100,i))})(e,t,i);if("number"==typeof n)return P(n)?"~0%":`${n}%`},L=(e,t=2)=>P(e)?"~0%":`${k(e,t)}%`;function z(e){return"string"==typeof e?e:"object"==typeof e&&null!==e&&Object.keys(e).filter(t=>e[t]).join(" ")}function Y(...e){return e.map(z).filter(Boolean).join(" ")}function B(e,t,i="asc"){if(e===t)return 0;if(void 0===e||void 0===t)return void 0===e&&void 0!==t?"asc"===i?-1:1:void 0===t&&void 0!==e?"asc"===i?1:-1:0;const n=e=>"boolean"!=typeof e&&!isNaN(Date.parse(e)),a=e=>"string"==typeof e;let r=0;if(n(e)&&n(t)){r=(e instanceof Date?e:new Date(e))>(t instanceof Date?t:new Date(t))?1:-1}else r=(a(e)&&a(t),e>t?1:-1);return"asc"===i?-r:r}function U(e,t){return"string"==typeof t?t.replace(/\[(\d+)\]/g,".$1").split(".").reduce((e,t)=>e?.[t],e):e[t]}function H(e,t){return t.reduce((e,t)=>function(e,t){const{attr:i,order:n="asc",preferredValue:a,backupAttr:r,orderArrayAttr:s,orderArray:o}=t;return e.slice().sort((e,t)=>{const l=U(e,i),c=U(t,i);if(void 0!==a){if(l===a&&c!==a)return-1;if(c===a&&l!==a)return 1}if(s===i&&o){const e=o[n];return e.indexOf(l)-e.indexOf(c)}const d=B(l,c,n);return 0!==d?d:r?B(e[r],t[r],n):0})}(e,t),e.slice())}n.extend(s),n.extend(r),n.extend(a);let G="UTC";const Q="YYYY-MM-DD HH:mm:ss";const W=e=>e?n(e).tz(G):n().tz(G),_=e=>e?n.tz(n(e).format(Q),G):n.tz(n().format(Q),G),V=e=>n(e?W(e).format(Q):W().format(Q)),F=e=>V(e).toDate();var J;function q(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}!function(e){e.DAY="DAY",e.HOUR="HOUR",e.MONTH="MONTH",e.QUARTER="QUARTER",e.WEEK="WEEK",e.YEAR="YEAR"}(J||(J={}));const X=60,K=3600,Z=(e,t,i)=>{if(!e)return"";const n=i?.isExpandDetail?{formatHouse:"MMM D, h:mm A",formatDay:"MMM D, YYYY",formatMonth:"MMM YYYY",formatYear:"MMM YYYY"}:{formatHouse:"h A",formatDay:"MMM D",formatMonth:"MMM YYYY",formatYear:"YYYY"};switch(t){case J.HOUR:return W(e).format(n.formatHouse);case J.DAY:case J.WEEK:return W(e).format(n.formatDay);case J.MONTH:return W(e).format(n.formatMonth);case J.QUARTER:{const t=W(e);return`Q${t.quarter()} ${t.format("YYYY")}`}case J.YEAR:return W(e).format(n.formatYear)}return W(e).format(n.formatMonth)},$=({value:e,formatter:t,getTextPrice:i,name:n})=>{if(null!==e&&("object"==typeof e||Array.isArray(e)))return e;switch(t){case h.INTEGER:return q((e??0).toString());case h.CURRENCY:return i?i(e,!1):`${e??0}`;case h.DATE:return(e=>{if(!e)return"None";const t=W(e),i=W(),n=W().subtract(1,"day"),a=t.format("YYYY-MM-DD")===i.format("YYYY-MM-DD"),r=t.format("YYYY-MM-DD")===n.format("YYYY-MM-DD");if(a)return`Today at ${t.format("HH:mm")}`;if(r)return`Yesterday at ${t.format("HH:mm")}`;const s=i.diff(t,"day");return s>=0&&s<7?`${t.format("dddd")} at ${t.format("HH:mm")}`:`${t.format("MMM D")} at ${t.format("hh:mm a")}`})(e);case h.PERCENT:return"number"!=typeof e?w(0,1,2)??"":w(e/100,1,2)??"";case h.DURATION:return(e=>{let t=e;Number.isFinite(e)&&null!=e||(t=0);const i=k(t);if(t>=K)return`${Math.floor(t/K)}h ${Math.floor(t%K/X)}m ${Math.floor(t%X)}s`;if(t>=X)return`${Math.floor(t/X)}m ${Math.floor(t%X)}s`;return`${i}s`})(Number(e));case h.STRING:{const t=n===A.CAMPAIGNS?"":"None";return e??t}case h.DAY:return Z(e,J.DAY,{isExpandDetail:!0});case h.HOUR:return Z(e,J.HOUR,{isExpandDetail:!0});case h.MONTH:return Z(e,J.MONTH,{isExpandDetail:!0});case h.YEAR:return Z(e,J.YEAR);case h.WEEK:return Z(e,J.WEEK,{isExpandDetail:!0});case h.QUARTER:return Z(e,J.QUARTER,{isExpandDetail:!0});case h.OBJECT:case h.ARRAY:return e;default:return`${e}`}},ee=e=>{try{const t=(e=>{if(e)return"string"==typeof e?JSON.parse(e):e})(e);if(!Array.isArray(t))return;return t}catch{return}},te=e=>ee(e)?.map(e=>({...e,total:Number(e.total)})),ie=(e,t)=>{const i=e?.[t];return"number"==typeof i?i:0};var ne;!function(e){e.NEXT="NEXT",e.PREV="PREV"}(ne||(ne={})),M.NEW,M.RETURNING,T.DESKTOP,T.TABLET,T.MOBILE,f.DIRECT,f.EMAIL,f.REFERRAL,f.ORGANIC_SOCIAL,f.ORGANIC_SEARCH,f.PAID_SOCIAL,f.PAID_SEARCH,f.SMS;const ae={current:"rgba(64, 176, 230, 1)",comparison:"rgba(161, 202, 231, 1)",all:["#2C7DFF","#F34A70"]},re="#007F5F",se="#4A4A4A",oe="USD";var le=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M3.5 10a.75.75 0 0 1 .75-.75h9.69l-2.72-2.72a.75.75 0 1 1 1.06-1.06l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06-1.06l2.72-2.72h-9.69a.75.75 0 0 1-.75-.75Z"}))};le.displayName="ArrowRightIcon";var ce=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M7.75 3.5a.75.75 0 0 0-1.5 0v.407a3.075 3.075 0 0 0-.702.252 3.75 3.75 0 0 0-1.64 1.639c-.226.444-.32.924-.365 1.47-.043.531-.043 1.187-.043 2v1.464c0 .813 0 1.469.043 2 .045.546.14 1.026.366 1.47a3.75 3.75 0 0 0 1.639 1.64c.444.226.924.32 1.47.365.531.043 1.187.043 2 .043h3.383c.323 0 .542 0 .735-.02a3.75 3.75 0 0 0 3.344-3.344c.02-.193.02-.412.02-.735v-2.883c0-.813 0-1.469-.043-2-.045-.546-.14-1.026-.366-1.47a3.75 3.75 0 0 0-1.639-1.64 3.076 3.076 0 0 0-.702-.251v-.407a.75.75 0 0 0-1.5 0v.259c-.373-.009-.794-.009-1.268-.009h-1.964c-.474 0-.895 0-1.268.009v-.259Zm-1.521 1.995c.197-.1.458-.17.912-.207.462-.037 1.057-.038 1.909-.038h1.9c.853 0 1.447 0 1.91.038.453.037.714.107.912.207.423.216.767.56.983.984.1.197.17.458.207.912.014.18.024.38.029.609h-9.982c.006-.228.015-.429.03-.61.036-.453.106-.714.206-.911a2.25 2.25 0 0 1 .984-.984Zm-1.229 4.005v1.2c0 .853 0 1.447.038 1.91.037.453.107.714.207.912.216.423.56.767.984.983.197.1.458.17.912.207.462.037 1.057.038 1.909.038h3.306c.385 0 .52-.001.626-.012a2.25 2.25 0 0 0 2.006-2.006c.011-.106.012-.241.012-.626v-2.606h-10Z"}))};ce.displayName="CalendarIcon";var de=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M15.78 5.97a.75.75 0 0 1 0 1.06l-6.5 6.5a.75.75 0 0 1-1.06 0l-3.25-3.25a.75.75 0 1 1 1.06-1.06l2.72 2.72 5.97-5.97a.75.75 0 0 1 1.06 0Z"}))};de.displayName="CheckIcon";var ue=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M5.72 8.47a.75.75 0 0 1 1.06 0l3.47 3.47 3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06Z"}))};ue.displayName="ChevronDownIcon";var me=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M7.72 14.53a.75.75 0 0 1 0-1.06l3.47-3.47-3.47-3.47a.75.75 0 0 1 1.06-1.06l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 0 1-1.06 0Z"}))};me.displayName="ChevronRightIcon";var he=function(e){return o.createElement("svg",Object.assign({viewBox:"0 0 20 20"},e),o.createElement("path",{fillRule:"evenodd",d:"M14.53 12.28a.75.75 0 0 1-1.06 0l-3.47-3.47-3.47 3.47a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06Z"}))};he.displayName="ChevronUpIcon";const Ae=({children:e,fullWidth:i=!1,cursor:n="pointer",onClick:a,onMouseEnter:r,onMouseLeave:s})=>t.jsx("div",{role:"button",tabIndex:0,className:Y({"w-full":i,"cursor-pointer":"pointer"===n,"cursor-default":"default"===n,"cursor-not-allowed":"not-allowed"===n}),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())},onClick:a,onMouseEnter:r,onMouseLeave:s,children:e}),ge=({onClick:e,active:i,content:n,textProps:a,boxProps:r,disabled:s,icon:c})=>{const d=o.useMemo(()=>s?{borderColor:"border-disabled",background:"bg-surface-disabled",...r}:{shadow:i?"button-inset":"button",background:i?"bg-fill-active":"bg-fill",...r},[i,s,r]),u=o.useMemo(()=>s?"text-[var(--p-color-text-disabled)]":i?"text-[var(--p-color-text-subdued)]":"text-[var(--p-color-text)]",[i,s]),m=o.useMemo(()=>t.jsx(l.Text,{as:"span",variant:"bodyMd",fontWeight:"medium",tone:s?"inherit":a?.tone,truncate:!0,...a?.variant&&{variant:a.variant},children:n}),[n,a,s]),h=o.useCallback(()=>{s||e()},[s,e]);return t.jsx(Ae,{cursor:s?"default":"pointer",onClick:h,children:t.jsx("div",{className:Y(u),children:t.jsxs(l.Box,{padding:"150",paddingInline:"300",paddingInlineEnd:"150",borderRadius:"200",...d,children:[c&&t.jsxs(l.InlineStack,{gap:"200",align:"center",wrap:!1,children:[t.jsx(l.Box,{children:t.jsx(l.Icon,{source:c})}),m]}),!c&&t.jsxs(l.InlineGrid,{columns:"1fr 20px",gap:"200",alignItems:"center",children:[m,t.jsx(l.Icon,{source:i?he:ue})]})]})})})},pe=({height:e,align:i,inlineAlign:n,display:a,...r})=>{const s=o.useMemo(()=>{if("sticky"!==r.position)return{};const e={position:"sticky"};return r.insetInlineStart&&(e.insetInlineStart=4*Number(r.insetInlineStart)),r.insetInlineEnd&&(e.insetInlineEnd=4*Number(r.insetInlineEnd)),r.insetBlockStart&&(e.insetBlockStart=4*Number(r.insetBlockStart)),r.insetBlockEnd&&(e.insetBlockEnd=4*Number(r.insetBlockEnd)),e},[r.position,r.insetInlineStart,r.insetInlineEnd,r.insetBlockStart,r.insetBlockEnd]);return t.jsx("div",{className:"Polaris-GBlockCenter",style:{...s,"--gp-block-center-height":e,"--gp-block-center-display":a,"--gp-block-center-align":i,"--gp-block-center-inline-align":n,"--gp-block-center-overflow-x":r.overflowX,"--gp-block-center-overflow-y":r.overflowY},children:t.jsx(l.Box,{...r})})},Me=({isEnabled:e=!0,content:i,maxWidth:n,...a})=>e&&!!i?t.jsx(l.Tooltip,{width:"wide",hoverDelay:500,content:i,...a,accessibilityLabel:n?.toString()}):a.children,Te=({activatorWrapper:e,children:i,iconRight:n,inset:a,stopPropagation:r=!0,onClick:s,themeTone:o="light",variant:c,...d})=>{const u=e||"div",m="neutral"===c,h=m?void 0:c,A=t.jsx(Me,{activatorWrapper:"tooltip-content",...d.tooltip,children:t.jsx(u,{className:Y("Polaris-GButton",{"Polaris-GButton--icon-right":n,"Polaris-GButton--dark":"dark"===o,"Polaris-GButton--neutral":m,"cursor-default":d.disabled,"Polaris-GButton--fullWidth":d.fullWidth,flex:a}),onClick:e=>{r&&e.stopPropagation(),d.disabled||s?.()},children:t.jsx(l.Button,{variant:h,...d,children:i})})});return a?t.jsx(l.Box,{padding:"100",children:A}):A},fe=({...e})=>e.multiple?t.jsx(xe,{...e}):t.jsx(Ie,{...e}),xe=({options:e,onChange:i,onChangeSingleValue:n,emptySelected:a,selected:r,onHover:s,itemHovered:c,dependentDisabledValues:d})=>{const[u,m]=o.useState([]),h=e=>{s&&s(e)};return o.useEffect(()=>{m(()=>r?e.filter(e=>r.includes(e.value)).map(e=>e.value):[])},[r]),t.jsx(l.BlockStack,{children:e.map(r=>{const s=d?.has(r.value),o=a&&1===e.filter(e=>e.selected).length&&a,A=()=>{o||(e=>{n&&n(e);const t=u.includes(e)?u.filter(t=>t!==e):[...u,e];m(t),i(t)})(r.value)};return t.jsx("div",{className:Y("flex w-full items-center justify-between",{"cursor-not-allowed":o,"cursor-pointer":!o,"bg-surface-hover rounded-lg":c===r.value}),onClick:()=>{o||r.disabled||A()},onMouseEnter:()=>h(r.value),onMouseLeave:()=>h(void 0),children:o?t.jsx(Me,{isEnabled:r.tooltip?.isEnabled,...r.tooltip,children:t.jsx(l.Box,{paddingBlock:"150",paddingInline:"200",width:"100%",children:t.jsxs(l.InlineStack,{blockAlign:"center",gap:"150",children:[t.jsx(l.Checkbox,{label:r.label,labelHidden:!0,checked:r.selected,disabled:!0}),t.jsx(l.Text,{as:"p",variant:"bodyMd",tone:"subdued",children:r.label})]})})}):t.jsx(l.Box,{paddingBlock:"150",paddingInline:"200",minWidth:"0",children:t.jsxs(l.InlineStack,{blockAlign:"center",gap:"150",wrap:!1,children:[t.jsx(l.Checkbox,{label:r.label,labelHidden:!0,checked:!s&&u.includes(r.value),onChange:A,disabled:r.disabled}),t.jsxs(l.Box,{minWidth:"0",children:[t.jsx(l.Text,{as:"p",variant:"bodyMd",truncate:!0,tone:s?"disabled":"inherit",children:r.label}),r.description&&t.jsx(l.Text,{as:"p",variant:"bodySm",tone:"disabled",truncate:!0,children:r.description})]})]})})},r.value)})})},Ie=({options:e,onChange:i})=>t.jsx(l.BlockStack,{gap:"300",children:e.map(e=>t.jsx(l.RadioButton,{label:e.label,checked:e.selected,onChange:()=>i(e.value),helpText:e.helpText?t.jsx(Le,{item:e}):void 0},e.value))}),je=o.forwardRef(({children:e,onClick:i,...n},a)=>{const r=o.useCallback(e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i?.())},[i]);return t.jsx("div",{ref:a,...n,role:"button",tabIndex:0,onKeyDown:r,onClick:i,children:e})});je.displayName="GDiv";const Ne=/\[(\d+)\](.*?)\[\]/g,De=e=>{const{children:i,transformers:n}=e;if(!n||0===Object.values(n).length)return t.jsx(l.Text,{...e,children:i});return t.jsx(l.Text,{...e,children:"string"==typeof i?(e=>{const i=[];let a=0;return e.replace(Ne,(t,r,s,o)=>{i.push(e.slice(a,o));const l=n[r];return"function"==typeof l?i.push(l(s)):i.push(t),a=o+t.length,t}),i.push(e.slice(a)),i.map((e,i)=>t.jsx(o.Fragment,{children:e},i))})(i):i})};function Se({options:e,selected:i,onChange:n}){const a=e=>{n([e])};return t.jsx(l.Box,{padding:"150",children:t.jsx(l.BlockStack,{gap:"100",children:e.map(e=>{const n=i.includes(e.value);return t.jsx("div",{role:"option","aria-selected":n,tabIndex:0,onClick:()=>a(e.value),onKeyDown:t=>{return i=t,n=e.value,void("Enter"!==i.key&&" "!==i.key||(i.preventDefault(),a(n)));var i,n},className:Y("p-1.5 pl-4 rounded-lg cursor-pointer",{"bg-[#F1F1F1]":n,"hover:bg-[#F1F1F1]":!n}),children:t.jsxs(l.InlineStack,{align:"space-between",blockAlign:"center",wrap:!1,gap:"200",children:[t.jsx(l.Box,{minWidth:"0",children:e.label}),n&&t.jsx(l.Box,{children:t.jsx(l.Icon,{source:de})})]})},e.value)})})})}const Ee=e=>{const[i,n]=o.useState(!1),{activatorText:a,selected:r,options:s,emptyLabel:c,preferredAlignment:d="right",formatActivatorContent:u=e=>e.join(", ")}=e,m=o.useCallback(()=>n(e=>!e),[]),h=o.useMemo(()=>s.filter(e=>e.active||e.id===r).map(e=>e.content||"").filter(e=>!!e),[s,r]),A=o.useMemo(()=>{if(h.length){const e=u(h);return a?`${a}: ${e}`:e}return c?a?`${a}: ${c}`:c:a},[h,c,a,u]),g=o.useMemo(()=>{switch(e.variant){case"choice":return t.jsx(ve,{...e,setPopoverActive:m});case"action-list":return t.jsx(Oe,{...e,setPopoverActive:m})}},[e,m]);return t.jsx(l.Popover,{active:i,activator:t.jsx("div",{className:"flex items-center gap-1",children:t.jsx(l.Button,{onClick:m,disclosure:i?"up":"down",children:A})}),autofocusTarget:"first-node",fluidContent:!0,onClose:m,preferredAlignment:d,children:g})},ve=({options:e,selected:i,onSelect:n,maxWidth:a,minWidth:r,clearable:s,setPopoverActive:d})=>{const{t:u}=c.useTranslation(),m=o.useMemo(()=>e?.length?e.map(e=>({value:e.id,label:e.content||"",selected:!1})):[],[e]),h=o.useCallback(e=>{n(e)},[n]);return t.jsx(l.Box,{maxWidth:a,minWidth:r,paddingBlock:"150",children:t.jsxs(l.BlockStack,{children:[t.jsx(l.BlockStack,{gap:"0",children:t.jsx(fe,{multiple:!0,options:m,selected:i,onChange:h})}),s&&t.jsx(l.Box,{paddingBlock:"150",paddingInline:"200",children:t.jsx(l.InlineStack,{blockAlign:"center",align:"start",children:t.jsx(l.Button,{disabled:!i?.length,onClick:()=>{h([]),d(!1)},variant:"plain",children:u("Clear")})})})]})})},Oe=({options:e,selected:i,onSelect:n,helpText:a,maxWidth:r,minWidth:s,setPopoverActive:c})=>{const d=o.useCallback(e=>{n(e),c(!1)},[n,c]),u=o.useMemo(()=>e?.length?e.map(e=>({id:e.id,content:e.content,helpText:e.helpText,onAction:()=>d(e.id),active:e.active||e.id===i,suffix:(e.active||e.id===i)&&t.jsx(l.Icon,{source:de,tone:"success"})})):[],[e,i,d]);return t.jsx(l.Box,{maxWidth:r,minWidth:s,children:t.jsxs(l.BlockStack,{gap:"0",children:[t.jsx(l.ActionList,{actionRole:"menuitem",items:u}),a]})})},ye=({linkAction:e,isDisabled:i,disabledFocus:n,children:a})=>!e||i?t.jsx(t.Fragment,{children:a}):t.jsx("span",{className:Y("GTextLink",{"GTextLink--disabled-focus":n}),children:t.jsx(l.Link,{...e,children:t.jsx(t.Fragment,{children:a})})}),Ce=e=>{const i=e.height??"50px";return t.jsxs("div",{className:"Polaris-GSkeletonDisplayText",children:[t.jsx("style",{children:`.Polaris-GSkeletonDisplayText .Polaris-SkeletonDisplayText__DisplayText { height: ${i} !important; }`}),t.jsx(l.SkeletonDisplayText,{maxWidth:"100%",size:"extraLarge"})]})};const Re=({source:e,alt:i,size:n,grayscale:a,defaultSource:r="data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSI5MCIKICBoZWlnaHQ9IjcyIgogIHZpZXdCb3g9IjAgMCA5MCA3MiIKICBmaWxsPSJub25lIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKPgogIDxwYXRoCiAgICBkPSJNNDguNzUgMzQuNUM0OS45OTI2IDM0LjUgNTEgMzMuNDkyNiA1MSAzMi4yNUM1MSAzMS4wMDc0IDQ5Ljk5MjYgMzAgNDguNzUgMzBDNDcuNTA3NCAzMCA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gMzkuMzQyOCA0My4xMzIxQzM4LjcwNzcgNDIuODA4NiAzOC4xOTE0IDQyLjI5MjMgMzcuODY3OSA0MS42NTcyQzM3LjcxNjkgNDEuMzYwOSAzNy42MTMyIDQwLjk2OTggMzcuNTU3NiA0MC4yODlaIgogICAgZmlsbD0iIzYxNjE2MSIKICAvPgo8L3N2Zz4K",width:s="80",height:o="80",classRemoved:l=!1})=>{var c;const d=a&&"Polaris-GThumbnail--filter",u=Y("Polaris-Thumbnail",n&&`${"Polaris-Thumbnail--size"}${(c=n).charAt(0).toUpperCase()}${c.slice(1)}`),m=t.jsx("img",{onError:e=>{e.currentTarget.src=r},alt:i??"Thumbnail",src:`${e??r}`,width:s,height:o,style:{"--gp-grayscale-percentage":a||"100%"},className:Y("Polaris-GThumbnail",d)});return l?m:t.jsx("span",{className:u,children:m})},ke={default:"w-[210px]",wide:"w-[320px]",large:"w-[328px]"},be={start:"flex justify-start",center:"flex justify-center",end:"flex justify-end"},Pe=o.forwardRef((e,i)=>{const{tooltip:n,wrapper:a="div",activatorProps:r,isHideBorder:s,alignment:c,delay:d=500,textDecoration:u="none",popoverRef:m,preferredAlignment:h="left",showArrow:A=!1}=e,{width:g="default"}=n??{},[p,M]=o.useState(!1),T=a,f=ke[g],x=o.useRef(null),I=()=>{x.current&&(clearTimeout(x.current),x.current=null),M(!1)};return o.useImperativeHandle(i,()=>({onClose:I})),t.jsx(T,{className:Y("GTooltipCard cursor-pointer",c&&be[c],{"GTooltipCard--text-underline":"underline"===u}),onMouseEnter:()=>{x.current=setTimeout(()=>{M(!0)},d)},onMouseLeave:I,children:t.jsx(l.Popover,{ref:m,activator:s?t.jsx(l.InlineStack,{children:e.children}):t.jsx(l.Box,{borderBlockEndWidth:"025",borderStyle:"dashed",borderColor:"border-tertiary",as:a,...r,children:e.children}),activatorWrapper:a,onClose:()=>{},active:p,preferredPosition:"below",preferredAlignment:h,children:n&&t.jsx("div",{className:Y(f,{"GTooltipCard-arrow":A}),children:t.jsx(l.Box,{padding:"400",children:t.jsxs(l.BlockStack,{gap:"200",children:[t.jsxs(l.BlockStack,{gap:"100",children:[t.jsx(l.Text,{as:"span",variant:"headingSm",fontWeight:"semibold",children:n.title}),t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx(l.Text,{as:"span",variant:"bodyMd",tone:"subdued",fontWeight:"medium",children:t.jsx("span",{dangerouslySetInnerHTML:{__html:n.content}})}),n.contentList&&t.jsx(l.List,{type:"bullet",children:n.contentList.map(e=>t.jsx(l.List.Item,{children:t.jsx(l.Text,{as:"span",variant:"bodyMd",tone:"subdued",fontWeight:"medium",children:e})},e))})]})]}),n.formula&&t.jsx("div",{className:"rounded-md font-mono",style:{fontSize:"12px"},children:n.formula})]})})})})})});Pe.displayName="GTooltipCard";const we=({activatorText:e,selected:i,options:n,minWidth:a,maxWidth:r,preferredAlignment:s="right",onSelect:c})=>{const[d,u]=o.useState(!1),[m,h]=o.useState(null),A=()=>u(e=>!e),g=o.useMemo(()=>n.find(e=>e.id===i),[n,i]),p=o.useMemo(()=>{if(g){const t=g.title??g.content;return e?`${e}: ${t}`:t}return e},[g,e]);return t.jsx(l.Popover,{active:d,activator:t.jsx(ge,{active:d,content:p,textProps:{variant:"bodySm"},onClick:A}),autofocusTarget:"first-node",fluidContent:!0,onClose:A,preferredAlignment:s,children:t.jsx(l.Box,{maxWidth:r,minWidth:a,padding:"200",children:t.jsx(l.BlockStack,{gap:"200",children:n.map(e=>{const n=e.id===i,a=m===e.id,r=n?"input-border":a?"border-hover":"transparent";return t.jsx(l.Box,{padding:"150",borderWidth:"025",borderColor:r,borderRadius:"100",children:t.jsx("div",{onClick:()=>{return t=e.id,c(t),void u(!1);var t},className:"cursor-pointer",onMouseEnter:()=>h(e.id),onMouseLeave:()=>h(null),children:t.jsxs(l.InlineStack,{gap:"300",align:"space-between",blockAlign:"center",wrap:!1,children:[t.jsxs(l.InlineStack,{gap:"300",blockAlign:"center",wrap:!1,children:[t.jsx("div",{className:"bg-surface-secondary flex items-center justify-center rounded-md min-w-[184px] h-[92px]",children:t.jsx("img",{src:e.icon,alt:e.content,className:"w-full h-full object-contain"})}),t.jsxs(l.BlockStack,{gap:"100",children:[t.jsx(l.Text,{as:"span",variant:"bodyMd",fontWeight:"semibold",children:e.content}),t.jsx(l.Text,{as:"p",variant:"bodyMd",tone:"subdued",children:e.helpText})]})]}),n&&t.jsx(l.Box,{children:t.jsx(l.Icon,{source:de})})]})})},e.id)})})})})},Le=({item:e})=>t.jsxs(l.Text,{as:"p",variant:"bodyMd",children:[e.description,e.inlineAction&&t.jsx(l.Link,{monochrome:!0,onClick:()=>{e.inlineAction?.onAction?e.inlineAction?.onAction():window.open(e.inlineAction?.url,e.inlineAction?.target??"_blank")},children:e.inlineAction?.content})]}),ze=()=>t.jsx(Ce,{height:"188px"}),Ye={comparison:ae.comparison,single:ae.current,all:[...ae.all]},Be=({children:e,minHeight:i=228,seriesColors:n=Ye})=>t.jsx(d.PolarisVizProvider,{themes:{Light:{chartContainer:{minHeight:i},grid:{horizontalOverflow:!0,verticalOverflow:!0,horizontalMargin:0},seriesColors:n}},children:e});const Ue=({metricKey:e,columnTypes:t})=>{const{formatData:i}=(e=>{const t=({value:t,formatter:i,name:n})=>$({value:t,formatter:i,getTextPrice:e,name:n});return{formatData:t,computeMetric:({metric:e,previousMetric:i,metricKey:n,formatter:a})=>{if(!(e=>{const t=e?.sessions;return"number"==typeof t&&t>0})(e))return{value:0,change:"-"};const r=ie(e,n),s=ie(i,n),o=t({value:r,formatter:a,name:n});return 0===r&&0!==s?{value:o,change:-100}:0===s?{value:o,change:"-"}:{value:o,change:(r-s)/s*100}}}})(),n=e?t?.[e]:void 0,a=e=>String(i({value:e,formatter:n})),r={labelFormatter:e=>a(Number(e)||0)};return{formatValue:a,yAxisOptions:r}},He=({lineChartData:e,isLoading:i,isEmptyMetricData:n,columnTypes:a,metricKey:r})=>{const{formatValue:s,yAxisOptions:o}=Ue({metricKey:r,columnTypes:a||{}});return r?i?t.jsx(ze,{}):n?t.jsx(Ge,{title:"No data yet",description:"Data needs time to gather"}):t.jsx(Be,{children:t.jsx(d.LineChart,{data:e,yAxisOptions:o,theme:"Light",tooltipOptions:{titleFormatter:()=>`${m[r]?.title??""}`,keyFormatter:e=>e,renderTooltipContent:e=>t.jsx(Ve,{data:e,formatValue:s})},showLegend:!0})}):t.jsx(t.Fragment,{})};const Ge=({boxProps:e,minHeight:i,description:n,title:a})=>t.jsx(l.Box,{minWidth:"100%",...e,children:t.jsx(pe,{minHeight:i,children:t.jsx(l.Box,{padding:"400",children:t.jsxs(l.BlockStack,{gap:"400",align:"center",inlineAlign:"center",children:[t.jsx("div",{className:"h-[80px] w-[80px]",children:t.jsx(Re,{source:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKEAAACgCAYAAABkDQwTAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABvtSURBVHgB7V3NjyRFdo+oqq7u6fmg5wOzMINA8oDkA2hXSICstTS+GWRp17CyLIF89on1P2DBybKslS0h37hYFsg37PUBfIQbYCFZIPkCQoM0MAzM0D3Tw/RMT1el3y8iXubLqMjPqu7Mro6fOjuzMiMys7J++b7iRYRW+4DNzc0NWv02SZJLtP45LRsq4rBji5YPptPp78+dO/evaoHQasEgAoJ8b6hIvGXGZa31n54+ffqyWgAWSkIi4OuOgBHLjy1HxP9Vc2JhJLx+/fqvB4PBf6iIowRIxF8QEbfUHBioBYEI+M8q4qjhcbIR/1bNiYWQkNTwJVo9riKOHEgS/lbNiYWQkN6GSyriqGKDhNDP1RxYlDp+XEUcWUwmk16QMCKiNSIJIzpHJGFE54gkjOgcI9URyLVXa2tranV11WxHdAtyLtTdu3fV7u6uOmh0RsKTJ0+q4XCoIvoB/BbHjx83AuHevXvqINGJOh6Px5GAPcWxY8cOXDN1QsLRqDMBHFEBEPCgf5/omETM4EhIwogIiUjCiM4RSRjROSIJIzpHJGFE54gkjOgckYQRnWNposbT6dS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wJAL5IBURvmEywkOdR01zdjdL2rSfCBEcTtLQzqZdF6asJKEkUohgIaJFAvYYkH5YJBlBHiwc4E5HwtKzQ+Zx7BFrJhwP3s4A+WD70bpNNrIpI0fv9w+GTujbhqG6ET0Dk5HVM9ZMyDYA8SBN3WyePtlCvChNmR8VHCgiVhnhokTsOUAe2VeF256LpByrbJaYIB5neAv4DmvImS1Nmf9/PWJzbd+1lKUAAAAASUVORK5CYII=",width:"80px",height:"80px",alt:a,classRemoved:!0})}),t.jsxs(l.BlockStack,{gap:"200",align:"center",inlineAlign:"center",children:[t.jsx(l.Text,{as:"h4",variant:"headingSm",fontWeight:"semibold",children:a}),t.jsx(l.Text,{as:"h4",variant:"bodyMd",tone:"subdued",children:n})]})]})})})}),Qe=()=>t.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("g",{clipPath:"url(#clip0_18114_1160)",children:t.jsx("path",{d:"M1 1L6.5 6.5M6.5 6.5V1.5M6.5 6.5H1.5",stroke:"#8A8A8A",strokeWidth:"1.5"})}),t.jsx("defs",{children:t.jsx("clipPath",{id:"clip0_18114_1160",children:t.jsx("rect",{width:"8",height:"8",fill:"white"})})})]}),We=()=>t.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("g",{clipPath:"url(#clip0_18114_1146)",children:t.jsx("path",{d:"M1 7L6.5 1.5M6.5 1.5H1.5M6.5 1.5V6.5",stroke:"#29845A",strokeWidth:"1.5"})}),t.jsx("defs",{children:t.jsx("clipPath",{id:"clip0_18114_1146",children:t.jsx("rect",{width:"8",height:"8",fill:"white",transform:"matrix(0 -1 1 0 0 8)"})})})]}),_e=({change:e})=>"number"!=typeof e?t.jsx("div",{style:{height:"2px",width:"11px",backgroundColor:"#8A8A8A"}}):t.jsxs("div",{style:{display:"flex",maxHeight:"20px",width:"fit-content",alignItems:"center",gap:"4px",borderRadius:"8px",fontSize:"12px",color:e>0?re:se},children:[e<0&&t.jsx(l.InlineStack,{align:"center",children:t.jsx(Qe,{})}),e>0&&t.jsx(l.InlineStack,{align:"center",children:t.jsx(We,{})}),t.jsx(l.Text,{as:"span",variant:"bodyXs",fontWeight:"semibold",children:L(Math.abs(e||0))})]}),Ve=({data:e,formatValue:i})=>{const{activeIndex:n}=e,a=e?.dataSeries[0]?.data[n],r=e?.dataSeries[1]?.data[n],s=()=>{const e=a.trend?.value;if(!e)return"-";const t=Number(e.replace(/[%~]/g,""));return"negative"===a.trend?.trend?-1*t:t};return t.jsx("div",{className:"w-fit min-w-[175px]",children:t.jsx(l.Card,{padding:"200",children:t.jsxs(l.BlockStack,{gap:"100",children:[t.jsx(l.Text,{as:"p",variant:"bodySm",fontWeight:"semibold",children:e.formatters?.titleFormatter?.(e.title||"")||e.title}),t.jsxs(l.BlockStack,{gap:"100",children:[t.jsxs(l.InlineStack,{gap:"400",align:"space-between",blockAlign:"center",children:[t.jsxs(l.InlineStack,{gap:"100",blockAlign:"center",children:[t.jsx("div",{className:"h-[2px] w-[12px] rounded-[10px] bg-[#4FA9EA]"}),t.jsx(l.Text,{as:"p",variant:"bodySm",fontWeight:"medium",tone:"subdued",children:a.tooltipKey})]}),t.jsxs(l.InlineStack,{blockAlign:"center",gap:"100",children:[t.jsx(l.Text,{as:"span",variant:"bodySm",fontWeight:"semibold",children:i(a.value)}),t.jsx(_e,{change:s()})]})]}),t.jsxs(l.InlineStack,{gap:"400",align:"space-between",blockAlign:"center",children:[t.jsxs(l.InlineStack,{gap:"100",blockAlign:"center",children:[t.jsx("div",{className:"w-[12px] border border-dashed border-[#A1CAE7]"}),t.jsx(l.Text,{as:"p",variant:"bodySm",tone:"subdued",fontWeight:"medium",children:r.tooltipKey})]}),t.jsxs(l.InlineStack,{blockAlign:"center",gap:"100",children:[t.jsx(l.Text,{as:"span",variant:"bodySm",fontWeight:"semibold",children:i(r.value)}),t.jsx("div",{className:"opacity-0",children:t.jsx(_e,{change:s()})})]})]})]})]})})})},Fe=({isShowOneLine:e})=>e?t.jsx(l.Box,{width:"40%",children:t.jsx(l.SkeletonBodyText,{lines:1})}):t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx(l.Box,{width:"60%",children:t.jsx(l.SkeletonBodyText,{lines:1})}),t.jsx(l.Box,{width:"40%",children:t.jsx(l.SkeletonBodyText,{lines:1})})]}),Je=()=>t.jsx(l.Card,{children:t.jsxs(l.BlockStack,{gap:"400",children:[t.jsx(Fe,{isShowOneLine:!0}),t.jsx(ze,{})]})}),qe=({totalValue:e,hideComparison:i})=>t.jsx(l.BlockStack,{gap:"200",children:t.jsxs(l.InlineStack,{blockAlign:"center",gap:"200",wrap:!1,children:[t.jsx(l.InlineStack,{blockAlign:"center",gap:"200",children:t.jsx(l.Text,{as:"span",variant:"headingSm",children:e.value})}),!i&&t.jsx(_e,{change:e.change})]})}),Xe=({item:e,isHovered:i,isLoading:n,hideComparison:a,titleVariant:r="headingMd",titleFontWeight:s,onClickTitle:o})=>{const{key:c,title:d,totalValue:u}=e,h=m[c];return n?t.jsx(Fe,{}):t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx("div",{className:"hover:cursor-pointer hover:text-[--p-color-text-link-hover]",onClick:e=>{e?.stopPropagation(),o?.(c)},children:t.jsxs(l.InlineStack,{wrap:!1,children:[t.jsx(l.Box,{maxWidth:"100%",overflowX:"hidden",children:t.jsx(Pe,{tooltip:h,children:t.jsx(l.Text,{as:"span",variant:r,fontWeight:s,truncate:!0,children:d})})}),i&&t.jsx("div",{className:"flex h-[20px] w-[20px] items-center",children:t.jsx(l.Icon,{source:me,tone:"inherit"})})]})}),t.jsx(qe,{totalValue:u,hideComparison:a})]})},Ke=({item:e,isActive:i,isLoading:n,hideComparison:a,onSelect:r,onClickTitle:s})=>{const[c,d]=o.useState(!1),u=i||c;return t.jsx("div",{className:"w-full cursor-pointer overflow-hidden",onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:()=>r(e.key),children:t.jsx(l.Box,{paddingBlock:"150",paddingInline:"300",borderRadius:"200",background:u?"bg-surface-active":void 0,children:t.jsx(Xe,{item:e,isHovered:c,isLoading:n,hideComparison:a,titleVariant:"headingSm",titleFontWeight:"semibold",onClickTitle:s})})})},Ze=(e,t)=>{if(0===e&&0===t)return;if(0===t)return e>0?"100%":"0%";const i=(e-t)/t*100;return`${Math.abs(i).toFixed(0)}%`},$e=(e,t)=>{const i=e?.find(e=>e?.type?.toLowerCase()===t.toLowerCase());return i?.total??0},et=({targets:e,metricKey:t,totalsRow:i,comparisonTotalsRow:n,sort:a})=>{const r=te(i?.[t]),s=te(n?.[t]),o=!!n?.[t],l=e.map(({value:e,label:t})=>(({name:e,currentValue:t,prevValue:i,hasPreviousData:n})=>({name:e,data:[{key:"value",value:t}],metadata:{trend:{value:n?Ze(t,i):void 0,direction:t>=i?"upward":"downward",trend:t>=i?"positive":"negative"}}}))({name:t,currentValue:$e(r,e),prevValue:$e(s,e),hasPreviousData:o})),c=e=>e.data[0]?.value??0;return a?[...l].sort((e,t)=>c(t)-c(e)):l};var tt;!function(e){e.ALL_SESSION="ALL_SESSION",e.FIRST_SESSION="FIRST_SESSION",e.PAGE_ONLY="PAGE_ONLY"}(tt||(tt={}));const it=[{id:tt.ALL_SESSION,content:"All sessions",helpText:"Count metrics for all sessions where this page shows up anywhere in the journey: before, during, or after other pages.",icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXAAAAC4CAMAAADNC0dgAAAAw1BMVEUAAAD39/f39/f39/f39/f39/f39/f39/f8/Pz39/fb5P////+WrPjj4+MaHB319vfe5v/s7/rp7Ovy8vLx8/nn5+fu7u7n7PzKzdDi6f1wcXL7+/vEzOTGxscphFrd5Pni4+o2OTtTnHpjZnCcsfjQ2fby9/VEk2/f5PFSVFaktvd4spewwPd6gI9mboa6yPWGmt2pqqsuMTbW3OCSwavDz/iwvcJKVHOpqqrl6feLkaGMjo6bm5x+gIA8QUqOo+t3i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Text:"Count metrics for sessions only where this page was the very first page visited, then track how they moved through the funnel.",icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXAAAAC4CAMAAADNC0dgAAAAulBMVEUAAAD39/f39/f39/f39/f39/f8/Pz39/fb5P+WrPj///8aHB3j4+P09vfKzdDo6Ojy8vLl5ebd5f7h6P7n7Pzr6+vu7u5wcXLx8/nt8PsxNDn7+/vGxscphFrEzOS8yfakt/je5Pecsfjh4+zQ2fZjZnDr7vdSVFaHm95UnXt4sZd6f41Ek2/H0visvfTk7+vZ3OSOkJZXY4ipqqvX6OBIUm+u0cGRwKqpqqo3i2Vvc4CwtcGFkba82cvy+RBRAAAAB3RSTlMAduu/IJ8QQSls1wAACLJJREFUeNrs1kEKwEAIBEHdNfH/P84lhJzmtsJA1xMaUeN1516NQ9bOir/ajcOuX/JkuAes/Ho3RiS9tTPFi30yZlVEXI0xO6Iag242+KwMPvBROziZo1Y0RhFcI7g7gmsEd0dwjeDuCK4R3B3BNYK7I7hGcHcE1wjujuAawd0RXCO4O4JrBHdHcI3g7giuEdwdwTWCuyO4RnB3BNcI7u5h1+x2nIaBMHo5ThkrcVpbLVGbJlsVFthQEFqEBO//WnizTUddb6bEPyJInKv26kvPTMZu4v/Cef4L/9dJK1wanVtMAYmRRSHBZYY5KYUbhRfydM4Lrc4ZWgIx05x0wg0iKlP0baERMU9jw6BF5VrnV3WdbU4q4TJH1LAYqJ6+G4hOoWxMUT1ngLEhfffNOCeRcKkw73WTcoOoITKmrypRFYhKAsw4J7Zw8l0tXgAqmnHyULwIqXJUBcB8c9IIt2oXLqBCpgrvgTB97802J4lw3fe3CyBG7L6i9+Bi0wFgrjkphEvE3reLielCDR7cu90AzDUnhfB8uEKHSsVrcYP5SAogSoCZ5iQQLlFVixGKeC2uEMZSNBqAmeYkEG7QOJf2+Ovc4tGar6DGcwBEAJhnTgLhudsS37f3sZtPu3Pr86chpZ9c88xJIByxcnz/+HaZKRqioLByPGy/XxZnAzDPnPjCJeZjv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jEQA0G09LF12vzTXTA2vs3NDQP9QihEa3cOvubgu3PwNQffnYOvOfjuHFyMHBNKakyoiDGh4BwTarwpSgfQfpsy2YBXXCfAxYWCW3hVBDLg0cfYx6qBV0f5zL/yy4oTLn9JSvy4U7oaTQAAAABJRU5ErkJggg=="}];var nt;function at(){return{[e.MainDateTimePickerAlias.TODAY]:{title:"Today",alias:e.MainDateTimePickerAlias.TODAY,getDateRange:Ct},[e.MainDateTimePickerAlias.YESTERDAY]:{title:"Yesterday",alias:e.MainDateTimePickerAlias.YESTERDAY,getDateRange:Rt},[e.MainDateTimePickerAlias.LAST_7_DAYS]:{title:"Last 7 days",alias:e.MainDateTimePickerAlias.LAST_7_DAYS,getDateRange:kt},[e.MainDateTimePickerAlias.LAST_30_DAYS]:{title:"Last 30 days",alias:e.MainDateTimePickerAlias.LAST_30_DAYS,getDateRange:bt},[e.MainDateTimePickerAlias.LAST_90_DAYS]:{title:"Last 90 days",alias:e.MainDateTimePickerAlias.LAST_90_DAYS,getDateRange:Pt},[e.MainDateTimePickerAlias.LAST_365_DAYS]:{title:"Last 365 days",alias:e.MainDateTimePickerAlias.LAST_365_DAYS,getDateRange:wt},[e.MainDateTimePickerAlias.LAST_MONTH]:{title:"Last month",alias:e.MainDateTimePickerAlias.LAST_MONTH,getDateRange:Lt},[e.MainDateTimePickerAlias.LAST_12_MONTHS]:{title:"Last 12 months",alias:e.MainDateTimePickerAlias.LAST_12_MONTHS,getDateRange:zt},[e.MainDateTimePickerAlias.LAST_YEAR]:{title:"Last year",alias:e.MainDateTimePickerAlias.LAST_YEAR,getDateRange:Yt}}}function rt(e){return at()[e]}e.MainDateTimePickerAlias=void 0,(nt=e.MainDateTimePickerAlias||(e.MainDateTimePickerAlias={})).TODAY="today",nt.YESTERDAY="yesterday",nt.LAST_7_DAYS="last7days",nt.LAST_30_DAYS="last30days",nt.LAST_90_DAYS="last90days",nt.LAST_365_DAYS="last365days",nt.LAST_MONTH="lastMonth",nt.LAST_12_MONTHS="last12Months",nt.LAST_YEAR="lastYear";const st={YMD:"YYYY-MM-DD",MONTH_YEAR:"MMM YYYY",FULL:"MMMM D, YYYY",FULL_WITH_TIME:"MMMM D, YYYY [at] h:mm A",SHORT:"MMM DD, YYYY",SHORT_NO_PAD:"MMM D, YYYY",SHORT_WITH_TIME:"MMM D, YYYY [at] h:mm A",MONTH_DAY:"MMM D",DAY_YEAR:"D, YYYY",TIME:"h:mm A",MONTH_DAY_WITH_TIME:"MMM D [at] h:mm A",YEAR:"YYYY"};const ot=/^\d{4}-\d{1,2}-\d{1,2}/;function lt(e){return!isNaN(new Date(e).getDate())}function ct(e){return ot.test(e)&<(e)}function dt(e){return 10===e.length&&ct(e)}function ut(e,t){const i=_(e);return"YMD"===t?i.format(st.YMD):"MY"===t?i.format(st.MONTH_YEAR):"FULL"===t?i.format(st.FULL):"FULL_WITH_TIME"===t?i.format(st.FULL_WITH_TIME):i.format(st.SHORT)}function mt(e,t){const i=_(e),n=_(t);return i.isSame(n,"day")}function ht(e){const{since:t,until:i,format:n=st.TIME,showNow:a=!1}=e,r=_(t),s=_(i);return`${r.format(n)} - ${a?"Now":s.format(n)}`}function At(e){const{since:t,until:i,isShowNow:n}=e,a=_(t),r=_(i),s=a.isSame(W(),"day"),o=a.format(st.TIME),l=r.format(st.TIME);if(s){return`Today at ${o} - ${n?"Now":l}`}if(n)return`${a.format(st.SHORT_WITH_TIME)} - Now`;if(a.isSame(r,"day"))return`${a.format(st.SHORT_WITH_TIME)} - ${l}`;if(a.isSame(r,"day")){const e=ht({since:t,until:i});return`${a.format(st.SHORT)} (${e})`}return a.isSame(r,"year")?`${a.format(st.MONTH_DAY_WITH_TIME)} - ${r.format(st.MONTH_DAY_WITH_TIME)}, ${r.format(st.YEAR)}`:`${a.format(st.SHORT_WITH_TIME)} - ${r.format(st.SHORT_WITH_TIME)}`}const gt=(e,t=!1,i)=>t&&Mt(e)?e.endOf("day").format(i):e.format(i),pt=(e,t)=>gt(e?W(e).endOf("day"):W().endOf("day"),!1,t),Mt=e=>0===e.hour()&&0===e.minute();function Tt(e,t){const i=_(e),n=_(t);return i.isSame(n,"day")?i.format(st.SHORT):i.isSame(n,"month")&&i.isSame(n,"year")?`${i.format(st.MONTH_DAY)} - ${n.format(st.DAY_YEAR)}`:i.isSame(n,"year")?`${i.format(st.MONTH_DAY)} - ${n.format(st.SHORT_NO_PAD)}`:`${i.format(st.SHORT_NO_PAD)} - ${n.format(st.SHORT_NO_PAD)}`}function ft(t){const{since:i,until:n,isShowNow:a}=t,r=_(i);return r.isSame(W(),"day")?rt(e.MainDateTimePickerAlias.TODAY).title:a?`${r.format(st.SHORT_NO_PAD)} - Now`:Tt(i,n)}const xt=({since:e,until:t,isShowNow:i})=>{if(mt(e,t))return ht({since:e,until:t,showNow:i})},It=e=>[...e].sort((e,t)=>b(t.version)-b(e.version)).map(e=>{if(!e.startedAt)return!1;const t=!e.completedAt,i=V(e.startedAt).valueOf(),n=t?V(pt()).valueOf():V(e.completedAt).valueOf(),a=ft({since:i,until:n,isShowNow:t}),r=xt({since:i,until:n,isShowNow:t});return{title:a,alias:`${e.version}`,since:i,until:n,isVersion:!0,isCurrentVersion:t,description:r,versionId:e.id}}).filter(Boolean),jt=()=>({since:0,until:0}),Nt=t=>{const{since:i,until:a,alias:r}=t,s=n(i),o=n(a);if(r===e.MainDateTimePickerAlias.LAST_MONTH)return Lt(s);if(r===e.MainDateTimePickerAlias.LAST_12_MONTHS)return zt(s);if(r===e.MainDateTimePickerAlias.LAST_YEAR)return Yt(s);const l=o.diff(s,"day")+1,c=s.subtract(l,"day"),d=o.subtract(l,"day");return{since:c.valueOf(),until:d.valueOf()}},Dt=(e,t)=>i=>{const{since:a,until:r}=i,s=n(a),o=n(r).diff(s,"day"),l=s.subtract(e,t),c=l.add(o,"day");return{since:l.valueOf(),until:c.valueOf()}},St=Dt(7,"day"),Et=Dt(3,"month"),vt=Dt(1,"month"),Ot=Dt(1,"year"),yt=e=>t=>({since:t.subtract(e,"day").valueOf(),until:t.valueOf()}),Ct=e=>({since:e.valueOf(),until:e.valueOf()}),Rt=e=>({since:e.subtract(1,"day").valueOf(),until:e.subtract(1,"day").valueOf()}),kt=yt(6),bt=yt(29),Pt=yt(89),wt=yt(364);function Lt(e){return{since:e.subtract(1,"month").startOf("month").valueOf(),until:e.subtract(1,"month").endOf("month").valueOf()}}function zt(e){return{since:e.subtract(12,"month").startOf("month").valueOf(),until:e.subtract(1,"month").endOf("month").valueOf()}}function Yt(e){return{since:e.subtract(1,"year").startOf("year").valueOf(),until:e.subtract(1,"year").endOf("year").valueOf()}}const Bt=(e,t,i)=>{const a=n(i),r=a.month();if(a.year()!==t||r!==e){const e=a.subtract(1,"month");return{month:e.month(),year:e.year()}}return{month:e,year:t}};var Ut;e.CompareDateTimePickerAlias=void 0,(Ut=e.CompareDateTimePickerAlias||(e.CompareDateTimePickerAlias={})).NO_COMPARISON="noComparison",Ut.PREVIOUS_PERIOD="previousPeriod",Ut.PREVIOUS_WEEK="previousWeek",Ut.PREVIOUS_MONTH="previousMonth",Ut.PREVIOUS_QUARTER="previousQuarter",Ut.PREVIOUS_YEAR="previousYear";const Ht={title:"Previous period",alias:e.CompareDateTimePickerAlias.PREVIOUS_PERIOD,since:0,until:0},Gt=[{title:"No comparison",alias:e.CompareDateTimePickerAlias.NO_COMPARISON,since:0,until:0},Ht,{title:"Previous week",alias:e.CompareDateTimePickerAlias.PREVIOUS_WEEK,since:0,until:0},{title:"Previous quarter",alias:e.CompareDateTimePickerAlias.PREVIOUS_QUARTER,since:0,until:0},{title:"Previous month",alias:e.CompareDateTimePickerAlias.PREVIOUS_MONTH,since:0,until:0},{title:"Previous year",alias:e.CompareDateTimePickerAlias.PREVIOUS_YEAR,since:0,until:0}],Qt={[e.CompareDateTimePickerAlias.NO_COMPARISON]:jt,[e.CompareDateTimePickerAlias.PREVIOUS_PERIOD]:Nt,[e.CompareDateTimePickerAlias.PREVIOUS_WEEK]:St,[e.CompareDateTimePickerAlias.PREVIOUS_QUARTER]:Et,[e.CompareDateTimePickerAlias.PREVIOUS_MONTH]:vt,[e.CompareDateTimePickerAlias.PREVIOUS_YEAR]:Ot},Wt=()=>{const t=V().startOf("day"),i=at(),n=i[e.MainDateTimePickerAlias.TODAY],a={...n,...n.getDateRange(t)},r=i[e.MainDateTimePickerAlias.YESTERDAY],s={...r,...r.getDateRange(t)},o=i[e.MainDateTimePickerAlias.LAST_7_DAYS],l={...o,...o.getDateRange(t)},c=i[e.MainDateTimePickerAlias.LAST_30_DAYS],d={...c,...c.getDateRange(t)},u=i[e.MainDateTimePickerAlias.LAST_90_DAYS],m={...u,...u.getDateRange(t)},h=i[e.MainDateTimePickerAlias.LAST_365_DAYS],A={...h,...h.getDateRange(t)},g=i[e.MainDateTimePickerAlias.LAST_MONTH],p={...g,...g.getDateRange(t)},M=i[e.MainDateTimePickerAlias.LAST_12_MONTHS],T={...M,...M.getDateRange(t)},f=i[e.MainDateTimePickerAlias.LAST_YEAR];return{DATE_TIME_FILTERS:[a,s,l,d,m,A,p,T,{...f,...f.getDateRange(t)}],LAST_7_DAYS_DATE_RANGE:l,LAST_30_DAYS_DATE_RANGE:d}},_t=o.createContext({dateTimePicked:{since:W().valueOf(),until:W().valueOf(),title:"Today",alias:"today"},compareDateTimePicked:Ht,setDateTimePicked:()=>{},setCompareDateTimePicked:()=>{},resetDateVersion:()=>{}}),Vt=()=>{const e=o.useContext(_t);if(!e)throw new Error("useDateTimePickerContext must be used within a DateTimePickerProvider");return e},Ft=({ranges:e,initialPicked:t,onApply:i})=>{const{DATE_TIME_FILTERS:a}=Wt(),r=e||a,{dateTimePicked:s,setDateTimePicked:l}=Vt(),[c,d]=o.useState(s),[{month:u,year:m},h]=o.useState({month:n(s.since).month(),year:n(s.since).year()});o.useEffect(()=>{if(s){const e=new Date(s.until);((e,t)=>t.month-e.month+12*(e.year-t.year))({year:m,month:u},{year:e.getFullYear(),month:e.getMonth()})}},[s,u,m]);return o.useEffect(()=>{s&&(d(s),h({month:n(s.since).month(),year:n(s.since).year()}))},[s]),{month:u,year:m,setDate:h,dateRange:c,apply:()=>{l(c),i?.(c)},cancel:()=>{d(s)},dateTimePicked:s,onChange:({end:e})=>{h(Bt(u,m,e))},onMonthChange:(e,t)=>{h({month:e,year:t})},onCalendarChange:e=>{const{start:i,end:n,alias:a}=e,s={alias:"custom",title:"Custom",since:i.getTime(),until:n.getTime()},o=r.find(e=>{const t=e.alias===a,r=e.until===n.getTime(),s=e.since===i.getTime();return t||s&&r});d(o||t||s)}}};function Jt({onBlur:e,dateRange:i,setDateTimePicked:n}){const[a,r]=o.useState(!1),[s,c]=o.useState({}),d=o.useCallback((e,t=!1)=>!i.isVersion||t&&i.isCurrentVersion?ut(e,"FULL"):ut(e,"FULL_WITH_TIME"),[i.isVersion,i.isCurrentVersion]);function u(){r(!1),c({since:d(i.since),until:d(i.until,!0)}),e&&e()}return o.useEffect(()=>{a||c({since:d(i.since),until:d(i.until,!0)})},[i,d]),t.jsxs(l.InlineGrid,{gap:"200",columns:"1fr auto 1fr",children:[t.jsx(l.TextField,{role:"combobox",label:"Since",labelHidden:!0,value:i.since?s.since:"MMMM D, YYYY",onChange:function(e){if(c(t=>({...t,since:e})),dt(e)){const t=_(e).startOf("day"),a=_(i.until).endOf("day"),r=t.isAfter(a)?t.endOf("day"):a;n({start:V(t).toDate(),end:V(r).toDate()})}},onBlur:()=>u(),onFocus:()=>(r(!0),void c({...s,since:ut(i.since,"YMD")})),autoComplete:"off"}),t.jsx(l.InlineStack,{children:t.jsx(l.Icon,{source:le,tone:"subdued"})}),t.jsx(l.TextField,{role:"combobox",label:"Until",labelHidden:!0,value:i.until?s.until:"MMMM D, YYYY",onChange:function(e){if(c(t=>({...t,until:e})),dt(e)){const t=W().endOf("day"),a=_(e).endOf("day"),r=a.isAfter(t)?t:a,s=_(i.since).startOf("day"),o=r.isBefore(s)?r.startOf("day"):s;n({start:V(o).toDate(),end:V(r).toDate()})}},onBlur:()=>u(),onFocus:()=>(r(!0),void c({...s,until:ut(i.until,"YMD")})),autoComplete:"off"})]})}function qt(e){const{setDateTimePicked:i,dateTimePicked:n,rangeAddition:a,allRanges:r}=e,{value:s,toggle:c}=function(e){const[t,i]=o.useState(e);return{value:t,toggle:o.useCallback(()=>i(e=>!e),[]),setTrue:o.useCallback(()=>i(!0),[]),setFalse:o.useCallback(()=>i(!1),[])}}(!0),d=a?.rangers||[],u=d.map(e=>{const i=n.alias===e.alias;return{value:e.alias,label:t.jsxs(l.Text,{as:"span",truncate:!0,children:[t.jsx(l.Text,{as:"span",variant:"bodyMd",fontWeight:i?"semibold":"regular",children:e.title}),e.description&&t.jsxs(t.Fragment,{children:[" ",t.jsx(l.Text,{as:"span",variant:"bodyXs",fontWeight:"regular",tone:"subdued",children:`(${e.description})`})]})]})}});if(a&&0!==d.length)return t.jsxs(l.Box,{borderBlockEndWidth:"025",borderColor:"border",paddingBlock:"200",children:[t.jsx("div",{className:"px-1.5",children:t.jsx(je,{onClick:c,"aria-expanded":s,className:Y("hover:bg-surface-hover cursor-pointer rounded-lg p-1.5"),children:t.jsxs(l.InlineStack,{align:"space-between",blockAlign:"center",children:[t.jsx(l.Text,{as:"span",variant:"bodyMd",children:a.title}),t.jsx(l.Box,{children:t.jsx(l.Icon,{source:s?he:ue})})]})})}),t.jsx(l.Collapsible,{open:s,id:"date-time-filter-periods-collapsible",transition:{duration:"200ms",timingFunction:"ease-in-out"},children:t.jsx(Se,{options:u,selected:n?[n.alias]:[],onChange:e=>{const t=e[0],n=r.find(e=>e.alias===t)||r[0];i({start:W(n?.since).toDate(),end:W(n?.until).toDate(),alias:n?.alias})}})})]})}function Xt(e){const{setDateTimePicked:i,dateTimePicked:n,allRanges:a,isCompare:r}=e,{DATE_TIME_FILTERS:s}=Wt(),{mdDown:o}=l.useBreakpoints(),c=r?[...Gt]:[...s];return t.jsx(l.Box,{maxWidth:o?"516px":"250px",width:o?"100%":"250px",padding:{xs:"500",md:"0"},paddingBlockEnd:{xs:"100",md:"0"},children:o?t.jsx(l.Select,{label:"dateRangeLabel",labelHidden:!0,onChange:e=>(e=>{const t=a.find(({title:t,alias:i})=>t===e||i===e)||a[0];i({start:W(t?.since).toDate(),end:W(t?.until).toDate(),alias:t?.alias})})(e),value:n?.title||n?.alias||"",options:a.map(({alias:e,title:t})=>t||e)}):t.jsx(l.Scrollable,{style:{maxHeight:"356px"},children:t.jsx(l.Box,{children:t.jsxs(l.BlockStack,{children:[t.jsx(qt,{...e}),t.jsx(l.OptionList,{options:c.map(e=>({value:e.alias,label:e.title})),selected:n?[n.alias]:[],onChange:e=>(e=>{const t=a.find(t=>t.alias===e[0])||a[0];i({start:W(t?.since).toDate(),end:W(t?.until).toDate(),alias:t?.alias})})(e)})]})})})})}const Kt=({ranges:e,onApply:t})=>{const i=e||Gt,{compareDateTimePicked:n,setCompareDateTimePicked:a}=Vt(),{dateTimePicked:r}=Vt(),[s,l]=o.useState(n),[{month:c,year:d},u]=o.useState({month:W(n.since).month(),year:W(n.since).year()});return{month:c,year:d,setDate:u,dateRange:s,apply:()=>{a(s),t?.(s)},cancel:()=>{l(n)},compareDateTimePicked:n,onChange:({end:e})=>{u(Bt(c,d,e))},onMonthChange:(e,t)=>{u({month:e,year:t})},onCalendarChange:({start:e,end:t,alias:n})=>{const a=i.find(e=>e.alias===n);l(a?{...a,...Qt[n]({since:r.since,until:r.until})}:{alias:"custom",title:"Custom",since:e.getTime(),until:t.getTime()})}}},Zt=e=>{const{dateTimeFilters:i,rangeAddition:a,popoverProps:r,activatorProps:s,actionProps:d,isCompare:u,buttonValue:m,activator:h}=e,A=a?.initialPicked,g=[...i||[],...a?.rangers||[]],p=u?Kt:Ft,{month:M,year:T,dateRange:f,apply:x,cancel:I,onMonthChange:j,onCalendarChange:N,onChange:D}=p({ranges:g,initialPicked:A,onApply:e.onApply}),{t:S}=c.useTranslation(),{mdDown:E,lgUp:v}=l.useBreakpoints(),O=v,y=o.useMemo(()=>{if(f.isVersion&&f.since&&f.until)return At({since:f.since,until:f.until,isShowNow:f.isCurrentVersion})},[f.since,f.until,f.isVersion,f.isCurrentVersion]),[C,R]=o.useState(!1),k=o.useRef(null),b=o.useRef(y);C||(b.current=y);const P=b.current;function w({relatedTarget:e}){var t;null!=e&&(t=e,!!k?.current&&function(e,t){if(e===t)return!0;let i=t.parentNode;for(;null!=i;){if(i===e)return!0;i=i.parentNode}return!1}(k.current,t))||R(!1)}function L(){I(),R(!1)}const z=()=>{u||R(!C)};return t.jsx(l.Popover,{active:C,autofocusTarget:"none",preferredAlignment:"right",preferredPosition:"below",fluidContent:!0,sectioned:!1,fullHeight:!0,activator:t.jsx(pe,{height:"100%",minHeight:"28px",align:"center",children:t.jsx(Me,{content:P,maxWidth:h?"large":"extra-large",children:t.jsx(l.Box,{children:h?h({onClick:z,value:m}):t.jsx(l.Button,{size:"slim",icon:u?void 0:ce,onClick:z,...s,children:m})})})}),onClose:L,...r,children:t.jsxs(l.Scrollable,{vertical:!0,scrollbarWidth:"thin",className:"max-w-[100%]",children:[t.jsx(l.Popover.Pane,{fixed:!0,children:t.jsx("div",{ref:k,children:t.jsxs(l.InlineGrid,{columns:{xs:"1fr",md:"max-content max-content"},gap:"0",children:[t.jsx(Xt,{setDateTimePicked:e=>{N(e),D(e)},dateTimePicked:f,rangeAddition:a,allRanges:g,isCompare:u}),t.jsx(l.Box,{padding:"400",maxWidth:E?"320px":"516px",borderInlineStartWidth:"025",borderColor:"border-secondary",children:t.jsxs(l.BlockStack,{gap:"400",children:[t.jsx(Jt,{setDateTimePicked:N,dateRange:f,onBlur:()=>w}),t.jsx("div",{children:t.jsx(l.DatePicker,{month:M,year:T,selected:f.since||f.until?{start:n(f.since).toDate(),end:n(f.until).toDate()}:void 0,onMonthChange:j,onChange:N,multiMonth:O,allowRange:!0,disableDatesAfter:F()})}),d&&t.jsx(Te,{...d,onClick:()=>{R(!1),d.onClick?.()}})]})})]})})}),t.jsx(l.Popover.Pane,{fixed:!0,children:t.jsx(l.Box,{padding:"400",borderBlockStartWidth:"025",borderColor:"border-secondary",children:t.jsx(l.InlineStack,{align:"end",gap:"200",children:t.jsxs(l.ButtonGroup,{children:[t.jsx(l.Button,{onClick:L,children:S("Cancel")}),t.jsx(l.Button,{variant:"primary",onClick:function(){x(),R(!1)},children:S("Apply")})]})})})})]})})},$t=i=>{const{rangeAddition:n,popoverProps:a}=i,r=n?.initialPicked,s=Gt,l=[...s,...n?.rangers||[]],{t:d}=c.useTranslation(),{compareDateTimePicked:u}=Kt({ranges:l,initialPicked:r}),m=o.useMemo(()=>u.alias===e.CompareDateTimePickerAlias.NO_COMPARISON?d("No comparison"):d("Compare to: {{value}}",{value:Tt(u.since,u.until)}),[u,d]);return t.jsx(Zt,{dateTimeFilters:s,rangeAddition:n,popoverProps:a,isCompare:!0,buttonValue:m})},ei=e=>{const{rangeAddition:i,popoverProps:n,activator:a,onApply:r,activatorProps:s,actionProps:o}=e,{DATE_TIME_FILTERS:l}=Wt(),c=l,d=i?.rangers||[],u=i?.initialPicked,m=[...c,...d],{dateTimePicked:h}=Ft({ranges:m,initialPicked:u});return t.jsx(Zt,{activatorProps:s,dateTimeFilters:c,rangeAddition:i,popoverProps:n,actionProps:o,buttonValue:(()=>{if(h.isVersion&&d.length>0){const e=h.description?`at ${h.description}`:"";return`Period: ${h.title} ${e}`}return"custom"===h.alias?Tt(h.since,h.until):h.title})(),activator:a,onApply:r})};e.dayjs=n,e.AnalyticModeSelector=({activatorText:e="View by",value:i,onChange:n})=>{const a=o.useMemo(()=>it.map(e=>({...e})),[]);return t.jsx(we,{activatorText:e,options:a,selected:i,onSelect:e=>{n(e)},maxWidth:"650px"})},e.COMPARE_DATE_TIME_FILTERS_MAP=Qt,e.CurrencySelector=({currencies:e,selected:i,preferredAlignment:n="left",activatorText:a,onSelect:r})=>{const{t:s}=c.useTranslation(),d=o.useRef(r),u=o.useCallback(e=>{d.current?.(e)},[]),m=o.useMemo(()=>{if(!e)return[];const t=e.map(e=>({content:e,id:e}));return t.some(e=>e.id===oe)||t.push({content:oe,id:oe}),H(t,[{attr:"content",order:"asc",preferredValue:oe}])},[e]),h=o.useMemo(()=>m.map(e=>({id:e.id,content:e.content,onAction:()=>u(e.id),active:e.id===i,suffix:e.id===i&&t.jsx(l.Icon,{source:de,tone:"success"}),helpText:e.id===oe&&t.jsx(l.Text,{as:"p",fontWeight:"semibold",children:s("Default")})})),[m,i,u,s]),A=o.useMemo(()=>!m?.length||1===m.length&&m[0]?.id===oe,[m]);return o.useEffect(()=>{d.current=r}),A?null:t.jsx(Ee,{options:h,selected:i,variant:"action-list",onSelect:e=>u(e),activatorText:a??s("Currency"),maxWidth:"225px",preferredAlignment:n,helpText:t.jsx(l.Box,{padding:"200",paddingBlockStart:"300",paddingBlockEnd:"300",borderColor:"border-tertiary",background:"bg",children:t.jsx(De,{as:"p",variant:"bodyMd",transformers:{1:e=>t.jsx(ye,{linkAction:{url:"https://help.shopify.com/en/manual/international/pricing/exchange-rates#auto-convert",target:"_blank"},children:e},e+"text-link")},children:s("This will follow Shopify's current exchange rate. [1]Read more[]")})})})},e.DATE_TIME_COMPARISON_FILTERS=Gt,e.DateTimeFilterInputs=Jt,e.DateTimeFilters=Xt,e.DateTimePickerContext=_t,e.DateTimePickerProvider=({children:i,initDate:a,initDateCompare:r})=>{const[s,l]=o.useState(a||{since:W().set("hour",0).valueOf(),until:W().set("hour",0).valueOf(),title:"Today",alias:"today"}),{DATE_TIME_FILTERS:c}=Wt(),d=o.useCallback((e,t=s)=>({...Ht,...Qt[e]({since:t.since,until:t.until,alias:t.alias})}),[s]),[u,m]=o.useState(r||d(e.CompareDateTimePickerAlias.PREVIOUS_PERIOD)),h=o.useCallback(t=>{"custom"!==u.alias&&u.alias!==e.CompareDateTimePickerAlias.NO_COMPARISON&&m(d(u.alias,t))},[u,d]),A=o.useCallback(e=>{l(e),h(e)},[h]);return t.jsx(_t.Provider,{value:{dateTimePicked:s,setDateTimePicked:A,compareDateTimePicked:u,setCompareDateTimePicked:m,resetDateVersion:()=>{const e=n(s.since).startOf("day").valueOf(),t=n(s.until).startOf("day").valueOf(),i=c.find(i=>i.since===e&&i.until===t);l({...s,isVersion:!1,versionId:void 0,isCurrentVersion:!1,description:"",title:i?.title||s.title,alias:i?.alias||"custom"})}},children:i})},e.GSelectableMetricChartCard=({metricInfo:e,dataChart:i,defaultActiveTab:n,isLoading:a,isEmptyMetricData:r,hideComparison:s,currentPeriodLabel:c="Current",previousPeriodLabel:d="Previous",columnTypes:u})=>{const[m,h]=o.useState(n),A=o.useMemo(()=>{const e=m?i[m]:void 0;if(!e)return[];const t={name:c,data:e.current};return s?[t]:[t,{name:d,data:e.previous,isComparison:!0}]},[m,i,s,c,d]);return t.jsxs(l.Card,{children:[t.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${e.length}, 1fr)`,gap:"16px",marginBottom:"16px"},children:e.map(e=>t.jsx(Ke,{item:e,isActive:m===e.key,isLoading:a,hideComparison:s,onSelect:h},e.key))}),t.jsx(He,{lineChartData:A,isLoading:a,isEmptyMetricData:r,metricKey:m,columnTypes:u})]})},e.GTimePicker=e=>{const{isCompare:i,...n}=e;return t.jsxs(l.InlineStack,{gap:"200",children:[t.jsx(ei,{...n}),i&&t.jsx($t,{rangeAddition:n.rangeAddition,popoverProps:n.popoverProps})]})},e.MetricDonutChartCard=({label:e,metricKey:i,targets:n,totalsRow:a,comparisonTotalsRow:r,sort:s,isLoading:c,isEmptyMetricData:u,minHeight:h=294,onClick:A})=>{const g=m[i],{windowWidth:p,windowSize:M}=(()=>{const[e,t]=o.useState(()=>({width:"undefined"!=typeof window?window.innerWidth:0,height:"undefined"!=typeof window?window.innerHeight:0})),i=o.useMemo(()=>({xs:e.width<=768,md:768<e.width&&e.width<=1024,lg:e.width>1024,xsDown:e.width<768,"1200Down":e.width<1200,"1040Down":e.width<1040}),[e.width]),n=!i.lg,a=i.xs;return o.useEffect(()=>{const e=()=>{t({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[]),{windowSize:e,windowWidth:i,isMobileTabletView:n,isMobileView:a}})(),[T,f]=o.useState(!1),x=o.useMemo(()=>et({targets:n,metricKey:i,totalsRow:a,comparisonTotalsRow:r,sort:s}),[n,i,a,r,s]);if(c)return t.jsx(Je,{});const I=e=>q(`${e}`),j=p.lg&&M.width<1500;return t.jsx("div",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:t.jsx(l.Card,{children:t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx(l.InlineStack,{children:t.jsx("div",{className:"hover:cursor-pointer hover:text-[--p-color-text-link-hover]",onClick:e=>{e.stopPropagation(),A()},children:t.jsxs(l.InlineStack,{children:[t.jsx(Pe,{tooltip:g,children:t.jsx(l.Text,{as:"h3",variant:"headingMd",children:e})}),T&&t.jsx(l.Icon,{source:me,tone:"inherit"})]})})}),t.jsx("div",{className:Y("flex items-center justify-center",{"max-h-[250px] overflow-hidden":j}),children:u?t.jsx(Ge,{title:"No data yet",description:"Data needs time to gather"}):t.jsx(Be,{minHeight:h,seriesColors:{},children:t.jsx(d.DonutChart,{data:x,legendPosition:"left",showLegendValues:!0,showLegend:!0,theme:"Light",tooltipOptions:{valueFormatter:I},labelFormatter:I})})})]})})})},e.PREVIOUS_PERIOD_FILTER=Ht,e.SingleMetricChartCard=({metricInfo:e,lineChartData:i,isLoading:n,hideComparison:a,columnTypes:r,isEmptyMetricData:s,onClickTitle:c})=>{const[d,u]=o.useState(!1);return t.jsx("div",{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:t.jsx(l.Card,{children:t.jsxs(l.BlockStack,{gap:"200",children:[t.jsx(Xe,{item:e,isHovered:d,isLoading:n,hideComparison:a,onClickTitle:c}),t.jsx(He,{lineChartData:i,isLoading:n,isEmptyMetricData:s,columnTypes:r,metricKey:e.key})]})})})},e.convertDateToTz=_,e.convertToDateTimeFilters=It,e.createLastDaysRange=yt,e.dayjsTz=W,e.dayjsTzToDate=F,e.dayjsTzToLocalTZ=V,e.formatDate=ut,e.formatDateTimeRange=At,e.formatDayjs=gt,e.formatMs=e=>{const t=Math.floor(e/1e3);return[Math.floor(t/3600),Math.floor(t%3600/60),t%60].map(e=>String(e).padStart(2,"0")).join(":")},e.formatTime=function(e){return _(e).format(st.TIME)},e.formatTimeRange=ht,e.getDateRangeTitle=Tt,e.getDateTimeFilterBase=function(e,t){const i=W(),n=_(e),a=_(t),r=at();for(const e of Object.values(r)){const t=e.getDateRange(i),r=_(t.since),s=_(t.until),o=n.isSame(r,"day"),l=a.isSame(s,"day");if(o&&l)return{title:e.title,alias:e.alias}}return{title:Tt(e,t),alias:"custom"}},e.getDateTimeFilterByAlias=rt,e.getDateTimeFilterMapping=at,e.getEndOfDayBy=pt,e.getInitialTimezone=function(){return G},e.getLast12Months=zt,e.getLast30Days=bt,e.getLast365Days=wt,e.getLast7Days=kt,e.getLast90Days=Pt,e.getLastMonth=Lt,e.getLastYear=Yt,e.getMonthAndYearByDateFilter=Bt,e.getNoComparison=jt,e.getPreviousMonth=vt,e.getPreviousPeriod=Nt,e.getPreviousQuarter=Et,e.getPreviousWeek=St,e.getPreviousYear=Ot,e.getToday=Ct,e.getVersionDateDescription=xt,e.getVersionDateRangeTitle=ft,e.getYesterday=Rt,e.isDate=lt,e.isMidnight=Mt,e.isSameDayTimestamp=mt,e.isValidDate=dt,e.isValidYearMonthDayDateString=ct,e.parseYearMonthDayDateString=function(e){return n(e).valueOf()},e.setTz=function(e){G=e,n.tz.setDefault(e)},e.useDateTimeFilter=Wt,e.useDateTimePicker=Ft,e.useDateTimePickerContext=Vt,e.useVersionDateTimeFilters=e=>{const{t:t}=c.useTranslation(),i=o.useMemo(()=>e?.length?It(e):[],[e]);return{rangeAddition:{title:t("Experiment periods"),rangers:i}}}});
|