@vizzly/dashboard 0.6.3 → 0.6.4
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/charts/src/XYChart/Axis/XAxis.d.ts +2 -0
- package/dist/charts/src/XYChart/Axis/axis.d.ts +9 -1
- package/dist/charts/src/XYChart/AxisTitle.d.ts +1 -0
- package/dist/charts/src/XYChart/logic/constants.d.ts +1 -7
- package/dist/dashboard/src/index.d.ts +4 -4
- package/dist/dashboard/src/sdk.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/shared-logic/src/Component/Component.d.ts +2 -2
- package/dist/shared-logic/src/Component/dumpable.d.ts +2 -1
- package/dist/shared-logic/src/Display/Display.d.ts +9 -6
- package/dist/shared-logic/src/Display/types.d.ts +6 -2
- package/dist/shared-logic/src/Display/upcast.d.ts +2 -2
- package/dist/shared-logic/src/Theme/Theme.d.ts +1 -0
- package/dist/shared-logic/src/Theme/types.d.ts +17 -1
- package/dist/shared-ui/src/base/Accordion/Accordion.styles.d.ts +1 -1
- package/dist/shared-ui/src/base/ActionSection/ActionSection.d.ts +3 -1
- package/dist/shared-ui/src/base/Alert/Alert.styles.d.ts +4 -4
- package/dist/shared-ui/src/base/AppStyles/AppStyles.styles.d.ts +1 -0
- package/dist/shared-ui/src/base/AppStyles/AppStyling.d.ts +0 -2
- package/dist/shared-ui/src/base/Button/Button.d.ts +2 -1
- package/dist/shared-ui/src/base/Button/Button.styles.d.ts +1 -1
- package/dist/shared-ui/src/base/DateTime/DateOptionsPopup.d.ts +1 -1
- package/dist/shared-ui/src/base/DateTime/DatePicker.styles.d.ts +7 -8
- package/dist/shared-ui/src/base/Dropdown/Dropdown.styles.d.ts +3 -3
- package/dist/shared-ui/src/base/Input/Input.styles.d.ts +1 -1
- package/dist/shared-ui/src/base/Label/Label.styles.d.ts +1 -1
- package/dist/shared-ui/src/base/ListView/List.styles.d.ts +6 -6
- package/dist/shared-ui/src/base/Modal/Modal.styles.d.ts +4 -4
- package/dist/shared-ui/src/base/Panel/Panel.styles.d.ts +1 -1
- package/dist/shared-ui/src/base/PopoverMenu/PopoverMenu.styles.d.ts +2 -2
- package/dist/shared-ui/src/base/Prompt/Prompt.styles.d.ts +1 -1
- package/dist/shared-ui/src/base/RadioGroup/RadioGroup.styles.d.ts +2 -2
- package/dist/shared-ui/src/base/Search/Search.styles.d.ts +2 -2
- package/dist/shared-ui/src/base/Select/Control.styles.d.ts +5 -5
- package/dist/shared-ui/src/base/Tab/Tab.styles.d.ts +2 -2
- package/dist/shared-ui/src/base/Table/Table.styles.d.ts +9 -9
- package/dist/shared-ui/src/base/Toolbar/Toolbar.d.ts +20 -0
- package/dist/shared-ui/src/base/layout/View.d.ts +1 -0
- package/dist/shared-ui/src/base/page/Page.d.ts +1 -0
- package/dist/shared-ui/src/base/styles/overlay.styles.d.ts +1 -1
- package/dist/shared-ui/src/components/Studio/AddContent/AddContent.d.ts +1 -0
- package/dist/shared-ui/src/components/Studio/StudioApp/Cell.styles.d.ts +1 -1
- package/dist/shared-ui/src/components/Studio/StudioApp/ComponentOptions.d.ts +6 -0
- package/dist/shared-ui/src/components/Studio/StudioApp/dashboardIconStyles.styles.d.ts +1 -1
- package/dist/shared-ui/src/components/ViewHeader/ViewHeader.styles.d.ts +3 -3
- package/dist/shared-ui/src/contexts/DashboardContext/reducer.d.ts +2 -2
- package/dist/shared-ui/src/contexts/DashboardContext/types.d.ts +12 -1
- package/dist/shared-ui/src/contexts/ThemeProvider/ThemeProvider.d.ts +0 -1
- package/dist/shared-ui/src/contexts/ThemeProvider/default.theme.d.ts +3 -1
- package/dist/shared-ui/src/library/Button/index.d.ts +2 -1
- package/dist/shared-ui/src/library/Dashboard/EditTitleModal.d.ts +9 -0
- package/dist/shared-ui/src/library/Dashboard/HeaderRow.d.ts +9 -0
- package/dist/shared-ui/src/library/DataPanel/CustomMetrics/FieldsUsedModal.d.ts +8 -0
- package/dist/shared-ui/src/library/DataPanel/CustomMetricsInput.d.ts +2 -0
- package/dist/shared-ui/src/library/DataPanel/FilterInput/FilterInputForm.d.ts +1 -1
- package/dist/shared-ui/src/library/DataPanel/index.d.ts +0 -1
- package/dist/shared-ui/src/library/Editor/Editor.styles.d.ts +1 -1
- package/dist/shared-ui/src/library/Library/Library.styles.d.ts +1 -1
- package/dist/shared-ui/src/library/ResizableRow/ResizableRow.styles.d.ts +1 -1
- package/dist/shared-ui/src/library/ResizableRow.d.ts +8 -5
- package/package.json +2 -3
- package/dist/shared-ui/src/library/DataPanel/LimitInput.d.ts +0 -10
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),r=e(require("joi")),i=require("lodash"),o=e(i),a=e(require("lodash/isEmpty")),l=require("uuid"),s=e(require("chroma-js")),u=e(require("isomorphic-fetch")),d=require("@emotion/react"),c=require("@emotion/react/jsx-runtime"),p=require("@emotion/css"),f=e(require("@emotion/cache")),m=require("react-dom"),h=e(require("fuse.js")),v=require("@heroicons/react/solid"),g=require("@heroicons/react/outline");require("@emotion/styled/base");var b=require("react-dnd"),x=require("react-popper"),y=e(require("moment"));require("react-dates/initialize");var w=require("react-dates"),C=require("@visx/xychart"),j=require("@visx/gradient"),F=require("@visx/legend"),S=require("@visx/scale"),k=e(require("@visx/legend/lib/legends/Ordinal")),T=require("@visx/curve"),A=require("d3-time-format"),D=require("@visx/shape"),I=require("@visx/responsive"),P=require("@visx/group"),_=e(require("@visx/shape/lib/shapes/Pie")),E=require("@react-spring/web"),O=require("@visx/tooltip"),L=require("@visx/geo"),M=require("topojson-client"),R=e(require("@visx/responsive/lib/components/ParentSize")),N=require("@visx/zoom"),z=e(require("react-visibility-sensor")),B=e(require("copy-to-clipboard")),q=require("react-dnd-html5-backend"),V=require("file-saver");function H(){H=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var o=Object.create((t&&t.prototype instanceof p?t:p).prototype),a=new S(i||[]);return r(o,"_invoke",{value:w(e,n,a)}),o}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function p(){}function f(){}function m(){}var h={};s(h,o,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(k([])));g&&g!==t&&n.call(g,o)&&(h=g);var b=m.prototype=p.prototype=Object.create(h);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var i;r(this,"_invoke",{value:function(r,o){function a(){return new t((function(i,a){!function r(i,o,a,l){var s=d(e[i],e,o);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,l)}),(function(e){r("throw",e,a,l)})):t.resolve(c).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,l)}))}l(s.arg)}(r,o,i,a)}))}return i=i?i.then(a,a):a()}})}function w(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var l=C(a,n);if(l){if(l===c)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===c)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function C(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),c;var i=d(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,c;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function F(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function k(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:void 0,done:!0}}return f.prototype=m,r(b,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:f,configurable:!0}),f.displayName=s(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,l,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},x(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new y(u(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(b),s(b,l,"Generator"),s(b,o,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=k,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(F),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),F(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;F(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function W(e,t,n,r,i,o,a){try{var l=e[o](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,i)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){W(o,r,i,a,l,"next",e)}function l(e){W(o,r,i,a,l,"throw",e)}a(void 0)}))}}function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function G(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,X(e,t)}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function J(e,t,n){return(J=Q()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&X(i,n.prototype),i}).apply(null,arguments)}function Z(e){var t="function"==typeof Map?new Map:void 0;return(Z=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return J(e,arguments,K(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),X(n,e)})(e)}function $(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ee(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ee(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var ne=r.object({fieldId:r.string().required(),dataSetId:r.string().required()}),re=function(e){return r.object().pattern(r.string(),r.array().items(pe(e)).optional())},ie=function(e){return{title:r.string().allow(""),managedByConfiguration:r.boolean().optional(),requiresValue:r.boolean().optional(),optionsFilters:re(e).optional(),appliesToFields:r.array().items(ne).required(),optionsPulledFrom:r.array().items(ne).optional()}},oe=function(e,t){return r.object(U({},ie(e),{type:r.valid("singleSelectFilter").required(),value:r.alternatives(r.string(),r.number(),r.boolean(),r.valid.apply(r,t?[]:[null]))}))},ae=function(e,t){return r.object(U({},ie(e),{type:r.valid("multiSelectFilter").required(),value:r.alternatives(r.array().items(r.string(),r.number()).single(),r.valid.apply(r,t?[]:[null]))}))},le=function(e,t,n){return r.object(U({},ie(e),{type:r.valid(n).required(),value:r.alternatives(r.valid.apply(r,t?[]:[null]),r.object({type:r.valid("fixedRange"),before:r.alternatives(r.date()).required(),after:r.alternatives(r.date()).required()}),r.object({type:r.valid("relative"),value:r.string()}))}))},se=function(e){return r.object({field:r.string().required(),function:r.valid.apply(r,Object.keys(e).concat(["none"]))})},ue=function(e){var t;return r.object({field:r.string().required(),direction:r.string().valid("asc","desc").required(),function:(t=r.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"]))})},de=function(e){return r.object({field:r.string().required(),truncate:r.valid.apply(r,Object.keys(e)),bucketFill:r.boolean()})},ce=function(e){return r.array().items(r.object({field:r.string(),pivot:r.allow("x","y").optional(),function:r.valid.apply(r,["none"].concat(Object.keys(e)))}))},pe=function(e){var t;return r.object({field:r.string().required(),op:(t=r.string()).valid.apply(t,Object.keys(e.supportedOperators)),value:r.any().required(),function:r.string()})},fe=function(e){return r.array().items(r.array().items(pe(e)))},me=function(){return r.number().allow("",r.number())},he={viewId:r.string().allow("").optional(),displayTitle:r.string().allow(""),displaySubject:r.string().allow(""),dataSetId:r.string(),protectedByOrganisation:r.boolean().optional()},ve=r.valid("auto",2,0),ge=function(e){return{measure:r.array().items(se(e.supportedAggregates)).required(),dimension:ce(e.supportedTimeTruncFunctions).required(),drilldown:r.alternatives(ce(e.supportedTimeTruncFunctions).required(),r.string()),order:r.array().items(ue(e)),timeDimension:r.alternatives(de(e.supportedTimeTruncFunctions),r.valid(null)).required(),limit:me(),offset:r.number().min(0),filter:r.array().items(r.array().items(pe(e))),xAxisPrefix:r.string().allow(""),yAxisPrefix:r.string().allow(""),xAxisPostfix:r.string().allow(""),yAxisPostfix:r.string().allow(""),yAxisFormat:r.alternatives(r.string(),r.valid(null)),xAxisFormat:r.alternatives(r.string(),r.valid(null)),approxYAxisLabelCount:ve,approxXAxisLabelCount:ve}},be=r.string().valid("natural","straight","step","stepBefore","stepAfter"),xe=function(){return r.array().items(r.object({function:r.string().required(),field:r.string().required()}))},ye=function(){return r.array().items(r.object({function:r.string(),truncate:r.string(),field:r.string().required(),bucketFill:r.boolean().optional(),pivot:r.string().valid("x","y").optional()}))},we=function(e){return r.object().pattern(r.string(),r.alternatives().try(r.array().items(de(e.supportedTimeTruncFunctions)).min(1),ce(e.supportedTimeTruncFunctions))).unknown(!0)},Ce=function(e){return r.object().pattern(r.string(),r.array().items(se(e.supportedAggregates)).min(1)).unknown(!0)},je=function(e){return r.object({measure:Ce(e),group:we(e)})},Fe=function(){return r.object({color:r.string().required(),value:r.number().required(),strokeWidth:r.number().required(),strokeStyle:r.string().valid("dashed","solid").required(),label:r.boolean().optional()})},Se=function(){return r.array().items(Fe())},ke=function(){return r.object({x:r.string().allow(""),y:r.string().allow("")})},Te=r.object().pattern(r.string(),r.object({width:r.number().min(0),height:r.number().min(0)})),Ae=function(e){return r.object({field:r.string().required(),operator:r.valid.apply(r,Object.keys(e.supportedOperators)),value:r.alternatives(r.string(),r.number(),r.boolean()).required(),ruleValue:r.string().allow("").required(),ruleType:r.valid("backgroundColor","fontColor","lineColor","areaColor").required()})},De=r.object({field:r.string().required(),prefix:r.string().required()}),Ie=r.object({field:r.string().required(),function:r.valid("none").required()}),Pe=function(e){return r.object(U({},he,{type:r.valid("basicTable"),measure:r.array().items(Ie),dimension:r.array().max(0),order:r.array().items(ue(e.queryEngineConfig)),timeDimension:r.valid(null),limit:me(),offset:r.number().min(0),filter:fe(e.queryEngineConfig),prefixes:r.array().items(De),exportNames:r.object(),numberFormat:r.object(),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),dateTimeFormat:r.string(),protectedFields:r.object({measure:xe()}).unknown(!0),sizing:Te}))},_e=function(e){return null!=e&&e.truncate&&"none"!=(null==e?void 0:e.truncate)?e.field+"_"+e.truncate:null==e?void 0:e.field},Ee=function(e,t){var n=e.split("_"),r=n.pop();return r&&!Me(t,r)?null:{field:n.join("_"),truncate:null!=r?r:""}},Oe={month:{publicName:"Monthly",dateFormat:"MMMM YYYY"},year:{publicName:"Yearly",dateFormat:"YYYY"},quarter:{publicName:"Per quarter",dateFormat:"quarter"},week:{publicName:"Weekly",dateFormat:"week"},day:{publicName:"Daily",dateFormat:"DD-MM-YYYY"},second:{publicName:"Per second",dateFormat:"hh:mm:ss"},hour:{publicName:"Hourly",dateFormat:"hh:mm"},minute:{publicName:"Per minute",dateFormat:"hh:mm"}},Le=function(e){var t=i.cloneDeep(Oe);if(!e)return t;var n={};return e.forEach((function(e){if(!Oe[e])throw"Time trunc function "+e+" not managed by Vizzly";n[e]=Oe[e]})),n},Me=function(e,t){return[].concat(Object.keys(e),["none"]).includes(t)},Re=function(e,t){return[].concat(Object.keys(t.supportedOperators)).filter((function(t){return ze[t].validDataTypes.includes(e.dataType)}))},Ne=function(e){return"countDistinct"==e?"Count distinct":i.capitalize(e)},ze={">":{publicName:"Greater than",validDataTypes:["number","date_time"]},"<":{publicName:"Less than",validDataTypes:["number","date_time"]},"<=":{publicName:"Less than or equal to",validDataTypes:["number","date_time"]},">=":{publicName:"Greater than or equal to",validDataTypes:["number","date_time"]},"!=":{publicName:"Not equal to",validDataTypes:["number","date_time","boolean","string"]},is_one_of:{publicName:"Is one of",validDataTypes:["number","date_time","boolean","string"]},"=":{publicName:"Equal to",validDataTypes:["number","date_time","boolean","string"]},is_not_one_of:{publicName:"Is not one of",validDataTypes:["number","date_time","boolean","string"]},starts_with:{publicName:"Starts with",validDataTypes:["string"]},ends_with:{publicName:"Ends with",validDataTypes:["string"]},contains_substring:{publicName:"Contains text",validDataTypes:["string"]},does_not_contain_substring:{publicName:"Does not contain text",validDataTypes:["string"]},array_contains:{publicName:"Contains",validDataTypes:["string[]"]}},Be=function(e){var t=i.cloneDeep(ze);if(!e)return t;var n={};return e.forEach((function(e){if(!ze[e])throw"Operator "+e+" not managed by Vizzly";n[e]=ze[e]})),n},qe=function(e){return ze[e].publicName},Ve=function(e){return e.map((function(e){return e.map((function(e){return"is_one_of"!=e.op&&"is_not_one_of"!=e.op||i.isArray(e.value)?e:U({},e,{value:[e.value]})}))}))},He=function(e,t){return e.map((function(e){var n=U({},e,{aggregate:void 0,function:e.function||e.aggregate});return delete n.aggregate,t&&n.field==t.field&&"none"==n.function&&(n.function=t.truncate),n}))},We=function(e){return e.map((function(e){var t=U({},e,{aggregate:void 0,function:e.function||e.aggregate});return delete t.aggregate,t}))},Ye=function(e){return"auto"===e||0===e||2===e?e:"auto"},Ue=function(e){if(!e)return{};var t={};return e.measure&&Object.entries(e.measure).forEach((function(e){t&&(t[e[0]]=We(e[1]))})),{measure:i.isEmpty(t)?void 0:t,group:e.group}},Ge={mean:{publicName:"Mean",validDataTypes:["number"]},sum:{publicName:"Sum",validDataTypes:["number"]},min:{publicName:"Min",validDataTypes:["number"]},max:{publicName:"Max",validDataTypes:["number"]},count:{publicName:"Count",validDataTypes:["string","number","boolean","date_time","string[]"]},countDistinct:{publicName:"Unique",validDataTypes:["string","number","boolean","date_time"]}},Ke=function(e){var t=i.cloneDeep(Ge);if(!e)return t;var n={};return e.forEach((function(e){if(!Ge[e])throw"Aggregate "+e+" not managed by Vizzly";n[e]=Ge[e]})),n};function Xe(e,t,n){return e+" "+(1==e?t:n)}function Qe(e,t){if(void 0===t&&(t=!0),1==e.length)return t?"'"+e[0]+"'":""+e[0];var n=[].concat(e),r=n.pop();return n.map((function(e){return t?"'"+e+"'":""+e})).join(", ")+" and "+(t?"'"+r+"'":""+r)}var Je=function(e,t,n){return void 0===n&&(n="No value"),null===e||i.isNumber(e)&&isNaN(e)?n:e instanceof Date?t(e):!0===e?"True":!1===e?"False":i.isNumber(e)&&e%1!=0?e.toFixed(2):Array.isArray(e)?e.join(", "):""+e},Ze=function(e,t){return void 0===t&&(t="No value"),null===e?t:e instanceof Date?e.toISOString():e},$e=function(e,t){return et(e,t)[0]},et=function(e,t){return Object.keys(t).filter((function(n){return t[n].validDataTypes.includes(e.dataType)}))},tt=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},nt=function(e,t){var n=e.split("_"),r=n.pop();return[void 0].concat(Object.keys(t.supportedAggregates||{}),Object.keys(t.supportedTimeTruncFunctions||{}),Object.keys(t.supportedTransformationFunctions||{})).includes(r)?{field:n.join("_"),function:null!=r?r:""}:{field:e,function:"none"}},rt=function(e,t){var n=nt(e,t);return{fieldId:n.field,function:n.function}},it=function(e,t){var n=new Set(t.map((function(e){return e.field})));return e.filter((function(e){return!n.has(e.id)}))},ot=function(e){return e.map((function(e){return"string"==typeof e?{field:e,function:"none"}:e}))},at=function(e){return"string[]"==e.dataType},lt=tt,st=nt,ut=function(e){return"none"!=e.function},dt=function(e,t,n){switch(e.type){case"subquery":return"subquery_"+t;case"maths":return"maths_"+t;case"switchField":return"switchField_"+t;case"field":return tt({field:e.value,function:e.function});case"function":return"function_"+t;case"number":default:return"number_"+t}};function ct(e,t){for(var n={},r=0,i=Object.entries(e);r<i.length;r++){var o=i[r];n[o[0]]=o[1].filter((function(e){return(null==e?void 0:e.field)!==t}))}return n}var pt=function(e,t){return U({},e,{order:i.remove(e.order,(function(e){return i.some(t,(function(t){return t.function==e.function&&t.field==e.field}))}))})},ft=function(e,t,n){var r,o,a,l=U({},e);if("measure"in l&&i.remove(l.measure,(function(e){return e.field==t})),"barMeasure"in l&&i.remove(l.barMeasure,(function(e){return e.field==t})),"lineMeasure"in l&&i.remove(l.lineMeasure,(function(e){return e.field==t})),"xMeasure"in l&&(null==(r=l.yMeasure)?void 0:r.field)==t&&(l.xMeasure=null),"yMeasure"in l&&(null==(o=l.yMeasure)?void 0:o.field)==t&&(l.yMeasure=null),"order"in l&&i.remove(l.order,(function(e){return e.field==t})),"dimension"in l&&i.remove(l.dimension,(function(e){return e.field==t})),"barDimension"in l&&i.remove(l.barDimension,(function(e){return e.field==t})),"lineDimension"in l&&i.remove(l.lineDimension,(function(e){return e.field==t})),"filter"in l&&l.filter.forEach((function(e){i.remove(e,(function(e){return e.field==t}))})),"parameters"in l&&l.parameters&&n){var s=function(e,t,n){if("measure"in e&&e.measure){var r=function(e,t){return Object.keys(e).map((function(e){var n=st(e,t);return null!=n&&n.function?n:null})).find((function(e){return null!==e}))}(e.measure,n);if(null!=r&&r.function&&r.field===t){var i=lt(r);delete e.measure[i]}e.measure=ct(e.measure,t)}if("group"in e&&e.group){var o=function(e,t){return Object.keys(e).map((function(e){var n=Ee(e,t.supportedTimeTruncFunctions);return null!=n&&n.truncate?n:null})).find((function(e){return null!==e}))}(e.group,n);if(null!=o&&o.truncate&&o.field===t){var a=_e(o);delete e.group[a]}else e.group.hasOwnProperty(t)&&delete e.group[t];e.group=ct(e.group,t)}return e}(l.parameters,t,n);l.parameters=s}return"timeDimension"in l&&(null==(a=l.timeDimension)?void 0:a.field)==t&&(l.timeDimension=null),l},mt=function(e){var t=[].concat(e.measure);return e.dimension.forEach((function(e){t.push({field:e.field,function:e.function})})),e.timeDimension&&t.push({field:e.timeDimension.field,function:e.timeDimension.truncate}),pt(e,t)},ht=function(e,t,n){var r=function e(t,n){return i.mergeWith({},t,n,(function(t,n){return i.isArray(n)?n:i.isObject(t)&&i.isObject(n)?e(t,n):n}))}(e,t),o=n.validate(r),a=o.error;if(a)throw a;return o.value},vt=function(e){return function(t,n){var r=ht(t,n,Pe(e));return pt(r,[].concat(r.measure))}},gt=function(e,t,n){return e.map((function(e){return{returns:{type:"string",value:e.name},filter:Pt(e.rule,t,n)}}))},bt=function(){return l.v4().replace(/-/g,"")},xt=function(e){return"numeratorFilter"in e},yt=function(e){return"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e},wt=function(e){return"roundToDecimalPlaces"in e},Ct=function(e){return"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e},jt=function(e){return"denominatorFieldId"in e&&"denominatorAggregate"in e&&"numeratorFieldId"in e&&"numeratorAggregate"in e},Ft=function(e){return"rules"in e},St=function(e){if(xt(e))return"percentage";if(jt(e))return"percentage";if(yt(e))return"math";if(Ct(e))return"math";if(Ft(e))return"rules";if(wt(e))return"roundedNumber";throw"Unrecognised custom field type for custom field; "+JSON.stringify(e)},kt=function(e){return xt(e)||yt(e)||Ct(e)||jt(e)||Ft(e)||wt(e)},Tt=function(e,t,n,r,i,o){if(xt(t))return function(e,t,n,r,i){var o,a=[];return i&&(a=It(i,null!=(o=e.numeratorFilter[0])?o:[])),r?{type:"maths",left:{type:"field",value:null==e?void 0:e.denominatorFieldId,function:e.denominatorAggregate},op:"/",right:{type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:[]}}}:{type:"maths",left:{type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:Pt(a,t,n)}},op:"/",right:{type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:[]}}}}(t,n,r,i,o);if(jt(t))return function(e,t,n,r){return{type:"maths",left:{type:"field",value:null==e?void 0:e.numeratorFieldId,function:e.numeratorAggregate},op:"/",right:{type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:Pt(r,t,n)}}}}(t,n,r,o||[]);if(Ft(t))return function(e,t,n,r){var i={type:"switchField",value:{cases:gt(t.rules,n,r)}};return"none"==e.function?i:{type:"function",function:e.function,value:i}}(e,t,n,r);if(Ct(t))return function(e){var t=function(e,t,n){return n?{type:"maths",left:{type:"field",value:e,function:t},right:{type:"field",value:n.fieldId,function:n.function},op:n.operator}:{type:"field",value:e,function:t}};return{type:"maths",left:t(e.leftFieldId,e.leftFunction,e.leftNested),right:t(e.rightFieldId,e.rightFunction,e.rightNested),op:e.operator}}(t);if(yt(t))return function(e,t){return"none"!=e.function?{type:"function",function:e.function,value:{type:"maths",left:{type:"field",value:t.leftFieldId,function:"none"},right:{type:"field",value:t.rightFieldId,function:"none"},op:t.operator}}:{type:"maths",left:{type:"field",value:t.leftFieldId,function:"none"},right:{type:"field",value:t.rightFieldId,function:"none"},op:t.operator}}(e,t);if(wt(t))return At(e,t);throw"Unsupported custom field type; "+JSON.stringify(t)},At=function(e,t){var n={type:"field",function:"round_to_"+t.roundToDecimalPlaces+"_dp",value:t.fieldId};return"none"==e.function?n:{type:"function",function:e.function,value:n}},Dt=function(e){if("numeratorFilter"in e&&"numeratorFieldId"in e)return{id:e.id,canBeDimension:e.canBeDimension,canBeMeasure:e.canBeMeasure,denominatorAggregate:e.numeratorAggregate,denominatorFieldId:e.numeratorFieldId,publicName:e.publicName,dataType:e.dataType,allowedOperators:e.allowedOperators,numeratorFilter:e.numeratorFilter};if("leftAggregate"in e||"rightAggregate"in e){var t=U({},e,{rightFunction:e.rightFunction||e.rightAggregate,leftFunction:e.leftFunction||e.leftAggregate,leftNested:e.leftNested?U({},e.leftNested,{aggregate:void 0,function:e.leftNested.function||e.leftNested.aggregate}):void 0,rightNested:e.rightNested?U({},e.rightNested,{aggregate:void 0,function:e.rightNested.function||e.rightNested.aggregate}):void 0});return delete t.leftAggregate,delete t.rightAggregate,t.rightNested&&delete t.rightNested.aggregate,t.leftNested&&delete t.leftNested.aggregate,t}return e},It=function(e,t){return e&&!i.isEmpty(e)||(e=[[]]),[].concat(e).map((function(e){return[].concat(e,t)}))},Pt=function(e,t,n){return e.map((function(r){return[].concat(r).flatMap((function(r){var i;if(r.function&&!Me(t.supportedTimeTruncFunctions,r.function))throw"Query engine does not support the query function "+r.function+".";var o,a=Rn(n,r.field),l={type:"field",value:r.field,function:null!=(i=r.function)?i:"none"};return kt(a)&&(l=Tt({field:a.id,function:null!=(o=r.function)?o:"none"},a,t,n,!1,e)),"array_contains"==r.op&&Array.isArray(r.value)?[].concat(r.value).map((function(e){return{field:l,op:r.op,value:e}})):[{field:l,op:r.op,value:r.value}]}))}))},_t=function(e,t){return[[].concat(e,[t]),e.length]},Et=function(e,t,n,r,i,o,a,l,s){var u=[],d=[],c=[],p=[],f=[];if(o){var m;if(!Me(s.supportedTimeTruncFunctions,o.truncate))throw"Query engine does not support the time trunc function "+o.truncate+".";var h=_t(d,{type:"field",value:o.field,function:o.truncate});d=h[0],m=h[1],u=[].concat(u,[{functionId:o.truncate,field:Rn(e,o.field)}]),c=[].concat(c,[{index:m}])}return i.forEach((function(t){var n,r=_t(d,{type:"field",value:null==t?void 0:t.field,function:t.function});d=r[0],n=r[1],u=[].concat(u,[{functionId:t.function,field:Rn(e,t.field)}]),c=[].concat(c,[{index:n}])})),t.forEach((function(t){if(n=t.function,![].concat(Object.keys(s.supportedAggregates),["none"]).includes(n))throw"Query engine does not support the query function "+t.function+".";var n,r=_t(d,{type:"field",value:t.field,function:t.function});d=r[0],u=[].concat(u,[{functionId:t.function,field:Rn(e,t.field)}])})),n.forEach((function(e){var t=d.findIndex((function(t){return"field"==t.type&&t.value==e.field&&t.function==e.function}));t>=0&&(p=[].concat(p,[{index:t,direction:e.direction}]))})),r.forEach((function(t){var n=Pt([t],s,e);f=[].concat(f,[n[0]])})),d=d.map((function(t){if("field"==t.type&&"string"==typeof t.value){var n=Rn(e,t.value);if(kt(n))return Tt({function:t.function,field:t.value},n,s,e,Mt({group:c}),r)}return t})),{query:{type:"query",dataSetId:e.id,measure:d,group:c,filter:f,order:p,limit:a,offset:l},measureDescription:u}},Ot=function e(t){return i.some(t,(function(t){return"maths"==t.type?e([t.left])||e([t.right]):"field"==t.type&&"string"!=typeof t.value?e([t.value]):"subquery"==t.type}))},Lt=Et,Mt=function(e){return e.group.length>0},Rt=function(e,t,n){return{query:{type:"preparedQuery",preparedQueryType:"uniqueArrayValues",dataSetId:e,fieldId:t.id,filter:n||[]},resultFields:[{id:t.id,publicName:t.publicName,dataType:t.dataType}]}},Nt=function(e,t,n){return{dataSetId:e.id,measure:[{field:t,function:"count"}],order:[],filter:n?[n]:[],dimension:[{field:t,function:"none"}],timeDimension:null,limit:5e3,offset:0}},zt=function(e,t){return e.supportedFeatures.includes(t)},Bt=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ValidationError",n}return G(t,e),t}(Z(Error)),qt=function(e){function t(t,n){var r;return(r=e.call(this,"\n An expected field is missing from a dataSet.\n\n Missing '"+n+"'. Got;\n "+JSON.stringify(t)+"\n ")||this).missingFieldId=void 0,r.name="FieldNotFoundInDataSet",r.missingFieldId=n,r}return G(t,e),t.prototype.getMissingFieldId=function(){return this.missingFieldId},t}(Bt),Vt=function(e){return r.object(U({},he,ge(e.queryEngineConfig),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("barChart","horizontalBarChart"),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),protectedFields:r.object({dimension:ye(),measure:xe()}).unknown(!0),parameters:je(e.queryEngineConfig),goalLines:Se(),axisTitles:ke()}))},Ht=function(e){return function(t,n){var r=ht(t,n,Vt(e));return mt(r)}},Wt=function(e){function t(t){var n;return(n=e.call(this,"Corrupt view. "+t.message+".\n\n "+JSON.stringify(t)+"\n ")||this).name="CorruptedView",n}return G(t,e),t}(Bt),Yt=function(e){function t(t,n){var r;return(r=e.call(this,"\n An expected data set is missing from the dashboard.\n\n Missing '"+n+"'. Got;\n "+JSON.stringify([].concat(t).map((function(e){return e.id})))+"\n ")||this).name="DataSetNotFound",r}return G(t,e),t}(Bt),Ut=function(e){var t=[];return"measure"in e&&e.measure&&(t=[].concat(t,[].concat(e.measure))),"xMeasure"in e&&e.xMeasure&&(t=[].concat(t,[e.xMeasure])),"yMeasure"in e&&e.yMeasure&&(t=[].concat(t,[e.yMeasure])),t},Gt=function(e){var t=[];return"dimension"in e&&e.dimension&&(t=[].concat(t,e.dimension)),"lineDimension"in e&&e.lineDimension&&(t=[].concat(t,e.lineDimension)),"barDimension"in e&&e.barDimension&&(t=[].concat(t,e.barDimension)),t},Kt=function(e){var t=[];return Ut(e).forEach((function(e){t=[].concat(t,[e.field])})),Gt(e).forEach((function(e){t=[].concat(t,[e.field])})),"order"in e&&e.order&&(t=[].concat(t,[].concat(e.order).map((function(e){return e.field})))),"timeDimension"in e&&e.timeDimension&&(t=[].concat(t,[e.timeDimension.field])),t},Xt={allowUnknown:!0,stripUnknown:!0},Qt=function(e,t,n){var r=On(e.type,{queryEngineConfig:n}).schema.validate(e,Xt).error;if(r)return[new Wt(r)];var i=Mn(t,e.dataSetId);if(!i)return[new Yt(t,e.dataSetId)];var o=Kt(e);try{o.forEach((function(e){Rn(i,e)}))}catch(e){if(e instanceof qt)return[e];throw e}return[]},Jt=function(e){return"barChart"===e.type?"The Column Chart needs to have a grouping or a time to display correctly.":"lineChart"===e.type?"The Line Chart needs to have a grouping or a time to display correctly.":"areaChart"===e.type?"The Area Chart needs to have a grouping or a time to display correctly.":"horizontalBarChart"===e.type?"The Horizontal Bar Chart needs to have a grouping or a time to display correctly.":"comboChart"===e.type?"The Combo Chart needs to have a grouping (Bar and Line), or have time set to display correctly.":"scatterChart"===e.type?"The Scatter Chart needs to have a grouping to display correctly.":"pieChart"===e.type?"The Pie Chart needs to have a grouping to display correctly.":null},Zt=function(e){var t;return"comboChart"===e.type?!!e.timeDimension||!!(e.barDimension.length>0&&e.lineDimension.length>0):"barChart"!==e.type&&"lineChart"!==e.type&&"areaChart"!==e.type&&"horizontalBarChart"!==e.type&&"scatterChart"!==e.type&&"pieChart"!==e.type||!!e.timeDimension||null==e||!e.dimension||0!==(null==e||null==(t=e.dimension)?void 0:t.length)},$t=function(e){return!!Zt(e)||Jt(e)},en=["parentDimension"],tn=function(e){return e||"view_"+l.v4()};function nn(e){return $(e,en)}var rn=function(e,t,n){var r=i.cloneDeep(Ln(t.fields,{onlyFieldTypes:["boolean","string"]})),o=i.cloneDeep(Ln(t.fields,{onlyFieldTypes:["date_time"]})),a=i.cloneDeep(Ln(t.fields,{onlyFieldTypes:["number"]})),l=null;return o[0]&&(l={field:o[0].id,truncate:"allowedGranularities"in o[0]?o[0].allowedGranularities[0]:"none"}),n(e,{protectedByOrganisation:!0,dimension:r.map((function(e){return{field:e.id,function:"none"}})),measure:[].concat(a).map((function(e){return{function:"none",field:e.id}})),order:[],timeDimension:l})},on=function(e,t){var n=null,r=i.cloneDeep(e);return r.forEach((function(e){var r=Rn(t,e.field);"date_time"==r.dataType&&(n={field:r.id,truncate:e.function})})),r=r.filter((function(e){return"date_time"!=Rn(t,e.field).dataType})),{timeDimension:n,dimension:r}},an=function(e){var t=[].concat(e.dimension);return"timeDimension"in e&&e.timeDimension&&(t=[{field:e.timeDimension.field,function:e.timeDimension.truncate}].concat(t)),t},ln=function(e){if(e){var t=i.cloneDeep(e);return t.measure=We(e.measure||[]),t}},sn=function(e){return{title:"Column chart",dump:function(e){return e},load:function(e){return U({},e,{measure:We(e.measure),order:He(e.order,e.timeDimension),filter:Ve(e.filter),protectedFields:ln(e.protectedFields),viewId:tn(e.viewId),dimension:ot(e.dimension),approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount),parameters:Ue(e.parameters)})},setAttributes:Ht(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],stacked:void 0,dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0},t)},createFeedback:$t,schema:Vt(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,callToAction:"Add grouping",preSetPartialAttributes:function(e,t){return on(e,t)},getValues:function(e){return an(e)},maxAllowed:2,testId:"add-dimension"},{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"stacked",title:"Layout",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0},setDataAttributesFromPreAggregatedDataSet:function(e,t){return rn(e,t,this.setAttributes)}}},un=function(e){return r.object(U({},he,ge(e.queryEngineConfig),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("lineChart"),parameters:je(e.queryEngineConfig),lineCurve:be,conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),goalLines:Se(),axisTitles:ke()}))},dn=function(e){return function(t,n){var r=ht(t,n,un(e));return mt(r)}},cn=function(e){return{title:"Line chart",dump:function(e){return e},load:function(e){return{type:e.type,measure:We(e.measure),order:He(e.order,e.timeDimension),dimension:ot(e.dimension),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:tn(e.viewId),filter:Ve(e.filter),dataSetId:e.dataSetId,limit:e.limit,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,conditionalFormattingRules:e.conditionalFormattingRules,drilldown:e.drilldown,legend:e.legend,goalLines:e.goalLines,parameters:Ue(e.parameters),approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount),axisTitles:e.axisTitles}},setAttributes:dn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0},t)},createFeedback:$t,schema:un(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",fieldFilterOptions:{forComponent:"lineChart"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,callToAction:"Add grouping",preSetPartialAttributes:function(e,t){return on(e,t)},getValues:function(e){return an(e)},maxAllowed:2,testId:"add-dimension"},{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"curve",title:"Line Curve",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0},setDataAttributesFromPreAggregatedDataSet:function(e,t){return rn(e,t,this.setAttributes)}}},pn=function(e){return r.object(U({},he,{measure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),dimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),filter:fe(e.queryEngineConfig),timeDimension:r.valid(null),order:r.array().items(ue(e.queryEngineConfig)),type:r.valid("pieChart"),legend:r.valid(!0,!1),limit:me(),labelsAsPercentage:r.boolean(),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),labelFormat:r.alternatives(r.string(),r.valid(null)),parameters:je(e.queryEngineConfig)}))},fn=function(e){return{title:"Pie chart",dump:function(e){return e},load:function(e){return{type:e.type,measure:We(e.measure),order:He(e.order,e.timeDimension),dimension:ot(e.dimension),viewId:tn(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:Ve(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,labelsAsPercentage:e.labelsAsPercentage,legend:e.legend,labelFormat:e.labelFormat,parameters:Ue(e.parameters)}},setAttributes:function(t,n){return ht(t,n,pn(e))},validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labelFormat:null,parameters:{}},t)},createFeedback:$t,schema:pn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",fieldFilterOptions:{forComponent:"pieChart"},callToAction:"Add metric",maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,callToAction:"Add comparison",preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"},{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart"},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart"}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"legend",title:"Show Legend",description:""},{type:"numberFormat",title:"Format",description:""}]}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0}}},mn=function(e){return r.object(U({},he,{xMeasure:se(e.queryEngineConfig.supportedAggregates).allow(null),yMeasure:se(e.queryEngineConfig.supportedAggregates).allow(null),dimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),order:r.array().items(ue(e.queryEngineConfig)),limit:me(),legend:r.valid(!0,!1),offset:r.number().min(0),filter:fe(e.queryEngineConfig),type:r.valid("scatterChart"),timeDimension:r.valid(null),xAxisPrefix:r.string().allow(""),yAxisPrefix:r.string().allow(""),xAxisPostfix:r.string().allow(""),yAxisPostfix:r.string().allow(""),yAxisFormat:r.alternatives(r.string(),r.valid(null)),xAxisFormat:r.alternatives(r.string(),r.valid(null)),approxYAxisLabelCount:ve,approxXAxisLabelCount:ve,goalLines:Se(),axisTitles:ke()}))},hn=function(e){return function(t,n){var r=ht(t,n,mn(e)),i=[];return r.xMeasure&&i.push(r.xMeasure),r.yMeasure&&i.push(r.yMeasure),r.dimension.forEach((function(e){i.push({field:e.field,function:e.function})})),pt(r,i)}},vn=function(e){return r.object(U({},he,{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),barMeasure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),lineMeasure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),barDimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),lineDimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),order:r.array().items(ue(e.queryEngineConfig)),timeDimension:r.alternatives(de(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),limit:me(),offset:r.number().min(0),filter:fe(e.queryEngineConfig),type:r.valid("comboChart"),xAxisPrefix:r.string().allow(""),yAxisPrefix:r.string().allow(""),xAxisPostfix:r.string().allow(""),yAxisPostfix:r.string().allow(""),yAxisFormat:r.alternatives(r.string(),r.valid(null)),xAxisFormat:r.alternatives(r.string(),r.valid(null)),approxYAxisLabelCount:ve,approxXAxisLabelCount:ve,goalLines:Se(),conditionalFormattingRules:r.object({bar:r.array().items(Ae(e.queryEngineConfig))}),axisTitles:ke()}))},gn=function(e){return function(t,n){var r=ht(t,n,vn(e)),i=[].concat(r.lineMeasure,r.barMeasure);return[].concat(r.lineDimension,r.barDimension).forEach((function(e){i.push({field:e.field,function:e.function})})),r.timeDimension&&i.push({field:r.timeDimension.field,function:r.timeDimension.truncate}),pt(r,i)}},bn=function(e){return{title:"Combo chart",dump:function(e){return e},load:function(e){return U({},t=e,{lineMeasure:We(t.lineMeasure),barMeasure:We(t.barMeasure),order:He(t.order,t.timeDimension||null),filter:Ve(t.filter),lineDimension:ot(t.lineDimension||t.dimension||[]),barDimension:ot(t.barDimension||t.dimension||[]),viewId:tn(t.viewId),approxXAxisLabelCount:Ye(t.approxXAxisLabelCount),approxYAxisLabelCount:Ye(t.approxYAxisLabelCount)});var t},setAttributes:gn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0},t)},createFeedback:$t,schema:vn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.lineMeasure.length>0||e.barMeasure.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"comboChart"),r=n.measure,i=n.dimension;return this.init(t.id,{barMeasure:[r[0]],lineMeasure:[r[1]||r[0]],barDimension:i,lineDimension:i})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},{type:"views",title:"View",description:""},{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",metrics:[{title:"Line",propKey:"lineMeasure",allowsMultiple:!0},{title:"Bar",propKey:"barMeasure",allowsMultiple:!0}]},{type:"comboChartDimension",title:"Grouping - X Axis",description:""},{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},{type:"customMetrics",title:"Custom metrics",description:""},{type:"limit",title:"Limit",description:"Set the maximum number of data points to show on this combo chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"stacked",title:"Layout",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor",subSection:[{title:"Bar",propKey:"bar"}]},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}}},xn=function(e){return r.object(U({},he,{type:r.valid("dataTable"),measure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),dimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),order:r.array().items(ue(e.queryEngineConfig)),timeDimension:r.alternatives(de(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),limit:me(),offset:r.number().min(0),filter:fe(e.queryEngineConfig),prefixes:r.array().items(De),exportNames:r.object(),numberFormat:r.object(),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),dateTimeFormat:r.string(),protectedFields:r.object({dimension:ye(),measure:xe()}).unknown(!0),sizing:Te,tableDrilldown:r.array().items(r.object({subsetDimension:r.string().required()}))}))},yn=function(e){return function(t,n){var r=ht(t,n,xn(e));return mt(r)}},wn=function(e,t){return e.filter((function(e){return e.pivot==t}))},Cn=function(e){return{title:"Pivot table",dump:function(e){return e},load:function(e){return{type:e.type,measure:We(e.measure),order:He(e.order,e.timeDimension||null),displayTitle:e.displayTitle,dimension:(n=an({timeDimension:e.timeDimension,dimension:ot(e.dimension)}),n.map((function(e){return U({},e,{pivot:e.pivot?e.pivot:"x"})}))),displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,protectedFields:ln(e.protectedFields),viewId:tn(e.viewId),filter:Ve(e.filter),dataSetId:e.dataSetId,limit:e.limit,offset:e.offset,conditionalFormattingRules:e.conditionalFormattingRules,dateTimeFormat:e.dateTimeFormat,prefixes:e.prefixes,exportNames:e.exportNames,numberFormat:e.numberFormat,sizing:e.sizing,tableDrilldown:(t=e.tableDrilldown,t&&t.length>0?t.map(nn):t||[])};var t,n},setAttributes:yn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:2e3,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[]},t)},schema:xn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"dataTable"),r=n.dimension;return this.init(t.id,{measure:n.measure.slice(0,5),dimension:r})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Group columns",description:"",fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,callToAction:"Add group column",preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return U({},e,{pivot:"y"})})),wn(n.dimension,"x"))}},getValues:function(e){return wn(e.dimension,"y")},testId:"add-pivot-dimension"},{type:"fieldCollector",title:"Group rows",description:"Which field do you want to group each row by? An example might be an employee ID or geographical location",fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,callToAction:"Add group row",preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return U({},e,{pivot:"x"})})),wn(n.dimension,"y"))}},getValues:function(e){return wn(e.dimension,"x")},testId:"add-dimension"},{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",fieldFilterOptions:{forComponent:"dataTable"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"sort",title:"Sort",description:""},{type:"pagination",title:"Pagination",description:""},{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}]},formatPanelConfig:function(){return[{title:"Heading",type:"heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"format",title:"Format",description:"",subSection:[{type:"time",title:"Time",description:""}]},{type:"prefixes",title:"Prefixes",description:""},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}}},jn=function(e){return function(t,n){var r=ht(t,n,Vt(e));return mt(r)}},Fn=function(e){return{title:"Horizontal bar chart",dump:function(e){return e},load:function(e){return U({},e,{measure:We(e.measure),order:He(e.order,e.timeDimension),dimension:ot(e.dimension),viewId:tn(e.viewId),filter:Ve(e.filter),approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount),protectedFields:ln(e.protectedFields)})},setAttributes:jn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0},t)},createFeedback:$t,schema:Vt(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this horizontal bar chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric - X Axis",description:"What do you want each bar to measure?",fieldFilterOptions:{forComponent:"horizontalBarChart"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"drilldown",title:"Drilldown",description:""},{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,callToAction:"Add grouping",preSetPartialAttributes:function(e,t){return on(e,t)},getValues:function(e){return an(e)},maxAllowed:2,testId:"add-dimension"},{type:"sort",title:"Sort",description:""},{type:"limit",title:"Limit",description:"Set the maximum number of data points to show on this horizontal bar chart."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this horizontal bar chart."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"stacked",title:"Layout",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0},setDataAttributesFromPreAggregatedDataSet:function(e,t){return rn(e,t,this.setAttributes)}}},Sn=function(e){return r.object(U({},he,ge(e.queryEngineConfig),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("areaChart"),lineCurve:be,conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),parameters:je(e.queryEngineConfig),goalLines:Se(),axisTitles:ke()}))},kn=function(e){return function(t,n){var r=ht(t,n,Sn(e));return mt(r)}},Tn=function(e){return{title:"Area chart",dump:function(e){return e},load:function(e){return{type:e.type,measure:We(e.measure),displayTitle:e.displayTitle,dimension:ot(e.dimension),timeDimension:e.timeDimension,displaySubject:e.displaySubject,viewId:tn(e.viewId),filter:Ve(e.filter),order:He(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,offset:e.offset,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,lineCurve:e.lineCurve,conditionalFormattingRules:e.conditionalFormattingRules,protectedByOrganisation:e.protectedByOrganisation,stacked:e.stacked,drilldown:e.drilldown,legend:e.legend,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,goalLines:e.goalLines,parameters:Ue(e.parameters),approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount)}},setAttributes:kn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,offset:0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0},t)},createFeedback:$t,schema:Sn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",fieldFilterOptions:{forComponent:"areaChart"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be an employee ID to represent each employee.",fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,callToAction:"Add grouping",preSetPartialAttributes:function(e,t){return on(e,t)},getValues:function(e){return an(e)},maxAllowed:2,testId:"add-dimension"},{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"stacked",title:"Layout",description:""},{type:"curve",title:"Line Curve",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0}}},An=function(e){return r.object(U({},he,{fontSize:r.string().allow(""),formatter:r.object(),measure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),filter:fe(e.queryEngineConfig),prefixes:r.object(),postfixes:r.object(),type:r.valid("singleStat"),limit:me(),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),deltaTimeDimension:r.alternatives(de(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),parameters:je(e.queryEngineConfig)}))},Dn=function(e){return{title:"Single stat",dump:function(e){return e},load:function(e){var t=function(e){if("singleMeasure"in e){var t={},n={},r=[],i={};return e.singleMeasure&&(r=[e.singleMeasure],t[lt(e.singleMeasure)]=e.prefix,n[lt(e.singleMeasure)]=e.postfix,i[lt(e.singleMeasure)]=e.formatter),{type:"singleStat",prefixes:t,postfixes:n,measure:r,formatter:i,fontSize:e.fontSize,displayTitle:e.displayTitle,displaySubject:e.displaySubject,filter:Ve(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,deltaTimeDimension:e.deltaTimeDimension,parameters:Ue(e.parameters)}}return U({},e,{filter:Ve(e.filter)})}(e);return{type:"singleStat",prefixes:t.prefixes,postfixes:t.postfixes,fontSize:t.fontSize,formatter:t.formatter,measure:We(t.measure),displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:tn(e.viewId),filter:t.filter,dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:t.conditionalFormattingRules,deltaTimeDimension:t.deltaTimeDimension,parameters:Ue(t.parameters)}},setAttributes:function(t,n){return ht(t,n,An(e))},validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"singleStat",postfixes:{},prefixes:{},measure:[],displayTitle:"",formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{}},t)},schema:An(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[n.measure[0]]})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",fieldFilterOptions:{forComponent:"singleStat"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"filter",title:"Filters",description:"Only include the information you want in this single stat"},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"comparison",title:"Comparison",description:""}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"statsLabels",title:"Labels",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""}},{type:"format",title:"Format",description:"",subSection:[{title:"Font Size",type:"fontSize",description:""}]},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"fontColor"}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0}}},In={title:"Custom",dump:function(e){return e},load:function(e){return e},setAttributes:function(e,t){throw"Not implemented."},validate:function(){return[]},init:function(e,t){return{type:"custom",id:t&&t.id||"",dataSetId:e,displaySubject:"",displayTitle:"",protectedByOrganisation:void 0}},schema:r.object(),removeField:function(e,t){return e},isRunnable:function(){return!0},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[]},formatPanelConfig:function(){return[]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!1,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}},Pn=function(e){return r.object(U({},he,{type:r.valid("mercatorMap"),measure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),filter:fe(e.queryEngineConfig),limit:me(),dimension:ce({}),labelFormat:r.alternatives(r.string(),r.valid(null)),noDataColor:r.string().required(),backgroundColor:r.string().required(),maxValueColor:r.string().required(),minValueColor:r.string().required(),position:r.object({scale:r.number(),centerX:r.number(),centerY:r.number()})}))},_n=function(e){return function(t,n){return ht(t,n,Pn(e))}},En={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}};function On(e,t){if("custom"==e)return In;if("barChart"==e)return sn(t||En);if("areaChart"==e)return Tn(t||En);if("lineChart"==e)return cn(t||En);if("pieChart"==e)return fn(t||En);if("scatterChart"==e)return function(e){return{title:"Scatter chart",dump:function(e){return e},load:function(e){return{type:e.type,xMeasure:We(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:We(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:ot(e.dimension),viewId:tn(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:Ve(e.filter),order:He(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles}},setAttributes:hn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,axisTitles:void 0},t)},createFeedback:$t,schema:mn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0},autoGenerate:function(t){var n=Hn(t,e.queryEngineConfig,"scatterChart"),r=n.measure;return this.init(t.id,{xMeasure:r[0],yMeasure:r[1],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},{type:"views",title:"View",description:""},{type:"labelledMetrics",title:"Metrics",description:"",metrics:[{title:"X axis",propKey:"xMeasure",allowsMultiple:!1},{title:"Y axis",propKey:"yMeasure",allowsMultiple:!1}]},{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,callToAction:"Add comparison",preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"},{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart"},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart"}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}}}(t||En);if("comboChart"==e)return bn(t||En);if("dataTable"==e)return Cn(t||En);if("basicTable"==e)return Zn(t||En);if("singleStat"==e)return Dn(t||En);if("mercatorMap"==e)return function(e){return{title:"Country map",dump:function(e){return e},load:function(e){return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:tn(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:We(e.measure),labelFormat:e.labelFormat,position:e.position,filter:Ve(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0"}},setAttributes:_n(e),validate:function(){return[]},init:function(e,t){return U({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:tn(null==t?void 0:t.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0"},t)},schema:Pn(e),removeField:function(e,t){return e},isRunnable:function(e){return!!(e.dimension&&e.dimension[0]&&e.measure&&e.measure[0])},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric",description:"What do you want to show?",fieldFilterOptions:{forComponent:"pieChart"},callToAction:"Add metric",maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeConditionalPercentage:!0,removeRuleGrouping:!1,removeSimpleMaths:!0,removeSimplePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,callToAction:"Set country",preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"},{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Map Settings",description:"",subSection:[{type:"numberFormat",title:"Value format",description:""}]},{type:"mapColors",title:"Map colors",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}}}(t||En);if("horizontalBarChart"==e)return Fn(t||En);throw"Cannot get interface for "+e+". Please implement it."}function Ln(e,t){var n=[].concat(e);return null!=t&&t.onlyFieldTypes&&!i.isEmpty(t.onlyFieldTypes)&&(n=[].concat(n).filter((function(e){var n;return null==t||null==(n=t.onlyFieldTypes)?void 0:n.includes(e.dataType)}))),null!=t&&t.forComponent&&(n=function(e,t){var n=On(t);return[].concat(e).filter((function(e){var t=!0;return xt(e)&&!n.supportedCustomFields.conditionalPercentage&&(t=!1),jt(e)&&!n.supportedCustomFields.simplePercentage&&(t=!1),yt(e)&&!n.supportedCustomFields.simpleMaths&&(t=!1),Ft(e)&&!n.supportedCustomFields.rules&&(t=!1),wt(e)&&!n.supportedCustomFields.roundedNumbers&&(t=!1),t}))}(n,t.forComponent)),null!=t&&t.removeConditionalPercentage&&(n=n.filter((function(e){return!xt(e)}))),null!=t&&t.removeSimplePercentage&&(n=n.filter((function(e){return!jt(e)}))),null!=t&&t.removeRuleGrouping&&(n=n.filter((function(e){return!Ft(e)}))),null!=t&&t.removeSimpleMaths&&(n=n.filter((function(e){return!yt(e)}))),null!=t&&t.removeAggregateMaths&&(n=n.filter((function(e){return!Ct(e)}))),null!=t&&t.onlyDimensions&&(n=n.filter((function(e){return e.canBeDimension}))),null!=t&&t.onlyMeasures&&(n=n.filter((function(e){return e.canBeMeasure}))),n}var Mn=function(e,t){return e.find((function(e){return e.id==t}))||null},Rn=function(e,t){var n=[].concat(e.fields).find((function(e){return e.id==t}));if(n)return n;throw new qt(e,t)},Nn=function(e,t){var n=i.findIndex(e,(function(e){return e.id==t}));return[e[n]||null,n]},zn=function(e,t){return U({},e,{fields:[].concat(e.fields).map((function(e){return function(e,t){return{id:e.id,dataType:e.dataType,publicName:e.publicName||(n=e.id,(r=function e(t,n,r){var o=i.replace(t,n,r);return o.indexOf(n)>=0?e(o,n,r):o}(n,"_"," ")).charAt(0).toUpperCase()+r.slice(1)),dashboardRequiredFilterGroups:e.dashboardRequiredFilterGroups||[],canBeDimension:void 0===e.canBeDimension||e.canBeDimension,canBeMeasure:void 0===e.canBeMeasure||e.canBeMeasure,allowedOperators:void 0===e.allowedOperators?Re(e,t):e.allowedOperators,allowedGranularities:void 0===e.allowedGranularities?Object.keys(t.supportedTimeTruncFunctions):e.allowedGranularities};var n,r}(e,t)}))})},Bn=function(e,t){var n=[].concat(e.fields).filter(kt);return t&&(n=Ln(n,{forComponent:t})),n},qn=function(e){return U({},e,{fields:[].concat(e.fields).filter((function(e){return!kt(e)}))})},Vn=function(e,t){return[].concat(e).map((function(e){return e.id==t.id?t:e}))},Hn=function(e,t,n){var r="horizontalBarChart"===n?void 0:"x",i=function(e){return[].concat(Ln(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0}))}(e)[0],o=[].concat(function(e,t){return[].concat(Ln(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t}))}(e,n)).map((function(e){var n=$e(e,t.supportedAggregates);return{field:e.id,function:n}}));return{dataSetId:e.id,measure:o,order:[],timeDimension:null,filter:[],dimension:[{field:i.id,function:"none",pivot:r}]}},Wn=function(e,t,n){var r=Ln(e.fields,{removeAggregateMaths:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0}),i=[].concat(r).map((function(e){return{field:e.id,function:"none"}}));return{dataSetId:e.id,measure:i,timeDimension:null,order:[],filter:n,dimension:[],limit:t,offset:0}},Yn=function(e){if(!e.preAggregated)throw"buildViewOnlyQuery function should only be used for single-view datasets";var t=[].concat(e.fields).map((function(e){return{field:e.id,function:"none"}}));return{dataSetId:e.id,measure:t,timeDimension:null,order:[],filter:[],dimension:[],offset:0}},Un=function(e,t){if(!t)return e;e=e.map(qn);var n=[].concat(e).map((function(e){var n=(t[e.id]||[]).map(Dt);return U({},e,{fields:[].concat(e.fields,n)})}));return[].concat(n)},Gn=function(e,t,n,r,i){var o,a,l;return void 0===i&&(i={}),{id:n,publicName:r,dataType:t,canBeDimension:null!=(o=i.canBeDimension)?o:"number"!=t,canBeMeasure:null==(a=i.canBeMeasure)||a,allowedOperators:null!=(l=i.allowedOperators)?l:Re({dataType:t},e)}},Kn=function(e,t,n,r){return void 0===r&&(r={}),Gn(e,"string",t,n,r)},Xn=function(e,t,n,r){return void 0===r&&(r={}),Gn(e,"number",t,n,r)},Qn=function(e,t,n,r){return void 0===r&&(r={}),Gn(e,"boolean",t,n,r)},Jn=function(e,t,n,r){var i,o,a,l;return{id:t,publicName:n,dataType:"date_time",allowedGranularities:null!=(i=r.allowedGranularities)?i:Object.keys(e.supportedTimeTruncFunctions),allowedOperators:null!=(o=r.allowedOperators)?o:Re({dataType:"date_time"},e),canBeDimension:null==(a=r.canBeDimension)||a,canBeMeasure:null!=(l=r.canBeMeasure)&&l}},Zn=function(e){return{title:"Basic table",dump:function(e){return{type:e.type,measure:e.measure,displayTitle:e.displayTitle,dimension:e.dimension,timeDimension:e.timeDimension,displaySubject:e.displaySubject,protectedFields:e.protectedFields,filter:e.filter,order:e.order,dataSetId:e.dataSetId,viewId:null==e?void 0:e.viewId,limit:e.limit,offset:e.offset,conditionalFormattingRules:e.conditionalFormattingRules,protectedByOrganisation:e.protectedByOrganisation,dateTimeFormat:e.dateTimeFormat,prefixes:e.prefixes,exportNames:e.exportNames,numberFormat:e.numberFormat,sizing:e.sizing}},load:function(e){return U({},e,{measure:We(e.measure),order:He(e.order,e.timeDimension),filter:Ve(e.filter),dimension:ot(e.dimension),viewId:tn(e.viewId),protectedFields:ln(e.protectedFields)})},setAttributes:vt(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(t,n){var r={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],dataSetId:t,viewId:tn(null==n?void 0:n.viewId),protectedFields:void 0,limit:50,offset:0,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{}};return vt(e)(r,n||{})},schema:Pe(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},setFields:function(t,n){var r=[].concat(n).map((function(e){return{field:e,function:"none"}}));return vt(e)(t,{measure:r})},setDateTimeFormat:function(e,t){return this.setAttributes(e,{dateTimeFormat:t})},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(e){var t=Ln(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0}),n=[].concat(t).map((function(e){return{field:e.id,function:"none"}}));return this.init(e.id,{measure:n.slice(0,5)})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},{type:"views",title:"View",description:""},{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},{type:"sort",title:"Sort",description:"Select how the columns are ordered in this table"},{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"},{type:"filter",title:"Filters",description:"Only include the information you want to use in this table."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"format",title:"Format",description:"",subSection:[{type:"time",title:"Time",description:""}]},{type:"prefixes",title:"Prefixes",description:""},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"}]},supportedCustomFields:{simplePercentage:!1,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0},supportedFeatures:{parameters:!1}}},$n=function(e,t){return s.scale(e).colors(t)},er=function(e,t){var n;return(null!=t?t:0)<=(null!=(n=null==e?void 0:e.length)?n:0)?e:rr($n(e,t))},tr={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},nr=function(e){var t=1e4*Math.sin(e++);return t-Math.floor(t)},rr=function(e,t){void 0===t&&(t=5);for(var n,r,i=e.length;i;)r=Math.floor(nr(t)*i--),n=e[i],e[i]=e[r],e[r]=n,++t;return e},ir=[].concat(["barChart","horizontalBarChart","areaChart","lineChart","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","custom"]).filter((function(e){return"custom"!=e})),or=function(e){return{attributes:e,localFilters:[],results:[],colSpan:1,reports:[],updatesFromParameters:{}}},ar=function(e){if("dateFilter"==e)return"Date filter";if("dateAndTimeFilter"==e)return"Date Time filter";if("singleSelectFilter"==e)return"Single select filter";if("multiSelectFilter"==e)return"Multi select filter";throw"Unrecognised additional filter type "+e},lr=function(e){return U({},e,{managedByConfiguration:!1})},sr=function(e){return"fields"in e?function(e){if("globalSelectFilter"==e.type)return{type:"singleSelectFilter",title:e.title,value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:e.fields.map((function(e){return{fieldId:e.field,dataSetId:e.dataSetId}}))};if("globalDateTimeFilter"==e.type)return{type:"dateFilter",value:null,requiresValue:!1,managedByConfiguration:!1,title:e.title,appliesToFields:e.fields.map((function(e){return{fieldId:e.field,dataSetId:e.dataSetId}}))};throw"Unrecognised global filter. "+JSON.stringify(e)}(e):U({},e,{type:fr(e.type)})},ur=function(e,t,n){return t.appliesToFields.flatMap((function(r){var i,o;if(r.dataSetId!=e.id)return[];if(null==t.value)return[];if("string[]"==Rn(e,r.fieldId).dataType)return[{field:r.fieldId,op:"array_contains",value:t.value}];if(("dateFilter"==t.type||"dateAndTimeFilter"==t.type)&&"fixedRange"==(null==(i=t.value)?void 0:i.type))return[{field:r.fieldId,op:">",value:t.value.after},{field:r.fieldId,op:"<",value:t.value.before}];if(("dateFilter"==t.type||"dateAndTimeFilter"==t.type)&&"relative"==(null==(o=t.value)?void 0:o.type)){var a=n[t.value.value].range,l=a.before,s=a.after,u=[];return l&&(u=[].concat(u,[{field:r.fieldId,op:"<",value:l}])),s&&(u=[].concat(u,[{field:r.fieldId,op:">",value:s}])),u}if("singleSelectFilter"==t.type)return[{field:r.fieldId,op:"=",value:t.value}];if("multiSelectFilter"==t.type&&t.value.length>0)return[{field:r.fieldId,op:"is_one_of",value:t.value}];if("dateFilter"==t.type&&!t.value||"dateAndTimeFilter"==t.type&&!t.value||"multiSelectFilter"==t.type&&0===t.value.length)return[];throw"Cannot convert filter type "+t.type+" to query attributes filter. "+JSON.stringify(t)}))},dr=function(e,t,n){var r=[];return(e.globalFilters||[]).forEach((function(e){r=[].concat(r,ur(t,e,n))})),Object.values(e.localFilters||{}).flat().forEach((function(e){r=[].concat(r,ur(t,e,n))})),r},cr=function(e,t){if(e.title)return e.title;var n="Untitled";return t.forEach((function(t){try{var r=e.appliesToFields[0],i=Rn(t,r.fieldId);t.id==r.dataSetId&&r.fieldId==i.id&&(n=i.publicName)}catch(e){}})),n},pr=function(e,t){return[].concat(e).find((function(e){var n,r,o=e.type==t.type,a=(null==(n=e.appliesToFields)?void 0:n.length)==(null==(r=t.appliesToFields)?void 0:r.length),l=i.every(t.appliesToFields,(function(t){return i.some(e.appliesToFields,(function(e){return e.fieldId==t.fieldId&&e.dataSetId==t.dataSetId}))}));return o&&a&&l}))},fr=function(e){return"dateTimeFilter"===e?"dateFilter":e};function mr(e,t,n,r){if(r){var i=e.reduce((function(e,r){if(null!==r.value){if(Array.isArray(r.value)&&0===r.value.length)return e;r.appliesToFields.forEach((function(i){var o=i.dataSetId,a=Mn(t,o);e[o]||(e[o]=[]),null!==a&&(e[o]=[].concat(e[o],ur(a,r,n)))}))}return e}),{});return 0===Object.keys(i).length?void 0:i}}var hr=function(e){return"optionsPulledFrom"in e&&e.optionsPulledFrom&&0!==e.optionsPulledFrom.length?U({},e,{appliesToFields:[].concat(e.optionsPulledFrom)}):e},vr=function(e){if("isEmpty"in e)return e;var t=(0,On(e.attributes.type).load)(e.attributes),n=[];return i.isArray(e.localFilters)&&(n=[].concat(e.localFilters?e.localFilters:[]).map((function(e){return sr(e)}))),"addOns"in e.attributes&&i.isEmpty(n)&&e.attributes.addOns.forEach((function(e){n=[].concat(n,[{type:"dateFilter"==e.type?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:e.field,dataSetId:t.dataSetId}]}])})),delete e.addOns,delete t.addOns,U({},e,{localFilters:n,attributes:t,results:[]})},gr=function(e){if("isEmpty"in e)return e;var t=[].concat(e.localFilters&&i.isArray(e.localFilters)?e.localFilters:[]).map(lr);return U({},e,{results:void 0,queries:void 0,attributes:U({},e.attributes,{offset:void 0}),localFilters:t})},br=function(e,t,n,r){var i=function(e,t,n,r){var i=e[t];return"left"==r?[].concat(i.components).slice(0,n).reverse():[].concat(i.components).slice(n+1,i.components.length)}(e,t,n,r),o=i.length-1,a=i.findIndex((function(e){return e.colSpan>2}));return-1==a?-1:"left"==r?o-a:a+1+n},xr=function(e,t,n){void 0===n&&(n=350);var r=[].concat(e);return r.splice(t,0,{components:[{isEmpty:!0,colSpan:12}],height:n}),r},yr=function(e){return{colSpan:e,isEmpty:!0}};function wr(e){return 1===e?12:e<5?12/e:2}var Cr=function(e,t){for(var n,r=i.cloneDeep(e),o=[].concat(r[t].components),a=yr(wr(o.length+1)),l=(o=[].concat(o,[a])).length-1,s=0;s<((n=o.length)>2&&n<5?3:2);s++){var u=br(r,t,l,"left");o.length<5?o[s].colSpan=wr(o.length):o[u].colSpan=o[u].colSpan-1,r[t]={components:[].concat(o),height:r[t].height}}return r},jr=function(e,t,n,r){var i=[].concat(e),o=[].concat(i[n].components);return o[r]=U({},t,{colSpan:o[r].colSpan}),i[n]={components:o,height:i[n].height},i};function Fr(e){for(var t,n=te(e);!(t=n()).done;)for(var r,i=te(t.value.components);!(r=i()).done;){var o=r.value;if(!("isEmpty"in o)||!0!==o.isEmpty)return!1}return!0}var Sr=function(e){var t=[].concat(e),n=i.sumBy(t,(function(e){return e.colSpan}));return 12==n||(t[t.length-1].colSpan=t[t.length-1].colSpan+12-n),t},kr=function(e){return{display:e.display,componentLibrary:e.componentLibrary,isPlayground:!1,globalFilters:[],customFields:{}}},Tr={FIRST_ROW:0,SECOND_ROW:1,THIRD_ROW:2,FOURTH_ROW:3,FIFTH_ROW:4,FIRST_CELL:0,SECOND_CELL:1,THIRD_CELL:2,FOURTH_CELL:3,FIFTH_CELL:4},Ar={emptyDashboard:function(){var e=new Date;return{id:void 0,parentDashboardId:void 0,createdAt:e,updatedAt:e,metadata:{},display:[],componentLibrary:[]}},insertRow:function(e,t,n){return U({},e,{display:xr(e.display,t,null==n?void 0:n.height)})},setComponentOnDisplay:function(e,t,n,r){return U({},e,{display:jr(e.display,or(t),n,r)})},listComponentTypesUsed:function(e){return t=[],e.display.forEach((function(e){e.components.forEach((function(e){"isEmpty"in e||(t=[].concat(t,[e.attributes.type]))}))})),i.uniq(t);var t},appendEmptyCell:function(e,t){return U({},e,{display:Cr(e.display,t)})},listDataSetIdsUsed:function(e){var t=[];return e.componentLibrary.forEach((function(e){t=[].concat(t,[e.attributes.dataSetId])})),e.display.forEach((function(e){e.components.forEach((function(e){"isEmpty"in e||(t=[].concat(t,[e.attributes.dataSetId]))}))})),i.uniq(t)}},Dr={setComponent:jr,newEmptyCell:yr,initRow:function(e,t){return{components:e,height:null!=t?t:350}},init:function(){return[]}},Ir=function e(t){return t.startsWith("/")?e(t.slice(1)):t.endsWith("/")?e(t.slice(0,-1)):t},Pr=function(e,t){var n=Ir(e),r=Ir(t),i=function(e){return e.startsWith("https://")||e.startsWith("http://")||e.startsWith(".")}(e)?"":"/";return""==n&&""==r?"/":""==r?""+i+n:""!=n&&""!=r?""+i+n+"/"+r:""+i+r},_r=function(e){return function(){var t=Y(H().mark((function t(n,r,i,o){var a,l,s,u;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a={},r&&(a.auth="Api-Key "+r),i&&(a.auth="Bearer "+i),l="",o&&(l="filter="+o.join(",")),t.next=7,e({path:"/api/v2/auth/project/"+n+"/access_token?"+l,method:"get",headers:a});case 7:if(u=(s=t.sent).body,200!=s.status){t.next=12;break}return t.abrupt("return",u.token.token);case 12:return t.abrupt("return",void 0);case 13:case"end":return t.stop()}}),t)})));return function(e,n,r,i){return t.apply(this,arguments)}}()},Er=["debug","info","warning","error"],Or="error",Lr=function(e,t){return Or=e,t&&t(Or),{logDebug:Nr,logError:qr,logInfo:zr,logWarning:Br}},Mr=function(e){return Er.findIndex((function(e){return Or==e}))<=Er.findIndex((function(t){return e==t}))},Rr=function(e){return e instanceof Error?e:i.isObject(e)||i.isArray(e)?JSON.stringify(e):e},Nr=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Mr("debug")&&(e=console).info.apply(e,["[VIZZLY DEBUG]"].concat(n.map(Rr)))},zr=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Mr("info")&&(e=console).info.apply(e,["[VIZZLY INFO]"].concat(n.map(Rr)))},Br=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Mr("warning")&&(e=console).warn.apply(e,["[VIZZLY WARNING]"].concat(n.map(Rr)))},qr=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Mr("error")&&(e=console).error.apply(e,["[VIZZLY ERROR]"].concat(n.map(Rr)))},Vr=function(){var e=Y(H().mark((function e(t,n){var r;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.dashboardAccessToken){e.next=3;break}return Nr("Using dashboard access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.dashboardAccessToken});case 3:if(!t.projectAccessToken){e.next=6;break}return Nr("Using project access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.projectAccessToken});case 6:if(!n.preFetchProjectAccessTokens){e.next=19;break}return Nr("Fetching project access token from the Vizzly API",n.preFetchProjectAccessTokens.projectId,"Filtering by",n.preFetchProjectAccessTokens.resourceFilters),e.next=10,_r(Hr(t))(n.preFetchProjectAccessTokens.projectId,t.apiKey,t.appSessionAuthToken,n.preFetchProjectAccessTokens.resourceFilters);case 10:if(!(r=e.sent)){e.next=16;break}return Nr("Project access token received."),e.abrupt("return",{auth:"Bearer "+r});case 16:Nr("Failed to receive project access token.");case 17:e.next=20;break;case 19:Nr("Not pre-fetching project access token.");case 20:return e.abrupt("return",{});case 21:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Hr=function(e){return function(){var t=Y(H().mark((function t(n){var r,i,o,a,l,s;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Vr(e,n);case 3:return r=t.sent,i=n.headers||{},o=Pr(e.host,n.path),t.next=8,u(o,{method:n.method,headers:U({"Content-Type":"application/json",Accept:"application/json"},r,i),redirect:"follow",referrerPolicy:"no-referrer",body:n.body?JSON.stringify(n.body):null,signal:n.abortSignal,mode:n.mode||void 0});case 8:return a=t.sent,t.next=11,a.json();case 11:return l=t.sent,Nr("HTTP Client Response",{host:e.host,status:a.status,responseId:a.headers.get("X-Request-Id")}),t.abrupt("return",{body:l,status:a.status});case 16:if(t.prev=16,t.t0=t.catch(0),null==(s=n.abortSignal)||!s.aborted){t.next=21;break}return console.log("Aborted a request."),t.abrupt("return",{status:500,body:{reason:"Aborted"}});case 21:throw t.t0;case 22:case"end":return t.stop()}}),t,null,[[0,16]])})));return function(e){return t.apply(this,arguments)}}()},Wr=function(e){return{id:e.id,parentDashboardId:e.parent_dashboard_id,isPlayground:void 0===e.definition.isPlayground||e.definition.isPlayground,globalFilters:[].concat(e.definition.globalFilters||[]).map(sr),componentLibrary:[].concat(e.definition.componentLibrary).map((function(e){return vr(U({},e,{colSpan:e.colSpan||1}))})),theme:U({},tr,e.theme),display:(t=e.definition.display,t.map((function(e){return r=i.sumBy((n="components"in(t=e)?t:{components:t,height:350}).components,(function(e){return null==e?1:0})),o=i.sumBy(n.components,(function(e){return null==e?0:e.colSpan})),a=Math.floor((12-o)/r),l=[].concat(n.components).map((function(e){return null===e?{isEmpty:!0,colSpan:a}:"isEmpty"in e?e:vr(U({},e,{colSpan:e.colSpan}))})),{components:Sr(l),height:n.height||350};var t,n,r,o,a,l}))),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}};var t},Yr=function(e,t){return e.dataSets.findIndex((function(e){return e.id==t}))},Ur=function(e,t){return Mn(e.dataSets,t)},Gr=function(e){var t=U({},e),n={};e.dataSets.forEach((function(e){n[e.id]=Bn(e)}));var r,i=null===t.parentDashboardId?t.componentLibrary:Zr(t),o=[].concat(e.globalFilters).filter((function(e){return!e.managedByConfiguration})).map(lr);return{isPlayground:e.isPlayground,globalFilters:o,componentLibrary:[].concat(i).map(gr),display:(r=e.display,r.map((function(e){return{components:[].concat(e.components).map(gr),height:e.height}}))),customFields:n}},Kr=function(e,t,n){return U({},e,{dataSets:Un(t,n)})},Xr=function(e,t){return[].concat(t).filter((function(t){return t.parentDashboardId==e}))},Qr=function(e,t){return e.find((function(e){return e.id==t}))||null},Jr=function(e){var t=new Map(e.map((function(e){return[e.id,e]})));return e.map((function(e){var n;if(null===e.parentDashboardId)return e;var r=null==(n=t.get(e.parentDashboardId))?void 0:n.componentLibrary,i=null==r?void 0:r.filter((function(e){return e.attributes.protectedByOrganisation}));return i?U({},e,{componentLibrary:[].concat(Zr(e),i)}):e}))},Zr=function(e){return e.componentLibrary.filter((function(e){return!e.attributes.protectedByOrganisation}))};function $r(e,t,n){var r=t.find((function(e){return e.id===n}));return void 0===r?e:U({},r,{id:e.id,createdAt:e.createdAt,updatedAt:new Date})}var ei,ti=function(e){return Y(H().mark((function t(){var n,r;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/parent-dashboards",method:"get"});case 2:if(r=(n=t.sent).body,200!=n.status){t.next=7;break}return t.abrupt("return",r.dashboards.map((function(e){return U({},Wr(e),{dataSets:[]})})));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})))},ni=function(e){return function(){var t=Y(H().mark((function t(n){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/scheduled-report",method:"post",body:{cronSchedule:n.cronSchedule,dashboardAccessToken:n.dashboardAccessToken,scheduledReportId:n.scheduledReportId}});case 2:return t.abrupt("return",200==t.sent.status);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ri=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToCreateDashboardAccess",n}return G(t,e),t}(Z(Error)),ii=function(e){return function(){var t=Y(H().mark((function t(n,r,i){var o,a;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/auth/dashboards/access",method:"post",body:{dashboardAccessToken:n,dashboardAdminOverrideToken:r},abortSignal:i});case 2:if(a=(o=t.sent).body,200!=o.status){t.next=7;break}return t.abrupt("return",{permissions:a.permissions.map((function(e){return{dashboardId:e.dashboard_id,scope:e.scope,token:e.token,userReference:e.user_reference}}))});case 7:throw new ri("Failed to fetch dashboard access");case 8:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},oi=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToGetDashboard",n}return G(t,e),t}(Z(Error)),ai=function(e){return function(){var t=Y(H().mark((function t(n,r,i){var o,a;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/multi-get-dashboard",method:"post",body:{dashboardAccessTokens:n},abortSignal:i});case 2:if(a=(o=t.sent).body,200!=o.status){t.next=8;break}return a.not_found.length>0&&console.warn("[Vizzly] Failed to retrieve dashboards",a.not_found),t.abrupt("return",a.found.map((function(e){var t=Wr(e);return Kr(t,r,e.definition.customFields||{})})));case 8:throw new oi("Failed to get dashboard from POST /api/v2/multi-get-dashboard.");case 9:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},li=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToCreateDashboard",n}return G(t,e),t}(Z(Error)),si=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="DashboardQuotaReached",n}return G(t,e),t}(Z(Error)),ui=function(e){return function(){var t=Y(H().mark((function t(n,r){var i,o,a,l,s,u;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/dashboard",method:"post",body:{dashboardAccessToken:n.dashboardAccessToken,definition:n.definition,meta:n.meta||{},parentDashboardId:n.parentDashboardId,permissions:n.permissions}});case 2:if(o=(i=t.sent).body,200!=(a=i.status)){t.next=10;break}return l=Wr(o.dashboard),s=Kr(l,r,o.dashboard.definition.customFields||{}),u=o.permissions.map((function(e){return{dashboardId:e.dashboard_id,scope:e.scope,token:e.token,userReference:e.user_reference}})),t.abrupt("return",{dashboard:s,permissions:u});case 10:if(422!=a){t.next=12;break}throw new si("Dashboard quota reached; "+JSON.stringify(o));case 12:throw new li("Failed to update the dashboard from POST /api/v2/dashboard");case 13:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},di=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToUpdateDashboard",n}return G(t,e),t}(Z(Error)),ci=function(e){return function(){var t=Y(H().mark((function t(n,r){var i,o,a,l;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/dashboard",method:"put",body:U({},n)});case 2:if(o=(i=t.sent).body,200!=i.status){t.next=9;break}return a=Wr(o.dashboard),l=Kr(a,r,o.dashboard.definition.customFields||{}),t.abrupt("return",l);case 9:throw new di("Failed to update dashboard from PUT /api/v2/dashboard.");case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},pi=function(e){function t(){return e.call(this,"AI usage limit has been reached.")||this}return G(t,e),t}(Z(Error)),fi=function(e,t,n){var r,o,a={},l=(null==(r=e.measure)?void 0:r.filter((function(e){try{return Rn(t,e.field).canBeMeasure}catch(e){return!1}})))||[];l=l.map((function(e){var r=Rn(t,e.field),i=$e(r,n.supportedAggregates);return et(r,n.supportedAggregates).includes(e.function)?e:{field:e.field,function:i}}));var s=(null==(o=e.dimension)?void 0:o.filter((function(e){try{return Rn(t,e).canBeDimension}catch(e){return!1}})).map((function(e){return{field:e,function:"none"}})))||[];return i.isEmpty(l)||(a.measure=l),i.isEmpty(s)||(a.dimension=s),a},mi=function(e){return function(){var t=Y(H().mark((function t(n,r,i,o){var a,l,s;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/ai",method:"post",body:{question:n,supported_aggregates:Object.keys(o.supportedAggregates),data_set_fields:[].concat(i.fields).map((function(e){return{id:e.id,name:e.publicName}})),dashboard_access_token:r}});case 2:if(l=(a=t.sent).body,200!=(s=a.status)){t.next=7;break}return t.abrupt("return",fi(l,i,o));case 7:if(422!=s&&429!=s){t.next=9;break}throw new pi;case 9:throw"Failed to fetch query attributes from AI.";case 10:case"end":return t.stop()}}),t)})));return function(e,n,r,i){return t.apply(this,arguments)}}()},hi=function(e){function t(t){var n;return(n=e.call(this,"Failed to save Vizzly config. Received status code "+t+".")||this).name="FailedToSaveVizzlyConfigVersion",n}return G(t,e),t}(Z(Error));!function(e){e.ConfigStore="cnf_",e.Project="prj_",e.KeyPair="kyp_",e.Dashboard="dsh_",e.ProjectApiKey="vizzly_project_api_key_"}(ei||(ei={}));var vi=function(e){return function(){var t=Y(H().mark((function t(n,r){var i;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/config",method:"post",body:{projectId:n,encryptedConfig:r},preFetchProjectAccessTokens:n?{projectId:n,resourceFilters:[ei.Project,ei.ConfigStore]}:void 0});case 2:if(200==(i=t.sent.status)){t.next=6;break}throw new hi(i);case 6:return t.abrupt("return",200==i);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},gi=function(e){function t(t){var n;return(n=e.call(this,"Failed to setup project by saving an encrypted connection and config on the Vizzly API. Received status code "+t+".")||this).statusCode=void 0,n.name="VizzlyApiCallErrorFailedToSetupProject",n.statusCode=t,n}return G(t,e),t}(Z(Error)),bi=function(e){return function(){var t=Y(H().mark((function t(n,r,i){var o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/connection",method:"post",body:{projectId:n,encryptedConfig:i,encryptedConnection:r},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ei.Project]}});case 2:if(200==(o=t.sent.status)){t.next=7;break}throw new gi(o);case 7:return t.abrupt("return",200==o);case 8:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},xi=function(e){return function(){var t=Y(H().mark((function t(n){var r,i,o,a;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="/api/v3/project/"+n+"/config",t.next=3,e({path:r,method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ei.ConfigStore]}});case 3:if(a=(i=t.sent).body,200!=(o=i.status)){t.next=8;break}return t.abrupt("return",{encryptedConfig:a.encrypted_config});case 8:return Nr("HTTP request to fetch Config returned non-200.",r,o,a),t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},yi=function(e){return function(){var t=Y(H().mark((function t(n){var r,i,o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/project/"+n+"/connection",method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ei.Project]}});case 2:if(o=(r=t.sent).body,200!=(i=r.status)){t.next=7;break}return t.abrupt("return",{status:i,encryptedCredentials:o.encrypted_credentials});case 7:return t.abrupt("return",{status:i});case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},wi=function(e){return function(){var t=Y(H().mark((function t(n){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/api-key",method:"post",body:{},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ei.Project]}});case 2:return t.abrupt("return",t.sent.body.api_key);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Ci=function(e){return function(){var t=Y(H().mark((function t(n,r,i){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/api-key/"+r,method:"put",body:U({},i),preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ei.Project,ei.ProjectApiKey]}});case 2:return t.abrupt("return",t.sent.body.api_key);case 5:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},ji=function(e){return function(){var t=Y(H().mark((function t(n){var r,i;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n,method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ei.Project]}});case 2:if(i=(r=t.sent).body,200!=r.status){t.next=7;break}return t.abrupt("return",i.project);case 7:return t.abrupt("return",null);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Fi=function(e){return function(){var t=Y(H().mark((function t(n,r,i){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/query-engine-user",method:"post",body:{email:r,password:i},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ei.Project]}});case 2:return t.abrupt("return",200==t.sent.status);case 6:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Si=function(e){return function(){var t=Y(H().mark((function t(n,r){var i,o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/query-engine-user?email="+encodeURIComponent(r),method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ei.Project]}});case 2:if(o=(i=t.sent).body,200!=i.status){t.next=7;break}return t.abrupt("return",o.query_engine_user);case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},ki=function(e){return function(){var t=Y(H().mark((function t(n){var r,i;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/organisation-team-members",method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:["prj_"]}});case 2:if(i=(r=t.sent).body,200!=r.status){t.next=7;break}return t.abrupt("return",i.team_members);case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Ti=function(e){return function(){var t=Y(H().mark((function t(n){var r,i,o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={},n&&(r={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-query-engine",method:"post",body:{},headers:r});case 4:return o=(i=t.sent).body,t.abrupt("return",200==i.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Ai=function(e){return function(){var t=Y(H().mark((function t(n){var r,i,o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={},n&&(r={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-dynamic-query-engine",method:"post",body:{},headers:r});case 4:return o=(i=t.sent).body,t.abrupt("return",200==i.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Di=function(e){return function(){var t=Y(H().mark((function t(n){var r,i,o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={},n&&(r={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-in-browser",method:"post",body:{},headers:r});case 4:return o=(i=t.sent).body,t.abrupt("return",200==i.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Ii=function(e){return function(){var t=Y(H().mark((function t(n,r,i){var o,a,l;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o={},i&&(o={auth:"Bearer "+i}),t.next=4,e({path:"/api/v2/project/managed-query-engine/"+n+"/key-pairs/"+r,method:"get",headers:o});case 4:if(l=(a=t.sent).body,200!=a.status){t.next=9;break}return t.abrupt("return",{privateKey:l.keys.private_key,publicKey:l.keys.public_key});case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Pi=function(e){var t=Hr(e);return{config:e,getParentDashboards:ti(t),saveScheduledReport:ni(t),createDashboardAccess:ii(t),multiGetDashboards:ai(t),createDashboard:ui(t),updateDashboard:ci(t),askAi:mi(t),createVizzlyConfigVersion:vi(t),getVizzlyConfig:xi(t),saveConnection:bi(t),getConnection:yi(t),createProjectApiKey:wi(t),updateProjectApiKey:Ci(t),getProjectAccessToken:_r(t),getProject:ji(t),createQueryEngineUser:Fi(t),getQueryEngineUser:Si(t),getProjectTeamMembers:ki(t),createSelfHostedQueryEngineProject:Ti(t),createSelfHostedDynamicQueryEngineProject:Ai(t),createSelfHostedInBrowserQueryEngineProject:Di(t),getManagedQueryEngineKeyPair:Ii(t)}},_i=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadIdentity",n}return G(t,e),t}(Z(Error)),Ei=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="InvalidIdentityReturn",n}return G(t,e),t}(Z(Error)),Oi=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadQueryEngineConfig",n}return G(t,e),t}(Z(Error)),Li=function(e){return U({},(r=null==(t=e.split("."))?void 0:t[1],JSON.parse((n=r,"object"==typeof window&&window&&window.atob?window.atob(n):Buffer.from(n,"base64").toString()).toString())),{signature:e});var t,n,r},Mi=function(e,t,n,r){var i=Li(e);"scope"in i||(i.scope="read_write");var o={dashboardAccess:i,dataAccess:t?Li(t):void 0,queryEngineAccessConfig:n?Li(n):void 0,dashboardAdminOverride:r?Li(r):void 0};return Ri(o),o},Ri=function(e){var t=new Date,n=new Date(e.dashboardAccess.expires),r=!!e.dataAccess&&new Date(e.dataAccess.expires);!1!==r&&r<t&&console.warn("Vizzly data access token expired at;",r),n<t&&console.warn("Vizzly dashboard access token expired at;",n)},Ni=function(e){function t(){return e.apply(this,arguments)||this}return G(t,e),t}(Z(Error)),zi=function(e,t){return[].concat(e.supportedFeatures).includes(t)},Bi=function(e){function t(t){var n;return(n=e.call(this,"The queryEngineEndpoint value '"+t+"' is not valid.")||this).invalidEndpoint=void 0,n.name="InvalidQueryEngineEndpoint",n.invalidEndpoint=t,n}return G(t,e),t}(Z(Error)),qi=function(e){function t(){var t;return(t=e.call(this,"The queryEngineEndpoint value is not of the correct type. It must be a string or a function.")||this).name="InvalidQueryEngineEndpointType",t}return G(t,e),t}(Z(Error)),Vi=function(e){return"string"==typeof e?{}:e.customHeaders?e.customHeaders():{}},Hi=function(e){return function(){var t=Y(H().mark((function t(n){var r,i;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={host:Ui(e)},i=U({},n,{headers:U({},n.headers,Vi(e))}),t.abrupt("return",Hr(r)(i));case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Wi=function(){var e=Y(H().mark((function e(t){var n,r;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Hi(t),e.next=3,n({method:"post",mode:"cors",path:"/api/v1/support",body:{}});case 3:if(200!=(r=e.sent).status){e.next=6;break}return e.abrupt("return","supportedFeatures"in(i=r.body)?i:U({},i,{supportedFeatures:["subquery"]}));case 6:return e.abrupt("return",null);case 7:case"end":return e.stop()}var i}),e)})));return function(t){return e.apply(this,arguments)}}(),Yi=function(){var e=Y(H().mark((function e(t){var n,r;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!("string"==typeof t||"object"==typeof t&&"endpoint"in t)){e.next=12;break}if(o=void 0,(o="string"==typeof(i=t)?i:i.endpoint).startsWith("http://")||o.startsWith("https://")||o.startsWith("/")){e.next=4;break}throw new Bi(t);case 4:return e.next=6,Wi(t);case 6:if(n=e.sent){e.next=9;break}throw new Oi("Failed to load query engine config.");case 9:return e.abrupt("return",n);case 12:if("function"!=typeof t){e.next=21;break}return e.next=15,t();case 15:if(r=e.sent){e.next=18;break}throw new Oi("Failed to load query engine config.");case 18:return e.abrupt("return",U({},r));case 21:throw new qi;case 22:e.next=31;break;case 24:if(e.prev=24,e.t0=e.catch(0),!(e.t0 instanceof Bi)){e.next=28;break}throw e.t0;case 28:if(!(e.t0 instanceof qi)){e.next=30;break}throw e.t0;case 30:throw new Oi("Failed to load query engine config.");case 31:case"end":return e.stop()}var i,o}),e,null,[[0,24]])})));return function(t){return e.apply(this,arguments)}}(),Ui=function(e){return"string"==typeof e?e:e.endpoint},Gi=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToResolveDataSets",n}return G(t,e),t}(Z(Error)),Ki=function(e){function t(){var t;return(t=e.call(this,"Identity prop type is invalid.")||this).name="InvalidIdentityPropType",t}return G(t,e),t}(Z(Error)),Xi=function(e){function t(){var t;return(t=e.call(this,"dataSets property is not valid")||this).name="InvalidDataSetsPropType",t}return G(t,e),t}(Z(Error)),Qi=function(e,n,r){var i,o,a=t.useState(),l=a[0],s=a[1],u=t.useState({dataSets:void 0,queryEngineConfig:void 0,identityConfig:void 0}),d=u[0],c=u[1],p=function(){var t=Y(H().mark((function t(){var n,r,i;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e();case 2:if(n=Ji(n=t.sent)){t.next=6;break}throw new _i("Failed to fetch identity config.");case 6:return a=(o=window.location.href).split("#vizzly_")[1]||null,r=a||new URLSearchParams(new URL(o).search).get("_vizzlyDashboardAdmin")||null,i=Mi(n.dashboardAccessToken,n.dataAccessToken,n.queryEngineAccessToken,r),t.abrupt("return",i);case 9:case"end":return t.stop()}var o,a}),t)})));return function(){return t.apply(this,arguments)}}();return i=Y(H().mark((function e(){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Nr("Fetching identity config."),e.next=4,p();case 4:c(U({},d,{identityConfig:e.sent})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),Br("Failed to refresh identity tokens.");case 11:case"end":return e.stop()}}),e,null,[[0,8]])}))),o=t.useRef(),t.useEffect((function(){o.current=i})),t.useEffect((function(){var e=setInterval((function(){o.current&&o.current()}),12e5);return function(){return clearInterval(e)}}),[12e5]),t.useEffect((function(){!function(){var t=Y(H().mark((function t(){var i,o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"function"==typeof e){t.next=3;break}throw new Ki;case 3:return t.next=5,p();case 5:return i=t.sent,t.next=8,Yi(r);case 8:return o=t.sent,t.next=11,n(i,o);case 11:c({dataSets:t.sent,queryEngineConfig:o,identityConfig:i}),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),t.t0 instanceof _i||t.t0 instanceof Oi||t.t0 instanceof Ni||t.t0 instanceof Ei||t.t0 instanceof Gi||t.t0 instanceof Bi||t.t0 instanceof qi||t.t0 instanceof Ki||t.t0 instanceof Xi?s(t.t0):(qr("Unknown error",t.t0),s(new _i("Failed to load identity")));case 18:case"end":return t.stop()}}),t,null,[[0,15]])})));return function(){return t.apply(this,arguments)}}()()}),[]),U({},d,{error:l})},Ji=function(e){if(!e)throw new Ei("Failed to load identity.");var t=r.object({dashboardAccessToken:r.string().required(),dataAccessToken:r.string(),queryEngineAccessToken:r.string(),projectAccessToken:r.string().optional()}).validate(e).error;if(t)throw new Ei(t.message);return e},Zi=function(e){return function(){var t=Y(H().mark((function t(n){var r,i,o,a;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=Qr(e.dashboards,n.parentDashboardId||e.defaultParentDashboardId)){t.next=3;break}throw"Cannot create a child dashboard from a parent dashboard which does not exist.";case 3:return i=kr(r),o=n.dashboard?kr(n.dashboard):i,t.next=7,e.createDashboard({definition:o,meta:n.metadata,parentDashboardId:r.id,permissions:[{scope:"read_write"}]});case 7:if(!(a=t.sent)){t.next=10;break}return t.abrupt("return",a.id);case 10:return t.abrupt("return",null);case 11:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},$i=function(e){return function(){var t=Y(H().mark((function t(n){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.updateDashboard(n,{deleted:!0});case 2:return t.abrupt("return",!!t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},eo=function(e){return function(){var t=Y(H().mark((function t(n,r){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.updateDashboard(n,{meta:r});case 2:return t.abrupt("return",!!t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},to={supportedFeatures:["simpleMaths","aggregateMaths","subquery"],supportedTimeTruncFunctions:Le(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:Ke(["mean","sum","min","max","count","countDistinct"]),supportedOperators:Be([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:{}},no=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ReadOnlyPermissionNotFound",n}return G(t,e),t}(Z(Error)),ro=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ReadPermissionNotFound",n}return G(t,e),t}(Z(Error)),io=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="WritePermissionNotFound",n}return G(t,e),t}(Z(Error)),oo=function(e){var t=[].concat(e).map((function(e){return e.dashboardId}));return i.uniq(t)},ao=function(e,t){var n=t.find((function(t){return t.dashboardId==e}));if(!n)throw new ro("Cannot find read permission for dashboard "+e);return n},lo=function(e,t){var n=t.find((function(t){return t.dashboardId==e&&"read_write"==t.scope}));if(!n)throw new io("Cannot find write permission for dashboard "+e);return n},so=function(e,t){try{return!!lo(e,t)}catch(e){if(e instanceof io)return!1;throw e}},uo=function(e,n,r,i){var o=t.useState(),a=o[0],l=o[1],s=t.useState(),u=s[0],d=s[1],c=function(){var t=Y(H().mark((function t(i){var o,a,s,u,c,p;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e||!n){t.next=29;break}return t.prev=1,t.next=4,r.createDashboardAccess(e.dashboardAccess.signature,null==(o=e.dashboardAdminOverride)?void 0:o.signature,i.signal);case 4:return s=oo(a=t.sent.permissions),u=[].concat(s).map((function(e){return ao(e,a).token})),t.next=10,r.multiGetDashboards(u,n,i.signal);case 10:c=t.sent,i.signal.aborted||(p=Jr(c),d({dashboards:p,permissions:a})),t.next=29;break;case 14:if(t.prev=14,t.t0=t.catch(1),!(t.t0 instanceof oi)){t.next=20;break}l(t.t0),t.next=29;break;case 20:if(!(t.t0 instanceof ri)){t.next=24;break}l(t.t0),t.next=29;break;case 24:if(!(t.t0 instanceof Ni)){t.next=28;break}l(t.t0),t.next=29;break;case 28:throw t.t0;case 29:case"end":return t.stop()}}),t,null,[[1,14]])})));return function(e){return t.apply(this,arguments)}}();if(t.useEffect((function(){var e=new AbortController;return void 0===u&&c(e),function(){return e.abort()}}),[e]),!u||!e)return{isLoading:!0,error:a};var p=function(){var e=Y(H().mark((function e(t){var n;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=lo(t.dashboardId,u.permissions),e.next=3,r.saveScheduledReport(U({},t,{dashboardAccessToken:n.token}));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),f=function(){var t=Y(H().mark((function t(i){var o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=6;break}return t.next=3,r.createDashboard(U({},i,{dashboardAccessToken:e.dashboardAccess.signature}),n);case 3:return d({dashboards:[].concat(u.dashboards,[(o=t.sent).dashboard]),permissions:[].concat(u.permissions,o.permissions)}),t.abrupt("return",o.dashboard);case 6:throw"Unable to create a dashboard when the data sets have not been loaded.";case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),m=function(){var e=Y(H().mark((function e(t,i){var o,a,l;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=8;break}return o=lo(t,u.permissions),e.next=4,r.updateDashboard(U({},i,{dashboardSessionToken:o.token}),n);case 4:return a=e.sent,l=[].concat(u.dashboards).flatMap((function(e){return e.id==a.id?i.deleted?[]:[a]:[e]})),d({dashboards:l,permissions:[].concat(u.permissions)}),e.abrupt("return",a);case 8:throw"Unable to update a dashboard when the data sets have not been loaded.";case 9:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),h=[].concat(u.dashboards).filter((function(e){return function(e,t){try{return!!function(e,t){var n=t.find((function(t){return t.dashboardId==e&&"read"==t.scope}));if(!n)throw new no("Cannot find read-only permission for dashboard "+e);return n}(e,t)}catch(e){if(e instanceof no)return!1;throw e}}(e.id,u.permissions)})),v=[].concat(u.dashboards).filter((function(e){return so(e.id,u.permissions)})),g=function(e,t,n){if(e){var r=Qr(n,e);if(null!=r&&r.parentDashboardId)throw"[Vizzly] `parentDashboardId` value must specify an ID for a parent dashboard.";return e}var i=function(e){return[].concat(e).filter((function(e){return null==e.parentDashboardId}))}(n);return t||function(e){if(0==e.length)throw"Cannot get first created dashboard from empty list of dashboards.";return[].concat(e).sort((function(e,t){var n=new Date(e.createdAt),r=new Date(t.createdAt);return n.getTime()-r.getTime()}))[0]}(i).id}(i,e.dashboardAccess.dashboardId,u.dashboards);return{childDashboardCount:[].concat(u.dashboards||[]).filter((function(e){return!!e.parentDashboardId})).length,defaultParentDashboardId:g,createDashboard:f,updateDashboard:m,saveScheduledReport:p,permissions:u.permissions,writeAccessDashboards:v,readOnlyAccessDashboards:h,dashboards:u.dashboards,error:a,accessType:e.dashboardAdminOverride?"admin":e.dashboardAccess.accessType}},co=function(e,t,n,r){var o=Qi(e,Y(H().mark((function e(){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",[]);case 1:case"end":return e.stop()}}),e)}))),t),a=o.identityConfig,l=o.dataSets,s=o.queryEngineConfig,u=Pi(r||{host:"https://api.vizzly.co"}),d=uo(a,l,u,n);if("isLoading"in d||!s)return{VizzlySDK:null,loading:!0,isAdmin:!1,dashboards:[],parentDashboards:[],allChildDashboards:[],defaultParentDashboardId:null,getChildDashboards:function(){throw"Still loading. Please check the `loading` property returned by this hook."},createDashboard:function(){throw"Still loading. Please check the `loading` property returned by this hook."},deleteDashboard:function(){throw"Still loading. Please check the `loading` property returned by this hook."},updateDashboardMeta:function(){throw"Still loading. Please check the `loading` property returned by this hook."}};var c,p=[].concat(d.dashboards).map((function(e){return{id:e.id,parentDashboardId:e.parentDashboardId,display:e.display,componentLibrary:e.componentLibrary,createdAt:e.createdAt,updatedAt:e.updatedAt,metadata:e.metadata}})),f=function(e){var t=i.cloneDeep(p).filter((function(t){return t.parentDashboardId==e}));return i.sortBy(t,(function(e){return e.updatedAt})).reverse()},m=i.cloneDeep(p).filter((function(e){return null==e.parentDashboardId})),h=i.cloneDeep(p).filter((function(e){return null!=e.parentDashboardId}));return{VizzlySDK:(c={queryEngineConfig:s},U({},function(e){return{BasicTable:{init:Zn(e).init,setAttributes:Zn(e).setAttributes,setFields:Zn(e).setFields,validate:Zn(e).validate,setDateTimeFormat:Zn(e).setDateTimeFormat},DataTable:{init:Cn(e).init,setAttributes:Cn(e).setAttributes,validate:Cn(e).validate},HorizontalBarChart:{init:Fn(e).init,setAttributes:Fn(e).setAttributes,validate:Fn(e).validate},BarChart:{init:sn(e).init,setAttributes:sn(e).setAttributes,validate:sn(e).validate},AreaChart:{init:Tn(e).init,setAttributes:Tn(e).setAttributes,validate:Tn(e).validate},SingleStat:{init:Dn(e).init,setAttributes:Dn(e).setAttributes,validate:Dn(e).validate},PieChart:{init:fn(e).init,setAttributes:fn(e).setAttributes,validate:fn(e).validate},LineChart:{init:cn(e).init,setAttributes:cn(e).setAttributes,validate:cn(e).validate},ComboChart:{init:bn(e).init,setAttributes:bn(e).setAttributes,validate:bn(e).validate}}}(c),{displayPositions:Tr,Display:Dr,Dashboard:Ar})),loading:!1,getChildDashboards:f,dashboards:f(d.defaultParentDashboardId),allChildDashboards:h,parentDashboards:m,createDashboard:Zi(d),deleteDashboard:$i(d),updateDashboardMeta:eo(d),isAdmin:"admin"==d.accessType,defaultParentDashboardId:d.defaultParentDashboardId}},po=function(e,t,n){return co(e,Y(H().mark((function e(){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",to);case 1:case"end":return e.stop()}}),e)}))),t,n)},fo=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={error:void 0,tryCount:0},n}G(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}};var n=t.prototype;return n.componentDidCatch=function(e,t){var n,r;console.log("Attempt "+this.state.tryCount,e,t),(null==(n=this.props)?void 0:n.onError)&&(null==(r=this.props)||r.onError(e,t)),this.setState({error:e,tryCount:this.state.tryCount+1})},n.render=function(){var e=this;return this.state.tryCount>1?this.props.renderOnError((function(){return e.setState({tryCount:0})}),this.state.error):this.props.children},t}(n.Component),mo={string:function(e,t,n){return void 0===n&&(n={}),Kn(to,e,t,n)},number:function(e,t,n){return void 0===n&&(n={}),Xn(to,e,t,n)},boolean:function(e,t,n){return void 0===n&&(n={}),Qn(to,e,t,n)},dateTime:function(e,t,n){return void 0===n&&(n={}),Jn(to,e,t,n)}},ho={__proto__:null,number:Xn,string:Kn,boolean:Qn,dateTime:Jn,InBrowser:mo},vo=function(){var e={boxSizing:"border-box",borderWidth:"0",borderStyle:"solid",borderColor:"#e5e7eb","--tw-border-spacing-x":"0","--tw-border-spacing-y":"0","--tw-translate-x":"0","--tw-translate-y":"0","--tw-rotate":"0","--tw-skew-x":"0","--tw-skew-y":"0","--tw-scale-x":"1","--tw-scale-y":"1","--tw-pan-x":"var(--tw-empty,/*!*/ /*!*/)","--tw-pan-y":"var(--tw-empty,/*!*/ /*!*/)","--tw-pinch-zoom":"var(--tw-empty,/*!*/ /*!*/)","--tw-scroll-snap-strictness":"proximity","--tw-ordinal":"var(--tw-empty,/*!*/ /*!*/)","--tw-slashed-zero":"var(--tw-empty,/*!*/ /*!*/)","--tw-numeric-figure":"var(--tw-empty,/*!*/ /*!*/)","--tw-numeric-spacing":"var(--tw-empty,/*!*/ /*!*/)","--tw-numeric-fraction":"var(--tw-empty,/*!*/ /*!*/)","--tw-ring-offset-shadow":"0 0 #0000","--tw-ring-shadow":"0 0 #0000","--tw-shadow":"0 0 #0000","--tw-shadow-colored":"0 0 #0000","--tw-ring-inset":"var(--tw-empty,/*!*/ /*!*/)","--tw-ring-offset-width":"0px","--tw-ring-offset-color":"#fff","--tw-ring-color":"rgb(59 130 246 / 0.5)","--tw-blur":"var(--tw-empty,/*!*/ /*!*/)","--tw-brightness":"var(--tw-empty,/*!*/ /*!*/)","--tw-contrast":"var(--tw-empty,/*!*/ /*!*/)","--tw-grayscale":"var(--tw-empty,/*!*/ /*!*/)","--tw-hue-rotate":"var(--tw-empty,/*!*/ /*!*/)","--tw-invert":"var(--tw-empty,/*!*/ /*!*/)","--tw-saturate":"var(--tw-empty,/*!*/ /*!*/)","--tw-sepia":"var(--tw-empty,/*!*/ /*!*/)","--tw-drop-shadow":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-blur":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-brightness":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-contrast":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-grayscale":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-hue-rotate":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-invert":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-opacity":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-saturate":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-sepia":"var(--tw-empty,/*!*/ /*!*/)"};return delete e.borderColor,delete e.borderWidth,delete e.borderStyle,e}(),go=["vizzly-studio","vizzly-toolbar","vizzly-modals","vizzly-popover"].map((function(e){return"\n ."+e+" hr {"+xo({height:"0",color:"inherit",borderTopWidth:"1px"})+"}\n ."+e+" svg {"+xo({display:"block",verticalAlign:"middle"})+"}\n "})).join(""),bo=function(){return c.jsx(d.Global,{styles:d.css(".v_contentEnter{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-duration:300ms;;}.v_contentEnterFrom{--tw-translate-y:0.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-scale-x:.95;--tw-scale-y:.95;opacity:0;;}.v_contentEnterTo{--tw-translate-y:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-scale-x:1;--tw-scale-y:1;opacity:1;;}.v_contentLeave{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 1, 1);transition-duration:200ms;;}.v_contentLeaveFrom{--tw-translate-y:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-scale-x:1;--tw-scale-y:1;opacity:1;;}.v_contentLeaveTo{--tw-translate-y:0.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-scale-x:.95;--tw-scale-y:.95;opacity:0;;}.v_overlayEnter{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-duration:300ms;;}.v_overlayEnterFrom{opacity:0;;}.v_overlayEnterTo{opacity:1;;}.v_overlayLeave{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 1, 1);transition-duration:300ms;;}.v_overlayLeaveFrom{opacity:1;;}.v_overlayLeaveTo{opacity:0;;}*,::after,::before{",xo(vo),";}",go,";","")})};function xo(e){for(var t="",n=0,r=Object.entries(e);n<r.length;n++){var i=r[n],o=i[1];t+=i[0].replace(/([A-Z])/g,"-$1").toLowerCase()+": "+o+";\n"}return t}if("undefined"!=typeof window&&"undefined"!=typeof localStorage){var yo=localStorage.getItem("__VIZZLY__LOG_LEVEL_STORED");yo&&Lr(yo),window.VizzlyDev={setLogLevel:function(e){if(Er.includes(e))return Lr(e,(function(e){localStorage.setItem("__VIZZLY__LOG_LEVEL_STORED",e)})),"Log level set to "+e+".";console.warn("Invalid log level. Please set one of",Er)}}}var wo={year:"numeric",month:"short",day:"numeric"},Co={year:"numeric",month:"short"},jo={weekday:"long",year:"numeric",month:"long",day:"numeric"},Fo=function(e,t,n){if(!e)return"";var r=e.toLocaleDateString("en-GB",n);return t&&t!=Intl.DateTimeFormat().resolvedOptions().timeZone?r+" ("+t+")":r},So=function(e,t){var n={hour:"2-digit",minute:"2-digit"};return t&&(n.seconds="2-digit"),e.toLocaleTimeString("en-GB",n)},ko=function(e,t){var n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate();return i<10&&(i="0"+i),r<10&&(r="0"+r),"quarter"==t?"Q"+Ao(e)+", "+e.getFullYear().toString():"week"==t?"Week "+Do(e)+", "+e.getFullYear().toString():"DD-MM-YYYY"==t?i+"-"+r+"-"+n:"DD/MM/YYYY"==t?i+"/"+r+"/"+n:"MM-DD-YYYY"==t?r+"-"+i+"-"+n:"MM/DD/YYYY"==t?r+"/"+i+"/"+n:"DD MMMM YYYY, hh:mm"==t?function(e){if(!e)return null;var t=U({},wo,{hour:"2-digit",minute:"2-digit"});return e.toLocaleTimeString("en-GB",t)}(e):"dddd DD MMMM YYYY, hh:mm"==t?function(e){if(!e)return null;var t=U({},jo,{hour:"2-digit",minute:"2-digit"});return e.toLocaleTimeString("en-GB",t)}(e):"hh:mm"==t?So(e):"hh:mm:ss"==t?So(e,!0):"DD MMMM YYYY"==t?function(e,t){return Fo(e,void 0,wo)}(e):"MMMM YYYY"==t?Fo(e,null,Co):"YYYY-MM-DD[T]HH:mm:ss"==t?e.getFullYear()+"-"+r+"-"+i+"T"+So(e):"YYYY"==t?e.getFullYear().toString():null},To=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},Ao=function(e){return Math.floor((e.getMonth()+3)/3)},Do=function(e){var t=new Date(e),n=new Date(e.getFullYear(),0,1),r=Math.floor((t.getTime()-n.getTime())/864e5);return Math.ceil(r/7)},Io=function(e,t){return e/t*100},Po=function(e,t){return(Math.round(100*e)/100).toFixed(t)},_o=function(e,t){return new Intl.NumberFormat(void 0,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e)},Eo=function(e){return Array(e).fill(void 0)},Oo=function(e,t,n,r){return JSON.stringify({dimensionKeys:e,dimensionValues:t,fieldId:n,function:r})},Lo=function(e){if(!e)return!1;try{return Mo(e),!0}catch(e){return!1}},Mo=function(e){var t=JSON.parse(e);return{dimensionKeys:t.dimensionKeys,dimensionValues:t.dimensionValues,fieldId:t.fieldId,function:t.function}},Ro=function(e){var t=Mo(e);return tt({function:t.function,field:t.fieldId})},No=function(e){return[].concat(e.content).map((function(t){return i.reduce(t,(function(t,n,r){return t[e.fields[r].id]=n,t}),{})}))},zo=function(e,t,n,r,o){if(void 0===r&&(r=!1),!e)return[];var a=No(e),l=[].concat(a).map((function(e){var r=[].concat(n.x).map((function(t){return Ze(e[t],o)})),i={},a=[].concat(n.y).map((function(t){return e[t]}));t.forEach((function(t){var r=lt(t),o=Oo(n.y,a,t.field,t.function);i[o]=e[r]}));var l={};return[].concat(n.x).forEach((function(t){l[t]=e[t]})),U({},l,{x:r.join(", ")},i,{xValues:r})})),s=[],u={};l.forEach((function(e){var t=u[e.x];u[e.x]||s.push(e.x),u[e.x]=i.merge({},t,e)}));var d=s.map((function(e){return u[e]}));return r?Uo(d):d},Bo=function(e,t,n){if(!n)return[];var r=No(n),i={};return r.forEach((function(n){var r=[].concat(e.y).map((function(e){return n[e]}));t.forEach((function(t){var n=Oo(e.y,r,t.field,t.function);i[n]=!0}))})),Object.keys(i)},qo=function(e,t){return i.findIndex(e.fields,(function(e){return e.id==t}))},Vo=function(e,t){return e.fields[qo(e,t)]},Ho=function(e){return void 0===e},Wo=function(e){return null===e},Yo=function(e){return!!Ho(e)||!!Wo(e)||i.isEmpty(e.content)},Uo=function(e){var t=["x","xValues"];return e.map((function(e){var n=U({},e),r=i.sumBy(Object.entries(n),(function(e){var n=e[1];return t.includes(e[0])?0:i.isNumber(n)?n:0}));return n=i.mapValues(n,(function(e,o){return t.includes(o)?e:i.isNumber(e)?Io(n[o],r):e}))}))},Go=["contains_substring","does_not_contain_substring","ends_with","starts_with","<","<=",">",">="],Ko=function(e,t){if(null==t&&Go.includes(e.op))return!1;switch(e.op){case"starts_with":return(""+t).startsWith(e.value);case"ends_with":return(""+t).endsWith(e.value);case"is_one_of":return e.value.includes(t);case"is_not_one_of":return!e.value.includes(t);case"contains_substring":return(""+t).includes(e.value);case"does_not_contain_substring":return!(""+t).includes(e.value);case"<":return t<e.value;case">":return t>e.value;case"=":return t==e.value;case"!=":return t!=e.value;case">=":return t>=e.value;case"<=":return t<=e.value}throw"Unsupported comparison op."},Xo=function(e,t){return Ko(e,t)},Qo={_vizzly_compact:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Intl.NumberFormat(void 0,{notation:"compact"}).format(e)},description:"Compact"},_vizzly_to_2_dp:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Po(e,2)},description:"2 decimal places"},_vizzly_to_gbp:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":_o(e,"GBP")},description:"Currency £"},_vizzly_to_usd:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":_o(e,"USD")},description:"Currency $"},_vizzly_to_eur:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":_o(e,"EUR")},description:"Currency €"},_vizzly_to_percentage:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":(n=(100*e).toFixed(2)).endsWith(".00")?parseInt(n)+"%":n+"%";var n},description:"Percentage"},_vizzly_separated:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":e.toLocaleString()},description:"Separated"},_vizzly_number:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":""+e},description:"Number"},_vizzly_hours_and_minutes_from_minutes:{description:"Minutes to hours & minutes",formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Math.floor(e/60)+" H : "+Po(e%60,0)+" M"}}},Jo={description:"Default",formatter:Qo._vizzly_compact.formatter},Zo=function(e,t,n){var r=i.merge({},t,e);return i.merge({},n,r)},$o=function(e,t){return JSON.stringify(e)==JSON.stringify(t)},ea=function(e,t,n){var r=Mo(n);return[].concat(t).flatMap((function(t){var n=e.some((function(e){return e.field===t.field}))&&("string"==typeof t.value||"boolean"==typeof t.value||"number"==typeof t.value);return n||lt({field:r.fieldId,function:r.function})==t.field?[{rule:t,isRuleOnDimension:n}]:[]}))},ta=function(e,t,n,r,i){return ea(e,t,n).map((function(e){var t=rt(e.rule.field,{supportedAggregates:r,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),n=t.function,o=Rn(i,t.fieldId);return{isRuleOnDimension:e.isRuleOnDimension,color:e.rule.ruleValue,explanation:"When "+o.publicName+" "+(n&&"none"!=n?"("+n+")":"")+" "+e.rule.operator+" "+e.rule.value,value:e.rule.value,operator:e.rule.operator,conditionIsMet:function(t){return Xo({value:e.rule.value,op:e.rule.operator},la(o,t))}}}))},na=function(e,t,n,r,o){if(n){var a=ea(e,t,r),l=Mo(r),s=a.find((function(e){var t=e.rule,a=e.isRuleOnDimension,s=a?Rn(o,t.field):void 0,u=a?[].concat(l.dimensionValues,null!=n[t.field]?[n[t.field]]:[]):[n[r]];return i.some(u,(function(e){return null==e?null:Xo({op:t.operator,value:t.value},s?la(s,e):e)}))}));return null==s?void 0:s.rule}},ra=function(e,t,n){return function(r){if(e){var i=n.dateTimeFormatOptions[t[e.truncate].dateFormat].formatter(new Date(r));return""+(n.prefix||"")+i+(n.postfix||"")}return r=aa(r,n.numberFormatOptions,n.format),""+(n.prefix||"")+r+(n.postfix||"")}},ia=function(e){return function(t){var n,r;return"number"==typeof t?(t=aa(t,U({},null==e?void 0:e.numberFormatOptions,((r={}).default=Jo,r)),null!=(n=null==e?void 0:e.format)?n:"default"),""+((null==e?void 0:e.prefix)||"")+t+((null==e?void 0:e.postfix)||"")):""+((null==e?void 0:e.prefix)||"")+t+((null==e?void 0:e.postfix)||"")}},oa=function(e){return function(t){if(e){var n=Mo(t),r=lt({function:n.function,field:n.fieldId}),i=Vo(e,r),o=Ne(n.function);if(i)return[].concat(n.dimensionValues,[null==i?void 0:i.publicName,o]).join(" • ")}}},aa=function(e,t,n){var r,i=null==t||null==(r=t[null!=n?n:""])?void 0:r.formatter;return i?i(e):e};function la(e,t){return"boolean"===e.dataType&&"string"==typeof t?(n=t,"boolean"===(r=e.dataType)&&("true"===n||"TRUE"===n||"True"===n)||("boolean"!==r||"false"!==n&&"FALSE"!==n&&"False"!==n)&&n):t;var n,r}var sa={transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)"},ua=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},r=U({},i.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var i=t?t[e]:null;i&&(r=U({},r,n.variants&&n.variants[e]&&n.variants[e][i]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=U({},e.css);i.every(Object.keys(i.omit(e,["css"])),(function(n){var r;return e[n]==(null==(r=t)?void 0:r[n])}))&&(r=U({},r,n))})),r}}(e)(t);return p.css(n,"","")};return t.toString=t,t};function da(e){return function(e,t){for(var n=e.startsWith("#")?e.slice(1):e,r="",i=0;i<3;i++){var o=parseInt(n.substr(2*i,2),16);r+=("0"+Math.min(255,Math.floor(o+(255-o)*t/100)).toString(16)).slice(-2)}return"#"+r}("#374151",e)}function ca(e){for(var t,n={},r=te(e);!(t=r()).done;){var i=t.value;n[i.toString()]=100-i}return n}var pa=ca([5,8,20,80,90]),fa={base:va("55, 65, 81",0)};for(var ma in pa)fa[ma]=va("55, 65, 81",pa[ma]);var ha={font:{header:16,standard:13,bold:400,sanSerif:"Inter, sans-serif",color:"rgb(55, 65, 81)"},size:{borderRadius:"0.5rem"},colors:{brand:fa,blue:"rgb(48, 116, 217)",contrast:"rgb(249, 247, 250)",success:"#43BA73"}};function va(e,t){var n=e.match(/\d+/g).map(Number),r=n[0],i=n[1],o=n[2],a=t/100;return"rgb("+(r=Math.min(Math.round(r+(255-r)*a),255))+", "+(i=Math.min(Math.round(i+(255-i)*a),255))+", "+(o=Math.min(Math.round(o+(255-o)*a),255))+")"}for(var ga={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",rowLimit:6,forms:{label:{fontSize:ha.font.standard,fontWeight:ha.font.bold,margin:"0 0 0.3rem 0"},input:{border:"2px "+ha.colors.brand[8]+" solid",background:"#fff",borderRadius:ha.size.borderRadius,padding:"0.35rem 0.5rem",fontSize:ha.font.standard,color:ha.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},select:{border:"2px "+ha.colors.brand[8]+" solid",background:"#fff",borderRadius:ha.size.borderRadius,padding:"0.35rem 0.5rem",color:ha.colors.brand.base,fontSize:ha.font.standard,fontWeight:"inherit",indicatorColor:ha.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},dateTime:{input:{border:"2px rgb(243, 244, 246) solid",background:"#fff",borderRadius:ha.size.borderRadius,padding:"0.26rem 0.5rem",fontSize:ha.font.standard,color:ha.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},date:{width:90},time:{width:40},indicatorColor:ha.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},title:{fontSize:ha.font.header,fontWeight:ha.font.bold,color:ha.font.color}}}},dropdowns:{fontSize:ha.font.standard,background:"rgb(255 255 255 / 1)",color:"inherit",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1),0 1px 2px -1px rgb(0 0 0 / 0.1)",borderRadius:ha.size.borderRadius,border:"0px solid transparent",separatorBorder:"1px solid "+ha.colors.brand[8],"&:hover":{background:ha.colors.brand[5]},padding:"0.5rem"},buttons:{primary:{borderRadius:ha.size.borderRadius,border:"1px solid rgb(48, 116, 217)",background:ha.colors.blue,padding:"0.30rem 0.75rem",boxShadow:"0 2px 0 rgb(0 0 0 / 5%)",color:"#fff",fontSize:ha.font.standard,"&:hover":{background:"#5795e6"}},secondary:{borderRadius:ha.size.borderRadius,border:"1px solid "+ha.colors.brand[20],background:"rgb(255, 255, 255)",padding:"0.30rem 0.75rem",color:ha.font.color,fontSize:ha.font.standard,"&:hover":{border:"1px solid rgb(209, 209, 209, 0.8)",color:"rgb(27, 27, 29, 0.8)"}},add:{border:"2px dashed rgba(143, 143, 145, 0.2)",borderRadius:ha.size.borderRadius,color:"#8f8f91",background:"transparent","&:hover":{border:"2px dashed #3074d9",color:"#3074d9"},small:{fontSize:"0.75rem"},medium:{fontSize:ha.font.standard},large:{fontSize:ha.font.standard}},grid:{selected:{borderRadius:ha.size.borderRadius,fontWeight:ha.font.bold,background:"rgb(243 244 246)",fontSize:ha.font.standard,"&:hover":{boxShadow:"0 0 #0000, 0 0 #0000, 0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)"}},unselected:{borderRadius:ha.size.borderRadius,fontWeight:ha.font.bold,background:"transparent",fontSize:ha.font.standard,"&:hover":{boxShadow:"0 0 #0000, 0 0 #0000, 0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)"}}}},panels:{padding:"0.75rem 1rem",borderRadius:ha.size.borderRadius,background:"#fff",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1),0 2px 4px -2px rgb(0 0 0 / 0.1)"},modals:{base:{borderRadius:ha.size.borderRadius,border:"0px solid",background:"rgb(255, 255, 255)",boxShadow:"0 0 #0000,0 0 #0000,0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)",zIndex:2147483147},header:{padding:"0.75rem 0.75rem 0px"},content:{fontSize:ha.font.standard,padding:"0.75rem",alternativeBackground:"rgb(229 231 235 / 0.2)"},footer:{padding:"0.75rem"},overlay:{background:"#000",opacity:.3},options:{disableOutsideClick:!1,closeButton:"outside"}},alerts:{padding:"8px 12px",borderRadius:ha.size.borderRadius,info:{background:"rgb(224, 242, 255)",border:"1px solid rgb(224, 242, 255)",iconColor:"#1677ff"},warning:{background:"rgb(255, 245, 234)",border:"1px solid #e1b878",iconColor:"#b98900"},critical:{background:"rgb(255, 85, 85)",border:"1px solid rgb(255, 85, 85)",color:"rgb(255, 255, 255)",iconColor:"#fff"},title:{fontWeight:ha.font.bold,fontSize:ha.font.standard},content:{fontSize:ha.font.standard}},tabs:{selected:{borderRadius:ha.size.borderRadius,padding:"0.5rem 0",fontSize:ha.font.standard,fontWeight:600,boxShadow:"0 0 #0000,0 0 #0000,0 1px 2px 0 rgb(0 0 0 / 0.05)",background:"rgb(48 116 217)",color:"rgb(255 255 255)"},unselected:{borderRadius:ha.size.borderRadius,padding:"0.5rem 0",fontSize:ha.font.standard,fontWeight:600,color:"rgba(0, 0, 0, 0.4)"}},lists:{title:{fontSize:14,fontWeight:ha.font.bold},fontSize:ha.font.standard,border:"2px solid rgb(229 231 235 / 0.6)",borderRadius:ha.size.borderRadius,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"}},popoverMenu:{borderRadius:ha.size.borderRadius,fontSize:ha.font.standard,background:"rgb(249 247 250)",color:"inherit",boxShadow:"0 0 #0000,0 0 #0000,0 10px 15px -3px rgb(0 0 0 / 0.1),0 4px 6px -4px rgb(0 0 0 / 0.1)","&:hover":{background:"rgb(255, 255, 255)"},padding:"0.35rem 0.75rem"},charts:{title:{fontWeight:ha.font.bold,fontSize:ha.font.header,color:ha.colors.brand[90]},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:da(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31"},tables:{th:{background:da(95),borderTop:0,borderBottom:"3px solid "+da(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid "+da(70),last:{borderRight:0},inner:{borderRight:!1},"&:hover":{color:ha.colors.brand[90]},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+da(70)},row:{borderBottom:"1px solid "+da(70),padding:"0.5rem"},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}},body:{cells:{padding:"7.3px 8px",fontSize:13,borderBottom:"1px solid "+ha.colors.brand[8]},odd:{"&:hover":{background:ha.colors.brand[5]}},even:{"&:hover":{background:ha.colors.brand[5]}}}},accordion:{iconColor:ha.colors.blue,button:{fontWeight:ha.font.bold,fontSize:ha.font.standard,color:ha.colors.blue}},dashboard:{borderColor:da(80),borderStyle:"solid",borderWidth:2,borderRadius:ha.size.borderRadius,icon:{color:"#1f293799"}},radioGroup:{description:{fontWeight:"inherit",color:ha.colors.brand[80],fontSize:11},label:{fontWeight:"inherit",color:"inherit",fontSize:13}},search:{border:"1px solid rgb(243, 244, 246)",background:"#fff",borderRadius:"0.5rem",padding:"6px 10px 7px 16px",fontSize:16,fontWeight:500,height:36,"&:focus":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},"&:hover":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},icons:{color:"rgb(48, 116, 217)"}},library:{verified:{color:"rgba(22, 119, 255, 0.3)"}}},ba={backgroundColor:"transparent",backgroundImage:"none",WebkitAppearance:"button",border:"none",cursor:"pointer",padding:0},xa=ua(ba),ya={margin:0},wa={margin:0,textDecoration:"underline",color:"rgb(47, 129, 247)",cursor:"pointer"},Ca={listStyle:"none",padding:0,margin:0},ja={padding:0,margin:0},Fa=ua(ya),Sa='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',ka=ua({fontFamily:Sa,fontSize:"1em"}),Ta=ua(wa),Aa=ua(Ca),Da=ua(ja),Ia=ua({fontWeight:700}),Pa={xs:"0.75rem",sm:"0.8rem"},_a=ua({position:"absolute",left:-9999,width:1,height:1,overflow:"hidden"}),Ea=Object.assign((function(){return null}),{ml:function(e){return ua({marginLeft:e})},bw:function(e){return ua({borderWidth:e})},codeText:ka,bold:Ia,button:xa,text:Fa,link:Ta,paddingBottom:function(e){return ua({paddingBottom:e})},paddingLeft:function(e){return ua({paddingLeft:e})},padding:function(e){return ua({padding:e})},margin:function(e){return ua({margin:e})},srOnly:_a,liReset:Aa,ulReset:Da,textSize:function(e){return ua({fontSize:Pa[e]||"1rem"})},opacity:function(e){return ua({opacity:e})},color:function(e){return ua({color:e})}}),Oa=Object.assign((function(){return null}),{button:ba,text:ya,link:wa,codeFontFamily:Sa}),La=ua({display:"block",verticalAlign:"middle"}),Ma=Object.assign((function(){return null}),{selectedComponent:function(e){var t=o.merge({},ga.panels,e);return ua(U({},sa,Oa.button,{borderRadius:t.borderRadius,"&:hover":U({},sa,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:t.borderRadius}),"&:focus":U({},sa,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:t.borderRadius}),variants:{componentSelect:{true:U({},sa,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:t.borderRadius,"&:focus-visible":{outline:0},"&:focus":{outline:0},"&:hover":U({},sa,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:t.borderRadius})})}}}))},tableWrapper:ua({display:"flex",height:268,width:"100%",flexDirection:"column",position:"relative"})}),Ra={name:"n8i3ag",styles:"position:relative;height:100%;width:100%;flex-grow:1;overflow-x:hidden"},Na={name:"4hfwcq",styles:"height:100%;width:100%;flex-grow:1"},za=function(e){return null!=e&&e.disabledFeatures?c.jsxs("div",{css:Ra,"aria-disabled":!0,children:[null==e?void 0:e.children,c.jsx("div",{style:{position:"absolute",inset:0}})]}):c.jsx("div",{css:Na,children:null==e?void 0:e.children})},Ba=function(e){return null!=e&&e.disabledFeatures?c.jsxs("div",{className:""+Ma.tableWrapper,children:[null==e?void 0:e.children,c.jsx("div",{style:{position:"absolute",inset:0}})]}):c.jsx(t.Fragment,{children:null==e?void 0:e.children})},qa={name:"c1vcec",styles:"display:inline-block;height:1rem;width:1rem"},Va=function(e){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:e.active?"black":"none",css:qa,viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","data-component":"filter-icon",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"})})},Ha={name:"6r56vi",styles:"height:1rem;width:1rem"},Wa=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Ha,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})},Ya={name:"3vy5qs",styles:"height:1.25rem;width:1.25rem;opacity:0.7"},Ua=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:Ya,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})})},Ga={name:"15zcgxh",styles:"margin:auto;margin-top:0.25rem;height:1.25rem;width:1.25rem"},Ka=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Ga,viewBox:"0 0 20 20",fill:"#88ecac",children:c.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})},Xa={name:"15zcgxh",styles:"margin:auto;margin-top:0.25rem;height:1.25rem;width:1.25rem"},Qa={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Ja=function(e){return c.jsxs(c.Fragment,{children:["removeFilter"==e.purpose&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Xa,viewBox:"0 0 20 20",children:c.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),"removeFilter"!=e.purpose&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Qa,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{fillRule:"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 10 0-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})})]})},Za={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},$a=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Za,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{d:"M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"})})},el={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},tl=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:el,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})})},nl={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},rl=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:nl,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{fillRule:"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z",clipRule:"evenodd"})})},il={name:"6r56vi",styles:"height:1rem;width:1rem"},ol=function(e){return c.jsx("svg",{onClick:e.onClick,css:il,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"})})},al={name:"y1h7kl",styles:"display:inline;height:1.5rem;width:1.5rem"},ll=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:al,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{d:"M5 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2H5zM5 11a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2H5zM11 5a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V5zM11 13a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})})},sl={name:"6r56vi",styles:"height:1rem;width:1rem"},ul={name:"6r56vi",styles:"height:1rem;width:1rem"},dl=function(e){return c.jsxs(c.Fragment,{children:[e.isOpen&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:sl,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),!e.isOpen&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:ul,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})})]})},cl={name:"y1h7kl",styles:"display:inline;height:1.5rem;width:1.5rem"},pl=function(e){return c.jsx("svg",{onClick:e.onClick,css:cl,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7.5h1.5m-1.5 3h1.5m-7.5 3h7.5m-7.5 3h7.5m3-9h3.375c.621 0 1.125.504 1.125 1.125V18a2.25 2.25 0 01-2.25 2.25M16.5 7.5V18a2.25 2.25 0 002.25 2.25M16.5 7.5V4.875c0-.621-.504-1.125-1.125-1.125H4.125C3.504 3.75 3 4.254 3 4.875V18a2.25 2.25 0 002.25 2.25h13.5M6 7.5h3v3H6v-3z"})})},fl=function(){return c.jsx("svg",{width:"24",height:"24",viewBox:"0 0 160 160",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{d:"M72.7304 36.3655L84.8523 48.4873L96.9741 36.3655C100.189 33.1506 104.549 31.3444 109.096 31.3444C113.642 31.3444 118.003 33.1505 121.218 36.3655L157.583 72.731C160.798 75.9459 162.604 80.3062 162.604 84.8528C162.604 89.3994 160.798 93.7597 157.583 96.9746L121.218 133.34C118.003 136.555 113.642 138.361 109.096 138.361C104.549 138.361 100.189 136.555 96.9741 133.34L84.8523 121.218L72.7304 133.34C69.5155 136.555 65.1552 138.361 60.6086 138.361C56.062 138.361 51.7017 136.555 48.4868 133.34L12.1213 96.9746C8.90637 93.7597 7.10025 89.3994 7.10025 84.8528C7.10025 80.3062 8.90637 75.9459 12.1213 72.731L48.4868 36.3655C51.7017 33.1506 56.062 31.3444 60.6086 31.3444C65.1552 31.3444 69.5155 33.1506 72.7304 36.3655ZM111.52 123.643L147.886 87.2771C148.529 86.6342 148.89 85.7621 148.89 84.8528C148.89 83.9435 148.529 83.0714 147.886 82.4284L111.52 46.0629C110.877 45.4199 110.005 45.0587 109.096 45.0587C108.187 45.0587 107.315 45.4199 106.672 46.0629L70.3061 82.4284C69.6631 83.0714 69.3019 83.9435 69.3019 84.8528C69.3019 85.7621 69.6631 86.6342 70.3061 87.2771L106.672 123.643C107.315 124.286 108.187 124.647 109.096 124.647C110.005 124.647 110.877 124.286 111.52 123.643ZM21.8187 82.4284C21.1758 83.0714 20.8145 83.9435 20.8145 84.8528C20.8145 85.7621 21.1758 86.6342 21.8187 87.2771L58.1842 123.643C58.8272 124.286 59.6993 124.647 60.6086 124.647C61.5179 124.647 62.39 124.286 63.033 123.643L75.1548 111.521L60.6086 96.9746C57.3937 93.7597 55.5876 89.3994 55.5876 84.8528C55.5876 80.3062 57.3937 75.9459 60.6086 72.731L75.1548 58.1848L63.033 46.0629C62.39 45.4199 61.5179 45.0587 60.6086 45.0587C59.6993 45.0587 58.8272 45.4199 58.1842 46.0629L21.8187 82.4284Z",fill:"rgb(55, 65, 81)"})})},ml={name:"37ue6p",styles:"display:inline-block;height:1.25rem;width:1.25rem"},hl=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",css:ml,viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75"})})},vl={parameters:!0,disableAutoSave:!0,showGlobalFilters:!0,showResetButton:!1,canManageGlobalFilters:!0,canEditComponentLibrary:!0,canUseComponentLibrary:!0,canCreateStandaloneComponents:!0,canDownloadComponentData:!0,canEditComponentsOnDashboard:!0,canRemoveComponentsFromDashboard:!0,canConfigureLocalFilters:!0,canAddNewRows:!0,canAddNewCells:!0,canEditCustomMetrics:!0,allowPercentagesCustomField:!0,allowSimpleMathsCustomField:!0,allowAggregateMathsCustomField:!0,allowRoundedNumberCustomField:!0,allowRulesCustomField:!0,showDateAndTimeFilter:!0,showDateFilter:!0,canSeeEmptyState:!1},gl={parameters:!0,disableAutoSave:!1,showGlobalFilters:!0,showResetButton:!0,canManageGlobalFilters:!0,canEditComponentLibrary:!0,canUseComponentLibrary:!0,canCreateStandaloneComponents:!0,canDownloadComponentData:!0,canEditComponentsOnDashboard:!0,canRemoveComponentsFromDashboard:!0,canConfigureLocalFilters:!0,canAddNewRows:!0,canAddNewCells:!0,canEditCustomMetrics:!0,allowPercentagesCustomField:!0,allowSimpleMathsCustomField:!0,allowAggregateMathsCustomField:!0,allowRoundedNumberCustomField:!0,allowRulesCustomField:!0,showDateAndTimeFilter:!0,showDateFilter:!0,canSeeEmptyState:!1},bl=function(e,t,n,r){var i=U({},gl,e);return"admin"==n&&(i=U({},vl,xl(e))),"read"==r&&"admin"!=n&&(i.disableAutoSave=!0,i.canEditComponentLibrary=!1,i.canEditComponentsOnDashboard=!1,i.canCreateStandaloneComponents=!1,i.parameters=!0,i.canRemoveComponentsFromDashboard=!1,i.canConfigureLocalFilters=!1,i.canAddNewRows=!1,i.canAddNewCells=!1,i.canEditCustomMetrics=!1,i.canUseComponentLibrary=!1,i.canManageGlobalFilters=!1),zi(t,"simpleMaths")||(i.allowSimpleMathsCustomField=!1),zi(t,"aggregateMaths")||(i.allowAggregateMathsCustomField=!1),zi(t,"subquery")||(i.allowPercentagesCustomField=!1),zi(t,"switchField")||(i.allowRulesCustomField=!1),zi(t,"roundedNumbers")||(i.allowRoundedNumberCustomField=!1),i},xl=function(e){var t;return{showDateAndTimeFilter:void 0===e.showDateAndTimeFilter||e.showDateAndTimeFilter,showDateFilter:void 0===e.showDateFilter||e.showDateFilter,canUseComponentLibrary:void 0===e.canUseComponentLibrary||e.canUseComponentLibrary,canSeeEmptyState:null!=(t=e.canSeeEmptyState)&&t}},yl={today:!1,past_1_day:!0,yesterday:!0,past_3_days:!0,past_7_days:!0,past_30_days:!0,past_90_days:!0,past_3_months:!1,past_6_months:!1,past_12_months:!1,past_18_months:!1},wl=function(e){return{description:"Yesterday",range:{before:To(e),after:To((t=e,n=new Date(t.getTime()-864e5),new Date(n.getFullYear(),n.getMonth(),n.getDate())))}};var t,n},Cl=function(e,t,n){var r=new Date,i=new Date(r);return t>0&&i.setMonth(r.getMonth()-t),e>0&&(i=new Date(r.getTime()-24*e*60*60*1e3)),{description:n,range:{before:r,after:i}}},jl={today:function(e){var t=To(new Date),n=new Date(t);return n.setDate(n.getDate()+1),n.setMilliseconds(n.getMilliseconds()-1),{description:"Today",range:{before:n,after:t}}}(),past_1_day:Cl(1,0,"Last 24 hours"),yesterday:wl(new Date),past_3_days:Cl(3,0,"Last 3 days"),past_7_days:Cl(7,0,"Last 7 days"),past_30_days:Cl(30,0,"Last 30 days"),past_90_days:Cl(90,0,"Last 90 days"),past_3_months:Cl(0,3,"Last 3 months"),past_6_months:Cl(0,6,"Last 6 months"),past_12_months:Cl(0,12,"Last 12 months"),past_18_months:Cl(0,18,"Last 18 months")},Fl={},Sl=0,kl=Object.entries(yl);Sl<kl.length;Sl++){var Tl=kl[Sl],Al=Tl[0];Tl[1]&&Al in jl&&(Fl["_vizzly_"+Al]=jl[Al])}var Dl=function(e){var t=Object.keys(yl).map((function(e){return e in jl?"_vizzly_"+e:e})),n=t.indexOf("_vizzly_today");n>-1&&(t.splice(n,1),t.unshift("_vizzly_today"));for(var r,i={},o={},a=te(t);!(r=a()).done;){var l=r.value,s=l.replace("_vizzly_",""),u=jl[s],d=null==e?void 0:e[s];"boolean"==typeof d?d&&(o[l]=u):null!=d?o[l]=d:!1!==yl[s]&&(o[l]=u)}if(e)for(var c=0,p=Object.entries(e);c<p.length;c++){var f=p[c],m=f[0],h=f[1];m in yl||(t.push(m),o[m]=h)}for(var v,g=te(t);!(v=g()).done;){var b=v.value;b in o&&(i[b]=o[b])}return i},Il=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="MissingDateTimeFormatOption",n}return G(t,e),t}(Z(Error)),Pl={"DD/MM/YYYY":{description:"DD/MM/YYYY",formatter:function(e){return ko(e,"DD/MM/YYYY")}},"MM/DD/YYYY":{description:"MM/DD/YYYY",formatter:function(e){return ko(e,"MM/DD/YYYY")}},"DD-MM-YYYY":{description:"DD-MM-YYYY",formatter:function(e){return ko(e,"DD-MM-YYYY")}},"MM-DD-YYYY":{description:"MM-DD-YYYY",formatter:function(e){return ko(e,"MM-DD-YYYY")}},"DD MMMM YYYY, hh:mm":{description:"DD MMMM YYYY, hh:mm",formatter:function(e){return ko(e,"DD MMMM YYYY, hh:mm")}},"dddd DD MMMM YYYY, hh:mm":{description:"dddd DD MMMM YYYY, hh:mm",formatter:function(e){return ko(e,"dddd DD MMMM YYYY, hh:mm")}},"hh:mm":{description:"hh:mm",formatter:function(e){return ko(e,"hh:mm")}},"hh:mm:ss":{description:"hh:mm:ss",formatter:function(e){return ko(e,"hh:mm:ss")}},"DD MMMM YYYY":{description:"DD MMMM YYYY",formatter:function(e){return ko(e,"DD MMMM YYYY")}},"MMMM YYYY":{description:"MMMM YYYY",formatter:function(e){return ko(e,"MMMM YYYY")}},YYYY:{description:"YYYY",formatter:function(e){return ko(e,"YYYY")}},"YYYY-MM-DD[T]HH:mm:ss":{description:"YYYY-MM-DD[T]HH:mm:ss",formatter:function(e){return ko(e,"YYYY-MM-DD[T]HH:mm:ss")}},quarter:{description:"quarter",formatter:function(e){return ko(e,"quarter")}},week:{description:"week",formatter:function(e){return ko(e,"week")}}},_l=function(e,t){var n={};return Object.keys(e).forEach((function(t){e[t]&&(n[t]=e[t])})),Object.keys(t.supportedTimeTruncFunctions).forEach((function(e){var r=t.supportedTimeTruncFunctions[e].dateFormat;if(!n[r])throw new Il("Date format option "+r+" is required by the query engine, but it has not been set on the dateTimeFormatOptions.")})),n},El={mode:"endUser",scope:"read_write",maxCSVDownloadLimit:1e4,featureToggles:U({},gl),developerTools:!1,componentOverrides:{},customComponents:[],reportScheduleOptions:[],overrideDeveloperInfo:null,disableToolbar:!1,onlyViewTypes:function(){return[]},dataPanel:function(e){return e},formatPanel:function(e){return e},dashboardFilters:function(){return[]},onDashboardFilterChange:function(){},dateFilterOptions:Fl,dateTimeFormatOptions:Pl,numberFormatOptions:Qo,textOverrides:{},queryEngineConfig:to,organizationName:void 0,onEditorUpdate:function(e){return e},onSave:function(){return Br("Save functionality not set.")},onScheduledReportChange:function(){var e=Y(H().mark((function e(){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Br("Scheduled report change functionality not set."),e.abrupt("return",null);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onOpenConfigManagerUi:void 0,onReset:function(){throw new Error("onReset function not implemented.")}},Ol=function(e){var n=(null==e?void 0:e.developerTools)&&"object"==typeof(null==e?void 0:e.developerTools)&&"theme"in(null==e?void 0:e.developerTools)&&!0===(null==e?void 0:e.developerTools.theme),r=(null==e?void 0:e.developerTools)&&"object"==typeof(null==e?void 0:e.developerTools)&&"componentOverride"in(null==e?void 0:e.developerTools)&&!0===(null==e?void 0:e.developerTools.componentOverride),i=function(){setTimeout((function(){document.querySelectorAll("[data-themeapi]").forEach((function(e){!function(e){var t=e.getAttribute("data-themeapi"),n=e.getAttribute("data-chipposition"),r=null==n?void 0:n.split("."),i="0px",o="20px",a=void 0,l=void 0;null!=r&&r.length&&(r.includes("left")&&(a="0px",i=void 0),r.includes("center")&&(a="calc(50% - 35px)",i=void 0),r.includes("bottom")&&(l="8px",o=void 0),r.includes("above")&&(o="0")),e.style.setProperty("--theme-value","'"+t+"'"),e.style.setProperty("--chip-top-value",""+o),e.style.setProperty("--chip-right-value",""+i),e.style.setProperty("--chip-left-value",""+a),e.style.setProperty("--chip-bottom-value",""+l)}(e),e.classList.add("theme-box")}))}),300)},o=function(){setTimeout((function(){document.querySelectorAll("[data-componentoverride]").forEach((function(e){!function(e){var t=e.getAttribute("data-componentoverride");e.style.setProperty("--override-value","'"+t+"'")}(e),e.classList.add("override-box")}))}),300)};return t.useEffect((function(){n&&Ll(),r&&Ml()}),[n]),t.useEffect((function(){return n&&(i(),document.addEventListener("click",i)),r&&(o(),document.addEventListener("click",o)),function(){document.removeEventListener("click",i),document.removeEventListener("click",o)}}),[]),c.jsx(t.Fragment,{children:null==e?void 0:e.children})},Ll=function(){p.injectGlobal({name:"1rt118i",styles:".theme-box:hover{outline:2px solid #1db954;}.theme-box{outline:2px solid transparent;}.theme-box:hover::after{opacity:1!important;z-index:999999999999;}.theme-box::after{opacity:0.4;content:var(--theme-value);position:absolute;background:#1db954;color:#fff;width:auto;font-size:10px;height:20px;border-radius:8px;right:var(--chip-right-value);top:var(--chip-top-value);bottom:var(--chip-bottom-value);left:var(--chip-left-value);padding:2.5px 5px 2px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.2);font-style:initial;font-weight:initial;}"})},Ml=function(){p.injectGlobal({name:"13sfq96",styles:".override-box:hover{outline:2px solid #652C8F;}.override-box{outline:2px solid transparent;}.override-box:hover::after{opacity:1!important;z-index:999999999999;}.override-box::after{opacity:0.4;content:var(--override-value);position:absolute;background:#652C8F;color:#fff;width:auto;font-size:10px;height:20px;border-radius:8px;right:0;top:20px;padding:2.5px 5px 2px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.2);font-style:initial;font-weight:initial;}"})},Rl=n.createContext(U({},El,{setOverrideDeveloperInfo:function(){throw"Not initiated."}})),Nl=function(e){var n,r,a,l,s,u,d,p,f=t.useState(null),m=f[0],h=f[1],v=(r=U({},e.dashboardBehaviour||{},{mode:e.mode}),a=e.includeComponentTypes,l=e.excludeComponentTypes,u=r.scope||El.scope,d="admin"==(s=r.mode||El.mode)?{}:U({},r.componentOverrides),p=r.queryEngineConfig?r.queryEngineConfig:El.queryEngineConfig,U({},El,{mode:s,scope:u,reportScheduleOptions:r.reportScheduleOptions||El.reportScheduleOptions,customComponents:r.customComponents||El.customComponents,componentOverrides:d,onlyViewTypes:function(e){var t,n,r;return(t=ir,n=l,r=[].concat(a||t),n&&(r=i.reject(r,(function(e){return n.includes(e)}))),r).filter((function(t){var n=!!On(t).setDataAttributesFromPreAggregatedDataSet;return!(e.preAggregated&&!n)}))},developerTools:"boolean"==typeof(null==r?void 0:r.developerTools)&&(null==r?void 0:r.developerTools),featureToggles:bl(o.merge({},El.featureToggles,r.featureToggles),p,s,u),textOverrides:r.textOverrides||El.textOverrides,maxCSVDownloadLimit:r.maxCSVDownloadLimit?r.maxCSVDownloadLimit:El.maxCSVDownloadLimit,queryEngineConfig:p,dataPanel:r.dataPanel?r.dataPanel:El.dataPanel,formatPanel:r.formatPanel?r.formatPanel:El.formatPanel,numberFormatOptions:U({},El.numberFormatOptions,r.numberFormatOptions),onEditorUpdate:r.onEditorUpdate?r.onEditorUpdate:El.onEditorUpdate,onAskAI:r.onAskAI,dateFilterOptions:Dl(r.dateFilterOptions),onSave:r.onSave?r.onSave:El.onSave,onScheduledReportChange:r.onScheduledReportChange?r.onScheduledReportChange:El.onScheduledReportChange,dashboardFilters:r.dashboardFilters?r.dashboardFilters:El.dashboardFilters,onDashboardFilterChange:r.onDashboardFilterChange?r.onDashboardFilterChange:El.onDashboardFilterChange,onOpenConfigManagerUi:r.onOpenConfigManagerUi,organizationName:r.organizationName,dateTimeFormatOptions:_l(U({},El.dateTimeFormatOptions,r.dateTimeFormatOptions?r.dateTimeFormatOptions:{}),p),disableToolbar:r.disableToolbar}));return c.jsx(Ol,{developerTools:null==(n=e.dashboardBehaviour)?void 0:n.developerTools,children:c.jsx(Rl.Provider,{value:U({},v,{setOverrideDeveloperInfo:h,overrideDeveloperInfo:m,onError:e.onError,onReset:e.onReset,onViewClick:e.onViewClick,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection}),children:e.children})})},zl=function(){return n.useContext(Rl)},Bl=function(e){var t=zl(),n=t.developerTools,r=t.setOverrideDeveloperInfo,i=t.componentOverrides[e.renderOverrideKey];if(i){var o=U({},e.componentProps,{testId:void 0,onClickWithDevToolCheck:void 0,activeDevToolHighlight:void 0});return delete o.testId,delete o.onClickWithDevToolCheck,delete o.activeDevToolHighlight,i(o)}return c.jsx(e.Element,U({},e.componentProps,{activeDevToolHighlight:n,onClickWithDevToolCheck:function(t){return function(i){if(!i.shiftKey||!n)return t&&t(i);r({overrideKey:e.renderOverrideKey,componentProps:e.componentProps}),i.stopPropagation()}}}))},ql=function(e,t,n){return function(r){return c.jsx(Bl,{Element:e,renderOverrideKey:t,componentProps:n?n(r):r})}},Vl=function(e,t,n){return ql((function(n){return c.jsx(Hl,{activeDevToolHighlight:n.activeDevToolHighlight,onClickWithDevToolCheck:n.onClickWithDevToolCheck,renderOverrideKey:t,children:c.jsx(e,U({},n))})}),t,n)},Hl=function(e){var t,n=zl();return c.jsx("div",U({style:{display:"inherit"},css:["position:relative;",!!n.developerTools&&{outlineStyle:"solid",outlineOffset:"-3px",outlineColor:"#ef4444"},"",""],onClick:e.onClickWithDevToolCheck()},((t={})["data-componentoverride"]=null==e?void 0:e.renderOverrideKey,t),{"data-testid":e.renderOverrideKey,children:e.children}))},Wl=Vl((function(e){return c.jsx(Va,{active:e.active})}),"renderFilterIcon"),Yl=Vl((function(){return c.jsx(pl,{})}),"renderReportIcon"),Ul=Vl((function(){return c.jsx(hl,{active:!0})}),"renderParametersIcon"),Gl=Vl((function(){return c.jsx(Wa,{})}),"renderCloseIcon"),Kl=Vl((function(){return c.jsx(Ua,{})}),"renderUndoIcon"),Xl=Vl((function(){return c.jsx(Ka,{})}),"renderCompletedIcon"),Ql=Vl((function(e){return c.jsx(Ja,{purpose:e.purpose})}),"renderDeleteIcon"),Jl=Vl((function(){return c.jsx($a,{})}),"renderEditIcon"),Zl=Vl((function(){return c.jsx(tl,{})}),"renderLockedIcon"),$l=Vl((function(){return c.jsx(rl,{})}),"renderDownloadIcon"),es=Vl((function(){return c.jsx(ol,{})}),"renderComponentOptionsMenuIcon"),ts=Vl((function(){return c.jsx(ll,{})}),"renderLibraryIcon"),ns=Vl((function(e){return c.jsx(dl,{isOpen:e.isOpen})}),"renderAccordionIcon");function rs(){for(var e=[],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach((function(t){switch(typeof t){case"string":e.push(t);break;case"object":Object.keys(t).forEach((function(n){t[n]&&e.push(n)}))}})),e.length>0?e.join(" "):void 0}var is=function(e){var t,n;return ua({width:"100%",display:"grid",gridTemplateColumns:null==e||null==(t=e.columns)?void 0:t.join(" "),gridTemplateRows:null==e||null==(n=e.rows)?void 0:n.join(" "),height:null==e?void 0:e.height,gap:null==e?void 0:e.gap,rowGap:null==e?void 0:e.rowGap,columnGap:null==e?void 0:e.columnGap,marginBottom:null==e?void 0:e.marginBottom,position:null==e?void 0:e.position,placeContent:null==e?void 0:e.placeContent,gridAutoFlow:null==e?void 0:e.flow})},os=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"div";return c.jsx(r,{className:rs(""+is(e),null==e?void 0:e.className),"data-component":null!=(n=null==e?void 0:e["data-component"])?n:"Grid",role:null==e?void 0:e.role,children:null==e?void 0:e.children})},as=Object.assign((function(){return null}),{container:function(e){var t=ls(e);return ua({position:"absolute",top:0,right:0,zIndex:2147483247,border:null==t?void 0:t.border,borderRadius:null==t?void 0:t.borderRadius,background:null==t?void 0:t.background,color:null==t?void 0:t.color,boxShadow:null==t?void 0:t.boxShadow,fontSize:null==t?void 0:t.fontSize})},option:function(e){var t,n,r,i=ls(e);return ua(U({display:"flex",width:"100%",alignItems:"center",justifyContent:"flex-start",padding:null==i?void 0:i.padding,borderBottom:null==i?void 0:i.separatorBorder,gap:"0.5rem",color:"inherit"},sa,{variants:{clickable:(r={},r.true={cursor:"pointer","&:hover":U({background:null==i||null==(t=i["&:hover"])?void 0:t.background,color:null==i||null==(n=i["&:hover"])?void 0:n.color},sa),"&:last-of-type":{borderBottomLeftRadius:null==i?void 0:i.borderRadius,borderBottomRightRadius:null==i?void 0:i.borderRadius},"&:hover:last-of-type":{borderBottomLeftRadius:null==i?void 0:i.borderRadius,borderBottomRightRadius:null==i?void 0:i.borderRadius},"&:first-of-type":{borderTopLeftRadius:null==i?void 0:i.borderRadius,borderTopRightRadius:null==i?void 0:i.borderRadius},"&:hover:first-of-type":{borderTopLeftRadius:null==i?void 0:i.borderRadius,borderTopRightRadius:null==i?void 0:i.borderRadius}},r)}}))},close:ua({marginRight:"0.5rem",color:"inherit","&:hover":{opacity:.7}})}),ls=function(e){return i.merge({},ga.popoverMenu,e)};function ss(e,t){n.useEffect((function(){function n(n){e.current&&!e.current.contains(n.target)&&t()}return document.addEventListener("mousedown",n),function(){document.removeEventListener("mousedown",n)}}),[e,t])}var us=function(){return t.useContext(ds)},ds=t.createContext(void 0),cs=f({key:"css"}),ps=function(e){return c.jsx(ds.Provider,{value:fs(null==e?void 0:e.theme,null==e?void 0:e.storedTheme),children:c.jsx(d.CacheProvider,{value:cs,children:null==e?void 0:e.children})})},fs=function(e,t){var n,r,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,C,j,F,S,k,T,A,D,I,P,_={baseFont:{fontSize:null!=(n=null!=(r=null==e||null==(o=e.baseFont)?void 0:o.fontSize)?r:null==t?void 0:t.fontSize)?n:ha.font.standard,fontFamily:null!=(a=null!=(l=null==e||null==(s=e.baseFont)?void 0:s.fontFamily)?l:null==t?void 0:t.fontFamily)?a:ha.font.sanSerif},titles:{fontFamily:null!=(u=null!=(d=null!=(c=null==e||null==(p=e.titles)?void 0:p.fontFamily)?c:null==e||null==(f=e.baseFont)?void 0:f.fontFamily)?d:null==t?void 0:t.fontFamily)?u:ha.font.sanSerif,fontSize:null!=(m=null==e||null==(h=e.titles)?void 0:h.fontSize)?m:null==e||null==(v=e.baseFont)?void 0:v.fontSize},colors:null!=(g=null!=(b=null==e?void 0:e.colors)?b:null==t?void 0:t.colors)?g:ga.colors,rowLimit:null!=(x=null!=(y=null==e?void 0:e.rowLimit)?y:null==t?void 0:t.rowLimit)?x:ga.rowLimit,detail:null!=(w=null!=(C=null==e?void 0:e.detail)?C:null==t?void 0:t.detail)?w:ga.detail,fontFamily:null!=(j=null!=(F=null==e?void 0:e.fontFamily)?F:null==t?void 0:t.fontFamily)?j:ha.font.sanSerif,fontSize:null!=(S=null!=(k=null==e?void 0:e.fontSize)?k:null==t?void 0:t.fontSize)?S:ha.font.sanSerif,dashboard:{icon:{color:null!=(T=null==e||null==(A=e.dashboard)||null==(D=A.icon)?void 0:D.color)?T:null==ga||null==(I=ga.dashboard)||null==(P=I.icon)?void 0:P.color}}};return i.merge({},e,_)},ms=function(e){return o.merge({},ga.charts,e)},hs=t.createContext(!1);function vs(e){return c.jsx(hs.Provider,{value:e.force,children:e.children})}function gs(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(e in t){var o=t[e];return"function"==typeof o?o.apply(void 0,r):o}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,gs),a}var bs,xs,ys=["static"],ws=["unmount"],Cs=["as","children","refName"];function js(e){var t=e.slot,n=e.defaultTag,r=e.features,i=e.visible,o=void 0===i||i,a=e.name,l=Ss(e.theirProps,e.ourProps);if(o)return Fs(l,t,n,a);var s=null!=r?r:bs.None;if(s&bs.Static){var u=l.static,d=void 0!==u&&u,c=$(l,ys);if(d)return Fs(c,t,n,a)}if(s&bs.RenderStrategy){var p,f=l.unmount,m=void 0===f||f,h=$(l,ws);return gs(m?xs.Unmount:xs.Hidden,((p={})[xs.Unmount]=function(){return null},p[xs.Hidden]=function(){return Fs(U({},h,{hidden:!0,style:{display:"none"}}),t,n,a)},p))}return Fs(l,t,n,a)}function Fs(e,n,r,i){var o;void 0===n&&(n={});var a=As(e,["unmount","static"]),l=a.as,s=void 0===l?r:l,u=a.children,d=a.refName,c=void 0===d?"ref":d,p=$(a,Cs),f=void 0!==e.ref?((o={})[c]=e.ref,o):{},m="function"==typeof u?u(n):u;p.className&&"function"==typeof p.className&&(p.className=p.className(n));var h={};if(n){for(var v=!1,g=[],b=0,x=Object.entries(n);b<x.length;b++){var y=x[b],w=y[1];"boolean"==typeof w&&(v=!0),!0===w&&g.push(y[0])}v&&(h["data-headlessui-state"]=g.join(" "))}if(s===t.Fragment&&Object.keys(Ts(p)).length>0){if(!t.isValidElement(m)||Array.isArray(m)&&m.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+i+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(p).map((function(e){return" - "+e})).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((function(e){return" - "+e})).join("\n")].join("\n"));return t.cloneElement(m,Object.assign({},Ss(m.props,Ts(As(p,["ref"]))),h,f,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return{ref:t.every((function(e){return null==e}))?void 0:function(e){for(var n,r=te(t);!(n=r()).done;){var i=n.value;null!=i&&("function"==typeof i?i(e):i.current=e)}}}}(m.ref,f.ref)))}return t.createElement(s,Object.assign({},As(p,["ref"]),s!==t.Fragment&&f,s!==t.Fragment&&h),m)}function Ss(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)return{};if(1===t.length)return t[0];for(var r={},i={},o=0,a=t;o<a.length;o++){var l=a[o];for(var s in l)s.startsWith("on")&&"function"==typeof l[s]?(null!=i[s]||(i[s]=[]),i[s].push(l[s])):r[s]=l[s]}if(r.disabled||r["aria-disabled"])return Object.assign(r,Object.fromEntries(Object.keys(i).map((function(e){return[e,void 0]}))));var u=function(e){var t;Object.assign(r,((t={})[e]=function(t){for(var n=i[e],r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];for(var l,s=te(n);!(l=s()).done;){var u=l.value;if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;u.apply(void 0,[t].concat(o))}},t))};for(var d in i)u(d);return r}function ks(e){var n;return Object.assign(t.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function Ts(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}function As(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),i=te(t);!(n=i()).done;){var o=n.value;o in r&&delete r[o]}return r}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(bs||(bs={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(xs||(xs={}));var Ds="undefined"==typeof window||"undefined"==typeof document,Is=Ds?t.useEffect:t.useLayoutEffect;function Ps(e){var n=t.useRef(e);return Is((function(){n.current=e}),[e]),n}var _s,Es=function(e){var t=Ps(e);return n.useCallback((function(){return t.current.apply(t,arguments)}),[t])},Os=Symbol();function Ls(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=t.useRef(n);t.useEffect((function(){i.current=n}),[n]);var o=Es((function(e){for(var t,n=te(i.current);!(t=n()).done;){var r=t.value;null!=r&&("function"==typeof r?r(e):r.current=e)}}));return n.every((function(e){return null==e||(null==e?void 0:e[Os])}))?void 0:o}!function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(_s||(_s={}));var Ms,Rs={serverHandoffComplete:!1};function Ns(){var e=t.useState(Rs.serverHandoffComplete),n=e[0],r=e[1];return t.useEffect((function(){!0!==n&&r(!0)}),[n]),t.useEffect((function(){!1===Rs.serverHandoffComplete&&(Rs.serverHandoffComplete=!0)}),[]),n}var zs=0;function Bs(){return++zs}var qs,Vs=null!=(Ms=n.useId)?Ms:function(){var e=Ns(),t=n.useState(e?Bs:null),r=t[0],i=t[1];return Is((function(){null===r&&i(Bs())}),[r]),null!=r?""+r:void 0},Hs=["features"];!function(e){e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden"}(qs||(qs={}));var Ws=ks((function(e,t){var n=e.features,r=void 0===n?qs.None:n,i=$(e,Hs);return js({ourProps:{ref:t,"aria-hidden":(r&qs.Focusable)===qs.Focusable||void 0,style:U({position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},(r&qs.Hidden)===qs.Hidden&&!((r&qs.Focusable)===qs.Focusable)&&{display:"none"})},theirProps:i,slot:{},defaultTag:"div",name:"Hidden"})}));function Ys(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((function(e){return setTimeout((function(){throw e}))}))}function Us(){var e=[],t=[],n={enqueue:function(e){t.push(e)},addEventListener:function(e,t,r,i){return e.addEventListener(t,r,i),n.add((function(){return e.removeEventListener(t,r,i)}))},requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);return n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.requestAnimationFrame((function(){return n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);return n.add((function(){return clearTimeout(e)}))})),microTask:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i={current:!0};return Ys((function(){i.current&&t[0]()})),n.add((function(){i.current=!1}))},add:function(t){return e.push(t),function(){var n=e.indexOf(t);n>=0&&(0,e.splice(n,1)[0])()}},dispose:function(){for(var t,n=te(e.splice(0));!(t=n()).done;)(0,t.value)()},workQueue:function(){return Y(H().mark((function e(){var n,r,i;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=te(t.splice(0));case 1:if((r=n()).done){e.next=7;break}return i=r.value,e.next=5,i();case 5:e.next=1;break;case 7:case"end":return e.stop()}}),e)})))()}};return n}function Gs(e){return Ds?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}var Ks,Xs,Qs,Js,Zs=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function $s(e){null==e||e.focus({preventScroll:!0})}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(Ks||(Ks={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(Xs||(Xs={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(Qs||(Qs={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(Js||(Js={}));var eu,tu=["textarea","input"].join(",");function nu(e,t){return void 0===t&&(t=function(e){return e}),e.slice().sort((function(e,n){var r=t(e),i=t(n);if(null===r||null===i)return 0;var o=r.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function ru(e,t,n,r){var i;void 0===n&&(n=!0),void 0===r&&(r=null);var o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?nu(e):e:function(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(Zs))}(e);r=null!=(i=r)?i:o.activeElement;var l,s,u=function(){if(t&(Ks.First|Ks.Next))return Qs.Next;if(t&(Ks.Previous|Ks.Last))return Qs.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),d=function(){if(t&Ks.First)return 0;if(t&Ks.Previous)return Math.max(0,a.indexOf(r))-1;if(t&Ks.Next)return Math.max(0,a.indexOf(r))+1;if(t&Ks.Last)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),c=t&Ks.NoScroll?{preventScroll:!0}:{},p=0,f=a.length,m=void 0;do{var h;if(p>=f||p+f<=0)return Xs.Error;var v=d+p;if(t&Ks.WrapAround)v=(v+f)%f;else{if(v<0)return Xs.Underflow;if(v>=f)return Xs.Overflow}null==(h=m=a[v])||h.focus(c),p+=u}while(m!==o.activeElement);return t&(Ks.Next|Ks.Previous)&&null!=(s=null==(l=m)||null==l.matches?void 0:l.matches(tu))&&s&&m.select(),m.hasAttribute("tabindex")||m.setAttribute("tabindex","0"),Xs.Success}function iu(){var e=t.useRef(!1);return Is((function(){return e.current=!0,function(){e.current=!1}}),[]),e}function ou(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useMemo((function(){return Gs.apply(void 0,n)}),[].concat(n))}function au(e,n,r,i){var o=Ps(r);t.useEffect((function(){var t;function r(e){o.current(e)}return(e=null!=(t=e)?t:window).addEventListener(n,r,i),function(){return e.removeEventListener(n,r,i)}}),[e,n,i])}function lu(e,n){var r=t.useRef([]),i=Es(e);t.useEffect((function(){for(var e,t=[].concat(r.current),o=te(n.entries());!(e=o()).done;){var a=e.value;if(r.current[a[0]]!==a[1]){var l=i(n,t);return r.current=n,l}}}),[i].concat(n))}!function(e){e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards"}(eu||(eu={}));var su,uu=["initialFocus","containers","features"];!function(e){e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All"}(su||(su={}));var du=Object.assign(ks((function(e,n){var r=t.useRef(null),i=Ls(r,n),o=e.initialFocus,a=e.containers,l=e.features,s=void 0===l?su.All:l,u=$(e,uu);Ns()||(s=su.None);var d=ou(r);!function(e,n){var r=e.ownerDocument,i=t.useRef(null);au(null==r?void 0:r.defaultView,"focusout",(function(e){n&&(i.current||(i.current=e.target))}),!0),lu((function(){n||((null==r?void 0:r.activeElement)===(null==r?void 0:r.body)&&$s(i.current),i.current=null)}),[n]);var o=t.useRef(!1);t.useEffect((function(){return o.current=!1,function(){o.current=!0,Ys((function(){o.current&&($s(i.current),i.current=null)}))}}),[])}({ownerDocument:d},Boolean(s&su.RestoreFocus));var p=function(e,n){var r=e.ownerDocument,i=e.container,o=e.initialFocus,a=t.useRef(null),l=iu();return lu((function(){if(n){var e=i.current;e&&Ys((function(){if(l.current){var t=null==r?void 0:r.activeElement;if(null!=o&&o.current){if((null==o?void 0:o.current)===t)return void(a.current=t)}else if(e.contains(t))return void(a.current=t);null!=o&&o.current?$s(o.current):ru(e,Ks.First)===Xs.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),a.current=null==r?void 0:r.activeElement}}))}}),[n]),a}({ownerDocument:d,container:r,initialFocus:o},Boolean(s&su.InitialFocus));!function(e,t){var n=e.ownerDocument,r=e.container,i=e.containers,o=e.previousActiveElement,a=iu();au(null==n?void 0:n.defaultView,"focus",(function(e){if(t&&a.current){var n=new Set(null==i?void 0:i.current);n.add(r);var l=o.current;if(l){var s=e.target;s&&s instanceof HTMLElement?function(e,t){for(var n,r=te(e);!(n=r()).done;){var i;if(null!=(i=n.value.current)&&i.contains(t))return!0}return!1}(n,s)?(o.current=s,$s(s)):(e.preventDefault(),e.stopPropagation(),$s(l)):$s(o.current)}}}),!0)}({ownerDocument:d,container:r,containers:a,previousActiveElement:p},Boolean(s&su.FocusLock));var f=function(){var e,n=t.useRef(eu.Forwards);return e=Ps((function(e){"Tab"===e.key&&(n.current=e.shiftKey?eu.Backwards:eu.Forwards)})),t.useEffect((function(){function t(t){e.current(t)}return window.addEventListener("keydown",t,!0),function(){return window.removeEventListener("keydown",t,!0)}}),["keydown",!0]),n}(),m=Es((function(){var e,t=r.current;t&&gs(f.current,((e={})[eu.Forwards]=function(){return ru(t,Ks.First)},e[eu.Backwards]=function(){return ru(t,Ks.Last)},e))})),h={ref:i};return c.jsxs(c.Fragment,{children:[Boolean(s&su.TabLock)&&c.jsx(Ws,{as:"button",type:"button",onFocus:m,features:qs.Focusable}),js({ourProps:h,theirProps:u,defaultTag:"div",name:"FocusTrap"}),Boolean(s&su.TabLock)&&c.jsx(Ws,{as:"button",type:"button",onFocus:m,features:qs.Focusable})]})})),{features:su}),cu=new Set,pu=new Map;function fu(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function mu(e){var t=pu.get(e);t&&(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}var hu=["target"],vu="headlessui-portal-root",gu=t.Fragment,bu=ks((function(e,n){var r,i,o=e,a=t.useRef(null),l=Ls((void 0===r&&(r=!0),Object.assign((function(e){a.current=e}),((i={})[Os]=r,i))),n),s=ou(a),u=function(e){var n=t.useContext(hs),r=t.useContext(yu),i=ou(e),o=t.useState((function(){if(!n&&null!==r)return null;if(Ds)return null;var e=null==i?void 0:i.getElementById(vu);if(e)return e;if(null===i)return null;var t=i.createElement("div");return t.setAttribute("id",vu),t.setAttribute("data-testid",vu),i.body.appendChild(t)})),a=o[0],l=o[1];return t.useEffect((function(){null!==a&&(null!=i&&i.body.contains(a)||null==i||i.body.appendChild(a))}),[a,i]),t.useEffect((function(){n||null!==r&&l(r.current)}),[r,l,n]),a}(a),d=t.useState((function(){var e;return Ds?null:null!=(e=null==s?void 0:s.createElement("div"))?e:null}))[0],c=Ns(),p=t.useRef(!1);return Is((function(){if(p.current=!1,u&&d)return u.contains(d)||(d.setAttribute("data-headlessui-portal",""),u.appendChild(d)),function(){p.current=!0,Ys((function(){var e;p.current&&u&&d&&(u.removeChild(d),u.childNodes.length<=0&&(null==(e=u.parentElement)||e.removeChild(u)))}))}}),[u,d]),c&&u&&d?m.createPortal(js({ourProps:{ref:l},theirProps:o,defaultTag:gu,name:"Portal"}),d):null})),xu=t.Fragment,yu=t.createContext(null),wu=Object.assign(bu,{Group:ks((function(e,t){var n=e.target,r=$(e,hu),i=Ls(t);return c.jsx(yu.Provider,{value:n,children:js({ourProps:{ref:i},theirProps:r,defaultTag:xu,name:"Popover.Group"})})}))}),Cu=t.createContext(null);function ju(){var e=t.useContext(Cu);if(null===e){var n=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,ju),n}return e}var Fu,Su=ks((function(e,t){var n=ju(),r="headlessui-description-"+Vs(),i=Ls(t);Is((function(){return n.register(r)}),[r,n.register]);var o=e;return js({ourProps:U({ref:i},n.props,{id:r}),theirProps:o,slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})})),ku=t.createContext(null);function Tu(){return t.useContext(ku)}function Au(e){return c.jsx(ku.Provider,{value:e.value,children:e.children})}ku.displayName="OpenClosedContext",function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Fu||(Fu={}));var Du,Iu=t.createContext((function(){}));function Pu(e){var n=e.children,r=e.onUpdate,i=e.type,o=e.element,a=e.enabled,l=t.useContext(Iu),s=Es((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];null==r||r.apply(void 0,t),l.apply(void 0,t)}));return Is((function(){var e=void 0===a||!0===a;return e&&s(Du.Add,i,o),function(){e&&s(Du.Remove,i,o)}}),[s,i,o,a]),c.jsx(Iu.Provider,{value:s,children:n})}function _u(e,n,r){var i=Ps(n);t.useEffect((function(){function t(e){i.current(e)}return document.addEventListener(e,t,r),function(){return document.removeEventListener(e,t,r)}}),[e,r])}Iu.displayName="StackContext",function(e){e[e.Add=0]="Add",e[e.Remove=1]="Remove"}(Du||(Du={}));var Eu,Ou,Lu,Mu=["open","onClose","initialFocus","__demoMode"];!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Ou||(Ou={})),function(e){e[e.SetTitleId=0]="SetTitleId"}(Lu||(Lu={}));var Ru=((Eu={})[Lu.SetTitleId]=function(e,t){return e.titleId===t.id?e:U({},e,{titleId:t.id})},Eu),Nu=t.createContext(null);function zu(e){var n=t.useContext(Nu);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Dialog /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,zu),r}return n}function Bu(e,t){return gs(t.type,Ru,e,t)}Nu.displayName="DialogContext";var qu,Vu,Hu,Wu,Yu,Uu,Gu=bs.RenderStrategy|bs.Static,Ku=ks((function(e,n){var r,i=e.open,o=e.onClose,a=e.initialFocus,l=e.__demoMode,s=void 0!==l&&l,u=$(e,Mu),d=t.useState(0),p=d[0],f=d[1],m=Tu();void 0===i&&null!==m&&(i=gs(m,((r={})[Fu.Open]=!0,r[Fu.Closed]=!1,r)));var h=t.useRef(new Set),v=t.useRef(null),g=Ls(v,n),b=t.useRef(null),x=ou(v),y=e.hasOwnProperty("open")||null!==m,w=e.hasOwnProperty("onClose");if(!y&&!w)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!y)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!w)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof i)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+i);if("function"!=typeof o)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+o);var C=i?Ou.Open:Ou.Closed,j=t.useReducer(Bu,{titleId:null,descriptionId:null,panelRef:t.createRef()}),F=j[0],S=j[1],k=Es((function(){return o(!1)})),T=Es((function(e){return S({type:Lu.SetTitleId,id:e})})),A=!!Ns()&&!s&&C===Ou.Open,D=p>1,I=null!==t.useContext(Nu),P=D?"parent":"leaf";!function(e,t){void 0===t&&(t=!0),Is((function(){if(t&&e.current){var n=e.current,r=Gs(n);if(r){cu.add(n);for(var i,o=te(pu.keys());!(i=o()).done;){var a=i.value;a.contains(n)&&(mu(a),pu.delete(a))}return r.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var t,n=te(cu);!(t=n()).done;)if(e.contains(t.value))return;1===cu.size&&(pu.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),fu(e))}})),function(){if(cu.delete(n),cu.size>0)r.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!pu.has(e)){for(var t,n=te(cu);!(t=n()).done;)if(e.contains(t.value))return;pu.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),fu(e)}}));else for(var e,t=te(pu.keys());!(e=t()).done;){var i=e.value;mu(i),pu.delete(i)}}}}}),[t])}(v,!!D&&A),function(e,n,r){void 0===r&&(r=!0);var i=t.useRef(!1);function o(t,r){if(i.current&&!t.defaultPrevented){var o=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e),a=r(t);if(null!==a&&a.getRootNode().contains(a)){for(var l,s=te(o);!(l=s()).done;){var u=l.value;if(null!==u){var d=u instanceof HTMLElement?u:u.current;if(null!=d&&d.contains(a))return}}var c,p,f,m;return void 0===(p=Js.Loose)&&(p=Js.Strict),(c=a)!==(null==(f=Gs(c))?void 0:f.body)&&gs(p,((m={})[Js.Strict]=function(){return c.matches(Zs)},m[Js.Loose]=function(){for(var e=c;null!==e;){if(e.matches(Zs))return!0;e=e.parentElement}return!1},m))||-1===a.tabIndex||t.preventDefault(),n(t,a)}}}t.useEffect((function(){requestAnimationFrame((function(){i.current=r}))}),[r]);var a=t.useRef(null);_u("mousedown",(function(e){var t;i.current&&(a.current=(null==e.composedPath||null==(t=e.composedPath())?void 0:t[0])||e.target)}),!0),_u("click",(function(e){a.current&&(o(e,(function(){return a.current})),a.current=null)}),!0),_u("blur",(function(e){return o(e,(function(){return window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null}))}),!0)}((function(){var e,t,n=Array.from(null!=(e=null==x?void 0:x.querySelectorAll("body > *, [data-headlessui-portal]"))?e:[]).filter((function(e){return e instanceof HTMLElement&&!e.contains(b.current)&&(!F.panelRef.current||!e.contains(F.panelRef.current))}));return[].concat(n,[null!=(t=F.panelRef.current)?t:v.current])}),k,A&&!D),au(null==x?void 0:x.defaultView,"keydown",(function(e){e.defaultPrevented||e.key===_s.Escape&&C===Ou.Open&&(D||(e.preventDefault(),e.stopPropagation(),k()))})),function(e,n){t.useEffect((function(){var t;if(n&&e){var r=Us(),i=e.documentElement,o=(null!=(t=e.defaultView)?t:window).innerWidth-i.clientWidth;if(l(i,"overflow","hidden"),o>0&&l(i,"paddingRight",o-(i.clientWidth-i.offsetWidth)+"px"),/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0){var a=window.pageYOffset;l(i,"position","fixed"),l(i,"marginTop","-"+a+"px"),l(i,"width","100%"),r.add((function(){return window.scrollTo(0,a)}))}return r.dispose}function l(e,t,n){var i,o=e.style.getPropertyValue(t);return Object.assign(e.style,((i={})[t]=n,i)),r.add((function(){var n;Object.assign(e.style,((n={})[t]=o,n))}))}}),[e,n])}(x,C===Ou.Open&&!I),t.useEffect((function(){if(C===Ou.Open&&v.current){var e=new IntersectionObserver((function(e){for(var t,n=te(e);!(t=n()).done;){var r=t.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&k()}}));return e.observe(v.current),function(){return e.disconnect()}}}),[C,v,k]);var _=function(){var e=t.useState([]),n=e[0],r=e[1];return[n.length>0?n.join(" "):void 0,t.useMemo((function(){return function(e){var n=Es((function(e){return r((function(t){return[].concat(t,[e])})),function(){return r((function(t){var n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))}})),i=t.useMemo((function(){return{register:n,slot:e.slot,name:e.name,props:e.props}}),[n,e.slot,e.name,e.props]);return c.jsx(Cu.Provider,{value:i,children:e.children})}}),[r])]}(),E=_[0],O=_[1],L="headlessui-dialog-"+Vs(),M=t.useMemo((function(){return[{dialogState:C,close:k,setTitleId:T},F]}),[C,F,k,T]),R=t.useMemo((function(){return{open:C===Ou.Open}}),[C]),N={ref:g,id:L,role:"dialog","aria-modal":C===Ou.Open||void 0,"aria-labelledby":F.titleId,"aria-describedby":E};return c.jsxs(Pu,{type:"Dialog",enabled:C===Ou.Open,element:v,onUpdate:Es((function(e,t,n){var r;"Dialog"===t&&gs(e,((r={})[Du.Add]=function(){h.current.add(n),f((function(e){return e+1}))},r[Du.Remove]=function(){h.current.add(n),f((function(e){return e-1}))},r))})),children:[c.jsx(vs,{force:!0,children:c.jsx(wu,{children:c.jsx(Nu.Provider,{value:M,children:c.jsx(wu.Group,{target:v,children:c.jsx(vs,{force:!1,children:c.jsx(O,{slot:R,name:"Dialog.Description",children:c.jsx(du,{initialFocus:a,containers:h,features:A?gs(P,{parent:du.features.RestoreFocus,leaf:du.features.All&~du.features.FocusLock}):du.features.None,children:js({ourProps:N,theirProps:u,slot:R,defaultTag:"div",features:Gu,visible:C===Ou.Open,name:"Dialog"})})})})})})})}),c.jsx(Ws,{features:qs.Hidden,ref:b})]})})),Xu=ks((function(e,n){var r=zu("Dialog.Overlay")[0],i=r.dialogState,o=r.close;return js({ourProps:{ref:Ls(n),id:"headlessui-dialog-overlay-"+Vs(),"aria-hidden":!0,onClick:Es((function(e){if(e.target===e.currentTarget){if(function(e){for(var t,n,r=e.parentElement,i=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(i=r),r=r.parentElement;var o=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!o||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(i))&&o}(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),o()}}))},theirProps:e,slot:t.useMemo((function(){return{open:i===Ou.Open}}),[i]),defaultTag:"div",name:"Dialog.Overlay"})})),Qu=Object.assign(Ku,{Backdrop:ks((function(e,n){var r=zu("Dialog.Backdrop"),i=r[0].dialogState,o=r[1],a=Ls(n),l="headlessui-dialog-backdrop-"+Vs();t.useEffect((function(){if(null===o.panelRef.current)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")}),[o.panelRef]);var s=t.useMemo((function(){return{open:i===Ou.Open}}),[i]);return c.jsx(vs,{force:!0,children:c.jsx(wu,{children:js({ourProps:{ref:a,id:l,"aria-hidden":!0},theirProps:e,slot:s,defaultTag:"div",name:"Dialog.Backdrop"})})})})),Panel:ks((function(e,n){var r=zu("Dialog.Panel"),i=r[0].dialogState,o=Ls(n,r[1].panelRef),a="headlessui-dialog-panel-"+Vs(),l=t.useMemo((function(){return{open:i===Ou.Open}}),[i]);return js({ourProps:{ref:o,id:a,onClick:Es((function(e){e.stopPropagation()}))},theirProps:e,slot:l,defaultTag:"div",name:"Dialog.Panel"})})),Overlay:Xu,Title:ks((function(e,n){var r=zu("Dialog.Title")[0],i=r.dialogState,o=r.setTitleId,a="headlessui-dialog-title-"+Vs(),l=Ls(n);t.useEffect((function(){return o(a),function(){return o(null)}}),[a,o]);var s=t.useMemo((function(){return{open:i===Ou.Open}}),[i]);return js({ourProps:{ref:l,id:a},theirProps:e,slot:s,defaultTag:"h2",name:"Dialog.Title"})})),Description:Su});function Ju(e){var t;if(e.type)return e.type;var n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function Zu(e,n){var r=t.useState((function(){return Ju(e)})),i=r[0],o=r[1];return Is((function(){o(Ju(e))}),[e.type,e.as]),Is((function(){i||n.current&&n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")}),[i,n]),i}function $u(e){var n=e.onFocus,r=t.useState(!0),i=r[1];return r[0]?c.jsx(Ws,{as:"button",type:"button",features:qs.Focusable,onFocus:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){var t;e.preventDefault();var r=50;t=requestAnimationFrame((function e(){if(!(r--<=0))return n()?(i(!1),void cancelAnimationFrame(t)):void(t=requestAnimationFrame(e));t&&cancelAnimationFrame(t)}))}))}):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Vu||(Vu={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.LinkPanel=4]="LinkPanel",e[e.UnlinkPanel=5]="UnlinkPanel"}(Hu||(Hu={})),(qu={})[Hu.ToggleDisclosure]=function(e){var t;return U({},e,{disclosureState:gs(e.disclosureState,(t={},t[Vu.Open]=Vu.Closed,t[Vu.Closed]=Vu.Open,t))})},qu[Hu.CloseDisclosure]=function(e){return e.disclosureState===Vu.Closed?e:U({},e,{disclosureState:Vu.Closed})},qu[Hu.LinkPanel]=function(e){return!0===e.linkedPanel?e:U({},e,{linkedPanel:!0})},qu[Hu.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:U({},e,{linkedPanel:!1})},qu[Hu.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:U({},e,{buttonId:t.buttonId})},qu[Hu.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:U({},e,{panelId:t.panelId})},t.createContext(null).displayName="DisclosureContext",t.createContext(null).displayName="DisclosureAPIContext",t.createContext(null).displayName="DisclosurePanelContext",function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Yu||(Yu={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(Uu||(Uu={})),(Wu={})[Uu.TogglePopover]=function(e){var t;return U({},e,{popoverState:gs(e.popoverState,(t={},t[Yu.Open]=Yu.Closed,t[Yu.Closed]=Yu.Open,t))})},Wu[Uu.ClosePopover]=function(e){return e.popoverState===Yu.Closed?e:U({},e,{popoverState:Yu.Closed})},Wu[Uu.SetButton]=function(e,t){return e.button===t.button?e:U({},e,{button:t.button})},Wu[Uu.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:U({},e,{buttonId:t.buttonId})},Wu[Uu.SetPanel]=function(e,t){return e.panel===t.panel?e:U({},e,{panel:t.panel})},Wu[Uu.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:U({},e,{panelId:t.panelId})},t.createContext(null).displayName="PopoverContext",t.createContext(null).displayName="PopoverAPIContext",t.createContext(null).displayName="PopoverGroupContext",t.createContext(null).displayName="PopoverPanelContext",t.createContext(null).displayName="GroupContext";var ed,td,nd=["defaultIndex","vertical","manual","onChange","selectedIndex"];!function(e){e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel"}(td||(td={}));var rd=((ed={})[td.SetSelectedIndex]=function(e,t){var n=e.tabs.filter((function(e){var t;return!(null!=(t=e.current)&&t.hasAttribute("disabled"))}));if(t.index<0)return U({},e,{selectedIndex:e.tabs.indexOf(n[0])});if(t.index>e.tabs.length)return U({},e,{selectedIndex:e.tabs.indexOf(n[n.length-1])});var r=e.tabs.slice(0,t.index),i=e.tabs.slice(t.index),o=[].concat(i,r).find((function(e){return n.includes(e)}));return o?U({},e,{selectedIndex:e.tabs.indexOf(o)}):e},ed[td.RegisterTab]=function(e,t){var n;if(e.tabs.includes(t.tab))return e;var r=e.tabs[e.selectedIndex],i=nu([].concat(e.tabs,[t.tab]),(function(e){return e.current})),o=null!=(n=i.indexOf(r))?n:e.selectedIndex;return-1===o&&(o=e.selectedIndex),U({},e,{tabs:i,selectedIndex:o})},ed[td.UnregisterTab]=function(e,t){return U({},e,{tabs:e.tabs.filter((function(e){return e!==t.tab}))})},ed[td.RegisterPanel]=function(e,t){return e.panels.includes(t.panel)?e:U({},e,{panels:nu([].concat(e.panels,[t.panel]),(function(e){return e.current}))})},ed[td.UnregisterPanel]=function(e,t){return U({},e,{panels:e.panels.filter((function(e){return e!==t.panel}))})},ed),id=t.createContext(null);function od(e){var n=t.useContext(id);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,od),r}return n}id.displayName="TabsSSRContext";var ad=t.createContext(null);function ld(e){var n=t.useContext(ad);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,ld),r}return n}ad.displayName="TabsDataContext";var sd=t.createContext(null);function ud(e){var n=t.useContext(sd);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,ud),r}return n}function dd(e,t){return gs(t.type,rd,e,t)}sd.displayName="TabsActionsContext";var cd,pd=t.Fragment,fd=ks((function(e,n){var r=e.defaultIndex,i=void 0===r?0:r,o=e.vertical,a=void 0!==o&&o,l=e.manual,s=void 0!==l&&l,u=e.onChange,d=e.selectedIndex,p=void 0===d?null:d,f=$(e,nd),m=a?"vertical":"horizontal",h=s?"manual":"auto",v=null!==p,g=Ls(n),b=t.useReducer(dd,{selectedIndex:null!=p?p:i,tabs:[],panels:[]}),x=b[0],y=b[1],w=t.useMemo((function(){return{selectedIndex:x.selectedIndex}}),[x.selectedIndex]),C=Ps(u||function(){}),j=Ps(x.tabs),F=t.useMemo((function(){return U({orientation:m,activation:h},x)}),[m,h,x]),S=Ps(v?e.selectedIndex:x.selectedIndex),k=t.useMemo((function(){return{registerTab:function(e){return y({type:td.RegisterTab,tab:e}),function(){return y({type:td.UnregisterTab,tab:e})}},registerPanel:function(e){return y({type:td.RegisterPanel,panel:e}),function(){return y({type:td.UnregisterPanel,panel:e})}},change:function(e){S.current!==e&&C.current(e),v||y({type:td.SetSelectedIndex,index:e})}}}),[y,v]);Is((function(){y({type:td.SetSelectedIndex,index:null!=p?p:i})}),[p]);var T=t.useRef({tabs:[],panels:[]}),A={ref:g};return c.jsx(id.Provider,{value:T,children:c.jsx(sd.Provider,{value:k,children:c.jsxs(ad.Provider,{value:F,children:[F.tabs.length<=0&&c.jsx($u,{onFocus:function(){for(var e,t=te(j.current);!(e=t()).done;){var n,r,i=e.value;if(0===(null==(n=i.current)?void 0:n.tabIndex))return null==(r=i.current)||r.focus(),!0}return!1}}),js({ourProps:A,theirProps:f,slot:w,defaultTag:pd,name:"Tabs"})]})})})})),md=ks((function(e,t){var n=ld("Tab.List"),r=n.orientation,i=n.selectedIndex;return js({ourProps:{ref:Ls(t),role:"tablist","aria-orientation":r},theirProps:e,slot:{selectedIndex:i},defaultTag:"div",name:"Tabs.List"})})),hd=bs.RenderStrategy|bs.Static,vd=Object.assign(ks((function(e,n){var r,i,o="headlessui-tabs-tab-"+Vs(),a=ld("Tab"),l=a.orientation,s=a.activation,u=a.selectedIndex,d=a.tabs,c=a.panels,p=ud("Tab"),f=ld("Tab"),m=od("Tab"),h=t.useRef(null),v=Ls(h,n);Is((function(){return p.registerTab(h)}),[p,h]);var g=m.current.tabs.indexOf(o);-1===g&&(g=m.current.tabs.push(o)-1);var b=d.indexOf(h);-1===b&&(b=g);var x=b===u,y=Es((function(e){var t=e();if(t===Xs.Success&&"auto"===s){var n,r=null==(n=Gs(h))?void 0:n.activeElement,i=f.tabs.findIndex((function(e){return e.current===r}));-1!==i&&p.change(i)}return t})),w=Es((function(e){var t=d.map((function(e){return e.current})).filter(Boolean);if(e.key===_s.Space||e.key===_s.Enter)return e.preventDefault(),e.stopPropagation(),void p.change(b);switch(e.key){case _s.Home:case _s.PageUp:return e.preventDefault(),e.stopPropagation(),y((function(){return ru(t,Ks.First)}));case _s.End:case _s.PageDown:return e.preventDefault(),e.stopPropagation(),y((function(){return ru(t,Ks.Last)}))}return y((function(){return gs(l,{vertical:function(){return e.key===_s.ArrowUp?ru(t,Ks.Previous|Ks.WrapAround):e.key===_s.ArrowDown?ru(t,Ks.Next|Ks.WrapAround):Xs.Error},horizontal:function(){return e.key===_s.ArrowLeft?ru(t,Ks.Previous|Ks.WrapAround):e.key===_s.ArrowRight?ru(t,Ks.Next|Ks.WrapAround):Xs.Error}})}))===Xs.Success?e.preventDefault():void 0})),C=t.useRef(!1),j=Es((function(){var e;C.current||(C.current=!0,null==(e=h.current)||e.focus(),p.change(b),Ys((function(){C.current=!1})))})),F=Es((function(e){e.preventDefault()})),S=t.useMemo((function(){return{selected:x}}),[x]),k=e;return js({ourProps:{ref:v,onKeyDown:w,onMouseDown:F,onClick:j,id:o,role:"tab",type:Zu(e,h),"aria-controls":null==(r=c[b])||null==(i=r.current)?void 0:i.id,"aria-selected":x,tabIndex:x?0:-1},theirProps:k,slot:S,defaultTag:"button",name:"Tabs.Tab"})})),{Group:fd,List:md,Panels:ks((function(e,n){var r=ld("Tab.Panels").selectedIndex;return js({ourProps:{ref:Ls(n)},theirProps:e,slot:t.useMemo((function(){return{selectedIndex:r}}),[r]),defaultTag:"div",name:"Tabs.Panels"})})),Panel:ks((function(e,n){var r,i,o,a,l=ld("Tab.Panel"),s=l.selectedIndex,u=l.tabs,d=l.panels,p=ud("Tab.Panel"),f=od("Tab.Panel"),m="headlessui-tabs-panel-"+Vs(),h=t.useRef(null),v=Ls(h,n);Is((function(){return p.registerPanel(h)}),[p,h]);var g=f.current.panels.indexOf(m);-1===g&&(g=f.current.panels.push(m)-1);var b=d.indexOf(h);-1===b&&(b=g);var x=b===s,y=t.useMemo((function(){return{selected:x}}),[x]),w={ref:v,id:m,role:"tabpanel","aria-labelledby":null==(r=u[b])||null==(i=r.current)?void 0:i.id,tabIndex:x?0:-1};return x||null!=(o=e.unmount)&&!o||null!=(a=e.static)&&a?js({ourProps:w,theirProps:e,slot:y,defaultTag:"div",features:hd,visible:x,name:"Tabs.Panel"}):c.jsx(Ws,U({as:"span"},w))}))});function gd(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function bd(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function xd(){var e=t.useState(Us)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}!function(e){e.Ended="ended",e.Cancelled="cancelled"}(cd||(cd={}));var yd=["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"],wd=["show","appear","unmount"];function Cd(e){return void 0===e&&(e=""),e.split(" ").filter((function(e){return e.trim().length>1}))}var jd,Fd=t.createContext(null);Fd.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(jd||(jd={}));var Sd=t.createContext(null);function kd(e){return"children"in e?kd(e.children):e.current.filter((function(e){return null!==e.el.current})).filter((function(e){return e.state===jd.Visible})).length>0}function Td(e,n){var r=Ps(e),i=t.useRef([]),o=iu(),a=xd(),l=Es((function(e,t){var n;void 0===t&&(t=xs.Hidden);var l=i.current.findIndex((function(t){return t.el===e}));-1!==l&&(gs(t,((n={})[xs.Unmount]=function(){i.current.splice(l,1)},n[xs.Hidden]=function(){i.current[l].state=jd.Hidden},n)),a.microTask((function(){!kd(i)&&o.current&&(null==r.current||r.current())})))})),s=Es((function(e){var t=i.current.find((function(t){return t.el===e}));return t?t.state!==jd.Visible&&(t.state=jd.Visible):i.current.push({el:e,state:jd.Visible}),function(){return l(e,xs.Unmount)}})),u=t.useRef([]),d=t.useRef(Promise.resolve()),c=t.useRef({enter:[],leave:[],idle:[]}),p=Es((function(e,t,r){u.current.splice(0),n&&(n.chains.current[t]=n.chains.current[t].filter((function(t){return t[0]!==e}))),null==n||n.chains.current[t].push([e,new Promise((function(e){u.current.push(e)}))]),null==n||n.chains.current[t].push([e,new Promise((function(e){Promise.all(c.current[t].map((function(e){return e[1]}))).then((function(){return e()}))}))]),"enter"===t?d.current=d.current.then((function(){return null==n?void 0:n.wait.current})).then((function(){return r(t)})):r(t)})),f=Es((function(e,t,n){Promise.all(c.current[t].splice(0).map((function(e){return e[1]}))).then((function(){var e;null==(e=u.current.shift())||e()})).then((function(){return n(t)}))}));return t.useMemo((function(){return{children:i,register:s,unregister:l,onStart:p,onStop:f,wait:d,chains:c}}),[s,l,i,p,f,c,d])}function Ad(){}Sd.displayName="NestingContext";var Dd=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Id(e){for(var t={},n=0,r=Dd;n<r.length;n++){var i,o=r[n];t[o]=null!=(i=e[o])?i:Ad}return t}var Pd=bs.RenderStrategy,_d=ks((function(e,n){var r,i=e.beforeEnter,o=e.afterEnter,a=e.beforeLeave,l=e.afterLeave,s=e.enter,u=e.enterFrom,d=e.enterTo,p=e.entered,f=e.leave,m=e.leaveFrom,h=e.leaveTo,v=$(e,yd),g=t.useRef(null),b=Ls(g,n),x=v.unmount?xs.Unmount:xs.Hidden,y=function(){var e=t.useContext(Fd);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),w=y.show,C=y.appear,j=y.initial,F=t.useState(w?jd.Visible:jd.Hidden),S=F[0],k=F[1],T=function(){var e=t.useContext(Sd);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),A=T.register,D=T.unregister,I=t.useRef(null);t.useEffect((function(){return A(g)}),[A,g]),t.useEffect((function(){var e;if(x===xs.Hidden&&g.current){if(!w||S===jd.Visible)return gs(S,((e={})[jd.Hidden]=function(){return D(g)},e[jd.Visible]=function(){return A(g)},e));k(jd.Visible)}}),[S,g,A,D,w,x]);var P=Ps({enter:Cd(s),enterFrom:Cd(u),enterTo:Cd(d),entered:Cd(p),leave:Cd(f),leaveFrom:Cd(m),leaveTo:Cd(h)}),_=function(e){var n=t.useRef(Id(e));return t.useEffect((function(){n.current=Id(e)}),[e]),n}({beforeEnter:i,afterEnter:o,beforeLeave:a,afterLeave:l}),E=Ns();t.useEffect((function(){if(E&&S===jd.Visible&&null===g.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[g,S,E]);var O=j&&!C,L=E?O||I.current===w?"idle":w?"enter":"leave":"idle",M=Es((function(e){return gs(e,{enter:function(){return _.current.beforeEnter()},leave:function(){return _.current.beforeLeave()},idle:function(){}})})),R=Es((function(e){return gs(e,{enter:function(){return _.current.afterEnter()},leave:function(){return _.current.afterLeave()},idle:function(){}})})),N=Td((function(){k(jd.Hidden),D(g)}),T);!function(e){var t=e.container,n=e.direction,r=e.classes,i=e.onStart,o=e.onStop,a=iu(),l=xd(),s=Ps(n);Is((function(){var e=Us();l.add(e.dispose);var n=t.current;if(n&&"idle"!==s.current&&a.current)return e.dispose(),i.current(s.current),e.add(function(e,t,n,r){var i=n?"enter":"leave",o=Us(),a=void 0!==r?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(r):function(){};"enter"===i&&(e.removeAttribute("hidden"),e.style.display="");var l=gs(i,{enter:function(){return t.enter},leave:function(){return t.leave}}),s=gs(i,{enter:function(){return t.enterTo},leave:function(){return t.leaveTo}}),u=gs(i,{enter:function(){return t.enterFrom},leave:function(){return t.leaveFrom}});return bd.apply(void 0,[e].concat(t.enter,t.enterTo,t.enterFrom,t.leave,t.leaveFrom,t.leaveTo,t.entered)),gd.apply(void 0,[e].concat(l,u)),o.nextFrame((function(){bd.apply(void 0,[e].concat(u)),gd.apply(void 0,[e].concat(s)),function(e,t){var n=Us();if(!e)return n.dispose;var r=getComputedStyle(e),i=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t}));if(0!==i[0]+i[1]){var o=[];o.push(n.addEventListener(e,"transitionrun",(function(r){r.target===r.currentTarget&&(o.splice(0).forEach((function(e){return e()})),o.push(n.addEventListener(e,"transitionend",(function(e){e.target===e.currentTarget&&(t(cd.Ended),o.splice(0).forEach((function(e){return e()})))})),n.addEventListener(e,"transitioncancel",(function(e){e.target===e.currentTarget&&(t(cd.Cancelled),o.splice(0).forEach((function(e){return e()})))}))))})))}else t(cd.Ended);n.add((function(){return t(cd.Cancelled)}))}(e,(function(n){return n===cd.Ended&&(bd.apply(void 0,[e].concat(l)),gd.apply(void 0,[e].concat(t.entered))),a(n)}))})),o.dispose}(n,r.current,"enter"===s.current,(function(t){var n;e.dispose(),gs(t,((n={})[cd.Ended]=function(){o.current(s.current)},n[cd.Cancelled]=function(){},n))}))),e.dispose}),[n])}({container:g,classes:P,direction:L,onStart:Ps((function(e){N.onStart(g,e,M)})),onStop:Ps((function(e){N.onStop(g,e,R),"leave"!==e||kd(N)||(k(jd.Hidden),D(g))}))}),t.useEffect((function(){O&&(I.current=x===xs.Hidden?null:w)}),[w,O,S]);var z=v,B={ref:b};return c.jsx(Sd.Provider,{value:N,children:c.jsx(Au,{value:gs(S,(r={},r[jd.Visible]=Fu.Open,r[jd.Hidden]=Fu.Closed,r)),children:js({ourProps:B,theirProps:z,defaultTag:"div",features:Pd,visible:S===jd.Visible,name:"Transition.Child"})})})})),Ed=ks((function(e,n){var r=e.show,i=e.appear,o=void 0!==i&&i,a=e.unmount,l=$(e,wd),s=t.useRef(null),u=Ls(s,n);Ns();var d,p=Tu();if(void 0===r&&null!==p&&(r=gs(p,((d={})[Fu.Open]=!0,d[Fu.Closed]=!1,d))),![!0,!1].includes(r))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var f=t.useState(r?jd.Visible:jd.Hidden),m=f[0],h=f[1],v=Td((function(){h(jd.Hidden)})),g=t.useState(!0),b=g[0],x=g[1],y=t.useRef([r]);Is((function(){!1!==b&&y.current[y.current.length-1]!==r&&(y.current.push(r),x(!1))}),[y,r]);var w=t.useMemo((function(){return{show:r,appear:o,initial:b}}),[r,o,b]);t.useEffect((function(){if(r)h(jd.Visible);else if(kd(v)){var e=s.current;if(!e)return;var t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&h(jd.Hidden)}else h(jd.Hidden)}),[r,v]);var C={unmount:a};return c.jsx(Sd.Provider,{value:v,children:c.jsx(Fd.Provider,{value:w,children:js({ourProps:U({},C,{as:t.Fragment,children:c.jsx(_d,U({ref:u},C,l))}),theirProps:{},defaultTag:t.Fragment,features:Pd,visible:m===jd.Visible,name:"Transition"})})})})),Od=Object.assign(Ed,{Child:ks((function(e,n){var r=null!==t.useContext(Fd),i=null!==Tu();return c.jsx(c.Fragment,{children:c.jsx(!r&&i?Ed:_d,U({ref:n},e))})})),Root:Ed}),Ld=function(e){var t,n,r,i,o,a,l,s;return ua(U({padding:null==e?void 0:e.padding,paddingTop:null!=(t=null==e?void 0:e.paddingTop)?t:null==e?void 0:e.paddingY,paddingLeft:null!=(n=null==e?void 0:e.paddingLeft)?n:null==e?void 0:e.paddingX,paddingRight:null!=(r=null==e?void 0:e.paddingRight)?r:null==e?void 0:e.paddingX,paddingBottom:null!=(i=null==e?void 0:e.paddingBottom)?i:null==e?void 0:e.paddingY,marginTop:null!=(o=null==e?void 0:e.marginTop)?o:null==e?void 0:e.marginY,marginBottom:null!=(a=null==e?void 0:e.marginBottom)?a:null==e?void 0:e.marginY,marginRight:null!=(l=null==e?void 0:e.marginRight)?l:null==e?void 0:e.marginX,marginLeft:null!=(s=null==e?void 0:e.marginLeft)?s:null==e?void 0:e.marginX,margin:null==e?void 0:e.margin,position:null==e?void 0:e.position,overflowX:null==e?void 0:e.overflowX,overflowY:null==e?void 0:e.overflowY,width:null==e?void 0:e.width,gridRow:null==e?void 0:e.gridRow,gridColumn:null==e?void 0:e.gridColumn,height:null==e?void 0:e.height,overflow:null==e?void 0:e.overflow,flex:null==e?void 0:e.flex,flexGrow:null==e?void 0:e.flexGrow,maxWidth:null==e?void 0:e.maxWidth,maxHeight:null==e?void 0:e.maxHeight,minHeight:null==e?void 0:e.minHeight,minWidth:null==e?void 0:e.minWidth,overflowWrap:null!=e&&e.textWrap?"break-word":void 0,wordWrap:null!=e&&e.textWrap?"break-word":void 0,wordBreak:null!=e&&e.textWrap?"break-word":void 0,hyphens:null!=e&&e.hyphens&&null!=e&&e.textWrap?"auto":void 0,alignSelf:null==e?void 0:e.alignSelf,border:null==e?void 0:e.border,textAlign:null==e?void 0:e.textAlign,display:null==e?void 0:e.display,listStyle:null==e?void 0:e.listStyle,right:null==e?void 0:e.right,top:null==e?void 0:e.top,left:null==e?void 0:e.left},function(e){var t={};return null!=e&&e.mdWidth&&(t=U({},t,{"@media (max-width: 1366px)":{width:null==e?void 0:e.mdWidth}})),null!=e&&e.smWidth&&(t=U({},t,{"@media (max-width: 920px)":{width:null==e?void 0:e.smWidth}})),t}(e)))},Md=function(e){var t,n,r,i,o,a,l=null!=(t=null==(n=e)?void 0:n.as)?t:"div";return"fieldset"===e.as&&(e=U({padding:0,border:0,marginY:0,marginX:0},e)),c.jsx(l,{className:rs(""+Ld(e),null==(r=e)?void 0:r.className),"data-component":null!=(i=null==(o=e)?void 0:o["data-component"])?i:"View",children:null==(a=e)?void 0:a.children})},Rd=function(e){var n=e.width,r=void 0===n?160:n,i=t.useRef(null);function o(){null==e||e.onClose()}ss(i,(function(){return null==e?void 0:e.onClose()})),t.useEffect((function(){return window.addEventListener("scroll",o),function(){return window.removeEventListener("scroll",o)}}),[]),t.useEffect((function(){return window.addEventListener("resize",o),function(){window.removeEventListener("resize",o)}}),[]);var a=us();return null!=e&&e.position?c.jsx(vs,{force:!0,children:c.jsx(wu,{children:c.jsx("div",{style:zd(r,null==e?void 0:e.position,null==e?void 0:e.align),"data-component":"popover-menu-container",ref:i,className:as.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})})}):c.jsx("div",{className:as.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})},Nd=Object.assign(Rd,{Options:function(e){return c.jsx(os,{rows:["auto"],gap:"0.5rem",children:c.jsx(Md,{paddingY:null!=e&&e.padding?"0.5rem":void 0,children:null==e?void 0:e.children})})},Option:function(e){var t=us();return c.jsx("li",{className:""+as.option(null==t?void 0:t.popoverMenu)({clickable:(null==e?void 0:e.onChange)&&"true"}),"data-testid":null==e?void 0:e.testId,onClick:function(){return(null==e?void 0:e.onChange)&&(null==e?void 0:e.onChange())},role:(null==e?void 0:e.onChange)&&"button",children:null==e?void 0:e.children})},Container:Rd,DisplayWrapper:function(e){var t=e.width,n=void 0===t?160:t,r=us();return c.jsx("div",{className:""+as.container(null==r?void 0:r.popoverMenu),style:{width:n},children:null==e?void 0:e.children})}});function zd(e,t,n){var r,i=null!=(r=null==t?void 0:t.left)?r:0,o=t||{},a=o.left,l=void 0===a?0:a,s=o.top,u=o.width,d=void 0===u?0:u,c=o.height,p=(void 0===s?0:s)+(void 0===c?0:c)+window.pageYOffset;return{position:"absolute",left:"right"===n?i+e>window.innerWidth?l-d:l:l<e?l-d:l-e+d,top:p,width:e}}function Bd(){var e=t.useState(!1),r=e[0],i=e[1],o=t.useState(void 0),a=o[0],l=o[1],s=n.useRef(null);return{ref:s,show:r,position:a,close:function(){return i(!1)},open:function(){i(!r),s.current&&l(s.current.getBoundingClientRect())}}}var qd={convert:!1,stripUnknown:!0},Vd=function(e,n){var r=t.useState(""),i=r[0],o=r[1];return""==i?{values:e.map((function(e,t){return{item:e,refIndex:t}})),searchString:i,setSearch:o}:{values:new h([].concat(e),{keys:n,useExtendedSearch:!0}).search(i),setSearch:o,searchString:i}},Hd=function(e){var t,n,r,i,o;return ua({width:null!=(t=null==e?void 0:e.width)?t:"100%",maxWidth:null==e?void 0:e.maxWidth,minWidth:null==e?void 0:e.minWidth,height:null==e?void 0:e.height,display:"flex",alignItems:null==e?void 0:e.alignItems,gridRow:null==e?void 0:e.gridRow,gridColumn:null==e?void 0:e.gridColumn,padding:null==e?void 0:e.padding,paddingTop:null!=(n=null==e?void 0:e.paddingTop)?n:null==e?void 0:e.paddingY,paddingLeft:null!=(r=null==e?void 0:e.paddingLeft)?r:null==e?void 0:e.paddingX,paddingRight:null!=(i=null==e?void 0:e.paddingRight)?i:null==e?void 0:e.paddingX,paddingBottom:null!=(o=null==e?void 0:e.paddingBottom)?o:null==e?void 0:e.paddingY,margin:null==e?void 0:e.margin,gap:null==e?void 0:e.gap,rowGap:null==e?void 0:e.rowGap,columnGap:null==e?void 0:e.columnGap,flexWrap:null!=e&&e.wrap?"wrap":void 0,flex:null==e?void 0:e.flex,flexDirection:null==e?void 0:e.direction,justifyContent:null==e?void 0:e.justifyContent,cursor:null==e?void 0:e.cursor,overflow:null==e?void 0:e.overflow,border:null==e?void 0:e.border,minHeight:null==e?void 0:e.minHeight,position:null==e?void 0:e.position,flexGrow:null==e?void 0:e.grow,maxHeight:null==e?void 0:e.maxHeight,alignContent:null==e?void 0:e.alignContent,placeContent:null==e?void 0:e.placeContent,placeItems:null==e?void 0:e.placeItems,justifyItems:null==e?void 0:e.justifyItems,alignSelf:null==e?void 0:e.alignSelf})},Wd=function(e){var t,n,r,i,o,a,l,s=null!=(t=null==(n=e)?void 0:n.as)?t:"div";return"fieldset"===e.as&&(e=U({padding:0,border:0,margin:0},e)),c.jsx(s,{className:rs(""+Hd(e),null==(r=e)?void 0:r.className),"data-component":null!=(i=null==(o=e)?void 0:o["data-component"])?i:"Flex",role:null==(a=e)?void 0:a.role,children:null==(l=e)?void 0:l.children})},Yd={"&::-webkit-scrollbar":{height:8,width:8,opacity:.6},"&:active::-webkit-scrollbar-thumb":{visibility:"visible"},"&:focus::-webkit-scrollbar-thumb":{visibility:"visible"},"&:hover::-webkit-scrollbar-thumb":{visibility:"visible"},"&::-webkit-scrollbar-thumb":{backgroundColor:"rgba(142, 139, 130, 0.8)",visibility:"hidden",borderRadius:4},"&::-webkit-scrollbar-corner":{backgroundColor:"transparent"}},Ud=ua({width:"100%"}),Gd=Object.assign((function(){return null}),{wrapper:function(e){var t=Kd(e);return ua(U({marginTop:8,fontSize:null==t?void 0:t.fontSize,width:"calc(100% - 2px)",position:"absolute",top:"100%",zIndex:40,overflow:"overlay",borderRadius:null==t?void 0:t.borderRadius,background:null==t?void 0:t.background,color:null==t?void 0:t.color,boxShadow:null==t?void 0:t.boxShadow,border:null==t?void 0:t.border,variants:{fixedHeight:{on:{maxHeight:"20rem"}}}},Yd))},option:function(e){var t=Kd(e);return ua({position:"relative",width:"100%",cursor:"pointer",borderBottom:null==t?void 0:t.separatorBorder,"&:hover":null==t?void 0:t["&:hover"]})},button:function(e){var t=Kd(e);return ua({position:"relative",width:"100%",borderLeftWidth:2,borderColor:"transparent",padding:null==t?void 0:t.padding,display:"grid",gap:8,textAlign:"left",boxSizing:"border-box",variants:{selected:{on:U({fontWeight:500,gridTemplateColumns:"1fr 24px"},t.selected),off:{gridTemplateColumns:"1fr"}}}})},selectedIcon:ua({height:"1.25rem",width:"1.25rem"}),layout:Ud,subtext:ua({color:"inherit",opacity:.6})}),Kd=function(e){return i.merge({},ga.dropdowns,e)},Xd={name:"14n397",styles:"position:relative;width:100%;cursor:pointer;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity));padding-top:0.5rem;padding-bottom:0.5rem;text-align:center;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity))"};function Qd(e,t){if(void 0!==e)return s(e).brighten(t).css()}var Jd=ua({position:"relative",display:"flex",flex:1,flexDirection:"row"}),Zd=ua({width:16,zIndex:999,top:0,bottom:0,left:-3,position:"absolute",alignSelf:"flex-start",cursor:"pointer"}),$d=Object.assign((function(){return null}),{itemWrapper:Jd,item:function(e){var t;return ua({width:"100%",borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,boxShadow:null==e?void 0:e.boxShadow,color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,boxSizing:"border-box",variants:{highlight:{on:{border:null==e?void 0:e.border,borderColor:"rgb(187 247 208 / 0.6)"},off:{border:null==e?void 0:e.border}},componentPadding:(t={},t.true={padding:"0.5rem"},t),clickable:{on:{cursor:"pointer"}}}})},label:function(e){var t;return ua(U({},Oa.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em"}))},metadata:function(e){var t;return ua(U({},Oa.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em",color:"inherit",opacity:.6}))},right:ua({display:"flex",placeContent:"center"}),edit:ua({marginRight:"0.75rem",display:"grid",placeContent:"center",color:"inherit",opacity:.5}),deleteWrapper:function(e){var t,n;return ua({position:"absolute",top:"-0.75rem",right:"-0.55rem",height:21.5,width:21.5,background:null==e||null==(t=e.icon)?void 0:t.background,border:null==e||null==(n=e.icon)?void 0:n.border,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"})},deleteButton:function(e){var t,n;return ua(U({},Oa.button,{height:16,color:null==e||null==(t=e.icon)?void 0:t.color,"&:hover":{color:Qd(null==(n=e.icon)?void 0:n.color,1.5)}}))},iconSize:ua({height:"1rem",width:"1rem"}),addWrapper:ua(U({position:"relative",width:"100%"},sa)),title:function(e){var t,n=i.merge({},null==ga||null==(t=ga.lists)?void 0:t.title,null==e?void 0:e.title);return ua(U({padding:0},sa,n))},titleContainer:function(){return ua({variants:{hasBorder:{true:{borderBottom:"2px solid #e5e7eb"}}}})},dragHandleContainer:Zd}),ec=Object.assign((function(){return null}),{item:ua({opacity:.5}),string:ua({fontSize:"0.55rem",transform:"scaleX(1.2)",marginLeft:1}),bool:ua({fontSize:"0.65rem",fontWeight:"bold"}),icon:function(e){return ua({"& > *":{fill:null!=e?e:"#2d2f31"}})}}),tc=function(e){return c.jsxs(t.Fragment,{children:["number"===(null==e?void 0:e.icon)&&c.jsx(g.HashtagIcon,{width:"75%","aria-label":"Number"}),"date_time"===(null==e?void 0:e.icon)&&c.jsx(g.CalendarIcon,{width:"75%","aria-label":"Date"}),"string"===(null==e?void 0:e.icon)&&c.jsx(Md,{as:"code",children:c.jsxs(os,{columns:["1fr","1fr"],className:""+Ea.codeText,children:[c.jsx("span",{className:""+Ea.bold,"aria-label":"String",children:"A"}),c.jsx("span",{className:rs(""+ec.string({}),""+Ea.bold),children:"A"})]})}),"string[]"===(null==e?void 0:e.icon)&&c.jsx(Md,{as:"code",className:""+Ea.codeText,children:c.jsxs(os,{columns:["1fr","1fr"],children:[c.jsx("span",{className:""+Ea.bold,"aria-label":"String",children:"A"}),c.jsx("span",{className:rs(""+ec.string({}),""+Ea.bold),children:"[]"})]})}),"boolean"===(null==e?void 0:e.icon)&&c.jsx(Md,{as:"code",className:rs(""+ec.bool({}),""+nc),"data-component":"true-false",children:c.jsxs(os,{columns:["1fr","1fr","1fr"],height:"20px",children:[c.jsx(Md,{alignSelf:"start",children:"T"}),c.jsx(Md,{alignSelf:"center",marginLeft:-.5,children:"/"}),c.jsx(Md,{alignSelf:"end",children:"F"})]})})]})},nc=ua({fontSize:11,lineHeight:1.3,fontFamily:Oa.codeFontFamily}),rc=function(e){var t,r,i;return c.jsx(Md,{width:24,paddingTop:null!=(t=null==e?void 0:e.paddingTop)?t:"0.30rem",alignSelf:"start","data-component":"item-icon",marginLeft:-2,children:c.jsxs(Wd,{justifyContent:"center",alignItems:"center",className:""+ec.item,paddingTop:null!=(r=null==e?void 0:e.flexPaddingTop)?r:"0.10rem",children:[(i=null==e?void 0:e.icon,n.isValidElement(i)&&c.jsx(ic,{icon:null==e?void 0:e.icon,width:null==e?void 0:e.iconWidth})),c.jsx(tc,{icon:null==e?void 0:e.icon})]})})},ic=function(e){var t,n,r=us();return c.jsx(Md,{width:null!=(t=null==e?void 0:e.width)?t:"75%",className:""+ec.icon(null==r||null==(n=r.charts)?void 0:n.iconColor),"data-themeapi":"charts.iconColor",children:null==e?void 0:e.icon})},oc={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},ac=Object.assign((function(e){var n=us();return c.jsx(t.Fragment,{children:(null==e?void 0:e.open)&&c.jsx("div",{className:""+Gd.wrapper(null==n?void 0:n.dropdowns)({fixedHeight:(null==e?void 0:e.fixedHeight)&&"on"}),"data-component":"dropdown","data-themeapi":"dropdown",children:c.jsx(Wd,{direction:"column",role:"list","data-component":"dropdown-options",maxHeight:400,children:null==e?void 0:e.children})})})}),{Option:function(e){var n=e.label,r=us();return c.jsx("div",{className:""+Gd.option(null==r?void 0:r.dropdowns),role:"listitem","aria-selected":null==e?void 0:e.selected,"data-themeapi":"dropdown",children:c.jsxs("div",{tabIndex:-1,onClick:function(t){return e.onChange(t)},onKeyUp:function(){return e.onChange()},role:"button",className:""+Gd.button(null==r?void 0:r.dropdowns)({selected:null!=e&&e.selected?"on":"off"}),"data-testid":null==e?void 0:e.testId,children:[null!=e&&e.render?e.render(e):c.jsx(t.Fragment,{children:null!=e&&e.subtext||null!=e&&e.icon?c.jsxs(Wd,{direction:"row",gap:"0.5rem",children:[(null==e?void 0:e.icon)&&c.jsx(rc,{icon:null==e?void 0:e.icon,paddingTop:"0"}),c.jsxs(Md,{flexGrow:1,paddingTop:"0.1rem",children:[c.jsx(Md,{children:i.isFunction(n)?n():n}),(null==e?void 0:e.subtext)&&c.jsx(Md,{className:""+Gd.subtext,children:null==e?void 0:e.subtext})]})]}):c.jsx("span",{children:i.isFunction(n)?n():n})}),(null==e?void 0:e.selected)&&c.jsx(Wd,{alignItems:"center",justifyContent:"center",children:c.jsx("div",{className:""+Gd.selectedIcon,children:c.jsx(v.CheckIcon,{css:oc,"aria-hidden":"true"})})})]})})},Empty:function(e){return c.jsx("div",{css:Xd,children:e.label})}}),lc=function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return"v"+e+" "+n.flatMap((function(t){return t?["vizzly"+e+"_"+t]:[]})).join(" ")},sc=function(e,t,n){var r=[].concat(n).flatMap((function(e){if(i.isFunction(e)){var n=e();if(n)return[lc(n)]}return i.isString(e)&&t[e]?[lc(e)]:[]})).join(" ");return lc(e)+" "+r},uc=p.keyframes({name:"19mmmx",styles:"0%,15%{transform:translate(0, 0);}50%{transform:translate(0, -5px);opacity:0.7;}85%,100%{transform:translate(0, 0);}"}),dc=function(e){var t;return c.jsx("div",{css:[d.css("height:7px;width:7px;border-radius:50%;background:",null!=(t=e.color)?t:"white",";float:left;margin:0 3px;&:nth-of-type(1){z-index:1;-moz-animation:",uc," 2s infinite ease-in-out;-webkit-animation:",uc," 2s infinite ease-in-out;}&:nth-of-type(2){-moz-animation:",uc," 2s infinite ease-in-out;-webkit-animation:",uc," 2s infinite ease-in-out;-webkit-animation-delay:0.25s;animation-delay:0.25s;}&:nth-of-type(3){-moz-animation:",uc," 2s infinite ease-in-out;-webkit-animation:",uc," 2s infinite ease-in-out;-webkit-animation-delay:0.5s;animation-delay:0.5s;}",""),"",""]})},cc=Vl((function(e){var t=e.color,n=e.mAuto;return c.jsxs("div",{className:lc("loading"),css:["margin-top:-0.5rem;margin-bottom:-0.5rem;",n&&{margin:"auto"},"",""],children:[c.jsx(dc,{color:t}),c.jsx(dc,{color:t}),c.jsx(dc,{color:t})]})}),"renderLoadingComponent"),pc={name:"45oqhd",styles:"display:grid;align-content:center;text-align:center"},fc=function(e){var t;return c.jsx("div",{css:pc,style:{width:"100%",height:"100%",minHeight:null!=(t=null==e?void 0:e.minHeight)?t:"200px"},children:e.override?e.override({}):c.jsx(cc,{mAuto:!0,color:"#e5e5e5"})})},mc={name:"45oqhd",styles:"display:grid;align-content:center;text-align:center"},hc=function(e){return c.jsx("div",{css:mc,style:{width:"100%",height:"100%"},children:c.jsx(cc,{mAuto:!0,color:e.color})})},vc=function(e){var t;return c.jsx("button",{"data-testid":null==e?void 0:e.testId,onClick:function(t){t.stopPropagation(),null==e||e.onClear()},onKeyUp:function(t){t.stopPropagation(),null==e||e.onClear()},className:rs(null==e?void 0:e.className,""+Ea.button),"aria-label":null!=(t=null==e?void 0:e["aria-label"])?t:"Clear",children:c.jsx("div",{children:c.jsx("svg",{fill:null==e?void 0:e.fill,height:8,width:10,stroke:null==e?void 0:e.stroke,focusable:"false",viewBox:"0 0 12 12",className:""+La,children:c.jsx("path",{fillRule:"evenodd",d:"M11.53.47a.75.75 0 0 0-1.061 0l-4.47 4.47L1.529.47A.75.75 0 1 0 .468 1.531l4.47 4.47-4.47 4.47a.75.75 0 1 0 1.061 1.061l4.47-4.47 4.47 4.47a.75.75 0 1 0 1.061-1.061l-4.47-4.47 4.47-4.47a.75.75 0 0 0 0-1.061z"})})})})},gc={height:"1.5rem",width:"1.5rem",cursor:"pointer",paddingTop:1,outline:"2px solid transparent",outlineOffset:2},bc=Object.assign(ua({width:"100%"}),{inputComponent:function(e,t){var n,r;return ua(U({display:"flex",outline:"2px solid transparent",outlineOffset:2,textAlign:"left",lineHeight:1.25,borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,color:null==e?void 0:e.color,fontWeight:null==e?void 0:e.fontWeight,fontSize:null==e?void 0:e.fontSize,boxShadow:null==e?void 0:e.boxShadow},t?U({},null==e?void 0:e["&:focus"]):((n={})["&:hover"]=null==e?void 0:e["&:hover"],n),{variants:{highlighted:{on:{outline:"2px solid transparent",outlineOffset:2}},subtle:{off:{border:t?null==e||null==(r=e["&:focus"])?void 0:r.border:null==e?void 0:e.border},on:{border:null==e?void 0:e.border,borderColor:"transparent",background:"transparent"}}}}))},clickableArea:function(e){return ua({width:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:e.padding,gridArea:"1 / 1 / 2 / 3",variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},multiple:function(e){return ua({display:"inline-grid",gridArea:"1 / 1 / 2 / 3",padding:e.padding,paddingLeft:0,paddingRight:0,variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},input:ua({height:"100%",width:"100%",appearance:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:"transparent",padding:"0 0.5rem",color:"inherit",outline:"2px solid transparent",border:0,"&:disabled":{border:"none"},variants:{rightAligned:{on:{textAlign:"right"},off:{}}}}),loading:ua({paddingLeft:"0.25rem",paddingRight:0,width:100,alignSelf:"center"}),clearContainer:ua({display:"flex",width:"2rem",alignItems:"center",paddingLeft:"0.5rem",paddingRight:"0.25rem"}),clearButton:function(e){return ua(U({},gc,{color:e.indicatorColor}))},controlGrid:ua({paddingBottom:1}),arrowContainer:function(e){return ua({display:"flex",width:"2rem",alignItems:"center",justifyContent:"center",padding:0,margin:0,color:"rgb(209 213 219)",variants:{subtle:{off:{borderLeft:null==e?void 0:e.border}}}})}}),xc=ua({variants:{open:{up:{},off:{transform:"rotate(180deg)"},side:{transform:"rotate(90deg)"}}}}),yc=function(e){var t,n,r;return c.jsx("button",{onClick:function(t){t.stopPropagation(),t.preventDefault(),null==e||e.onClick()},"aria-label":e.label,className:""+(r=null!=(t=null==e?void 0:e.styled)?t:null==(n=ga.forms)?void 0:n.select,ua(U({},Oa.button,{height:"1.5rem",cursor:"pointer",color:null==r?void 0:r.indicatorColor,outline:"2px solid transparent",outlineOffset:2,"&:disabled":{border:"none"}}))),children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:rs(""+xc({open:null==e||!e.expanded||null!=e&&e.disabled?null==e?void 0:e.arrowStart:"off"}),""+La),children:c.jsx("polyline",{points:"18 15 12 9 6 15"})})})},wc=function(e){var n,r=e.disabled,o=e.placeholder,a=e.onClear,l=e.isLoading,s=t.useRef(null),u=function(){null==e||e.setOpen(!0),null!==s.current&&s.current.focus()},d=i.isString(null==e?void 0:e.selectedValue)?null==e?void 0:e.selectedValue:void 0;t.useEffect((function(){null!=e&&e.open&&null!==s.current&&!l&&s.current.focus()}),[null==e?void 0:e.open]);var p=us(),f=Cc(null==p||null==(n=p.forms)?void 0:n.select);return c.jsx("div",{className:""+bc,"data-component":"control","aria-labelledby":null!=e&&e.multiple?null==e?void 0:e.id:void 0,onClick:function(){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick())},children:c.jsxs("div",{className:""+bc.inputComponent(f,null==e?void 0:e.open)({highlighted:null!=e&&e.highlighted?"on":"off",subtle:null!=e&&e.subtle?"on":"off"}),"data-themeapi":"forms.select",children:[c.jsxs(Wd,{flex:"1 1 auto",wrap:!0,"data-component":"control-flex",alignItems:null!=e&&e.multiple?"flex-start":void 0,rowGap:null!=e&&e.multiple?"0.25rem":void 0,minHeight:null!=e&&e.multiple?28.44:void 0,direction:null!=e&&e.multiple?"row":void 0,children:[(null==e?void 0:e.multiple)&&c.jsx(t.Fragment,{children:null==e?void 0:e.children}),!(null!=e&&e.multiple)&&c.jsx(Md,{flex:1,"data-component":"control-view",children:c.jsxs(os,{"data-component":"control-grid",className:""+bc.controlGrid,children:[c.jsx(t.Fragment,{children:null!=e&&e.open?c.jsx(t.Fragment,{children:0===e.value.length&&d&&c.jsx("div",{className:bc.clickableArea(f)({small:null!=e&&e.sm?"on":"off",rightAligned:null!=e&&e.rightAligned?"on":"off"}),"aria-labelledby":null==e?void 0:e["aria-labelledby"],children:d})}):c.jsx("div",{onClick:function(){return u()},onKeyUp:function(){return u()},"data-testid":e.testId,className:rs(""+bc.clickableArea(f),null==e?void 0:e.className),"aria-labelledby":null==e?void 0:e["aria-labelledby"],children:null==e?void 0:e.children})}),!(null!=e&&e.multiple)&&(null==e?void 0:e.open)&&c.jsx("div",{className:bc.multiple(f)({small:null!=e&&e.sm?"on":"off"}),children:c.jsx("input",{style:{minWidth:o?9*(null==o?void 0:o.length)+"px":void 0},id:null==e?void 0:e.id,value:null==e?void 0:e.value,onChange:function(t){return null==e?void 0:e.onChange(t.target.value)},onClick:function(){return(null==e?void 0:e.multiple)&&(null==e?void 0:e.setOpen(!(null!=e&&e.open)))},"aria-labelledby":null==e?void 0:e["aria-labelledby"],placeholder:null==e?void 0:e.placeholder,disabled:r,ref:s,className:bc.input({rightAligned:null!=e&&e.rightAligned?"on":"off"}),autoComplete:"off"})})]})})]}),l&&c.jsx("div",{className:""+bc.loading,children:c.jsx(hc,{color:"#3074d9"})}),a&&(null==e?void 0:e.clearable)&&c.jsx("div",{className:""+bc.clearContainer,children:c.jsx(vc,{onClear:function(){return a&&a()},className:""+bc.clearButton(f),fill:f.indicatorColor,stroke:f.indicatorColor,testId:e.testId?e.testId+"-clear":void 0})}),c.jsx("div",{className:bc.arrowContainer(f)({subtle:null!=e&&e.subtle?"on":"off"}),children:c.jsx(yc,{label:null!=e&&e.open?"Close":"Open",arrowStart:"up",disabled:r,onClick:function(){return null==e?void 0:e.setOpen(!(null!=e&&e.open))},styled:f,expanded:null==e?void 0:e.open})})]})})},Cc=function(e){var t;return i.merge({},null==(t=ga.forms)?void 0:t.select,e)},jc=Object.assign(ua({display:"flex",position:"relative",alignItems:"start",flexDirection:"column",variants:{dynamicWidth:{true:{width:"100%"}}}})),Fc=ql((function(e){var r,o,a,l=e.selected,s=e.options,u=e.setSelectOptionsAreOpen,d=e.isLoading,p=e.selectOptionsAreOpen,f=e.onClickWithDevToolCheck,m=e.activeDevToolHighlight,h=null===e.selected?null:s[e.selected],v=h?h.label:e.placeholder||"Select...",g=n.useRef(null);ss(g,(function(){return u(!1)}));var b=Object.keys(s[0]||{}),x=Vd(s,b),y=x.values,w=x.setSearch,C=x.searchString,j=function(t){t!=l&&e.onChange(null===t?null:t),u(!1)};return c.jsxs("div",U({className:""+jc({dynamicWidth:null==e?void 0:e.dynamicWidth}),ref:g,"data-component":null==e?void 0:e["data-component"]},((r={})["data-componentoverride"]="renderSelectComponent",r),{children:[c.jsx(wc,{value:null!=e&&e.selectOptionsAreOpen?C:i.isFunction(v)?v():v,onChange:function(e){return w(e)},open:p,setOpen:f((function(){u(!p),w("")})),onClear:function(){h&&e.canBeCleared&&j(null),h&&e.canBeCleared&&w("")},clearable:!(!h||!e.canBeCleared),subtle:null==e?void 0:e.subtle,selectedValue:null==(o=y.find((function(e){return e.refIndex===l})))?void 0:o.item.label,highlighted:m,rightAligned:null==e?void 0:e.rightAligned,testId:null==e?void 0:e.testId,isLoading:d,id:null==e?void 0:e.id,"aria-labelledby":null==e?void 0:e["aria-labelledby"],className:null==e?void 0:e.controlClassName,children:null!=e&&e.renderSelected?null==e?void 0:e.renderSelected(h):c.jsxs(t.Fragment,{children:[h&&e.selectedLabelPrefix,i.isFunction(v)?v():v]})}),!d&&c.jsxs(ac,{open:p,fixedHeight:!0,children:[y.map((function(t,n){return c.jsx(ac.Option,U({onChange:function(){return j(t.refIndex)},label:t.item.label,selected:t.refIndex==l,testId:t.item.testId?""+t.item.testId:null!=e&&e.testId?(null==e?void 0:e.testId)+"-"+n:void 0,icon:t.item.icon},e.renderOption&&{render:function(){return e.renderOption&&e.renderOption(t.item)}}),"option_"+t.refIndex+"_"+t.item.label)})),0===y.length&&c.jsx(Md,{padding:8,width:200,children:null!=(a=e.noOptionsMessage)?a:"No Options"})]})]}))}),"renderSelectComponent",(function(e){return U({},e,{setSelectOptionsAreOpen:(t=e.setSelectOptionsAreOpen,n=[r.boolean()],function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return n.forEach((function(e,t){var n=e.validate(r[t],qd);if(n.error)throw n.error;r[t]=n.value})),t.apply(void 0,r)})});var t,n})),Sc=ua({color:"#7D7D7E"}),kc=function(e){var t,n,r,o,a,l,s,u,d=null!=(t=null==e?void 0:e.as)?t:"label",p=us(),f={className:""+(r=null==p||null==(n=p.forms)?void 0:n.label,o=null==e?void 0:e.labelHidden,a=null==e?void 0:e.margin,l=null==e?void 0:e.fontWeight,u=i.merge({},null==(s=ga.forms)?void 0:s.label,r),ua(U({},u,{margin:null!=a?a:null==u?void 0:u.margin,fontWeight:null!=l?l:null==u?void 0:u.fontWeight,display:o?"none":"block",padding:0,position:"relative",width:"100%"}))),"data-themeapi":"forms.label","data-chipposition":"above.right",htmlFor:null==e?void 0:e.htmlFor,id:null==e?void 0:e.id};return e.tooltip?c.jsxs(Wd,{gap:"0.25rem",children:[c.jsx(d,U({},f,{children:null==e?void 0:e.children})),c.jsx(Md,{width:18,children:(null==e?void 0:e.tooltip.href)&&c.jsxs("a",{href:null==e?void 0:e.tooltip.href,target:"_blank",rel:"noopener noreferrer",children:[c.jsx("span",{className:""+Ea.srOnly,children:null==e?void 0:e.tooltip.label}),c.jsx(v.QuestionMarkCircleIcon,{className:rs("help-icon",""+Sc)})]})})]}):c.jsx(d,U({},f,{children:null==e?void 0:e.children}))},Tc=function(e){var n,r=i.isFunction(e.options)&&e.selected?[{value:e.selected,label:e.selected}]:[],o=t.useState(i.isArray(e.options)?{loading:!1,options:e.options}:{loading:!1,options:r}),a=o[0],l=o[1],s=a.options,u=t.useState(void 0!==e.defaultOpen&&e.defaultOpen),d=u[0],p=u[1];t.useEffect((function(){var t=new AbortController;d&&function(){var n=Y(H().mark((function n(){var r;return H().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!i.isFunction(e.options)){n.next=6;break}return l({loading:!0,options:[]}),n.next=4,e.options(t.signal);case 4:(r=n.sent)?l({loading:!1,options:r}):console.warn("[Vizzly] Failed to fetch async options for select.");case 6:return n.abrupt("return",(function(){t.abort()}));case 7:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}()()}),[d]),t.useEffect((function(){i.isArray(e.options)&&l({loading:!1,options:e.options})}),[e.options]);var f=s.findIndex((function(t){return i.isArray(t.value)||i.isObject(t.value)?JSON.stringify(t.value)==JSON.stringify(e.selected):t.value==e.selected}));return c.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(kc,{labelHidden:null==e?void 0:e.labelHidden,id:null==e?void 0:e.id,tooltip:null==e?void 0:e.tooltip,children:null==e?void 0:e.label}),c.jsx(Fc,{"data-component":null==e?void 0:e["data-component"],testId:e.testId,dynamicWidth:e.dynamicWidth,onChange:function(t){e.onChange(null===t?null:a.options[t].value)},controlClassName:null==e?void 0:e.controlClassName,setSelectOptionsAreOpen:p,options:a.options,isLoading:null!=(n=null==e?void 0:e.loading)?n:a.loading,subtle:e.subtle,selected:-1===f?null:f,selectOptionsAreOpen:d,anchorOptionsLeft:e.anchorLeft,error:e.error,canBeCleared:e.showClearBtn,selectedLabelPrefix:e.selectedPrefix,placeholder:e.placeholder,rightAligned:null==e?void 0:e.rightAligned,id:null==e?void 0:e.id,"aria-labelledby":null==e?void 0:e.id,renderSelected:null==e?void 0:e.renderSelected,renderOption:null==e?void 0:e.renderOption,noOptionsMessage:e.noOptionsMessage})]})},Ac=function(e){return c.jsx("div",{"data-component":"select-input",children:null==e?void 0:e.children})},Dc=function(e){var t=e.placeholder,n=e.showClearBtn;return c.jsx(Tc,{showClearBtn:void 0===n||n,options:e.options,onChange:e.setSelected,selected:e.currentValue,anchorLeft:e.anchorLeft,placeholder:t,selectedPrefix:t+" · ",maintainOptionOrder:e.maintainOptionOrder,testId:"select"})},Ic=function(e,t){return null===e?null:i.reduce(t,(function(e,t){return function(e,t){var n=i.cloneDeep(e);return n.attributes=On(e.attributes.type).removeField(e.attributes,t),n}(e,t.id)}),e)},Pc=[];function _c(e){for(var t,n=[],r=te(e);!(t=r()).done;){var i=t.value;n.push("dateTimeFilter"===i.type?U({},i,{type:"dateFilter"}):i)}return n}function Ec(e,t){var n=U({},e);return"attributes"in n&&("measure"in n.attributes&&t.updatedMeasures&&(n.attributes.measure=t.updatedMeasures),"dimension"in n.attributes&&t.updatedDimension&&(n.attributes.dimension=t.updatedDimension),"timeDimension"in n.attributes&&t.updatedTimeDimension&&(n.attributes.timeDimension=t.updatedTimeDimension)),n}var Oc=function(e,t,n,r){var i=[].concat(e.dashboard.componentLibrary);return i[n]=U({},t,{attributes:U({},t.attributes,{protectedByOrganisation:!!r||void 0})}),U({},e,{componentEditor:null,dashboard:U({},e.dashboard,{componentLibrary:i})})},Lc=function(e,t,n,r){var i=jr(e.dashboard.display,t,n,r);return U({},e,{dashboard:U({},e.dashboard,{display:i})})},Mc=function(e,t){var n=t.rowIndex,r=i.cloneDeep(e.dashboard.display);return r.length>1?(r.splice(n,1),U({},e,{dashboard:U({},e.dashboard,{display:r})})):e},Rc=n.createContext(null),Nc=function(e){var r,o,a=e.dashboard,l=e.children,s=e.onEvent,u=function(e){var t,r=zl(),o=r.dashboardFilters,a=r.onDashboardFilterChange,l=U({pickFromComponentLibrary:null,componentEditor:null,inPreviewMode:!1},e,{dashboard:e.dashboard}),s=(t={dashboardFilters:o,onDashboardFilterChange:a},function(e,n){var r=n.type;return[function(e){return function(e,t){var n,r,o,a,l,s,u=t.dashboardFilters,d=[].concat(e.dashboard.globalFilters).filter((function(e){return!e.managedByConfiguration})),c=(l=e.dashboard.dataSets,s={},l.forEach((function(e){e.fields.forEach((function(t){[].concat(t.dashboardRequiredFilterGroups||[]).forEach((function(n){var r=n.publicName+" - "+t.dataType;s[r]=[].concat(s[r]||[],[{publicName:n.publicName,dataSetField:t,dataSetId:e.id}])}))}))})),Object.values(s)).map((function(e){return{type:"date_time"==e[0].dataSetField.dataType?"dateFilter":"singleSelectFilter",managedByConfiguration:!0,requiresValue:!0,title:e[0].publicName,appliesToFields:e.map((function(e){return{dataSetId:e.dataSetId,fieldId:e.dataSetField.id}})),value:null}})),p=u((r=e.dashboard,o=function(e){var t=[];return e.display.forEach((function(e){e.components.forEach((function(e){(function(e){return"isEmpty"in e})(e)||(t=[].concat(t,[e.attributes.dataSetId]))}))})),i.uniq(t).flatMap((function(t){var n=Mn(e.dataSets,t);return n?[n]:[]}))}(r),a=function(e){var t=[];return e.componentLibrary.forEach((function(e){t=[].concat(t,[e.attributes.dataSetId])})),i.uniq(t).flatMap((function(t){var n=Mn(e.dataSets,t);return n?[n]:[]}))}(r),i.uniqBy([].concat(a,o),(function(e){return e.id}))),Pc).map((function(e){return U({},e,{managedByConfiguration:!0})})),f=function(e,t){var n=new Set(t.flatMap((function(e){return e.fields.map((function(e){return e.id}))})));return t.forEach((function(e){e.fields.forEach((function(e){n.add(e.id)}))})),e.map((function(e){var t=Object.assign({},e);return t.appliesToFields=e.appliesToFields.filter((function(e){return n.has(e.fieldId)})),t}))}([].concat(_c(c),_c(p),_c(d)),e.dashboard.dataSets).map((function(t){var n=pr(e.dashboard.globalFilters,t);return U({},t,{value:n?n.value:t.value||null})}));return i.some(n=f,(function(e,t){var r=[].concat(n);return r.splice(t,1),!!pr(r,e)}))&&Br("Identical global dashboard filters found. This will cause strange behaviour. Please make sure the global filters all apply to a unique set of `appliesToFields` values."),U({},e,{dashboard:U({},e.dashboard,{globalFilters:f})})}(e,t)},function(e){return function(e,t,n){return"setGlobalFilters"!=t.type&&"init"!=t.type||n.onDashboardFilterChange(e.dashboard.globalFilters),e}(e,n,t)}].reduce((function(e,t){return t(e)}),function(){switch(r){case"insertRow":return function(e,t){var n=xr(e.dashboard.display,t.rowIndex);return U({},e,{dashboard:U({},e.dashboard,{display:n})})}(e,n);case"appendCell":return function(e,t){var n=Cr(e.dashboard.display,t.rowIndex);return U({},e,{dashboard:U({},e.dashboard,{display:n})})}(e,n);case"removeCell":return function(e,t){var n=t.rowIndex,r=t.cellIndex,o=i.cloneDeep(e.dashboard.display),a=o[n].components[r];return o[n].components.length>1?(o[n].components.splice(r,1),o[n].components[0].colSpan=o[n].components[0].colSpan+a.colSpan,U({},e,{dashboard:U({},e.dashboard,{display:o})})):Mc(e,U({},t,{type:"removeRow"}))}(e,n);case"removeRow":return Mc(e,n);case"clearCell":return function(e,t){var n=t.rowIndex,r=t.cellIndex,o=i.cloneDeep(e.dashboard.display);return o[n].components[r]=yr(o[n].components[r].colSpan),U({},e,{dashboard:U({},e.dashboard,{display:o})})}(e,n);case"addDataSet":return function(e,t){var n=t.dataSet,r=[].concat(e.dashboard.dataSets);return r.push(n),U({},e,{dashboard:U({},e.dashboard,{dataSets:r})})}(e,n);case"removeDataSet":return function(e,t){var n=t.dataSetId;if(!function(e,t){return Yr(e,t)>=0}(e.dashboard,n))return e;var r=Yr(e.dashboard,n),i=[].concat(e.dashboard.dataSets);return i.splice(r,1),U({},e,{dashboard:U({},e.dashboard,{dataSets:i})})}(e,n);case"setDataSets":return function(e,t){var n,r,o,a=t.dataSets,l=function(e,t){return[].concat(t).flatMap((function(t){var n,r,i,o=Mn(e,t.id);return null==o?[]:(n=o,r=[].concat(t.fields).map((function(e){return e.id})),i=[],[].concat(n.fields).forEach((function(e){r.includes(e.id)||(i=[].concat(i,[e]))})),i)}))}([].concat(e.dashboard.dataSets),a),s=i.reduce(l,(function(e,t){return function(e,t){var n=i.cloneDeep(e);return n.map((function(e){var n=e.components.map((function(e){return"isEmpty"in e||(e.attributes=On(e.attributes.type).removeField(e.attributes,t)),e}));return U({},e,{components:n})})),n}(e,t.id)}),e.dashboard.display);return U({},e,{componentEditor:(n=e.componentEditor,r=l,o=(null==n?void 0:n.component)||null,o=Ic(o,r),n?U({},n,{component:o}):null),dashboard:U({},e.dashboard,{componentLibrary:[].concat(e.dashboard.componentLibrary).map((function(e){return Ic(e,l)})),dataSets:[].concat(a),display:s})})}(e,n);case"startPickingComponentFromLibraryForDisplay":return function(e,t){return U({},e,{pickFromComponentLibrary:{cellIndex:t.cellIndex,rowIndex:t.rowIndex}})}(e,n);case"startEditingComponent":return function(e,t){return U({},e,{componentEditor:{target:{libraryIndex:t.libraryIndex,displayTarget:t.displayTarget},component:t.component||null}})}(e,n);case"saveComponent":return function(e,t){var n;if(!e.componentEditor)throw"Cannnot save a component when the editor is not active.";if(null==(n=e.componentEditor)||!n.component||!e.componentEditor.component.attributes)throw"Component must be set for it to be saved.";var r=U({},e);return null!=e.componentEditor.target.libraryIndex&&(r=Oc(e,e.componentEditor.component,e.componentEditor.target.libraryIndex,t.protectedComponent)),e.componentEditor.target.displayTarget&&!e.componentEditor.target.libraryIndex&&(r=Lc(r,e.componentEditor.component,e.componentEditor.target.displayTarget.rowIndex,e.componentEditor.target.displayTarget.cellIndex)),U({},r,{componentEditor:null,pickFromComponentLibrary:e.pickFromComponentLibrary})}(e,n);case"addCustomComponent":return function(e,t){var n=U({},e);return null!=t.target.libraryIndex&&(n=Oc(e,t.component,t.target.libraryIndex)),t.target.displayTarget&&!t.target.libraryIndex&&(n=Lc(n,t.component,t.target.displayTarget.rowIndex,t.target.displayTarget.cellIndex)),U({},n,{componentEditor:null})}(e,n);case"clearModal":return function(e,t){return U({},e,{pickFromComponentLibrary:null,componentEditor:null})}(e);case"updateEditorComponent":return function(e,t){return e.componentEditor?U({},e,{componentEditor:U({},e.componentEditor,{component:t.component})}):U({},e)}(e,n);case"setResultsForComponentInDisplay":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=e.dashboard.display[n].components[r];if(!i)throw"We can only set results on an existing component on the dashboard.";var o=U({},i,{results:t.results});return U({},Lc(e,o,n,r))}(e,n);case"setResultsForComponentInLibrary":return function(e,t){var n=t.libraryIndex,r=t.results,i=[].concat(e.dashboard.componentLibrary);return i[n]=U({},i[n],{results:r}),U({},e,{dashboard:U({},e.dashboard,{componentLibrary:i})})}(e,n);case"setResultsForComponentInEditor":return function(e,t){if(!e.componentEditor)throw"Cannot set results for a closed editor.";if(!e.componentEditor.component)throw"Cannot set results for a non-existant component in editor.";return U({},e,{componentEditor:U({},e.componentEditor,{component:U({},e.componentEditor.component,{results:t.results})})})}(e,n);case"pickComponentFromLibraryForDisplay":return function(e,t){var n=U({},e.dashboard.componentLibrary[t.libraryIndex]);if(!n)throw"Cannot set a non-existant library component for display";if(!e.pickFromComponentLibrary)throw"Component library not open, so cannot set library component on display";var r=e.pickFromComponentLibrary;return U({},Lc(e,n,r.rowIndex,r.cellIndex),{pickFromComponentLibrary:null})}(e,n);case"setDashboard":return function(e,t){return U({},e,{dashboard:t.dashboard})}(e,n);case"setTheme":return function(e,t){return U({},e,{dashboard:U({},e.dashboard,{theme:t.theme})})}(e,n);case"setGlobalFilters":return function(e,t){return U({},e,{dashboard:U({},e.dashboard,{globalFilters:t.globalFilters})})}(e,n);case"setColSpans":return function(e,t){var n=i.cloneDeep(e.dashboard.display),r=i.cloneDeep(e.dashboard.display)[t.rowIndex];return r.components.map((function(e,n){e.colSpan=t.colSpans[n].colSpan})),n[t.rowIndex]=r,U({},e,{dashboard:U({},e.dashboard,{display:n})})}(e,n);case"setRowHeight":return function(e,t){var n=i.cloneDeep(e.dashboard.display),r=i.cloneDeep(e.dashboard.display)[t.rowIndex];return r.height=t.height,n[t.rowIndex]=r,U({},e,{dashboard:U({},e.dashboard,{display:n})})}(e,n);case"changePreviewMode":return function(e,t){return U({},e,{inPreviewMode:t.inPreviewMode})}(e,n);case"updateDisplayComponentAttributes":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=U({},e.dashboard.display[n].components[r],{attributes:U({},t.attributes)});return Lc(e,i,n,r)}(e,n);case"updateComponentLibraryAttributes":return function(e,t){var n=t.libraryIndex,r=t.attributes,i=[].concat(e.dashboard.componentLibrary);return i[n]=U({},i[n],{attributes:r}),U({},e,{dashboard:U({},e.dashboard,{componentLibrary:i})})}(e,n);case"removeComponentFromLibrary":return function(e,t){var n=t.libraryIndex,r=[].concat(e.dashboard.componentLibrary);return r.splice(n,1),U({},e,{dashboard:U({},e.dashboard,{componentLibrary:r})})}(e,n);case"setComponentReports":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=e.dashboard.display[n].components[r];if(!i)throw"We can only set local filters on an existing component on the dashboard.";var o=U({},i,{reports:t.reports});return U({},Lc(e,o,n,r))}(e,n);case"swapComponents":return function(e,t){var n,r,i,o,a,l=(i=t.positionB,o=U({},(n=e.dashboard.display)[(r=t.positionA).rowIndex].components[r.cellIndex]),a=U({},n[i.rowIndex].components[i.cellIndex]),n=jr(n,o,i.rowIndex,i.cellIndex),n=jr(n,a,r.rowIndex,r.cellIndex));return U({},e,{dashboard:U({},e.dashboard,{display:l})})}(e,n);case"setAttributes":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=e.dashboard.display[n].components[r];if(!i)throw"We can only set attributes on an existing component on the dashboard.";var o=U({},i,{attributes:t.attributes});return U({},Lc(e,o,n,r))}(e,n);case"setParameterBasedUpdate":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=function(e,t,n,r){var i=e[t].components[n];if(!i||"isEmpty"in i)throw"We can only set parameters on an existing component on the dashboard.";return Ec(i,r)}(e.dashboard.display,n,r,t.payload);return U({},Lc(e,i,n,r))}(e,n);case"setLocalFilters":return function(e,t){var n=t.localFilters,r=t.rowIndex,i=t.cellIndex,o=t.libraryIndex,a=U({},e);if(void 0!==r&&void 0!==i){var l=e.dashboard.display[r].components[i];if(!l)throw"We can only set local filters on an existing component on the dashboard.";var s=U({},l,{localFilters:n});a=Lc(e,s,r,i)}if(void 0!==o){var u=e.dashboard.componentLibrary[o];if(!u)throw"We can only set local filters on an existing component on the library.";var d=U({},u,{localFilters:n});a=Oc(e,d,o)}return U({},a)}(e,n);case"init":return e}}())});return n.useReducer(s,l,(function(e){return s(e,{type:"init"})}))}({componentEditor:e.componentEditor||null,dashboard:a?Bc(a,e.theme):a}),d=u[0],p=u[1];return t.useEffect((function(){(null==e?void 0:e.onDashboardUpdate)&&(null==e||e.onDashboardUpdate(d.dashboard))}),[JSON.stringify(d.dashboard)]),c.jsx(Rc.Provider,{value:U({},d,{dispatch:p,broadcastEvent:s||function(){},runQueriesCallback:(o=Y(H().mark((function t(n,r,i){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!d.dashboard){t.next=2;break}return t.abrupt("return",e.runQueriesCallback(n,{abortSignal:r,dataSets:d.dashboard.dataSets,filterConfig:i}));case 2:return t.abrupt("return",null);case 3:case"end":return t.stop()}}),t)}))),function(e,t,n){return o.apply(this,arguments)})}),children:c.jsx(ps,{theme:null==e?void 0:e.theme,storedTheme:null==d||null==(r=d.dashboard)?void 0:r.theme,children:l})})},zc=function(){return n.useContext(Rc)},Bc=function(e,t){var n,r,i,o,a,l,s,u,d,c,p,f;return U({},e,{theme:{detail:null!=(n=null==t?void 0:t.detail)?n:null==e||null==(r=e.theme)?void 0:r.detail,rowLimit:null!=(i=null==t?void 0:t.rowLimit)?i:null==e||null==(o=e.theme)?void 0:o.rowLimit,fontFamily:null!=(a=null==t||null==(l=t.baseFont)?void 0:l.fontFamily)?a:null==e||null==(s=e.theme)?void 0:s.fontFamily,fontSize:null!=(u=null==t||null==(d=t.baseFont)?void 0:d.fontSize)?u:null==e||null==(c=e.theme)?void 0:c.fontSize,colors:null!=(p=null==t?void 0:t.colors)?p:null==e||null==(f=e.theme)?void 0:f.colors}})},qc=function(){var e=Y(H().mark((function e(t,n,r,i){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n(t,r,i);case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,n,r,i){return e.apply(this,arguments)}}(),Vc=function(e,t){return function(){var n=Y(H().mark((function n(r){var o,a;return H().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,qc(e,t,r);case 3:if(o=n.sent){n.next=6;break}throw new Error("Failed to fetch filter options.");case 6:return a=o.flatMap((function(e){return e?e.content.map((function(e){return e[0]})):[]})),n.abrupt("return",i.uniq(a).map((function(e){return{label:Je(e,(function(){throw"Async options should not be formatting a date time field."})),value:e}})));case 10:return n.prev=10,n.t0=n.catch(0),n.t0 instanceof Error?console.error(n.t0.message):console.error(n.t0),n.abrupt("return",[]);case 14:case"end":return n.stop()}}),n,null,[[0,10]])})));return function(e){return n.apply(this,arguments)}}()},Hc=function(e){var n=zc().runQueriesCallback,r=zl().cascadeFilterSelection,i=e.filter,o=e.filterIndex,a=e.dataSets,l=e.onChange,s=t.useState(null),u=s[0],d=s[1],p=t.useRef(void 0),f=function(){var e=Y(H().mark((function e(t){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vc(hr(i),n)(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return t.useEffect((function(){!function(){var e=Y(H().mark((function e(){var t,n;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.requiresValue||null!==i.value){e.next=6;break}return t=new AbortController,e.next=4,f(t.signal);case 4:(n=e.sent)&&n[0]?(Nr("Filter forcing initial value to be set."),d(n),l(U({},i,{value:n[0].value}))):Br("Ran select filter options to force a value, but no results were returned.");case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[JSON.stringify(i)]),t.useEffect((function(){r&&null!==p.current&&JSON.stringify(p.current)!==JSON.stringify(i.optionsFilters)&&d(null),p.current=i.optionsFilters}),[i.optionsFilters]),c.jsx(Dc,{showClearBtn:e.showClearBtn,anchorLeft:!0,placeholder:cr(i,a),options:u||f,currentValue:i.value,setSelected:function(t){e.onChange(U({},i,{value:t}))}},"filter-"+o)},Wc=Object.assign((function(){return null}),{button:function(e){var t,n=o.merge({},null==(t=ga.accordion)?void 0:t.button,e);return ua(U({},Oa.button,{color:null==n?void 0:n.color,fontSize:null==n?void 0:n.fontSize,fontWeight:null==n?void 0:n.fontWeight}))},icon:function(e){var t=o.merge({},ga.accordion,e);return ua({"& > *":{fill:null==t?void 0:t.iconColor}})}}),Yc=["sm"],Uc={name:"1hl83va",styles:"margin-bottom:0.75rem"},Gc={name:"jf4xqj",styles:"position:absolute;top:0px;right:2rem"},Kc={name:"duftww",styles:"position:absolute;top:0.25rem;right:0px"},Xc={name:"1e4sizb",styles:"margin-top:0.5rem"},Qc=function(e){var n,r=t.useState(e.defaultOpen||!1),i=r[0],o=r[1],a=us();return c.jsxs("div",{css:Uc,className:rs(sc("accordion",e,Yc)),children:[c.jsxs("button",{type:"button",onClick:function(){if(e.showAccordionIcon){var t=!i;o(t),t&&e.onOpened&&e.onOpened()}},css:["position:relative;width:100%;cursor:pointer;border-radius:0.5rem;text-align:left;",!i&&{cursor:"pointer"},e.sm&&{marginBottom:"0px"},"",""],className:rs(""+Wc.button(null==a||null==(n=a.accordion)?void 0:n.button)),"data-themeapi":"accordion.button","data-chipposition":"top.left",children:[c.jsx(Wd,{gap:"0.25rem",alignItems:"center",children:null==e?void 0:e.title}),e.renderAction&&c.jsx("div",{css:Gc,children:e.renderAction(i)}),e.showAccordionIcon&&c.jsx("span",{css:Kc,className:rs(""+Wc.icon(null==a?void 0:a.accordion)),"data-themeapi":"accordion.iconColor",children:c.jsx(e.Icon,{isOpen:i})})]}),i&&c.jsx("div",{className:lc("accordion-content"),css:Xc,children:e.children})]})},Jc=function(e){return c.jsx(Qc,U({},e,{Icon:ns}))},Zc=["labelHidden"],$c=["sm","error"],ep={name:"15jydtm",styles:"width:100%;appearance:none;text-align:left;line-height:1.25;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms"},tp=n.forwardRef((function(e,n){var r,o,a,l,s,u,d=us(),p=$(e,Zc);return c.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(kc,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),c.jsx("input",U({css:ep,id:null==e?void 0:e.id,ref:n},p,{className:rs(sc("input",e,$c),""+(a=null!=(r=null==e?void 0:e.inputTheme)?r:null==d||null==(o=d.forms)?void 0:o.input,l=null==e?void 0:e.error,u=i.merge({},null==(s=ga.forms)?void 0:s.input,a),ua(U({},u,{boxSizing:"border-box"},l?{outline:"2px solid rgb(239, 68, 68)",outlineOffset:-2}:{outline:"2px solid transparent",outlineOffset:-2},{position:"relative"})))),"data-themeapi":"forms.input","data-chipposition":"above.right",disabled:null==e?void 0:e.disabled}))]})})),np=n.forwardRef((function(e,t){return c.jsxs(c.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(kc,{htmlFor:null==e?void 0:e.id,children:null==e?void 0:e.label}),c.jsx("input",U({className:""+rp(),type:"checkbox",ref:t},e))]})})),rp=function(){return ua({float:"left",marginRight:"0.5rem",height:"1rem",width:"1rem",cursor:"pointer",appearance:"none",borderRadius:"0.125rem",borderWidth:2,borderStyle:"solid",backgroundSize:"contain",backgroundPosition:"center",backgroundRepeat:"no-repeat",verticalAlign:"top",transitionProperty:"all",borderColor:da(50),backgroundColor:"rgb(255, 255, 255)",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"200ms","&:checked":{borderColor:"rgb(48, 116, 217)",backgroundColor:"rgb(48, 116, 217)"},"&:hover":{borderColor:"rgb(48, 116, 217)"},"&:focus":{outline:"2px solid transparent",outlineOffset:2}})},ip=t.forwardRef((function(e,t){var n=us(),r=i.merge({},ga.lists,null==n?void 0:n.lists);return c.jsx("div",{className:rs(lc("listview-item"),""+$d.item(r)({highlight:e.highlight?"on":"off",clickable:e.onClick&&"on",componentPadding:null!=e&&e.padding?"true":"false"})),ref:t,"data-themeapi":"lists",children:null==e?void 0:e.children})})),op=ua(U({},sa,{opacity:0,cursor:"pointer",variants:{active:{true:U({},sa,{opacity:1})}}})),ap=ua({width:"100%",display:"flex",cursor:"pointer",height:16}),lp=ua(U({},sa,{width:12,color:"#1f293799",variants:{active:{true:U({},sa,{color:"rgba(93,103,119,0.6)"})}}})),sp=ua({position:"absolute",top:0,left:0,right:0,background:"transparent",variants:{active:{true:{"&:hover":{background:"rgb(229 231 235 / 0.2)",boxShadow:"0 0 #0000,0 0 #0000,0 1px 2px 0 rgb(0 0 0 / 0.05)",borderTopRightRadius:ha.size.borderRadius,borderTopLeftRadius:ha.size.borderRadius}}}}}),up=Object.assign((function(){return null}),{popover:function(e){return ua(U({background:da(0),zIndex:99999999999,padding:"6px 8px",borderRadius:4,fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,letterSpacing:"0.1em",color:"rgb(255, 255, 255)"},{minWidth:e}))}}),dp=Object.assign((function(e){var n,r,i,o=t.useState(null!=(n=null==e?void 0:e.showTooltip)&&n),a=o[0],l=o[1],s=t.useState(null),u=s[0],d=s[1],p=t.useState(null),f=p[1],m=x.usePopper(u,p[0],{placement:null!=(r=null==e?void 0:e.placement)?r:"bottom-start",modifiers:null!=(i=null==e?void 0:e.modifiers)?i:[]}),h=m.styles,v=m.attributes;return c.jsxs("div",{className:rs((null==e?void 0:e.className)&&""+(null==e?void 0:e.className)),children:[c.jsx("span",{ref:d,onMouseEnter:function(){return l(!0)},onMouseLeave:function(){return l(!1)},className:rs((null==e?void 0:e.classNameTrigger)&&""+(null==e?void 0:e.classNameTrigger)),children:e.children}),a&&c.jsx("div",U({ref:f,className:""+up.popover(null==e?void 0:e.tooltipMinWidth),style:U({},h.popper,{visibility:a?"visible":"hidden"})},v.popper,{children:e.tooltipContent()}))]})}),{Content:function(e){var t;return c.jsx("div",{children:null!=(t=e.text)?t:null==e?void 0:e.children})}}),cp=function(e){var t,n,r=o.merge({},null==ga?void 0:ga.dashboard,e);return ua(U({},sa,{cursor:"pointer",color:null==(t=r.icon)?void 0:t.color,"&:hover":U({},sa,{color:Qd(null==(n=r.icon)?void 0:n.color,1.5)})}))},pp=function(e){return c.jsx("div",{ref:e.dragSource,className:""+sp({active:null!=e&&e.enabled?"true":"false"}),style:null!=e&&e.height?{height:null==e?void 0:e.height}:{},children:(null==e?void 0:e.enabled)&&c.jsx(fp,{active:null==e?void 0:e.active,top:null==e?void 0:e.top})})},fp=function(e){var n,r=t.useState(!1),i=r[0],o=r[1],a=us();return c.jsx(dp,{tooltipContent:function(){return c.jsx(dp.Content,{children:"Drag to move"})},className:""+(n=null==e?void 0:e.top,ua(U({},sa,{position:"absolute",left:1,top:n})))({active:null!=e&&e.active?"true":"false"}),tooltipMinWidth:110,children:c.jsx("div",{className:""+op({active:null!=e&&e.active?"true":"false"}),children:c.jsxs("div",{className:""+ap,onMouseOver:function(){return o(!0)},onMouseLeave:function(){return o(!1)},"data-themeapi":"dashboard.icon",children:[c.jsx(v.DotsVerticalIcon,{className:lp({active:i?"true":"false"})+" "+cp(null==a?void 0:a.dashboard)}),c.jsx(v.DotsVerticalIcon,{className:lp({active:i?"true":"false"})+" "+cp(null==a?void 0:a.dashboard),style:{marginLeft:-8}})]})})})},mp=function(e){return c.jsx(null!=e&&e.onOrderChange?vp:gp,U({},e))},hp=function(){},vp=function(e){var n,r,i,o,a,l,s,u,d,p=(u=null==e?void 0:e.onOrderChange,n={id:"re-order-drag-"+e.index,index:e.index,type:"list-view-drag"},r=e.onOrderChange||hp,i=t.useRef(null),o=b.useDrop({accept:n.type,collect:function(e){return{handlerId:e.getHandlerId()}},hover:function(e,t){var o;if(i.current){var a=e.index,l=n.index;if(a!==l){var s=null==(o=i.current)?void 0:o.getBoundingClientRect(),u=(s.bottom-s.top)/2,d=t.getClientOffset().y-s.top;a<l&&d<u||a>l&&d>u||(r(a,l),e.index=l)}}}})[1],l=(a=b.useDrag({type:n.type,item:function(){return{id:n.id,index:n.index}},collect:function(e){return{isDragging:e.isDragging()}}}))[0].isDragging,s=a[2],(0,a[1])(o(i)),d=[i,s,l],u?[d[0],d[1]]:[null,null]);return c.jsx(gp,U({},e,{ref:p[0]}))},gp=t.forwardRef((function(e,n){var r=e.item,o=e.index,a=e.onDeleteItem,l=e.onOrderChange&&e.totalItemsCount>1,s=us(),u=t.useState(!1),d=u[0],p=u[1],f=i.merge({},ga.lists,null==s?void 0:s.lists);return c.jsx(Wd,{"data-component":"listview-item",role:"listitem","data-themeapi":"lists",children:c.jsxs("div",{style:{cursor:r.onClick?"pointer":void 0},onClick:function(){return r.onClick?r.onClick(o):void 0},className:""+$d.itemWrapper,onMouseOver:function(){return!!l&&p(!0)},onMouseLeave:function(){return!!l&&p(!1)},children:[c.jsx(ip,{clickable:!!r.onClick,highlight:r.highlight,ref:n,children:c.jsxs(Wd,{direction:"row","data-component":"list-cell-row",gap:"0.5rem",paddingY:"0.1rem",paddingRight:"0.1rem",paddingLeft:"0.5rem",alignItems:"center",position:"relative",children:[c.jsx("div",{className:""+$d.dragHandleContainer,children:!!l&&c.jsx(fp,{active:d,top:9})}),c.jsx(Md,{flex:1,paddingLeft:0,children:c.jsxs(Wd,{gap:"0.5rem",children:[(null==r?void 0:r.icon)&&c.jsx(rc,{icon:null==r?void 0:r.icon}),c.jsxs(Md,{flexGrow:1,paddingY:"5.5px","data-component":"list-title-subtext",children:["string"==typeof r.title?c.jsx("p",{className:""+$d.label(f),children:r.title}):c.jsx(t.Fragment,{children:r.title}),r.subtext&&c.jsx("p",{className:""+$d.metadata(f),children:r.subtext})]})]})}),r.select&&c.jsx("div",{className:""+$d.right,children:c.jsx(Tc,{labelHidden:!0,label:"Function",subtle:!0,showClearBtn:r.select.showClearBtn,onChange:function(e){var t;return null==(t=r.select)?void 0:t.onChange(e,o)},options:r.select.options,selected:r.select.selected,rightAligned:!0,id:"function_"+o})}),r.renderRight&&c.jsx("div",{className:""+$d.right,children:r.renderRight()}),r.editIcon&&c.jsx("div",{className:""+$d.edit,children:c.jsx(Jl,{})}),r.preventDelete&&c.jsx("div",{className:""+$d.edit,children:c.jsx(Zl,{})})]})}),a&&!r.preventDelete&&c.jsx("div",{className:""+$d.deleteWrapper(f),children:c.jsxs("button",{type:"button",className:""+$d.deleteButton(f),"data-testid":e.testId&&e.testId+"-"+o+"-remove",onClick:function(e){e.stopPropagation(),a&&a(o)},"aria-label":"Remove","data-themeapi":"lists.icon",children:[c.jsxs("span",{className:""+_a,children:["Remove ",r.title]}),c.jsx(Gl,{})]})})]})})})),bp=function(e){return c.jsx(Md,{paddingRight:null==e?void 0:e.paddingRight,as:null==e?void 0:e.as,children:c.jsx(os,{gap:"0.5rem",children:null==e?void 0:e.children})})},xp=function(e){var t,n,r,o,a,l,s,u,d,c,p,f,m,h,v,g=i.merge({},null==(t=ga.buttons)?void 0:t.add,null==e?void 0:e.theme);return ua({height:null!=(n=null==e?void 0:e.height)?n:"100%",width:"100%",transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",WebkitFontSmoothing:"antialiased",justifyContent:null!=(r=null==e?void 0:e.align)?r:"center",alignItems:"center",display:"flex",cursor:"pointer",padding:"0 12px 1px 12px",background:g.background,border:g.border,boxShadow:g.boxShadow,borderRadius:g.borderRadius,color:g.color,position:"relative","&:hover":yp(g),variants:{size:{small:{fontSize:null==(o=g.small)?void 0:o.fontSize,fontWeight:null==(a=g.small)?void 0:a.fontWeight,padding:null!=(l=null==(s=g.small)?void 0:s.padding)?l:"2px 8px 3px",height:"auto",width:"auto"},medium:{fontSize:null==(u=g.medium)?void 0:u.fontSize,fontWeight:null==(d=g.medium)?void 0:d.fontWeight,padding:null!=(c=null==(p=g.medium)?void 0:p.padding)?c:"0 12px"},large:{fontSize:null==(f=g.large)?void 0:f.fontSize,fontWeight:null==(m=g.large)?void 0:m.fontWeight,padding:null!=(h=null==(v=g.large)?void 0:v.padding)?h:"0 12px"}},isHovering:{true:yp(g)}}})};function yp(e){var t,n,r,i;return{transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",background:null==(t=e["&:hover"])?void 0:t.background,border:null==(n=e["&:hover"])?void 0:n.border,boxShadow:null==(r=e["&:hover"])?void 0:r.boxShadow,color:null==(i=e["&:hover"])?void 0:i.color}}var wp=function(e){var t,n,r,i=us();return c.jsx("button",{onClick:function(t){e.disabled||(t.preventDefault(),(null==e?void 0:e.onChange)&&(null==e||e.onChange()))},"data-component":null==e?void 0:e["data-component"],"data-testid":null==e?void 0:e.testId,className:rs(xp({height:null==e?void 0:e.height,align:null==e?void 0:e.align,theme:null!=(t=null==e?void 0:e.addTheme)?t:null==i||null==(n=i.buttons)?void 0:n.add})({size:null!=(r=null==e?void 0:e.size)?r:"medium"}),e.className),"data-themeapi":"buttons.add",disabled:e.disabled,children:c.jsx("span",{children:null==e?void 0:e.children})})},Cp=function(e){return c.jsx(Md,{children:c.jsx(wp,{testId:e.testId,onChange:function(){return null==e?void 0:e.onChange()},height:36,align:"left",disabled:e.disabled,children:c.jsxs(Wd,{children:["+ ",e.label]})})})},jp=function(e){return void 0===(null==e?void 0:e.children)?null:c.jsx(os,{gap:e.hasDeleteIcon?"0.9rem":"0.5rem",className:lc("listview"),columns:["repeat(1,minmax(0,1fr))"],"data-component":"list-view",role:"list",children:null==e?void 0:e.children})};function Fp(e){var t,r=i.orderBy(e.initValues,(function(e){return e.title})),o=n.useState(null!=(t=null==e?void 0:e.isOpen)&&t),a=o[0],l=o[1],s=Vd(r,["title","subtext"]),u=s.setSearch,d=s.values,p=s.searchString,f=n.useRef(null);return ss(f,(function(){return l(!1)})),e.hide?null:c.jsxs("div",{className:""+$d.addWrapper,ref:f,children:[c.jsx(Md,{marginTop:e.marginTop,"data-component":"new-item",children:c.jsx(Cp,{testId:e.testId,onChange:function(){var t=!a;t&&e.onOpenDropdown&&e.onOpenDropdown(),l(t)},label:e.callToAction})}),c.jsxs(ac,{open:a,fixedHeight:!0,children:[c.jsx(Md,{padding:8,children:c.jsx(tp,{id:(null==e?void 0:e.id)+"-add-item",label:"Add Item",labelHidden:!0,autoFocus:!0,defaultValue:p,onChange:function(e){return u(e.target.value)}})}),d.map((function(t){return c.jsx(ac.Option,{testId:e.testId+"-option-"+t.refIndex,onChange:function(){return(n=r[t.refIndex]).onSelected&&n.onSelected(n.value),e.onNew&&e.onNew(n.value),void l(!1);var n},label:t.item.title,subtext:t.item.subtext,icon:t.item.icon},"list_view_"+t.refIndex+"_option")}))]})]})}function Sp(e){var n,r;return c.jsxs(bp,{paddingRight:null!=(n=null==e?void 0:e.paddingRight)?n:"0.25rem",children:[e.items.length>0&&c.jsx(jp,{children:[].concat(e.items).map((function(t,n){return c.jsx(mp,{mode:null==e?void 0:e.mode,testId:e.testId,onDeleteItem:e.onDeleteItem,onOrderChange:e.onOrderChange,item:t,index:n,totalItemsCount:e.items.length},"list_view_item_"+n)}))}),c.jsxs(t.Fragment,{children:[e.newItem&&c.jsx(Fp,U({},e.newItem,{testId:e.testId,id:null==e?void 0:e.id,marginTop:e.items.length>0?"0.50rem":void 0})),e.newItemBtn&&c.jsx(Cp,{testId:e.testId,onChange:null==(r=e.newItemBtn)?void 0:r.onClick,label:e.newItemBtn.callToAction,disabled:null==e?void 0:e.newItemBtn.disabled})]})]})}var kp=function(e){var t=e.children;return c.jsx("div",{id:e.id,className:""+Tp({queriesAreChanging:e.queriesAreChanging,overflowScroll:e.overflowScroll,justifyCenter:e.justifyCenter}),children:t})},Tp=ua({display:"flex",width:"100%",height:"100%",flexDirection:"column",variants:{queriesAreChanging:{false:{},true:{filter:"blur(1px)"}},overflowScroll:{false:{},true:U({overflow:"auto"},Yd)},justifyCenter:{false:{},true:{justifyContent:"center"}}}}),Ap=["sm","primary","secondary","disabled","loading"],Dp=ql((function(e){var t,n,r,o,a,l,s=us();return c.jsx("button",U({},((t={})["data-componentoverride"]="renderButtonComponent",t),{"data-component":null==e?void 0:e["data-component"],"data-testid":e.testId,onClick:e.onClickWithDevToolCheck&&e.onClickWithDevToolCheck(e.onClick),disabled:e.disabled,className:rs(sc("button",e,Ap),""+(n=null==s?void 0:s.buttons,a=i.merge({},null==(r=ga.buttons)?void 0:r.primary,null==n?void 0:n.primary),l=i.merge({},null==(o=ga.buttons)?void 0:o.secondary,null==n?void 0:n.secondary),ua(U({},Oa.button,{transitionDuration:"150ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",cursor:"pointer",letterSpacing:"normal",whiteSpace:"nowrap",transform:"translateY(0) scale(1)",lineHeight:"inherit","&:disabled":{opacity:.7,cursor:"inherit"},"&:disabled:hover":{opacity:.95,cursor:"inherit"},variants:{type:{primary:{},secondary:{}},highlight:{false:{outline:"2px solid transparent",outlineOffset:-2},true:{outline:"2px solid rgb(239, 68, 68)",outlineOffset:-2}},block:{true:{display:"block",width:"100%"}}},compoundVariants:[{type:"primary",css:U({},a)},{type:"secondary",css:U({},l)}]})))({type:null!=e&&e.primary?"primary":"secondary",highlight:!!(null!=e&&e.highlight||null!=e&&e.activeDevToolHighlight),block:null==e?void 0:e.block}),null==e?void 0:e.className),"data-themeapi":e.internal?void 0:"buttons."+(null!=e&&e.primary?"primary":"secondary"),children:e.children}))}),"renderButtonComponent"),Ip={name:"t91scv",styles:"display:grid;place-content:center"},Pp=function(e){var n=t.useState("initial"),r=n[0],i=n[1],o=e.autoFeedback?Y(H().mark((function t(){var n;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=!1,!e.onClick){t.next=7;break}return i("loading"),t.next=5,e.onClick();case 5:i((n=!!t.sent)?"success":"error");case 7:return t.abrupt("return",n);case 8:case"end":return t.stop()}}),t)}))):e.onClick,a=(e.error||"error"==r?"error":(e.isLoading||"loading"==r)&&"loading")||(e.success||"success"==r)&&"success"||r;return c.jsxs(Dp,{testId:e.testId,error:"error"==a,isLoading:"loading"==a,primary:!e.secondary,secondary:e.secondary,onClick:o,type:e.type,disabled:e.disabled,"data-component":null==e?void 0:e["data-component"],block:null==e?void 0:e.block,internal:null==e?void 0:e.internal,className:null==e?void 0:e.className,children:[c.jsx("div",{css:["loading"==a&&{visibility:"hidden"},"",""],children:e.children}),"loading"==a&&c.jsx("div",{css:Ip,children:c.jsx(cc,{color:"white"})})]})},_p=t.createContext({addToast:function(){throw"not implemented."}}),Ep={name:"zjik7",styles:"display:flex"},Op={name:"1x3jg5i",styles:"margin-left:0.75rem"},Lp=function(e){return c.jsxs("div",{css:Ep,children:[c.jsx("span",{children:e.renderIcon()}),c.jsx("span",{css:Op,children:e.message})]})},Mp={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Rp=function(e){return c.jsx(Lp,{message:e.message,renderIcon:function(){return c.jsx("svg",{css:Mp,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})})}})},Np={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},zp=function(e){return c.jsx(Lp,{message:e.message,renderIcon:function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",css:Np,viewBox:"0 0 20 20",fill:"#6fe8ba",children:c.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}})},Bp={name:"6u431h",styles:"position:fixed;left:1.25rem;bottom:1.25rem"},qp={name:"yuw6vf",styles:"margin-top:0.75rem;border-radius:0.5rem;background-color:rgb(0 0 0 / 0.9);padding-top:0.75rem;padding-bottom:0.75rem;padding-left:1.5rem;padding-right:1.5rem;letter-spacing:0.025em;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity));--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)"};function Vp(e){var n=e.children,r=t.useState([]),o=r[0],a=r[1],l=t.useRef([]),s=t.useCallback((function(e,t){if(t){if(l.current.includes(t))return;l.current=[].concat(l.current,[t])}a((function(t){return[e].concat(t)})),setTimeout((function(){t&&i.remove(l.current),a((function(e){return e.slice(void 0,-1)}))}),7500)}),[a]);return c.jsxs(_p.Provider,{value:{addToast:s},children:[c.jsx("div",{css:Bp,style:{zIndex:2147483647},children:o.map((function(e,t){return c.jsx("div",{css:qp,children:e()},"toast_"+t)}))}),n]})}function Hp(){return t.useContext(_p)}var Wp,Yp=function(e){var t=zl(),n=t.textOverrides,r=t.developerTools,i=Hp().addToast,o=("string"==typeof e.override?[e.override]:e.override).find((function(e){return!!n[e]})),a=c.jsx(c.Fragment,{children:o?n[o]:e.children});return r?c.jsx("span",{onMouseEnter:function(){i((function(){return c.jsx(Rp,{message:"Change the text with 'textOverride' property '"+e.override+"'"})}),"unique-text-override-"+e.override)},children:a}):c.jsx(c.Fragment,{children:a})},Up=ua({display:"grid",height:"100%",width:"100%",alignContent:"center"}),Gp=ua({margin:"auto",textAlign:"center"}),Kp=ua(U({},Oa.text,{fontSize:"1.5rem",lineHeight:"2rem",color:"inherit",variants:{textOpacity:(Wp={},Wp[60]={opacity:60},Wp[40]={opacity:40},Wp)}})),Xp=ua({marginTop:"0.75rem",fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,letterSpacing:"0.1rem",opacity:.8}),Qp=Object.assign((function(e){var t;return c.jsx("div",{className:""+Up,children:c.jsxs("div",{className:""+Gp,children:[c.jsx("h1",{className:""+Kp({opacity:e.opacity}),children:e.title}),null!=(t=null==e?void 0:e.children)?t:e.renderExtra&&e.renderExtra()]})})}),{Extra:function(e){return c.jsx("div",{className:""+Xp,children:null==e?void 0:e.children})}}),Jp=function(e){return c.jsx(Qp,{opacity:40,title:null==e?void 0:e.title,children:e.renderExtra&&e.renderExtra()})},Zp={name:"13b3q89",styles:"margin-top:0.75rem;max-width:36rem;font-size:0.75rem;line-height:1rem;font-weight:500;letter-spacing:0.1em;opacity:0.5"},$p={name:"akdqam",styles:"margin-top:1rem"},ef=function(){return c.jsx(Qp,{title:"We have failed to load your dashboard",renderExtra:function(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{css:Zp,className:""+Ea.text,children:"An internal error occurred, please try again soon."}),c.jsx("div",{css:$p,children:c.jsx(Pp,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},tf=function(){return c.jsx(Qp,{title:"There is an issue with your configuration settings.",renderExtra:function(){return c.jsx("p",{className:""+Ea.text,children:"See logs for more details."})}})},nf={name:"13b3q89",styles:"margin-top:0.75rem;max-width:36rem;font-size:0.75rem;line-height:1rem;font-weight:500;letter-spacing:0.1em;opacity:0.5"},rf={name:"akdqam",styles:"margin-top:1rem"},of=function(){return c.jsx(Qp,{title:"We have failed to load your dashboard",renderExtra:function(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{css:nf,className:""+Ea.text,children:"We were unable to verify your identity"}),c.jsx("div",{css:rf,children:c.jsx(Pp,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},af={name:"12dms0z",styles:"margin-top:1rem;width:100%"},lf=function(e){return c.jsx(Qp,{title:"This view has changed",renderExtra:function(){return c.jsx(Qp.Extra,{children:c.jsxs(Yp,{override:"view.data-set-changed",children:["A field this view was using has been removed.",c.jsx("div",{css:af,children:c.jsx(Pp,{"data-component":"remove-missing-field",onClick:function(){return e.removeMissingField()},children:"Auto fix"})})]})})}})},sf=function(e){var t;return c.jsx(Qp,{title:null!=(t=null==e?void 0:e.title)?t:"Query under construction 🏗",renderExtra:function(){var t;return c.jsx(Qp.Extra,{children:null!=(t=null==e?void 0:e.children)?t:"Not all required properties have been set to render this component"})}})},uf=function(){return c.jsx(Qp,{title:c.jsx(Yp,{override:"view.failed-to-fetch-results",children:"Failed to fetch the data 🤔"})})},df=function(){return c.jsx(Qp,{title:"This view is not available"})},cf=function(e){return c.jsxs(kp,{queriesAreChanging:!1,children:[c.jsx(Bm,U({},e)),c.jsx(Qp,{title:c.jsx(Yp,{override:"view.empty-results",children:"No data to show"})}),e.children]})},pf={name:"1g0vxgi",styles:"margin-top:0.75rem"},ff=function(e){return c.jsx(Qp,{title:"Something went wrong 😞",renderExtra:function(){return c.jsx(Pp,{onClick:e.onManualRetry,css:pf,children:"retry"})}})},mf=function(e){return c.jsx("h3",U({},e,{children:e.children}))},hf=function(e){return c.jsx("p",U({},e,{children:e.children}))},vf=function(e){return c.jsx("p",U({},e,{className:rs(p.css({name:"1xpc8ph",styles:"font-size:0.75rem;line-height:1rem;font-weight:500;text-transform:capitalize"}),p.css(2===(null==e?void 0:e.marginBottom)?{name:"1gok8e8",styles:"margin-bottom:0.5rem"}:{name:"1tlmwo2",styles:"margin-bottom:0px"})),children:e.children}))},gf=ua(U({overflow:"overlay"},Yd)),bf=function(e){var t,n=i.merge({},null==(t=ga.modals)?void 0:t.footer,e);return ua(U({},n,{variants:{buttons:{end:{display:"grid",justifyContent:"end"}}}}))},xf=function(e){var t,n,r,o,a,l,s,u,d,p=e.title,f=e.hiddenUnlessEnabledInCss,m=e.className,h=e.show,g=e.hide,b=us();return c.jsx("div",{className:rs(lc("modal-header"),""+(s=null==b||null==(t=b.modals)?void 0:t.header,d=i.merge({},null==(u=ga.modals)?void 0:u.header,s),ua(U({width:"100%",lineHeight:"1.5rem"},d,{"& h3":Oa.text,variants:{hidden:{true:{position:"absolute",left:-1e4,top:"auto",width:1,height:1,overflow:"hidden"}}}})))({hidden:null!=(n=null!=(r=null==b||null==(o=b.modals)?void 0:o.header)?r:f)&&n})),"data-themeapi":"modals.header",style:g?{display:"none"}:h||null!=b&&null!=(a=b.modals)&&a.header?{display:"block"}:{display:"none"},"data-component":null!=(l=null==e?void 0:e["data-component"])?l:"modal-header",children:c.jsxs(Wd,{className:rs(null!=m?m:void 0),alignItems:"center",gap:"0.25rem",children:[c.jsx(mf,{children:p}),(null==e?void 0:e.tooltip)&&c.jsx(Md,{width:18,children:c.jsx(dp,{tooltipContent:function(){return c.jsx(dp.Content,{children:e.tooltip})},children:c.jsx(v.QuestionMarkCircleIcon,{"aria-label":"Help",color:da(30)})})})]})})},yf=function(e){var t,n,r,i,o,a=null!=(t=null==e?void 0:e.buttons)?t:"end",l=us();return c.jsx("div","space-between"===(null==e?void 0:e.buttons)?{className:rs(lc("modal-footer"),""+bf(null==l||null==(i=l.modals)?void 0:i.footer)({buttons:a}),null==e?void 0:e.className),"data-themeapi":"modals.footer","data-component":null!=(o=null==e?void 0:e["data-component"])?o:"modal-footer","data-chipposition":"bottom.center",children:c.jsx(Wd,{gap:"0.75rem",justifyContent:"space-between",children:null==e?void 0:e.children})}:{className:rs(lc("modal-footer"),""+bf(null==l||null==(n=l.modals)?void 0:n.footer)({buttons:null==e?void 0:e.buttons}),null==e?void 0:e.className),"data-themeapi":"modals.footer","data-component":null!=(r=null==e?void 0:e["data-component"])?r:"modal-footer","data-chipposition":"bottom.center",children:null==e?void 0:e.children})},wf=function(e){var t,n,r,o,a,l=e.children,s=e.className,u=us();return c.jsx("div",{className:rs(null!=e&&e.scrollable?""+gf:void 0,lc("modal-content"),""+(r=null==u||null==(t=u.modals)?void 0:t.content,a=i.merge({},null==(o=ga.modals)?void 0:o.content,r),ua({fontWeight:null==a?void 0:a.fontWeight,fontSize:null==a?void 0:a.fontSize,padding:null==a?void 0:a.padding,background:null==a?void 0:a.background,variants:{scrollable:{true:U({background:a.alternativeBackground,paddingBottom:"0.75rem"},{"@media (max-height: 768px)":{height:420},"@media (min-height: 768px)":{height:600}})}}}))({scrollable:null!=e&&e.scrollable?"true":"false"}),s),"data-themeapi":"modals.content","data-component":null!=(n=null==e?void 0:e["data-component"])?n:"modal-content",children:l})},Cf={name:"1px9jck",styles:"min-height:100vh;padding-left:1rem;padding-right:1rem;text-align:center"},jf={name:"8pnu7z",styles:"display:inline-block;height:100vh;vertical-align:middle"},Ff=function(e){var n,r,o,a,l,s,u=t.useRef();e.width&&(u.current=e.width);var d,f,m,h=If();return c.jsx("div",{style:{display:"inherit",zIndex:null!=(n=null==h||null==(r=h.base)?void 0:r.zIndex)?n:2147483147},children:c.jsx(Od,{appear:!0,show:e.isOpen,children:c.jsxs(Qu,{style:{zIndex:null!=(o=null==h||null==(a=h.base)?void 0:a.zIndex)?o:2147483147},"data-themeapi":"modals.base",className:rs(p.css({name:"18w3cuy",styles:"position:fixed;top:0px;right:0px;bottom:0px;left:0px;overflow-y:auto;overflow-x:hidden"}),"vizzly-modals"),onClose:function(){var t;return!(null!=h&&null!=(t=h.options)&&t.disableOutsideClick)&&e.onClose()},"data-testid":"modal",static:!(null!=h&&null!=(l=h.options)&&l.disableOutsideClick),children:[c.jsx(Qu.Overlay,{className:rs(lc("modal-overlay"),""+(d=null==h?void 0:h.overlay,m=i.merge({},null==(f=ga.modals)?void 0:f.overlay,d),ua(U({position:"fixed",top:0,right:0,bottom:0,left:0},m,{variants:{dark:{true:{opacity:.7},false:{opacity:m.opacity}}}})))({dark:null!=(s=null==e?void 0:e.dark)&&s})),"data-themeapi":"modals.overlay"}),c.jsxs("div",{"data-testid":e["data-testid"],css:Cf,children:[c.jsx("span",{css:jf,"aria-hidden":"true",children:""}),c.jsxs(Od.Child,{enter:"v_contentEnter",enterFrom:"v_contentEnterFrom",enterTo:"v_contentEnterTo",leave:"v_contentLeave",leaveFrom:"v_contentLeaveFrom",leaveTo:"v_contentLeaveTo",css:["margin-top:2rem;margin-bottom:2rem;display:inline-block;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));text-align:left;vertical-align:middle;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;","sm"==u.current&&{width:"100%",maxWidth:"24rem"},"xl"==u.current&&{width:"100%",maxWidth:"36rem"},"2xl"==u.current&&{width:"100%",maxWidth:"42rem"},"4xl"==u.current&&{width:"100%",maxWidth:"56rem"},"7xl"==u.current&&{width:"100%",maxWidth:"80rem"},"",""],children:[!e.hideCloseIcon&&c.jsx(Af,{onClick:e.onClose}),c.jsx(Sf,{vizzlyPrefix:lc("modal-wrapper",e.namespace),children:e.children})]})]})]})})})},Sf=function(e){var t,n,r,o,a,l=us();return c.jsx("div",{className:rs(null==e?void 0:e.vizzlyPrefix,""+(r=null==l||null==(t=l.modals)?void 0:t.base,a=i.merge({},null==(o=ga.modals)?void 0:o.base,r),ua(U({},a,{variants:{hasFooter:{true:{},false:{borderBottomLeftRadius:a.borderRadius,borderBottomRightRadius:a.borderRadius}},hasHeader:{true:{},false:{borderTopLeftRadius:a.borderRadius,borderTopRightRadius:a.borderRadius}}}}))),"modal-body"),"data-themeapi":"modals.base","data-component":null!=(n=null==e?void 0:e["data-component"])?n:"modal-body","data-chipposition":"above.center",children:null==e?void 0:e.children})},kf={name:"1f0fr1j",styles:"position:absolute;top:-1.5rem;right:-1.5rem"},Tf={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Af=function(e){var t;return"none"===(null==(t=If().options)?void 0:t.closeButton)?null:c.jsx("button",{type:"button","data-testid":"close-modal",onClick:function(){return e.onClick()},css:kf,className:rs(lc("modal-close"),""+Ea.button),"data-themeapi":"modals.options.closeButton","data-component":"modal-close-button",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"#FFF",css:Tf,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})},Df=Object.assign(Ff,{Header:xf,Footer:yf,Content:wf}),If=function(){var e;return o.merge({},ga.modals,null==(e=us())?void 0:e.modals)},Pf=Object.assign((function(){return null}),{list:function(e){var t;return ua({position:"relative",width:"100%",display:"grid",gridTemplateColumns:null==e?void 0:e.columns,padding:null!=(t=null==e?void 0:e.padding)?t:"0 0.5rem",margin:"0 0 1.5rem 0",borderBottom:null!=e&&e.theme&&null!=e&&e.theme.borderBottom?null==e?void 0:e.theme.borderBottom:"0px solid transparent"})},button:function(e){var t,n,r,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,C,j,F,S,k,T,A,D=i.merge({},ga.tabs,e);return ua(U({lineHeight:"1rem",letterSpacing:"0.1em",whiteSpace:"nowrap"},sa,{position:"relative",variants:{state:{unselected:{borderRadius:null==D||null==(t=D.unselected)?void 0:t.borderRadius,padding:null==D||null==(n=D.unselected)?void 0:n.padding,fontSize:null==D||null==(r=D.unselected)?void 0:r.fontSize,fontWeight:null==D||null==(o=D.unselected)?void 0:o.fontWeight,color:null==D||null==(a=D.unselected)?void 0:a.color,boxShadow:null==D||null==(l=D.unselected)?void 0:l.boxShadow,background:null!=(s=null==D||null==(u=D.unselected)?void 0:u.background)?s:"inherit",border:null==D||null==(d=D.unselected)?void 0:d.border,borderRight:null==D||null==(c=D.unselected)?void 0:c.borderRight,borderLeft:null==D||null==(p=D.unselected)?void 0:p.borderLeft,borderTop:null==D||null==(f=D.unselected)?void 0:f.borderTop,borderBottom:null==D||null==(m=D.unselected)?void 0:m.borderBottom,"&:hover":U({},sa,null==D||null==(h=D.unselected)?void 0:h["&:hover"])},selected:{borderRadius:null==D||null==(v=D.selected)?void 0:v.borderRadius,padding:null==D||null==(g=D.selected)?void 0:g.padding,fontSize:null==D||null==(b=D.selected)?void 0:b.fontSize,fontWeight:null==D||null==(x=D.selected)?void 0:x.fontWeight,color:null==D||null==(y=D.selected)?void 0:y.color,boxShadow:null==D||null==(w=D.selected)?void 0:w.boxShadow,background:null==D||null==(C=D.selected)?void 0:C.background,border:null==D||null==(j=D.selected)?void 0:j.border,borderRight:null==D||null==(F=D.selected)?void 0:F.borderRight,borderLeft:null==D||null==(S=D.selected)?void 0:S.borderLeft,borderTop:null==D||null==(k=D.selected)?void 0:k.borderTop,borderBottom:null==D||null==(T=D.selected)?void 0:T.borderBottom,"&:hover":U({},sa,null==D||null==(A=D.selected)?void 0:A["&:hover"])}},button:{true:{cursor:"pointer",padding:"0.5rem",border:0,whiteSpace:"nowrap"}}}}))},panel:function(e,t){return ua({paddingLeft:null!=e?e:"0.5rem",paddingRight:null!=t?t:"0.5rem"})},hasChanges:ua({fontSize:8})}),_f=["children","paddingLeft","paddingRight"],Ef=Object.assign((function(){return null}),{Group:function(e){return c.jsx(vd.Group,U({},e,{children:c.jsx("div",{className:lc("tab-group"),children:e.children})}))},Button:function(e){var t=us();return c.jsx(vd,U({},e,{className:""+Ea.button,children:function(n){var r=n.selected;return c.jsx("div",{className:rs(sc("tab-button",{selected:r},["selected"]),""+Pf.button(null==t?void 0:t.tabs)({state:r?"selected":"unselected"})),"data-themeapi":"tabs-"+(r?"selected":"unselected"),children:e.children})}}))},Panel:function(e){var t=e.children,n=e.paddingLeft,r=e.paddingRight,i=$(e,_f);return c.jsx(vd.Panel,U({className:rs(lc("tab-panel"),""+Pf.panel(n,r))},i,{children:t}))},Panels:function(e){return c.jsx(vd.Panels,U({},e,{children:e.children}))},List:function(e){var t=us();return c.jsx(vd.List,U({className:rs(lc("tab-button-list"),""+Pf.list({columns:null==e?void 0:e.columns,theme:null==t?void 0:t.tabs,padding:null==e?void 0:e.padding}))},e,{"data-themeapi":"tabs","data-chipposition":"above.left",children:e.children}))}}),Of=function(e){var t;return c.jsx(Wd,{className:rs(sc("button-group",e,[])),gap:"0.75rem",justifyContent:null!=(t=null==e?void 0:e.buttons)?t:"start","data-component":e["data-component"],children:e.children})},Lf=ua({borderWidth:0,padding:0,marginLeft:0,marginRight:0}),Mf=function(e){var t;return c.jsx(Md,{className:rs(lc("panel-property"),""+Lf),marginBottom:"0.75rem",as:null!=(t=null==e?void 0:e.as)?t:"div",children:e.children})},Rf=function(e,t,n){return[].concat(t).flatMap((function(t,r){var i=!n.includes(r);return[].concat(function(e){return[].concat(e.fields).filter((function(e){return!kt(e)}))}(t)).filter((function(t){var n;return("dateFilter"==(n=e)||"dateAndTimeFilter"==n||"dateTimeFilter"==n?["date_time"]:["number","string","boolean","string[]"]).includes(t.dataType)})).map((function(e){return{label:t.name+" · "+e.publicName,value:{dataSetId:t.id,field:e},hide:i}}))}))},Nf=function(e,t){switch(t.type){case"setSelectedFields":return function(e,t){return U({},e,{selectedFieldIndexes:t.selectedFieldIndexes})}(e,t);case"setSelectedDataSets":return function(e,t){var n=t.selectedDataSetIndexes,r=e.dataSets,o=e.selectedFieldIndexes,a=Rf(e.type,r,e.selectedDataSetIndexes);return o=i.remove(o,(function(e){var t=Nn(r,a[e].value.dataSetId);return n.includes(t[1])})),U({},e,{selectedDataSetIndexes:n,selectedFieldIndexes:o})}(e,t);case"setTitle":return function(e,t){return U({},e,{title:t.title})}(e,t);case"setType":return function(e,t){return U({},e,{selectedFieldIndexes:[],type:t.filterType})}(e,t);default:return U({},e)}},zf={type:"singleSelectFilter",appliesToFields:[],title:"",value:null,requiresValue:!1,managedByConfiguration:!1},Bf=function(e){var r,o=function(e,t){var r=i.uniq([].concat(e.appliesToFields).map((function(e){return t.findIndex((function(t){return t.id==e.dataSetId}))}))),o=[].concat(e.appliesToFields).flatMap((function(n){var i=Rf(e.type,t,r).findIndex((function(e){return e.value.dataSetId==n.dataSetId&&n.fieldId==e.value.field.id}));return-1==i?[]:[i]})),a=n.useReducer(Nf,{title:e.title,type:e.type,selectedDataSetIndexes:r,dataSets:t,selectedFieldIndexes:o}),l=a[0],s=a[1];!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(l);var u=[].concat(t).map((function(e){return{label:e.name,value:e.id}})),d=Rf(l.type,t,l.selectedDataSetIndexes),c=[].concat(l.selectedFieldIndexes).map((function(e){var t=d[e].value;return{dataSetId:t.dataSetId,fieldId:t.field.id}}));return{selectedFieldIndexes:l.selectedFieldIndexes,selectedDataSetIndexes:l.selectedDataSetIndexes,dataSetOptions:u,fieldOptions:d,dispatch:s,globalFilter:{type:l.type,appliesToFields:c,title:l.title,value:null,managedByConfiguration:!1,requiresValue:!1}}}(e.current||zf,e.dataSets),a=o.fieldOptions,l=o.dataSetOptions,s=o.globalFilter,u=o.dispatch,d=o.selectedDataSetIndexes,p=o.selectedFieldIndexes,f=zl().featureToggles;return t.useEffect((function(){1===e.dataSets.length&&u({type:"setSelectedDataSets",selectedDataSetIndexes:[0]})}),[]),c.jsxs(c.Fragment,{children:[c.jsx(Df.Header,{title:"New filter",show:!0}),c.jsxs(Df.Content,{children:[c.jsx(Mf,{children:c.jsx(tp,{label:"Title",id:"title",placeholder:"Title",value:s.title,onChange:function(e){u({type:"setTitle",title:e.target.value})}})}),e.dataSets.length>1&&c.jsx(Mf,{children:c.jsx($f,{id:"data-set",label:"Data sets",placeholder:"Which data sets will this filter impact?",options:l,selected:d,setSelected:function(e){u({type:"setSelectedDataSets",selectedDataSetIndexes:e})}})}),c.jsx(Mf,{children:c.jsx(Tc,{id:"filter-type",label:"Filter type",anchorLeft:!0,selected:s.type,onChange:function(e){u({type:"setType",filterType:e})},options:(r=[{label:"Single select",value:"singleSelectFilter"},{label:"Multi select",value:"multiSelectFilter"}],f.showDateFilter&&r.push({label:"Date picker",value:"dateFilter"}),f.showDateAndTimeFilter&&r.push({label:"Date Time picker",value:"dateAndTimeFilter"}),r)})}),c.jsx(Mf,{children:c.jsx($f,{label:"Fields",id:"data-set-fields",placeholder:"Which fields are affected?",options:a,selected:p,setSelected:function(e){u({type:"setSelectedFields",selectedFieldIndexes:e})}})})]}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{secondary:!0,onClick:function(){return null!=e&&e.saving?void 0:e.onCancel()},disabled:null==e?void 0:e.saving,children:"Cancel"}),c.jsx(Pp,{onClick:function(){return null!=e&&e.saving?void 0:void e.setFilter(s)},disabled:null==e?void 0:e.saving,children:"Confirm"})]})})]})},qf=Object.assign((function(){}),{svg:function(e){var t,n,r,i=Vf(e);return ua({display:"block",width:"100%",position:"relative",variants:{alertType:{warning:{fill:null==i||null==(t=i.warning)?void 0:t.iconColor,transform:"rotate(180deg)"},info:{fill:null==i||null==(n=i.info)?void 0:n.iconColor,transform:"rotate(180deg)"},critical:{fill:null==i||null==(r=i.critical)?void 0:r.iconColor}}}})},icon:ua({paddingTop:0,display:"block",height:"1rem",width:"1rem"})}),Vf=function(e){return i.merge({},null==ga?void 0:ga.alerts,e)},Hf=function(e){var t,n=us();return c.jsxs("div",{className:rs(""+qf.icon,null==e?void 0:e.className),role:"alert",children:[c.jsx("span",{className:""+_a,children:null==e?void 0:e.title}),c.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+qf.svg(null==n?void 0:n.alerts)({alertType:"critical"}),focusable:"false","aria-hidden":"true",children:c.jsx("path",{d:"M11.768.768a2.5 2.5 0 0 0-3.536 0l-7.464 7.464a2.5 2.5 0 0 0 0 3.536l7.464 7.464a2.5 2.5 0 0 0 3.536 0l7.464-7.464a2.5 2.5 0 0 0 0-3.536l-7.464-7.464zm-2.768 5.232a1 1 0 1 1 2 0v4a1 1 0 1 1-2 0v-4zm2 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})}:{viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",className:""+qf.svg(null==n?void 0:n.alerts)({alertType:null!=(t=null==e?void 0:e.type)?t:"info"}),children:c.jsx("path",{fillRule:"evenodd",d:"M10 20c5.514 0 10-4.486 10-10s-4.486-10-10-10-10 4.486-10 10 4.486 10 10 10zm1-6a1 1 0 1 1-2 0v-4a1 1 0 1 1 2 0v4zm-1-9a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"})})]})},Wf=function(e){var r=e.filters,i=e.dataSets,o=e.show,a=e.onClose,l=e.source,s=e.onDeleteItem,u=e.onUpdate,d=t.useState(!1),p=d[0],f=d[1],m=t.useState([]),h=m[0],v=m[1],g=n.useState(null),b=g[0],x=g[1],y=Array.isArray(r)?[].concat(r).map((function(e,t){var n={};return 0===e.appliesToFields.length&&(n={renderRight:function(){return c.jsx(dp,{tooltipContent:function(){return c.jsx(dp.Content,{children:"There are no fields on this Filter. It should be deleted or a field added."})},children:c.jsx(Hf,{title:"There are no fields on this Filter. It should be deleted or a field added.",type:"warning",className:""+Uf})})}}),U({preventDelete:e.managedByConfiguration,title:cr(e,i),subtext:ar(e.type)+" for "+Xe(e.appliesToFields.length,"field","fields")+" "+Qe([].concat(e.appliesToFields).map((function(e){var t=Mn(i,e.dataSetId);return t?Rn(t,e.fieldId).publicName:""})))},n,{editIcon:!e.managedByConfiguration,onClick:e.managedByConfiguration?function(){}:function(){return x({draftFilter:e,filterIndex:t})}})})):[];t.useEffect((function(){p&&h&&r.length>h.length&&f(!1)}),[p,h,r]);var w=zl().mode;return c.jsxs(c.Fragment,{children:[c.jsxs(Df,{width:"xl","data-testid":"manage-filters-modal",isOpen:o,onClose:function(){return a()},children:[c.jsx(Df.Header,{title:("global"===l?"Dashboard":"Add Local")+" filters",show:!0}),c.jsx(Df.Content,{children:c.jsx(Sp,{mode:w,onDeleteItem:s,newItemBtn:{callToAction:"New "+("global"===l?"dashboard":"local")+" filter",onClick:function(){x({filterIndex:void 0,draftFilter:zf}),v(r)}},items:y})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsx(Pp,{onClick:function(){return a()},secondary:!0,children:"Close"})})]}),c.jsx(Df,{width:"xl","data-testid":"edit-filter",isOpen:null!=b,onClose:function(){},hideCloseIcon:!0,children:c.jsx(Bf,{onCancel:function(){return x(null)},current:(null==b?void 0:b.draftFilter)||null,setFilter:function(e){f(!0),v(r),u({filter:e,index:null==b?void 0:b.filterIndex}),x(null)},dataSets:i,saving:p})})]})};function Yf(e,t){var n=t.filter,r=t.index,i=[].concat(e);return void 0===r?i=[].concat(i,[n]):r>=0&&r<i.length&&(i[r]=n),i}var Uf=ua({paddingTop:0}),Gf=function(){var e=zc(),t=e.dashboard,r=e.dispatch,i=e.broadcastEvent,o=n.useState(!1),a=o[0],l=o[1];if(!t)return null;var s=function(e){r({type:"setGlobalFilters",globalFilters:e})};return c.jsxs(c.Fragment,{children:[c.jsx(Kf,{onChange:function(){i("manageGlobalFilters.open"),l(!0)},disabled:Fr(t.display)}),c.jsx(Wf,{dataSets:t.dataSets,filters:t.globalFilters,show:a,onUpdate:function(e){var n=Yf(t.globalFilters,e);s(n)},source:"global",onDeleteItem:function(e){var n=[].concat(t.globalFilters);n.splice(e,1),s(n)},onClose:function(){i("manageGlobalFilters.close"),l(!1)}})]})},Kf=function(e){var t,n,r=us();return c.jsx("div",{className:""+Xf,"data-themeapi":"filters.filterBy",children:c.jsx(Pp,{testId:"manage-global-filters-open",onClick:null==e?void 0:e.onChange,disabled:null==e?void 0:e.disabled,className:rs("filter-by-button",null!=r&&null!=(t=r.filters)&&t.filterBy?""+Qf(null==r||null==(n=r.filters)?void 0:n.filterBy):void 0),children:c.jsxs(Wd,{as:"span",justifyContent:"center",alignItems:"center",gap:"0.5rem",children:[c.jsx("span",{className:"filter-by-button-icon",children:c.jsx(Va,{active:!1})}),c.jsx("span",{className:"filter-by-button-text",children:c.jsx(Yp,{override:"dashboard-filters.call-to-action",children:"Filter by"})})]})})})},Xf=ua({minWidth:"100px",position:"relative"}),Qf=function(e){return ua(U({},e))},Jf={name:"1d3w5wq",styles:"width:100%"},Zf={name:"1egouu6",styles:"position:relative;display:flex;width:100%;flex-direction:column;align-items:center"},$f=function(e){var r,o,a,l,s,u,d,p,f=null!=(r=null==e?void 0:e.showableChips)?r:2,m=e.selected,h=t.useState([]),v=h[0],g=h[1];t.useEffect((function(){i.isArray(e.options)&&g(e.options)}),[e.options]);var b=t.useState(null!=(o=null==e?void 0:e.isLoading)&&o),x=b[0],y=b[1],w=t.useState(i.isFunction(e.options)?"unloaded":void 0),C=w[0],j=w[1],F=n.useState(!1),S=F[0],k=F[1];t.useEffect((function(){var t=function(){var t=Y(H().mark((function t(){var n;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=new AbortController,j("loading"),y(!0),!i.isFunction(e.options)){t.next=9;break}return e.options(n.signal).then((function(e){j("loaded"),e&&(g(e),y(!1))})),t.abrupt("return",(function(){n.abort(),j("failed")}));case 9:y(!1),g(e.options);case 11:return t.abrupt("return",(function(){}));case 12:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();S&&i.isFunction(e.options)&&t()}),[S]);var T=Vd(v,["label","value"]),A=T.values,D=T.searchString,I=T.setSearch,P=t.useRef(null);ss(P,(function(){k(!1),M(f)}));var _=function(t){I("");var n=[].concat(m);n=m.includes(t)?i.filter([].concat(m),(function(e){return e!=t})):[].concat(m,[t]),e.setSelected(n)},E=i.sumBy(v,(function(e){return e.hide?0:1})),O=t.useState(f),L=O[0],M=O[1];t.useEffect((function(){M(S?m.length:f)}),[m.length,v.length]);var R=us();return c.jsxs("div",{css:Jf,"data-fetchstatus":null!=C?C:void 0,children:[(null==e?void 0:e.id)&&(null==e?void 0:e.label)&&c.jsx(kc,{labelHidden:null==e?void 0:e.labelHidden,id:null==e?void 0:e.id,children:null==e?void 0:e.label}),c.jsxs("div",{css:Zf,ref:P,children:[c.jsxs(wc,{value:D,onChange:function(e){return I(e)},open:S,isLoading:x,setOpen:function(e){k(e),M(e?m.length:f)},multiple:!0,id:null==e?void 0:e.id,"aria-labelledby":(null==e?void 0:e.id)&&(null==e?void 0:e.label)&&(null==e?void 0:e.id),onClick:function(){return!S&&0===m.length&&k(!0)},testId:"multi-select",children:[(null==e?void 0:e.selectedPrefix)&&c.jsx(Md,{"data-component":"selected-prefix",padding:null!=(a=null==R||null==(l=R.forms)||null==(s=l.select)?void 0:s.padding)?a:"0.30rem 0.5rem",paddingRight:0,children:null==e?void 0:e.selectedPrefix}),(null==e?void 0:e.placeholder)&&0===m.length&&c.jsx(Md,{padding:"0.35rem 0.5rem",as:"span",children:c.jsx("span",{style:{color:"#A1A8B3"},children:null==e?void 0:e.placeholder})}),c.jsxs(Wd,{columnGap:"0.25rem",rowGap:"0.25rem",flex:1,minWidth:S?190:void 0,wrap:!0,padding:null!=(u=null==R||null==(d=R.forms)||null==(p=d.select)?void 0:p.padding)?u:"0.30rem","data-component":"selected-chips",children:[m.length<=L&&m.map((function(t,n){var r=v[t];return r?c.jsx(rm,{onRemove:function(){return _(t)},label:r.label,disableClear:null==e?void 0:e.disableClearAll},n):null})),L<=f&&m.length>f&&c.jsxs(t.Fragment,{children:[m.map((function(t,n){var r=v[t];return n>f-1?null:r?c.jsx(rm,{onRemove:function(){return _(t)},label:r.label,disableClear:null==e?void 0:e.disableClearAll},n):null})),c.jsx(dp,{tooltipContent:function(){return c.jsx(dp.Content,{children:m.map((function(e,n){var r;return n<=f-1?null:c.jsxs(t.Fragment,{children:[null==(r=v[e])?void 0:r.label,m.length!==n+1&&", "]},n)}))})},children:c.jsx(rm,{onRemove:function(){},label:m.length-f+" more",disableClear:!0})})]})]})]}),c.jsxs(ac,{open:S,children:[m.length!==E&&c.jsxs(t.Fragment,{children:[c.jsx(Md,{padding:8,children:c.jsx(tp,{id:(null==e?void 0:e.id)+"-add-item",label:"Add "+e.placeholder,labelHidden:!0,autoFocus:!0,defaultValue:D,onChange:function(e){return I(e.target.value)}})}),A.map((function(e,n){return c.jsx(t.Fragment,{children:!e.item.hide&&!m.includes(e.refIndex)&&c.jsx(ac.Option,{onChange:function(){return _(e.refIndex)},label:e.item.label})},n)}))]}),m.length===E&&c.jsx(Md,{padding:8,children:"No Options"})]})]})]})},em={name:"1576s6y",styles:"display:flex;height:18px;min-width:max-content;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity));padding-top:0.125rem;padding-bottom:0.125rem;padding-left:0.5rem;padding-right:0.5rem;font-weight:500;--tw-text-opacity:1;color:rgb(30 41 59 / var(--tw-text-opacity))"},tm={name:"1ho1ybk",styles:"max-width:100%;flex:0 1 auto;font-size:0.75rem;line-height:1;font-weight:400"},nm={name:"10bts8a",styles:"display:flex;flex:1 1 auto;flex-direction:row-reverse"},rm=function(e){return c.jsxs("div",{css:em,children:[c.jsx("div",{css:tm,children:e.label}),c.jsx("div",{css:nm,children:c.jsxs("button",{onClick:function(t){t.preventDefault(),e.onRemove()},className:""+Ea.button,children:[c.jsxs("span",{className:""+Ea.srOnly,children:["Remove ",null==e?void 0:e.label]}),!(null!=e&&e.disableClear)&&c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:rs(p.css({name:"13h9wtn",styles:"margin-left:0.5rem;height:1rem;width:1rem;cursor:pointer;border-radius:9999px;opacity:0.7;:hover{opacity:1;}"}),""+La),"aria-label":"Remove",children:[c.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),c.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})]})})]})},im=function(e){var n,r,i,o=t.useRef(void 0),a=zl().cascadeFilterSelection,l=zc().runQueriesCallback,s=e.filter,u=e.filterIndex,d=e.dataSets,p=e.onChange,f=t.useState(null),m=f[0],h=f[1],v=t.useState(!1),g=v[0],b=v[1],x=function(){var e=Y(H().mark((function e(t){var n;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vc(hr(s),l)(t);case 2:return h(n=e.sent),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=Y(H().mark((function e(){var t,n;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),t=new AbortController,e.next=4,x(t.signal);case 4:(n=e.sent)&&n[0]?(Nr("Filter forcing initial value to be set."),b(!1),h(n)):Br("Ran select filter options to force a value, but no results were returned.");case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();t.useEffect((function(){!function(){var e=Y(H().mark((function e(){var t,n;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s.requiresValue||null!==s.value){e.next=6;break}return t=new AbortController,e.next=4,x(t.signal);case 4:(n=e.sent)&&n[0]?(Nr("Filter forcing initial value to be set."),h(n),p(U({},s,{value:n[0].value}))):Br("Ran select filter options to force a value, but no results were returned.");case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[JSON.stringify(s)]);var w=cr(s,d),C=t.useState([]),j=C[0],F=C[1];return t.useEffect((function(){var e;null!=s&&s.value&&(m&&(null==m?void 0:m.length)>0?F((e=null==s?void 0:s.value,m.reduce((function(t,n,r){return e.includes(n.value)&&t.push(r),t}),[]))):y())}),[s,m]),t.useEffect((function(){a&&null!==o.current&&JSON.stringify(o.current)!==JSON.stringify(s.optionsFilters)&&h(null),o.current=s.optionsFilters}),[s.optionsFilters]),c.jsxs("div",{children:[c.jsx(kc,{id:"filter-"+u,labelHidden:!0,children:w}),c.jsx($f,{options:m||x,setSelected:function(t){m&&e.onChange(U({},s,{value:t.map((function(e){var t;return null==(t=m[e])?void 0:t.value})).filter((function(e){return void 0!==e}))}))},selected:j,isLoading:g,id:"filter-"+u,disableClearAll:!(null!=e&&e.showClearBtn)&&1===(null==(n=s.value)?void 0:n.length),selectedPrefix:w+(null!=(r=s.value)&&r.length&&(null==(i=s.value)?void 0:i.length)>0?" · ":""),showableChips:1},"filter-"+u)]})},om=Object.assign((function(){return null}),{input:{border:"none",borderStyle:"none",borderWidth:"initial",borderColor:"initial",borderImage:"initial",backgroundColor:"transparent",boxShadow:"unset",fontFamily:"inherit",fontSize:"inherit",fontWeight:"inherit",color:"inherit",padding:"0",margin:"0",boxSizing:"border-box",outline:"none",appearance:"none",textAlign:"left"}}),am=ua({position:"relative",display:"inline-flex"}),lm=ua({display:"flex",width:"100%",height:"100%"}),sm=ua({width:18,display:"flex",verticalAlign:"middle",color:"rgb(72, 72, 72)",alignSelf:"center",justifyContent:"center"}),um=Object.assign((function(){return null}),{picker:ua(U({},om.input,{appearance:"searchfield"})),prefixStyle:function(e){var t,n,r,i,a=o.merge({},null==(t=ga.forms)?void 0:t.dateTime,e);return ua({alignSelf:"center",paddingTop:0,paddingBottom:0,paddingRight:0,paddingLeft:"0.5rem",background:null==a||null==(n=a.input)?void 0:n.background,borderRadius:null==a||null==(r=a.input)?void 0:r.borderRadius,borderTopRightRadius:0,borderBottomRightRadius:0,color:null==a||null==(i=a.input)?void 0:i.color,whiteSpace:"nowrap",flex:1})},inputsWrapper:function(e){var t,n,r,i,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y=o.merge({},null==(t=ga.forms)?void 0:t.dateTime,e);return ua({position:"relative",border:null==(n=y.input)?void 0:n.border,boxShadow:null==(r=y.input)?void 0:r.boxShadow,borderRadius:null==(i=y.input)?void 0:i.borderRadius,fontSize:null==(a=y.input)?void 0:a.fontSize,background:null==y||null==(l=y.input)?void 0:l.background,cursor:"default","&:hover":{border:null==(s=y.input)||null==(u=s["&:hover"])?void 0:u.border,background:null==(d=y.input)||null==(c=d["&:hover"])?void 0:c.background,boxShadow:null==(p=y.input)||null==(f=p["&:hover"])?void 0:f.boxShadow},"&:focus":{border:null==(m=y.input)||null==(h=m["&:focus"])?void 0:h.border,background:null==(v=y.input)||null==(g=v["&:focus"])?void 0:g.background,boxShadow:null==(b=y.input)||null==(x=b["&:focus"])?void 0:x.boxShadow}})},inputs:lm,separator:sm,dateInput:function(e){var t,n,r,i,a,l,s,u=o.merge({},null==(t=ga.forms)?void 0:t.dateTime,e);return ua({width:null==(n=u.date)?void 0:n.width,background:null==u||null==(r=u.input)?void 0:r.background,padding:null==(i=u.input)?void 0:i.padding,cursor:"default",borderRadius:null==(a=u.input)?void 0:a.borderRadius,color:null==u||null==(l=u.input)?void 0:l.color,border:0,fontWeight:null==u||null==(s=u.input)?void 0:s.fontWeight,"&:focus":{outline:0}})},timeInput:function(e){var t,n,r=o.merge({},null==(t=ga.forms)?void 0:t.dateTime,e);return ua({width:null==(n=r.time)?void 0:n.width,paddingLeft:0,paddingRight:0})},clearContainer:function(){return ua({width:18,alignSelf:"center"})},wrapper:am,separatorIcon:function(e){var t=cm(e);return ua({verticalAlign:"middle",display:"block",fill:t.indicatorColor,height:18,width:18})},clearButton:function(e){var t=cm(e);return ua(U({},gc,{fill:t.indicatorColor}))}}),dm=function(e,t){var n,r,i,a,l,s,u,d,c,f,m,h,v,g,b,x,y,w,C,j,F,S,k,T,A,D,I,P,_,E,O,L,M,R,N,z,B,q,V,H,W,Y,U,G,K,X,Q,J,Z,$,ee,te,ne,re,ie,oe,ae=o.merge({},null==(n=ga.forms)?void 0:n.dateTime,e);return p.css("position:absolute;top:",t?t+16:40,"px;margin-right:0;border:1px solid ",ha.colors.brand[20],";border-radius:",ha.size.borderRadius,";z-index:1;background:#fff;padding-right:2px;.DateRangePickerInput{display:grid;background:",null==ae||null==(r=ae.input)?void 0:r.background,";border-radius:",null==ae||null==(i=ae.input)?void 0:i.borderRadius,"px;grid-template-columns:minmax(76px, auto) 18px minmax(76px, auto) 24px;}.DateInput:first-of-type{border-radius:0;border-top-right-radius:0;border-bottom-right-radius:0;}.DateInput:first-of-type>input{border-radius:0;border-top-right-radius:0;border-bottom-right-radius:0;padding-left:0.25rem;padding-right:0;}.DateInput_input{color:",null==ae||null==(a=ae.input)?void 0:a.color,";font-weight:",null==(l=ae.input)?void 0:l.fontWeight,";background:",null==ae||null==(s=ae.input)?void 0:s.background,";outline:2px solid transparent;line-height:initial;&:hover:{border:",null==(u=ae.input)||null==(d=u["&:hover"])?void 0:d.border,";background:",null==(c=ae.input)||null==(f=c["&:hover"])?void 0:f.background,";}}.DateInput_input__focused input{border:",null==(m=ae.input)||null==(h=m["&:focus"])?void 0:h.border,";background:",null==(v=ae.input)||null==(g=v["&:focus"])?void 0:g.background,";}.DateInput:last-of-type>input{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0;padding-left:0.25rem;padding-right:0;}.DateInput{margin:0;padding:0;background:",null==ae||null==(b=ae.input)?void 0:b.background,";position:relative;display:grid;min-width:76px;align-content:center;padding-bottom:1px;}.DateRangePickerInput_clearDates{border:0;color:inherit;font:inherit;line-height:normal;cursor:pointer;padding:5px;margin:2.5px;background-color:transparent;}.DateInput_input+.DateInput_input{margin-left:8px;}.DateInput_input__focused{outline-offset:0px;}.DateRangePickerInput__withBorder{border:none;border-bottom:2px solid black;border-radius:0;}.DayPickerKeyboardShortcuts_show__bottomRight::before{border-right-color:black;}.DayPickerKeyboardShortcuts_show__bottomRight::after{border-right-color:white;}.DayPickerKeyboardShortcuts_show__topRight::before{border-right-color:black;}.DayPickerKeyboardShortcuts_show__topRight::after{border-right-color:white;}.PresetDateRangePicker_panel{padding:0 22px 11px;}.PresetDateRangePicker_button{position:relative;height:100%;text-align:center;background:0 0;border:2px solid #00a699;color:#00a699;padding:4px 12px;margin-right:8px;font:inherit;font-weight:700;line-height:normal;overflow:visible;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;}.PresetDateRangePicker_button:active{outline:0;}.PresetDateRangePicker_button__selected{color:#fff;background:#00a699;}.SingleDatePickerInput{display:inline-block;background-color:#fff;}.SingleDatePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb;}.SingleDatePickerInput__rtl{direction:rtl;}.SingleDatePickerInput__disabled{background-color:#f2f2f2;}.SingleDatePickerInput__block{display:block;}.SingleDatePickerInput__showClearDate{padding-right:30px;}.SingleDatePickerInput_clearDate{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}.SingleDatePickerInput_clearDate__default:focus,.SingleDatePickerInput_clearDate__default:hover{background:#dbdbdb;border-radius:50%;}.SingleDatePickerInput_clearDate__small{padding:6px;}.SingleDatePickerInput_clearDate__hide{visibility:hidden;}.SingleDatePickerInput_clearDate_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle;}.SingleDatePickerInput_clearDate_svg__small{height:9px;}.SingleDatePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px;}.SingleDatePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle;}.SingleDatePicker{position:relative;display:inline-block;}.SingleDatePicker__block{display:block;}.SingleDatePicker_picker{z-index:1;background-color:#fff;position:absolute;}.SingleDatePicker_picker__rtl{direction:rtl;}.SingleDatePicker_picker__directionLeft{left:0;}.SingleDatePicker_picker__directionRight{right:0;}.SingleDatePicker_picker__portal{background-color:rgba(0, 0, 0, 0.3);position:fixed;top:0;left:0;height:100%;width:100%;}.SingleDatePicker_picker__fullScreenPortal{background-color:#fff;}.SingleDatePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2;}.SingleDatePicker_closeButton:focus,.SingleDatePicker_closeButton:hover{color:darken(#cacccd, 10%);text-decoration:none;}.SingleDatePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd;}.DayPickerKeyboardShortcuts_buttonReset{background:0 0;border:0;border-radius:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;cursor:pointer;font-size:14px;}.DayPickerKeyboardShortcuts_buttonReset:active{outline:0;}.DayPickerKeyboardShortcuts_show{width:33px;height:26px;position:absolute;z-index:2;}.DayPickerKeyboardShortcuts_show::before{content:'';display:block;position:absolute;}.DayPickerKeyboardShortcuts_show__bottomRight{bottom:0;right:0;}.DayPickerKeyboardShortcuts_show__bottomRight::before{border-top:26px solid transparent;border-right:33px solid #00a699;bottom:0;right:0;}.DayPickerKeyboardShortcuts_show__bottomRight:hover::before{border-right:33px solid #008489;}.DayPickerKeyboardShortcuts_show__topRight{top:0;right:0;}.DayPickerKeyboardShortcuts_show__topRight::before{border-bottom:26px solid transparent;border-right:33px solid #00a699;top:0;right:0;}.DayPickerKeyboardShortcuts_show__topRight:hover::before{border-right:33px solid #008489;}.DayPickerKeyboardShortcuts_show__topLeft{top:0;left:0;}.DayPickerKeyboardShortcuts_show__topLeft::before{border-bottom:26px solid transparent;border-left:33px solid #00a699;top:0;left:0;}.DayPickerKeyboardShortcuts_show__topLeft:hover::before{border-left:33px solid #008489;}.DayPickerKeyboardShortcuts_showSpan{color:#fff;position:absolute;}.DayPickerKeyboardShortcuts_showSpan__bottomRight{bottom:0;right:5px;}.DayPickerKeyboardShortcuts_showSpan__topRight{top:1px;right:5px;}.DayPickerKeyboardShortcuts_showSpan__topLeft{top:1px;left:5px;}.DayPickerKeyboardShortcuts_panel{overflow:auto;background:#fff;border:1px solid #dbdbdb;border-radius:2px;position:absolute;top:0;bottom:0;right:0;left:0;z-index:2;padding:22px;margin:33px;text-align:left;}.DayPickerKeyboardShortcuts_title{font-size:16px;font-weight:700;margin:0;}.DayPickerKeyboardShortcuts_list{list-style:none;padding:0;font-size:14px;}.DayPickerKeyboardShortcuts_close{position:absolute;right:22px;top:22px;z-index:2;}.DayPickerKeyboardShortcuts_close:active{outline:0;}.DayPickerKeyboardShortcuts_closeSvg{height:15px;width:15px;fill:#cacccd;}.DayPickerKeyboardShortcuts_closeSvg:focus,.DayPickerKeyboardShortcuts_closeSvg:hover{fill:#82888a;}.CalendarDay{-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;font-size:14px;text-align:center;}.CalendarDay:active{outline:0;}.CalendarDay__defaultCursor{cursor:default;}.CalendarDay__default{border:1px solid #e4e7e7;color:#484848;background:#fff;}.CalendarDay__default:hover{background:#e4e7e7;border:1px solid #e4e7e7;color:inherit;}.CalendarDay__hovered_offset{background:#f4f5f5;border:1px double #e4e7e7;color:inherit;}.CalendarDay__outside{border:0;background:#fff;color:#484848;}.CalendarDay__outside:hover{border:0;}.CalendarDay__blocked_minimum_nights{background:#fff;border:1px solid #eceeee;color:#cacccd;}.CalendarDay__blocked_minimum_nights:active,.CalendarDay__blocked_minimum_nights:hover{background:#fff;color:#cacccd;}.CalendarDay__highlighted_calendar{background:#ffe8bc;color:#484848;}.CalendarDay__highlighted_calendar:active,.CalendarDay__highlighted_calendar:hover{background:",null==(x=ae.calendar)||null==(y=x.selected)?void 0:y.background,";opacity:0.8;color:",null==(w=ae.calendar)||null==(C=w.selected)?void 0:C.color,";}.CalendarDay__selected_span{background:",null==(j=ae.calendar)||null==(F=j.selected)?void 0:F.background,";opacity:0.8;border:1px double ",null==(S=ae.calendar)||null==(k=S.selected)?void 0:k.background,";color:",null==(T=ae.calendar)||null==(A=T.selected)?void 0:A.color,";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:",null==(D=ae.calendar)||null==(I=D.selected)?void 0:I.background,";opacity:0.7;border:1px double ",null==(P=ae.calendar)||null==(_=P.selected)?void 0:_.background,";color:",null==(E=ae.calendar)||null==(O=E.selected)?void 0:O.color,";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:",null==(L=ae.calendar)||null==(M=L.selected)?void 0:M.background,";border:1px double ",null==(R=ae.calendar)||null==(N=R.selected)?void 0:N.background,";color:",null==(z=ae.calendar)||null==(B=z.selected)?void 0:B.color,";}.CalendarDay__hovered_span,.CalendarDay__hovered_span:hover{background:",null==(q=ae.calendar)||null==(V=q.selected)?void 0:V.background,";border:1px double ",null==(H=ae.calendar)||null==(W=H.selected)?void 0:W.background,";opacity:0.8;color:",null==(Y=ae.calendar)||null==(U=Y.selected)?void 0:U.color,";}.CalendarDay__hovered_span:active{background:",null==(G=ae.calendar)||null==(K=G.selected)?void 0:K.background,";border:1px double ",null==(X=ae.calendar)||null==(Q=X.selected)?void 0:Q.background,";color:",null==(J=ae.calendar)||null==(Z=J.selected)?void 0:Z.color,";}.CalendarDay__blocked_calendar,.CalendarDay__blocked_calendar:active,.CalendarDay__blocked_calendar:hover{background:#cacccd;border:1px solid #cacccd;color:#82888a;}.CalendarDay__blocked_out_of_range,.CalendarDay__blocked_out_of_range:active,.CalendarDay__blocked_out_of_range:hover{background:#fff;border:1px solid #e4e7e7;color:#cacccd;}.CalendarDay__hovered_start_first_possible_end{background:#eceeee;border:1px double #eceeee;}.CalendarDay__hovered_start_blocked_min_nights{background:#eceeee;border:1px double #e4e7e7;}.CalendarMonth{background:#fff;text-align:center;vertical-align:top;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.CalendarMonth_table{border-collapse:collapse;border-spacing:0;}.CalendarMonth_verticalSpacing{border-collapse:separate;}.CalendarMonth_caption{color:",null==($=ae.calendar)||null==(ee=$.title)?void 0:ee.color,";font-size:",(oe=null==(te=ae.calendar)||null==(ne=te.title)?void 0:ne.fontSize)+("number"==typeof oe?"px":""),";text-align:center;padding-top:22px;padding-bottom:37px;caption-side:initial;}.CalendarMonth_caption>strong{font-weight:",null==(re=ae.calendar)||null==(ie=re.title)?void 0:ie.fontWeight,";}.CalendarMonth_caption__verticalScrollable{padding-top:12px;padding-bottom:7px;}.CalendarMonthGrid{background:#fff;text-align:left;z-index:0;}.CalendarMonthGrid__animating{z-index:1;}.CalendarMonthGrid__horizontal{position:absolute;left:9px;}.CalendarMonthGrid__vertical,.CalendarMonthGrid__vertical_scrollable{margin:0 auto;}.CalendarMonthGrid_month__horizontal{display:inline-block;vertical-align:top;min-height:100%;}.CalendarMonthGrid_month__hideForAnimation{position:absolute;z-index:-1;opacity:0;pointer-events:none;}.CalendarMonthGrid_month__hidden{visibility:hidden;}.DayPickerNavigation{position:relative;z-index:2;}.DayPickerNavigation__horizontal{height:0;}.DayPickerNavigation__verticalScrollable_prevNav{z-index:1;}.DayPickerNavigation__verticalDefault{position:absolute;width:100%;height:52px;bottom:0;left:0;}.DayPickerNavigation__verticalScrollableDefault{position:relative;}.DayPickerNavigation__bottom{height:auto;}.DayPickerNavigation__bottomDefault{-webkit-box-pack:justify;-ms-flex-pack:justify;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;}.DayPickerNavigation_button{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:0;padding:0;margin:0;}.DayPickerNavigation_button__default{border:1px solid #e4e7e7;background-color:#fff;color:#757575;}.DayPickerNavigation_button__default:focus,.DayPickerNavigation_button__default:hover{border:1px solid #c4c4c4;}.DayPickerNavigation_button__default:active{background:#f2f2f2;}.DayPickerNavigation_button__disabled{cursor:default;border:1px solid #f2f2f2;}.DayPickerNavigation_button__disabled:focus,.DayPickerNavigation_button__disabled:hover{border:1px solid #f2f2f2;}.DayPickerNavigation_button__disabled:active{background:0 0;}.DayPickerNavigation_button__horizontalDefault{position:absolute;top:18px;line-height:0.78;border-radius:3px;padding:6px 9px;}.DayPickerNavigation_bottomButton__horizontalDefault{position:static;margin:-10px 22px 30px;}.DayPickerNavigation_leftButton__horizontalDefault{left:22px;}.DayPickerNavigation_rightButton__horizontalDefault{right:22px;}.DayPickerNavigation_button__verticalDefault{padding:5px;background:#fff;box-shadow:0 0 5px 2px rgba(0, 0, 0, 0.1);position:relative;display:inline-block;text-align:center;height:100%;width:50%;}.DayPickerNavigation_nextButton__verticalDefault{border-left:0;}.DayPickerNavigation_nextButton__verticalScrollableDefault,.DayPickerNavigation_prevButton__verticalScrollableDefault{width:100%;}.DayPickerNavigation_svg__horizontal{height:19px;width:19px;fill:#82888a;display:block;}.DayPickerNavigation_svg__vertical{height:42px;width:42px;fill:#484848;}.DayPickerNavigation_svg__disabled{fill:#f2f2f2;}.DayPicker{position:relative;text-align:left;}.DayPicker__verticalScrollable{height:100%;}.DayPicker__hidden{visibility:hidden;}.DayPicker__withBorder{box-shadow:0 2px 6px rgba(0, 0, 0, 0.05),0 0 0 1px rgba(0, 0, 0, 0.07);border-radius:3px;}.DayPicker_portal__horizontal{box-shadow:none;position:absolute;left:50%;top:50%;}.DayPicker_portal__vertical{position:initial;}.DayPicker_focusRegion{outline:0;}.DayPicker_calendarInfo__horizontal,.DayPicker_wrapper__horizontal{display:inline-block;vertical-align:top;}.DayPicker_weekHeaders{position:relative;}.DayPicker_weekHeaders__horizontal{margin-left:9px;}.DayPicker_weekHeader{color:#757575;position:absolute;top:62px;z-index:2;text-align:left;}.DayPicker_weekHeader__vertical{left:50%;}.DayPicker_weekHeader__verticalScrollable{top:0;display:table-row;border-bottom:1px solid #dbdbdb;background:#fff;margin-left:0;left:0;width:100%;text-align:center;}.DayPicker_weekHeader_ul{list-style:none;margin:1px 0;padding-left:0;padding-right:0;font-size:14px;}.DayPicker_weekHeader_li{display:inline-block;text-align:center;}.DayPicker_transitionContainer{position:relative;overflow:hidden;border-radius:3px;}.DayPicker_transitionContainer__horizontal{-webkit-transition:height 0.2s ease-in-out;-moz-transition:height 0.2s ease-in-out;transition:height 0.2s ease-in-out;}.DayPicker_transitionContainer__vertical{width:100%;}.DayPicker_transitionContainer__verticalScrollable{padding-top:20px;height:100%;position:absolute;top:0;bottom:0;right:0;left:0;overflow-y:scroll;}.DateInput__block{width:100%;}.DateInput__disabled{background:#f2f2f2;color:#dbdbdb;}.DateInput_input{width:100%;}.DateInput_input__small{font-size:15px;line-height:18px;letter-spacing:0.2px;padding:7px 7px 5px;}.DateInput_input__regular{font-weight:auto;}.DateInput_input__readOnly{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.DateInput_input__disabled{background:#f2f2f2;font-style:italic;}.DateInput_screenReaderMessage{border:0;clip:rect(0, 0, 0, 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.DateInput_fang{position:absolute;width:20px;height:10px;left:22px;z-index:2;}.DateInput_fangShape{fill:#fff;}.DateInput_fangStroke{stroke:#dbdbdb;fill:transparent;}.DateRangePickerInput__disabled{background:#f2f2f2;}.DateRangePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb;}.DateRangePickerInput__rtl{direction:rtl;}.DateRangePickerInput__block{display:block;}.DateRangePickerInput_arrow{display:inline-block;vertical-align:middle;color:#484848;align-self:center;}.DateRangePickerInput_arrow_svg{vertical-align:middle;fill:#484848;height:18px;width:18px;}.DateRangePickerInput_clearDates__small{padding:6px;}.DateRangePickerInput_clearDates__hide{cursor:inherit;&:hover{background:unset;}}.DateRangePickerInput_clearDates_svg{fill:rgb(75 85 99);stroke:rgb(75 85 99);height:8px;width:8px;vertical-align:middle;}.DateRangePickerInput_clearDates_svg__small{height:9px;}.DateRangePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px;}.DateRangePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle;}.DateRangePicker{position:relative;display:grid;align-content:center;}.DateRangePicker__block{display:block;}.DateRangePicker_picker{z-index:1;background-color:#fff;position:absolute;}.DateRangePicker_picker__rtl{direction:rtl;}.DateRangePicker_picker__directionLeft{left:0;}.DateRangePicker_picker__directionRight{right:0;}.DateRangePicker_picker__portal{background-color:rgba(0, 0, 0, 0.3);position:fixed;top:0;left:0;height:100%;width:100%;}.DateRangePicker_picker__fullScreenPortal{background-color:#fff;}.DateRangePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2;}.DateRangePicker_closeButton:focus,.DateRangePicker_closeButton:hover{color:darken(#cacccd, 10%);text-decoration:none;}.DateRangePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd;}","")};function cm(e){var t;return o.merge({},null==(t=ga.forms)?void 0:t.dateTime,e)}var pm=function(e){var t,n=us();return c.jsx("div",{style:{display:"inline-block"},children:c.jsx("input",{type:"text",name:null==e?void 0:e.name,value:null==e?void 0:e.value,placeholder:null==e?void 0:e.label,"aria-label":null==e?void 0:e.label,autoComplete:"off",className:""+um.dateInput(null==n||null==(t=n.forms)?void 0:t.dateTime),onChange:function(t){return null==e?void 0:e.onChange(t.currentTarget.value)}})})},fm=function(e){return c.jsx(w.DayPickerRangeController,{initialVisibleMonth:function(){return y()},startDate:null==e?void 0:e.startDate,endDate:null==e?void 0:e.endDate,onDatesChange:null==e?void 0:e.onDatesChange,focusedInput:null==e?void 0:e.focusedInput,onFocusChange:null==e?void 0:e.onFocusChange,numberOfMonths:2,hideKeyboardShortcutsPanel:!0,minimumNights:0,noBorder:!0,isOutsideRange:function(){return!1},renderMonthElement:function(e){var t,n=e.month,r=e.onYearSelect;return c.jsxs("span",{children:[c.jsxs("span",{className:""+Ea.bold,children:[n.format("MMMM")," "]}),c.jsx("select",{value:n.year(),onChange:function(e){return r(n,e.target.value)},className:""+um.picker,children:(t=y().year(),Array.from({length:25},(function(e,n){return t-n})).map((function(e){return c.jsx("option",{value:e,children:e},"year-"+e)})))})]})}})},mm=function(e){var n,r=t.useState(null==e||null==(n=e.value)?void 0:n.format(null==e?void 0:e.timeFormat)),i=r[0],o=r[1],a=t.useRef(null);t.useEffect((function(){e.shouldClear&&a.current&&(o(void 0),a.current.value="")}),[e.shouldClear]),t.useEffect((function(){var t;return o(null==e||null==(t=e.value)?void 0:t.format(null==e?void 0:e.timeFormat))}),[null==e?void 0:e.value]);var l=t.useState(!1),s=l[0],u=l[1],d=t.useRef(null),p=function(e){for(var t=[],n=0;n<1440;n+=15){var r=Math.floor(n/60),i=n%60,o=("0"+r).slice(-2)+":"+("0"+i).slice(-2),a=y().hour(r).minute(i).second(0);t.push({label:o,value:a})}return t}();return ss(d,(function(){u(!1)})),t.useEffect((function(){if(i){var t=hm(i,null==e?void 0:e.timeFormat);t&&(null==e||e.onChange(t),u(!1))}}),[i]),c.jsxs("div",{ref:d,children:[c.jsx("div",{style:{position:"relative"},children:c.jsx("input",{ref:a,type:"text",name:null==e?void 0:e.name,value:i,placeholder:null==e?void 0:e.label,"aria-label":null==e?void 0:e.label,autoComplete:"off",className:null==e?void 0:e.className,onChange:function(e){o(e.currentTarget.value)},onClick:function(t){return function(t){u(!s),(null==e?void 0:e.onClick)&&(null==e||e.onClick(t))}(t)}})}),c.jsx("div",{style:{maxWidth:80},children:c.jsx(ac,{open:s,fixedHeight:!0,children:p.map((function(t,n){return c.jsx(ac.Option,{label:t.label,onChange:function(n){var r;null==n||n.stopPropagation(),o((r=t.value).format(null==e?void 0:e.timeFormat)),null==e||e.onChange(r),u(!1)}},n)}))})})]},null==e?void 0:e.name)},hm=function(e,t){var n=y(e,"HH:mm:ss",!0);return y(e,"HH:mm",!0).isValid()||n.isValid()?y(e,t):null},vm=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h=e.startDate,v=e.endDate,g=e.startTime,b=e.endTime,x=e.onChange,w=e.id,C=e.prefix,j=e.onClear,F=e.label,S=e.dateFormat,k=e.timeFormat,T=e.type;S=null!=(n=S)?n:"DD/MM/YYYY",k=null!=(r=k)?r:"HH:mm";var A=t.useState({start:g?hm(g,k):null,end:b?hm(b,k):null}),D=A[0],I=A[1],P=t.useState(!1),_=P[0],E=P[1],O=t.useState(h?y(h):null),L=O[0],M=O[1],R=t.useState(!1),N=R[0],z=R[1];t.useEffect((function(){N&&z(!1)}),[N]);var B=t.useState(v?y(v):null),q=B[0],V=B[1],H=t.useState(void 0),W=H[0],Y=H[1],U=t.useState(void 0),G=U[0],K=U[1],X=t.useState("startDate"),Q=X[0],J=X[1],Z=t.useRef(null),$=t.useRef(null),ee=us(),te=t.useCallback((function(e){var t=e.startDate,n=e.endDate;y(t).isSame(Z.current)&&y(n).isSame($.current)||(I({start:t?hm("00:00",k):null,end:n?hm("23:59",k):null}),M(t),V(n),x({startDate:t?t.toDate():null,endDate:n?n.toDate():null,startTime:"date_time"===T?"00:00":null,endTime:"date_time"===T?"23:59":null}),t&&n&&E(!1))}),[x]),ne=t.useCallback((function(e){I({start:e.start,end:e.end}),x({startDate:L?L.toDate():null,endDate:q?q.toDate():null,startTime:e.start?e.start.format("HH:mm"):null,endTime:e.end?e.end.format("HH:mm"):null})}),[x]);t.useEffect((function(){Z.current=L}),[L]),t.useEffect((function(){$.current=q}),[q]);var re=t.useRef(null);ss(re,(function(){E(!1),J("startDate")}));var ie=L?L.format(S):"",oe=q?q.format(S):"",ae=t.useCallback((function(){E(!1),M(null),V(null),Y(void 0),K(void 0),x({startDate:null,endDate:null,endTime:null,startTime:null}),j(),I({start:null,end:null}),z(!0)}),[x,j]);t.useEffect((function(){if(W){var e=gm(W,S),t=gm(G||"",S);null===e&&null===t||te({startDate:e||L,endDate:t||q})}}),[W,G]);var le=t.useRef(null),se=t.useState(0),ue=se[0],de=se[1];t.useEffect((function(){le.current&&de(le.current.getBoundingClientRect().height)}),[le.current]);var ce=cm(null==ee||null==(i=ee.forms)?void 0:i.select);return c.jsxs("div",{className:""+um.wrapper,id:""+(null!=w?w:"date-picker"),children:[c.jsx("div",{className:""+um.inputsWrapper(null==ee||null==(o=ee.forms)?void 0:o.dateTime),"data-themeapi":"forms.dateTime.input",onClick:function(){E(!0),Y(void 0),K(void 0),J("startDate"),V(null)},ref:le,children:c.jsxs("div",{className:""+um.inputs,children:[C&&c.jsxs("div",{className:""+um.prefixStyle(null==ee||null==(a=ee.forms)?void 0:a.dateTime),children:[null!=F?F:"Custom"," ·"]}),c.jsxs(Wd,{gap:0,alignItems:"center",children:[c.jsx(pm,{name:"start_date",value:null!=W?W:ie,label:"Start Date",onChange:function(e){return Y(e)},dateFormat:S}),"date_time"===T&&c.jsx(t.Fragment,{children:c.jsx(mm,{label:"Time",name:"start_time",onChange:function(e){ne({start:e,end:D.end})},className:um.dateInput(null==ee||null==(l=ee.forms)?void 0:l.dateTime)+" "+um.timeInput(null==ee||null==(s=ee.forms)?void 0:s.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:k,value:D.start,shouldClear:N})})]}),c.jsx("div",{"aria-hidden":"true",role:"presentation",className:""+um.separator,children:c.jsx("svg",{focusable:"false",viewBox:"0 0 1000 1000",className:""+um.separatorIcon(null==ee||null==(u=ee.forms)?void 0:u.dateTime),"data-themeapi":"forms.dateTime.indicatorColor",children:c.jsx("path",{d:"M694 242l249 250c12 11 12 21 1 32L694 773c-5 5-10 7-16 7s-11-2-16-7c-11-11-11-21 0-32l210-210H68c-13 0-23-10-23-23s10-23 23-23h806L662 275c-21-22 11-54 32-33z"})})}),c.jsxs(Wd,{gap:0,children:[c.jsx(pm,{name:"end_date",value:null!=G?G:oe,label:"End Date",onChange:function(e){return K(e)},dateFormat:S}),"date_time"===T&&c.jsx(mm,{label:"Time",name:"end_time",onChange:function(e){ne({start:D.start,end:e})},className:um.dateInput(null==ee||null==(d=ee.forms)?void 0:d.dateTime)+" "+um.timeInput(null==ee||null==(p=ee.forms)?void 0:p.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:k,value:D.end,shouldClear:N})]}),c.jsx("div",{className:""+um.clearContainer(),children:c.jsx(vc,{onClear:ae,className:""+um.clearButton(null==ee||null==(f=ee.forms)?void 0:f.dateTime),"aria-label":"Clear Dates",fill:ce.indicatorColor,stroke:ce.indicatorColor})})]})}),_&&c.jsx("div",{className:""+dm(null==ee||null==(m=ee.forms)?void 0:m.dateTime,ue),"data-themeapi":"forms.dateTime.calendar",ref:re,children:c.jsx(fm,{startDate:L,endDate:q,onDatesChange:function(e){Y(void 0),K(void 0),te(e)},focusedInput:Q,onFocusChange:function(e){return J(e)}})})]})},gm=function(e,t){return y(e,t,!0).isValid()?y(e,t):null},bm=function(e){var n,r=e.placeholder,i=e.currentValue,o=e.dateFilterOptions,a=e.onChangeToTimeRange,l=e.showClearBtn,s=zl().textOverrides,u=t.useState(i),d=u[0],p=u[1],f=Object.keys(o).map((function(e){return{value:e,label:o[e].description}}));return a&&(f=[].concat(f,[{label:null!=(n=s["dashboard-filters.custom-range"])?n:"Custom range",value:"__vizzly_custom"}])),c.jsx(Tc,{showClearBtn:void 0===l||l,options:f,onChange:function(t){"__vizzly_custom"===t?(p(t),e.onChangeToTimeRange&&e.onChangeToTimeRange()):(p(t),e.onChange&&e.onChange(t))},selected:d,anchorLeft:!0,placeholder:r,selectedPrefix:null!=e&&e.hasSelectedPrefix?r+" · ":void 0,maintainOptionOrder:!0})},xm=function(e){var n=e.hasCustomPicker,r=null==e?void 0:e.currentValue,i=r.value,o=r.type,a=t.useState("fixedRange"==(null==i?void 0:i.type)),l=a[0],s=a[1],u="fixedRange"==(null==i?void 0:i.type)&&(null==i?void 0:i.after)||void 0,d="fixedRange"==(null==i?void 0:i.type)&&(null==i?void 0:i.before)||void 0,p="dateAndTimeFilter"===o&&d instanceof Date?null==d?void 0:d.toLocaleTimeString():null,f="dateAndTimeFilter"===o&&u instanceof Date?null==u?void 0:u.toLocaleTimeString():null;return c.jsxs(t.Fragment,{children:[!l&&c.jsx(bm,{showClearBtn:e.showClearBtn,dateFilterOptions:e.dateFilterOptions,placeholder:null==e?void 0:e.placeholder,onChangeToTimeRange:function(){s(!0)},onChange:function(t){n&&s(!1),e.onChange&&e.onChange(t)},currentValue:"relative"==(null==i?void 0:i.type)&&i.value||null,hasSelectedPrefix:!0,custom:n}),n&&l&&c.jsx(vm,{label:null==e?void 0:e.placeholder,id:null==e?void 0:e.id,startDate:u,endDate:d,startTime:f,endTime:p,onChange:function(t){var n=t.startDate,r=t.endDate;n&&r?e.onChange&&e.onChange(function(e,t,n,r){return{startDate:ym(t,e||"00:00"),endDate:ym(r,n||"23:59")}}(t.startTime,n,t.endTime,r)):t||e.onChange&&e.onChange(null)},prefix:!0,onClear:function(){null==e||e.onChange(null),s(!1)},type:"dateAndTimeFilter"===o?"date_time":"date"})]})},ym=function(e,t){var n=t.split(":").map(Number),r=n[1];return e.setHours(n[0]),e.setMinutes(r),e},wm=function(e){var t=e.onChange,n=e.filter,r=e.type;return c.jsx(xm,{hasCustomPicker:!0,showClearBtn:e.showClearBtn,dateFilterOptions:null==e?void 0:e.dateFilterOptions,onChange:function(e){"string"==typeof e?t({type:r,appliesToFields:n.appliesToFields,title:n.title,managedByConfiguration:n.managedByConfiguration,requiresValue:n.requiresValue,value:{type:"relative",value:e}}):e&&e.endDate&&e.startDate?t({type:r,appliesToFields:n.appliesToFields,managedByConfiguration:n.managedByConfiguration,requiresValue:n.requiresValue,title:n.title,value:{type:"fixedRange",before:e.endDate,after:e.startDate}}):null===e&&t({type:r,managedByConfiguration:n.managedByConfiguration,requiresValue:n.requiresValue,appliesToFields:n.appliesToFields,title:n.title,value:null})},currentValue:n,placeholder:cr(n,e.dataSets)})},Cm=function(e){var t=e.filter,n=e.filterIndex,i=e.onChange,o=e.shouldAlwaysHaveValue,a=zl().queryEngineConfig,l=function(e){var t=function(e,t){return r.alternatives().conditional(".type",{is:"singleSelectFilter",then:oe(e,t)}).conditional(".type",{is:"dateFilter",then:le(e,t,"dateFilter")}).conditional(".type",{is:"dateAndTimeFilter",then:le(e,t,"dateAndTimeFilter")}).conditional(".type",{is:"multiSelectFilter",then:ae(e,t)})}(a,e.requiresValue).validate(e).error;t?qr("Invalid additional filter. Therefore ignoring the change",t,e):i(e)},s=function(n){o&&null==n.value?"dateFilter"!==t.type&&"dateAndTimeFilter"!==t.type||l({type:"dateFilter",appliesToFields:t.appliesToFields,title:t.title,value:{type:"relative",value:Object.keys(null==e?void 0:e.dateFilterOptions)[0]},requiresValue:t.requiresValue,managedByConfiguration:t.managedByConfiguration}):l(n)};return t.appliesToFields.length>0?"singleSelectFilter"==t.type?c.jsx(Hc,{showClearBtn:!o,filter:t,filterIndex:n,onChange:s,dataSets:e.dataSets}):"multiSelectFilter"==t.type?c.jsx(im,{showClearBtn:!o,filter:t,filterIndex:n,onChange:s,dataSets:e.dataSets}):"dateFilter"==t.type||"dateAndTimeFilter"==t.type?c.jsx(wm,{showClearBtn:!o,dateFilterOptions:null==e?void 0:e.dateFilterOptions,filter:t,onChange:s,dataSets:e.dataSets,type:t.type}):null:null},jm={name:"1gqeage",styles:"margin-right:0.75rem"},Fm=function(e){var n,r=Bd(),o=r.ref,a=r.show,l=r.position,s=r.close,u=r.open,d=zl().dateFilterOptions;return c.jsxs(t.Fragment,{children:[(e.localFilters.length>0||e.zoomControl)&&c.jsxs("div",{ref:o,children:[e.zoomControl&&e.zoomControl.show&&c.jsx("button",{css:jm,onClick:e.zoomControl.onReset,children:c.jsx(Kl,{})}),e.localFilters.length>0&&c.jsx("button",{onClick:function(){return u()},"aria-label":"Show Local Filter",className:""+Ea.button,children:c.jsx(Wl,{active:(n=e.localFilters,i.some(n,(function(e){var t=e.value;return!(i.isArray(t)&&0===t.length||!t)})))})})]}),a&&c.jsx(Nd,{onClose:function(){return s()},width:320,position:l,children:c.jsx(Nd.Options,{padding:!0,children:c.jsx(Md,{padding:"0.5rem",children:c.jsx(Wd,{direction:"column",gap:"0.5rem","data-component":"filters",children:[].concat(e.localFilters).map((function(t,n){return c.jsx(Md,{children:c.jsx(Cm,{dataSets:[e.dataSet],filterIndex:n,filter:t,onChange:function(t){var r=[].concat(e.localFilters);r[n]=t,e.setLocalFilters(r)},dateFilterOptions:d})},"local_filter_"+n)}))})})})})]})},Sm=Object.assign((function(){return null}),{title:function(e){var t,n,r,i,o,a,l,s,u,d=km(e);return ua({padding:0,fontSize:null==(t=d.title)?void 0:t.fontSize,color:null==(n=d.title)?void 0:n.color,fontWeight:null==(r=d.title)?void 0:r.fontWeight,fontFamily:null==(i=d.title)?void 0:i.fontFamily,margin:null!=(o=null==(a=d.title)?void 0:a.margin)?o:0,textAlign:null!=(l=null==(s=d.title)?void 0:s.textAlign)?l:"left",lineHeight:null==(u=d.title)?void 0:u.lineHeight})},subject:function(e){var t,n,r,i,o,a,l,s,u,d=km(e);return ua({position:"relative",fontSize:null==(t=d.subject)?void 0:t.fontSize,color:null==(n=d.subject)?void 0:n.color,fontWeight:null==(r=d.subject)?void 0:r.fontWeight,fontFamily:null==(i=d.subject)?void 0:i.fontFamily,margin:null!=(o=null==(a=d.subject)?void 0:a.margin)?o:0,marginBottom:"0.3rem",textAlign:null!=(l=null==(s=d.subject)?void 0:s.textAlign)?l:"left",lineHeight:null==(u=d.subject)?void 0:u.lineHeight,padding:0})},verified:function(e){var t;return e=o.merge({},ga.library,e),ua({height:18,color:null==(t=e.verified)?void 0:t.color})}}),km=function(e){return i.merge({},ga.charts,e)},Tm=function(e){var t,n=null!=(t=null==e?void 0:e.as)?t:"span";return c.jsx(n,{className:""+Ea.srOnly,htmlFor:null==e?void 0:e.htmlFor,children:null==e?void 0:e.children})},Am=function(e){var n=e.measures,r=zl();return c.jsx(t.Fragment,{children:n&&(null==e?void 0:e.activeMeasures)&&c.jsx(Wd,{direction:"column",gap:"1rem",children:Object.keys(n).map((function(t,i){var a=function(e,t,n,r){try{var i,o=st(e,{supportedAggregates:t,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),a=[{label:null!=(i=Rn(n,o.field).publicName+" ("+o.function+")")?i:"",value:o}];return r[e].map((function(e){a.push({label:Rn(n,e.field).publicName+" ("+e.function+")",value:e})})),a}catch(e){if(e instanceof qt)return[];throw e}}(t,r.queryEngineConfig.supportedAggregates,e.dataSet,n),l=function(e,t){var n=e.filter((function(e){return null==t?void 0:t.some((function(t){return o.isEqual(e.value,t)}))}));return n.length>0?n[0].value:null}(a,e.activeMeasures);return c.jsx(Tc,{label:"Replace Parameter "+(i+1),labelHidden:!0,id:"replace-parameter-"+i,selected:l,onChange:function(t){return e.setMeasure(t,l)},options:a},t)}))})})},Dm=function(e,t){return!!On(e).supportedFeatures.parameters&&!(i.isEmpty(t)||!Pm(t)&&!Im(t))},Im=function(e){return!i.isEmpty(null==e?void 0:e.group)},Pm=function(e){return!i.isEmpty(null==e?void 0:e.measure)},_m=function(e){var n=e.activeDimensions,r=e.group,i=e.dataSet,o=zl().queryEngineConfig;return c.jsx(t.Fragment,{children:r&&n&&c.jsx(Wd,{direction:"column",gap:"1rem",children:Object.keys(r).map((function(t,n){var a=Ee(t,o.supportedTimeTruncFunctions),l=a?function(e,t,n,r){if(!t||!n[r])return[];var i=Rn(e,t.field);if(!i)return[];var o=[{label:i.publicName+" ("+t.truncate+")",value:t}];return n[r].forEach((function(t){if(t&&"truncate"in t){var n=Rn(e,t.field);n&&o.push({label:n.publicName+" ("+t.truncate+")",value:t})}})),o}(i,a,r,t):function(e,t,n){var r;if(!t||null==e||!e.fields||!n[t])return[];var i=Rn(e,t);if(!i)return[];var o=[{label:null!=(r=""+i.publicName)?r:"",value:{field:t,function:"none"}}];return n[t].forEach((function(t){if(t&&"function"in t){var n,r=Rn(e,t.field);r&&o.push({label:r.publicName,value:{field:t.field,function:null!=(n=t.function)?n:"none"}})}})),o}(i,t,r),s=a?Em(l,null==e?void 0:e.activeTimeDimension):Om(l,null==e?void 0:e.activeDimensions);return c.jsx(Tc,{labelHidden:!0,label:"Replace Parameter "+(n+1),id:"replace-parameter-"+n,selected:s,onChange:function(t){return null==e?void 0:e.setDimension(t,s)},options:l},t)}))})})},Em=function(e,t){var n;return null==(n=e.find((function(e){return o.isEqual(e.value,t)})))?void 0:n.value},Om=function(e,t){var n=e.filter((function(e){return null==t?void 0:t.some((function(t){return e.value.field===t.field&&e.value.function===t.function}))}));return n.length>0?n[0].value:null},Lm=function(e,t,n){return null==n?n:null==n?void 0:n.map((function(n){return n.field===e.field&&n.function===e.function?U({},t):n}))},Mm=function(e,t,n){return null==n?void 0:n.map((function(n){return o.isEqual(n,e)?t:n}))},Rm=function(e){var n=Bd(),r=n.ref,i=n.show,o=n.position,a=n.close,l=n.open,s=e.parameters;return Dm(null==e?void 0:e.componentType,s)?c.jsxs(t.Fragment,{children:[c.jsx("div",{ref:r,children:c.jsxs("button",{onClick:function(){return l()},className:""+Ea.button,children:[c.jsx("span",{className:""+_a,children:"Change Parameters"}),c.jsx(dp,{tooltipContent:function(){return"Change Parameters"},children:c.jsx(Ul,{})})]})}),i&&c.jsx(Nd,{onClose:function(){return a()},width:320,position:o,children:c.jsx(Nd.Options,{padding:!0,children:c.jsx(Md,{padding:"0.5rem",children:c.jsxs(Wd,{direction:"column",gap:"0.5rem","data-component":"parameters",children:[Im(s)&&Pm(s)&&c.jsx(vf,{marginBottom:0,children:"Measures"}),c.jsx(Am,{measures:null==s?void 0:s.measure,dataSet:null==e?void 0:e.dataSet,activeMeasures:null==e?void 0:e.activeMeasures,setMeasure:function(t,n){null==e||e.setParameterUpdate({updatedMeasures:Mm(n,t,e.activeMeasures)})}}),Im(s)&&Pm(s)&&c.jsx(vf,{marginBottom:0,children:"Groups"}),c.jsx(_m,{group:null==s?void 0:s.group,dataSet:null==e?void 0:e.dataSet,activeDimensions:null==e?void 0:e.activeDimension,activeTimeDimension:null==e?void 0:e.activeTimeDimension,setDimension:function(t,n){"truncate"in t||!n||"truncate"in n||null==e||e.setParameterUpdate({updatedDimension:Lm(n,t,null==e?void 0:e.activeDimension)}),"truncate"in t&&(null==e||e.setParameterUpdate({updatedTimeDimension:t}))}})]})})})})]}):null},Nm={name:"18pw007",styles:"position:absolute;top:0px;right:0px;z-index:2"},zm={name:"195ggdj",styles:"position:absolute;top:0.75rem;right:0.75rem;display:flex;flex-direction:row;gap:0.625rem"},Bm=function(e){var n,r,o=us(),a=zl().organizationName;return e.displayTitle||e.displaySubject||!i.isEmpty(e.localFilters)||Dm(null==e?void 0:e.componentType,e.parameters)||null!=e&&e.verified?c.jsxs(c.Fragment,{children:[c.jsxs(Wd,{direction:"column",gap:"0.25rem","data-component":"titles",children:[c.jsxs(Wd,{alignItems:"center",gap:"0.25rem",paddingRight:"2.5rem",children:[e.displayTitle&&c.jsx(mf,{style:{fontFamily:null==o||null==(n=o.titles)?void 0:n.fontFamily},className:""+Sm.title(null==o?void 0:o.charts),"data-themeapi":"charts.title",children:e.displayTitle}),(null==e?void 0:e.verified)&&(null==e?void 0:e.library)&&c.jsxs(dp,{tooltipContent:function(){return c.jsxs(t.Fragment,{children:["Verified ",a&&"by "+a]})},children:[c.jsx(v.BadgeCheckIcon,{className:""+Sm.verified(null==o?void 0:o.library),"data-testid":"badge","data-themeapi":"library.verified.icon"}),c.jsxs(Tm,{children:["Verified ",a&&"by "+a]})]})]}),e.displaySubject&&c.jsx(hf,{style:{fontFamily:null==o||null==(r=o.baseFont)?void 0:r.fontFamily},className:""+Sm.subject(null==o?void 0:o.charts),"data-themeapi":"charts.subject",children:e.displaySubject})]}),!(null!=e&&e.library)&&c.jsx("div",{css:Nm,children:c.jsxs("div",{css:zm,children:[c.jsx(Rm,{activeDimension:null==e?void 0:e.dimension,activeTimeDimension:e.timeDimension,activeMeasures:null==e?void 0:e.measure,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.componentType,dataSet:e.dataSet,setParameterUpdate:function(t){return e.setParameterUpdate&&e.setParameterUpdate(t)}}),c.jsx(Fm,{setLocalFilters:e.setLocalFilters,localFilters:e.localFilters,zoomControl:e.zoomControl,dataSet:e.dataSet})]})})]}):null},qm=t.memo((function(e){return c.jsx(c.Fragment,{children:e.annotations.map((function(t){return c.jsxs(C.Annotation,{dataKey:e.dataKey,datum:t.datum,dx:t.xOffset,dy:t.yOffset,children:[c.jsx(C.AnnotationConnector,{stroke:"#dedede"}),c.jsx(C.AnnotationLabel,{backgroundPadding:5,title:t.title,showAnchorLine:!1,titleFontSize:"10px",backgroundProps:{opacity:1}})]})}))})}),(function(e,t){return JSON.stringify(e)==JSON.stringify(t)})),Vm=function(e){var t=e.dataKey,n=e.data;if(!e.show||i.isEmpty(e.generateAnnotations))return null;var r=function(e,t,n){var r=i.minBy(n,(function(e){return e[t]})),o=i.maxBy(n,(function(e){return e[t]})),a=[];return r&&a.push({title:"Low of "+r[t],datum:r,yOffset:15,xOffset:10}),o&&a.push({title:"High of "+o[t],datum:o,yOffset:-15,xOffset:10}),a}(0,t,n||[]);return c.jsx(qm,{dataKey:t,annotations:r})},Hm=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},r=U({},i.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var i=t?t[e]:null;i&&(r=U({},r,n.variants&&n.variants[e][i]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=U({},e.css);i.every(Object.keys(i.omit(e,["css"])),(function(n){var r;return e[n]==(null==(r=t)?void 0:r[n])}))&&(r=U({},r,n))})),r}}(e)(t);return p.css(n,"","")};return t.toString=t,t},Wm="\n.visx-tooltip {\n z-index: 14294967294; /* or whatever height is appropriate */\n}",Ym=function(e,t){return t?e-40:e},Um=p.css({display:"inline-flex",position:"relative",flexDirection:"row",gap:24,padding:0,height:40},"",""),Gm=p.css({name:"1lozhax",styles:"color:inherit;margin:0 0 0 4px;flex:1;display:flex;justify-content:left;font-family:inherit;font-size:0.7rem;opacity:1;font-weight:400"}),Km=Object.assign((function(){return null}),{icon:function(e){return Hm({marginLeft:"2px",variants:{type:{lines:{width:8,paddingTop:3,maxHeight:1,backgroundColor:e},bar:{height:8,width:8,backgroundColor:e,borderRadius:2},area:{height:0,width:0,borderBottom:"8px solid "+e,borderLeft:"8px solid transparent"},scatter:{height:8,borderRadius:"50%",width:8,backgroundColor:e},pie:{height:8,borderRadius:"50%",width:8,backgroundColor:e}}}})},container:Um,label:Gm,scrollbar:p.css({name:"1azakc",styles:"text-align:center"}),reason:function(e){return p.css(Gm,{zIndex:999,pointerEvents:"none",overflow:"hidden",position:"absolute",marginLeft:"20px",marginTop:"-5px",padding:"3px 5px",boxShadow:"0 1px 3px 0 rgba(0,0,0,0.1),0 1px 2px 0 rgba(0,0,0,0.06)",borderRadius:"5px",paddingLeft:"12px",paddingRight:"8px",background:"linear-gradient(90deg, "+e+" 5px, rgba(255,255,255,1) 5px)"},"","")}}),Xm=function(e){var n,r,i=t.useState(!1),o=i[1];return c.jsx("div",{className:(r=i[0],p.css(U({overflowX:r?"auto":"hidden",whiteSpace:"nowrap"},r?{"&::-webkit-scrollbar":{height:8,width:8,opacity:.6},"&:active::-webkit-scrollbar-thumb":{visibility:"visible"},"&:focus::-webkit-scrollbar-thumb":{visibility:"visible"},"&:hover::-webkit-scrollbar-thumb":{visibility:"visible"},"&::-webkit-scrollbar-thumb":{backgroundColor:"rgba(142, 139, 130, 0.8)",visibility:"hidden",borderRadius:4}}:{}),"","")+" "+(null!=(n=null==e?void 0:e.className)?n:"")),onMouseEnter:function(){return o(!0)},onMouseLeave:function(){return o(!1)},children:null==e?void 0:e.children})},Qm=function(e){var n,r,i=t.useState(!1),o=i[0],a=i[1];return c.jsx(c.Fragment,{children:c.jsx("span",{onMouseLeave:function(){return a(!1)},onMouseEnter:function(){return a(!0)},className:Km.icon(null!=(n=e.color)?n:"#5d4e8c")({type:null==e?void 0:e.type}),children:o&&e.reason&&c.jsx("div",{className:Km.reason(null!=(r=e.color)?r:"#5d4e8c"),children:e.reason})})})},Jm={natural:T.curveNatural,straight:T.curveLinear,step:T.curveStep,stepBefore:T.curveStepBefore,stepAfter:T.curveStepAfter};function Zm(e,t){return[].concat(null!=e&&e.areas?null==e?void 0:e.areas[t]:[],null!=e&&e.bars?null==e?void 0:e.bars[t]:[],null!=e&&e.lines?null==e?void 0:e.lines[t]:[])}function $m(e,t,n,r,i,o){var a={type:"linear",nice:!0},l={paddingOuter:.05,paddingInner:.3,type:n?"time":"band"};return"y"===e&&o&&(a=U({},a,{domain:o})),"x"===e?(i&&(l=U({},l,{type:"band"})),r&&(l=U({},l,{type:"pow"})),t?a:l):t?l:a}function eh(e,t,n,r){return function(i){var o;return null!=(o=t(i,e))?o:n[r]}}function th(e,t,n){return function(r){var i;return null!=(i=e(r))?i:t[n]}}var nh,rh=function(e,t){return function(n){return e?e(n):t?oh(n):n}},ih=function(e){return function(t){return null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(t):t}},oh=function(e){return A.timeFormat("%b %d, %y")(new Date(e))},ah=function(e){return c.jsx(Xm,{className:null!=e&&e.alignCenter?""+Km.scrollbar:void 0,x:!0,children:c.jsx(k,{scale:S.scaleOrdinal({domain:null==e?void 0:e.keys,range:null==e?void 0:e.colors}),children:function(t){return c.jsx("div",{className:Km.container,children:t.map((function(t,n){var r,i=null==e||null==(r=e.typeIndex)?void 0:r.find((function(e){return e.index===t.index})),o=e.conditionalFormattingPossibilities?e.conditionalFormattingPossibilities(t.text):[],a=function(){var r=null!=e&&e.formatter&&null!=e&&e.colors&&e.data?eh(t.datum,null==e?void 0:e.formatter,null==e?void 0:e.colors,n)(e.data):t.value,i=o.filter((function(e){var n=e.conditionIsMet(t.datum);return e.isRuleOnDimension&&n}));return e.replaceDimensionColorsIfPossible&&i[0]&&i[0].conditionIsMet(t.datum)?i[0].color:r},l=e.replaceDimensionColorsIfPossible?o.filter((function(e){return!e.isRuleOnDimension})):o;return c.jsx(Qm,{type:null==i?void 0:i.type,color:a()}),c.jsxs(F.LegendItem,{margin:"0",children:[l.map((function(e,t){return c.jsx(Qm,{type:null==i?void 0:i.type,color:e.color,reason:e.explanation},t)})),c.jsx(Qm,{type:null==i?void 0:i.type,color:a(),reason:l.length>0?"Original color":void 0}),c.jsx(F.LegendLabel,{className:Km.label,style:{},children:null!=e&&e.formatSeriesName?null==e?void 0:e.formatSeriesName(null==t?void 0:t.text):t.text})]},"legend-quantile-"+n)}))})}})})},lh=function(e){var t,n,r,i,o,a=[],l=0;return null!=e&&e.bars&&(null==e||e.bars.keys.forEach((function(){a.push({type:"bar",index:l}),l+=1}))),null!=e&&e.areas&&(null==e||null==(r=e.areas)||r.keys.forEach((function(){a.push({type:"area",index:l}),l+=1}))),null==e||!e.lines||null!=e&&null!=(t=e.lines)&&t.scatter||null==e||null==(i=e.lines)||i.keys.forEach((function(){a.push({type:"lines",index:l}),l+=1})),null!=e&&e.lines&&null!=e&&null!=(n=e.lines)&&n.scatter&&(null==e||null==(o=e.lines)||o.keys.forEach((function(){a.push({type:"scatter",index:l}),l+=1}))),a},sh=function(e,t){var n=-Infinity;if(t&&e)for(var r,i=te(t);!(r=i()).done;)for(var o=r.value,a=0;a<e.length;a++)e[a][o]>n&&(n=e[a][o]);return n},uh=function(e,t){var n=Infinity;if(t&&e)for(var r,i=te(t);!(r=i()).done;)for(var o=r.value,a=0;a<e.length;a++)e[a][o]<n&&(n=e[a][o]);return Infinity===n?0:n};function dh(e,t,n,r,i){var o=e?Math.max.apply(Math,e.map((function(e){return e.value}))):void 0,a=e?Math.min.apply(Math,e.map((function(e){return e.value}))):void 0;return o&&a&&o>t&&a<n?$m("y",r,i,void 0,void 0,[1.0005*a,1.0005*o]):o&&o>t?$m("y",r,i,void 0,void 0,[n,1.0005*o]):a&&a<n?$m("y",r,i,void 0,void 0,[1.0005*a,t]):$m("y",r,i)}var ch=Hm({margin:0,fontSize:"0.9rem",padding:0}),ph=Hm({borderBottom:"1px dotted rgba(0,0,0,0.025)"}),fh=Hm({display:"flex",alignItems:"center",gap:6}),mh=Hm({display:"block",padding:0,margin:0,textAlign:"right"}),hh=Hm({display:"grid",gridTemplateRows:"auto 1fr",gridRowGap:12,variants:{displayGrid:(nh={},nh.true={gridTemplateColumns:"1fr 1fr",gridColumnGap:48},nh.false={gridTemplateColumns:"1fr"},nh)}}),vh=Hm({borderTop:"1px solid rgba(200, 200, 200, 0.4)"}),gh=Hm({display:"grid",gridTemplateColumns:"auto 1fr",gap:12,fontSize:"0.75rem",fontWeight:500,color:"inherit",alignItems:"center"}),bh=Hm({display:"block",padding:0,margin:0}),xh=Object.assign((function(){return null}),{wrapper:function(e,t,n){var r=Array(n||1).fill("auto").join(" ");return t&&(r="20px "+r),e&&(r+=" 40px"),Hm({display:"grid",gridTemplateRows:r,gap:12,padding:6})},heading:ch,total:vh,highlighted:Hm({wordBreak:"break-all"}),row:ph,rowLabel:fh,resultGrid:hh,rowValue:mh,tooltipRowContainer:gh,totalLabel:bh,sectionTitle:Hm({color:"#7d838d",fontSize:12,marginTop:"0.25rem",marginBottom:0})}),yh=ua({color:da(35)}),wh=function(e){var t,n,r,o=e.chartProps,a=e.datumKey,l=e.tooltipNearestDatum.key,s=[].concat((r=i.sumBy([(n=o).bars,n.areas,n.lines],(function(e){return e?1:0}))>=1,n.sharedTooltip||r?Object.keys(null!=(t=null==e?void 0:e.datumKey)?t:{}):[l]));s.sort((function(t,n){var r=e.formatSeriesName(t),i=e.formatSeriesName(n);return r?i?r<i?-1:1:-1:1}));var u=[].concat(s).filter((function(e){return e&&void 0!==a[e].datum[e]})),d=e.formatValue?e.formatValue(a[l].datum[l]):a[l].datum[l];return c.jsxs(Ch,{total:o.showTotalOnTooltip,title:!0,sections:void 0!==d&&u.length>1?2:1,children:[c.jsx("p",{className:""+xh.heading,children:null==e?void 0:e.heading}),void 0!==d&&c.jsxs("div",{className:""+xh.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[u.length>1&&c.jsx("p",{className:xh.sectionTitle+" "+yh,children:"Active"}),c.jsx(Fh,{datumKey:a,keyString:l,chartProps:o,chartTooltipProps:e})]}),u.length>1&&c.jsxs("div",{className:""+xh.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[c.jsx("p",{className:xh.sectionTitle+" "+yh,children:"All"}),u.map((function(t){var n;return null!=o&&null!=(n=o.lines)&&n.scatter&&void 0===a[t].datum[t]?null:c.jsx(Fh,{datumKey:a,keyString:t,chartProps:o,chartTooltipProps:e},"chart_"+t)}))]}),o.showTotalOnTooltip&&c.jsxs("div",{className:xh.total+" "+xh.tooltipRowContainer,children:[c.jsx("p",{className:""+xh.totalLabel,children:"Rounded total: "}),c.jsx("p",{className:xh.row+" "+xh.rowValue,children:null==e?void 0:e.total})]})]})},Ch=function(e){return c.jsx("div",{className:""+xh.wrapper(e.total,null==e?void 0:e.title,null==e?void 0:e.sections),"data-sections":null==e?void 0:e.sections,children:null==e?void 0:e.children})},jh=function(e){var t,n;return c.jsxs("div",{className:""+xh.tooltipRowContainer,children:[c.jsxs("span",{className:xh.row+" "+xh.rowLabel,children:[(null==e?void 0:e.icon)&&c.jsx(Qm,{type:null==e||null==(t=e.icon)?void 0:t.type,color:null==e||null==(n=e.icon)?void 0:n.color}),c.jsx("span",{className:""+xh.highlighted,children:null==e?void 0:e.label})]}),c.jsx("p",{className:xh.row+" "+xh.rowValue,children:null==e?void 0:e.value})]})},Fh=function(e){var t,n=e.datumKey,r=e.keyString,i=e.chartProps,o=e.chartTooltipProps,a=function(e,t){var n,r,i,o,a,l,s;return null!=t&&t.bars&&null!=t&&null!=(n=t.bars.keys)&&n.find((function(t){return t===e}))?"bar":null==t||!t.lines||null!=t&&t.lines.scatter||null==t||null==(r=t.lines)||null==(i=r.keys)||!i.find((function(t){return t===e}))?null!=t&&t.areas&&null!=t&&null!=(o=t.areas)&&null!=(a=o.keys)&&a.find((function(t){return t===e}))?"area":null!=t&&t.lines&&null!=t&&t.lines.scatter&&null!=t&&null!=(l=t.lines)&&null!=(s=l.keys)&&s.find((function(t){return t===e}))?"scatter":null:"lines"}(n[r].key,i);if(!a)return null;var l=null!=(t=function(e,t,n,r){var i,o,a,l,s;return"area"==t&&null!=e&&null!=(i=e.areas)&&i.formatter?e.areas.formatter(n):"bar"==t&&null!=e&&null!=(o=e.bars)&&o.formatter?null==e||null==(a=e.bars)?void 0:a.formatter(r,n):"lines"==t&&null!=e&&null!=(l=e.lines)&&l.formatter?e.lines.formatter(n):"scatter"==t&&null!=e&&null!=(s=e.lines)&&s.formatter?e.lines.formatter(r,n):void 0}(i,a,r,n[r].datum))?t:o.getColor(r),s=o.formatSeriesName(r),u=o.formatValue?o.formatValue(n[r].datum[r]):n[r].datum[r];return c.jsx("div",{style:{width:380},children:c.jsx(jh,{icon:{type:a,color:l},label:s,value:"undefined"===u?"-":u})})};function Sh(e,t,n,r,i,o){void 0===o&&(o=0);var a=document.createElement("canvas").getContext("2d");if(!a)return e;a.font=i+" "+r+" "+n;var l=t-o;if(a.measureText(e).width+.4*(e.length-1)>l){for(var s=l-a.measureText("...").width,u="",d=0;d<e.length;d++){var c=e[d],p=a.measureText(c).width;if(!(s>=p))break;u+=c,s-=p+.4}return u+"..."}return e}function kh(e,t,n){if(1===e.length)return t.from.x;var r=e[n+1],i=e[n-1];return r&&i||r?r.from.x-t.from.x:i?t.from.x-i.from.x:0}var Th=function(e){if("string"==typeof e)return parseInt(e,10);if("number"==typeof e)return e;throw new Error("Invalid font size type")},Ah=function(e){if(void 0!==e){if("number"==typeof e)return e;switch(e){case"normal":return 400;case"bold":return 700;case"bolder":return 900;case"lighter":return 100;default:var t=parseInt(e,10);if(isNaN(t))throw new Error("Invalid font weight type");return t}}};function Dh(e,t,n){var r=(t-n)/3;return r*e+(n-9*r)}var Ih=function(e){var t,n,r,i,o={fontFamily:"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif",fontWeight:null==e||null==(t=e.theme)?void 0:t.fontWeight,fontSize:null==e||null==(n=e.theme)?void 0:n.fontSize,style:{fill:null!=(r=null==(i=e.theme)?void 0:i.color)?r:da(10)}};if("y"===(null==e?void 0:e.axis)){var a,l=-((null==e?void 0:e.axisFromPoint.y)+e.axisToPoint.y)/2;return c.jsx("svg",{x:"-1.25em",y:"0",fontSize:null==e||null==(a=e.theme)?void 0:a.fontSize,style:{overflow:"visible"},className:"vizzly-axis-title vizzly-axis-title-y",children:c.jsx("text",U({transform:"rotate(-90)",x:l,y:"-"+(50+(null!=e&&e.horizontal?8:0))},o,{textAnchor:"middle",children:c.jsx("tspan",{x:l,dy:"0em",children:null==e?void 0:e.label})}))})}return c.jsx("g",{className:"vizzly-axis-title vizzly-axis-title-x",transform:"translate(0, 0)",children:c.jsx("text",U({x:((null==e?void 0:e.axisFromPoint.x)+e.axisToPoint.x)/2,y:"34",textAnchor:"middle",dominantBaseline:"middle"},o,{children:null==e?void 0:e.label}))})},Ph=function(e){var n,r,i,o,a,l=function(e,n,r,i,o,a,l){var s=t.useState([]),u=s[0],d=s[1];return t.useEffect((function(){if(e&&n.length&&r){var t=function(e,t,n){var r=0;return e.forEach((function(e){var i=function(e,t,n,r,i){var o=document.createElementNS("http://www.w3.org/2000/svg","svg"),a=document.createElementNS("http://www.w3.org/2000/svg","text");a.textContent=e,a.setAttribute("font-family",t),a.setAttribute("font-weight",n),a.setAttribute("font-size",r),a.setAttribute("letter-spacing","normal"),o.appendChild(a),document.body.appendChild(o);var l=a.getBBox().width;return document.body.removeChild(o),l}(e.formattedValue,(null==n?void 0:n.fontFamily)||"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif",null!=t&&t.fontWeight?""+Ah(null==t?void 0:t.fontWeight):"700",""+(null!=t&&t.fontSize?Th(null==t?void 0:t.fontSize):9));r=Math.max(r,i)})),r}(n,l,a),s=n.find((function(e){return e.from.x+t/8>=i+t/2})),u=o-i-1.2*t;if(!(u<0)){for(var c=Math.floor((u-40)/(t+30)),p=Math.max(1,Math.floor(n.length/(c+1))),f=[s],m=s.index+p;m<n.length;m+=p)f.push(n[m]);d(f)}}}),[e,n,r,a,l]),r?u:n}(e.chartWidth,e.ticks,e.xAxisIsTime,e.axisFromPoint.x,e.axisToPoint.x,null==e?void 0:e.labelProps,null==e||null==(n=e.theme)?void 0:n.labels);return"none"===e.type?null:e.horizontal?c.jsxs("g",{className:"visx-group visx-axis-tick vizzly-axis-v",transform:"translate(0, 0)",children:["end2end"===(null==e?void 0:e.type)&&(null==e||null==(r=e.ticks)?void 0:r.map((function(t,n,r){var i;return function(t){return 0===t||t===(null==e?void 0:e.ticks.length)-1}(n)?d.createElement(_h,U({},t,{width:kh(r,t,n),labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),key:t.index+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(i=e.theme)?void 0:i.labels,type:null==e?void 0:e.type})):null}))),"end2end"!==(null==e?void 0:e.type)&&(null==l?void 0:l.map((function(t,n,r){var i;return d.createElement(_h,U({},t,{width:kh(r,t,n),labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),key:t.index+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(i=e.theme)?void 0:i.labels,type:null==e?void 0:e.type,xAxisIsTime:null==e?void 0:e.xAxisIsTime}))}))),!(null!=e&&e.hideAxisLine)&&c.jsx("line",{className:"visx-line",x1:e.axisFromPoint.x,y1:e.axisFromPoint.y,x2:e.axisToPoint.x,y2:e.axisToPoint.y,fill:"transparent",shapeRendering:"crispEdges",stroke:null==e?void 0:e.tickStroke,strokeWidth:null==e?void 0:e.strokeWidth,strokeLinecap:"square"}),(null==e?void 0:e.label)&&c.jsx(Ih,U({},e,{theme:null==e||null==(i=e.theme)?void 0:i.axisTitles,axis:"x",horizontal:null==e?void 0:e.horizontal}))]}):c.jsxs(t.Fragment,{children:[null==e||null==(o=e.ticks)?void 0:o.map((function(t,n){var r;return c.jsx("g",{className:"visx-group visx-axis-tick vizzly-axis-h",transform:"translate(0, 0)",children:c.jsx(_h,U({},t,{width:82,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),horizontal:e.horizontal,theme:null==e||null==(r=e.theme)?void 0:r.labels,type:null==e?void 0:e.type}))},t.index+"-"+(null==e?void 0:e.uniqueId))})),(null==e?void 0:e.label)&&c.jsx(Ih,U({},e,{theme:null==e||null==(a=e.theme)?void 0:a.axisTitles,axis:"y"}))]})},_h=function(e){var n,r,i,o,a,l,s,u=e.type,d=null!=(n=e.theme)&&n.fontSize?Th(null==(r=e.theme)?void 0:r.fontSize):9,p=null!=(i=e.theme)&&i.fontWeight?""+Ah(null==(o=e.theme)?void 0:o.fontWeight):"700",f=e.width/6,m=Sh(e.formattedValue,e.last?e.width-Dh(d,40,5):e.width-Dh(d,4,0),null==(a=e.labelProps)?void 0:a.fontFamily,""+d,p,f),h="end2end"===u?e.last?e.right:null==e?void 0:e.left:e.horizontal?e.last?e.from.x-5:e.from.x:-5,v=e.from.y;return c.jsxs(t.Fragment,{children:[!e.horizontal&&c.jsx("line",{className:"visx-line",x1:"0",y1:v,x2:"0",y2:v,fill:"transparent",shapeRendering:"crispEdges",stroke:"#eaeaea",strokeWidth:"1",strokeLinecap:"square"}),c.jsx("g",{x:"-0.25em",y:"0.25em",children:c.jsx("text",{transform:"",x:h,y:e.horizontal?"16":v,fontFamily:"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif",fontWeight:p,fontSize:""+d,letterSpacing:.4,stroke:"none",textAnchor:"end2end"===u?e.last?"end":"start":e.horizontal?"middle":"end",style:{fill:null!=(l=null==(s=e.theme)?void 0:s.color)?l:"rgba(0, 0, 0, 0.6)"},children:c.jsx("tspan",{x:h,dy:e.horizontal?0:2,children:"end2end"===u||e.xAxisIsTime?e.formattedValue:m})})})]})},Eh=function(e){var n,r,i;return"none"===e.type?null:c.jsxs("g",{className:"visx-group visx-axis-tick vizzly-axis-v",transform:"translate(0, 0)",children:["end2end"===(null==e?void 0:e.type)&&(null==e||null==(n=e.ticks)?void 0:n.map((function(n,r,i){var o,a;return 0===r?c.jsxs(t.Fragment,{children:[c.jsx(Oh,U({},n,{width:null!=e&&e.horizontal?kh(i,n,r):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:!1,top:null==e?void 0:e.axisToPoint.y,horizontal:e.horizontal,theme:null==e||null==(o=e.theme)?void 0:o.labels,type:null==e?void 0:e.type})),c.jsx(Oh,U({},n,{width:null!=e&&e.horizontal?kh(i,n,r):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,top:null==e?void 0:e.axisToPoint.y,last:!0,horizontal:e.horizontal,theme:null==e||null==(a=e.theme)?void 0:a.labels,type:null==e?void 0:e.type,maxValueOfYAxis:null==e?void 0:e.maxValueOfYAxis}))]},n.index+"-"+(null==e?void 0:e.uniqueId)):null}))),"end2end"!==(null==e?void 0:e.type)&&(null==e||null==(r=e.ticks)?void 0:r.map((function(t,n,r){var i;return d.createElement(Oh,U({},t,{width:null!=e&&e.horizontal?kh(r,t,n):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,top:null==e?void 0:e.axisToPoint.y,right:null==e?void 0:e.axisToPoint.x,last:!1,key:t.index+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(i=e.theme)?void 0:i.labels,type:null==e?void 0:e.type}))}))),(null==e?void 0:e.label)&&c.jsx(Ih,U({},e,{theme:null==e||null==(i=e.theme)?void 0:i.axisTitles,axis:null!=e&&e.horizontal?"x":"y",horizontal:null==e?void 0:e.horizontal}))]})},Oh=function(e){var t,n,r,i,o,a,l,s,u=null!=(t=e.theme)&&t.fontSize?Th(null==(n=e.theme)?void 0:n.fontSize):"9",d=null!=(r=e.theme)&&r.fontWeight?""+Ah(null==(i=e.theme)?void 0:i.fontWeight):"700",p=Sh(null!=(o=null==e?void 0:e.maxValueOfYAxis)?o:e.formattedValue,e.width,null==(a=e.labelProps)?void 0:a.fontFamily,""+u,d,5),f=e.horizontal?e.last?e.right:e.from.x:e.to.x;return c.jsx("g",{x:"-0.25em",y:"0.25em",children:c.jsx("text",{transform:"matrix(1, 0, 0, 1, 0, 0)",x:f,y:e.horizontal?"16":null!=e&&e.last?e.top:e.from.y,fontFamily:"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif",fontWeight:d,fontSize:u,letterSpacing:.4,stroke:"none",textAnchor:e.horizontal&&"end2end"===e.type?e.last?"end":"start":"middle",style:{fill:null!=(l=null==(s=e.theme)?void 0:s.color)?l:"rgba(0, 0, 0, 0.6)"},children:c.jsx("tspan",{x:f,dy:e.horizontal?0:2,children:p})})})},Lh=t.memo((function(e){if(e.value>(null==e?void 0:e.maxValueOfYAxis))return null;var n=null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(e.value):e.value,r=e.goalLine,i=e.axisProps,o=e.toX,a=t.useState(0),l=a[0],s=a[1],u=t.useRef(null);t.useEffect((function(){if(u.current){var e=u.current.getBBox();s(e.width+16)}}),[n]);var d=t.useMemo((function(){return function(e,t){for(var n,r,i,o=0,a=te(e);!(i=a()).done;){var l=i.value;if(l.value<=t.value&&(n=l),l.value>=t.value){r=l;break}}return n&&r&&(o=n.value===r.value?n.from.y:n.from.y+(r.from.y-n.from.y)/(r.value-n.value)*(t.value-n.value)),Math.round(o)}(i.ticks,r)}),[i.ticks,r]);return c.jsxs("g",{children:[c.jsx(D.Line,{from:{x:0,y:d},to:{x:o,y:d},stroke:r.color,strokeDasharray:"dashed"==r.strokeStyle?"5,5":void 0,strokeWidth:2,strokeLinecap:"round",shapeRendering:"smooth"}),c.jsxs("g",{transform:"translate("+(o-l-8- -(null==e?void 0:e.marginRight))+","+(d+8)+")",children:[c.jsx("path",{d:"M 0,0\n l -8,-8 \n l 8,-8 \n h "+l+" \n a 3,3 0 0 1 3,3 \n v 10 \n a 3,3 0 0 1 -3,3 \n h "+-l+" z",fill:r.color}),c.jsx("text",{ref:u,x:l/2,y:-1,dy:-4,textAnchor:"middle",fontFamily:"-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif",fontSize:9,fill:Mh(r.color,["#fff",da(0)]),children:n})]})]})})),Mh=function(e,t){return i.maxBy(t,(function(t){return s.contrast(t,e)}))||e},Rh=function(e,t,n,r){return{xAccessor:function(i){return i?r?i[n]:e?new Date(i[t]):i[t]:void 0},yAccessor:function(i){return i?r?e?new Date(i[t]):i[t]:i[n]:void 0}}},Nh=function(e){var n,r,o,a,l,s,u,d,p,f,m,h,v,g,b,x,y,w,F,S,k,T,A,D,I,P=Ym(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),_=e.approxYAxisLabelCount,E=void 0===_?"auto":_,O=e.approxXAxisLabelCount,L=void 0===O?"auto":O,M=e.removeStroke,R=void 0!==M&&M,N=e.horizontal,z=void 0!==N&&N,B=e.theme,q=e.x,V=(A=e.x,D=e.bars,e.forceXAxisAsTime&&!D||i.isDate(null==(I=Zm({bars:D,lines:e.lines,areas:e.areas},"data")[0])?void 0:I[A])),H=e.lineCurve?Jm[e.lineCurve]:Jm.natural,W=function(e,t){var n,r,i;return{fill:null!=(n=null==t?void 0:t.color)?n:"rgba(0, 0, 0, 0.6)",fontSize:null!=(r=null==t?void 0:t.fontSize)?r:9,fontWeight:null!=(i=null==t?void 0:t.fontWeight)?i:700,textAnchor:e?"end":"middle",scaleToFit:"shrink-only"}},Y=function(e,n){var r=t.useRef(null),i=t.useState(0),o=i[0],a=i[1];t.useEffect((function(){a(r.current?r.current.clientWidth:0),window.addEventListener("resize",(function(){a(r.current?r.current.offsetWidth:0)}))}));var l=Math.min(o<1e3?parseInt((""+o)[0]):12,12);return"auto"!=e?[r,e]:[r,l*(n?4:1)]}(L,!(null!=e&&e.horizontal)&&(null==e?void 0:e.forceXAxisAsTime)),G=Y[0],K=Y[1],X=t.useState(void 0),Q=X[0],J=X[1],Z=t.useState(void 0),$=Z[0],ee=Z[1],te=Zm(e,"colors"),ne=C.buildChartTheme(U({},C.lightTheme,{colors:te,tickLength:0,gridColor:"",gridColorDark:""})),re=null!=(r=null==B||null==(o=B.axis)?void 0:o.stroke)?r:"#eaeaea",ie=function(e,t){var n=0===e?"none":2===e?"end2end":"auto";return{xAxisType:n,xAxisAttributes:"end2end"===n?{left:0}:null,yAxisType:0===t?"none":2===t?"end2end":"auto"}}(L,E),oe=ie.xAxisType,ae=ie.xAxisAttributes,le=ie.yAxisType,se=null!=(a=null!=(l=null==e||null==(s=e.lines)?void 0:s.data.length)?l:null==e||null==(u=e.areas)||null==(d=u.data)?void 0:d.length)?a:null==(p=e.bars)?void 0:p.data.length,ue=function(e){var n,r,i,o,a,l;return t.useMemo((function(){for(var t=-Infinity,n=Infinity,r=0,i=["bars","lines","areas"];r<i.length;r++){var o,a,l=i[r],s=null==(o=e[l])?void 0:o.data,u=null==(a=e[l])?void 0:a.keys,d=sh(s,u),c=uh(s,u);d>t&&(t=d),c<n&&(n=c)}return{maxValue:t,minValue:n}}),[null==(n=e.bars)?void 0:n.data,null==(r=e.bars)?void 0:r.keys,null==(i=e.lines)?void 0:i.data,null==(o=e.lines)?void 0:o.keys,null==(a=e.areas)?void 0:a.data,null==(l=e.areas)?void 0:l.keys])}(e),de=ue.maxValue,ce=ue.minValue,pe=e.sparkline?{top:2,bottom:2,left:"right"!==e.yAxisOrientation?50:0,right:0}:function(e,t,n,r){var i=Boolean(null==r?void 0:r.x),o=Boolean(null==r?void 0:r.y);return{top:25,bottom:i?40:25,left:e?"none"!==n?82:25:t?50+(o?24:0):25,right:25}}(z,"right"!==e.yAxisOrientation,oe,null==e?void 0:e.axisTitles);return c.jsxs("div",{ref:G,style:{position:"relative",height:P},children:[c.jsxs(C.XYChart,{theme:ne,margin:pe,height:P,xScale:$m("x",z,V,null==e||null==(f=e.lines)?void 0:f.scatter,!(null==e||!e.lines)||!(null==e||!e.areas)),yScale:dh(null==e?void 0:e.goalLine,de,ce,z,V),horizontal:z,onPointerUp:function(){return null==e?void 0:e.onClick(Q,$)},children:[c.jsx(C.Grid,{columns:z,rows:!z,stroke:"black",strokeDasharray:"0.5 5",strokeWidth:R?0:2,lineStyle:{strokeLinecap:"round",stroke:null!=(m=null==B||null==(h=B.grid)?void 0:h.stroke)?m:"rgba(200, 200, 200, 0.2)"}}),!(null!=e&&e.sparkline)&&c.jsxs(c.Fragment,{children:["none"!==oe&&c.jsx(C.Axis,U({},ae,{tickLabelProps:function(){var e=U({},W(z,null==B?void 0:B.labels));return z||(e.y=15),e},numTicks:"end2end"===oe?se:K,strokeWidth:R?0:1,tickStroke:"#eaeaea",stroke:z?"transparent":re,orientation:z?"left":"bottom",tickFormat:rh(e.formatXAxisLabel,e.forceXAxisAsTime||V),label:z?null==e||null==(v=e.axisTitles)?void 0:v.y:null==e||null==(g=e.axisTitles)?void 0:g.x,children:function(t){return c.jsx(Ph,U({},t,{theme:B,type:oe,uniqueId:null==e?void 0:e.uniqueId,chartWidth:null==e?void 0:e.width,xAxisIsTime:!!e.forceXAxisAsTime}))}})),c.jsx(C.Axis,{labelOffset:50,tickLabelProps:function(){var t=U({},W(z,null==B?void 0:B.labels));return z||"right"===e.yAxisOrientation||(t.width=50,t.textAnchor="middle"),t},hideAxisLine:!0,numTicks:"auto"===E?5:E,strokeWidth:R?0:1,hideTicks:!0,tickLength:e.horizontal||"right"===e.yAxisOrientation?10:25,stroke:re,orientation:z?"bottom":e.yAxisOrientation||"left",tickFormat:ih(e),label:z?null==e||null==(b=e.axisTitles)?void 0:b.x:null==e||null==(x=e.axisTitles)?void 0:x.y,children:function(t){return c.jsx(Eh,U({},t,{theme:B,type:le,horizontal:z,maxValueOfYAxis:null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(de):de,uniqueId:null==e?void 0:e.uniqueId}))}})]}),c.jsx("style",{children:"\n .visx-bar-stack .visx-bar {\n stroke: #fff;\n stroke-width: 2px;\n }\n .visx-tooltip-glyph svg {\n max-width: 10px\n height: 10px;\n }\n "+Wm+"\n "}),(null==e?void 0:e.areas)&&c.jsx(c.Fragment,{children:[].concat(e.areas.keys).map((function(t,n){var r,i,o,a=(null==(r=e.areas)?void 0:r.formatter)&&(null==(i=e.areas)?void 0:i.formatter(t))||(null==(o=e.areas)?void 0:o.colors[n]);return c.jsx(j.LinearGradient,{id:"g"+e.uniqueId+n,from:a,to:a,fromOffset:.6,fromOpacity:.8,toOpacity:.6},"area_gradients_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.areas)&&!(null!=e&&null!=(y=e.areas)&&y.stacked)&&c.jsx(c.Fragment,{children:[].concat(e.areas.keys).map((function(t,n){var r;return c.jsx(C.AreaSeries,U({fill:"url(#g"+e.uniqueId+n+")",curve:H,renderLine:!1,dataKey:t,data:null==(r=e.areas)?void 0:r.data},Rh(V,q,t,z)),"grouped_area_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.areas)&&e.areas.stacked&&c.jsx(C.AreaStack,{curve:H,renderLine:!0,children:[].concat(e.areas.keys).map((function(t,n){var r;return c.jsx(C.AreaSeries,U({fill:"url(#g"+e.uniqueId+n+")",dataKey:t,lineProps:{strokeWidth:4,strokeLinecap:"round"},data:null==(r=e.areas)?void 0:r.data},Rh(V,q,t,z)),"areas_stacked_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.bars)&&!e.bars.stacked&&c.jsx(C.BarGroup,{children:e.bars.keys.map((function(t,n){var r,i;return c.jsx(C.BarSeries,U({radiusAll:!0,radius:5,dataKey:t,data:null==(r=e.bars)?void 0:r.data},Rh(V,q,t,z),{colorAccessor:(null==e||null==(i=e.bars)?void 0:i.formatter)&&eh(t,null==e?void 0:e.bars.formatter,te,n)}),"grouped_bar_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.bars)&&e.bars.stacked&&c.jsx(C.BarStack,{offset:"100%"==e.bars.stacked?"expand":"none",children:e.bars.keys.map((function(t,n){var r,i;return c.jsx(C.BarSeries,U({radiusAll:!0,radius:3,dataKey:t,data:null==(r=e.bars)?void 0:r.data},Rh(V,q,t,z),{colorAccessor:(null==e||null==(i=e.bars)?void 0:i.formatter)&&eh(t,null==e?void 0:e.bars.formatter,te,n)}),"stacked_bar_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.lines)&&!(null!=e&&null!=(w=e.lines)&&w.scatter)&&e.lines.keys.map((function(t,n){var r,i;return c.jsx(C.LineSeries,U({strokeWidth:3,curve:H,dataKey:t,data:null==(r=e.lines)?void 0:r.data},Rh(V,q,t,z),{colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&th(null==e?void 0:e.lines.formatter,te,n)}),"line_on_line_chart_"+e.uniqueId+"_"+n)})),e.lines&&(null==e||null==(F=e.lines)?void 0:F.scatter)&&e.lines.keys.map((function(t,n){var r,i;return c.jsx(C.GlyphSeries,U({dataKey:t,data:null==(r=e.lines)?void 0:r.data},Rh(V,q,t,z),{colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&eh(t,null==e?void 0:e.lines.formatter,te,n)}),"scatter_chart_"+e.uniqueId+"_"+n)})),["areas","lines"].map((function(n,r){var i=e;return c.jsx(t.Fragment,{children:i[n]&&[].concat(i[n].keys).map((function(t,o){var a,l;return c.jsx(Vm,{show:(null==Q?void 0:Q.key)==t,generateAnnotations:null==(a=i[n])?void 0:a.annotate,dataKey:t,data:null==(l=i[n])?void 0:l.data},"area_lines_"+e.uniqueId+"_"+r+"_"+o)}))},"area_lines_"+e.uniqueId+"_"+r)})),c.jsx(C.Tooltip,{showVerticalCrosshair:!0,showSeriesGlyphs:null==e.bars,renderTooltip:function(n){var r=n.tooltipData,o=n.colorScale,a=null==r?void 0:r.datumByKey;ee(a);var l=null==r?void 0:r.nearestDatum,s=i.debounce((function(){var e,t=(null==l||null==(e=l.key)?void 0:e.key)!=(null==Q?void 0:Q.key);Q&&!t||J(null==r?void 0:r.nearestDatum)}));if(t.useEffect((function(){return s()})),!r||!o)return null;var u=Object.values(null!=a?a:{}),d=Math.round(i.sumBy(u,(function(e){return Number(e.datum[e.key]||0)}))),p=function(e,t,n){return null==n?"No value":rh(e,t)(n)}(e.formatXAxisLabel,V,null==l?void 0:l.datum[q]);return c.jsx(wh,{heading:p,total:d,chartProps:e,datumKey:a,tooltipNearestDatum:l,typeIndex:lh(e),getColor:function(e){return null==o?void 0:o(e)},formatSeriesName:e.formatSeriesName,formatValue:ih(e)})}}),e.goalLine&&(null==(S=e.goalLine)?void 0:S.length)>0&&!z&&c.jsx(C.Axis,{orientation:"left",children:function(t){var n;return null==(n=e.goalLine)?void 0:n.map((function(n,r){var i;return c.jsx(Lh,{axisProps:t,goalLine:n,value:n.value,toX:(null!=(i=null==e?void 0:e.width)?i:0)-pe.left-pe.right,marginRight:pe.right,maxValueOfYAxis:de,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel},(null==e?void 0:e.uniqueId)+"-"+r)}))}})]}),(null==e?void 0:e.legend)&&c.jsx(ah,{keys:Zm(e,"keys"),colors:te,typeIndex:lh(e),formatSeriesName:null==e?void 0:e.formatSeriesName,formatter:null==e||null==(k=e.bars)?void 0:k.formatter,data:null==(T=e.bars)?void 0:T.data,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities})]})};function zh(e){var n=t.useState(!1),r=n[0],i=n[1];return t.useEffect((function(){return i(!1)}),[r]),t.useImperativeHandle(e,(function(){return{resetSize:function(){i(!0)}}})),r}var Bh=t.forwardRef((function(e,t){return zh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Nh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,sparkline:e.sparkline,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,lineCurve:e.lineCurve,showTotalOnTooltip:e.showTotalOnTooltip,forceXAxisAsTime:e.forceXAxisAsTime,areas:{colors:e.colors,annotate:e.annotate||[],stacked:e.stacked||!1,data:e.data,keys:e.keys,formatter:e.formatter},x:e.x,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onPointerUp:null==e?void 0:e.onPointerUp,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles})}})})),qh=function(e){var t=[];return"dimension"in e&&(t=[].concat(t,e.dimension||[])),"lineDimension"in e&&(t=[].concat(t,e.lineDimension||[])),"barDimension"in e&&(t=[].concat(t,e.barDimension||[])),{x:(t=(t=[].concat(e.timeDimension?[{field:e.timeDimension.field,function:e.timeDimension.truncate,pivot:"x"}]:[],t)).map((function(e,t){return 0==t?(e.pivot=e.pivot||"x",e):(e.pivot=e.pivot||"y",e)}))).filter((function(e){return"x"==e.pivot})).map((function(e){return tt(e)})),y:t.filter((function(e){return"y"==e.pivot})).map((function(e){return tt(e)}))}};function Vh(e){var n=e.title,r=e.subject,i=t.useRef(null),o=t.useState(n),a=o[0],l=o[1],s=t.useState(r),u=s[0],d=s[1];return t.useEffect((function(){0===a.length&&n.length>=1&&i.current&&i.current.resetSize(),0===u.length&&r.length>=1&&i.current&&i.current.resetSize(),l(n),d(r)}),[n,r]),i}var Hh=function(e,t){return!(!1!==e&&void 0!==e||!t)||!0===e},Wh=function(e){var n,r,i,o=Vh({title:null==e?void 0:e.displayTitle,subject:null==e?void 0:e.displaySubject}),a=us(),l={displayTitle:e.displayTitle,displaySubject:e.displaySubject,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,library:null!=(n=e.library)&&n,verified:e.protectedByOrganisation,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension,timeDimension:e.timeDimension,setParameterUpdate:null==e?void 0:e.setParameterUpdate};if(!On(e.type).isRunnable(e))return c.jsx(sf,{title:"Missing parameters"});if(Ho(e.result))return c.jsx(fc,{});if(Wo(e.result))return c.jsx(uf,{});if(Yo(e.result))return c.jsx(cf,U({},l));var s=qh(e),u=Bo(s,e.measure,e.result),d=zo(e.result,e.measure,s,"100%"==e.stacked);return c.jsx(t.Suspense,{fallback:c.jsx(fc,{}),children:c.jsxs(kp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Bm,U({},l)),c.jsx(za,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:c.jsx(Bh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:o,uniqueId:e.id,x:"x",keys:u,colors:er(null!=(i=null==a?void 0:a.colors)?i:ga.colors,u.length),data:d,legend:Hh(null==e?void 0:e.legend,"verbose"===(null==a?void 0:a.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!!e.timeDimension,showTotalOnTooltip:!!e.stacked,stacked:!!e.stacked,formatXAxisLabel:ra(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatYAxisLabel:ia({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),annotate:"verbose"==(null==a?void 0:a.detail)?["high_and_low"]:[],lineCurve:e.lineCurve,theme:ms(null==a?void 0:a.charts),formatSeriesName:oa(e.result),formatter:function(t){var n=na(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.ruleValue},onPointerUp:null==e?void 0:e.onPointerUp,sparkline:e.sm,goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles})})]})})};Wh.defaultProps={type:"areaChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0};var Yh=t.memo(Wh,$o),Uh=function(){return null},Gh=function(e){var t,n,r;return(null==e||null==(t=e.component)||null==(n=t.attributes)||null==(r=n.drilldown)?void 0:r.length)>0},Kh=function(e,n,r,i,o,a){var l=t.useState(!1),s=l[0],u=l[1];try{var d=function(e,t){if("dataSetId"in t){var n=Kt(t).flatMap((function(t){var n=Rn(e,t);return kt(n)?[n]:[]}));return JSON.stringify(n)}return""}(o,e);return t.useEffect((function(){var t=new AbortController;return function(){var o=Y(H().mark((function o(){var a;return H().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return u(!0),o.next=3,qc(e,n,t.signal,i);case 3:(a=o.sent)?(u(!1),t.signal.aborted||r(a)):r([null]);case 5:case"end":return o.stop()}}),o)})));return function(){return o.apply(this,arguments)}}()(),function(){t.abort()}}),[JSON.stringify({componentType:a,dataSetId:o.id,queries:e,filterConfig:i,watchCustomFieldChangesKey:d})]),{queriesAreChanging:s}}catch(e){if(u(!1),e instanceof qt)return{queriesAreChanging:!1};throw e}},Xh=function(e){var n,r,i=t.useState(null),o=i[0],a=i[1],l=e.component,s=l.results,u=l.attributes,d=l.localFilters,p=Kh(u,e.runQueriesCallback,e.setResults,{localFilters:e.component.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsxs(t.Fragment,{children:[c.jsx(Yh,U({id:e.id},u,{dataSet:e.dataSet,localFilters:d,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,result:s[0],queriesAreChanging:p.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(r=n.queryEngineConfig)?void 0:r.supportedTransformationFunctions,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,onPointerUp:function(t){return Gh(e)&&a(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions})),o&&c.jsx(Uh,{onDrilldown:o,onClose:function(){return a(null)},inputProps:e})]})},Qh=t.forwardRef((function(e,t){return zh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Nh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,sparkline:e.sparkline,x:e.x,formatSeriesName:e.formatSeriesName,bars:{annotate:[],stacked:"stacked"===(null==e?void 0:e.type),colors:e.colors,data:e.data,keys:e.keys,formatter:e.formatter},legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,forceXAxisAsTime:null==e?void 0:e.forceXAxisAsTime,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width,showTotalOnTooltip:e.showTotalOnTooltip,theme:null==e?void 0:e.theme,onPointerUp:null==e?void 0:e.onPointerUp,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities,onClick:function(t,n){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t,n))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles})}})}));function Jh(e,t,n){var r=Zh(e,t);return null!=n&&n.grouping?$h(r,null==n?void 0:n.grouping):r}var Zh=function(e,t){return e.map((function(e){return e.field in t?{fieldId:e.field,function:e.function,aggregate:e.function,value:t[e.field]}:{fieldId:e.field,function:e.function,aggregate:e.function}}))},$h=function(e,t){return t.forEach((function(t){var n=e.findIndex((function(e){return e.fieldId===t.fieldId}));n>-1?e[n]=U({},e[n],t):e.push(t)})),e};function ev(e,t,n,r,i){if(!Array.isArray(e)||!Array.isArray(n))throw new Error("Invalid input: fields and row must be arrays");return e.map((function(e,o){var a,l;if(Lo(e.datumKey))return(l={})[e.datumKey]=null==(a=n[o])?void 0:a.value,l;var s={};if("string"==typeof e.id){var u,d,c=e.id;i&&null!=r&&r.some((function(e){return e.id===i.subsetDimension}))&&(c=i.subsetDimension);var p=nt(c,t);(d={})[JSON.stringify(p)]=null==(u=n[o])?void 0:u.value,s=d}return s})).filter((function(e){return Object.keys(e).length>0}))}var tv=function(e){var t;return!(!e||void 0===e||!(e.measure&&(null==(t=e.measure)?void 0:t.length)>0||null!=e&&e.dimension&&(null==e?void 0:e.dimension.length)>0))},nv={type:"barChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!1,drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto"},rv=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b,x=e.displayTitle,y=e.displaySubject,w=Vh({title:x,subject:y}),C=us(),j={displayTitle:x,displaySubject:y,localFilters:(e=Zo(e,{},nv)).localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,library:null!=(n=null==(r=e)?void 0:r.library)&&n,verified:null==(i=e)?void 0:i.protectedByOrganisation,dataSet:e.dataSet,parameters:null==(o=e)?void 0:o.parameters,componentType:null==(a=e)?void 0:a.type,measure:null==(l=e)?void 0:l.measure,dimension:null==(s=e)?void 0:s.dimension,timeDimension:e.timeDimension};if(!On(e.type).isRunnable(e))return c.jsx(sf,{title:"Missing parameters"});if(Ho(e.result))return c.jsx(fc,{});if(Wo(e.result))return c.jsx(uf,{});if(Yo(e.result))return c.jsx(cf,U({},j));var F=qh(e),S=Bo(F,e.measure,e.result),k=zo(e.result,e.measure,F,"100%"==e.stacked);return c.jsx(t.Suspense,{fallback:c.jsx(fc,{}),children:c.jsxs(kp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Bm,U({},j)),c.jsx(za,{disabledFeatures:null!=(u=null==(d=e)?void 0:d.library)&&u,children:c.jsx(Qh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:w,sparkline:e.sm,uniqueId:e.id,x:"x",formatYAxisLabel:ia({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(p=e)?void 0:p.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:ra(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(f=e)?void 0:f.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatter:function(t,n){var r,i=na(e.dimension,e.conditionalFormattingRules,t,n,null==(r=e)?void 0:r.dataSet);if(i)return i.ruleValue},keys:S,colors:er(null!=(m=null==C?void 0:C.colors)?m:ga.colors,S.length),data:k,legend:Hh(null==(h=e)?void 0:h.legend,"verbose"===(null==C?void 0:C.detail)),horizontal:"horizontalBarChart"==e.type,removeStroke:!1,type:e.stacked?"stacked":"grouped",showTotalOnTooltip:!!e.stacked,forceXAxisAsTime:!!e.timeDimension,theme:ms(null==C?void 0:C.charts),axisTitles:null==(v=e)?void 0:v.axisTitles,formatSeriesName:oa(e.result),onPointerUp:null==(g=e)?void 0:g.onPointerUp,conditionalFormattingPossibilities:function(t){return ta(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},onClick:function(t,n){return function(e,t,n){var r,i,o=n.onViewClick;(function(e){return(null==e?void 0:e.distance)<3})(e)&&tv(null==n?void 0:n.protectedFields)&&o({viewId:null!=(r=null==n?void 0:n.viewId)?r:"",type:null!=(i=null==n?void 0:n.type)?i:"barChart",clicked:{grouping:function(){var r,i=[],o=Object.keys(null!=t?t:{}).map((function(e){return Mo(e)}));if(null!=n&&n.dimension&&(null==n||null==(r=n.dimension)?void 0:r.length)>0)if(o.length>1)o.map((function(e){var t,n;i.push({fieldId:null!=(t=""+e.dimensionKeys[0])?t:"",function:e.function,aggregate:e.function,value:null!=(n=""+e.dimensionValues[0])?n:""})}));else{var a,l=null!=(a=null==n?void 0:n.dimension[0].field)?a:"";i.push({fieldId:l,function:null==n?void 0:n.dimension[0].function,aggregate:null==n?void 0:n.dimension[0].function,value:null==e?void 0:e.datum[l]})}if(n&&"timeDimension"in n&&null!==(null==n?void 0:n.timeDimension)){var s,u,d,c,p=null!=(s=null==(u=n.timeDimension)?void 0:u.field)?s:"";i.push({fieldId:p,function:null==(d=n.timeDimension)?void 0:d.truncate,aggregate:null==(c=n.timeDimension)?void 0:c.truncate,value:null==e?void 0:e.datum[p]})}return i}(),value:{fieldId:null!=n&&n.measure?null==n?void 0:n.measure[0].field:"",function:null!=n&&n.measure?null==n?void 0:n.measure[0].function:"",aggregate:null!=n&&n.measure?null==n?void 0:n.measure[0].function:"",value:null==e?void 0:e.datum[null==e?void 0:e.key]}}})}(t,n,e)},goalLine:null==(b=e)?void 0:b.goalLines})})]})})};rv.defaultProps=nv;var iv=t.memo(rv,$o),ov=function(e,n,r,i,o,a,l){var s=e;return n.preAggregated&&(s=[Yn(n)]),function(e,n,r,i){t.useEffect((function(){var t=On(n.type,{queryEngineConfig:r});if(e.preAggregated&&t.setDataAttributesFromPreAggregatedDataSet){var o=t.setDataAttributesFromPreAggregatedDataSet(n,e);i(o)}}),[JSON.stringify({dataSet:e,type:n.type})])}(n,e,r,o),{queriesAreChanging:Kh(s,a,l,i,n,e.type).queriesAreChanging}},av=function(e){var n,r,i=t.useState(null),o=i[0],a=i[1],l=e.component,s=l.results,u=l.attributes,d=ov(u,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:l.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return c.jsxs(t.Fragment,{children:[c.jsx(iv,U({id:e.id},u,{sm:e.sm,dataSet:e.dataSet,localFilters:e.component.localFilters,parameters:null==e?void 0:e.component.attributes.parameters,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,result:s[0],queriesAreChanging:d.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(r=n.queryEngineConfig)?void 0:r.supportedTransformationFunctions,onPointerUp:function(t){return Gh(e)&&a(t)},library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onViewClick:function(t){return(null==e?void 0:e.onViewClick)&&(null==e?void 0:e.onViewClick(t))},goalLines:e.component.attributes.goalLines,axisTitles:null==e?void 0:e.component.attributes.axisTitles})),o&&c.jsx(Uh,{onDrilldown:o,onClose:function(){return a(null)},inputProps:e})]})},lv=t.forwardRef((function(e,t){return zh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Nh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,forceXAxisAsTime:e.forceXAxisAsTime,lineCurve:e.lineCurve,sparkline:e.sparkline,lines:{annotate:e.annotate||[],data:e.data,keys:e.keys,colors:e.colors,formatter:e.formatter},x:e.x,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onPointerUp:null==e?void 0:e.onPointerUp,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles})}})})),sv=function(e){var n,r,i,o=e.displayTitle,a=e.displaySubject,l=Vh({title:o,subject:a}),s={displayTitle:o,displaySubject:a,verified:e.protectedByOrganisation,library:null!=(n=e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension,timeDimension:e.timeDimension,setParameterUpdate:null==e?void 0:e.setParameterUpdate},u=us();if(!On(e.type).isRunnable(e))return c.jsx(sf,{title:"Missing parameters"});if(Ho(e.result))return c.jsx(fc,{});if(Wo(e.result))return c.jsx(uf,{});if(Yo(e.result))return c.jsx(cf,U({},s));var d=qh(e),p=Bo(d,e.measure,e.result),f=zo(e.result,e.measure,d,"100%"==e.stacked);return c.jsx(t.Suspense,{fallback:c.jsx(fc,{}),children:c.jsxs(kp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Bm,U({},s)),c.jsx(za,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:c.jsx(lv,{ref:l,uniqueId:e.id,x:"x",approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,formatYAxisLabel:ia({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:ra(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),keys:p,colors:er(null!=(i=null==u?void 0:u.colors)?i:ga.colors,p.length),data:f,sparkline:e.sm,legend:Hh(null==e?void 0:e.legend,"verbose"===(null==u?void 0:u.detail)),horizontal:!1,annotate:"verbose"==(null==u?void 0:u.detail)?["high_and_low"]:[],forceXAxisAsTime:!!e.timeDimension,lineCurve:e.lineCurve,theme:ms(null==u?void 0:u.charts),formatSeriesName:oa(e.result),formatter:function(t){var n=na(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.ruleValue},onPointerUp:null==e?void 0:e.onPointerUp,goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles})})]})})};sv.defaultProps={type:"lineChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0};var uv=t.memo(sv,$o),dv=function(e){var n,r,i=t.useState(null),o=i[0],a=i[1],l=e.component,s=l.results,u=l.attributes,d=ov(u,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:l.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return c.jsxs(t.Fragment,{children:[c.jsx(uv,U({id:e.id},u,{dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,result:s[0],queriesAreChanging:d.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(r=n.queryEngineConfig)?void 0:r.supportedTransformationFunctions,onPointerUp:function(t){return Gh(e)&&a(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions})),o&&c.jsx(Uh,{onDrilldown:o,onClose:function(){return a(null)},inputProps:e})]})};function cv(e){if(0===(null==e?void 0:e.measure.length))return"The Data settings are missing a Metric. Select from the list of Metrics to display the Chart."}function pv(e){if(e.xMeasure&&e.yMeasure||e.dimension.length>0)return"The Data settings are missing a parameter. Select from the list of parameters to display the Chart."}var fv=t.forwardRef((function(e,t){return zh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Nh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,forceXAxisAsTime:e.forceXAxisAsTime,sparkline:e.sparkline,lines:{annotate:e.annotate||[],data:e.data,keys:e.keys,colors:e.colors,scatter:!0},x:e.x,sharedTooltip:!0,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles})}})})),mv={type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,filter:[],limit:500,legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto"},hv=function(e){var n,r,i,o,a,l,s,u,d,p,f=e.displayTitle,m=e.displaySubject,h=Vh({title:f,subject:m}),v={displayTitle:f,displaySubject:m,library:null!=(n=e.library)&&n,verified:e.protectedByOrganisation,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,componentType:null==(r=e)?void 0:r.type},g=us();if(!On(e.type).isRunnable(e))return c.jsx(sf,{title:"Missing parameters",children:pv(e)});if(Ho(e.result))return c.jsx(fc,{});if(Wo(e.result))return c.jsx(uf,{});if(Yo(e.result))return c.jsx(cf,U({},v));var b=(e=Zo(e,{},mv)).result&&e.xMeasure?function(e,t,n){var r={};return No(n).forEach((function(n){var i=[].concat(e).map((function(e){return n[e.field]})),o=[].concat(e).map((function(e){return e.field})),a=Oo(o,i,t.field,t.function);r[a]=!0})),Object.keys(r)}(e.dimension,e.xMeasure,e.result):[];if(!e.xMeasure||!e.yMeasure)return null;var x=[];e.xMeasure&&x.push(e.xMeasure),e.yMeasure&&x.push(e.yMeasure);var y=qh(e),w=e.result?zo(e.result,x,y):[],C=Oo([],[],e.xMeasure.field,e.xMeasure.function);return w.map((function(t){var n=[].concat(e.dimension.map((function(e){return t[e.field]}))),r=e.yMeasure,i=e.xMeasure;if(!r)return!1;if(!i)return!1;var o=Oo([],[],r.field,r.function),a=Oo(e.dimension.map((function(e){return e.field})),n,i.field,i.function);return t[a]=t[o],t})),c.jsx(t.Suspense,{fallback:c.jsx(fc,{}),children:c.jsxs(kp,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Bm,U({},v)),c.jsx(za,{disabledFeatures:null!=(i=null==(o=e)?void 0:o.library)&&i,children:c.jsx(fv,{ref:h,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,x:C,keys:b,colors:er(null!=(a=null==g?void 0:g.colors)?a:ga.colors,b.length),data:w,legend:Hh(null==(l=e)?void 0:l.legend,"verbose"===(null==g?void 0:g.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!1,sparkline:!1,formatYAxisLabel:ia({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(s=e)?void 0:s.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:ra(null,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(u=e)?void 0:u.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),theme:ms(null==g?void 0:g.charts),formatSeriesName:oa(e.result),goalLine:null==(d=e)?void 0:d.goalLines,axisTitles:null==(p=e)?void 0:p.axisTitles})})]})})};hv.defaultProps=mv;var vv=t.memo(hv,$o),gv=function(e){var t,n,r=e.component,i=r.results,o=r.attributes,a=r.localFilters,l=Kh(o,e.runQueriesCallback,e.setResults,{localFilters:a,globalFilters:e.globalFilters},e.dataSet);return c.jsx(vv,U({id:e.id},o,{dataSet:e.dataSet,localFilters:a,setLocalFilters:e.setLocalFilters,setParameterUpdate:function(){},result:i[0],queriesAreChanging:l.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,sm:e.sm,library:null==e?void 0:e.library,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(n=t.queryEngineConfig)?void 0:n.supportedTransformationFunctions,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions}))},bv=function(e){return[].concat(e.content).map((function(t){return i.reduce(t,(function(t,n,r){return t[e.fields[r].id]=n,t}),{})}))},xv=t.forwardRef((function(e,t){return zh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Nh,U({},e,{height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width}))}})})),yv=function(e){var t=e.endAngle;return{startAngle:t>Math.PI?2*Math.PI:0,endAngle:t>Math.PI?2*Math.PI:0,opacity:0}},wv=function(e){return{startAngle:e.startAngle,endAngle:e.endAngle,opacity:1}};function Cv(e){var t=e.animate,n=e.path,r=e.getColor,i=e.onClickDatum,o=e.onMouseOver,a=e.onMouseOut,l=e.showLabel,s=e.valueKey,u=e.formatValue;return E.useTransition(e.arcs,{from:t?yv:wv,enter:wv,update:wv,leave:t?yv:wv,keys:e.getKey})((function(e,t,d){var p=d.key,f=n.centroid(t),m=f[0],h=f[1],v=t.endAngle-t.startAngle>=.1,g=JSON.parse(p);return c.jsxs("g",{children:[c.jsx(E.animated.path,{d:E.interpolate([e.startAngle,e.endAngle],(function(e,r){return n(U({},t,{startAngle:e,endAngle:r}))})),fill:r(t),onClick:function(){return i(g)},onTouchStart:function(){return i(g)},onMouseOver:function(){return o({arc:t,coords:{x:m,y:h}})},onMouseOut:function(){return a()}}),l&&v&&c.jsx(E.animated.g,{style:{opacity:e.opacity},children:c.jsx("text",{fill:"white",x:m,y:h,dy:".33em",fontSize:9,textAnchor:"middle",pointerEvents:"none",children:u(g[s])})})]},p)}))}var jv=t.forwardRef((function(e,t){return zh(t)?null:c.jsx(I.ParentSize,{children:function(t){return c.jsx(Fv,U({width:null==t?void 0:t.width,height:null==t?void 0:t.height},e))}})})),Fv=function(e){var n,r=e.width,i=e.labelKey,o=e.valueKey,a=e.formatValue,l=e.formatLabel,s=Ym(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),u=O.useTooltip({tooltipOpen:!1,tooltipLeft:r/2,tooltipTop:s,tooltipData:"Move me with your mouse or finger"}),d=u.showTooltip,p=u.hideTooltip,f=u.tooltipOpen,m=u.tooltipData,h=u.tooltipLeft,v=void 0===h?0:h,g=u.tooltipTop,b=void 0===g?0:g,x=O.useTooltipInPortal({scroll:!0,detectBounds:!0}),y=x.containerRef,w=x.containerBounds,C=x.TooltipInPortal,j=Sv(null==e?void 0:e.data,i,l),F=S.scaleOrdinal({domain:j,range:null==e?void 0:e.colors}),k=r-25-25,T=s-25-25,A=Math.min(k,T)/2,D=T/2,I=k/2,E=s/5.5,L=t.useCallback((function(e){var t,n,i=(null==e||null==(t=e.coords)?void 0:t.x)-w.left+r/2,o=(null==e||null==(n=e.coords)?void 0:n.y)-w.top+s/2;d({tooltipLeft:i,tooltipTop:o,tooltipData:JSON.stringify(e.arc.data)})}),[d,s,r]);if(r<10)return null;var M=function(){if(m){var e=JSON.parse(m);return{label:l?l(e[i]):e[i],value:a(e[o])}}return{label:"",value:""}};return c.jsxs("div",{ref:y,style:{position:"relative",height:s,width:r},children:[c.jsx("style",{children:""+Wm}),c.jsx("svg",{width:r,height:s,children:c.jsxs(P.Group,{top:D+25,left:I+25,children:[c.jsx(_,{data:null==e?void 0:e.data,pieValue:function(e){return e[o]},outerRadius:A,innerRadius:A-E,cornerRadius:5,padAngle:.005,pieSort:null,pieSortValues:null,children:function(t){return c.jsx(Cv,U({},t,{animate:!0,getKey:function(e){return JSON.stringify(e.data)},onClickDatum:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},getColor:function(t){return e.formatColor&&e.formatColor(t.data,o)||F(t.data[i])},onMouseOver:L,onMouseOut:function(){return p()},showLabel:null==e?void 0:e.showLabel,valueKey:o,formatValue:function(e){return a(e)}}))}}),f&&c.jsx(C,{top:b,left:v,children:c.jsx(Ch,{sections:1,children:c.jsx(jh,{label:M().label,value:M().value.toString()})})},Math.random())]})}),(null==e?void 0:e.legend)&&c.jsx(ah,{colors:null==e?void 0:e.colors,keys:j,typeIndex:kv(null==e?void 0:e.data),alignCenter:!0,replaceDimensionColorsIfPossible:!0,conditionalFormattingPossibilities:function(t){return e.conditionalFormattingPossibilities?e.conditionalFormattingPossibilities(o):[]}})]})},Sv=function(e,t,n){return e.map((function(e){return n?n(e[t]):e[t]}))},kv=function(e){return e.map((function(e,t){return{index:t,type:"pie"}}))},Tv={Afghanistan:"AFG",Angola:"AGO",Albania:"ALB","United Arab Emirates":"ARE",Argentina:"ARG",Armenia:"ARM",Antarctica:"ATA","French Southern and Antarctic Lands":"ATF",Australia:"AUS",Austria:"AUT",Azerbaijan:"AZE",Burundi:"BDI",Belgium:"BEL",Benin:"BEN","Burkina Faso":"BFA",Bangladesh:"BGD",Bulgaria:"BGR","The Bahamas":"BHS","Bosnia and Herzegovina":"BIH",Belarus:"BLR",Belize:"BLZ",Bermuda:"BMU",Bolivia:"BOL",Brazil:"BRA",Brunei:"BRN",Bhutan:"BTN",Botswana:"BWA","Central African Republic":"CAF",Canada:"CAN",Switzerland:"CHE",Chile:"CHL",China:"CHN","Ivory Coast":"CIV",Cameroon:"CMR","Democratic Republic of the Congo":"COD","Republic of the Congo":"COG",Colombia:"COL","Costa Rica":"CRI",Kosovo:"CS-KM",Cuba:"CUB",Cyprus:"CYP","Czech Republic":"CZE",Germany:"DEU",Djibouti:"DJI",Denmark:"DNK","Dominican Republic":"DOM",Algeria:"DZA",Ecuador:"ECU",Egypt:"EGY",Eritrea:"ERI","Western Sahara":"ESH",Spain:"ESP",Estonia:"EST",Ethiopia:"ETH",Finland:"FIN",Fiji:"FJI","Falkland Islands":"FLK",France:"FRA",Gabon:"GAB","United Kingdom":"GBR",Georgia:"GEO",Ghana:"GHA",Guinea:"GIN",Gambia:"GMB","Guinea Bissau":"GNB","Equatorial Guinea":"GNQ",Greece:"GRC",Greenland:"GRL",Guatemala:"GTM","French Guiana":"GUF",Guyana:"GUY",Honduras:"HND",Croatia:"HRV",Haiti:"HTI",Hungary:"HUN",Indonesia:"IDN",India:"IND",Ireland:"IRL",Iran:"IRN",Iraq:"IRQ",Iceland:"ISL",Israel:"ISR",Italy:"ITA",Jamaica:"JAM",Jordan:"JOR",Japan:"JPN",Kazakhstan:"KAZ",Kenya:"KEN",Kyrgyzstan:"KGZ",Cambodia:"KHM","South Korea":"KOR",Kuwait:"KWT",Laos:"LAO",Lebanon:"LBN",Liberia:"LBR",Libya:"LBY","Sri Lanka":"LKA",Lesotho:"LSO",Lithuania:"LTU",Luxembourg:"LUX",Latvia:"LVA",Morocco:"MAR",Moldova:"MDA",Madagascar:"MDG",Mexico:"MEX",Macedonia:"MKD",Mali:"MLI",Malta:"MLT",Myanmar:"MMR",Montenegro:"MNE",Mongolia:"MNG",Mozambique:"MOZ",Mauritania:"MRT",Malawi:"MWI",Malaysia:"MYS",Namibia:"NAM","New Caledonia":"NCL",Niger:"NER",Nigeria:"NGA",Nicaragua:"NIC",Netherlands:"NLD",Norway:"NOR",Nepal:"NPL","New Zealand":"NZL",Oman:"OMN",Pakistan:"PAK",Panama:"PAN",Peru:"PER",Philippines:"PHL","Papua New Guinea":"PNG",Poland:"POL","Puerto Rico":"PRI","North Korea":"PRK",Portugal:"PRT",Paraguay:"PRY","West Bank":"PSE",Qatar:"QAT",Romania:"ROU",Russia:"RUS",Rwanda:"RWA","Saudi Arabia":"SAU",Sudan:"SDN",Senegal:"SEN","Solomon Islands":"SLB","Sierra Leone":"SLE","El Salvador":"SLV",Somalia:"SOM","Republic of Serbia":"SRB","South Sudan":"SSD",Suriname:"SUR",Slovakia:"SVK",Slovenia:"SVN",Sweden:"SWE",Swaziland:"SWZ",Syria:"SYR",Chad:"TCD",Togo:"TGO",Thailand:"THA",Tajikistan:"TJK",Turkmenistan:"TKM","East Timor":"TLS","Trinidad and Tobago":"TTO",Tunisia:"TUN",Turkey:"TUR",Taiwan:"TWN","United Republic of Tanzania":"TZA",Uganda:"UGA",Ukraine:"UKR",Uruguay:"URY","United States of America":"USA",Uzbekistan:"UZB",Venezuela:"VEN",Vietnam:"VNM",Vanuatu:"VUT",Yemen:"YEM","South Africa":"ZAF",Zambia:"ZMB",Zimbabwe:"ZWE"},Av={worldCountries:{id:"worldCountries",fetchTopoJSON:function(){var e=Y(H().mark((function e(){var t;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u("https://static.app.vizzly.co/topojson/world-countries.json",{mode:"cors"});case 2:if(!(t=e.sent).ok){e.next=8;break}return e.next=6,t.json();case 6:return e.abrupt("return",e.sent);case 8:return e.abrupt("return",null);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),geographicAreaId:function(e){return"id"in e&&"string"==typeof e.id?e.id:""},geographicAreaPublicName:function(e){return i.get(e,"properties.name","Name not found.")},allGeographicAreas:function(e){var t,n,r=this,o=(null==e||null==(t=e.objects)||null==(n=t.countries1)?void 0:n.geometries)||[];return i.reduce(o,(function(e,t){return e[r.geographicAreaId(t)]={publicName:r.geographicAreaPublicName(t)},e}),{})},resolveUserDataToVizzlyAreaCode:function(e){var t={};return Object.keys(e).forEach((function(n){t[Tv[n]||n]=e[n]})),t}}},Dv=function(e){var n,r,o=e.width,a=e.height,l=e.data,s=e.background,u=e.colorRange,d=e.gridColor,p=e.missingDataColor,f=e.formatValue,m=e.onPositionChange,h=e.position||{centerX:o/2,centerY:a/2,scale:o/630*100},v=h.centerX,g=h.centerY,b=h.scale,x=function(e){var n=t.useState(null),r=n[0],i=n[1],o=Av[e];return t.useEffect((function(){!function(){var e=Y(H().mark((function e(){var t;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.fetchTopoJSON();case 2:(t=e.sent)&&i(t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[e]),{topologyJSON:r,topology:o}}(e.topology),y=x.topology,w=x.topologyJSON,C=function(e,t){var n=O.useTooltip({tooltipOpen:!1,tooltipLeft:e/2,tooltipTop:t,tooltipData:void 0}),r=n.showTooltip,i=n.hideTooltip,o=n.tooltipOpen,a=n.tooltipData,l=n.tooltipLeft,s=void 0===l?0:l,u=n.tooltipTop,d=void 0===u?0:u,c=O.useTooltipInPortal({scroll:!0,detectBounds:!0});return{showTooltip:r,hideTooltip:i,tooltipOpen:o,tooltipData:a,tooltipLeft:s,tooltipTop:d,containerRef:c.containerRef,containerBounds:c.containerBounds,TooltipInPortal:c.TooltipInPortal}}(o,a),j=C.showTooltip,F=C.containerRef,k=C.tooltipData,T=C.containerBounds,A=C.tooltipOpen,D=C.TooltipInPortal,I=C.tooltipTop,P=C.tooltipLeft,_=C.hideTooltip;if(!w)return null;var E=y.resolveUserDataToVizzlyAreaCode(l),R=M.feature(w,w.objects.countries1),z=Object.values(l),B=S.scaleQuantize({domain:[null!=(n=i.min(z))?n:0,null!=(r=i.max(z))?r:1],range:u});return o<10?null:c.jsxs("div",{ref:F,children:[c.jsx("style",{children:""+Wm}),c.jsx(N.Zoom,{width:o,height:a,initialTransformMatrix:{scaleX:b,scaleY:b,translateX:v,translateY:g,skewX:0,skewY:0},children:function(e){return c.jsxs("div",{onMouseLeave:function(){m&&m({scale:e.transformMatrix.scaleX,centerX:e.transformMatrix.translateX,centerY:e.transformMatrix.translateY})},children:[c.jsxs("svg",{"data-component":"mercator-map",width:o,height:a,onDoubleClick:function(){e.scale({scaleX:1.3,scaleY:1.3})},onTouchStart:e.dragStart,onMouseDown:e.dragStart,onTouchMove:e.dragMove,onTouchEnd:e.dragEnd,onMouseMove:e.dragMove,onMouseUp:e.dragEnd,onMouseLeave:function(){_(),e.isDragging&&e.dragEnd()},children:[c.jsx("rect",{x:0,y:0,width:o,height:a,fill:s,rx:14}),c.jsx(L.Mercator,{data:R.features,scale:e.transformMatrix.scaleX,translate:[e.transformMatrix.translateX,e.transformMatrix.translateY],children:function(e){return c.jsxs("g",{children:[c.jsx(L.Graticule,{graticule:function(t){return e.path(t)||""},stroke:null!=d?d:"none"}),e.features.map((function(e,t){var n,r=e.feature;return c.jsx("path",{"data-testid":"map-feature-"+r.id,d:e.path||"",fill:(n=y.geographicAreaId(r),E[n]?B(E[n]):p),stroke:s,strokeWidth:.5,onMouseEnter:function(e){r.id!=(null==k?void 0:k.areaId)&&j({tooltipLeft:e.clientX-T.left,tooltipTop:e.clientY-T.top,tooltipData:{areaId:r.id,publicName:y.geographicAreaPublicName(r),value:E[r.id]}})}},"map-feature-"+t)}))]})}}),A&&c.jsx(D,{top:I,left:P,children:c.jsx(Ch,{sections:1,children:c.jsx(jh,{label:null==k?void 0:k.publicName,value:null!=k&&k.value?""+f(k.value):"No data"})})},Math.random())]}),c.jsxs("div",{style:{position:"absolute",bottom:20,right:30,display:"flex",flexDirection:"column"},children:[c.jsx("button",{style:{background:"#fff",borderRadius:"5px",opacity:.6,padding:"1px 6px",marginBottom:5,border:0},onClick:function(){e.scale({scaleX:1.4,scaleY:1.4})},"aria-label":"zoom in",children:"+"}),c.jsx("button",{style:{background:"#fff",borderRadius:"5px",opacity:.6,padding:"1px 6px",border:0},onClick:function(){return e.scale({scaleX:.8,scaleY:.8})},"aria-label":"zoom out",children:"-"})]})]})}})]})},Iv=t.forwardRef((function(e,t){return zh(t)?null:c.jsx(R,{children:function(t){return c.jsx(Dv,U({},e,{width:t.width,height:t.height}))}})})),Pv=function(e){var n,r,o,a=e.displayTitle,l=e.displaySubject,s=us(),u=Vh({title:a,subject:l}),d={displayTitle:a,displaySubject:l,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension},p={dataSetId:e.dataSetId,measure:e.measure,dimension:e.dimension,timeDimension:null,order:e.order,filter:e.filter},f=e.measure.length>0&&e.dimension.length>0;if(Ho(e.result))return c.jsx(fc,{});if(!f)return c.jsx(sf,{title:"Missing parameters",children:cv(p)});if(Wo(e.result))return c.jsx(uf,{});if(Yo(e.result))return c.jsx(cf,U({},d));var m=qh({dimension:e.dimension}),h=function(e,t,n,r){void 0===r&&(r=!1);var o=bv(e),a=[].concat(o).map((function(e){var r=function(e,t){var n=i.reject([].concat(e.x),(function(e){var n;return e==(null==(n=t.timeDimension)?void 0:n.field)}));return t.timeDimension?[t.timeDimension.field]:n}(t,n),o=r.map((function(t){return Ze(e[t])})),a={},l=t.y.includes("measures")?[].concat(t.y).slice(0,t.y.length-1):[].concat(t.y),s=[].concat(l).map((function(t){return e[t]}));n.measure.forEach((function(t){var n=lt(t),r=Oo(l,s,t.field,t.function);a[r]=e[n]}));var u={};return r.forEach((function(t){u[t]=e[t]})),U({},u,{x:o.join(", ")},a,{xValues:o})})),l=[],s={};a.forEach((function(e){var t=s[e.x];s[e.x]||l.push(e.x),s[e.x]=i.merge({},t,e)}));var u=l.map((function(e){return s[e]}));return r?function(e){var t=["x","xValues"];return e.map((function(e){var n=U({},e),r=i.sumBy(Object.entries(n),(function(e){var n=e[1];return t.includes(e[0])?0:i.isNumber(n)?n:0}));return n=i.mapValues(n,(function(e,o){return t.includes(o)?e:i.isNumber(e)?Io(n[o],r):e}))}))}(u):u}(e.result,m,p),v=function(e,t,n){var r=bv(t),i={};return r.forEach((function(t){var r=[].concat(n.y).map((function(e){return t[e]}));e.measure.forEach((function(e){var t=lt(e),o=Oo(n.y,r,e.field,e.function);i[o]={key:o,yValues:[].concat(r,[t]),name:[].concat(r,[t]).join(", ")}}))})),Object.values(i)}(p,e.result,m).map((function(t){return{data:h.map((function(n){var r;return(r={})[e.dimension[0].field]=n.x,r[t.key]=Number(n[t.key]),r})),valueKey:t.key,labelKey:e.dimension[0].field}}));return c.jsx(t.Suspense,{fallback:c.jsx(fc,{}),children:c.jsxs(kp,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Bm,U({},d)),c.jsx(za,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:c.jsx(jv,{ref:u,data:v[0].data,labelKey:v[0].labelKey,valueKey:v[0].valueKey,colors:er(null!=(o=null==s?void 0:s.colors)?o:ga.colors,h.length),conditionalFormattingPossibilities:function(t){return ta(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},formatColor:function(t,n){var r=na(e.dimension,e.conditionalFormattingRules,t,n,null==e?void 0:e.dataSet);if(r)return r.ruleValue},showLabel:"verbose"===(null==s?void 0:s.detail),legend:Hh(null==e?void 0:e.legend,"verbose"===(null==s?void 0:s.detail)),formatValue:function(t){return aa(Po(t,2),null==e?void 0:e.numberFormatOptions,null==e?void 0:e.labelFormat)}})})]})})};Pv.defaultProps={type:"pieChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!1,labelFormat:null};var _v=t.memo(Pv,$o),Ev=function(e){var t,n,r=e.component,i=r.results,o=r.attributes,a=Kh(o,e.runQueriesCallback,e.setResults,{localFilters:r.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(_v,U({id:e.id},o,{dataSet:e.dataSet,localFilters:e.component.localFilters,setParameterUpdate:e.setParameterUpdate,setLocalFilters:e.setLocalFilters,result:i[0],queriesAreChanging:a.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(n=t.queryEngineConfig)?void 0:n.supportedTransformationFunctions,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions}))},Ov=Object.assign((function(){}),{wrapper:function(e){var t,n,r;return e=Lv(e),ua({position:"relative",border:null==(t=e)?void 0:t.border,background:null==(n=e)?void 0:n.background,borderRadius:null==(r=e)?void 0:r.borderRadius})},input:function(e){var t,n,r,i;return e=Lv(e),ua(U({color:"inherit",width:"100%",border:0,height:null==(t=e)?void 0:t.height,background:"transparent",padding:e.padding,fontSize:e.fontSize,borderRadius:e.borderRadius,fontWeight:e.fontWeight,boxSizing:"border-box"},sa,{"&:hover":U({},sa,{outline:0,boxShadow:null==(n=e["&:hover"])?void 0:n.boxShadow,background:null==(r=e["&:hover"])?void 0:r.background}),"&:focus":U({},sa,{outline:0,boxShadow:null==(i=e["&:focus"])?void 0:i.boxShadow})}))},icon:function(e){var t,n,r;return e=Lv(e),ua({color:null==(t=e)||null==(n=t.icons)?void 0:n.color,height:18,width:18,"> * svg":{fill:null==(r=e.icons)?void 0:r.color}})},iconWrapper:ua({top:8,right:12,position:"absolute",display:"flex",gap:"0.5rem"})});function Lv(e){return o.merge({},ga.search,e)}var Mv=t.forwardRef((function(e,n){var r=e.placeholder,i=e.onChange,o=e.initialValue,a=e.inputRef,l=t.useState(null!=o?o:""),s=l[0],u=l[1],d=function(e,n){var r=t.useState(e),i=r[0],o=r[1];return t.useEffect((function(){var t=setTimeout((function(){o(e)}),500);return function(){return clearTimeout(t)}}),[e,500]),i}(s);t.useEffect((function(){i(d)}),[i,d]);var p=function(){return u("")},f=us();return c.jsx("form",{autoComplete:"off",children:c.jsxs("div",{role:"search",className:""+Ov.wrapper(null==f?void 0:f.search),"data-themeapi":"search","data-chipposition":"top.left",children:[c.jsx(Tm,{as:"label",htmlFor:"library-search",children:"Search"}),c.jsx("input",{value:s,onChange:function(e){return u(e.target.value)},id:"library-search",name:"library-search",className:""+Ov.input(null==f?void 0:f.search),placeholder:r,ref:a}),c.jsxs("span",{className:""+Ov.iconWrapper,children:[s&&c.jsx(vc,{onClear:function(){return p&&p()},className:""+Ov.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"}),c.jsx(g.SearchIcon,{className:""+Ov.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"})]})]})})})),Rv=function(e){var t,n=null!=(t=null==e?void 0:e.percentage)?t:50;return c.jsx("div",{style:{height:e.height*(n/100)+"px"},children:c.jsx("div",{style:{width:e.width+"px",height:e.height+"px"},css:[50==n&&{"--tw-translate-y":"-25%",transform:"translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))","--tw-translate-x":"-25%","--tw-scale-x":".5","--tw-scale-y":".5"},""],children:e.children})})},Nv=function(e,t,n){var r=i.merge({},ga.panels,e);return ua(U({transform:t?"translate3d(0, 0, 0)":void 0,position:"relative",height:"100%",width:null!=n?n:"100%"},r))},zv=n.forwardRef((function(e,t){var n,r,i=e.transform,o=void 0===i||i,a=us();return c.jsx("div",{role:null==e?void 0:e.role,"data-testid":null==e?void 0:e.testId,className:rs(null==e?void 0:e.vizzlyPrefix,""+Nv(U({},null==a?void 0:a.panels,{padding:null!=(n=null==e?void 0:e.padding)?n:null==a||null==(r=a.panels)?void 0:r.padding}),o,null==e?void 0:e.width)),ref:t,"data-themeapi":"panels","data-chipposition":"top.left",onMouseOver:function(){return(null==e?void 0:e.onHover)&&(null==e?void 0:e.onHover(!0))},onMouseLeave:function(){return(null==e?void 0:e.onHover)&&(null==e?void 0:e.onHover(!1))},children:null==e?void 0:e.children})})),Bv=function(e,t,n){try{if(!Mn(t,e.attributes.dataSetId))throw new Yt(t,e.attributes.dataSetId);var r=On(e.attributes.type,{queryEngineConfig:n.queryEngineConfig}).validate(e.attributes,t);return r.length>0&&Br(r),r[0]}catch(e){if(e instanceof qt)return e;if(e instanceof Yt)return e;if(e instanceof Wt)return e;throw e}},qv=Object.assign((function(){return null}),{label:function(e){var t,n=o.merge({},null==(t=ga.radioGroup)?void 0:t.label,e);return ua({color:null==n?void 0:n.color,fontSize:null==n?void 0:n.fontSize,fontWeight:null==n?void 0:n.fontWeight,margin:0,padding:0})},description:function(e){var t,n=o.merge({},null==(t=ga.radioGroup)?void 0:t.description,e);return ua({color:null==n?void 0:n.color,fontSize:null==n?void 0:n.fontSize,fontWeight:null==n?void 0:n.fontWeight})},input:ua({height:19.5,margin:0,padding:0}),fieldset:function(e){return void 0===e&&(e=!1),ua({border:"none",margin:0,padding:0,width:"auto",opacity:e?.6:1,cursor:e?"not-allowed":"pointer"})}});function Vv(e){var t=e.options,n=e.name,r=e.onChange,i=e.selected,o=e.label,a=e.labelHidden,l=e.locked,s=e.direction,u=e.maxWidth;return c.jsxs("fieldset",{className:""+qv.fieldset(l),children:[!a&&c.jsx(kc,{as:"legend",children:o}),c.jsx(Wd,{direction:s||"column",gap:"0.5rem","data-component":"radio-group",maxWidth:u||"100%",children:t.map((function(e,t){return c.jsx(Hv,{option:e,name:n,onChange:function(e){return r&&!l&&r(e.target.value)},selected:i},t)}))})]})}function Hv(e){return c.jsx(Wv,U({},e,{type:"radio"}))}function Wv(e){var t,n,r=e.name,i=e.option,o=e.selected,a=e.onChange,l=e.type,s=us();return c.jsxs(Wd,{as:"label",gap:"0.5rem",alignItems:"self-start","data-component":"input",cursor:"inherit",className:""+Uv,children:[c.jsx("input",{type:l,name:r,value:i.value,checked:JSON.stringify(o)===JSON.stringify(i.value),onChange:a,className:rs("checkbox"===l?rp()+" "+Yv:""+qv.input)}),c.jsxs(Wd,{direction:"column","data-component":"label",children:[c.jsx("p",{className:""+qv.label(null==s||null==(t=s.radioGroup)?void 0:t.label),"data-themeapi":"radioGroup.label",children:i.label}),(null==i?void 0:i.description)&&c.jsx("span",{className:""+qv.description(null==s||null==(n=s.radioGroup)?void 0:n.label),children:null==i?void 0:i.description})]})]})}var Yv=ua({marginRight:0,marginTop:1}),Uv=ua({userSelect:"none"}),Gv=function(e){var n=zl().maxCSVDownloadLimit,r=t.useState("data-set-download-type"),i=r[0],o=r[1],a=n&&"number"==typeof n?" Up to "+n.toLocaleString()+" rows.":"";return c.jsxs(Df,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(Df.Header,{title:"Data download",show:!0}),c.jsx(Df.Content,{children:c.jsx(Vv,{options:[{label:"Full data set",value:"data-set-download-type",description:"Download the underlying data that this view has used."+a},{label:"View data set",value:"view-download-type",description:"Download the data that you see in this view."}],name:"download-type",label:"Select Download Type",selected:i,labelHidden:!0,onChange:function(e){return o(e)}})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Dp,{onClick:function(){return null==e?void 0:e.onClose(!1)},children:"Cancel"}),c.jsx(Dp,{primary:!0,onClick:function(){e.onDownload(i),null==e||e.onClose(!0)},children:"Download"})]})})]})},Kv=Vl((function(e){var t=e.onClose,n={editComponentsOnDashboard:"Edit",editComponentsOnLibrary:"Edit",downloadComponentData:"Download",increaseColSpan:"Merge",decreaseColSpan:"Unmerge",removeComponentFromLibrary:"Remove",removeComponentFromDashboard:"Remove",removeCellFromDashboard:"Remove",manageReport:"Reports",parameters:"Add Parameters",localFilter:"Add Local Filters",clickSettings:"Click Settings"};return c.jsx(Nd.Options,{children:c.jsx("div",{children:e.cellOptions.map((function(e,r){return c.jsxs(Nd.Option,{"data-testid":e.testId,onChange:function(){e.onClick(),t()},children:[e.renderIcon&&e.renderIcon(),c.jsx("span",{children:n[e.purpose]||""})]},"option_"+r+"_"+e.purpose+e.testId)}))})})}),"renderComponentOptions"),Xv={name:"1v3ivpe",styles:"position:absolute;right:-1.25rem;top:0px"},Qv=function(e){var t=Bd(),n=t.ref,r=t.open,i=t.position,o=t.show,a=t.close,l=us();return c.jsxs("div",{css:Xv,ref:n,children:[c.jsx("button",{"data-testid":"open-component-options","aria-label":null!=e&&e.chartLabel?"Options: "+(null==e?void 0:e.chartLabel):"Options",onClick:function(){r()},className:cp(null==l?void 0:l.dashboard)+" "+Ea.button,"data-themeapi":"dashboard.icon",children:c.jsx(es,{})}),o&&c.jsx(Nd,{onClose:function(){return a()},position:i,children:c.jsx(Kv,{onClose:function(){return r()},cellOptions:e.cellOptions})})]})},Jv=function(e){var n,r=t.useState(!1),o=r[0],a=r[1],l=zc().dashboard,s=(null==e?void 0:e.component.attributes).type,u=zl(),d=On(e.component.attributes.type),p=Bv(e.component,l.dataSets,u),f=[];return!e.canEditComponentsOnDashboard||p instanceof qt||f.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return c.jsx(Jl,{})},onClick:function(){return e.onEdit()},testId:"edit"}),e.canSetupReportSchedule&&"basicTable"==s&&f.push({purpose:"manageReport",renderIcon:function(){return c.jsx(Yl,{})},onClick:function(){return e.onManageReport()},testId:"manage-report"}),"admin"!==u.mode||"basicTable"!=s&&"dataTable"!=s&&"barChart"!=s&&"horizontalBarChart"!=s||f.push({purpose:"clickSettings",renderIcon:function(){return c.jsx(Wd,{width:20,justifyContent:"center",as:"span",children:c.jsx(g.CogIcon,{})})},onClick:function(){return e.onClickSettings()},testId:"click-settings"}),e.canDownloadComponentData&&"custom"!=s&&f.push({purpose:"downloadComponentData",renderIcon:function(){return c.jsx($l,{})},onClick:function(){return a(!0)},testId:"download"}),u.featureToggles.canConfigureLocalFilters&&f.push({purpose:"localFilter",renderIcon:function(){return c.jsx(Wd,{width:20,justifyContent:"center",as:"span",children:c.jsx(Wl,{active:!1})})},onClick:function(){return e.onAddFilter()},testId:"filterBy"}),u.featureToggles.parameters&&null!=(n=d.supportedFeatures)&&n.parameters&&"read_write"===u.scope&&f.push({purpose:"parameters",renderIcon:function(){return c.jsx(Wd,{width:20,justifyContent:"center",as:"span",children:c.jsx(Ul,{})})},onClick:function(){return e.onSetParameters()},testId:"parameters"}),e.canRemoveComponentsFromDashboard&&f.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return c.jsx(Ql,{purpose:"removeComponentFromDashboard"})},onClick:function(){return e.onRemove()},testId:"remove"}),i.isEmpty(f)?null:c.jsxs(c.Fragment,{children:[c.jsx(Qv,{cellOptions:f,chartLabel:null==e?void 0:e.chartLabel}),c.jsx(Gv,{onDownload:e.onDownload,show:o,onClose:function(){return a(!1)}})]})},Zv=function(e){var t=[];return zl().featureToggles.canRemoveComponentsFromDashboard&&(t=[].concat(t,[{purpose:"removeCellFromDashboard",renderIcon:function(){return c.jsx(Ql,{purpose:"removeCellFromDashboard"})},onClick:function(){return e.onRemoveCell()},testId:"deleteCell"}])),i.isEmpty(t)?null:c.jsx(Qv,{chartLabel:e.chartLabel,cellOptions:t})},$v={group:void 0,measure:void 0},eg=function(e,t){if(!e.group&&!e.measure&&!t)return!0},tg=function(e,t,n){var r,i=null==(r=n[e])?void 0:r[0];if(!i)return t;var o=t.findIndex((function(e){return e.field===i.field}));return-1!==o&&(t[o]={field:e,function:"none"}),t},ng=function(e){var t=og(e);return ua({padding:null==t?void 0:t.padding,display:"flex",alignItems:"center",borderRadius:null==t?void 0:t.borderRadius,gap:6,variants:{alertType:{warning:null==t?void 0:t.warning,info:null==t?void 0:t.info,critical:null==t?void 0:t.critical}}})},rg=ua({display:"block",alignSelf:"flex-start"}),ig=Object.assign(ng,{svg:function(e){var t,n,r,i=og(e);return ua({display:"block",width:"100%",position:"relative",variants:{alertType:{warning:{fill:null==i||null==(t=i.warning)?void 0:t.iconColor,transform:"rotate(180deg)"},info:{fill:null==i||null==(n=i.info)?void 0:n.iconColor,transform:"rotate(180deg)"},critical:{fill:null==i||null==(r=i.critical)?void 0:r.iconColor}}}})},icon:ua({paddingTop:3,display:"block",height:"1rem",width:"1rem"}),content:function(e){var t,n,r=og(e);return ua({display:"flex",flexDirection:"column",gap:6,fontSize:null==r||null==(t=r.content)?void 0:t.fontSize,fontWeight:null==r||null==(n=r.content)?void 0:n.fontWeight})},title:function(e){var t,n,r=og(e);return ua({fontWeight:null==r||null==(t=r.title)?void 0:t.fontWeight,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:null==r||null==(n=r.title)?void 0:n.fontSize,WebkitFontSmoothing:"antialiased"})},iconWrapper:rg}),og=function(e){return i.merge({},null==ga?void 0:ga.alerts,e)},ag=function(e){var n,r,i=us();return c.jsxs("div",{role:"alert",className:""+ig(null==i?void 0:i.alerts)({alertType:null!=(n=null==e?void 0:e.type)?n:"info"}),"data-themeapi":"alerts",children:[c.jsxs("span",{className:""+ig.iconWrapper,children:[void 0!==(null==e?void 0:e.icon)&&c.jsx(t.Fragment,{children:null==e?void 0:e.icon}),void 0===(null==e?void 0:e.icon)&&c.jsx("span",{className:""+ig.icon,children:c.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+ig.svg(null==i?void 0:i.alerts)({alertType:"critical"}),focusable:"false","aria-hidden":"true",children:c.jsx("path",{d:"M11.768.768a2.5 2.5 0 0 0-3.536 0l-7.464 7.464a2.5 2.5 0 0 0 0 3.536l7.464 7.464a2.5 2.5 0 0 0 3.536 0l7.464-7.464a2.5 2.5 0 0 0 0-3.536l-7.464-7.464zm-2.768 5.232a1 1 0 1 1 2 0v4a1 1 0 1 1-2 0v-4zm2 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})}:{viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",className:""+ig.svg(null==i?void 0:i.alerts)({alertType:null!=(r=null==e?void 0:e.type)?r:"info"}),children:c.jsx("path",{fillRule:"evenodd",d:"M10 20c5.514 0 10-4.486 10-10s-4.486-10-10-10-10 4.486-10 10 4.486 10 10 10zm1-6a1 1 0 1 1-2 0v-4a1 1 0 1 1 2 0v4zm-1-9a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"})})})]}),c.jsxs("div",{className:""+ig.content(null==i?void 0:i.alerts),children:[(null==e?void 0:e.title)&&c.jsx("div",{className:""+ig.title(null==i?void 0:i.alerts),children:null==e?void 0:e.title}),(null==e?void 0:e.children)&&c.jsx("div",{children:null==e?void 0:e.children})]})]})},lg=function(e){var t=e.dataSets,n=e.setDataSet,r=[].concat(t).map((function(e){return{value:e.id,label:e.name}}));return c.jsxs(c.Fragment,{children:[t.length>1&&c.jsx(Ac,{children:c.jsx(Tc,{label:"Dataset",labelHidden:!0,id:"select-data-set",testId:"select-data-set",anchorLeft:!0,placeholder:"Data set",onChange:n,selected:e.dataSet.id,options:r})}),e.dataSet.preAggregated&&c.jsx(Md,{paddingX:0,paddingTop:16,children:c.jsx(ag,{icon:c.jsx(c.Fragment,{}),title:"Pre-aggregated data set",type:"info",children:"This data set has already been aggregated, therefore you will find some data properties have already been set."})})]})},sg=function(e,t,n,r){var i,o=[].concat(n);return o.splice(r,1),(i={})[e]=t(o),i},ug=function(e,t,n){var r=[].concat(e),i=e[t];return r[t]=e[n],r[n]=i,r},dg=function(e){var t=zl().organizationName;return c.jsxs(Df,{width:"sm","data-testid":"cannot-delete-modal",isOpen:!0,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(Df.Header,{title:"Field Protected",show:!0}),c.jsx(Df.Content,{children:c.jsxs("p",{children:["This field has been protected",t?" by "+t+" ":" ","and cannot be removed."]})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsx(Of,{children:c.jsx(Dp,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:"Close"})})})]})},cg=["barChart","dataTable","basicTable"],pg=function(e,t){if(!t)return!1;if(!(e&&"type"in e&&e.type&&cg.includes(e.type)))return!1;if(!("protectedFields"in e)||!e.protectedFields)return!1;var n,r=!1,i=!1;return"measure"in e.protectedFields&&"function"in t&&(r=((null==e||null==(n=e.protectedFields)?void 0:n.measure)||[]).some((function(e){return e.function==t.function&&e.field==t.field}))),"dimension"in e.protectedFields&&(i=(e.protectedFields.dimension||[]).some((function(e){return"function"in e&&"function"in t?e.field==t.field&&e.function==t.function:"truncate"in e&&"truncate"in t&&e.field==t.field&&e.truncate==t.truncate}))),r||i},fg=function(e){var n,r,o,a=t.useState(!1),l=a[0],s=a[1],u=e.propKey||"dimension",d=e.dataSet,p=e.attributes,f=e.attributes[u]||[],m=[].concat(f).map((function(e){var t=Rn(d,e.field);return{title:t.publicName,icon:t.dataType}})),h=[].concat(Ln(d.fields,null!=(n=e.filterFieldOptions)?n:{onlyFieldTypes:["boolean","number","string"],removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})),v=it(h,[].concat(f)),g=[].concat(v).map((function(e){return{title:e.publicName,icon:e.dataType,value:e.id}})),b=zl();return c.jsxs(t.Fragment,{children:[c.jsx(Sp,{mode:b.mode,testId:null!=(r=null==e?void 0:e.testId)?r:"add-dimension",onDeleteItem:e.dataSet.preAggregated?void 0:function(t){if(pg(p,f[t]))s(!0);else{var n,r=[].concat(f);r.splice(t,1),e.setPartialAttributes(((n={})[u]=r,n))}},onOrderChange:e.allowsMultiple?function(t,n){var r=ug([].concat(f),t,n);e.setPartialAttributes({dimension:r})}:void 0,newItem:{callToAction:null!=(o=null==e?void 0:e.label)?o:"Add comparison",onNew:function(t){var n,r=[].concat(f,[{field:t,function:"none"}]);e.setPartialAttributes(((n={})[u]=r,n))},initValues:g,hide:e.dataSet.preAggregated||i.isEmpty(v)||!e.allowsMultiple&&!i.isEmpty(e.attributes[u])},items:e.filterOptions?e.filterOptions(m):m}),l&&c.jsx(dg,{onClose:function(){return s(!1)}})]})},mg=function(e){var t,n,r,o=e.dataSet,a=e.setPartialAttributes,l=e.allow,s=i.isArray(n=(null==e?void 0:e.attributes).timeDimensions)?n:n?[n]:[],u=(r=[],[].concat(s).map((function(t){var n=Rn(o,t.field),i=null!=e&&e.onNewMeasureFilterTruncFunctions?e.onNewMeasureFilterTruncFunctions(n):e.supportedTimeDimensions,l="date_time"==n.dataType?function(e,t){var n=Object.keys(t);return[].concat(n).flatMap((function(n){return e.includes(n)?[{value:n,label:t[n].publicName}]:[]}))}(n.allowedGranularities,e.supportedTimeDimensions):void 0,u=l?{onChange:function(e,t){!function(e,t){var n=[].concat(s);n[t]=U({},n[t],{truncate:e}),a({timeDimensions:n})}(e,t)},options:hg(l,i),selected:t.truncate}:void 0;r.push({title:Rn(o,t.field).publicName,icon:"date_time",value:t.field,select:u})})),r),d=Ln(o.fields,{onlyFieldTypes:["date_time"]}).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}})),p=!!l&&s.length===l,f=zl();return c.jsx(Sp,{mode:f.mode,testId:"time-dimension",onOrderChange:l?void 0:function(e,t){var n=ug([].concat(s),e,t);a({timeDimensions:n})},onDeleteItem:function(e){var t=[].concat(s);t.splice(e,1),a({timeDimensions:t})},newItem:{callToAction:null!=(t=null==e?void 0:e.label)?t:"Add time dimension",onNew:function(t){null!=e&&e.onNewMeasureFilterTruncFunctions&&e.onNewMeasureFilterTruncFunctions(t);var n=[].concat(s,[{field:t.id,truncate:Object.keys(Oe)[0]}]);a({timeDimensions:n})},initValues:d,hide:p},items:e.filterOptions?e.filterOptions(u):u})};function hg(e,t){return e.filter((function(e){return t.hasOwnProperty(e.value)}))}var vg=function(e){var n,r,o,a,l=t.useState(!1),s=l[0],u=l[1],d=e.propKey||"measure",p=(o=!!e.allowsMultiple,function(e){var t;return o?e:null!=(t=e[0])?t:null}),f=e.attributes,m=e.setPartialAttributes,h=e.dataSet,v=e.supportedAggregates,g=f,b=i.isArray(a=g[d])?a:a?[a]:[],x=function(e,t,n,r){return[].concat(e).map((function(e){var r=Rn(t,e.field),i={onChange:function(e,t){!function(e,t){!function(e,t,n){var r,i,o=[].concat(b);o[n]=U({},o[n],((r={}).function=t,r)),m(((i={})[d]=p(o),i))}(0,e,t)}(e,t)},options:function(e,t){var n=et(e,t);return[].concat(n).map((function(e){return{value:e,label:t[e].publicName}}))}(r,n),selected:e.function};return{title:Rn(t,e.field).publicName,icon:Rn(t,e.field).dataType,value:e.field,select:xt(r)||jt(r)||"none"===e.function?void 0:i}}))}(b,h,v),y=[].concat(Ln(h.fields,e.fieldFilterOptions)).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}})),w=zl().mode,C=!1;return e.allowsMultiple||(C=!e.allowsMultiple&&!!g[d]),i.isArray(g[d])&&e.maxAllowed&&e.maxAllowed<=g[d].length&&(C=!0),e.dataSet.preAggregated&&(C=!0),c.jsxs(t.Fragment,{children:[c.jsx(Sp,{mode:w,onOrderChange:e.allowsMultiple?function(e,t){var n,r=ug([].concat(b),e,t);m(((n={})[d]=p(r),n))}:void 0,onDeleteItem:e.dataSet.preAggregated?void 0:function(e){pg(f,b[e])?u(!0):m(sg(d,p,b,e))},items:e.filterOptions?e.filterOptions(x):x,newItem:{callToAction:null!=(n=null==e?void 0:e.label)?n:"Add metric",onNew:function(t){var n,r=null!=e&&e.onNewMeasureFilterAggregate?e.onNewMeasureFilterAggregate(t):e.supportedAggregates,i=$e(t,r),o=[].concat(b,[{field:t.id,function:xt(t)?t.denominatorAggregate:i}]);m(((n={})[d]=p(o),n))},initValues:y,hide:C},id:null==e?void 0:e.id,testId:null!=(r=null==e?void 0:e.testId)?r:"metric-input"}),s&&c.jsx(dg,{onClose:function(){return u(!1)}})]})},gg=function(e){var n=e.attributes,r=e.setPartialAttributes,i=e.dataSet,o=t.useState(!1),a=o[0],l=o[1],s=zl(),u=n.measure,d=[].concat(u).map((function(e){var t=Rn(i,e.field);return{title:t.publicName,icon:t.dataType}})),p=[].concat(Ln(i.fields,{removeSimplePercentage:!0,removeAggregateMaths:!0,removeConditionalPercentage:!0})).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}}));return c.jsxs(t.Fragment,{children:[c.jsx(Sp,{mode:s.mode,onOrderChange:function(e,t){var n=ug([].concat(u),e,t);r({measure:n})},onDeleteItem:function(e){pg(n,n.measure[e])?l(!0):r(sg("measure",(function(e){return e}),u,e))},items:d,newItem:{callToAction:"Add field",onNew:function(e){var t=[].concat(u,[{field:e.id,function:"none"}]);r({measure:t})},initValues:p}}),a&&c.jsx(dg,{onClose:function(){return l(!1)}})]})},bg=function(e,t){return t?e+" ("+t+")":e},xg=function(e){var t=e.attributes,n=e.setPartialAttributes,r=e.dataSet,i=[].concat(t.order).map((function(e){var t={onChange:function(e,t){o(e,t)},options:[{label:"Asc",value:"asc"},{label:"Desc",value:"desc"}],selected:e.direction},n=Rn(r,e.field);return{title:bg(n.publicName,e.function&&"none"!=e.function&&Ne(e.function)),icon:n.dataType,select:t}})),o=function(e,r){var i=[].concat(t.order);i[r].direction=e,n({order:i})},a=zl().mode,l=function(e,t,n,r,i){var o=[];if(o=o.concat([].concat(r||[]).flatMap((function(t){var n=Rn(e,t.field);return at(n)?[]:[{title:n.publicName,icon:n.dataType,value:n,onSelected:function(e){i(e.id,t.function)}}]}))),t){var a=Rn(e,t.field);o.push({title:a.publicName,icon:a.dataType,value:a,onSelected:function(e){i(e.id,t.truncate)}})}return o.concat([].concat(n||[]).flatMap((function(t){var n=Rn(e,t.field);return at(n)?[]:[{title:bg(n.publicName,ut(t)&&Ne(t.function)),icon:n.dataType,value:t,onSelected:function(e){return i(e.field,e.function)}}]})))}(e.dataSet,e.timeDimension||null,e.measure,e.dimension,(function(e,r){var i=[].concat(t.order,[{field:e,direction:"asc",function:r}]);n({order:i})}));return c.jsx(Sp,{mode:a,onOrderChange:function(e,r){var i=ug([].concat(t.order),e,r);n({order:i})},onDeleteItem:function(e){var r=[].concat(t.order);r.splice(e,1),n({order:r})},items:i,newItem:{callToAction:"Add sort",initValues:l},testId:"sort-input"})},yg=function(e){return!!e.field&&!!e.op&&![void 0,NaN,""].includes(e.value)},wg=function(e){if(!e.field)return null;var t=function(e,t){var n={};return[].concat(e.allowedOperators).forEach((function(r){var i=t[r];i.validDataTypes.includes(e.dataType)&&(n[r]=i)})),n}(e.field,e.queryEngineConfig.supportedOperators),n=[].concat(Object.keys(t)).flatMap((function(n,r){return null!=e&&e.isAList||!["is_one_of","is_not_one_of"].includes(n)?[{label:t[n].publicName,value:n,testId:e.testId+"-pick-op-"+r}]:[]}));"allowedOperators"in e.field&&e.field.allowedOperators.includes("=")&&n.push({label:"Is null",value:"is_null",testId:"is-null"}),"allowedOperators"in e.field&&e.field.allowedOperators.includes("!=")&&n.push({label:"Is not null",value:"is_not_null",testId:"is-not-null"});var r=e.selected;return"!="==e.selected&&null===e.value?r="is_not_null":"="==e.selected&&null===e.value&&(r="is_null"),c.jsx(Tc,{label:"Operator",labelHidden:!0,id:null==e?void 0:e.id,testId:e.testId+"-pick-op",onChange:function(t){e.onChange("is_not_null"==t?{op:"!=",value:null}:"is_null"==t?{op:"=",value:null}:{op:t})},options:n,selected:r})},Cg=Vl((function(e){return c.jsx("input",{defaultValue:e.value,"data-testid":e.testId,css:["width:100%;appearance:none;border-radius:0.375rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.5rem;padding-right:0.5rem;text-align:left;line-height:1.25;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;:focus{--tw-border-opacity:1;border-color:rgb(224 242 255 / var(--tw-border-opacity));}",e.error&&{"--tw-border-opacity":"1",borderColor:"rgb(239 68 68 / var(--tw-border-opacity))"},""],type:"datetime-local",onChange:function(t){var n=t.target.value?new Date(t.target.value):null;e.onChange(n)}})}),"renderDateTimeInput"),jg=Object.assign((function(){return null}),{remove:function(e){return ua(U({"& svg":U({},sa,{fill:"#e5e7eb"})},e?{}:{"&:hover svg":U({},sa,{fill:"#de0938",cursor:"pointer"})}))},complete:function(e){return ua(U({},e?{}:{"& svg":U({},sa,{fill:"rgb(229, 231, 235)"})}))}}),Fg=function(e,t,n,r,i){var o=On(t,{queryEngineConfig:r}),a=n.preAggregated&&o.setDataAttributesFromPreAggregatedDataSet?o.setDataAttributesFromPreAggregatedDataSet(o.init(n.id),n):o.autoGenerate(n),l=i(a,n,"initial"),s=o.setAttributes(a,l);return or(s)},Sg=function(){var e,n,r=zl(),i=r.onlyViewTypes,o=r.queryEngineConfig,a=zc(),l=a.dashboard,s=a.componentEditor,u=a.runQueriesCallback,d=a.dispatch,c=a.broadcastEvent,p=zl(),f=p.featureToggles,m=p.numberFormatOptions,h=p.mode,v=p.dataPanel,g=p.formatPanel,b=p.onAskAI,x=p.onEditorUpdate,y=(null==s?void 0:s.component)||null;if(t.useEffect((function(){var e=function(){var e=Y(H().mark((function e(){var t;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Fg(0,i(l.dataSets[0])[0],l.dataSets[0],o,x);case 2:t=e.sent,s&&d(U({type:"startEditingComponent",component:t},s.target));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();y||e()}),[]),!y)return null;var w=On(y.attributes.type,{queryEngineConfig:o}),C=Mn(l.dataSets,y.attributes.dataSetId);if(!C)return null;var j=null!=s&&null!=(e=s.target)&&e.libraryIndex||0===(null==s||null==(n=s.target)?void 0:n.libraryIndex)?"library":"dashboard",F=function(e){if(y){var t,n=x(e,C,"edit");try{t=w.setAttributes(e,n)}catch(n){console.warn("[VIZZLY] Not applying changes from `onEditorUpdate` because of a validation error.",n),t=e}var r=U({},y,{attributes:t});d({type:"updateEditorComponent",component:r})}};return{setLocalFilters:function(e){d({type:"updateEditorComponent",component:U({},y,{localFilters:e})})},setParameterUpdate:function(e){var t=Ec(y,e);d({type:"updateEditorComponent",component:U({},t)})},queryEngineConfig:o,selectedComponent:y.attributes.type,onSelectViewType:function(e){var t=Fg(0,e,C,o,x);d({type:"updateEditorComponent",component:t})},dataPanel:v,formatPanel:g,setDataSet:function(){var e=Y(H().mark((function e(t){var n,r,a,u;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(s&&s.component&&t)){e.next=10;break}if(n=Nn(l.dataSets,t),!(r=n[0])){e.next=10;break}return(a=i(r)).includes(u=s.component.attributes.type)||(u=a[0]),e.next=8,Fg(0,u,r,o,x);case 8:d({type:"updateEditorComponent",component:e.sent});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),featureToggles:f,dashboard:l,setDataSets:function(e){d({type:"setDataSets",dataSets:e})},dataSet:C,viewOptions:i,numberFormatOptions:m,onAskAI:b,setAttributes:F,setPartialAttributes:function(e){F(w.setAttributes(y.attributes,e))},setResults:function(e){d({type:"setResultsForComponentInEditor",results:e})},mode:h,origin:j,componentEditor:s,component:y,broadcastEvent:c,runQueriesCallback:u,dispatch:d}},kg={name:"blres4",styles:"--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))"},Tg=function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:c.jsx("path",{d:"M448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM152 96H64V160H152V96zM208 160H296V96H208V160zM448 96H360V160H448V96zM64 288H152V224H64V288zM296 224H208V288H296V224zM360 288H448V224H360V288zM152 352H64V416H152V352zM208 416H296V352H208V416zM448 352H360V416H448V352z"})}))},Ag={areaChart:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:c.jsx("path",{d:"M500 384c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12V76c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v308h436zM372.7 159.5L288 216l-85.3-113.7c-5.1-6.8-15.5-6.3-19.9 1L96 248v104h384l-89.9-187.8c-3.2-6.5-11.4-8.7-17.4-4.7z"})}))},barChart:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:c.jsx("path",{d:"M160 80C160 53.49 181.5 32 208 32H240C266.5 32 288 53.49 288 80V432C288 458.5 266.5 480 240 480H208C181.5 480 160 458.5 160 432V80zM0 272C0 245.5 21.49 224 48 224H80C106.5 224 128 245.5 128 272V432C128 458.5 106.5 480 80 480H48C21.49 480 0 458.5 0 432V272zM400 96C426.5 96 448 117.5 448 144V432C448 458.5 426.5 480 400 480H368C341.5 480 320 458.5 320 432V144C320 117.5 341.5 96 368 96H400z"})}))},horizontalBarChart:function(e){return c.jsx("svg",U({css:kg},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:c.jsx("path",{d:"M160 80C160 53.49 181.5 32 208 32H240C266.5 32 288 53.49 288 80V432C288 458.5 266.5 480 240 480H208C181.5 480 160 458.5 160 432V80zM0 272C0 245.5 21.49 224 48 224H80C106.5 224 128 245.5 128 272V432C128 458.5 106.5 480 80 480H48C21.49 480 0 458.5 0 432V272zM400 96C426.5 96 448 117.5 448 144V432C448 458.5 426.5 480 400 480H368C341.5 480 320 458.5 320 432V144C320 117.5 341.5 96 368 96H400z"})}))},lineChart:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:c.jsx("path",{d:"M64 400C64 408.8 71.16 416 80 416H480C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H80C35.82 480 0 444.2 0 400V64C0 46.33 14.33 32 32 32C49.67 32 64 46.33 64 64V400zM342.6 278.6C330.1 291.1 309.9 291.1 297.4 278.6L240 221.3L150.6 310.6C138.1 323.1 117.9 323.1 105.4 310.6C92.88 298.1 92.88 277.9 105.4 265.4L217.4 153.4C229.9 140.9 250.1 140.9 262.6 153.4L320 210.7L425.4 105.4C437.9 92.88 458.1 92.88 470.6 105.4C483.1 117.9 483.1 138.1 470.6 150.6L342.6 278.6z"})}))},pieChart:function(e){return c.jsxs("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:[c.jsx("path",{d:"M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"}),c.jsx("path",{d:"M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"})]}))},scatterChart:function(e){return c.jsxs("svg",U({viewBox:"0 0 2134 2134",xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1.5}},e,{children:[c.jsx("path",{d:"M208.333 208.334v1716.66M214.91 1926.73h1716.66",style:{strokeWidth:"166.67px"}}),c.jsx("circle",{cx:987.916,cy:920.416,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),c.jsx("circle",{cx:708.749,cy:1516.25,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),c.jsx("circle",{cx:1633.75,cy:907.916,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),c.jsx("circle",{cx:1775.42,cy:307.916,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}})]}))},singleStat:function(e){return c.jsx("svg",U({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor"},e,{children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5l-3.9 19.5m-2.1-19.5l-3.9 19.5"})}))},dataTable:Tg,basicTable:Tg,comboChart:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512.000000 512.000000",children:c.jsxs("g",{transform:"translate(0.000000,512.000000) scale(0.100000,-0.100000)",stroke:"currentColor",children:[c.jsx("path",{d:"M4840 4671 c-138 -42 -207 -183 -151 -306 l18 -40 -337 -483 -337 -483 -74 -2 c-51 -2 -84 -8 -106 -21 l-31 -19 -169 121 c-92 66 -220 158 -283 204 l-115 84 -2 48 c-3 69 -20 113 -60 157 -71 79 -205 93 -296 30 -62 -42 -100 -120 -95 -191 l3 -51 -308 -240 -308 -240 -50 9 c-118 22 -231 -44 -259 -150 -7 -24 -15 -49 -19 -57 -6 -12 -204 -122 -474 -263 l-78 -41 -42 24 c-62 34 -157 33 -219 -4 -26 -15 -56 -39 -68 -54 l-21 -27 -255 39 -255 39 -15 35 c-39 93 -112 141 -211 141 -134 -1 -223 -91 -223 -227 1 -131 92 -223 222 -223 65 0 123 26 170 74 l35 36 224 -35 c123 -19 238 -37 256 -40 24 -4 33 -12 38 -34 8 -39 60 -98 105 -121 58 -30 110 -34 174 -16 94 28 156 107 160 205 l1 37 268 143 c245 131 270 142 285 128 30 -28 106 -57 147 -57 70 0 117 19 166 69 62 61 86 153 60 223 -8 21 14 40 291 256 l300 233 39 -15 c54 -22 136 -20 181 2 l36 19 288 -208 288 -208 3 -51 c3 -62 30 -117 77 -157 46 -42 95 -56 172 -51 81 5 137 42 177 118 30 59 34 104 13 173 l-14 47 342 490 c341 489 341 490 372 484 76 -14 176 39 218 115 32 59 36 152 9 208 -45 96 -167 153 -263 124z"}),c.jsx("path",{d:"M4765 3605 l-25 -24 0 -1544 c0 -1506 0 -1545 19 -1568 18 -23 25 -24 135 -24 107 0 117 2 138 23 l23 23 3 1522 c2 1028 0 1534 -7 1558 -15 49 -43 59 -162 59 -93 0 -102 -2 -124 -25z"}),c.jsx("path",{d:"M2914 3246 c-17 -7 -34 -21 -38 -31 -3 -9 -6 -626 -6 -1370 0 -1317 1 -1353 19 -1376 18 -22 28 -24 129 -27 104 -4 110 -3 138 21 l29 25 0 1361 0 1360 -22 23 c-20 20 -35 23 -120 25 -69 2 -107 -1 -129 -11z"}),c.jsx("path",{d:"M1962 2580 c-12 -11 -24 -31 -27 -43 -3 -12 -4 -478 -3 -1035 l3 -1014 29 -25 c28 -24 34 -25 138 -21 101 3 111 5 129 27 18 23 19 54 19 1055 l0 1033 -23 21 c-21 20 -34 22 -133 22 -97 0 -113 -2 -132 -20z"}),c.jsx("path",{d:"M3842 2593 c-7 -3 -19 -18 -27 -33 -13 -25 -15 -167 -15 -1039 0 -719 3 -1017 11 -1034 17 -37 50 -47 150 -47 94 0 141 14 153 45 3 9 6 478 6 1041 l0 1025 -25 24 c-23 24 -30 25 -132 24 -59 0 -114 -3 -121 -6z"}),c.jsx("path",{d:"M102 1748 c-12 -6 -27 -27 -33 -47 -6 -24 -9 -235 -7 -623 l3 -587 23 -23 c21 -21 31 -23 138 -23 110 0 117 1 135 24 18 22 19 48 19 636 l0 614 -26 20 c-23 18 -40 21 -128 20 -55 0 -111 -5 -124 -11z"}),c.jsx("path",{d:"M1025 1735 l-25 -24 0 -605 c0 -332 3 -612 6 -621 12 -31 59 -45 153 -45 100 0 133 10 150 47 16 34 16 1192 0 1226 -17 37 -50 47 -160 47 -93 0 -102 -2 -124 -25z"})]})}))},mercatorMap:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:{fill:"none"},className:"w-5 h-5",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12.75 3.03v.568c0 .334.148.65.405.864l1.068.89c.442.369.535 1.01.216 1.49l-.51.766a2.25 2.25 0 01-1.161.886l-.143.048a1.107 1.107 0 00-.57 1.664c.369.555.169 1.307-.427 1.605L9 13.125l.423 1.059a.956.956 0 01-1.652.928l-.679-.906a1.125 1.125 0 00-1.906.172L4.5 15.75l-.612.153M12.75 3.031a9 9 0 00-8.862 12.872M12.75 3.031a9 9 0 016.69 14.036m0 0l-.177-.529A2.25 2.25 0 0017.128 15H16.5l-.324-.324a1.453 1.453 0 00-2.328.377l-.036.073a1.586 1.586 0 01-.982.816l-.99.282c-.55.157-.894.702-.8 1.267l.073.438c.08.474.49.821.97.821.846 0 1.598.542 1.865 1.345l.215.643m5.276-3.67a9.012 9.012 0 01-5.276 3.67m0 0a9 9 0 01-10.275-4.835M15.75 9c0 .896-.393 1.7-1.016 2.25"})}))},custom:function(e){return c.jsx(c.Fragment,{})}},Dg=function(){var e=Sg();if(!e)return null;var t=[].concat(e.viewOptions(e.dataSet)).flatMap((function(t){var n=On(t);return!n.setDataAttributesFromPreAggregatedDataSet&&e.dataSet.preAggregated?[]:[{value:t,label:n.title,icon:Ag[t]()}]}));return c.jsx(Ac,{children:c.jsx(Tc,{label:"View",labelHidden:!0,id:"select-view",testId:"select-view",anchorLeft:!0,onChange:function(t){return e.onSelectViewType(t)},selected:e.component.attributes.type,renderOption:function(e){return c.jsx(Ig,U({},e,{option:"option"}))},renderSelected:function(e){return c.jsx(Ig,U({},e,{option:"view"}))},options:t})})},Ig=function(e){return c.jsxs(Wd,{direction:"row",gap:"0.5rem",alignItems:"center",height:"view"===e.option?16:"inline"===e.option?18:20,children:[(null==e?void 0:e.icon)&&c.jsx(rc,{flexPaddingTop:"0",paddingTop:"0",icon:null==e?void 0:e.icon,iconWidth:"horizontalBarChart"===e.value[0]||"barChart"===e.value[0]?"66%":void 0}),c.jsx(Md,{as:"span",marginY:"0.15rem",children:null==e?void 0:e.label})]})},Pg=function(e,t){return("!="==e||"="==e)&&null===t},_g={name:"c5j7er",styles:"display:grid;flex-grow:1;grid-template-columns:repeat(3, minmax(0, 1fr));gap:0.5rem;font-size:0.875rem;line-height:1.25rem"},Eg={name:"1jjvu4g",styles:"margin-left:0.5rem;width:1.75rem;flex:none;text-align:right"},Og={name:"xioa8z",styles:"width:1.75rem;flex:none;text-align:right"},Lg=function(e){var n=e.filter,r=n.field,i=n.op,o=n.value,a=yg(e.filter),l=function(t){e.onChange(U({},e.filter,t))},s=[];return Ln(e.dataSet.fields,{removeAggregateMaths:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0}).forEach((function(t,n){s.push({label:t.publicName,value:t,testId:e.testId+"-pick-field-"+n,icon:c.jsx(rc,{icon:t.dataType,paddingTop:0})})})),c.jsxs("div",{css:["display:flex;",a&&{"--tw-border-opacity":"1",borderColor:"rgb(74 222 128 / var(--tw-border-opacity))"},"",""],children:[c.jsxs("div",{css:_g,children:[c.jsx("div",{children:c.jsx(Tc,{label:"Field",id:e.testId+"-pick-field",labelHidden:!0,testId:e.testId+"-pick-field",onChange:function(e){l({value:void 0,op:void 0,field:e})},options:s,selected:r,renderSelected:function(e){return c.jsx(Ig,U({},e,{option:"inline"}))},controlClassName:""+Ea.paddingLeft("0.5rem")})}),c.jsx("div",{css:[r?{opacity:"1"}:{opacity:"0"},"transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;",""],children:c.jsx(wg,{queryEngineConfig:e.queryEngineConfig,onChange:function(e){return l(e)},field:r,testId:e.testId,selected:i,value:o,id:"percentage-operator-"+(null==e?void 0:e.rowIndex),isAList:r&&"string"==r.dataType})}),c.jsx("div",{css:[i?{opacity:"1"}:{opacity:"0"},"transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;",""],children:!Pg(i,o)&&c.jsxs(c.Fragment,{children:[r&&"number"==r.dataType&&c.jsx(tp,{id:e.testId+"-value",label:"Value",labelHidden:!0,"data-testid":e.testId+"-value",type:"number",onChange:function(e){var t=parseFloat(e.target.value);l({value:t})},defaultValue:o}),r&&("string"==r.dataType||"string[]"==r.dataType)&&c.jsx(t.Fragment,{children:"="===i||"!="===i||"array_contains"===i||"is_one_of"===i||"is_not_one_of"===i?c.jsx(Mg,{onChange:function(e){return l({value:e})},testId:e.testId+"-value",value:o,dataSet:e.dataSet,field:r,multiple:"is_one_of"===i||"is_not_one_of"===i||"array_contains"===i}):c.jsx(tp,{label:"Value",labelHidden:!0,id:e.testId+"-value","data-testid":e.testId+"-value",type:"text",onChange:function(e){l({value:e.target.value})},defaultValue:o})}),r&&"boolean"==r.dataType&&c.jsx(Tc,{label:"Value",labelHidden:!0,id:e.testId+"-value",selected:o,onChange:function(e){return l({value:e})},options:[{label:"True",value:!0},{label:"False",value:!1}]}),r&&"date_time"==r.dataType&&c.jsx(Cg,{value:o?ko(new Date(o),"YYYY-MM-DD[T]HH:mm:ss"):void 0,onChange:function(e){var t=e?e.toISOString():null;l({value:t})},testId:""+e.testId})]})||c.jsx("p",{children:"-"})})]}),c.jsx("div",{css:Eg,className:""+jg.complete(a),children:c.jsx(Xl,{})}),c.jsx("div",{css:Og,children:c.jsx("button",{onClick:function(){return e.onDelete()},className:rs(""+jg.remove(!(null==e||!e.removeDisabled)),""+Ea.button),"aria-label":"Remove Filter",disabled:null==e?void 0:e.removeDisabled,children:c.jsx(Ql,{purpose:"removeFilter"})})})]})},Mg=function(e){var n,r=e.value,i=function(e,n){var r,i=zc().runQueriesCallback,o=t.useState(void 0),a=o[0],l=o[1],s=Rn(e,n);return r="string[]"==s.dataType?[Rt(e.id,s).query]:[Nt(e,n)],Kh(r,i,(function(e){null===e&&l(null),e&&l(e[0])}),{},e),{result:null!=a?a:null,loading:void 0===a,error:null===a}}(null==e?void 0:e.dataSet,e.field.id).result,o=(null==i?void 0:i.content.map((function(t,n){var r=t[0];return{value:r,label:r,testId:e.testId+"-pick-field-"+n}})))||[];return null!=e&&e.multiple?c.jsx($f,{label:"Values",id:"select-multiple-value",labelHidden:!0,setSelected:function(t){return null==e?void 0:e.onChange(t.map((function(e){return o[e].value})))},selected:(n=[],o.forEach((function(e,t){null!=r&&r.includes(e.value)&&n.push(t)})),n),options:o}):c.jsx(Tc,{testId:null==e?void 0:e.testId,label:"Value",labelHidden:!0,id:"select-single-value",selected:null==e?void 0:e.value,onChange:function(t){return null==e?void 0:e.onChange(t)},options:o})},Rg={name:"1v017vf",styles:"margin-top:1.5rem;margin-bottom:1.5rem;text-align:left"},Ng={name:"151yjvf",styles:"margin-bottom:0.5rem;font-weight:500;text-transform:uppercase;letter-spacing:0.1em"},zg={name:"zjik7",styles:"display:flex"},Bg={name:"1sul1dv",styles:"display:grid;flex-grow:1;grid-template-columns:repeat(3, minmax(0, 1fr));gap:0.5rem"},qg={name:"1x4tmz9",styles:"width:3.5rem;flex:none"},Vg={name:"1gok8e8",styles:"margin-bottom:0.5rem"},Hg=function(e){return c.jsx(c.Fragment,{children:e.wipFilters.map((function(t,n){return c.jsxs("div",{children:[0!=n&&c.jsx("div",{css:Rg,children:c.jsx("span",{css:Ng,children:"or"})}),c.jsxs("div",{children:[c.jsxs("div",{css:zg,children:[c.jsxs("div",{css:Bg,children:[c.jsx("div",{children:c.jsx(kc,{as:"span",children:e.fieldHeadingOverride||"Field"})}),c.jsx("div",{children:c.jsx(kc,{as:"span",children:"Operator"})}),c.jsx("div",{children:c.jsx(kc,{as:"span",children:"Value"})})]}),c.jsx("div",{css:qg})]}),t.map((function(r,i){return c.jsx("div",{css:Vg,children:c.jsx(Lg,{queryEngineConfig:e.queryEngineConfig,testId:"filter-"+n+"-"+i,filter:r,dataSet:e.dataSet,onChange:function(t){e.updateWipFilter(t,n,i)},onDelete:function(){e.deleteWipFilter(n,i)},rowIndex:i,removeDisabled:t.length<=1||t.length===i+1})},"filter_"+n+"_"+i)}))]})]},"filter_"+n)}))})},Wg=function(e){var t,n=null!=(t=null==e?void 0:e.as)?t:"span",r=us();return c.jsx(n,{className:""+$d.title(null==r?void 0:r.lists),"data-themeapi":"list.title",children:null==e?void 0:e.children})},Yg=Object.assign((function(){return null}),{wrapper:ua({position:"relative","&:hover .help-icon":{opacity:1}}),fadeIn:function(e){return ua(U({opacity:0,maxWidth:18,color:e},sa))}}),Ug=function(e){var t,n,r=us();return c.jsx(Wg,{as:"legend",children:c.jsxs(Wd,{gap:"0.25rem",alignItems:"center",children:[null==e?void 0:e.title,(null==e?void 0:e.tooltip)&&c.jsx(Md,{width:"18px",children:c.jsx(dp,{tooltipContent:function(){return c.jsx(dp.Content,{children:null==e?void 0:e.tooltip})},children:c.jsx(v.QuestionMarkCircleIcon,{"aria-label":"Help",className:"help-icon "+Yg.fadeIn(null==r||null==(t=r.dashboard)||null==(n=t.icon)?void 0:n.color)})})})]})})},Gg=Object.assign((function(e){return c.jsxs("fieldset",{className:rs(""+Yg.wrapper,""+Ea.bw(0),""+Ea.margin(0),""+Ea.padding(0)),children:[(null==e?void 0:e.title)&&c.jsx(Ug,U({},e)),c.jsx(Md,{marginTop:"0.25rem",children:e.children})]})}),{Grid:function(e){return c.jsx(os,{gap:"0.75rem",columns:2===(null==e?void 0:e.columns)?["repeat(2, minmax(0px, 1fr))"]:void 0,"data-component":null==e?void 0:e["data-component"],children:null==e?void 0:e.children})},Panel:function(e){var t;return c.jsx(Md,{as:null!=(t=null==e?void 0:e.as)?t:"fieldset","data-component":"list-panel",children:c.jsxs(ip,{padding:!0,children:[(null==e?void 0:e.title)&&c.jsx(Md,{"data-component":"section-panel",children:c.jsx(kc,{as:"legend",children:null==e?void 0:e.title})}),c.jsx(os,{gap:"0.5rem",children:null==e?void 0:e.children})]})})},Container:function(e){return c.jsx(Wd,{direction:"column",gap:"0.75rem","data-component":null==e?void 0:e["data-component"],children:null==e?void 0:e.children})},Title:Ug});function Kg(e,t){return[].concat(e).map((function(e){return[].concat(e).map((function(e){return U({},e,{field:Rn(t,e.field)})}))}))}var Xg=function(e,r){var o=Kg(e,r),a=n.useState(o),l=a[0],s=a[1];t.useEffect((function(){s(Kg(e,r))}),[JSON.stringify(e)]),i.isEmpty(l)&&(l=[[{field:r.fields[0],op:void 0,value:void 0}]]);var u,d=[].concat(l).map((function(e){var t=e[e.length-1];return t&&yg(t)?[].concat(e,[{field:r.fields[0],op:void 0,value:void 0}]):[].concat(e)}));return{addOrFilter:function(){var e=[].concat(l);e.push([{field:r.fields[0],op:void 0,value:void 0}]),s(e)},deleteWipFilter:function(e,t){var n=l;n[e].splice(t,1),i.isEmpty(n[e])&&n.splice(e,1),s([].concat(n))},updateWipFilter:function(e,t,n){var r=l;r[t][n]=e,s([].concat(r))},completedFilters:(u=l,[].concat(u).map((function(e){return[].concat(e).flatMap((function(e){var t;return yg(e)?[{op:e.op,value:e.value,field:null==(t=e.field)?void 0:t.id}]:[]}))})).filter((function(e){return!i.isEmpty(e)}))),wipFilters:d}},Qg={numeratorType:"simple",publicName:"",numerator:null,denominator:null},Jg=function(e){var n=e.dataSet,r=function(e,n,r,i){var o=!!n,a=t.useState(Qg),l=a[0],s=a[1],u=Xg(n&&"numeratorFilter"in n?n.numeratorFilter:[],r),d=u.completedFilters,c=u.wipFilters,p=u.deleteWipFilter,f=u.updateWipFilter;return t.useEffect((function(){n?jt(n)?s({numeratorType:"simple",publicName:n.publicName,numerator:{function:n.numeratorAggregate,field:n.numeratorFieldId},denominator:{function:n.denominatorAggregate,field:n.denominatorFieldId}}):s({numeratorType:"conditional",publicName:n.publicName,numerator:null,denominator:{function:n.denominatorAggregate,field:n.denominatorFieldId}}):s(Qg)}),[JSON.stringify(n)]),{onChange:function(e){o&&e.numeratorType&&e.numeratorType!=l.numeratorType?Br("Percentage type cannot be changed once it has been created."):s(U({},l,e))},fieldPublicName:l.publicName,denominatorMeasure:l.denominator,numeratorType:l.numeratorType,numeratorMeasure:l.numerator,completedFilters:d,wipFilters:c,deleteWipFilter:p,updateWipFilter:f,isEditing:o,handleUpsertPercentageField:function(){if("simple"==l.numeratorType&&l.denominator&&l.numerator){var t=function(e,t,n,r,i,o){return{id:bt(),publicName:e,numeratorFieldId:t,numeratorAggregate:n,denominatorFieldId:r,denominatorAggregate:i,canBeDimension:!1,canBeMeasure:!0,dataType:"number",allowedOperators:Re({dataType:"number"},o)}}(l.publicName,l.numerator.field,l.numerator.function,l.denominator.field,l.denominator.function,e);i(U({},t,{id:o?n.id:t.id}))}if("conditional"==l.numeratorType&&l.denominator&&l.publicName){var r=function(e,t,n,r,i){return{id:bt(),publicName:e,numeratorFilter:r,denominatorFieldId:t,denominatorAggregate:n,canBeDimension:!1,canBeMeasure:!0,dataType:"number",allowedOperators:Re({dataType:"number"},i)}}(l.publicName,l.denominator.field,l.denominator.function,d,e);i(U({},r,{id:o?n.id:r.id}))}}}}(e.queryEngineConfig,e.initialValue,n,e.onNewCustomField),i=r.fieldPublicName,o=r.denominatorMeasure,a=r.numeratorType,l=r.numeratorMeasure,s=r.onChange,u=r.completedFilters,d=r.wipFilters,p=r.deleteWipFilter,f=r.updateWipFilter,m=r.isEditing,h=r.handleUpsertPercentageField,v=On(e.componentType),g=[];v.supportedCustomFields.simplePercentage&&(g=[].concat(g,[{value:"simple",label:"Simple",description:"Percentage metric without a numerator filter"}])),v.supportedCustomFields.conditionalPercentage&&(g=[].concat(g,[{value:"conditional",label:"Conditional",description:"Apply conditional filters to the numerator"}]));var b={onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:e.componentType,removeSimplePercentage:!0,removeConditionalPercentage:!0,removeSimpleMaths:!0,removeRuleGrouping:!0,removeAggregateMaths:!0};return c.jsxs(Df,{width:"2xl",isOpen:e.isOpen,onClose:e.onClose,children:[c.jsx(Df.Header,{title:"Percentage Custom Metric"}),c.jsxs(Df.Content,{children:[c.jsx(Mf,{children:c.jsx(tp,{id:"percentage-name",placeholder:"Metric name",label:"Metric name",value:i,onChange:function(e){return s({publicName:e.target.value})}})}),c.jsxs(Mf,{as:"fieldset",children:[c.jsx(kc,{as:"legend",children:"Numerator"}),c.jsx(Md,{marginBottom:"1rem",children:c.jsx(Vv,{options:g,name:"percentage-check",label:"Select Percentage Type",selected:a,locked:m,labelHidden:!0,onChange:function(e){return s({numeratorType:e})}})}),"simple"===a&&c.jsx(vg,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){s({numerator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:l?[l]:[]},dataSet:e.dataSet,fieldFilterOptions:b}),"conditional"===a&&c.jsx(Gg.Panel,{children:c.jsx(Hg,{fieldHeadingOverride:"metric",queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:u,wipFilters:d,updateWipFilter:f,deleteWipFilter:p})})]}),c.jsxs(Mf,{children:[c.jsx(kc,{children:"Denominator"}),c.jsx(vg,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){s({denominator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:o?[o]:[]},dataSet:e.dataSet,fieldFilterOptions:b})]})]}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{onClick:function(){return e.onClose()},secondary:!0,children:"Close"}),c.jsx(Pp,{onClick:function(){return h()},children:m?"Update":"Create"})]})})]})},Zg=function(e){return c.jsxs(Df,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(Df.Header,{title:"Are you sure?",show:!0}),c.jsx(Df.Content,{children:c.jsx(Md,{paddingY:8,children:e.message})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Dp,{onClick:function(){return null==e?void 0:e.onClose(!1)},children:"Cancel"}),c.jsx(Dp,{testId:"modal-confirm-delete-btn",primary:!0,onClick:function(){return null==e?void 0:e.onClose(!0)},disabled:null==e?void 0:e.disabledDelete,children:"Delete"})]})})]})};function $g(e){var n=e.label,r=void 0===n?"Metric":n,i=t.useState(e.value),o=i[0],a=i[1],l=[];return[].concat(e.dataSetFields).forEach((function(t,n){l.push({label:t.publicName,value:t,testId:e.testId+"-pick-field-"+n})})),c.jsx(Tc,{label:r,labelHidden:null==e?void 0:e.labelHidden,id:null==e?void 0:e.id,testId:e?e.testId+"-pick-field":void 0,onChange:function(t){a(t),null==e||e.onChange(t)},options:l,selected:o})}var eb={publicName:"",mathType:"simple",left:void 0,right:void 0,rightFieldId:void 0,leftFieldId:void 0,operator:void 0},tb=function(e){switch(e.mathType){case"simple":return void 0===e.publicName||void 0===e.operator||void 0===e.leftFieldId||void 0===e.rightFieldId;case"aggregate":return void 0===e.left||void 0===e.right||void 0===e.operator;default:return!0}},nb=function(e){var t,n,r,i,o=void 0,a=void 0,l=void 0;return e&&(ib(e)&&e.operator&&e.right&&(o=null==(t=e.left)?void 0:t.field,a=null==(n=e.left)?void 0:n.function,l={operator:e.operator,fieldId:null==(r=e.right)?void 0:r.field,function:null==(i=e.right)?void 0:i.function}),ob(e)&&(o=e.field,a=e.function)),{fieldId:o,function:a,nested:l}};function rb(e){return{field:e.fieldId,function:e.function}}var ib=function(e){return"left"in e||"operator"in e||"right"in e},ob=function(e){return"field"in e&&"function"in e};function ab(e,t){var n={};return n[t]=e&&ib(e)?e.left:{operator:"+",left:null!=e?e:void 0},n}var lb=function(e){var t;return c.jsx(Tc,{placeholder:"Operator...",id:null!=(t=null==e?void 0:e.id)?t:"simple-math-operator",label:"Operator",labelHidden:!0,onChange:function(t){null==e||e.onChange(t)},options:[{label:"Add",value:"+",testId:"simple-math-operator-add"},{label:"Subtract",value:"-"},{label:"Multiply",value:"*"},{label:"Divide",value:"/"}],selected:e.mathOperator})},sb=function(e){var t=e.state;return c.jsx(dp,{tooltipContent:function(){return t+" nested calculation"},classNameTrigger:""+cb,children:c.jsxs(Pp,{secondary:!0,onClick:e.onClick,children:[c.jsxs("span",{className:""+_a,children:[t," nested calculation"]}),c.jsx("Remove"===t?v.MinusSmIcon:v.PlusSmIcon,{width:16})]})})},ub=function(e){var n=e.left,r=e.right,i=e.operator,o=e.dataSet,a=tb({mathType:"aggregate",left:n,right:r,operator:i,publicName:""});return c.jsx("code",{className:""+pb,children:a?c.jsx(t.Fragment,{children:"Metrics and operator need to be defined"}):c.jsxs(t.Fragment,{children:[n&&c.jsx(Md,{flex:1,as:"span","data-component":"calculation-left",textAlign:"right",children:c.jsx(db,{side:n,dataSet:o})}),c.jsx(Md,{as:"strong",width:8,"data-component":"calculation-operator",className:""+Ea.bold,children:i}),r&&c.jsx(Md,{flex:1,as:"span","data-component":"calculation-right",children:c.jsx(db,{side:r,dataSet:o})})]})})},db=function(e){var n,r,i,o,a,l,s=e.side,u=e.dataSet;return c.jsx(t.Fragment,{children:s&&ib(s)?c.jsxs("span",{children:[c.jsx("span",{className:""+Ea.bold,children:"("}),(null==(n=s.left)?void 0:n.field)&&Rn(u,null==(r=s.left)?void 0:r.field).publicName," (",null==s||null==(i=s.left)?void 0:i.function,")"," ",s.operator," ",(null==(o=s.right)?void 0:o.field)&&Rn(u,null==(a=s.right)?void 0:a.field).publicName," (",null==(l=s.right)?void 0:l.function,")",c.jsx("span",{className:""+Ea.bold,children:")"})]}):c.jsxs("span",{children:[s&&Rn(u,s.field).publicName," ",(null==s?void 0:s.function)&&c.jsxs(t.Fragment,{children:["(",null==s?void 0:s.function,")"]})]})})},cb=ua({display:"block"}),pb=ua({backgroundColor:da(80),color:da(0),borderRadius:8,padding:"16px 8px",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",gap:"0.5rem",fontSize:11}),fb=function(e){var n=function(e,n,r){var i=!!n,o=t.useState(eb),a=o[0],l=o[1],s=function(){l(eb)};return t.useEffect((function(){if(n)if(Ct(n)){var e=function(e){var t=e.rightFieldId,n=e.rightFunction,r=e.leftNested,i=e.rightNested,o=rb({fieldId:e.leftFieldId,function:e.leftFunction}),a=rb({fieldId:t,function:n});return r&&(o={left:o,operator:r.operator,right:rb({fieldId:r.fieldId,function:r.function})}),i&&(a={left:a,operator:i.operator,right:rb({fieldId:i.fieldId,function:i.function})}),{left:o,right:a}}(n);l({publicName:n.publicName,left:e.left,right:e.right,leftFieldId:void 0,rightFieldId:void 0,operator:n.operator,mathType:"aggregate"})}else yt(n)&&l({publicName:n.publicName,rightFieldId:n.rightFieldId,leftFieldId:n.leftFieldId,operator:n.operator,right:void 0,left:void 0,mathType:"simple"});else s()}),[JSON.stringify(n)]),U({reset:s},a,{handleUpsertMathField:function(){if("simple"===a.mathType&&null!=a&&a.leftFieldId&&null!=a&&a.operator&&null!=a&&a.rightFieldId){var t=function(e,t,n,r,i){return{id:bt(),publicName:e,rightFieldId:r,operator:n,leftFieldId:t,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:Re({dataType:"number"},i)}}(a.publicName,null==a?void 0:a.leftFieldId,null==a?void 0:a.operator,null==a?void 0:a.rightFieldId,e);r(U({},t,{id:i?n.id:t.id}))}if("aggregate"===a.mathType&&a.left&&a.right&&a.operator){var o=function(e){var t=e.right,n=nb(e.left),r=n.fieldId,i=n.function,o=n.nested,a=nb(t);return{nestedLeft:o,nestedRight:a.nested,leftField:r,rightField:a.fieldId,leftFunction:i,rightFunction:a.function}}(a),l=function(e,t,n,r,i,o,a,l,s){return{id:bt(),publicName:e,rightFieldId:i,rightFunction:o,operator:r,leftFieldId:t,leftFunction:n,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:Re({dataType:"number"},a),leftNested:l,rightNested:s}}(a.publicName,o.leftField,o.leftFunction,a.operator,o.rightField,o.rightFunction,e,o.nestedLeft,o.nestedRight);r(U({},l,{id:i?n.id:l.id}))}},onChange:function(e){l(void 0!==e.mathType&&e.mathType!==a.mathType?U({},a,e,{left:void 0,leftFieldId:void 0,right:void 0,rightFieldId:void 0}):U({},a,e))},isEditing:!!n,disabled:tb(a)})}(e.queryEngineConfig,e.initialValue||void 0,e.onNewCustomField),r=n.leftFieldId,i=n.rightFieldId,o=n.operator,a=n.publicName,l=n.handleUpsertMathField,s=n.onChange,u=n.isEditing,d=n.mathType,p=n.right,f=n.left,m=n.disabled,h=n.reset,v={onlyFieldTypes:["number"],removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},g=Ln(e.dataSet.fields,v),b=function(e){var t=[],n=On(e);return n.supportedCustomFields.simpleMaths&&(t=[].concat(t,[{value:"simple",label:"Simple",description:"Math calculation with simple metrics"}])),n.supportedCustomFields.aggregateMaths&&(t=[].concat(t,[{value:"aggregate",label:"Aggregate",description:"Math calculation with a aggregate metric"}])),t}(e.componentType),x=function(t){return t?Rn(e.dataSet,t):void 0};return t.useEffect((function(){null!=e&&e.open&&!e.initialValue&&h()}),[null==e?void 0:e.open]),c.jsxs(Df,{width:"4xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(Df.Header,{title:"Math Custom Metric"}),c.jsxs(Df.Content,{children:[c.jsx(Mf,{children:c.jsx(tp,{label:"Metric name",id:"metric-name",placeholder:"Metric name",value:a,onChange:function(e){return s({publicName:e.target.value})}})}),c.jsxs(Mf,{as:"fieldset",children:[c.jsx(kc,{as:"legend",children:"Calculation"}),e.allowAggregateMathsCustomField&&c.jsx(Md,{marginBottom:"1rem",children:c.jsx(Vv,{options:b,name:"math-check",label:"Select Math Type",selected:d,locked:u,labelHidden:!0,onChange:function(e){return s({mathType:e})}})}),"simple"===d&&c.jsx(Gg.Panel,{children:c.jsxs(Wd,{direction:"row",gap:"0.5rem",children:[c.jsx(Md,{flex:1,children:c.jsx($g,{id:"metric-1",testId:"metric-1",label:"Metric 1",onChange:function(e){return s({leftFieldId:null==e?void 0:e.id})},dataSetFields:g,value:x(r),labelHidden:!0})}),c.jsx(Md,{width:170,children:c.jsx(lb,{mathOperator:o,onChange:function(e){return s({operator:e})}})}),c.jsx(Md,{flex:1,children:c.jsx($g,{id:"metric-2",testId:"metric-2",label:"Metric 2",onChange:function(e){return s({rightFieldId:null==e?void 0:e.id})},dataSetFields:g.filter((function(e){return e.id!==r})),value:x(i),labelHidden:!0})})]})}),"aggregate"===d&&c.jsxs(t.Fragment,{children:[c.jsx(Gg.Panel,{children:c.jsxs(Wd,{direction:"column",gap:"1rem",paddingY:"0.5rem",children:[c.jsxs(Wd,{direction:"row",gap:"0.5rem",children:[c.jsx(Md,{flex:1,children:c.jsx(vg,{id:"left-1",testId:"left-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return s(f&&ib(f)?{left:U({},f,{left:t[0]})}:{left:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:f&&ob(f)?[f]:null!=f&&f.left?[null==f?void 0:f.left]:[]},dataSet:e.dataSet,fieldFilterOptions:v},""+f)}),f&&!!ib(f)&&c.jsxs(t.Fragment,{children:[c.jsx(Md,{width:120,children:c.jsx(lb,{mathOperator:f.operator,onChange:function(e){return s({left:U({},f,{operator:e})})}})}),c.jsx(Md,{flex:1,children:c.jsx(vg,{id:"right-1",testId:"right-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return s({left:U({},f,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:null!=f&&f.right?[null==f?void 0:f.right]:[]},dataSet:e.dataSet,fieldFilterOptions:v})})]}),c.jsx(Md,{children:c.jsx(sb,{onClick:function(){return s(ab(f,"left"))},state:f&&ib(f)?"Remove":"Add"})})]}),c.jsx(Wd,{justifyContent:"center",children:c.jsx(Md,{flex:1,marginRight:60,children:c.jsx(lb,{mathOperator:o,onChange:function(e){return s({operator:e})},id:"operator-2"})})}),c.jsxs(Wd,{direction:"row",gap:"0.5rem",children:[c.jsx(Md,{flex:1,children:c.jsx(vg,{id:"left-2",testId:"left-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return s(p&&ib(p)?{right:U({},p,{left:t[0]})}:{right:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:p&&ob(p)?[p]:null!=p&&p.left?[null==p?void 0:p.left]:[]},dataSet:e.dataSet,fieldFilterOptions:v},""+p)}),p&&ib(p)&&c.jsxs(t.Fragment,{children:[c.jsx(Md,{width:120,children:c.jsx(lb,{mathOperator:p.operator,onChange:function(e){return s({right:U({},p,{operator:e})})},id:"operator-2"})}),c.jsx(Md,{flex:1,children:c.jsx(vg,{id:"right-2",testId:"right-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return s({right:U({},p,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:p.right?[p.right]:[]},dataSet:e.dataSet,fieldFilterOptions:v})})]}),c.jsx(Md,{children:c.jsx(sb,{onClick:function(){s(ab(p,"right"))},state:p&&ib(p)?"Remove":"Add"})})]})]})}),c.jsx(Md,{marginTop:20,children:c.jsx(ub,{left:f,right:p,operator:o,dataSet:null==e?void 0:e.dataSet})})]})]})]}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{onClick:function(){return e.onClose()},secondary:!0,children:"Close"}),c.jsx(Pp,{onClick:function(){return l()},disabled:m,children:u?"Update":"Create"})]})})]})},mb=["round_to_0_dp","round_to_2_dp"],hb=function(e){var n=zl().mode,r=function(e,n,r,o){var a=!!e,l=i.intersection(mb,Object.keys(n.supportedTransformationFunctions)),s=t.useState(""),u=s[0],d=s[1],c=t.useState({dataSetField:void 0,transformationFunctionKey:void 0}),p=c[0],f=c[1],m=Ln(r.fields,{onlyFieldTypes:["number"]}).map((function(e){return{title:e.publicName,value:e}})),h=p.dataSetField?[{title:p.dataSetField.publicName,select:{selected:p.transformationFunctionKey,onChange:function(e){f(U({},p,{transformationFunctionKey:e}))},options:[].concat(l).map((function(e){return{label:n.supportedTransformationFunctions[e].publicName,value:e}}))}}]:[];return t.useEffect((function(){if(e&&wt(e)){d(e.publicName);var t=Rn(r,e.fieldId);f({dataSetField:t,transformationFunctionKey:2==e.roundToDecimalPlaces?"round_to_2_dp":"round_to_0_dp"})}else d(""),f({dataSetField:void 0,transformationFunctionKey:void 0})}),[JSON.stringify(e)]),{onCreateNewRoundedNumber:function(){if(p&&p.dataSetField){var t,r=function(e,t,n,r){return{id:bt(),publicName:e,fieldId:t,roundToDecimalPlaces:n,dataType:"number",canBeDimension:!0,canBeMeasure:!0,allowedOperators:Re({dataType:"number"},r)}}(u,null==(t=p.dataSetField)?void 0:t.id,"round_to_0_dp"==p.transformationFunctionKey?0:2,n);o(U({},r,{id:a?e.id:r.id}))}},isEditing:a,metricName:u,setMetricName:d,items:h,initValues:m,selected:p,setSelected:f,transformationFunctions:l}}(e.initialValue,e.queryEngineConfig,e.dataSet,e.onNewCustomField),o=r.isEditing,a=r.metricName,l=r.setMetricName,s=r.items,u=r.initValues,d=r.selected,p=r.setSelected,f=r.transformationFunctions,m=r.onCreateNewRoundedNumber;return c.jsxs(Df,{width:"xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(Df.Header,{title:"Round number custom field"}),c.jsxs(Df.Content,{children:[c.jsx(Mf,{children:c.jsx(tp,{id:"rounded-number-name",placeholder:"Metric name",label:"Metric name",value:a,onChange:function(e){return l(e.target.value)}})}),c.jsx(Mf,{children:c.jsx(Sp,{testId:"select-rounded-number-field",mode:n,items:s,onDeleteItem:function(){return p({dataSetField:void 0,transformationFunctionKey:f[0]})},newItem:{callToAction:"Select field to transform",onNew:function(e){return p({dataSetField:e,transformationFunctionKey:f[0]})},initValues:u,hide:!!d.dataSetField}})})]}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{onClick:function(){return e.onClose()},secondary:!0,children:"Close"}),c.jsx(Pp,{onClick:function(){d.dataSetField&&m()},children:o?"Update":"Create"})]})})]})},vb=function(e,t,n){var r=[],i=On(t);return e.allowSimpleMathsCustomField&&i.supportedCustomFields.simpleMaths||e.allowAggregateMathsCustomField&&i.supportedCustomFields.aggregateMaths?r.push({title:"Math",subtext:"Calculate from multiple values",value:"math"}):(e.allowSimpleMathsCustomField||e.allowAggregateMathsCustomField||Nr("Simple math custom field not made available, because of a feature toggle."),i.supportedCustomFields.simpleMaths&&!i.supportedCustomFields.aggregateMaths||Nr("Simple math custom field not made available, because it is not supported for the view "+i.title+".")),e.allowRoundedNumberCustomField&&i.supportedCustomFields.roundedNumbers?r.push({title:"Rounded number",subtext:"Round a number field",value:"roundedNumber"}):(e.allowRoundedNumberCustomField||Nr("Rounded number custom field not made available, because of a feature toggle."),i.supportedCustomFields.roundedNumbers||Nr("Rounded number custom field not made available, because it is not supported for the view "+i.title+".")),e.allowPercentagesCustomField&&(i.supportedCustomFields.simplePercentage||i.supportedCustomFields.conditionalPercentage)?r.push({title:"Percentage",subtext:"Calculate a percentage in a field",value:"percentage"}):(e.allowPercentagesCustomField||Nr("Percentage custom field not made available, because of a feature toggle."),i.supportedCustomFields.simplePercentage||i.supportedCustomFields.conditionalPercentage||Nr("Percentage custom field not made available, because it is not supported for the view "+i.title+".")),e.allowRulesCustomField&&i.supportedCustomFields.rules&&zt(n,"switchField")?r.push({title:"Rules-based Groups",subtext:"Create groups based on conditions",value:"rules"}):(e.allowRulesCustomField||Nr("Custom rules field not made available, because of a feature toggle."),i.supportedCustomFields.rules||Nr("Custom rules field not made available, because it is not supported for the view "+i.title+"."),zt(n,"switchField")||Nr("Custom rules field not made available, because it is not supported by the current query engine.")),r},gb=function(e){var n=e.index,r=e.rules,i=e.data,a=e.queryEngineConfig,l=e.updateDraft,s=e.removeDraft,u=t.useState(r.name),d=u[0],p=u[1],f=Xg(r.rule,i),m=f.completedFilters,h=f.wipFilters,v=f.addOrFilter,g=f.deleteWipFilter,b=f.updateWipFilter;return t.useEffect((function(){var e={name:d,rule:m};o.isEqual(r,e)||l(e)}),[m,d]),c.jsx(Md,{as:"fieldset",children:c.jsxs(Wd,{gap:"0.5rem",paddingBottom:"0.1rem",paddingRight:"0.1rem",paddingLeft:"0.1rem",direction:"column",children:[c.jsx(Gg.Title,{title:"Rule "+(n+1)+(r.name&&": "+r.name)}),c.jsx(Md,{children:c.jsx(tp,{id:"rules-name-"+n,label:"Field Value",value:null==r?void 0:r.name,onChange:function(e){return p(e.target.value)}})}),c.jsx(Md,{children:c.jsxs(Wd,{direction:"column",gap:"0.5rem",children:[c.jsx(Md,{children:c.jsx(Hg,{wipFilters:h,completedFilters:m,dataSet:i,updateWipFilter:b,queryEngineConfig:a,deleteWipFilter:g})}),c.jsx(Md,{children:c.jsxs(Wd,{justifyContent:"space-between",children:[c.jsx(Pp,{secondary:!0,onClick:function(){return v()},children:'Add "OR"'}),0!==n&&c.jsx(Pp,{secondary:!0,onClick:function(){return s()},children:"Delete Rule"})]})})]})})]})})},bb=function(e){var t,n=wb(e.initialValue),r=n.draft,i=n.updateDraftTitle,o=n.addNewRule,a=n.updateDraftRules,l=n.removeDraftRule;return c.jsxs(Df,{width:"4xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(Df.Header,{title:"Rules Custom Metric"}),c.jsxs(Df.Content,{scrollable:!0,children:[c.jsx(Mf,{children:c.jsx(tp,{id:"rules-name",label:"Metric name",value:null==r?void 0:r.publicName,onChange:function(e){return i(e.target.value)}})}),c.jsx(Mf,{children:c.jsx(os,{gap:"0.75rem",role:"list",children:null==r||null==(t=r.rules)?void 0:t.map((function(t,n){return c.jsx(zv,{transform:!1,children:c.jsx(gb,{rules:t,index:n,data:null==e?void 0:e.data,queryEngineConfig:e.queryEngineConfig,updateDraft:function(e){return a(e,n)},removeDraft:function(){return l(n)}})},"rules_modal_key_"+n)}))})})]}),c.jsxs(Df.Footer,{buttons:"space-between",children:[c.jsx(Of,{children:c.jsx(Pp,{onClick:function(){return o()},secondary:!0,children:"Add Rule"})}),c.jsxs(Of,{buttons:"end",children:[c.jsx(Pp,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:"Close"}),c.jsx(Pp,{onClick:function(){return function(){if(r.publicName&&r.rules){var t=(n=r.publicName,i=r.rules,o=e.queryEngineConfig,{id:bt(),publicName:n,rules:i,dataType:"string",canBeDimension:!0,canBeMeasure:!0,allowedOperators:Re({dataType:"string"},o)});e.onCreateNewRules(e.initialValue?U({},t,{id:e.initialValue.id}):t)}var n,i,o}()},children:e.initialValue?"Update":"Create"})]})]})]})},xb={name:"",rule:[]},yb={publicName:"",rules:[xb]},wb=function(e){var n=t.useState(yb),r=n[0],i=n[1];return t.useEffect((function(){i(e||yb)}),[JSON.stringify(e)]),{draft:r,updateDraftTitle:function(e){i(U({},r,{publicName:e}))},addNewRule:function(){var e,t=[].concat(null!=(e=null==r?void 0:r.rules)?e:[]);t.push(xb),i(U({},r,{rules:t}))},updateDraftRules:function(e,t){var n,o=[].concat(null!=(n=null==r?void 0:r.rules)?n:[]);t>=0&&t<o.length&&(o[t]=e),i(U({},r,{rules:o}))},removeDraftRule:function(e){var t,n=[].concat(null!=(t=null==r?void 0:r.rules)?t:[]);e>=0&&e<n.length+1&&n.splice(e,1),i(U({},r,{rules:n}))}}},Cb=function(e,t){setTimeout((function(){try{var n=t?document.getElementById(t):window;n&&n.scrollBy&&n.scrollBy({top:"bottom"===e?99999999:e,behavior:"smooth"})}catch(e){Nr("Failed to auto-scroll.")}}),50)},jb=function(e){var n=zl(),r=n.mode,i=n.featureToggles,o=Mn(e.dataSets,e.dataSetId);if(!o)return console.warn("Data set must be found for custom field input to render."),null;var a=t.useState(null),l=a[0],s=a[1],u=t.useState(null),d=u[0],p=u[1],f=vb(i,e.componentType,null==e?void 0:e.queryEngineConfig),m=Bn(o,e.componentType),h=[].concat(m).map((function(e){return{title:e.publicName,subtext:Fb(e),onClick:function(){return s({customFieldCategory:St(e),customField:e})}}})),v=function(t){var n=Mn(e.dataSets,e.dataSetId);if(!n)throw"Cannot find data set.";var r=function(e,t){var n=!1,r=[].concat(e.fields).map((function(e){return e.id==t.id?(n=!0,t):e}));return U({},e,{fields:n?r:[].concat(r,[t])})}(n,t),i=Vn(e.dataSets,r);e.setDataSets(i),s(null)};return c.jsxs(c.Fragment,{children:[c.jsx(Sp,{mode:r,newItem:{callToAction:"Add custom metric",onNew:function(e){s({customFieldCategory:e,customField:void 0})},initValues:f,onOpenDropdown:function(){Cb("bottom","editor-panel")}},items:h,onDeleteItem:function(e){p(m[e])},testId:"custom-metric-input"}),c.jsx(Jg,{dataSet:o,onNewCustomField:v,isOpen:"percentage"===(null==l?void 0:l.customFieldCategory),onClose:function(){return s(null)},queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,initialValue:null==l?void 0:l.customField}),c.jsx(fb,{open:"math"===(null==l?void 0:l.customFieldCategory),onClose:function(){return s(null)},dataSet:o,onNewCustomField:v,queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,initialValue:null==l?void 0:l.customField,allowAggregateMathsCustomField:i.allowAggregateMathsCustomField}),c.jsx(bb,{open:"rules"===(null==l?void 0:l.customFieldCategory),onClose:function(){return s(null)},data:o,queryEngineConfig:e.queryEngineConfig,onCreateNewRules:v,initialValue:null==l?void 0:l.customField}),c.jsx(hb,{open:"roundedNumber"===(null==l?void 0:l.customFieldCategory),onClose:function(){return s(null)},dataSet:o,queryEngineConfig:e.queryEngineConfig,onNewCustomField:v,initialValue:null==l?void 0:l.customField}),c.jsx(Zg,{message:"This will permanently remove the custom field '"+(null==d?void 0:d.publicName)+"' from all views on the dashboard, not just this view. Are you sure you want to continue?",onClose:function(t){if(t&&d){var n=function(e,t){var n=e.fields.findIndex((function(e){return e.id==t})),r=[].concat(e.fields);return n>=0?(r.splice(n,1),U({},e,{fields:r})):U({},e,{fields:r})}(o,d.id),r=Vn(e.dataSets,n);e.setDataSets(r)}p(null)},show:null!=d})]})};function Fb(e){return yt(e)||Ct(e)?"Math":xt(e)||jt(e)?"Percentage":Ft(e)?"Rules-based Group":""}var Sb=function(e){var n,r=e.dataSet,o=e.queryEngineConfig,a=e.fieldFilterOptions,l=e.attributes,s=e.preSetPartialAttributes,u=e.setPartialAttributes,d=e.callToAction,p=e.maxAllowed,f=e.preventDuplicates,m=null!=a&&a.onlyDimensions?"grouping":"metric",h=(0,e.getValues)(l),v=function(e){var t=s(e,r,l);"order"in l&&i.isEmpty(l.order)&&e.forEach((function(e){"date_time"==Rn(r,e.field).dataType&&"grouping"==m&&(t.order=[{function:e.function,field:e.field,direction:"asc"}])})),u(t)},g=t.useState(!1),b=g[0],x=g[1],y=zl(),w=kb(h,m,o,v),C=Ab(h,r,m,o,v),j=Tb(r,a,f,h);return c.jsxs(t.Fragment,{children:[c.jsx(Sp,{testId:null!=(n=null==e?void 0:e.testId)?n:"field-collector-input",mode:y.mode,onOrderChange:function(e,t){var n=ug([].concat(h),e,t);v(n)},onDeleteItem:r.preAggregated?void 0:function(e){var t=h[e],n=Rn(r,h[e].field);pg(l,"date_time"===n.dataType&&"function"in t?{field:t.field,truncate:t.function}:t)?x(!0):v(function(e,t){var n=i.cloneDeep(e);return n.splice(t,1),n}(h,e))},items:C,newItem:{callToAction:d||"Add field",onNew:w,initValues:j,hide:e.dataSet.preAggregated||!!p&&h.length>=p}}),b&&c.jsx(dg,{onClose:function(){return x(!1)}})]})};function kb(e,t,n,r){return function(i){var o,a=[].concat(e);o="grouping"==t&&"date_time"==i.dataType?{field:i.id,function:i.allowedGranularities[0]}:"grouping"==t?{field:i.id,function:"none"}:{field:i.id,function:et(i,n.supportedAggregates)[0]},r([].concat(a,[o]))}}function Tb(e,t,n,r){var i=Ln(e.fields,t);return n&&(i=it(i,[].concat(r))),i.map((function(e){return{title:e.publicName,icon:e.dataType,value:e}}))}function Ab(e,t,n,r,o){return[].concat(e).map((function(a,l){var s=Rn(t,a.field),u=[];"metric"==n?u=et(s,r.supportedAggregates).map((function(e){return{label:r.supportedAggregates[e].publicName,value:e}})):"grouping"===n&&"date_time"===s.dataType&&(u=function(e,t){return e.filter((function(e){return void 0!==t[e]})).map((function(e){return{label:t[e].publicName,value:e}}))}(s.allowedGranularities,r.supportedTimeTruncFunctions));var d=!(xt(s)||jt(s)),c=!Ct(s);return{title:s.publicName,icon:s.dataType,select:!t.preAggregated&&"none"!=a.function&&d&&c?{options:u,selected:a.function,onChange:function(t){var n=i.cloneDeep(e);"function"in a&&(n[l]={field:a.field,function:t}),o(n)}}:void 0}}))}var Db={name:"iaoxbn",styles:"display:grid;width:100%;grid-template-columns:repeat(2, minmax(0, 1fr))"},Ib={name:"1flj9lk",styles:"text-align:left"},Pb={name:"gdaplf",styles:"width:100%;text-align:right"},_b={name:"1gqeage",styles:"margin-right:0.75rem"},Eb=function(e){var n,r=zl(),o=r.mode,a=r.queryEngineConfig,l=e.dataSet,s=t.useState(e.defaultOpen||!1),u=s[0],d=s[1],p=function(e,t){var n=e.flatMap((function(e){return e.map((function(e){return Rn(t,e.field).publicName}))}));return i.uniq(n)}(e.attributes.filter,l),f=i.isEmpty(e.attributes.filter)?[]:[{title:Xe(e.attributes.filter.length,"condition","conditions"),subtext:(n=p.length,(1==n?"On the field":"Across fields")+" "+Qe(p)+"."),onClick:function(){return d(!0)}}],m={callToAction:"Add filter",onClick:function(){d(!0)}},h=Xg(e.attributes.filter,l),v=h.completedFilters,g=h.addOrFilter,b=h.wipFilters,x=h.updateWipFilter,y=h.deleteWipFilter;return c.jsxs(c.Fragment,{children:[c.jsx(Sp,{mode:o,newItemBtn:i.isEmpty(f)?m:void 0,onDeleteItem:function(){e.setPartialAttributes({filter:[]})},items:f}),c.jsxs(Df,{width:"4xl",isOpen:u,onClose:function(){return d(!1)},children:[c.jsx(Df.Header,{title:"Advanced Filters"}),c.jsx(Df.Content,{children:c.jsx(Hg,{queryEngineConfig:a,updateWipFilter:x,deleteWipFilter:y,wipFilters:b,completedFilters:v,dataSet:l})}),c.jsx(Df.Footer,{children:c.jsxs("div",{css:Db,children:[c.jsx("div",{css:Ib,children:c.jsx(Pp,{testId:"add-rule-btn",secondary:!0,onClick:function(){g()},children:0==v.length?"Add filter":'Add "OR"'})}),c.jsx("div",{children:c.jsxs("div",{css:Pb,children:[c.jsx("span",{css:_b,children:c.jsx(Pp,{secondary:!0,onClick:function(){d(!1)},children:"Cancel"})}),c.jsx(Pp,{testId:"save-filter-btn",onClick:function(){e.setPartialAttributes({filter:v}),d(!1)},children:"Save"})]})})]})})]})]})},Ob={name:"12vm4ss",styles:"margin-left:0.75rem;opacity:0.4;:hover{opacity:0.8;}"},Lb=function(e){return c.jsxs("div",{children:[c.jsxs("div",{children:[c.jsx(kc,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),e.secondaryAction&&c.jsx("span",{css:Ob,children:c.jsx("button",{onClick:function(){var t;return null==(t=e.secondaryAction)?void 0:t.onClick()},children:e.secondaryAction.label})})]}),c.jsx(tp,{id:null==e?void 0:e.id,type:"number",min:e.min,max:e.max,onChange:function(t){e.setNumber(parseFloat(t.target.value))},defaultValue:e.currentValue||void 0,"data-testid":e.testId})]})},Mb=function(e){var t=e.component,n=e.definedMetric,r=e.measure,i=lt(n),o=Rn(null==e?void 0:e.dataSet,n.field),a=zl().queryEngineConfig;return c.jsxs(Wd,{direction:"column",gap:"0.5rem",children:[c.jsx(kc,{as:"p",margin:0,children:c.jsxs(Wd,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(rc,{icon:o.dataType})," ",c.jsxs("span",{children:[o.publicName," (",n.function,")"]})]})}),c.jsx(vg,U({},e,{attributes:{measure:r?r[i]:[]},dataSet:null==e?void 0:e.dataSet,componentType:t.attributes.type,allowsMultiple:!0,onNewMeasureFilterAggregate:Nb(e.definedMetrics,a),setPartialAttributes:function(t){var n;e.setAttributes(((n={})[i]=t.measure,n))},supportedAggregates:a.supportedAggregates,id:"metric-input",propKey:"measure",filterOptions:function(t){return Rb(t,null==e?void 0:e.definedMetrics)},label:"Add alternative metric"}))]})},Rb=function(e,t){return e.map((function(e){var n=t.filter((function(t){return t.field===e.value})),r=e.select.options.filter((function(e){return!n.map((function(e){return e.function})).includes(e.value)})),i=e.select.selected;return r.some((function(e){return e.value===i}))||(i=r.length>0?r[0].value:null),U({},e,{select:U({},e.select,{options:r,selected:i})})}))};function Nb(e,t){return function(n){var r=e.filter((function(e){return e.field===n.id})),i=U({},t.supportedAggregates);return r.forEach((function(e){delete i[e.function]})),i}}var zb=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},Bb=function(e,t,n){var r=nt(t,n);return e.filter((function(e){return e.field===(null==r?void 0:r.field)&&e.function===r.function}))[0]},qb=function(e){var t=e.group,n=e.definedDimension,r=zb(n),i=Rn(null==e?void 0:e.dataSet,n.field),o=t?t[r]:null,a=zl().queryEngineConfig;return c.jsxs(Wd,{direction:"column",gap:"0.5rem",children:[c.jsx(kc,{as:"p",margin:0,children:c.jsxs(Wd,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(rc,{icon:i.dataType})," ",c.jsx("span",{children:i.publicName})]})}),c.jsx(fg,U({},e,{allowsMultiple:!0,attributes:{dimension:o||void 0},setPartialAttributes:function(t){var n,i;e.setAttributes(((i={})[r]=null!=(n=t.dimension)?n:[],i))},supportedTransformationFunctions:a.supportedTransformationFunctions,filterOptions:function(e){return e},label:"Add alternative group"}))]})},Vb=function(e){var t=e.group,n=e.definedDimension,r=_e(n),i=Rn(null==e?void 0:e.dataSet,null==e?void 0:e.definedDimension.field),o=zl().queryEngineConfig,a=t?t[r]:null;return c.jsxs(Wd,{direction:"column",gap:"0.5rem",children:[c.jsx(kc,{as:"p",margin:0,children:c.jsxs(Wd,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(rc,{icon:i.dataType})," ",c.jsxs("span",{children:[i.publicName," (",n.truncate,")"]})]})}),c.jsx(mg,U({},e,{attributes:{timeDimensions:a||null},supportedTimeDimensions:o.supportedTimeTruncFunctions,setPartialAttributes:function(t){var n;t.timeDimensions&&e.setAttributes(((n={})[r]=t.timeDimensions,n))},onNewMeasureFilterTruncFunctions:function(t){var r=U({},o.supportedTimeTruncFunctions);return t.id===(null==e?void 0:e.definedDimension.field)&&delete r[n.truncate],r},label:"Add alternative time group"}))]})},Hb=function(e){var t=(null==e?void 0:e.component).attributes,n=zl().featureToggles,r=zc().dispatch;return 0==function(e,t){var n=[],r=On(t);return e.parameters&&r.supportedFeatures.parameters?n.push({title:"Parameter",subtext:"Set customisable Parameters on Views"}):(e.parameters||Nr("Parameters not made available, because of a feature toggle."),r.supportedFeatures.parameters||Nr("Parameters not made available, because it is not supported for the view "+r.title+".")),n}(n,t.type).length?null:null!=e&&e.show?c.jsx(Wb,U({},e,{onAddingParameters:function(n){var i=U({},t,{parameters:n});"parameters"in t&&void 0!==e.cellIndex&&void 0!==e.rowIndex&&r({type:"setAttributes",attributes:i,cellIndex:e.cellIndex,rowIndex:e.rowIndex}),"parameters"in t&&void 0!==e.libraryIndex&&r({type:"updateComponentLibraryAttributes",attributes:i,libraryIndex:null==e?void 0:e.libraryIndex}),null==e||e.onClose()}})):null},Wb=function(e){var n=(null==e?void 0:e.component).attributes,r=zc(),i=Ur(r.dashboard,e.component.attributes.dataSetId);if(!i)return null;var a=function(e,n,r){var i=zl().queryEngineConfig,a=t.useState($v),l=a[0],s=a[1],u=function(){s($v)},d="parameters"in e?e.parameters:void 0;t.useEffect((function(){d?s(d):u()}),[JSON.stringify(d)]);var c,p,f,m,h,v,g,b,x,y,w,C="measure"in e&&"parameters"in e&&o.isEmpty(null==(c=e.parameters)?void 0:c.measure)?e.measure:"parameters"in e&&!o.isEmpty(null==(p=e.parameters)?void 0:p.measure)&&null!=(f=e.parameters)&&f.measure?function(e,t,n){return t.map((function(t){var r,i=Object.keys(null!=(r=null==n?void 0:n.measure)?r:{}).find((function(e){var r,i;return(null!=(r=null==n||null==(i=n.measure)?void 0:i[e])?r:[]).some((function(e){return e.field===t.field&&e.function===t.function}))}));return i?st(i,{supportedAggregates:e,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}):t}))}(i.supportedAggregates,e.measure,e.parameters):[],j="dimension"in e&&"parameters"in e&&o.isEmpty(null==(v=e.parameters)?void 0:v.group)?e.dimension:"dimension"in e&&"parameters"in e&&!o.isEmpty(null==(g=e.parameters)?void 0:g.group)&&null!=(b=e.parameters)&&b.group?(h=e.parameters,(m=e.dimension)?null==m?void 0:m.map((function(e){var t,n=Object.keys(null!=(t=null==h?void 0:h.group)?t:{}).find((function(t){var n,r;return(null!=(n=null==h||null==(r=h.group)?void 0:r[t])?n:[]).some((function(t){return(null==t?void 0:t.field)===e.field&&"function"in t&&t.function===("function"in e&&e.function)}))}));return n?{field:n,function:"none"}:e})):[]):[],F="timeDimension"in e&&e.timeDimension&&"parameters"in e&&o.isEmpty(null==(x=e.parameters)?void 0:x.group)?e.timeDimension:"timeDimension"in e&&"parameters"in e&&!o.isEmpty(null==(y=e.parameters)?void 0:y.group)&&null!=(w=e.parameters)&&w.group?function(e,t,n){var r,i=Object.keys(null!=(r=null==n?void 0:n.group)?r:{}).find((function(e){var r,i;return(null!=(r=null==n||null==(i=n.group)?void 0:i[e])?r:[]).some((function(e){if(e)return e.field===(null==t?void 0:t.field)&&("truncate"in e&&e.truncate)===t.truncate}))}));if(i){var o=Ee(i,e);return null!=o?o:t}return t}(i.supportedTimeTruncFunctions,e.timeDimension,e.parameters):void 0;return U({},l,{definedMetrics:C,definedDimensions:j,definedTimeDimension:F,onChange:function(t){if("measure"in t&&t.measure){var n=function(e,t){var n=Object.keys(t)[0];e.measure||(e.measure={});var r=U({},e.measure),i=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete r[n],i=n):r[n]=t[n],{updatedMetrics:U({},e,{measure:r}),metricKeyToDelete:i}}(U({},l),t.measure),o=n.updatedMetrics,a=n.metricKeyToDelete;a&&function(t){if("measure"in e&&t&&l.measure){var n=st(t,i),o=function(e,t,n,r){var i,o=null==(i=r[e])?void 0:i[0];if(!o)return t;var a=t.findIndex((function(e){return e.field===o.field&&e.function===o.function}));return-1!==a&&n&&(t[a]=n),t}(t,e.measure,n,l.measure);r({updatedMeasures:o})}}(a),s(o)}if("group"in t&&t.group){var u=function(e,t){var n=Object.keys(t)[0];e.group||(e.group={});var r=U({},e.group),i=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete r[n],i=n):r[n]=t[n],{updatedMetrics:U({},e,{group:r}),metricKeyToDelete:i}}(U({},l),t.group),d=u.updatedMetrics,c=u.metricKeyToDelete;c&&function(t){if("parameters"in e&&t&&l.group){var n=Ee(t,i.supportedTimeTruncFunctions);n&&r({updatedTimeDimension:n}),"dimension"in e&&!n&&r({updatedDimension:tg(t,e.dimension,l.group)})}}(c),s(d)}},handleUpsert:function(){n(l)},reset:u,disabled:eg(l,d)})}(n,null==e?void 0:e.onAddingParameters,e.setParameterUpdate),l=a.definedMetrics,s=a.onChange,u=a.measure,d=a.handleUpsert,p=a.definedDimensions,f=a.definedTimeDimension,m=a.group;return c.jsxs(Df,{width:"xl","data-testid":"parameters-modal",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(Df.Header,{title:"Add Parameters",show:!0,tooltip:"Set alternate metrics and groups for the view. "}),c.jsx(Df.Content,{children:c.jsx(Wd,{width:"100%",children:c.jsx(Md,{flex:1,children:c.jsxs(Ef.Group,{defaultIndex:0,children:[(f||0!==p.length)&&c.jsxs(Ef.List,{columns:"1fr 1fr",padding:0,children:[c.jsx(Ef.Button,{children:"Metrics"}),c.jsx(Ef.Button,{children:"Groups"})]}),c.jsxs(Ef.Panels,{children:[c.jsxs(Ef.Panel,{paddingLeft:0,paddingRight:0,children:[c.jsx(vf,{marginBottom:2,children:"Current active metrics"}),c.jsx(Wd,{direction:"column",gap:"1.5rem",children:null==l?void 0:l.map((function(t){return c.jsx(Mb,{component:null==e?void 0:e.component,definedMetric:t,definedMetrics:l,dataSet:i,setAttributes:function(e){return s({measure:e})},measure:u},t.field+"-"+t.function)}))})]}),c.jsxs(Ef.Panel,{paddingLeft:0,paddingRight:0,children:[c.jsx(vf,{marginBottom:2,children:"Current active groups"}),c.jsxs(Wd,{direction:"column",gap:"1.5rem",children:[p.map((function(t){return c.jsx(qb,{setAttributes:function(e){return s({group:e})},component:null==e?void 0:e.component,definedDimension:t,dataSet:i,group:m},""+t.field)})),f&&c.jsx(Vb,{definedDimension:f,setAttributes:function(e){return s({group:e})},dataSet:i,group:m})]})]})]})]})})})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Dp,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Close"}),c.jsx(Dp,{onClick:function(){return d()},primary:!0,children:"Update"})]})})]})},Yb=function(e){return{renderCloseIcon:e.renderCloseIcon||null,renderDeleteIcon:e.renderDeleteIcon||null,renderFilterIcon:e.renderFilterIcon||null,renderParametersIcon:e.renderParametersIcon||null,renderLoadingComponent:e.renderLoadingComponent||null,renderDownloadIcon:e.renderDownloadIcon||null,renderEditIcon:e.renderEditIcon||null,renderComponentOptionsMenuIcon:e.renderComponentOptionsMenuIcon||null,renderLockedIcon:e.renderLockedIcon||null,renderLibraryIcon:e.renderLibraryIcon||null,renderAccordionIcon:e.renderAccordionIcon||null,renderButtonComponent:e.renderButtonComponent||null,renderSelectComponent:e.renderSelectComponent||null,renderDateTimeInput:e.renderDateTimeInput||null,renderReportIcon:e.renderReportIcon||null}},Ub=function(e){var t=zl().customComponents,n=null;try{n=function(e,t){var n=e.find((function(e){return e.id==t}));if(!n)throw"Failed to find custom component.";return n}(t,e.component.attributes.id)}catch(e){return c.jsx(df,{})}return c.jsx(n.Component,{})},Gb=t.memo((function(e){var n,r,i,o,a=e.displayTitle,l=e.displaySubject,u=Vh({title:a,subject:l}),d=us(),p={displayTitle:a,displaySubject:l,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,dataSet:e.dataSet,componentType:null==e?void 0:e.type};if(!On(e.type).isRunnable(e))return c.jsx(sf,{title:"Missing parameters"});if(Ho(e.lineResult)||Ho(e.barResult))return c.jsx(fc,{});if(Wo(e.lineResult)&&Wo(e.barResult))return c.jsx(uf,{});var f,m,h=qh({dimension:e.barDimension,timeDimension:e.timeDimension}),v=e.barResult?Bo(h,e.barMeasure,e.barResult):[],g=e.barResult?zo(e.barResult,e.barMeasure,h,"100%"==e.stacked):[],b=qh({dimension:e.lineDimension,timeDimension:e.timeDimension}),x=e.lineResult?Bo(b,e.lineMeasure,e.lineResult):[],y=e.lineResult?zo(e.lineResult,e.lineMeasure,b,"100%"==e.stacked):[];return c.jsx(t.Suspense,{fallback:c.jsx(fc,{}),children:c.jsxs(kp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Bm,U({},p)),c.jsx(za,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:c.jsx(xv,{ref:u,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,formatYAxisLabel:ia({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:ra(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),forceXAxisAsTime:!!e.timeDimension,legend:Hh(null==e?void 0:e.legend,"verbose"===(null==d?void 0:d.detail)),x:"x",bars:{colors:er(null!=(i=null==d?void 0:d.colors)?i:ga.colors,v.length),data:g,annotate:[],stacked:!!e.stacked,keys:v,formatter:function(t,n){if(e.conditionalFormattingRules&&e.conditionalFormattingRules.bar){var r=na(e.barDimension,e.conditionalFormattingRules.bar,t,n,null==e?void 0:e.dataSet);return r?r.ruleValue:void 0}}},lines:{colors:(f=er(null!=(o=null==d?void 0:d.colors)?o:ga.colors,x.length),void 0===m&&(m=1),[].concat(f).map((function(e){return function(e,t,n){return s(e).darken(t).hex()}(e,m)}))),data:y,annotate:[],keys:x},removeStroke:!1,theme:ms(null==d?void 0:d.charts),formatSeriesName:function(t){var n=e.barResult&&oa(e.barResult)(t),r=e.lineResult&&oa(e.lineResult)(t);return n||r||""},sparkline:e.sm,onClick:function(){},goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles})})]})})}),$o),Kb=function(e){var t=e.component,n=t.results,r=t.attributes,i=t.localFilters,o=zc().dashboard,a=Kh(r,e.runQueriesCallback,e.setResults,{localFilters:i,globalFilters:e.globalFilters},e.dataSet);return c.jsx(Gb,U({id:e.id},r,{dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,lineResult:n[0],barResult:n[1],queriesAreChanging:a.queriesAreChanging,setParameterUpdate:function(){},supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,dashboard:o,sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,goalLines:null==e?void 0:e.component.attributes.goalLines}))},Xb=function(e){var n,r=e.result,i=e.minValueColor,o=e.maxValueColor,a=e.noDataColor,l={displayTitle:e.displayTitle,displaySubject:e.displaySubject,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,library:null!=(n=null==e?void 0:e.library)&&n,verified:null==e?void 0:e.protectedByOrganisation,dataSet:e.dataSet,componentType:null==e?void 0:e.type},s=Vh({title:e.displayTitle,subject:e.displaySubject});if(!On("mercatorMap").isRunnable(e))return c.jsx(sf,{title:"Missing parameters"});if(Ho(r))return c.jsx(fc,{});if(Wo(r))return c.jsx(uf,{});var u={};if(r){var d=e.dimension[0].field,p=e.measure[0],f=r.fields.findIndex((function(e){return e.id==d})),m=r.fields.findIndex((function(e){return e.id==lt(p)}));r.content.forEach((function(e){u[e[f]]=e[m]}))}var h=$n([i,o],((null==r?void 0:r.content.length)||100)/4);return c.jsx(t.Suspense,{fallback:c.jsx(fc,{}),children:c.jsxs(kp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Bm,U({},l)),c.jsx(Iv,{ref:s,formatValue:function(t){return aa(Po(t,2),e.numberFormatOptions,e.labelFormat)},topology:"worldCountries",data:u,background:e.backgroundColor,colorRange:h,missingDataColor:a,position:e.position,onPositionChange:e.onPositionChange})]})})},Qb=function(e){var t=e.component,n=t.results,r=t.attributes,i=Kh(r,e.runQueriesCallback,e.setResults,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(Xb,U({},r,{id:e.id,result:n[0],queriesAreChanging:i.queriesAreChanging,dataSet:e.dataSet,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTransformationFunctions,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:function(){},onPositionChange:e.onPositionChange,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions}))},Jb=Object.assign((function(){return null}),{pill:ua({padding:"4px 10px",borderRadius:"5px",fontSize:"12px",display:"flex",alignItems:"center",rowGap:"0.5rem",variants:{positive:{yes:{color:"rgb(4, 120, 87)",background:"#D1FAE5"},no:{color:"rgb(190, 18, 60)",background:"#FFE4E6"}}}})}),Zb=function(e){var n,r=e.result;if(!r||0===r.content.length||1===r.content.length)return null;var i,o,a=r.content[r.content.length-2][e.index],l=r.content[r.content.length-1][e.index],s=(i=a,0!==(o=l)?0!==i?(o-i)/i*100:100*o:100*-i),u=Jb.pill({positive:s>=0?"yes":"no"}),d=t.useState(!0),f=d[0],m=d[1],h=-1*(a-l);return c.jsxs(os,{gap:"0.15rem",children:[c.jsxs(Md,{as:"p",className:rs(""+Ea.textSize("xs"),""+Ea.opacity(.7)),margin:0,children:["Current ",null==e||null==(n=e.deltaTimeDimension)?void 0:n.truncate]}),c.jsxs(Wd,{gap:"1rem",alignItems:"center",children:[c.jsx("div",{children:c.jsx(Md,{as:"p",margin:0,children:c.jsx(rx,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:l,measure:null==e?void 0:e.measure})})}),c.jsx(Wd,{alignSelf:"flex-end",gap:"0.5rem",children:c.jsx(dp,{tooltipContent:function(){var t;return c.jsxs(dp.Content,{children:["Previous ",null==e||null==(t=e.deltaTimeDimension)?void 0:t.truncate,":"," ",c.jsx(rx,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:a,measure:null==e?void 0:e.measure})]})},children:c.jsxs("button",{onClick:function(){return m(!f)},className:rs(u,""+Ea.bw(0)),children:[f?Po(s,2)+"%":c.jsx(rx,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:h,measure:null==e?void 0:e.measure}),c.jsx("svg",{className:p.css([{height:"1rem",width:"1rem"},s>=0?{"--tw-rotate":"-45deg",transform:"translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))"}:{"--tw-rotate":"45deg",transform:"translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))"}],"",""),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12h15m0 0l-6.75-6.75M19.5 12l-6.75 6.75"})})]})})})]})]})},$b=function(e){var t=null==e?void 0:e.results.some((function(e){return Array.isArray(null==e?void 0:e.content)&&(null==e?void 0:e.content)&&e.content.length>1}));return null!==e.deltaTimeDimension&&!1===t?c.jsxs("p",{className:rs(""+Ea.textSize("xs"),""+Ea.opacity(.5)),children:["No data available for ",null==e?void 0:e.deltaTimeDimension.truncate," comparison"]}):null===(null==e?void 0:e.deltaTimeDimension)||!1===t?null:c.jsxs(Md,{margin:0,className:rs(""+Ea.textSize("xs"),""+Ea.opacity(.5)),children:["Comparing ",null==e?void 0:e.deltaTimeDimension.truncate," over ",null==e?void 0:e.deltaTimeDimension.truncate]})},ex=function(){var e=t.useRef(null),n=t.useState(0),r=n[0],i=n[1];return t.useEffect((function(){i(e.current?e.current.clientWidth:0),window.addEventListener("resize",(function(){i(e.current?e.current.offsetWidth:0)}))})),[e,r]},tx={name:"n294es",styles:"position:relative;display:flex;padding-top:0.25rem;text-align:left;font-size:3rem;line-height:1;font-weight:600;letter-spacing:0.1em"},nx=function(e){var n,r=e.results[0],o=e.results[1],a=t.useState(null),l=a[0],s=a[1];if(t.useEffect((function(){if(r&&e.measure){var t=qo(r,lt(e.measure));-1!==t&&s(t)}}),[r,e.measure]),null===l)return null;var u=null==r?void 0:r.content[0][l],d=function(e,t){var n={};return t.forEach((function(t){if("fontColor"==t.ruleType&&Xo({op:t.operator,value:t.value},e))return n.color=t.ruleValue})),n}(u,i.filter(e.conditionalFormattingRules,(function(t){return t.field==lt(e.measure)})));return c.jsxs("div",{children:[c.jsx("div",{children:e.showAggregateText&&c.jsxs("span",{className:""+Ea.textSize("sm"),children:[null==r||null==(n=r.fields[l])?void 0:n.publicName," (",e.supportedAggregates[e.measure.function].publicName.toLowerCase(),")"]})}),c.jsxs(Wd,{gap:"0.5rem",direction:"column",children:[c.jsx(Md,{children:c.jsx("p",{style:U({},d,{fontSize:e.fontSize}),css:tx,className:""+Ea.text,children:c.jsx(rx,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,measure:null==e?void 0:e.measure,value:u})})}),c.jsx(Zb,{index:l,result:o,deltaTimeDimension:null==e?void 0:e.deltaTimeDimension,formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,measure:null==e?void 0:e.measure})]})]})},rx=function(e){var n=e.formatter[lt(e.measure)]||"_vizzly_to_2_dp",r=e.prefixes[lt(e.measure)]||"",i=e.postfixes[lt(e.measure)]||"",o=zl().numberFormatOptions[n].formatter(null==e?void 0:e.value);return"No value"===o?c.jsx(t.Fragment,{children:o}):c.jsxs(t.Fragment,{children:[r,o,i]})},ix={type:"singleStat",prefixes:{},postfixes:{},fontSize:"30px",measure:[],displayTitle:"",displaySubject:"",formatter:{},filter:[],limit:500,conditionalFormattingRules:[],deltaTimeDimension:null},ox=function(e){var n,r,i,o,a,l,s,u,d,p={displayTitle:e.displayTitle,displaySubject:e.displaySubject,verified:e.protectedByOrganisation,library:null!=(n=e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:e.dataSet,componentType:null==(r=e)?void 0:r.type,parameters:null==(i=e)?void 0:i.parameters,measure:null==(o=e)?void 0:o.measure},f=ex(),m=f[0],h=f[1],v=ex(),g=v[0],b=v[1];if(!On(e.type).isRunnable(e))return c.jsx(sf,{title:"Missing parameters",children:cv({measure:e.measure,order:[],dimension:[]})});var x=e.results[0];if(Ho(x))return c.jsx(fc,{});if(Wo(x))return c.jsx(uf,{});if(Yo(x))return c.jsx(cf,U({},p));var y=h>380,w=(e=Zo(e,{},ix)).measure.length,C=80*(w-1)+b*w<h-32;return c.jsxs(kp,{queriesAreChanging:e.queriesAreChanging,overflowScroll:!0,children:[c.jsx(Bm,U({},p)),w>1?c.jsxs(t.Fragment,{children:[c.jsx("div",{css:y?[{height:"100%",width:"100%"}]:[{width:"100%"}],ref:m,children:c.jsx(Wd,{direction:y?"row":"column",height:"100%",gap:y?80:"2rem","data-component":"stat-container",alignItems:y?"center":void 0,justifyContent:y&&C?"center":void 0,children:[].concat(e.measure).map((function(t,n){var r;return c.jsx("div",{ref:g,children:c.jsx(nx,{index:n,showAggregateText:w>1,supportedAggregates:e.supportedAggregates,measure:t,prefixes:e.prefixes,postfixes:e.postfixes,fontSize:e.fontSize,formatter:e.formatter,conditionalFormattingRules:e.conditionalFormattingRules,results:e.results,deltaTimeDimension:null==(r=e)?void 0:r.deltaTimeDimension})},n)}))})}),c.jsx(Md,{marginTop:"2rem",children:c.jsx($b,{deltaTimeDimension:null==(a=e)?void 0:a.deltaTimeDimension,results:null==(l=e)?void 0:l.results})})]}):c.jsxs(os,{placeContent:"center","data-component":"stat-container",height:"100%",children:[c.jsx(nx,{index:1,showAggregateText:w>1,supportedAggregates:e.supportedAggregates,measure:e.measure[0],prefixes:e.prefixes,postfixes:e.postfixes,fontSize:e.fontSize,formatter:e.formatter,conditionalFormattingRules:e.conditionalFormattingRules,results:e.results,deltaTimeDimension:null==(s=e)?void 0:s.deltaTimeDimension},1),c.jsx(Md,{marginTop:"1rem",children:c.jsx($b,{deltaTimeDimension:null==(u=e)?void 0:u.deltaTimeDimension,results:null==(d=e)?void 0:d.results})})]})]})};ox.defaultProps=ix;var ax=function(e){var t,n,r=e.component,i=r.results,o=r.attributes,a=Kh(o,e.runQueriesCallback,e.setResults,{localFilters:r.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(ox,U({},o,{id:e.id,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,results:i,queriesAreChanging:a.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(n=t.queryEngineConfig)?void 0:n.supportedTransformationFunctions,library:null==e?void 0:e.library}))};function lx(e){return e>0}function sx(e){return e.total>=e.limit}var ux=ua(U({minWidth:"100%",overflow:"overlay"},Yd)),dx=Object.assign((function(){return null}),{table:ua({textIndent:"0",borderColor:"inherit",borderCollapse:"collapse",tableLayout:"fixed"}),wrapper:ux,th:function(e){var t,n,r,i,a,l,s=o.merge({},null==(t=ga.tables)?void 0:t.th,e);return ua({padding:s.padding,display:"table-cell",position:"relative",fontSize:null==s?void 0:s.fontSize,fontWeight:null==s?void 0:s.fontWeight,background:null==s?void 0:s.background,color:null==s?void 0:s.color,whiteSpace:"nowrap",textAlign:"left",borderTop:s.borderTop,borderRight:s.borderRight,borderBottom:s.borderBottom,variants:{first:{true:{borderLeft:null==(n=s.first)?void 0:n.borderLeft}},last:{true:{borderRight:null==(r=s.last)?void 0:r.borderRight}},rowScope:{true:{background:null==(i=s.column)?void 0:i.background}},hover:{true:{"&:hover":{color:null==s||null==(a=s["&:hover"])?void 0:a.color,background:null==s||null==(l=s["&:hover"])?void 0:l.background}}}}})},td:function(e){var t,n,r,i,a,l,s,u,d,c,p,f,m=o.merge({},ga.tables,e);return ua({verticalAlign:"top",overflow:"hidden",position:"relative",whiteSpace:"nowrap",borderLeft:null==(t=m.body)||null==(n=t.cells)?void 0:n.borderLeft,borderRight:null==(r=m.body)||null==(i=r.cells)?void 0:i.borderRight,borderBottom:null==(a=m.body)||null==(l=a.cells)?void 0:l.borderBottom,fontSize:null==(s=m.body)||null==(u=s.cells)?void 0:u.fontSize,padding:null==m||null==(d=m.body)||null==(c=d.cells)?void 0:c.padding,variants:{first:{true:{borderLeft:null==(p=m.body)?void 0:p.borderLeft}},last:{true:{borderRight:null==(f=m.body)?void 0:f.borderRight}},align:{alignLeft:{textAlign:"left"},alignRight:{textAlign:"right"}}}})},tr:function(e){var t,n,r,i,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,C=o.merge({},ga.tables,e);return ua({position:"relative",cursor:"default",variants:{even:{true:{background:null==(t=C.body)||null==(n=t.even)?void 0:n.background,color:null==(r=C.body)||null==(i=r.even)?void 0:i.color,"&:hover":{background:null==(a=C.body)||null==(l=a.even)||null==(s=l["&:hover"])?void 0:s.background,color:null==(u=C.body)||null==(d=u.even)||null==(c=d["&:hover"])?void 0:c.color}}},odd:{true:{background:null==(p=C.body)||null==(f=p.odd)?void 0:f.background,color:null==(m=C.body)||null==(h=m.odd)?void 0:h.color,"&:hover":{background:null==(v=C.body)||null==(g=v.odd)||null==(b=g["&:hover"])?void 0:b.background,color:null==(x=C.body)||null==(y=x.odd)||null==(w=y["&:hover"])?void 0:w.color}}}}})},showMoreButton:function(e){var t,n,r=o.merge({},null==(t=ga.tables)?void 0:t.body,e);return ua(U({color:null==r||null==(n=r.odd)?void 0:n.color,background:"transparent",padding:"0 4px 0 4px",minWidth:20,fontSize:"100%",border:0,fontWeight:300,alignSelf:"flex-end",position:"absolute",right:0,top:"40%",marginBottom:1},sa,{"&:hover":U({},sa,{opacity:.5}),"> svg":{marginTop:-2},"> span":{height:10,lineHeight:"1px",display:"block"}}))},tdContentWrapper:function(e){return ua({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"clip","> span":{fontSize:null!=e?e:"inherit"}})},thInner:function(e){var t,n,r,i=o.merge({},null==(t=ga.tables)?void 0:t.th,e);return ua({position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:null==i||null==(n=i.inner)?void 0:n.padding,borderBottomWidth:null==i||null==(r=i.inner)?void 0:r.borderBottomWidth})},thLabel:function(e){var t,n=o.merge({},null==(t=ga.tables)?void 0:t.th,e);return ua({textTransform:null==n?void 0:n.textTransform})},thButton:function(e){var t;return o.merge({},null==(t=ga.tables)?void 0:t.th,e),ua({marginTop:1,WebkitLineClamp:1,width:"calc(100% - 20px)",textTransform:"inherit",fontWeight:"inherit"})},thGroupRow:function(e){var t,n,r,i,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,C,j,F,S,k,T,A=o.merge({},ga.tables,e);return ua(U({display:"table-cell",position:"relative",fontWeight:null==A||null==(t=A.th)||null==(n=t.group)?void 0:n.fontWeight,fontSize:null==A||null==(r=A.th)||null==(i=r.group)?void 0:i.fontSize,background:null==A||null==(a=A.th)||null==(l=a.column)?void 0:l.background,textTransform:null==(s=A.th)||null==(u=s.group)?void 0:u.textTransform,color:null==A||null==(d=A.th)||null==(c=d.column)?void 0:c.color,whiteSpace:"nowrap",textAlign:"left",borderRight:null==(p=A.th)||null==(f=p.column)?void 0:f.borderRight,borderLeft:null==(m=A.th)||null==(h=m.column)?void 0:h.borderLeft,borderBottom:null==(v=A.body)||null==(g=v.cells)?void 0:g.borderBottom,padding:null==(b=A.th)||null==(x=b.column)?void 0:x.padding},sa,{variants:{first:{true:{borderLeft:null==(y=A.body)?void 0:y.borderLeft}},last:{true:{borderRight:null==(w=A.body)?void 0:w.borderRight}},deadSpace:{true:{borderBottom:null==(C=A.th)||null==(j=C.row)?void 0:j.borderBottom,borderRight:0,borderLeft:null==(F=A.th)||null==(S=F.column)?void 0:S.borderLeft}},level:{2:{background:null==(k=A.th)||null==(T=k.level)?void 0:T[2].background}}}}))},thGroupColumn:function(e){var t,n,r,i,a,l,s,u,d,c,p=o.merge({},null==(t=ga.tables)?void 0:t.th,e);return ua(U({display:"table-cell",position:"relative",fontWeight:null==(n=p.group)?void 0:n.fontWeight,fontSize:null==(r=p.group)?void 0:r.fontSize,textTransform:null==(i=p.group)?void 0:i.textTransform,background:null==p?void 0:p.background,color:null==p?void 0:p.color,whiteSpace:"nowrap",textAlign:"left",borderTop:p.borderTop,borderRight:p.borderRight,borderLeft:p.borderRight,borderBottom:null==(a=p.row)?void 0:a.borderBottom,padding:null==(l=p.row)?void 0:l.padding},sa,{variants:{first:{true:{borderLeft:null==(s=p.first)?void 0:s.borderLeft}},last:{true:{borderRight:null==(u=p.last)?void 0:u.borderRight}},hover:{true:{"&:hover":U({},sa,{color:null==p||null==(d=p["&:hover"])?void 0:d.color,background:null==p||null==(c=p["&:hover"])?void 0:c.background})}}}}))}}),cx=ua({textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}),px=function(e){var n=e.columnIndex,r=e.type,i=e.fieldKey,o=e.onResized,a=e.width,l=t.useState(!1),s=l[0],u=l[1],d=b.useDrag({type:r,item:{columnIndex:n,fieldKey:i,width:a},collect:function(e){return{isDragging:e.isDragging()}},end:function(e,t){var n=t.getDifferenceFromInitialOffset();n&&o({columnIndex:e.columnIndex,fieldKey:i,width:e.width+n.x})}}),p=d[0],f=d[1],m=d[2];return t.useEffect((function(){if(m){var e=new Image;e.src=function(e,t){var n=document.createElement("canvas");n.width=1,n.height=1;var r=n.getContext("2d");return r&&(r.fillStyle="transparent",r.fillRect(0,0,1,1)),n.toDataURL()}(),e.onload=function(){return m(e)}}}),[m]),c.jsx("div",{className:""+fx,ref:f,onMouseEnter:function(){return u(!0)},onMouseLeave:function(){return u(!1)},children:c.jsx("span",{className:""+mx({onHover:p.isDragging||s?"true":"false"})})})},fx=ua({position:"absolute",right:-8,top:0,bottom:0,width:16,zIndex:1,cursor:"ew-resize"}),mx=ua({position:"absolute",top:4,bottom:4,right:6,transitionDuration:"100ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",borderRightWidth:3,borderRightStyle:"solid",variants:{onHover:{true:{borderRightColor:ha.colors.blue},false:{borderRightColor:"transparent"}}}}),hx=t.forwardRef((function(e,t){return c.jsx("div",{ref:t,className:"vizzly-data-table "+dx.wrapper,children:c.jsx("table",{className:""+dx.table,children:e.children})})})),vx={name:"1pghby6",styles:"position:relative;box-sizing:border-box"},gx=t.forwardRef((function(e,n){var r,i,o,a,l=e.clickEnabled,s=us(),u={first:e.first&&"true",last:e.last&&"true",hover:e.hover&&"true",level:null==e?void 0:e.level},d=t.useMemo((function(){return null!=e&&e.deadSpace||"row"===(null==e?void 0:e.scope)?"tables.th.column":null!=e&&e.group?"tables.th.row":e.level?"tables.th.level."+e.level:"tables.th"}),[null==e?void 0:e.deadSpace,null==e?void 0:e.scope,null==e?void 0:e.group]);return c.jsxs("th",{scope:null!=(r=null==e?void 0:e.scope)?r:"column",className:rs(null!=e&&e.group?"row"===(null==e?void 0:e.scope)?""+dx.thGroupRow(null==s?void 0:s.tables)(U({},u,{deadSpace:(null==e?void 0:e.deadSpace)&&"true"})):""+dx.thGroupColumn(null==s||null==(o=s.tables)?void 0:o.th)(u):""+dx.th(null==s||null==(i=s.tables)?void 0:i.th)(U({},u,{rowScope:"row"===(null==e?void 0:e.scope)&&"true"}))),style:e.cellStyles,"data-themeapi":d,"data-chipposition":"top.left","data-first":e.first?"true":"false","data-last":e.last?"true":"false","data-hover":e.hover?"true":"false","data-deadspace":e.deadSpace?"true":"false",colSpan:e.colSpan,role:l?"button":void 0,tabIndex:l?0:void 0,"data-clickenabled":l?"true":"false",onClick:null==e?void 0:e.onClick,onKeyDown:function(t){null!=e&&e.onClick&&"Enter"===t.key&&(null==e||e.onClick())},children:[(null==e?void 0:e.dragSettings)&&c.jsx(px,U({},null==e?void 0:e.dragSettings)),c.jsx("div",{css:vx,style:e.columnStyles,children:c.jsx("div",{className:""+dx.thInner(null==s||null==(a=s.tables)?void 0:a.th),ref:n,"data-themeapi":"tables.th.inner",children:c.jsxs(Wd,{as:"span",overflow:"hidden",alignItems:"center",gap:"0.5rem","data-component":"th-inner",paddingLeft:null!=e&&e.level&&1!==(null==e?void 0:e.level)?20*(null==e?void 0:e.level):void 0,children:[(null==e?void 0:e.expand)&&c.jsx(yc,U({},e.expand,{label:null!=e&&e.expand.expanded?"Collapse "+(null==e?void 0:e.expand.label):"Expand "+e.expand.label,arrowStart:"side"})),e.children]})})})]})})),bx={name:"1flj9lk",styles:"text-align:left"},xx={name:"6r56vi",styles:"height:1rem;width:1rem"},yx=t.forwardRef((function(e,n){var r,i=t.useRef(null),o=e.label,a=function(e,n){var r=t.useState(!1),i=r[0],o=r[1];return t.useEffect((function(){var t,r=e.current;n&&r&&((r.offsetHeight<r.scrollHeight||r.offsetWidth<r.scrollWidth)&&o(!0),e.current&&(t=e.current).offsetWidth<t.scrollWidth&&o(!0))}),[e.current]),i}(i,o),l=t.useCallback((function(e){"function"==typeof n?n(e):null!=n&&(n.current=e),i.current=e}),[n,i]),s=us();return c.jsxs(t.Fragment,{children:[c.jsx("button",{onClick:function(){return e.onChange&&e.onChange()},css:bx,ref:l,className:rs(a?""+cx:void 0,""+Ea.button,""+dx.thButton(null==s||null==(r=s.tables)?void 0:r.th)),"data-testid":e.testIdPrefix+"-title",children:a?c.jsx(dp,{placement:"bottom-start",tooltipContent:function(){return c.jsx(dp.Content,{children:o})},className:""+cx,modifiers:[{name:"offset",options:{offset:[-50,10]}}],showTooltip:e.showTooltip,children:c.jsx(wx,{children:o})}):c.jsx(wx,{children:o})}),e.onSort&&c.jsxs("button",{type:"button",onClick:function(){return e.onSort&&e.onSort()},className:""+Ea.button,"aria-label":"Sort",css:xx,"data-testid":e.testIdPrefix+"-sort",children:[!e.direction&&c.jsx(v.SelectorIcon,{}),"asc"===e.direction&&c.jsx(v.ChevronUpIcon,{}),"desc"===e.direction&&c.jsx(v.ChevronDownIcon,{})]})]})})),wx=function(e){var t,n=us();return c.jsx("span",{className:""+dx.thLabel(null==n||null==(t=n.tables)?void 0:t.th),children:e.children})},Cx={name:"agbev0",styles:"min-width:100%;overflow:scroll;border-bottom-width:1px"},jx=Object.assign((function(){return null}),{Wrapper:hx,Head:function(e){return c.jsx("thead",{children:e.children})},Body:function(e){return c.jsx("tbody",{css:Cx,children:e.children})},TR:function(e){var t,n=us();return c.jsx("tr",{"data-themeapi":e.odd?"tables.body.odd":"tables.body.even",className:""+dx.tr(null==n?void 0:n.tables)({odd:e.odd&&"true",even:e.even&&"true"}),"data-chipposition":"top.left","aria-expanded":!0===e.expanded?"true":!1===(null==e?void 0:e.expanded)?"false":void 0,"aria-level":null!=(t=e.level)?t:void 0,children:e.children})},TD:function(e){var r,i,o,a,l,s,u=us(),d=n.useState(!1),p=d[0],f=d[1],m=e.clickEnabled,h=e.first,g=t.useRef(null);return t.useEffect((function(){var t,n,r=g.current;"number"==typeof(null==(t=e.style)?void 0:t.width)&&r&&f((null==(n=e.style)?void 0:n.width)<r.offsetWidth+16)}),[g.current,null==(r=e.style)?void 0:r.width]),c.jsxs("td",{style:U({},e.style),className:""+dx.td(null==u?void 0:u.tables)({first:e.first&&"true",last:e.last&&"true",align:null!=(i=e.align)?i:"alignRight"}),role:m?"button":void 0,tabIndex:m?0:void 0,"data-clickenabled":m?"true":"false",onClick:null==e?void 0:e.onClick,onKeyDown:function(t){null!=e&&e.onClick&&"Enter"===t.key&&(null==e||e.onClick())},"data-themeapi":"tables.body.cells","data-first":h?"true":"false","data-last":e.last?"true":"false",children:[c.jsx("div",{className:""+dx.tdContentWrapper(null==u||null==(o=u.tables)||null==(a=o.body)||null==(l=a.cells)?void 0:l.fontSize),style:function(t){var n,r,i,o="number"==typeof(null==(n=e.style)?void 0:n.width)?(null==(r=e.style)?void 0:r.width)-(t?36:16):null==(i=e.style)?void 0:i.width;return{width:o,minWidth:o}}(p),children:c.jsx("span",{ref:g,children:e.children})}),p&&c.jsx("button",{"aria-label":"string"==typeof e.children?"Show more: "+e.children:"Show more",onClick:function(){return e.onShowMore&&e.onShowMore()},className:""+dx.showMoreButton(null==u||null==(s=u.tables)?void 0:s.body),children:c.jsx(v.DotsHorizontalIcon,{})})]})},TH:gx,THButton:yx,THLabel:wx,HeadTR:function(e){return c.jsx("tr",{children:e.children})}}),Fx=Object.assign(jx.Wrapper,{Wrapper:jx.Wrapper,Head:jx.Head,Body:jx.Body,TR:jx.TR,TD:jx.TD,TH:jx.TH,THLabel:jx.THLabel,THButton:jx.THButton,HeadTR:jx.HeadTR}),Sx=function(e){return c.jsx(Wd,{direction:"column",children:null==e?void 0:e.children})};function kx(e){return null===e?"asc":"asc"===e?"desc":null}var Tx=function(e){var n=i.debounce(e.onSetExportName),r=Object.entries(e.numberFormatOptions).map((function(e){return{label:e[1].description,value:e[0]}}));return c.jsx(t.Fragment,{children:e.open&&c.jsx(Nd,{onClose:function(){return null==e?void 0:e.close()},width:220,position:null==e?void 0:e.triggerPosition,align:"right",children:c.jsxs(Nd.Options,{padding:!0,children:[c.jsx(Nd.Option,{children:c.jsx(Sx,{children:c.jsx(tp,{label:"Title",id:"table-header-title","data-testid":"table-header-title",defaultValue:e.exportName,placeholder:e.originalPublicName,onChange:function(t){n(e.fieldId,t.target.value?t.target.value:void 0)}})})}),"number"==e.dataType&&c.jsx(Nd.Option,{children:c.jsx(Sx,{children:c.jsx(Tc,{label:"Format",id:"table-header-format",testId:"table-header-format",showClearBtn:!0,selected:e.currentNumberFormat,options:r,onChange:function(t){e.onSetNumberFormat(t)}})})})]})})})},Ax=function(e){var t=e.fieldIndex,n=e.currentOrder,r=e.exportName,i=e.currentNumberFormat,o=e.fields[t],a={width:e.width,maxWidth:e.width,minWidth:e.width},l=Bd(),s=l.ref,u=l.show,d=l.position,p=l.close,f=l.open,m={fontFamily:a.fontFamily,translate:e.columnOffset+"px"};return e.isImpactedColumn&&(m.opacity=.1),c.jsxs(Fx.TH,{cellStyles:a,columnStyles:m,first:0===t,last:null==e?void 0:e.last,hover:!0,group:!1,scope:null==e?void 0:e.scope,dragSettings:{columnIndex:t,type:e.id,fieldKey:o.datumKey,onResized:null==e?void 0:e.onResizedColumn,width:e.width},children:[c.jsx(Fx.THButton,{onChange:function(){return f()},direction:n?null==n?void 0:n.direction:void 0,label:r||o.publicName,onSort:at(o)?void 0:function(){var t,r=nt(o.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});null==e.onOrderChange||e.onOrderChange({fieldId:r.field,function:r.function,direction:kx(null!=(t=null==n?void 0:n.direction)?t:null)})},ref:s,testIdPrefix:"column-"+(null==o?void 0:o.id)}),c.jsx(Tx,{open:u,triggerPosition:d,close:p,exportName:e.exportName||o.publicName,fieldId:o.datumKey,originalPublicName:o.publicName,onSetExportName:e.onSetExportName,onSetNumberFormat:function(t){return e.onSetNumberFormat(o.datumKey,t)},currentNumberFormat:i,numberFormatOptions:e.numberFormatOptions,dataType:o.dataType})]})},Dx=Object.assign((function(e){var n=e.content,r=t.useState(!1),i=r[0],o=r[1];return c.jsxs(Wd,{gap:"0.5rem",children:[c.jsx(Md,{textWrap:!0,flex:1,hyphens:"none",children:n}),c.jsxs(Md,{width:"2rem",position:"relative",children:[c.jsx(Dx.Button,{onClick:function(){"string"==typeof n&&(B(n),o(!0),setTimeout((function(){return o(!1)}),2e3))},copied:i}),c.jsx(Dx.Success,{copied:i})]})]})}),{Button:function(e){return c.jsxs("button",{onClick:function(){return null==e?void 0:e.onClick()},"aria-label":"Copy content",className:""+Ea.button,children:[!(null!=e&&e.copied)&&c.jsx("svg",{height:24,width:24,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:null==e?void 0:e.iconStyles,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z"})}),(null==e?void 0:e.copied)&&c.jsx("svg",{height:24,width:24,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:null==e?void 0:e.iconStyles,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0118 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3l1.5 1.5 3-3.75"})})]})},Success:function(e){return c.jsx(t.Fragment,{children:(null==e?void 0:e.copied)&&c.jsx("div",{style:{position:"absolute",right:0},className:""+up.popover,children:"Copied!"})})}}),Ix=function(e){return c.jsxs(Df,{onClose:function(){return null==e?void 0:e.onCloseModal()},isOpen:null==e?void 0:e.open,width:"sm",children:[c.jsx(Df.Content,{children:c.jsx(Gg.Container,{children:c.jsx(Gg.Panel,{as:"div",children:c.jsx(Dx,{content:null==e?void 0:e.content})})})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsx(Dp,{secondary:!0,onClick:function(){return null==e?void 0:e.onCloseModal()},children:"Close"})})]})},Px=ua({height:"1.25rem",width:"1.25rem","&:disabled":{opacity:.4}}),_x=ua({fontSize:13}),Ex=function(e){var t,n;return c.jsxs(Wd,{justifyContent:"flex-end",alignItems:"center",margin:"0.5rem 0 0 0",children:[c.jsxs("span",{className:""+_x,children:["Page ",(null!=(t=e.offset)?t:0)/(null!=(n=e.limit)?n:1)+1]}),e.onPrevious&&c.jsx("button",{disabled:null==e?void 0:e.previousDisabled,onClick:e.onPrevious,"aria-label":"Previous",className:Ea.button+" "+Px,children:c.jsx(v.ChevronLeftIcon,{})}),e.onNext&&c.jsx("button",{"aria-label":"Next",disabled:null==e?void 0:e.nextDisabled,className:Ea.button+" "+Px,onClick:e.onNext,children:c.jsx(v.ChevronRightIcon,{})})]})},Ox=function(e,t){return t[e]?t[e]:Lo(e)?t[Ro(e)]:void 0},Lx=function(e){for(var t,n=[],r=function(){var e=t.value,r=n.find((function(t){return t.content===e}));r?r.colSpan+=1:n.push({content:e,colSpan:1})},i=te(e);!(t=i()).done;)r();return n},Mx=function(e,t,n,r,o,a,l,s,u,d,c){if(!e)return null;var p=[],f=[],m=void 0,h=function(e,t){var n="";return t&&"none"!=t&&(n=" ("+u[t].publicName+")"),""+e+n};if(e&&"dataTable"==t.type){var v=Ut(t),g=Gt(t),b=function(e,t,n,r){var o=i.groupBy(t,(function(e){return e.pivot||"x"})),a={x:(o.x||[]).map((function(e){return lt(e)})),y:(o.y||[]).map((function(e){return lt(e)}))},l=zo(e,n,a,void 0,r),s=[].concat(a.x).map((function(t){return U({},Vo(e,t),{datumKey:t})})),u=[],d=Bo(a,n,e);return l.forEach((function(e){u.push([].concat(e.xValues,i.cloneDeep(d).map((function(t){return void 0===e[t]?null:e[t]}))))})),d.forEach((function(t){var n=Mo(t),r=lt({field:n.fieldId,function:n.function}),i=Vo(e,r),o=Oo(n.dimensionKeys,n.dimensionValues,n.fieldId,n.function);s.push({id:r,datumKey:o,publicName:i.publicName,dataType:"number"})})),{fields:s,content:u}}(e,g,v,c);m=function(e,t,n,r,o){if(!i.some(t,(function(e){return"y"==e.pivot}))||!e)return!1;var a=n.flatMap((function(t){if(Lo(t.datumKey)){var n=Mo(t.datumKey);return[n.dimensionValues.map((function(t,i){return function(e,t,n,r,i){var o=Ee(t,i);if(e&&o){var a=Vo(e,t),l=i[o.truncate].dateFormat,s="date_time"==(null==a?void 0:a.dataType)?new Date(n):n;return Je(s,r[l].formatter)||""+n}return""+n}(e,n.dimensionKeys[i],t,r,o)})).join(", ")]}return[]})),l=i.cloneDeep(t).flatMap((function(e){return"y"==e.pivot?[]:[{colSpan:1,content:"",rowGroup:!0}]}));return{consolidated:[].concat(l,Lx(a)),unconsolidated:[].concat(l,a.map((function(e){return{colSpan:1,content:e}})))}}(e,g,b.fields,a,d),f=b.content,p=b.fields}else e&&e.fields.forEach((function(e){p.push(U({},e,{datumKey:Oo([],[],e.id,"none")}))}));return p=p.map((function(e){var t=e.publicName,r="none",i=function(e,t){return t[e]?t[e]:Lo(e)?t[Ro(e)]:void 0}(e.datumKey,n||{});return i?t=i:Lo(e.datumKey)&&(r=Mo(e.datumKey).function),U({},e,{publicName:i||h(t,r)})})),f=Rx(p,"dataTable"==t.type?f:e.content,r,o,a,l,s,c),{groupTitles:m,fields:p,content:f}},Rx=function(e,t,n,r,i,o,a,l){return t.map((function(t){return t.map((function(t,s){var u,d=e[s],c=n?function(e,t){var n;return null==(n=e.find((function(e){var n=t.id;return Lo(n)?Ro(n)==e.field:n==e.field})))?void 0:n.prefix}(n,e[s]):"",p=r?i[r].formatter:function(e){return e.toISOString()},f=o?Ox(null!=(u=d.datumKey)?u:"",o):"",m=a[f||""];return{value:t,displayValue:""+(null!=c?c:"")+(m&&"number"==d.dataType?m.formatter(t,l):Je(function(e,t){if(null===e)return null;switch(t){case"boolean":return!!e;case"date_time":return new Date(e);case"number":return Number(e);case"string[]":return""+(Array.isArray(e)?Qe(e,!1):""+e);case"string":return""+e}}(t,d.dataType),p,l))}}))}))};function Nx(e,t,n,r){var i,o;return r&&r.hasOwnProperty(e)?r[e]:null!=(i=null==(o=t[e])?void 0:o.width)?i:n}var zx=function(e){var n=e.row,r=e.rowIndex,o=e.tableRepresentation,a=e.dimension,l=e.conditionalFormattingRules,u=e.dataSet,d=e.protectedFields,p=e.drilldownAction,f=zl().queryEngineConfig;return c.jsx(t.Fragment,{children:n.map((function(t,m){if(null!=o&&o.fields[m].hidden)return null;if(null==o)return null;var h,v,g=o.fields[m],b=e.drilldown.length>0&&0===m,x=Nx(g.datumKey,null==e?void 0:e.sizing,null==e?void 0:e.defaultColumnWidth,null==e?void 0:e.alternativeColumnSizing);if(Lo(g.datumKey)){var y=Mo(g.datumKey),w={};null==o||o.fields.forEach((function(e,t){var r,i;w[y.fieldId]=null==(r=n[t])?void 0:r.value,w[e.datumKey]=null==(i=n[t])?void 0:i.value})),y.dimensionKeys.forEach((function(e,t){w[e]=y.dimensionValues[t]}));var C=na(a,l,w,g.datumKey,u);C&&(h=function(e){var t,n=e.rule,r=e.ruleValue,o=(t=r,i.maxBy(["white","black"],(function(e){return s.contrast(e,t)}))||t);switch(n){case"fontColor":return{color:r};case"backgroundColor":return{backgroundColor:r,color:o}}return{}}({rule:C.ruleType,ruleValue:C.ruleValue}))}return Bb(a,g.id,{supportedAggregates:f.supportedAggregates,supportedTimeTruncFunctions:f.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0})?c.jsx(Fx.TH,{first:0===m,last:m+1===n.length,group:!0,scope:"row",onClick:function(){return e.onViewClick(r,m,t.value,g.datumKey)},clickEnabled:tv(d),expand:p&&b?{expanded:null==p?void 0:p.expanded,onClick:function(){return null==p?void 0:p.onExpanded(null!=p&&p.expanded?void 0:r)},label:""+t.displayValue}:void 0,level:null!=(v=null==e?void 0:e.level)?v:void 0,children:"undefined"!==t.displayValue?t.displayValue:""},"table_row_"+r+"_cell_"+m):c.jsx(Fx.TD,{first:0===m,last:m+1===n.length,onClick:function(){return e.onViewClick(r,m,t.value,g.datumKey)},align:"number"==g.dataType?"alignRight":"alignLeft",clickEnabled:tv(d),style:U({},null==e?void 0:e.cellStyles,h||{},{width:x,maxWidth:x,minWidth:x}),onShowMore:function(){return null==e?void 0:e.setShowMore(t.displayValue)},children:void 0!==t.displayValue?t.displayValue:""},"table_row_"+r+"_cell_"+m+"_"+JSON.stringify(t.displayValue)+"}")}))})},Bx=function(e){var r=n.useState(void 0),i=r[0],o=r[1],a=e.rowIndex,l=e.dataSet,s=e.drilldown;t.useEffect((function(){return o(void 0)}),[e.queriesAreChanging]);var u=t.useState(),d=u[0],p=u[1],f=void 0!==i,m=s&&(null==s?void 0:s.length)>0,h=zl().queryEngineConfig;return c.jsxs(t.Fragment,{children:[c.jsx(Fx.TR,{odd:a%2!=0,even:a%2==0,level:s?1:void 0,expanded:s?f:void 0,children:c.jsx(zx,U({},e,{drilldownAction:m?{onExpanded:function(t){if(void 0!==t){var n=function(e,t,n){return Vx(t).map((function(t){var r,i,o,a=(o=zb(t),e.fields.findIndex((function(e){return e.id===o})));return(i={})[t.field]=null==(r=e.content[n][a])?void 0:r.value,i}))}(e.tableRepresentation,e.dimension,t);null!==n&&o(n)}else o(void 0)},expanded:f}:void 0,onViewClick:function(t,n,r){e.handleOnChange(t,n,r,ev(null==e?void 0:e.tableRepresentation.fields,h,e.row))}}))}),(null==e?void 0:e.drilldownInputProps)&&f&&m&&c.jsx(qx,{setResults:function(e){return p({results:e})},dataSet:l,result:null==d?void 0:d.results[0],drilldownInputProps:null==e?void 0:e.drilldownInputProps,drilldown:s,selectedRow:i,tableRowProps:e,parentFields:e.tableRepresentation.fields,handleOnChange:e.handleOnChange,dimension:e.dimension})]})},qx=function(e){var n,r,i,o,a,l,s,u,d,p,f=e.drilldownInputProps,m=f.component,h=f.runQueriesCallback,v=zl(),g=v.queryEngineConfig,b=v.numberFormatOptions,x=v.dateTimeFormatOptions,y=(o=m.attributes,a=nt(e.drilldown[0].subsetDimension,g),l=e.dimension,p=(s=e.selectedRow).map((function(e){return Object.keys(e)})).flat(),u=o.filter.filter((function(e){return e.every((function(e){return!p.includes(e.field)}))})),(d=[].concat(u)).push(s.map((function(e){var t,n=Object.keys(e)[0];return{field:n,op:"=",value:e[n],function:(null==(t=l.find((function(e){return e.field===n})))?void 0:t.function)||"none"}}))),U({},o,{dimension:(n=o.dimension,r=a,i=n.filter((function(e){return"x"!==e.pivot})),[].concat(i,[U({},r)])),order:[{field:a.field,direction:"asc",function:a.function||"none"}],filter:d}));Kh(y,h,null==e?void 0:e.setResults,{localFilters:m.localFilters,globalFilters:e.drilldownInputProps.globalFilters},e.dataSet);var w=t.useMemo((function(){return Mx(e.result,y,y.exportNames,y.prefixes,y.dateTimeFormat,x,y.numberFormat,b,g.supportedAggregates,g.supportedTimeTruncFunctions)}),[e.result,y,g,b,x]),C=null==e?void 0:e.tableRowProps.row.length;return Ho(e.result)?c.jsx(Fx.TR,{level:2,children:c.jsx(Fx.TH,{colSpan:C,children:c.jsx(fc,{minHeight:30})})}):Wo(e.result)?c.jsx(uf,{}):c.jsx(t.Fragment,{children:(null==w?void 0:w.content)&&c.jsx(t.Fragment,{children:(null==w?void 0:w.content.length)>0?null==w?void 0:w.content.map((function(t,n){var r=function(e,t,n,r,i){return 0===e.length?[{value:r[0].value,displayValue:r[0].displayValue}]:e.map((function(e,o){if(0===o)return r[0];var a=t.fields.findIndex((function(t){return t.datumKey===e.datumKey})),l=i.find((function(t){return t.field===e.id}));return-1!==a?t.content[n][a]:l?{value:null,displayValue:""}:{value:null,displayValue:"No value"}}))}(e.parentFields,w,n,t,Vx(e.dimension));return c.jsx(Fx.TR,{level:2,odd:n%2!=0,even:n%2==0,children:c.jsx(zx,U({},null==e?void 0:e.tableRowProps,{row:r,rowIndex:n,drilldownAction:void 0,level:2,subsetTableRepresentation:w,onViewClick:function(t,n,i,o){e.handleOnChange(t,n,i,ev(e.parentFields,g,r,w.fields,e.drilldown[0]),function(e,t,n,r,i,o,a){var l=nt(e.subsetDimension,t),s=function(){var e=[{fieldId:l.field,function:l.function,aggregate:l.function,value:r}];return a.forEach((function(t){var r;"x"===t.pivot&&e.push({fieldId:t.field,function:t.function,aggregate:t.function,value:(null==n||null==(r=n.find((function(e){return Object.keys(e)[0]===t.field})))?void 0:r[t.field])||""})})),e}();return{value:function(){if(Lo(o)){var n=Mo(o);return{fieldId:n.fieldId,value:i,function:n.function,aggregate:n.function,datum:o}}var r=nt(e.subsetDimension,t);return{fieldId:r.field,value:i,function:r.function,aggregate:r.function,datum:o}}(),grouping:s}}(null==e?void 0:e.drilldown[0],g,e.selectedRow,w.content[t][0].value,r[n].value,o,e.dimension))}}))},"table_row_level_2_"+n)})):c.jsx(Fx.TR,{level:2,children:c.jsx(Fx.TH,{colSpan:C,children:"No Results"})})})})};function Vx(e){return e.filter((function(e){return"x"===e.pivot}))}var Hx={type:"dataTable",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:10,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[]},Wx=function(e){var n,r,i,o,a,l,s={displayTitle:e.displayTitle,displaySubject:e.displaySubject,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,componentType:null==e?void 0:e.type},u=e.sizing,d=ex(),p=d[0],f=function(e,t){var n=e/t;return n<200&&(n=200),n>300&&(n=300),n}(d[1],((null==(r=e.result)?void 0:r.fields)||[]).length),m=b.useDragLayer((function(e){if(e.isDragging()){var t,n=e.getItem(),r=e.getDifferenceFromInitialOffset();if(null!==r&&n)return(t={})[null==n?void 0:n.fieldKey]=(null==n?void 0:n.width)+(null==r?void 0:r.x),t}})),h=function(t){var n;return null==e?void 0:e.onSizingUpdate(U({},u,((n={})[t.fieldKey]={width:t.width},n)))},v=t.useState(null),g=v[0],x=v[1],y=us(),w=t.useMemo((function(){return Mx(e.result,e,e.exportNames,e.prefixes,e.dateTimeFormat,e.dateTimeFormatOptions,e.numberFormat,e.numberFormatOptions,e.supportedAggregates,e.supportedTimeTruncFunctions)}),[e]),C=(null!=(i=e.result)&&i.content?null==(o=e.result)?void 0:o.content.length:0)>(w?w.content.length:0),j=t.useMemo((function(){var t,n,r;return c.jsx(c.Fragment,{children:e.result&&!C&&c.jsx(Ex,{offset:null==e?void 0:e.offset,limit:null==e?void 0:e.limit,onNext:null==e?void 0:e.onNext,onPrevious:null==e?void 0:e.onPrevious,previousDisabled:!lx(null!=(t=e.offset)?t:0),nextDisabled:!sx({offset:null!=(n=e.offset)?n:0,limit:null!=(r=e.limit)?r:0,total:w?w.content.length:0})})})}),[e.offset,e.limit,e.onPrevious,e.onNext,null==(a=e.result)?void 0:a.content.length,C]);if(null===w)return null;if(Yo(e.result))return c.jsx(cf,U({},s,{children:j}));if(!On(e.type).isRunnable(e))return c.jsx(sf,{title:"Missing parameters",children:cv(e)});if(Ho(e.result))return c.jsx(fc,{});if(Wo(e.result))return c.jsx(uf,{});var F={fontFamily:null==y?void 0:y.fontFamily},S=function(t,n,r,i,o){return function(e,t,n,r,i,o){var a=e.result,l=e.onViewClick,s=e.type;if(null!=a&&a.fields&&l){var u,d,c,p,f=(null==(u=a.fields[t])?void 0:u.id)||"",m=rt(f,{supportedAggregates:null==e?void 0:e.supportedAggregates,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),h=m.fieldId,v=m.function,g=(null==(d=a.content)?void 0:d[n])||[],b=function(e,t){var n={};return e.forEach((function(e,r){n[e.id]=t[r]})),n}(a.fields,g);if("dataTable"===s){var x,y={fieldId:h,function:v,value:r,aggregate:v};c={grouping:Jh(e.dimension,b,o),value:null!=(x=null==o?void 0:o.value)?x:y}}else c={fieldId:f,value:r,function:"none",aggregate:"none"};tv(null==e?void 0:e.protectedFields)&&l({viewId:null!=(p=null==e?void 0:e.viewId)?p:"",type:s,fields:b,clicked:c,fieldsV2:i})}}(e,n,t,r,i,o)};return c.jsxs(kp,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Md,{marginBottom:null!=e&&e.displayTitle&&(null==e?void 0:e.displayTitle.length)>0?"0.4rem":void 0,children:c.jsx(Bm,U({},s))}),c.jsxs(Ba,{disabledFeatures:null!=(l=null==e?void 0:e.library)&&l,children:[c.jsxs(Fx.Wrapper,{ref:p,children:[c.jsxs(Fx.Head,{children:[w.groupTitles&&c.jsx(Fx.HeadTR,{children:w.groupTitles.consolidated.map((function(e,t){var n,r;return c.jsx(Fx.TH,{colSpan:e.colSpan,group:!0,last:t+1===((null==w?void 0:w.groupTitles)&&(null==w||null==(n=w.groupTitles)||null==(r=n.consolidated)?void 0:r.length)),scope:e.rowGroup?"row":void 0,deadSpace:e.rowGroup,children:e.content},e+"_"+t)}))}),c.jsx(Fx.HeadTR,{children:w.fields.map((function(t,n){if(t.hidden)return null;var r=e.order.find((function(n){var r=nt(t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});return n.field===r.field&&r.function==n.function})),i=!!Bb(null==e?void 0:e.dimension,t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0}),o=Nx(t.datumKey,u,f,m);return c.jsx(Ax,{exportName:t.publicName,onSetExportName:e.onSetExportName,supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,id:e.id,isImpactedColumn:!1,width:o,columnOffset:0,currentOrder:r,onOrderChange:e.onOrderChange,fieldIndex:n,numberFormatOptions:e.numberFormatOptions,currentNumberFormat:Ox(t.datumKey,e.numberFormat),onSetNumberFormat:e.onSetNumberFormat,fields:null==w?void 0:w.fields,last:n+1===(null==w?void 0:w.fields.length),scope:i?"row":void 0,onResizedColumn:h},"table_column_"+n)}))})]}),c.jsx(Fx.Body,{children:w.content.map((function(t,n){return c.jsx(Bx,{protectedFields:null==e?void 0:e.protectedFields,dataSet:null==e?void 0:e.dataSet,conditionalFormattingRules:null==e?void 0:e.conditionalFormattingRules,dimension:null==e?void 0:e.dimension,rowIndex:n,row:t,tableRepresentation:w,sizing:u,defaultColumnWidth:f,alternativeColumnSizing:m,handleOnChange:S,cellStyles:F,setShowMore:x,drilldown:e.tableDrilldown,drilldownInputProps:null==e?void 0:e.drilldownInputProps,queriesAreChanging:e.queriesAreChanging})}))})]}),j]}),c.jsx(Ix,{open:!!g,onCloseModal:function(){return x(null)},content:g})]})};Wx.defaultProps=Hx;var Yx,Ux=function(e){return c.jsx(b.DndProvider,{backend:q.HTML5Backend,children:c.jsx(Wx,U({},e))})},Gx=function(e){var t=e.component,n=t.results,r=t.attributes,o=Kh(r,e.runQueriesCallback,e.setResults,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.dataSet).queriesAreChanging,a=n[0];if(a&&a.fields.length!=r.dimension.length+r.measure.length)return null;var l=r.measure.map((function(e){return lt(e)})),s=r.dimension.map((function(e){return lt({function:e.function,field:e.field})}));return i.every(null==a?void 0:a.fields,(function(e){return s.includes(e.id)||l.includes(e.id)}))?c.jsx(Ux,U({},r,{dataSet:e.dataSet,onSetExportName:function(t,n){var i;e.updateComponentAttributes(U({},r,{exportNames:U({},r.exportNames,(i={},i[t]=n,i))}))},id:e.id,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:function(){},result:a,onNext:function(){var t,i,o,a;sx({limit:null!=(t=r.limit)?t:0,offset:null!=(i=r.offset)?i:0,total:null!=(o=null==(a=n[0])?void 0:a.content.length)?o:0})&&e.updateComponentAttributes(U({},r,{offset:(r.offset||0)+(r.limit||Hx.limit)}))},onPrevious:function(){var t;lx(null!=(t=r.offset)?t:0)&&e.updateComponentAttributes(U({},r,{offset:(r.offset||0)-(r.limit||Hx.limit)}))},queriesAreChanging:o,onOrderChange:function(t){var n=t.fieldId,o=t.function,a=t.direction,l=i.cloneDeep(r.order),s=l.findIndex((function(e){return e.field===n&&e.function==o}));null===a?l.splice(s,1):s>-1?l[s].direction=a:l.push({field:n,direction:a,function:o}),e.updateComponentAttributes(U({},r,{order:l}))},numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onSetNumberFormat:function(t,n){var i=U({},r.numberFormat);n?i[t]=n:delete i[t],e.updateComponentAttributes(U({},r,{numberFormat:i}))},supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,library:null==e?void 0:e.library,onViewClick:null==e?void 0:e.onViewClick,onSizingUpdate:function(t){e.updateComponentAttributes(U({},r,{sizing:t}))},drilldownInputProps:{component:e.component,runQueriesCallback:e.runQueriesCallback,globalFilters:e.globalFilters}})):null},Kx=function(e){var t=zc().dashboard,n=zl();if(!e.component.attributes)return null;var r=Bv(e.component,t.dataSets,n);if(r){if(r instanceof Yt)return c.jsx(Jp,{title:"Data set not available."});if(r instanceof Wt)return c.jsx(Jp,{title:"This view is no-longer supported."});if(r instanceof qt)return c.jsx(lf,{removeMissingField:function(){var t=On(e.component.attributes.type,{queryEngineConfig:n.queryEngineConfig});if(r instanceof qt){var i=t.removeField(e.component.attributes,r.getMissingFieldId());e.updateComponentAttributes(i)}}})}var i=Ur(t,e.component.attributes.dataSetId);if(e.isBeingSizeAdjusted)return c.jsx(Jp,{title:c.jsx(cc,{color:"#e5e5e5"})});var o=null!=e&&e.editor||null!=e&&e.library?void 0:e.component.colSpan<=2,a=function(r){(0,On(r.type,n).validate)(r,t.dataSets),e.updateComponentAttributes(r)};if("scatterChart"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(gv,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library})});if(["horizontalBarChart","barChart"].includes(e.component.attributes.type))return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(av,{id:e.id,dataSet:i,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,runQueriesCallback:e.runQueriesCallback,updateComponentAttributes:function(e){return a(e)},component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library,onViewClick:n.onViewClick})});if("areaChart"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(Xh,{id:e.id,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library})});if("lineChart"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(dv,{id:e.id,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:i,updateComponentAttributes:function(e){return a(e)},runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library})});if("pieChart"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(Ev,{id:e.id,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library})});if("singleStat"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(ax,{id:e.id,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library})});if("dataTable"==e.component.attributes.type||"basicTable"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(Gx,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,updateComponentAttributes:function(e){return a(e)},dashboardBehaviour:n,library:null==e?void 0:e.library,onViewClick:n.onViewClick})});if("comboChart"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(Kb,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library})});if("custom"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(Ub,{component:e.component})});if("mercatorMap"==e.component.attributes.type)return c.jsx(fo,{renderOnError:function(e){return c.jsx(ff,{onManualRetry:e})},onError:n.onError,children:c.jsx(Qb,{id:e.id,setLocalFilters:e.setLocalFilters,onPositionChange:function(t){var r=(0,On("mercatorMap",n).setAttributes)(e.component.attributes,{position:t});e.updateComponentAttributes(r)},dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n})});throw"Unsupported component in generic component wrapper. "+e.component.attributes.type},Xx=function(e){var t=e.component.localFilters||[],n=zc(),r=Ur(n.dashboard,e.component.attributes.dataSetId);return r?c.jsx(Wf,{dataSets:[r],filters:t,show:null==e?void 0:e.show,onUpdate:function(n){var r=Yf(t,n);null==e||e.setLocalFilters(r)},source:"local",onDeleteItem:function(n){var r=[].concat(t);r.splice(n,1),null==e||e.setLocalFilters(r)},onClose:function(){return null==e?void 0:e.onClose()}}):null},Qx=function(e){var r=t.useState(!1),i=r[0],o=r[1],a=t.useState(!1),l=a[0],s=a[1],u=zc().dispatch,d=e.component,p=e.libraryIndex,f=n.useState(!1),m=f[0],h=f[1],v=zl().mode,g=window.disableViewCheck||m,b=us(),x="admin"===v||!d.attributes.protectedByOrganisation&&"endUser"===v;return c.jsx(t.Fragment,{children:c.jsx(z,{active:!m,partialVisibility:!0,onChange:h,children:c.jsxs("button",{onClick:function(){return e.onSelectComponent(p)},className:""+Ma.selectedComponent(null==b?void 0:b.panels)({componentSelect:p===(null==e?void 0:e.selectedIndex)&&"true"}),"aria-selected":p===(null==e?void 0:e.selectedIndex),children:[c.jsxs(Tm,{children:["View ",p+1,d.attributes.displayTitle?": "+d.attributes.displayTitle:""]}),!g&&c.jsx("div",{style:{height:"170px"},children:c.jsx(fc,{})}),g&&c.jsx(zv,{children:c.jsxs(Rv,{width:340,height:306,percentage:100,children:[x&&c.jsx(Zx,{label:"View "+(p+1)+" Options",onEdit:function(){return null==e?void 0:e.onEdit(p)},onDelete:function(){return null==e?void 0:e.onDelete(p)},onSetParameters:function(){return o(!0)},onAddFilter:function(){return s(!0)},attributes:d.attributes}),c.jsx(Kx,{isBeingSizeAdjusted:!1,id:"library_"+p+"_"+Math.floor(1e11*Math.random()),setLocalFilters:function(){},setParameterUpdate:function(){},runQueriesCallback:e.runQueriesCallback,component:d,setResults:function(t){return e.setResults(t,p)},updateComponentAttributes:e.updateComponentAttributes,library:!0})]})},"select_component_preview_"+p),c.jsx(Hb,{setParameterUpdate:function(){},libraryIndex:e.libraryIndex,show:i,component:e.component,onClose:function(){return o(!1)}}),c.jsx(Xx,{component:e.component,onClose:function(){return s(!1)},show:l,setLocalFilters:function(e){u({type:"setLocalFilters",localFilters:e,libraryIndex:p})}})]})})})},Jx={name:"1v3ivpe",styles:"position:absolute;right:-1.25rem;top:0px"},Zx=function(e){var r,i=n.useRef(null),o=zl(),a=On(null==e?void 0:e.attributes.type),l=t.useState(!1),s=l[0],u=l[1],d=t.useState(void 0),p=d[0],f=d[1],m=[{purpose:"editComponentsOnLibrary",renderIcon:function(){return c.jsx(Jl,{})},onClick:function(){return e.onEdit()}},{purpose:"removeComponentFromLibrary",renderIcon:function(){return c.jsx(Ql,{purpose:"removeComponentFromDashboard"})},onClick:function(){return e.onDelete()}}];o.featureToggles.parameters&&null!=(r=a.supportedFeatures)&&r.parameters&&"read_write"===o.scope&&m.push({purpose:"parameters",renderIcon:function(){return c.jsx(Wd,{width:20,justifyContent:"center",as:"span",children:c.jsx(Ul,{})})},onClick:function(){return e.onSetParameters()}}),o.featureToggles.canConfigureLocalFilters&&m.push({purpose:"localFilter",renderIcon:function(){return c.jsx(Wd,{width:20,justifyContent:"center",as:"span",children:c.jsx(Wl,{active:!1})})},onClick:function(){return e.onAddFilter()}});var h=us();return c.jsxs("div",{css:Jx,ref:i,children:[c.jsxs("button",{"data-testid":"open-component-options",onClick:function(e){e.stopPropagation(),u(!s),i.current&&f(i.current.getBoundingClientRect())},"data-themeapi":"dashboard.icon",className:cp(null==h?void 0:h.dashboard)+" "+Ea.button+" open-component-options",children:[c.jsx(Tm,{children:null==e?void 0:e.label}),c.jsx(es,{})]}),s&&c.jsx(Nd,{onClose:function(){return u(!1)},position:p,children:c.jsx(Kv,{onClose:function(){return u(!1)},cellOptions:m})})]})},$x=function(e){if(i.isEmpty(e.components))return c.jsx(Jp,{title:"Your library is empty"});var n=function(){var e=t.useRef(null);return t.useEffect((function(){e.current&&e.current.focus()}),[]),e}(),r=[].concat(e.components).map((function(e){return{displayTitle:e.attributes.displayTitle,displaySubject:e.attributes.displaySubject,component:e}})),o=Vd(r,["displayTitle","displaySubject"]),a=o.values,l=o.setSearch;return t.useEffect((function(){var t;null==e||e.onSelectComponent(null==(t=a[0])?void 0:t.refIndex)}),[o.searchString]),c.jsx(Md,{padding:"1.5rem",children:c.jsxs(os,{gap:"1.5rem",rows:["48px","1fr"],children:[c.jsx(Md,{children:c.jsx(Mv,{placeholder:"Search Library",onChange:l,inputRef:n})}),c.jsx(Md,{children:c.jsxs(os,{columns:["repeat(3, 1fr)"],gap:"1.5rem",children:[0===a.length&&c.jsx(Jp,{title:"Your search returned no results"}),[].concat(a).map((function(t){var n=t.refIndex;return c.jsx(Qx,{updateComponentAttributes:e.updateComponentAttributes,setResults:e.setResults,component:t.item.component,libraryIndex:n,onSelectComponent:null==e?void 0:e.onSelectComponent,runQueriesCallback:e.runQueriesCallback,selectedIndex:null==e?void 0:e.selectedIndex,onDelete:null==e?void 0:e.onDelete,onEdit:null==e?void 0:e.onEdit},n)}))]})})]})})},ey={name:"om9tn6",styles:"margin:auto;height:24rem"},ty={name:"1g0vxgi",styles:"margin-top:0.75rem"},ny=function(){var e=zc(),n=e.dispatch,r=e.dashboard,o=e.broadcastEvent,a=e.runQueriesCallback,l=t.useState(0),s=l[0],u=l[1],d=t.useState(null),p=d[0],f=d[1],m=zl().featureToggles,h=m.canEditComponentLibrary,v=function(){var e=r.componentLibrary.length;o("library.startCreatingNew"),n({type:"startEditingComponent",libraryIndex:e,displayTarget:null,component:null})};return i.isEmpty(r.componentLibrary)?c.jsx("div",{className:lc("modal-empty-library"),css:ey,children:c.jsx(Jp,{title:"There are no Views in your template library",renderExtra:function(){return m.canEditComponentLibrary&&c.jsx("div",{css:ty,children:c.jsx(Pp,{onClick:v,children:"Create new"})})}})}):c.jsxs(c.Fragment,{children:[c.jsx(ry,{runQueriesCallback:a,onClose:function(){o("library.close"),n({type:"clearModal"})},onSelect:function(){n({type:"pickComponentFromLibraryForDisplay",libraryIndex:s})},updateComponentAttributes:function(e){n({type:"updateComponentLibraryAttributes",attributes:e,libraryIndex:s})},setFocussedComponentResults:function(e){n({type:"setResultsForComponentInLibrary",results:e,libraryIndex:s})},dashboard:r,selectedLibraryIndex:s,setResults:function(e,t){n({type:"setResultsForComponentInLibrary",results:e,libraryIndex:t})},canEditComponentLibrary:h,onEdit:function(e){var t=U({},r.componentLibrary[e]);o("library.startEditing"),n({type:"startEditingComponent",libraryIndex:e,displayTarget:null,component:t})},onDelete:f,onCreate:v,onSelectComponent:function(e){o("library.switchSelectedComponent"),u(e)}}),c.jsx(iy,{open:null!==p,onClose:function(){return f(null)},onDelete:function(){null!==p&&n({type:"removeComponentFromLibrary",libraryIndex:p}),f(null),u(0)}})]})},ry=function(e){return c.jsxs(t.Fragment,{children:[c.jsx(Df.Header,{title:"Select Template","data-component":"library-header"}),c.jsx(Df.Content,{scrollable:!0,"data-component":"library-content",children:c.jsx($x,{runQueriesCallback:null==e?void 0:e.runQueriesCallback,setResults:null==e?void 0:e.setResults,components:null==e?void 0:e.dashboard.componentLibrary,onSelectComponent:function(t){return null==e?void 0:e.onSelectComponent(t)},updateComponentAttributes:null==e?void 0:e.updateComponentAttributes,selectedIndex:null==e?void 0:e.selectedLibraryIndex,onDelete:null==e?void 0:e.onDelete,onEdit:null==e?void 0:e.onEdit})}),c.jsxs(Df.Footer,{buttons:"space-between","data-component":"library-footer",children:[c.jsx(Of,{"data-component":"library-footer-left",children:(null==e?void 0:e.canEditComponentLibrary)&&c.jsx(Pp,{onClick:function(){return null==e?void 0:e.onCreate()},secondary:!0,children:"Create New"})}),c.jsxs(Of,{buttons:"end","data-component":"library-footer-right",children:[c.jsx(Pp,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:"Close"}),c.jsx(Pp,{onClick:function(){return null==e?void 0:e.onSelect()},children:"Add to Dashboard"})]})]})]})},iy=function(e){return c.jsxs(Df,{width:"sm",isOpen:null==e?void 0:e.open,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(Df.Header,{title:"Are you sure?"}),c.jsx(Df.Content,{children:c.jsx("p",{className:""+Ea.text,children:"Are you sure you want to delete this component from your library?"})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Cancel"}),c.jsx(Pp,{onClick:function(){return null==e?void 0:e.onDelete()},children:"Delete"})]})})]})},oy=Vl((function(e){var t=zc().dashboard,n=zl(),r=n.dateFilterOptions,i=n.cascadeFilterSelection;return c.jsx(Wd,{gap:"0.5rem","data-component":"filters",className:""+sy(n.scope),children:[].concat(e.globalFilters).map((function(n,o){return c.jsx(Cm,{shouldAlwaysHaveValue:n.requiresValue,dataSets:t.dataSets,dateFilterOptions:r,filter:U({},n,{optionsFilters:mr(null==e?void 0:e.globalFilters,t.dataSets,r,i)}),filterIndex:o,onChange:function(t){var n=[].concat(e.globalFilters);n[o]=t,e.setGlobalFilters(n)}},o)}))})}),"renderGlobalFiltersViewComponent"),ay=function(e){var t=zl(),n=t.featureToggles;return c.jsxs("div",{className:""+ly(t.scope),"data-component":"global-filters",children:[e.globalFilters.length>0&&c.jsx(oy,U({},e)),n.canManageGlobalFilters&&c.jsx(Gf,{})]})},ly=function(e){return ua("read"===e?{"@media (min-width: 768px)":{display:"flex",gridRow:1,gridColumn:2,gap:16,width:"100%"},"@media (max-width: 767px)":{display:"block"}}:{display:"flex",gridRow:1,gridColumn:2,gap:16,width:"100%"})},sy=function(e){return ua("read"===e?{"@media (min-width: 768px)":{flexDirection:"row"},"@media (max-width: 767px)":{flexDirection:"column"}}:{flexDirection:"row"})},uy=function(){var e=zc(),t=e.dashboard,n=e.dispatch;return zl().featureToggles.showGlobalFilters?c.jsx(ay,{globalFilters:t.globalFilters,setGlobalFilters:function(e){Nr("Setting global filters",e),n({type:"setGlobalFilters",globalFilters:e})},setupAsyncOptionLoader:function(){return Y(H().mark((function e(){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Not implemented.";case 1:case"end":return e.stop()}}),e)})))}}):null},dy=function(e){return c.jsxs("pre",{css:["position:relative;margin-bottom:0.75rem;user-select:none;border-radius:0.5rem;background-color:rgb(0 0 0 / 0.9);padding:0.75rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity));",e.sm&&{fontSize:"0.75rem",lineHeight:"1rem"},"",""],children:[c.jsx(cy,{content:e.content,copyContent:e.copyContent}),e.children||e.content]})},cy=function(e){var n=Hp().addToast,r=t.useState(!1),i=r[0],o=r[1];return c.jsx(Dx.Button,{onClick:Y(H().mark((function t(){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.copyContent){t.next=6;break}return t.next=3,e.copyContent();case 3:t.t0=t.sent,t.next=7;break;case 6:t.t0=e.content;case 7:B(t.t0),n((function(){return c.jsx(zp,{message:"Copied to clipboard"})})),o(!0),setTimeout((function(){return o(!1)}),2e3);case 12:case"end":return t.stop()}}),t)}))),iconStyles:{position:"absolute",top:"0.75rem",right:"1.25rem"},copied:i})},py={name:"1gok8e8",styles:"margin-bottom:0.5rem"},fy={name:"1mipg0r",styles:"margin-top:0.5rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 245 249 / var(--tw-bg-opacity));padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem"},my=function(){var e,t=zl(),n=t.overrideDeveloperInfo,r=t.setOverrideDeveloperInfo;return c.jsx(Df,{width:"xl",isOpen:!!n,onClose:function(){return r(null)},children:c.jsxs("div",{onClick:function(e){e.preventDefault(),e.stopPropagation()},children:[c.jsx(Df.Header,{title:"Replace component"}),c.jsxs(Df.Content,{children:[c.jsx("div",{css:py,children:c.jsx(dy,{content:"<Vizzly.Dashboard\n// Rest of dashboard props...\n"+(null==n?void 0:n.overrideKey)+"={CustomComponent}\n/>"})}),c.jsxs("p",{children:["Adding the `",null==n?void 0:n.overrideKey,"` React prop of the Vizzly.Dashboard component, will allow you to render your own component."]}),!i.isEmpty(null==n?void 0:n.componentProps)&&c.jsx("div",{css:fy,children:c.jsx(Qc,{showAccordionIcon:!0,title:"View props",Icon:dl,children:c.jsx(dy,{content:(e=null==n?void 0:n.componentProps,JSON.stringify(e,(function(e,t){if("testId"!=e)return"children"==e?" [ React.JSX ] ":i.isFunction(t)?" [ function ] ":t}),2))})})})]})]})})},hy=function(e){var t=e.currentReports[0],n=t?t.id:l.v4(),r=zl(),i=r.reportScheduleOptions,o=r.onScheduledReportChange,a=[].concat(i).map((function(e){return{label:e.description,value:e.cron}})),s=function(){var t=Y(H().mark((function t(r){var a,l;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o(n,r);case 2:a=t.sent,l=(i||[]).find((function(e){return e.cron==r})),e.setComponentReports("saved"==a?[{id:n,type:"scheduled",schedule:r,scheduleDescription:l.description}]:[]);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();return c.jsxs(Df,{width:"xl",onClose:e.onClose,isOpen:e.isOpen,children:[c.jsx(Df.Header,{title:"Set report schedule"}),c.jsx(Df.Content,{children:c.jsx(Tc,{placeholder:"Select schedule",selected:t?t.schedule:null,showClearBtn:!0,onChange:s,options:a})}),c.jsx(Df.Footer,{children:c.jsx(Pp,{onClick:e.onClose,secondary:!0,children:"Close"})})]})},vy=Object.assign((function(){return null}),{emptyCell:function(e){var t=o.merge({},ga.dashboard,e);return ua({position:"relative",height:"100%",borderRadius:"0.75rem",borderColor:null==t?void 0:t.borderColor,borderWidth:null==t?void 0:t.borderWidth,borderStyle:null==t?void 0:t.borderStyle})}}),gy=function(e){return c.jsxs(Md,{children:[c.jsx(kc,{as:"span",children:e.label}),c.jsx("div",{className:rs(""+Ea.text,null==e?void 0:e.className),children:e.value})]})},by=function(e){var n,r,o=(null==e?void 0:e.component).attributes,a=zc().dispatch,l=function(){var t,n,r={};null==e||null==(t=e.component)||null==(n=t.results[0])||n.fields.forEach((function(e){r[e.id]=e.publicName}));var i=[];if("dimension"in o&&o.dimension.map((function(e){var t=r[tt(e)];i.push({value:e,label:t})})),"timeDimension"in o&&null!==o.timeDimension){var a=o.timeDimension,l=r[a?tt({field:null==a?void 0:a.field,function:null==a?void 0:a.truncate}):""];i.push({value:a,label:l})}return i.sort((function(e,t){return e.label.localeCompare(t.label,void 0,{sensitivity:"base"})})),i},s=t.useState(!1),u=s[0],d=s[1],p=t.useState((r=[],o&&"protectedFields"in o&&o.protectedFields&&"measure"in o.protectedFields&&o.protectedFields.measure&&(r=o.protectedFields.measure.map((function(e){return o.measure.findIndex((function(t){return t.field===e.field}))}))),r)),f=p[0],m=p[1],h=t.useState(function(){var e,t,n,r=[],i=l().map((function(e){return e.value}));return o&&"protectedFields"in o&&o.protectedFields&&"dimension"in o.protectedFields&&o.protectedFields.dimension&&(r=null!=(e=null==(t=o.protectedFields)||null==(n=t.dimension)?void 0:n.map((function(e){return i.findIndex((function(t){return(null==t?void 0:t.field)===e.field}))})))?e:[]),r}()),v=h[0],g=h[1],b=function(){null==e||e.onClose()};return c.jsxs(Df,{width:"xl","data-testid":"edit-filter",isOpen:null==e?void 0:e.show,onClose:null==e?void 0:e.onClose,hideCloseIcon:!0,children:[c.jsx(Df.Header,{title:"Click Settings",show:!0}),c.jsxs(Df.Content,{children:[c.jsx(Mf,{children:c.jsx(gy,{label:"View Id",value:c.jsx(Gg.Panel,{children:c.jsx(Dx,{content:o.viewId})})})}),"basicTable"!==o.type&&c.jsx(Mf,{children:c.jsx(xy,{options:l(),selectedDimension:v,setSelectedDimesion:g})}),c.jsx(Mf,{children:c.jsx(yy,{attributes:o,results:null==e||null==(n=e.component)?void 0:n.results,selectedMeasure:f,setSelectedMeasure:m,label:"Protected "+("basicTable"===o.type?"Columns":"Metrics")})})]}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Dp,{secondary:!0,onClick:function(){u||(b(),null==e||e.onClose())},disabled:u,children:"Cancel"}),c.jsx(Dp,{onClick:function(){return u?void 0:function(){d(!0);var t={};"measure"in o&&i.isArray(f)&&(t.measure=f.map((function(e){return null==o?void 0:o.measure[e]})));var n=l();n.length>0&&i.isArray(v)&&(t.dimension=v.map((function(e){return n[e]})).map((function(e){return e.value}))),"protectedFields"in o&&a({type:"setAttributes",attributes:U({},o,{protectedFields:t}),cellIndex:e.cellIndex,rowIndex:e.rowIndex}),d(!1),b()}()},disabled:u,primary:!0,children:"Confirm"})]})})]})},xy=function(e){var t=e.setSelectedDimesion;return c.jsx($f,{label:"Protected Grouping Fields",id:"protected-grouping-fields",setSelected:function(e){return t(e)},selected:e.selectedDimension,options:e.options})},yy=function(e){var t=e.attributes,n=e.results,r=e.setSelectedMeasure;return c.jsx($f,{label:e.label,id:"protected-measure-fields",setSelected:function(e){return r(e)},selected:e.selectedMeasure,options:function(){var e,r={};null==(e=n[0])||e.fields.forEach((function(e){r[e.id]=e.publicName}));var i=[];return"measure"in t&&t.measure.map((function(e){var t=lt(e);i.push({value:e,label:r[t]+("none"!==e.function?" ("+e.function+")":"")})})),i}()})},wy=function(e){var t;return c.jsxs("svg",{height:null!=(t=null==e?void 0:e.height)?t:"535",viewBox:"0 0 1541 535",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("rect",{x:"1068",y:"287",width:"11",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),c.jsx("rect",{x:"1152",y:"259",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),c.jsx("rect",{x:"1232",y:"95",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),c.jsx("rect",{x:"1348",y:"256",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),c.jsx("rect",{x:"532",y:"312",width:"16",height:"15",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.24",strokeWidth:"4"}),c.jsx("rect",{x:"326",y:"197",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),c.jsx("rect",{x:"508.5",y:"56.5",width:"11",height:"3",rx:"1.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.24",strokeWidth:"3"}),c.jsx("rect",{x:"242",y:"236",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),c.jsx("rect",{x:"249",y:"302",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),c.jsx("rect",{x:"203.25",y:"139.25",width:"2.5",height:"10.5",rx:"1.25",stroke:null==e?void 0:e.color,strokeOpacity:"0.22",strokeWidth:"2.5"}),c.jsx("rect",{x:"160",y:"88",width:"16",height:"14",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.3",strokeWidth:"4"}),c.jsx("rect",{x:"1203",y:"266",width:"120",height:"117",rx:"16",fill:"url(#paint0_linear_7_421)",fillOpacity:"0.2"}),c.jsx("rect",{x:"1205.5",y:"268.5",width:"115",height:"112",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M1205 299H1321",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"377",y:"177",width:"120",height:"117",rx:"16",fill:"url(#paint1_linear_7_421)"}),c.jsx("rect",{x:"379.5",y:"179.5",width:"115",height:"112",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M379 210H495",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsxs("g",{clipPath:"url(#clip0_7_421)",children:[c.jsx("rect",{x:"572",y:"61",width:"410",height:"322",rx:"24",fill:"#E7EAF1"}),c.jsx("rect",{x:"730",y:"116",width:"337.5",height:"239.708",rx:"8",fill:"#F3F5F9"}),c.jsx("g",{filter:"url(#filter0_d_7_421)",children:c.jsx("rect",{x:"741.926",y:"127.926",width:"78.7103",height:"66.7845",rx:"5.9629",fill:"white"})}),c.jsxs("g",{filter:"url(#filter1_d_7_421)",children:[c.jsx("rect",{x:"828.984",y:"127.926",width:"78.7103",height:"66.7845",rx:"5.9629",fill:"white"}),c.jsx("rect",{x:"829.484",y:"128.426",width:"77.7103",height:"65.7845",rx:"5.4629",stroke:null==e?void 0:e.color})]}),c.jsx("path",{d:"M888.611 160.721C888.611 172.247 879.267 181.591 867.741 181.591C856.214 181.591 846.871 172.247 846.871 160.721C846.871 149.195 856.214 139.851 867.741 139.851C879.267 139.851 888.611 149.195 888.611 160.721ZM855.661 160.721C855.661 167.393 861.069 172.801 867.741 172.801C874.412 172.801 879.821 167.393 879.821 160.721C879.821 154.049 874.412 148.641 867.741 148.641C861.069 148.641 855.661 154.049 855.661 160.721Z",fill:null==e?void 0:e.color}),c.jsx("path",{d:"M867.741 139.851C862.912 139.851 858.233 141.525 854.501 144.588C850.768 147.651 848.214 151.914 847.272 156.65C846.33 161.385 847.059 166.301 849.335 170.559C851.611 174.817 855.293 178.155 859.754 180.003C864.215 181.85 869.179 182.094 873.799 180.693C878.42 179.291 882.411 176.331 885.094 172.316C887.776 168.301 888.984 163.481 888.51 158.675C888.037 153.87 885.912 149.378 882.498 145.964L876.283 152.179C878.259 154.155 879.489 156.756 879.763 159.537C880.037 162.318 879.338 165.109 877.785 167.432C876.232 169.756 873.922 171.47 871.247 172.281C868.573 173.092 865.7 172.951 863.118 171.882C860.536 170.812 858.405 168.88 857.087 166.416C855.77 163.951 855.348 161.105 855.893 158.364C856.438 155.623 857.917 153.156 860.077 151.383C862.238 149.61 864.946 148.641 867.741 148.641L867.741 139.851Z",fill:null==e?void 0:e.color}),c.jsx("path",{d:"M867.741 139.851C864.309 139.851 860.929 140.697 857.903 142.315C854.876 143.933 852.295 146.273 850.388 149.126C848.481 151.98 847.308 155.26 846.971 158.675C846.635 162.091 847.146 165.537 848.459 168.708C849.773 171.879 851.848 174.677 854.501 176.854C857.154 179.031 860.303 180.521 863.669 181.19C867.035 181.86 870.515 181.689 873.799 180.693C877.083 179.696 880.071 177.905 882.498 175.479L876.283 169.263C874.878 170.668 873.148 171.704 871.247 172.281C869.346 172.858 867.332 172.957 865.384 172.569C863.436 172.181 861.613 171.319 860.077 170.059C858.542 168.799 857.34 167.179 856.58 165.344C855.82 163.509 855.524 161.514 855.719 159.537C855.914 157.56 856.593 155.662 857.697 154.01C858.8 152.358 860.294 151.004 862.046 150.067C863.798 149.131 865.754 148.641 867.741 148.641L867.741 139.851Z",fill:"#D9FFE8"}),c.jsx("g",{filter:"url(#filter2_d_7_421)",children:c.jsx("path",{d:"M916.042 133.889C916.042 130.595 918.712 127.926 922.005 127.926H1048.42C1051.71 127.926 1054.38 130.595 1054.38 133.889V262.687C1054.38 265.98 1051.71 268.65 1048.42 268.65H922.005C918.712 268.65 916.042 265.98 916.042 262.687V133.889Z",fill:"white"})}),c.jsx("path",{d:"M945.857 189.636C946.367 187.861 951.979 177.805 956.061 184.312C960.142 190.819 965.244 198.509 968.816 192.593C972.387 186.678 975.958 169.523 980.55 173.664C985.142 177.805 989.223 172.481 992.795 164.791C996.366 157.101 1000.45 158.284 1004.02 167.157C1007.59 176.03 1009.12 181.946 1015.24 181.946C1021.37 181.946 1023.92 189.044 1028.51 186.678C1032.18 184.785 1038.54 162.622 1041.26 151.777",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),c.jsx("path",{d:"M956.061 184.312C951.979 177.805 946.367 187.861 945.857 189.636V240.028H1041.26V151.777C1038.54 162.622 1032.18 184.785 1028.51 186.678C1023.92 189.044 1021.37 181.946 1015.24 181.946C1009.12 181.946 1007.59 176.03 1004.02 167.157C1000.45 158.284 996.366 157.101 992.795 164.791C989.223 172.481 985.142 177.805 980.55 173.664C975.958 169.523 972.387 186.678 968.816 192.593C965.244 198.509 960.142 190.819 956.061 184.312Z",fill:"url(#paint2_linear_7_421)"}),c.jsx("g",{filter:"url(#filter3_d_7_421)",children:c.jsx("rect",{x:"741.926",y:"203.058",width:"165.769",height:"66.7845",rx:"5.9629",fill:"white"})}),c.jsx("g",{filter:"url(#filter4_d_7_421)",children:c.jsx("rect",{x:"741.926",y:"278.191",width:"165.769",height:"66.7845",rx:"5.9629",fill:"white"})}),c.jsx("path",{d:"M749.081 337.82C775.101 330.469 781.606 307.366 802.422 306.316C823.238 305.266 832.345 323.118 840.151 319.967C847.957 316.817 862.268 279.012 892.191 300.015",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),c.jsx("path",{d:"M750.274 337.82C755.048 335.681 765.637 329.264 769.804 320.709C775.012 310.014 784.126 300.389 795.844 314.292C807.561 328.195 817.977 339.959 829.695 312.153C841.413 284.347 851.829 292.903 860.943 305.736C870.057 318.57 877.869 338.889 892.191 318.57",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),c.jsx("g",{filter:"url(#filter5_d_7_421)",children:c.jsx("rect",{x:"916.042",y:"278.191",width:"138.339",height:"66.7845",rx:"5.9629",fill:"white"})}),c.jsx("path",{d:"M764.015 167.45C763.28 167.45 762.601 167.361 761.978 167.183C761.354 167.005 760.798 166.76 760.308 166.448C759.83 166.136 759.429 165.775 759.106 165.363L760.375 163.86C760.62 164.239 760.937 164.567 761.327 164.845C761.716 165.112 762.156 165.324 762.646 165.48C763.135 165.624 763.636 165.697 764.148 165.697C764.827 165.697 765.362 165.585 765.751 165.363C766.141 165.14 766.335 164.812 766.335 164.378C766.335 164.099 766.224 163.86 766.002 163.66C765.79 163.459 765.417 163.298 764.883 163.176L762.545 162.641C761.922 162.497 761.388 162.296 760.943 162.04C760.497 161.784 760.158 161.473 759.924 161.105C759.702 160.727 759.59 160.293 759.59 159.803C759.59 159.157 759.763 158.584 760.108 158.083C760.464 157.582 760.965 157.182 761.61 156.881C762.267 156.581 763.057 156.43 763.981 156.43C764.95 156.43 765.801 156.597 766.536 156.931C767.27 157.265 767.894 157.76 768.406 158.417L767.204 159.803C766.758 159.235 766.263 158.823 765.718 158.567C765.183 158.3 764.555 158.167 763.831 158.167C763.341 158.167 762.941 158.228 762.629 158.35C762.317 158.462 762.084 158.617 761.928 158.818C761.783 159.018 761.711 159.246 761.711 159.502C761.711 159.703 761.755 159.886 761.844 160.053C761.933 160.209 762.1 160.348 762.345 160.471C762.601 160.593 762.963 160.71 763.43 160.821L765.434 161.272C766.48 161.506 767.232 161.851 767.688 162.307C768.155 162.753 768.389 163.348 768.389 164.094C768.389 164.806 768.205 165.413 767.838 165.914C767.471 166.415 766.953 166.799 766.285 167.066C765.629 167.322 764.872 167.45 764.015 167.45ZM763.23 169.002V154.911H764.783V169.002H763.23ZM771.992 167.466V160.487C771.992 160.231 771.992 159.97 771.992 159.703C772.003 159.424 772.014 159.141 772.025 158.851C771.647 159.196 771.224 159.497 770.756 159.753C770.289 160.009 769.81 160.187 769.321 160.287L769.02 158.35C769.276 158.328 769.56 158.256 769.872 158.133C770.194 158 770.517 157.844 770.84 157.666C771.174 157.477 771.474 157.282 771.742 157.081C772.02 156.87 772.231 156.658 772.376 156.447H774.246V167.466H771.992ZM777.502 164.912C777.947 164.912 778.298 165.034 778.554 165.279C778.821 165.524 778.954 165.852 778.954 166.264C778.954 166.687 778.821 167.021 778.554 167.266C778.298 167.5 777.947 167.617 777.502 167.617C777.057 167.617 776.701 167.5 776.433 167.266C776.177 167.021 776.049 166.687 776.049 166.264C776.049 165.852 776.177 165.524 776.433 165.279C776.701 165.034 777.057 164.912 777.502 164.912ZM778.199 156.447H786.931V158.2C786.007 159.124 785.272 160.076 784.727 161.055C784.182 162.035 783.786 163.053 783.541 164.111C783.308 165.168 783.191 166.287 783.191 167.466H780.904C780.904 166.242 781.054 165.068 781.354 163.944C781.666 162.808 782.139 161.729 782.773 160.705C783.419 159.669 784.237 158.679 785.228 157.733L785.695 158.334H778.199V156.447ZM800.402 156.447V167.466H798.315V161.723L798.431 158.501H798.398L795.343 167.466H793.456L790.417 158.501H790.384L790.501 161.723V167.466H788.414V156.447H791.753L793.74 162.458L794.441 164.945H794.474L795.192 162.474L797.163 156.447H800.402Z",fill:"#374151"}),c.jsx("rect",{x:"749.081",y:"210.214",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"749.081",y:"285.346",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"135.081",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"285.346",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"150.585",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"168.474",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"186.362",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"204.251",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"222.14",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"240.028",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"941.087",y:"254.339",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"964.938",y:"254.339",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"769.355",y:"210.214",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"769.355",y:"285.346",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"943.472",y:"135.081",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"943.472",y:"285.346",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"970.901",y:"285.346",width:"8.34806",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"797.977",y:"210.214",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"752.659",y:"234.065",width:"5.9629",height:"27.4293",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"763.392",y:"229.295",width:"5.9629",height:"32.1996",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"774.125",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"784.859",y:"235.258",width:"5.9629",height:"26.2367",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"795.592",y:"247.184",width:"5.9629",height:"14.311",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"806.325",y:"241.221",width:"5.9629",height:"20.2739",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"817.058",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"827.792",y:"244.799",width:"5.9629",height:"16.6961",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"838.525",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"849.258",y:"229.295",width:"5.9629",height:"32.1996",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"859.991",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"870.724",y:"231.68",width:"5.9629",height:"29.8145",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"881.458",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"892.191",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"923.198",y:"298.465",width:"82.288",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),c.jsx("rect",{x:"923.198",y:"313.968",width:"26.2367",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),c.jsx("rect",{x:"923.198",y:"329.472",width:"52.4735",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),c.jsx("rect",{x:"923.198",y:"304.427",width:"118.065",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"923.198",y:"319.931",width:"85.8657",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"923.198",y:"335.435",width:"70.3622",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),c.jsxs("g",{filter:"url(#filter6_d_7_421)",children:[c.jsx("rect",{x:"594",y:"81",width:"155",height:"172",rx:"8",fill:"white"}),c.jsx("rect",{x:"594.5",y:"81.5",width:"154",height:"171",rx:"7.5",stroke:null==e?void 0:e.color})]}),c.jsx("rect",{x:"614",y:"223",width:"116",height:"17",rx:"3",fill:"#F3F5F9"}),c.jsx("rect",{x:"614",y:"103",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),c.jsx("rect",{x:"614",y:"209",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),c.jsx("rect",{x:"614",y:"122",width:"115",height:"3",rx:"1.5",fill:"#D9FFE8"}),c.jsx("rect",{x:"614",y:"122",width:"58",height:"3",rx:"1.5",fill:"#151515"}),c.jsx("circle",{cx:"673",cy:"123",r:"6",fill:"#151515"}),c.jsx("rect",{x:"614",y:"153",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),c.jsx("rect",{x:"614",y:"167",width:"16",height:"16",fill:"#151515"}),c.jsx("rect",{x:"714",y:"167",width:"16",height:"16",fill:"#F3F5F9"}),c.jsx("rect",{x:"639",y:"167",width:"16",height:"16",fill:"#374151"}),c.jsx("rect",{x:"661.5",y:"164.5",width:"21",height:"21",fill:null==e?void 0:e.color,stroke:"#151515"}),c.jsx("rect",{x:"689",y:"167",width:"16",height:"16",fill:"#D9FFE8"}),c.jsx("path",{d:"M674.157 178.471L674.157 178.471L674.159 178.477L689.023 218.322L689.024 218.322C689.212 218.826 689.552 219.258 689.997 219.558C690.443 219.859 690.971 220.013 691.508 219.999C692.045 219.985 692.564 219.803 692.993 219.479C693.422 219.155 693.738 218.706 693.9 218.193L693.902 218.186L697.67 205.899L710.895 218.839C710.896 218.84 710.898 218.841 710.899 218.842C711.381 219.322 712.034 219.591 712.715 219.591C713.397 219.591 714.051 219.32 714.534 218.839L714.537 218.837L718.249 215.115L718.251 215.113C718.731 214.629 719 213.974 719 213.293C719 212.611 718.731 211.956 718.251 211.472L718.245 211.466L718.24 211.461L705.081 198.603L717.11 194.872L717.126 194.867L717.142 194.861C717.649 194.685 718.089 194.355 718.399 193.918C718.71 193.48 718.877 192.957 718.877 192.42C718.877 191.884 718.71 191.36 718.399 190.922C718.091 190.488 717.656 190.16 717.154 189.983L677.486 175.165C677.485 175.164 677.485 175.164 677.485 175.164C677.022 174.991 676.52 174.954 676.038 175.058C675.555 175.162 675.112 175.402 674.762 175.751C674.412 176.099 674.169 176.54 674.062 177.022C673.955 177.504 673.988 178.007 674.157 178.471Z",fill:"black",stroke:"#E7EAF1",strokeWidth:"2"})]}),c.jsx("rect",{x:"217",y:"77",width:"96",height:"99",rx:"16",fill:"url(#paint3_linear_7_421)",fillOpacity:"0.2"}),c.jsx("rect",{x:"219.5",y:"79.5",width:"91",height:"94",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M218.5 104.5H311",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"1064",y:"69",width:"105",height:"99",rx:"16",fill:"url(#paint4_linear_7_421)",fillOpacity:"0.2"}),c.jsx("rect",{x:"1066.5",y:"71.5",width:"100",height:"94",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"1011",y:"218",width:"15",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),c.jsx("rect",{x:"1442",y:"227",width:"19",height:"16",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),c.jsx("rect",{x:"1269",y:"130",width:"15",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),c.jsx("rect",{x:"420",y:"111",width:"18",height:"16",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.28",strokeWidth:"4"}),c.jsx("path",{d:"M1066 97H1167",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"69",y:"193",width:"73",height:"72",rx:"16",fill:"url(#paint5_linear_7_421)",fillOpacity:"0.2"}),c.jsx("rect",{x:"71.5",y:"195.5",width:"68",height:"67",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M70 213H141",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"1399",y:"116",width:"73",height:"72",rx:"16",fill:"url(#paint6_linear_7_421)"}),c.jsx("rect",{x:"1401.5",y:"118.5",width:"68",height:"67",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M1400 136H1471",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsxs("defs",{children:[c.jsxs("filter",{id:"filter0_d_7_421",x:"737.155",y:"123.155",width:"88.2509",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter1_d_7_421",x:"824.214",y:"123.155",width:"88.2509",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter2_d_7_421",x:"911.272",y:"123.155",width:"147.88",height:"150.265",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter3_d_7_421",x:"737.155",y:"198.288",width:"175.309",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter4_d_7_421",x:"737.155",y:"273.42",width:"175.309",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter5_d_7_421",x:"911.272",y:"273.42",width:"147.88",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter6_d_7_421",x:"580",y:"67",width:"183",height:"200",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"7"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("linearGradient",{id:"paint0_linear_7_421",x1:"1206.5",y1:"324",x2:"1319.5",y2:"324",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint1_linear_7_421",x1:"492",y1:"231.5",x2:"380.5",y2:"230.5",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.2"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint2_linear_7_421",x1:"993.56",y1:"151.777",x2:"993.56",y2:"240.028",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.72"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint3_linear_7_421",x1:"310.5",y1:"126",x2:"219.5",y2:"126",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint4_linear_7_421",x1:"1066.5",y1:"117",x2:"1164",y2:"118",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),c.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint5_linear_7_421",x1:"138",y1:"229",x2:"74",y2:"229",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint6_linear_7_421",x1:"1404",y1:"152",x2:"1467.5",y2:"152",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.19"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsx("clipPath",{id:"clip0_7_421",children:c.jsx("rect",{x:"572",y:"61",width:"410",height:"322",rx:"24",fill:"white"})})]})]})},Cy=function(e){return c.jsxs(Wd,{justifyContent:"center",direction:"column",alignItems:"center",height:"100%","data-component":"empty-state",children:[c.jsx(wy,{height:160,color:null==e?void 0:e.illustrationColor}),c.jsxs(Wd,{direction:"column",gap:"1rem",alignItems:"center",children:[c.jsx(Md,{className:""+jy,children:null==e?void 0:e.title}),(null==e?void 0:e.children)&&c.jsx(Md,{children:null==e?void 0:e.children})]})]})},jy=ua({fontSize:16,fontWeight:500}),Fy={name:"1g6uwz7",styles:"display:grid;height:100%;width:100%;place-content:center"},Sy={name:"1g6uwz7",styles:"display:grid;height:100%;width:100%;place-content:center"},ky={name:"1q8mru7",styles:"margin-left:0.25rem;display:inline-block"},Ty=function(e){var n=us(),r=zl().featureToggles,i=r.canUseComponentLibrary,o=r.canCreateStandaloneComponents;return 0===(null==e?void 0:e.rowIndex)&&0===(null==e?void 0:e.cellIndex)&&r.canSeeEmptyState?c.jsx(zv,{vizzlyPrefix:lc("populated-cell"),children:c.jsxs("div",{css:Fy,children:[c.jsx(Zv,{chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),onRemoveCell:null==e?void 0:e.onRemoveCell}),c.jsx(Cy,{title:c.jsx(t.Fragment,{children:"Build a dashboard with your data and delight your customer."}),illustrationColor:"#43BA73",children:o&&c.jsx(wp,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",children:"+ Add View"})})]})}):c.jsx("div",{className:rs(lc("empty-cell"),""+vy.emptyCell(null==n?void 0:n.dashboard)),"data-themeapi":"dashboard","data-chipposition":"top.left",children:c.jsxs("div",{css:Sy,children:[c.jsx(Zv,{chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),onRemoveCell:null==e?void 0:e.onRemoveCell}),c.jsxs(Wd,{gap:"0.5rem",wrap:!0,justifyContent:"center",children:[i&&c.jsx(wp,{onChange:e.onPickFromLibrary,size:"small","data-component":"select-template",children:c.jsxs(Wd,{alignItems:"center",as:"span",children:[c.jsx(ts,{}),c.jsx("span",{css:ky,children:"Select Template"})]})}),o&&c.jsx(wp,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",children:"+ Add View"})]})]})})},Ay=function(e){var r,o,a=t.useState(!1),l=a[0],s=a[1],u=t.useState(!1),d=u[0],p=u[1],f=t.useState(!1),m=f[0],h=f[1],v=zc().dispatch,g=zl(),x=g.featureToggles,y=g.reportScheduleOptions,w=g.scope,C=x.canDownloadComponentData,j=x.canEditComponentsOnDashboard,F=x.canRemoveComponentsFromDashboard,S=n.useState(!1),k=S[0],T=S[1],A=t.useState(!1),D=A[0],I=A[1],P=n.useState(!1),_=P[0],E=P[1],O=window.disableViewCheck||_,L=!i.isEmpty(y)&&e.hasWebhookSetup,M=(r=e.rowIndex,o=e.cellIndex,b.useDrag((function(){return{type:"moveComponentPositionDragHandle",item:{rowIndex:r,cellIndex:o},collect:function(e){var t=e.isDragging();return{adjust:e.getDifferenceFromInitialOffset(),isDragging:t}}}}))),R=M[1],N=M[2],B=function(t){v({type:"setLocalFilters",localFilters:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},q=function(t){v({type:"setParameterBasedUpdate",payload:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},V=t.useState(!1),H=V[0],W=V[1];return c.jsxs(c.Fragment,{children:[c.jsx(z,{active:!_,partialVisibility:!0,onChange:E,children:c.jsxs(zv,{vizzlyPrefix:lc("populated-cell"),"data-testid":e.testId,ref:N,onHover:W,children:[c.jsx(pp,{dragSource:R,active:"read_write"===w&&H,enabled:"read_write"===w,top:Dy(e.component.attributes).top,height:Dy(e.component.attributes).height}),c.jsx(Jv,{canDownloadComponentData:C&&e.componentValidWithDataSet,canEditComponentsOnDashboard:j&&e.componentValidWithDataSet,canRemoveComponentsFromDashboard:F,onEdit:e.onEdit,onRemove:function(){return s(!0)},onDownload:e.onDownload,canSetupReportSchedule:L,onManageReport:function(){return T(!0)},onClickSettings:function(){return I(!0)},chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),component:e.component,onAddFilter:function(){return p(!0)},onSetParameters:function(){return h(!0)}}),c.jsxs(Md,{height:"100%","data-component":"cell-contents",children:[O&&c.jsx(Kx,{id:e.id,setLocalFilters:B,setParameterUpdate:q,isBeingSizeAdjusted:e.isBeingSizeAdjusted,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,updateComponentAttributes:e.updateComponentAttributes}),!O&&c.jsx(fc,{})]})]})}),L&&c.jsx(hy,{setComponentReports:e.setComponentReports,currentReports:e.component.reports||[],isOpen:k,onClose:function(){return T(!1)}}),D&&c.jsx(by,{show:D,component:null==e?void 0:e.component,onClose:function(){return I(!1)},cellIndex:e.cellIndex,rowIndex:e.rowIndex}),c.jsx(Zg,{message:"This view will be deleted from your dashboard.",onClose:function(t){t&&(null==e||e.onRemove()),s(!1)},show:l}),c.jsx(Xx,{component:e.component,onClose:function(){return p(!1)},show:d,setLocalFilters:B}),c.jsx(Hb,{cellIndex:e.cellIndex,setParameterUpdate:q,rowIndex:e.rowIndex,show:m,component:e.component,onClose:function(){return h(!1)}})]})},Dy=function(e){var t=e.displayTitle,n=e.displaySubject,r=t?15:8,i=28;return t&&(i+=13),n&&(i+=13),n&&t&&(i+=4),n&&!t&&(r=14),{top:r,height:i}},Iy=function(e,t){if(e){var n=[[].concat(e.fields).map((function(t,n){var r,i;if(!e.groupTitles)return t.publicName;var o=null==(r=e.groupTitles.unconsolidated)||null==(i=r[n])?void 0:i.content;return(o?"["+o+"] ":"")+t.publicName}))].concat(e.content),r="";n.forEach((function(e){var t=e.map((function(e){var t,n="object"==typeof e&&"value"in e?null!=(t=e.displayValue)?t:e.value:e;return"number"==typeof n?n:'"'+n+'"'})).join(",");r+=t+"\r\n"})),t(r)}else t("Download failed")},Py=function(e){var t=new Blob([e],{type:"text/csv;charset=utf-8"});V.saveAs(t,"download.csv")},_y=function(){var e=Y(H().mark((function e(t,n,r,o,a,l,s,u,d,c){var p,f,m,h,v;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===c&&(c=Py),e.prev=1,"limit"in a&&(a.limit=o),p=new AbortController,f="view-download-type"==t?a:[Wn(n,o,"filter"in a?a.filter:[])],e.next=7,qc(f,r,p.signal,d);case 7:Wo(h=null==(m=e.sent)?void 0:m[0])||Yo(h)||Ho(h)||(v=Mx(h,i.isArray(f)?f[0]:f,"exportNames"in a?a.exportNames:void 0,"prefixes"in a&&Array.isArray(a.prefixes)?a.prefixes:void 0,"dateTimeFormat"in a?a.dateTimeFormat:void 0,l,"numberFormat"in a?a.numberFormat:void 0,s,u.supportedAggregates,u.supportedTimeTruncFunctions,""),Iy(v,c)),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(1),console.error(e.t0);case 15:case"end":return e.stop()}}),e,null,[[1,12]])})));return function(t,n,r,i,o,a,l,s,u,d){return e.apply(this,arguments)}}(),Ey=function(e,t,n){return e.slice(-15)+"_"+t+"_"+n},Oy=function(e){var t=e.onCreateNew,n=e.onPickFromLibrary,r=e.onRemoveCell,i=e.rowIndex,o=e.dispatch,a=e.cellIndex,l=e.dashboard,s=e.runQueriesCallback,u=e.broadcastEvent,d=zl(),p=d.queryEngineConfig,f=d.dateTimeFormatOptions,m=d.numberFormatOptions,h=l.display[i].components[a],v="isEmpty"in h?"empty":"populated",g=null!=l.webhookId,x=b.useDrop((function(){return{accept:"moveComponentPositionDragHandle",drop:function(t,n){e.dispatch({type:"swapComponents",positionA:{rowIndex:t.rowIndex,cellIndex:t.cellIndex},positionB:{rowIndex:e.rowIndex,cellIndex:e.cellIndex}})},collect:function(e){return{isOver:e.isOver()}}}}));return c.jsxs("div",{ref:x[1],css:["height:100%;padding:0.5rem;",x[0].isOver&&{opacity:"0.2"},"",""],children:["populated"==v&&!("isEmpty"in h)&&c.jsx(Ay,{rowIndex:i,cellIndex:a,id:Ey(l.id,i,a),hasWebhookSetup:g,componentValidWithDataSet:!0,setComponentReports:function(e){o({type:"setComponentReports",rowIndex:i,cellIndex:a,reports:e})},testId:"populated_cell_"+i+"_cell_"+a,isBeingSizeAdjusted:e.isBeingSizeAdjusted,component:h,runQueriesCallback:s,updateComponentAttributes:function(e){o({type:"updateDisplayComponentAttributes",rowIndex:i,cellIndex:a,attributes:e})},setResults:function(e){o({type:"setResultsForComponentInDisplay",rowIndex:i,cellIndex:a,results:e})},onEdit:function(){u("component.startEditing"),o({type:"startEditingComponent",displayTarget:{rowIndex:i,cellIndex:a},libraryIndex:null,component:h})},onRemove:function(){u("component.removeFromDisplay"),o({type:"clearCell",rowIndex:i,cellIndex:a})},onDownload:function(){var t=Y(H().mark((function t(n){var r,i;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=Mn(l.dataSets,h.attributes.dataSetId),i={globalFilters:l.globalFilters,localFilters:h.localFilters},r&&_y(n,r,e.runQueriesCallback,e.maxCSVDownloadLimit,h.attributes,f,m,p,i);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}),"empty"==v&&c.jsx(Ty,{onCreateNew:function(){return t(i,a)},onPickFromLibrary:function(){return n(i,a)},onRemoveCell:function(){return r(i,a)},cellIndex:a,rowIndex:i})]},"row_"+i+"_cell_"+a)},Ly=ua(U({width:"100%",cursor:"ns-resize",opacity:0,paddingTop:"0.75rem",paddingBottom:"0.75rem"},sa,{"&:hover":U({},sa,{opacity:100})})),My=ua({position:"relative",height:"0.25rem",marginLeft:"40%",width:"20%"}),Ry=ua(U({cursor:"ew-resize",position:"absolute",right:"-0.75rem",height:"25%",width:"0.25rem",top:"40%"},sa,{"&:hover":U({},sa,{opacity:80}),variants:{highlighted:(Yx={},Yx.true={opacity:100},Yx.false={opacity:0},Yx)}})),Ny=Object.assign((function(){return null}),{dragHandle:function(e){var t=o.merge({},ga.dashboard,e);return ua({borderRadius:"0.75rem",background:null==t?void 0:t.borderColor})},cellDragHandle:Ry,rowDragHandle:My,rowDragHandleContainer:Ly}),zy=function(e){var n=us(),r=b.useDrag((function(){return{type:"rowHeightDragHandle",item:{rowIndex:e.rowIndex,displayRow:e.displayRow},collect:function(e){return{isDragging:e.isDragging()}},end:function(t,n){var r=n.getDifferenceFromInitialOffset();r&&e.onNewHeight(t.rowIndex,t.displayRow.height+r.y)}}}),[e.displayRow,e.rowIndex]),i=r[0],o=r[1],a=r[2];return t.useEffect((function(){a(q.getEmptyImage(),{captureDraggingState:!1})}),[]),i.isDragging?null:c.jsx("div",{ref:o,className:""+Ny.rowDragHandleContainer,children:c.jsx("div",{className:" "+Ny.dragHandle(null==n?void 0:n.dashboard)+" "+Ny.rowDragHandle,"data-themeapi":"dashboard"})})},By=function(e){var t=us(),n=b.useDrag((function(){return{type:"componentWidthDragHandle",item:{displayRow:e.displayRow,cellIndex:e.cellIndex,rowIndex:e.rowIndex},collect:function(e){return{isDragging:e.isDragging()}}}}),[JSON.stringify(e.displayRow),JSON.stringify(e.rowIndex)]);return n[0].isDragging?null:c.jsx("div",{ref:n[1],className:Ny.dragHandle(null==t?void 0:t.dashboard)+" "+Ny.cellDragHandle({highlighted:null!=e&&e.rowHighlighted?"true":"false"})})},qy={name:"b7hthc",styles:"position:absolute;top:-0.25rem;display:flex;height:100%;width:100%;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms"},Vy={name:"1vjyfqt",styles:"position:absolute;top:0px;height:0.5rem;width:0.5rem;border-radius:9999px;background-color:rgb(0 0 0 / 0.8)"},Hy={name:"ve8olc",styles:"position:absolute;top:0px;height:0.5rem;width:0.5rem;border-radius:9999px;background-color:rgb(0 0 0 / 0.1)"},Wy=function(e){var t=b.useDrop((function(){return{accept:"componentWidthDragHandle",drop:function(t,n){var r=n.getDifferenceFromInitialOffset();r&&e.onDrop(t.cellIndex,r.x,t.displayRow)},collect:function(e){return{isOver:e.isOver()}}}}));return c.jsx("div",{ref:t[1],style:{position:"absolute",left:e.dropIndex*e.colWidth+e.colWidth/2+32+"px",width:e.colWidth+"px"},css:qy,children:t[0].isOver?c.jsx("div",{style:{left:"calc(50% - 10px)"},css:Vy}):c.jsx(c.Fragment,{children:e.active&&c.jsx("div",{style:{left:"calc(50% - 10px)"},css:Hy})})})},Yy={name:"1kzq5ms",styles:"height:100%;width:100%"},Uy={name:"cvkgqy",styles:"display:inline-block;overflow-y:hidden"},Gy={name:"1wv4onu",styles:"position:relative;height:100%"},Ky=function(e){var n=ex(),r=n[0],o=n[1],a=zl().scope,l=function(e){return parseFloat(((e-1)/12).toFixed(2))}(o),s=b.useDragLayer((function(t){var n=t.getItem(),r=t.getItemType(),i=t.getDifferenceFromInitialOffset(),o=[].concat(Eo(12)).map((function(){return 0})),a=0;if(null!=i)if("rowHeightDragHandle"==r&&e.rowIndex==n.rowIndex)a=i.y;else if("componentWidthDragHandle"==r&&n&&e.rowIndex==n.rowIndex){var l=i.x;o[n.cellIndex]=l,o[n.cellIndex+1]=-l}return{rowHeightAdjustment:a,moveType:r,adjustRowIndex:e.rowIndex,widthAdjustments:o,activeCell:n?n.cellIndex:null,activeRow:n?n.rowIndex:null,isDraggingComponentWidth:"componentWidthDragHandle"==r}})),u=s.rowHeightAdjustment,d=s.widthAdjustments,p=s.activeCell,f=s.activeRow,m=s.moveType,h=s.isDraggingComponentWidth,v=t.useRef(null),g=t.useState(),x=g[0],y=g[1];t.useEffect((function(){v.current&&y(v.current.offsetWidth)}),[]);var w=u+e.displayRow.height;return c.jsxs("div",{ref:v,className:""+Qy(w,a,e.displayRow.components.length),"data-component":"rowContainer",children:[h&&c.jsx(c.Fragment,{children:Eo(12).map((function(t,n){return c.jsx(Wy,{onDrop:function(t,r,o){var a=i.cloneDeep(o),l=i.sumBy([].concat(a.components).splice(0,t),(function(e){return e.colSpan})),s=n+1-l,u=s-[].concat(a.components)[t].colSpan,d=[].concat(a.components).map((function(e){return e.colSpan}));d[t]=s,d[t+1]=d[t+1]-u,e.onColSpanChange(d.map((function(e){return{colSpan:e}})))},dropIndex:n,colWidth:l,active:null!=p},n)}))}),c.jsx("div",{css:Yy,ref:r,children:[].concat(e.displayRow.components).map((function(t,n){var r=n==e.displayRow.components.length-1,i="componentWidthDragHandle"==m&&null!=p&&e.rowIndex==f&&(p==n||p+1==n),o="rowHeightDragHandle"==m&&e.rowIndex==f;return c.jsx("div",{css:Uy,className:""+Xy(w,l*t.colSpan+(d[n]||0),a,x),"data-component":"cellContainer",children:c.jsxs("div",{css:Gy,style:{width:"calc(100% - 20px)"},children:[c.jsx(Oy,{maxCSVDownloadLimit:e.maxCSVDownloadLimit,isBeingSizeAdjusted:i||o,onCreateNew:e.onCreateNew,onPickFromLibrary:e.onPickFromLibrary,onRemoveCell:e.onRemoveCell,rowIndex:e.rowIndex,dispatch:e.dispatch,cellIndex:n,dashboard:e.dashboard,runQueriesCallback:e.runQueriesCallback,broadcastEvent:e.broadcastEvent}),!r&&"read_write"===a&&c.jsx(By,{displayRow:e.displayRow,rowIndex:e.rowIndex,cellIndex:n,rowHighlighted:null==e?void 0:e.rowHighlighted})]})},"row_"+e.rowIndex+"_cell_"+n)}))}),"read_write"===a&&c.jsx(zy,{onNewHeight:function(t,n){e.dispatch({type:"setRowHeight",rowIndex:t,height:n})},dispatch:e.dispatch,displayRow:e.displayRow,rowIndex:e.rowIndex})]},"actual_resizable_row_"+e.rowIndex)},Xy=function(e,t,n,r){var i;return ua("read"===n?((i={})["@media (min-width: 768px)"]={width:t,height:"100%"},i["@media (max-width: 767px)"]={width:null!=r?r:"100%",height:e},i):{width:t,height:"100%"})},Qy=function(e,t,n){var r;return ua("read"===t?((r={})["@media (min-width: 768px)"]={height:e},r["@media (max-width: 767px)"]={height:e*n},r):{height:e})},Jy=Object.assign((function(){return null}),{tooltip:ua({height:"100%",width:"100%",justifyContent:"center",alignItems:"center",display:"flex"})}),Zy=function(e){return null!=e&&e.narrow?c.jsx(dp,{placement:"right-start",tooltipContent:function(){return c.jsx(dp.Content,{children:null==e?void 0:e.tooltipLabel})},className:""+Jy.tooltip,classNameTrigger:""+Jy.tooltip,children:c.jsx($y,U({},e))}):c.jsx($y,U({},e))},$y=function(e){return c.jsxs(wp,{onChange:null==e?void 0:e.onChange,"data-component":"add-cell-button",size:"large",children:["+"," ",c.jsx("span",{style:null!=e&&e.narrow?{display:"none"}:{},children:null==e?void 0:e.label})]})},ew=function(e){var t,n;return c.jsx(ps,{theme:iw,children:c.jsx(Md,{padding:null==e?void 0:e.padding,marginTop:"0.50rem","data-component":null==e?void 0:e["data-component"],marginBottom:"1rem",className:"vizzly-toolbar",children:c.jsxs(Wd,{className:""+tw,children:[c.jsxs("a",{href:e.logo.href,className:""+nw,target:null!=(t=null==e||null==(n=e.logo)?void 0:n.target)?t:void 0,children:[c.jsx("span",{className:""+Ea.srOnly,children:"Vizzly"}),c.jsx(fl,{}),(null==e?void 0:e.logo.text)&&c.jsx(Md,{as:"span",paddingTop:2,children:e.logo.text})]}),null==e?void 0:e.children]})})})},tw=ua({background:"#E7EAF1",color:"#151515",padding:"0 0.75rem",borderRadius:12,position:"relative",minHeight:40}),nw=ua({position:"absolute",left:12,top:7.5,display:"flex",gap:"0.5rem",alignItems:"center",fontSize:12,fontWeight:600}),rw=ua({height:30,background:ha.colors.brand[20],width:1}),iw={buttons:{secondary:{background:"transparent",color:ha.colors.brand.base,border:"1px solid transparent",padding:"0.30rem 0.25rem",borderRadius:12,fontFamily:"system-ui, -apple-system","&:hover":{background:"rgba(48, 116, 217, 0.1)",border:"1px solid transparent",color:ha.colors.brand.base},fontSize:12,fontWeight:600}}},ow={name:"1gok8e8",styles:"margin-bottom:0.5rem"},aw={name:"1gok8e8",styles:"margin-bottom:0.5rem"},lw=function(){var e=t.useState("small"),n=e[0],r=e[1],i=zc().dashboard,o=t.useState(!1),a=o[0],l=o[1],s=zl(),u=s.featureToggles,d=s.scope,p=s.mode,f=s.onSave,m=s.queryEngineConfig,h=s.onOpenConfigManagerUi;if(s.disableToolbar)return null;var v=Gr(i),g=function(){"read_write"==d&&f(i)},b=zi(m,"configManagerUi")&&h;t.useEffect((function(){!function(){var e=Y(H().mark((function e(){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u.disableAutoSave||"endUser"!=p?Nr("Auto-save is disabled, so the dashboard will not be saved."):g();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[v&&JSON.stringify({display:v.display,componentLibrary:v.componentLibrary,globalFilters:v.globalFilters})]);var x=function(){l(!1)};return c.jsxs(c.Fragment,{children:[("admin"==p||b)&&"hidden"!==n&&c.jsx(ew,{"data-component":"admin-tools",logo:{href:"https://docs.vizzly.co/",target:"_blank"},children:c.jsx(Wd,{justifyContent:"end",alignItems:"center",padding:"0.1rem 0",children:c.jsxs(Of,{buttons:"end",children:[b&&c.jsx(Pp,{testId:"manage-data-sets",secondary:!0,onClick:function(){h()},internal:!0,children:"Config Manager"}),"admin"==p&&c.jsx(Pp,{secondary:!0,testId:"save-dashboard",onClick:function(){l(!0)},internal:!0,children:"Save"}),c.jsx("div",{className:""+rw}),c.jsxs(Pp,{secondary:!0,onClick:function(){return r("hidden")},internal:!0,children:[c.jsx("span",{className:""+Ea.srOnly,children:"Hide Tools"}),c.jsx(Wa,{})]})]})})}),c.jsxs(Df,{width:"sm",isOpen:a,onClose:function(){return x()},children:[c.jsx(Df.Header,{title:"Confirm changes?"}),c.jsxs(Df.Content,{children:[c.jsx("p",{css:ow,children:"Are you sure you want to save this dashboard?"}),c.jsx("p",{css:aw,children:"This will save the dashboard that new users will see, and the verified views in the library for new and existing users."})]}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{secondary:!0,onClick:function(){return x()},children:"Cancel"}),c.jsx(Pp,{testId:"confirm-save",onClick:function(){g(),x()},children:"Save"})]})})]})]})},sw=function(e){var n=zc(),r=n.dashboard,o=n.dispatch,a=zl().dashboardFilters,l=t.useState(0===r.globalFilters.length),s=l[0],u=l[1];return t.useEffect((function(){var e=function(e,t){var n,r=t(e.dataSets,[]).map((function(e){return U({},e,{managedByConfiguration:!0})})),o=[].concat(e.globalFilters).filter((function(e){return!e.managedByConfiguration})),a=t(e.dataSets,o),l=(n=r,[].concat(a).filter((function(e){return!pr(n,e)})));return e.globalFilters.length==l.length?i.cloneDeep(l):(Br("dashboardFilters function did not return the same number of user-added dashboard filters, so changes made to user-added dashboard filters will be ignored."),i.cloneDeep(e.globalFilters))}(r,a);o({type:"setGlobalFilters",globalFilters:e}),u(!0)}),[]),s?c.jsx(c.Fragment,{children:e.children}):null},uw={name:"firlg",styles:"grid-column:span 2 / span 2"},dw=function(e){return c.jsx("div",{css:uw,children:e.children})},cw=function(e){return c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Wd,{gap:"0.75rem",direction:"column",children:e.section.metrics.map((function(t,n){return c.jsxs(dw,{children:[c.jsx(vf,{children:t.title}),c.jsx(vg,U({componentType:e.attributes.type},e,{allowsMultiple:t.allowsMultiple,propKey:t.propKey,setPartialAttributes:e.setAttributes,supportedAggregates:e.queryEngineConfig.supportedAggregates}))]},n)}))})})},pw=function(e){return(null==e?void 0:e.dataSets.length)<2&&!e.dataSet.preAggregated?null:c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,"data-component":"dataset-section",children:c.jsx(lg,U({},e,{setPartialAttributes:e.setAttributes}))})},fw=function(e){var t=zl();return 0==vb(t.featureToggles,e.attributes.type,null==e?void 0:e.queryEngineConfig).length||e.dataSet.preAggregated?null:c.jsx(c.Fragment,{children:e.featureToggles.canEditCustomMetrics&&c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,"data-component":"custom-metric-section",children:c.jsx(jb,{queryEngineConfig:e.queryEngineConfig,setDataSets:e.setDataSets,dataSetId:e.attributes.dataSetId,dataSets:e.dataSets,componentType:e.attributes.type})})})},mw=function(e){if(e.dataSet.preAggregated)return null;if(!("order"in e.attributes))return null;var t=e.attributes,n=[],r=[];if("comboChart"===t.type){if(!("barDimension"in t&&"lineDimension"in t&&"barMeasure"in t&&"lineMeasure"in t))return null;var i=function(e){var t=[].concat(e.barDimension,e.lineDimension),n=[].concat(e.barMeasure,e.lineMeasure);return{dimension:t.filter((function(e,t,n){return n.findIndex((function(t){return JSON.stringify(t)===JSON.stringify(e)}))===t})),measure:n.filter((function(e,t,n){return n.findIndex((function(t){return JSON.stringify(t)===JSON.stringify(e)}))===t}))}}(t);n=i.dimension,r=i.measure}else{if(!("dimension"in t))return null;if(!("measure"in t))return null;n=t.dimension,r=t.measure}return c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,"data-component":"sort-section",children:c.jsx(xg,U({},e,{attributes:t,timeDimension:"timeDimension"in t&&t.timeDimension||null,dimension:n,measure:r,setPartialAttributes:e.setAttributes}))})},hw=function(e){var n=t.useState([]),r=n[0],i=n[1],o=zl(),a=o.mode,l=o.queryEngineConfig,s=Ab(r,null==e?void 0:e.dataSet,"grouping",l,i),u=Tb(null==e?void 0:e.dataSet,{onlyDimensions:!0},!0,[].concat(r,null==e?void 0:e.dimension)),d=kb(r,"grouping",l,i);return c.jsxs(Df,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},children:[c.jsx(Df.Header,{title:"Add Drilldown"}),c.jsx(Df.Content,{children:c.jsx(os,{columns:["1fr"],gap:"1rem",children:c.jsxs(Mf,{children:[c.jsx(kc,{as:"p",children:"Drilldown field"}),c.jsx(Sp,{mode:a,onDeleteItem:function(){return i([])},items:s,newItem:{callToAction:"Add drilldown field",onNew:d,initValues:u,hide:r.length>0}})]})})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Close"}),c.jsx(Pp,{onClick:function(){var t;0===r.length||e.onClose({subsetDimension:tt({field:r[0].field,function:null==(t=r[0])?void 0:t.function})})},primary:!0,disabled:0===r.length,children:"Update"})]})})]})},vw=function(e){var n=zl(),r=n.mode,o=n.queryEngineConfig,a=t.useState(!1),l=a[0],s=a[1];t.useEffect((function(){null!=e&&e.drilldown&&(null==e?void 0:e.drilldown.length)>0&&(0!==e.dimensions.length||i.isEmpty(e.drilldown)||e.onSetDrilldown([]))}),[e.dimensions]);var u=function(){var t;if(!(null==e||null==(t=e.drilldown)?void 0:t[0]))return[];var n=nt(null==e?void 0:e.drilldown[0].subsetDimension,o),r=Rn(e.dataSet,n.field);return[{title:bg(r.publicName,n.function&&"none"!=n.function&&Ne(n.function))}]}();return c.jsxs(c.Fragment,{children:[c.jsx(Sp,{mode:r,newItemBtn:i.isEmpty(null==e?void 0:e.drilldown)?{callToAction:"Add drilldown",onClick:function(){s(!0)}}:void 0,onDeleteItem:function(){return e.onSetDrilldown([])},items:u}),l&&c.jsx(hw,{show:l,onClose:function(t){t&&e.onSetDrilldown([t]),s(!1)},dimension:null==e?void 0:e.dimensions,dataSet:e.dataSet})]})},gw=function(e){return"tableDrilldown"in e.attributes?c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(vw,{dataSet:e.dataSet,dimensions:e.attributes.dimension,drilldown:null==e?void 0:e.attributes.tableDrilldown,onSetDrilldown:function(t){return e.setAttributes({tableDrilldown:t})}})}):null},bw=function(e){return"filter"in e.attributes?e.dataSet.preAggregated?null:c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Eb,U({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes}))}):null},xw=function(e){return"limit"in e.attributes?e.dataSet.preAggregated?null:c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Lb,{label:"Limit",labelHidden:!0,id:"limit",currentValue:e.attributes.limit,setNumber:function(t){return e.setAttributes({limit:t})}})}):null},yw=function(e){return"limit"in e.attributes?c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Lb,{label:"Limit",currentValue:e.attributes.limit,testId:"pagination-limit-input",setNumber:function(t){e.setAttributes({limit:t,offset:0})}})}):null},ww=function(e){return"comboChart"!=e.attributes.type?null:c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,children:c.jsxs(Wd,{gap:"0.75rem",direction:"column","data-component":"combo-chart-compare",children:[c.jsxs(Md,{children:[c.jsx(vf,{children:"Line"}),c.jsx(fg,U({propKey:"lineDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),c.jsxs(Md,{children:[c.jsx(vf,{children:"Bar"}),c.jsx(fg,U({propKey:"barDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),c.jsxs(Md,{children:[c.jsx(vf,{children:"Time"}),c.jsx(mg,U({},e,{attributes:{timeDimensions:e.attributes.timeDimension?[e.attributes.timeDimension]:[]},allow:1,supportedTimeDimensions:e.queryEngineConfig.supportedTimeTruncFunctions,setPartialAttributes:function(t){var n;t.timeDimensions&&(null==e||e.setAttributes({timeDimension:null!=(n=t.timeDimensions[0])?n:null}))}}))]})]})})},Cw=function(e){return"measure"in e.attributes?c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(gg,U({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes}))}):null},jw=function(e){return c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,"data-component":"views-section",children:c.jsx(Dg,U({},e,{setPartialAttributes:e.setAttributes}))})},Fw=function(e){return c.jsx(Gg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Sb,U({},e,e.section,{setPartialAttributes:e.setAttributes}))})},Sw=function(e){return c.jsx(os,{gap:"1.5rem",children:null==e?void 0:e.children})},kw=function(e){var t=Object.keys(e.queryEngineConfig.supportedTimeTruncFunctions),n=Ln(e.dataSet.fields,{onlyFieldTypes:["date_time"]});if(0===n.length)return null;var r,i=[];e.deltaTimeDimension&&i.push({title:Rn(e.dataSet,e.deltaTimeDimension.field).publicName,subtext:e.queryEngineConfig.supportedTimeTruncFunctions[null==(r=e.deltaTimeDimension)?void 0:r.truncate].publicName+" window",select:{onChange:function(t){e.deltaTimeDimension&&e.setDeltaTimeDimension(U({},e.deltaTimeDimension,{truncate:t}))},selected:e.deltaTimeDimension?e.deltaTimeDimension.truncate:t[0],options:[].concat(t).map((function(t){return{label:e.queryEngineConfig.supportedTimeTruncFunctions[t].publicName,value:t}}))}});var o=[].concat(n).map((function(e){return{title:""+e.publicName,subtext:"",value:e.id}})),a=zl();return c.jsx(Sp,{mode:a.mode,onDeleteItem:function(){e.setDeltaTimeDimension(null)},items:i,newItem:{callToAction:"Add percentage and absolute change",hide:null!=e.deltaTimeDimension,initValues:o,onNew:function(n){e.setDeltaTimeDimension({truncate:t[0],field:n,bucketFill:!1})}}})},Tw=function(e){var t,n=zl().queryEngineConfig,r=null==e?void 0:e.attributes;return t=Ln((null==e?void 0:e.dataSet).fields,{onlyFieldTypes:["date_time"]}),a(t)?null:c.jsx(Gg,{title:"Comparison",children:c.jsx(kw,{dataSet:null==e?void 0:e.dataSet,deltaTimeDimension:r.deltaTimeDimension,setDeltaTimeDimension:function(t){e.setAttributes({deltaTimeDimension:t})},queryEngineConfig:n})})},Aw=function(e){var r=e.dataPanelConfig.some((function(e){return"function"!=typeof e&&("filter"===e.type||"customMetrics"==e.type||"limit"==e.type)}))&&!e.dataSet.preAggregated;return c.jsxs(Sw,{children:[e.dataPanelConfig.map((function(t,r){return"function"==typeof t?c.jsx(n.Fragment,{children:t({dataSet:e.dataSet,attributes:e.attributes,dataSets:e.dataSets,featureToggles:e.featureToggles,setDataSet:e.setDataSet,setAttributes:e.setAttributes,setDataSets:e.setDataSets,queryEngineConfig:e.queryEngineConfig})},""+r):c.jsxs(n.Fragment,{children:["fieldCollector"==t.type&&c.jsx(Fw,U({},e,{section:t})),"drilldown"==t.type&&c.jsx(gw,U({},e,{section:t})),"labelledMetrics"==t.type&&c.jsx(cw,U({},e,{section:t})),"fields"==t.type&&c.jsx(Cw,U({},e,{section:t})),"dataSet"==t.type&&c.jsx(pw,U({},e,{section:t})),"views"==t.type&&c.jsx(jw,U({},e,{section:t})),"sort"==t.type&&c.jsx(mw,U({},e,{section:t})),"pagination"==t.type&&c.jsx(yw,U({},e,{section:t})),"comboChartDimension"==t.type&&c.jsx(ww,U({},e,{section:t})),"comparison"==t.type&&c.jsx(Tw,U({},e,{section:t}))]},t.type+"_"+r)})),r&&c.jsx(Jc,{title:"Advanced Options",defaultOpen:!1,showAccordionIcon:!0,onOpened:function(){Cb("bottom","editor-panel")},children:c.jsx(Sw,{children:e.dataPanelConfig.map((function(n,r){return"function"!=typeof n?c.jsxs(t.Fragment,{children:["filter"==n.type&&c.jsx(bw,U({},e,{section:n})),"customMetrics"==n.type&&c.jsx(fw,U({},e,{section:n})),"limit"==n.type&&c.jsx(xw,U({},e,{section:n}))]},r):null}))})})]})},Dw=function(){var e=Sg();if(!e)return c.jsx(fc,{});var t=e.dataSet,n=e.queryEngineConfig,r=e.dataPanel,i=e.dashboard,o=e.setPartialAttributes,a=e.component.attributes;if(!t)throw"Data set required to show data props editor.";var l=On(a.type,{queryEngineConfig:n});return c.jsx(Aw,{setDataSets:e.setDataSets,setAttributes:o,setDataSet:e.setDataSet,dataSets:i.dataSets,dataSet:t,featureToggles:e.featureToggles,attributes:a,queryEngineConfig:n,dataPanelConfig:r(l.dataPanelConfig(),{type:a.type})})},Iw=function(e){var n,r=e.section,i=e.setAttributes,o=e.attributes;return c.jsx(Gg,{title:r.title,tooltip:null==r?void 0:r.description,children:c.jsx(Gg.Grid,{children:null==r||null==(n=r.subSection)?void 0:n.map((function(e,n){return c.jsxs(t.Fragment,{children:["title"===e.type&&c.jsx("div",{children:c.jsx(tp,{label:null==e?void 0:e.title,"data-testid":"display-title-input",id:"display-title-input",type:"text",onChange:function(e){return i({displayTitle:e.target.value})},defaultValue:o.displayTitle})}),"subject"===e.type&&c.jsx("div",{children:c.jsx(tp,{label:null==e?void 0:e.title,"data-testid":"display-subject-input",id:"display-subject-input",type:"text",onChange:function(e){i({displaySubject:e.target.value})},defaultValue:o.displaySubject})})]},n)}))})})},Pw=function(e){return c.jsx(Ac,{children:c.jsx(Tc,{labelHidden:null==e?void 0:e.labelHidden,label:e.label,id:null==e?void 0:e.id,onChange:e.onSelect,options:e.options,selected:e.currentValue,dynamicWidth:!0})})},_w=function(e){return c.jsxs(Wd,{alignItems:"top"===(null==e?void 0:e.checkboxPosition)?"flex-start":"center",children:[c.jsx(np,{onChange:function(t){e.setChecked(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),c.jsx(kc,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},Ew=function(e){var t,n=zl().numberFormatOptions,r=Object.keys(n).map((function(e){return{value:e,label:n[e].description}}));return c.jsx(Ac,{children:c.jsx(Tc,{id:null==e?void 0:e.id,showClearBtn:!0,selected:null==e?void 0:e.currentValue,label:null!=(t=null==e?void 0:e.label)?t:"Format",onChange:function(t){return null==e?void 0:e.onChange(t)},options:r})})},Ow=function(e){var n=e.section,r=e.attributes,i=e.setAttributes,o=n.subSection.some((function(e){return"legend"===e.type||"numberFormat"===e.type})),a=n.subSection.some((function(e){return"stacked"===e.type||"curve"===e.type}));return c.jsx(Gg,{title:n.title,tooltip:null==n?void 0:n.description,children:c.jsxs(os,{gap:"1rem",children:[a&&c.jsx(Gg.Grid,{columns:2,"data-component":"layout",children:null==n?void 0:n.subSection.map((function(e,n){return c.jsxs(t.Fragment,{children:["stacked"===e.type&&c.jsx(Pw,{id:"format-layout-stacked",label:e.title,currentValue:void 0!==r.stacked&&r.stacked,onSelect:function(e){return i({stacked:e})},options:[{label:"Grouped",value:!1},{label:"Stacked",value:!0},{label:"Stacked (100%)",value:"100%"}]}),"curve"===e.type&&c.jsx(Pw,{label:e.title,id:"format-layout-curve",currentValue:r.lineCurve,onSelect:function(e){return i({lineCurve:e})},options:[{value:"natural",label:"Natural"},{value:"straight",label:"Straight"},{value:"step",label:"Step"}]})]},n)}))}),o&&c.jsx(Gg.Grid,{"data-component":"settings",children:null==n?void 0:n.subSection.map((function(e,n){return c.jsxs(t.Fragment,{children:["legend"===e.type&&c.jsx(_w,{label:e.title,setChecked:function(e){return i({legend:e})},currentValue:r.legend,id:"show-legend-input"}),"numberFormat"===e.type&&c.jsx(Ew,{label:e.title,onChange:function(e){return i({labelFormat:e})},id:"format-number",currentValue:r.labelFormat,testId:"format-number"})]},n)}))})]})})},Lw=function(e){return c.jsx(Mf,{children:c.jsx("div",{className:""+Mw,children:c.jsx(tp,{label:e.label,id:null==e?void 0:e.id,style:{padding:0,flexGrow:1,marginBottom:0},type:"color",onChange:function(t){e.setColor(t.target.value)},value:e.currentValue||void 0})})})},Mw=ua({width:"100%",flexDirection:"column",flexGrow:1,height:"100%",display:"flex"}),Rw=function(e){return c.jsx("div",{children:c.jsx(tp,{id:null==e?void 0:e.id,label:null==e?void 0:e.label,maxLength:e.maxLength,onChange:function(t){e.setText(t.target.value)},defaultValue:e.currentValue||void 0})})},Nw=function(e){return c.jsxs(Wd,{alignItems:"center",children:[c.jsx(np,{onChange:function(t){e.onChange(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),c.jsx(kc,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},zw=[{label:"Auto",value:"auto"},{label:"Minimal",value:2},{label:"None",value:0}],Bw=function(e){var t,n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b,x="horizontalBarChart"==e.attributes.type,y=(null==(t=e.attributes)||null==(n=t.dimension)?void 0:n.length)>0&&"number"===Rn(e.dataSet,null==(r=e.attributes)||null==(i=r.dimension[0])?void 0:i.field).dataType&&!(null!=(o=e.attributes)&&o.timeDimension),w=x?{x:"y",y:"x"}:{x:"x",y:"y"},C=w.x,j=w.y;return c.jsx(Gg,{title:null==(a=e.section)?void 0:a.title,tooltip:null==(l=e.section)?void 0:l.description,"data-component":"axis-preference-section",children:c.jsxs(Gg.Container,{"data-component":"single-stats-labels",children:[c.jsxs(Gg.Panel,{title:null==(s=e.section[j])?void 0:s.title,children:[c.jsxs(Gg.Grid,{columns:2,children:[c.jsx(Rw,{label:e.section[j].prefix.title,setText:function(t){return e.setAttributes({yAxisPrefix:t})},currentValue:e.attributes.yAxisPrefix,maxLength:4,id:"axis-"+j+"-prefix"}),c.jsx(Rw,{label:e.section[j].postfix.title,setText:function(t){return e.setAttributes({yAxisPostfix:t})},currentValue:e.attributes.yAxisPostfix,maxLength:4,id:"axis-"+j+"-postfix"})]}),c.jsxs(Gg.Grid,{columns:2,children:[c.jsx(Ew,{label:null==(u=e.section[j].format)?void 0:u.title,id:"axis-"+j+"-format",onChange:function(t){return e.setAttributes({yAxisFormat:t})},currentValue:e.attributes.yAxisFormat,testId:"axis-"+j+"-format"}),c.jsx(Pw,{id:"axis-"+j+"-label-count",label:e.section.y.count.title,currentValue:e.attributes.approxYAxisLabelCount,onSelect:function(t){return e.setAttributes({approxYAxisLabelCount:t})},options:zw})]}),c.jsx(Gg.Grid,{children:c.jsx(Rw,{label:null!=(d=null==(p=e.section[j].axisTitle)?void 0:p.title)?d:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[j]=t,n)})},currentValue:null==(f=e.attributes.axisTitles)?void 0:f[j],id:"axis-"+[j]+"-axisTitle"})})]}),c.jsxs(Gg.Panel,{title:e.section[C].title,children:[c.jsxs(Gg.Grid,{columns:2,children:[c.jsx(Rw,{label:e.section[C].prefix.title,setText:function(t){return e.setAttributes({xAxisPrefix:t})},currentValue:e.attributes.xAxisPrefix,maxLength:4,id:"axis-"+C+"-prefix"}),c.jsx(Rw,{label:e.section[C].postfix.title,setText:function(t){return e.setAttributes({xAxisPostfix:t})},currentValue:e.attributes.xAxisPostfix,maxLength:4,id:"axis-"+C+"-postfix"})]}),c.jsx(Gg.Grid,{columns:y?2:1,children:c.jsxs(c.Fragment,{children:[y&&c.jsx(Ew,{label:null==(m=e.section[C].format)?void 0:m.title,id:"axis-"+C+"-format",onChange:function(t){e.setAttributes({xAxisFormat:t})},currentValue:e.attributes.xAxisFormat,testId:"axis-"+j+"-format"}),null!=(h=e.attributes)&&h.timeDimension?c.jsx(Pw,{id:"axis-"+C+"-label-count",label:e.section.x.count.title,currentValue:e.attributes.approxXAxisLabelCount,onSelect:function(t){return e.setAttributes({approxXAxisLabelCount:t})},options:zw}):c.jsx(Nw,{label:"Hide Labels",onChange:function(t){return e.setAttributes({approxXAxisLabelCount:t?0:"auto"})},id:"hide-labels",currentValue:0===e.attributes.approxXAxisLabelCount})]})}),c.jsx(Gg.Grid,{children:c.jsx(Rw,{label:null!=(v=null==(g=e.section[C].axisTitle)?void 0:g.title)?v:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[C]=t,n)})},currentValue:null==(b=e.attributes.axisTitles)?void 0:b[C],id:"axis-"+[C]+"-axisTitle"})})]})]})})},qw=function(e,t){return t.map((function(t){var n=Rn(e,t.field);return{label:n.publicName+(ut(t)?" ("+Ne(t.function)+")":""),value:lt(t),icon:c.jsx(rc,{icon:n.dataType,paddingTop:0})}}))},Vw=function(e,t){return[].concat(t).flatMap((function(t){var n=Rn(e,t.field);return"date_time"==n.dataType?[]:[{label:n.publicName,value:t.field,icon:c.jsx(rc,{icon:n.dataType,paddingTop:0})}]}))},Hw=function(e,t,n){var r=st(t,n),i=Rn(e,r.field);return"none"==r.function?i.dataType:"number"},Ww=function(e,t,n){if(!t)return[];var r=Hw(e,t,n);return[].concat(Re({dataType:r},n)).filter(Yw).map((function(e){return{label:qe(e),value:e}}))},Yw=function(e){return!("is_one_of"===e||"is_not_one_of"===e)},Uw={name:"xwlclt",styles:"display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:1rem"};function Gw(e){var n=e.isOpen,r=e.dataSet,i=e.onClose,o=e.measures,a=e.dimension,l=e.onSave,s=e.ruleType,u=e.queryEngineConfig,d=t.useState(void 0),p=d[0],f=d[1],m=t.useState(void 0),h=m[0],v=m[1],g=t.useState(void 0),b=g[0],x=g[1],y=t.useState("#2aeb84"),w=y[0],C=y[1],j=p?Rn(r,rt(p,u).fieldId):null,F=void 0!==b&&"string"==typeof b&&0!==b.length||void 0!==b&&"boolean"==typeof b||void 0!==b&&"number"==typeof b&&!Number.isNaN(b),S=p?Hw(r,p,u):null;return c.jsxs(Df,{isOpen:n,onClose:i,width:"4xl",children:[c.jsx(Df.Header,{title:"Add Conditional Formatting",hiddenUnlessEnabledInCss:!1}),c.jsx(Df.Content,{children:c.jsxs("div",{css:Uw,children:[c.jsx(Mf,{children:c.jsx(Tc,{id:"conditional-formatting-field",label:"Field",anchorLeft:!0,options:[].concat(Vw(r,a),qw(r,o)),selected:p,onChange:function(e){return f(e)},renderSelected:function(e){return c.jsx(Ig,U({},e,{option:"inline"}))},controlClassName:""+Ea.paddingLeft("0.5rem")})}),c.jsx(Mf,{children:j&&c.jsx(Tc,{label:"Operator",id:"conditional-formatting-operator",anchorLeft:!0,options:[].concat(Ww(r,p,u)),selected:h,onChange:function(e){return v(e)}})}),"number"==S&&c.jsx(Lb,{id:"conditional-formatting-value",label:"Value",currentValue:b,setNumber:function(e){return x(e)}}),"string"==S&&c.jsx(Rw,{id:"conditional-formatting-value",label:"Value",currentValue:b,setText:function(e){return x(e)}}),"boolean"==S&&c.jsx(Md,{children:c.jsx(Tc,{label:"Value",id:"conditional-formatting-value",options:[{label:"True",value:!0},{label:"False",value:!1}],selected:b,onChange:function(e){return x(e)}})}),F&&c.jsx(Lw,{id:"color-formatting",label:"Color",currentValue:w,setColor:function(e){return C(e)}})]})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{secondary:!0,onClick:i,children:"Cancel"}),c.jsx(Pp,{onClick:function(){p&&h&&w&&(b||0==b)&&(l({field:p,operator:h,value:b,ruleType:s,ruleValue:w}),i())},children:"Save"})]})})]})}var Kw={name:"s5xdrg",styles:"display:flex;align-items:center"},Xw={name:"v5pkt6",styles:"margin-left:0.5rem;display:inline-block;height:1rem;width:1rem;border-radius:0.125rem"},Qw=function(e){var t=rt(e.rule.field,e.queryEngineConfig),n=t.function,r=Rn(e.dataSet,t.fieldId);return c.jsxs("span",{css:Kw,children:[c.jsxs("p",{className:""+Ea.text,children:["If"," ",c.jsxs("b",{children:[r.publicName," ",n&&"none"!=n&&"("+n+")"]})," ","is ",c.jsx("b",{children:e.rule.operator})," ",c.jsx("b",{children:e.rule.value})," then color is"]}),c.jsx("span",{css:Xw,style:{backgroundColor:e.rule.ruleValue}})]})},Jw=function(e){var n,r=t.useState(!1),i=r[0],o=r[1],a=zl();return c.jsxs(c.Fragment,{children:[c.jsx(Sp,{mode:a.mode,onOrderChange:function(t,n){var r=ug([].concat(e.conditionalFormattingRules),t,n);e.onSetConditionalFormattingRules(r)},items:(null!=(n=e.conditionalFormattingRules)?n:[]).map((function(t){var n=rt(t.field,e.queryEngineConfig);return{title:Rn(e.dataSet,n.fieldId).publicName,subtext:c.jsx(Qw,{dataSet:e.dataSet,rule:t,queryEngineConfig:e.queryEngineConfig})}})),newItemBtn:{callToAction:"Add Condition",onClick:function(){return o(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.conditionalFormattingRules)?n:[]);r.splice(t,1),e.onSetConditionalFormattingRules(r)}}),c.jsx(Gw,{queryEngineConfig:e.queryEngineConfig,ruleType:e.ruleType,dataSet:e.dataSet,isOpen:i,onClose:function(){return o(!1)},measures:e.measure,dimension:e.dimension||[],onSave:function(t){var n;e.onSetConditionalFormattingRules([].concat(null!=(n=e.conditionalFormattingRules)?n:[],[t]))}})]})},Zw=function(e){var t,n=e.section,r=e.attributes;return c.jsx(Gg,{title:n.title,tooltip:null==n?void 0:n.description,children:c.jsx(Wd,{gap:"0.75rem",direction:"column",children:n.subSection?null==(t=n.subSection)?void 0:t.map((function(t,i){var o,a;return c.jsxs("div",{children:[c.jsx(vf,{children:t.title}),c.jsx(Jw,{dimension:"bar"===t.propKey?r.barDimension:[],ruleType:null==n?void 0:n.ruleType,onSetConditionalFormattingRules:function(n){var r;return e.setAttributes({conditionalFormattingRules:(r={},r[t.propKey]=n,r)})},measure:"bar"===t.propKey?r.barMeasure:[],dataSet:e.dataSet,conditionalFormattingRules:null!=(o=null==r||null==(a=r.conditionalFormattingRules)?void 0:a[t.propKey])?o:void 0,queryEngineConfig:e.queryEngineConfig})]},i)})):c.jsx(Jw,{dimension:r.dimension,ruleType:null==n?void 0:n.ruleType,onSetConditionalFormattingRules:function(t){return e.setAttributes({conditionalFormattingRules:t})},measure:r.measure,dataSet:e.dataSet,conditionalFormattingRules:r.conditionalFormattingRules,queryEngineConfig:e.queryEngineConfig})})})},$w=function(e){var n,r,i,o=zl().dateTimeFormatOptions;return c.jsx(Gg,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:null==e||null==(r=e.section)||null==(i=r.subSection)?void 0:i.map((function(n,r){return c.jsxs(t.Fragment,{children:["time"===n.type&&c.jsx("div",{children:c.jsx(Tc,{label:n.title,onChange:function(t){e.setAttributes({dateTimeFormat:t})},options:Object.keys(o).map((function(e){return{label:o[e].description,value:e}})),selected:e.attributes.dateTimeFormat})}),"fontSize"===n.type&&c.jsx(Rw,{label:null==n?void 0:n.title,currentValue:e.attributes.fontSize,setText:function(t){return e.setAttributes({fontSize:t})}})]},r)}))})},eC=function(e,t){return t.map((function(t){return{label:Rn(e,t.field).publicName,value:lt(t)}}))};function tC(e){var n=e.dataSet,r=e.isOpen,i=e.onClose,o=e.measures,a=e.onSave,l=t.useState(void 0),s=l[0],u=l[1],d=t.useState(void 0),p=d[0],f=d[1];return c.jsxs(Df,{isOpen:r,onClose:i,width:"sm",children:[c.jsx(Df.Header,{title:"Choose a prefix"}),c.jsxs(Df.Content,{children:[c.jsxs(Mf,{children:[c.jsx(vf,{children:"Field"}),c.jsx(Tc,{options:eC(n,o),selected:s,onChange:function(e){return u(e)}})]}),c.jsx(Rw,{label:"Prefix",currentValue:p,setText:f})]}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{secondary:!0,onClick:i,children:"Cancel"}),c.jsx(Pp,{onClick:function(){s&&p&&(a({field:s,prefix:p}),i())},children:"Save"})]})})]})}var nC=function(e){var n,r,i=t.useState(!1),o=i[0],a=i[1],l=zl();return c.jsxs(Gg,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:[c.jsx(Sp,{mode:l.mode,items:(null!=(r=e.attributes.prefixes)?r:[]).map((function(t){var n=rt(t.field,e.queryEngineConfig),r=n.function;return{title:Rn(e.dataSet,n.fieldId).publicName+("none"!=r?" ("+e.queryEngineConfig.supportedAggregates[r].publicName+")":""),subtext:t.prefix}})),newItemBtn:{callToAction:"Add Prefix",onClick:function(){return a(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.attributes.prefixes)?n:[]);r.splice(t,1),e.setAttributes({prefixes:r})}}),c.jsx(tC,{dataSet:e.dataSet,isOpen:o,onClose:function(){return a(!1)},measures:e.attributes.measure,onSave:function(t){var n;return e.setAttributes({prefixes:[].concat(null!=(n=e.attributes.prefixes)?n:[],[t])})}})]})},rC=function(e){var t;if("mercatorMap"!=e.attributes.type)return null;var n=e.attributes,r=n.backgroundColor,o=n.noDataColor,a=n.maxValueColor,l=n.minValueColor,s=i.debounce(e.setAttributes,200);return c.jsx(Gg,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsxs(Gg.Grid,{columns:2,children:[c.jsx("div",{children:c.jsx(Lw,{id:"map-background-color",label:"Background",currentValue:r,setColor:function(e){return s({backgroundColor:e})}})}),c.jsx("div",{children:c.jsx(Lw,{id:"map-no-data-color",label:"No data",currentValue:o,setColor:function(e){return s({noDataColor:e})}})}),c.jsx("div",{children:c.jsx(Lw,{id:"map-min-value-color",label:"Min value",currentValue:l,setColor:function(e){return s({minValueColor:e})}})}),c.jsx("div",{children:c.jsx(Lw,{id:"map-max-value-color",label:"Max value",currentValue:a,setColor:function(e){return s({maxValueColor:e})}})})]})})},iC={name:"135831l",styles:"font-size:0.75rem;line-height:1rem;opacity:0.8"},oC=function(e){var n,r,i=zl().numberFormatOptions,o=Object.keys(i).map((function(e){return{value:e,label:i[e].description}}));return c.jsxs(Gg,{title:null==e||null==(n=e.section)?void 0:n.title,tooltip:null==e||null==(r=e.section)?void 0:r.description,children:[0==e.attributes.measure.length&&c.jsx("p",{css:iC,children:"Please select a metric on the data panel."}),c.jsx(Gg.Container,{"data-component":"single-stats-labels",children:[].concat(e.attributes.measure).map((function(n,r){var i,a,l,s,u;return c.jsxs(Gg.Panel,{title:c.jsxs(t.Fragment,{children:[Rn(e.dataSet,n.field).publicName," ","(",e.queryEngineConfig.supportedAggregates[n.function].publicName.toLowerCase(),")"]}),children:[c.jsxs(Gg.Grid,{columns:2,children:[c.jsx(Rw,{label:null==e||null==(i=e.section)?void 0:i.prefix.title,currentValue:e.attributes.prefixes[lt(n)],setText:function(t){var r,i=U({},e.attributes.prefixes,((r={})[lt(n)]=t,r));e.setAttributes({prefixes:i})}}),c.jsx(Rw,{label:null==e||null==(a=e.section)?void 0:a.postfix.title,currentValue:e.attributes.postfixes[lt(n)],setText:function(t){var r,i=U({},e.attributes.postfixes,((r={})[lt(n)]=t,r));e.setAttributes({postfixes:i})}})]}),c.jsx(Gg.Grid,{children:c.jsx(Pw,{options:o,currentValue:e.attributes.formatter[lt(n)]||"_vizzly_number",onSelect:function(t){var r,i=U({},e.attributes.formatter,((r={})[lt(n)]=t,r));e.setAttributes({formatter:i})},label:null!=(l=null==e||null==(s=e.section)||null==(u=s.format)?void 0:u.title)?l:"Format"})})]},r)}))})]})},aC={value:void 0,strokeStyle:"dashed",strokeWidth:2,color:da(0),label:void 0},lC=function(e){return!!Fe().validate(e).error},sC=function(e){return null!=e&&e.show?c.jsx(uC,U({},e)):null},uC=function(e){var n=function(e,n){var r=t.useState(null!=e?e:aC),i=r[0],o=r[1];return t.useEffect((function(){o(e||aC)}),[JSON.stringify(e)]),U({},i,{handleUpsert:function(){n(i)},onChange:function(e){o(U({},i,e))},disabled:lC(i)})}(null==e?void 0:e.goalLine,null==e?void 0:e.onSave),r=n.value,i=n.onChange,o=n.color,a=n.disabled,l=n.handleUpsert;return c.jsxs(Df,{isOpen:!0,onClose:null==e?void 0:e.onClose,width:"xl",children:[c.jsx(Df.Header,{title:"Add Goal Line"}),c.jsx(Df.Content,{children:c.jsxs(os,{columns:["1fr","1fr"],gap:"1rem",children:[c.jsx(Mf,{children:c.jsx(Lb,{id:"goal-line-value",label:"Value",currentValue:r,setNumber:function(e){return i({value:e})}})}),c.jsx(Lw,{id:"color-formatting",label:"Color",currentValue:o,setColor:function(e){return i({color:e})}})]})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Pp,{secondary:!0,onClick:null==e?void 0:e.onClose,children:"Cancel"}),c.jsx(Pp,{onClick:function(){return l()},disabled:a,children:"Save"})]})})]})},dC={name:"upzw6c",styles:"margin-right:0.25rem;display:inline-block;height:1rem;width:1rem;border-radius:0.125rem"},cC=function(e){var n,r=t.useState(!1),i=r[0],a=r[1],l=zl();return c.jsxs(c.Fragment,{children:[c.jsx(Sp,{mode:l.mode,onOrderChange:function(t,n){var r=ug([].concat(e.goalLines),t,n);e.onSetGoalLineRules(r)},items:(null!=(n=e.goalLines)?n:[]).map((function(e){return{title:c.jsxs(Wd,{alignItems:"center",gap:"0.25rem",children:[c.jsx("span",{css:dC,style:{backgroundColor:e.color}}),"Set to ",c.jsx("span",{className:""+Ea.bold,children:e.value})]}),onClick:function(){return a(e)}}})),newItemBtn:{callToAction:"Add Goal Line",onClick:function(){return a(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.goalLines)?n:[]);r.splice(t,1),e.onSetGoalLineRules(r)}}),c.jsx(sC,{show:!!i,goalLine:"boolean"!=typeof i?i:void 0,onClose:function(){return a(!1)},onSave:function(t){a(!1);var n=function(e,t,n){var r;if("object"==typeof e&&null!==e){var i=o.findIndex(t,(function(t){return o.isEqual(t,e)}));-1!==i?(r=[].concat(t))[i]=n:r=[].concat(null!=t?t:[],[n])}else r=[].concat(null!=t?t:[],[n]);return r}(i,e.goalLines,t);e.onSetGoalLineRules(n)}})]})},pC=function(e){var t;return c.jsx(Gg,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsx(cC,{onSetGoalLineRules:function(t){return e.setAttributes({goalLines:t})},goalLines:e.attributes.goalLines})})},fC=function(e){return c.jsx(Sw,{children:null==e?void 0:e.formatPanelConfig.map((function(r,i){return"function"==typeof r?c.jsx(n.Fragment,{children:r({dataSet:e.dataSet,attributes:e.attributes,dataSets:e.dataSets,featureToggles:e.featureToggles,setDataSet:e.setDataSet,setAttributes:e.setAttributes,setDataSets:e.setDataSets,queryEngineConfig:e.queryEngineConfig})},""+i):c.jsxs(t.Fragment,{children:["heading"===r.type&&c.jsx(Iw,U({},e,{section:r})),"format"===r.type&&c.jsx($w,U({},e,{section:r})),"prefixes"===r.type&&c.jsx(nC,U({},e,{section:r})),"axisLabels"===r.type&&c.jsx(Bw,U({},e,{section:r})),"mapColors"===r.type&&c.jsx(rC,U({},e,{section:r})),"conditionalFormatting"===r.type&&c.jsx(Zw,U({},e,{section:r})),"goalLine"===r.type&&c.jsx(pC,U({},e,{section:r})),"chartStyles"===r.type&&c.jsx(Ow,U({},e,{section:r})),"statsLabels"===r.type&&c.jsx(oC,U({},e,{section:r}))]},i)}))})},mC=function(){var e=Sg();if(!e)return c.jsx(fc,{});var t=On(e.component.attributes.type,{queryEngineConfig:e.queryEngineConfig});return c.jsx(fC,{setDataSets:e.setDataSets,setAttributes:e.setPartialAttributes,setDataSet:e.setDataSet,dataSets:e.dashboard.dataSets,dataSet:null==e?void 0:e.dataSet,featureToggles:e.featureToggles,attributes:e.component.attributes,queryEngineConfig:e.queryEngineConfig,formatPanelConfig:e.formatPanel(t.formatPanelConfig(),{type:e.component.attributes.type})})};function hC(e){return c.jsx(c.Fragment,{children:c.jsxs(Ef.Group,{defaultIndex:e.defaultTabOpen||0,children:[c.jsxs(Ef.List,{columns:"1fr 1fr",children:[c.jsx(Ef.Button,{"data-component":"tab-data",children:c.jsx(Yp,{override:"editor.tab.heading.data",children:"Data"})}),c.jsx(Ef.Button,{"data-component":"tab-format",children:c.jsx(Yp,{override:"editor.tab.heading.format",children:"Format"})})]}),c.jsxs(Ef.Panels,{children:[c.jsx(Ef.Panel,{children:c.jsx(Dw,{})}),c.jsx(Ef.Panel,{children:c.jsx(mC,{})})]})]})})}var vC=function(e){return Zt(null==e?void 0:e.component.attributes)?null:c.jsx(Md,{paddingX:24,paddingTop:16,children:c.jsx(ag,{title:"Feedback",type:"info",children:Jt(null==e?void 0:e.component.attributes)})})},gC=Object.assign((function(){return null}),{panel:ua(U({height:"100%",overflow:"overlay",padding:"0 8px"},Yd)),view:ua(U({height:"100%",overflow:"overlay"},Yd))}),bC=Object.assign((function(){return null}),{dataSetDescriptionPanel:function(){return ua({position:"absolute",marginTop:"-5px",padding:"8px"})}}),xC=function(e){var t=i.sortBy(e.fields,(function(e){return e.publicName}));return c.jsx("div",{children:c.jsx(os,{columns:["1fr","1fr","1fr"],gap:10,children:t.map((function(e){return c.jsxs(Wd,{direction:"row",gap:"0.2rem",children:[c.jsx(Md,{width:24,alignSelf:"start","data-component":"ai-field-data-type-icon",children:c.jsx(tc,{icon:e.dataType})}),e.publicName]})}))})})},yC=function(e){var n=t.useState(!1),r=n[0],o=n[1],a=t.useState("awaitingInput"),l=a[0],s=a[1],u=t.useState(""),d=u[0],p=u[1],f=us(),m=function(){var t=Y(H().mark((function t(){var n;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e.onAskAI){t.next=10;break}return s("pending"),t.next=5,e.onAskAI(d,e.dataSet);case 5:e.setPartialAttributes(n=t.sent),console.log("aiGeneratedQueryAttributes",n),s("answered"),setTimeout((function(){s("awaitingInput")}),3e3);case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),console.error(t.t0);case 15:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(){return t.apply(this,arguments)}}(),h=i.groupBy(e.dataSet.fields,(function(e){return e.dataType}));return c.jsxs("div",{style:{width:"100%",position:"relative"},children:[c.jsxs(os,{columns:["1fr","auto"],children:[c.jsx(tp,{placeholder:"Show me...",onFocus:function(){return o(!0)},onBlur:function(){return o(!1)},value:d,onChange:function(e){return p(e.target.value)}}),c.jsx(Md,{paddingX:10,position:"relative",width:"100%",children:c.jsxs(Dp,{primary:!0,disabled:"awaitingInput"!=l,onClick:function(){m()},children:["answered"==l&&"Done","awaitingInput"==l&&"Ask","pending"==l&&"Thinking"]})})]}),r&&c.jsx("div",{className:Gd.wrapper(null==f?void 0:f.dropdowns)+" "+bC.dataSetDescriptionPanel(),children:c.jsxs(os,{rows:["1fr"],gap:"1.5rem",children:[c.jsx(xC,{fields:h.number||[]}),c.jsx(xC,{fields:h.string||[]}),c.jsx(xC,{fields:h.date_time||[]}),c.jsx(xC,{fields:h.boolean||[]})]})})]})},wC=t.createContext(void 0),CC={name:"1n8cavw",styles:"height:40rem;width:100%"},jC=function(e){var n,r,o,a,l,s,u=Sg(),d=t.useContext(wC);if(!u)return c.jsx(fc,{});var p=u.setAttributes,f=u.dashboard,m=u.dataSet,h=u.onAskAI,v=u.setPartialAttributes,g=u.setResults,b=u.mode,x=u.origin,y=u.componentEditor,w=u.runQueriesCallback,C=u.component,j=u.dispatch,F=u.broadcastEvent,S=u.queryEngineConfig,k=null==d?void 0:d.active,T=us(),A="boolean"==typeof(null==T||null==(n=T.modals)||null==(r=n.options)||null==(o=r.showTitle)?void 0:o.editor)&&!(null!=T&&null!=(a=T.modals)&&null!=(l=a.options)&&null!=(s=l.showTitle)&&s.editor),D=(null==y?void 0:y.target.displayTarget)||i.isNumber(null==y?void 0:y.target.libraryIndex);return c.jsxs("div",{"data-testid":"editor",children:[c.jsx(xf,{title:"Editor","data-component":"editor-header",hide:A}),c.jsx(wf,{"data-component":"editor-content",children:c.jsx("div",{css:CC,children:c.jsxs(os,{columns:["24rem","1fr"],height:"100%",children:[c.jsx("div",{id:"editor-panel",className:""+gC.panel,children:c.jsx(hC,{})}),c.jsxs(os,{rows:k?["50px","1fr","100px"]:["1fr","100px"],className:""+gC.view,children:[k&&c.jsx(yC,{dataSet:m,attributes:C.attributes,queryEngineConfig:S,onAskAI:h,setPartialAttributes:v}),c.jsx(Md,{paddingX:24,paddingTop:16,position:"relative",overflowY:"auto",width:"100%",children:c.jsx(Kx,{id:"editor_"+Math.floor(1e11*Math.random()),isBeingSizeAdjusted:!1,setLocalFilters:u.setLocalFilters,setParameterUpdate:u.setParameterUpdate,runQueriesCallback:w,setResults:g,component:C,updateComponentAttributes:p,editor:!0})}),c.jsx(vC,{component:C})]})]})})}),c.jsx(yf,{buttons:"end","data-component":"editor-footer",children:c.jsxs(Of,{children:[c.jsx(Pp,{secondary:!0,onClick:function(){F("editor.changesCancelled"),e.onClose?e.onClose():j({type:"clearModal"})},children:D?"Cancel":"Close"}),D&&c.jsx(Pp,{onClick:function(){F("editor.changesConfirmed"),j({type:"saveComponent",protectedComponent:"library"===x&&"admin"===b})},children:FC(b,x,(null==y?void 0:y.target.libraryIndex)!==f.componentLibrary.length)})]})})]})};function FC(e,t,n){return"library"===t&&n?"Save":"library"===t?"Add to Library":"endUser"===e?"Save":"Confirm"}var SC,kC,TC,AC,DC,IC=function(e){var n=zc().dispatch,r=zl().onReset,i=t.useState(!1),o=i[0],a=i[1],l=function(){var t=Y(H().mark((function t(){var i;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a(!0),t.next=3,r();case 3:(i=t.sent)&&n({type:"setDashboard",dashboard:i}),a(!1),null==e||e.onClose();case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),s=t.useState(!1),u=s[0],d=s[1];return t.useEffect((function(){e.show||(d(!1),a(!1))}),[e.show]),c.jsxs(Df,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(Df.Header,{title:"Confirm Reset",show:!0}),c.jsx(Df.Content,{children:c.jsx(_w,{label:"Any change you have made will be lost and the default dashboard will be restored.",setChecked:function(e){return d(e)},currentValue:u,id:"reset-dashboard",checkboxPosition:"top"})}),c.jsx(Df.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Dp,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},disabled:o,children:"Cancel"}),c.jsx(Dp,{onClick:function(){u&&l()},disabled:!u||o,primary:!0,children:"Reset Dashboard"})]})})]})},PC=function(e){return!1===zl().featureToggles.showResetButton?null:c.jsx(dp,{tooltipContent:function(){return"Reset dashboard to default"},children:c.jsx(Dp,{onClick:e.onChange,disabled:null==e?void 0:e.disabled,className:"vizzly_reset-button",children:"Reset"})})},_C=function(){var e=t.useState(!1),n=e[0],r=e[1],o=zc(),a=o.runQueriesCallback,l=o.dashboard,s=o.dispatch,u=o.componentEditor,d=o.pickFromComponentLibrary,p=o.broadcastEvent,f=t.useState(null),m=f[0],h=f[1],v=zl(),g=v.maxCSVDownloadLimit,x=v.featureToggles,y=v.scope,w=function(e,t){p("library.open"),s({type:"startPickingComponentFromLibraryForDisplay",rowIndex:e,cellIndex:t})},C=function(e,t){p("manageDisplay.removeCell"),s({type:"removeCell",rowIndex:e,cellIndex:t})},j=function(e,t){s({type:"startEditingComponent",displayTarget:{rowIndex:e,cellIndex:t},libraryIndex:null,component:null})},F=null!=u||null!=d,S="neither",k=void 0;null!=u?(S="editor",k="modal-editor"):null!=d&&(S="library",k="modal-library");var T=x.showGlobalFilters,A=x.canAddNewRows,D=function e(t){return i.isArray(t)?i.every(t,e):!t.requiresValue||!(!t.requiresValue||!t.value)}(l.globalFilters);D||Nr("Required dashboard filters do not have values, so the display of the dashboard will not render.",l.globalFilters);var I,P="read"===y,_=0===l.globalFilters.length&&P;return I=P&&l.globalFilters.length>0?["1fr"]:P||!1===A?["auto"]:["32px","auto"],c.jsx(b.DndProvider,{backend:q.HTML5Backend,children:c.jsxs(sw,{children:[c.jsx(lw,{}),c.jsx(Md,{padding:"0.25rem","data-component":"dashboard",overflow:"hidden",className:"vizzly-studio",children:c.jsxs(os,{rows:_?["auto"]:EC(),columns:I,gap:8,className:lc("dashboard"),"data-component":"dashboard-grid",children:[!_&&c.jsxs(Wd,{gridRow:1,gap:"16px","data-component":"toolbar",className:""+OC(y),justifyContent:"space-between",children:[c.jsx(Md,{flex:"0 0 80%",paddingLeft:P?"0.5rem":void 0,children:T&&c.jsx(uy,{})}),"read_write"===y&&c.jsx(Md,{children:c.jsx(PC,{onChange:function(){return r(!0)}})})]}),D&&c.jsxs(c.Fragment,{children:[c.jsx(Md,{gridColumn:"span 2/span 2",gridRow:2,"data-component":"panels",children:l.display.map((function(e,t){return c.jsx("div",{onMouseOver:function(){return h(t)},onMouseLeave:function(){return h(null)},onFocus:function(){return h(t)},onBlur:function(){return h(null)},style:{position:"relative"},children:c.jsxs(os,{columns:I,"data-component":"panel-row",marginBottom:26,children:[c.jsx(Wd,{alignItems:"stretch",paddingY:8,"data-component":"add-cell",children:m===t&&(n=e,x.canAddNewCells&&n.components.length<6)&&c.jsx(Zy,{onChange:function(){return function(e){p("manageDisplay.appendCell"),s({type:"appendCell",rowIndex:e})}(t)},narrow:!0,tooltipLabel:"Add Cell to Dashboard",label:"Add Cell"})}),c.jsx(Ky,{maxCSVDownloadLimit:g,onCreateNew:j,onPickFromLibrary:w,onRemoveCell:C,rowIndex:t,dispatch:s,dashboard:l,runQueriesCallback:a,broadcastEvent:p,displayRow:l.display[t],onColSpanChange:function(e){s({type:"setColSpans",colSpans:e,rowIndex:t})},rowHighlighted:m===t},"dashboard_"+l.id+"_row_"+t)]})},l.id+"_row_"+t);var n}))}),l.display.length<l.theme.rowLimit&&x.canAddNewRows&&c.jsx(Wd,{alignItems:"stretch",gridRow:3,gridColumn:2,paddingRight:28,"data-component":"add-row",children:c.jsx(Zy,{label:"Add Row",onChange:function(){var e;e=l.display.length,p("manageDisplay.newRow"),s({type:"insertRow",rowIndex:e}),Cb(350)}})})]})]})}),c.jsxs(Df,{width:"7xl",isOpen:F,onClose:function(){p("library.close"),s({type:"clearModal"})},transparentBackground:"modal-library"==k,namespace:k,children:["library"==S&&c.jsx(ny,{}),"editor"==S&&c.jsx(jC,{})]}),c.jsx(my,{}),c.jsx(IC,{show:n,onClose:function(){return r(!1)}})]})})},EC=function(){return["minmax(28px, 1fr)","auto","72px"]},OC=function(e){return ua("read"===e?{"@media (min-width: 767px)":{paddingRight:46,gridColumn:1},"@media (max-width: 768px)":{paddingRight:28,gridColumn:"span 2/span 2"}}:{paddingRight:29,gridColumn:2})},LC=function(e){var t=n.useState(0),r=t[0],i=t[1],o=function(){var t=Y(H().mark((function t(){var n;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.onReset();case 2:if(!(n=t.sent)){t.next=6;break}return i(r+1),t.abrupt("return",n);case 6:return t.abrupt("return",null);case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return c.jsx(Nl,{mode:e.dashboardBehaviour.mode,includeComponentTypes:e.includeComponents,excludeComponentTypes:e.excludeComponents,dashboardBehaviour:e.dashboardBehaviour,onError:null==e?void 0:e.onError,onViewClick:null==e?void 0:e.onViewClick,onReset:o,disableToolbar:null==e?void 0:e.dashboardBehaviour.disableToolbar,cascadeFilterSelection:null==e?void 0:e.dashboardBehaviour.cascadeFilterSelection,children:c.jsx(Nc,{theme:null==e?void 0:e.theme,dashboard:e.dashboard,componentEditor:e.componentEditor,onDashboardUpdate:e.onDashboardUpdate,runQueriesCallback:function(t,n){var r;return e.runQueriesCallback(t,U({},n,{dataAccessToken:null==(r=e.identityConfig.dataAccess)?void 0:r.signature}))},children:c.jsx("div",{children:c.jsx(Vp,{children:null==e?void 0:e.children})},"_vizzly_dashboard_"+e.dashboard.id+"_"+r)})})},MC=t.createContext(void 0),RC=function(){var e=Y(H().mark((function e(t,n){var r,i,o,a,l;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("exact"!=t.type){e.next=7;break}return r=so(t.dashboardId,n.permissions),Nr("A specific dashboard has been requested. This will be rendered with",i=r?"read_write":"read","scope.",t.dashboardId),e.abrupt("return",{dashboardId:t.dashboardId,mode:r&&t.dashboardId==n.defaultParentDashboardId?"admin":"endUser",scope:i});case 7:if("instantCopyOf"!=t.type){e.next=27;break}if(!so(t.parentDashboardId,n.permissions)){e.next=12;break}return Nr("Write access to the parent dashboard has been found, so this dashboard will be shown with admin access.",t.parentDashboardId),e.abrupt("return",{dashboardId:t.parentDashboardId,mode:"admin",scope:"read_write"});case 12:if(o=Xr(t.parentDashboardId,n.writeAccessDashboards),!(a=function(e){return[].concat(e).sort((function(e,t){var n=new Date(e.updatedAt);return new Date(t.updatedAt).getTime()-n.getTime()}))}(o)[0]||null)){e.next=17;break}return Nr("An existing child dashboard exists of the parent dashboard. As no specific dashboardId was provided, we will render the most recently updated child dashboard",a.id),e.abrupt("return",{dashboardId:a.id,mode:"endUser",scope:"read_write"});case 17:if(l=Qr(n.dashboards,n.defaultParentDashboardId)){e.next=20;break}throw"Failed to find parent dashboard. "+n.defaultParentDashboardId;case 20:return Nr("No previous child dashboard has been created on behalf of the current user for the parent dashboard",l.id,". Creating a child copy of the parent."),e.next=23,n.createDashboard({parentDashboardId:l.id,definition:Gr(l),meta:{},permissions:[{scope:"read_write"}]});case 23:return e.abrupt("return",{dashboardId:e.sent.id,scope:"read_write",mode:"endUser"});case 27:throw"Unsupported strategy";case 28:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),NC=function(e){function t(){var t;return(t=e.call(this,"At least one data set must be built for the Vizzly dashboard to render.")||this).name="NoDataSetResolved",t}return G(t,e),t}(Z(Error)),zC=function(){var e=Y(H().mark((function e(t,n,r){var i,o;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Hi(t),e.next=3,i({method:"post",body:{dynamicConfig:"object"==typeof t?t.dynamicConfig:void 0,integritySignature:n},mode:"cors",path:"/api/v1/resolve-data-sets",abortSignal:r});case 3:if(200!=(o=e.sent).status){e.next=6;break}return e.abrupt("return",o.body.dataSets);case 6:throw new Gi("Failed to resolve data sets from "+JSON.stringify(t)+". Received status "+o.status);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),BC=function(e){if("queryEngineEndpoint"in e&&e.queryEngineEndpoint)return t=e.queryEngineEndpoint,function(){var e=Y(H().mark((function e(n){var r;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zC(t,null==(r=n.dataAccess)?void 0:r.signature);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var t;if(!e.dataSets)throw new Xi;return e.dataSets},qC=function(e){return function(){var t=Y(H().mark((function t(n,r){var i,o;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"function"==typeof(i=BC(e))){t.next=4;break}throw new Xi;case 4:return t.next=6,i(n,r);case 6:if(o=t.sent){t.next=9;break}throw new Gi("Failed to fetch data sets from the query engine endpoint");case 9:return t.abrupt("return",o.map((function(e){return zn(e,r)})));case 12:if(t.prev=12,t.t0=t.catch(0),!(t.t0 instanceof Xi)){t.next=16;break}throw t.t0;case 16:throw new Gi("Failed to fetch data sets.");case 17:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(e,n){return t.apply(this,arguments)}}()},VC=function(e){return Y(H().mark((function t(){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("queryEngineConfig"in e)||!e.queryEngineConfig){t.next=4;break}return t.abrupt("return",Yi(e.queryEngineConfig));case 4:if(!("queryEngineEndpoint"in e)||!e.queryEngineEndpoint){t.next=6;break}return t.abrupt("return",Yi(e.queryEngineEndpoint));case 6:return t.abrupt("return",to);case 7:case"end":return t.stop()}}),t)})))},HC={file:"local file",environment:"environment variables",github:"GitHub",s3:"AWS S3",vizzlyEncrypted:"Vizzly API"},WC={name:"1gqeage",styles:"margin-right:0.75rem"},YC=function(e){return c.jsx("div",{children:c.jsxs("span",{children:[c.jsxs("span",{css:WC,children:[!0===e.status&&c.jsx(XC,{}),!1===e.status&&c.jsx(JC,{}),null===e.status&&c.jsx($C,{})]}),!0===e.status&&e.successMessage,!1===e.status&&e.errorMessage,null===e.status&&e.unknownMessage]})})},UC={name:"5edt7z",styles:"display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));> :not([hidden]) ~ :not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse));}"},GC=function(e){return c.jsxs("div",{css:UC,children:[c.jsx(YC,{status:e.statusReport.configFound,successMessage:e.statusReport.configSources?"Config was fetched from "+(t=e.statusReport.configSources.dataSets,Qe(t.map((function(e){return HC[e]})))+" with ")+Xe(e.statusReport.dataSetsCount||0,"data set","data sets"):"Config was found",errorMessage:"Config was not found",unknownMessage:"We did not check the existence of the Vizzly config"}),c.jsx(YC,{status:e.statusReport.configValid,successMessage:"Config is valid",errorMessage:"Config is not valid",unknownMessage:"We did not run any config validation checks"}),c.jsx(YC,{status:e.statusReport.connectionOk,successMessage:"Connection check passed",errorMessage:"Connection check failed. Please check the logs",unknownMessage:"We did not run a connection check"})]});var t},KC={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},XC=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:KC,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})},QC={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},JC=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:QC,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})},ZC={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},$C=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:ZC,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.625 12a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H8.25m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H12m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0h-.375M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})},ej=function(){var e=Y(H().mark((function e(t,n){var r,i,o;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Hi(t),e.next=3,r({path:"/api/status",method:"post",mode:"cors",abortSignal:n,body:{}});case 3:return o=(i=e.sent).body,e.abrupt("return",200==i.status?o:null);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),tj=function(e){var t=c.jsx("code",{style:{background:"rgba(0, 0, 0, 0.05)",borderRadius:"5px",padding:"2px 5px"},children:e.children});return e.href?c.jsx("a",{target:"_blank",href:e.href,children:t}):t},nj={name:"n4q3vn",styles:"margin-bottom:1.5rem;margin-top:1.5rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(243 245 249 / var(--tw-bg-opacity));padding:0.75rem"},rj={name:"1flj9lk",styles:"text-align:left"},ij={name:"1u8s3xj",styles:"margin-bottom:0.75rem;font-weight:700"},oj={name:"1gok8e8",styles:"margin-bottom:0.5rem"},aj={name:"1f0dvzm",styles:"margin-top:1.5rem;text-align:right"},lj={name:"y5vlkk",styles:"margin-top:0.75rem;width:100%;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(243 245 249 / var(--tw-bg-opacity));padding:0.75rem;text-align:left"},sj={name:"1u8s3xj",styles:"margin-bottom:0.75rem;font-weight:700"},uj={name:"12q5llh",styles:"margin-top:0.5rem;text-align:right"},dj={name:"fevti5",styles:"margin-bottom:0.75rem;margin-top:0.75rem;font-weight:700"},cj=function(e){var n=t.useState(void 0),r=n[0],i=n[1];return t.useEffect((function(){var t=new AbortController;return"self-hosted"==e.implementationMeta.type&&e.implementationMeta.queryEngineEndpoint&&function(){var e=Y(H().mark((function e(n){var o,a;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=setTimeout((function(){t.signal.aborted||void 0!==r||(t.abort(),i(null))}),2e3),e.prev=1,e.next=4,ej(n,t.signal);case 4:a=e.sent,clearTimeout(o),i(a||null),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),i(null);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()(e.implementationMeta.queryEngineEndpoint),function(){t.abort()}}),[]),c.jsx(Qp,{title:"Vizzly set up",renderExtra:function(){return c.jsxs("div",{style:{width:"650px"},children:[e.helpSections.map((function(e){return c.jsxs("div",{css:nj,children:[c.jsxs("div",{css:rj,children:[c.jsx("h2",{css:ij,className:""+Ea.text,children:e.title}),e.text.map((function(e){return c.jsx("p",{css:oj,className:""+Ea.text,children:e})}))]}),e.callToAction&&c.jsx("div",{css:aj,children:c.jsx("a",{target:"_blank",href:e.callToAction.link,children:c.jsx(Pp,{secondary:!0,children:e.callToAction.text})})})]})})),void 0!==r&&c.jsxs("div",{css:lj,children:[null===r&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{css:sj,className:""+Ea.text,children:"Vizzly Query Engine not found"}),c.jsxs("p",{className:""+Ea.text,children:["If you have deployed the Vizzly Query Engine, then please set the ",c.jsx(tj,{children:"queryEngineEndpoint"})," ","property to the URL where it is deployed too."]}),c.jsx("div",{css:uj,children:c.jsx("a",{target:"_blank",href:"https://docs.vizzly.co/query-engines/self-hosted-query-engine",children:c.jsx(Pp,{secondary:!0,children:"Deploy the Query Engine"})})})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{css:dj,className:""+Ea.text,children:"Query engine status"}),c.jsx(GC,{statusReport:r})]})]})]})}})},pj=function(e){return c.jsx(cj,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"Set up identity"},text:[c.jsxs(c.Fragment,{children:["We need to replace the current placeholder ",c.jsx(tj,{children:"identity"})," function with your own identity logic."]}),"Typically, this is an HTTPS call to your servers to retrieve the Vizzly identity tokens."]}]})},fj=function(e){return c.jsx(cj,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"See the docs"},text:["The async identity function must return the Vizzly access tokens in the correct format."]}]})},mj=function(e){var t=[];switch(e.implementationMeta.type){case"custom":case"in-browser":t=[c.jsxs(c.Fragment,{children:["The ",c.jsx(tj,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"}),"function must provide at least one data set"]})];break;case"self-hosted":t=[c.jsx(c.Fragment,{children:"To start using the Vizzly dashboard, you must add a data set to the Vizzly Query Engine."}),c.jsx(c.Fragment,{children:"If you have already done this, check the `dataSets` value in your identity token to make sure it allows at least one data set to be returned."})]}return c.jsx(cj,{implementationMeta:e.implementationMeta,helpSections:[{title:"At least one data set must be provided",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/dataSets",text:"See the docs"},text:t}]})},hj=function(e){return c.jsx(cj,{implementationMeta:e.implementationMeta,helpSections:[{title:"We did not fetch your data sets.",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/dataSets",text:"See the docs"},text:[c.jsxs(c.Fragment,{children:["If you are using the Vizzly Query Engine, then you will need to set the"," ",c.jsx(tj,{href:"https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint",children:"queryEngineEndpoint"})," ","property on the dashboard."]}),c.jsxs(c.Fragment,{children:["Alternatively, if you are not using the Vizzly Query Engine, then the"," ",c.jsx(tj,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"})," property is required, and it must be an async function."]})]}]})},vj={name:"185o5ba",styles:"text-decoration-line:underline"},gj=function(e){return c.jsx(cj,{implementationMeta:e.implementationMeta,helpSections:[{title:"Query Engine Endpoint",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint",text:"See the docs"},text:[c.jsxs(c.Fragment,{children:["Incorrect ",c.jsx(tj,{children:"queryEngineEndpoint"})," value",e.invalidEndpoint?" ("+JSON.stringify(e.invalidEndpoint)+")":"",". Please deploy the"," ",c.jsx("a",{css:vj,href:"https://docs.vizzly.co/query-engines/self-hosted",children:"Vizzly Query Engine"}),", and then provide the URL to it as a string, or as an object with a string host value."]})]}]})},bj=function(e){return c.jsx(cj,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"See the docs"},text:[c.jsxs(c.Fragment,{children:[c.jsx(tj,{children:"identity"})," must be an async function that returns your Vizzly identity tokens."]})]}]})};kC=SC||(SC={}),AC=TC||(TC=kC.ComponentOverrides||(kC.ComponentOverrides={})),function(e){var t;t||(t=e.ComponentOptions||(e.ComponentOptions={}))}(DC||(DC=AC.Props||(AC.Props={})));var xj=function(e){qr(e.error);var t=c.jsx("p",{children:"Unknown error"});return e.error instanceof NC&&(t=c.jsx(mj,{implementationMeta:e.implementationMeta})),e.error instanceof Xi&&(t=c.jsx(hj,{implementationMeta:e.implementationMeta})),e.error instanceof qi&&(t=c.jsx(gj,{implementationMeta:e.implementationMeta,invalidType:!0})),e.error instanceof Bi&&(t=c.jsx(gj,{implementationMeta:e.implementationMeta,invalidEndpoint:e.error.invalidEndpoint})),e.error instanceof Ki&&(t=c.jsx(bj,{implementationMeta:e.implementationMeta})),e.error instanceof _i&&(t=c.jsx(of,{})),e.error instanceof Ei&&(t=c.jsx(fj,{implementationMeta:e.implementationMeta})),e.error instanceof Oi&&(t=c.jsx(ef,{})),e.error instanceof Gi&&(t=c.jsx(tf,{})),e.error instanceof Ni&&(t=c.jsx(pj,{implementationMeta:e.implementationMeta})),c.jsxs(c.Fragment,{children:[c.jsx(bo,{}),t]})},yj=function(e,t){return e.map((function(e){return e.map((function(e){var t=e.field;return{id:lt({field:t.id,function:e.functionId}),publicName:t.publicName,dataType:t.dataType}}))}))},wj=function(e,t,n){var r=t.map((function(t){var r=Mn(e,t.dataSetId);if(!r)throw"Data set not found for query attributes query";return Et(r,t.measure,t.order,t.filter,t.dimension,t.timeDimension,t.limit,t.offset,n)}));return{queries:r.map((function(e){return e.query})),resultFields:yj([].concat(r).map((function(e){return e.measureDescription})))}};function Cj(e,t){var n=e.optionsFilters?e.optionsFilters[t.dataSetId]:[];return null==n?void 0:n.filter((function(e){return e.field!==t.fieldId}))}var jj=function(e,t,n,r){var i=Lt(t,e.measure,e.order,It(e.filter,n),e.dimension,e.timeDimension||null,e.limit,e.offset,r);return{queries:[i.query],resultFields:yj([i.measureDescription])}},Fj=jj,Sj=jj,kj=jj,Tj=jj,Aj=jj,Dj=jj,Ij=jj,Pj=function(e,t,n){var r=[],i=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type){r=[e[0]];var o=Mn(n.dataSets,e[0].dataSetId);if(!o)throw"Data set not found for view attributes query";var a=Rn(o,e[0].fieldId),l=Rt(e[0].dataSetId,a);r=[l.query],i=[l.resultFields]}else if(Array.isArray(e)){var s=[].concat(e).map((function(e){var t=Mn(n.dataSets,e.dataSetId);if(!t)throw"Data set not found for query-attributes query";var r=dr(n.filterConfig,t,n.timeRangeOptions);return U({},e,{filter:It(e.filter,r)})})),u=wj(n.dataSets,s,t);r=u.queries,i=u.resultFields}else if("type"in e&&("order"in e||"measure"in e)){var d=Mn(n.dataSets,e.dataSetId);if(!d)throw"Data set not found for view attributes query";var c=function(e,t,n,r){switch(e.type){case"areaChart":return Fj(e,t,n,r);case"barChart":return Sj(e,t,n,r);case"horizontalBarChart":return kj(e,t,n,r);case"lineChart":return Tj(e,t,n,r);case"pieChart":return Aj(e,t,n,r);case"dataTable":return Dj(e,t,n,r);case"basicTable":return Ij(e,t,n,r);case"comboChart":return function(e,t,n,r){var i=function(e,t,n,r){var i=Lt(t,e.lineMeasure,e.order,It(e.filter,r),e.lineDimension,e.timeDimension,e.limit,e.offset,n);return{bar:Lt(t,e.barMeasure,e.order,It(e.filter,r),e.barDimension,e.timeDimension,e.limit,e.offset,n),line:i}}(e,t,r,n),o=i.line,a=i.bar;return{queries:[o.query,a.query],resultFields:yj([o.measureDescription,a.measureDescription])}}(e,t,n,r);case"singleStat":return function(e,t,n,r){var i=function(e,t,n,r){var i=function(e,t,n,r){var i=Lt(n,e.measure,[],It(e.filter,t),[],null,1,e.offset,r),o=i.query,a=i.measureDescription;return o.measure=[{type:"number",value:0}].concat(o.measure),{query:o,measureDescription:a=[{field:{id:"single-stat-bumper-field",canBeDimension:!1,canBeMeasure:!1,publicName:"",dataType:"number",allowedOperators:[]},functionId:"none"}].concat(a)}}(e,r,t,n),o=function(e,t,n,r){return t.deltaTimeDimension?Lt(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],It(t.filter,n),[],t.deltaTimeDimension,t.limit,t.offset,r):null}(t,e,r,n);return{queries:o?[i.query,o.query]:[i.query],measureDescription:o?[i.measureDescription,o.measureDescription]:[i.measureDescription]}}(e,t,r,n);return{queries:i.queries,resultFields:yj(i.measureDescription)}}(e,t,n,r);case"scatterChart":return function(e,t,n,r){var i=[];e.xMeasure&&i.push(e.xMeasure),e.yMeasure&&i.push(e.yMeasure);var o=Lt(t,i,e.order,It(e.filter,n),e.dimension,e.timeDimension,e.limit,e.offset,r);return{queries:[o.query],resultFields:yj([o.measureDescription])}}(e,t,n,r);case"mercatorMap":return function(e,t,n,r){return wj([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:It(e.filter,n),order:[],timeDimension:null}],r)}(e,t,n,r);default:throw"Unsupported."}}(e,d,dr(n.filterConfig,d,n.timeRangeOptions),t);r=c.queries,i=c.resultFields}else if("custom"!=e.type){var p=function(e,t,n){var r=[].concat(e.appliesToFields).map((function(r){var i=Mn(t,r.dataSetId);if(!i)throw"Data set not found for additional filter query";var o=Rn(i,r.fieldId);if("string[]"==o.dataType){var a=Pt([Cj(e,r)],n,i),l=Rt(r.dataSetId,o,a);return{queries:[l.query],resultFields:[l.resultFields]}}var s=Nt(i,r.fieldId,Cj(e,r));return wj(t,[s],n)}));return{queries:r.flatMap((function(e){return e.queries})),resultFields:r.flatMap((function(e){return e.resultFields}))}}(e,n.dataSets,t);r=p.queries,i=p.resultFields}return{queries:r,resultFields:i}},_j={},Ej=function(e,t,n){var r=JSON.stringify(e),i=new Date;i.setSeconds(i.getSeconds()+n),Nr("Browser cache new object set.",r),_j[r]={item:t,expires:i}},Oj=function(e){var t=JSON.stringify(e),n=_j[t];if(!n)return Nr("Browser cache miss.",e),null;Nr("Browser cache hit.",e);var r=n.item,i=n.expires;return new Date<i?r:(delete _j[t],null)},Lj=function e(t){return Array.isArray(t)?0==t.length:"object"==typeof t&&e(Object.keys(t))},Mj=function(){var e=Y(H().mark((function e(t,n,r,i){var o,a,l,s;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},t.forEach((function(e,t){var n=Oj(i(e));n&&(Nr("Query result received from the cache."),o[t]=n)})),t.forEach((function(e,t){n(e)||(Nr("Query is not runnable."),o[t]=null)})),a=t.filter((function(e,t){return n(e)&&void 0===o[t]})),l=[],Lj(a)){e.next=9;break}return e.next=8,r(a);case 8:l=e.sent;case 9:if(null!==l){e.next=11;break}return e.abrupt("return",null);case 11:if(!Lj(l)||!Lj(o)){e.next=13;break}return e.abrupt("return",null);case 13:return s=[].concat(t).map((function(e,t){var r,a=o[t];if(n(e)&&null==a&&(a=(null==(r=l)?void 0:r.shift())||null,Ej(i(e),a,20)),void 0===a)throw"A result went missing...";return a})),e.abrupt("return",s);case 15:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),Rj=function(){var e=Y(H().mark((function e(t,n,r,i){var o,a,l;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Hi(n),e.next=3,o({path:"/api/v1/create-results",method:"post",mode:"cors",body:{queries:t,virtualFields:{},dynamicConfig:"object"==typeof n?n.dynamicConfig:void 0,identityConfigIntegritySignature:r},abortSignal:i});case 3:return l=(a=e.sent).body,e.abrupt("return",200==a.status?l:null);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),Nj=function(){var e=Y(H().mark((function e(t,n,r){var i,o,a,l,s;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Pj(n,t.queryEngineConfig,r),o=i.queries,a=i.resultFields,e.next=3,Mj(o,(function(e){return!0}),function(){var e=Y(H().mark((function e(n){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Rj(n,t.queryEngineEndpoint,t.dataAccessToken,r.abortSignal);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:return l=e.sent,s=[].concat(o).map((function(e,t){if(null===l)return null;var n=l[t];return void 0===n?null:{content:n,fields:a[t]}})),e.abrupt("return",s);case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),zj={},Bj=[],qj=function(){var e=Y(H().mark((function e(t,n,r){var i;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Nr("Fetching data for in-browser query engine. DataSet;",t.id,"CacheKey;",r),!zj[r]){e.next=5;break}return e.abrupt("return",zj[r]);case 5:return e.next=7,n(t);case 7:return(i=e.sent)||Bj.includes(t.id)||(Bj.push(t.id),console.error("Failed to download data for data set "+t.id)),zj[r]=i,e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Vj=function e(t,n,r,i){switch(n.type){case"subquery":return r(n.value);case"number":return n.value;case"maths":var o=e(t,n.left,r,i),a=e(t,n.right,r,i);if(void 0===o)throw"Left is undefined";if(void 0===a)throw"Right is undefined";return function(e,t,n){var r=null;if(null===t||null===n)return null;switch(e){case"*":r=t*n;break;case"-":r=t-n;break;case"+":r=t+n;break;case"/":r=t/n;break;default:throw"Unrecognised op"}if(null===r)throw"Value after maths is null";return r}(n.op,o,a);case"field":var l=lt({field:n.value,function:n.function});if("none"===n.function)return t[n.value];if(void 0!==t[l])return t[l];if(i){var s=Yj({dataSetId:"",order:[],filter:[],group:[],type:"query",measure:[{type:"field",function:n.function,value:n.value}]},i,r);if(s&&s[0])return s[0][l];throw new Error("No value found in doMath")}}throw"Unsure how to handle this from doMath."},Hj=Object.keys(to.supportedTimeTruncFunctions),Wj=function(e,t,n){if("count"==e)return n.length;if("sum"==e)return i.sumBy(n,t);if("mean"==e)return i.meanBy(n,t);if("min"==e){var r=i.minBy(n,t);return r?r[t]:0}if("max"==e){var o=i.maxBy(n,t);return o?o[t]:0}if("countDistinct"==e)return i.uniqBy(n,t).length;if("custom-func"==e)return i.meanBy(n,t);throw"Aggregate '"+e+"' not recognised."},Yj=function(e,t,n){if(!Ot(e.measure)&&!function e(t){var n=[].concat("group"in t?t.group:[]).map((function(e){return e.index}));return i.some(t.measure,(function t(r,i){if("field"==r.type)return"none"!=r.function&&!n.includes(i);if("number"==r.type)return!1;if("subquery"==r.type)return e(r.value);if("maths"==r.type)return t(r.left)||t(r.right);if("function"==r.type)return"none"!=r.function||t(r.value);throw console.log("measure",JSON.stringify(r)),"not supported"}))}(e))return t;var r=function(e,t){return"group"in e?i.groupBy([].concat(t),(function(t){var n=[];return e.group.forEach((function(r){var i=e.measure[r.index];if("field"!=i.type||"string"!=typeof i.value)throw"Unsupported group on in local query engine.";if(Hj.includes(i.function)){var o=function(e,t){switch(t){case"second":return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds());case"minute":return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes());case"hour":return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours());case"day":return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());case"week":return r=(n=new Date(e)).getDay(),i=n.getDate()-r+(0==r?-6:1),new Date(n.setDate(i));case"month":return new Date(e.getUTCFullYear(),e.getUTCMonth());case"quarter":return function(e,t){if(1==t)return new Date(e.getUTCFullYear(),0);if(2==t)return new Date(e.getUTCFullYear(),3);if(3==t)return new Date(e.getUTCFullYear(),6);if(4==t)return new Date(e.getUTCFullYear(),9);throw"Invalid quarter "+t}(e,Ao(e));case"year":return new Date(e.getUTCFullYear(),1);default:throw"Local query engine does not support time trunc function "+t}var n,r,i}(new Date(t[i.value]),i.function);t[i.value]=o.toISOString(),n=[].concat(n,[o.toISOString()])}else n=[].concat(n,[""+t[i.value]])})),n.join("|")})):{"":t}}(e,t);return i.map(Object.values(r),(function(t){var r=[].concat(e.measure);return U({},i.reduce(r,(function(e,r,i){var o=dt(r,i);switch(r.type){case"field":e[o]="none"==r.function||Hj.includes(r.function)?t[0][r.value]:Wj(r.function,r.value,t);break;case"function":if("none"==r.function)throw"Function type is redundant if function is 'none'.";var a=dt(r.value,i);e[o]=Wj(r.function,a,t);break;case"subquery":e[o]=n(r.value);break;case"number":e[o]=r.value;break;case"maths":(Ot([r.left])||Ot([r.right]))&&(e[o]=Vj(e,r,n,t))}return e}),{}))}))},Uj=function(e,t){return e+"::"+t},Gj=function(e,t,n){return[].concat(e).map((function(e){var r=Nn(t,e.dataSetId)[0],o=Uj(n,e.dataSetId),a=zj[o];return a&&r?function e(t,n,r){var o=function(e,t,n){return i.isEmpty(e.filter)?n:i.filter([].concat(n),(function(n){return function(e,t,n){return i.some(t,(function(t){return i.every(t,(function(t){if("field"==t.field.type&&"string"==typeof t.field.value){var r=e[t.field.value],i=Rn(n,t.field.value);r="date_time"==i.dataType?new Date(r):r;var o="date_time"==i.dataType?new Date(t.value):t.value;return Ko(U({},t,{value:o}),r)}throw"Unsure how to handle this."}))}))}(n,e.filter,t)}))}(t,n,i.cloneDeep(r)),a=function(o){var a=e({type:"query",dataSetId:t.dataSetId,measure:[o.measure[0]],filter:o.filter,order:[],group:[]},n,r);if(0==a.length)return null;if(!i.isNumber(a[0][0]))throw"Sub query must return a numeric result.";return a[0][0]};o=function(e,t,n){return t.map((function(t){var r=U({},t);return e.measure.forEach((function(e,i){var o=dt(e,i);if("maths"!=e.type||Ot([e.left])||Ot([e.right])){if("function"==e.type){var a=Vj(t,e.value,n),l=dt(e.value,i);r[l]=a}}else r[o]=Vj(t,e,n)})),r}))}(t,o,a),o=Yj(t,o,a),o=function(e,t){if(i.isEmpty(e.order))return t;var n=[].concat(e.order).map((function(t){var n=e.measure[t.index];if("field"==n.type&&"string"==typeof n.value)return lt({field:n.value,function:n.function});throw"Cannot sort by non-aggregate"})),r=[].concat(e.order).map((function(e){return e.direction}));return i.orderBy([].concat(t),n,r)}(t,o),o=function(e,t){return e.offset||e.limit?t.slice(e.offset).slice(0,e.limit):t}(t,o);var l=function(e,t){return[].concat(e.measure).map((function(e,t){return dt(e,t)}))}(t);return o.map((function(e){return[].concat(l).map((function(t){return e[t]}))}))}(e,r,a):(console.warn("Returning an empty result."),[])}))},Kj=function(){var e=Y(H().mark((function e(t,n,r,i){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([].concat(t).flatMap(function(){var e=Y(H().mark((function e(t){var o,a;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=Nn(n,t.dataSetId),!(a=o[0])){e.next=8;break}return e.next=4,qj(a,r,Uj(i,t.dataSetId));case 4:return e.t0=e.sent,e.abrupt("return",[e.t0]);case 8:return e.abrupt("return",[]);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return e.abrupt("return",Gj(t,n,i));case 3:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),Xj=function(){var e=Y(H().mark((function e(t,n,r){var i,o,a,l,s;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Pj(n,to,r),o=i.queries,a=i.resultFields,e.next=3,Mj(o,(function(e){return"preparedQuery"==e.type&&Br("In-browser query engine does not support prepared queries."),"query"==e.type}),function(){var e=Y(H().mark((function e(n){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Kj(n,r.dataSets,t.loadData,t.cacheKeyNamespace);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:return null===(l=e.sent)&&(l=o.map((function(){return null}))),s=[].concat(o).map((function(e,t){if(null===l)return null;var n=l[t];return void 0===n?null:{content:n,fields:a[t]}})),e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Qj=function(){var e=Y(H().mark((function e(t,n,r){var i,o,a,l;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Pj(n,t.queryEngineConfig,r),o=i.queries,a=i.resultFields,e.next=3,Mj(o,(function(e){return"preparedQuery"==e.type&&Br("Custom query engine does not support prepared queries."),"query"==e.type}),function(){var e=Y(H().mark((function e(n){var i;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.runQueries(n,U({},r,{dataAccessToken:t.dataAccessToken}));case 2:if(null!=(i=e.sent)){e.next=5;break}return e.abrupt("return",n.map((function(){return null})));case 5:return e.abrupt("return",i.map((function(e,t){return Array.isArray(e)?{fields:a[t],content:e}:e})));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:if(null!==(l=e.sent)){e.next=6;break}return e.abrupt("return",o.map((function(){return null})));case 6:return e.abrupt("return",l);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}();function Jj(e,t,n){return Zj.apply(this,arguments)}function Zj(){return(Zj=Y(H().mark((function e(t,n,r){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyQueryEngine"!=t.type){e.next=4;break}return e.next=3,Nj(t,n,r);case 3:return e.abrupt("return",e.sent);case 4:if("vizzlyJsQueryEngine"!=t.type){e.next=8;break}return e.next=7,Xj(t,n,r);case 7:return e.abrupt("return",e.sent);case 8:if("custom"!=t.type){e.next=12;break}return e.next=11,Qj(t,n,r);case 11:return e.abrupt("return",e.sent);case 12:return e.abrupt("return",[]);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var $j=function(e){var n,r,i,o,a,l,s,u,d=eF(e),p=e.vizzlyApiHost?{host:e.vizzlyApiHost}:{host:"https://api.vizzly.co"},f=Pi(p),m=(o={dashboardId:e.dashboardId,parentDashboardId:e.parentDashboardId,identityCallback:e.identity,loadDataSetsCallback:qC(e),vizzlyAPI:f,implementationMeta:d,loadQueryEngineConfigCallback:VC(e)},l=Qi(o.identityCallback,o.loadDataSetsCallback,o.loadQueryEngineConfigCallback),u=function(e,n){var r=t.useState(),i=r[0],o=r[1];if(t.useEffect((function(){!function(){var t=Y(H().mark((function t(){var r,a,l,s;return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("isLoading"in n)){t.next=2;break}return t.abrupt("return");case 2:if(e){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,RC(e,n);case 6:a=(r=t.sent).mode,s=r.scope,(l=r.dashboardId)!=(null==i?void 0:i.dashboardId)&&o({mode:a,dashboardId:l,scope:s});case 11:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[JSON.stringify(e),n]),!i)return null;if("isLoading"in n)return null;var a=n.dashboards.find((function(e){return e.id==i.dashboardId}))||null;return{mode:i.mode,dashboard:a,scope:i.scope}}(function(e,t,n){if("accessType"in e&&"admin"==e.accessType){Nr("Admin access found, so we will show the parent dashboard.",e.defaultParentDashboardId);var r=e.defaultParentDashboardId;if(n){var i=e.dashboards.find((function(e){return e.id==n}));null!=i&&i.parentDashboardId&&(Nr("A child dashboard was provided whilst in admin mode. Therefore the parent of the given child will be shown to administer.",i.parentDashboardId),r=i.parentDashboardId)}return{type:"exact",dashboardId:r}}return n?(Nr("Strategy will be to show dashboard",n),{type:"exact",dashboardId:n}):"childDashboardCount"in e&&1===e.childDashboardCount&&"read"==(null==t?void 0:t.dashboardAccess.scope)?(Nr("Strategy will be to show read-only view of the only child dashboard. If you wish to render a read-only view of the parent dashboard, please make sure the `dashboardId` property matches the `parentDashboardId` property.",e.defaultParentDashboardId),{type:"exact",dashboardId:e.dashboards[0].id}):"read"==(null==t?void 0:t.dashboardAccess.scope)&&"defaultParentDashboardId"in e?(Nr("Strategy will be to return read-only view of the parent dashboard.",e.defaultParentDashboardId),{type:"exact",dashboardId:e.defaultParentDashboardId}):"defaultParentDashboardId"in e?t&&t.dashboardAccess.dashboardId?(Nr("Strategy will be to show a child of the parent dashboard determined by the identity config",null==t||null==(o=t.dashboardAccess)?void 0:o.dashboardId),{type:"instantCopyOf",parentDashboardId:null==t||null==(a=t.dashboardAccess)?void 0:a.dashboardId}):(Nr("Strategy will be to show a child of the parent dashboard",e.defaultParentDashboardId),{type:"instantCopyOf",parentDashboardId:e.defaultParentDashboardId}):void 0;var o,a}(s=uo(null==l?void 0:l.identityConfig,null==l?void 0:l.dataSets,o.vizzlyAPI,o.parentDashboardId),l.identityConfig,o.dashboardId),s),0===(null==(a=l.dataSets)?void 0:a.length)?{error:new NC}:l.error?{error:l.error}:l.identityConfig&&l.queryEngineConfig?"isLoading"in s?null:u?{dashboardAPI:s,scope:u.scope,queryEngineConfig:l.queryEngineConfig,dashboard:u.dashboard,identityConfig:l.identityConfig,mode:u.mode,vizzlyApiConfig:o.vizzlyAPI.config}:null:null);if(null===m)return c.jsx(fc,{override:e.renderLoadingComponent});if("error"in m)return c.jsx(xj,{implementationMeta:d,error:m.error});if(!m.dashboard)return c.jsx(fc,{override:e.renderLoadingComponent});var h=function(){var e=Y(H().mark((function e(t,n){var r;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m.dashboard){e.next=6;break}return r=lo(m.dashboard.id,m.dashboardAPI.permissions),e.next=4,f.askAi(t,r.token,n,m.queryEngineConfig);case 4:return e.abrupt("return",e.sent);case 6:return e.abrupt("return",{});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),v=function(){var e=Y(H().mark((function e(t,n){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n||!m.dashboard){e.next=7;break}return e.next=3,m.dashboardAPI.saveScheduledReport({dashboardId:m.dashboard.id,cronSchedule:null,scheduledReportId:t});case 3:return e.abrupt("return",e.sent?"deleted":null);case 7:if(null==n||!m.dashboard){e.next=12;break}return e.next=10,m.dashboardAPI.saveScheduledReport({dashboardId:m.dashboard.id,cronSchedule:n,scheduledReportId:t});case 10:return e.abrupt("return",e.sent?"saved":null);case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),g=function(){var e=Y(H().mark((function e(t){return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"read_write"==m.scope&&m.dashboardAPI.updateDashboard(t.id,{definition:Gr(t)});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),b=function(){var e=Y(H().mark((function e(){var t;return H().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===m||!("dashboard"in m)||null===m.dashboard){e.next=4;break}return t=$r(m.dashboard,m.dashboardAPI.dashboards,m.dashboardAPI.defaultParentDashboardId),g(t),e.abrupt("return",t);case 4:return e.abrupt("return",null);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=(null==(n=m.identityConfig)||null==(r=n.queryEngineAccessConfig)?void 0:r.allowDatabaseSchemaAccess)&&"self-hosted"==d.type,y=null!=(i=e.dateFilterOptions)?i:e.dateTimeFilterOptions,w=function(e,t,n){var r,i,o=(i=t.identityConfig.dashboardAccess,["accessType","dashboardId","projectId","userReference","scope"].map((function(e){return e+":"+i[e]})).join(":::"));if("queryEngineEndpoint"in e&&e.queryEngineEndpoint&&null!=(r=t.identityConfig.dataAccess)&&r.signature)return function(){var r=Y(H().mark((function r(i,a){var l;return H().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Jj({type:"vizzlyQueryEngine",queryEngineConfig:t.queryEngineConfig,dataAccessToken:null==(l=t.identityConfig.dataAccess)?void 0:l.signature,queryEngineEndpoint:e.queryEngineEndpoint,cacheKeyNamespace:o},i,{abortSignal:a.abortSignal,dataSets:a.dataSets,filterConfig:a.filterConfig||{},timeRangeOptions:n});case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r)})));return function(e,t){return r.apply(this,arguments)}}();if("runQueries"in e&&e.runQueries)return function(){var r=Y(H().mark((function r(i,a){var l;return H().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Jj({type:"custom",queryEngineConfig:t.queryEngineConfig,runQueries:e.runQueries,dataAccessToken:null==(l=t.identityConfig.dataAccess)?void 0:l.signature,cacheKeyNamespace:o},i,{abortSignal:a.abortSignal,dataSets:a.dataSets,filterConfig:a.filterConfig||{},timeRangeOptions:n});case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r)})));return function(e,t){return r.apply(this,arguments)}}();if(e.data)return function(){var t=Y(H().mark((function t(r,i){return H().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Jj({type:"vizzlyJsQueryEngine",loadData:e.data,cacheKeyNamespace:o},r,{abortSignal:i.abortSignal,dataSets:i.dataSets,filterConfig:i.filterConfig||{},timeRangeOptions:n});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}();throw"Missing required props."}(e,m,Dl(y));return c.jsx(MC.Provider,{value:U({},e,{onSave:g}),children:c.jsx(LC,{dashboardBehaviour:{onAskAI:h,mode:m.mode,scope:m.scope,dateFilterOptions:y,numberFormatOptions:null==e?void 0:e.numberFormatOptions,dateTimeFormatOptions:null==e?void 0:e.dateTimeFormatOptions,onEditorUpdate:null==e?void 0:e.onEditorUpdate,onScheduledReportChange:v,reportScheduleOptions:e.reportScheduleOptions,dataPanel:e.dataPanel,formatPanel:e.formatPanel,maxCSVDownloadLimit:e.maxCSVDownloadLimit,textOverrides:e.textOverrides,developerTools:e.developerTools,dashboardFilters:e.dashboardFilters,onDashboardFilterChange:e.onDashboardFilterChange,onSave:g,onOpenConfigManagerUi:x?function(){var e,t,n,r,i;x&&d.queryEngineEndpoint&&(window.location.href=(t=d.queryEngineEndpoint,(n=null==(e=m.identityConfig.queryEngineAccessConfig)?void 0:e.signature)?(r=JSON.stringify({queryEngineAccessToken:n,projectAccessToken:void 0}),i="object"==typeof window&&window&&window.btoa?window.btoa(r):Buffer.from(r).toString("base64"),Pr(Ui(t),"/sign-in#"+i)):""))}:void 0,organizationName:e.organizationName,featureToggles:e.featureToggles,customComponents:e.customComponents,componentOverrides:Yb(e),queryEngineConfig:m.queryEngineConfig,disableToolbar:null==e?void 0:e.disableToolbar,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection},onDashboardUpdate:null==e?void 0:e.onDashboardUpdate,dashboard:m.dashboard,runQueriesCallback:w,implementationMeta:d,identityConfig:m.identityConfig,includeComponents:null==e?void 0:e.includeComponents,excludeComponents:null==e?void 0:e.excludeComponents,onReset:b,onError:null==e?void 0:e.onError,theme:e.theme,vizzlyApiConfig:p,onViewClick:null==e?void 0:e.onViewClick,children:null==e?void 0:e.children})})},eF=function(e){return"queryEngineEndpoint"in e?{type:"self-hosted",queryEngineEndpoint:e.queryEngineEndpoint}:"runQueries"in e?{type:"custom"}:{type:"in-browser"}},tF=function(e){return c.jsxs(fo,{renderOnError:function(){return c.jsx("p",{children:"Unexpected vizzly error."})},onError:function(t,n){return(null==e?void 0:e.onError)&&(null==e?void 0:e.onError(t,n))},children:[c.jsx(bo,{}),c.jsx($j,U({},e,{children:c.jsx(_C,{})}))]})},nF={Dashboard:tF,useDashboardManager:co,useInBrowserDashboardManager:po,NewVizzlyImplementation:Ni,displayPositions:Tr,DataSetField:ho};exports.Dashboard=tF,exports.DataSetField=ho,exports.NewVizzlyImplementation=Ni,exports.default=nF,exports.displayPositions=Tr,exports.useDashboardManager=co,exports.useInBrowserDashboardManager=po;
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),n=e(t),r=e(require("joi")),i=require("lodash"),o=e(i),a=e(require("lodash/isEmpty")),l=require("uuid"),s=e(require("chroma-js")),u=e(require("isomorphic-fetch")),d=require("@emotion/react"),c=require("@emotion/react/jsx-runtime"),p=require("@emotion/css"),f=e(require("@emotion/cache")),m=require("react-dom"),h=e(require("fuse.js")),v=require("@heroicons/react/solid"),g=require("@heroicons/react/outline");require("@emotion/styled/base");var b=require("react-dnd"),x=require("react-popper"),y=e(require("moment"));require("react-dates-17/initialize");var w=require("react-dates-17"),C=require("@visx/xychart"),j=require("@visx/gradient"),S=require("@visx/legend"),F=require("@visx/scale"),k=e(require("@visx/legend/lib/legends/Ordinal")),T=require("@visx/curve"),A=require("d3-time-format"),D=require("@visx/shape"),I=require("@visx/responsive"),P=require("@visx/group"),_=e(require("@visx/shape/lib/shapes/Pie")),E=require("@react-spring/web"),O=require("@visx/tooltip"),L=require("@visx/geo"),R=require("topojson-client"),M=e(require("@visx/responsive/lib/components/ParentSize")),N=require("@visx/zoom"),z=e(require("react-visibility-sensor")),B=e(require("copy-to-clipboard")),q=require("react-dnd-html5-backend"),V=require("file-saver");function W(){W=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var o=Object.create((t&&t.prototype instanceof p?t:p).prototype),a=new F(i||[]);return r(o,"_invoke",{value:w(e,n,a)}),o}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function p(){}function f(){}function m(){}var h={};s(h,o,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(k([])));g&&g!==t&&n.call(g,o)&&(h=g);var b=m.prototype=p.prototype=Object.create(h);function x(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var i;r(this,"_invoke",{value:function(r,o){function a(){return new t((function(i,a){!function r(i,o,a,l){var s=d(e[i],e,o);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,l)}),(function(e){r("throw",e,a,l)})):t.resolve(c).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,l)}))}l(s.arg)}(r,o,i,a)}))}return i=i?i.then(a,a):a()}})}function w(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var l=C(a,n);if(l){if(l===c)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=d(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===c)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function C(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),c;var i=d(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,c;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function F(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function k(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:T}}function T(){return{value:void 0,done:!0}}return f.prototype=m,r(b,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:f,configurable:!0}),f.displayName=s(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s(e,l,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},x(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new y(u(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(b),s(b,l,"Generator"),s(b,o,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=k,F.prototype={constructor:F,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function H(e,t,n,r,i,o,a){try{var l=e[o](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,i)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){H(o,r,i,a,l,"next",e)}function l(e){H(o,r,i,a,l,"throw",e)}a(void 0)}))}}function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function G(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,X(e,t)}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Q(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function J(e,t,n){return(J=Q()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&X(i,n.prototype),i}).apply(null,arguments)}function Z(e){var t="function"==typeof Map?new Map:void 0;return(Z=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return J(e,arguments,K(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),X(n,e)})(e)}function $(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function te(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ee(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ee(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var ne=r.object({fieldId:r.string().required(),dataSetId:r.string().required()}),re=function(e){return r.object().pattern(r.string(),r.array().items(pe(e)).optional())},ie=function(e){return{title:r.string().allow(""),managedByConfiguration:r.boolean().optional(),requiresValue:r.boolean().optional(),optionsFilters:re(e).optional(),appliesToFields:r.array().items(ne).required(),optionsPulledFrom:r.array().items(ne).optional()}},oe=function(e,t){return r.object(U({},ie(e),{type:r.valid("singleSelectFilter").required(),value:r.alternatives(r.string(),r.number(),r.boolean(),r.valid.apply(r,t?[]:[null]))}))},ae=function(e,t){return r.object(U({},ie(e),{type:r.valid("multiSelectFilter").required(),value:r.alternatives(r.array().items(r.string(),r.number()).single(),r.valid.apply(r,t?[]:[null]))}))},le=function(e,t,n){return r.object(U({},ie(e),{type:r.valid(n).required(),value:r.alternatives(r.valid.apply(r,t?[]:[null]),r.object({type:r.valid("fixedRange"),before:r.alternatives(r.date()).required(),after:r.alternatives(r.date()).required()}),r.object({type:r.valid("relative"),value:r.string()}))}))},se=function(e){return r.object({field:r.string().required(),function:r.valid.apply(r,Object.keys(e).concat(["none"]))})},ue=function(e){var t;return r.object({field:r.string().required(),direction:r.string().valid("asc","desc").required(),function:(t=r.string()).valid.apply(t,Object.keys(e.supportedAggregates).concat(Object.keys(e.supportedTimeTruncFunctions),["none"]))})},de=function(e){return r.object({field:r.string().required(),truncate:r.valid.apply(r,Object.keys(e)),bucketFill:r.boolean()})},ce=function(e){return r.array().items(r.object({field:r.string(),pivot:r.allow("x","y").optional(),function:r.valid.apply(r,["none"].concat(Object.keys(e)))}))},pe=function(e){var t;return r.object({field:r.string().required(),op:(t=r.string()).valid.apply(t,Object.keys(e.supportedOperators)),value:r.any().required(),function:r.string()})},fe=function(e){return r.array().items(r.array().items(pe(e)))},me=function(){return r.number()},he={viewId:r.string().allow("").optional(),displayTitle:r.string().allow(""),displaySubject:r.string().allow(""),dataSetId:r.string(),protectedByOrganisation:r.boolean().optional()},ve=r.valid("auto",2,0),ge=function(e){return{measure:r.array().items(se(e.supportedAggregates)).required(),dimension:ce(e.supportedTimeTruncFunctions).required(),drilldown:r.alternatives(ce(e.supportedTimeTruncFunctions).required(),r.string()),order:r.array().items(ue(e)),timeDimension:r.alternatives(de(e.supportedTimeTruncFunctions),r.valid(null)).required(),limit:me(),offset:r.number().min(0),filter:r.array().items(r.array().items(pe(e))),xAxisPrefix:r.string().allow(""),yAxisPrefix:r.string().allow(""),xAxisPostfix:r.string().allow(""),yAxisPostfix:r.string().allow(""),yAxisFormat:r.alternatives(r.string(),r.valid(null)),xAxisFormat:r.alternatives(r.string(),r.valid(null)),approxYAxisLabelCount:ve,approxXAxisLabelCount:ve}},be=r.string().valid("natural","straight","step","stepBefore","stepAfter"),xe=function(){return r.array().items(r.object({function:r.string().required(),field:r.string().required()}))},ye=function(){return r.array().items(r.object({function:r.string(),truncate:r.string(),field:r.string().required(),bucketFill:r.boolean().optional(),pivot:r.string().valid("x","y").optional()}))},we=function(e){return r.object().pattern(r.string(),r.alternatives().try(r.array().items(de(e.supportedTimeTruncFunctions)).min(1),ce(e.supportedTimeTruncFunctions))).unknown(!0)},Ce=function(e){return r.object().pattern(r.string(),r.array().items(se(e.supportedAggregates)).min(1)).unknown(!0)},je=function(e){return r.object({measure:Ce(e),group:we(e)})},Se=function(){return r.object({color:r.string().required(),value:r.number().required(),strokeWidth:r.number().required(),strokeStyle:r.string().valid("dashed","solid").required(),label:r.boolean().optional()})},Fe=function(){return r.array().items(Se())},ke=function(){return r.object({x:r.string().allow(""),y:r.string().allow("")})},Te=r.object().pattern(r.string(),r.object({width:r.number().min(0),height:r.number().min(0)})),Ae=function(e){return r.object({field:r.string().required(),operator:r.valid.apply(r,Object.keys(e.supportedOperators)),value:r.alternatives(r.string(),r.number(),r.boolean()).required(),ruleValue:r.string().allow("").required(),ruleType:r.valid("backgroundColor","fontColor","lineColor","areaColor").required()})},De=r.object({field:r.string().required(),prefix:r.string().required()}),Ie=r.object({field:r.string().required(),function:r.valid("none").required()}),Pe=function(e){return r.object(U({},he,{type:r.valid("basicTable"),measure:r.array().items(Ie),dimension:r.array().max(0),order:r.array().items(ue(e.queryEngineConfig)),timeDimension:r.valid(null),limit:me(),offset:r.number().min(0),filter:fe(e.queryEngineConfig),prefixes:r.array().items(De),exportNames:r.object(),numberFormat:r.object(),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),dateTimeFormat:r.string(),protectedFields:r.object({measure:xe()}).unknown(!0),sizing:Te}))},_e=function(e){return null!=e&&e.truncate&&"none"!=(null==e?void 0:e.truncate)?e.field+"_"+e.truncate:null==e?void 0:e.field},Ee=function(e,t){var n=e.split("_"),r=n.pop();return r&&!Re(t,r)?null:{field:n.join("_"),truncate:null!=r?r:""}},Oe={month:{publicName:"Monthly",dateFormat:"MMMM YYYY"},year:{publicName:"Yearly",dateFormat:"YYYY"},quarter:{publicName:"Per quarter",dateFormat:"quarter"},week:{publicName:"Weekly",dateFormat:"week"},day:{publicName:"Daily",dateFormat:"DD-MM-YYYY"},second:{publicName:"Per second",dateFormat:"hh:mm:ss"},hour:{publicName:"Hourly",dateFormat:"hh:mm"},minute:{publicName:"Per minute",dateFormat:"hh:mm"}},Le=function(e){var t=i.cloneDeep(Oe);if(!e)return t;var n={};return e.forEach((function(e){if(!Oe[e])throw"Time trunc function "+e+" not managed by Vizzly";n[e]=Oe[e]})),n},Re=function(e,t){return[].concat(Object.keys(e),["none"]).includes(t)},Me=function(e,t){return[].concat(Object.keys(t.supportedOperators)).filter((function(t){return ze[t].validDataTypes.includes(e.dataType)}))},Ne=function(e){return"countDistinct"==e?"Count distinct":i.capitalize(e)},ze={">":{publicName:"Greater than",validDataTypes:["number","date_time"]},"<":{publicName:"Less than",validDataTypes:["number","date_time"]},"<=":{publicName:"Less than or equal to",validDataTypes:["number","date_time"]},">=":{publicName:"Greater than or equal to",validDataTypes:["number","date_time"]},"!=":{publicName:"Not equal to",validDataTypes:["number","date_time","boolean","string"]},is_one_of:{publicName:"Is one of",validDataTypes:["number","date_time","boolean","string"]},"=":{publicName:"Equal to",validDataTypes:["number","date_time","boolean","string"]},is_not_one_of:{publicName:"Is not one of",validDataTypes:["number","date_time","boolean","string"]},starts_with:{publicName:"Starts with",validDataTypes:["string"]},ends_with:{publicName:"Ends with",validDataTypes:["string"]},contains_substring:{publicName:"Contains text",validDataTypes:["string"]},does_not_contain_substring:{publicName:"Does not contain text",validDataTypes:["string"]},array_contains:{publicName:"Contains",validDataTypes:["string[]"]}},Be=function(e){var t=i.cloneDeep(ze);if(!e)return t;var n={};return e.forEach((function(e){if(!ze[e])throw"Operator "+e+" not managed by Vizzly";n[e]=ze[e]})),n},qe=function(e){return ze[e].publicName},Ve=function(e){return e.map((function(e){return e.map((function(e){return"is_one_of"!=e.op&&"is_not_one_of"!=e.op||i.isArray(e.value)?e:U({},e,{value:[e.value]})}))}))},We=function(e,t){return e.map((function(e){var n=U({},e,{aggregate:void 0,function:e.function||e.aggregate});return delete n.aggregate,t&&n.field==t.field&&"none"==n.function&&(n.function=t.truncate),n}))},He=function(e){return e.map((function(e){var t=U({},e,{aggregate:void 0,function:e.function||e.aggregate});return delete t.aggregate,t}))},Ye=function(e){return"auto"===e||0===e||2===e?e:"auto"},Ue=function(e){if(!e)return{};var t={};return e.measure&&Object.entries(e.measure).forEach((function(e){t&&(t[e[0]]=He(e[1]))})),{measure:i.isEmpty(t)?void 0:t,group:e.group}},Ge={mean:{publicName:"Mean",validDataTypes:["number"]},sum:{publicName:"Sum",validDataTypes:["number"]},min:{publicName:"Min",validDataTypes:["number"]},max:{publicName:"Max",validDataTypes:["number"]},count:{publicName:"Count",validDataTypes:["string","number","boolean","date_time","string[]"]},countDistinct:{publicName:"Unique",validDataTypes:["string","number","boolean","date_time"]}},Ke=function(e){var t=i.cloneDeep(Ge);if(!e)return t;var n={};return e.forEach((function(e){if(!Ge[e])throw"Aggregate "+e+" not managed by Vizzly";n[e]=Ge[e]})),n};function Xe(e,t,n){return e+" "+(1==e?t:n)}function Qe(e,t){if(void 0===t&&(t=!0),1==e.length)return t?"'"+e[0]+"'":""+e[0];var n=[].concat(e),r=n.pop();return n.map((function(e){return t?"'"+e+"'":""+e})).join(", ")+" and "+(t?"'"+r+"'":""+r)}var Je=function(e,t,n){return void 0===n&&(n="No value"),null===e||i.isNumber(e)&&isNaN(e)?n:e instanceof Date?t(e):!0===e?"True":!1===e?"False":i.isNumber(e)&&e%1!=0?e.toFixed(2):Array.isArray(e)?e.join(", "):""+e},Ze=function(e,t){return void 0===t&&(t="No value"),null===e?t:e instanceof Date?e.toISOString():e},$e=function(e,t){return et(e,t)[0]},et=function(e,t){return Object.keys(t).filter((function(n){return t[n].validDataTypes.includes(e.dataType)}))},tt=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},nt=function(e,t){var n=e.split("_"),r=n.pop();return[void 0].concat(Object.keys(t.supportedAggregates||{}),Object.keys(t.supportedTimeTruncFunctions||{}),Object.keys(t.supportedTransformationFunctions||{})).includes(r)?{field:n.join("_"),function:null!=r?r:""}:{field:e,function:"none"}},rt=function(e,t){var n=nt(e,t);return{fieldId:n.field,function:n.function}},it=function(e,t){var n=new Set(t.map((function(e){return e.field})));return e.filter((function(e){return!n.has(e.id)}))},ot=function(e){return e.map((function(e){return"string"==typeof e?{field:e,function:"none"}:e}))},at=function(e){return"string[]"==e.dataType},lt=tt,st=nt,ut=function(e){return"none"!=e.function},dt=function(e,t,n){switch(e.type){case"subquery":return"subquery_"+t;case"maths":return"maths_"+t;case"switchField":return"switchField_"+t;case"field":return tt({field:e.value,function:e.function});case"function":return"function_"+t;case"number":default:return"number_"+t}};function ct(e,t){for(var n={},r=0,i=Object.entries(e);r<i.length;r++){var o=i[r];n[o[0]]=o[1].filter((function(e){return(null==e?void 0:e.field)!==t}))}return n}var pt=function(e,t){return U({},e,{order:i.remove(e.order,(function(e){return i.some(t,(function(t){return t.function==e.function&&t.field==e.field}))}))})},ft=function(e,t,n){var r,o,a,l=U({},e);if("measure"in l&&i.remove(l.measure,(function(e){return e.field==t})),"barMeasure"in l&&i.remove(l.barMeasure,(function(e){return e.field==t})),"lineMeasure"in l&&i.remove(l.lineMeasure,(function(e){return e.field==t})),"xMeasure"in l&&(null==(r=l.yMeasure)?void 0:r.field)==t&&(l.xMeasure=null),"yMeasure"in l&&(null==(o=l.yMeasure)?void 0:o.field)==t&&(l.yMeasure=null),"order"in l&&i.remove(l.order,(function(e){return e.field==t})),"dimension"in l&&i.remove(l.dimension,(function(e){return e.field==t})),"barDimension"in l&&i.remove(l.barDimension,(function(e){return e.field==t})),"lineDimension"in l&&i.remove(l.lineDimension,(function(e){return e.field==t})),"filter"in l&&l.filter.forEach((function(e){i.remove(e,(function(e){return e.field==t}))})),"parameters"in l&&l.parameters&&n){var s=function(e,t,n){if("measure"in e&&e.measure){var r=function(e,t){return Object.keys(e).map((function(e){var n=st(e,t);return null!=n&&n.function?n:null})).find((function(e){return null!==e}))}(e.measure,n);if(null!=r&&r.function&&r.field===t){var i=lt(r);delete e.measure[i]}e.measure=ct(e.measure,t)}if("group"in e&&e.group){var o=function(e,t){return Object.keys(e).map((function(e){var n=Ee(e,t.supportedTimeTruncFunctions);return null!=n&&n.truncate?n:null})).find((function(e){return null!==e}))}(e.group,n);if(null!=o&&o.truncate&&o.field===t){var a=_e(o);delete e.group[a]}else e.group.hasOwnProperty(t)&&delete e.group[t];e.group=ct(e.group,t)}return e}(l.parameters,t,n);l.parameters=s}return"timeDimension"in l&&(null==(a=l.timeDimension)?void 0:a.field)==t&&(l.timeDimension=null),l},mt=function(e){var t=[].concat(e.measure);return e.dimension.forEach((function(e){t.push({field:e.field,function:e.function})})),e.timeDimension&&t.push({field:e.timeDimension.field,function:e.timeDimension.truncate}),pt(e,t)},ht=function(e,t,n){var r=function e(t,n){return i.mergeWith({},t,n,(function(t,n){return i.isArray(n)?n:i.isObject(t)&&i.isObject(n)?e(t,n):n}))}(e,t),o=n.validate(r),a=o.error;if(a)throw a;return o.value},vt=function(e){return function(t,n){var r=ht(t,n,Pe(e));return pt(r,[].concat(r.measure))}},gt=function(e,t,n){return e.map((function(e){return{returns:{type:"string",value:e.name},filter:Pt(e.rule,t,n)}}))},bt=function(){return l.v4().replace(/-/g,"")},xt=function(e){return"numeratorFilter"in e},yt=function(e){return"leftFieldId"in e&&"operator"in e&&"rightFieldId"in e},wt=function(e){return"roundToDecimalPlaces"in e},Ct=function(e){return"leftFieldId"in e&&"leftFunction"in e&&"operator"in e&&"rightFieldId"in e&&"rightFunction"in e},jt=function(e){return"denominatorFieldId"in e&&"denominatorAggregate"in e&&"numeratorFieldId"in e&&"numeratorAggregate"in e},St=function(e){return"rules"in e},Ft=function(e){if(xt(e))return"percentage";if(jt(e))return"percentage";if(yt(e))return"math";if(Ct(e))return"math";if(St(e))return"rules";if(wt(e))return"roundedNumber";throw"Unrecognised custom field type for custom field; "+JSON.stringify(e)},kt=function(e){return xt(e)||yt(e)||Ct(e)||jt(e)||St(e)||wt(e)},Tt=function(e,t,n,r,i,o){if(xt(t))return function(e,t,n,r,i){var o,a=[];return i&&(a=It(i,null!=(o=e.numeratorFilter[0])?o:[])),r?{type:"maths",left:{type:"field",value:null==e?void 0:e.denominatorFieldId,function:e.denominatorAggregate},op:"/",right:{type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:[]}}}:{type:"maths",left:{type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:Pt(a,t,n)}},op:"/",right:{type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:[]}}}}(t,n,r,i,o);if(jt(t))return function(e,t,n,r){return{type:"maths",left:{type:"field",value:null==e?void 0:e.numeratorFieldId,function:e.numeratorAggregate},op:"/",right:{type:"subquery",value:{measure:[{type:"field",value:e.denominatorFieldId,function:e.denominatorAggregate}],filter:Pt(r,t,n)}}}}(t,n,r,o||[]);if(St(t))return function(e,t,n,r){var i={type:"switchField",value:{cases:gt(t.rules,n,r)}};return"none"==e.function?i:{type:"function",function:e.function,value:i}}(e,t,n,r);if(Ct(t))return function(e){var t=function(e,t,n){return n?{type:"maths",left:{type:"field",value:e,function:t},right:{type:"field",value:n.fieldId,function:n.function},op:n.operator}:{type:"field",value:e,function:t}};return{type:"maths",left:t(e.leftFieldId,e.leftFunction,e.leftNested),right:t(e.rightFieldId,e.rightFunction,e.rightNested),op:e.operator}}(t);if(yt(t))return function(e,t){return"none"!=e.function?{type:"function",function:e.function,value:{type:"maths",left:{type:"field",value:t.leftFieldId,function:"none"},right:{type:"field",value:t.rightFieldId,function:"none"},op:t.operator}}:{type:"maths",left:{type:"field",value:t.leftFieldId,function:"none"},right:{type:"field",value:t.rightFieldId,function:"none"},op:t.operator}}(e,t);if(wt(t))return At(e,t);throw"Unsupported custom field type; "+JSON.stringify(t)},At=function(e,t){var n={type:"field",function:"round_to_"+t.roundToDecimalPlaces+"_dp",value:t.fieldId};return"none"==e.function?n:{type:"function",function:e.function,value:n}},Dt=function(e){if("numeratorFilter"in e&&"numeratorFieldId"in e)return{id:e.id,canBeDimension:e.canBeDimension,canBeMeasure:e.canBeMeasure,denominatorAggregate:e.numeratorAggregate,denominatorFieldId:e.numeratorFieldId,publicName:e.publicName,dataType:e.dataType,allowedOperators:e.allowedOperators,numeratorFilter:e.numeratorFilter};if("leftAggregate"in e||"rightAggregate"in e){var t=U({},e,{rightFunction:e.rightFunction||e.rightAggregate,leftFunction:e.leftFunction||e.leftAggregate,leftNested:e.leftNested?U({},e.leftNested,{aggregate:void 0,function:e.leftNested.function||e.leftNested.aggregate}):void 0,rightNested:e.rightNested?U({},e.rightNested,{aggregate:void 0,function:e.rightNested.function||e.rightNested.aggregate}):void 0});return delete t.leftAggregate,delete t.rightAggregate,t.rightNested&&delete t.rightNested.aggregate,t.leftNested&&delete t.leftNested.aggregate,t}return e},It=function(e,t){return e&&!i.isEmpty(e)||(e=[[]]),[].concat(e).map((function(e){return[].concat(e,t)}))},Pt=function(e,t,n){return e.map((function(r){return[].concat(r).flatMap((function(r){var i;if(r.function&&!Re(t.supportedTimeTruncFunctions,r.function))throw"Query engine does not support the query function "+r.function+".";var o,a=Mn(n,r.field),l={type:"field",value:r.field,function:null!=(i=r.function)?i:"none"};return kt(a)&&(l=Tt({field:a.id,function:null!=(o=r.function)?o:"none"},a,t,n,!1,e)),"array_contains"==r.op&&Array.isArray(r.value)?[].concat(r.value).map((function(e){return{field:l,op:r.op,value:e}})):[{field:l,op:r.op,value:r.value}]}))}))},_t=function(e,t){return[[].concat(e,[t]),e.length]},Et=function(e,t,n,r,i,o,a,l,s){var u=[],d=[],c=[],p=[],f=[];if(o){var m;if(!Re(s.supportedTimeTruncFunctions,o.truncate))throw"Query engine does not support the time trunc function "+o.truncate+".";var h=_t(d,{type:"field",value:o.field,function:o.truncate});d=h[0],m=h[1],u=[].concat(u,[{functionId:o.truncate,field:Mn(e,o.field)}]),c=[].concat(c,[{index:m}])}return i.forEach((function(t){var n,r=_t(d,{type:"field",value:null==t?void 0:t.field,function:t.function});d=r[0],n=r[1],u=[].concat(u,[{functionId:t.function,field:Mn(e,t.field)}]),c=[].concat(c,[{index:n}])})),t.forEach((function(t){if(n=t.function,![].concat(Object.keys(s.supportedAggregates),["none"]).includes(n))throw"Query engine does not support the query function "+t.function+".";var n,r=_t(d,{type:"field",value:t.field,function:t.function});d=r[0],u=[].concat(u,[{functionId:t.function,field:Mn(e,t.field)}])})),n.forEach((function(e){var t=d.findIndex((function(t){return"field"==t.type&&t.value==e.field&&t.function==e.function}));t>=0&&(p=[].concat(p,[{index:t,direction:e.direction}]))})),r.forEach((function(t){var n=Pt([t],s,e);f=[].concat(f,[n[0]])})),d=d.map((function(t){if("field"==t.type&&"string"==typeof t.value){var n=Mn(e,t.value);if(kt(n))return Tt({function:t.function,field:t.value},n,s,e,Rt({group:c}),r)}return t})),{query:{type:"query",dataSetId:e.id,measure:d,group:c,filter:f,order:p,limit:a,offset:l},measureDescription:u}},Ot=function e(t){return i.some(t,(function(t){return"maths"==t.type?e([t.left])||e([t.right]):"field"==t.type&&"string"!=typeof t.value?e([t.value]):"subquery"==t.type}))},Lt=Et,Rt=function(e){return e.group.length>0},Mt=function(e,t,n){return{query:{type:"preparedQuery",preparedQueryType:"uniqueArrayValues",dataSetId:e,fieldId:t.id,filter:n||[]},resultFields:[{id:t.id,publicName:t.publicName,dataType:t.dataType}]}},Nt=function(e,t,n){return{dataSetId:e.id,measure:[{field:t,function:"count"}],order:[],filter:n?[n]:[],dimension:[{field:t,function:"none"}],timeDimension:null,limit:5e3,offset:0}},zt=function(e,t){return e.supportedFeatures.includes(t)},Bt=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ValidationError",n}return G(t,e),t}(Z(Error)),qt=function(e){function t(t,n){var r;return(r=e.call(this,"\n An expected field is missing from a dataSet.\n\n Missing '"+n+"'. Got;\n "+JSON.stringify(t)+"\n ")||this).missingFieldId=void 0,r.name="FieldNotFoundInDataSet",r.missingFieldId=n,r}return G(t,e),t.prototype.getMissingFieldId=function(){return this.missingFieldId},t}(Bt),Vt=function(e){return r.object(U({},he,ge(e.queryEngineConfig),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("barChart","horizontalBarChart"),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),protectedFields:r.object({dimension:ye(),measure:xe()}).unknown(!0),parameters:je(e.queryEngineConfig),goalLines:Fe(),axisTitles:ke()}))},Wt=function(e){return function(t,n){var r=ht(t,n,Vt(e));return mt(r)}},Ht=function(e){function t(t){var n;return(n=e.call(this,"Corrupt view. "+t.message+".\n\n "+JSON.stringify(t)+"\n ")||this).name="CorruptedView",n}return G(t,e),t}(Bt),Yt=function(e){function t(t,n){var r;return(r=e.call(this,"\n An expected data set is missing from the dashboard.\n\n Missing '"+n+"'. Got;\n "+JSON.stringify([].concat(t).map((function(e){return e.id})))+"\n ")||this).name="DataSetNotFound",r}return G(t,e),t}(Bt),Ut=function(e){var t=[];return"measure"in e&&e.measure&&(t=[].concat(t,[].concat(e.measure))),"xMeasure"in e&&e.xMeasure&&(t=[].concat(t,[e.xMeasure])),"yMeasure"in e&&e.yMeasure&&(t=[].concat(t,[e.yMeasure])),t},Gt=function(e){var t=[];return"dimension"in e&&e.dimension&&(t=[].concat(t,e.dimension)),"lineDimension"in e&&e.lineDimension&&(t=[].concat(t,e.lineDimension)),"barDimension"in e&&e.barDimension&&(t=[].concat(t,e.barDimension)),t},Kt=function(e){var t=[];return Ut(e).forEach((function(e){t=[].concat(t,[e.field])})),Gt(e).forEach((function(e){t=[].concat(t,[e.field])})),"order"in e&&e.order&&(t=[].concat(t,[].concat(e.order).map((function(e){return e.field})))),"timeDimension"in e&&e.timeDimension&&(t=[].concat(t,[e.timeDimension.field])),t},Xt={allowUnknown:!0,stripUnknown:!0},Qt=function(e,t,n){var r=On(e.type,{queryEngineConfig:n}).schema.validate(e,Xt).error;if(r)return[new Ht(r)];var i=Rn(t,e.dataSetId);if(!i)return[new Yt(t,e.dataSetId)];var o=Kt(e);try{o.forEach((function(e){Mn(i,e)}))}catch(e){if(e instanceof qt)return[e];throw e}return[]},Jt=function(e){return"barChart"===e.type?"The Column Chart needs to have a grouping or a time to display correctly.":"lineChart"===e.type?"The Line Chart needs to have a grouping or a time to display correctly.":"areaChart"===e.type?"The Area Chart needs to have a grouping or a time to display correctly.":"horizontalBarChart"===e.type?"The Horizontal Bar Chart needs to have a grouping or a time to display correctly.":"comboChart"===e.type?"The Combo Chart needs to have a grouping (Bar and Line), or have time set to display correctly.":"scatterChart"===e.type?"The Scatter Chart needs to have a grouping to display correctly.":"pieChart"===e.type?"The Pie Chart needs to have a grouping to display correctly.":null},Zt=function(e){var t;return"comboChart"===e.type?!!e.timeDimension||!!(e.barDimension.length>0&&e.lineDimension.length>0):"barChart"!==e.type&&"lineChart"!==e.type&&"areaChart"!==e.type&&"horizontalBarChart"!==e.type&&"scatterChart"!==e.type&&"pieChart"!==e.type||!!e.timeDimension||null==e||!e.dimension||0!==(null==e||null==(t=e.dimension)?void 0:t.length)},$t=function(e){return!!Zt(e)||Jt(e)},en=["parentDimension"],tn=function(e){return e||"view_"+l.v4()};function nn(e){return $(e,en)}var rn=function(e,t,n){var r=i.cloneDeep(Ln(t.fields,{onlyFieldTypes:["boolean","string"]})),o=i.cloneDeep(Ln(t.fields,{onlyFieldTypes:["date_time"]})),a=i.cloneDeep(Ln(t.fields,{onlyFieldTypes:["number"]})),l=null;return o[0]&&(l={field:o[0].id,truncate:"allowedGranularities"in o[0]?o[0].allowedGranularities[0]:"none"}),n(e,{protectedByOrganisation:!0,dimension:r.map((function(e){return{field:e.id,function:"none"}})),measure:[].concat(a).map((function(e){return{function:"none",field:e.id}})),order:[],timeDimension:l})},on=function(e,t){var n=null,r=i.cloneDeep(e);return r.forEach((function(e){var r=Mn(t,e.field);"date_time"==r.dataType&&(n={field:r.id,truncate:e.function})})),r=r.filter((function(e){return"date_time"!=Mn(t,e.field).dataType})),{timeDimension:n,dimension:r}},an=function(e){var t=[].concat(e.dimension);return"timeDimension"in e&&e.timeDimension&&(t=[{field:e.timeDimension.field,function:e.timeDimension.truncate}].concat(t)),t},ln=function(e){if(e){var t=i.cloneDeep(e);return t.measure=He(e.measure||[]),t}},sn=function(e){return{title:"Column chart",dump:function(e){return e},load:function(e){return U({},e,{measure:He(e.measure),order:We(e.order,e.timeDimension),filter:Ve(e.filter),protectedFields:ln(e.protectedFields),viewId:tn(e.viewId),dimension:ot(e.dimension),approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount),parameters:Ue(e.parameters)})},setAttributes:Wt(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],stacked:void 0,dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0},t)},createFeedback:$t,schema:Vt(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"barChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,callToAction:"Add grouping",preSetPartialAttributes:function(e,t){return on(e,t)},getValues:function(e){return an(e)},maxAllowed:2,testId:"add-dimension"},{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"stacked",title:"Layout",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0},setDataAttributesFromPreAggregatedDataSet:function(e,t){return rn(e,t,this.setAttributes)}}},un=function(e){return r.object(U({},he,ge(e.queryEngineConfig),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("lineChart"),parameters:je(e.queryEngineConfig),lineCurve:be,conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),goalLines:Fe(),axisTitles:ke()}))},dn=function(e){return function(t,n){var r=ht(t,n,un(e));return mt(r)}},cn=function(e){return{title:"Line chart",dump:function(e){return e},load:function(e){return{type:e.type,measure:He(e.measure),order:We(e.order,e.timeDimension),dimension:ot(e.dimension),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:tn(e.viewId),filter:Ve(e.filter),dataSetId:e.dataSetId,limit:e.limit,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,conditionalFormattingRules:e.conditionalFormattingRules,drilldown:e.drilldown,legend:e.legend,goalLines:e.goalLines,parameters:Ue(e.parameters),approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount),axisTitles:e.axisTitles}},setAttributes:dn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0},t)},createFeedback:$t,schema:un(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"lineChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",fieldFilterOptions:{forComponent:"lineChart"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,callToAction:"Add grouping",preSetPartialAttributes:function(e,t){return on(e,t)},getValues:function(e){return an(e)},maxAllowed:2,testId:"add-dimension"},{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"curve",title:"Line Curve",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0},setDataAttributesFromPreAggregatedDataSet:function(e,t){return rn(e,t,this.setAttributes)}}},pn=function(e){return r.object(U({},he,{measure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),dimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),filter:fe(e.queryEngineConfig),timeDimension:r.valid(null),order:r.array().items(ue(e.queryEngineConfig)),type:r.valid("pieChart"),legend:r.valid(!0,!1),limit:me(),labelsAsPercentage:r.boolean(),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),labelFormat:r.alternatives(r.string(),r.valid(null)),parameters:je(e.queryEngineConfig)}))},fn=function(e){return{title:"Pie chart",dump:function(e){return e},load:function(e){return{type:e.type,measure:He(e.measure),order:We(e.order,e.timeDimension),dimension:ot(e.dimension),viewId:tn(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:Ve(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,labelsAsPercentage:e.labelsAsPercentage,legend:e.legend,labelFormat:e.labelFormat,parameters:Ue(e.parameters)}},setAttributes:function(t,n){return ht(t,n,pn(e))},validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labelFormat:null,parameters:{}},t)},createFeedback:$t,schema:pn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"pieChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",fieldFilterOptions:{forComponent:"pieChart"},callToAction:"Add metric",maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,callToAction:"Add comparison",preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"},{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart"},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart"}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"legend",title:"Show Legend",description:""},{type:"numberFormat",title:"Format",description:""}]}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0}}},mn=function(e){return r.object(U({},he,{xMeasure:se(e.queryEngineConfig.supportedAggregates).allow(null),yMeasure:se(e.queryEngineConfig.supportedAggregates).allow(null),dimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),order:r.array().items(ue(e.queryEngineConfig)),limit:me(),legend:r.valid(!0,!1),offset:r.number().min(0),filter:fe(e.queryEngineConfig),type:r.valid("scatterChart"),timeDimension:r.valid(null),xAxisPrefix:r.string().allow(""),yAxisPrefix:r.string().allow(""),xAxisPostfix:r.string().allow(""),yAxisPostfix:r.string().allow(""),yAxisFormat:r.alternatives(r.string(),r.valid(null)),xAxisFormat:r.alternatives(r.string(),r.valid(null)),approxYAxisLabelCount:ve,approxXAxisLabelCount:ve,goalLines:Fe(),axisTitles:ke()}))},hn=function(e){return function(t,n){var r=ht(t,n,mn(e)),i=[];return r.xMeasure&&i.push(r.xMeasure),r.yMeasure&&i.push(r.yMeasure),r.dimension.forEach((function(e){i.push({field:e.field,function:e.function})})),pt(r,i)}},vn=function(e){return r.object(U({},he,{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),barMeasure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),lineMeasure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),barDimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),lineDimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),order:r.array().items(ue(e.queryEngineConfig)),timeDimension:r.alternatives(de(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),limit:me(),offset:r.number().min(0),filter:fe(e.queryEngineConfig),type:r.valid("comboChart"),xAxisPrefix:r.string().allow(""),yAxisPrefix:r.string().allow(""),xAxisPostfix:r.string().allow(""),yAxisPostfix:r.string().allow(""),yAxisFormat:r.alternatives(r.string(),r.valid(null)),xAxisFormat:r.alternatives(r.string(),r.valid(null)),approxYAxisLabelCount:ve,approxXAxisLabelCount:ve,goalLines:Fe(),conditionalFormattingRules:r.object({bar:r.array().items(Ae(e.queryEngineConfig))}),axisTitles:ke()}))},gn=function(e){return function(t,n){var r=ht(t,n,vn(e)),i=[].concat(r.lineMeasure,r.barMeasure);return[].concat(r.lineDimension,r.barDimension).forEach((function(e){i.push({field:e.field,function:e.function})})),r.timeDimension&&i.push({field:r.timeDimension.field,function:r.timeDimension.truncate}),pt(r,i)}},bn=function(e){return{title:"Combo chart",dump:function(e){return e},load:function(e){return U({},t=e,{lineMeasure:He(t.lineMeasure),barMeasure:He(t.barMeasure),order:We(t.order,t.timeDimension||null),filter:Ve(t.filter),lineDimension:ot(t.lineDimension||t.dimension||[]),barDimension:ot(t.barDimension||t.dimension||[]),viewId:tn(t.viewId),approxXAxisLabelCount:Ye(t.approxXAxisLabelCount),approxYAxisLabelCount:Ye(t.approxYAxisLabelCount)});var t},setAttributes:gn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0},t)},createFeedback:$t,schema:vn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.lineMeasure.length>0||e.barMeasure.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"comboChart"),r=n.measure,i=n.dimension;return this.init(t.id,{barMeasure:[r[0]],lineMeasure:[r[1]||r[0]],barDimension:i,lineDimension:i})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},{type:"views",title:"View",description:""},{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",metrics:[{title:"Line",propKey:"lineMeasure",allowsMultiple:!0},{title:"Bar",propKey:"barMeasure",allowsMultiple:!0}]},{type:"comboChartDimension",title:"Grouping - X Axis",description:""},{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},{type:"customMetrics",title:"Custom metrics",description:""},{type:"limit",title:"Limit",description:"Set the maximum number of data points to show on this combo chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"stacked",title:"Layout",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor",subSection:[{title:"Bar",propKey:"bar"}]},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}}},xn=function(e){return r.object(U({},he,{type:r.valid("dataTable"),measure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),dimension:ce(e.queryEngineConfig.supportedTimeTruncFunctions),order:r.array().items(ue(e.queryEngineConfig)),timeDimension:r.alternatives(de(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),limit:me(),offset:r.number().min(0),filter:fe(e.queryEngineConfig),prefixes:r.array().items(De),exportNames:r.object(),numberFormat:r.object(),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),dateTimeFormat:r.string(),protectedFields:r.object({dimension:ye(),measure:xe()}).unknown(!0),sizing:Te,tableDrilldown:r.array().items(r.object({subsetDimension:r.string().required()}))}))},yn=function(e){return function(t,n){var r=ht(t,n,xn(e));return mt(r)}},wn=function(e,t){return e.filter((function(e){return e.pivot==t}))},Cn=function(e){return{title:"Pivot table",dump:function(e){return e},load:function(e){return{type:e.type,measure:He(e.measure),order:We(e.order,e.timeDimension||null),displayTitle:e.displayTitle,dimension:(n=an({timeDimension:e.timeDimension,dimension:ot(e.dimension)}),n.map((function(e){return U({},e,{pivot:e.pivot?e.pivot:"x"})}))),displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,protectedFields:ln(e.protectedFields),viewId:tn(e.viewId),filter:Ve(e.filter),dataSetId:e.dataSetId,limit:e.limit,offset:e.offset,conditionalFormattingRules:e.conditionalFormattingRules,dateTimeFormat:e.dateTimeFormat,prefixes:e.prefixes,exportNames:e.exportNames,numberFormat:e.numberFormat,sizing:e.sizing,tableDrilldown:(t=e.tableDrilldown,t&&t.length>0?t.map(nn):t||[])};var t,n},setAttributes:yn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:2e3,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[]},t)},schema:xn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"dataTable"),r=n.dimension;return this.init(t.id,{measure:n.measure.slice(0,5),dimension:r})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Group columns",description:"",fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,callToAction:"Add group column",preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return U({},e,{pivot:"y"})})),wn(n.dimension,"x"))}},getValues:function(e){return wn(e.dimension,"y")},testId:"add-pivot-dimension"},{type:"fieldCollector",title:"Group rows",description:"Which field do you want to group each row by? An example might be an employee ID or geographical location",fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,callToAction:"Add group row",preSetPartialAttributes:function(e,t,n){return{dimension:[].concat(e.map((function(e){return U({},e,{pivot:"x"})})),wn(n.dimension,"y"))}},getValues:function(e){return wn(e.dimension,"x")},testId:"add-dimension"},{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",fieldFilterOptions:{forComponent:"dataTable"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"sort",title:"Sort",description:""},{type:"pagination",title:"Pagination",description:""},{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}]},formatPanelConfig:function(){return[{title:"Heading",type:"heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"format",title:"Format",description:"",subSection:[{type:"time",title:"Time",description:""}]},{type:"prefixes",title:"Prefixes",description:""},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}}},jn=function(e){return function(t,n){var r=ht(t,n,Vt(e));return mt(r)}},Sn=function(e){return{title:"Horizontal bar chart",dump:function(e){return e},load:function(e){return U({},e,{measure:He(e.measure),order:We(e.order,e.timeDimension),dimension:ot(e.dimension),viewId:tn(e.viewId),filter:Ve(e.filter),approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount),protectedFields:ln(e.protectedFields)})},setAttributes:jn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0},t)},createFeedback:$t,schema:Vt(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"horizontalBarChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this horizontal bar chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric - X Axis",description:"What do you want each bar to measure?",fieldFilterOptions:{forComponent:"horizontalBarChart"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"drilldown",title:"Drilldown",description:""},{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,callToAction:"Add grouping",preSetPartialAttributes:function(e,t){return on(e,t)},getValues:function(e){return an(e)},maxAllowed:2,testId:"add-dimension"},{type:"sort",title:"Sort",description:""},{type:"limit",title:"Limit",description:"Set the maximum number of data points to show on this horizontal bar chart."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this horizontal bar chart."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"stacked",title:"Layout",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0},setDataAttributesFromPreAggregatedDataSet:function(e,t){return rn(e,t,this.setAttributes)}}},Fn=function(e){return r.object(U({},he,ge(e.queryEngineConfig),{stacked:r.valid(!0,!1,"100%"),legend:r.valid(!0,!1),type:r.valid("areaChart"),lineCurve:be,conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),parameters:je(e.queryEngineConfig),goalLines:Fe(),axisTitles:ke()}))},kn=function(e){return function(t,n){var r=ht(t,n,Fn(e));return mt(r)}},Tn=function(e){return{title:"Area chart",dump:function(e){return e},load:function(e){return{type:e.type,measure:He(e.measure),displayTitle:e.displayTitle,dimension:ot(e.dimension),timeDimension:e.timeDimension,displaySubject:e.displaySubject,viewId:tn(e.viewId),filter:Ve(e.filter),order:We(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,offset:e.offset,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,lineCurve:e.lineCurve,conditionalFormattingRules:e.conditionalFormattingRules,protectedByOrganisation:e.protectedByOrganisation,stacked:e.stacked,drilldown:e.drilldown,legend:e.legend,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,goalLines:e.goalLines,parameters:Ue(e.parameters),approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount)}},setAttributes:kn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,offset:0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0},t)},createFeedback:$t,schema:Fn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"areaChart");return this.init(t.id,{measure:[n.measure[0]],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",fieldFilterOptions:{forComponent:"areaChart"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be an employee ID to represent each employee.",fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,callToAction:"Add grouping",preSetPartialAttributes:function(e,t){return on(e,t)},getValues:function(e){return an(e)},maxAllowed:2,testId:"add-dimension"},{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"stacked",title:"Layout",description:""},{type:"curve",title:"Line Curve",description:""},{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0}}},An=function(e){return r.object(U({},he,{fontSize:r.string().allow(""),formatter:r.object(),measure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),filter:fe(e.queryEngineConfig),prefixes:r.object(),postfixes:r.object(),type:r.valid("singleStat"),limit:me(),conditionalFormattingRules:r.array().items(Ae(e.queryEngineConfig)),deltaTimeDimension:r.alternatives(de(e.queryEngineConfig.supportedTimeTruncFunctions),r.valid(null)),parameters:je(e.queryEngineConfig)}))},Dn=function(e){return{title:"Single stat",dump:function(e){return e},load:function(e){var t=function(e){if("singleMeasure"in e){var t={},n={},r=[],i={};return e.singleMeasure&&(r=[e.singleMeasure],t[lt(e.singleMeasure)]=e.prefix,n[lt(e.singleMeasure)]=e.postfix,i[lt(e.singleMeasure)]=e.formatter),{type:"singleStat",prefixes:t,postfixes:n,measure:r,formatter:i,fontSize:e.fontSize,displayTitle:e.displayTitle,displaySubject:e.displaySubject,filter:Ve(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules,deltaTimeDimension:e.deltaTimeDimension,parameters:Ue(e.parameters)}}return U({},e,{filter:Ve(e.filter)})}(e);return{type:"singleStat",prefixes:t.prefixes,postfixes:t.postfixes,fontSize:t.fontSize,formatter:t.formatter,measure:He(t.measure),displayTitle:t.displayTitle,displaySubject:t.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:tn(e.viewId),filter:t.filter,dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:t.conditionalFormattingRules,deltaTimeDimension:t.deltaTimeDimension,parameters:Ue(t.parameters)}},setAttributes:function(t,n){return ht(t,n,An(e))},validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"singleStat",postfixes:{},prefixes:{},measure:[],displayTitle:"",formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:tn(null==t?void 0:t.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{}},t)},schema:An(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"singleStat");return this.init(t.id,{measure:[n.measure[0]]})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",fieldFilterOptions:{forComponent:"singleStat"},callToAction:"Add metric",preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"filter",title:"Filters",description:"Only include the information you want in this single stat"},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"comparison",title:"Comparison",description:""}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"statsLabels",title:"Labels",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""}},{type:"format",title:"Format",description:"",subSection:[{title:"Font Size",type:"fontSize",description:""}]},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"fontColor"}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0},supportedFeatures:{parameters:!0}}},In={title:"Custom",dump:function(e){return e},load:function(e){return e},setAttributes:function(e,t){throw"Not implemented."},validate:function(){return[]},init:function(e,t){return{type:"custom",id:t&&t.id||"",dataSetId:e,displaySubject:"",displayTitle:"",protectedByOrganisation:void 0}},schema:r.object(),removeField:function(e,t){return e},isRunnable:function(){return!0},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[]},formatPanelConfig:function(){return[]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!1,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}},Pn=function(e){return r.object(U({},he,{type:r.valid("mercatorMap"),measure:r.array().items(se(e.queryEngineConfig.supportedAggregates)),filter:fe(e.queryEngineConfig),limit:me(),dimension:ce({}),labelFormat:r.alternatives(r.string(),r.valid(null)),noDataColor:r.string().required(),backgroundColor:r.string().required(),maxValueColor:r.string().required(),minValueColor:r.string().required(),position:r.object({scale:r.number(),centerX:r.number(),centerY:r.number()})}))},_n=function(e){return function(t,n){return ht(t,n,Pn(e))}},En={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}};function On(e,t){if("custom"==e)return In;if("barChart"==e)return sn(t||En);if("areaChart"==e)return Tn(t||En);if("lineChart"==e)return cn(t||En);if("pieChart"==e)return fn(t||En);if("scatterChart"==e)return function(e){return{title:"Scatter chart",dump:function(e){return e},load:function(e){return{type:e.type,xMeasure:He(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:He(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:ot(e.dimension),viewId:tn(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:Ve(e.filter),order:We(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:Ye(e.approxXAxisLabelCount),approxYAxisLabelCount:Ye(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles}},setAttributes:hn(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(e,t){return U({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:tn(null==t?void 0:t.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,axisTitles:void 0},t)},createFeedback:$t,schema:mn(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},isRunnable:function(e){return!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0},autoGenerate:function(t){var n=Wn(t,e.queryEngineConfig,"scatterChart"),r=n.measure;return this.init(t.id,{xMeasure:r[0],yMeasure:r[1],dimension:n.dimension})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},{type:"views",title:"View",description:""},{type:"labelledMetrics",title:"Metrics",description:"",metrics:[{title:"X axis",propKey:"xMeasure",allowsMultiple:!1},{title:"Y axis",propKey:"yMeasure",allowsMultiple:!1}]},{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,callToAction:"Add comparison",preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"},{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart"},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart"}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Chart Settings",description:"",subSection:[{type:"legend",title:"Show Legend",description:""}]},{type:"axisLabels",title:"Axis Preferences",description:"",y:{title:"Y Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}},x:{title:"X Axis",description:"",prefix:{title:"Prefix",description:""},postfix:{title:"Postfix",description:""},format:{title:"Format",description:""},count:{title:"Label count",description:""},axisTitle:{title:"Title",description:""}}},{type:"goalLine",title:"Goal Lines",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}}}(t||En);if("comboChart"==e)return bn(t||En);if("dataTable"==e)return Cn(t||En);if("basicTable"==e)return Zn(t||En);if("singleStat"==e)return Dn(t||En);if("mercatorMap"==e)return function(e){return{title:"Country map",dump:function(e){return e},load:function(e){return{dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:tn(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:He(e.measure),labelFormat:e.labelFormat,position:e.position,filter:Ve(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0"}},setAttributes:_n(e),validate:function(){return[]},init:function(e,t){return U({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:tn(null==t?void 0:t.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0"},t)},schema:Pn(e),removeField:function(e,t){return e},isRunnable:function(e){return!!(e.dimension&&e.dimension[0]&&e.measure&&e.measure[0])},autoGenerate:function(e){return this.init(e.id)},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},{type:"views",title:"View",description:""},{type:"fieldCollector",title:"Metric",description:"What do you want to show?",fieldFilterOptions:{forComponent:"pieChart"},callToAction:"Add metric",maxAllowed:1,preSetPartialAttributes:function(e){return{measure:e}},getValues:function(e){return e.measure},testId:"metric-input"},{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeConditionalPercentage:!0,removeRuleGrouping:!1,removeSimpleMaths:!0,removeSimplePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,callToAction:"Set country",preSetPartialAttributes:function(e){return{dimension:e}},getValues:function(e){return e.dimension},testId:"add-dimension"},{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"chartStyles",title:"Map Settings",description:"",subSection:[{type:"numberFormat",title:"Value format",description:""}]},{type:"mapColors",title:"Map colors",description:""}]},supportedCustomFields:{simplePercentage:!0,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0},supportedFeatures:{parameters:!1}}}(t||En);if("horizontalBarChart"==e)return Sn(t||En);throw"Cannot get interface for "+e+". Please implement it."}function Ln(e,t){var n=[].concat(e);return null!=t&&t.onlyFieldTypes&&!i.isEmpty(t.onlyFieldTypes)&&(n=[].concat(n).filter((function(e){var n;return null==t||null==(n=t.onlyFieldTypes)?void 0:n.includes(e.dataType)}))),null!=t&&t.forComponent&&(n=function(e,t){var n=On(t);return[].concat(e).filter((function(e){var t=!0;return xt(e)&&!n.supportedCustomFields.conditionalPercentage&&(t=!1),jt(e)&&!n.supportedCustomFields.simplePercentage&&(t=!1),yt(e)&&!n.supportedCustomFields.simpleMaths&&(t=!1),St(e)&&!n.supportedCustomFields.rules&&(t=!1),wt(e)&&!n.supportedCustomFields.roundedNumbers&&(t=!1),t}))}(n,t.forComponent)),null!=t&&t.removeConditionalPercentage&&(n=n.filter((function(e){return!xt(e)}))),null!=t&&t.removeSimplePercentage&&(n=n.filter((function(e){return!jt(e)}))),null!=t&&t.removeRuleGrouping&&(n=n.filter((function(e){return!St(e)}))),null!=t&&t.removeSimpleMaths&&(n=n.filter((function(e){return!yt(e)}))),null!=t&&t.removeAggregateMaths&&(n=n.filter((function(e){return!Ct(e)}))),null!=t&&t.onlyDimensions&&(n=n.filter((function(e){return e.canBeDimension}))),null!=t&&t.onlyMeasures&&(n=n.filter((function(e){return e.canBeMeasure}))),n}var Rn=function(e,t){return e.find((function(e){return e.id==t}))||null},Mn=function(e,t){var n=[].concat(e.fields).find((function(e){return e.id==t}));if(n)return n;throw new qt(e,t)},Nn=function(e,t){var n=i.findIndex(e,(function(e){return e.id==t}));return[e[n]||null,n]},zn=function(e,t){return U({},e,{fields:[].concat(e.fields).map((function(e){return function(e,t){return{id:e.id,dataType:e.dataType,publicName:e.publicName||(n=e.id,(r=function e(t,n,r){var o=i.replace(t,n,r);return o.indexOf(n)>=0?e(o,n,r):o}(n,"_"," ")).charAt(0).toUpperCase()+r.slice(1)),dashboardRequiredFilterGroups:e.dashboardRequiredFilterGroups||[],canBeDimension:void 0===e.canBeDimension||e.canBeDimension,canBeMeasure:void 0===e.canBeMeasure||e.canBeMeasure,allowedOperators:void 0===e.allowedOperators?Me(e,t):e.allowedOperators,allowedGranularities:void 0===e.allowedGranularities?Object.keys(t.supportedTimeTruncFunctions):e.allowedGranularities};var n,r}(e,t)}))})},Bn=function(e,t){var n=[].concat(e.fields).filter(kt);return t&&(n=Ln(n,{forComponent:t})),n},qn=function(e){return U({},e,{fields:[].concat(e.fields).filter((function(e){return!kt(e)}))})},Vn=function(e,t){return[].concat(e).map((function(e){return e.id==t.id?t:e}))},Wn=function(e,t,n){var r="horizontalBarChart"===n?void 0:"x",i=function(e){return[].concat(Ln(e.fields,{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0}))}(e)[0],o=[].concat(function(e,t){return[].concat(Ln(e.fields,{onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:t}))}(e,n)).map((function(e){var n=$e(e,t.supportedAggregates);return{field:e.id,function:n}}));return{dataSetId:e.id,measure:o,order:[],timeDimension:null,filter:[],dimension:[{field:i.id,function:"none",pivot:r}]}},Hn=function(e,t,n){var r=Ln(e.fields,{removeAggregateMaths:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0}),i=[].concat(r).map((function(e){return{field:e.id,function:"none"}}));return{dataSetId:e.id,measure:i,timeDimension:null,order:[],filter:n,dimension:[],limit:t,offset:0}},Yn=function(e){if(!e.preAggregated)throw"buildViewOnlyQuery function should only be used for single-view datasets";var t=[].concat(e.fields).map((function(e){return{field:e.id,function:"none"}}));return{dataSetId:e.id,measure:t,timeDimension:null,order:[],filter:[],dimension:[],offset:0}},Un=function(e,t){if(!t)return e;e=e.map(qn);var n=[].concat(e).map((function(e){var n=(t[e.id]||[]).map(Dt);return U({},e,{fields:[].concat(e.fields,n)})}));return[].concat(n)},Gn=function(e,t,n,r,i){var o,a,l;return void 0===i&&(i={}),{id:n,publicName:r,dataType:t,canBeDimension:null!=(o=i.canBeDimension)?o:"number"!=t,canBeMeasure:null==(a=i.canBeMeasure)||a,allowedOperators:null!=(l=i.allowedOperators)?l:Me({dataType:t},e)}},Kn=function(e,t,n,r){return void 0===r&&(r={}),Gn(e,"string",t,n,r)},Xn=function(e,t,n,r){return void 0===r&&(r={}),Gn(e,"number",t,n,r)},Qn=function(e,t,n,r){return void 0===r&&(r={}),Gn(e,"boolean",t,n,r)},Jn=function(e,t,n,r){var i,o,a,l;return{id:t,publicName:n,dataType:"date_time",allowedGranularities:null!=(i=r.allowedGranularities)?i:Object.keys(e.supportedTimeTruncFunctions),allowedOperators:null!=(o=r.allowedOperators)?o:Me({dataType:"date_time"},e),canBeDimension:null==(a=r.canBeDimension)||a,canBeMeasure:null!=(l=r.canBeMeasure)&&l}},Zn=function(e){return{title:"Basic table",dump:function(e){return{type:e.type,measure:e.measure,displayTitle:e.displayTitle,dimension:e.dimension,timeDimension:e.timeDimension,displaySubject:e.displaySubject,protectedFields:e.protectedFields,filter:e.filter,order:e.order,dataSetId:e.dataSetId,viewId:null==e?void 0:e.viewId,limit:e.limit,offset:e.offset,conditionalFormattingRules:e.conditionalFormattingRules,protectedByOrganisation:e.protectedByOrganisation,dateTimeFormat:e.dateTimeFormat,prefixes:e.prefixes,exportNames:e.exportNames,numberFormat:e.numberFormat,sizing:e.sizing}},load:function(e){return U({},e,{measure:He(e.measure),order:We(e.order,e.timeDimension),filter:Ve(e.filter),dimension:ot(e.dimension),viewId:tn(e.viewId),protectedFields:ln(e.protectedFields)})},setAttributes:vt(e),validate:function(t,n){return Qt(t,n,e.queryEngineConfig)},init:function(t,n){var r={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],dataSetId:t,viewId:tn(null==n?void 0:n.viewId),protectedFields:void 0,limit:50,offset:0,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{}};return vt(e)(r,n||{})},schema:Pe(e),removeField:function(t,n){return ft(t,n,e.queryEngineConfig)},setFields:function(t,n){var r=[].concat(n).map((function(e){return{field:e,function:"none"}}));return vt(e)(t,{measure:r})},setDateTimeFormat:function(e,t){return this.setAttributes(e,{dateTimeFormat:t})},isRunnable:function(e){return e.measure.length>0},autoGenerate:function(e){var t=Ln(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0}),n=[].concat(t).map((function(e){return{field:e.id,function:"none"}}));return this.init(e.id,{measure:n.slice(0,5)})},dataPanelConfig:function(){return[{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},{type:"views",title:"View",description:""},{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},{type:"sort",title:"Sort",description:"Select how the columns are ordered in this table"},{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"},{type:"filter",title:"Filters",description:"Only include the information you want to use in this table."},{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}]},formatPanelConfig:function(){return[{type:"heading",title:"Heading",description:"",subSection:[{type:"title",title:"Title",description:""},{type:"subject",title:"Subject",description:""}]},{type:"format",title:"Format",description:"",subSection:[{type:"time",title:"Time",description:""}]},{type:"prefixes",title:"Prefixes",description:""},{type:"conditionalFormatting",title:"Conditional Formatting",description:"",ruleType:"backgroundColor"}]},supportedCustomFields:{simplePercentage:!1,conditionalPercentage:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0},supportedFeatures:{parameters:!1}}},$n=function(e,t){return s.scale(e).colors(t)},er=function(e,t){var n;return(null!=t?t:0)<=(null!=(n=null==e?void 0:e.length)?n:0)?e:rr($n(e,t))},tr={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},nr=function(e){var t=1e4*Math.sin(e++);return t-Math.floor(t)},rr=function(e,t){void 0===t&&(t=5);for(var n,r,i=e.length;i;)r=Math.floor(nr(t)*i--),n=e[i],e[i]=e[r],e[r]=n,++t;return e},ir=[].concat(["barChart","horizontalBarChart","areaChart","lineChart","scatterChart","pieChart","singleStat","dataTable","basicTable","comboChart","mercatorMap","custom"]).filter((function(e){return"custom"!=e})),or=function(e){return{attributes:e,localFilters:[],results:[],colSpan:1,reports:[],updatesFromParameters:{}}},ar=function(e){if("dateFilter"==e)return"Date filter";if("dateAndTimeFilter"==e)return"Date Time filter";if("singleSelectFilter"==e)return"Single select filter";if("multiSelectFilter"==e)return"Multi select filter";throw"Unrecognised additional filter type "+e},lr=function(e){return U({},e,{managedByConfiguration:!1})},sr=function(e){return"fields"in e?function(e){if("globalSelectFilter"==e.type)return{type:"singleSelectFilter",title:e.title,value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:e.fields.map((function(e){return{fieldId:e.field,dataSetId:e.dataSetId}}))};if("globalDateTimeFilter"==e.type)return{type:"dateFilter",value:null,requiresValue:!1,managedByConfiguration:!1,title:e.title,appliesToFields:e.fields.map((function(e){return{fieldId:e.field,dataSetId:e.dataSetId}}))};throw"Unrecognised global filter. "+JSON.stringify(e)}(e):U({},e,{type:fr(e.type)})},ur=function(e,t,n){return t.appliesToFields.flatMap((function(r){var i,o;if(r.dataSetId!=e.id)return[];if(null==t.value)return[];if("string[]"==Mn(e,r.fieldId).dataType)return[{field:r.fieldId,op:"array_contains",value:t.value}];if(("dateFilter"==t.type||"dateAndTimeFilter"==t.type)&&"fixedRange"==(null==(i=t.value)?void 0:i.type))return[{field:r.fieldId,op:">",value:t.value.after},{field:r.fieldId,op:"<",value:t.value.before}];if(("dateFilter"==t.type||"dateAndTimeFilter"==t.type)&&"relative"==(null==(o=t.value)?void 0:o.type)){var a=n[t.value.value].range,l=a.before,s=a.after,u=[];return l&&(u=[].concat(u,[{field:r.fieldId,op:"<",value:l}])),s&&(u=[].concat(u,[{field:r.fieldId,op:">",value:s}])),u}if("singleSelectFilter"==t.type)return[{field:r.fieldId,op:"=",value:t.value}];if("multiSelectFilter"==t.type&&t.value.length>0)return[{field:r.fieldId,op:"is_one_of",value:t.value}];if("dateFilter"==t.type&&!t.value||"dateAndTimeFilter"==t.type&&!t.value||"multiSelectFilter"==t.type&&0===t.value.length)return[];throw"Cannot convert filter type "+t.type+" to query attributes filter. "+JSON.stringify(t)}))},dr=function(e,t,n){var r=[];return(e.globalFilters||[]).forEach((function(e){r=[].concat(r,ur(t,e,n))})),Object.values(e.localFilters||{}).flat().forEach((function(e){r=[].concat(r,ur(t,e,n))})),r},cr=function(e,t){if(e.title)return e.title;var n="Untitled";return t.forEach((function(t){try{var r=e.appliesToFields[0],i=Mn(t,r.fieldId);t.id==r.dataSetId&&r.fieldId==i.id&&(n=i.publicName)}catch(e){}})),n},pr=function(e,t){return[].concat(e).find((function(e){var n,r,o=e.type==t.type,a=(null==(n=e.appliesToFields)?void 0:n.length)==(null==(r=t.appliesToFields)?void 0:r.length),l=i.every(t.appliesToFields,(function(t){return i.some(e.appliesToFields,(function(e){return e.fieldId==t.fieldId&&e.dataSetId==t.dataSetId}))}));return o&&a&&l}))},fr=function(e){return"dateTimeFilter"===e?"dateFilter":e};function mr(e,t,n,r){if(r){var i=e.reduce((function(e,r){if(null!==r.value){if(Array.isArray(r.value)&&0===r.value.length)return e;r.appliesToFields.forEach((function(i){var o=i.dataSetId,a=Rn(t,o);e[o]||(e[o]=[]),null!==a&&(e[o]=[].concat(e[o],ur(a,r,n)))}))}return e}),{});return 0===Object.keys(i).length?void 0:i}}var hr=function(e){return"optionsPulledFrom"in e&&e.optionsPulledFrom&&0!==e.optionsPulledFrom.length?U({},e,{appliesToFields:[].concat(e.optionsPulledFrom)}):e},vr=function(e){if("isEmpty"in e||kr(e))return e;var t=(0,On(e.attributes.type).load)(e.attributes),n=[];return i.isArray(e.localFilters)&&(n=[].concat(e.localFilters?e.localFilters:[]).map((function(e){return sr(e)}))),"addOns"in e.attributes&&i.isEmpty(n)&&e.attributes.addOns.forEach((function(e){n=[].concat(n,[{type:"dateFilter"==e.type?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:e.field,dataSetId:t.dataSetId}]}])})),delete e.addOns,delete t.addOns,U({},e,{localFilters:n,attributes:t,results:[]})},gr=function(e){if(Fr(e)||kr(e))return e;var t=[].concat(e.localFilters&&i.isArray(e.localFilters)?e.localFilters:[]).map(lr);return U({},e,{results:void 0,queries:void 0,attributes:U({},e.attributes,{offset:void 0}),localFilters:t})},br=function(e,t,n,r){var i=function(e,t,n,r){var i=e[t];return"left"==r?[].concat(i.components).slice(0,n).reverse():[].concat(i.components).slice(n+1,i.components.length)}(e,t,n,r),o=i.length-1,a=i.findIndex((function(e){return e.colSpan>2}));return-1==a?-1:"left"==r?o-a:a+1+n},xr=function(e,t,n){void 0===n&&(n=350);var r=[].concat(e);return r.splice(t,0,{components:[{isEmpty:!0,colSpan:12}],height:n}),r},yr=function(e){return{colSpan:e,isEmpty:!0}};function wr(e){return 1===e?12:e<5?12/e:2}var Cr=function(e,t){for(var n,r=i.cloneDeep(e),o=[].concat(r[t].components),a=yr(wr(o.length+1)),l=(o=[].concat(o,[a])).length-1,s=0;s<((n=o.length)>2&&n<5?3:2);s++){var u=br(r,t,l,"left");o.length<5?o[s].colSpan=wr(o.length):o[u].colSpan=o[u].colSpan-1,r[t]={components:[].concat(o),height:r[t].height}}return r},jr=function(e,t,n,r){var i=[].concat(e),o=[].concat(i[n].components);return o[r]=U({},t,{colSpan:o[r].colSpan}),i[n]={components:o,height:i[n].height},i},Sr=function(e,t){return{components:e,height:null!=t?t:350}},Fr=function(e){return"isEmpty"in e},kr=function(e){return"displayTitle"in e};function Tr(e){for(var t,n=te(e);!(t=n()).done;)for(var r,i=te(t.value.components);!(r=i()).done;){var o=r.value;if(!("isEmpty"in o)||!0!==o.isEmpty)return!1}return!0}var Ar=function(e){var t=[].concat(e),n=i.sumBy(t,(function(e){return e.colSpan}));return 12==n||(t[t.length-1].colSpan=t[t.length-1].colSpan+12-n),t},Dr=function(e){return{display:e.display,componentLibrary:e.componentLibrary,isPlayground:!1,globalFilters:[],customFields:{}}},Ir={FIRST_ROW:0,SECOND_ROW:1,THIRD_ROW:2,FOURTH_ROW:3,FIFTH_ROW:4,FIRST_CELL:0,SECOND_CELL:1,THIRD_CELL:2,FOURTH_CELL:3,FIFTH_CELL:4},Pr={emptyDashboard:function(){var e=new Date;return{id:void 0,parentDashboardId:void 0,createdAt:e,updatedAt:e,metadata:{},display:[],componentLibrary:[]}},insertRow:function(e,t,n){return U({},e,{display:xr(e.display,t,null==n?void 0:n.height)})},setComponentOnDisplay:function(e,t,n,r){return U({},e,{display:jr(e.display,or(t),n,r)})},listComponentTypesUsed:function(e){return t=[],e.display.forEach((function(e){e.components.forEach((function(e){Fr(e)||kr(e)||(t=[].concat(t,[e.attributes.type]))}))})),i.uniq(t);var t},appendEmptyCell:function(e,t){return U({},e,{display:Cr(e.display,t)})},listDataSetIdsUsed:function(e){var t=[];return e.componentLibrary.forEach((function(e){t=[].concat(t,[e.attributes.dataSetId])})),e.display.forEach((function(e){e.components.forEach((function(e){Fr(e)||kr(e)||(t=[].concat(t,[e.attributes.dataSetId]))}))})),i.uniq(t)}},_r={setComponent:jr,newEmptyCell:yr,initRow:Sr,init:function(){return[]}},Er=function e(t){return t.startsWith("/")?e(t.slice(1)):t.endsWith("/")?e(t.slice(0,-1)):t},Or=function(e,t){var n=Er(e),r=Er(t),i=function(e){return e.startsWith("https://")||e.startsWith("http://")||e.startsWith(".")}(e)?"":"/";return""==n&&""==r?"/":""==r?""+i+n:""!=n&&""!=r?""+i+n+"/"+r:""+i+r},Lr=function(e){return function(){var t=Y(W().mark((function t(n,r,i,o){var a,l,s,u;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a={},r&&(a.auth="Api-Key "+r),i&&(a.auth="Bearer "+i),l="",o&&(l="filter="+o.join(",")),t.next=7,e({path:"/api/v2/auth/project/"+n+"/access_token?"+l,method:"get",headers:a});case 7:if(u=(s=t.sent).body,200!=s.status){t.next=12;break}return t.abrupt("return",u.token.token);case 12:return t.abrupt("return",void 0);case 13:case"end":return t.stop()}}),t)})));return function(e,n,r,i){return t.apply(this,arguments)}}()},Rr=["debug","info","warning","error"],Mr="error",Nr=function(e,t){return Mr=e,t&&t(Mr),{logDebug:qr,logError:Hr,logInfo:Vr,logWarning:Wr}},zr=function(e){return Rr.findIndex((function(e){return Mr==e}))<=Rr.findIndex((function(t){return e==t}))},Br=function(e){return e instanceof Error?e:i.isObject(e)||i.isArray(e)?JSON.stringify(e):e},qr=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];zr("debug")&&(e=console).info.apply(e,["[VIZZLY DEBUG]"].concat(n.map(Br)))},Vr=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];zr("info")&&(e=console).info.apply(e,["[VIZZLY INFO]"].concat(n.map(Br)))},Wr=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];zr("warning")&&(e=console).warn.apply(e,["[VIZZLY WARNING]"].concat(n.map(Br)))},Hr=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];zr("error")&&(e=console).error.apply(e,["[VIZZLY ERROR]"].concat(n.map(Br)))},Yr=function(){var e=Y(W().mark((function e(t,n){var r;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.dashboardAccessToken){e.next=3;break}return qr("Using dashboard access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.dashboardAccessToken});case 3:if(!t.projectAccessToken){e.next=6;break}return qr("Using project access token for auth header"),e.abrupt("return",{auth:"Bearer "+t.projectAccessToken});case 6:if(!n.preFetchProjectAccessTokens){e.next=19;break}return qr("Fetching project access token from the Vizzly API",n.preFetchProjectAccessTokens.projectId,"Filtering by",n.preFetchProjectAccessTokens.resourceFilters),e.next=10,Lr(Ur(t))(n.preFetchProjectAccessTokens.projectId,t.apiKey,t.appSessionAuthToken,n.preFetchProjectAccessTokens.resourceFilters);case 10:if(!(r=e.sent)){e.next=16;break}return qr("Project access token received."),e.abrupt("return",{auth:"Bearer "+r});case 16:qr("Failed to receive project access token.");case 17:e.next=20;break;case 19:qr("Not pre-fetching project access token.");case 20:return e.abrupt("return",{});case 21:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Ur=function(e){return function(){var t=Y(W().mark((function t(n){var r,i,o,a,l,s;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Yr(e,n);case 3:return r=t.sent,i=n.headers||{},o=Or(e.host,n.path),t.next=8,u(o,{method:n.method,headers:U({"Content-Type":"application/json",Accept:"application/json"},r,i),redirect:"follow",referrerPolicy:"no-referrer",body:n.body?JSON.stringify(n.body):null,signal:n.abortSignal,mode:n.mode||void 0});case 8:return a=t.sent,t.next=11,a.json();case 11:return l=t.sent,qr("HTTP Client Response",{host:e.host,status:a.status,responseId:a.headers.get("X-Request-Id")}),t.abrupt("return",{body:l,status:a.status});case 16:if(t.prev=16,t.t0=t.catch(0),null==(s=n.abortSignal)||!s.aborted){t.next=21;break}return console.log("Aborted a request."),t.abrupt("return",{status:500,body:{reason:"Aborted"}});case 21:throw t.t0;case 22:case"end":return t.stop()}}),t,null,[[0,16]])})));return function(e){return t.apply(this,arguments)}}()},Gr=function(e){return{id:e.id,parentDashboardId:e.parent_dashboard_id,isPlayground:void 0===e.definition.isPlayground||e.definition.isPlayground,globalFilters:[].concat(e.definition.globalFilters||[]).map(sr),componentLibrary:[].concat(e.definition.componentLibrary).map((function(e){return vr(U({},e,{colSpan:e.colSpan||1}))})),theme:U({},tr,e.theme),display:(t=e.definition.display,t.map((function(e){return r=i.sumBy((n="components"in(t=e)?t:{components:t,height:350}).components,(function(e){return null==e?1:0})),o=i.sumBy(n.components,(function(e){return null==e?0:e.colSpan})),a=Math.floor((12-o)/r),l=[].concat(n.components).map((function(e){return null===e?{isEmpty:!0,colSpan:a}:Fr(e)||kr(e)?e:vr(U({},e,{colSpan:e.colSpan}))})),{components:Ar(l),height:n.height||350};var t,n,r,o,a,l}))),webhookId:e.webhook_id||null,createdAt:new Date(e.created_at),updatedAt:new Date(e.updated_at),metadata:e.metadata||{}};var t},Kr=function(e,t){return e.dataSets.findIndex((function(e){return e.id==t}))},Xr=function(e,t){return Rn(e.dataSets,t)},Qr=function(e){var t=U({},e),n={};e.dataSets.forEach((function(e){n[e.id]=Bn(e)}));var r,i=null===t.parentDashboardId?t.componentLibrary:ti(t),o=[].concat(e.globalFilters).filter((function(e){return!e.managedByConfiguration})).map(lr);return{isPlayground:e.isPlayground,globalFilters:o,componentLibrary:[].concat(i).map(gr),display:(r=e.display,r.map((function(e){return{components:[].concat(e.components).map(gr),height:e.height}}))),customFields:n}},Jr=function(e,t,n){return U({},e,{dataSets:Un(t,n)})},Zr=function(e,t){return[].concat(t).filter((function(t){return t.parentDashboardId==e}))},$r=function(e,t){return e.find((function(e){return e.id==t}))||null},ei=function(e){var t=new Map(e.map((function(e){return[e.id,e]})));return e.map((function(e){var n;if(null===e.parentDashboardId)return e;var r=null==(n=t.get(e.parentDashboardId))?void 0:n.componentLibrary,i=null==r?void 0:r.filter((function(e){return e.attributes.protectedByOrganisation}));return i?U({},e,{componentLibrary:[].concat(ti(e),i)}):e}))},ti=function(e){return e.componentLibrary.filter((function(e){return!e.attributes.protectedByOrganisation}))};function ni(e,t,n){var r=t.find((function(e){return e.id===n}));return void 0===r?e:U({},r,{id:e.id,createdAt:e.createdAt,updatedAt:new Date})}var ri,ii=function(e){return Y(W().mark((function t(){var n,r;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/parent-dashboards",method:"get"});case 2:if(r=(n=t.sent).body,200!=n.status){t.next=7;break}return t.abrupt("return",r.dashboards.map((function(e){return U({},Gr(e),{dataSets:[]})})));case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})))},oi=function(e){return function(){var t=Y(W().mark((function t(n){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/scheduled-report",method:"post",body:{cronSchedule:n.cronSchedule,dashboardAccessToken:n.dashboardAccessToken,scheduledReportId:n.scheduledReportId}});case 2:return t.abrupt("return",200==t.sent.status);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ai=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToCreateDashboardAccess",n}return G(t,e),t}(Z(Error)),li=function(e){return function(){var t=Y(W().mark((function t(n,r,i){var o,a;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/auth/dashboards/access",method:"post",body:{dashboardAccessToken:n,dashboardAdminOverrideToken:r},abortSignal:i});case 2:if(a=(o=t.sent).body,200!=o.status){t.next=7;break}return t.abrupt("return",{permissions:a.permissions.map((function(e){return{dashboardId:e.dashboard_id,scope:e.scope,token:e.token,userReference:e.user_reference}}))});case 7:throw new ai("Failed to fetch dashboard access");case 8:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},si=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToGetDashboard",n}return G(t,e),t}(Z(Error)),ui=function(e){return function(){var t=Y(W().mark((function t(n,r,i){var o,a;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/multi-get-dashboard",method:"post",body:{dashboardAccessTokens:n},abortSignal:i});case 2:if(a=(o=t.sent).body,200!=o.status){t.next=8;break}return a.not_found.length>0&&console.warn("[Vizzly] Failed to retrieve dashboards",a.not_found),t.abrupt("return",a.found.map((function(e){var t=Gr(e);return Jr(t,r,e.definition.customFields||{})})));case 8:throw new si("Failed to get dashboard from POST /api/v2/multi-get-dashboard.");case 9:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},di=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToCreateDashboard",n}return G(t,e),t}(Z(Error)),ci=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="DashboardQuotaReached",n}return G(t,e),t}(Z(Error)),pi=function(e){return function(){var t=Y(W().mark((function t(n,r){var i,o,a,l,s,u;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/dashboard",method:"post",body:{dashboardAccessToken:n.dashboardAccessToken,definition:n.definition,meta:n.meta||{},parentDashboardId:n.parentDashboardId,permissions:n.permissions}});case 2:if(o=(i=t.sent).body,200!=(a=i.status)){t.next=10;break}return l=Gr(o.dashboard),s=Jr(l,r,o.dashboard.definition.customFields||{}),u=o.permissions.map((function(e){return{dashboardId:e.dashboard_id,scope:e.scope,token:e.token,userReference:e.user_reference}})),t.abrupt("return",{dashboard:s,permissions:u});case 10:if(422!=a){t.next=12;break}throw new ci("Dashboard quota reached; "+JSON.stringify(o));case 12:throw new di("Failed to update the dashboard from POST /api/v2/dashboard");case 13:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},fi=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToUpdateDashboard",n}return G(t,e),t}(Z(Error)),mi=function(e){return function(){var t=Y(W().mark((function t(n,r){var i,o,a,l;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/dashboard",method:"put",body:U({},n)});case 2:if(o=(i=t.sent).body,200!=i.status){t.next=9;break}return a=Gr(o.dashboard),l=Jr(a,r,o.dashboard.definition.customFields||{}),t.abrupt("return",l);case 9:throw new fi("Failed to update dashboard from PUT /api/v2/dashboard.");case 10:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},hi=function(e){function t(){return e.call(this,"AI usage limit has been reached.")||this}return G(t,e),t}(Z(Error)),vi=function(e,t,n){var r,o,a={},l=(null==(r=e.measure)?void 0:r.filter((function(e){try{return Mn(t,e.field).canBeMeasure}catch(e){return!1}})))||[];l=l.map((function(e){var r=Mn(t,e.field),i=$e(r,n.supportedAggregates);return et(r,n.supportedAggregates).includes(e.function)?e:{field:e.field,function:i}}));var s=(null==(o=e.dimension)?void 0:o.filter((function(e){try{return Mn(t,e).canBeDimension}catch(e){return!1}})).map((function(e){return{field:e,function:"none"}})))||[];return i.isEmpty(l)||(a.measure=l),i.isEmpty(s)||(a.dimension=s),a},gi=function(e){return function(){var t=Y(W().mark((function t(n,r,i,o){var a,l,s;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/ai",method:"post",body:{question:n,supported_aggregates:Object.keys(o.supportedAggregates),data_set_fields:[].concat(i.fields).map((function(e){return{id:e.id,name:e.publicName}})),dashboard_access_token:r}});case 2:if(l=(a=t.sent).body,200!=(s=a.status)){t.next=7;break}return t.abrupt("return",vi(l,i,o));case 7:if(422!=s&&429!=s){t.next=9;break}throw new hi;case 9:throw"Failed to fetch query attributes from AI.";case 10:case"end":return t.stop()}}),t)})));return function(e,n,r,i){return t.apply(this,arguments)}}()},bi=function(e){function t(t){var n;return(n=e.call(this,"Failed to save Vizzly config. Received status code "+t+".")||this).name="FailedToSaveVizzlyConfigVersion",n}return G(t,e),t}(Z(Error));!function(e){e.ConfigStore="cnf_",e.Project="prj_",e.KeyPair="kyp_",e.Dashboard="dsh_",e.ProjectApiKey="vizzly_project_api_key_"}(ri||(ri={}));var xi=function(e){return function(){var t=Y(W().mark((function t(n,r){var i;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/config",method:"post",body:{projectId:n,encryptedConfig:r},preFetchProjectAccessTokens:n?{projectId:n,resourceFilters:[ri.Project,ri.ConfigStore]}:void 0});case 2:if(200==(i=t.sent.status)){t.next=6;break}throw new bi(i);case 6:return t.abrupt("return",200==i);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},yi=function(e){function t(t){var n;return(n=e.call(this,"Failed to setup project by saving an encrypted connection and config on the Vizzly API. Received status code "+t+".")||this).statusCode=void 0,n.name="VizzlyApiCallErrorFailedToSetupProject",n.statusCode=t,n}return G(t,e),t}(Z(Error)),wi=function(e){return function(){var t=Y(W().mark((function t(n,r,i){var o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/connection",method:"post",body:{projectId:n,encryptedConfig:i,encryptedConnection:r},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ri.Project]}});case 2:if(200==(o=t.sent.status)){t.next=7;break}throw new yi(o);case 7:return t.abrupt("return",200==o);case 8:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Ci=function(e){return function(){var t=Y(W().mark((function t(n){var r,i,o,a;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="/api/v3/project/"+n+"/config",t.next=3,e({path:r,method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ri.ConfigStore]}});case 3:if(a=(i=t.sent).body,200!=(o=i.status)){t.next=8;break}return t.abrupt("return",{encryptedConfig:a.encrypted_config});case 8:return qr("HTTP request to fetch Config returned non-200.",r,o,a),t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ji=function(e){return function(){var t=Y(W().mark((function t(n){var r,i,o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v2/project/"+n+"/connection",method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ri.Project]}});case 2:if(o=(r=t.sent).body,200!=(i=r.status)){t.next=7;break}return t.abrupt("return",{status:i,encryptedCredentials:o.encrypted_credentials});case 7:return t.abrupt("return",{status:i});case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Si=function(e){return function(){var t=Y(W().mark((function t(n){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/api-key",method:"post",body:{},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ri.Project]}});case 2:return t.abrupt("return",t.sent.body.api_key);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Fi=function(e){return function(){var t=Y(W().mark((function t(n,r,i){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/api-key/"+r,method:"put",body:U({},i),preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ri.Project,ri.ProjectApiKey]}});case 2:return t.abrupt("return",t.sent.body.api_key);case 5:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},ki=function(e){return function(){var t=Y(W().mark((function t(n){var r,i;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n,method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ri.Project]}});case 2:if(i=(r=t.sent).body,200!=r.status){t.next=7;break}return t.abrupt("return",i.project);case 7:return t.abrupt("return",null);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Ti=function(e){return function(){var t=Y(W().mark((function t(n,r,i){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/query-engine-user",method:"post",body:{email:r,password:i},preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ri.Project]}});case 2:return t.abrupt("return",200==t.sent.status);case 6:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Ai=function(e){return function(){var t=Y(W().mark((function t(n,r){var i,o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/query-engine-user?email="+encodeURIComponent(r),method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:[ri.Project]}});case 2:if(o=(i=t.sent).body,200!=i.status){t.next=7;break}return t.abrupt("return",o.query_engine_user);case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},Di=function(e){return function(){var t=Y(W().mark((function t(n){var r,i;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e({path:"/api/v3/project/"+n+"/organisation-team-members",method:"get",preFetchProjectAccessTokens:{projectId:n,resourceFilters:["prj_"]}});case 2:if(i=(r=t.sent).body,200!=r.status){t.next=7;break}return t.abrupt("return",i.team_members);case 7:return t.abrupt("return",void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Ii=function(e){return function(){var t=Y(W().mark((function t(n){var r,i,o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={},n&&(r={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-query-engine",method:"post",body:{},headers:r});case 4:return o=(i=t.sent).body,t.abrupt("return",200==i.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Pi=function(e){return function(){var t=Y(W().mark((function t(n){var r,i,o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={},n&&(r={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-dynamic-query-engine",method:"post",body:{},headers:r});case 4:return o=(i=t.sent).body,t.abrupt("return",200==i.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},_i=function(e){return function(){var t=Y(W().mark((function t(n){var r,i,o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={},n&&(r={auth:"Bearer "+n}),t.next=4,e({path:"/api/v2/project/self-hosted-in-browser",method:"post",body:{},headers:r});case 4:return o=(i=t.sent).body,t.abrupt("return",200==i.status?o.project:void 0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Ei=function(e){return function(){var t=Y(W().mark((function t(n,r,i){var o,a,l;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o={},i&&(o={auth:"Bearer "+i}),t.next=4,e({path:"/api/v2/project/managed-query-engine/"+n+"/key-pairs/"+r,method:"get",headers:o});case 4:if(l=(a=t.sent).body,200!=a.status){t.next=9;break}return t.abrupt("return",{privateKey:l.keys.private_key,publicKey:l.keys.public_key});case 9:return t.abrupt("return",void 0);case 10:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}()},Oi=function(e){var t=Ur(e);return{config:e,getParentDashboards:ii(t),saveScheduledReport:oi(t),createDashboardAccess:li(t),multiGetDashboards:ui(t),createDashboard:pi(t),updateDashboard:mi(t),askAi:gi(t),createVizzlyConfigVersion:xi(t),getVizzlyConfig:Ci(t),saveConnection:wi(t),getConnection:ji(t),createProjectApiKey:Si(t),updateProjectApiKey:Fi(t),getProjectAccessToken:Lr(t),getProject:ki(t),createQueryEngineUser:Ti(t),getQueryEngineUser:Ai(t),getProjectTeamMembers:Di(t),createSelfHostedQueryEngineProject:Ii(t),createSelfHostedDynamicQueryEngineProject:Pi(t),createSelfHostedInBrowserQueryEngineProject:_i(t),getManagedQueryEngineKeyPair:Ei(t)}},Li=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadIdentity",n}return G(t,e),t}(Z(Error)),Ri=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="InvalidIdentityReturn",n}return G(t,e),t}(Z(Error)),Mi=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToLoadQueryEngineConfig",n}return G(t,e),t}(Z(Error)),Ni=function(e){return U({},(r=null==(t=e.split("."))?void 0:t[1],JSON.parse((n=r,"object"==typeof window&&window&&window.atob?window.atob(n):Buffer.from(n,"base64").toString()).toString())),{signature:e});var t,n,r},zi=function(e,t,n,r){var i=Ni(e);"scope"in i||(i.scope="read_write");var o={dashboardAccess:i,dataAccess:t?Ni(t):void 0,queryEngineAccessConfig:n?Ni(n):void 0,dashboardAdminOverride:r?Ni(r):void 0};return Bi(o),o},Bi=function(e){var t=new Date,n=new Date(e.dashboardAccess.expires),r=!!e.dataAccess&&new Date(e.dataAccess.expires);!1!==r&&r<t&&console.warn("Vizzly data access token expired at;",r),n<t&&console.warn("Vizzly dashboard access token expired at;",n)},qi=function(e){function t(){return e.apply(this,arguments)||this}return G(t,e),t}(Z(Error)),Vi=function(e,t){return[].concat(e.supportedFeatures).includes(t)},Wi=function(e){function t(t){var n;return(n=e.call(this,"The queryEngineEndpoint value '"+t+"' is not valid.")||this).invalidEndpoint=void 0,n.name="InvalidQueryEngineEndpoint",n.invalidEndpoint=t,n}return G(t,e),t}(Z(Error)),Hi=function(e){function t(){var t;return(t=e.call(this,"The queryEngineEndpoint value is not of the correct type. It must be a string or a function.")||this).name="InvalidQueryEngineEndpointType",t}return G(t,e),t}(Z(Error)),Yi=function(e){return"string"==typeof e?{}:e.customHeaders?e.customHeaders():{}},Ui=function(e){return function(){var t=Y(W().mark((function t(n){var r,i;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={host:Xi(e)},i=U({},n,{headers:U({},n.headers,Yi(e))}),t.abrupt("return",Ur(r)(i));case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},Gi=function(){var e=Y(W().mark((function e(t){var n,r;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Ui(t),e.next=3,n({method:"post",mode:"cors",path:"/api/v1/support",body:{}});case 3:if(200!=(r=e.sent).status){e.next=6;break}return e.abrupt("return","supportedFeatures"in(i=r.body)?i:U({},i,{supportedFeatures:["subquery"]}));case 6:return e.abrupt("return",null);case 7:case"end":return e.stop()}var i}),e)})));return function(t){return e.apply(this,arguments)}}(),Ki=function(){var e=Y(W().mark((function e(t){var n,r;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!("string"==typeof t||"object"==typeof t&&"endpoint"in t)){e.next=12;break}if(o=void 0,(o="string"==typeof(i=t)?i:i.endpoint).startsWith("http://")||o.startsWith("https://")||o.startsWith("/")){e.next=4;break}throw new Wi(t);case 4:return e.next=6,Gi(t);case 6:if(n=e.sent){e.next=9;break}throw new Mi("Failed to load query engine config.");case 9:return e.abrupt("return",n);case 12:if("function"!=typeof t){e.next=21;break}return e.next=15,t();case 15:if(r=e.sent){e.next=18;break}throw new Mi("Failed to load query engine config.");case 18:return e.abrupt("return",U({},r));case 21:throw new Hi;case 22:e.next=31;break;case 24:if(e.prev=24,e.t0=e.catch(0),!(e.t0 instanceof Wi)){e.next=28;break}throw e.t0;case 28:if(!(e.t0 instanceof Hi)){e.next=30;break}throw e.t0;case 30:throw new Mi("Failed to load query engine config.");case 31:case"end":return e.stop()}var i,o}),e,null,[[0,24]])})));return function(t){return e.apply(this,arguments)}}(),Xi=function(e){return"string"==typeof e?e:e.endpoint},Qi=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="FailedToResolveDataSets",n}return G(t,e),t}(Z(Error)),Ji=function(e){function t(){var t;return(t=e.call(this,"Identity prop type is invalid.")||this).name="InvalidIdentityPropType",t}return G(t,e),t}(Z(Error)),Zi=function(e){function t(){var t;return(t=e.call(this,"dataSets property is not valid")||this).name="InvalidDataSetsPropType",t}return G(t,e),t}(Z(Error)),$i=function(e,n,r){var i,o,a=t.useState(),l=a[0],s=a[1],u=t.useState({dataSets:void 0,queryEngineConfig:void 0,identityConfig:void 0}),d=u[0],c=u[1],p=function(){var t=Y(W().mark((function t(){var n,r,i;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e();case 2:if(n=eo(n=t.sent)){t.next=6;break}throw new Li("Failed to fetch identity config.");case 6:return a=(o=window.location.href).split("#vizzly_")[1]||null,r=a||new URLSearchParams(new URL(o).search).get("_vizzlyDashboardAdmin")||null,i=zi(n.dashboardAccessToken,n.dataAccessToken,n.queryEngineAccessToken,r),t.abrupt("return",i);case 9:case"end":return t.stop()}var o,a}),t)})));return function(){return t.apply(this,arguments)}}();return i=Y(W().mark((function e(){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,qr("Fetching identity config."),e.next=4,p();case 4:c(U({},d,{identityConfig:e.sent})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),Wr("Failed to refresh identity tokens.");case 11:case"end":return e.stop()}}),e,null,[[0,8]])}))),o=t.useRef(),t.useEffect((function(){o.current=i})),t.useEffect((function(){var e=setInterval((function(){o.current&&o.current()}),12e5);return function(){return clearInterval(e)}}),[12e5]),t.useEffect((function(){!function(){var t=Y(W().mark((function t(){var i,o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"function"==typeof e){t.next=3;break}throw new Ji;case 3:return t.next=5,p();case 5:return i=t.sent,t.next=8,Ki(r);case 8:return o=t.sent,t.next=11,n(i,o);case 11:c({dataSets:t.sent,queryEngineConfig:o,identityConfig:i}),t.next=18;break;case 15:t.prev=15,t.t0=t.catch(0),t.t0 instanceof Li||t.t0 instanceof Mi||t.t0 instanceof qi||t.t0 instanceof Ri||t.t0 instanceof Qi||t.t0 instanceof Wi||t.t0 instanceof Hi||t.t0 instanceof Ji||t.t0 instanceof Zi?s(t.t0):(Hr("Unknown error",t.t0),s(new Li("Failed to load identity")));case 18:case"end":return t.stop()}}),t,null,[[0,15]])})));return function(){return t.apply(this,arguments)}}()()}),[]),U({},d,{error:l})},eo=function(e){if(!e)throw new Ri("Failed to load identity.");var t=r.object({dashboardAccessToken:r.string().required(),dataAccessToken:r.string(),queryEngineAccessToken:r.string(),projectAccessToken:r.string().optional()}).validate(e).error;if(t)throw new Ri(t.message);return e},to=function(e){return function(){var t=Y(W().mark((function t(n){var r,i,o,a;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=$r(e.dashboards,n.parentDashboardId||e.defaultParentDashboardId)){t.next=3;break}throw"Cannot create a child dashboard from a parent dashboard which does not exist.";case 3:return i=Dr(r),o=n.dashboard?Dr(n.dashboard):i,t.next=7,e.createDashboard({definition:o,meta:n.metadata,parentDashboardId:r.id,permissions:[{scope:"read_write"}]});case 7:if(!(a=t.sent)){t.next=10;break}return t.abrupt("return",a.id);case 10:return t.abrupt("return",null);case 11:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},no=function(e){return function(){var t=Y(W().mark((function t(n){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.updateDashboard(n,{deleted:!0});case 2:return t.abrupt("return",!!t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},ro=function(e){return function(){var t=Y(W().mark((function t(n,r){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.updateDashboard(n,{meta:r});case 2:return t.abrupt("return",!!t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()},io={supportedFeatures:["simpleMaths","aggregateMaths","subquery"],supportedTimeTruncFunctions:Le(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:Ke(["mean","sum","min","max","count","countDistinct"]),supportedOperators:Be([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:{}},oo=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ReadOnlyPermissionNotFound",n}return G(t,e),t}(Z(Error)),ao=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="ReadPermissionNotFound",n}return G(t,e),t}(Z(Error)),lo=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="WritePermissionNotFound",n}return G(t,e),t}(Z(Error)),so=function(e){var t=[].concat(e).map((function(e){return e.dashboardId}));return i.uniq(t)},uo=function(e,t){var n=t.find((function(t){return t.dashboardId==e}));if(!n)throw new ao("Cannot find read permission for dashboard "+e);return n},co=function(e,t){var n=t.find((function(t){return t.dashboardId==e&&"read_write"==t.scope}));if(!n)throw new lo("Cannot find write permission for dashboard "+e);return n},po=function(e,t){try{return!!co(e,t)}catch(e){if(e instanceof lo)return!1;throw e}},fo=function(e,n,r,i){var o=t.useState(),a=o[0],l=o[1],s=t.useState(),u=s[0],d=s[1],c=function(){var t=Y(W().mark((function t(i){var o,a,s,u,c,p;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e||!n){t.next=29;break}return t.prev=1,t.next=4,r.createDashboardAccess(e.dashboardAccess.signature,null==(o=e.dashboardAdminOverride)?void 0:o.signature,i.signal);case 4:return s=so(a=t.sent.permissions),u=[].concat(s).map((function(e){return uo(e,a).token})),t.next=10,r.multiGetDashboards(u,n,i.signal);case 10:c=t.sent,i.signal.aborted||(p=ei(c),d({dashboards:p,permissions:a})),t.next=29;break;case 14:if(t.prev=14,t.t0=t.catch(1),!(t.t0 instanceof si)){t.next=20;break}l(t.t0),t.next=29;break;case 20:if(!(t.t0 instanceof ai)){t.next=24;break}l(t.t0),t.next=29;break;case 24:if(!(t.t0 instanceof qi)){t.next=28;break}l(t.t0),t.next=29;break;case 28:throw t.t0;case 29:case"end":return t.stop()}}),t,null,[[1,14]])})));return function(e){return t.apply(this,arguments)}}();if(t.useEffect((function(){var e=new AbortController;return void 0===u&&c(e),function(){return e.abort()}}),[e,i]),!u||!e)return{isLoading:!0,error:a};var p=function(){var e=Y(W().mark((function e(t){var n;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=co(t.dashboardId,u.permissions),e.next=3,r.saveScheduledReport(U({},t,{dashboardAccessToken:n.token}));case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),f=function(){var t=Y(W().mark((function t(i){var o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!n){t.next=6;break}return t.next=3,r.createDashboard(U({},i,{dashboardAccessToken:e.dashboardAccess.signature}),n);case 3:return d({dashboards:[].concat(u.dashboards,[(o=t.sent).dashboard]),permissions:[].concat(u.permissions,o.permissions)}),t.abrupt("return",o.dashboard);case 6:throw"Unable to create a dashboard when the data sets have not been loaded.";case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),m=function(){var e=Y(W().mark((function e(t,i){var o,a,l;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=8;break}return o=co(t,u.permissions),e.next=4,r.updateDashboard(U({},i,{dashboardSessionToken:o.token}),n);case 4:return a=e.sent,l=[].concat(u.dashboards).flatMap((function(e){return e.id==a.id?i.deleted?[]:[a]:[e]})),d({dashboards:l,permissions:[].concat(u.permissions)}),e.abrupt("return",a);case 8:throw"Unable to update a dashboard when the data sets have not been loaded.";case 9:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),h=[].concat(u.dashboards).filter((function(e){return function(e,t){try{return!!function(e,t){var n=t.find((function(t){return t.dashboardId==e&&"read"==t.scope}));if(!n)throw new oo("Cannot find read-only permission for dashboard "+e);return n}(e,t)}catch(e){if(e instanceof oo)return!1;throw e}}(e.id,u.permissions)})),v=[].concat(u.dashboards).filter((function(e){return po(e.id,u.permissions)})),g=function(e,t,n){if(e){var r=$r(n,e);if(null!=r&&r.parentDashboardId)throw"[Vizzly] `parentDashboardId` value must specify an ID for a parent dashboard.";return e}var i=function(e){return[].concat(e).filter((function(e){return null==e.parentDashboardId}))}(n);return t||function(e){if(0==e.length)throw"Cannot get first created dashboard from empty list of dashboards.";return[].concat(e).sort((function(e,t){var n=new Date(e.createdAt),r=new Date(t.createdAt);return n.getTime()-r.getTime()}))[0]}(i).id}(i,e.dashboardAccess.dashboardId,u.dashboards);return{childDashboardCount:[].concat(u.dashboards||[]).filter((function(e){return!!e.parentDashboardId})).length,defaultParentDashboardId:g,createDashboard:f,updateDashboard:m,saveScheduledReport:p,permissions:u.permissions,writeAccessDashboards:v,readOnlyAccessDashboards:h,dashboards:u.dashboards,error:a,accessType:e.dashboardAdminOverride?"admin":e.dashboardAccess.accessType}},mo=function(e,t,n,r){var o=$i(e,Y(W().mark((function e(){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",[]);case 1:case"end":return e.stop()}}),e)}))),t),a=o.identityConfig,l=o.dataSets,s=o.queryEngineConfig,u=Oi(r||{host:"https://api.vizzly.co"}),d=fo(a,l,u,n);if("isLoading"in d||!s)return{VizzlySDK:null,loading:!0,isAdmin:!1,dashboards:[],parentDashboards:[],allChildDashboards:[],defaultParentDashboardId:null,getChildDashboards:function(){throw"Still loading. Please check the `loading` property returned by this hook."},createDashboard:function(){throw"Still loading. Please check the `loading` property returned by this hook."},deleteDashboard:function(){throw"Still loading. Please check the `loading` property returned by this hook."},updateDashboardMeta:function(){throw"Still loading. Please check the `loading` property returned by this hook."}};var c,p=[].concat(d.dashboards).map((function(e){return{id:e.id,parentDashboardId:e.parentDashboardId,display:e.display,componentLibrary:e.componentLibrary,createdAt:e.createdAt,updatedAt:e.updatedAt,metadata:e.metadata}})),f=function(e){var t=i.cloneDeep(p).filter((function(t){return t.parentDashboardId==e}));return i.sortBy(t,(function(e){return e.updatedAt})).reverse()},m=i.cloneDeep(p).filter((function(e){return null==e.parentDashboardId})),h=i.cloneDeep(p).filter((function(e){return null!=e.parentDashboardId}));return{VizzlySDK:(c={queryEngineConfig:s},U({},function(e){return{BasicTable:{init:Zn(e).init,setAttributes:Zn(e).setAttributes,setFields:Zn(e).setFields,validate:Zn(e).validate,setDateTimeFormat:Zn(e).setDateTimeFormat},DataTable:{init:Cn(e).init,setAttributes:Cn(e).setAttributes,validate:Cn(e).validate},HorizontalBarChart:{init:Sn(e).init,setAttributes:Sn(e).setAttributes,validate:Sn(e).validate},BarChart:{init:sn(e).init,setAttributes:sn(e).setAttributes,validate:sn(e).validate},AreaChart:{init:Tn(e).init,setAttributes:Tn(e).setAttributes,validate:Tn(e).validate},SingleStat:{init:Dn(e).init,setAttributes:Dn(e).setAttributes,validate:Dn(e).validate},PieChart:{init:fn(e).init,setAttributes:fn(e).setAttributes,validate:fn(e).validate},LineChart:{init:cn(e).init,setAttributes:cn(e).setAttributes,validate:cn(e).validate},ComboChart:{init:bn(e).init,setAttributes:bn(e).setAttributes,validate:bn(e).validate}}}(c),{displayPositions:Ir,Display:_r,Dashboard:Pr})),loading:!1,getChildDashboards:f,dashboards:f(d.defaultParentDashboardId),allChildDashboards:h,parentDashboards:m,createDashboard:to(d),deleteDashboard:no(d),updateDashboardMeta:ro(d),isAdmin:"admin"==d.accessType,defaultParentDashboardId:d.defaultParentDashboardId}},ho=function(e,t,n){return mo(e,Y(W().mark((function e(){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",io);case 1:case"end":return e.stop()}}),e)}))),t,n)},vo=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={error:void 0,tryCount:0},n}G(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}};var n=t.prototype;return n.componentDidCatch=function(e,t){var n,r;console.log("Attempt "+this.state.tryCount,e,t),(null==(n=this.props)?void 0:n.onError)&&(null==(r=this.props)||r.onError(e,t)),this.setState({error:e,tryCount:this.state.tryCount+1})},n.render=function(){var e=this;return this.state.tryCount>1?this.props.renderOnError((function(){return e.setState({tryCount:0})}),this.state.error):this.props.children},t}(n.Component),go={string:function(e,t,n){return void 0===n&&(n={}),Kn(io,e,t,n)},number:function(e,t,n){return void 0===n&&(n={}),Xn(io,e,t,n)},boolean:function(e,t,n){return void 0===n&&(n={}),Qn(io,e,t,n)},dateTime:function(e,t,n){return void 0===n&&(n={}),Jn(io,e,t,n)}},bo={__proto__:null,number:Xn,string:Kn,boolean:Qn,dateTime:Jn,InBrowser:go},xo=function(){var e={boxSizing:"border-box",borderWidth:"0",borderStyle:"solid",borderColor:"#e5e7eb","--tw-border-spacing-x":"0","--tw-border-spacing-y":"0","--tw-translate-x":"0","--tw-translate-y":"0","--tw-rotate":"0","--tw-skew-x":"0","--tw-skew-y":"0","--tw-scale-x":"1","--tw-scale-y":"1","--tw-pan-x":"var(--tw-empty,/*!*/ /*!*/)","--tw-pan-y":"var(--tw-empty,/*!*/ /*!*/)","--tw-pinch-zoom":"var(--tw-empty,/*!*/ /*!*/)","--tw-scroll-snap-strictness":"proximity","--tw-ordinal":"var(--tw-empty,/*!*/ /*!*/)","--tw-slashed-zero":"var(--tw-empty,/*!*/ /*!*/)","--tw-numeric-figure":"var(--tw-empty,/*!*/ /*!*/)","--tw-numeric-spacing":"var(--tw-empty,/*!*/ /*!*/)","--tw-numeric-fraction":"var(--tw-empty,/*!*/ /*!*/)","--tw-ring-offset-shadow":"0 0 #0000","--tw-ring-shadow":"0 0 #0000","--tw-shadow":"0 0 #0000","--tw-shadow-colored":"0 0 #0000","--tw-ring-inset":"var(--tw-empty,/*!*/ /*!*/)","--tw-ring-offset-width":"0px","--tw-ring-offset-color":"#fff","--tw-ring-color":"rgb(59 130 246 / 0.5)","--tw-blur":"var(--tw-empty,/*!*/ /*!*/)","--tw-brightness":"var(--tw-empty,/*!*/ /*!*/)","--tw-contrast":"var(--tw-empty,/*!*/ /*!*/)","--tw-grayscale":"var(--tw-empty,/*!*/ /*!*/)","--tw-hue-rotate":"var(--tw-empty,/*!*/ /*!*/)","--tw-invert":"var(--tw-empty,/*!*/ /*!*/)","--tw-saturate":"var(--tw-empty,/*!*/ /*!*/)","--tw-sepia":"var(--tw-empty,/*!*/ /*!*/)","--tw-drop-shadow":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-blur":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-brightness":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-contrast":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-grayscale":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-hue-rotate":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-invert":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-opacity":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-saturate":"var(--tw-empty,/*!*/ /*!*/)","--tw-backdrop-sepia":"var(--tw-empty,/*!*/ /*!*/)"};return delete e.borderColor,delete e.borderWidth,delete e.borderStyle,e}(),yo=["vizzly-studio","vizzly-toolbar","vizzly-modals","vizzly-popover"].map((function(e){return"\n ."+e+" hr {"+Co({height:"0",color:"inherit",borderTopWidth:"1px"})+"}\n ."+e+" svg {"+Co({display:"block",verticalAlign:"middle"})+"}\n "})).join(""),wo=function(){return c.jsx(d.Global,{styles:d.css(".v_contentEnter{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-duration:300ms;;}.v_contentEnterFrom{--tw-translate-y:0.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-scale-x:.95;--tw-scale-y:.95;opacity:0;;}.v_contentEnterTo{--tw-translate-y:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-scale-x:1;--tw-scale-y:1;opacity:1;;}.v_contentLeave{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 1, 1);transition-duration:200ms;;}.v_contentLeaveFrom{--tw-translate-y:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-scale-x:1;--tw-scale-y:1;opacity:1;;}.v_contentLeaveTo{--tw-translate-y:0.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-scale-x:.95;--tw-scale-y:.95;opacity:0;;}.v_overlayEnter{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-duration:300ms;;}.v_overlayEnterFrom{opacity:0;;}.v_overlayEnterTo{opacity:1;;}.v_overlayLeave{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 1, 1);transition-duration:300ms;;}.v_overlayLeaveFrom{opacity:1;;}.v_overlayLeaveTo{opacity:0;;}*,::after,::before{",Co(xo),";}",yo,";","")})};function Co(e){for(var t="",n=0,r=Object.entries(e);n<r.length;n++){var i=r[n],o=i[1];t+=i[0].replace(/([A-Z])/g,"-$1").toLowerCase()+": "+o+";\n"}return t}if("undefined"!=typeof window&&"undefined"!=typeof localStorage){var jo=localStorage.getItem("__VIZZLY__LOG_LEVEL_STORED");jo&&Nr(jo),window.VizzlyDev={setLogLevel:function(e){if(Rr.includes(e))return Nr(e,(function(e){localStorage.setItem("__VIZZLY__LOG_LEVEL_STORED",e)})),"Log level set to "+e+".";console.warn("Invalid log level. Please set one of",Rr)}}}var So={year:"numeric",month:"short",day:"numeric"},Fo={year:"numeric",month:"short"},ko={weekday:"long",year:"numeric",month:"long",day:"numeric"},To=function(e,t,n){if(!e)return"";var r=e.toLocaleDateString("en-GB",n);return t&&t!=Intl.DateTimeFormat().resolvedOptions().timeZone?r+" ("+t+")":r},Ao=function(e,t){var n={hour:"2-digit",minute:"2-digit"};return t&&(n.seconds="2-digit"),e.toLocaleTimeString("en-GB",n)},Do=function(e,t){var n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate();return i<10&&(i="0"+i),r<10&&(r="0"+r),"quarter"==t?"Q"+Po(e)+", "+e.getFullYear().toString():"week"==t?"Week "+_o(e)+", "+e.getFullYear().toString():"DD-MM-YYYY"==t?i+"-"+r+"-"+n:"DD/MM/YYYY"==t?i+"/"+r+"/"+n:"MM-DD-YYYY"==t?r+"-"+i+"-"+n:"MM/DD/YYYY"==t?r+"/"+i+"/"+n:"DD MMMM YYYY, hh:mm"==t?function(e){if(!e)return null;var t=U({},So,{hour:"2-digit",minute:"2-digit"});return e.toLocaleTimeString("en-GB",t)}(e):"dddd DD MMMM YYYY, hh:mm"==t?function(e){if(!e)return null;var t=U({},ko,{hour:"2-digit",minute:"2-digit"});return e.toLocaleTimeString("en-GB",t)}(e):"hh:mm"==t?Ao(e):"hh:mm:ss"==t?Ao(e,!0):"DD MMMM YYYY"==t?function(e,t){return To(e,void 0,So)}(e):"MMMM YYYY"==t?To(e,null,Fo):"YYYY-MM-DD[T]HH:mm:ss"==t?e.getFullYear()+"-"+r+"-"+i+"T"+Ao(e):"YYYY"==t?e.getFullYear().toString():null},Io=function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},Po=function(e){return Math.floor((e.getMonth()+3)/3)},_o=function(e){var t=new Date(e),n=new Date(e.getFullYear(),0,1),r=Math.floor((t.getTime()-n.getTime())/864e5);return Math.ceil(r/7)},Eo=function(e,t){return e/t*100},Oo=function(e,t){return(Math.round(100*e)/100).toFixed(t)},Lo=function(e,t){return new Intl.NumberFormat(void 0,{style:"currency",currency:t,currencyDisplay:"symbol"}).format(e)},Ro=function(e){return Array(e).fill(void 0)},Mo=function(e,t,n,r){return JSON.stringify({dimensionKeys:e,dimensionValues:t,fieldId:n,function:r})},No=function(e){if(!e)return!1;try{return zo(e),!0}catch(e){return!1}},zo=function(e){var t=JSON.parse(e);return{dimensionKeys:t.dimensionKeys,dimensionValues:t.dimensionValues,fieldId:t.fieldId,function:t.function}},Bo=function(e){var t=zo(e);return tt({function:t.function,field:t.fieldId})},qo=function(e){return[].concat(e.content).map((function(t){return i.reduce(t,(function(t,n,r){return t[e.fields[r].id]=n,t}),{})}))},Vo=function(e,t,n,r,o){if(void 0===r&&(r=!1),!e)return[];var a=qo(e),l=[].concat(a).map((function(e){var r=[].concat(n.x).map((function(t){return Ze(e[t],o)})),i={},a=[].concat(n.y).map((function(t){return e[t]}));t.forEach((function(t){var r=lt(t),o=Mo(n.y,a,t.field,t.function);i[o]=e[r]}));var l={};return[].concat(n.x).forEach((function(t){l[t]=e[t]})),U({},l,{x:r.join(", ")},i,{xValues:r})})),s=[],u={};l.forEach((function(e){var t=u[e.x];u[e.x]||s.push(e.x),u[e.x]=i.merge({},t,e)}));var d=s.map((function(e){return u[e]}));return r?Xo(d):d},Wo=function(e,t,n){if(!n)return[];var r=qo(n),i={};return r.forEach((function(n){var r=[].concat(e.y).map((function(e){return n[e]}));t.forEach((function(t){var n=Mo(e.y,r,t.field,t.function);i[n]=!0}))})),Object.keys(i)},Ho=function(e,t){return i.findIndex(e.fields,(function(e){return e.id==t}))},Yo=function(e,t){return e.fields[Ho(e,t)]},Uo=function(e){return void 0===e},Go=function(e){return null===e},Ko=function(e){return!!Uo(e)||!!Go(e)||i.isEmpty(e.content)},Xo=function(e){var t=["x","xValues"];return e.map((function(e){var n=U({},e),r=i.sumBy(Object.entries(n),(function(e){var n=e[1];return t.includes(e[0])?0:i.isNumber(n)?n:0}));return n=i.mapValues(n,(function(e,o){return t.includes(o)?e:i.isNumber(e)?Eo(n[o],r):e}))}))},Qo=["contains_substring","does_not_contain_substring","ends_with","starts_with","<","<=",">",">="],Jo=function(e,t){if(null==t&&Qo.includes(e.op))return!1;switch(e.op){case"starts_with":return(""+t).startsWith(e.value);case"ends_with":return(""+t).endsWith(e.value);case"is_one_of":return e.value.includes(t);case"is_not_one_of":return!e.value.includes(t);case"contains_substring":return(""+t).includes(e.value);case"does_not_contain_substring":return!(""+t).includes(e.value);case"<":return t<e.value;case">":return t>e.value;case"=":return t==e.value;case"!=":return t!=e.value;case">=":return t>=e.value;case"<=":return t<=e.value}throw"Unsupported comparison op."},Zo=function(e,t){return Jo(e,t)},$o={_vizzly_compact:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Intl.NumberFormat(void 0,{notation:"compact"}).format(e)},description:"Compact"},_vizzly_to_2_dp:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Oo(e,2)},description:"2 decimal places"},_vizzly_to_gbp:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Lo(e,"GBP")},description:"Currency £"},_vizzly_to_usd:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Lo(e,"USD")},description:"Currency $"},_vizzly_to_eur:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Lo(e,"EUR")},description:"Currency €"},_vizzly_to_percentage:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":(n=(100*e).toFixed(2)).endsWith(".00")?parseInt(n)+"%":n+"%";var n},description:"Percentage"},_vizzly_separated:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":e.toLocaleString()},description:"Separated"},_vizzly_number:{formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":""+e},description:"Number"},_vizzly_hours_and_minutes_from_minutes:{description:"Minutes to hours & minutes",formatter:function(e,t){return void 0===t&&(t="No value"),null==e?t:Number.isNaN(e)?"Formatting error":Math.floor(e/60)+" H : "+Oo(e%60,0)+" M"}}},ea={description:"Default",formatter:$o._vizzly_compact.formatter},ta=function(e,t,n){var r=i.merge({},t,e);return i.merge({},n,r)},na=function(e,t){return JSON.stringify(e)==JSON.stringify(t)},ra=function(e,t,n){var r=zo(n);return[].concat(t).flatMap((function(t){var n=e.some((function(e){return e.field===t.field}))&&("string"==typeof t.value||"boolean"==typeof t.value||"number"==typeof t.value);return n||lt({field:r.fieldId,function:r.function})==t.field?[{rule:t,isRuleOnDimension:n}]:[]}))},ia=function(e,t,n,r,i){return ra(e,t,n).map((function(e){var t=rt(e.rule.field,{supportedAggregates:r,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),n=t.function,o=Mn(i,t.fieldId);return{isRuleOnDimension:e.isRuleOnDimension,color:e.rule.ruleValue,explanation:"When "+o.publicName+" "+(n&&"none"!=n?"("+n+")":"")+" "+e.rule.operator+" "+e.rule.value,value:e.rule.value,operator:e.rule.operator,conditionIsMet:function(t){return Zo({value:e.rule.value,op:e.rule.operator},da(o,t))}}}))},oa=function(e,t,n,r,o){if(n){var a=ra(e,t,r),l=zo(r),s=a.find((function(e){var t=e.rule,a=e.isRuleOnDimension,s=a?Mn(o,t.field):void 0,u=a?[].concat(l.dimensionValues,null!=n[t.field]?[n[t.field]]:[]):[n[r]];return i.some(u,(function(e){return null==e?null:Zo({op:t.operator,value:t.value},s?da(s,e):e)}))}));return null==s?void 0:s.rule}},aa=function(e,t,n){return function(r){if(e){var i=n.dateTimeFormatOptions[t[e.truncate].dateFormat].formatter(new Date(r));return""+(n.prefix||"")+i+(n.postfix||"")}return r=ua(r,n.numberFormatOptions,n.format),""+(n.prefix||"")+r+(n.postfix||"")}},la=function(e){return function(t){var n,r;return"number"==typeof t?(t=ua(t,U({},null==e?void 0:e.numberFormatOptions,((r={}).default=ea,r)),null!=(n=null==e?void 0:e.format)?n:"default"),""+((null==e?void 0:e.prefix)||"")+t+((null==e?void 0:e.postfix)||"")):""+((null==e?void 0:e.prefix)||"")+t+((null==e?void 0:e.postfix)||"")}},sa=function(e){return function(t){if(e){var n=zo(t),r=lt({function:n.function,field:n.fieldId}),i=Yo(e,r),o=Ne(n.function);if(i)return[].concat(n.dimensionValues,[null==i?void 0:i.publicName,o]).join(" • ")}}},ua=function(e,t,n){var r,i=null==t||null==(r=t[null!=n?n:""])?void 0:r.formatter;return i?i(e):e};function da(e,t){return"boolean"===e.dataType&&"string"==typeof t?(n=t,"boolean"===(r=e.dataType)&&("true"===n||"TRUE"===n||"True"===n)||("boolean"!==r||"false"!==n&&"FALSE"!==n&&"False"!==n)&&n):t;var n,r}for(var ca={transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)"},pa=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},r=U({},i.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var i=t?t[e]:null;i&&(r=U({},r,n.variants&&n.variants[e]&&n.variants[e][i]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=U({},e.css);i.every(Object.keys(i.omit(e,["css"])),(function(n){var r;return e[n]==(null==(r=t)?void 0:r[n])}))&&(r=U({},r,n))})),r}}(e)(t);return p.css(n,"","")};return t.toString=t,t},fa={backgroundColor:"transparent",backgroundImage:"none",WebkitAppearance:"button",border:"none",cursor:"pointer",padding:0},ma=pa(fa),ha={margin:0},va={margin:0,textDecoration:"underline",color:"rgb(47, 129, 247)",cursor:"pointer"},ga={listStyle:"none",padding:0,margin:0},ba={padding:0,margin:0},xa=pa(ha),ya='ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',wa=pa({fontFamily:ya,fontSize:"1em"}),Ca=pa(va),ja=pa(ga),Sa=pa(ba),Fa=pa({fontWeight:700}),ka={xs:"0.75rem",sm:"0.8rem"},Ta=pa({position:"absolute",left:-9999,width:1,height:1,overflow:"hidden"}),Aa=Object.assign((function(){return null}),{ml:function(e){return pa({marginLeft:e})},bw:function(e){return pa({borderWidth:e})},codeText:wa,bold:Fa,button:ma,text:xa,link:Ca,paddingBottom:function(e){return pa({paddingBottom:e})},paddingLeft:function(e){return pa({paddingLeft:e})},padding:function(e){return pa({padding:e})},margin:function(e){return pa({margin:e})},srOnly:Ta,liReset:ja,ulReset:Sa,textSize:function(e){return pa({fontSize:ka[e]||"1rem"})},opacity:function(e){return pa({opacity:e})},color:function(e){return pa({color:e})}}),Da=Object.assign((function(){return null}),{button:fa,text:ha,link:va,codeFontFamily:ya}),Ia=pa({display:"block",verticalAlign:"middle"}),Pa=Object.assign((function(){return null}),{selectedComponent:function(e){return pa(U({},ca,Da.button,{borderRadius:null==e?void 0:e.borderRadius,"&:hover":U({},ca,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:null==e?void 0:e.borderRadius}),"&:focus":U({},ca,{boxShadow:"0 0 0 3px rgba(48, 116, 217, 0.3)",borderRadius:null==e?void 0:e.borderRadius}),variants:{componentSelect:{true:U({},ca,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:null==e?void 0:e.borderRadius,"&:focus-visible":{outline:0},"&:focus":{outline:0},"&:hover":U({},ca,{boxShadow:"0 0 0 3px rgb(48, 116, 217)",borderRadius:null==e?void 0:e.borderRadius})})}}}))},tableWrapper:pa({display:"flex",height:268,width:"100%",flexDirection:"column",position:"relative"})}),_a={name:"n8i3ag",styles:"position:relative;height:100%;width:100%;flex-grow:1;overflow-x:hidden"},Ea={name:"4hfwcq",styles:"height:100%;width:100%;flex-grow:1"},Oa=function(e){return null!=e&&e.disabledFeatures?c.jsxs("div",{css:_a,"aria-disabled":!0,children:[null==e?void 0:e.children,c.jsx("div",{style:{position:"absolute",inset:0}})]}):c.jsx("div",{css:Ea,children:null==e?void 0:e.children})},La=function(e){return null!=e&&e.disabledFeatures?c.jsxs("div",{className:""+Pa.tableWrapper,children:[null==e?void 0:e.children,c.jsx("div",{style:{position:"absolute",inset:0}})]}):c.jsx(t.Fragment,{children:null==e?void 0:e.children})},Ra={name:"c1vcec",styles:"display:inline-block;height:1rem;width:1rem"},Ma=function(e){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:e.active?"black":"none",css:Ra,viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","data-component":"filter-icon",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"})})},Na={name:"6r56vi",styles:"height:1rem;width:1rem"},za=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Na,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})},Ba={name:"3vy5qs",styles:"height:1.25rem;width:1.25rem;opacity:0.7"},qa=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:Ba,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"})})},Va={name:"15zcgxh",styles:"margin:auto;margin-top:0.25rem;height:1.25rem;width:1.25rem"},Wa=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Va,viewBox:"0 0 20 20",fill:"#88ecac",children:c.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})},Ha={name:"15zcgxh",styles:"margin:auto;margin-top:0.25rem;height:1.25rem;width:1.25rem"},Ya={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Ua=function(e){return c.jsxs(c.Fragment,{children:["removeFilter"==e.purpose&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Ha,viewBox:"0 0 20 20",children:c.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),"removeFilter"!=e.purpose&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Ya,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{fillRule:"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 10 0-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})})]})},Ga={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Ka=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Ga,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{d:"M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"})})},Xa={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Qa=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:Xa,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z"})})},Ja={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},Za=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:Ja,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{fillRule:"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z",clipRule:"evenodd"})})},$a={name:"6r56vi",styles:"height:1rem;width:1rem"},el=function(e){return c.jsx("svg",{onClick:e.onClick,css:$a,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"})})},tl={name:"y1h7kl",styles:"display:inline;height:1.5rem;width:1.5rem"},nl=function(e){return c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:tl,viewBox:"0 0 20 20",fill:"currentColor",children:c.jsx("path",{d:"M5 3a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2V5a2 2 0 00-2-2H5zM5 11a2 2 0 00-2 2v2a2 2 0 002 2h2a2 2 0 002-2v-2a2 2 0 00-2-2H5zM11 5a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V5zM11 13a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"})})},rl={name:"6r56vi",styles:"height:1rem;width:1rem"},il={name:"6r56vi",styles:"height:1rem;width:1rem"},ol=function(e){return c.jsxs(c.Fragment,{children:[e.isOpen&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:rl,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})}),!e.isOpen&&c.jsx("svg",{onClick:e.onClick,xmlns:"http://www.w3.org/2000/svg",css:il,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"})})]})},al={name:"y1h7kl",styles:"display:inline;height:1.5rem;width:1.5rem"},ll=function(e){return c.jsx("svg",{onClick:e.onClick,css:al,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7.5h1.5m-1.5 3h1.5m-7.5 3h7.5m-7.5 3h7.5m3-9h3.375c.621 0 1.125.504 1.125 1.125V18a2.25 2.25 0 01-2.25 2.25M16.5 7.5V18a2.25 2.25 0 002.25 2.25M16.5 7.5V4.875c0-.621-.504-1.125-1.125-1.125H4.125C3.504 3.75 3 4.254 3 4.875V18a2.25 2.25 0 002.25 2.25h13.5M6 7.5h3v3H6v-3z"})})},sl=function(){return c.jsx("svg",{width:"24",height:"24",viewBox:"0 0 160 160",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:c.jsx("path",{d:"M72.7304 36.3655L84.8523 48.4873L96.9741 36.3655C100.189 33.1506 104.549 31.3444 109.096 31.3444C113.642 31.3444 118.003 33.1505 121.218 36.3655L157.583 72.731C160.798 75.9459 162.604 80.3062 162.604 84.8528C162.604 89.3994 160.798 93.7597 157.583 96.9746L121.218 133.34C118.003 136.555 113.642 138.361 109.096 138.361C104.549 138.361 100.189 136.555 96.9741 133.34L84.8523 121.218L72.7304 133.34C69.5155 136.555 65.1552 138.361 60.6086 138.361C56.062 138.361 51.7017 136.555 48.4868 133.34L12.1213 96.9746C8.90637 93.7597 7.10025 89.3994 7.10025 84.8528C7.10025 80.3062 8.90637 75.9459 12.1213 72.731L48.4868 36.3655C51.7017 33.1506 56.062 31.3444 60.6086 31.3444C65.1552 31.3444 69.5155 33.1506 72.7304 36.3655ZM111.52 123.643L147.886 87.2771C148.529 86.6342 148.89 85.7621 148.89 84.8528C148.89 83.9435 148.529 83.0714 147.886 82.4284L111.52 46.0629C110.877 45.4199 110.005 45.0587 109.096 45.0587C108.187 45.0587 107.315 45.4199 106.672 46.0629L70.3061 82.4284C69.6631 83.0714 69.3019 83.9435 69.3019 84.8528C69.3019 85.7621 69.6631 86.6342 70.3061 87.2771L106.672 123.643C107.315 124.286 108.187 124.647 109.096 124.647C110.005 124.647 110.877 124.286 111.52 123.643ZM21.8187 82.4284C21.1758 83.0714 20.8145 83.9435 20.8145 84.8528C20.8145 85.7621 21.1758 86.6342 21.8187 87.2771L58.1842 123.643C58.8272 124.286 59.6993 124.647 60.6086 124.647C61.5179 124.647 62.39 124.286 63.033 123.643L75.1548 111.521L60.6086 96.9746C57.3937 93.7597 55.5876 89.3994 55.5876 84.8528C55.5876 80.3062 57.3937 75.9459 60.6086 72.731L75.1548 58.1848L63.033 46.0629C62.39 45.4199 61.5179 45.0587 60.6086 45.0587C59.6993 45.0587 58.8272 45.4199 58.1842 46.0629L21.8187 82.4284Z",fill:"rgb(55, 65, 81)"})})},ul={name:"37ue6p",styles:"display:inline-block;height:1.25rem;width:1.25rem"},dl=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",css:ul,viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75"})})},cl={parameters:!0,disableAutoSave:!0,showGlobalFilters:!0,showResetButton:!1,canManageGlobalFilters:!0,canEditComponentLibrary:!0,canUseComponentLibrary:!0,canCreateStandaloneComponents:!0,canDownloadComponentData:!0,canEditComponentsOnDashboard:!0,canRemoveComponentsFromDashboard:!0,canConfigureLocalFilters:!0,canAddNewRows:!0,canAddNewCells:!0,canEditCustomMetrics:!0,allowPercentagesCustomField:!0,allowSimpleMathsCustomField:!0,allowAggregateMathsCustomField:!0,allowRoundedNumberCustomField:!0,allowRulesCustomField:!0,showDateAndTimeFilter:!0,showDateFilter:!0,canSeeEmptyState:!1},pl={parameters:!0,disableAutoSave:!1,showGlobalFilters:!0,showResetButton:!0,canManageGlobalFilters:!0,canEditComponentLibrary:!0,canUseComponentLibrary:!0,canCreateStandaloneComponents:!0,canDownloadComponentData:!0,canEditComponentsOnDashboard:!0,canRemoveComponentsFromDashboard:!0,canConfigureLocalFilters:!0,canAddNewRows:!0,canAddNewCells:!0,canEditCustomMetrics:!0,allowPercentagesCustomField:!0,allowSimpleMathsCustomField:!0,allowAggregateMathsCustomField:!0,allowRoundedNumberCustomField:!0,allowRulesCustomField:!0,showDateAndTimeFilter:!0,showDateFilter:!0,canSeeEmptyState:!1},fl=function(e,t,n,r){var i=U({},pl,e);return"admin"==n&&(i=U({},cl,ml(e))),"read"==r&&"admin"!=n&&(i.disableAutoSave=!0,i.canEditComponentLibrary=!1,i.canEditComponentsOnDashboard=!1,i.canCreateStandaloneComponents=!1,i.parameters=!0,i.canRemoveComponentsFromDashboard=!1,i.canConfigureLocalFilters=!1,i.canAddNewRows=!1,i.canAddNewCells=!1,i.canEditCustomMetrics=!1,i.canUseComponentLibrary=!1,i.canManageGlobalFilters=!1),Vi(t,"simpleMaths")||(i.allowSimpleMathsCustomField=!1),Vi(t,"aggregateMaths")||(i.allowAggregateMathsCustomField=!1),Vi(t,"subquery")||(i.allowPercentagesCustomField=!1),Vi(t,"switchField")||(i.allowRulesCustomField=!1),Vi(t,"roundedNumbers")||(i.allowRoundedNumberCustomField=!1),i},ml=function(e){var t;return{showDateAndTimeFilter:void 0===e.showDateAndTimeFilter||e.showDateAndTimeFilter,showDateFilter:void 0===e.showDateFilter||e.showDateFilter,canUseComponentLibrary:void 0===e.canUseComponentLibrary||e.canUseComponentLibrary,canSeeEmptyState:null!=(t=e.canSeeEmptyState)&&t}},hl={today:!1,past_1_day:!0,yesterday:!0,past_3_days:!0,past_7_days:!0,past_30_days:!0,past_90_days:!0,past_3_months:!1,past_6_months:!1,past_12_months:!1,past_18_months:!1},vl=function(e){return{description:"Yesterday",range:{before:Io(e),after:Io((t=e,n=new Date(t.getTime()-864e5),new Date(n.getFullYear(),n.getMonth(),n.getDate())))}};var t,n},gl=function(e,t,n){var r=new Date,i=new Date(r);return t>0&&i.setMonth(r.getMonth()-t),e>0&&(i=new Date(r.getTime()-24*e*60*60*1e3)),{description:n,range:{before:r,after:i}}},bl={today:function(e){var t=Io(new Date),n=new Date(t);return n.setDate(n.getDate()+1),n.setMilliseconds(n.getMilliseconds()-1),{description:"Today",range:{before:n,after:t}}}(),past_1_day:gl(1,0,"Last 24 hours"),yesterday:vl(new Date),past_3_days:gl(3,0,"Last 3 days"),past_7_days:gl(7,0,"Last 7 days"),past_30_days:gl(30,0,"Last 30 days"),past_90_days:gl(90,0,"Last 90 days"),past_3_months:gl(0,3,"Last 3 months"),past_6_months:gl(0,6,"Last 6 months"),past_12_months:gl(0,12,"Last 12 months"),past_18_months:gl(0,18,"Last 18 months")},xl={},yl=0,wl=Object.entries(hl);yl<wl.length;yl++){var Cl=wl[yl],jl=Cl[0];Cl[1]&&jl in bl&&(xl["_vizzly_"+jl]=bl[jl])}var Sl=function(e){var t=Object.keys(hl).map((function(e){return e in bl?"_vizzly_"+e:e})),n=t.indexOf("_vizzly_today");n>-1&&(t.splice(n,1),t.unshift("_vizzly_today"));for(var r,i={},o={},a=te(t);!(r=a()).done;){var l=r.value,s=l.replace("_vizzly_",""),u=bl[s],d=null==e?void 0:e[s];"boolean"==typeof d?d&&(o[l]=u):null!=d?o[l]=d:!1!==hl[s]&&(o[l]=u)}if(e)for(var c=0,p=Object.entries(e);c<p.length;c++){var f=p[c],m=f[0],h=f[1];m in hl||(t.push(m),o[m]=h)}for(var v,g=te(t);!(v=g()).done;){var b=v.value;b in o&&(i[b]=o[b])}return i},Fl=function(e){function t(t){var n;return(n=e.call(this,t)||this).name="MissingDateTimeFormatOption",n}return G(t,e),t}(Z(Error)),kl={"DD/MM/YYYY":{description:"DD/MM/YYYY",formatter:function(e){return Do(e,"DD/MM/YYYY")}},"MM/DD/YYYY":{description:"MM/DD/YYYY",formatter:function(e){return Do(e,"MM/DD/YYYY")}},"DD-MM-YYYY":{description:"DD-MM-YYYY",formatter:function(e){return Do(e,"DD-MM-YYYY")}},"MM-DD-YYYY":{description:"MM-DD-YYYY",formatter:function(e){return Do(e,"MM-DD-YYYY")}},"DD MMMM YYYY, hh:mm":{description:"DD MMMM YYYY, hh:mm",formatter:function(e){return Do(e,"DD MMMM YYYY, hh:mm")}},"dddd DD MMMM YYYY, hh:mm":{description:"dddd DD MMMM YYYY, hh:mm",formatter:function(e){return Do(e,"dddd DD MMMM YYYY, hh:mm")}},"hh:mm":{description:"hh:mm",formatter:function(e){return Do(e,"hh:mm")}},"hh:mm:ss":{description:"hh:mm:ss",formatter:function(e){return Do(e,"hh:mm:ss")}},"DD MMMM YYYY":{description:"DD MMMM YYYY",formatter:function(e){return Do(e,"DD MMMM YYYY")}},"MMMM YYYY":{description:"MMMM YYYY",formatter:function(e){return Do(e,"MMMM YYYY")}},YYYY:{description:"YYYY",formatter:function(e){return Do(e,"YYYY")}},"YYYY-MM-DD[T]HH:mm:ss":{description:"YYYY-MM-DD[T]HH:mm:ss",formatter:function(e){return Do(e,"YYYY-MM-DD[T]HH:mm:ss")}},quarter:{description:"quarter",formatter:function(e){return Do(e,"quarter")}},week:{description:"week",formatter:function(e){return Do(e,"week")}}},Tl=function(e,t){var n={};return Object.keys(e).forEach((function(t){e[t]&&(n[t]=e[t])})),Object.keys(t.supportedTimeTruncFunctions).forEach((function(e){var r=t.supportedTimeTruncFunctions[e].dateFormat;if(!n[r])throw new Fl("Date format option "+r+" is required by the query engine, but it has not been set on the dateTimeFormatOptions.")})),n},Al={mode:"endUser",scope:"read_write",maxCSVDownloadLimit:1e4,featureToggles:U({},pl),developerTools:!1,componentOverrides:{},customComponents:[],reportScheduleOptions:[],overrideDeveloperInfo:null,disableToolbar:!1,onlyViewTypes:function(){return[]},dataPanel:function(e){return e},formatPanel:function(e){return e},dashboardFilters:function(){return[]},onDashboardFilterChange:function(){},dateFilterOptions:xl,dateTimeFormatOptions:kl,numberFormatOptions:$o,textOverrides:{},queryEngineConfig:io,organizationName:void 0,onEditorUpdate:function(e){return e},onSave:function(){return Wr("Save functionality not set.")},onScheduledReportChange:function(){var e=Y(W().mark((function e(){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wr("Scheduled report change functionality not set."),e.abrupt("return",null);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onOpenConfigManagerUi:void 0,onReset:function(){throw new Error("onReset function not implemented.")}},Dl=function(e){var n=(null==e?void 0:e.developerTools)&&"object"==typeof(null==e?void 0:e.developerTools)&&"theme"in(null==e?void 0:e.developerTools)&&!0===(null==e?void 0:e.developerTools.theme),r=(null==e?void 0:e.developerTools)&&"object"==typeof(null==e?void 0:e.developerTools)&&"componentOverride"in(null==e?void 0:e.developerTools)&&!0===(null==e?void 0:e.developerTools.componentOverride),i=function(){setTimeout((function(){document.querySelectorAll("[data-themeapi]").forEach((function(e){!function(e){var t=e.getAttribute("data-themeapi"),n=e.getAttribute("data-chipposition"),r=null==n?void 0:n.split("."),i="0px",o="20px",a=void 0,l=void 0;null!=r&&r.length&&(r.includes("left")&&(a="0px",i=void 0),r.includes("center")&&(a="calc(50% - 35px)",i=void 0),r.includes("bottom")&&(l="8px",o=void 0),r.includes("above")&&(o="0")),e.style.setProperty("--theme-value","'"+t+"'"),e.style.setProperty("--chip-top-value",""+o),e.style.setProperty("--chip-right-value",""+i),e.style.setProperty("--chip-left-value",""+a),e.style.setProperty("--chip-bottom-value",""+l)}(e),e.classList.add("theme-box")}))}),300)},o=function(){setTimeout((function(){document.querySelectorAll("[data-componentoverride]").forEach((function(e){!function(e){var t=e.getAttribute("data-componentoverride");e.style.setProperty("--override-value","'"+t+"'")}(e),e.classList.add("override-box")}))}),300)};return t.useEffect((function(){n&&Il(),r&&Pl()}),[n]),t.useEffect((function(){return n&&(i(),document.addEventListener("click",i)),r&&(o(),document.addEventListener("click",o)),function(){document.removeEventListener("click",i),document.removeEventListener("click",o)}}),[]),c.jsx(t.Fragment,{children:null==e?void 0:e.children})},Il=function(){p.injectGlobal({name:"1rt118i",styles:".theme-box:hover{outline:2px solid #1db954;}.theme-box{outline:2px solid transparent;}.theme-box:hover::after{opacity:1!important;z-index:999999999999;}.theme-box::after{opacity:0.4;content:var(--theme-value);position:absolute;background:#1db954;color:#fff;width:auto;font-size:10px;height:20px;border-radius:8px;right:var(--chip-right-value);top:var(--chip-top-value);bottom:var(--chip-bottom-value);left:var(--chip-left-value);padding:2.5px 5px 2px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.2);font-style:initial;font-weight:initial;}"})},Pl=function(){p.injectGlobal({name:"13sfq96",styles:".override-box:hover{outline:2px solid #652C8F;}.override-box{outline:2px solid transparent;}.override-box:hover::after{opacity:1!important;z-index:999999999999;}.override-box::after{opacity:0.4;content:var(--override-value);position:absolute;background:#652C8F;color:#fff;width:auto;font-size:10px;height:20px;border-radius:8px;right:0;top:20px;padding:2.5px 5px 2px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.2);font-style:initial;font-weight:initial;}"})},_l=n.createContext(U({},Al,{setOverrideDeveloperInfo:function(){throw"Not initiated."}})),El=function(e){var n,r,a,l,s,u,d,p,f=t.useState(null),m=f[0],h=f[1],v=(r=U({},e.dashboardBehaviour||{},{mode:e.mode}),a=e.includeComponentTypes,l=e.excludeComponentTypes,u=r.scope||Al.scope,d="admin"==(s=r.mode||Al.mode)?{}:U({},r.componentOverrides),p=r.queryEngineConfig?r.queryEngineConfig:Al.queryEngineConfig,U({},Al,{mode:s,scope:u,reportScheduleOptions:r.reportScheduleOptions||Al.reportScheduleOptions,customComponents:r.customComponents||Al.customComponents,componentOverrides:d,onlyViewTypes:function(e){var t,n,r;return(t=ir,n=l,r=[].concat(a||t),n&&(r=i.reject(r,(function(e){return n.includes(e)}))),r).filter((function(t){var n=!!On(t).setDataAttributesFromPreAggregatedDataSet;return!(e.preAggregated&&!n)}))},developerTools:"boolean"==typeof(null==r?void 0:r.developerTools)&&(null==r?void 0:r.developerTools),featureToggles:fl(o.merge({},Al.featureToggles,r.featureToggles),p,s,u),textOverrides:r.textOverrides||Al.textOverrides,maxCSVDownloadLimit:r.maxCSVDownloadLimit?r.maxCSVDownloadLimit:Al.maxCSVDownloadLimit,queryEngineConfig:p,dataPanel:r.dataPanel?r.dataPanel:Al.dataPanel,formatPanel:r.formatPanel?r.formatPanel:Al.formatPanel,numberFormatOptions:U({},Al.numberFormatOptions,r.numberFormatOptions),onEditorUpdate:r.onEditorUpdate?r.onEditorUpdate:Al.onEditorUpdate,onAskAI:r.onAskAI,dateFilterOptions:Sl(r.dateFilterOptions),onSave:r.onSave?r.onSave:Al.onSave,onScheduledReportChange:r.onScheduledReportChange?r.onScheduledReportChange:Al.onScheduledReportChange,dashboardFilters:r.dashboardFilters?r.dashboardFilters:Al.dashboardFilters,onDashboardFilterChange:r.onDashboardFilterChange?r.onDashboardFilterChange:Al.onDashboardFilterChange,onOpenConfigManagerUi:r.onOpenConfigManagerUi,organizationName:r.organizationName,dateTimeFormatOptions:Tl(U({},Al.dateTimeFormatOptions,r.dateTimeFormatOptions?r.dateTimeFormatOptions:{}),p),disableToolbar:r.disableToolbar}));return c.jsx(Dl,{developerTools:null==(n=e.dashboardBehaviour)?void 0:n.developerTools,children:c.jsx(_l.Provider,{value:U({},v,{setOverrideDeveloperInfo:h,overrideDeveloperInfo:m,onError:e.onError,onReset:e.onReset,onViewClick:e.onViewClick,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection}),children:e.children})})},Ol=function(){return n.useContext(_l)},Ll=function(e){var t=Ol(),n=t.developerTools,r=t.setOverrideDeveloperInfo,i=t.componentOverrides[e.renderOverrideKey];if(i){var o=U({},e.componentProps,{testId:void 0,onClickWithDevToolCheck:void 0,activeDevToolHighlight:void 0});return delete o.testId,delete o.onClickWithDevToolCheck,delete o.activeDevToolHighlight,i(o)}return c.jsx(e.Element,U({},e.componentProps,{activeDevToolHighlight:n,onClickWithDevToolCheck:function(t){return function(i){if(!i.shiftKey||!n)return t&&t(i);r({overrideKey:e.renderOverrideKey,componentProps:e.componentProps}),i.stopPropagation()}}}))},Rl=function(e,t,n){return function(r){return c.jsx(Ll,{Element:e,renderOverrideKey:t,componentProps:n?n(r):r})}},Ml=function(e,t,n){return Rl((function(n){return c.jsx(Nl,{activeDevToolHighlight:n.activeDevToolHighlight,onClickWithDevToolCheck:n.onClickWithDevToolCheck,renderOverrideKey:t,children:c.jsx(e,U({},n))})}),t,n)},Nl=function(e){var t,n=Ol();return c.jsx("div",U({style:{display:"inherit"},css:["position:relative;",!!n.developerTools&&{outlineStyle:"solid",outlineOffset:"-3px",outlineColor:"#ef4444"},"",""],onClick:e.onClickWithDevToolCheck()},((t={})["data-componentoverride"]=null==e?void 0:e.renderOverrideKey,t),{"data-testid":e.renderOverrideKey,children:e.children}))},zl=Ml((function(e){return c.jsx(Ma,{active:e.active})}),"renderFilterIcon"),Bl=Ml((function(){return c.jsx(ll,{})}),"renderReportIcon"),ql=Ml((function(){return c.jsx(dl,{active:!0})}),"renderParametersIcon"),Vl=Ml((function(){return c.jsx(za,{})}),"renderCloseIcon"),Wl=Ml((function(){return c.jsx(qa,{})}),"renderUndoIcon"),Hl=Ml((function(){return c.jsx(Wa,{})}),"renderCompletedIcon"),Yl=Ml((function(e){return c.jsx(Ua,{purpose:e.purpose})}),"renderDeleteIcon"),Ul=Ml((function(){return c.jsx(Ka,{})}),"renderEditIcon"),Gl=Ml((function(){return c.jsx(Qa,{})}),"renderLockedIcon"),Kl=Ml((function(){return c.jsx(Za,{})}),"renderDownloadIcon"),Xl=Ml((function(){return c.jsx(el,{})}),"renderComponentOptionsMenuIcon"),Ql=Ml((function(){return c.jsx(nl,{})}),"renderLibraryIcon"),Jl=Ml((function(e){return c.jsx(ol,{isOpen:e.isOpen})}),"renderAccordionIcon");function Zl(){for(var e=[],t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach((function(t){switch(typeof t){case"string":e.push(t);break;case"object":Object.keys(t).forEach((function(n){t[n]&&e.push(n)}))}})),e.length>0?e.join(" "):void 0}var $l=function(e){var t,n;return pa({width:"100%",display:"grid",gridTemplateColumns:null==e||null==(t=e.columns)?void 0:t.join(" "),gridTemplateRows:null==e||null==(n=e.rows)?void 0:n.join(" "),height:null==e?void 0:e.height,gap:null==e?void 0:e.gap,rowGap:null==e?void 0:e.rowGap,columnGap:null==e?void 0:e.columnGap,marginBottom:null==e?void 0:e.marginBottom,position:null==e?void 0:e.position,placeContent:null==e?void 0:e.placeContent,gridAutoFlow:null==e?void 0:e.flow})},es=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"div";return c.jsx(r,{className:Zl(""+$l(e),null==e?void 0:e.className),"data-component":null!=(n=null==e?void 0:e["data-component"])?n:"Grid",role:null==e?void 0:e.role,children:null==e?void 0:e.children})},ts=Object.assign((function(){return null}),{container:function(e){return pa({position:"absolute",top:0,right:0,zIndex:2147483247,border:null==e?void 0:e.border,borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,color:null==e?void 0:e.color,boxShadow:null==e?void 0:e.boxShadow,fontSize:null==e?void 0:e.fontSize})},option:function(e){var t,n,r;return pa(U({display:"flex",width:"100%",alignItems:"center",justifyContent:"flex-start",padding:null==e?void 0:e.padding,borderBottom:null==e?void 0:e.separatorBorder,gap:"0.5rem",color:"inherit"},ca,{variants:{clickable:(r={},r.true={cursor:"pointer","&:hover":U({background:null==e||null==(t=e["&:hover"])?void 0:t.background,color:null==e||null==(n=e["&:hover"])?void 0:n.color},ca),"&:last-of-type":{borderBottomLeftRadius:null==e?void 0:e.borderRadius,borderBottomRightRadius:null==e?void 0:e.borderRadius},"&:hover:last-of-type":{borderBottomLeftRadius:null==e?void 0:e.borderRadius,borderBottomRightRadius:null==e?void 0:e.borderRadius},"&:first-of-type":{borderTopLeftRadius:null==e?void 0:e.borderRadius,borderTopRightRadius:null==e?void 0:e.borderRadius},"&:hover:first-of-type":{borderTopLeftRadius:null==e?void 0:e.borderRadius,borderTopRightRadius:null==e?void 0:e.borderRadius}},r)}}))},close:pa({marginRight:"0.5rem",color:"inherit","&:hover":{opacity:.7}})});function ns(e,t){n.useEffect((function(){function n(n){e.current&&!e.current.contains(n.target)&&t()}return document.addEventListener("mousedown",n),function(){document.removeEventListener("mousedown",n)}}),[e,t])}var rs=function(){return t.useContext(is)},is=t.createContext(void 0);function os(e){for(var t,n={},r=te(e);!(t=r()).done;){var i=t.value;n[i.toString()]=100-i}return n}var as=os([5,8,20,80,90]),ls={base:ds("55, 65, 81",0)};for(var ss in as)ls[ss]=ds("55, 65, 81",as[ss]);var us={font:{header:16,standard:13,bold:400,sanSerif:"Inter, sans-serif",color:"rgb(55, 65, 81)"},size:{borderRadius:"0.5rem"},colors:{brand:ls,blue:"rgb(48, 116, 217)",contrast:"rgb(249, 247, 250)",success:"#43BA73"}};function ds(e,t){var n=e.match(/\d+/g).map(Number),r=n[0],i=n[1],o=n[2],a=t/100;return"rgb("+(r=Math.min(Math.round(r+(255-r)*a),255))+", "+(i=Math.min(Math.round(i+(255-i)*a),255))+", "+(o=Math.min(Math.round(o+(255-o)*a),255))+")"}function cs(e){return function(e,t){for(var n=e.startsWith("#")?e.slice(1):e,r="",i=0;i<3;i++){var o=parseInt(n.substr(2*i,2),16);r+=("0"+Math.min(255,Math.floor(o+(255-o)*t/100)).toString(16)).slice(-2)}return"#"+r}("#374151",e)}var ps=function(e){return 1===e?fs:ms},fs={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",rowLimit:6,forms:{label:{fontSize:us.font.standard,fontWeight:us.font.bold,margin:"0 0 0.3rem 0"},input:{border:"2px "+us.colors.brand[8]+" solid",background:"#fff",borderRadius:us.size.borderRadius,padding:"0.35rem 0.5rem",fontSize:us.font.standard,color:us.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},select:{border:"2px "+us.colors.brand[8]+" solid",background:"#fff",borderRadius:us.size.borderRadius,padding:"0.35rem 0.5rem",color:us.colors.brand.base,fontSize:us.font.standard,fontWeight:"inherit",indicatorColor:us.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},dateTime:{input:{border:"2px rgb(243, 244, 246) solid",background:"#fff",borderRadius:us.size.borderRadius,padding:"0.26rem 0.5rem",fontSize:us.font.standard,color:us.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},date:{width:90},time:{width:40},indicatorColor:us.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},title:{fontSize:us.font.header,fontWeight:us.font.bold,color:us.font.color}}}},dropdowns:{fontSize:us.font.standard,background:"rgb(255 255 255 / 1)",color:"inherit",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1),0 1px 2px -1px rgb(0 0 0 / 0.1)",borderRadius:us.size.borderRadius,border:"0px solid transparent",separatorBorder:"1px solid "+us.colors.brand[8],"&:hover":{background:us.colors.brand[5]},padding:"0.5rem"},buttons:{primary:{borderRadius:us.size.borderRadius,border:"1px solid rgb(48, 116, 217)",background:us.colors.blue,padding:"0.30rem 0.75rem",boxShadow:"0 2px 0 rgb(0 0 0 / 5%)",color:"#fff",fontSize:us.font.standard,"&:hover":{background:"#5795e6"}},secondary:{borderRadius:us.size.borderRadius,border:"1px solid "+us.colors.brand[20],background:"rgb(255, 255, 255)",padding:"0.30rem 0.75rem",color:us.font.color,fontSize:us.font.standard,"&:hover":{border:"1px solid rgb(209, 209, 209, 0.8)",color:"rgb(27, 27, 29, 0.8)"}},add:{border:"2px dashed rgba(143, 143, 145, 0.2)",borderRadius:us.size.borderRadius,color:"#8f8f91",background:"transparent","&:hover":{border:"2px dashed #3074d9",color:"#3074d9"},small:{fontSize:"0.75rem"},medium:{fontSize:us.font.standard},large:{fontSize:us.font.standard}},grid:{selected:{borderRadius:us.size.borderRadius,fontWeight:us.font.bold,background:"rgb(243 244 246)",fontSize:us.font.standard,"&:hover":{boxShadow:"0 0 #0000, 0 0 #0000, 0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)"}},unselected:{borderRadius:us.size.borderRadius,fontWeight:us.font.bold,background:"transparent",fontSize:us.font.standard,"&:hover":{boxShadow:"0 0 #0000, 0 0 #0000, 0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)"}}}},panels:{padding:"0.75rem 1rem",borderRadius:us.size.borderRadius,background:"#fff",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1),0 2px 4px -2px rgb(0 0 0 / 0.1)"},modals:{base:{borderRadius:us.size.borderRadius,border:"0px solid",background:"rgb(255, 255, 255)",boxShadow:"0 0 #0000,0 0 #0000,0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)",zIndex:2147483147},header:{padding:"0.75rem 0.75rem 0px"},content:{fontSize:us.font.standard,padding:"0.75rem",alternativeBackground:"rgb(229 231 235 / 0.2)"},footer:{padding:"0.75rem"},overlay:{background:"#000",opacity:.3},options:{disableOutsideClick:!1,closeButton:"outside",showTitle:{editor:!1,library:!1}}},alerts:{padding:"8px 12px",borderRadius:us.size.borderRadius,info:{background:"rgb(224, 242, 255)",border:"1px solid rgb(224, 242, 255)",iconColor:"#1677ff"},warning:{background:"rgb(255, 245, 234)",border:"1px solid #e1b878",iconColor:"#b98900"},critical:{background:"rgb(255, 85, 85)",border:"1px solid rgb(255, 85, 85)",color:"rgb(255, 255, 255)",iconColor:"#fff"},title:{fontWeight:us.font.bold,fontSize:us.font.standard},content:{fontSize:us.font.standard}},tabs:{selected:{borderRadius:us.size.borderRadius,padding:"0.5rem 0",fontSize:us.font.standard,fontWeight:600,boxShadow:"0 0 #0000,0 0 #0000,0 1px 2px 0 rgb(0 0 0 / 0.05)",background:"rgb(48 116 217)",color:"rgb(255 255 255)"},unselected:{borderRadius:us.size.borderRadius,padding:"0.5rem 0",fontSize:us.font.standard,fontWeight:600,color:"rgba(0, 0, 0, 0.4)"}},lists:{title:{fontSize:14,fontWeight:us.font.bold},fontSize:us.font.standard,border:"2px solid rgb(229 231 235 / 0.6)",borderRadius:us.size.borderRadius,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"}},popoverMenu:{borderRadius:us.size.borderRadius,fontSize:us.font.standard,background:"rgb(249 247 250)",color:"inherit",boxShadow:"0 0 #0000,0 0 #0000,0 10px 15px -3px rgb(0 0 0 / 0.1),0 4px 6px -4px rgb(0 0 0 / 0.1)","&:hover":{background:"rgb(255, 255, 255)"},padding:"0.35rem 0.75rem"},charts:{title:{fontWeight:us.font.bold,fontSize:us.font.header,color:us.colors.brand[90]},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:cs(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31"},tables:{th:{background:cs(95),borderTop:0,borderBottom:"3px solid "+cs(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid "+cs(70),last:{borderRight:0},inner:{borderRight:!1},"&:hover":{color:us.colors.brand[90]},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+cs(70)},row:{borderBottom:"1px solid "+cs(70),padding:"0.5rem"},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}}},accordion:{iconColor:us.colors.blue,button:{fontWeight:us.font.bold,fontSize:us.font.standard,color:us.colors.blue}},dashboard:{borderColor:cs(80),borderStyle:"solid",borderWidth:2,borderRadius:us.size.borderRadius,icon:{color:"#1f293799"}},radioGroup:{description:{fontWeight:"inherit",color:us.colors.brand[80],fontSize:11},label:{fontWeight:"inherit",color:"inherit",fontSize:13}},search:{border:"1px solid rgb(243, 244, 246)",background:"#fff",borderRadius:"0.5rem",padding:"6px 10px 7px 16px",fontSize:16,fontWeight:500,height:36,"&:focus":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},"&:hover":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},icons:{color:"rgb(48, 116, 217)"}},library:{verified:{color:"rgba(22, 119, 255, 0.3)"}},header:{borderBottom:"2px solid "+cs(75),padding:"0 0 0.5rem 0",title:{fontSize:18,fontWeight:500,htmlElement:"span"}}},ms={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",rowLimit:6,version:2,forms:{label:{fontSize:14,color:cs(0),fontWeight:500,margin:"0 0 0.3rem 0"},input:{fontSize:14,padding:"7px 1rem",color:cs(0),fontWeight:400,border:"2px "+cs(92)+" solid",background:"#fff",borderRadius:8,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},select:{border:"2px "+cs(92)+" solid",background:"#fff",borderRadius:8,indicatorColor:us.colors.brand.base,"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"},fontSize:14,padding:"7px 1rem",color:cs(0),fontWeight:400},dateTime:{input:{border:"2px rgb(243, 244, 246) solid",background:"#fff",borderRadius:8,padding:"0.26rem 0.5rem",fontSize:14,color:cs(0),"&:focus":{border:"2px rgb(224, 242, 255) solid"},"&:hover":{border:"2px rgb(224, 242, 255) solid"}},date:{width:90},time:{width:40},indicatorColor:us.colors.brand.base,calendar:{selected:{background:"rgb(48, 116, 217)",color:"#fff"},title:{fontSize:us.font.header,fontWeight:us.font.bold,color:us.font.color}}}},dropdowns:{fontSize:14,background:"rgb(255 255 255 / 1)",color:"inherit",boxShadow:"0 1px 3px 0 rgb(0 0 0 / 0.1),0 1px 2px -1px rgb(0 0 0 / 0.1)",borderRadius:8,border:"0px solid transparent",separatorBorder:"1px solid "+cs(92),"&:hover":{background:cs(95)},padding:"0.5rem"},buttons:{primary:{padding:".6rem 1rem",borderRadius:8,fontSize:14,fontWeight:500,background:cs(0),color:"#fff",border:"0",boxShadow:"unset",narrowPadding:"0.46rem 1rem 0.5rem","&:hover":{background:cs(10),border:0,boxShadow:"unset"},"&:disabled":{opacity:1,background:cs(50),border:"0"},"&:hover:disabled":{opacity:1,background:cs(50),border:"0"}},secondary:{padding:".6rem 1rem",borderRadius:8,fontSize:14,background:"rgb(255, 255, 255)",fontWeight:500,color:cs(0),border:"0",boxShadow:"unset","&:hover":{background:"#e9ebf0",border:0,boxShadow:"unset"},"&:disabled":{opacity:1,background:"#9ba9bb",border:"0"},"&:hover:disabled":{opacity:1,background:"#9ba9bb",border:"0"}},add:{border:"2px dashed "+cs(70),color:cs(15),background:"transparent",borderRadius:8,"&:hover":{border:"2px dashed #3074d9",color:"#3074d9"},small:{fontSize:12,fontWeight:500},medium:{fontSize:12,fontWeight:500},large:{fontSize:14,fontWeight:500}}},panels:{padding:"0.75rem 1rem",borderRadius:8,background:"#fff",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1),0 2px 4px -2px rgb(0 0 0 / 0.1)"},modals:{base:{borderRadius:8,border:"0px solid",background:"rgb(255, 255, 255)",boxShadow:"0 0 #0000,0 0 #0000,0 20px 25px -5px rgb(0 0 0 / 0.1),0 8px 10px -6px rgb(0 0 0 / 0.1)",zIndex:2147483147},header:{background:"rgb(229 231 235 / 0.2)",padding:"1.5rem 2rem 0.5rem 2rem"},content:{fontSize:14,background:"rgb(229 231 235 / 0.2)",padding:"1rem 2rem",alternativeBackground:"rgb(229 231 235 / 0.2)"},footer:{padding:"0.5rem 2rem 0.5rem 2rem"},overlay:{background:"#000",opacity:.3},options:{disableOutsideClick:!1,closeButton:"outside",showTitle:{editor:!1,library:!1}}},alerts:{padding:"8px 12px",borderRadius:8,info:{background:"rgb(224, 242, 255)",border:"1px solid rgb(224, 242, 255)",iconColor:"#1677ff"},warning:{background:"rgb(255, 245, 234)",border:"1px solid #e1b878",iconColor:"#b98900"},critical:{background:"rgb(255, 85, 85)",border:"1px solid rgb(255, 85, 85)",color:"rgb(255, 255, 255)",iconColor:"#fff"},title:{fontWeight:us.font.bold,fontSize:us.font.standard},content:{fontSize:us.font.standard}},tabs:{selected:{borderRadius:8,padding:"0.5rem 0",fontSize:14,fontWeight:500,background:cs(0),boxShadow:"0 0 #0000,0 0 #0000,0 1px 2px 0 rgb(0 0 0 / 0.05)",color:"rgb(255 255 255)","&:disabled":{opacity:1,background:cs(50),border:"0"},"&:hover:disabled":{opacity:1,background:cs(50),border:"0"}},unselected:{borderRadius:8,padding:"0.5rem 0",fontSize:14,fontWeight:500,color:cs(25),"&:hover":{background:cs(90)},"&:disabled":{opacity:1,background:cs(90),border:"0"},"&:hover:disabled":{opacity:1,background:cs(90),border:"0"}}},lists:{title:{fontSize:14,fontWeight:us.font.bold},fontSize:us.font.standard,borderRadius:8,background:"rgb(255 255 255 / 1)",icon:{color:"#1f293799",background:"#fff",border:"1px solid transparent"},border:"2px solid "+cs(92)},popoverMenu:{borderRadius:8,fontSize:14,background:"rgb(249 247 250)",color:"inherit",boxShadow:"0 0 #0000,0 0 #0000,0 10px 15px -3px rgb(0 0 0 / 0.1),0 4px 6px -4px rgb(0 0 0 / 0.1)","&:hover":{background:"rgb(255, 255, 255)"},padding:"0.35rem 0.75rem"},charts:{title:{fontWeight:us.font.bold,fontSize:us.font.header,color:cs(10)},labels:{fontSize:9},axisTitles:{fontSize:11,fontWeight:700,color:cs(15)},subject:{color:"#8f8f91",fontSize:"0.75rem"},iconColor:"#2d2f31"},tables:{th:{background:cs(95),borderTop:0,borderBottom:"3px solid "+cs(70),fontSize:13,fontWeight:600,padding:"0.5rem 0.5rem",borderRight:"1px solid "+cs(70),last:{borderRight:0},inner:{borderRight:!1},"&:hover":{color:us.colors.brand[90]},group:{fontSize:13,fontWeight:400},column:{background:"rgba(48, 116, 217, 0.05)",padding:"0.5rem",borderRight:"1px solid "+cs(70)},row:{borderBottom:"1px solid "+cs(70),padding:"0.5rem"},level:{2:{background:"rgba(48, 116, 217, 0.15)"}}},body:{cells:{padding:"7.3px 8px",fontSize:13,borderBottom:"1px solid "+us.colors.brand[8]},odd:{"&:hover":{background:us.colors.brand[5]}},even:{"&:hover":{background:us.colors.brand[5]}}}},accordion:{iconColor:us.colors.blue,button:{fontWeight:us.font.bold,fontSize:us.font.standard,color:us.colors.blue}},dashboard:{borderColor:cs(80),borderStyle:"solid",borderWidth:2,borderRadius:8,icon:{color:"#1f293799"}},radioGroup:{description:{fontWeight:"inherit",color:cs(20),fontSize:11},label:{fontWeight:"inherit",color:"inherit",fontSize:13}},search:{border:"1px solid "+cs(92),background:"#fff",borderRadius:"0.5rem",padding:"6px 10px 7px 16px",fontSize:16,fontWeight:500,height:36,"&:focus":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},"&:hover":{boxShadow:"0 0 0 3px rgb(224, 242, 255)"},icons:{color:"rgb(48, 116, 217)"}},library:{verified:{color:"rgba(22, 119, 255, 0.3)"}},filters:{filterBy:{padding:"0.45rem 1rem 0.46rem",lineHeight:"21px"}},header:{borderBottom:"2px solid "+cs(75),padding:"0 0 0.5rem 0",title:{fontSize:18,fontWeight:500,htmlElement:"span"}}},hs=f({key:"css"}),vs=function(e){var t,n,r=null!=(t=null==(n=e.theme)?void 0:n.version)?t:2,o=i.defaultsDeep({},gs(r,null==e?void 0:e.theme,null==e?void 0:e.storedTheme),ps(r));return c.jsx(is.Provider,{value:o,children:c.jsx(d.CacheProvider,{value:hs,children:null==e?void 0:e.children})})},gs=function(e,t,n){var r,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,C,j,S,F,k,T,A,D,I,P,_,E,O={baseFont:{fontSize:null!=(r=null!=(o=null==t||null==(a=t.baseFont)?void 0:a.fontSize)?o:null==n?void 0:n.fontSize)?r:us.font.standard,fontFamily:null!=(l=null!=(s=null==t||null==(u=t.baseFont)?void 0:u.fontFamily)?s:null==n?void 0:n.fontFamily)?l:us.font.sanSerif},titles:{fontFamily:null!=(d=null!=(c=null!=(p=null==t||null==(f=t.titles)?void 0:f.fontFamily)?p:null==t||null==(m=t.baseFont)?void 0:m.fontFamily)?c:null==n?void 0:n.fontFamily)?d:us.font.sanSerif,fontSize:null!=(h=null==t||null==(v=t.titles)?void 0:v.fontSize)?h:null==t||null==(g=t.baseFont)?void 0:g.fontSize},colors:null!=(b=null!=(x=null==t?void 0:t.colors)?x:null==n?void 0:n.colors)?b:ps(e).colors,rowLimit:null!=(y=null!=(w=null==t?void 0:t.rowLimit)?w:null==n?void 0:n.rowLimit)?y:ps(e).rowLimit,detail:null!=(C=null!=(j=null==t?void 0:t.detail)?j:null==n?void 0:n.detail)?C:ps(e).detail,fontFamily:null!=(S=null!=(F=null==t?void 0:t.fontFamily)?F:null==n?void 0:n.fontFamily)?S:us.font.sanSerif,fontSize:null!=(k=null!=(T=null==t?void 0:t.fontSize)?T:null==n?void 0:n.fontSize)?k:us.font.sanSerif,dashboard:{icon:{color:null!=(A=null==t||null==(D=t.dashboard)||null==(I=D.icon)?void 0:I.color)?A:null==(P=ps(e))||null==(_=P.dashboard)||null==(E=_.icon)?void 0:E.color}}};return i.merge({},t,O)},bs=t.createContext(!1);function xs(e){return c.jsx(bs.Provider,{value:e.force,children:e.children})}function ys(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];if(e in t){var o=t[e];return"function"==typeof o?o.apply(void 0,r):o}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,ys),a}var ws,Cs,js=["static"],Ss=["unmount"],Fs=["as","children","refName"];function ks(e){var t=e.slot,n=e.defaultTag,r=e.features,i=e.visible,o=void 0===i||i,a=e.name,l=As(e.theirProps,e.ourProps);if(o)return Ts(l,t,n,a);var s=null!=r?r:ws.None;if(s&ws.Static){var u=l.static,d=void 0!==u&&u,c=$(l,js);if(d)return Ts(c,t,n,a)}if(s&ws.RenderStrategy){var p,f=l.unmount,m=void 0===f||f,h=$(l,Ss);return ys(m?Cs.Unmount:Cs.Hidden,((p={})[Cs.Unmount]=function(){return null},p[Cs.Hidden]=function(){return Ts(U({},h,{hidden:!0,style:{display:"none"}}),t,n,a)},p))}return Ts(l,t,n,a)}function Ts(e,n,r,i){var o;void 0===n&&(n={});var a=Ps(e,["unmount","static"]),l=a.as,s=void 0===l?r:l,u=a.children,d=a.refName,c=void 0===d?"ref":d,p=$(a,Fs),f=void 0!==e.ref?((o={})[c]=e.ref,o):{},m="function"==typeof u?u(n):u;p.className&&"function"==typeof p.className&&(p.className=p.className(n));var h={};if(n){for(var v=!1,g=[],b=0,x=Object.entries(n);b<x.length;b++){var y=x[b],w=y[1];"boolean"==typeof w&&(v=!0),!0===w&&g.push(y[0])}v&&(h["data-headlessui-state"]=g.join(" "))}if(s===t.Fragment&&Object.keys(Is(p)).length>0){if(!t.isValidElement(m)||Array.isArray(m)&&m.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+i+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(p).map((function(e){return" - "+e})).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((function(e){return" - "+e})).join("\n")].join("\n"));return t.cloneElement(m,Object.assign({},As(m.props,Is(Ps(p,["ref"]))),h,f,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return{ref:t.every((function(e){return null==e}))?void 0:function(e){for(var n,r=te(t);!(n=r()).done;){var i=n.value;null!=i&&("function"==typeof i?i(e):i.current=e)}}}}(m.ref,f.ref)))}return t.createElement(s,Object.assign({},Ps(p,["ref"]),s!==t.Fragment&&f,s!==t.Fragment&&h),m)}function As(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)return{};if(1===t.length)return t[0];for(var r={},i={},o=0,a=t;o<a.length;o++){var l=a[o];for(var s in l)s.startsWith("on")&&"function"==typeof l[s]?(null!=i[s]||(i[s]=[]),i[s].push(l[s])):r[s]=l[s]}if(r.disabled||r["aria-disabled"])return Object.assign(r,Object.fromEntries(Object.keys(i).map((function(e){return[e,void 0]}))));var u=function(e){var t;Object.assign(r,((t={})[e]=function(t){for(var n=i[e],r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];for(var l,s=te(n);!(l=s()).done;){var u=l.value;if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;u.apply(void 0,[t].concat(o))}},t))};for(var d in i)u(d);return r}function Ds(e){var n;return Object.assign(t.forwardRef(e),{displayName:null!=(n=e.displayName)?n:e.name})}function Is(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}function Ps(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),i=te(t);!(n=i()).done;){var o=n.value;o in r&&delete r[o]}return r}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(ws||(ws={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(Cs||(Cs={}));var _s="undefined"==typeof window||"undefined"==typeof document,Es=_s?t.useEffect:t.useLayoutEffect;function Os(e){var n=t.useRef(e);return Es((function(){n.current=e}),[e]),n}var Ls,Rs=function(e){var t=Os(e);return n.useCallback((function(){return t.current.apply(t,arguments)}),[t])},Ms=Symbol();function Ns(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=t.useRef(n);t.useEffect((function(){i.current=n}),[n]);var o=Rs((function(e){for(var t,n=te(i.current);!(t=n()).done;){var r=t.value;null!=r&&("function"==typeof r?r(e):r.current=e)}}));return n.every((function(e){return null==e||(null==e?void 0:e[Ms])}))?void 0:o}!function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(Ls||(Ls={}));var zs,Bs={serverHandoffComplete:!1};function qs(){var e=t.useState(Bs.serverHandoffComplete),n=e[0],r=e[1];return t.useEffect((function(){!0!==n&&r(!0)}),[n]),t.useEffect((function(){!1===Bs.serverHandoffComplete&&(Bs.serverHandoffComplete=!0)}),[]),n}var Vs=0;function Ws(){return++Vs}var Hs,Ys=null!=(zs=n.useId)?zs:function(){var e=qs(),t=n.useState(e?Ws:null),r=t[0],i=t[1];return Es((function(){null===r&&i(Ws())}),[r]),null!=r?""+r:void 0},Us=["features"];!function(e){e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden"}(Hs||(Hs={}));var Gs=Ds((function(e,t){var n=e.features,r=void 0===n?Hs.None:n,i=$(e,Us);return ks({ourProps:{ref:t,"aria-hidden":(r&Hs.Focusable)===Hs.Focusable||void 0,style:U({position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},(r&Hs.Hidden)===Hs.Hidden&&!((r&Hs.Focusable)===Hs.Focusable)&&{display:"none"})},theirProps:i,slot:{},defaultTag:"div",name:"Hidden"})}));function Ks(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((function(e){return setTimeout((function(){throw e}))}))}function Xs(){var e=[],t=[],n={enqueue:function(e){t.push(e)},addEventListener:function(e,t,r,i){return e.addEventListener(t,r,i),n.add((function(){return e.removeEventListener(t,r,i)}))},requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);return n.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.requestAnimationFrame((function(){return n.requestAnimationFrame.apply(n,t)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);return n.add((function(){return clearTimeout(e)}))})),microTask:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i={current:!0};return Ks((function(){i.current&&t[0]()})),n.add((function(){i.current=!1}))},add:function(t){return e.push(t),function(){var n=e.indexOf(t);n>=0&&(0,e.splice(n,1)[0])()}},dispose:function(){for(var t,n=te(e.splice(0));!(t=n()).done;)(0,t.value)()},workQueue:function(){return Y(W().mark((function e(){var n,r,i;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=te(t.splice(0));case 1:if((r=n()).done){e.next=7;break}return i=r.value,e.next=5,i();case 5:e.next=1;break;case 7:case"end":return e.stop()}}),e)})))()}};return n}function Qs(e){return _s?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}var Js,Zs,$s,eu,tu=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");function nu(e){null==e||e.focus({preventScroll:!0})}!function(e){e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll"}(Js||(Js={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(Zs||(Zs={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}($s||($s={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(eu||(eu={}));var ru,iu=["textarea","input"].join(",");function ou(e,t){return void 0===t&&(t=function(e){return e}),e.slice().sort((function(e,n){var r=t(e),i=t(n);if(null===r||null===i)return 0;var o=r.compareDocumentPosition(i);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function au(e,t,n,r){var i;void 0===n&&(n=!0),void 0===r&&(r=null);var o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?ou(e):e:function(e){return void 0===e&&(e=document.body),null==e?[]:Array.from(e.querySelectorAll(tu))}(e);r=null!=(i=r)?i:o.activeElement;var l,s,u=function(){if(t&(Js.First|Js.Next))return $s.Next;if(t&(Js.Previous|Js.Last))return $s.Previous;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),d=function(){if(t&Js.First)return 0;if(t&Js.Previous)return Math.max(0,a.indexOf(r))-1;if(t&Js.Next)return Math.max(0,a.indexOf(r))+1;if(t&Js.Last)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")}(),c=t&Js.NoScroll?{preventScroll:!0}:{},p=0,f=a.length,m=void 0;do{var h;if(p>=f||p+f<=0)return Zs.Error;var v=d+p;if(t&Js.WrapAround)v=(v+f)%f;else{if(v<0)return Zs.Underflow;if(v>=f)return Zs.Overflow}null==(h=m=a[v])||h.focus(c),p+=u}while(m!==o.activeElement);return t&(Js.Next|Js.Previous)&&null!=(s=null==(l=m)||null==l.matches?void 0:l.matches(iu))&&s&&m.select(),m.hasAttribute("tabindex")||m.setAttribute("tabindex","0"),Zs.Success}function lu(){var e=t.useRef(!1);return Es((function(){return e.current=!0,function(){e.current=!1}}),[]),e}function su(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useMemo((function(){return Qs.apply(void 0,n)}),[].concat(n))}function uu(e,n,r,i){var o=Os(r);t.useEffect((function(){var t;function r(e){o.current(e)}return(e=null!=(t=e)?t:window).addEventListener(n,r,i),function(){return e.removeEventListener(n,r,i)}}),[e,n,i])}function du(e,n){var r=t.useRef([]),i=Rs(e);t.useEffect((function(){for(var e,t=[].concat(r.current),o=te(n.entries());!(e=o()).done;){var a=e.value;if(r.current[a[0]]!==a[1]){var l=i(n,t);return r.current=n,l}}}),[i].concat(n))}!function(e){e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards"}(ru||(ru={}));var cu,pu=["initialFocus","containers","features"];!function(e){e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All"}(cu||(cu={}));var fu=Object.assign(Ds((function(e,n){var r=t.useRef(null),i=Ns(r,n),o=e.initialFocus,a=e.containers,l=e.features,s=void 0===l?cu.All:l,u=$(e,pu);qs()||(s=cu.None);var d=su(r);!function(e,n){var r=e.ownerDocument,i=t.useRef(null);uu(null==r?void 0:r.defaultView,"focusout",(function(e){n&&(i.current||(i.current=e.target))}),!0),du((function(){n||((null==r?void 0:r.activeElement)===(null==r?void 0:r.body)&&nu(i.current),i.current=null)}),[n]);var o=t.useRef(!1);t.useEffect((function(){return o.current=!1,function(){o.current=!0,Ks((function(){o.current&&(nu(i.current),i.current=null)}))}}),[])}({ownerDocument:d},Boolean(s&cu.RestoreFocus));var p=function(e,n){var r=e.ownerDocument,i=e.container,o=e.initialFocus,a=t.useRef(null),l=lu();return du((function(){if(n){var e=i.current;e&&Ks((function(){if(l.current){var t=null==r?void 0:r.activeElement;if(null!=o&&o.current){if((null==o?void 0:o.current)===t)return void(a.current=t)}else if(e.contains(t))return void(a.current=t);null!=o&&o.current?nu(o.current):au(e,Js.First)===Zs.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),a.current=null==r?void 0:r.activeElement}}))}}),[n]),a}({ownerDocument:d,container:r,initialFocus:o},Boolean(s&cu.InitialFocus));!function(e,t){var n=e.ownerDocument,r=e.container,i=e.containers,o=e.previousActiveElement,a=lu();uu(null==n?void 0:n.defaultView,"focus",(function(e){if(t&&a.current){var n=new Set(null==i?void 0:i.current);n.add(r);var l=o.current;if(l){var s=e.target;s&&s instanceof HTMLElement?function(e,t){for(var n,r=te(e);!(n=r()).done;){var i;if(null!=(i=n.value.current)&&i.contains(t))return!0}return!1}(n,s)?(o.current=s,nu(s)):(e.preventDefault(),e.stopPropagation(),nu(l)):nu(o.current)}}}),!0)}({ownerDocument:d,container:r,containers:a,previousActiveElement:p},Boolean(s&cu.FocusLock));var f=function(){var e,n=t.useRef(ru.Forwards);return e=Os((function(e){"Tab"===e.key&&(n.current=e.shiftKey?ru.Backwards:ru.Forwards)})),t.useEffect((function(){function t(t){e.current(t)}return window.addEventListener("keydown",t,!0),function(){return window.removeEventListener("keydown",t,!0)}}),["keydown",!0]),n}(),m=Rs((function(){var e,t=r.current;t&&ys(f.current,((e={})[ru.Forwards]=function(){return au(t,Js.First)},e[ru.Backwards]=function(){return au(t,Js.Last)},e))})),h={ref:i};return c.jsxs(c.Fragment,{children:[Boolean(s&cu.TabLock)&&c.jsx(Gs,{as:"button",type:"button",onFocus:m,features:Hs.Focusable}),ks({ourProps:h,theirProps:u,defaultTag:"div",name:"FocusTrap"}),Boolean(s&cu.TabLock)&&c.jsx(Gs,{as:"button",type:"button",onFocus:m,features:Hs.Focusable})]})})),{features:cu}),mu=new Set,hu=new Map;function vu(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function gu(e){var t=hu.get(e);t&&(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}var bu=["target"],xu="headlessui-portal-root",yu=t.Fragment,wu=Ds((function(e,n){var r,i,o=e,a=t.useRef(null),l=Ns((void 0===r&&(r=!0),Object.assign((function(e){a.current=e}),((i={})[Ms]=r,i))),n),s=su(a),u=function(e){var n=t.useContext(bs),r=t.useContext(ju),i=su(e),o=t.useState((function(){if(!n&&null!==r)return null;if(_s)return null;var e=null==i?void 0:i.getElementById(xu);if(e)return e;if(null===i)return null;var t=i.createElement("div");return t.setAttribute("id",xu),t.setAttribute("data-testid",xu),i.body.appendChild(t)})),a=o[0],l=o[1];return t.useEffect((function(){null!==a&&(null!=i&&i.body.contains(a)||null==i||i.body.appendChild(a))}),[a,i]),t.useEffect((function(){n||null!==r&&l(r.current)}),[r,l,n]),a}(a),d=t.useState((function(){var e;return _s?null:null!=(e=null==s?void 0:s.createElement("div"))?e:null}))[0],c=qs(),p=t.useRef(!1);return Es((function(){if(p.current=!1,u&&d)return u.contains(d)||(d.setAttribute("data-headlessui-portal",""),u.appendChild(d)),function(){p.current=!0,Ks((function(){var e;p.current&&u&&d&&(u.removeChild(d),u.childNodes.length<=0&&(null==(e=u.parentElement)||e.removeChild(u)))}))}}),[u,d]),c&&u&&d?m.createPortal(ks({ourProps:{ref:l},theirProps:o,defaultTag:yu,name:"Portal"}),d):null})),Cu=t.Fragment,ju=t.createContext(null),Su=Object.assign(wu,{Group:Ds((function(e,t){var n=e.target,r=$(e,bu),i=Ns(t);return c.jsx(ju.Provider,{value:n,children:ks({ourProps:{ref:i},theirProps:r,defaultTag:Cu,name:"Popover.Group"})})}))}),Fu=t.createContext(null);function ku(){var e=t.useContext(Fu);if(null===e){var n=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,ku),n}return e}var Tu,Au=Ds((function(e,t){var n=ku(),r="headlessui-description-"+Ys(),i=Ns(t);Es((function(){return n.register(r)}),[r,n.register]);var o=e;return ks({ourProps:U({ref:i},n.props,{id:r}),theirProps:o,slot:n.slot||{},defaultTag:"p",name:n.name||"Description"})})),Du=t.createContext(null);function Iu(){return t.useContext(Du)}function Pu(e){return c.jsx(Du.Provider,{value:e.value,children:e.children})}Du.displayName="OpenClosedContext",function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Tu||(Tu={}));var _u,Eu=t.createContext((function(){}));function Ou(e){var n=e.children,r=e.onUpdate,i=e.type,o=e.element,a=e.enabled,l=t.useContext(Eu),s=Rs((function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];null==r||r.apply(void 0,t),l.apply(void 0,t)}));return Es((function(){var e=void 0===a||!0===a;return e&&s(_u.Add,i,o),function(){e&&s(_u.Remove,i,o)}}),[s,i,o,a]),c.jsx(Eu.Provider,{value:s,children:n})}function Lu(e,n,r){var i=Os(n);t.useEffect((function(){function t(e){i.current(e)}return document.addEventListener(e,t,r),function(){return document.removeEventListener(e,t,r)}}),[e,r])}Eu.displayName="StackContext",function(e){e[e.Add=0]="Add",e[e.Remove=1]="Remove"}(_u||(_u={}));var Ru,Mu,Nu,zu=["open","onClose","initialFocus","__demoMode"];!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Mu||(Mu={})),function(e){e[e.SetTitleId=0]="SetTitleId"}(Nu||(Nu={}));var Bu=((Ru={})[Nu.SetTitleId]=function(e,t){return e.titleId===t.id?e:U({},e,{titleId:t.id})},Ru),qu=t.createContext(null);function Vu(e){var n=t.useContext(qu);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Dialog /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,Vu),r}return n}function Wu(e,t){return ys(t.type,Bu,e,t)}qu.displayName="DialogContext";var Hu,Yu,Uu,Gu,Ku,Xu,Qu=ws.RenderStrategy|ws.Static,Ju=Ds((function(e,n){var r,i=e.open,o=e.onClose,a=e.initialFocus,l=e.__demoMode,s=void 0!==l&&l,u=$(e,zu),d=t.useState(0),p=d[0],f=d[1],m=Iu();void 0===i&&null!==m&&(i=ys(m,((r={})[Tu.Open]=!0,r[Tu.Closed]=!1,r)));var h=t.useRef(new Set),v=t.useRef(null),g=Ns(v,n),b=t.useRef(null),x=su(v),y=e.hasOwnProperty("open")||null!==m,w=e.hasOwnProperty("onClose");if(!y&&!w)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!y)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!w)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof i)throw new Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: "+i);if("function"!=typeof o)throw new Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: "+o);var C=i?Mu.Open:Mu.Closed,j=t.useReducer(Wu,{titleId:null,descriptionId:null,panelRef:t.createRef()}),S=j[0],F=j[1],k=Rs((function(){return o(!1)})),T=Rs((function(e){return F({type:Nu.SetTitleId,id:e})})),A=!!qs()&&!s&&C===Mu.Open,D=p>1,I=null!==t.useContext(qu),P=D?"parent":"leaf";!function(e,t){void 0===t&&(t=!0),Es((function(){if(t&&e.current){var n=e.current,r=Qs(n);if(r){mu.add(n);for(var i,o=te(hu.keys());!(i=o()).done;){var a=i.value;a.contains(n)&&(gu(a),hu.delete(a))}return r.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement){for(var t,n=te(mu);!(t=n()).done;)if(e.contains(t.value))return;1===mu.size&&(hu.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),vu(e))}})),function(){if(mu.delete(n),mu.size>0)r.querySelectorAll("body > *").forEach((function(e){if(e instanceof HTMLElement&&!hu.has(e)){for(var t,n=te(mu);!(t=n()).done;)if(e.contains(t.value))return;hu.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),vu(e)}}));else for(var e,t=te(hu.keys());!(e=t()).done;){var i=e.value;gu(i),hu.delete(i)}}}}}),[t])}(v,!!D&&A),function(e,n,r){void 0===r&&(r=!0);var i=t.useRef(!1);function o(t,r){if(i.current&&!t.defaultPrevented){var o=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e),a=r(t);if(null!==a&&a.getRootNode().contains(a)){for(var l,s=te(o);!(l=s()).done;){var u=l.value;if(null!==u){var d=u instanceof HTMLElement?u:u.current;if(null!=d&&d.contains(a))return}}var c,p,f,m;return void 0===(p=eu.Loose)&&(p=eu.Strict),(c=a)!==(null==(f=Qs(c))?void 0:f.body)&&ys(p,((m={})[eu.Strict]=function(){return c.matches(tu)},m[eu.Loose]=function(){for(var e=c;null!==e;){if(e.matches(tu))return!0;e=e.parentElement}return!1},m))||-1===a.tabIndex||t.preventDefault(),n(t,a)}}}t.useEffect((function(){requestAnimationFrame((function(){i.current=r}))}),[r]);var a=t.useRef(null);Lu("mousedown",(function(e){var t;i.current&&(a.current=(null==e.composedPath||null==(t=e.composedPath())?void 0:t[0])||e.target)}),!0),Lu("click",(function(e){a.current&&(o(e,(function(){return a.current})),a.current=null)}),!0),Lu("blur",(function(e){return o(e,(function(){return window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null}))}),!0)}((function(){var e,t,n=Array.from(null!=(e=null==x?void 0:x.querySelectorAll("body > *, [data-headlessui-portal]"))?e:[]).filter((function(e){return e instanceof HTMLElement&&!e.contains(b.current)&&(!S.panelRef.current||!e.contains(S.panelRef.current))}));return[].concat(n,[null!=(t=S.panelRef.current)?t:v.current])}),k,A&&!D),uu(null==x?void 0:x.defaultView,"keydown",(function(e){e.defaultPrevented||e.key===Ls.Escape&&C===Mu.Open&&(D||(e.preventDefault(),e.stopPropagation(),k()))})),function(e,n){t.useEffect((function(){var t;if(n&&e){var r=Xs(),i=e.documentElement,o=(null!=(t=e.defaultView)?t:window).innerWidth-i.clientWidth;if(l(i,"overflow","hidden"),o>0&&l(i,"paddingRight",o-(i.clientWidth-i.offsetWidth)+"px"),/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0){var a=window.pageYOffset;l(i,"position","fixed"),l(i,"marginTop","-"+a+"px"),l(i,"width","100%"),r.add((function(){return window.scrollTo(0,a)}))}return r.dispose}function l(e,t,n){var i,o=e.style.getPropertyValue(t);return Object.assign(e.style,((i={})[t]=n,i)),r.add((function(){var n;Object.assign(e.style,((n={})[t]=o,n))}))}}),[e,n])}(x,C===Mu.Open&&!I),t.useEffect((function(){if(C===Mu.Open&&v.current){var e=new IntersectionObserver((function(e){for(var t,n=te(e);!(t=n()).done;){var r=t.value;0===r.boundingClientRect.x&&0===r.boundingClientRect.y&&0===r.boundingClientRect.width&&0===r.boundingClientRect.height&&k()}}));return e.observe(v.current),function(){return e.disconnect()}}}),[C,v,k]);var _=function(){var e=t.useState([]),n=e[0],r=e[1];return[n.length>0?n.join(" "):void 0,t.useMemo((function(){return function(e){var n=Rs((function(e){return r((function(t){return[].concat(t,[e])})),function(){return r((function(t){var n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))}})),i=t.useMemo((function(){return{register:n,slot:e.slot,name:e.name,props:e.props}}),[n,e.slot,e.name,e.props]);return c.jsx(Fu.Provider,{value:i,children:e.children})}}),[r])]}(),E=_[0],O=_[1],L="headlessui-dialog-"+Ys(),R=t.useMemo((function(){return[{dialogState:C,close:k,setTitleId:T},S]}),[C,S,k,T]),M=t.useMemo((function(){return{open:C===Mu.Open}}),[C]),N={ref:g,id:L,role:"dialog","aria-modal":C===Mu.Open||void 0,"aria-labelledby":S.titleId,"aria-describedby":E};return c.jsxs(Ou,{type:"Dialog",enabled:C===Mu.Open,element:v,onUpdate:Rs((function(e,t,n){var r;"Dialog"===t&&ys(e,((r={})[_u.Add]=function(){h.current.add(n),f((function(e){return e+1}))},r[_u.Remove]=function(){h.current.add(n),f((function(e){return e-1}))},r))})),children:[c.jsx(xs,{force:!0,children:c.jsx(Su,{children:c.jsx(qu.Provider,{value:R,children:c.jsx(Su.Group,{target:v,children:c.jsx(xs,{force:!1,children:c.jsx(O,{slot:M,name:"Dialog.Description",children:c.jsx(fu,{initialFocus:a,containers:h,features:A?ys(P,{parent:fu.features.RestoreFocus,leaf:fu.features.All&~fu.features.FocusLock}):fu.features.None,children:ks({ourProps:N,theirProps:u,slot:M,defaultTag:"div",features:Qu,visible:C===Mu.Open,name:"Dialog"})})})})})})})}),c.jsx(Gs,{features:Hs.Hidden,ref:b})]})})),Zu=Ds((function(e,n){var r=Vu("Dialog.Overlay")[0],i=r.dialogState,o=r.close;return ks({ourProps:{ref:Ns(n),id:"headlessui-dialog-overlay-"+Ys(),"aria-hidden":!0,onClick:Rs((function(e){if(e.target===e.currentTarget){if(function(e){for(var t,n,r=e.parentElement,i=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(i=r),r=r.parentElement;var o=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!o||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(i))&&o}(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),o()}}))},theirProps:e,slot:t.useMemo((function(){return{open:i===Mu.Open}}),[i]),defaultTag:"div",name:"Dialog.Overlay"})})),$u=Object.assign(Ju,{Backdrop:Ds((function(e,n){var r=Vu("Dialog.Backdrop"),i=r[0].dialogState,o=r[1],a=Ns(n),l="headlessui-dialog-backdrop-"+Ys();t.useEffect((function(){if(null===o.panelRef.current)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")}),[o.panelRef]);var s=t.useMemo((function(){return{open:i===Mu.Open}}),[i]);return c.jsx(xs,{force:!0,children:c.jsx(Su,{children:ks({ourProps:{ref:a,id:l,"aria-hidden":!0},theirProps:e,slot:s,defaultTag:"div",name:"Dialog.Backdrop"})})})})),Panel:Ds((function(e,n){var r=Vu("Dialog.Panel"),i=r[0].dialogState,o=Ns(n,r[1].panelRef),a="headlessui-dialog-panel-"+Ys(),l=t.useMemo((function(){return{open:i===Mu.Open}}),[i]);return ks({ourProps:{ref:o,id:a,onClick:Rs((function(e){e.stopPropagation()}))},theirProps:e,slot:l,defaultTag:"div",name:"Dialog.Panel"})})),Overlay:Zu,Title:Ds((function(e,n){var r=Vu("Dialog.Title")[0],i=r.dialogState,o=r.setTitleId,a="headlessui-dialog-title-"+Ys(),l=Ns(n);t.useEffect((function(){return o(a),function(){return o(null)}}),[a,o]);var s=t.useMemo((function(){return{open:i===Mu.Open}}),[i]);return ks({ourProps:{ref:l,id:a},theirProps:e,slot:s,defaultTag:"h2",name:"Dialog.Title"})})),Description:Au});function ed(e){var t;if(e.type)return e.type;var n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function td(e,n){var r=t.useState((function(){return ed(e)})),i=r[0],o=r[1];return Es((function(){o(ed(e))}),[e.type,e.as]),Es((function(){i||n.current&&n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")}),[i,n]),i}function nd(e){var n=e.onFocus,r=t.useState(!0),i=r[1];return r[0]?c.jsx(Gs,{as:"button",type:"button",features:Hs.Focusable,onFocus:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){var t;e.preventDefault();var r=50;t=requestAnimationFrame((function e(){if(!(r--<=0))return n()?(i(!1),void cancelAnimationFrame(t)):void(t=requestAnimationFrame(e));t&&cancelAnimationFrame(t)}))}))}):null}!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Yu||(Yu={})),function(e){e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.LinkPanel=4]="LinkPanel",e[e.UnlinkPanel=5]="UnlinkPanel"}(Uu||(Uu={})),(Hu={})[Uu.ToggleDisclosure]=function(e){var t;return U({},e,{disclosureState:ys(e.disclosureState,(t={},t[Yu.Open]=Yu.Closed,t[Yu.Closed]=Yu.Open,t))})},Hu[Uu.CloseDisclosure]=function(e){return e.disclosureState===Yu.Closed?e:U({},e,{disclosureState:Yu.Closed})},Hu[Uu.LinkPanel]=function(e){return!0===e.linkedPanel?e:U({},e,{linkedPanel:!0})},Hu[Uu.UnlinkPanel]=function(e){return!1===e.linkedPanel?e:U({},e,{linkedPanel:!1})},Hu[Uu.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:U({},e,{buttonId:t.buttonId})},Hu[Uu.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:U({},e,{panelId:t.panelId})},t.createContext(null).displayName="DisclosureContext",t.createContext(null).displayName="DisclosureAPIContext",t.createContext(null).displayName="DisclosurePanelContext",function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(Ku||(Ku={})),function(e){e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId"}(Xu||(Xu={})),(Gu={})[Xu.TogglePopover]=function(e){var t;return U({},e,{popoverState:ys(e.popoverState,(t={},t[Ku.Open]=Ku.Closed,t[Ku.Closed]=Ku.Open,t))})},Gu[Xu.ClosePopover]=function(e){return e.popoverState===Ku.Closed?e:U({},e,{popoverState:Ku.Closed})},Gu[Xu.SetButton]=function(e,t){return e.button===t.button?e:U({},e,{button:t.button})},Gu[Xu.SetButtonId]=function(e,t){return e.buttonId===t.buttonId?e:U({},e,{buttonId:t.buttonId})},Gu[Xu.SetPanel]=function(e,t){return e.panel===t.panel?e:U({},e,{panel:t.panel})},Gu[Xu.SetPanelId]=function(e,t){return e.panelId===t.panelId?e:U({},e,{panelId:t.panelId})},t.createContext(null).displayName="PopoverContext",t.createContext(null).displayName="PopoverAPIContext",t.createContext(null).displayName="PopoverGroupContext",t.createContext(null).displayName="PopoverPanelContext",t.createContext(null).displayName="GroupContext";var rd,id,od=["defaultIndex","vertical","manual","onChange","selectedIndex"];!function(e){e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel"}(id||(id={}));var ad=((rd={})[id.SetSelectedIndex]=function(e,t){var n=e.tabs.filter((function(e){var t;return!(null!=(t=e.current)&&t.hasAttribute("disabled"))}));if(t.index<0)return U({},e,{selectedIndex:e.tabs.indexOf(n[0])});if(t.index>e.tabs.length)return U({},e,{selectedIndex:e.tabs.indexOf(n[n.length-1])});var r=e.tabs.slice(0,t.index),i=e.tabs.slice(t.index),o=[].concat(i,r).find((function(e){return n.includes(e)}));return o?U({},e,{selectedIndex:e.tabs.indexOf(o)}):e},rd[id.RegisterTab]=function(e,t){var n;if(e.tabs.includes(t.tab))return e;var r=e.tabs[e.selectedIndex],i=ou([].concat(e.tabs,[t.tab]),(function(e){return e.current})),o=null!=(n=i.indexOf(r))?n:e.selectedIndex;return-1===o&&(o=e.selectedIndex),U({},e,{tabs:i,selectedIndex:o})},rd[id.UnregisterTab]=function(e,t){return U({},e,{tabs:e.tabs.filter((function(e){return e!==t.tab}))})},rd[id.RegisterPanel]=function(e,t){return e.panels.includes(t.panel)?e:U({},e,{panels:ou([].concat(e.panels,[t.panel]),(function(e){return e.current}))})},rd[id.UnregisterPanel]=function(e,t){return U({},e,{panels:e.panels.filter((function(e){return e!==t.panel}))})},rd),ld=t.createContext(null);function sd(e){var n=t.useContext(ld);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,sd),r}return n}ld.displayName="TabsSSRContext";var ud=t.createContext(null);function dd(e){var n=t.useContext(ud);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,dd),r}return n}ud.displayName="TabsDataContext";var cd=t.createContext(null);function pd(e){var n=t.useContext(cd);if(null===n){var r=new Error("<"+e+" /> is missing a parent <Tab.Group /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,pd),r}return n}function fd(e,t){return ys(t.type,ad,e,t)}cd.displayName="TabsActionsContext";var md,hd=t.Fragment,vd=Ds((function(e,n){var r=e.defaultIndex,i=void 0===r?0:r,o=e.vertical,a=void 0!==o&&o,l=e.manual,s=void 0!==l&&l,u=e.onChange,d=e.selectedIndex,p=void 0===d?null:d,f=$(e,od),m=a?"vertical":"horizontal",h=s?"manual":"auto",v=null!==p,g=Ns(n),b=t.useReducer(fd,{selectedIndex:null!=p?p:i,tabs:[],panels:[]}),x=b[0],y=b[1],w=t.useMemo((function(){return{selectedIndex:x.selectedIndex}}),[x.selectedIndex]),C=Os(u||function(){}),j=Os(x.tabs),S=t.useMemo((function(){return U({orientation:m,activation:h},x)}),[m,h,x]),F=Os(v?e.selectedIndex:x.selectedIndex),k=t.useMemo((function(){return{registerTab:function(e){return y({type:id.RegisterTab,tab:e}),function(){return y({type:id.UnregisterTab,tab:e})}},registerPanel:function(e){return y({type:id.RegisterPanel,panel:e}),function(){return y({type:id.UnregisterPanel,panel:e})}},change:function(e){F.current!==e&&C.current(e),v||y({type:id.SetSelectedIndex,index:e})}}}),[y,v]);Es((function(){y({type:id.SetSelectedIndex,index:null!=p?p:i})}),[p]);var T=t.useRef({tabs:[],panels:[]}),A={ref:g};return c.jsx(ld.Provider,{value:T,children:c.jsx(cd.Provider,{value:k,children:c.jsxs(ud.Provider,{value:S,children:[S.tabs.length<=0&&c.jsx(nd,{onFocus:function(){for(var e,t=te(j.current);!(e=t()).done;){var n,r,i=e.value;if(0===(null==(n=i.current)?void 0:n.tabIndex))return null==(r=i.current)||r.focus(),!0}return!1}}),ks({ourProps:A,theirProps:f,slot:w,defaultTag:hd,name:"Tabs"})]})})})})),gd=Ds((function(e,t){var n=dd("Tab.List"),r=n.orientation,i=n.selectedIndex;return ks({ourProps:{ref:Ns(t),role:"tablist","aria-orientation":r},theirProps:e,slot:{selectedIndex:i},defaultTag:"div",name:"Tabs.List"})})),bd=ws.RenderStrategy|ws.Static,xd=Object.assign(Ds((function(e,n){var r,i,o="headlessui-tabs-tab-"+Ys(),a=dd("Tab"),l=a.orientation,s=a.activation,u=a.selectedIndex,d=a.tabs,c=a.panels,p=pd("Tab"),f=dd("Tab"),m=sd("Tab"),h=t.useRef(null),v=Ns(h,n);Es((function(){return p.registerTab(h)}),[p,h]);var g=m.current.tabs.indexOf(o);-1===g&&(g=m.current.tabs.push(o)-1);var b=d.indexOf(h);-1===b&&(b=g);var x=b===u,y=Rs((function(e){var t=e();if(t===Zs.Success&&"auto"===s){var n,r=null==(n=Qs(h))?void 0:n.activeElement,i=f.tabs.findIndex((function(e){return e.current===r}));-1!==i&&p.change(i)}return t})),w=Rs((function(e){var t=d.map((function(e){return e.current})).filter(Boolean);if(e.key===Ls.Space||e.key===Ls.Enter)return e.preventDefault(),e.stopPropagation(),void p.change(b);switch(e.key){case Ls.Home:case Ls.PageUp:return e.preventDefault(),e.stopPropagation(),y((function(){return au(t,Js.First)}));case Ls.End:case Ls.PageDown:return e.preventDefault(),e.stopPropagation(),y((function(){return au(t,Js.Last)}))}return y((function(){return ys(l,{vertical:function(){return e.key===Ls.ArrowUp?au(t,Js.Previous|Js.WrapAround):e.key===Ls.ArrowDown?au(t,Js.Next|Js.WrapAround):Zs.Error},horizontal:function(){return e.key===Ls.ArrowLeft?au(t,Js.Previous|Js.WrapAround):e.key===Ls.ArrowRight?au(t,Js.Next|Js.WrapAround):Zs.Error}})}))===Zs.Success?e.preventDefault():void 0})),C=t.useRef(!1),j=Rs((function(){var e;C.current||(C.current=!0,null==(e=h.current)||e.focus(),p.change(b),Ks((function(){C.current=!1})))})),S=Rs((function(e){e.preventDefault()})),F=t.useMemo((function(){return{selected:x}}),[x]),k=e;return ks({ourProps:{ref:v,onKeyDown:w,onMouseDown:S,onClick:j,id:o,role:"tab",type:td(e,h),"aria-controls":null==(r=c[b])||null==(i=r.current)?void 0:i.id,"aria-selected":x,tabIndex:x?0:-1},theirProps:k,slot:F,defaultTag:"button",name:"Tabs.Tab"})})),{Group:vd,List:gd,Panels:Ds((function(e,n){var r=dd("Tab.Panels").selectedIndex;return ks({ourProps:{ref:Ns(n)},theirProps:e,slot:t.useMemo((function(){return{selectedIndex:r}}),[r]),defaultTag:"div",name:"Tabs.Panels"})})),Panel:Ds((function(e,n){var r,i,o,a,l=dd("Tab.Panel"),s=l.selectedIndex,u=l.tabs,d=l.panels,p=pd("Tab.Panel"),f=sd("Tab.Panel"),m="headlessui-tabs-panel-"+Ys(),h=t.useRef(null),v=Ns(h,n);Es((function(){return p.registerPanel(h)}),[p,h]);var g=f.current.panels.indexOf(m);-1===g&&(g=f.current.panels.push(m)-1);var b=d.indexOf(h);-1===b&&(b=g);var x=b===s,y=t.useMemo((function(){return{selected:x}}),[x]),w={ref:v,id:m,role:"tabpanel","aria-labelledby":null==(r=u[b])||null==(i=r.current)?void 0:i.id,tabIndex:x?0:-1};return x||null!=(o=e.unmount)&&!o||null!=(a=e.static)&&a?ks({ourProps:w,theirProps:e,slot:y,defaultTag:"div",features:bd,visible:x,name:"Tabs.Panel"}):c.jsx(Gs,U({as:"span"},w))}))});function yd(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function wd(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function Cd(){var e=t.useState(Xs)[0];return t.useEffect((function(){return function(){return e.dispose()}}),[e]),e}!function(e){e.Ended="ended",e.Cancelled="cancelled"}(md||(md={}));var jd=["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"],Sd=["show","appear","unmount"];function Fd(e){return void 0===e&&(e=""),e.split(" ").filter((function(e){return e.trim().length>1}))}var kd,Td=t.createContext(null);Td.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(kd||(kd={}));var Ad=t.createContext(null);function Dd(e){return"children"in e?Dd(e.children):e.current.filter((function(e){return null!==e.el.current})).filter((function(e){return e.state===kd.Visible})).length>0}function Id(e,n){var r=Os(e),i=t.useRef([]),o=lu(),a=Cd(),l=Rs((function(e,t){var n;void 0===t&&(t=Cs.Hidden);var l=i.current.findIndex((function(t){return t.el===e}));-1!==l&&(ys(t,((n={})[Cs.Unmount]=function(){i.current.splice(l,1)},n[Cs.Hidden]=function(){i.current[l].state=kd.Hidden},n)),a.microTask((function(){!Dd(i)&&o.current&&(null==r.current||r.current())})))})),s=Rs((function(e){var t=i.current.find((function(t){return t.el===e}));return t?t.state!==kd.Visible&&(t.state=kd.Visible):i.current.push({el:e,state:kd.Visible}),function(){return l(e,Cs.Unmount)}})),u=t.useRef([]),d=t.useRef(Promise.resolve()),c=t.useRef({enter:[],leave:[],idle:[]}),p=Rs((function(e,t,r){u.current.splice(0),n&&(n.chains.current[t]=n.chains.current[t].filter((function(t){return t[0]!==e}))),null==n||n.chains.current[t].push([e,new Promise((function(e){u.current.push(e)}))]),null==n||n.chains.current[t].push([e,new Promise((function(e){Promise.all(c.current[t].map((function(e){return e[1]}))).then((function(){return e()}))}))]),"enter"===t?d.current=d.current.then((function(){return null==n?void 0:n.wait.current})).then((function(){return r(t)})):r(t)})),f=Rs((function(e,t,n){Promise.all(c.current[t].splice(0).map((function(e){return e[1]}))).then((function(){var e;null==(e=u.current.shift())||e()})).then((function(){return n(t)}))}));return t.useMemo((function(){return{children:i,register:s,unregister:l,onStart:p,onStop:f,wait:d,chains:c}}),[s,l,i,p,f,c,d])}function Pd(){}Ad.displayName="NestingContext";var _d=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Ed(e){for(var t={},n=0,r=_d;n<r.length;n++){var i,o=r[n];t[o]=null!=(i=e[o])?i:Pd}return t}var Od=ws.RenderStrategy,Ld=Ds((function(e,n){var r,i=e.beforeEnter,o=e.afterEnter,a=e.beforeLeave,l=e.afterLeave,s=e.enter,u=e.enterFrom,d=e.enterTo,p=e.entered,f=e.leave,m=e.leaveFrom,h=e.leaveTo,v=$(e,jd),g=t.useRef(null),b=Ns(g,n),x=v.unmount?Cs.Unmount:Cs.Hidden,y=function(){var e=t.useContext(Td);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),w=y.show,C=y.appear,j=y.initial,S=t.useState(w?kd.Visible:kd.Hidden),F=S[0],k=S[1],T=function(){var e=t.useContext(Ad);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),A=T.register,D=T.unregister,I=t.useRef(null);t.useEffect((function(){return A(g)}),[A,g]),t.useEffect((function(){var e;if(x===Cs.Hidden&&g.current){if(!w||F===kd.Visible)return ys(F,((e={})[kd.Hidden]=function(){return D(g)},e[kd.Visible]=function(){return A(g)},e));k(kd.Visible)}}),[F,g,A,D,w,x]);var P=Os({enter:Fd(s),enterFrom:Fd(u),enterTo:Fd(d),entered:Fd(p),leave:Fd(f),leaveFrom:Fd(m),leaveTo:Fd(h)}),_=function(e){var n=t.useRef(Ed(e));return t.useEffect((function(){n.current=Ed(e)}),[e]),n}({beforeEnter:i,afterEnter:o,beforeLeave:a,afterLeave:l}),E=qs();t.useEffect((function(){if(E&&F===kd.Visible&&null===g.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[g,F,E]);var O=j&&!C,L=E?O||I.current===w?"idle":w?"enter":"leave":"idle",R=Rs((function(e){return ys(e,{enter:function(){return _.current.beforeEnter()},leave:function(){return _.current.beforeLeave()},idle:function(){}})})),M=Rs((function(e){return ys(e,{enter:function(){return _.current.afterEnter()},leave:function(){return _.current.afterLeave()},idle:function(){}})})),N=Id((function(){k(kd.Hidden),D(g)}),T);!function(e){var t=e.container,n=e.direction,r=e.classes,i=e.onStart,o=e.onStop,a=lu(),l=Cd(),s=Os(n);Es((function(){var e=Xs();l.add(e.dispose);var n=t.current;if(n&&"idle"!==s.current&&a.current)return e.dispose(),i.current(s.current),e.add(function(e,t,n,r){var i=n?"enter":"leave",o=Xs(),a=void 0!==r?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(r):function(){};"enter"===i&&(e.removeAttribute("hidden"),e.style.display="");var l=ys(i,{enter:function(){return t.enter},leave:function(){return t.leave}}),s=ys(i,{enter:function(){return t.enterTo},leave:function(){return t.leaveTo}}),u=ys(i,{enter:function(){return t.enterFrom},leave:function(){return t.leaveFrom}});return wd.apply(void 0,[e].concat(t.enter,t.enterTo,t.enterFrom,t.leave,t.leaveFrom,t.leaveTo,t.entered)),yd.apply(void 0,[e].concat(l,u)),o.nextFrame((function(){wd.apply(void 0,[e].concat(u)),yd.apply(void 0,[e].concat(s)),function(e,t){var n=Xs();if(!e)return n.dispose;var r=getComputedStyle(e),i=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t}));if(0!==i[0]+i[1]){var o=[];o.push(n.addEventListener(e,"transitionrun",(function(r){r.target===r.currentTarget&&(o.splice(0).forEach((function(e){return e()})),o.push(n.addEventListener(e,"transitionend",(function(e){e.target===e.currentTarget&&(t(md.Ended),o.splice(0).forEach((function(e){return e()})))})),n.addEventListener(e,"transitioncancel",(function(e){e.target===e.currentTarget&&(t(md.Cancelled),o.splice(0).forEach((function(e){return e()})))}))))})))}else t(md.Ended);n.add((function(){return t(md.Cancelled)}))}(e,(function(n){return n===md.Ended&&(wd.apply(void 0,[e].concat(l)),yd.apply(void 0,[e].concat(t.entered))),a(n)}))})),o.dispose}(n,r.current,"enter"===s.current,(function(t){var n;e.dispose(),ys(t,((n={})[md.Ended]=function(){o.current(s.current)},n[md.Cancelled]=function(){},n))}))),e.dispose}),[n])}({container:g,classes:P,direction:L,onStart:Os((function(e){N.onStart(g,e,R)})),onStop:Os((function(e){N.onStop(g,e,M),"leave"!==e||Dd(N)||(k(kd.Hidden),D(g))}))}),t.useEffect((function(){O&&(I.current=x===Cs.Hidden?null:w)}),[w,O,F]);var z=v,B={ref:b};return c.jsx(Ad.Provider,{value:N,children:c.jsx(Pu,{value:ys(F,(r={},r[kd.Visible]=Tu.Open,r[kd.Hidden]=Tu.Closed,r)),children:ks({ourProps:B,theirProps:z,defaultTag:"div",features:Od,visible:F===kd.Visible,name:"Transition.Child"})})})})),Rd=Ds((function(e,n){var r=e.show,i=e.appear,o=void 0!==i&&i,a=e.unmount,l=$(e,Sd),s=t.useRef(null),u=Ns(s,n);qs();var d,p=Iu();if(void 0===r&&null!==p&&(r=ys(p,((d={})[Tu.Open]=!0,d[Tu.Closed]=!1,d))),![!0,!1].includes(r))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var f=t.useState(r?kd.Visible:kd.Hidden),m=f[0],h=f[1],v=Id((function(){h(kd.Hidden)})),g=t.useState(!0),b=g[0],x=g[1],y=t.useRef([r]);Es((function(){!1!==b&&y.current[y.current.length-1]!==r&&(y.current.push(r),x(!1))}),[y,r]);var w=t.useMemo((function(){return{show:r,appear:o,initial:b}}),[r,o,b]);t.useEffect((function(){if(r)h(kd.Visible);else if(Dd(v)){var e=s.current;if(!e)return;var t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&h(kd.Hidden)}else h(kd.Hidden)}),[r,v]);var C={unmount:a};return c.jsx(Ad.Provider,{value:v,children:c.jsx(Td.Provider,{value:w,children:ks({ourProps:U({},C,{as:t.Fragment,children:c.jsx(Ld,U({ref:u},C,l))}),theirProps:{},defaultTag:t.Fragment,features:Od,visible:m===kd.Visible,name:"Transition"})})})})),Md=Object.assign(Rd,{Child:Ds((function(e,n){var r=null!==t.useContext(Td),i=null!==Iu();return c.jsx(c.Fragment,{children:c.jsx(!r&&i?Rd:Ld,U({ref:n},e))})})),Root:Rd}),Nd=function(e){var t,n,r,i,o,a,l,s;return pa(U({padding:null==e?void 0:e.padding,paddingTop:null!=(t=null==e?void 0:e.paddingTop)?t:null==e?void 0:e.paddingY,paddingLeft:null!=(n=null==e?void 0:e.paddingLeft)?n:null==e?void 0:e.paddingX,paddingRight:null!=(r=null==e?void 0:e.paddingRight)?r:null==e?void 0:e.paddingX,paddingBottom:null!=(i=null==e?void 0:e.paddingBottom)?i:null==e?void 0:e.paddingY,marginTop:null!=(o=null==e?void 0:e.marginTop)?o:null==e?void 0:e.marginY,marginBottom:null!=(a=null==e?void 0:e.marginBottom)?a:null==e?void 0:e.marginY,marginRight:null!=(l=null==e?void 0:e.marginRight)?l:null==e?void 0:e.marginX,marginLeft:null!=(s=null==e?void 0:e.marginLeft)?s:null==e?void 0:e.marginX,margin:null==e?void 0:e.margin,position:null==e?void 0:e.position,overflowX:null==e?void 0:e.overflowX,overflowY:null==e?void 0:e.overflowY,width:null==e?void 0:e.width,gridRow:null==e?void 0:e.gridRow,gridColumn:null==e?void 0:e.gridColumn,height:null==e?void 0:e.height,overflow:null==e?void 0:e.overflow,flex:null==e?void 0:e.flex,flexGrow:null==e?void 0:e.flexGrow,maxWidth:null==e?void 0:e.maxWidth,maxHeight:null==e?void 0:e.maxHeight,minHeight:null==e?void 0:e.minHeight,minWidth:null==e?void 0:e.minWidth,overflowWrap:null!=e&&e.textWrap?"break-word":void 0,wordWrap:null!=e&&e.textWrap?"break-word":void 0,wordBreak:null!=e&&e.textWrap?"break-word":void 0,hyphens:null!=e&&e.hyphens&&null!=e&&e.textWrap?"auto":void 0,alignSelf:null==e?void 0:e.alignSelf,border:null==e?void 0:e.border,textAlign:null==e?void 0:e.textAlign,display:null==e?void 0:e.display,listStyle:null==e?void 0:e.listStyle,right:null==e?void 0:e.right,top:null==e?void 0:e.top,left:null==e?void 0:e.left},function(e){var t={};return null!=e&&e.mdWidth&&(t=U({},t,{"@media (max-width: 1366px)":{width:null==e?void 0:e.mdWidth}})),null!=e&&e.smWidth&&(t=U({},t,{"@media (max-width: 920px)":{width:null==e?void 0:e.smWidth}})),t}(e)))},zd=function(e){var t,n,r,i,o,a,l,s=null!=(t=null==(n=e)?void 0:n.as)?t:"div";return"fieldset"===e.as&&(e=U({padding:0,border:0,marginY:0,marginX:0},e)),c.jsx(s,{className:Zl(""+Nd(e),null==(r=e)?void 0:r.className),"data-component":null!=(i=null==(o=e)?void 0:o["data-component"])?i:"View","data-themeapi":null==(a=e)?void 0:a["data-themeapi"],children:null==(l=e)?void 0:l.children})},Bd=function(e){var n=e.width,r=void 0===n?160:n,i=t.useRef(null);function o(){null==e||e.onClose()}ns(i,(function(){return null==e?void 0:e.onClose()})),t.useEffect((function(){return window.addEventListener("scroll",o),function(){return window.removeEventListener("scroll",o)}}),[]),t.useEffect((function(){return window.addEventListener("resize",o),function(){window.removeEventListener("resize",o)}}),[]);var a=rs();return null!=e&&e.position?c.jsx(xs,{force:!0,children:c.jsx(Su,{children:c.jsx("div",{style:Vd(r,null==e?void 0:e.position,null==e?void 0:e.align),"data-component":"popover-menu-container",ref:i,className:ts.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})})}):c.jsx("div",{className:ts.container(null==a?void 0:a.popoverMenu)+" vizzly-popover","data-themeapi":"popoverMenu",children:null==e?void 0:e.children})},qd=Object.assign(Bd,{Options:function(e){return c.jsx(es,{rows:["auto"],gap:"0.5rem",children:c.jsx(zd,{paddingY:null!=e&&e.padding?"0.5rem":void 0,children:null==e?void 0:e.children})})},Option:function(e){var t=rs();return c.jsx("li",{className:""+ts.option(null==t?void 0:t.popoverMenu)({clickable:(null==e?void 0:e.onChange)&&"true"}),"data-testid":null==e?void 0:e.testId,onClick:function(){return(null==e?void 0:e.onChange)&&(null==e?void 0:e.onChange())},role:(null==e?void 0:e.onChange)&&"button",children:null==e?void 0:e.children})},Container:Bd,DisplayWrapper:function(e){var t=e.width,n=void 0===t?160:t,r=rs();return c.jsx("div",{className:""+ts.container(null==r?void 0:r.popoverMenu),style:{width:n},children:null==e?void 0:e.children})}});function Vd(e,t,n){var r,i=null!=(r=null==t?void 0:t.left)?r:0,o=t||{},a=o.left,l=void 0===a?0:a,s=o.top,u=o.width,d=void 0===u?0:u,c=o.height,p=(void 0===s?0:s)+(void 0===c?0:c)+window.pageYOffset;return{position:"absolute",left:"right"===n?i+e>window.innerWidth?l-d:l:l<e?l-d:l-e+d,top:p,width:e}}function Wd(){var e=t.useState(!1),r=e[0],i=e[1],o=t.useState(void 0),a=o[0],l=o[1],s=n.useRef(null);return{ref:s,show:r,position:a,close:function(){return i(!1)},open:function(){i(!r),s.current&&l(s.current.getBoundingClientRect())}}}var Hd={convert:!1,stripUnknown:!0},Yd=function(e,n){var r=t.useState(""),i=r[0],o=r[1];return""==i?{values:e.map((function(e,t){return{item:e,refIndex:t}})),searchString:i,setSearch:o}:{values:new h([].concat(e),{keys:n,useExtendedSearch:!0}).search(i),setSearch:o,searchString:i}},Ud=function(e){var t,n,r,i,o;return pa({width:null!=(t=null==e?void 0:e.width)?t:"100%",maxWidth:null==e?void 0:e.maxWidth,minWidth:null==e?void 0:e.minWidth,height:null==e?void 0:e.height,display:"flex",alignItems:null==e?void 0:e.alignItems,gridRow:null==e?void 0:e.gridRow,gridColumn:null==e?void 0:e.gridColumn,padding:null==e?void 0:e.padding,paddingTop:null!=(n=null==e?void 0:e.paddingTop)?n:null==e?void 0:e.paddingY,paddingLeft:null!=(r=null==e?void 0:e.paddingLeft)?r:null==e?void 0:e.paddingX,paddingRight:null!=(i=null==e?void 0:e.paddingRight)?i:null==e?void 0:e.paddingX,paddingBottom:null!=(o=null==e?void 0:e.paddingBottom)?o:null==e?void 0:e.paddingY,margin:null==e?void 0:e.margin,gap:null==e?void 0:e.gap,rowGap:null==e?void 0:e.rowGap,columnGap:null==e?void 0:e.columnGap,flexWrap:null!=e&&e.wrap?"wrap":void 0,flex:null==e?void 0:e.flex,flexDirection:null==e?void 0:e.direction,justifyContent:null==e?void 0:e.justifyContent,cursor:null==e?void 0:e.cursor,overflow:null==e?void 0:e.overflow,border:null==e?void 0:e.border,minHeight:null==e?void 0:e.minHeight,position:null==e?void 0:e.position,flexGrow:null==e?void 0:e.grow,maxHeight:null==e?void 0:e.maxHeight,alignContent:null==e?void 0:e.alignContent,placeContent:null==e?void 0:e.placeContent,placeItems:null==e?void 0:e.placeItems,justifyItems:null==e?void 0:e.justifyItems,alignSelf:null==e?void 0:e.alignSelf})},Gd=function(e){var t,n,r,i,o,a,l,s=null!=(t=null==(n=e)?void 0:n.as)?t:"div";return"fieldset"===e.as&&(e=U({padding:0,border:0,margin:0},e)),c.jsx(s,{className:Zl(""+Ud(e),null==(r=e)?void 0:r.className),"data-component":null!=(i=null==(o=e)?void 0:o["data-component"])?i:"Flex",role:null==(a=e)?void 0:a.role,children:null==(l=e)?void 0:l.children})},Kd={"&::-webkit-scrollbar":{height:8,width:8,opacity:.6},"&:active::-webkit-scrollbar-thumb":{visibility:"visible"},"&:focus::-webkit-scrollbar-thumb":{visibility:"visible"},"&:hover::-webkit-scrollbar-thumb":{visibility:"visible"},"&::-webkit-scrollbar-thumb":{backgroundColor:"rgba(142, 139, 130, 0.8)",visibility:"hidden",borderRadius:4},"&::-webkit-scrollbar-corner":{backgroundColor:"transparent"}},Xd=pa({width:"100%"}),Qd=Object.assign((function(){return null}),{wrapper:function(e){return pa(U({marginTop:8,fontSize:null==e?void 0:e.fontSize,width:"calc(100% - 2px)",position:"absolute",top:"100%",zIndex:40,overflow:"overlay",borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,color:null==e?void 0:e.color,boxShadow:null==e?void 0:e.boxShadow,border:null==e?void 0:e.border,variants:{fixedHeight:{on:{maxHeight:"20rem"}}}},Kd))},option:function(e){return pa({position:"relative",width:"100%",cursor:"pointer",borderBottom:null==e?void 0:e.separatorBorder,"&:hover":null==e?void 0:e["&:hover"]})},button:function(e){return pa({position:"relative",width:"100%",borderLeftWidth:2,borderColor:"transparent",padding:null==e?void 0:e.padding,display:"grid",gap:8,textAlign:"left",boxSizing:"border-box",variants:{selected:{on:U({fontWeight:500,gridTemplateColumns:"1fr 24px"},null==e?void 0:e.selected),off:{gridTemplateColumns:"1fr"}}}})},selectedIcon:pa({height:"1.25rem",width:"1.25rem"}),layout:Xd,subtext:pa({color:"inherit",opacity:.6})}),Jd={name:"14n397",styles:"position:relative;width:100%;cursor:pointer;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity));padding-top:0.5rem;padding-bottom:0.5rem;text-align:center;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity))"};function Zd(e,t){if(void 0!==e)return s(e).brighten(t).css()}var $d=pa({position:"relative",display:"flex",flex:1,flexDirection:"row"}),ec=pa({width:16,zIndex:999,top:0,bottom:0,left:-3,position:"absolute",alignSelf:"flex-start",cursor:"pointer"}),tc=Object.assign((function(){return null}),{itemWrapper:$d,item:function(e){var t;return pa({width:"100%",borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,boxShadow:null==e?void 0:e.boxShadow,color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,boxSizing:"border-box",variants:{highlight:{on:{border:null==e?void 0:e.border,borderColor:"rgb(187 247 208 / 0.6)"},off:{border:null==e?void 0:e.border}},componentPadding:(t={},t.true={padding:"0.5rem"},t),clickable:{on:{cursor:"pointer"}}}})},label:function(e){var t;return pa(U({},Da.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em"}))},metadata:function(e){var t;return pa(U({},Da.text,{fontSize:null!=(t=null==e?void 0:e.fontSize)?t:"0.875rem",lineHeight:"inherit",letterSpacing:"-0.05em",color:"inherit",opacity:.6}))},right:pa({display:"flex",placeContent:"center"}),edit:pa({marginRight:"0.75rem",display:"grid",placeContent:"center",color:"inherit",opacity:.5}),deleteWrapper:function(e){var t,n;return pa({position:"absolute",top:"-0.75rem",right:"-0.55rem",height:21.5,width:21.5,background:null==e||null==(t=e.icon)?void 0:t.background,border:null==e||null==(n=e.icon)?void 0:n.border,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center"})},deleteButton:function(e){var t,n;return pa(U({},Da.button,{height:16,color:null==e||null==(t=e.icon)?void 0:t.color,"&:hover":{color:Zd(null==e||null==(n=e.icon)?void 0:n.color,1.5)}}))},iconSize:pa({height:"1rem",width:"1rem"}),addWrapper:pa(U({position:"relative",width:"100%"},ca)),title:function(e){return pa(U({padding:0},ca,e))},titleContainer:function(){return pa({variants:{hasBorder:{true:{borderBottom:"2px solid #e5e7eb"}}}})},dragHandleContainer:ec}),nc=Object.assign((function(){return null}),{item:pa({opacity:.5}),string:pa({fontSize:"0.55rem",transform:"scaleX(1.2)",marginLeft:1}),bool:pa({fontSize:"0.65rem",fontWeight:"bold"}),icon:function(e){return pa({"& > *":{fill:null!=e?e:"#2d2f31"}})}}),rc=function(e){return c.jsxs(t.Fragment,{children:["number"===(null==e?void 0:e.icon)&&c.jsx(g.HashtagIcon,{width:"75%","aria-label":"Number"}),"date_time"===(null==e?void 0:e.icon)&&c.jsx(g.CalendarIcon,{width:"75%","aria-label":"Date"}),"string"===(null==e?void 0:e.icon)&&c.jsx(zd,{as:"code",children:c.jsxs(es,{columns:["1fr","1fr"],className:""+Aa.codeText,children:[c.jsx("span",{className:""+Aa.bold,"aria-label":"String",children:"A"}),c.jsx("span",{className:Zl(""+nc.string({}),""+Aa.bold),children:"A"})]})}),"string[]"===(null==e?void 0:e.icon)&&c.jsx(zd,{as:"code",className:""+Aa.codeText,children:c.jsxs(es,{columns:["1fr","1fr"],children:[c.jsx("span",{className:""+Aa.bold,"aria-label":"String",children:"A"}),c.jsx("span",{className:Zl(""+nc.string({}),""+Aa.bold),children:"[]"})]})}),"boolean"===(null==e?void 0:e.icon)&&c.jsx(zd,{as:"code",className:Zl(""+nc.bool({}),""+ic),"data-component":"true-false",children:c.jsxs(es,{columns:["1fr","1fr","1fr"],height:"20px",children:[c.jsx(zd,{alignSelf:"start",children:"T"}),c.jsx(zd,{alignSelf:"center",marginLeft:-.5,children:"/"}),c.jsx(zd,{alignSelf:"end",children:"F"})]})})]})},ic=pa({fontSize:11,lineHeight:1.3,fontFamily:Da.codeFontFamily}),oc=function(e){var t,r,i;return c.jsx(zd,{width:24,paddingTop:null!=(t=null==e?void 0:e.paddingTop)?t:"0.30rem",alignSelf:"start","data-component":"item-icon",marginLeft:-2,children:c.jsxs(Gd,{justifyContent:"center",alignItems:"center",className:""+nc.item,paddingTop:null!=(r=null==e?void 0:e.flexPaddingTop)?r:"0.10rem",children:[(i=null==e?void 0:e.icon,n.isValidElement(i)&&c.jsx(ac,{icon:null==e?void 0:e.icon,width:null==e?void 0:e.iconWidth})),c.jsx(rc,{icon:null==e?void 0:e.icon})]})})},ac=function(e){var t,n,r=rs();return c.jsx(zd,{width:null!=(t=null==e?void 0:e.width)?t:"75%",className:""+nc.icon(null==r||null==(n=r.charts)?void 0:n.iconColor),"data-themeapi":"charts.iconColor",children:null==e?void 0:e.icon})},lc={name:"1gp9wld",styles:"height:1.25rem;width:1.25rem"},sc=Object.assign((function(e){var n=rs();return c.jsx(t.Fragment,{children:(null==e?void 0:e.open)&&c.jsx("div",{className:""+Qd.wrapper(null==n?void 0:n.dropdowns)({fixedHeight:(null==e?void 0:e.fixedHeight)&&"on"}),"data-component":"dropdown","data-themeapi":"dropdown",children:c.jsx(Gd,{direction:"column",role:"list","data-component":"dropdown-options",maxHeight:400,children:null==e?void 0:e.children})})})}),{Option:function(e){var n=e.label,r=rs();return c.jsx("div",{className:""+Qd.option(null==r?void 0:r.dropdowns),role:"listitem","aria-selected":null==e?void 0:e.selected,"data-themeapi":"dropdown",children:c.jsxs("div",{tabIndex:-1,onClick:function(t){return e.onChange(t)},onKeyUp:function(){return e.onChange()},role:"button",className:""+Qd.button(null==r?void 0:r.dropdowns)({selected:null!=e&&e.selected?"on":"off"}),"data-testid":null==e?void 0:e.testId,children:[null!=e&&e.render?e.render(e):c.jsx(t.Fragment,{children:null!=e&&e.subtext||null!=e&&e.icon?c.jsxs(Gd,{direction:"row",gap:"0.5rem",children:[(null==e?void 0:e.icon)&&c.jsx(oc,{icon:null==e?void 0:e.icon,paddingTop:"0"}),c.jsxs(zd,{flexGrow:1,paddingTop:"0.1rem",children:[c.jsx(zd,{children:i.isFunction(n)?n():n}),(null==e?void 0:e.subtext)&&c.jsx(zd,{className:""+Qd.subtext,children:null==e?void 0:e.subtext})]})]}):c.jsx("span",{children:i.isFunction(n)?n():n})}),(null==e?void 0:e.selected)&&c.jsx(Gd,{alignItems:"center",justifyContent:"center",children:c.jsx("div",{className:""+Qd.selectedIcon,children:c.jsx(v.CheckIcon,{css:lc,"aria-hidden":"true"})})})]})})},Empty:function(e){return c.jsx("div",{css:Jd,children:e.label})}}),uc=function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return"v"+e+" "+n.flatMap((function(t){return t?["vizzly"+e+"_"+t]:[]})).join(" ")},dc=function(e,t,n){var r=[].concat(n).flatMap((function(e){if(i.isFunction(e)){var n=e();if(n)return[uc(n)]}return i.isString(e)&&t[e]?[uc(e)]:[]})).join(" ");return uc(e)+" "+r},cc=p.keyframes({name:"19mmmx",styles:"0%,15%{transform:translate(0, 0);}50%{transform:translate(0, -5px);opacity:0.7;}85%,100%{transform:translate(0, 0);}"}),pc=function(e){var t;return c.jsx("div",{"data-testid":"loading-component-ball",css:[d.css("height:7px;width:7px;border-radius:50%;background:",null!=(t=e.color)?t:"white",";float:left;margin:0 3px;&:nth-of-type(1){z-index:1;-moz-animation:",cc," 2s infinite ease-in-out;-webkit-animation:",cc," 2s infinite ease-in-out;}&:nth-of-type(2){-moz-animation:",cc," 2s infinite ease-in-out;-webkit-animation:",cc," 2s infinite ease-in-out;-webkit-animation-delay:0.25s;animation-delay:0.25s;}&:nth-of-type(3){-moz-animation:",cc," 2s infinite ease-in-out;-webkit-animation:",cc," 2s infinite ease-in-out;-webkit-animation-delay:0.5s;animation-delay:0.5s;}",""),"",""]})},fc=Ml((function(e){var t=e.color,n=e.mAuto;return c.jsxs("div",{className:uc("loading"),css:["margin-top:-0.5rem;margin-bottom:-0.5rem;",n&&{margin:"auto"},"",""],children:[c.jsx(pc,{color:t}),c.jsx(pc,{color:t}),c.jsx(pc,{color:t})]})}),"renderLoadingComponent"),mc={name:"45oqhd",styles:"display:grid;align-content:center;text-align:center"},hc=function(e){var t;return c.jsx("div",{css:mc,style:{width:"100%",height:"100%",minHeight:null!=(t=null==e?void 0:e.minHeight)?t:"200px"},children:e.override?e.override({}):c.jsx(fc,{mAuto:!0,color:"#e5e5e5"})})},vc={name:"45oqhd",styles:"display:grid;align-content:center;text-align:center"},gc=function(e){return c.jsx("div",{css:vc,style:{width:"100%",height:"100%"},children:c.jsx(fc,{mAuto:!0,color:e.color})})},bc=function(e){var t;return c.jsx("button",{"data-testid":null==e?void 0:e.testId,onClick:function(t){t.stopPropagation(),null==e||e.onClear()},onKeyUp:function(t){t.stopPropagation(),null==e||e.onClear()},className:Zl(null==e?void 0:e.className,""+Aa.button),"aria-label":null!=(t=null==e?void 0:e["aria-label"])?t:"Clear",children:c.jsx("div",{children:c.jsx("svg",{fill:null==e?void 0:e.fill,height:8,width:10,stroke:null==e?void 0:e.stroke,focusable:"false",viewBox:"0 0 12 12",className:""+Ia,children:c.jsx("path",{fillRule:"evenodd",d:"M11.53.47a.75.75 0 0 0-1.061 0l-4.47 4.47L1.529.47A.75.75 0 1 0 .468 1.531l4.47 4.47-4.47 4.47a.75.75 0 1 0 1.061 1.061l4.47-4.47 4.47 4.47a.75.75 0 1 0 1.061-1.061l-4.47-4.47 4.47-4.47a.75.75 0 0 0 0-1.061z"})})})})},xc={height:"1.5rem",width:"1.5rem",cursor:"pointer",paddingTop:1,outline:"2px solid transparent",outlineOffset:2},yc=Object.assign(pa({width:"100%"}),{inputComponent:function(e,t){var n,r;return pa(U({display:"flex",outline:"2px solid transparent",outlineOffset:2,textAlign:"left",lineHeight:1.25,borderRadius:null==e?void 0:e.borderRadius,background:null==e?void 0:e.background,color:null==e?void 0:e.color,fontWeight:null==e?void 0:e.fontWeight,fontSize:null==e?void 0:e.fontSize,boxShadow:null==e?void 0:e.boxShadow},t?U({},null==e?void 0:e["&:focus"]):((n={})["&:hover"]=null==e?void 0:e["&:hover"],n),{variants:{highlighted:{on:{outline:"2px solid transparent",outlineOffset:2}},subtle:{off:{border:t?null==e||null==(r=e["&:focus"])?void 0:r.border:null==e?void 0:e.border},on:{border:null==e?void 0:e.border,borderColor:"transparent",background:"transparent"}}}}))},clickableArea:function(e){return pa({width:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:null==e?void 0:e.padding,gridArea:"1 / 1 / 2 / 3",variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},multiple:function(e){return pa({display:"inline-grid",gridArea:"1 / 1 / 2 / 3",padding:null==e?void 0:e.padding,paddingLeft:0,paddingRight:0,variants:{rightAligned:{on:{textAlign:"right"},off:{}}}})},input:pa({height:"100%",width:"100%",appearance:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",background:"transparent",padding:"0 0.5rem",color:"inherit",outline:"2px solid transparent",border:0,"&:disabled":{border:"none"},variants:{rightAligned:{on:{textAlign:"right"},off:{}}}}),loading:pa({paddingLeft:"0.25rem",paddingRight:0,width:100,alignSelf:"center"}),clearContainer:pa({display:"flex",width:"2rem",alignItems:"center",paddingLeft:"0.5rem",paddingRight:"0.25rem"}),clearButton:function(e){return pa(U({},xc,{color:null==e?void 0:e.indicatorColor}))},controlGrid:pa({paddingBottom:1}),arrowContainer:function(e){return pa({display:"flex",width:"2rem",alignItems:"center",justifyContent:"center",padding:0,margin:0,color:"rgb(209 213 219)",variants:{subtle:{off:{borderLeft:null==e?void 0:e.border}}}})}}),wc=pa({variants:{open:{up:{},off:{transform:"rotate(180deg)"},side:{transform:"rotate(90deg)"}}}}),Cc=function(e){return c.jsx("button",{onClick:function(t){t.stopPropagation(),t.preventDefault(),null==e||e.onClick()},"aria-label":e.label,className:""+(t=null==e?void 0:e.styled,pa(U({},Da.button,{height:"1.5rem",cursor:"pointer",color:null==t?void 0:t.indicatorColor,outline:"2px solid transparent",outlineOffset:2,"&:disabled":{border:"none"}}))),children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Zl(""+wc({open:null==e||!e.expanded||null!=e&&e.disabled?null==e?void 0:e.arrowStart:"off"}),""+Ia),children:c.jsx("polyline",{points:"18 15 12 9 6 15"})})});var t},jc=function(e){var n,r,o,a,l,s,u,d,p,f,m,h=e.disabled,v=e.placeholder,g=e.onClear,b=e.isLoading,x=t.useRef(null),y=function(){null==e||e.setOpen(!0),null!==x.current&&x.current.focus()},w=i.isString(null==e?void 0:e.selectedValue)?null==e?void 0:e.selectedValue:void 0;t.useEffect((function(){null!=e&&e.open&&null!==x.current&&!b&&x.current.focus()}),[null==e?void 0:e.open]);var C=rs();return c.jsx("div",{className:""+yc,"data-component":"control","aria-labelledby":null!=e&&e.multiple?null==e?void 0:e.id:void 0,onClick:function(){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick())},children:c.jsxs("div",{className:""+yc.inputComponent(null==C||null==(n=C.forms)?void 0:n.select,null==e?void 0:e.open)({highlighted:null!=e&&e.highlighted?"on":"off",subtle:null!=e&&e.subtle?"on":"off"}),"data-themeapi":"forms.select",children:[c.jsxs(Gd,{flex:"1 1 auto",wrap:!0,"data-component":"control-flex",alignItems:null!=e&&e.multiple?"flex-start":void 0,rowGap:null!=e&&e.multiple?"0.25rem":void 0,minHeight:null!=e&&e.multiple?28.44:void 0,direction:null!=e&&e.multiple?"row":void 0,children:[(null==e?void 0:e.multiple)&&c.jsx(t.Fragment,{children:null==e?void 0:e.children}),!(null!=e&&e.multiple)&&c.jsx(zd,{flex:1,"data-component":"control-view",children:c.jsxs(es,{"data-component":"control-grid",className:""+yc.controlGrid,children:[c.jsx(t.Fragment,{children:null!=e&&e.open?c.jsx(t.Fragment,{children:0===e.value.length&&w&&c.jsx("div",{className:yc.clickableArea(null==C||null==(o=C.forms)?void 0:o.select)({small:null!=e&&e.sm?"on":"off",rightAligned:null!=e&&e.rightAligned?"on":"off"}),"aria-labelledby":null==e?void 0:e["aria-labelledby"],children:w})}):c.jsx("div",{onClick:function(){return y()},onKeyUp:function(){return y()},"data-testid":e.testId,className:Zl(""+yc.clickableArea(null==C||null==(r=C.forms)?void 0:r.select),null==e?void 0:e.className),"aria-labelledby":null==e?void 0:e["aria-labelledby"],children:null==e?void 0:e.children})}),!(null!=e&&e.multiple)&&(null==e?void 0:e.open)&&c.jsx("div",{className:yc.multiple(null==C||null==(a=C.forms)?void 0:a.select)({small:null!=e&&e.sm?"on":"off"}),children:c.jsx("input",{style:{minWidth:v?9*(null==v?void 0:v.length)+"px":void 0},id:null==e?void 0:e.id,value:null==e?void 0:e.value,onChange:function(t){return null==e?void 0:e.onChange(t.target.value)},onClick:function(){return(null==e?void 0:e.multiple)&&(null==e?void 0:e.setOpen(!(null!=e&&e.open)))},"aria-labelledby":null==e?void 0:e["aria-labelledby"],placeholder:null==e?void 0:e.placeholder,disabled:h,ref:x,className:yc.input({rightAligned:null!=e&&e.rightAligned?"on":"off"}),autoComplete:"off"})})]})})]}),b&&c.jsx("div",{className:""+yc.loading,children:c.jsx(gc,{color:"#3074d9"})}),g&&(null==e?void 0:e.clearable)&&c.jsx("div",{className:""+yc.clearContainer,children:c.jsx(bc,{onClear:function(){return g&&g()},className:""+yc.clearButton(null==C||null==(l=C.forms)?void 0:l.select),fill:null==C||null==(s=C.forms)||null==(u=s.select)?void 0:u.indicatorColor,stroke:null==C||null==(d=C.forms)||null==(p=d.select)?void 0:p.indicatorColor,testId:e.testId?e.testId+"-clear":void 0})}),c.jsx("div",{className:yc.arrowContainer(null==C||null==(f=C.forms)?void 0:f.select)({subtle:null!=e&&e.subtle?"on":"off"}),children:c.jsx(Cc,{label:null!=e&&e.open?"Close":"Open",arrowStart:"up",disabled:h,onClick:function(){return null==e?void 0:e.setOpen(!(null!=e&&e.open))},styled:null==C||null==(m=C.forms)?void 0:m.select,expanded:null==e?void 0:e.open})})]})})},Sc=Object.assign(pa({display:"flex",position:"relative",alignItems:"start",flexDirection:"column",variants:{dynamicWidth:{true:{width:"100%"}}}})),Fc=Rl((function(e){var r,o,a,l=e.selected,s=e.options,u=e.setSelectOptionsAreOpen,d=e.isLoading,p=e.selectOptionsAreOpen,f=e.onClickWithDevToolCheck,m=e.activeDevToolHighlight,h=null===e.selected?null:s[e.selected],v=h?h.label:e.placeholder||"Select...",g=n.useRef(null);ns(g,(function(){return u(!1)}));var b=Object.keys(s[0]||{}),x=Yd(s,b),y=x.values,w=x.setSearch,C=x.searchString,j=function(t){t!=l&&e.onChange(null===t?null:t),u(!1)};return c.jsxs("div",U({className:""+Sc({dynamicWidth:null==e?void 0:e.dynamicWidth}),ref:g,"data-component":null==e?void 0:e["data-component"]},((r={})["data-componentoverride"]="renderSelectComponent",r),{children:[c.jsx(jc,{value:null!=e&&e.selectOptionsAreOpen?C:i.isFunction(v)?v():v,onChange:function(e){return w(e)},open:p,setOpen:f((function(){u(!p),w("")})),onClear:function(){h&&e.canBeCleared&&j(null),h&&e.canBeCleared&&w("")},clearable:!(!h||!e.canBeCleared),subtle:null==e?void 0:e.subtle,selectedValue:null==(o=y.find((function(e){return e.refIndex===l})))?void 0:o.item.label,highlighted:m,rightAligned:null==e?void 0:e.rightAligned,testId:null==e?void 0:e.testId,isLoading:d,id:null==e?void 0:e.id,"aria-labelledby":null==e?void 0:e["aria-labelledby"],className:null==e?void 0:e.controlClassName,children:null!=e&&e.renderSelected?null==e?void 0:e.renderSelected(h):c.jsxs(t.Fragment,{children:[h&&e.selectedLabelPrefix,i.isFunction(v)?v():v]})}),!d&&c.jsxs(sc,{open:p,fixedHeight:!0,children:[y.map((function(t,n){return c.jsx(sc.Option,U({onChange:function(){return j(t.refIndex)},label:t.item.label,selected:t.refIndex==l,testId:t.item.testId?""+t.item.testId:null!=e&&e.testId?(null==e?void 0:e.testId)+"-"+n:void 0,icon:t.item.icon},e.renderOption&&{render:function(){return e.renderOption&&e.renderOption(t.item)}}),"option_"+t.refIndex+"_"+t.item.label)})),0===y.length&&c.jsx(zd,{padding:8,width:200,children:null!=(a=e.noOptionsMessage)?a:"No Options"})]})]}))}),"renderSelectComponent",(function(e){return U({},e,{setSelectOptionsAreOpen:(t=e.setSelectOptionsAreOpen,n=[r.boolean()],function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return n.forEach((function(e,t){var n=e.validate(r[t],Hd);if(n.error)throw n.error;r[t]=n.value})),t.apply(void 0,r)})});var t,n})),kc=pa({color:"#7D7D7E"}),Tc=function(e){var t,n,r,i,o,a,l=null!=(t=null==e?void 0:e.as)?t:"label",s=rs(),u={className:""+(r=null==s||null==(n=s.forms)?void 0:n.label,i=null==e?void 0:e.labelHidden,o=null==e?void 0:e.margin,a=null==e?void 0:e.fontWeight,pa(U({},r,{margin:null!=o?o:null==r?void 0:r.margin,fontWeight:null!=a?a:null==r?void 0:r.fontWeight,display:i?"none":"block",padding:0,position:"relative",width:"100%"}))),"data-themeapi":"forms.label","data-chipposition":"above.right",htmlFor:null==e?void 0:e.htmlFor,id:null==e?void 0:e.id};return e.tooltip?c.jsxs(Gd,{gap:"0.25rem",children:[c.jsx(l,U({},u,{children:null==e?void 0:e.children})),c.jsx(zd,{width:18,children:(null==e?void 0:e.tooltip.href)&&c.jsxs("a",{href:null==e?void 0:e.tooltip.href,target:"_blank",rel:"noopener noreferrer",children:[c.jsx("span",{className:""+Aa.srOnly,children:null==e?void 0:e.tooltip.label}),c.jsx(v.QuestionMarkCircleIcon,{className:Zl("help-icon",""+kc)})]})})]}):c.jsx(l,U({},u,{children:null==e?void 0:e.children}))},Ac=function(e){var n,r=i.isFunction(e.options)&&e.selected?[{value:e.selected,label:e.selected}]:[],o=t.useState(i.isArray(e.options)?{loading:!1,options:e.options}:{loading:!1,options:r}),a=o[0],l=o[1],s=a.options,u=t.useState(void 0!==e.defaultOpen&&e.defaultOpen),d=u[0],p=u[1];t.useEffect((function(){var t=new AbortController;d&&function(){var n=Y(W().mark((function n(){var r;return W().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!i.isFunction(e.options)){n.next=6;break}return l({loading:!0,options:[]}),n.next=4,e.options(t.signal);case 4:(r=n.sent)?l({loading:!1,options:r}):console.warn("[Vizzly] Failed to fetch async options for select.");case 6:return n.abrupt("return",(function(){t.abort()}));case 7:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}()()}),[d]),t.useEffect((function(){i.isArray(e.options)&&l({loading:!1,options:e.options})}),[e.options]);var f=s.findIndex((function(t){return i.isArray(t.value)||i.isObject(t.value)?JSON.stringify(t.value)==JSON.stringify(e.selected):t.value==e.selected}));return c.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(Tc,{labelHidden:null==e?void 0:e.labelHidden,id:null==e?void 0:e.id,tooltip:null==e?void 0:e.tooltip,children:null==e?void 0:e.label}),c.jsx(Fc,{"data-component":null==e?void 0:e["data-component"],testId:e.testId,dynamicWidth:e.dynamicWidth,onChange:function(t){e.onChange(null===t?null:a.options[t].value)},controlClassName:null==e?void 0:e.controlClassName,setSelectOptionsAreOpen:p,options:a.options,isLoading:null!=(n=null==e?void 0:e.loading)?n:a.loading,subtle:e.subtle,selected:-1===f?null:f,selectOptionsAreOpen:d,anchorOptionsLeft:e.anchorLeft,error:e.error,canBeCleared:e.showClearBtn,selectedLabelPrefix:e.selectedPrefix,placeholder:e.placeholder,rightAligned:null==e?void 0:e.rightAligned,id:null==e?void 0:e.id,"aria-labelledby":null==e?void 0:e.id,renderSelected:null==e?void 0:e.renderSelected,renderOption:null==e?void 0:e.renderOption,noOptionsMessage:e.noOptionsMessage})]})},Dc=function(e){return c.jsx("div",{"data-component":"select-input",children:null==e?void 0:e.children})},Ic=function(e){var t=e.placeholder,n=e.showClearBtn;return c.jsx(Ac,{showClearBtn:void 0===n||n,options:e.options,onChange:e.setSelected,selected:e.currentValue,anchorLeft:e.anchorLeft,placeholder:t,selectedPrefix:t+" · ",maintainOptionOrder:e.maintainOptionOrder,testId:"select"})},Pc=function(e,t){return null===e?null:i.reduce(t,(function(e,t){return function(e,t){var n=i.cloneDeep(e);return n.attributes=On(e.attributes.type).removeField(e.attributes,t),n}(e,t.id)}),e)},_c=[];function Ec(e){for(var t,n=[],r=te(e);!(t=r()).done;){var i=t.value;n.push("dateTimeFilter"===i.type?U({},i,{type:"dateFilter"}):i)}return n}function Oc(e,t){var n=U({},e);return"attributes"in n&&("measure"in n.attributes&&t.updatedMeasures&&(n.attributes.measure=t.updatedMeasures),"dimension"in n.attributes&&t.updatedDimension&&(n.attributes.dimension=t.updatedDimension),"timeDimension"in n.attributes&&t.updatedTimeDimension&&(n.attributes.timeDimension=t.updatedTimeDimension)),n}var Lc=function(e,t,n,r){var i=[].concat(e.dashboard.componentLibrary);return i[n]=U({},t,{attributes:U({},t.attributes,{protectedByOrganisation:!!r||void 0})}),U({},e,{componentEditor:null,dashboard:U({},e.dashboard,{componentLibrary:i})})},Rc=function(e,t,n,r){var i=jr(e.dashboard.display,t,n,r);return U({},e,{dashboard:U({},e.dashboard,{display:i})})},Mc=function(e,t){var n=t.rowIndex,r=i.cloneDeep(e.dashboard.display);return r.length>1?(r.splice(n,1),U({},e,{dashboard:U({},e.dashboard,{display:r})})):e},Nc=n.createContext(null),zc=function(e){var r,o,a=e.dashboard,l=e.children,s=e.onEvent,u=function(e){var t,r=Ol(),o=r.dashboardFilters,a=r.onDashboardFilterChange,l=U({pickFromComponentLibrary:null,componentEditor:null,inPreviewMode:!1},e,{dashboard:e.dashboard}),s=(t={dashboardFilters:o,onDashboardFilterChange:a},function(e,n){var r=n.type;return[function(e){return function(e,t){var n,r,o,a,l,s,u=t.dashboardFilters,d=[].concat(e.dashboard.globalFilters).filter((function(e){return!e.managedByConfiguration})),c=(l=e.dashboard.dataSets,s={},l.forEach((function(e){e.fields.forEach((function(t){[].concat(t.dashboardRequiredFilterGroups||[]).forEach((function(n){var r=n.publicName+" - "+t.dataType;s[r]=[].concat(s[r]||[],[{publicName:n.publicName,dataSetField:t,dataSetId:e.id}])}))}))})),Object.values(s)).map((function(e){return{type:"date_time"==e[0].dataSetField.dataType?"dateFilter":"singleSelectFilter",managedByConfiguration:!0,requiresValue:!0,title:e[0].publicName,appliesToFields:e.map((function(e){return{dataSetId:e.dataSetId,fieldId:e.dataSetField.id}})),value:null}})),p=u((r=e.dashboard,o=function(e){var t=[];return e.display.forEach((function(e){e.components.forEach((function(e){Fr(e)||kr(e)||(t=[].concat(t,[e.attributes.dataSetId]))}))})),i.uniq(t).flatMap((function(t){var n=Rn(e.dataSets,t);return n?[n]:[]}))}(r),a=function(e){var t=[];return e.componentLibrary.forEach((function(e){t=[].concat(t,[e.attributes.dataSetId])})),i.uniq(t).flatMap((function(t){var n=Rn(e.dataSets,t);return n?[n]:[]}))}(r),i.uniqBy([].concat(a,o),(function(e){return e.id}))),_c).map((function(e){return U({},e,{managedByConfiguration:!0})})),f=function(e,t){var n=new Set(t.flatMap((function(e){return e.fields.map((function(e){return e.id}))})));return t.forEach((function(e){e.fields.forEach((function(e){n.add(e.id)}))})),e.map((function(e){var t=Object.assign({},e);return t.appliesToFields=e.appliesToFields.filter((function(e){return n.has(e.fieldId)})),t}))}([].concat(Ec(c),Ec(p),Ec(d)),e.dashboard.dataSets).map((function(t){var n=pr(e.dashboard.globalFilters,t);return U({},t,{value:n?n.value:t.value||null})}));return i.some(n=f,(function(e,t){var r=[].concat(n);return r.splice(t,1),!!pr(r,e)}))&&Wr("Identical global dashboard filters found. This will cause strange behaviour. Please make sure the global filters all apply to a unique set of `appliesToFields` values."),U({},e,{dashboard:U({},e.dashboard,{globalFilters:f})})}(e,t)},function(e){return function(e,t,n){return"setGlobalFilters"!=t.type&&"init"!=t.type||n.onDashboardFilterChange(e.dashboard.globalFilters),e}(e,n,t)}].reduce((function(e,t){return t(e)}),function(){switch(r){case"insertRow":return function(e,t){var n=xr(e.dashboard.display,t.rowIndex);return U({},e,{dashboard:U({},e.dashboard,{display:n})})}(e,n);case"appendCell":return function(e,t){var n=Cr(e.dashboard.display,t.rowIndex);return U({},e,{dashboard:U({},e.dashboard,{display:n})})}(e,n);case"addHeaderRow":return function(e,t){var n,r,i,o=(n=t.rowIndex,r=[].concat(e.dashboard.display),i=Sr([{displayTitle:"New Header",colSpan:12}],48),r.splice(n,0,i),r);return U({},e,{dashboard:U({},e.dashboard,{display:o})})}(e,n);case"setHeaderComponent":return function(e,t){var n=t.component,r=t.rowIndex,o=t.cellIndex,a=i.cloneDeep(e);return a.dashboard.display[r].components[o]=n,a}(e,n);case"removeCell":return function(e,t){var n=t.rowIndex,r=t.cellIndex,o=i.cloneDeep(e.dashboard.display),a=o[n].components[r];return o[n].components.length>1?(o[n].components.splice(r,1),o[n].components[0].colSpan=o[n].components[0].colSpan+a.colSpan,U({},e,{dashboard:U({},e.dashboard,{display:o})})):Mc(e,U({},t,{type:"removeRow"}))}(e,n);case"removeRow":return Mc(e,n);case"clearCell":return function(e,t){var n=t.rowIndex,r=t.cellIndex,o=i.cloneDeep(e.dashboard.display);return o[n].components[r]=yr(o[n].components[r].colSpan),U({},e,{dashboard:U({},e.dashboard,{display:o})})}(e,n);case"addDataSet":return function(e,t){var n=t.dataSet,r=[].concat(e.dashboard.dataSets);return r.push(n),U({},e,{dashboard:U({},e.dashboard,{dataSets:r})})}(e,n);case"removeDataSet":return function(e,t){var n=t.dataSetId;if(!function(e,t){return Kr(e,t)>=0}(e.dashboard,n))return e;var r=Kr(e.dashboard,n),i=[].concat(e.dashboard.dataSets);return i.splice(r,1),U({},e,{dashboard:U({},e.dashboard,{dataSets:i})})}(e,n);case"setDataSets":return function(e,t){var n,r,o,a=t.dataSets,l=function(e,t){return[].concat(t).flatMap((function(t){var n,r,i,o=Rn(e,t.id);return null==o?[]:(n=o,r=[].concat(t.fields).map((function(e){return e.id})),i=[],[].concat(n.fields).forEach((function(e){r.includes(e.id)||(i=[].concat(i,[e]))})),i)}))}([].concat(e.dashboard.dataSets),a),s=i.reduce(l,(function(e,t){return function(e,t){var n=i.cloneDeep(e);return n.map((function(e){var n=e.components.map((function(e){return"isEmpty"in e||kr(e)||(e.attributes=On(e.attributes.type).removeField(e.attributes,t)),e}));return U({},e,{components:n})})),n}(e,t.id)}),e.dashboard.display);return U({},e,{componentEditor:(n=e.componentEditor,r=l,o=(null==n?void 0:n.component)||null,o=Pc(o,r),n?U({},n,{component:o}):null),dashboard:U({},e.dashboard,{componentLibrary:[].concat(e.dashboard.componentLibrary).map((function(e){return Pc(e,l)})),dataSets:[].concat(a),display:s})})}(e,n);case"startPickingComponentFromLibraryForDisplay":return function(e,t){return U({},e,{pickFromComponentLibrary:{cellIndex:t.cellIndex,rowIndex:t.rowIndex}})}(e,n);case"startEditingComponent":return function(e,t){return U({},e,{componentEditor:{target:{libraryIndex:t.libraryIndex,displayTarget:t.displayTarget},component:t.component||null}})}(e,n);case"saveComponent":return function(e,t){var n;if(!e.componentEditor)throw"Cannnot save a component when the editor is not active.";if(null==(n=e.componentEditor)||!n.component||!e.componentEditor.component.attributes)throw"Component must be set for it to be saved.";var r=U({},e);return null!=e.componentEditor.target.libraryIndex&&(r=Lc(e,e.componentEditor.component,e.componentEditor.target.libraryIndex,t.protectedComponent)),e.componentEditor.target.displayTarget&&!e.componentEditor.target.libraryIndex&&(r=Rc(r,e.componentEditor.component,e.componentEditor.target.displayTarget.rowIndex,e.componentEditor.target.displayTarget.cellIndex)),U({},r,{componentEditor:null,pickFromComponentLibrary:e.pickFromComponentLibrary})}(e,n);case"addCustomComponent":return function(e,t){var n=U({},e);return null!=t.target.libraryIndex&&(n=Lc(e,t.component,t.target.libraryIndex)),t.target.displayTarget&&!t.target.libraryIndex&&(n=Rc(n,t.component,t.target.displayTarget.rowIndex,t.target.displayTarget.cellIndex)),U({},n,{componentEditor:null})}(e,n);case"clearModal":return function(e,t){return U({},e,{pickFromComponentLibrary:null,componentEditor:null})}(e);case"updateEditorComponent":return function(e,t){return e.componentEditor?U({},e,{componentEditor:U({},e.componentEditor,{component:t.component})}):U({},e)}(e,n);case"setResultsForComponentInDisplay":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=e.dashboard.display[n].components[r];if(!i)throw"We can only set results on an existing component on the dashboard.";var o=U({},i,{results:t.results});return U({},Rc(e,o,n,r))}(e,n);case"setResultsForComponentInLibrary":return function(e,t){var n=t.libraryIndex,r=t.results,i=[].concat(e.dashboard.componentLibrary);return i[n]=U({},i[n],{results:r}),U({},e,{dashboard:U({},e.dashboard,{componentLibrary:i})})}(e,n);case"setResultsForComponentInEditor":return function(e,t){if(!e.componentEditor)throw"Cannot set results for a closed editor.";if(!e.componentEditor.component)throw"Cannot set results for a non-existant component in editor.";return U({},e,{componentEditor:U({},e.componentEditor,{component:U({},e.componentEditor.component,{results:t.results})})})}(e,n);case"pickComponentFromLibraryForDisplay":return function(e,t){var n=U({},e.dashboard.componentLibrary[t.libraryIndex]);if(!n)throw"Cannot set a non-existant library component for display";if(!e.pickFromComponentLibrary)throw"Component library not open, so cannot set library component on display";var r=e.pickFromComponentLibrary;return U({},Rc(e,n,r.rowIndex,r.cellIndex),{pickFromComponentLibrary:null})}(e,n);case"setDashboard":return function(e,t){return U({},e,{dashboard:t.dashboard})}(e,n);case"setTheme":return function(e,t){return U({},e,{dashboard:U({},e.dashboard,{theme:t.theme})})}(e,n);case"setGlobalFilters":return function(e,t){return U({},e,{dashboard:U({},e.dashboard,{globalFilters:t.globalFilters})})}(e,n);case"setColSpans":return function(e,t){var n=i.cloneDeep(e.dashboard.display),r=i.cloneDeep(e.dashboard.display)[t.rowIndex];return r.components.map((function(e,n){e.colSpan=t.colSpans[n].colSpan})),n[t.rowIndex]=r,U({},e,{dashboard:U({},e.dashboard,{display:n})})}(e,n);case"setRowHeight":return function(e,t){var n=i.cloneDeep(e.dashboard.display),r=i.cloneDeep(e.dashboard.display)[t.rowIndex];return r.height=t.height,n[t.rowIndex]=r,U({},e,{dashboard:U({},e.dashboard,{display:n})})}(e,n);case"changePreviewMode":return function(e,t){return U({},e,{inPreviewMode:t.inPreviewMode})}(e,n);case"updateDisplayComponentAttributes":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=U({},e.dashboard.display[n].components[r],{attributes:U({},t.attributes)});return Rc(e,i,n,r)}(e,n);case"updateComponentLibraryAttributes":return function(e,t){var n=t.libraryIndex,r=t.attributes,i=[].concat(e.dashboard.componentLibrary);return i[n]=U({},i[n],{attributes:r}),U({},e,{dashboard:U({},e.dashboard,{componentLibrary:i})})}(e,n);case"removeComponentFromLibrary":return function(e,t){var n=t.libraryIndex,r=[].concat(e.dashboard.componentLibrary);return r.splice(n,1),U({},e,{dashboard:U({},e.dashboard,{componentLibrary:r})})}(e,n);case"setComponentReports":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=e.dashboard.display[n].components[r];if(!i)throw"We can only set local filters on an existing component on the dashboard.";var o=U({},i,{reports:t.reports});return U({},Rc(e,o,n,r))}(e,n);case"swapComponents":return function(e,t){var n,r,i,o,a,l=(i=t.positionB,o=U({},(n=e.dashboard.display)[(r=t.positionA).rowIndex].components[r.cellIndex]),a=U({},n[i.rowIndex].components[i.cellIndex]),n=jr(n,o,i.rowIndex,i.cellIndex),n=jr(n,a,r.rowIndex,r.cellIndex));return U({},e,{dashboard:U({},e.dashboard,{display:l})})}(e,n);case"setAttributes":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=e.dashboard.display[n].components[r];if(!i)throw"We can only set attributes on an existing component on the dashboard.";var o=U({},i,{attributes:t.attributes});return U({},Rc(e,o,n,r))}(e,n);case"setParameterBasedUpdate":return function(e,t){var n=t.rowIndex,r=t.cellIndex,i=function(e,t,n,r){var i=e[t].components[n];if(!i||Fr(i)||kr(i))throw"We can only set parameters on an existing component on the dashboard.";return Oc(i,r)}(e.dashboard.display,n,r,t.payload);return U({},Rc(e,i,n,r))}(e,n);case"setLocalFilters":return function(e,t){var n=t.localFilters,r=t.rowIndex,i=t.cellIndex,o=t.libraryIndex,a=U({},e);if(void 0!==r&&void 0!==i){var l=e.dashboard.display[r].components[i];if(!l)throw"We can only set local filters on an existing component on the dashboard.";var s=U({},l,{localFilters:n});a=Rc(e,s,r,i)}if(void 0!==o){var u=e.dashboard.componentLibrary[o];if(!u)throw"We can only set local filters on an existing component on the library.";var d=U({},u,{localFilters:n});a=Lc(e,d,o)}return U({},a)}(e,n);case"init":return e}}())});return n.useReducer(s,l,(function(e){return s(e,{type:"init"})}))}({componentEditor:e.componentEditor||null,dashboard:a?qc(a,e.theme):a}),d=u[0],p=u[1];return t.useEffect((function(){(null==e?void 0:e.onDashboardUpdate)&&(null==e||e.onDashboardUpdate(d.dashboard))}),[JSON.stringify(d.dashboard)]),c.jsx(Nc.Provider,{value:U({},d,{dispatch:p,broadcastEvent:s||function(){},runQueriesCallback:(o=Y(W().mark((function t(n,r,i){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!d.dashboard){t.next=2;break}return t.abrupt("return",e.runQueriesCallback(n,{abortSignal:r,dataSets:d.dashboard.dataSets,filterConfig:i}));case 2:return t.abrupt("return",null);case 3:case"end":return t.stop()}}),t)}))),function(e,t,n){return o.apply(this,arguments)})}),children:c.jsx(vs,{theme:null==e?void 0:e.theme,storedTheme:null==d||null==(r=d.dashboard)?void 0:r.theme,children:l})})},Bc=function(){return n.useContext(Nc)},qc=function(e,t){var n,r,i,o,a,l,s,u,d,c,p,f;return U({},e,{theme:{detail:null!=(n=null==t?void 0:t.detail)?n:null==e||null==(r=e.theme)?void 0:r.detail,rowLimit:null!=(i=null==t?void 0:t.rowLimit)?i:null==e||null==(o=e.theme)?void 0:o.rowLimit,fontFamily:null!=(a=null==t||null==(l=t.baseFont)?void 0:l.fontFamily)?a:null==e||null==(s=e.theme)?void 0:s.fontFamily,fontSize:null!=(u=null==t||null==(d=t.baseFont)?void 0:d.fontSize)?u:null==e||null==(c=e.theme)?void 0:c.fontSize,colors:null!=(p=null==t?void 0:t.colors)?p:null==e||null==(f=e.theme)?void 0:f.colors}})},Vc=function(){var e=Y(W().mark((function e(t,n,r,i){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n(t,r,i);case 3:return e.abrupt("return",e.sent);case 6:return e.prev=6,e.t0=e.catch(0),console.error(e.t0),e.abrupt("return",null);case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,n,r,i){return e.apply(this,arguments)}}(),Wc=function(e,t){return function(){var n=Y(W().mark((function n(r){var o,a;return W().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,Vc(e,t,r);case 3:if(o=n.sent){n.next=6;break}throw new Error("Failed to fetch filter options.");case 6:return a=o.flatMap((function(e){return e?e.content.map((function(e){return e[0]})):[]})),n.abrupt("return",i.uniq(a).map((function(e){return{label:Je(e,(function(){throw"Async options should not be formatting a date time field."})),value:e}})));case 10:return n.prev=10,n.t0=n.catch(0),n.t0 instanceof Error?console.error(n.t0.message):console.error(n.t0),n.abrupt("return",[]);case 14:case"end":return n.stop()}}),n,null,[[0,10]])})));return function(e){return n.apply(this,arguments)}}()},Hc=function(e){var n=Bc().runQueriesCallback,r=Ol().cascadeFilterSelection,i=e.filter,o=e.filterIndex,a=e.dataSets,l=e.onChange,s=t.useState(null),u=s[0],d=s[1],p=t.useRef(void 0),f=function(){var e=Y(W().mark((function e(t){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wc(hr(i),n)(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return t.useEffect((function(){!function(){var e=Y(W().mark((function e(){var t,n;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.requiresValue||null!==i.value){e.next=6;break}return t=new AbortController,e.next=4,f(t.signal);case 4:(n=e.sent)&&n[0]?(qr("Filter forcing initial value to be set."),d(n),l(U({},i,{value:n[0].value}))):Wr("Ran select filter options to force a value, but no results were returned.");case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[JSON.stringify(i)]),t.useEffect((function(){r&&null!==p.current&&JSON.stringify(p.current)!==JSON.stringify(i.optionsFilters)&&d(null),p.current=i.optionsFilters}),[i.optionsFilters]),c.jsx(Ic,{showClearBtn:e.showClearBtn,anchorLeft:!0,placeholder:cr(i,a),options:u||f,currentValue:i.value,setSelected:function(t){e.onChange(U({},i,{value:t}))}},"filter-"+o)},Yc=Object.assign((function(){return null}),{button:function(e){return pa(U({},Da.button,{color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight}))},icon:function(e){return pa({"& > *":{fill:null==e?void 0:e.iconColor}})}}),Uc=["sm"],Gc={name:"1hl83va",styles:"margin-bottom:0.75rem"},Kc={name:"jf4xqj",styles:"position:absolute;top:0px;right:2rem"},Xc={name:"duftww",styles:"position:absolute;top:0.25rem;right:0px"},Qc={name:"1e4sizb",styles:"margin-top:0.5rem"},Jc=function(e){var n,r=t.useState(e.defaultOpen||!1),i=r[0],o=r[1],a=rs();return c.jsxs("div",{css:Gc,className:Zl(dc("accordion",e,Uc)),children:[c.jsxs("button",{type:"button",onClick:function(){if(e.showAccordionIcon){var t=!i;o(t),t&&e.onOpened&&e.onOpened()}},css:["position:relative;width:100%;cursor:pointer;border-radius:0.5rem;text-align:left;",!i&&{cursor:"pointer"},e.sm&&{marginBottom:"0px"},"",""],className:Zl(""+Yc.button(null==a||null==(n=a.accordion)?void 0:n.button)),"data-themeapi":"accordion.button","data-chipposition":"top.left",children:[c.jsx(Gd,{gap:"0.25rem",alignItems:"center",children:null==e?void 0:e.title}),e.renderAction&&c.jsx("div",{css:Kc,children:e.renderAction(i)}),e.showAccordionIcon&&c.jsx("span",{css:Xc,className:Zl(""+Yc.icon(null==a?void 0:a.accordion)),"data-themeapi":"accordion.iconColor",children:c.jsx(e.Icon,{isOpen:i})})]}),i&&c.jsx("div",{className:uc("accordion-content"),css:Qc,children:e.children})]})},Zc=function(e){return c.jsx(Jc,U({},e,{Icon:Jl}))},$c=["labelHidden"],ep=["sm","error"],tp={name:"15jydtm",styles:"width:100%;appearance:none;text-align:left;line-height:1.25;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms"},np=n.forwardRef((function(e,n){var r,i,o,a,l=rs(),s=$(e,$c);return c.jsxs(t.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(Tc,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),c.jsx("input",U({css:tp,id:null==e?void 0:e.id,ref:n},s,{className:Zl(dc("input",e,ep),""+(o=null!=(r=null==e?void 0:e.inputTheme)?r:null==l||null==(i=l.forms)?void 0:i.input,a=null==e?void 0:e.error,pa(U({},o,{boxSizing:"border-box"},a?{outline:"2px solid rgb(239, 68, 68)",outlineOffset:-2}:{outline:"2px solid transparent",outlineOffset:-2},{position:"relative"})))),"data-themeapi":"forms.input","data-chipposition":"above.right",disabled:null==e?void 0:e.disabled}))]})})),rp=n.forwardRef((function(e,t){return c.jsxs(c.Fragment,{children:[(null==e?void 0:e.label)&&c.jsx(Tc,{htmlFor:null==e?void 0:e.id,children:null==e?void 0:e.label}),c.jsx("input",U({className:""+ip(),type:"checkbox",ref:t},e))]})})),ip=function(){return pa({float:"left",marginRight:"0.5rem",height:"1rem",width:"1rem",cursor:"pointer",appearance:"none",borderRadius:"0.125rem",borderWidth:2,borderStyle:"solid",backgroundSize:"contain",backgroundPosition:"center",backgroundRepeat:"no-repeat",verticalAlign:"top",transitionProperty:"all",borderColor:cs(50),backgroundColor:"rgb(255, 255, 255)",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionDuration:"200ms","&:checked":{borderColor:"rgb(48, 116, 217)",backgroundColor:"rgb(48, 116, 217)"},"&:hover":{borderColor:"rgb(48, 116, 217)"},"&:focus":{outline:"2px solid transparent",outlineOffset:2}})},op=t.forwardRef((function(e,t){var n=rs();return c.jsx("div",{className:Zl(uc("listview-item"),""+tc.item(null==n?void 0:n.lists)({highlight:e.highlight?"on":"off",clickable:e.onClick&&"on",componentPadding:null!=e&&e.padding?"true":"false"})),ref:t,"data-themeapi":"lists",children:null==e?void 0:e.children})})),ap=pa(U({},ca,{opacity:0,cursor:"pointer",variants:{active:{true:U({},ca,{opacity:1})}}})),lp=pa({width:"100%",display:"flex",cursor:"pointer",height:16}),sp=pa(U({},ca,{width:12,color:"#1f293799",variants:{active:{true:U({},ca,{color:"rgba(93,103,119,0.6)"})}}})),up=pa({position:"absolute",top:0,left:0,right:0,background:"transparent",variants:{active:{true:{"&:hover":{background:"rgb(229 231 235 / 0.2)",boxShadow:"0 0 #0000,0 0 #0000,0 1px 2px 0 rgb(0 0 0 / 0.05)",borderTopRightRadius:us.size.borderRadius,borderTopLeftRadius:us.size.borderRadius}}}}}),dp=Object.assign((function(){return null}),{popover:function(e){return pa(U({background:cs(0),zIndex:99999999999,padding:"6px 8px",borderRadius:4,fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,letterSpacing:"0.1em",color:"rgb(255, 255, 255)"},{minWidth:e}))}}),cp=Object.assign((function(e){var n,r,i,o=t.useState(null!=(n=null==e?void 0:e.showTooltip)&&n),a=o[0],l=o[1],s=t.useState(null),u=s[0],d=s[1],p=t.useState(null),f=p[1],m=x.usePopper(u,p[0],{placement:null!=(r=null==e?void 0:e.placement)?r:"bottom-start",modifiers:null!=(i=null==e?void 0:e.modifiers)?i:[]}),h=m.styles,v=m.attributes;return c.jsxs("div",{className:Zl((null==e?void 0:e.className)&&""+(null==e?void 0:e.className)),children:[c.jsx("span",{ref:d,onMouseEnter:function(){return l(!0)},onMouseLeave:function(){return l(!1)},className:Zl((null==e?void 0:e.classNameTrigger)&&""+(null==e?void 0:e.classNameTrigger)),children:e.children}),a&&c.jsx("div",U({ref:f,className:""+dp.popover(null==e?void 0:e.tooltipMinWidth),style:U({},h.popper,{visibility:a?"visible":"hidden"})},v.popper,{children:e.tooltipContent()}))]})}),{Content:function(e){var t;return c.jsx("div",{children:null!=(t=e.text)?t:null==e?void 0:e.children})}}),pp=function(e){var t,n;return pa(U({},ca,{cursor:"pointer",color:null==e||null==(t=e.icon)?void 0:t.color,"&:hover":U({},ca,{color:Zd(null==e||null==(n=e.icon)?void 0:n.color,1.5)})}))},fp=function(e){return c.jsx("div",{ref:e.dragSource,className:""+up({active:null!=e&&e.enabled?"true":"false"}),style:null!=e&&e.height?{height:null==e?void 0:e.height}:{},children:(null==e?void 0:e.enabled)&&c.jsx(mp,{active:null==e?void 0:e.active,top:null==e?void 0:e.top})})},mp=function(e){var n,r=t.useState(!1),i=r[0],o=r[1],a=rs();return c.jsx(cp,{tooltipContent:function(){return c.jsx(cp.Content,{children:"Drag to move"})},className:""+(n=null==e?void 0:e.top,pa(U({},ca,{position:"absolute",left:1,top:n})))({active:null!=e&&e.active?"true":"false"}),tooltipMinWidth:110,children:c.jsx("div",{className:""+ap({active:null!=e&&e.active?"true":"false"}),children:c.jsxs("div",{className:""+lp,onMouseOver:function(){return o(!0)},onMouseLeave:function(){return o(!1)},"data-themeapi":"dashboard.icon",children:[c.jsx(v.DotsVerticalIcon,{className:sp({active:i?"true":"false"})+" "+pp(null==a?void 0:a.dashboard)}),c.jsx(v.DotsVerticalIcon,{className:sp({active:i?"true":"false"})+" "+pp(null==a?void 0:a.dashboard),style:{marginLeft:-8}})]})})})},hp=function(e){return c.jsx(null!=e&&e.onOrderChange?gp:bp,U({},e))},vp=function(){},gp=function(e){var n,r,i,o,a,l,s,u,d,p=(u=null==e?void 0:e.onOrderChange,n={id:"re-order-drag-"+e.index,index:e.index,type:"list-view-drag"},r=e.onOrderChange||vp,i=t.useRef(null),o=b.useDrop({accept:n.type,collect:function(e){return{handlerId:e.getHandlerId()}},hover:function(e,t){var o;if(i.current){var a=e.index,l=n.index;if(a!==l){var s=null==(o=i.current)?void 0:o.getBoundingClientRect(),u=(s.bottom-s.top)/2,d=t.getClientOffset().y-s.top;a<l&&d<u||a>l&&d>u||(r(a,l),e.index=l)}}}})[1],l=(a=b.useDrag({type:n.type,item:function(){return{id:n.id,index:n.index}},collect:function(e){return{isDragging:e.isDragging()}}}))[0].isDragging,s=a[2],(0,a[1])(o(i)),d=[i,s,l],u?[d[0],d[1]]:[null,null]);return c.jsx(bp,U({},e,{ref:p[0]}))},bp=t.forwardRef((function(e,n){var r=e.item,i=e.index,o=e.onDeleteItem,a=e.onOrderChange&&e.totalItemsCount>1,l=rs(),s=t.useState(!1),u=s[1];return c.jsx(Gd,{"data-component":"listview-item",role:"listitem","data-themeapi":"lists",children:c.jsxs("div",{style:{cursor:r.onClick?"pointer":void 0},onClick:function(){return r.onClick?r.onClick(i):void 0},className:""+tc.itemWrapper,onMouseOver:function(){return!!a&&u(!0)},onMouseLeave:function(){return!!a&&u(!1)},children:[c.jsx(op,{clickable:!!r.onClick,highlight:r.highlight,ref:n,children:c.jsxs(Gd,{direction:"row","data-component":"list-cell-row",gap:"0.5rem",paddingY:"0.1rem",paddingRight:"0.1rem",paddingLeft:"0.5rem",alignItems:"center",position:"relative",children:[c.jsx("div",{className:""+tc.dragHandleContainer,children:!!a&&c.jsx(mp,{active:s[0],top:9})}),c.jsx(zd,{flex:1,paddingLeft:0,children:c.jsxs(Gd,{gap:"0.5rem",children:[(null==r?void 0:r.icon)&&c.jsx(oc,{icon:null==r?void 0:r.icon}),c.jsxs(zd,{flexGrow:1,paddingY:"5.5px","data-component":"list-title-subtext",children:["string"==typeof r.title?c.jsx("p",{className:""+tc.label(null==l?void 0:l.lists),children:r.title}):c.jsx(t.Fragment,{children:r.title}),r.subtext&&c.jsx("p",{className:""+tc.metadata(null==l?void 0:l.lists),children:r.subtext})]})]})}),r.select&&c.jsx("div",{className:""+tc.right,children:c.jsx(Ac,{labelHidden:!0,label:"Function",subtle:!0,showClearBtn:r.select.showClearBtn,onChange:function(e){var t;return null==(t=r.select)?void 0:t.onChange(e,i)},options:r.select.options,selected:r.select.selected,rightAligned:!0,id:"function_"+i})}),r.renderRight&&c.jsx("div",{className:""+tc.right,children:r.renderRight()}),r.editIcon&&c.jsx("div",{className:""+tc.edit,children:c.jsx(Ul,{})}),r.preventDelete&&c.jsx("div",{className:""+tc.edit,children:c.jsx(Gl,{})})]})}),o&&!r.preventDelete&&c.jsx("div",{className:""+tc.deleteWrapper(null==l?void 0:l.lists),children:c.jsxs("button",{type:"button",className:""+tc.deleteButton(null==l?void 0:l.lists),"data-testid":e.testId&&e.testId+"-"+i+"-remove",onClick:function(e){e.stopPropagation(),o&&o(i)},"aria-label":"Remove","data-themeapi":"lists.icon",children:[c.jsxs("span",{className:""+Ta,children:["Remove ",r.title]}),c.jsx(Vl,{})]})})]})})})),xp=function(e){return c.jsx(zd,{paddingRight:null==e?void 0:e.paddingRight,as:null==e?void 0:e.as,children:c.jsx(es,{gap:"0.5rem",children:null==e?void 0:e.children})})},yp=function(e){var t,n,r,i,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,C,j,S,F,k,T,A;return pa({height:null!=(t=null==e?void 0:e.height)?t:"100%",width:"100%",transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",WebkitFontSmoothing:"antialiased",justifyContent:null!=(n=null==e?void 0:e.align)?n:"center",alignItems:"center",display:"flex",cursor:"pointer",padding:"0 12px 1px 12px",background:null==(r=e.theme)?void 0:r.background,border:null==(i=e.theme)?void 0:i.border,boxShadow:null==(o=e.theme)?void 0:o.boxShadow,borderRadius:null==(a=e.theme)?void 0:a.borderRadius,color:null==(l=e.theme)?void 0:l.color,position:"relative","&:hover":wp(e.theme),variants:{size:{small:{fontSize:null==(s=e.theme)||null==(u=s.small)?void 0:u.fontSize,fontWeight:null==(d=e.theme)||null==(c=d.small)?void 0:c.fontWeight,padding:null!=(p=null==(f=e.theme)||null==(m=f.small)?void 0:m.padding)?p:"2px 8px 3px",height:"auto",width:"auto"},medium:{fontSize:null==(h=e.theme)||null==(v=h.medium)?void 0:v.fontSize,fontWeight:null==(g=e.theme)||null==(b=g.medium)?void 0:b.fontWeight,padding:null!=(x=null==(y=e.theme)||null==(w=y.medium)?void 0:w.padding)?x:"0 12px"},large:{fontSize:null==(C=e.theme)||null==(j=C.large)?void 0:j.fontSize,fontWeight:null==(S=e.theme)||null==(F=S.large)?void 0:F.fontWeight,padding:null!=(k=null==(T=e.theme)||null==(A=T.large)?void 0:A.padding)?k:"0 12px"}},isHovering:{true:wp(e.theme)}}})};function wp(e){var t,n,r,i;if(e)return{transitionDuration:"250ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",background:null==(t=e["&:hover"])?void 0:t.background,border:null==(n=e["&:hover"])?void 0:n.border,boxShadow:null==(r=e["&:hover"])?void 0:r.boxShadow,color:null==(i=e["&:hover"])?void 0:i.color}}var Cp=function(e){var t,n,r,i=rs();return c.jsx("button",{onClick:function(t){e.disabled||(t.preventDefault(),(null==e?void 0:e.onChange)&&(null==e||e.onChange()))},"data-component":null==e?void 0:e["data-component"],"data-testid":null==e?void 0:e.testId,className:Zl(yp({height:null==e?void 0:e.height,align:null==e?void 0:e.align,theme:null!=(t=null==e?void 0:e.addTheme)?t:null==i||null==(n=i.buttons)?void 0:n.add})({size:null!=(r=null==e?void 0:e.size)?r:"medium"}),e.className),"data-themeapi":"buttons.add",disabled:e.disabled,children:c.jsx("span",{children:null==e?void 0:e.children})})},jp=function(e){return c.jsx(zd,{children:c.jsx(Cp,{testId:e.testId,onChange:function(){return null==e?void 0:e.onChange()},height:36,align:"left",disabled:e.disabled,children:c.jsxs(Gd,{children:["+ ",e.label]})})})},Sp=function(e){return void 0===(null==e?void 0:e.children)?null:c.jsx(es,{gap:e.hasDeleteIcon?"0.9rem":"0.5rem",className:uc("listview"),columns:["repeat(1,minmax(0,1fr))"],"data-component":"list-view",role:"list",children:null==e?void 0:e.children})};function Fp(e){var t,r=i.orderBy(e.initValues,(function(e){return e.title})),o=n.useState(null!=(t=null==e?void 0:e.isOpen)&&t),a=o[0],l=o[1],s=Yd(r,["title","subtext"]),u=s.setSearch,d=s.values,p=s.searchString,f=n.useRef(null);return ns(f,(function(){return l(!1)})),e.hide?null:c.jsxs("div",{className:""+tc.addWrapper,ref:f,children:[c.jsx(zd,{marginTop:e.marginTop,"data-component":"new-item",children:c.jsx(jp,{testId:e.testId,onChange:function(){var t=!a;t&&e.onOpenDropdown&&e.onOpenDropdown(),l(t)},label:e.callToAction})}),c.jsxs(sc,{open:a,fixedHeight:!0,children:[c.jsx(zd,{padding:8,children:c.jsx(np,{id:(null==e?void 0:e.id)+"-add-item",label:"Add Item",labelHidden:!0,autoFocus:!0,defaultValue:p,onChange:function(e){return u(e.target.value)}})}),d.map((function(t){return c.jsx(sc.Option,{testId:e.testId+"-option-"+t.refIndex,onChange:function(){return(n=r[t.refIndex]).onSelected&&n.onSelected(n.value),e.onNew&&e.onNew(n.value),void l(!1);var n},label:t.item.title,subtext:t.item.subtext,icon:t.item.icon},"list_view_"+t.refIndex+"_option")}))]})]})}function kp(e){var n,r;return c.jsxs(xp,{paddingRight:null!=(n=null==e?void 0:e.paddingRight)?n:"0.25rem",children:[e.items.length>0&&c.jsx(Sp,{children:[].concat(e.items).map((function(t,n){return c.jsx(hp,{mode:null==e?void 0:e.mode,testId:e.testId,onDeleteItem:e.onDeleteItem,onOrderChange:e.onOrderChange,item:t,index:n,totalItemsCount:e.items.length},"list_view_item_"+n)}))}),c.jsxs(t.Fragment,{children:[e.newItem&&c.jsx(Fp,U({},e.newItem,{testId:e.testId,id:null==e?void 0:e.id,marginTop:e.items.length>0?"0.50rem":void 0})),e.newItemBtn&&c.jsx(jp,{testId:e.testId,onChange:null==(r=e.newItemBtn)?void 0:r.onClick,label:e.newItemBtn.callToAction,disabled:null==e?void 0:e.newItemBtn.disabled})]})]})}var Tp=function(e){var t=e.children;return c.jsx("div",{id:e.id,className:""+Ap({queriesAreChanging:e.queriesAreChanging,overflowScroll:e.overflowScroll,justifyCenter:e.justifyCenter}),children:t})},Ap=pa({display:"flex",width:"100%",height:"100%",flexDirection:"column",variants:{queriesAreChanging:{false:{},true:{filter:"blur(1px)"}},overflowScroll:{false:{},true:U({overflow:"auto"},Kd)},justifyCenter:{false:{},true:{justifyContent:"center"}}}}),Dp=["sm","primary","secondary","disabled","loading"],Ip=Rl((function(e){var t,n,r,i=rs();return c.jsx("button",U({},((t={})["data-componentoverride"]="renderButtonComponent",t),{"data-component":null==e?void 0:e["data-component"],"data-testid":e.testId,onClick:e.onClickWithDevToolCheck&&e.onClickWithDevToolCheck(e.onClick),disabled:e.disabled,className:Zl(dc("button",e,Dp),null==e?void 0:e.className,""+(n=null==i?void 0:i.buttons,r=e.themeOverride,pa(U({},Da.button,{transitionDuration:"150ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",cursor:"pointer",letterSpacing:"normal",whiteSpace:"nowrap",transform:"translateY(0) scale(1)",lineHeight:"inherit","&:disabled":{opacity:.7,cursor:"inherit"},"&:disabled:hover":{opacity:.95,cursor:"inherit"},variants:{type:{primary:{},secondary:{}},highlight:{false:{outline:"2px solid transparent",outlineOffset:-2},true:{outline:"2px solid rgb(239, 68, 68)",outlineOffset:-2}},block:{true:{display:"block",width:"100%"}}},compoundVariants:[{type:"primary",css:U({},null==n?void 0:n.primary,r)},{type:"secondary",css:U({},null==n?void 0:n.secondary,r)}]})))({type:null!=e&&e.primary?"primary":"secondary",highlight:!!(null!=e&&e.highlight||null!=e&&e.activeDevToolHighlight),block:null==e?void 0:e.block})),"data-themeapi":e.internal?void 0:"buttons."+(null!=e&&e.primary?"primary":"secondary"),children:e.children}))}),"renderButtonComponent"),Pp={name:"t91scv",styles:"display:grid;place-content:center"},_p=function(e){var n=t.useState("initial"),r=n[0],i=n[1],o=e.autoFeedback?Y(W().mark((function t(){var n;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=!1,!e.onClick){t.next=7;break}return i("loading"),t.next=5,e.onClick();case 5:i((n=!!t.sent)?"success":"error");case 7:return t.abrupt("return",n);case 8:case"end":return t.stop()}}),t)}))):e.onClick,a=(e.error||"error"==r?"error":(e.isLoading||"loading"==r)&&"loading")||(e.success||"success"==r)&&"success"||r;return c.jsxs(Ip,{testId:e.testId,error:"error"==a,isLoading:"loading"==a,primary:!e.secondary,secondary:e.secondary,onClick:o,type:e.type,disabled:e.disabled,"data-component":null==e?void 0:e["data-component"],block:null==e?void 0:e.block,internal:null==e?void 0:e.internal,className:null==e?void 0:e.className,themeOverride:null==e?void 0:e.themeOverride,children:[c.jsx("div",{css:["loading"==a&&{visibility:"hidden"},"",""],children:e.children}),"loading"==a&&c.jsx("div",{css:Pp,children:c.jsx(fc,{color:"white"})})]})},Ep=t.createContext({addToast:function(){throw"not implemented."}}),Op={name:"zjik7",styles:"display:flex"},Lp={name:"1x3jg5i",styles:"margin-left:0.75rem"},Rp=function(e){return c.jsxs("div",{css:Op,children:[c.jsx("span",{children:e.renderIcon()}),c.jsx("span",{css:Lp,children:e.message})]})},Mp={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Np=function(e){return c.jsx(Rp,{message:e.message,renderIcon:function(){return c.jsx("svg",{css:Mp,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})})}})},zp={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Bp=function(e){return c.jsx(Rp,{message:e.message,renderIcon:function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",css:zp,viewBox:"0 0 20 20",fill:"#6fe8ba",children:c.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}})},qp={name:"6u431h",styles:"position:fixed;left:1.25rem;bottom:1.25rem"},Vp={name:"yuw6vf",styles:"margin-top:0.75rem;border-radius:0.5rem;background-color:rgb(0 0 0 / 0.9);padding-top:0.75rem;padding-bottom:0.75rem;padding-left:1.5rem;padding-right:1.5rem;letter-spacing:0.025em;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity));--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)"};function Wp(e){var n=e.children,r=t.useState([]),o=r[0],a=r[1],l=t.useRef([]),s=t.useCallback((function(e,t){if(t){if(l.current.includes(t))return;l.current=[].concat(l.current,[t])}a((function(t){return[e].concat(t)})),setTimeout((function(){t&&i.remove(l.current),a((function(e){return e.slice(void 0,-1)}))}),7500)}),[a]);return c.jsxs(Ep.Provider,{value:{addToast:s},children:[c.jsx("div",{css:qp,style:{zIndex:2147483647},children:o.map((function(e,t){return c.jsx("div",{css:Vp,children:e()},"toast_"+t)}))}),n]})}function Hp(){return t.useContext(Ep)}var Yp,Up=function(e){var t=Ol(),n=t.textOverrides,r=t.developerTools,i=Hp().addToast,o=("string"==typeof e.override?[e.override]:e.override).find((function(e){return!!n[e]})),a=c.jsx(c.Fragment,{children:o?n[o]:e.children});return r?c.jsx("span",{onMouseEnter:function(){i((function(){return c.jsx(Np,{message:"Change the text with 'textOverride' property '"+e.override+"'"})}),"unique-text-override-"+e.override)},children:a}):c.jsx(c.Fragment,{children:a})},Gp=pa({display:"grid",height:"100%",width:"100%",alignContent:"center"}),Kp=pa({margin:"auto",textAlign:"center"}),Xp=pa(U({},Da.text,{fontSize:"1.5rem",lineHeight:"2rem",color:"inherit",variants:{textOpacity:(Yp={},Yp[60]={opacity:60},Yp[40]={opacity:40},Yp)}})),Qp=pa({marginTop:"0.75rem",fontSize:"0.75rem",lineHeight:"1rem",fontWeight:500,letterSpacing:"0.1rem",opacity:.8}),Jp=Object.assign((function(e){var t;return c.jsx("div",{className:""+Gp,children:c.jsxs("div",{className:""+Kp,children:[c.jsx("h1",{className:""+Xp({opacity:e.opacity}),children:e.title}),null!=(t=null==e?void 0:e.children)?t:e.renderExtra&&e.renderExtra()]})})}),{Extra:function(e){return c.jsx("div",{className:""+Qp,children:null==e?void 0:e.children})}}),Zp=function(e){return c.jsx(Jp,{opacity:40,title:null==e?void 0:e.title,children:e.renderExtra&&e.renderExtra()})},$p={name:"13b3q89",styles:"margin-top:0.75rem;max-width:36rem;font-size:0.75rem;line-height:1rem;font-weight:500;letter-spacing:0.1em;opacity:0.5"},ef={name:"akdqam",styles:"margin-top:1rem"},tf=function(){return c.jsx(Jp,{title:"We have failed to load your dashboard",renderExtra:function(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{css:$p,className:""+Aa.text,children:"An internal error occurred, please try again soon."}),c.jsx("div",{css:ef,children:c.jsx(_p,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},nf=function(){return c.jsx(Jp,{title:"There is an issue with your configuration settings.",renderExtra:function(){return c.jsx("p",{className:""+Aa.text,children:"See logs for more details."})}})},rf={name:"13b3q89",styles:"margin-top:0.75rem;max-width:36rem;font-size:0.75rem;line-height:1rem;font-weight:500;letter-spacing:0.1em;opacity:0.5"},of={name:"akdqam",styles:"margin-top:1rem"},af=function(){return c.jsx(Jp,{title:"We have failed to load your dashboard",renderExtra:function(){return c.jsxs(c.Fragment,{children:[c.jsx("p",{css:rf,className:""+Aa.text,children:"We were unable to verify your identity"}),c.jsx("div",{css:of,children:c.jsx(_p,{secondary:!0,onClick:function(){return window.location.reload()},children:"Retry"})})]})}})},lf={name:"12dms0z",styles:"margin-top:1rem;width:100%"},sf=function(e){return c.jsx(Jp,{title:"This view has changed",renderExtra:function(){return c.jsx(Jp.Extra,{children:c.jsxs(Up,{override:"view.data-set-changed",children:["A field this view was using has been removed.",c.jsx("div",{css:lf,children:c.jsx(_p,{"data-component":"remove-missing-field",onClick:function(){return e.removeMissingField()},children:"Auto fix"})})]})})}})},uf=function(e){var t;return c.jsx(Jp,{title:null!=(t=null==e?void 0:e.title)?t:"Query under construction 🏗",renderExtra:function(){var t;return c.jsx(Jp.Extra,{children:null!=(t=null==e?void 0:e.children)?t:"Not all required properties have been set to render this component"})}})},df=function(){return c.jsx(Jp,{title:c.jsx(Up,{override:"view.failed-to-fetch-results",children:"Failed to fetch the data 🤔"})})},cf=function(){return c.jsx(Jp,{title:"This view is not available"})},pf=function(e){return c.jsxs(Tp,{queriesAreChanging:!1,children:[c.jsx(Rm,U({},e)),c.jsx(Jp,{title:c.jsx(Up,{override:"view.empty-results",children:"No data to show"})}),e.children]})},ff={name:"1g0vxgi",styles:"margin-top:0.75rem"},mf=function(e){return c.jsx(Jp,{title:"Something went wrong 😞",renderExtra:function(){return c.jsx(_p,{onClick:e.onManualRetry,css:ff,children:"retry"})}})},hf=function(e){return c.jsx("h3",U({},e,{children:e.children}))},vf=function(e){return c.jsx("p",U({},e,{children:e.children}))},gf=function(e){return c.jsx("p",U({},e,{className:Zl(p.css({name:"1xpc8ph",styles:"font-size:0.75rem;line-height:1rem;font-weight:500;text-transform:capitalize"}),p.css(2===(null==e?void 0:e.marginBottom)?{name:"1gok8e8",styles:"margin-bottom:0.5rem"}:{name:"1tlmwo2",styles:"margin-bottom:0px"})),children:e.children}))},bf=pa(U({overflow:"overlay"},Kd)),xf=function(e){return pa(U({},e,{variants:{buttons:{end:{display:"grid",justifyContent:"end"}}}}))},yf=function(e){var t,n,r,i,o,a,l,s=e.title,u=e.hiddenUnlessEnabledInCss,d=e.className,p=e.show,f=e.hide,m=rs();return c.jsx("div",{className:Zl(uc("modal-header"),""+(l=null==m||null==(t=m.modals)?void 0:t.header,pa(U({width:"100%",lineHeight:"1.5rem"},l,{"& h3":Da.text,variants:{hidden:{true:{position:"absolute",left:-1e4,top:"auto",width:1,height:1,overflow:"hidden"}}}})))({hidden:null!=(n=null!=(r=null==m||null==(i=m.modals)?void 0:i.header)?r:u)&&n})),"data-themeapi":"modals.header",style:f?{display:"none"}:p||null!=m&&null!=(o=m.modals)&&o.header?{display:"block"}:{display:"none"},"data-component":null!=(a=null==e?void 0:e["data-component"])?a:"modal-header",children:c.jsxs(Gd,{className:Zl(null!=d?d:void 0),alignItems:"center",gap:"0.25rem",children:[c.jsx(hf,{children:s}),(null==e?void 0:e.tooltip)&&c.jsx(zd,{width:18,children:c.jsx(cp,{tooltipContent:function(){return c.jsx(cp.Content,{children:e.tooltip})},children:c.jsx(v.QuestionMarkCircleIcon,{"aria-label":"Help",color:cs(30)})})})]})})},wf=function(e){var t,n,r,i,o,a=null!=(t=null==e?void 0:e.buttons)?t:"end",l=rs();return c.jsx("div","space-between"===(null==e?void 0:e.buttons)?{className:Zl(uc("modal-footer"),""+xf(null==l||null==(i=l.modals)?void 0:i.footer)({buttons:a}),null==e?void 0:e.className),"data-themeapi":"modals.footer","data-component":null!=(o=null==e?void 0:e["data-component"])?o:"modal-footer","data-chipposition":"bottom.center",children:c.jsx(Gd,{gap:"0.75rem",justifyContent:"space-between",children:null==e?void 0:e.children})}:{className:Zl(uc("modal-footer"),""+xf(null==l||null==(n=l.modals)?void 0:n.footer)({buttons:null==e?void 0:e.buttons}),null==e?void 0:e.className),"data-themeapi":"modals.footer","data-component":null!=(r=null==e?void 0:e["data-component"])?r:"modal-footer","data-chipposition":"bottom.center",children:null==e?void 0:e.children})},Cf=function(e){var t,n,r,i=e.children,o=e.className,a=rs();return c.jsx("div",{className:Zl(null!=e&&e.scrollable?""+bf:void 0,uc("modal-content"),""+(r=null==a||null==(t=a.modals)?void 0:t.content,pa({fontWeight:null==r?void 0:r.fontWeight,fontSize:null==r?void 0:r.fontSize,padding:null==r?void 0:r.padding,background:null==r?void 0:r.background,variants:{scrollable:{true:U({background:null==r?void 0:r.alternativeBackground,paddingBottom:"0.75rem"},{"@media (max-height: 768px)":{height:420},"@media (min-height: 768px)":{height:600}})}}}))({scrollable:null!=e&&e.scrollable?"true":"false"}),o),"data-themeapi":"modals.content","data-component":null!=(n=null==e?void 0:e["data-component"])?n:"modal-content",children:i})},jf={name:"1px9jck",styles:"min-height:100vh;padding-left:1rem;padding-right:1rem;text-align:center"},Sf={name:"8pnu7z",styles:"display:inline-block;height:100vh;vertical-align:middle"},Ff=function(e){var n,r,i,o,a,l,s,u=t.useRef();e.width&&(u.current=e.width);var d,f=null==(n=rs())?void 0:n.modals;return c.jsx("div",{style:{display:"inherit",zIndex:null!=(r=null==f||null==(i=f.base)?void 0:i.zIndex)?r:2147483147},children:c.jsx(Md,{appear:!0,show:e.isOpen,children:c.jsxs($u,{style:{zIndex:null!=(o=null==f||null==(a=f.base)?void 0:a.zIndex)?o:2147483147},"data-themeapi":"modals.base",className:Zl(p.css({name:"18w3cuy",styles:"position:fixed;top:0px;right:0px;bottom:0px;left:0px;overflow-y:auto;overflow-x:hidden"}),"vizzly-modals"),onClose:function(){var t;return!(null!=f&&null!=(t=f.options)&&t.disableOutsideClick)&&e.onClose()},"data-testid":"modal",static:!(null!=f&&null!=(l=f.options)&&l.disableOutsideClick),children:[c.jsx($u.Overlay,{className:Zl(uc("modal-overlay"),""+(d=null==f?void 0:f.overlay,pa(U({position:"fixed",top:0,right:0,bottom:0,left:0},d,{variants:{dark:{true:{opacity:.7},false:{opacity:null==d?void 0:d.opacity}}}})))({dark:null!=(s=null==e?void 0:e.dark)&&s})),"data-themeapi":"modals.overlay"}),c.jsxs("div",{"data-testid":e["data-testid"],css:jf,children:[c.jsx("span",{css:Sf,"aria-hidden":"true",children:""}),c.jsxs(Md.Child,{enter:"v_contentEnter",enterFrom:"v_contentEnterFrom",enterTo:"v_contentEnterTo",leave:"v_contentLeave",leaveFrom:"v_contentLeaveFrom",leaveTo:"v_contentLeaveTo",css:["margin-top:2rem;margin-bottom:2rem;display:inline-block;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));text-align:left;vertical-align:middle;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;","sm"==u.current&&{width:"100%",maxWidth:"24rem"},"xl"==u.current&&{width:"100%",maxWidth:"36rem"},"2xl"==u.current&&{width:"100%",maxWidth:"42rem"},"4xl"==u.current&&{width:"100%",maxWidth:"56rem"},"7xl"==u.current&&{width:"100%",maxWidth:"80rem"},"",""],children:[!e.hideCloseIcon&&c.jsx(Df,{onClick:e.onClose}),c.jsx(kf,{vizzlyPrefix:uc("modal-wrapper",e.namespace),children:e.children})]})]})]})})})},kf=function(e){var t,n,r,i=rs();return c.jsx("div",{className:Zl(null==e?void 0:e.vizzlyPrefix,""+(r=null==i||null==(t=i.modals)?void 0:t.base,pa(U({},r,{variants:{hasFooter:{true:{},false:{borderBottomLeftRadius:null==r?void 0:r.borderRadius,borderBottomRightRadius:null==r?void 0:r.borderRadius}},hasHeader:{true:{},false:{borderTopLeftRadius:null==r?void 0:r.borderRadius,borderTopRightRadius:null==r?void 0:r.borderRadius}}}}))),"modal-body"),"data-themeapi":"modals.base","data-component":null!=(n=null==e?void 0:e["data-component"])?n:"modal-body","data-chipposition":"above.center",children:null==e?void 0:e.children})},Tf={name:"1f0fr1j",styles:"position:absolute;top:-1.5rem;right:-1.5rem"},Af={name:"bq473o",styles:"height:1.5rem;width:1.5rem"},Df=function(e){var t,n,r=null==(t=rs())?void 0:t.modals;return"none"===(null==r||null==(n=r.options)?void 0:n.closeButton)?null:c.jsx("button",{type:"button","data-testid":"close-modal",onClick:function(){return e.onClick()},css:Tf,className:Zl(uc("modal-close"),""+Aa.button),"data-themeapi":"modals.options.closeButton","data-component":"modal-close-button",children:c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"#FFF",css:Af,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})},If=Object.assign(Ff,{Header:yf,Footer:wf,Content:Cf}),Pf=Object.assign((function(){return null}),{list:function(e){var t;return pa({position:"relative",width:"100%",display:"grid",gridTemplateColumns:null==e?void 0:e.columns,padding:null!=(t=null==e?void 0:e.padding)?t:"0 0.5rem",margin:"0 0 1.5rem 0",borderBottom:null!=e&&e.theme&&null!=e&&e.theme.borderBottom?null==e?void 0:e.theme.borderBottom:"0px solid transparent"})},button:function(e){var t,n,r,i,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,C,j,S,F,k,T;return pa(U({lineHeight:"1rem",letterSpacing:"0.1em",whiteSpace:"nowrap"},ca,{position:"relative",variants:{state:{unselected:{borderRadius:null==e||null==(t=e.unselected)?void 0:t.borderRadius,padding:null==e||null==(n=e.unselected)?void 0:n.padding,fontSize:null==e||null==(r=e.unselected)?void 0:r.fontSize,fontWeight:null==e||null==(i=e.unselected)?void 0:i.fontWeight,color:null==e||null==(o=e.unselected)?void 0:o.color,boxShadow:null==e||null==(a=e.unselected)?void 0:a.boxShadow,background:null!=(l=null==e||null==(s=e.unselected)?void 0:s.background)?l:"inherit",border:null==e||null==(u=e.unselected)?void 0:u.border,borderRight:null==e||null==(d=e.unselected)?void 0:d.borderRight,borderLeft:null==e||null==(c=e.unselected)?void 0:c.borderLeft,borderTop:null==e||null==(p=e.unselected)?void 0:p.borderTop,borderBottom:null==e||null==(f=e.unselected)?void 0:f.borderBottom,"&:hover":U({},ca,null==e||null==(m=e.unselected)?void 0:m["&:hover"])},selected:{borderRadius:null==e||null==(h=e.selected)?void 0:h.borderRadius,padding:null==e||null==(v=e.selected)?void 0:v.padding,fontSize:null==e||null==(g=e.selected)?void 0:g.fontSize,fontWeight:null==e||null==(b=e.selected)?void 0:b.fontWeight,color:null==e||null==(x=e.selected)?void 0:x.color,boxShadow:null==e||null==(y=e.selected)?void 0:y.boxShadow,background:null==e||null==(w=e.selected)?void 0:w.background,border:null==e||null==(C=e.selected)?void 0:C.border,borderRight:null==e||null==(j=e.selected)?void 0:j.borderRight,borderLeft:null==e||null==(S=e.selected)?void 0:S.borderLeft,borderTop:null==e||null==(F=e.selected)?void 0:F.borderTop,borderBottom:null==e||null==(k=e.selected)?void 0:k.borderBottom,"&:hover":U({},ca,null==e||null==(T=e.selected)?void 0:T["&:hover"])}},button:{true:{cursor:"pointer",padding:"0.5rem",border:0,whiteSpace:"nowrap"}}}}))},panel:function(e,t){return pa({paddingLeft:null!=e?e:"0.5rem",paddingRight:null!=t?t:"0.5rem"})},hasChanges:pa({fontSize:8})}),_f=["children","paddingLeft","paddingRight"],Ef=Object.assign((function(){return null}),{Group:function(e){return c.jsx(xd.Group,U({},e,{children:c.jsx("div",{className:uc("tab-group"),children:e.children})}))},Button:function(e){var t=rs();return c.jsx(xd,U({},e,{className:""+Aa.button,children:function(n){var r=n.selected;return c.jsx("div",{className:Zl(dc("tab-button",{selected:r},["selected"]),""+Pf.button(null==t?void 0:t.tabs)({state:r?"selected":"unselected"})),"data-themeapi":"tabs-"+(r?"selected":"unselected"),children:e.children})}}))},Panel:function(e){var t=e.children,n=e.paddingLeft,r=e.paddingRight,i=$(e,_f);return c.jsx(xd.Panel,U({className:Zl(uc("tab-panel"),""+Pf.panel(n,r))},i,{children:t}))},Panels:function(e){return c.jsx(xd.Panels,U({},e,{children:e.children}))},List:function(e){var t=rs();return c.jsx(xd.List,U({className:Zl(uc("tab-button-list"),""+Pf.list({columns:null==e?void 0:e.columns,theme:null==t?void 0:t.tabs,padding:null==e?void 0:e.padding}))},e,{"data-themeapi":"tabs","data-chipposition":"above.left",children:e.children}))}}),Of=function(e){var t;return c.jsx(Gd,{className:Zl(dc("button-group",e,[])),gap:"0.75rem",justifyContent:null!=(t=null==e?void 0:e.buttons)?t:"start","data-component":e["data-component"],children:e.children})},Lf=pa({borderWidth:0,padding:0,marginLeft:0,marginRight:0}),Rf=function(e){var t;return c.jsx(zd,{className:Zl(uc("panel-property"),""+Lf),marginBottom:"0.75rem",as:null!=(t=null==e?void 0:e.as)?t:"div",children:e.children})},Mf=function(e,t,n){return[].concat(t).flatMap((function(t,r){var i=!n.includes(r);return[].concat(function(e){return[].concat(e.fields).filter((function(e){return!kt(e)}))}(t)).filter((function(t){var n;return("dateFilter"==(n=e)||"dateAndTimeFilter"==n||"dateTimeFilter"==n?["date_time"]:["number","string","boolean","string[]"]).includes(t.dataType)})).map((function(e){return{label:t.name+" · "+e.publicName,value:{dataSetId:t.id,field:e},hide:i}}))}))},Nf=function(e,t){switch(t.type){case"setSelectedFields":return function(e,t){return U({},e,{selectedFieldIndexes:t.selectedFieldIndexes})}(e,t);case"setSelectedDataSets":return function(e,t){var n=t.selectedDataSetIndexes,r=e.dataSets,o=e.selectedFieldIndexes,a=Mf(e.type,r,e.selectedDataSetIndexes);return o=i.remove(o,(function(e){var t=Nn(r,a[e].value.dataSetId);return n.includes(t[1])})),U({},e,{selectedDataSetIndexes:n,selectedFieldIndexes:o})}(e,t);case"setTitle":return function(e,t){return U({},e,{title:t.title})}(e,t);case"setType":return function(e,t){return U({},e,{selectedFieldIndexes:[],type:t.filterType})}(e,t);default:return U({},e)}},zf={type:"singleSelectFilter",appliesToFields:[],title:"",value:null,requiresValue:!1,managedByConfiguration:!1},Bf=function(e){var r,o=function(e,t){var r=i.uniq([].concat(e.appliesToFields).map((function(e){return t.findIndex((function(t){return t.id==e.dataSetId}))}))),o=[].concat(e.appliesToFields).flatMap((function(n){var i=Mf(e.type,t,r).findIndex((function(e){return e.value.dataSetId==n.dataSetId&&n.fieldId==e.value.field.id}));return-1==i?[]:[i]})),a=n.useReducer(Nf,{title:e.title,type:e.type,selectedDataSetIndexes:r,dataSets:t,selectedFieldIndexes:o}),l=a[0],s=a[1];!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(l);var u=[].concat(t).map((function(e){return{label:e.name,value:e.id}})),d=Mf(l.type,t,l.selectedDataSetIndexes),c=[].concat(l.selectedFieldIndexes).map((function(e){var t=d[e].value;return{dataSetId:t.dataSetId,fieldId:t.field.id}}));return{selectedFieldIndexes:l.selectedFieldIndexes,selectedDataSetIndexes:l.selectedDataSetIndexes,dataSetOptions:u,fieldOptions:d,dispatch:s,globalFilter:{type:l.type,appliesToFields:c,title:l.title,value:null,managedByConfiguration:!1,requiresValue:!1}}}(e.current||zf,e.dataSets),a=o.fieldOptions,l=o.dataSetOptions,s=o.globalFilter,u=o.dispatch,d=o.selectedDataSetIndexes,p=o.selectedFieldIndexes,f=Ol().featureToggles;return t.useEffect((function(){1===e.dataSets.length&&u({type:"setSelectedDataSets",selectedDataSetIndexes:[0]})}),[]),c.jsxs(c.Fragment,{children:[c.jsx(If.Header,{title:"New filter",show:!0}),c.jsxs(If.Content,{children:[c.jsx(Rf,{children:c.jsx(np,{label:"Title",id:"title",placeholder:"Title",value:s.title,onChange:function(e){u({type:"setTitle",title:e.target.value})}})}),e.dataSets.length>1&&c.jsx(Rf,{children:c.jsx(Jf,{id:"data-set",label:"Data sets",placeholder:"Which data sets will this filter impact?",options:l,selected:d,setSelected:function(e){u({type:"setSelectedDataSets",selectedDataSetIndexes:e})}})}),c.jsx(Rf,{children:c.jsx(Ac,{id:"filter-type",label:"Filter type",anchorLeft:!0,selected:s.type,onChange:function(e){u({type:"setType",filterType:e})},options:(r=[{label:"Single select",value:"singleSelectFilter"},{label:"Multi select",value:"multiSelectFilter"}],f.showDateFilter&&r.push({label:"Date picker",value:"dateFilter"}),f.showDateAndTimeFilter&&r.push({label:"Date Time picker",value:"dateAndTimeFilter"}),r)})}),c.jsx(Rf,{children:c.jsx(Jf,{label:"Fields",id:"data-set-fields",placeholder:"Which fields are affected?",options:a,selected:p,setSelected:function(e){u({type:"setSelectedFields",selectedFieldIndexes:e})}})})]}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{secondary:!0,onClick:function(){return null!=e&&e.saving?void 0:e.onCancel()},disabled:null==e?void 0:e.saving,children:"Cancel"}),c.jsx(_p,{onClick:function(){return null!=e&&e.saving?void 0:void e.setFilter(s)},disabled:null==e?void 0:e.saving,children:"Confirm"})]})})]})},qf=Object.assign((function(){}),{svg:function(e){var t,n,r;return pa({display:"block",width:"100%",position:"relative",variants:{alertType:{warning:{fill:null==e||null==(t=e.warning)?void 0:t.iconColor,transform:"rotate(180deg)"},info:{fill:null==e||null==(n=e.info)?void 0:n.iconColor,transform:"rotate(180deg)"},critical:{fill:null==e||null==(r=e.critical)?void 0:r.iconColor}}}})},icon:pa({paddingTop:0,display:"block",height:"1rem",width:"1rem"})}),Vf=function(e){var t,n=rs();return c.jsxs("div",{className:Zl(""+qf.icon,null==e?void 0:e.className),role:"alert",children:[c.jsx("span",{className:""+Ta,children:null==e?void 0:e.title}),c.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+qf.svg(null==n?void 0:n.alerts)({alertType:"critical"}),focusable:"false","aria-hidden":"true",children:c.jsx("path",{d:"M11.768.768a2.5 2.5 0 0 0-3.536 0l-7.464 7.464a2.5 2.5 0 0 0 0 3.536l7.464 7.464a2.5 2.5 0 0 0 3.536 0l7.464-7.464a2.5 2.5 0 0 0 0-3.536l-7.464-7.464zm-2.768 5.232a1 1 0 1 1 2 0v4a1 1 0 1 1-2 0v-4zm2 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})}:{viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",className:""+qf.svg(null==n?void 0:n.alerts)({alertType:null!=(t=null==e?void 0:e.type)?t:"info"}),children:c.jsx("path",{fillRule:"evenodd",d:"M10 20c5.514 0 10-4.486 10-10s-4.486-10-10-10-10 4.486-10 10 4.486 10 10 10zm1-6a1 1 0 1 1-2 0v-4a1 1 0 1 1 2 0v4zm-1-9a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"})})]})},Wf=function(e){var r=e.filters,i=e.dataSets,o=e.show,a=e.onClose,l=e.source,s=e.onDeleteItem,u=e.onUpdate,d=t.useState(!1),p=d[0],f=d[1],m=t.useState([]),h=m[0],v=m[1],g=n.useState(null),b=g[0],x=g[1],y=Array.isArray(r)?[].concat(r).map((function(e,t){var n={};return 0===e.appliesToFields.length&&(n={renderRight:function(){return c.jsx(cp,{tooltipContent:function(){return c.jsx(cp.Content,{children:"There are no fields on this Filter. It should be deleted or a field added."})},children:c.jsx(Vf,{title:"There are no fields on this Filter. It should be deleted or a field added.",type:"warning",className:""+Yf})})}}),U({preventDelete:e.managedByConfiguration,title:cr(e,i),subtext:ar(e.type)+" for "+Xe(e.appliesToFields.length,"field","fields")+" "+Qe([].concat(e.appliesToFields).map((function(e){var t=Rn(i,e.dataSetId);return t?Mn(t,e.fieldId).publicName:""})))},n,{editIcon:!e.managedByConfiguration,onClick:e.managedByConfiguration?function(){}:function(){return x({draftFilter:e,filterIndex:t})}})})):[];t.useEffect((function(){p&&h&&r.length>h.length&&f(!1)}),[p,h,r]);var w=Ol().mode;return c.jsxs(c.Fragment,{children:[c.jsxs(If,{width:"xl","data-testid":"manage-filters-modal",isOpen:o,onClose:function(){return a()},children:[c.jsx(If.Header,{title:("global"===l?"Dashboard":"Add Local")+" filters",show:!0}),c.jsx(If.Content,{children:c.jsx(kp,{mode:w,onDeleteItem:s,newItemBtn:{callToAction:"New "+("global"===l?"dashboard":"local")+" filter",onClick:function(){x({filterIndex:void 0,draftFilter:zf}),v(r)}},items:y})}),c.jsx(If.Footer,{buttons:"end",children:c.jsx(_p,{onClick:function(){return a()},secondary:!0,children:"Close"})})]}),c.jsx(If,{width:"xl","data-testid":"edit-filter",isOpen:null!=b,onClose:function(){},hideCloseIcon:!0,children:c.jsx(Bf,{onCancel:function(){return x(null)},current:(null==b?void 0:b.draftFilter)||null,setFilter:function(e){f(!0),v(r),u({filter:e,index:null==b?void 0:b.filterIndex}),x(null)},dataSets:i,saving:p})})]})};function Hf(e,t){var n=t.filter,r=t.index,i=[].concat(e);return void 0===r?i=[].concat(i,[n]):r>=0&&r<i.length&&(i[r]=n),i}var Yf=pa({paddingTop:0}),Uf=function(){var e=Bc(),t=e.dashboard,r=e.dispatch,i=e.broadcastEvent,o=n.useState(!1),a=o[0],l=o[1];if(!t)return null;var s=function(e){r({type:"setGlobalFilters",globalFilters:e})};return c.jsxs(c.Fragment,{children:[c.jsx(Gf,{onChange:function(){i("manageGlobalFilters.open"),l(!0)},disabled:Tr(t.display)}),c.jsx(Wf,{dataSets:t.dataSets,filters:t.globalFilters,show:a,onUpdate:function(e){var n=Hf(t.globalFilters,e);s(n)},source:"global",onDeleteItem:function(e){var n=[].concat(t.globalFilters);n.splice(e,1),s(n)},onClose:function(){i("manageGlobalFilters.close"),l(!1)}})]})},Gf=function(e){var t,n=rs();return c.jsx("div",{className:""+Kf,"data-themeapi":"filters.filterBy",children:c.jsx(_p,{testId:"manage-global-filters-open",onClick:null==e?void 0:e.onChange,disabled:null==e?void 0:e.disabled,className:Zl("filter-by-button"),themeOverride:null==n||null==(t=n.filters)?void 0:t.filterBy,children:c.jsxs(Gd,{as:"span",justifyContent:"center",alignItems:"center",gap:"0.5rem",children:[c.jsx("span",{className:"filter-by-button-icon",children:c.jsx(Ma,{active:!1})}),c.jsx("span",{className:"filter-by-button-text",children:c.jsx(Up,{override:"dashboard-filters.call-to-action",children:"Filter by"})})]})})})},Kf=pa({minWidth:"100px",position:"relative"}),Xf={name:"1d3w5wq",styles:"width:100%"},Qf={name:"1egouu6",styles:"position:relative;display:flex;width:100%;flex-direction:column;align-items:center"},Jf=function(e){var r,o,a,l,s,u,d,p,f=null!=(r=null==e?void 0:e.showableChips)?r:2,m=e.selected,h=t.useState([]),v=h[0],g=h[1];t.useEffect((function(){i.isArray(e.options)&&g(e.options)}),[e.options]);var b=t.useState(null!=(o=null==e?void 0:e.isLoading)&&o),x=b[0],y=b[1],w=t.useState(i.isFunction(e.options)?"unloaded":void 0),C=w[0],j=w[1],S=n.useState(!1),F=S[0],k=S[1];t.useEffect((function(){var t=function(){var t=Y(W().mark((function t(){var n;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=new AbortController,j("loading"),y(!0),!i.isFunction(e.options)){t.next=9;break}return e.options(n.signal).then((function(e){j("loaded"),e&&(g(e),y(!1))})),t.abrupt("return",(function(){n.abort(),j("failed")}));case 9:y(!1),g(e.options);case 11:return t.abrupt("return",(function(){}));case 12:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();F&&i.isFunction(e.options)&&t()}),[F]);var T=Yd(v,["label","value"]),A=T.values,D=T.searchString,I=T.setSearch,P=t.useRef(null);ns(P,(function(){k(!1),R(f)}));var _=function(t){I("");var n=[].concat(m);n=m.includes(t)?i.filter([].concat(m),(function(e){return e!=t})):[].concat(m,[t]),e.setSelected(n)},E=i.sumBy(v,(function(e){return e.hide?0:1})),O=t.useState(f),L=O[0],R=O[1];t.useEffect((function(){R(F?m.length:f)}),[m.length,v.length]);var M=rs();return c.jsxs("div",{css:Xf,"data-fetchstatus":null!=C?C:void 0,children:[(null==e?void 0:e.id)&&(null==e?void 0:e.label)&&c.jsx(Tc,{labelHidden:null==e?void 0:e.labelHidden,id:null==e?void 0:e.id,children:null==e?void 0:e.label}),c.jsxs("div",{css:Qf,ref:P,children:[c.jsxs(jc,{value:D,onChange:function(e){return I(e)},open:F,isLoading:x,setOpen:function(e){k(e),R(e?m.length:f)},multiple:!0,id:null==e?void 0:e.id,"aria-labelledby":(null==e?void 0:e.id)&&(null==e?void 0:e.label)&&(null==e?void 0:e.id),onClick:function(){return!F&&0===m.length&&k(!0)},testId:"multi-select",children:[(null==e?void 0:e.selectedPrefix)&&c.jsx(zd,{"data-component":"selected-prefix",padding:null!=(a=null==M||null==(l=M.forms)||null==(s=l.select)?void 0:s.padding)?a:"0.30rem 0.5rem",paddingRight:0,children:null==e?void 0:e.selectedPrefix}),(null==e?void 0:e.placeholder)&&0===m.length&&c.jsx(zd,{padding:"0.35rem 0.5rem",as:"span",children:c.jsx("span",{style:{color:"#A1A8B3"},children:null==e?void 0:e.placeholder})}),c.jsxs(Gd,{columnGap:"0.25rem",rowGap:"0.25rem",flex:1,minWidth:F?190:void 0,wrap:!0,padding:null!=(u=null==M||null==(d=M.forms)||null==(p=d.select)?void 0:p.padding)?u:"0.30rem","data-component":"selected-chips",children:[m.length<=L&&m.map((function(t,n){var r=v[t];return r?c.jsx(tm,{onRemove:function(){return _(t)},label:r.label,disableClear:null==e?void 0:e.disableClearAll},n):null})),L<=f&&m.length>f&&c.jsxs(t.Fragment,{children:[m.map((function(t,n){var r=v[t];return n>f-1?null:r?c.jsx(tm,{onRemove:function(){return _(t)},label:r.label,disableClear:null==e?void 0:e.disableClearAll},n):null})),c.jsx(cp,{tooltipContent:function(){return c.jsx(cp.Content,{children:m.map((function(e,n){var r;return n<=f-1?null:c.jsxs(t.Fragment,{children:[null==(r=v[e])?void 0:r.label,m.length!==n+1&&", "]},n)}))})},children:c.jsx(tm,{onRemove:function(){},label:m.length-f+" more",disableClear:!0})})]})]})]}),c.jsxs(sc,{open:F,children:[m.length!==E&&c.jsxs(t.Fragment,{children:[c.jsx(zd,{padding:8,children:c.jsx(np,{id:(null==e?void 0:e.id)+"-add-item",label:"Add "+e.placeholder,labelHidden:!0,autoFocus:!0,defaultValue:D,onChange:function(e){return I(e.target.value)}})}),A.map((function(e,n){return c.jsx(t.Fragment,{children:!e.item.hide&&!m.includes(e.refIndex)&&c.jsx(sc.Option,{onChange:function(){return _(e.refIndex)},label:e.item.label})},n)}))]}),m.length===E&&c.jsx(zd,{padding:8,children:"No Options"})]})]})]})},Zf={name:"1576s6y",styles:"display:flex;height:18px;min-width:max-content;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity));padding-top:0.125rem;padding-bottom:0.125rem;padding-left:0.5rem;padding-right:0.5rem;font-weight:500;--tw-text-opacity:1;color:rgb(30 41 59 / var(--tw-text-opacity))"},$f={name:"1ho1ybk",styles:"max-width:100%;flex:0 1 auto;font-size:0.75rem;line-height:1;font-weight:400"},em={name:"10bts8a",styles:"display:flex;flex:1 1 auto;flex-direction:row-reverse"},tm=function(e){return c.jsxs("div",{css:Zf,children:[c.jsx("div",{css:$f,children:e.label}),c.jsx("div",{css:em,children:c.jsxs("button",{onClick:function(t){t.preventDefault(),e.onRemove()},className:""+Aa.button,children:[c.jsxs("span",{className:""+Aa.srOnly,children:["Remove ",null==e?void 0:e.label]}),!(null!=e&&e.disableClear)&&c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Zl(p.css({name:"13h9wtn",styles:"margin-left:0.5rem;height:1rem;width:1rem;cursor:pointer;border-radius:9999px;opacity:0.7;:hover{opacity:1;}"}),""+Ia),"aria-label":"Remove",children:[c.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),c.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})]})})]})},nm=function(e){var n,r,i,o=t.useRef(void 0),a=Ol().cascadeFilterSelection,l=Bc().runQueriesCallback,s=e.filter,u=e.filterIndex,d=e.dataSets,p=e.onChange,f=t.useState(null),m=f[0],h=f[1],v=t.useState(!1),g=v[0],b=v[1],x=function(){var e=Y(W().mark((function e(t){var n;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wc(hr(s),l)(t);case 2:return h(n=e.sent),e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=Y(W().mark((function e(){var t,n;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),t=new AbortController,e.next=4,x(t.signal);case 4:(n=e.sent)&&n[0]?(qr("Filter forcing initial value to be set."),b(!1),h(n)):Wr("Ran select filter options to force a value, but no results were returned.");case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();t.useEffect((function(){!function(){var e=Y(W().mark((function e(){var t,n;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s.requiresValue||null!==s.value){e.next=6;break}return t=new AbortController,e.next=4,x(t.signal);case 4:(n=e.sent)&&n[0]?(qr("Filter forcing initial value to be set."),h(n),p(U({},s,{value:n[0].value}))):Wr("Ran select filter options to force a value, but no results were returned.");case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[JSON.stringify(s)]);var w=cr(s,d),C=t.useState([]),j=C[0],S=C[1];return t.useEffect((function(){var e;null!=s&&s.value&&(m&&(null==m?void 0:m.length)>0?S((e=null==s?void 0:s.value,m.reduce((function(t,n,r){return e.includes(n.value)&&t.push(r),t}),[]))):y())}),[s,m]),t.useEffect((function(){a&&null!==o.current&&JSON.stringify(o.current)!==JSON.stringify(s.optionsFilters)&&h(null),o.current=s.optionsFilters}),[s.optionsFilters]),c.jsxs("div",{children:[c.jsx(Tc,{id:"filter-"+u,labelHidden:!0,children:w}),c.jsx(Jf,{options:m||x,setSelected:function(t){m&&e.onChange(U({},s,{value:t.map((function(e){var t;return null==(t=m[e])?void 0:t.value})).filter((function(e){return void 0!==e}))}))},selected:j,isLoading:g,id:"filter-"+u,disableClearAll:!(null!=e&&e.showClearBtn)&&1===(null==(n=s.value)?void 0:n.length),selectedPrefix:w+(null!=(r=s.value)&&r.length&&(null==(i=s.value)?void 0:i.length)>0?" · ":""),showableChips:1},"filter-"+u)]})},rm=Object.assign((function(){return null}),{input:{border:"none",borderStyle:"none",borderWidth:"initial",borderColor:"initial",borderImage:"initial",backgroundColor:"transparent",boxShadow:"unset",fontFamily:"inherit",fontSize:"inherit",fontWeight:"inherit",color:"inherit",padding:"0",margin:"0",boxSizing:"border-box",outline:"none",appearance:"none",textAlign:"left"}}),im=pa({position:"relative",display:"inline-flex"}),om=pa({display:"flex",width:"100%",height:"100%",alignItems:"center"}),am=pa({width:18,display:"flex",verticalAlign:"middle",color:"rgb(72, 72, 72)",alignSelf:"center",justifyContent:"center"}),lm=Object.assign((function(){return null}),{picker:pa(U({},rm.input,{appearance:"searchfield"})),prefixStyle:function(e){var t,n,r;return pa({alignSelf:"center",paddingTop:0,paddingBottom:0,paddingRight:0,paddingLeft:"0.5rem",background:null==e||null==(t=e.input)?void 0:t.background,borderRadius:null==e||null==(n=e.input)?void 0:n.borderRadius,borderTopRightRadius:0,borderBottomRightRadius:0,color:null==e||null==(r=e.input)?void 0:r.color,whiteSpace:"nowrap",flex:1})},inputsWrapper:function(e){var t,n,r,i,o,a,l,s,u,d,c,p,f,m,h,v,g;return pa({position:"relative",border:null==e||null==(t=e.input)?void 0:t.border,boxShadow:null==e||null==(n=e.input)?void 0:n.boxShadow,borderRadius:null==e||null==(r=e.input)?void 0:r.borderRadius,fontSize:null==e||null==(i=e.input)?void 0:i.fontSize,background:null==e||null==(o=e.input)?void 0:o.background,cursor:"default","&:hover":{border:null==e||null==(a=e.input)||null==(l=a["&:hover"])?void 0:l.border,background:null==e||null==(s=e.input)||null==(u=s["&:hover"])?void 0:u.background,boxShadow:null==e||null==(d=e.input)||null==(c=d["&:hover"])?void 0:c.boxShadow},"&:focus":{border:null==e||null==(p=e.input)||null==(f=p["&:focus"])?void 0:f.border,background:null==e||null==(m=e.input)||null==(h=m["&:focus"])?void 0:h.background,boxShadow:null==e||null==(v=e.input)||null==(g=v["&:focus"])?void 0:g.boxShadow}})},inputs:om,separator:am,dateInput:function(e){var t,n,r,i,o,a;return pa({width:null==e||null==(t=e.date)?void 0:t.width,background:null==e||null==(n=e.input)?void 0:n.background,padding:null==e||null==(r=e.input)?void 0:r.padding,cursor:"default",borderRadius:null==e||null==(i=e.input)?void 0:i.borderRadius,color:null==e||null==(o=e.input)?void 0:o.color,border:0,fontWeight:null==e||null==(a=e.input)?void 0:a.fontWeight,"&:focus":{outline:0}})},timeInput:function(e){var t;return pa({width:null==e||null==(t=e.time)?void 0:t.width,paddingLeft:0,paddingRight:0})},clearContainer:function(){return pa({width:18,alignSelf:"center"})},wrapper:im,separatorIcon:function(e){return pa({verticalAlign:"middle",display:"block",fill:null==e?void 0:e.indicatorColor,height:18,width:18})},clearButton:function(e){return pa(U({},xc,{fill:null==e?void 0:e.indicatorColor}))}}),sm=function(e,t){var n,r,i,o,a,l,s,u,d,c,f,m,h,v,g,b,x,y,w,C,j,S,F,k,T,A,D,I,P,_,E,O,L,R,M,N,z,B,q,V,W,H,Y,U,G,K,X,Q,J,Z,$,ee,te,ne,re;return p.css("position:absolute;top:",t?t+16:40,"px;margin-right:0;border:1px solid ",us.colors.brand[20],";border-radius:",us.size.borderRadius,";z-index:1;background:#fff;padding-right:2px;.DateRangePickerInput{display:grid;background:",null==e||null==(n=e.input)?void 0:n.background,";border-radius:",null==e||null==(r=e.input)?void 0:r.borderRadius,"px;grid-template-columns:minmax(76px, auto) 18px minmax(76px, auto) 24px;}.DateInput:first-of-type{border-radius:0;border-top-right-radius:0;border-bottom-right-radius:0;}.DateInput:first-of-type>input{border-radius:0;border-top-right-radius:0;border-bottom-right-radius:0;padding-left:0.25rem;padding-right:0;}.DateInput_input{color:",null==e||null==(i=e.input)?void 0:i.color,";font-weight:",null==e||null==(o=e.input)?void 0:o.fontWeight,";background:",null==e||null==(a=e.input)?void 0:a.background,";outline:2px solid transparent;line-height:initial;&:hover:{border:",null==e||null==(l=e.input)||null==(s=l["&:hover"])?void 0:s.border,";background:",null==e||null==(u=e.input)||null==(d=u["&:hover"])?void 0:d.background,";}}.DateInput_input__focused input{border:",null==e||null==(c=e.input)||null==(f=c["&:focus"])?void 0:f.border,";background:",null==e||null==(m=e.input)||null==(h=m["&:focus"])?void 0:h.background,";}.DateInput:last-of-type>input{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0;padding-left:0.25rem;padding-right:0;}.DateInput{margin:0;padding:0;background:",null==e||null==(v=e.input)?void 0:v.background,";position:relative;display:grid;min-width:76px;align-content:center;padding-bottom:1px;}.DateRangePickerInput_clearDates{border:0;color:inherit;font:inherit;line-height:normal;cursor:pointer;padding:5px;margin:2.5px;background-color:transparent;}.DateInput_input+.DateInput_input{margin-left:8px;}.DateInput_input__focused{outline-offset:0px;}.DateRangePickerInput__withBorder{border:none;border-bottom:2px solid black;border-radius:0;}.DayPickerKeyboardShortcuts_show__bottomRight::before{border-right-color:black;}.DayPickerKeyboardShortcuts_show__bottomRight::after{border-right-color:white;}.DayPickerKeyboardShortcuts_show__topRight::before{border-right-color:black;}.DayPickerKeyboardShortcuts_show__topRight::after{border-right-color:white;}.PresetDateRangePicker_panel{padding:0 22px 11px;}.PresetDateRangePicker_button{position:relative;height:100%;text-align:center;background:0 0;border:2px solid #00a699;color:#00a699;padding:4px 12px;margin-right:8px;font:inherit;font-weight:700;line-height:normal;overflow:visible;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;}.PresetDateRangePicker_button:active{outline:0;}.PresetDateRangePicker_button__selected{color:#fff;background:#00a699;}.SingleDatePickerInput{display:inline-block;background-color:#fff;}.SingleDatePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb;}.SingleDatePickerInput__rtl{direction:rtl;}.SingleDatePickerInput__disabled{background-color:#f2f2f2;}.SingleDatePickerInput__block{display:block;}.SingleDatePickerInput__showClearDate{padding-right:30px;}.SingleDatePickerInput_clearDate{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}.SingleDatePickerInput_clearDate__default:focus,.SingleDatePickerInput_clearDate__default:hover{background:#dbdbdb;border-radius:50%;}.SingleDatePickerInput_clearDate__small{padding:6px;}.SingleDatePickerInput_clearDate__hide{visibility:hidden;}.SingleDatePickerInput_clearDate_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle;}.SingleDatePickerInput_clearDate_svg__small{height:9px;}.SingleDatePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px;}.SingleDatePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle;}.SingleDatePicker{position:relative;display:inline-block;}.SingleDatePicker__block{display:block;}.SingleDatePicker_picker{z-index:1;background-color:#fff;position:absolute;}.SingleDatePicker_picker__rtl{direction:rtl;}.SingleDatePicker_picker__directionLeft{left:0;}.SingleDatePicker_picker__directionRight{right:0;}.SingleDatePicker_picker__portal{background-color:rgba(0, 0, 0, 0.3);position:fixed;top:0;left:0;height:100%;width:100%;}.SingleDatePicker_picker__fullScreenPortal{background-color:#fff;}.SingleDatePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2;}.SingleDatePicker_closeButton:focus,.SingleDatePicker_closeButton:hover{color:darken(#cacccd, 10%);text-decoration:none;}.SingleDatePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd;}.DayPickerKeyboardShortcuts_buttonReset{background:0 0;border:0;border-radius:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;cursor:pointer;font-size:14px;}.DayPickerKeyboardShortcuts_buttonReset:active{outline:0;}.DayPickerKeyboardShortcuts_show{width:33px;height:26px;position:absolute;z-index:2;}.DayPickerKeyboardShortcuts_show::before{content:'';display:block;position:absolute;}.DayPickerKeyboardShortcuts_show__bottomRight{bottom:0;right:0;}.DayPickerKeyboardShortcuts_show__bottomRight::before{border-top:26px solid transparent;border-right:33px solid #00a699;bottom:0;right:0;}.DayPickerKeyboardShortcuts_show__bottomRight:hover::before{border-right:33px solid #008489;}.DayPickerKeyboardShortcuts_show__topRight{top:0;right:0;}.DayPickerKeyboardShortcuts_show__topRight::before{border-bottom:26px solid transparent;border-right:33px solid #00a699;top:0;right:0;}.DayPickerKeyboardShortcuts_show__topRight:hover::before{border-right:33px solid #008489;}.DayPickerKeyboardShortcuts_show__topLeft{top:0;left:0;}.DayPickerKeyboardShortcuts_show__topLeft::before{border-bottom:26px solid transparent;border-left:33px solid #00a699;top:0;left:0;}.DayPickerKeyboardShortcuts_show__topLeft:hover::before{border-left:33px solid #008489;}.DayPickerKeyboardShortcuts_showSpan{color:#fff;position:absolute;}.DayPickerKeyboardShortcuts_showSpan__bottomRight{bottom:0;right:5px;}.DayPickerKeyboardShortcuts_showSpan__topRight{top:1px;right:5px;}.DayPickerKeyboardShortcuts_showSpan__topLeft{top:1px;left:5px;}.DayPickerKeyboardShortcuts_panel{overflow:auto;background:#fff;border:1px solid #dbdbdb;border-radius:2px;position:absolute;top:0;bottom:0;right:0;left:0;z-index:2;padding:22px;margin:33px;text-align:left;}.DayPickerKeyboardShortcuts_title{font-size:16px;font-weight:700;margin:0;}.DayPickerKeyboardShortcuts_list{list-style:none;padding:0;font-size:14px;}.DayPickerKeyboardShortcuts_close{position:absolute;right:22px;top:22px;z-index:2;}.DayPickerKeyboardShortcuts_close:active{outline:0;}.DayPickerKeyboardShortcuts_closeSvg{height:15px;width:15px;fill:#cacccd;}.DayPickerKeyboardShortcuts_closeSvg:focus,.DayPickerKeyboardShortcuts_closeSvg:hover{fill:#82888a;}.CalendarDay{-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;font-size:14px;text-align:center;}.CalendarDay:active{outline:0;}.CalendarDay__defaultCursor{cursor:default;}.CalendarDay__default{border:1px solid #e4e7e7;color:#484848;background:#fff;}.CalendarDay__default:hover{background:#e4e7e7;border:1px solid #e4e7e7;color:inherit;}.CalendarDay__hovered_offset{background:#f4f5f5;border:1px double #e4e7e7;color:inherit;}.CalendarDay__outside{border:0;background:#fff;color:#484848;}.CalendarDay__outside:hover{border:0;}.CalendarDay__blocked_minimum_nights{background:#fff;border:1px solid #eceeee;color:#cacccd;}.CalendarDay__blocked_minimum_nights:active,.CalendarDay__blocked_minimum_nights:hover{background:#fff;color:#cacccd;}.CalendarDay__highlighted_calendar{background:#ffe8bc;color:#484848;}.CalendarDay__highlighted_calendar:active,.CalendarDay__highlighted_calendar:hover{background:",null==e||null==(g=e.calendar)||null==(b=g.selected)?void 0:b.background,";opacity:0.8;color:",null==e||null==(x=e.calendar)||null==(y=x.selected)?void 0:y.color,";}.CalendarDay__selected_span{background:",null==e||null==(w=e.calendar)||null==(C=w.selected)?void 0:C.background,";opacity:0.8;border:1px double ",null==e||null==(j=e.calendar)||null==(S=j.selected)?void 0:S.background,";color:",null==e||null==(F=e.calendar)||null==(k=F.selected)?void 0:k.color,";}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:",null==e||null==(T=e.calendar)||null==(A=T.selected)?void 0:A.background,";opacity:0.7;border:1px double ",null==e||null==(D=e.calendar)||null==(I=D.selected)?void 0:I.background,";color:",null==e||null==(P=e.calendar)||null==(_=P.selected)?void 0:_.color,";}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:",null==e||null==(E=e.calendar)||null==(O=E.selected)?void 0:O.background,";border:1px double ",null==e||null==(L=e.calendar)||null==(R=L.selected)?void 0:R.background,";color:",null==e||null==(M=e.calendar)||null==(N=M.selected)?void 0:N.color,";}.CalendarDay__hovered_span,.CalendarDay__hovered_span:hover{background:",null==e||null==(z=e.calendar)||null==(B=z.selected)?void 0:B.background,";border:1px double ",null==e||null==(q=e.calendar)||null==(V=q.selected)?void 0:V.background,";opacity:0.8;color:",null==e||null==(W=e.calendar)||null==(H=W.selected)?void 0:H.color,";}.CalendarDay__hovered_span:active{background:",null==e||null==(Y=e.calendar)||null==(U=Y.selected)?void 0:U.background,";border:1px double ",null==e||null==(G=e.calendar)||null==(K=G.selected)?void 0:K.background,";color:",null==e||null==(X=e.calendar)||null==(Q=X.selected)?void 0:Q.color,";}.CalendarDay__blocked_calendar,.CalendarDay__blocked_calendar:active,.CalendarDay__blocked_calendar:hover{background:#cacccd;border:1px solid #cacccd;color:#82888a;}.CalendarDay__blocked_out_of_range,.CalendarDay__blocked_out_of_range:active,.CalendarDay__blocked_out_of_range:hover{background:#fff;border:1px solid #e4e7e7;color:#cacccd;}.CalendarDay__hovered_start_first_possible_end{background:#eceeee;border:1px double #eceeee;}.CalendarDay__hovered_start_blocked_min_nights{background:#eceeee;border:1px double #e4e7e7;}.CalendarMonth{background:#fff;text-align:center;vertical-align:top;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.CalendarMonth_table{border-collapse:collapse;border-spacing:0;}.CalendarMonth_verticalSpacing{border-collapse:separate;}.CalendarMonth_caption{color:",null==e||null==(J=e.calendar)||null==(Z=J.title)?void 0:Z.color,";font-size:",(re=null==e||null==($=e.calendar)||null==(ee=$.title)?void 0:ee.fontSize)+("number"==typeof re?"px":""),";text-align:center;padding-top:22px;padding-bottom:37px;caption-side:initial;}.CalendarMonth_caption>strong{font-weight:",null==e||null==(te=e.calendar)||null==(ne=te.title)?void 0:ne.fontWeight,";}.CalendarMonth_caption__verticalScrollable{padding-top:12px;padding-bottom:7px;}.CalendarMonthGrid{background:#fff;text-align:left;z-index:0;}.CalendarMonthGrid__animating{z-index:1;}.CalendarMonthGrid__horizontal{position:absolute;left:9px;}.CalendarMonthGrid__vertical,.CalendarMonthGrid__vertical_scrollable{margin:0 auto;}.CalendarMonthGrid_month__horizontal{display:inline-block;vertical-align:top;min-height:100%;}.CalendarMonthGrid_month__hideForAnimation{position:absolute;z-index:-1;opacity:0;pointer-events:none;}.CalendarMonthGrid_month__hidden{visibility:hidden;}.DayPickerNavigation{position:relative;z-index:2;}.DayPickerNavigation__horizontal{height:0;}.DayPickerNavigation__verticalScrollable_prevNav{z-index:1;}.DayPickerNavigation__verticalDefault{position:absolute;width:100%;height:52px;bottom:0;left:0;}.DayPickerNavigation__verticalScrollableDefault{position:relative;}.DayPickerNavigation__bottom{height:auto;}.DayPickerNavigation__bottomDefault{-webkit-box-pack:justify;-ms-flex-pack:justify;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;}.DayPickerNavigation_button{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:0;padding:0;margin:0;}.DayPickerNavigation_button__default{border:1px solid #e4e7e7;background-color:#fff;color:#757575;}.DayPickerNavigation_button__default:focus,.DayPickerNavigation_button__default:hover{border:1px solid #c4c4c4;}.DayPickerNavigation_button__default:active{background:#f2f2f2;}.DayPickerNavigation_button__disabled{cursor:default;border:1px solid #f2f2f2;}.DayPickerNavigation_button__disabled:focus,.DayPickerNavigation_button__disabled:hover{border:1px solid #f2f2f2;}.DayPickerNavigation_button__disabled:active{background:0 0;}.DayPickerNavigation_button__horizontalDefault{position:absolute;top:18px;line-height:0.78;border-radius:3px;padding:6px 9px;}.DayPickerNavigation_bottomButton__horizontalDefault{position:static;margin:-10px 22px 30px;}.DayPickerNavigation_leftButton__horizontalDefault{left:22px;}.DayPickerNavigation_rightButton__horizontalDefault{right:22px;}.DayPickerNavigation_button__verticalDefault{padding:5px;background:#fff;box-shadow:0 0 5px 2px rgba(0, 0, 0, 0.1);position:relative;display:inline-block;text-align:center;height:100%;width:50%;}.DayPickerNavigation_nextButton__verticalDefault{border-left:0;}.DayPickerNavigation_nextButton__verticalScrollableDefault,.DayPickerNavigation_prevButton__verticalScrollableDefault{width:100%;}.DayPickerNavigation_svg__horizontal{height:19px;width:19px;fill:#82888a;display:block;}.DayPickerNavigation_svg__vertical{height:42px;width:42px;fill:#484848;}.DayPickerNavigation_svg__disabled{fill:#f2f2f2;}.DayPicker{position:relative;text-align:left;}.DayPicker__verticalScrollable{height:100%;}.DayPicker__hidden{visibility:hidden;}.DayPicker__withBorder{box-shadow:0 2px 6px rgba(0, 0, 0, 0.05),0 0 0 1px rgba(0, 0, 0, 0.07);border-radius:3px;}.DayPicker_portal__horizontal{box-shadow:none;position:absolute;left:50%;top:50%;}.DayPicker_portal__vertical{position:initial;}.DayPicker_focusRegion{outline:0;}.DayPicker_calendarInfo__horizontal,.DayPicker_wrapper__horizontal{display:inline-block;vertical-align:top;}.DayPicker_weekHeaders{position:relative;}.DayPicker_weekHeaders__horizontal{margin-left:9px;}.DayPicker_weekHeader{color:#757575;position:absolute;top:62px;z-index:2;text-align:left;}.DayPicker_weekHeader__vertical{left:50%;}.DayPicker_weekHeader__verticalScrollable{top:0;display:table-row;border-bottom:1px solid #dbdbdb;background:#fff;margin-left:0;left:0;width:100%;text-align:center;}.DayPicker_weekHeader_ul{list-style:none;margin:1px 0;padding-left:0;padding-right:0;font-size:14px;}.DayPicker_weekHeader_li{display:inline-block;text-align:center;}.DayPicker_transitionContainer{position:relative;overflow:hidden;border-radius:3px;}.DayPicker_transitionContainer__horizontal{-webkit-transition:height 0.2s ease-in-out;-moz-transition:height 0.2s ease-in-out;transition:height 0.2s ease-in-out;}.DayPicker_transitionContainer__vertical{width:100%;}.DayPicker_transitionContainer__verticalScrollable{padding-top:20px;height:100%;position:absolute;top:0;bottom:0;right:0;left:0;overflow-y:scroll;}.DateInput__block{width:100%;}.DateInput__disabled{background:#f2f2f2;color:#dbdbdb;}.DateInput_input{width:100%;}.DateInput_input__small{font-size:15px;line-height:18px;letter-spacing:0.2px;padding:7px 7px 5px;}.DateInput_input__regular{font-weight:auto;}.DateInput_input__readOnly{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.DateInput_input__disabled{background:#f2f2f2;font-style:italic;}.DateInput_screenReaderMessage{border:0;clip:rect(0, 0, 0, 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.DateInput_fang{position:absolute;width:20px;height:10px;left:22px;z-index:2;}.DateInput_fangShape{fill:#fff;}.DateInput_fangStroke{stroke:#dbdbdb;fill:transparent;}.DateRangePickerInput__disabled{background:#f2f2f2;}.DateRangePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb;}.DateRangePickerInput__rtl{direction:rtl;}.DateRangePickerInput__block{display:block;}.DateRangePickerInput_arrow{display:inline-block;vertical-align:middle;color:#484848;align-self:center;}.DateRangePickerInput_arrow_svg{vertical-align:middle;fill:#484848;height:18px;width:18px;}.DateRangePickerInput_clearDates__small{padding:6px;}.DateRangePickerInput_clearDates__hide{cursor:inherit;&:hover{background:unset;}}.DateRangePickerInput_clearDates_svg{fill:rgb(75 85 99);stroke:rgb(75 85 99);height:8px;width:8px;vertical-align:middle;}.DateRangePickerInput_clearDates_svg__small{height:9px;}.DateRangePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px;}.DateRangePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle;}.DateRangePicker{position:relative;display:grid;align-content:center;}.DateRangePicker__block{display:block;}.DateRangePicker_picker{z-index:1;background-color:#fff;position:absolute;}.DateRangePicker_picker__rtl{direction:rtl;}.DateRangePicker_picker__directionLeft{left:0;}.DateRangePicker_picker__directionRight{right:0;}.DateRangePicker_picker__portal{background-color:rgba(0, 0, 0, 0.3);position:fixed;top:0;left:0;height:100%;width:100%;}.DateRangePicker_picker__fullScreenPortal{background-color:#fff;}.DateRangePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2;}.DateRangePicker_closeButton:focus,.DateRangePicker_closeButton:hover{color:darken(#cacccd, 10%);text-decoration:none;}.DateRangePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd;}","")},um=function(e){var t,n=rs();return c.jsx("div",{style:{display:"inline-block"},children:c.jsx("input",{type:"text",name:null==e?void 0:e.name,value:null==e?void 0:e.value,placeholder:null==e?void 0:e.label,"aria-label":null==e?void 0:e.label,autoComplete:"off",className:""+lm.dateInput(null==n||null==(t=n.forms)?void 0:t.dateTime),onChange:function(t){return null==e?void 0:e.onChange(t.currentTarget.value)}})})},dm=function(e){return c.jsx(w.DayPickerRangeController,{initialVisibleMonth:function(){return y()},startDate:null==e?void 0:e.startDate,endDate:null==e?void 0:e.endDate,onDatesChange:null==e?void 0:e.onDatesChange,focusedInput:null==e?void 0:e.focusedInput,onFocusChange:null==e?void 0:e.onFocusChange,numberOfMonths:2,hideKeyboardShortcutsPanel:!0,minimumNights:0,noBorder:!0,isOutsideRange:function(){return!1},renderMonthElement:function(e){var t,n=e.month,r=e.onYearSelect;return c.jsxs("span",{children:[c.jsxs("span",{className:""+Aa.bold,children:[n.format("MMMM")," "]}),c.jsx("select",{value:n.year(),onChange:function(e){return r(n,e.target.value)},className:""+lm.picker,children:(t=y().year(),Array.from({length:25},(function(e,n){return t-n})).map((function(e){return c.jsx("option",{value:e,children:e},"year-"+e)})))})]})}})},cm=function(e){var n,r=t.useState(null==e||null==(n=e.value)?void 0:n.format(null==e?void 0:e.timeFormat)),i=r[0],o=r[1],a=t.useRef(null);t.useEffect((function(){e.shouldClear&&a.current&&(o(void 0),a.current.value="")}),[e.shouldClear]),t.useEffect((function(){var t;return o(null==e||null==(t=e.value)?void 0:t.format(null==e?void 0:e.timeFormat))}),[null==e?void 0:e.value]);var l=t.useState(!1),s=l[0],u=l[1],d=t.useRef(null),p=function(e){for(var t=[],n=0;n<1440;n+=15){var r=Math.floor(n/60),i=n%60,o=("0"+r).slice(-2)+":"+("0"+i).slice(-2),a=y().hour(r).minute(i).second(0);t.push({label:o,value:a})}return t}();return ns(d,(function(){u(!1)})),t.useEffect((function(){if(i){var t=pm(i,null==e?void 0:e.timeFormat);t&&(null==e||e.onChange(t),u(!1))}}),[i]),c.jsxs("div",{ref:d,children:[c.jsx("div",{style:{position:"relative"},children:c.jsx("input",{ref:a,type:"text",name:null==e?void 0:e.name,value:i,placeholder:null==e?void 0:e.label,"aria-label":null==e?void 0:e.label,autoComplete:"off",className:null==e?void 0:e.className,onChange:function(e){o(e.currentTarget.value)},onClick:function(t){return function(t){u(!s),(null==e?void 0:e.onClick)&&(null==e||e.onClick(t))}(t)}})}),c.jsx("div",{style:{maxWidth:80},children:c.jsx(sc,{open:s,fixedHeight:!0,children:p.map((function(t,n){return c.jsx(sc.Option,{label:t.label,onChange:function(n){var r;null==n||n.stopPropagation(),o((r=t.value).format(null==e?void 0:e.timeFormat)),null==e||e.onChange(r),u(!1)}},n)}))})})]},null==e?void 0:e.name)},pm=function(e,t){var n=y(e,"HH:mm:ss",!0);return y(e,"HH:mm",!0).isValid()||n.isValid()?y(e,t):null},fm=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b=e.startDate,x=e.endDate,w=e.startTime,C=e.endTime,j=e.onChange,S=e.id,F=e.prefix,k=e.onClear,T=e.label,A=e.dateFormat,D=e.timeFormat,I=e.type;A=null!=(n=A)?n:"DD/MM/YYYY",D=null!=(r=D)?r:"HH:mm";var P=t.useState({start:w?pm(w,D):null,end:C?pm(C,D):null}),_=P[0],E=P[1],O=t.useState(!1),L=O[0],R=O[1],M=t.useState(b?y(b):null),N=M[0],z=M[1],B=t.useState(!1),q=B[0],V=B[1];t.useEffect((function(){q&&V(!1)}),[q]);var W=t.useState(x?y(x):null),H=W[0],Y=W[1],U=t.useState(void 0),G=U[0],K=U[1],X=t.useState(void 0),Q=X[0],J=X[1],Z=t.useState("startDate"),$=Z[0],ee=Z[1],te=t.useRef(null),ne=t.useRef(null),re=rs(),ie=t.useCallback((function(e){var t=e.startDate,n=e.endDate;y(t).isSame(te.current)&&y(n).isSame(ne.current)||(E({start:t?pm("00:00",D):null,end:n?pm("23:59",D):null}),z(t),Y(n),j({startDate:t?t.toDate():null,endDate:n?n.toDate():null,startTime:"date_time"===I?"00:00":null,endTime:"date_time"===I?"23:59":null}),t&&n&&R(!1))}),[j]),oe=t.useCallback((function(e){E({start:e.start,end:e.end}),j({startDate:N?N.toDate():null,endDate:H?H.toDate():null,startTime:e.start?e.start.format("HH:mm"):null,endTime:e.end?e.end.format("HH:mm"):null})}),[j]);t.useEffect((function(){te.current=N}),[N]),t.useEffect((function(){ne.current=H}),[H]);var ae=t.useRef(null);ns(ae,(function(){R(!1),ee("startDate")}));var le=N?N.format(A):"",se=H?H.format(A):"",ue=t.useCallback((function(){R(!1),z(null),Y(null),K(void 0),J(void 0),j({startDate:null,endDate:null,endTime:null,startTime:null}),k(),E({start:null,end:null}),V(!0)}),[j,k]);t.useEffect((function(){if(G){var e=mm(G,A),t=mm(Q||"",A);null===e&&null===t||ie({startDate:e||N,endDate:t||H})}}),[G,Q]);var de=t.useRef(null),ce=t.useState(0),pe=ce[0],fe=ce[1];return t.useEffect((function(){de.current&&fe(de.current.getBoundingClientRect().height)}),[de.current]),c.jsxs("div",{className:""+lm.wrapper,id:""+(null!=S?S:"date-picker"),children:[c.jsx("div",{className:""+lm.inputsWrapper(null==re||null==(i=re.forms)?void 0:i.dateTime),"data-themeapi":"forms.dateTime.input",onClick:function(){R(!0),K(void 0),J(void 0),ee("startDate"),Y(null)},ref:de,children:c.jsxs("div",{className:""+lm.inputs,children:[F&&c.jsxs("div",{className:""+lm.prefixStyle(null==re||null==(o=re.forms)?void 0:o.dateTime),children:[null!=T?T:"Custom"," ·"]}),c.jsxs(Gd,{gap:0,alignItems:"center",children:[c.jsx(um,{name:"start_date",value:null!=G?G:le,label:"Start Date",onChange:function(e){return K(e)},dateFormat:A}),"date_time"===I&&c.jsx(t.Fragment,{children:c.jsx(cm,{label:"Time",name:"start_time",onChange:function(e){oe({start:e,end:_.end})},className:lm.dateInput(null==re||null==(a=re.forms)?void 0:a.dateTime)+" "+lm.timeInput(null==re||null==(l=re.forms)?void 0:l.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:D,value:_.start,shouldClear:q})})]}),c.jsx("div",{"aria-hidden":"true",role:"presentation",className:""+lm.separator,children:c.jsx("svg",{focusable:"false",viewBox:"0 0 1000 1000",className:""+lm.separatorIcon(null==re||null==(s=re.forms)?void 0:s.dateTime),"data-themeapi":"forms.dateTime.indicatorColor",children:c.jsx("path",{d:"M694 242l249 250c12 11 12 21 1 32L694 773c-5 5-10 7-16 7s-11-2-16-7c-11-11-11-21 0-32l210-210H68c-13 0-23-10-23-23s10-23 23-23h806L662 275c-21-22 11-54 32-33z"})})}),c.jsxs(Gd,{gap:0,children:[c.jsx(um,{name:"end_date",value:null!=Q?Q:se,label:"End Date",onChange:function(e){return J(e)},dateFormat:A}),"date_time"===I&&c.jsx(cm,{label:"Time",name:"end_time",onChange:function(e){oe({start:_.start,end:e})},className:lm.dateInput(null==re||null==(u=re.forms)?void 0:u.dateTime)+" "+lm.timeInput(null==re||null==(d=re.forms)?void 0:d.dateTime),onClick:function(e){return e.stopPropagation()},timeFormat:D,value:_.end,shouldClear:q})]}),c.jsx("div",{className:""+lm.clearContainer(),children:c.jsx(bc,{onClear:ue,className:""+lm.clearButton(null==re||null==(p=re.forms)?void 0:p.dateTime),"aria-label":"Clear Dates",fill:null==re||null==(f=re.forms)||null==(m=f.select)?void 0:m.indicatorColor,stroke:null==re||null==(h=re.forms)||null==(v=h.select)?void 0:v.indicatorColor})})]})}),L&&c.jsx("div",{className:""+sm(null==re||null==(g=re.forms)?void 0:g.dateTime,pe),"data-themeapi":"forms.dateTime.calendar",ref:ae,children:c.jsx(dm,{startDate:N,endDate:H,onDatesChange:function(e){K(void 0),J(void 0),ie(e)},focusedInput:$,onFocusChange:function(e){return ee(e)}})})]})},mm=function(e,t){return y(e,t,!0).isValid()?y(e,t):null},hm=function(e){var n,r=e.placeholder,i=e.currentValue,o=e.dateFilterOptions,a=e.onChangeToTimeRange,l=e.showClearBtn,s=Ol().textOverrides,u=t.useState(i),d=u[0],p=u[1],f=Object.keys(o).map((function(e){return{value:e,label:o[e].description}}));return a&&(f=[].concat(f,[{label:null!=(n=s["dashboard-filters.custom-range"])?n:"Custom range",value:"__vizzly_custom"}])),c.jsx(Ac,{showClearBtn:void 0===l||l,options:f,onChange:function(t){"__vizzly_custom"===t?(p(t),e.onChangeToTimeRange&&e.onChangeToTimeRange()):(p(t),e.onChange&&e.onChange(t))},selected:d,anchorLeft:!0,placeholder:r,selectedPrefix:null!=e&&e.hasSelectedPrefix?r+" · ":void 0,maintainOptionOrder:!0})},vm=function(e){var n=e.hasCustomPicker,r=null==e?void 0:e.currentValue,i=r.value,o=r.type,a=t.useState("fixedRange"==(null==i?void 0:i.type)),l=a[0],s=a[1],u="fixedRange"==(null==i?void 0:i.type)&&(null==i?void 0:i.after)||void 0,d="fixedRange"==(null==i?void 0:i.type)&&(null==i?void 0:i.before)||void 0,p="dateAndTimeFilter"===o&&d instanceof Date?null==d?void 0:d.toLocaleTimeString():null,f="dateAndTimeFilter"===o&&u instanceof Date?null==u?void 0:u.toLocaleTimeString():null;return c.jsxs(t.Fragment,{children:[!l&&c.jsx(hm,{showClearBtn:e.showClearBtn,dateFilterOptions:e.dateFilterOptions,placeholder:null==e?void 0:e.placeholder,onChangeToTimeRange:function(){s(!0)},onChange:function(t){n&&s(!1),e.onChange&&e.onChange(t)},currentValue:"relative"==(null==i?void 0:i.type)&&i.value||null,hasSelectedPrefix:!0,custom:n}),n&&l&&c.jsx(fm,{label:null==e?void 0:e.placeholder,id:null==e?void 0:e.id,startDate:u,endDate:d,startTime:f,endTime:p,onChange:function(t){var n=t.startDate,r=t.endDate;n&&r?e.onChange&&e.onChange(function(e,t,n,r){return{startDate:gm(t,e||"00:00"),endDate:gm(r,n||"23:59")}}(t.startTime,n,t.endTime,r)):t||e.onChange&&e.onChange(null)},prefix:!0,onClear:function(){null==e||e.onChange(null),s(!1)},type:"dateAndTimeFilter"===o?"date_time":"date"})]})},gm=function(e,t){var n=t.split(":").map(Number),r=n[1];return e.setHours(n[0]),e.setMinutes(r),e},bm=function(e){var t=e.onChange,n=e.filter,r=e.type;return c.jsx(vm,{hasCustomPicker:!0,showClearBtn:e.showClearBtn,dateFilterOptions:null==e?void 0:e.dateFilterOptions,onChange:function(e){"string"==typeof e?t({type:r,appliesToFields:n.appliesToFields,title:n.title,managedByConfiguration:n.managedByConfiguration,requiresValue:n.requiresValue,value:{type:"relative",value:e}}):e&&e.endDate&&e.startDate?t({type:r,appliesToFields:n.appliesToFields,managedByConfiguration:n.managedByConfiguration,requiresValue:n.requiresValue,title:n.title,value:{type:"fixedRange",before:e.endDate,after:e.startDate}}):null===e&&t({type:r,managedByConfiguration:n.managedByConfiguration,requiresValue:n.requiresValue,appliesToFields:n.appliesToFields,title:n.title,value:null})},currentValue:n,placeholder:cr(n,e.dataSets)})},xm=function(e){var t=e.filter,n=e.filterIndex,i=e.onChange,o=e.shouldAlwaysHaveValue,a=Ol().queryEngineConfig,l=function(e){var t=function(e,t){return r.alternatives().conditional(".type",{is:"singleSelectFilter",then:oe(e,t)}).conditional(".type",{is:"dateFilter",then:le(e,t,"dateFilter")}).conditional(".type",{is:"dateAndTimeFilter",then:le(e,t,"dateAndTimeFilter")}).conditional(".type",{is:"multiSelectFilter",then:ae(e,t)})}(a,e.requiresValue).validate(e).error;t?Hr("Invalid additional filter. Therefore ignoring the change",t,e):i(e)},s=function(n){o&&null==n.value?"dateFilter"!==t.type&&"dateAndTimeFilter"!==t.type||l({type:"dateFilter",appliesToFields:t.appliesToFields,title:t.title,value:{type:"relative",value:Object.keys(null==e?void 0:e.dateFilterOptions)[0]},requiresValue:t.requiresValue,managedByConfiguration:t.managedByConfiguration}):l(n)};return t.appliesToFields.length>0?"singleSelectFilter"==t.type?c.jsx(Hc,{showClearBtn:!o,filter:t,filterIndex:n,onChange:s,dataSets:e.dataSets}):"multiSelectFilter"==t.type?c.jsx(nm,{showClearBtn:!o,filter:t,filterIndex:n,onChange:s,dataSets:e.dataSets}):"dateFilter"==t.type||"dateAndTimeFilter"==t.type?c.jsx(bm,{showClearBtn:!o,dateFilterOptions:null==e?void 0:e.dateFilterOptions,filter:t,onChange:s,dataSets:e.dataSets,type:t.type}):null:null},ym={name:"1gqeage",styles:"margin-right:0.75rem"},wm=function(e){var n,r=Wd(),o=r.ref,a=r.show,l=r.position,s=r.close,u=r.open,d=Ol().dateFilterOptions;return c.jsxs(t.Fragment,{children:[(e.localFilters.length>0||e.zoomControl)&&c.jsxs("div",{ref:o,children:[e.zoomControl&&e.zoomControl.show&&c.jsx("button",{css:ym,onClick:e.zoomControl.onReset,children:c.jsx(Wl,{})}),e.localFilters.length>0&&c.jsx("button",{onClick:function(){return u()},"aria-label":"Show Local Filter",className:""+Aa.button,children:c.jsx(zl,{active:(n=e.localFilters,i.some(n,(function(e){var t=e.value;return!(i.isArray(t)&&0===t.length||!t)})))})})]}),a&&c.jsx(qd,{onClose:function(){return s()},width:320,position:l,children:c.jsx(qd.Options,{padding:!0,children:c.jsx(zd,{padding:"0.5rem",children:c.jsx(Gd,{direction:"column",gap:"0.5rem","data-component":"filters",children:[].concat(e.localFilters).map((function(t,n){return c.jsx(zd,{children:c.jsx(xm,{dataSets:[e.dataSet],filterIndex:n,filter:t,onChange:function(t){var r=[].concat(e.localFilters);r[n]=t,e.setLocalFilters(r)},dateFilterOptions:d})},"local_filter_"+n)}))})})})})]})},Cm=Object.assign((function(){return null}),{title:function(e){var t,n,r,i,o,a,l,s,u;return pa({padding:0,fontSize:null==e||null==(t=e.title)?void 0:t.fontSize,color:null==e||null==(n=e.title)?void 0:n.color,fontWeight:null==e||null==(r=e.title)?void 0:r.fontWeight,fontFamily:null==e||null==(i=e.title)?void 0:i.fontFamily,margin:null!=(o=null==e||null==(a=e.title)?void 0:a.margin)?o:0,textAlign:null!=(l=null==e||null==(s=e.title)?void 0:s.textAlign)?l:"left",lineHeight:null==e||null==(u=e.title)?void 0:u.lineHeight})},subject:function(e){var t,n,r,i,o,a,l,s,u;return pa({position:"relative",fontSize:null==e||null==(t=e.subject)?void 0:t.fontSize,color:null==e||null==(n=e.subject)?void 0:n.color,fontWeight:null==e||null==(r=e.subject)?void 0:r.fontWeight,fontFamily:null==e||null==(i=e.subject)?void 0:i.fontFamily,margin:null!=(o=null==e||null==(a=e.subject)?void 0:a.margin)?o:0,marginBottom:"0.3rem",textAlign:null!=(l=null==e||null==(s=e.subject)?void 0:s.textAlign)?l:"left",lineHeight:null==e||null==(u=e.subject)?void 0:u.lineHeight,padding:0})},verified:function(e){var t;return pa({height:18,color:null==e||null==(t=e.verified)?void 0:t.color})}}),jm=function(e){var t,n=null!=(t=null==e?void 0:e.as)?t:"span";return c.jsx(n,{className:""+Aa.srOnly,htmlFor:null==e?void 0:e.htmlFor,children:null==e?void 0:e.children})},Sm=function(e){var n=e.measures,r=Ol();return c.jsx(t.Fragment,{children:n&&(null==e?void 0:e.activeMeasures)&&c.jsx(Gd,{direction:"column",gap:"1rem",children:Object.keys(n).map((function(t,i){var a=function(e,t,n,r){try{var i,o=st(e,{supportedAggregates:t,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),a=[{label:null!=(i=Mn(n,o.field).publicName+" ("+o.function+")")?i:"",value:o}];return r[e].map((function(e){a.push({label:Mn(n,e.field).publicName+" ("+e.function+")",value:e})})),a}catch(e){if(e instanceof qt)return[];throw e}}(t,r.queryEngineConfig.supportedAggregates,e.dataSet,n),l=function(e,t){var n=e.filter((function(e){return null==t?void 0:t.some((function(t){return o.isEqual(e.value,t)}))}));return n.length>0?n[0].value:null}(a,e.activeMeasures);return c.jsx(Ac,{label:"Replace Parameter "+(i+1),labelHidden:!0,id:"replace-parameter-"+i,selected:l,onChange:function(t){return e.setMeasure(t,l)},options:a},t)}))})})},Fm=function(e,t){return!!On(e).supportedFeatures.parameters&&!(i.isEmpty(t)||!Tm(t)&&!km(t))},km=function(e){return!i.isEmpty(null==e?void 0:e.group)},Tm=function(e){return!i.isEmpty(null==e?void 0:e.measure)},Am=function(e){var n=e.activeDimensions,r=e.group,i=e.dataSet,o=Ol().queryEngineConfig;return c.jsx(t.Fragment,{children:r&&n&&c.jsx(Gd,{direction:"column",gap:"1rem",children:Object.keys(r).map((function(t,n){var a=Ee(t,o.supportedTimeTruncFunctions),l=a?function(e,t,n,r){if(!t||!n[r])return[];var i=Mn(e,t.field);if(!i)return[];var o=[{label:i.publicName+" ("+t.truncate+")",value:t}];return n[r].forEach((function(t){if(t&&"truncate"in t){var n=Mn(e,t.field);n&&o.push({label:n.publicName+" ("+t.truncate+")",value:t})}})),o}(i,a,r,t):function(e,t,n){var r;if(!t||null==e||!e.fields||!n[t])return[];var i=Mn(e,t);if(!i)return[];var o=[{label:null!=(r=""+i.publicName)?r:"",value:{field:t,function:"none"}}];return n[t].forEach((function(t){if(t&&"function"in t){var n,r=Mn(e,t.field);r&&o.push({label:r.publicName,value:{field:t.field,function:null!=(n=t.function)?n:"none"}})}})),o}(i,t,r),s=a?Dm(l,null==e?void 0:e.activeTimeDimension):Im(l,null==e?void 0:e.activeDimensions);return c.jsx(Ac,{labelHidden:!0,label:"Replace Parameter "+(n+1),id:"replace-parameter-"+n,selected:s,onChange:function(t){return null==e?void 0:e.setDimension(t,s)},options:l},t)}))})})},Dm=function(e,t){var n;return null==(n=e.find((function(e){return o.isEqual(e.value,t)})))?void 0:n.value},Im=function(e,t){var n=e.filter((function(e){return null==t?void 0:t.some((function(t){return e.value.field===t.field&&e.value.function===t.function}))}));return n.length>0?n[0].value:null},Pm=function(e,t,n){return null==n?n:null==n?void 0:n.map((function(n){return n.field===e.field&&n.function===e.function?U({},t):n}))},_m=function(e,t,n){return null==n?void 0:n.map((function(n){return o.isEqual(n,e)?t:n}))},Em=function(e){var n=Wd(),r=n.ref,i=n.show,o=n.position,a=n.close,l=n.open,s=e.parameters;return Fm(null==e?void 0:e.componentType,s)?c.jsxs(t.Fragment,{children:[c.jsx("div",{ref:r,children:c.jsxs("button",{onClick:function(){return l()},className:""+Aa.button,children:[c.jsx("span",{className:""+Ta,children:"Change Parameters"}),c.jsx(cp,{tooltipContent:function(){return"Change Parameters"},children:c.jsx(ql,{})})]})}),i&&c.jsx(qd,{onClose:function(){return a()},width:320,position:o,children:c.jsx(qd.Options,{padding:!0,children:c.jsx(zd,{padding:"0.5rem",children:c.jsxs(Gd,{direction:"column",gap:"0.5rem","data-component":"parameters",children:[km(s)&&Tm(s)&&c.jsx(gf,{marginBottom:0,children:"Measures"}),c.jsx(Sm,{measures:null==s?void 0:s.measure,dataSet:null==e?void 0:e.dataSet,activeMeasures:null==e?void 0:e.activeMeasures,setMeasure:function(t,n){null==e||e.setParameterUpdate({updatedMeasures:_m(n,t,e.activeMeasures)})}}),km(s)&&Tm(s)&&c.jsx(gf,{marginBottom:0,children:"Groups"}),c.jsx(Am,{group:null==s?void 0:s.group,dataSet:null==e?void 0:e.dataSet,activeDimensions:null==e?void 0:e.activeDimension,activeTimeDimension:null==e?void 0:e.activeTimeDimension,setDimension:function(t,n){"truncate"in t||!n||"truncate"in n||null==e||e.setParameterUpdate({updatedDimension:Pm(n,t,null==e?void 0:e.activeDimension)}),"truncate"in t&&(null==e||e.setParameterUpdate({updatedTimeDimension:t}))}})]})})})})]}):null},Om={name:"18pw007",styles:"position:absolute;top:0px;right:0px;z-index:2"},Lm={name:"195ggdj",styles:"position:absolute;top:0.75rem;right:0.75rem;display:flex;flex-direction:row;gap:0.625rem"},Rm=function(e){var n,r,o=rs(),a=Ol().organizationName;return e.displayTitle||e.displaySubject||!i.isEmpty(e.localFilters)||Fm(null==e?void 0:e.componentType,e.parameters)||null!=e&&e.verified?c.jsxs(c.Fragment,{children:[c.jsxs(Gd,{direction:"column",gap:"0.25rem","data-component":"titles",children:[c.jsxs(Gd,{alignItems:"center",gap:"0.25rem",paddingRight:"2.5rem",children:[e.displayTitle&&c.jsx(hf,{style:{fontFamily:null==o||null==(n=o.titles)?void 0:n.fontFamily},className:""+Cm.title(null==o?void 0:o.charts),"data-themeapi":"charts.title",children:e.displayTitle}),(null==e?void 0:e.verified)&&(null==e?void 0:e.library)&&c.jsxs(cp,{tooltipContent:function(){return c.jsxs(t.Fragment,{children:["Verified ",a&&"by "+a]})},children:[c.jsx(v.BadgeCheckIcon,{className:""+Cm.verified(null==o?void 0:o.library),"data-testid":"badge","data-themeapi":"library.verified.icon"}),c.jsxs(jm,{children:["Verified ",a&&"by "+a]})]})]}),e.displaySubject&&c.jsx(vf,{style:{fontFamily:null==o||null==(r=o.baseFont)?void 0:r.fontFamily},className:""+Cm.subject(null==o?void 0:o.charts),"data-themeapi":"charts.subject",children:e.displaySubject})]}),!(null!=e&&e.library)&&c.jsx("div",{css:Om,children:c.jsxs("div",{css:Lm,children:[c.jsx(Em,{activeDimension:null==e?void 0:e.dimension,activeTimeDimension:e.timeDimension,activeMeasures:null==e?void 0:e.measure,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.componentType,dataSet:e.dataSet,setParameterUpdate:function(t){return e.setParameterUpdate&&e.setParameterUpdate(t)}}),c.jsx(wm,{setLocalFilters:e.setLocalFilters,localFilters:e.localFilters,zoomControl:e.zoomControl,dataSet:e.dataSet})]})})]}):null},Mm=t.memo((function(e){return c.jsx(c.Fragment,{children:e.annotations.map((function(t){return c.jsxs(C.Annotation,{dataKey:e.dataKey,datum:t.datum,dx:t.xOffset,dy:t.yOffset,children:[c.jsx(C.AnnotationConnector,{stroke:"#dedede"}),c.jsx(C.AnnotationLabel,{backgroundPadding:5,title:t.title,showAnchorLine:!1,titleFontSize:"10px",backgroundProps:{opacity:1}})]})}))})}),(function(e,t){return JSON.stringify(e)==JSON.stringify(t)})),Nm=function(e){var t=e.dataKey,n=e.data;if(!e.show||i.isEmpty(e.generateAnnotations))return null;var r=function(e,t,n){var r=i.minBy(n,(function(e){return e[t]})),o=i.maxBy(n,(function(e){return e[t]})),a=[];return r&&a.push({title:"Low of "+r[t],datum:r,yOffset:15,xOffset:10}),o&&a.push({title:"High of "+o[t],datum:o,yOffset:-15,xOffset:10}),a}(0,t,n||[]);return c.jsx(Mm,{dataKey:t,annotations:r})},zm=function(e){var t=function(t){var n=function(e){return function(t){t=t||{};var n={variants:e.variants,compoundVariants:e.compoundVariants},r=U({},i.omit(e,["variants","compoundVariants"].concat(Object.keys(t))));return Object.keys(t).forEach((function(e){var i=t?t[e]:null;i&&(r=U({},r,n.variants&&n.variants[e][i]||{}))})),(n.compoundVariants||[]).forEach((function(e){var n=U({},e.css);i.every(Object.keys(i.omit(e,["css"])),(function(n){var r;return e[n]==(null==(r=t)?void 0:r[n])}))&&(r=U({},r,n))})),r}}(e)(t);return p.css(n,"","")};return t.toString=t,t},Bm="\n.visx-tooltip {\n z-index: 14294967294; /* or whatever height is appropriate */\n}",qm=function(e,t){return t?e-40:e},Vm=p.css({display:"inline-flex",position:"relative",flexDirection:"row",gap:24,padding:0,height:40},"",""),Wm=p.css({name:"1lozhax",styles:"color:inherit;margin:0 0 0 4px;flex:1;display:flex;justify-content:left;font-family:inherit;font-size:0.7rem;opacity:1;font-weight:400"}),Hm=Object.assign((function(){return null}),{icon:function(e){return zm({marginLeft:"2px",variants:{type:{lines:{width:8,paddingTop:3,maxHeight:1,backgroundColor:e},bar:{height:8,width:8,backgroundColor:e,borderRadius:2},area:{height:0,width:0,borderBottom:"8px solid "+e,borderLeft:"8px solid transparent"},scatter:{height:8,borderRadius:"50%",width:8,backgroundColor:e},pie:{height:8,borderRadius:"50%",width:8,backgroundColor:e}}}})},container:Vm,label:Wm,scrollbar:p.css({name:"1azakc",styles:"text-align:center"}),reason:function(e){return p.css(Wm,{zIndex:999,pointerEvents:"none",overflow:"hidden",position:"absolute",marginLeft:"20px",marginTop:"-5px",padding:"3px 5px",boxShadow:"0 1px 3px 0 rgba(0,0,0,0.1),0 1px 2px 0 rgba(0,0,0,0.06)",borderRadius:"5px",paddingLeft:"12px",paddingRight:"8px",background:"linear-gradient(90deg, "+e+" 5px, rgba(255,255,255,1) 5px)"},"","")}}),Ym=function(e){var n,r,i=t.useState(!1),o=i[1];return c.jsx("div",{className:(r=i[0],p.css(U({overflowX:r?"auto":"hidden",whiteSpace:"nowrap"},r?{"&::-webkit-scrollbar":{height:8,width:8,opacity:.6},"&:active::-webkit-scrollbar-thumb":{visibility:"visible"},"&:focus::-webkit-scrollbar-thumb":{visibility:"visible"},"&:hover::-webkit-scrollbar-thumb":{visibility:"visible"},"&::-webkit-scrollbar-thumb":{backgroundColor:"rgba(142, 139, 130, 0.8)",visibility:"hidden",borderRadius:4}}:{}),"","")+" "+(null!=(n=null==e?void 0:e.className)?n:"")),onMouseEnter:function(){return o(!0)},onMouseLeave:function(){return o(!1)},children:null==e?void 0:e.children})},Um=function(e){var n,r,i=t.useState(!1),o=i[0],a=i[1];return c.jsx(c.Fragment,{children:c.jsx("span",{onMouseLeave:function(){return a(!1)},onMouseEnter:function(){return a(!0)},className:Hm.icon(null!=(n=e.color)?n:"#5d4e8c")({type:null==e?void 0:e.type}),children:o&&e.reason&&c.jsx("div",{className:Hm.reason(null!=(r=e.color)?r:"#5d4e8c"),children:e.reason})})})},Gm={natural:T.curveNatural,straight:T.curveLinear,step:T.curveStep,stepBefore:T.curveStepBefore,stepAfter:T.curveStepAfter},Km="-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif";function Xm(e,t){return[].concat(null!=e&&e.areas?null==e?void 0:e.areas[t]:[],null!=e&&e.bars?null==e?void 0:e.bars[t]:[],null!=e&&e.lines?null==e?void 0:e.lines[t]:[])}function Qm(e,t,n,r,i,o){var a={type:"linear",nice:!0},l={paddingOuter:.05,paddingInner:.3,type:n?"time":"band"};return"y"===e&&o&&(a=U({},a,{domain:o})),"x"===e?(i&&(l=U({},l,{type:"band"})),r&&(l=U({},l,{type:"pow"})),t?a:l):t?l:a}function Jm(e,t,n,r){return function(i){var o;return null!=(o=t(i,e))?o:n[r]}}function Zm(e,t,n){return function(r){var i;return null!=(i=e(r))?i:t[n]}}var $m,eh=function(e,t){return function(n){return e?e(n):t?nh(n):n}},th=function(e){return function(t){return null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(t):t}},nh=function(e){return A.timeFormat("%b %d, %y")(new Date(e))},rh=function(e){return c.jsx(Ym,{className:null!=e&&e.alignCenter?""+Hm.scrollbar:void 0,x:!0,children:c.jsx(k,{scale:F.scaleOrdinal({domain:null==e?void 0:e.keys,range:null==e?void 0:e.colors}),children:function(t){return c.jsx("div",{className:Hm.container,children:t.map((function(t,n){var r,i=null==e||null==(r=e.typeIndex)?void 0:r.find((function(e){return e.index===t.index})),o=e.conditionalFormattingPossibilities?e.conditionalFormattingPossibilities(t.text):[],a=function(){var r=null!=e&&e.formatter&&null!=e&&e.colors&&e.data?Jm(t.datum,null==e?void 0:e.formatter,null==e?void 0:e.colors,n)(e.data):t.value,i=o.filter((function(e){var n=e.conditionIsMet(t.datum);return e.isRuleOnDimension&&n}));return e.replaceDimensionColorsIfPossible&&i[0]&&i[0].conditionIsMet(t.datum)?i[0].color:r},l=e.replaceDimensionColorsIfPossible?o.filter((function(e){return!e.isRuleOnDimension})):o;return c.jsx(Um,{type:null==i?void 0:i.type,color:a()}),c.jsxs(S.LegendItem,{margin:"0",children:[l.map((function(e,t){return c.jsx(Um,{type:null==i?void 0:i.type,color:e.color,reason:e.explanation},t)})),c.jsx(Um,{type:null==i?void 0:i.type,color:a(),reason:l.length>0?"Original color":void 0}),c.jsx(S.LegendLabel,{className:Hm.label,style:{},children:null!=e&&e.formatSeriesName?null==e?void 0:e.formatSeriesName(null==t?void 0:t.text):t.text})]},"legend-quantile-"+n)}))})}})})},ih=function(e){var t,n,r,i,o,a=[],l=0;return null!=e&&e.bars&&(null==e||e.bars.keys.forEach((function(){a.push({type:"bar",index:l}),l+=1}))),null!=e&&e.areas&&(null==e||null==(r=e.areas)||r.keys.forEach((function(){a.push({type:"area",index:l}),l+=1}))),null==e||!e.lines||null!=e&&null!=(t=e.lines)&&t.scatter||null==e||null==(i=e.lines)||i.keys.forEach((function(){a.push({type:"lines",index:l}),l+=1})),null!=e&&e.lines&&null!=e&&null!=(n=e.lines)&&n.scatter&&(null==e||null==(o=e.lines)||o.keys.forEach((function(){a.push({type:"scatter",index:l}),l+=1}))),a},oh=function(e,t){var n=-Infinity;if(t&&e)for(var r,i=te(t);!(r=i()).done;)for(var o=r.value,a=0;a<e.length;a++)e[a][o]>n&&(n=e[a][o]);return n},ah=function(e,t){var n=Infinity;if(t&&e)for(var r,i=te(t);!(r=i()).done;)for(var o=r.value,a=0;a<e.length;a++)e[a][o]<n&&(n=e[a][o]);return Infinity===n?0:n};function lh(e,t,n,r,i){var o=e?Math.max.apply(Math,e.map((function(e){return e.value}))):void 0,a=e?Math.min.apply(Math,e.map((function(e){return e.value}))):void 0;return o&&a&&o>t&&a<n?Qm("y",r,i,void 0,void 0,[1.0005*a,1.0005*o]):o&&o>t?Qm("y",r,i,void 0,void 0,[n,1.0005*o]):a&&a<n?Qm("y",r,i,void 0,void 0,[1.0005*a,t]):Qm("y",r,i)}var sh=zm({margin:0,fontSize:"0.9rem",padding:0}),uh=zm({borderBottom:"1px dotted rgba(0,0,0,0.025)"}),dh=zm({display:"flex",alignItems:"center",gap:6}),ch=zm({display:"block",padding:0,margin:0,textAlign:"right"}),ph=zm({display:"grid",gridTemplateRows:"auto 1fr",gridRowGap:12,variants:{displayGrid:($m={},$m.true={gridTemplateColumns:"1fr 1fr",gridColumnGap:48},$m.false={gridTemplateColumns:"1fr"},$m)}}),fh=zm({borderTop:"1px solid rgba(200, 200, 200, 0.4)"}),mh=zm({display:"grid",gridTemplateColumns:"auto 1fr",gap:12,fontSize:"0.75rem",fontWeight:500,color:"inherit",alignItems:"center"}),hh=zm({display:"block",padding:0,margin:0}),vh=Object.assign((function(){return null}),{wrapper:function(e,t,n){var r=Array(n||1).fill("auto").join(" ");return t&&(r="20px "+r),e&&(r+=" 40px"),zm({display:"grid",gridTemplateRows:r,gap:12,padding:6})},heading:sh,total:fh,highlighted:zm({wordBreak:"break-all"}),row:uh,rowLabel:dh,resultGrid:ph,rowValue:ch,tooltipRowContainer:mh,totalLabel:hh,sectionTitle:zm({color:"#7d838d",fontSize:12,marginTop:"0.25rem",marginBottom:0})}),gh=pa({color:cs(35)}),bh=function(e){var t,n,r,o=e.chartProps,a=e.datumKey,l=e.tooltipNearestDatum.key,s=[].concat((r=i.sumBy([(n=o).bars,n.areas,n.lines],(function(e){return e?1:0}))>=1,n.sharedTooltip||r?Object.keys(null!=(t=null==e?void 0:e.datumKey)?t:{}):[l]));s.sort((function(t,n){var r=e.formatSeriesName(t),i=e.formatSeriesName(n);return r?i?r<i?-1:1:-1:1}));var u=[].concat(s).filter((function(e){return e&&void 0!==a[e].datum[e]})),d=e.formatValue?e.formatValue(a[l].datum[l]):a[l].datum[l];return c.jsxs(xh,{total:o.showTotalOnTooltip,title:!0,sections:void 0!==d&&u.length>1?2:1,children:[c.jsx("p",{className:""+vh.heading,children:null==e?void 0:e.heading}),void 0!==d&&c.jsxs("div",{className:""+vh.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[u.length>1&&c.jsx("p",{className:vh.sectionTitle+" "+gh,children:"Active"}),c.jsx(wh,{datumKey:a,keyString:l,chartProps:o,chartTooltipProps:e})]}),u.length>1&&c.jsxs("div",{className:""+vh.resultGrid({displayGrid:u.length>10?"true":"false"}),children:[c.jsx("p",{className:vh.sectionTitle+" "+gh,children:"All"}),u.map((function(t){var n;return null!=o&&null!=(n=o.lines)&&n.scatter&&void 0===a[t].datum[t]?null:c.jsx(wh,{datumKey:a,keyString:t,chartProps:o,chartTooltipProps:e},"chart_"+t)}))]}),o.showTotalOnTooltip&&c.jsxs("div",{className:vh.total+" "+vh.tooltipRowContainer,children:[c.jsx("p",{className:""+vh.totalLabel,children:"Rounded total: "}),c.jsx("p",{className:vh.row+" "+vh.rowValue,children:null==e?void 0:e.total})]})]})},xh=function(e){return c.jsx("div",{className:""+vh.wrapper(e.total,null==e?void 0:e.title,null==e?void 0:e.sections),"data-sections":null==e?void 0:e.sections,children:null==e?void 0:e.children})},yh=function(e){var t,n;return c.jsxs("div",{className:""+vh.tooltipRowContainer,children:[c.jsxs("span",{className:vh.row+" "+vh.rowLabel,children:[(null==e?void 0:e.icon)&&c.jsx(Um,{type:null==e||null==(t=e.icon)?void 0:t.type,color:null==e||null==(n=e.icon)?void 0:n.color}),c.jsx("span",{className:""+vh.highlighted,children:null==e?void 0:e.label})]}),c.jsx("p",{className:vh.row+" "+vh.rowValue,children:null==e?void 0:e.value})]})},wh=function(e){var t,n=e.datumKey,r=e.keyString,i=e.chartProps,o=e.chartTooltipProps,a=function(e,t){var n,r,i,o,a,l,s;return null!=t&&t.bars&&null!=t&&null!=(n=t.bars.keys)&&n.find((function(t){return t===e}))?"bar":null==t||!t.lines||null!=t&&t.lines.scatter||null==t||null==(r=t.lines)||null==(i=r.keys)||!i.find((function(t){return t===e}))?null!=t&&t.areas&&null!=t&&null!=(o=t.areas)&&null!=(a=o.keys)&&a.find((function(t){return t===e}))?"area":null!=t&&t.lines&&null!=t&&t.lines.scatter&&null!=t&&null!=(l=t.lines)&&null!=(s=l.keys)&&s.find((function(t){return t===e}))?"scatter":null:"lines"}(n[r].key,i);if(!a)return null;var l=null!=(t=function(e,t,n,r){var i,o,a,l,s;return"area"==t&&null!=e&&null!=(i=e.areas)&&i.formatter?e.areas.formatter(n):"bar"==t&&null!=e&&null!=(o=e.bars)&&o.formatter?null==e||null==(a=e.bars)?void 0:a.formatter(r,n):"lines"==t&&null!=e&&null!=(l=e.lines)&&l.formatter?e.lines.formatter(n):"scatter"==t&&null!=e&&null!=(s=e.lines)&&s.formatter?e.lines.formatter(r,n):void 0}(i,a,r,n[r].datum))?t:o.getColor(r),s=o.formatSeriesName(r),u=o.formatValue?o.formatValue(n[r].datum[r]):n[r].datum[r];return c.jsx("div",{style:{width:380},children:c.jsx(yh,{icon:{type:a,color:l},label:s,value:"undefined"===u?"-":u})})};function Ch(e,t,n,r,i,o){void 0===o&&(o=0);var a=document.createElement("canvas").getContext("2d");if(!a)return e;a.font=i+" "+r+" "+n;var l=t-o;if(a.measureText(e).width+.4*(e.length-1)>l){for(var s=l-a.measureText("...").width,u="",d=0;d<e.length;d++){var c=e[d],p=a.measureText(c).width;if(!(s>=p))break;u+=c,s-=p+.4}return u+"..."}return e}function jh(e,t,n){if(1===e.length)return t.from.x;var r=e[n+1],i=e[n-1];return r&&i||r?r.from.x-t.from.x:i?t.from.x-i.from.x:0}var Sh=function(e){if("string"==typeof e)return parseInt(e,10);if("number"==typeof e)return e;throw new Error("Invalid font size type")},Fh=function(e){if(void 0!==e){if("number"==typeof e)return e;switch(e){case"normal":return 400;case"bold":return 700;case"bolder":return 900;case"lighter":return 100;default:var t=parseInt(e,10);if(isNaN(t))throw new Error("Invalid font weight type");return t}}};function kh(e,t,n){var r=(t-n)/3;return r*e+(n-9*r)}function Th(e,t,n,r){var i,o,a=0,l={fontFamily:null!=(o=null==r?void 0:r.fontFamily)?o:Km,fontWeight:null!=(i=n)&&i.fontWeight?Fh(i.fontWeight):"700",fontSize:null!=i&&i.fontSize?Sh(i.fontSize):9,letterSpacing:"normal"},s=l.fontFamily,u=l.fontWeight,d=l.fontSize,c=l.letterSpacing;return e.forEach((function(e){var n=function(e,t,n,r,i){var o=document.createElementNS("http://www.w3.org/2000/svg","svg"),a=document.createElementNS("http://www.w3.org/2000/svg","text");a.textContent=e,a.setAttribute("font-family",t),a.setAttribute("font-weight",n),a.setAttribute("font-size",r),a.setAttribute("letter-spacing",i),o.appendChild(a),document.body.appendChild(o);var l=a.getBBox().width;return document.body.removeChild(o),l}(t(e),s,""+u,""+d,c);a=Math.max(a,n)})),a}var Ah=function(e){var t,n,r,i,o={fontFamily:Km,fontWeight:null==e||null==(t=e.theme)?void 0:t.fontWeight,fontSize:null==e||null==(n=e.theme)?void 0:n.fontSize,style:{fill:null!=(r=null==(i=e.theme)?void 0:i.color)?r:cs(10)}};if("y"===(null==e?void 0:e.axis)){var a,l,s=-((null==e?void 0:e.axisFromPoint.y)+e.axisToPoint.y)/2;return c.jsx("svg",{x:"-1.25em",y:"0",fontSize:null==e||null==(a=e.theme)?void 0:a.fontSize,style:{overflow:"visible"},className:"vizzly-axis-title vizzly-axis-title-y",children:c.jsx("text",U({transform:"rotate(-90)",x:s,y:"-"+(e.horizontal?null!=(l=e.leftPanelWidth)?l:82:38)},o,{textAnchor:"middle",children:c.jsx("tspan",{x:s,dy:"0em",children:null==e?void 0:e.label})}))})}return c.jsx("g",{className:"vizzly-axis-title vizzly-axis-title-x",transform:"translate(0, 0)",children:c.jsx("text",U({x:((null==e?void 0:e.axisFromPoint.x)+e.axisToPoint.x)/2,y:"34",textAnchor:"middle",dominantBaseline:"middle"},o,{children:null==e?void 0:e.label}))})},Dh=function(e){var n,r,i,o,a,l,s,u,p,f,m,h,v,g,b,x,y,w=(u=e.chartWidth,p=e.ticks,f=e.xAxisIsTime,m=e.axisFromPoint.x,h=e.axisToPoint.x,v=null==e?void 0:e.labelProps,g=null==e||null==(n=e.theme)?void 0:n.labels,x=(b=t.useState([]))[0],y=b[1],t.useEffect((function(){if(u&&p.length&&f){var e=function(e,t,n){return Th(e,(function(e){return e.formattedValue}),t,n)}(p,g,v),t=p.find((function(t){return t.from.x+e/8>=m+e/2})),n=h-m-1.2*e;if(!(n<0)){for(var r=Math.floor((n-40)/(e+30)),i=Math.max(1,Math.floor(p.length/(r+1))),o=[t],a=t.index+i;a<p.length;a+=i)o.push(p[a]);y(o)}}}),[u,p,f,v,g]),f?x:p);return"none"===e.type?null:e.horizontal?c.jsxs("g",{className:"visx-group visx-axis-tick vizzly-axis-v",transform:"translate(0, 0)",children:["end2end"===(null==e?void 0:e.type)&&(null==e||null==(r=e.ticks)?void 0:r.map((function(t,n,r){var i;return function(t){return 0===t||t===(null==e?void 0:e.ticks.length)-1}(n)?d.createElement(Ih,U({},t,{width:jh(r,t,n),labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),key:t.index+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(i=e.theme)?void 0:i.labels,type:null==e?void 0:e.type})):null}))),"end2end"!==(null==e?void 0:e.type)&&(null==w?void 0:w.map((function(t,n,r){var i;return d.createElement(Ih,U({},t,{width:jh(r,t,n),labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),key:t.index+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(i=e.theme)?void 0:i.labels,type:null==e?void 0:e.type,xAxisIsTime:null==e?void 0:e.xAxisIsTime}))}))),!(null!=e&&e.hideAxisLine)&&c.jsx("line",{className:"visx-line",x1:e.axisFromPoint.x,y1:e.axisFromPoint.y,x2:e.axisToPoint.x,y2:e.axisToPoint.y,fill:"transparent",shapeRendering:"crispEdges",stroke:null==e?void 0:e.tickStroke,strokeWidth:null==e?void 0:e.strokeWidth,strokeLinecap:"square"}),(null==e?void 0:e.label)&&c.jsx(Ah,U({},e,{theme:null==e||null==(i=e.theme)?void 0:i.axisTitles,axis:"x",horizontal:null!=(o=null==e?void 0:e.axisHorizontal)&&o,leftPanelWidth:e.leftPanelWidth}))]}):c.jsxs(t.Fragment,{children:[null==e||null==(a=e.ticks)?void 0:a.map((function(t,n){var r;return c.jsx("g",{className:"visx-group visx-axis-tick vizzly-axis-h",transform:"translate(0, 0)",children:c.jsx(Ih,U({},t,{width:82,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:n+1===(null==e?void 0:e.ticks.length),horizontal:e.horizontal,theme:null==e||null==(r=e.theme)?void 0:r.labels,type:null==e?void 0:e.type,xAxisIsTime:null==e?void 0:e.xAxisIsTime}))},t.index+"-"+(null==e?void 0:e.uniqueId))})),(null==e?void 0:e.label)&&c.jsx(Ah,U({},e,{theme:null==e||null==(l=e.theme)?void 0:l.axisTitles,axis:"y",horizontal:null!=(s=e.axisHorizontal)&&s}))]})},Ih=function(e){var n,r,i,o,a,l,s,u=e.type,d=null!=(n=e.theme)&&n.fontSize?Sh(null==(r=e.theme)?void 0:r.fontSize):9,p=null!=(i=e.theme)&&i.fontWeight?""+Fh(null==(o=e.theme)?void 0:o.fontWeight):"700",f=e.width/6,m=Ch(e.formattedValue,e.horizontal&&e.last?e.width-kh(d,40,5):e.width-kh(d,4,0),null==(a=e.labelProps)?void 0:a.fontFamily,""+d,p,f),h="end2end"===u?e.last?e.right:null==e?void 0:e.left:e.horizontal?e.last?e.from.x-5:e.from.x:-5,v=e.from.y;return c.jsxs(t.Fragment,{children:[!e.horizontal&&c.jsx("line",{className:"visx-line",x1:"0",y1:v,x2:"0",y2:v,fill:"transparent",shapeRendering:"crispEdges",stroke:"#eaeaea",strokeWidth:"1",strokeLinecap:"square"}),c.jsx("g",{x:"-0.25em",y:"0.25em",children:c.jsx("text",{transform:"",x:h,y:e.horizontal?"16":v,fontFamily:Km,fontWeight:p,fontSize:""+d,letterSpacing:.4,stroke:"none",textAnchor:"end2end"===u?e.last?"end":"start":e.horizontal?"middle":"end",style:{fill:null!=(l=null==(s=e.theme)?void 0:s.color)?l:"rgba(0, 0, 0, 0.6)"},"data-horizontal":e.horizontal?"true":"false","data-axisistime":e.xAxisIsTime?"true":"false","data-type":"type-"+u,children:c.jsx("tspan",{x:h,dy:e.horizontal?0:2,children:"end2end"===u||e.xAxisIsTime?e.formattedValue:m})})})]})},Ph=function(e){var n,r,i;return"none"===e.type?null:c.jsxs("g",{className:"visx-group visx-axis-tick vizzly-axis-v",transform:"translate(0, 0)",children:["end2end"===(null==e?void 0:e.type)&&(null==e||null==(n=e.ticks)?void 0:n.map((function(n,r,i){var o,a;return 0===r?c.jsxs(t.Fragment,{children:[c.jsx(_h,U({},n,{width:null!=e&&e.horizontal?jh(i,n,r):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,last:!1,top:null==e?void 0:e.axisToPoint.y,horizontal:e.horizontal,theme:null==e||null==(o=e.theme)?void 0:o.labels,type:null==e?void 0:e.type})),c.jsx(_h,U({},n,{width:null!=e&&e.horizontal?jh(i,n,r):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,right:null==e?void 0:e.axisToPoint.x,top:null==e?void 0:e.axisToPoint.y,last:!0,horizontal:e.horizontal,theme:null==e||null==(a=e.theme)?void 0:a.labels,type:null==e?void 0:e.type,maxValueOfYAxis:null==e?void 0:e.maxValueOfYAxis}))]},n.index+"-"+(null==e?void 0:e.uniqueId)):null}))),"end2end"!==(null==e?void 0:e.type)&&(null==e||null==(r=e.ticks)?void 0:r.map((function(t,n,r){var i;return d.createElement(_h,U({},t,{width:null!=e&&e.horizontal?jh(r,t,n):50,labelProps:null==e?void 0:e.labelProps,left:null==e?void 0:e.axisFromPoint.x,top:null==e?void 0:e.axisToPoint.y,right:null==e?void 0:e.axisToPoint.x,last:!1,key:t.index+"-"+(null==e?void 0:e.uniqueId),horizontal:e.horizontal,theme:null==e||null==(i=e.theme)?void 0:i.labels,type:null==e?void 0:e.type}))}))),(null==e?void 0:e.label)&&c.jsx(Ah,U({},e,{theme:null==e||null==(i=e.theme)?void 0:i.axisTitles,axis:null!=e&&e.horizontal?"x":"y",horizontal:null==e?void 0:e.horizontal}))]})},_h=function(e){var t,n,r,i,o,a,l,s,u=null!=(t=e.theme)&&t.fontSize?Sh(null==(n=e.theme)?void 0:n.fontSize):"9",d=null!=(r=e.theme)&&r.fontWeight?""+Fh(null==(i=e.theme)?void 0:i.fontWeight):"700",p=Ch(null!=(o=null==e?void 0:e.maxValueOfYAxis)?o:e.formattedValue,e.width,null==(a=e.labelProps)?void 0:a.fontFamily,""+u,d,5),f=e.horizontal?e.last?e.right:e.from.x:e.to.x;return c.jsx("g",{x:"-0.25em",y:"0.25em",children:c.jsx("text",{transform:"matrix(1, 0, 0, 1, 0, 0)",x:f,y:e.horizontal?"16":null!=e&&e.last?e.top:e.from.y,fontFamily:Km,fontWeight:d,fontSize:u,letterSpacing:.4,stroke:"none",textAnchor:e.horizontal&&"end2end"===e.type?e.last?"end":"start":"middle",style:{fill:null!=(l=null==(s=e.theme)?void 0:s.color)?l:"rgba(0, 0, 0, 0.6)"},children:c.jsx("tspan",{x:f,dy:e.horizontal?0:2,children:p})})})},Eh=t.memo((function(e){if(e.value>(null==e?void 0:e.maxValueOfYAxis))return null;var n=null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(e.value):e.value,r=e.goalLine,i=e.axisProps,o=e.toX,a=t.useState(0),l=a[0],s=a[1],u=t.useRef(null);t.useEffect((function(){if(u.current){var e=u.current.getBBox();s(e.width+16)}}),[n]);var d=t.useMemo((function(){return function(e,t){for(var n,r,i,o=0,a=te(e);!(i=a()).done;){var l=i.value;if(l.value<=t.value&&(n=l),l.value>=t.value){r=l;break}}return n&&r&&(o=n.value===r.value?n.from.y:n.from.y+(r.from.y-n.from.y)/(r.value-n.value)*(t.value-n.value)),Math.round(o)}(i.ticks,r)}),[i.ticks,r]);return c.jsxs("g",{children:[c.jsx(D.Line,{from:{x:0,y:d},to:{x:o,y:d},stroke:r.color,strokeDasharray:"dashed"==r.strokeStyle?"5,5":void 0,strokeWidth:2,strokeLinecap:"round",shapeRendering:"smooth"}),c.jsxs("g",{transform:"translate("+(o-l-8- -(null==e?void 0:e.marginRight))+","+(d+8)+")",children:[c.jsx("path",{d:"M 0,0\n l -8,-8 \n l 8,-8 \n h "+l+" \n a 3,3 0 0 1 3,3 \n v 10 \n a 3,3 0 0 1 -3,3 \n h "+-l+" z",fill:r.color}),c.jsx("text",{ref:u,x:l/2,y:-1,dy:-4,textAnchor:"middle",fontFamily:Km,fontSize:9,fill:Oh(r.color,["#fff",cs(0)]),children:n})]})]})})),Oh=function(e,t){return i.maxBy(t,(function(t){return s.contrast(t,e)}))||e},Lh=function(e,t,n,r){return{xAccessor:function(i){return i?r?i[n]:e?new Date(i[t]):i[t]:void 0},yAccessor:function(i){return i?r?e?new Date(i[t]):i[t]:i[n]:void 0}}},Rh=function(e){var n,r,o,a,l,s,u,d,p,f,m,h,v,g,b,x,y,w,S,F,k,T,A,D,I,P,_=qm(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),E=e.approxYAxisLabelCount,O=void 0===E?"auto":E,L=e.approxXAxisLabelCount,R=void 0===L?"auto":L,M=e.removeStroke,N=void 0!==M&&M,z=e.horizontal,B=void 0!==z&&z,q=e.theme,V=e.x,W=(D=e.x,I=e.bars,e.forceXAxisAsTime&&!I||i.isDate(null==(P=Xm({bars:I,lines:e.lines,areas:e.areas},"data")[0])?void 0:P[D])),H=e.lineCurve?Gm[e.lineCurve]:Gm.natural,Y=function(e,t){var n,r,i;return{fill:null!=(n=null==t?void 0:t.color)?n:"rgba(0, 0, 0, 0.6)",fontSize:null!=(r=null==t?void 0:t.fontSize)?r:9,fontWeight:null!=(i=null==t?void 0:t.fontWeight)?i:700,textAnchor:e?"end":"middle",scaleToFit:"shrink-only"}},G=function(e,n){var r=t.useRef(null),i=t.useState(0),o=i[0],a=i[1];t.useEffect((function(){a(r.current?r.current.clientWidth:0),window.addEventListener("resize",(function(){a(r.current?r.current.offsetWidth:0)}))}));var l=Math.min(o<1e3?parseInt((""+o)[0]):12,12);return"auto"!=e?[r,e]:[r,l*(n?4:1)]}(R,!(null!=e&&e.horizontal)&&(null==e?void 0:e.forceXAxisAsTime)),K=G[0],X=G[1],Q=t.useState(void 0),J=Q[0],Z=Q[1],$=t.useState(void 0),ee=$[0],te=$[1],ne=Xm(e,"colors"),re=C.buildChartTheme(U({},C.lightTheme,{colors:ne,tickLength:0,gridColor:"",gridColorDark:""})),ie=null!=(r=null==q||null==(o=q.axis)?void 0:o.stroke)?r:"#eaeaea",oe=function(e,t){var n=0===e?"none":2===e?"end2end":"auto";return{xAxisType:n,xAxisAttributes:"end2end"===n?{left:0}:null,yAxisType:0===t?"none":2===t?"end2end":"auto"}}(R,O),ae=oe.xAxisType,le=oe.xAxisAttributes,se=oe.yAxisType,ue=null!=(a=null!=(l=null==e||null==(s=e.lines)?void 0:s.data.length)?l:null==e||null==(u=e.areas)||null==(d=u.data)?void 0:d.length)?a:null==(p=e.bars)?void 0:p.data.length,de=function(e){var n,r,i,o,a,l;return t.useMemo((function(){for(var t=-Infinity,n=Infinity,r=0,i=["bars","lines","areas"];r<i.length;r++){var o,a,l=i[r],s=null==(o=e[l])?void 0:o.data,u=null==(a=e[l])?void 0:a.keys,d=oh(s,u),c=ah(s,u);d>t&&(t=d),c<n&&(n=c)}return{maxValue:t,minValue:n}}),[null==(n=e.bars)?void 0:n.data,null==(r=e.bars)?void 0:r.keys,null==(i=e.lines)?void 0:i.data,null==(o=e.lines)?void 0:o.keys,null==(a=e.areas)?void 0:a.data,null==(l=e.areas)?void 0:l.keys])}(e),ce=de.maxValue,pe=de.minValue,fe=function(e,t,n,r,i,o){if(e&&t)return Th(i,(function(e){return n.formatXAxisLabel?n.formatXAxisLabel(e[o]):String(e[o])}),null==r?void 0:r.axisTitles)}(B,null!=(f=e.forceXAxisAsTime)&&f,e,q,Xm(e,"data"),e.x),me=e.sparkline?{top:2,bottom:2,left:"right"!==e.yAxisOrientation?50:0,right:0}:function(e,t,n,r,i){var o=Boolean(null==r?void 0:r.x),a=Boolean(null==r?void 0:r.y);return{top:25,bottom:o?40:25,left:e?("none"!==n?i?i+10:82:25)+(a?24:0):t?50+(a?24:0):25,right:25}}(B,"right"!==e.yAxisOrientation,ae,null==e?void 0:e.axisTitles,fe);return c.jsxs("div",{ref:K,style:{position:"relative",height:_},children:[c.jsxs(C.XYChart,{theme:re,margin:me,height:_,xScale:Qm("x",B,W,null==e||null==(m=e.lines)?void 0:m.scatter,!(null==e||!e.lines)||!(null==e||!e.areas)),yScale:lh(null==e?void 0:e.goalLine,ce,pe,B,W),horizontal:B,onPointerUp:function(){return null==e?void 0:e.onClick(J,ee)},children:[c.jsx(C.Grid,{columns:B,rows:!B,stroke:"black",strokeDasharray:"0.5 5",strokeWidth:N?0:2,lineStyle:{strokeLinecap:"round",stroke:null!=(h=null==q||null==(v=q.grid)?void 0:v.stroke)?h:"rgba(200, 200, 200, 0.2)"}}),!(null!=e&&e.sparkline)&&c.jsxs(c.Fragment,{children:["none"!==ae&&c.jsx(C.Axis,U({},le,{tickLabelProps:function(){var e=U({},Y(B,null==q?void 0:q.labels));return B||(e.y=15),e},numTicks:"end2end"===ae?ue:X,strokeWidth:N?0:1,tickStroke:"#eaeaea",stroke:B?"transparent":ie,orientation:B?"left":"bottom",tickFormat:eh(e.formatXAxisLabel,e.forceXAxisAsTime||W),label:B?null==e||null==(g=e.axisTitles)?void 0:g.y:null==e||null==(b=e.axisTitles)?void 0:b.x,children:function(t){return c.jsx(Dh,U({},t,{theme:q,type:ae,uniqueId:null==e?void 0:e.uniqueId,chartWidth:null==e?void 0:e.width,xAxisIsTime:!!e.forceXAxisAsTime,leftPanelWidth:fe,axisHorizontal:null==e?void 0:e.horizontal}))}})),c.jsx(C.Axis,{labelOffset:50,tickLabelProps:function(){var t=U({},Y(B,null==q?void 0:q.labels));return B||"right"===e.yAxisOrientation||(t.width=50,t.textAnchor="middle"),t},hideAxisLine:!0,numTicks:"auto"===O?5:O,strokeWidth:N?0:1,hideTicks:!0,tickLength:e.horizontal||"right"===e.yAxisOrientation?10:25,stroke:ie,orientation:B?"bottom":e.yAxisOrientation||"left",tickFormat:th(e),label:B?null==e||null==(x=e.axisTitles)?void 0:x.x:null==e||null==(y=e.axisTitles)?void 0:y.y,children:function(t){return c.jsx(Ph,U({},t,{theme:q,type:se,horizontal:B,maxValueOfYAxis:null!=e&&e.formatYAxisLabel?null==e?void 0:e.formatYAxisLabel(ce):ce,uniqueId:null==e?void 0:e.uniqueId}))}})]}),c.jsx("style",{children:"\n .visx-bar-stack .visx-bar {\n stroke: #fff;\n stroke-width: 2px;\n }\n .visx-tooltip-glyph svg {\n max-width: 10px\n height: 10px;\n }\n "+Bm+"\n "}),(null==e?void 0:e.areas)&&c.jsx(c.Fragment,{children:[].concat(e.areas.keys).map((function(t,n){var r,i,o,a=(null==(r=e.areas)?void 0:r.formatter)&&(null==(i=e.areas)?void 0:i.formatter(t))||(null==(o=e.areas)?void 0:o.colors[n]);return c.jsx(j.LinearGradient,{id:"g"+e.uniqueId+n,from:a,to:a,fromOffset:.6,fromOpacity:.8,toOpacity:.6},"area_gradients_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.areas)&&!(null!=e&&null!=(w=e.areas)&&w.stacked)&&c.jsx(c.Fragment,{children:[].concat(e.areas.keys).map((function(t,n){var r;return c.jsx(C.AreaSeries,U({fill:"url(#g"+e.uniqueId+n+")",curve:H,renderLine:!1,dataKey:t,data:null==(r=e.areas)?void 0:r.data},Lh(W,V,t,B)),"grouped_area_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.areas)&&e.areas.stacked&&c.jsx(C.AreaStack,{curve:H,renderLine:!0,children:[].concat(e.areas.keys).map((function(t,n){var r;return c.jsx(C.AreaSeries,U({fill:"url(#g"+e.uniqueId+n+")",dataKey:t,lineProps:{strokeWidth:4,strokeLinecap:"round"},data:null==(r=e.areas)?void 0:r.data},Lh(W,V,t,B)),"areas_stacked_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.bars)&&!e.bars.stacked&&c.jsx(C.BarGroup,{children:e.bars.keys.map((function(t,n){var r,i;return c.jsx(C.BarSeries,U({radiusAll:!0,radius:5,dataKey:t,data:null==(r=e.bars)?void 0:r.data},Lh(W,V,t,B),{colorAccessor:(null==e||null==(i=e.bars)?void 0:i.formatter)&&Jm(t,null==e?void 0:e.bars.formatter,ne,n)}),"grouped_bar_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.bars)&&e.bars.stacked&&c.jsx(C.BarStack,{offset:"100%"==e.bars.stacked?"expand":"none",children:e.bars.keys.map((function(t,n){var r,i;return c.jsx(C.BarSeries,U({radiusAll:!0,radius:3,dataKey:t,data:null==(r=e.bars)?void 0:r.data},Lh(W,V,t,B),{colorAccessor:(null==e||null==(i=e.bars)?void 0:i.formatter)&&Jm(t,null==e?void 0:e.bars.formatter,ne,n)}),"stacked_bar_"+e.uniqueId+"_"+n)}))}),(null==e?void 0:e.lines)&&!(null!=e&&null!=(S=e.lines)&&S.scatter)&&e.lines.keys.map((function(t,n){var r,i;return c.jsx(C.LineSeries,U({strokeWidth:3,curve:H,dataKey:t,data:null==(r=e.lines)?void 0:r.data},Lh(W,V,t,B),{colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&Zm(null==e?void 0:e.lines.formatter,ne,n)}),"line_on_line_chart_"+e.uniqueId+"_"+n)})),e.lines&&(null==e||null==(F=e.lines)?void 0:F.scatter)&&e.lines.keys.map((function(t,n){var r,i;return c.jsx(C.GlyphSeries,U({dataKey:t,data:null==(r=e.lines)?void 0:r.data},Lh(W,V,t,B),{colorAccessor:(null==e||null==(i=e.lines)?void 0:i.formatter)&&Jm(t,null==e?void 0:e.lines.formatter,ne,n)}),"scatter_chart_"+e.uniqueId+"_"+n)})),["areas","lines"].map((function(n,r){var i=e;return c.jsx(t.Fragment,{children:i[n]&&[].concat(i[n].keys).map((function(t,o){var a,l;return c.jsx(Nm,{show:(null==J?void 0:J.key)==t,generateAnnotations:null==(a=i[n])?void 0:a.annotate,dataKey:t,data:null==(l=i[n])?void 0:l.data},"area_lines_"+e.uniqueId+"_"+r+"_"+o)}))},"area_lines_"+e.uniqueId+"_"+r)})),c.jsx(C.Tooltip,{showVerticalCrosshair:!0,showSeriesGlyphs:null==e.bars,renderTooltip:function(n){var r=n.tooltipData,o=n.colorScale,a=null==r?void 0:r.datumByKey;te(a);var l=null==r?void 0:r.nearestDatum,s=i.debounce((function(){var e,t=(null==l||null==(e=l.key)?void 0:e.key)!=(null==J?void 0:J.key);J&&!t||Z(null==r?void 0:r.nearestDatum)}));if(t.useEffect((function(){return s()})),!r||!o)return null;var u=Object.values(null!=a?a:{}),d=Math.round(i.sumBy(u,(function(e){return Number(e.datum[e.key]||0)}))),p=function(e,t,n){return null==n?"No value":eh(e,t)(n)}(e.formatXAxisLabel,W,null==l?void 0:l.datum[V]);return c.jsx(bh,{heading:p,total:d,chartProps:e,datumKey:a,tooltipNearestDatum:l,typeIndex:ih(e),getColor:function(e){return null==o?void 0:o(e)},formatSeriesName:e.formatSeriesName,formatValue:th(e)})}}),e.goalLine&&(null==(k=e.goalLine)?void 0:k.length)>0&&!B&&c.jsx(C.Axis,{orientation:"left",children:function(t){var n;return null==(n=e.goalLine)?void 0:n.map((function(n,r){var i;return c.jsx(Eh,{axisProps:t,goalLine:n,value:n.value,toX:(null!=(i=null==e?void 0:e.width)?i:0)-me.left-me.right,marginRight:me.right,maxValueOfYAxis:ce,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel},(null==e?void 0:e.uniqueId)+"-"+r)}))}})]}),(null==e?void 0:e.legend)&&c.jsx(rh,{keys:Xm(e,"keys"),colors:ne,typeIndex:ih(e),formatSeriesName:null==e?void 0:e.formatSeriesName,formatter:null==e||null==(T=e.bars)?void 0:T.formatter,data:null==(A=e.bars)?void 0:A.data,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities})]})};function Mh(e){var n=t.useState(!1),r=n[0],i=n[1];return t.useEffect((function(){return i(!1)}),[r]),t.useImperativeHandle(e,(function(){return{resetSize:function(){i(!0)}}})),r}var Nh=t.forwardRef((function(e,t){return Mh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Rh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,sparkline:e.sparkline,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,lineCurve:e.lineCurve,showTotalOnTooltip:e.showTotalOnTooltip,forceXAxisAsTime:e.forceXAxisAsTime,areas:{colors:e.colors,annotate:e.annotate||[],stacked:e.stacked||!1,data:e.data,keys:e.keys,formatter:e.formatter},x:e.x,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onPointerUp:null==e?void 0:e.onPointerUp,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles})}})})),zh=function(e){var t=[];return"dimension"in e&&(t=[].concat(t,e.dimension||[])),"lineDimension"in e&&(t=[].concat(t,e.lineDimension||[])),"barDimension"in e&&(t=[].concat(t,e.barDimension||[])),{x:(t=(t=[].concat(e.timeDimension?[{field:e.timeDimension.field,function:e.timeDimension.truncate,pivot:"x"}]:[],t)).map((function(e,t){return 0==t?(e.pivot=e.pivot||"x",e):(e.pivot=e.pivot||"y",e)}))).filter((function(e){return"x"==e.pivot})).map((function(e){return tt(e)})),y:t.filter((function(e){return"y"==e.pivot})).map((function(e){return tt(e)}))}};function Bh(e){var n=e.title,r=e.subject,i=t.useRef(null),o=t.useState(n),a=o[0],l=o[1],s=t.useState(r),u=s[0],d=s[1];return t.useEffect((function(){0===a.length&&n.length>=1&&i.current&&i.current.resetSize(),0===u.length&&r.length>=1&&i.current&&i.current.resetSize(),l(n),d(r)}),[n,r]),i}var qh=function(e,t){return!(!1!==e&&void 0!==e||!t)||!0===e},Vh=function(e){var n,r,i=Bh({title:null==e?void 0:e.displayTitle,subject:null==e?void 0:e.displaySubject}),o=rs(),a={displayTitle:e.displayTitle,displaySubject:e.displaySubject,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,library:null!=(n=e.library)&&n,verified:e.protectedByOrganisation,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension,timeDimension:e.timeDimension,setParameterUpdate:null==e?void 0:e.setParameterUpdate};if(!On(e.type).isRunnable(e))return c.jsx(uf,{title:"Missing parameters"});if(Uo(e.result))return c.jsx(hc,{});if(Go(e.result))return c.jsx(df,{});if(Ko(e.result))return c.jsx(pf,U({},a));var l=zh(e),s=Wo(l,e.measure,e.result),u=Vo(e.result,e.measure,l,"100%"==e.stacked);return c.jsx(t.Suspense,{fallback:c.jsx(hc,{}),children:c.jsxs(Tp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Rm,U({},a)),c.jsx(Oa,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:c.jsx(Nh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:i,uniqueId:e.id,x:"x",keys:s,colors:er(null==o?void 0:o.colors,s.length),data:u,legend:qh(null==e?void 0:e.legend,"verbose"===(null==o?void 0:o.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!!e.timeDimension,showTotalOnTooltip:!!e.stacked,stacked:!!e.stacked,formatXAxisLabel:aa(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatYAxisLabel:la({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),annotate:"verbose"==(null==o?void 0:o.detail)?["high_and_low"]:[],lineCurve:e.lineCurve,theme:null==o?void 0:o.charts,formatSeriesName:sa(e.result),formatter:function(t){var n=oa(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.ruleValue},onPointerUp:null==e?void 0:e.onPointerUp,sparkline:e.sm,goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles})})]})})};Vh.defaultProps={type:"areaChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0};var Wh=t.memo(Vh,na),Hh=function(){return null},Yh=function(e){var t,n,r;return(null==e||null==(t=e.component)||null==(n=t.attributes)||null==(r=n.drilldown)?void 0:r.length)>0},Uh=function(e,n,r,i,o,a){var l=t.useState(!1),s=l[0],u=l[1];try{var d=function(e,t){if("dataSetId"in t){var n=Kt(t).flatMap((function(t){var n=Mn(e,t);return kt(n)?[n]:[]}));return JSON.stringify(n)}return""}(o,e);return t.useEffect((function(){var t=new AbortController;return function(){var o=Y(W().mark((function o(){var a;return W().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return u(!0),o.next=3,Vc(e,n,t.signal,i);case 3:(a=o.sent)?(u(!1),t.signal.aborted||r(a)):r([null]);case 5:case"end":return o.stop()}}),o)})));return function(){return o.apply(this,arguments)}}()(),function(){t.abort()}}),[JSON.stringify({componentType:a,dataSetId:o.id,queries:e,filterConfig:i,watchCustomFieldChangesKey:d})]),{queriesAreChanging:s}}catch(e){if(u(!1),e instanceof qt)return{queriesAreChanging:!1};throw e}},Gh=function(e){var n,r,i=t.useState(null),o=i[0],a=i[1],l=e.component,s=l.results,u=l.attributes,d=l.localFilters,p=Uh(u,e.runQueriesCallback,e.setResults,{localFilters:e.component.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsxs(t.Fragment,{children:[c.jsx(Wh,U({id:e.id},u,{dataSet:e.dataSet,localFilters:d,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,result:s[0],queriesAreChanging:p.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(r=n.queryEngineConfig)?void 0:r.supportedTransformationFunctions,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,onPointerUp:function(t){return Yh(e)&&a(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions})),o&&c.jsx(Hh,{onDrilldown:o,onClose:function(){return a(null)},inputProps:e})]})},Kh=t.forwardRef((function(e,t){return Mh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Rh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,sparkline:e.sparkline,x:e.x,formatSeriesName:e.formatSeriesName,bars:{annotate:[],stacked:"stacked"===(null==e?void 0:e.type),colors:e.colors,data:e.data,keys:e.keys,formatter:e.formatter},legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,forceXAxisAsTime:null==e?void 0:e.forceXAxisAsTime,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width,showTotalOnTooltip:e.showTotalOnTooltip,theme:null==e?void 0:e.theme,onPointerUp:null==e?void 0:e.onPointerUp,conditionalFormattingPossibilities:e.conditionalFormattingPossibilities,onClick:function(t,n){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t,n))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles})}})}));function Xh(e,t,n){var r=Qh(e,t);return null!=n&&n.grouping?Jh(r,null==n?void 0:n.grouping):r}var Qh=function(e,t){return e.map((function(e){return e.field in t?{fieldId:e.field,function:e.function,aggregate:e.function,value:t[e.field]}:{fieldId:e.field,function:e.function,aggregate:e.function}}))},Jh=function(e,t){return t.forEach((function(t){var n=e.findIndex((function(e){return e.fieldId===t.fieldId}));n>-1?e[n]=U({},e[n],t):e.push(t)})),e};function Zh(e,t,n,r,i){if(!Array.isArray(e)||!Array.isArray(n))throw new Error("Invalid input: fields and row must be arrays");return e.map((function(e,o){var a,l;if(No(e.datumKey))return(l={})[e.datumKey]=null==(a=n[o])?void 0:a.value,l;var s={};if("string"==typeof e.id){var u,d,c=e.id;i&&null!=r&&r.some((function(e){return e.id===i.subsetDimension}))&&(c=i.subsetDimension);var p=nt(c,t);(d={})[JSON.stringify(p)]=null==(u=n[o])?void 0:u.value,s=d}return s})).filter((function(e){return Object.keys(e).length>0}))}var $h=function(e){var t;return!(!e||void 0===e||!(e.measure&&(null==(t=e.measure)?void 0:t.length)>0||null!=e&&e.dimension&&(null==e?void 0:e.dimension.length)>0))},ev={type:"barChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!1,drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto"},tv=function(e){var n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b=e.displayTitle,x=e.displaySubject,y=Bh({title:b,subject:x}),w=rs(),C={displayTitle:b,displaySubject:x,localFilters:(e=ta(e,{},ev)).localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,library:null!=(n=null==(r=e)?void 0:r.library)&&n,verified:null==(i=e)?void 0:i.protectedByOrganisation,dataSet:e.dataSet,parameters:null==(o=e)?void 0:o.parameters,componentType:null==(a=e)?void 0:a.type,measure:null==(l=e)?void 0:l.measure,dimension:null==(s=e)?void 0:s.dimension,timeDimension:e.timeDimension};if(!On(e.type).isRunnable(e))return c.jsx(uf,{title:"Missing parameters"});if(Uo(e.result))return c.jsx(hc,{});if(Go(e.result))return c.jsx(df,{});if(Ko(e.result))return c.jsx(pf,U({},C));var j=zh(e),S=Wo(j,e.measure,e.result),F=Vo(e.result,e.measure,j,"100%"==e.stacked);return c.jsx(t.Suspense,{fallback:c.jsx(hc,{}),children:c.jsxs(Tp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Rm,U({},C)),c.jsx(Oa,{disabledFeatures:null!=(u=null==(d=e)?void 0:d.library)&&u,children:c.jsx(Kh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,ref:y,sparkline:e.sm,uniqueId:e.id,x:"x",formatYAxisLabel:la({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(p=e)?void 0:p.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:aa(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(f=e)?void 0:f.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatter:function(t,n){var r,i=oa(e.dimension,e.conditionalFormattingRules,t,n,null==(r=e)?void 0:r.dataSet);if(i)return i.ruleValue},keys:S,colors:er(null==w?void 0:w.colors,S.length),data:F,legend:qh(null==(m=e)?void 0:m.legend,"verbose"===(null==w?void 0:w.detail)),horizontal:"horizontalBarChart"==e.type,removeStroke:!1,type:e.stacked?"stacked":"grouped",showTotalOnTooltip:!!e.stacked,forceXAxisAsTime:!!e.timeDimension,theme:null==w?void 0:w.charts,axisTitles:null==(h=e)?void 0:h.axisTitles,formatSeriesName:sa(e.result),onPointerUp:null==(v=e)?void 0:v.onPointerUp,conditionalFormattingPossibilities:function(t){return ia(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},onClick:function(t,n){return function(e,t,n){var r,i,o=n.onViewClick;(function(e){return(null==e?void 0:e.distance)<3})(e)&&$h(null==n?void 0:n.protectedFields)&&o({viewId:null!=(r=null==n?void 0:n.viewId)?r:"",type:null!=(i=null==n?void 0:n.type)?i:"barChart",clicked:{grouping:function(){var r,i=[],o=Object.keys(null!=t?t:{}).map((function(e){return zo(e)}));if(null!=n&&n.dimension&&(null==n||null==(r=n.dimension)?void 0:r.length)>0)if(o.length>1)o.map((function(e){var t,n;i.push({fieldId:null!=(t=""+e.dimensionKeys[0])?t:"",function:e.function,aggregate:e.function,value:null!=(n=""+e.dimensionValues[0])?n:""})}));else{var a,l=null!=(a=null==n?void 0:n.dimension[0].field)?a:"";i.push({fieldId:l,function:null==n?void 0:n.dimension[0].function,aggregate:null==n?void 0:n.dimension[0].function,value:null==e?void 0:e.datum[l]})}if(n&&"timeDimension"in n&&null!==(null==n?void 0:n.timeDimension)){var s,u,d,c,p=null!=(s=null==(u=n.timeDimension)?void 0:u.field)?s:"";i.push({fieldId:p,function:null==(d=n.timeDimension)?void 0:d.truncate,aggregate:null==(c=n.timeDimension)?void 0:c.truncate,value:null==e?void 0:e.datum[p]})}return i}(),value:{fieldId:null!=n&&n.measure?null==n?void 0:n.measure[0].field:"",function:null!=n&&n.measure?null==n?void 0:n.measure[0].function:"",aggregate:null!=n&&n.measure?null==n?void 0:n.measure[0].function:"",value:null==e?void 0:e.datum[null==e?void 0:e.key]}}})}(t,n,e)},goalLine:null==(g=e)?void 0:g.goalLines})})]})})};tv.defaultProps=ev;var nv=t.memo(tv,na),rv=function(e,n,r,i,o,a,l){var s=e;return n.preAggregated&&(s=[Yn(n)]),function(e,n,r,i){t.useEffect((function(){var t=On(n.type,{queryEngineConfig:r});if(e.preAggregated&&t.setDataAttributesFromPreAggregatedDataSet){var o=t.setDataAttributesFromPreAggregatedDataSet(n,e);i(o)}}),[JSON.stringify({dataSet:e,type:n.type})])}(n,e,r,o),{queriesAreChanging:Uh(s,a,l,i,n,e.type).queriesAreChanging}},iv=function(e){var n,r,i=t.useState(null),o=i[0],a=i[1],l=e.component,s=l.results,u=l.attributes,d=rv(u,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:l.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return c.jsxs(t.Fragment,{children:[c.jsx(nv,U({id:e.id},u,{sm:e.sm,dataSet:e.dataSet,localFilters:e.component.localFilters,parameters:null==e?void 0:e.component.attributes.parameters,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,result:s[0],queriesAreChanging:d.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(r=n.queryEngineConfig)?void 0:r.supportedTransformationFunctions,onPointerUp:function(t){return Yh(e)&&a(t)},library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onViewClick:function(t){return(null==e?void 0:e.onViewClick)&&(null==e?void 0:e.onViewClick(t))},goalLines:e.component.attributes.goalLines,axisTitles:null==e?void 0:e.component.attributes.axisTitles})),o&&c.jsx(Hh,{onDrilldown:o,onClose:function(){return a(null)},inputProps:e})]})},ov=t.forwardRef((function(e,t){return Mh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Rh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,forceXAxisAsTime:e.forceXAxisAsTime,lineCurve:e.lineCurve,sparkline:e.sparkline,lines:{annotate:e.annotate||[],data:e.data,keys:e.keys,colors:e.colors,formatter:e.formatter},x:e.x,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onPointerUp:null==e?void 0:e.onPointerUp,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles})}})})),av=function(e){var n,r,i=e.displayTitle,o=e.displaySubject,a=Bh({title:i,subject:o}),l={displayTitle:i,displaySubject:o,verified:e.protectedByOrganisation,library:null!=(n=e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension,timeDimension:e.timeDimension,setParameterUpdate:null==e?void 0:e.setParameterUpdate},s=rs();if(!On(e.type).isRunnable(e))return c.jsx(uf,{title:"Missing parameters"});if(Uo(e.result))return c.jsx(hc,{});if(Go(e.result))return c.jsx(df,{});if(Ko(e.result))return c.jsx(pf,U({},l));var u=zh(e),d=Wo(u,e.measure,e.result),p=Vo(e.result,e.measure,u,"100%"==e.stacked);return c.jsx(t.Suspense,{fallback:c.jsx(hc,{}),children:c.jsxs(Tp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Rm,U({},l)),c.jsx(Oa,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:c.jsx(ov,{ref:a,uniqueId:e.id,x:"x",approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,formatYAxisLabel:la({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:aa(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),keys:d,colors:er(null==s?void 0:s.colors,d.length),data:p,sparkline:e.sm,legend:qh(null==e?void 0:e.legend,"verbose"===(null==s?void 0:s.detail)),horizontal:!1,annotate:"verbose"==(null==s?void 0:s.detail)?["high_and_low"]:[],forceXAxisAsTime:!!e.timeDimension,lineCurve:e.lineCurve,theme:null==s?void 0:s.charts,formatSeriesName:sa(e.result),formatter:function(t){var n=oa(e.dimension,e.conditionalFormattingRules,{},t,null==e?void 0:e.dataSet);if(n)return n.ruleValue},onPointerUp:null==e?void 0:e.onPointerUp,goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles})})]})})};av.defaultProps={type:"lineChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0};var lv=t.memo(av,na),sv=function(e){var n,r,i=t.useState(null),o=i[0],a=i[1],l=e.component,s=l.results,u=l.attributes,d=rv(u,e.dataSet,e.dashboardBehaviour.queryEngineConfig,{localFilters:l.localFilters,globalFilters:e.globalFilters},e.updateComponentAttributes,e.runQueriesCallback,e.setResults);return c.jsxs(t.Fragment,{children:[c.jsx(lv,U({id:e.id},u,{dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,result:s[0],queriesAreChanging:d.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(n=e.dashboardBehaviour)||null==(r=n.queryEngineConfig)?void 0:r.supportedTransformationFunctions,onPointerUp:function(t){return Yh(e)&&a(t)},sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions})),o&&c.jsx(Hh,{onDrilldown:o,onClose:function(){return a(null)},inputProps:e})]})};function uv(e){if(0===(null==e?void 0:e.measure.length))return"The Data settings are missing a Metric. Select from the list of Metrics to display the Chart."}function dv(e){if(e.xMeasure&&e.yMeasure||e.dimension.length>0)return"The Data settings are missing a parameter. Select from the list of parameters to display the Chart."}var cv=t.forwardRef((function(e,t){return Mh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Rh,{approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.uniqueId,formatSeriesName:e.formatSeriesName,forceXAxisAsTime:e.forceXAxisAsTime,sparkline:e.sparkline,lines:{annotate:e.annotate||[],data:e.data,keys:e.keys,colors:e.colors,scatter:!0},x:e.x,sharedTooltip:!0,legend:null==e?void 0:e.legend,removeStroke:null==e?void 0:e.removeStroke,formatXAxisLabel:null==e?void 0:e.formatXAxisLabel,formatYAxisLabel:null==e?void 0:e.formatYAxisLabel,horizontal:null==e?void 0:e.horizontal,height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width,theme:null==e?void 0:e.theme,onClick:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},goalLine:null==e?void 0:e.goalLine,axisTitles:null==e?void 0:e.axisTitles})}})})),pv={type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,filter:[],limit:500,legend:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto"},fv=function(e){var n,r,i,o,a,l,s,u,d,p=e.displayTitle,f=e.displaySubject,m=Bh({title:p,subject:f}),h={displayTitle:p,displaySubject:f,library:null!=(n=e.library)&&n,verified:e.protectedByOrganisation,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,componentType:null==(r=e)?void 0:r.type},v=rs();if(!On(e.type).isRunnable(e))return c.jsx(uf,{title:"Missing parameters",children:dv(e)});if(Uo(e.result))return c.jsx(hc,{});if(Go(e.result))return c.jsx(df,{});if(Ko(e.result))return c.jsx(pf,U({},h));var g=(e=ta(e,{},pv)).result&&e.xMeasure?function(e,t,n){var r={};return qo(n).forEach((function(n){var i=[].concat(e).map((function(e){return n[e.field]})),o=[].concat(e).map((function(e){return e.field})),a=Mo(o,i,t.field,t.function);r[a]=!0})),Object.keys(r)}(e.dimension,e.xMeasure,e.result):[];if(!e.xMeasure||!e.yMeasure)return null;var b=[];e.xMeasure&&b.push(e.xMeasure),e.yMeasure&&b.push(e.yMeasure);var x=zh(e),y=e.result?Vo(e.result,b,x):[],w=Mo([],[],e.xMeasure.field,e.xMeasure.function);return y.map((function(t){var n=[].concat(e.dimension.map((function(e){return t[e.field]}))),r=e.yMeasure,i=e.xMeasure;if(!r)return!1;if(!i)return!1;var o=Mo([],[],r.field,r.function),a=Mo(e.dimension.map((function(e){return e.field})),n,i.field,i.function);return t[a]=t[o],t})),c.jsx(t.Suspense,{fallback:c.jsx(hc,{}),children:c.jsxs(Tp,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Rm,U({},h)),c.jsx(Oa,{disabledFeatures:null!=(i=null==(o=e)?void 0:o.library)&&i,children:c.jsx(cv,{ref:m,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,x:w,keys:g,colors:er(null==v?void 0:v.colors,g.length),data:y,legend:qh(null==(a=e)?void 0:a.legend,"verbose"===(null==v?void 0:v.detail)),horizontal:!1,removeStroke:!1,forceXAxisAsTime:!1,sparkline:!1,formatYAxisLabel:la({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==(l=e)?void 0:l.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:aa(null,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==(s=e)?void 0:s.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),theme:null==v?void 0:v.charts,formatSeriesName:sa(e.result),goalLine:null==(u=e)?void 0:u.goalLines,axisTitles:null==(d=e)?void 0:d.axisTitles})})]})})};fv.defaultProps=pv;var mv=t.memo(fv,na),hv=function(e){var t,n,r=e.component,i=r.results,o=r.attributes,a=r.localFilters,l=Uh(o,e.runQueriesCallback,e.setResults,{localFilters:a,globalFilters:e.globalFilters},e.dataSet);return c.jsx(mv,U({id:e.id},o,{dataSet:e.dataSet,localFilters:a,setLocalFilters:e.setLocalFilters,setParameterUpdate:function(){},result:i[0],queriesAreChanging:l.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,sm:e.sm,library:null==e?void 0:e.library,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(n=t.queryEngineConfig)?void 0:n.supportedTransformationFunctions,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions}))},vv=function(e){return[].concat(e.content).map((function(t){return i.reduce(t,(function(t,n,r){return t[e.fields[r].id]=n,t}),{})}))},gv=t.forwardRef((function(e,t){return Mh(t)?null:c.jsx(I.ParentSize,{children:function(t){var n,r;return c.jsx(Rh,U({},e,{height:null!=(n=null==e?void 0:e.height)?n:null==t?void 0:t.height,width:null!=(r=null==e?void 0:e.width)?r:null==t?void 0:t.width}))}})})),bv=function(e){var t=e.endAngle;return{startAngle:t>Math.PI?2*Math.PI:0,endAngle:t>Math.PI?2*Math.PI:0,opacity:0}},xv=function(e){return{startAngle:e.startAngle,endAngle:e.endAngle,opacity:1}};function yv(e){var t=e.animate,n=e.path,r=e.getColor,i=e.onClickDatum,o=e.onMouseOver,a=e.onMouseOut,l=e.showLabel,s=e.valueKey,u=e.formatValue;return E.useTransition(e.arcs,{from:t?bv:xv,enter:xv,update:xv,leave:t?bv:xv,keys:e.getKey})((function(e,t,d){var p=d.key,f=n.centroid(t),m=f[0],h=f[1],v=t.endAngle-t.startAngle>=.1,g=JSON.parse(p);return c.jsxs("g",{children:[c.jsx(E.animated.path,{d:E.interpolate([e.startAngle,e.endAngle],(function(e,r){return n(U({},t,{startAngle:e,endAngle:r}))})),fill:r(t),onClick:function(){return i(g)},onTouchStart:function(){return i(g)},onMouseOver:function(){return o({arc:t,coords:{x:m,y:h}})},onMouseOut:function(){return a()}}),l&&v&&c.jsx(E.animated.g,{style:{opacity:e.opacity},children:c.jsx("text",{fill:"white",x:m,y:h,dy:".33em",fontSize:9,textAnchor:"middle",pointerEvents:"none",children:u(g[s])})})]},p)}))}var wv=t.forwardRef((function(e,t){return Mh(t)?null:c.jsx(I.ParentSize,{children:function(t){return c.jsx(Cv,U({width:null==t?void 0:t.width,height:null==t?void 0:t.height},e))}})})),Cv=function(e){var n,r=e.width,i=e.labelKey,o=e.valueKey,a=e.formatValue,l=e.formatLabel,s=qm(null!=(n=null==e?void 0:e.height)?n:300,null==e?void 0:e.legend),u=O.useTooltip({tooltipOpen:!1,tooltipLeft:r/2,tooltipTop:s,tooltipData:"Move me with your mouse or finger"}),d=u.showTooltip,p=u.hideTooltip,f=u.tooltipOpen,m=u.tooltipData,h=u.tooltipLeft,v=void 0===h?0:h,g=u.tooltipTop,b=void 0===g?0:g,x=O.useTooltipInPortal({scroll:!0,detectBounds:!0}),y=x.containerRef,w=x.containerBounds,C=x.TooltipInPortal,j=jv(null==e?void 0:e.data,i,l),S=F.scaleOrdinal({domain:j,range:null==e?void 0:e.colors}),k=r-25-25,T=s-25-25,A=Math.min(k,T)/2,D=T/2,I=k/2,E=s/5.5,L=t.useCallback((function(e){var t,n,i=(null==e||null==(t=e.coords)?void 0:t.x)-w.left+r/2,o=(null==e||null==(n=e.coords)?void 0:n.y)-w.top+s/2;d({tooltipLeft:i,tooltipTop:o,tooltipData:JSON.stringify(e.arc.data)})}),[d,s,r]);if(r<10)return null;var R=function(){if(m){var e=JSON.parse(m);return{label:l?l(e[i]):e[i],value:a(e[o])}}return{label:"",value:""}};return c.jsxs("div",{ref:y,style:{position:"relative",height:s,width:r},children:[c.jsx("style",{children:""+Bm}),c.jsx("svg",{width:r,height:s,children:c.jsxs(P.Group,{top:D+25,left:I+25,children:[c.jsx(_,{data:null==e?void 0:e.data,pieValue:function(e){return e[o]},outerRadius:A,innerRadius:A-E,cornerRadius:5,padAngle:.005,pieSort:null,pieSortValues:null,children:function(t){return c.jsx(yv,U({},t,{animate:!0,getKey:function(e){return JSON.stringify(e.data)},onClickDatum:function(t){return(null==e?void 0:e.onClick)&&(null==e?void 0:e.onClick(t))},getColor:function(t){return e.formatColor&&e.formatColor(t.data,o)||S(t.data[i])},onMouseOver:L,onMouseOut:function(){return p()},showLabel:null==e?void 0:e.showLabel,valueKey:o,formatValue:function(e){return a(e)}}))}}),f&&c.jsx(C,{top:b,left:v,children:c.jsx(xh,{sections:1,children:c.jsx(yh,{label:R().label,value:R().value.toString()})})},Math.random())]})}),(null==e?void 0:e.legend)&&c.jsx(rh,{colors:null==e?void 0:e.colors,keys:j,typeIndex:Sv(null==e?void 0:e.data),alignCenter:!0,replaceDimensionColorsIfPossible:!0,conditionalFormattingPossibilities:function(t){return e.conditionalFormattingPossibilities?e.conditionalFormattingPossibilities(o):[]}})]})},jv=function(e,t,n){return e.map((function(e){return n?n(e[t]):e[t]}))},Sv=function(e){return e.map((function(e,t){return{index:t,type:"pie"}}))},Fv={Afghanistan:"AFG",Angola:"AGO",Albania:"ALB","United Arab Emirates":"ARE",Argentina:"ARG",Armenia:"ARM",Antarctica:"ATA","French Southern and Antarctic Lands":"ATF",Australia:"AUS",Austria:"AUT",Azerbaijan:"AZE",Burundi:"BDI",Belgium:"BEL",Benin:"BEN","Burkina Faso":"BFA",Bangladesh:"BGD",Bulgaria:"BGR","The Bahamas":"BHS","Bosnia and Herzegovina":"BIH",Belarus:"BLR",Belize:"BLZ",Bermuda:"BMU",Bolivia:"BOL",Brazil:"BRA",Brunei:"BRN",Bhutan:"BTN",Botswana:"BWA","Central African Republic":"CAF",Canada:"CAN",Switzerland:"CHE",Chile:"CHL",China:"CHN","Ivory Coast":"CIV",Cameroon:"CMR","Democratic Republic of the Congo":"COD","Republic of the Congo":"COG",Colombia:"COL","Costa Rica":"CRI",Kosovo:"CS-KM",Cuba:"CUB",Cyprus:"CYP","Czech Republic":"CZE",Germany:"DEU",Djibouti:"DJI",Denmark:"DNK","Dominican Republic":"DOM",Algeria:"DZA",Ecuador:"ECU",Egypt:"EGY",Eritrea:"ERI","Western Sahara":"ESH",Spain:"ESP",Estonia:"EST",Ethiopia:"ETH",Finland:"FIN",Fiji:"FJI","Falkland Islands":"FLK",France:"FRA",Gabon:"GAB","United Kingdom":"GBR",Georgia:"GEO",Ghana:"GHA",Guinea:"GIN",Gambia:"GMB","Guinea Bissau":"GNB","Equatorial Guinea":"GNQ",Greece:"GRC",Greenland:"GRL",Guatemala:"GTM","French Guiana":"GUF",Guyana:"GUY",Honduras:"HND",Croatia:"HRV",Haiti:"HTI",Hungary:"HUN",Indonesia:"IDN",India:"IND",Ireland:"IRL",Iran:"IRN",Iraq:"IRQ",Iceland:"ISL",Israel:"ISR",Italy:"ITA",Jamaica:"JAM",Jordan:"JOR",Japan:"JPN",Kazakhstan:"KAZ",Kenya:"KEN",Kyrgyzstan:"KGZ",Cambodia:"KHM","South Korea":"KOR",Kuwait:"KWT",Laos:"LAO",Lebanon:"LBN",Liberia:"LBR",Libya:"LBY","Sri Lanka":"LKA",Lesotho:"LSO",Lithuania:"LTU",Luxembourg:"LUX",Latvia:"LVA",Morocco:"MAR",Moldova:"MDA",Madagascar:"MDG",Mexico:"MEX",Macedonia:"MKD",Mali:"MLI",Malta:"MLT",Myanmar:"MMR",Montenegro:"MNE",Mongolia:"MNG",Mozambique:"MOZ",Mauritania:"MRT",Malawi:"MWI",Malaysia:"MYS",Namibia:"NAM","New Caledonia":"NCL",Niger:"NER",Nigeria:"NGA",Nicaragua:"NIC",Netherlands:"NLD",Norway:"NOR",Nepal:"NPL","New Zealand":"NZL",Oman:"OMN",Pakistan:"PAK",Panama:"PAN",Peru:"PER",Philippines:"PHL","Papua New Guinea":"PNG",Poland:"POL","Puerto Rico":"PRI","North Korea":"PRK",Portugal:"PRT",Paraguay:"PRY","West Bank":"PSE",Qatar:"QAT",Romania:"ROU",Russia:"RUS",Rwanda:"RWA","Saudi Arabia":"SAU",Sudan:"SDN",Senegal:"SEN","Solomon Islands":"SLB","Sierra Leone":"SLE","El Salvador":"SLV",Somalia:"SOM","Republic of Serbia":"SRB","South Sudan":"SSD",Suriname:"SUR",Slovakia:"SVK",Slovenia:"SVN",Sweden:"SWE",Swaziland:"SWZ",Syria:"SYR",Chad:"TCD",Togo:"TGO",Thailand:"THA",Tajikistan:"TJK",Turkmenistan:"TKM","East Timor":"TLS","Trinidad and Tobago":"TTO",Tunisia:"TUN",Turkey:"TUR",Taiwan:"TWN","United Republic of Tanzania":"TZA",Uganda:"UGA",Ukraine:"UKR",Uruguay:"URY","United States of America":"USA",Uzbekistan:"UZB",Venezuela:"VEN",Vietnam:"VNM",Vanuatu:"VUT",Yemen:"YEM","South Africa":"ZAF",Zambia:"ZMB",Zimbabwe:"ZWE"},kv={worldCountries:{id:"worldCountries",fetchTopoJSON:function(){var e=Y(W().mark((function e(){var t;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u("https://static.app.vizzly.co/topojson/world-countries.json",{mode:"cors"});case 2:if(!(t=e.sent).ok){e.next=8;break}return e.next=6,t.json();case 6:return e.abrupt("return",e.sent);case 8:return e.abrupt("return",null);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),geographicAreaId:function(e){return"id"in e&&"string"==typeof e.id?e.id:""},geographicAreaPublicName:function(e){return i.get(e,"properties.name","Name not found.")},allGeographicAreas:function(e){var t,n,r=this,o=(null==e||null==(t=e.objects)||null==(n=t.countries1)?void 0:n.geometries)||[];return i.reduce(o,(function(e,t){return e[r.geographicAreaId(t)]={publicName:r.geographicAreaPublicName(t)},e}),{})},resolveUserDataToVizzlyAreaCode:function(e){var t={};return Object.keys(e).forEach((function(n){t[Fv[n]||n]=e[n]})),t}}},Tv=function(e){var n,r,o=e.width,a=e.height,l=e.data,s=e.background,u=e.colorRange,d=e.gridColor,p=e.missingDataColor,f=e.formatValue,m=e.onPositionChange,h=e.position||{centerX:o/2,centerY:a/2,scale:o/630*100},v=h.centerX,g=h.centerY,b=h.scale,x=function(e){var n=t.useState(null),r=n[0],i=n[1],o=kv[e];return t.useEffect((function(){!function(){var e=Y(W().mark((function e(){var t;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.fetchTopoJSON();case 2:(t=e.sent)&&i(t);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[e]),{topologyJSON:r,topology:o}}(e.topology),y=x.topology,w=x.topologyJSON,C=function(e,t){var n=O.useTooltip({tooltipOpen:!1,tooltipLeft:e/2,tooltipTop:t,tooltipData:void 0}),r=n.showTooltip,i=n.hideTooltip,o=n.tooltipOpen,a=n.tooltipData,l=n.tooltipLeft,s=void 0===l?0:l,u=n.tooltipTop,d=void 0===u?0:u,c=O.useTooltipInPortal({scroll:!0,detectBounds:!0});return{showTooltip:r,hideTooltip:i,tooltipOpen:o,tooltipData:a,tooltipLeft:s,tooltipTop:d,containerRef:c.containerRef,containerBounds:c.containerBounds,TooltipInPortal:c.TooltipInPortal}}(o,a),j=C.showTooltip,S=C.containerRef,k=C.tooltipData,T=C.containerBounds,A=C.tooltipOpen,D=C.TooltipInPortal,I=C.tooltipTop,P=C.tooltipLeft,_=C.hideTooltip;if(!w)return null;var E=y.resolveUserDataToVizzlyAreaCode(l),M=R.feature(w,w.objects.countries1),z=Object.values(l),B=F.scaleQuantize({domain:[null!=(n=i.min(z))?n:0,null!=(r=i.max(z))?r:1],range:u});return o<10?null:c.jsxs("div",{ref:S,children:[c.jsx("style",{children:""+Bm}),c.jsx(N.Zoom,{width:o,height:a,initialTransformMatrix:{scaleX:b,scaleY:b,translateX:v,translateY:g,skewX:0,skewY:0},children:function(e){return c.jsxs("div",{onMouseLeave:function(){m&&m({scale:e.transformMatrix.scaleX,centerX:e.transformMatrix.translateX,centerY:e.transformMatrix.translateY})},children:[c.jsxs("svg",{"data-component":"mercator-map",width:o,height:a,onDoubleClick:function(){e.scale({scaleX:1.3,scaleY:1.3})},onTouchStart:e.dragStart,onMouseDown:e.dragStart,onTouchMove:e.dragMove,onTouchEnd:e.dragEnd,onMouseMove:e.dragMove,onMouseUp:e.dragEnd,onMouseLeave:function(){_(),e.isDragging&&e.dragEnd()},children:[c.jsx("rect",{x:0,y:0,width:o,height:a,fill:s,rx:14}),c.jsx(L.Mercator,{data:M.features,scale:e.transformMatrix.scaleX,translate:[e.transformMatrix.translateX,e.transformMatrix.translateY],children:function(e){return c.jsxs("g",{children:[c.jsx(L.Graticule,{graticule:function(t){return e.path(t)||""},stroke:null!=d?d:"none"}),e.features.map((function(e,t){var n,r=e.feature;return c.jsx("path",{"data-testid":"map-feature-"+r.id,d:e.path||"",fill:(n=y.geographicAreaId(r),E[n]?B(E[n]):p),stroke:s,strokeWidth:.5,onMouseEnter:function(e){r.id!=(null==k?void 0:k.areaId)&&j({tooltipLeft:e.clientX-T.left,tooltipTop:e.clientY-T.top,tooltipData:{areaId:r.id,publicName:y.geographicAreaPublicName(r),value:E[r.id]}})}},"map-feature-"+t)}))]})}}),A&&c.jsx(D,{top:I,left:P,children:c.jsx(xh,{sections:1,children:c.jsx(yh,{label:null==k?void 0:k.publicName,value:null!=k&&k.value?""+f(k.value):"No data"})})},Math.random())]}),c.jsxs("div",{style:{position:"absolute",bottom:20,right:30,display:"flex",flexDirection:"column"},children:[c.jsx("button",{style:{background:"#fff",borderRadius:"5px",opacity:.6,padding:"1px 6px",marginBottom:5,border:0},onClick:function(){e.scale({scaleX:1.4,scaleY:1.4})},"aria-label":"zoom in",children:"+"}),c.jsx("button",{style:{background:"#fff",borderRadius:"5px",opacity:.6,padding:"1px 6px",border:0},onClick:function(){return e.scale({scaleX:.8,scaleY:.8})},"aria-label":"zoom out",children:"-"})]})]})}})]})},Av=t.forwardRef((function(e,t){return Mh(t)?null:c.jsx(M,{children:function(t){return c.jsx(Tv,U({},e,{width:t.width,height:t.height}))}})})),Dv=function(e){var n,r,o=e.displayTitle,a=e.displaySubject,l=rs(),s=Bh({title:o,subject:a}),u={displayTitle:o,displaySubject:a,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:e.dataSet,parameters:null==e?void 0:e.parameters,componentType:null==e?void 0:e.type,measure:null==e?void 0:e.measure,dimension:null==e?void 0:e.dimension},d={dataSetId:e.dataSetId,measure:e.measure,dimension:e.dimension,timeDimension:null,order:e.order,filter:e.filter},p=e.measure.length>0&&e.dimension.length>0;if(Uo(e.result))return c.jsx(hc,{});if(!p)return c.jsx(uf,{title:"Missing parameters",children:uv(d)});if(Go(e.result))return c.jsx(df,{});if(Ko(e.result))return c.jsx(pf,U({},u));var f=zh({dimension:e.dimension}),m=function(e,t,n,r){void 0===r&&(r=!1);var o=vv(e),a=[].concat(o).map((function(e){var r=function(e,t){var n=i.reject([].concat(e.x),(function(e){var n;return e==(null==(n=t.timeDimension)?void 0:n.field)}));return t.timeDimension?[t.timeDimension.field]:n}(t,n),o=r.map((function(t){return Ze(e[t])})),a={},l=t.y.includes("measures")?[].concat(t.y).slice(0,t.y.length-1):[].concat(t.y),s=[].concat(l).map((function(t){return e[t]}));n.measure.forEach((function(t){var n=lt(t),r=Mo(l,s,t.field,t.function);a[r]=e[n]}));var u={};return r.forEach((function(t){u[t]=e[t]})),U({},u,{x:o.join(", ")},a,{xValues:o})})),l=[],s={};a.forEach((function(e){var t=s[e.x];s[e.x]||l.push(e.x),s[e.x]=i.merge({},t,e)}));var u=l.map((function(e){return s[e]}));return r?function(e){var t=["x","xValues"];return e.map((function(e){var n=U({},e),r=i.sumBy(Object.entries(n),(function(e){var n=e[1];return t.includes(e[0])?0:i.isNumber(n)?n:0}));return n=i.mapValues(n,(function(e,o){return t.includes(o)?e:i.isNumber(e)?Eo(n[o],r):e}))}))}(u):u}(e.result,f,d),h=function(e,t,n){var r=vv(t),i={};return r.forEach((function(t){var r=[].concat(n.y).map((function(e){return t[e]}));e.measure.forEach((function(e){var t=lt(e),o=Mo(n.y,r,e.field,e.function);i[o]={key:o,yValues:[].concat(r,[t]),name:[].concat(r,[t]).join(", ")}}))})),Object.values(i)}(d,e.result,f).map((function(t){return{data:m.map((function(n){var r;return(r={})[e.dimension[0].field]=n.x,r[t.key]=Number(n[t.key]),r})),valueKey:t.key,labelKey:e.dimension[0].field}}));return c.jsx(t.Suspense,{fallback:c.jsx(hc,{}),children:c.jsxs(Tp,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Rm,U({},u)),c.jsx(Oa,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:c.jsx(wv,{ref:s,data:h[0].data,labelKey:h[0].labelKey,valueKey:h[0].valueKey,colors:er(null==l?void 0:l.colors,m.length),conditionalFormattingPossibilities:function(t){return ia(e.dimension,e.conditionalFormattingRules,t,e.supportedAggregates,e.dataSet)},formatColor:function(t,n){var r=oa(e.dimension,e.conditionalFormattingRules,t,n,null==e?void 0:e.dataSet);if(r)return r.ruleValue},showLabel:"verbose"===(null==l?void 0:l.detail),legend:qh(null==e?void 0:e.legend,"verbose"===(null==l?void 0:l.detail)),formatValue:function(t){return ua(Oo(t,2),null==e?void 0:e.numberFormatOptions,null==e?void 0:e.labelFormat)}})})]})})};Dv.defaultProps={type:"pieChart",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:500,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!1,labelFormat:null};var Iv=t.memo(Dv,na),Pv=function(e){var t,n,r=e.component,i=r.results,o=r.attributes,a=Uh(o,e.runQueriesCallback,e.setResults,{localFilters:r.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(Iv,U({id:e.id},o,{dataSet:e.dataSet,localFilters:e.component.localFilters,setParameterUpdate:e.setParameterUpdate,setLocalFilters:e.setLocalFilters,result:i[0],queriesAreChanging:a.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(n=t.queryEngineConfig)?void 0:n.supportedTransformationFunctions,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions}))},_v=Object.assign((function(){}),{wrapper:function(e){return pa({position:"relative",border:null==e?void 0:e.border,background:null==e?void 0:e.background,borderRadius:null==e?void 0:e.borderRadius})},input:function(e){var t,n,r;return pa(U({color:"inherit",width:"100%",border:0,height:null==e?void 0:e.height,background:"transparent",padding:null==e?void 0:e.padding,fontSize:null==e?void 0:e.fontSize,borderRadius:null==e?void 0:e.borderRadius,fontWeight:null==e?void 0:e.fontWeight,boxSizing:"border-box"},ca,{"&:hover":U({},ca,{outline:0,boxShadow:e?null==(t=e["&:hover"])?void 0:t.boxShadow:void 0,background:e?null==(n=e["&:hover"])?void 0:n.background:void 0}),"&:focus":U({},ca,{outline:0,boxShadow:e?null==(r=e["&:focus"])?void 0:r.boxShadow:void 0})}))},icon:function(e){var t,n;return pa({color:null==e||null==(t=e.icons)?void 0:t.color,height:18,width:18,"> * svg":{fill:null==e||null==(n=e.icons)?void 0:n.color}})},iconWrapper:pa({top:8,right:12,position:"absolute",display:"flex",gap:"0.5rem"})}),Ev=t.forwardRef((function(e,n){var r=e.placeholder,i=e.onChange,o=e.initialValue,a=e.inputRef,l=t.useState(null!=o?o:""),s=l[0],u=l[1],d=function(e,n){var r=t.useState(e),i=r[0],o=r[1];return t.useEffect((function(){var t=setTimeout((function(){o(e)}),500);return function(){return clearTimeout(t)}}),[e,500]),i}(s);t.useEffect((function(){i(d)}),[i,d]);var p=function(){return u("")},f=rs();return c.jsx("form",{autoComplete:"off",children:c.jsxs("div",{role:"search",className:""+_v.wrapper(null==f?void 0:f.search),"data-themeapi":"search","data-chipposition":"top.left",children:[c.jsx(jm,{as:"label",htmlFor:"library-search",children:"Search"}),c.jsx("input",{value:s,onChange:function(e){return u(e.target.value)},id:"library-search",name:"library-search",className:""+_v.input(null==f?void 0:f.search),placeholder:r,ref:a}),c.jsxs("span",{className:""+_v.iconWrapper,children:[s&&c.jsx(bc,{onClear:function(){return p&&p()},className:""+_v.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"}),c.jsx(g.SearchIcon,{className:""+_v.icon(null==f?void 0:f.search),"data-themeapi":"search.icon"})]})]})})})),Ov=function(e){var t,n=null!=(t=null==e?void 0:e.percentage)?t:50;return c.jsx("div",{style:{height:e.height*(n/100)+"px"},children:c.jsx("div",{style:{width:e.width+"px",height:e.height+"px"},css:[50==n&&{"--tw-translate-y":"-25%",transform:"translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))","--tw-translate-x":"-25%","--tw-scale-x":".5","--tw-scale-y":".5"},""],children:e.children})})},Lv=function(e,t,n){return pa(U({transform:t?"translate3d(0, 0, 0)":void 0,position:"relative",height:"100%",width:null!=n?n:"100%"},e))},Rv=n.forwardRef((function(e,t){var n,r,i=e.transform,o=void 0===i||i,a=rs();return c.jsx("div",{role:null==e?void 0:e.role,"data-testid":null==e?void 0:e.testId,className:Zl(null==e?void 0:e.vizzlyPrefix,""+Lv(U({},null==a?void 0:a.panels,{padding:null!=(n=null==e?void 0:e.padding)?n:null==a||null==(r=a.panels)?void 0:r.padding}),o,null==e?void 0:e.width)),ref:t,"data-themeapi":"panels","data-chipposition":"top.left",onMouseOver:function(){return(null==e?void 0:e.onHover)&&(null==e?void 0:e.onHover(!0))},onMouseLeave:function(){return(null==e?void 0:e.onHover)&&(null==e?void 0:e.onHover(!1))},children:null==e?void 0:e.children})})),Mv=function(e,t,n){try{if(!Rn(t,e.attributes.dataSetId))throw new Yt(t,e.attributes.dataSetId);var r=On(e.attributes.type,{queryEngineConfig:n.queryEngineConfig}).validate(e.attributes,t);return r.length>0&&Wr(r),r[0]}catch(e){if(e instanceof qt)return e;if(e instanceof Yt)return e;if(e instanceof Ht)return e;throw e}},Nv=Object.assign((function(){return null}),{label:function(e){return pa({color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight,margin:0,padding:0})},description:function(e){return pa({color:null==e?void 0:e.color,fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight})},input:pa({height:19.5,margin:0,padding:0}),fieldset:function(e){return void 0===e&&(e=!1),pa({border:"none",margin:0,padding:0,width:"auto",opacity:e?.6:1,cursor:e?"not-allowed":"pointer"})}});function zv(e){var t=e.options,n=e.name,r=e.onChange,i=e.selected,o=e.label,a=e.labelHidden,l=e.locked,s=e.direction,u=e.maxWidth;return c.jsxs("fieldset",{className:""+Nv.fieldset(l),children:[!a&&c.jsx(Tc,{as:"legend",children:o}),c.jsx(Gd,{direction:s||"column",gap:"0.5rem","data-component":"radio-group",maxWidth:u||"100%",children:t.map((function(e,t){return c.jsx(Bv,{option:e,name:n,onChange:function(e){return r&&!l&&r(e.target.value)},selected:i},t)}))})]})}function Bv(e){return c.jsx(qv,U({},e,{type:"radio"}))}function qv(e){var t,n,r=e.name,i=e.option,o=e.selected,a=e.onChange,l=e.type,s=rs();return c.jsxs(Gd,{as:"label",gap:"0.5rem",alignItems:"self-start","data-component":"input",cursor:"inherit",className:""+Wv,children:[c.jsx("input",{type:l,name:r,value:i.value,checked:JSON.stringify(o)===JSON.stringify(i.value),onChange:a,className:Zl("checkbox"===l?ip()+" "+Vv:""+Nv.input)}),c.jsxs(Gd,{direction:"column","data-component":"label",children:[c.jsx("p",{className:""+Nv.label(null==s||null==(t=s.radioGroup)?void 0:t.label),"data-themeapi":"radioGroup.label",children:i.label}),(null==i?void 0:i.description)&&c.jsx("span",{className:""+Nv.description(null==s||null==(n=s.radioGroup)?void 0:n.description),children:null==i?void 0:i.description})]})]})}var Vv=pa({marginRight:0,marginTop:1}),Wv=pa({userSelect:"none"}),Hv=function(e){var n=Ol().maxCSVDownloadLimit,r=t.useState("data-set-download-type"),i=r[0],o=r[1],a=n&&"number"==typeof n?" Up to "+n.toLocaleString()+" rows.":"";return c.jsxs(If,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(If.Header,{title:"Data download",show:!0}),c.jsx(If.Content,{children:c.jsx(zv,{options:[{label:"Full data set",value:"data-set-download-type",description:"Download the underlying data that this view has used."+a},{label:"View data set",value:"view-download-type",description:"Download the data that you see in this view."}],name:"download-type",label:"Select Download Type",selected:i,labelHidden:!0,onChange:function(e){return o(e)}})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Ip,{onClick:function(){return null==e?void 0:e.onClose(!1)},children:"Cancel"}),c.jsx(Ip,{primary:!0,onClick:function(){e.onDownload(i),null==e||e.onClose(!0)},children:"Download"})]})})]})},Yv=Ml((function(e){var t=e.onClose,n={editComponentsOnDashboard:"Edit",editComponentsOnLibrary:"Edit",downloadComponentData:"Download",increaseColSpan:"Merge",decreaseColSpan:"Unmerge",removeComponentFromLibrary:"Remove",removeComponentFromDashboard:"Remove",removeCellFromDashboard:"Remove",manageReport:"Reports",parameters:"Add Parameters",localFilter:"Add Local Filters",clickSettings:"Click Settings"};return c.jsx(qd.Options,{children:c.jsx("div",{children:e.cellOptions.map((function(e,r){return c.jsxs(qd.Option,{"data-testid":e.testId,onChange:function(){e.onClick(),t()},children:[e.renderIcon&&e.renderIcon(),c.jsx("span",{children:n[e.purpose]||""})]},"option_"+r+"_"+e.purpose+e.testId)}))})})}),"renderComponentOptions"),Uv={name:"1v3ivpe",styles:"position:absolute;right:-1.25rem;top:0px"},Gv=function(e){var t=Wd(),n=t.ref,r=t.open,i=t.position,o=t.show,a=t.close,l=rs();return c.jsxs("div",{css:Uv,ref:n,children:[c.jsx("button",{"data-testid":"open-component-options","aria-label":null!=e&&e.chartLabel?"Options: "+(null==e?void 0:e.chartLabel):"Options",onClick:function(){r()},className:pp(null==l?void 0:l.dashboard)+" "+Aa.button,"data-themeapi":"dashboard.icon",children:c.jsx(Xl,{})}),o&&c.jsx(qd,{onClose:function(){return a()},position:i,children:c.jsx(Yv,{onClose:function(){return r()},cellOptions:e.cellOptions})})]})},Kv=function(e){var n,r=t.useState(!1),o=r[0],a=r[1],l=Bc().dashboard,s=(null==e?void 0:e.component.attributes).type,u=Ol(),d=On(e.component.attributes.type),p=Mv(e.component,l.dataSets,u),f=[];return!e.canEditComponentsOnDashboard||p instanceof qt||f.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return c.jsx(Jv,{})},onClick:function(){return e.onEdit()},testId:"edit"}),e.canSetupReportSchedule&&"basicTable"==s&&f.push({purpose:"manageReport",renderIcon:function(){return c.jsx(Bl,{})},onClick:function(){return e.onManageReport()},testId:"manage-report"}),"admin"!==u.mode||"basicTable"!=s&&"dataTable"!=s&&"barChart"!=s&&"horizontalBarChart"!=s||f.push({purpose:"clickSettings",renderIcon:function(){return c.jsx(Gd,{width:20,justifyContent:"center",as:"span",children:c.jsx(g.CogIcon,{})})},onClick:function(){return e.onClickSettings()},testId:"click-settings"}),e.canDownloadComponentData&&"custom"!=s&&f.push({purpose:"downloadComponentData",renderIcon:function(){return c.jsx(Kl,{})},onClick:function(){return a(!0)},testId:"download"}),u.featureToggles.canConfigureLocalFilters&&f.push({purpose:"localFilter",renderIcon:function(){return c.jsx(Gd,{width:20,justifyContent:"center",as:"span",children:c.jsx(zl,{active:!1})})},onClick:function(){return e.onAddFilter()},testId:"filterBy"}),u.featureToggles.parameters&&null!=(n=d.supportedFeatures)&&n.parameters&&"read_write"===u.scope&&f.push({purpose:"parameters",renderIcon:function(){return c.jsx(Gd,{width:20,justifyContent:"center",as:"span",children:c.jsx(ql,{})})},onClick:function(){return e.onSetParameters()},testId:"parameters"}),e.canRemoveComponentsFromDashboard&&f.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return c.jsx(Qv,{})},onClick:function(){return e.onRemove()},testId:"remove"}),i.isEmpty(f)?null:c.jsxs(c.Fragment,{children:[c.jsx(Gv,{cellOptions:f,chartLabel:null==e?void 0:e.chartLabel}),c.jsx(Hv,{onDownload:e.onDownload,show:o,onClose:function(){return a(!1)}})]})},Xv=function(e){var t=[];return Ol().featureToggles.canRemoveComponentsFromDashboard&&(t=[].concat(t,[{purpose:"removeCellFromDashboard",renderIcon:function(){return c.jsx(Yl,{purpose:"removeCellFromDashboard"})},onClick:function(){return e.onRemoveCell()},testId:"deleteCell"}])),i.isEmpty(t)?null:c.jsx(Gv,{chartLabel:e.chartLabel,cellOptions:t})},Qv=function(){return c.jsx(Yl,{purpose:"removeComponentFromDashboard"})},Jv=function(){return c.jsx(Ul,{})},Zv={group:void 0,measure:void 0},$v=function(e,t){if(!e.group&&!e.measure&&!t)return!0},eg=function(e,t,n){var r,i=null==(r=n[e])?void 0:r[0];if(!i)return t;var o=t.findIndex((function(e){return e.field===i.field}));return-1!==o&&(t[o]={field:e,function:"none"}),t},tg=function(e){return pa({padding:null==e?void 0:e.padding,display:"flex",alignItems:"center",borderRadius:null==e?void 0:e.borderRadius,gap:6,variants:{alertType:{warning:null==e?void 0:e.warning,info:null==e?void 0:e.info,critical:null==e?void 0:e.critical}}})},ng=pa({display:"block",alignSelf:"flex-start"}),rg=Object.assign(tg,{svg:function(e){var t,n,r;return pa({display:"block",width:"100%",position:"relative",variants:{alertType:{warning:{fill:null==e||null==(t=e.warning)?void 0:t.iconColor,transform:"rotate(180deg)"},info:{fill:null==e||null==(n=e.info)?void 0:n.iconColor,transform:"rotate(180deg)"},critical:{fill:null==e||null==(r=e.critical)?void 0:r.iconColor}}}})},icon:pa({paddingTop:3,display:"block",height:"1rem",width:"1rem"}),content:function(e){var t,n;return pa({display:"flex",flexDirection:"column",gap:6,fontSize:null==e||null==(t=e.content)?void 0:t.fontSize,fontWeight:null==e||null==(n=e.content)?void 0:n.fontWeight})},title:function(e){var t,n;return pa({fontWeight:null==e||null==(t=e.title)?void 0:t.fontWeight,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:null==e||null==(n=e.title)?void 0:n.fontSize,WebkitFontSmoothing:"antialiased"})},iconWrapper:ng}),ig=function(e){var n,r,i=rs();return c.jsxs("div",{role:"alert",className:""+rg(null==i?void 0:i.alerts)({alertType:null!=(n=null==e?void 0:e.type)?n:"info"}),"data-themeapi":"alerts",children:[c.jsxs("span",{className:""+rg.iconWrapper,children:[void 0!==(null==e?void 0:e.icon)&&c.jsx(t.Fragment,{children:null==e?void 0:e.icon}),void 0===(null==e?void 0:e.icon)&&c.jsx("span",{className:""+rg.icon,children:c.jsx("svg","critical"===(null==e?void 0:e.type)?{viewBox:"0 0 20 20",className:""+rg.svg(null==i?void 0:i.alerts)({alertType:"critical"}),focusable:"false","aria-hidden":"true",children:c.jsx("path",{d:"M11.768.768a2.5 2.5 0 0 0-3.536 0l-7.464 7.464a2.5 2.5 0 0 0 0 3.536l7.464 7.464a2.5 2.5 0 0 0 3.536 0l7.464-7.464a2.5 2.5 0 0 0 0-3.536l-7.464-7.464zm-2.768 5.232a1 1 0 1 1 2 0v4a1 1 0 1 1-2 0v-4zm2 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})}:{viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",className:""+rg.svg(null==i?void 0:i.alerts)({alertType:null!=(r=null==e?void 0:e.type)?r:"info"}),children:c.jsx("path",{fillRule:"evenodd",d:"M10 20c5.514 0 10-4.486 10-10s-4.486-10-10-10-10 4.486-10 10 4.486 10 10 10zm1-6a1 1 0 1 1-2 0v-4a1 1 0 1 1 2 0v4zm-1-9a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"})})})]}),c.jsxs("div",{className:""+rg.content(null==i?void 0:i.alerts),children:[(null==e?void 0:e.title)&&c.jsx("div",{className:""+rg.title(null==i?void 0:i.alerts),children:null==e?void 0:e.title}),(null==e?void 0:e.children)&&c.jsx("div",{children:null==e?void 0:e.children})]})]})},og=function(e){var t=e.dataSets,n=e.setDataSet,r=[].concat(t).map((function(e){return{value:e.id,label:e.name}}));return c.jsxs(c.Fragment,{children:[t.length>1&&c.jsx(Dc,{children:c.jsx(Ac,{label:"Dataset",labelHidden:!0,id:"select-data-set",testId:"select-data-set",anchorLeft:!0,placeholder:"Data set",onChange:n,selected:e.dataSet.id,options:r})}),e.dataSet.preAggregated&&c.jsx(zd,{paddingX:0,paddingTop:16,children:c.jsx(ig,{icon:c.jsx(c.Fragment,{}),title:"Pre-aggregated data set",type:"info",children:"This data set has already been aggregated, therefore you will find some data properties have already been set."})})]})},ag=function(e,t,n,r){var i,o=[].concat(n);return o.splice(r,1),(i={})[e]=t(o),i},lg=function(e,t,n){var r=[].concat(e),i=e[t];return r[t]=e[n],r[n]=i,r},sg=function(e){var t=Ol().organizationName;return c.jsxs(If,{width:"sm","data-testid":"cannot-delete-modal",isOpen:!0,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(If.Header,{title:"Field Protected",show:!0}),c.jsx(If.Content,{children:c.jsxs("p",{children:["This field has been protected",t?" by "+t+" ":" ","and cannot be removed."]})}),c.jsx(If.Footer,{buttons:"end",children:c.jsx(Of,{children:c.jsx(Ip,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:"Close"})})})]})},ug=["barChart","dataTable","basicTable"],dg=function(e,t){if(!t)return!1;if(!(e&&"type"in e&&e.type&&ug.includes(e.type)))return!1;if(!("protectedFields"in e)||!e.protectedFields)return!1;var n,r=!1,i=!1;return"measure"in e.protectedFields&&"function"in t&&(r=((null==e||null==(n=e.protectedFields)?void 0:n.measure)||[]).some((function(e){return e.function==t.function&&e.field==t.field}))),"dimension"in e.protectedFields&&(i=(e.protectedFields.dimension||[]).some((function(e){return"function"in e&&"function"in t?e.field==t.field&&e.function==t.function:"truncate"in e&&"truncate"in t&&e.field==t.field&&e.truncate==t.truncate}))),r||i},cg=function(e){var n,r,o,a=t.useState(!1),l=a[0],s=a[1],u=e.propKey||"dimension",d=e.dataSet,p=e.attributes,f=e.attributes[u]||[],m=[].concat(f).map((function(e){var t=Mn(d,e.field);return{title:t.publicName,icon:t.dataType}})),h=[].concat(Ln(d.fields,null!=(n=e.filterFieldOptions)?n:{onlyFieldTypes:["boolean","number","string"],removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0})),v=it(h,[].concat(f)),g=[].concat(v).map((function(e){return{title:e.publicName,icon:e.dataType,value:e.id}})),b=Ol();return c.jsxs(t.Fragment,{children:[c.jsx(kp,{mode:b.mode,testId:null!=(r=null==e?void 0:e.testId)?r:"add-dimension",onDeleteItem:e.dataSet.preAggregated?void 0:function(t){if(dg(p,f[t]))s(!0);else{var n,r=[].concat(f);r.splice(t,1),e.setPartialAttributes(((n={})[u]=r,n))}},onOrderChange:e.allowsMultiple?function(t,n){var r=lg([].concat(f),t,n);e.setPartialAttributes({dimension:r})}:void 0,newItem:{callToAction:null!=(o=null==e?void 0:e.label)?o:"Add comparison",onNew:function(t){var n,r=[].concat(f,[{field:t,function:"none"}]);e.setPartialAttributes(((n={})[u]=r,n))},initValues:g,hide:e.dataSet.preAggregated||i.isEmpty(v)||!e.allowsMultiple&&!i.isEmpty(e.attributes[u])},items:e.filterOptions?e.filterOptions(m):m}),l&&c.jsx(sg,{onClose:function(){return s(!1)}})]})},pg=function(e){var t,n,r,o=e.dataSet,a=e.setPartialAttributes,l=e.allow,s=i.isArray(n=(null==e?void 0:e.attributes).timeDimensions)?n:n?[n]:[],u=(r=[],[].concat(s).map((function(t){var n=Mn(o,t.field),i=null!=e&&e.onNewMeasureFilterTruncFunctions?e.onNewMeasureFilterTruncFunctions(n):e.supportedTimeDimensions,l="date_time"==n.dataType?function(e,t){var n=Object.keys(t);return[].concat(n).flatMap((function(n){return e.includes(n)?[{value:n,label:t[n].publicName}]:[]}))}(n.allowedGranularities,e.supportedTimeDimensions):void 0,u=l?{onChange:function(e,t){!function(e,t){var n=[].concat(s);n[t]=U({},n[t],{truncate:e}),a({timeDimensions:n})}(e,t)},options:fg(l,i),selected:t.truncate}:void 0;r.push({title:Mn(o,t.field).publicName,icon:"date_time",value:t.field,select:u})})),r),d=Ln(o.fields,{onlyFieldTypes:["date_time"]}).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}})),p=!!l&&s.length===l,f=Ol();return c.jsx(kp,{mode:f.mode,testId:"time-dimension",onOrderChange:l?void 0:function(e,t){var n=lg([].concat(s),e,t);a({timeDimensions:n})},onDeleteItem:function(e){var t=[].concat(s);t.splice(e,1),a({timeDimensions:t})},newItem:{callToAction:null!=(t=null==e?void 0:e.label)?t:"Add time dimension",onNew:function(t){null!=e&&e.onNewMeasureFilterTruncFunctions&&e.onNewMeasureFilterTruncFunctions(t);var n=[].concat(s,[{field:t.id,truncate:Object.keys(Oe)[0]}]);a({timeDimensions:n})},initValues:d,hide:p},items:e.filterOptions?e.filterOptions(u):u})};function fg(e,t){return e.filter((function(e){return t.hasOwnProperty(e.value)}))}var mg=function(e){var n,r,o,a,l=t.useState(!1),s=l[0],u=l[1],d=e.propKey||"measure",p=(o=!!e.allowsMultiple,function(e){var t;return o?e:null!=(t=e[0])?t:null}),f=e.attributes,m=e.setPartialAttributes,h=e.dataSet,v=e.supportedAggregates,g=f,b=i.isArray(a=g[d])?a:a?[a]:[],x=function(e,t,n,r){return[].concat(e).map((function(e){var r=Mn(t,e.field),i={onChange:function(e,t){!function(e,t){!function(e,t,n){var r,i,o=[].concat(b);o[n]=U({},o[n],((r={}).function=t,r)),m(((i={})[d]=p(o),i))}(0,e,t)}(e,t)},options:function(e,t){var n=et(e,t);return[].concat(n).map((function(e){return{value:e,label:t[e].publicName}}))}(r,n),selected:e.function};return{title:Mn(t,e.field).publicName,icon:Mn(t,e.field).dataType,value:e.field,select:xt(r)||jt(r)||"none"===e.function?void 0:i}}))}(b,h,v),y=[].concat(Ln(h.fields,e.fieldFilterOptions)).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}})),w=Ol().mode,C=!1;return e.allowsMultiple||(C=!e.allowsMultiple&&!!g[d]),i.isArray(g[d])&&e.maxAllowed&&e.maxAllowed<=g[d].length&&(C=!0),e.dataSet.preAggregated&&(C=!0),c.jsxs(t.Fragment,{children:[c.jsx(kp,{mode:w,onOrderChange:e.allowsMultiple?function(e,t){var n,r=lg([].concat(b),e,t);m(((n={})[d]=p(r),n))}:void 0,onDeleteItem:e.dataSet.preAggregated?void 0:function(e){dg(f,b[e])?u(!0):m(ag(d,p,b,e))},items:e.filterOptions?e.filterOptions(x):x,newItem:{callToAction:null!=(n=null==e?void 0:e.label)?n:"Add metric",onNew:function(t){var n,r=null!=e&&e.onNewMeasureFilterAggregate?e.onNewMeasureFilterAggregate(t):e.supportedAggregates,i=$e(t,r),o=[].concat(b,[{field:t.id,function:xt(t)?t.denominatorAggregate:i}]);m(((n={})[d]=p(o),n))},initValues:y,hide:C},id:null==e?void 0:e.id,testId:null!=(r=null==e?void 0:e.testId)?r:"metric-input"}),s&&c.jsx(sg,{onClose:function(){return u(!1)}})]})},hg=function(e){var n=e.attributes,r=e.setPartialAttributes,i=e.dataSet,o=t.useState(!1),a=o[0],l=o[1],s=Ol(),u=n.measure,d=[].concat(u).map((function(e){var t=Mn(i,e.field);return{title:t.publicName,icon:t.dataType}})),p=[].concat(Ln(i.fields,{removeSimplePercentage:!0,removeAggregateMaths:!0,removeConditionalPercentage:!0})).map((function(e){return{title:e.publicName,icon:e.dataType,value:e}}));return c.jsxs(t.Fragment,{children:[c.jsx(kp,{mode:s.mode,onOrderChange:function(e,t){var n=lg([].concat(u),e,t);r({measure:n})},onDeleteItem:function(e){dg(n,n.measure[e])?l(!0):r(ag("measure",(function(e){return e}),u,e))},items:d,newItem:{callToAction:"Add field",onNew:function(e){var t=[].concat(u,[{field:e.id,function:"none"}]);r({measure:t})},initValues:p}}),a&&c.jsx(sg,{onClose:function(){return l(!1)}})]})},vg=function(e,t){return t?e+" ("+t+")":e},gg=function(e){var t=e.attributes,n=e.setPartialAttributes,r=e.dataSet,i=[].concat(t.order).map((function(e){var t={onChange:function(e,t){o(e,t)},options:[{label:"Asc",value:"asc"},{label:"Desc",value:"desc"}],selected:e.direction},n=Mn(r,e.field);return{title:vg(n.publicName,e.function&&"none"!=e.function&&Ne(e.function)),icon:n.dataType,select:t}})),o=function(e,r){var i=[].concat(t.order);i[r].direction=e,n({order:i})},a=Ol().mode,l=function(e,t,n,r,i){var o=[];if(o=o.concat([].concat(r||[]).flatMap((function(t){var n=Mn(e,t.field);return at(n)?[]:[{title:n.publicName,icon:n.dataType,value:n,onSelected:function(e){i(e.id,t.function)}}]}))),t){var a=Mn(e,t.field);o.push({title:a.publicName,icon:a.dataType,value:a,onSelected:function(e){i(e.id,t.truncate)}})}return o.concat([].concat(n||[]).flatMap((function(t){var n=Mn(e,t.field);return at(n)?[]:[{title:vg(n.publicName,ut(t)&&Ne(t.function)),icon:n.dataType,value:t,onSelected:function(e){return i(e.field,e.function)}}]})))}(e.dataSet,e.timeDimension||null,e.measure,e.dimension,(function(e,r){var i=[].concat(t.order,[{field:e,direction:"asc",function:r}]);n({order:i})}));return c.jsx(kp,{mode:a,onOrderChange:function(e,r){var i=lg([].concat(t.order),e,r);n({order:i})},onDeleteItem:function(e){var r=[].concat(t.order);r.splice(e,1),n({order:r})},items:i,newItem:{callToAction:"Add sort",initValues:l},testId:"sort-input"})},bg=function(e){return!!e.field&&!!e.op&&![void 0,NaN,""].includes(e.value)},xg=function(e){if(!e.field)return null;var t=function(e,t){var n={};return[].concat(e.allowedOperators).forEach((function(r){var i=t[r];i.validDataTypes.includes(e.dataType)&&(n[r]=i)})),n}(e.field,e.queryEngineConfig.supportedOperators),n=[].concat(Object.keys(t)).flatMap((function(n,r){return null!=e&&e.isAList||!["is_one_of","is_not_one_of"].includes(n)?[{label:t[n].publicName,value:n,testId:e.testId+"-pick-op-"+r}]:[]}));"allowedOperators"in e.field&&e.field.allowedOperators.includes("=")&&n.push({label:"Is null",value:"is_null",testId:"is-null"}),"allowedOperators"in e.field&&e.field.allowedOperators.includes("!=")&&n.push({label:"Is not null",value:"is_not_null",testId:"is-not-null"});var r=e.selected;return"!="==e.selected&&null===e.value?r="is_not_null":"="==e.selected&&null===e.value&&(r="is_null"),c.jsx(Ac,{label:"Operator",labelHidden:!0,id:null==e?void 0:e.id,testId:e.testId+"-pick-op",onChange:function(t){e.onChange("is_not_null"==t?{op:"!=",value:null}:"is_null"==t?{op:"=",value:null}:{op:t})},options:n,selected:r})},yg=Ml((function(e){return c.jsx("input",{defaultValue:e.value,"data-testid":e.testId,css:["width:100%;appearance:none;border-radius:0.375rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity));padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.5rem;padding-right:0.5rem;text-align:left;line-height:1.25;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity));outline:2px solid transparent;outline-offset:2px;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;:focus{--tw-border-opacity:1;border-color:rgb(224 242 255 / var(--tw-border-opacity));}",e.error&&{"--tw-border-opacity":"1",borderColor:"rgb(239 68 68 / var(--tw-border-opacity))"},""],type:"datetime-local",onChange:function(t){var n=t.target.value?new Date(t.target.value):null;e.onChange(n)}})}),"renderDateTimeInput"),wg=Object.assign((function(){return null}),{remove:function(e){return pa(U({"& svg":U({},ca,{fill:"#e5e7eb"})},e?{}:{"&:hover svg":U({},ca,{fill:"#de0938",cursor:"pointer"})}))},complete:function(e){return pa(U({},e?{}:{"& svg":U({},ca,{fill:"rgb(229, 231, 235)"})}))}}),Cg=function(e,t,n,r,i){var o=On(t,{queryEngineConfig:r}),a=n.preAggregated&&o.setDataAttributesFromPreAggregatedDataSet?o.setDataAttributesFromPreAggregatedDataSet(o.init(n.id),n):o.autoGenerate(n),l=i(a,n,"initial"),s=o.setAttributes(a,l);return or(s)},jg=function(){var e,n,r=Ol(),i=r.onlyViewTypes,o=r.queryEngineConfig,a=Bc(),l=a.dashboard,s=a.componentEditor,u=a.runQueriesCallback,d=a.dispatch,c=a.broadcastEvent,p=Ol(),f=p.featureToggles,m=p.numberFormatOptions,h=p.mode,v=p.dataPanel,g=p.formatPanel,b=p.onAskAI,x=p.onEditorUpdate,y=(null==s?void 0:s.component)||null;if(t.useEffect((function(){var e=function(){var e=Y(W().mark((function e(){var t;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Cg(0,i(l.dataSets[0])[0],l.dataSets[0],o,x);case 2:t=e.sent,s&&d(U({type:"startEditingComponent",component:t},s.target));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();y||e()}),[]),!y)return null;var w=On(y.attributes.type,{queryEngineConfig:o}),C=Rn(l.dataSets,y.attributes.dataSetId);if(!C)return null;var j=null!=s&&null!=(e=s.target)&&e.libraryIndex||0===(null==s||null==(n=s.target)?void 0:n.libraryIndex)?"library":"dashboard",S=function(e){if(y){var t,n=x(e,C,"edit");try{t=w.setAttributes(e,n)}catch(n){console.warn("[VIZZLY] Not applying changes from `onEditorUpdate` because of a validation error.",n),t=e}var r=U({},y,{attributes:t});d({type:"updateEditorComponent",component:r})}};return{setLocalFilters:function(e){d({type:"updateEditorComponent",component:U({},y,{localFilters:e})})},setParameterUpdate:function(e){var t=Oc(y,e);d({type:"updateEditorComponent",component:U({},t)})},queryEngineConfig:o,selectedComponent:y.attributes.type,onSelectViewType:function(e){var t=Cg(0,e,C,o,x);d({type:"updateEditorComponent",component:t})},dataPanel:v,formatPanel:g,setDataSet:function(){var e=Y(W().mark((function e(t){var n,r,a,u;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(s&&s.component&&t)){e.next=10;break}if(n=Nn(l.dataSets,t),!(r=n[0])){e.next=10;break}return(a=i(r)).includes(u=s.component.attributes.type)||(u=a[0]),e.next=8,Cg(0,u,r,o,x);case 8:d({type:"updateEditorComponent",component:e.sent});case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),featureToggles:f,dashboard:l,setDataSets:function(e){d({type:"setDataSets",dataSets:e})},dataSet:C,viewOptions:i,numberFormatOptions:m,onAskAI:b,setAttributes:S,setPartialAttributes:function(e){S(w.setAttributes(y.attributes,e))},setResults:function(e){d({type:"setResultsForComponentInEditor",results:e})},mode:h,origin:j,componentEditor:s,component:y,broadcastEvent:c,runQueriesCallback:u,dispatch:d}},Sg={name:"blres4",styles:"--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))"},Fg=function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:c.jsx("path",{d:"M448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM152 96H64V160H152V96zM208 160H296V96H208V160zM448 96H360V160H448V96zM64 288H152V224H64V288zM296 224H208V288H296V224zM360 288H448V224H360V288zM152 352H64V416H152V352zM208 416H296V352H208V416zM448 352H360V416H448V352z"})}))},kg={areaChart:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:c.jsx("path",{d:"M500 384c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12V76c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v308h436zM372.7 159.5L288 216l-85.3-113.7c-5.1-6.8-15.5-6.3-19.9 1L96 248v104h384l-89.9-187.8c-3.2-6.5-11.4-8.7-17.4-4.7z"})}))},barChart:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:c.jsx("path",{d:"M160 80C160 53.49 181.5 32 208 32H240C266.5 32 288 53.49 288 80V432C288 458.5 266.5 480 240 480H208C181.5 480 160 458.5 160 432V80zM0 272C0 245.5 21.49 224 48 224H80C106.5 224 128 245.5 128 272V432C128 458.5 106.5 480 80 480H48C21.49 480 0 458.5 0 432V272zM400 96C426.5 96 448 117.5 448 144V432C448 458.5 426.5 480 400 480H368C341.5 480 320 458.5 320 432V144C320 117.5 341.5 96 368 96H400z"})}))},horizontalBarChart:function(e){return c.jsx("svg",U({css:Sg},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:c.jsx("path",{d:"M160 80C160 53.49 181.5 32 208 32H240C266.5 32 288 53.49 288 80V432C288 458.5 266.5 480 240 480H208C181.5 480 160 458.5 160 432V80zM0 272C0 245.5 21.49 224 48 224H80C106.5 224 128 245.5 128 272V432C128 458.5 106.5 480 80 480H48C21.49 480 0 458.5 0 432V272zM400 96C426.5 96 448 117.5 448 144V432C448 458.5 426.5 480 400 480H368C341.5 480 320 458.5 320 432V144C320 117.5 341.5 96 368 96H400z"})}))},lineChart:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:c.jsx("path",{d:"M64 400C64 408.8 71.16 416 80 416H480C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H80C35.82 480 0 444.2 0 400V64C0 46.33 14.33 32 32 32C49.67 32 64 46.33 64 64V400zM342.6 278.6C330.1 291.1 309.9 291.1 297.4 278.6L240 221.3L150.6 310.6C138.1 323.1 117.9 323.1 105.4 310.6C92.88 298.1 92.88 277.9 105.4 265.4L217.4 153.4C229.9 140.9 250.1 140.9 262.6 153.4L320 210.7L425.4 105.4C437.9 92.88 458.1 92.88 470.6 105.4C483.1 117.9 483.1 138.1 470.6 150.6L342.6 278.6z"})}))},pieChart:function(e){return c.jsxs("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",children:[c.jsx("path",{d:"M2 10a8 8 0 018-8v8h8a8 8 0 11-16 0z"}),c.jsx("path",{d:"M12 2.252A8.014 8.014 0 0117.748 8H12V2.252z"})]}))},scatterChart:function(e){return c.jsxs("svg",U({viewBox:"0 0 2134 2134",xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1.5}},e,{children:[c.jsx("path",{d:"M208.333 208.334v1716.66M214.91 1926.73h1716.66",style:{strokeWidth:"166.67px"}}),c.jsx("circle",{cx:987.916,cy:920.416,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),c.jsx("circle",{cx:708.749,cy:1516.25,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),c.jsx("circle",{cx:1633.75,cy:907.916,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}}),c.jsx("circle",{cx:1775.42,cy:307.916,r:187.917,style:{strokeWidth:"8.33px",strokeLinecap:"square"}})]}))},singleStat:function(e){return c.jsx("svg",U({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor"},e,{children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5l-3.9 19.5m-2.1-19.5l-3.9 19.5"})}))},dataTable:Fg,basicTable:Fg,comboChart:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512.000000 512.000000",children:c.jsxs("g",{transform:"translate(0.000000,512.000000) scale(0.100000,-0.100000)",stroke:"currentColor",children:[c.jsx("path",{d:"M4840 4671 c-138 -42 -207 -183 -151 -306 l18 -40 -337 -483 -337 -483 -74 -2 c-51 -2 -84 -8 -106 -21 l-31 -19 -169 121 c-92 66 -220 158 -283 204 l-115 84 -2 48 c-3 69 -20 113 -60 157 -71 79 -205 93 -296 30 -62 -42 -100 -120 -95 -191 l3 -51 -308 -240 -308 -240 -50 9 c-118 22 -231 -44 -259 -150 -7 -24 -15 -49 -19 -57 -6 -12 -204 -122 -474 -263 l-78 -41 -42 24 c-62 34 -157 33 -219 -4 -26 -15 -56 -39 -68 -54 l-21 -27 -255 39 -255 39 -15 35 c-39 93 -112 141 -211 141 -134 -1 -223 -91 -223 -227 1 -131 92 -223 222 -223 65 0 123 26 170 74 l35 36 224 -35 c123 -19 238 -37 256 -40 24 -4 33 -12 38 -34 8 -39 60 -98 105 -121 58 -30 110 -34 174 -16 94 28 156 107 160 205 l1 37 268 143 c245 131 270 142 285 128 30 -28 106 -57 147 -57 70 0 117 19 166 69 62 61 86 153 60 223 -8 21 14 40 291 256 l300 233 39 -15 c54 -22 136 -20 181 2 l36 19 288 -208 288 -208 3 -51 c3 -62 30 -117 77 -157 46 -42 95 -56 172 -51 81 5 137 42 177 118 30 59 34 104 13 173 l-14 47 342 490 c341 489 341 490 372 484 76 -14 176 39 218 115 32 59 36 152 9 208 -45 96 -167 153 -263 124z"}),c.jsx("path",{d:"M4765 3605 l-25 -24 0 -1544 c0 -1506 0 -1545 19 -1568 18 -23 25 -24 135 -24 107 0 117 2 138 23 l23 23 3 1522 c2 1028 0 1534 -7 1558 -15 49 -43 59 -162 59 -93 0 -102 -2 -124 -25z"}),c.jsx("path",{d:"M2914 3246 c-17 -7 -34 -21 -38 -31 -3 -9 -6 -626 -6 -1370 0 -1317 1 -1353 19 -1376 18 -22 28 -24 129 -27 104 -4 110 -3 138 21 l29 25 0 1361 0 1360 -22 23 c-20 20 -35 23 -120 25 -69 2 -107 -1 -129 -11z"}),c.jsx("path",{d:"M1962 2580 c-12 -11 -24 -31 -27 -43 -3 -12 -4 -478 -3 -1035 l3 -1014 29 -25 c28 -24 34 -25 138 -21 101 3 111 5 129 27 18 23 19 54 19 1055 l0 1033 -23 21 c-21 20 -34 22 -133 22 -97 0 -113 -2 -132 -20z"}),c.jsx("path",{d:"M3842 2593 c-7 -3 -19 -18 -27 -33 -13 -25 -15 -167 -15 -1039 0 -719 3 -1017 11 -1034 17 -37 50 -47 150 -47 94 0 141 14 153 45 3 9 6 478 6 1041 l0 1025 -25 24 c-23 24 -30 25 -132 24 -59 0 -114 -3 -121 -6z"}),c.jsx("path",{d:"M102 1748 c-12 -6 -27 -27 -33 -47 -6 -24 -9 -235 -7 -623 l3 -587 23 -23 c21 -21 31 -23 138 -23 110 0 117 1 135 24 18 22 19 48 19 636 l0 614 -26 20 c-23 18 -40 21 -128 20 -55 0 -111 -5 -124 -11z"}),c.jsx("path",{d:"M1025 1735 l-25 -24 0 -605 c0 -332 3 -612 6 -621 12 -31 59 -45 153 -45 100 0 133 10 150 47 16 34 16 1192 0 1226 -17 37 -50 47 -160 47 -93 0 -102 -2 -124 -25z"})]})}))},mercatorMap:function(e){return c.jsx("svg",U({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:{fill:"none"},className:"w-5 h-5",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12.75 3.03v.568c0 .334.148.65.405.864l1.068.89c.442.369.535 1.01.216 1.49l-.51.766a2.25 2.25 0 01-1.161.886l-.143.048a1.107 1.107 0 00-.57 1.664c.369.555.169 1.307-.427 1.605L9 13.125l.423 1.059a.956.956 0 01-1.652.928l-.679-.906a1.125 1.125 0 00-1.906.172L4.5 15.75l-.612.153M12.75 3.031a9 9 0 00-8.862 12.872M12.75 3.031a9 9 0 016.69 14.036m0 0l-.177-.529A2.25 2.25 0 0017.128 15H16.5l-.324-.324a1.453 1.453 0 00-2.328.377l-.036.073a1.586 1.586 0 01-.982.816l-.99.282c-.55.157-.894.702-.8 1.267l.073.438c.08.474.49.821.97.821.846 0 1.598.542 1.865 1.345l.215.643m5.276-3.67a9.012 9.012 0 01-5.276 3.67m0 0a9 9 0 01-10.275-4.835M15.75 9c0 .896-.393 1.7-1.016 2.25"})}))},custom:function(e){return c.jsx(c.Fragment,{})}},Tg=function(){var e=jg();if(!e)return null;var t=[].concat(e.viewOptions(e.dataSet)).flatMap((function(t){var n=On(t);return!n.setDataAttributesFromPreAggregatedDataSet&&e.dataSet.preAggregated?[]:[{value:t,label:n.title,icon:kg[t]()}]}));return c.jsx(Dc,{children:c.jsx(Ac,{label:"View",labelHidden:!0,id:"select-view",testId:"select-view",anchorLeft:!0,onChange:function(t){return e.onSelectViewType(t)},selected:e.component.attributes.type,renderOption:function(e){return c.jsx(Ag,U({},e,{option:"option"}))},renderSelected:function(e){return c.jsx(Ag,U({},e,{option:"view"}))},options:t})})},Ag=function(e){return c.jsxs(Gd,{direction:"row",gap:"0.5rem",alignItems:"center",height:"view"===e.option?16:"inline"===e.option?18:20,children:[(null==e?void 0:e.icon)&&c.jsx(oc,{flexPaddingTop:"0",paddingTop:"0",icon:null==e?void 0:e.icon,iconWidth:"horizontalBarChart"===e.value[0]||"barChart"===e.value[0]?"66%":void 0}),c.jsx(zd,{as:"span",marginY:"0.15rem",children:null==e?void 0:e.label})]})},Dg=function(e,t){return("!="==e||"="==e)&&null===t},Ig={name:"c5j7er",styles:"display:grid;flex-grow:1;grid-template-columns:repeat(3, minmax(0, 1fr));gap:0.5rem;font-size:0.875rem;line-height:1.25rem"},Pg={name:"1jjvu4g",styles:"margin-left:0.5rem;width:1.75rem;flex:none;text-align:right"},_g={name:"xioa8z",styles:"width:1.75rem;flex:none;text-align:right"},Eg=function(e){var n=e.filter,r=n.field,i=n.op,o=n.value,a=bg(e.filter),l=function(t){e.onChange(U({},e.filter,t))},s=[];return Ln(e.dataSet.fields,{removeAggregateMaths:!0,removeConditionalPercentage:!0,removeSimplePercentage:!0}).forEach((function(t,n){s.push({label:t.publicName,value:t,testId:e.testId+"-pick-field-"+n,icon:c.jsx(oc,{icon:t.dataType,paddingTop:0})})})),c.jsxs("div",{css:["display:flex;",a&&{"--tw-border-opacity":"1",borderColor:"rgb(74 222 128 / var(--tw-border-opacity))"},"",""],children:[c.jsxs("div",{css:Ig,children:[c.jsx("div",{children:c.jsx(Ac,{label:"Field",id:e.testId+"-pick-field",labelHidden:!0,testId:e.testId+"-pick-field",onChange:function(e){l({value:void 0,op:void 0,field:e})},options:s,selected:r,renderSelected:function(e){return c.jsx(Ag,U({},e,{option:"inline"}))},controlClassName:""+Aa.paddingLeft("0.5rem")})}),c.jsx("div",{css:[r?{opacity:"1"}:{opacity:"0"},"transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;",""],children:c.jsx(xg,{queryEngineConfig:e.queryEngineConfig,onChange:function(e){return l(e)},field:r,testId:e.testId,selected:i,value:o,id:"percentage-operator-"+(null==e?void 0:e.rowIndex),isAList:r&&"string"==r.dataType})}),c.jsx("div",{css:[i?{opacity:"1"}:{opacity:"0"},"transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;",""],children:!Dg(i,o)&&c.jsxs(c.Fragment,{children:[r&&"number"==r.dataType&&c.jsx(np,{id:e.testId+"-value",label:"Value",labelHidden:!0,"data-testid":e.testId+"-value",type:"number",onChange:function(e){var t=parseFloat(e.target.value);l({value:t})},defaultValue:o}),r&&("string"==r.dataType||"string[]"==r.dataType)&&c.jsx(t.Fragment,{children:"="===i||"!="===i||"array_contains"===i||"is_one_of"===i||"is_not_one_of"===i?c.jsx(Og,{onChange:function(e){return l({value:e})},testId:e.testId+"-value",value:o,dataSet:e.dataSet,field:r,multiple:"is_one_of"===i||"is_not_one_of"===i||"array_contains"===i}):c.jsx(np,{label:"Value",labelHidden:!0,id:e.testId+"-value","data-testid":e.testId+"-value",type:"text",onChange:function(e){l({value:e.target.value})},defaultValue:o})}),r&&"boolean"==r.dataType&&c.jsx(Ac,{label:"Value",labelHidden:!0,id:e.testId+"-value",selected:o,onChange:function(e){return l({value:e})},options:[{label:"True",value:!0},{label:"False",value:!1}]}),r&&"date_time"==r.dataType&&c.jsx(yg,{value:o?Do(new Date(o),"YYYY-MM-DD[T]HH:mm:ss"):void 0,onChange:function(e){var t=e?e.toISOString():null;l({value:t})},testId:""+e.testId})]})||c.jsx("p",{children:"-"})})]}),c.jsx("div",{css:Pg,className:""+wg.complete(a),children:c.jsx(Hl,{})}),c.jsx("div",{css:_g,children:c.jsx("button",{onClick:function(){return e.onDelete()},className:Zl(""+wg.remove(!(null==e||!e.removeDisabled)),""+Aa.button),"aria-label":"Remove Filter",disabled:null==e?void 0:e.removeDisabled,children:c.jsx(Yl,{purpose:"removeFilter"})})})]})},Og=function(e){var n,r=e.value,i=function(e,n){var r,i=Bc().runQueriesCallback,o=t.useState(void 0),a=o[0],l=o[1],s=Mn(e,n);return r="string[]"==s.dataType?[Mt(e.id,s).query]:[Nt(e,n)],Uh(r,i,(function(e){null===e&&l(null),e&&l(e[0])}),{},e),{result:null!=a?a:null,loading:void 0===a,error:null===a}}(null==e?void 0:e.dataSet,e.field.id).result,o=(null==i?void 0:i.content.map((function(t,n){var r=t[0];return{value:r,label:r,testId:e.testId+"-pick-field-"+n}})))||[];return null!=e&&e.multiple?c.jsx(Jf,{label:"Values",id:"select-multiple-value",labelHidden:!0,setSelected:function(t){return null==e?void 0:e.onChange(t.map((function(e){return o[e].value})))},selected:(n=[],o.forEach((function(e,t){null!=r&&r.includes(e.value)&&n.push(t)})),n),options:o}):c.jsx(Ac,{testId:null==e?void 0:e.testId,label:"Value",labelHidden:!0,id:"select-single-value",selected:null==e?void 0:e.value,onChange:function(t){return null==e?void 0:e.onChange(t)},options:o})},Lg={name:"1v017vf",styles:"margin-top:1.5rem;margin-bottom:1.5rem;text-align:left"},Rg={name:"151yjvf",styles:"margin-bottom:0.5rem;font-weight:500;text-transform:uppercase;letter-spacing:0.1em"},Mg={name:"zjik7",styles:"display:flex"},Ng={name:"1sul1dv",styles:"display:grid;flex-grow:1;grid-template-columns:repeat(3, minmax(0, 1fr));gap:0.5rem"},zg={name:"1x4tmz9",styles:"width:3.5rem;flex:none"},Bg={name:"1gok8e8",styles:"margin-bottom:0.5rem"},qg=function(e){return c.jsx(c.Fragment,{children:e.wipFilters.map((function(t,n){return c.jsxs("div",{children:[0!=n&&c.jsx("div",{css:Lg,children:c.jsx("span",{css:Rg,children:"or"})}),c.jsxs("div",{children:[c.jsxs("div",{css:Mg,children:[c.jsxs("div",{css:Ng,children:[c.jsx("div",{children:c.jsx(Tc,{as:"span",children:e.fieldHeadingOverride||"Field"})}),c.jsx("div",{children:c.jsx(Tc,{as:"span",children:"Operator"})}),c.jsx("div",{children:c.jsx(Tc,{as:"span",children:"Value"})})]}),c.jsx("div",{css:zg})]}),t.map((function(r,i){return c.jsx("div",{css:Bg,children:c.jsx(Eg,{queryEngineConfig:e.queryEngineConfig,testId:"filter-"+n+"-"+i,filter:r,dataSet:e.dataSet,onChange:function(t){e.updateWipFilter(t,n,i)},onDelete:function(){e.deleteWipFilter(n,i)},rowIndex:i,removeDisabled:t.length<=1||t.length===i+1})},"filter_"+n+"_"+i)}))]})]},"filter_"+n)}))})},Vg=function(e){var t,n,r=null!=(t=null==e?void 0:e.as)?t:"span",i=rs();return c.jsx(r,{className:""+tc.title(null==i||null==(n=i.lists)?void 0:n.title),"data-themeapi":"list.title",children:null==e?void 0:e.children})},Wg=Object.assign((function(){return null}),{wrapper:pa({position:"relative","&:hover .help-icon":{opacity:1}}),fadeIn:function(e){return pa(U({opacity:0,maxWidth:18,color:e},ca))}}),Hg=function(e){var t,n,r=rs();return c.jsx(Vg,{as:"legend",children:c.jsxs(Gd,{gap:"0.25rem",alignItems:"center",children:[null==e?void 0:e.title,(null==e?void 0:e.tooltip)&&c.jsx(zd,{width:"18px",children:c.jsx(cp,{tooltipContent:function(){return c.jsx(cp.Content,{children:null==e?void 0:e.tooltip})},children:c.jsx(v.QuestionMarkCircleIcon,{"aria-label":"Help",className:"help-icon "+Wg.fadeIn(null==r||null==(t=r.dashboard)||null==(n=t.icon)?void 0:n.color)})})})]})})},Yg=Object.assign((function(e){return c.jsxs("fieldset",{className:Zl(""+Wg.wrapper,""+Aa.bw(0),""+Aa.margin(0),""+Aa.padding(0)),children:[(null==e?void 0:e.title)&&c.jsx(Hg,U({},e)),c.jsx(zd,{marginTop:"0.25rem",children:e.children})]})}),{Grid:function(e){return c.jsx(es,{gap:"0.75rem",columns:2===(null==e?void 0:e.columns)?["repeat(2, minmax(0px, 1fr))"]:void 0,"data-component":null==e?void 0:e["data-component"],children:null==e?void 0:e.children})},Panel:function(e){var t;return c.jsx(zd,{as:null!=(t=null==e?void 0:e.as)?t:"fieldset","data-component":"list-panel",children:c.jsxs(op,{padding:!0,children:[(null==e?void 0:e.title)&&c.jsx(zd,{"data-component":"section-panel",children:c.jsx(Tc,{as:"legend",children:null==e?void 0:e.title})}),c.jsx(es,{gap:"0.5rem",children:null==e?void 0:e.children})]})})},Container:function(e){return c.jsx(Gd,{direction:"column",gap:"0.75rem","data-component":null==e?void 0:e["data-component"],children:null==e?void 0:e.children})},Title:Hg});function Ug(e,t){return[].concat(e).map((function(e){return[].concat(e).map((function(e){return U({},e,{field:Mn(t,e.field)})}))}))}var Gg=function(e,r){var o=Ug(e,r),a=n.useState(o),l=a[0],s=a[1];t.useEffect((function(){s(Ug(e,r))}),[JSON.stringify(e)]),i.isEmpty(l)&&(l=[[{field:r.fields[0],op:void 0,value:void 0}]]);var u,d=[].concat(l).map((function(e){var t=e[e.length-1];return t&&bg(t)?[].concat(e,[{field:r.fields[0],op:void 0,value:void 0}]):[].concat(e)}));return{addOrFilter:function(){var e=[].concat(l);e.push([{field:r.fields[0],op:void 0,value:void 0}]),s(e)},deleteWipFilter:function(e,t){var n=l;n[e].splice(t,1),i.isEmpty(n[e])&&n.splice(e,1),s([].concat(n))},updateWipFilter:function(e,t,n){var r=l;r[t][n]=e,s([].concat(r))},completedFilters:(u=l,[].concat(u).map((function(e){return[].concat(e).flatMap((function(e){var t;return bg(e)?[{op:e.op,value:e.value,field:null==(t=e.field)?void 0:t.id}]:[]}))})).filter((function(e){return!i.isEmpty(e)}))),wipFilters:d}},Kg={numeratorType:"simple",publicName:"",numerator:null,denominator:null},Xg=function(e){var n=e.dataSet,r=function(e,n,r,i){var o=!!n,a=t.useState(Kg),l=a[0],s=a[1],u=Gg(n&&"numeratorFilter"in n?n.numeratorFilter:[],r),d=u.completedFilters,c=u.wipFilters,p=u.deleteWipFilter,f=u.updateWipFilter;return t.useEffect((function(){n?jt(n)?s({numeratorType:"simple",publicName:n.publicName,numerator:{function:n.numeratorAggregate,field:n.numeratorFieldId},denominator:{function:n.denominatorAggregate,field:n.denominatorFieldId}}):s({numeratorType:"conditional",publicName:n.publicName,numerator:null,denominator:{function:n.denominatorAggregate,field:n.denominatorFieldId}}):s(Kg)}),[JSON.stringify(n)]),{onChange:function(e){o&&e.numeratorType&&e.numeratorType!=l.numeratorType?Wr("Percentage type cannot be changed once it has been created."):s(U({},l,e))},fieldPublicName:l.publicName,denominatorMeasure:l.denominator,numeratorType:l.numeratorType,numeratorMeasure:l.numerator,completedFilters:d,wipFilters:c,deleteWipFilter:p,updateWipFilter:f,isEditing:o,handleUpsertPercentageField:function(){if("simple"==l.numeratorType&&l.denominator&&l.numerator){var t=function(e,t,n,r,i,o){return{id:bt(),publicName:e,numeratorFieldId:t,numeratorAggregate:n,denominatorFieldId:r,denominatorAggregate:i,canBeDimension:!1,canBeMeasure:!0,dataType:"number",allowedOperators:Me({dataType:"number"},o)}}(l.publicName,l.numerator.field,l.numerator.function,l.denominator.field,l.denominator.function,e);i(U({},t,{id:o?n.id:t.id}))}if("conditional"==l.numeratorType&&l.denominator&&l.publicName){var r=function(e,t,n,r,i){return{id:bt(),publicName:e,numeratorFilter:r,denominatorFieldId:t,denominatorAggregate:n,canBeDimension:!1,canBeMeasure:!0,dataType:"number",allowedOperators:Me({dataType:"number"},i)}}(l.publicName,l.denominator.field,l.denominator.function,d,e);i(U({},r,{id:o?n.id:r.id}))}}}}(e.queryEngineConfig,e.initialValue,n,e.onNewCustomField),i=r.fieldPublicName,o=r.denominatorMeasure,a=r.numeratorType,l=r.numeratorMeasure,s=r.onChange,u=r.completedFilters,d=r.wipFilters,p=r.deleteWipFilter,f=r.updateWipFilter,m=r.isEditing,h=r.handleUpsertPercentageField,v=On(e.componentType),g=[];v.supportedCustomFields.simplePercentage&&(g=[].concat(g,[{value:"simple",label:"Simple",description:"Percentage metric without a numerator filter"}])),v.supportedCustomFields.conditionalPercentage&&(g=[].concat(g,[{value:"conditional",label:"Conditional",description:"Apply conditional filters to the numerator"}]));var b={onlyFieldTypes:["number","string","boolean"],onlyMeasures:!0,forComponent:e.componentType,removeSimplePercentage:!0,removeConditionalPercentage:!0,removeSimpleMaths:!0,removeRuleGrouping:!0,removeAggregateMaths:!0};return c.jsxs(If,{width:"2xl",isOpen:e.isOpen,onClose:e.onClose,children:[c.jsx(If.Header,{title:"Percentage Custom Metric"}),c.jsxs(If.Content,{children:[c.jsx(Rf,{children:c.jsx(np,{id:"percentage-name",placeholder:"Metric name",label:"Metric name",value:i,onChange:function(e){return s({publicName:e.target.value})}})}),c.jsxs(Rf,{as:"fieldset",children:[c.jsx(Tc,{as:"legend",children:"Numerator"}),c.jsx(zd,{marginBottom:"1rem",children:c.jsx(zv,{options:g,name:"percentage-check",label:"Select Percentage Type",selected:a,locked:m,labelHidden:!0,onChange:function(e){return s({numeratorType:e})}})}),"simple"===a&&c.jsx(mg,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){s({numerator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:l?[l]:[]},dataSet:e.dataSet,fieldFilterOptions:b}),"conditional"===a&&c.jsx(Yg.Panel,{children:c.jsx(qg,{fieldHeadingOverride:"Metric",queryEngineConfig:e.queryEngineConfig,dataSet:n,completedFilters:u,wipFilters:d,updateWipFilter:f,deleteWipFilter:p})})]}),c.jsxs(Rf,{children:[c.jsx(Tc,{children:"Denominator"}),c.jsx(mg,{componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){s({denominator:e.measure[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:o?[o]:[]},dataSet:e.dataSet,fieldFilterOptions:b})]})]}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{onClick:function(){return e.onClose()},secondary:!0,children:"Close"}),c.jsx(_p,{onClick:function(){return h()},children:m?"Update":"Create"})]})})]})},Qg=function(e){return c.jsxs(If,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(If.Header,{title:"Are you sure?",show:!0}),c.jsx(If.Content,{children:c.jsx(zd,{paddingY:8,children:e.message})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Ip,{testId:"modal-cancel-delete-btn",onClick:function(){return null==e?void 0:e.onClose(!1)},children:"Cancel"}),c.jsx(Ip,{testId:"modal-confirm-delete-btn",primary:!0,onClick:function(){return null==e?void 0:e.onClose(!0)},disabled:null==e?void 0:e.disabledDelete,children:"Delete"})]})})]})};function Jg(e){var n=e.label,r=void 0===n?"Metric":n,i=t.useState(e.value),o=i[0],a=i[1],l=[];return[].concat(e.dataSetFields).forEach((function(t,n){l.push({label:t.publicName,value:t,testId:e.testId+"-pick-field-"+n})})),c.jsx(Ac,{label:r,labelHidden:null==e?void 0:e.labelHidden,id:null==e?void 0:e.id,testId:e?e.testId+"-pick-field":void 0,onChange:function(t){a(t),null==e||e.onChange(t)},options:l,selected:o})}var Zg={publicName:"",mathType:"simple",left:void 0,right:void 0,rightFieldId:void 0,leftFieldId:void 0,operator:void 0},$g=function(e){switch(e.mathType){case"simple":return void 0===e.publicName||void 0===e.operator||void 0===e.leftFieldId||void 0===e.rightFieldId;case"aggregate":return void 0===e.left||void 0===e.right||void 0===e.operator;default:return!0}},eb=function(e){var t,n,r,i,o=void 0,a=void 0,l=void 0;return e&&(nb(e)&&e.operator&&e.right&&(o=null==(t=e.left)?void 0:t.field,a=null==(n=e.left)?void 0:n.function,l={operator:e.operator,fieldId:null==(r=e.right)?void 0:r.field,function:null==(i=e.right)?void 0:i.function}),rb(e)&&(o=e.field,a=e.function)),{fieldId:o,function:a,nested:l}};function tb(e){return{field:e.fieldId,function:e.function}}var nb=function(e){return"left"in e||"operator"in e||"right"in e},rb=function(e){return"field"in e&&"function"in e};function ib(e,t){var n={};return n[t]=e&&nb(e)?e.left:{operator:"+",left:null!=e?e:void 0},n}var ob=function(e){var t;return c.jsx(Ac,{placeholder:"Operator...",id:null!=(t=null==e?void 0:e.id)?t:"simple-math-operator",label:"Operator",labelHidden:!0,onChange:function(t){null==e||e.onChange(t)},options:[{label:"Add",value:"+",testId:"simple-math-operator-add"},{label:"Subtract",value:"-"},{label:"Multiply",value:"*"},{label:"Divide",value:"/"}],selected:e.mathOperator})},ab=function(e){var t=e.state;return c.jsx(cp,{tooltipContent:function(){return t+" nested calculation"},classNameTrigger:""+ub,children:c.jsxs(_p,{secondary:!0,onClick:e.onClick,children:[c.jsxs("span",{className:""+Ta,children:[t," nested calculation"]}),c.jsx("Remove"===t?v.MinusSmIcon:v.PlusSmIcon,{width:16})]})})},lb=function(e){var n=e.left,r=e.right,i=e.operator,o=e.dataSet,a=$g({mathType:"aggregate",left:n,right:r,operator:i,publicName:""});return c.jsx("code",{className:""+db,children:a?c.jsx(t.Fragment,{children:"Metrics and operator need to be defined"}):c.jsxs(t.Fragment,{children:[n&&c.jsx(zd,{flex:1,as:"span","data-component":"calculation-left",textAlign:"right",children:c.jsx(sb,{side:n,dataSet:o})}),c.jsx(zd,{as:"strong",width:8,"data-component":"calculation-operator",className:""+Aa.bold,children:i}),r&&c.jsx(zd,{flex:1,as:"span","data-component":"calculation-right",children:c.jsx(sb,{side:r,dataSet:o})})]})})},sb=function(e){var n,r,i,o,a,l,s=e.side,u=e.dataSet;return c.jsx(t.Fragment,{children:s&&nb(s)?c.jsxs("span",{children:[c.jsx("span",{className:""+Aa.bold,children:"("}),(null==(n=s.left)?void 0:n.field)&&Mn(u,null==(r=s.left)?void 0:r.field).publicName," (",null==s||null==(i=s.left)?void 0:i.function,")"," ",s.operator," ",(null==(o=s.right)?void 0:o.field)&&Mn(u,null==(a=s.right)?void 0:a.field).publicName," (",null==(l=s.right)?void 0:l.function,")",c.jsx("span",{className:""+Aa.bold,children:")"})]}):c.jsxs("span",{children:[s&&Mn(u,s.field).publicName," ",(null==s?void 0:s.function)&&c.jsxs(t.Fragment,{children:["(",null==s?void 0:s.function,")"]})]})})},ub=pa({display:"block"}),db=pa({backgroundColor:cs(80),color:cs(0),borderRadius:8,padding:"16px 8px",display:"flex",alignItems:"center",justifyContent:"center",width:"100%",gap:"0.5rem",fontSize:11}),cb=function(e){var n=function(e,n,r){var i=!!n,o=t.useState(Zg),a=o[0],l=o[1],s=function(){l(Zg)};return t.useEffect((function(){if(n)if(Ct(n)){var e=function(e){var t=e.rightFieldId,n=e.rightFunction,r=e.leftNested,i=e.rightNested,o=tb({fieldId:e.leftFieldId,function:e.leftFunction}),a=tb({fieldId:t,function:n});return r&&(o={left:o,operator:r.operator,right:tb({fieldId:r.fieldId,function:r.function})}),i&&(a={left:a,operator:i.operator,right:tb({fieldId:i.fieldId,function:i.function})}),{left:o,right:a}}(n);l({publicName:n.publicName,left:e.left,right:e.right,leftFieldId:void 0,rightFieldId:void 0,operator:n.operator,mathType:"aggregate"})}else yt(n)&&l({publicName:n.publicName,rightFieldId:n.rightFieldId,leftFieldId:n.leftFieldId,operator:n.operator,right:void 0,left:void 0,mathType:"simple"});else s()}),[JSON.stringify(n)]),U({reset:s},a,{handleUpsertMathField:function(){if("simple"===a.mathType&&null!=a&&a.leftFieldId&&null!=a&&a.operator&&null!=a&&a.rightFieldId){var t=function(e,t,n,r,i){return{id:bt(),publicName:e,rightFieldId:r,operator:n,leftFieldId:t,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:Me({dataType:"number"},i)}}(a.publicName,null==a?void 0:a.leftFieldId,null==a?void 0:a.operator,null==a?void 0:a.rightFieldId,e);r(U({},t,{id:i?n.id:t.id}))}if("aggregate"===a.mathType&&a.left&&a.right&&a.operator){var o=function(e){var t=e.right,n=eb(e.left),r=n.fieldId,i=n.function,o=n.nested,a=eb(t);return{nestedLeft:o,nestedRight:a.nested,leftField:r,rightField:a.fieldId,leftFunction:i,rightFunction:a.function}}(a),l=function(e,t,n,r,i,o,a,l,s){return{id:bt(),publicName:e,rightFieldId:i,rightFunction:o,operator:r,leftFieldId:t,leftFunction:n,dataType:"number",canBeDimension:!1,canBeMeasure:!0,allowedOperators:Me({dataType:"number"},a),leftNested:l,rightNested:s}}(a.publicName,o.leftField,o.leftFunction,a.operator,o.rightField,o.rightFunction,e,o.nestedLeft,o.nestedRight);r(U({},l,{id:i?n.id:l.id}))}},onChange:function(e){l(void 0!==e.mathType&&e.mathType!==a.mathType?U({},a,e,{left:void 0,leftFieldId:void 0,right:void 0,rightFieldId:void 0}):U({},a,e))},isEditing:!!n,disabled:$g(a)})}(e.queryEngineConfig,e.initialValue||void 0,e.onNewCustomField),r=n.leftFieldId,i=n.rightFieldId,o=n.operator,a=n.publicName,l=n.handleUpsertMathField,s=n.onChange,u=n.isEditing,d=n.mathType,p=n.right,f=n.left,m=n.disabled,h=n.reset,v={onlyFieldTypes:["number"],removeConditionalPercentage:!0,removeSimplePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},g=Ln(e.dataSet.fields,v),b=function(e){var t=[],n=On(e);return n.supportedCustomFields.simpleMaths&&(t=[].concat(t,[{value:"simple",label:"Simple",description:"Math calculation with simple metrics"}])),n.supportedCustomFields.aggregateMaths&&(t=[].concat(t,[{value:"aggregate",label:"Aggregate",description:"Math calculation with a aggregate metric"}])),t}(e.componentType),x=function(t){return t?Mn(e.dataSet,t):void 0};return t.useEffect((function(){null!=e&&e.open&&!e.initialValue&&h()}),[null==e?void 0:e.open]),c.jsxs(If,{width:"4xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(If.Header,{title:"Math Custom Metric"}),c.jsxs(If.Content,{children:[c.jsx(Rf,{children:c.jsx(np,{label:"Metric name",id:"metric-name",placeholder:"Metric name",value:a,onChange:function(e){return s({publicName:e.target.value})}})}),c.jsxs(Rf,{as:"fieldset",children:[c.jsx(Tc,{as:"legend",children:"Calculation"}),e.allowAggregateMathsCustomField&&c.jsx(zd,{marginBottom:"1rem",children:c.jsx(zv,{options:b,name:"math-check",label:"Select Math Type",selected:d,locked:u,labelHidden:!0,onChange:function(e){return s({mathType:e})}})}),"simple"===d&&c.jsx(Yg.Panel,{children:c.jsxs(Gd,{direction:"row",gap:"0.5rem",children:[c.jsx(zd,{flex:1,children:c.jsx(Jg,{id:"metric-1",testId:"metric-1",label:"Metric 1",onChange:function(e){return s({leftFieldId:null==e?void 0:e.id})},dataSetFields:g,value:x(r),labelHidden:!0})}),c.jsx(zd,{width:170,children:c.jsx(ob,{mathOperator:o,onChange:function(e){return s({operator:e})}})}),c.jsx(zd,{flex:1,children:c.jsx(Jg,{id:"metric-2",testId:"metric-2",label:"Metric 2",onChange:function(e){return s({rightFieldId:null==e?void 0:e.id})},dataSetFields:g.filter((function(e){return e.id!==r})),value:x(i),labelHidden:!0})})]})}),"aggregate"===d&&c.jsxs(t.Fragment,{children:[c.jsx(Yg.Panel,{children:c.jsxs(Gd,{direction:"column",gap:"1rem",paddingY:"0.5rem",children:[c.jsxs(Gd,{direction:"row",gap:"0.5rem",children:[c.jsx(zd,{flex:1,children:c.jsx(mg,{id:"left-1",testId:"left-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return s(f&&nb(f)?{left:U({},f,{left:t[0]})}:{left:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:f&&rb(f)?[f]:null!=f&&f.left?[null==f?void 0:f.left]:[]},dataSet:e.dataSet,fieldFilterOptions:v},""+f)}),f&&!!nb(f)&&c.jsxs(t.Fragment,{children:[c.jsx(zd,{width:120,children:c.jsx(ob,{mathOperator:f.operator,onChange:function(e){return s({left:U({},f,{operator:e})})}})}),c.jsx(zd,{flex:1,children:c.jsx(mg,{id:"right-1",testId:"right-1",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return s({left:U({},f,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:null!=f&&f.right?[null==f?void 0:f.right]:[]},dataSet:e.dataSet,fieldFilterOptions:v})})]}),c.jsx(zd,{children:c.jsx(ab,{onClick:function(){return s(ib(f,"left"))},state:f&&nb(f)?"Remove":"Add"})})]}),c.jsx(Gd,{justifyContent:"center",children:c.jsx(zd,{flex:1,marginRight:60,children:c.jsx(ob,{mathOperator:o,onChange:function(e){return s({operator:e})},id:"operator-2"})})}),c.jsxs(Gd,{direction:"row",gap:"0.5rem",children:[c.jsx(zd,{flex:1,children:c.jsx(mg,{id:"left-2",testId:"left-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){var t=e.measure;return s(p&&nb(p)?{right:U({},p,{left:t[0]})}:{right:t[0]})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:p&&rb(p)?[p]:null!=p&&p.left?[null==p?void 0:p.left]:[]},dataSet:e.dataSet,fieldFilterOptions:v},""+p)}),p&&nb(p)&&c.jsxs(t.Fragment,{children:[c.jsx(zd,{width:120,children:c.jsx(ob,{mathOperator:p.operator,onChange:function(e){return s({right:U({},p,{operator:e})})},id:"operator-2"})}),c.jsx(zd,{flex:1,children:c.jsx(mg,{id:"right-2",testId:"right-2",componentType:e.componentType,maxAllowed:1,allowsMultiple:!0,setPartialAttributes:function(e){return s({right:U({},p,{right:e.measure[0]})})},supportedAggregates:e.queryEngineConfig.supportedAggregates,attributes:{measure:p.right?[p.right]:[]},dataSet:e.dataSet,fieldFilterOptions:v})})]}),c.jsx(zd,{children:c.jsx(ab,{onClick:function(){s(ib(p,"right"))},state:p&&nb(p)?"Remove":"Add"})})]})]})}),c.jsx(zd,{marginTop:20,children:c.jsx(lb,{left:f,right:p,operator:o,dataSet:null==e?void 0:e.dataSet})})]})]})]}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{onClick:function(){return e.onClose()},secondary:!0,children:"Close"}),c.jsx(_p,{onClick:function(){return l()},disabled:m,children:u?"Update":"Create"})]})})]})},pb=["round_to_0_dp","round_to_2_dp"],fb=function(e){var n=Ol().mode,r=function(e,n,r,o){var a=!!e,l=i.intersection(pb,Object.keys(n.supportedTransformationFunctions)),s=t.useState(""),u=s[0],d=s[1],c=t.useState({dataSetField:void 0,transformationFunctionKey:void 0}),p=c[0],f=c[1],m=Ln(r.fields,{onlyFieldTypes:["number"]}).map((function(e){return{title:e.publicName,value:e}})),h=p.dataSetField?[{title:p.dataSetField.publicName,select:{selected:p.transformationFunctionKey,onChange:function(e){f(U({},p,{transformationFunctionKey:e}))},options:[].concat(l).map((function(e){return{label:n.supportedTransformationFunctions[e].publicName,value:e}}))}}]:[];return t.useEffect((function(){if(e&&wt(e)){d(e.publicName);var t=Mn(r,e.fieldId);f({dataSetField:t,transformationFunctionKey:2==e.roundToDecimalPlaces?"round_to_2_dp":"round_to_0_dp"})}else d(""),f({dataSetField:void 0,transformationFunctionKey:void 0})}),[JSON.stringify(e)]),{onCreateNewRoundedNumber:function(){if(p&&p.dataSetField){var t,r=function(e,t,n,r){return{id:bt(),publicName:e,fieldId:t,roundToDecimalPlaces:n,dataType:"number",canBeDimension:!0,canBeMeasure:!0,allowedOperators:Me({dataType:"number"},r)}}(u,null==(t=p.dataSetField)?void 0:t.id,"round_to_0_dp"==p.transformationFunctionKey?0:2,n);o(U({},r,{id:a?e.id:r.id}))}},isEditing:a,metricName:u,setMetricName:d,items:h,initValues:m,selected:p,setSelected:f,transformationFunctions:l}}(e.initialValue,e.queryEngineConfig,e.dataSet,e.onNewCustomField),o=r.isEditing,a=r.metricName,l=r.setMetricName,s=r.items,u=r.initValues,d=r.selected,p=r.setSelected,f=r.transformationFunctions,m=r.onCreateNewRoundedNumber;return c.jsxs(If,{width:"xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(If.Header,{title:"Round number custom field"}),c.jsxs(If.Content,{children:[c.jsx(Rf,{children:c.jsx(np,{id:"rounded-number-name",placeholder:"Metric name",label:"Metric name",value:a,onChange:function(e){return l(e.target.value)}})}),c.jsx(Rf,{children:c.jsx(kp,{testId:"select-rounded-number-field",mode:n,items:s,onDeleteItem:function(){return p({dataSetField:void 0,transformationFunctionKey:f[0]})},newItem:{callToAction:"Select field to transform",onNew:function(e){return p({dataSetField:e,transformationFunctionKey:f[0]})},initValues:u,hide:!!d.dataSetField}})})]}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{onClick:function(){return e.onClose()},secondary:!0,children:"Close"}),c.jsx(_p,{onClick:function(){d.dataSetField&&m()},children:o?"Update":"Create"})]})})]})},mb=function(e,t,n){var r=[],i=On(t);return e.allowSimpleMathsCustomField&&i.supportedCustomFields.simpleMaths||e.allowAggregateMathsCustomField&&i.supportedCustomFields.aggregateMaths?r.push({title:"Math",subtext:"Calculate from multiple values",value:"math"}):(e.allowSimpleMathsCustomField||e.allowAggregateMathsCustomField||qr("Simple math custom field not made available, because of a feature toggle."),i.supportedCustomFields.simpleMaths&&!i.supportedCustomFields.aggregateMaths||qr("Simple math custom field not made available, because it is not supported for the view "+i.title+".")),e.allowRoundedNumberCustomField&&i.supportedCustomFields.roundedNumbers?r.push({title:"Rounded number",subtext:"Round a number field",value:"roundedNumber"}):(e.allowRoundedNumberCustomField||qr("Rounded number custom field not made available, because of a feature toggle."),i.supportedCustomFields.roundedNumbers||qr("Rounded number custom field not made available, because it is not supported for the view "+i.title+".")),e.allowPercentagesCustomField&&(i.supportedCustomFields.simplePercentage||i.supportedCustomFields.conditionalPercentage)?r.push({title:"Percentage",subtext:"Calculate a percentage in a field",value:"percentage"}):(e.allowPercentagesCustomField||qr("Percentage custom field not made available, because of a feature toggle."),i.supportedCustomFields.simplePercentage||i.supportedCustomFields.conditionalPercentage||qr("Percentage custom field not made available, because it is not supported for the view "+i.title+".")),e.allowRulesCustomField&&i.supportedCustomFields.rules&&zt(n,"switchField")?r.push({title:"Rules-based Groups",subtext:"Create groups based on conditions",value:"rules"}):(e.allowRulesCustomField||qr("Custom rules field not made available, because of a feature toggle."),i.supportedCustomFields.rules||qr("Custom rules field not made available, because it is not supported for the view "+i.title+"."),zt(n,"switchField")||qr("Custom rules field not made available, because it is not supported by the current query engine.")),r},hb=function(e){var n=e.index,r=e.rules,i=e.data,a=e.queryEngineConfig,l=e.updateDraft,s=e.removeDraft,u=t.useState(r.name),d=u[0],p=u[1],f=Gg(r.rule,i),m=f.completedFilters,h=f.wipFilters,v=f.addOrFilter,g=f.deleteWipFilter,b=f.updateWipFilter;return t.useEffect((function(){var e={name:d,rule:m};o.isEqual(r,e)||l(e)}),[m,d]),c.jsx(zd,{as:"fieldset",children:c.jsxs(Gd,{gap:"0.5rem",paddingBottom:"0.1rem",paddingRight:"0.1rem",paddingLeft:"0.1rem",direction:"column",children:[c.jsx(Yg.Title,{title:"Rule "+(n+1)+(r.name&&": "+r.name)}),c.jsx(zd,{children:c.jsx(np,{id:"rules-name-"+n,label:"Field Value",value:null==r?void 0:r.name,onChange:function(e){return p(e.target.value)}})}),c.jsx(zd,{children:c.jsxs(Gd,{direction:"column",gap:"0.5rem",children:[c.jsx(zd,{children:c.jsx(qg,{wipFilters:h,completedFilters:m,dataSet:i,updateWipFilter:b,queryEngineConfig:a,deleteWipFilter:g})}),c.jsx(zd,{children:c.jsxs(Gd,{justifyContent:"space-between",children:[c.jsx(_p,{secondary:!0,onClick:function(){return v()},children:'Add "OR"'}),0!==n&&c.jsx(_p,{secondary:!0,onClick:function(){return s()},children:"Delete Rule"})]})})]})})]})})},vb=function(e){var t,n=xb(e.initialValue),r=n.draft,i=n.updateDraftTitle,o=n.addNewRule,a=n.updateDraftRules,l=n.removeDraftRule;return c.jsxs(If,{width:"4xl",isOpen:e.open,onClose:e.onClose,children:[c.jsx(If.Header,{title:"Rules Custom Metric"}),c.jsxs(If.Content,{scrollable:!0,children:[c.jsx(Rf,{children:c.jsx(np,{id:"rules-name",label:"Metric name",value:null==r?void 0:r.publicName,onChange:function(e){return i(e.target.value)}})}),c.jsx(Rf,{children:c.jsx(es,{gap:"0.75rem",role:"list",children:null==r||null==(t=r.rules)?void 0:t.map((function(t,n){return c.jsx(Rv,{transform:!1,children:c.jsx(hb,{rules:t,index:n,data:null==e?void 0:e.data,queryEngineConfig:e.queryEngineConfig,updateDraft:function(e){return a(e,n)},removeDraft:function(){return l(n)}})},"rules_modal_key_"+n)}))})})]}),c.jsxs(If.Footer,{buttons:"space-between",children:[c.jsx(Of,{children:c.jsx(_p,{onClick:function(){return o()},secondary:!0,children:"Add Rule"})}),c.jsxs(Of,{buttons:"end",children:[c.jsx(_p,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:"Close"}),c.jsx(_p,{onClick:function(){return function(){if(r.publicName&&r.rules){var t=(n=r.publicName,i=r.rules,o=e.queryEngineConfig,{id:bt(),publicName:n,rules:i,dataType:"string",canBeDimension:!0,canBeMeasure:!0,allowedOperators:Me({dataType:"string"},o)});e.onCreateNewRules(e.initialValue?U({},t,{id:e.initialValue.id}):t)}var n,i,o}()},children:e.initialValue?"Update":"Create"})]})]})]})},gb={name:"",rule:[]},bb={publicName:"",rules:[gb]},xb=function(e){var n=t.useState(bb),r=n[0],i=n[1];return t.useEffect((function(){i(e||bb)}),[JSON.stringify(e)]),{draft:r,updateDraftTitle:function(e){i(U({},r,{publicName:e}))},addNewRule:function(){var e,t=[].concat(null!=(e=null==r?void 0:r.rules)?e:[]);t.push(gb),i(U({},r,{rules:t}))},updateDraftRules:function(e,t){var n,o=[].concat(null!=(n=null==r?void 0:r.rules)?n:[]);t>=0&&t<o.length&&(o[t]=e),i(U({},r,{rules:o}))},removeDraftRule:function(e){var t,n=[].concat(null!=(t=null==r?void 0:r.rules)?t:[]);e>=0&&e<n.length+1&&n.splice(e,1),i(U({},r,{rules:n}))}}},yb=function(e,t){setTimeout((function(){try{var n=t?document.getElementById(t):window;n&&n.scrollBy&&n.scrollBy({top:"bottom"===e?99999999:e,behavior:"smooth"})}catch(e){qr("Failed to auto-scroll.")}}),50)},wb=function(e){var t,n=null==(t=e.customFields)?void 0:t.filter((function(t){var n;return null==(n=e.fieldsUsedModal)?void 0:n.includes(t.id)}));return c.jsxs(If,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose(!1)},children:[c.jsx(If.Header,{title:"Fields Being Used",show:!0}),c.jsx(If.Content,{children:c.jsxs(zd,{paddingY:8,children:["The following fields are being used in this custom metric. You need to delete the Custom metric before you can delete this fields.",c.jsx("ul",{children:null==n?void 0:n.map((function(e){return c.jsx("li",{children:e.publicName},e.id)}))})]})}),c.jsx(If.Footer,{buttons:"end",children:c.jsx(Of,{children:c.jsx(_p,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose(!0)},children:"Close"})})})]})},Cb=function(e){var n=Ol(),r=n.mode,i=n.featureToggles,o=Rn(e.dataSets,e.dataSetId);if(!o)return console.warn("Data set must be found for custom field input to render."),null;var a=t.useState(null),l=a[0],s=a[1],u=t.useState(void 0),d=u[0],p=u[1],f=t.useState(null),m=f[0],h=f[1],v=mb(i,e.componentType,null==e?void 0:e.queryEngineConfig),g=Bn(o,e.componentType),b=Bn(o),x=[].concat(g).map((function(e){return{title:e.publicName,subtext:jb(e),onClick:function(){return s({customFieldCategory:Ft(e),customField:e})}}})),y=function(t){var n=Rn(e.dataSets,e.dataSetId);if(!n)throw"Cannot find data set.";var r=function(e,t){var n=!1,r=[].concat(e.fields).map((function(e){return e.id==t.id?(n=!0,t):e}));return U({},e,{fields:n?r:[].concat(r,[t])})}(n,t),i=Vn(e.dataSets,r);e.setDataSets(i),s(null)};return c.jsxs(c.Fragment,{children:[c.jsx(kp,{mode:r,newItem:{callToAction:"Add custom metric",onNew:function(e){s({customFieldCategory:e,customField:void 0})},initValues:v,onOpenDropdown:function(){yb("bottom","editor-panel")}},items:x,onDeleteItem:function(e){var t=g[e],n=function(e,t){return e.reduce((function(e,n){return"rules"in n&&n.rules.some((function(e){return e.rule.some((function(e){return e.some((function(e){return e.field===t.id}))}))}))&&e.push(n.id),"numeratorFilter"in n&&n.numeratorFilter.some((function(e){return e.some((function(e){return e.field===t.id}))}))&&e.push(n.id),e}),[])}(b,t);n.length>0?p(n):h(t)},testId:"custom-metric-input"}),c.jsx(Xg,{dataSet:o,onNewCustomField:y,isOpen:"percentage"===(null==l?void 0:l.customFieldCategory),onClose:function(){return s(null)},queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,initialValue:null==l?void 0:l.customField}),c.jsx(cb,{open:"math"===(null==l?void 0:l.customFieldCategory),onClose:function(){return s(null)},dataSet:o,onNewCustomField:y,queryEngineConfig:e.queryEngineConfig,componentType:e.componentType,initialValue:null==l?void 0:l.customField,allowAggregateMathsCustomField:i.allowAggregateMathsCustomField}),c.jsx(vb,{open:"rules"===(null==l?void 0:l.customFieldCategory),onClose:function(){return s(null)},data:o,queryEngineConfig:e.queryEngineConfig,onCreateNewRules:y,initialValue:null==l?void 0:l.customField}),c.jsx(fb,{open:"roundedNumber"===(null==l?void 0:l.customFieldCategory),onClose:function(){return s(null)},dataSet:o,queryEngineConfig:e.queryEngineConfig,onNewCustomField:y,initialValue:null==l?void 0:l.customField}),c.jsx(Qg,{message:"This will permanently remove the custom field '"+(null==m?void 0:m.publicName)+"' from all views on the dashboard, not just this view. Are you sure you want to continue?",onClose:function(t){if(t&&m){var n=function(e,t){var n=e.fields.findIndex((function(e){return e.id==t})),r=[].concat(e.fields);return n>=0?(r.splice(n,1),U({},e,{fields:r})):U({},e,{fields:r})}(o,m.id),r=Vn(e.dataSets,n);e.setDataSets(r)}h(null)},show:null!=m}),c.jsx(wb,{onClose:function(){return p(void 0)},show:null!=d&&d.length>0,fieldsUsedModal:d,customFields:b})]})};function jb(e){return yt(e)||Ct(e)?"Math":xt(e)||jt(e)?"Percentage":St(e)?"Rules-based Group":""}var Sb=function(e){var n,r=e.dataSet,o=e.queryEngineConfig,a=e.fieldFilterOptions,l=e.attributes,s=e.preSetPartialAttributes,u=e.setPartialAttributes,d=e.callToAction,p=e.maxAllowed,f=e.preventDuplicates,m=null!=a&&a.onlyDimensions?"grouping":"metric",h=(0,e.getValues)(l),v=function(e){var t=s(e,r,l);"order"in l&&i.isEmpty(l.order)&&e.forEach((function(e){"date_time"==Mn(r,e.field).dataType&&"grouping"==m&&(t.order=[{function:e.function,field:e.field,direction:"asc"}])})),u(t)},g=t.useState(!1),b=g[0],x=g[1],y=Ol(),w=Fb(h,m,o,v),C=Tb(h,r,m,o,v),j=kb(r,a,f,h);return c.jsxs(t.Fragment,{children:[c.jsx(kp,{testId:null!=(n=null==e?void 0:e.testId)?n:"field-collector-input",mode:y.mode,onOrderChange:function(e,t){var n=lg([].concat(h),e,t);v(n)},onDeleteItem:r.preAggregated?void 0:function(e){var t=h[e],n=Mn(r,h[e].field);dg(l,"date_time"===n.dataType&&"function"in t?{field:t.field,truncate:t.function}:t)?x(!0):v(function(e,t){var n=i.cloneDeep(e);return n.splice(t,1),n}(h,e))},items:C,newItem:{callToAction:d||"Add field",onNew:w,initValues:j,hide:e.dataSet.preAggregated||!!p&&h.length>=p}}),b&&c.jsx(sg,{onClose:function(){return x(!1)}})]})};function Fb(e,t,n,r){return function(i){var o,a=[].concat(e);o="grouping"==t&&"date_time"==i.dataType?{field:i.id,function:i.allowedGranularities[0]}:"grouping"==t?{field:i.id,function:"none"}:{field:i.id,function:et(i,n.supportedAggregates)[0]},r([].concat(a,[o]))}}function kb(e,t,n,r){var i=Ln(e.fields,t);return n&&(i=it(i,[].concat(r))),i.map((function(e){return{title:e.publicName,icon:e.dataType,value:e}}))}function Tb(e,t,n,r,o){return[].concat(e).map((function(a,l){var s=Mn(t,a.field),u=[];"metric"==n?u=et(s,r.supportedAggregates).map((function(e){return{label:r.supportedAggregates[e].publicName,value:e}})):"grouping"===n&&"date_time"===s.dataType&&(u=function(e,t){return e.filter((function(e){return void 0!==t[e]})).map((function(e){return{label:t[e].publicName,value:e}}))}(s.allowedGranularities,r.supportedTimeTruncFunctions));var d=!(xt(s)||jt(s)),c=!Ct(s);return{title:s.publicName,icon:s.dataType,select:!t.preAggregated&&"none"!=a.function&&d&&c?{options:u,selected:a.function,onChange:function(t){var n=i.cloneDeep(e);"function"in a&&(n[l]={field:a.field,function:t}),o(n)}}:void 0}}))}var Ab={name:"iaoxbn",styles:"display:grid;width:100%;grid-template-columns:repeat(2, minmax(0, 1fr))"},Db={name:"1flj9lk",styles:"text-align:left"},Ib={name:"gdaplf",styles:"width:100%;text-align:right"},Pb={name:"1gqeage",styles:"margin-right:0.75rem"},_b=function(e){var n,r=Ol(),o=r.mode,a=r.queryEngineConfig,l=e.dataSet,s=t.useState(e.defaultOpen||!1),u=s[0],d=s[1],p=function(e,t){var n=e.flatMap((function(e){return e.map((function(e){return Mn(t,e.field).publicName}))}));return i.uniq(n)}(e.attributes.filter,l),f=i.isEmpty(e.attributes.filter)?[]:[{title:Xe(e.attributes.filter.length,"condition","conditions"),subtext:(n=p.length,(1==n?"On the field":"Across fields")+" "+Qe(p)+"."),onClick:function(){return d(!0)}}],m={callToAction:"Add filter",onClick:function(){d(!0)}},h=Gg(e.attributes.filter,l),v=h.completedFilters,g=h.addOrFilter,b=h.wipFilters,x=h.updateWipFilter,y=h.deleteWipFilter;return c.jsxs(c.Fragment,{children:[c.jsx(kp,{mode:o,newItemBtn:i.isEmpty(f)?m:void 0,onDeleteItem:function(){e.setPartialAttributes({filter:[]})},items:f}),c.jsxs(If,{width:"4xl",isOpen:u,onClose:function(){return d(!1)},children:[c.jsx(If.Header,{title:"Advanced Filters"}),c.jsx(If.Content,{children:c.jsx(qg,{queryEngineConfig:a,updateWipFilter:x,deleteWipFilter:y,wipFilters:b,completedFilters:v,dataSet:l})}),c.jsx(If.Footer,{children:c.jsxs("div",{css:Ab,children:[c.jsx("div",{css:Db,children:c.jsx(_p,{testId:"add-rule-btn",secondary:!0,onClick:function(){g()},children:0==v.length?"Add filter":'Add "OR"'})}),c.jsx("div",{children:c.jsxs("div",{css:Ib,children:[c.jsx("span",{css:Pb,children:c.jsx(_p,{secondary:!0,onClick:function(){d(!1)},children:"Cancel"})}),c.jsx(_p,{testId:"save-filter-btn",onClick:function(){e.setPartialAttributes({filter:v}),d(!1)},children:"Save"})]})})]})})]})]})},Eb={name:"12vm4ss",styles:"margin-left:0.75rem;opacity:0.4;:hover{opacity:0.8;}"},Ob=function(e){return c.jsxs("div",{children:[c.jsxs("div",{children:[c.jsx(Tc,{htmlFor:null==e?void 0:e.id,labelHidden:null==e?void 0:e.labelHidden,children:null==e?void 0:e.label}),e.secondaryAction&&c.jsx("span",{css:Eb,children:c.jsx("button",{onClick:function(){var t;return null==(t=e.secondaryAction)?void 0:t.onClick()},children:e.secondaryAction.label})})]}),c.jsx(np,{id:null==e?void 0:e.id,type:"number",min:e.min,max:e.max,onChange:function(t){e.setNumber(parseFloat(t.target.value))},defaultValue:e.currentValue||void 0,"data-testid":e.testId})]})},Lb=function(e){var t=e.component,n=e.definedMetric,r=e.measure,i=lt(n),o=Mn(null==e?void 0:e.dataSet,n.field),a=Ol().queryEngineConfig;return c.jsxs(Gd,{direction:"column",gap:"0.5rem",children:[c.jsx(Tc,{as:"p",margin:0,children:c.jsxs(Gd,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(oc,{icon:o.dataType})," ",c.jsxs("span",{children:[o.publicName," (",n.function,")"]})]})}),c.jsx(mg,U({},e,{attributes:{measure:r?r[i]:[]},dataSet:null==e?void 0:e.dataSet,componentType:t.attributes.type,allowsMultiple:!0,onNewMeasureFilterAggregate:Mb(e.definedMetrics,a),setPartialAttributes:function(t){var n;e.setAttributes(((n={})[i]=t.measure,n))},supportedAggregates:a.supportedAggregates,id:"metric-input",propKey:"measure",filterOptions:function(t){return Rb(t,null==e?void 0:e.definedMetrics)},label:"Add alternative metric"}))]})},Rb=function(e,t){return e.map((function(e){var n=t.filter((function(t){return t.field===e.value})),r=e.select.options.filter((function(e){return!n.map((function(e){return e.function})).includes(e.value)})),i=e.select.selected;return r.some((function(e){return e.value===i}))||(i=r.length>0?r[0].value:null),U({},e,{select:U({},e.select,{options:r,selected:i})})}))};function Mb(e,t){return function(n){var r=e.filter((function(e){return e.field===n.id})),i=U({},t.supportedAggregates);return r.forEach((function(e){delete i[e.function]})),i}}var Nb=function(e){return null!=e&&e.function&&"none"!=(null==e?void 0:e.function)?e.field+"_"+e.function:null==e?void 0:e.field},zb=function(e,t,n){var r=nt(t,n);return e.filter((function(e){return e.field===(null==r?void 0:r.field)&&e.function===r.function}))[0]},Bb=function(e){var t=e.group,n=e.definedDimension,r=Nb(n),i=Mn(null==e?void 0:e.dataSet,n.field),o=t?t[r]:null,a=Ol().queryEngineConfig;return c.jsxs(Gd,{direction:"column",gap:"0.5rem",children:[c.jsx(Tc,{as:"p",margin:0,children:c.jsxs(Gd,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(oc,{icon:i.dataType})," ",c.jsx("span",{children:i.publicName})]})}),c.jsx(cg,U({},e,{allowsMultiple:!0,attributes:{dimension:o||void 0},setPartialAttributes:function(t){var n,i;e.setAttributes(((i={})[r]=null!=(n=t.dimension)?n:[],i))},supportedTransformationFunctions:a.supportedTransformationFunctions,filterOptions:function(e){return e},label:"Add alternative group"}))]})},qb=function(e){var t=e.group,n=e.definedDimension,r=_e(n),i=Mn(null==e?void 0:e.dataSet,null==e?void 0:e.definedDimension.field),o=Ol().queryEngineConfig,a=t?t[r]:null;return c.jsxs(Gd,{direction:"column",gap:"0.5rem",children:[c.jsx(Tc,{as:"p",margin:0,children:c.jsxs(Gd,{as:"span",direction:"row",gap:"0.5rem",alignItems:"end",children:[c.jsx(oc,{icon:i.dataType})," ",c.jsxs("span",{children:[i.publicName," (",n.truncate,")"]})]})}),c.jsx(pg,U({},e,{attributes:{timeDimensions:a||null},supportedTimeDimensions:o.supportedTimeTruncFunctions,setPartialAttributes:function(t){var n;t.timeDimensions&&e.setAttributes(((n={})[r]=t.timeDimensions,n))},onNewMeasureFilterTruncFunctions:function(t){var r=U({},o.supportedTimeTruncFunctions);return t.id===(null==e?void 0:e.definedDimension.field)&&delete r[n.truncate],r},label:"Add alternative time group"}))]})},Vb=function(e){var t=(null==e?void 0:e.component).attributes,n=Ol().featureToggles,r=Bc().dispatch;return 0==function(e,t){var n=[],r=On(t);return e.parameters&&r.supportedFeatures.parameters?n.push({title:"Parameter",subtext:"Set customisable Parameters on Views"}):(e.parameters||qr("Parameters not made available, because of a feature toggle."),r.supportedFeatures.parameters||qr("Parameters not made available, because it is not supported for the view "+r.title+".")),n}(n,t.type).length?null:null!=e&&e.show?c.jsx(Wb,U({},e,{onAddingParameters:function(n){var i=U({},t,{parameters:n});"parameters"in t&&void 0!==e.cellIndex&&void 0!==e.rowIndex&&r({type:"setAttributes",attributes:i,cellIndex:e.cellIndex,rowIndex:e.rowIndex}),"parameters"in t&&void 0!==e.libraryIndex&&r({type:"updateComponentLibraryAttributes",attributes:i,libraryIndex:null==e?void 0:e.libraryIndex}),null==e||e.onClose()}})):null},Wb=function(e){var n=(null==e?void 0:e.component).attributes,r=Bc(),i=Xr(r.dashboard,e.component.attributes.dataSetId);if(!i)return null;var a=function(e,n,r){var i=Ol().queryEngineConfig,a=t.useState(Zv),l=a[0],s=a[1],u=function(){s(Zv)},d="parameters"in e?e.parameters:void 0;t.useEffect((function(){d?s(d):u()}),[JSON.stringify(d)]);var c,p,f,m,h,v,g,b,x,y,w,C="measure"in e&&"parameters"in e&&o.isEmpty(null==(c=e.parameters)?void 0:c.measure)?e.measure:"parameters"in e&&!o.isEmpty(null==(p=e.parameters)?void 0:p.measure)&&null!=(f=e.parameters)&&f.measure?function(e,t,n){return t.map((function(t){var r,i=Object.keys(null!=(r=null==n?void 0:n.measure)?r:{}).find((function(e){var r,i;return(null!=(r=null==n||null==(i=n.measure)?void 0:i[e])?r:[]).some((function(e){return e.field===t.field&&e.function===t.function}))}));return i?st(i,{supportedAggregates:e,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}):t}))}(i.supportedAggregates,e.measure,e.parameters):[],j="dimension"in e&&"parameters"in e&&o.isEmpty(null==(v=e.parameters)?void 0:v.group)?e.dimension:"dimension"in e&&"parameters"in e&&!o.isEmpty(null==(g=e.parameters)?void 0:g.group)&&null!=(b=e.parameters)&&b.group?(h=e.parameters,(m=e.dimension)?null==m?void 0:m.map((function(e){var t,n=Object.keys(null!=(t=null==h?void 0:h.group)?t:{}).find((function(t){var n,r;return(null!=(n=null==h||null==(r=h.group)?void 0:r[t])?n:[]).some((function(t){return(null==t?void 0:t.field)===e.field&&"function"in t&&t.function===("function"in e&&e.function)}))}));return n?{field:n,function:"none"}:e})):[]):[],S="timeDimension"in e&&e.timeDimension&&"parameters"in e&&o.isEmpty(null==(x=e.parameters)?void 0:x.group)?e.timeDimension:"timeDimension"in e&&"parameters"in e&&!o.isEmpty(null==(y=e.parameters)?void 0:y.group)&&null!=(w=e.parameters)&&w.group?function(e,t,n){var r,i=Object.keys(null!=(r=null==n?void 0:n.group)?r:{}).find((function(e){var r,i;return(null!=(r=null==n||null==(i=n.group)?void 0:i[e])?r:[]).some((function(e){if(e)return e.field===(null==t?void 0:t.field)&&("truncate"in e&&e.truncate)===t.truncate}))}));if(i){var o=Ee(i,e);return null!=o?o:t}return t}(i.supportedTimeTruncFunctions,e.timeDimension,e.parameters):void 0;return U({},l,{definedMetrics:C,definedDimensions:j,definedTimeDimension:S,onChange:function(t){if("measure"in t&&t.measure){var n=function(e,t){var n=Object.keys(t)[0];e.measure||(e.measure={});var r=U({},e.measure),i=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete r[n],i=n):r[n]=t[n],{updatedMetrics:U({},e,{measure:r}),metricKeyToDelete:i}}(U({},l),t.measure),o=n.updatedMetrics,a=n.metricKeyToDelete;a&&function(t){if("measure"in e&&t&&l.measure){var n=st(t,i),o=function(e,t,n,r){var i,o=null==(i=r[e])?void 0:i[0];if(!o)return t;var a=t.findIndex((function(e){return e.field===o.field&&e.function===o.function}));return-1!==a&&n&&(t[a]=n),t}(t,e.measure,n,l.measure);r({updatedMeasures:o})}}(a),s(o)}if("group"in t&&t.group){var u=function(e,t){var n=Object.keys(t)[0];e.group||(e.group={});var r=U({},e.group),i=void 0;return Array.isArray(t[n])&&0===t[n].length?(delete r[n],i=n):r[n]=t[n],{updatedMetrics:U({},e,{group:r}),metricKeyToDelete:i}}(U({},l),t.group),d=u.updatedMetrics,c=u.metricKeyToDelete;c&&function(t){if("parameters"in e&&t&&l.group){var n=Ee(t,i.supportedTimeTruncFunctions);n&&r({updatedTimeDimension:n}),"dimension"in e&&!n&&r({updatedDimension:eg(t,e.dimension,l.group)})}}(c),s(d)}},handleUpsert:function(){n(l)},reset:u,disabled:$v(l,d)})}(n,null==e?void 0:e.onAddingParameters,e.setParameterUpdate),l=a.definedMetrics,s=a.onChange,u=a.measure,d=a.handleUpsert,p=a.definedDimensions,f=a.definedTimeDimension,m=a.group;return c.jsxs(If,{width:"xl","data-testid":"parameters-modal",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(If.Header,{title:"Add Parameters",show:!0,tooltip:"Set alternate metrics and groups for the view. "}),c.jsx(If.Content,{children:c.jsx(Gd,{width:"100%",children:c.jsx(zd,{flex:1,children:c.jsxs(Ef.Group,{defaultIndex:0,children:[(f||0!==p.length)&&c.jsxs(Ef.List,{columns:"1fr 1fr",padding:0,children:[c.jsx(Ef.Button,{children:"Metrics"}),c.jsx(Ef.Button,{children:"Groups"})]}),c.jsxs(Ef.Panels,{children:[c.jsxs(Ef.Panel,{paddingLeft:0,paddingRight:0,children:[c.jsx(gf,{marginBottom:2,children:"Current active metrics"}),c.jsx(Gd,{direction:"column",gap:"1.5rem",children:null==l?void 0:l.map((function(t){return c.jsx(Lb,{component:null==e?void 0:e.component,definedMetric:t,definedMetrics:l,dataSet:i,setAttributes:function(e){return s({measure:e})},measure:u},t.field+"-"+t.function)}))})]}),c.jsxs(Ef.Panel,{paddingLeft:0,paddingRight:0,children:[c.jsx(gf,{marginBottom:2,children:"Current active groups"}),c.jsxs(Gd,{direction:"column",gap:"1.5rem",children:[p.map((function(t){return c.jsx(Bb,{setAttributes:function(e){return s({group:e})},component:null==e?void 0:e.component,definedDimension:t,dataSet:i,group:m},""+t.field)})),f&&c.jsx(qb,{definedDimension:f,setAttributes:function(e){return s({group:e})},dataSet:i,group:m})]})]})]})]})})})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Ip,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Close"}),c.jsx(Ip,{onClick:function(){return d()},primary:!0,children:"Update"})]})})]})},Hb=function(e){return{renderCloseIcon:e.renderCloseIcon||null,renderDeleteIcon:e.renderDeleteIcon||null,renderFilterIcon:e.renderFilterIcon||null,renderParametersIcon:e.renderParametersIcon||null,renderLoadingComponent:e.renderLoadingComponent||null,renderDownloadIcon:e.renderDownloadIcon||null,renderEditIcon:e.renderEditIcon||null,renderComponentOptionsMenuIcon:e.renderComponentOptionsMenuIcon||null,renderLockedIcon:e.renderLockedIcon||null,renderLibraryIcon:e.renderLibraryIcon||null,renderAccordionIcon:e.renderAccordionIcon||null,renderButtonComponent:e.renderButtonComponent||null,renderSelectComponent:e.renderSelectComponent||null,renderDateTimeInput:e.renderDateTimeInput||null,renderReportIcon:e.renderReportIcon||null}},Yb=function(e){var t=Ol().customComponents,n=null;try{n=function(e,t){var n=e.find((function(e){return e.id==t}));if(!n)throw"Failed to find custom component.";return n}(t,e.component.attributes.id)}catch(e){return c.jsx(cf,{})}return c.jsx(n.Component,{})},Ub=t.memo((function(e){var n,r,i=e.displayTitle,o=e.displaySubject,a=Bh({title:i,subject:o}),l=rs(),u={displayTitle:i,displaySubject:o,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,dataSet:e.dataSet,componentType:null==e?void 0:e.type};if(!On(e.type).isRunnable(e))return c.jsx(uf,{title:"Missing parameters"});if(Uo(e.lineResult)||Uo(e.barResult))return c.jsx(hc,{});if(Go(e.lineResult)&&Go(e.barResult))return c.jsx(df,{});var d,p,f=zh({dimension:e.barDimension,timeDimension:e.timeDimension}),m=e.barResult?Wo(f,e.barMeasure,e.barResult):[],h=e.barResult?Vo(e.barResult,e.barMeasure,f,"100%"==e.stacked):[],v=zh({dimension:e.lineDimension,timeDimension:e.timeDimension}),g=e.lineResult?Wo(v,e.lineMeasure,e.lineResult):[],b=e.lineResult?Vo(e.lineResult,e.lineMeasure,v,"100%"==e.stacked):[];return c.jsx(t.Suspense,{fallback:c.jsx(hc,{}),children:c.jsxs(Tp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Rm,U({},u)),c.jsx(Oa,{disabledFeatures:null!=(r=null==e?void 0:e.library)&&r,children:c.jsx(gv,{ref:a,approxXAxisLabelCount:e.approxXAxisLabelCount,approxYAxisLabelCount:e.approxYAxisLabelCount,uniqueId:e.id,formatYAxisLabel:la({prefix:e.yAxisPrefix,postfix:e.yAxisPostfix,format:null==e?void 0:e.yAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),formatXAxisLabel:aa(e.timeDimension,e.supportedTimeTruncFunctions,{prefix:e.xAxisPrefix,postfix:e.xAxisPostfix,format:null==e?void 0:e.xAxisFormat,numberFormatOptions:e.numberFormatOptions,dateTimeFormatOptions:e.dateTimeFormatOptions}),forceXAxisAsTime:!!e.timeDimension,legend:qh(null==e?void 0:e.legend,"verbose"===(null==l?void 0:l.detail)),x:"x",bars:{colors:er(null==l?void 0:l.colors,m.length),data:h,annotate:[],stacked:!!e.stacked,keys:m,formatter:function(t,n){if(e.conditionalFormattingRules&&e.conditionalFormattingRules.bar){var r=oa(e.barDimension,e.conditionalFormattingRules.bar,t,n,null==e?void 0:e.dataSet);return r?r.ruleValue:void 0}}},lines:{colors:(d=er(null==l?void 0:l.colors,g.length),void 0===p&&(p=1),[].concat(d).map((function(e){return function(e,t,n){return s(e).darken(t).hex()}(e,p)}))),data:b,annotate:[],keys:g},removeStroke:!1,theme:null==l?void 0:l.charts,formatSeriesName:function(t){var n=e.barResult&&sa(e.barResult)(t),r=e.lineResult&&sa(e.lineResult)(t);return n||r||""},sparkline:e.sm,onClick:function(){},goalLine:null==e?void 0:e.goalLines,axisTitles:null==e?void 0:e.axisTitles})})]})})}),na),Gb=function(e){var t=e.component,n=t.results,r=t.attributes,i=t.localFilters,o=Bc().dashboard,a=Uh(r,e.runQueriesCallback,e.setResults,{localFilters:i,globalFilters:e.globalFilters},e.dataSet);return c.jsx(Ub,U({id:e.id},r,{dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,lineResult:n[0],barResult:n[1],queriesAreChanging:a.queriesAreChanging,setParameterUpdate:function(){},supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,dashboard:o,sm:e.sm,library:null==e?void 0:e.library,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,goalLines:null==e?void 0:e.component.attributes.goalLines}))},Kb=function(e){var n,r=e.result,i=e.minValueColor,o=e.maxValueColor,a=e.noDataColor,l={displayTitle:e.displayTitle,displaySubject:e.displaySubject,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,library:null!=(n=null==e?void 0:e.library)&&n,verified:null==e?void 0:e.protectedByOrganisation,dataSet:e.dataSet,componentType:null==e?void 0:e.type},s=Bh({title:e.displayTitle,subject:e.displaySubject});if(!On("mercatorMap").isRunnable(e))return c.jsx(uf,{title:"Missing parameters"});if(Uo(r))return c.jsx(hc,{});if(Go(r))return c.jsx(df,{});var u={};if(r){var d=e.dimension[0].field,p=e.measure[0],f=r.fields.findIndex((function(e){return e.id==d})),m=r.fields.findIndex((function(e){return e.id==lt(p)}));r.content.forEach((function(e){u[e[f]]=e[m]}))}var h=$n([i,o],((null==r?void 0:r.content.length)||100)/4);return c.jsx(t.Suspense,{fallback:c.jsx(hc,{}),children:c.jsxs(Tp,{id:e.id,queriesAreChanging:e.queriesAreChanging,children:[c.jsx(Rm,U({},l)),c.jsx(Av,{ref:s,formatValue:function(t){return ua(Oo(t,2),e.numberFormatOptions,e.labelFormat)},topology:"worldCountries",data:u,background:e.backgroundColor,colorRange:h,missingDataColor:a,position:e.position,onPositionChange:e.onPositionChange})]})})},Xb=function(e){var t=e.component,n=t.results,r=t.attributes,i=Uh(r,e.runQueriesCallback,e.setResults,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(Kb,U({},r,{id:e.id,result:n[0],queriesAreChanging:i.queriesAreChanging,dataSet:e.dataSet,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTransformationFunctions,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:function(){},onPositionChange:e.onPositionChange,numberFormatOptions:e.dashboardBehaviour.numberFormatOptions}))},Qb=Object.assign((function(){return null}),{pill:pa({padding:"4px 10px",borderRadius:"5px",fontSize:"12px",display:"flex",alignItems:"center",rowGap:"0.5rem",variants:{positive:{yes:{color:"rgb(4, 120, 87)",background:"#D1FAE5"},no:{color:"rgb(190, 18, 60)",background:"#FFE4E6"}}}})}),Jb=function(e){var n,r=e.result;if(!r||0===r.content.length||1===r.content.length)return null;var i,o,a=r.content[r.content.length-2][e.index],l=r.content[r.content.length-1][e.index],s=(i=a,0!==(o=l)?0!==i?(o-i)/i*100:100*o:100*-i),u=Qb.pill({positive:s>=0?"yes":"no"}),d=t.useState(!0),f=d[0],m=d[1],h=-1*(a-l);return c.jsxs(es,{gap:"0.15rem",children:[c.jsxs(zd,{as:"p",className:Zl(""+Aa.textSize("xs"),""+Aa.opacity(.7)),margin:0,children:["Current ",null==e||null==(n=e.deltaTimeDimension)?void 0:n.truncate]}),c.jsxs(Gd,{gap:"1rem",alignItems:"center",children:[c.jsx("div",{children:c.jsx(zd,{as:"p",margin:0,children:c.jsx(nx,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:l,measure:null==e?void 0:e.measure})})}),c.jsx(Gd,{alignSelf:"flex-end",gap:"0.5rem",children:c.jsx(cp,{tooltipContent:function(){var t;return c.jsxs(cp.Content,{children:["Previous ",null==e||null==(t=e.deltaTimeDimension)?void 0:t.truncate,":"," ",c.jsx(nx,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:a,measure:null==e?void 0:e.measure})]})},children:c.jsxs("button",{onClick:function(){return m(!f)},className:Zl(u,""+Aa.bw(0)),children:[f?Oo(s,2)+"%":c.jsx(nx,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,value:h,measure:null==e?void 0:e.measure}),c.jsx("svg",{className:p.css([{height:"1rem",width:"1rem"},s>=0?{"--tw-rotate":"-45deg",transform:"translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))"}:{"--tw-rotate":"45deg",transform:"translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))"}],"",""),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12h15m0 0l-6.75-6.75M19.5 12l-6.75 6.75"})})]})})})]})]})},Zb=function(e){var t=null==e?void 0:e.results.some((function(e){return Array.isArray(null==e?void 0:e.content)&&(null==e?void 0:e.content)&&e.content.length>1}));return null!==e.deltaTimeDimension&&!1===t?c.jsxs("p",{className:Zl(""+Aa.textSize("xs"),""+Aa.opacity(.5)),children:["No data available for ",null==e?void 0:e.deltaTimeDimension.truncate," comparison"]}):null===(null==e?void 0:e.deltaTimeDimension)||!1===t?null:c.jsxs(zd,{margin:0,className:Zl(""+Aa.textSize("xs"),""+Aa.opacity(.5)),children:["Comparing ",null==e?void 0:e.deltaTimeDimension.truncate," over ",null==e?void 0:e.deltaTimeDimension.truncate]})},$b=function(){var e=t.useRef(null),n=t.useState(0),r=n[0],i=n[1];return t.useEffect((function(){i(e.current?e.current.clientWidth:0),window.addEventListener("resize",(function(){i(e.current?e.current.offsetWidth:0)}))})),[e,r]},ex={name:"n294es",styles:"position:relative;display:flex;padding-top:0.25rem;text-align:left;font-size:3rem;line-height:1;font-weight:600;letter-spacing:0.1em"},tx=function(e){var n,r=e.results[0],o=e.results[1],a=t.useState(null),l=a[0],s=a[1];if(t.useEffect((function(){if(r&&e.measure){var t=Ho(r,lt(e.measure));-1!==t&&s(t)}}),[r,e.measure]),null===l)return null;var u=null==r?void 0:r.content[0][l],d=function(e,t){var n={};return t.forEach((function(t){if("fontColor"==t.ruleType&&Zo({op:t.operator,value:t.value},e))return n.color=t.ruleValue})),n}(u,i.filter(e.conditionalFormattingRules,(function(t){return t.field==lt(e.measure)})));return c.jsxs("div",{children:[c.jsx("div",{children:e.showAggregateText&&c.jsxs("span",{className:""+Aa.textSize("sm"),children:[null==r||null==(n=r.fields[l])?void 0:n.publicName," (",e.supportedAggregates[e.measure.function].publicName.toLowerCase(),")"]})}),c.jsxs(Gd,{gap:"0.5rem",direction:"column",children:[c.jsx(zd,{children:c.jsx("p",{style:U({},d,{fontSize:e.fontSize}),css:ex,className:""+Aa.text,children:c.jsx(nx,{formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,measure:null==e?void 0:e.measure,value:u})})}),c.jsx(Jb,{index:l,result:o,deltaTimeDimension:null==e?void 0:e.deltaTimeDimension,formatter:null==e?void 0:e.formatter,postfixes:null==e?void 0:e.postfixes,prefixes:null==e?void 0:e.prefixes,measure:null==e?void 0:e.measure})]})]})},nx=function(e){var n=e.formatter[lt(e.measure)]||"_vizzly_to_2_dp",r=e.prefixes[lt(e.measure)]||"",i=e.postfixes[lt(e.measure)]||"",o=Ol().numberFormatOptions[n].formatter(null==e?void 0:e.value);return"No value"===o?c.jsx(t.Fragment,{children:o}):c.jsxs(t.Fragment,{children:[r,o,i]})},rx={type:"singleStat",prefixes:{},postfixes:{},fontSize:"30px",measure:[],displayTitle:"",displaySubject:"",formatter:{},filter:[],limit:500,conditionalFormattingRules:[],deltaTimeDimension:null},ix=function(e){var n,r,i,o,a,l,s,u,d,p={displayTitle:e.displayTitle,displaySubject:e.displaySubject,verified:e.protectedByOrganisation,library:null!=(n=e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:e.dataSet,componentType:null==(r=e)?void 0:r.type,parameters:null==(i=e)?void 0:i.parameters,measure:null==(o=e)?void 0:o.measure},f=$b(),m=f[0],h=f[1],v=$b(),g=v[0],b=v[1];if(!On(e.type).isRunnable(e))return c.jsx(uf,{title:"Missing parameters",children:uv({measure:e.measure,order:[],dimension:[]})});var x=e.results[0];if(Uo(x))return c.jsx(hc,{});if(Go(x))return c.jsx(df,{});if(Ko(x))return c.jsx(pf,U({},p));var y=h>380,w=(e=ta(e,{},rx)).measure.length,C=80*(w-1)+b*w<h-32;return c.jsxs(Tp,{queriesAreChanging:e.queriesAreChanging,overflowScroll:!0,children:[c.jsx(Rm,U({},p)),w>1?c.jsxs(t.Fragment,{children:[c.jsx("div",{css:y?[{height:"100%",width:"100%"}]:[{width:"100%"}],ref:m,children:c.jsx(Gd,{direction:y?"row":"column",height:"100%",gap:y?80:"2rem","data-component":"stat-container",alignItems:y?"center":void 0,justifyContent:y&&C?"center":void 0,children:[].concat(e.measure).map((function(t,n){var r;return c.jsx("div",{ref:g,children:c.jsx(tx,{index:n,showAggregateText:w>1,supportedAggregates:e.supportedAggregates,measure:t,prefixes:e.prefixes,postfixes:e.postfixes,fontSize:e.fontSize,formatter:e.formatter,conditionalFormattingRules:e.conditionalFormattingRules,results:e.results,deltaTimeDimension:null==(r=e)?void 0:r.deltaTimeDimension})},n)}))})}),c.jsx(zd,{marginTop:"2rem",children:c.jsx(Zb,{deltaTimeDimension:null==(a=e)?void 0:a.deltaTimeDimension,results:null==(l=e)?void 0:l.results})})]}):c.jsxs(es,{placeContent:"center","data-component":"stat-container",height:"100%",children:[c.jsx(tx,{index:1,showAggregateText:w>1,supportedAggregates:e.supportedAggregates,measure:e.measure[0],prefixes:e.prefixes,postfixes:e.postfixes,fontSize:e.fontSize,formatter:e.formatter,conditionalFormattingRules:e.conditionalFormattingRules,results:e.results,deltaTimeDimension:null==(s=e)?void 0:s.deltaTimeDimension},1),c.jsx(zd,{marginTop:"1rem",children:c.jsx(Zb,{deltaTimeDimension:null==(u=e)?void 0:u.deltaTimeDimension,results:null==(d=e)?void 0:d.results})})]})]})};ix.defaultProps=rx;var ox=function(e){var t,n,r=e.component,i=r.results,o=r.attributes,a=Uh(o,e.runQueriesCallback,e.setResults,{localFilters:r.localFilters,globalFilters:e.globalFilters},e.dataSet);return c.jsx(ix,U({},o,{id:e.id,dataSet:e.dataSet,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:null==e?void 0:e.setParameterUpdate,results:i,queriesAreChanging:a.queriesAreChanging,supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,supportedTransformationFunctions:null==e||null==(t=e.dashboardBehaviour)||null==(n=t.queryEngineConfig)?void 0:n.supportedTransformationFunctions,library:null==e?void 0:e.library}))};function ax(e){return e>0}function lx(e){return e.total>=e.limit}var sx=pa(U({minWidth:"100%",overflow:"overlay"},Kd)),ux=Object.assign((function(){return null}),{table:pa({textIndent:"0",borderColor:"inherit",borderCollapse:"collapse",tableLayout:"fixed"}),wrapper:sx,th:function(e){var t,n,r,i,o;return pa({padding:null==e?void 0:e.padding,display:"table-cell",position:"relative",fontSize:null==e?void 0:e.fontSize,fontWeight:null==e?void 0:e.fontWeight,background:null==e?void 0:e.background,color:null==e?void 0:e.color,whiteSpace:"nowrap",textAlign:"left",borderTop:null==e?void 0:e.borderTop,borderRight:null==e?void 0:e.borderRight,borderBottom:null==e?void 0:e.borderBottom,variants:{first:{true:{borderLeft:null==e||null==(t=e.first)?void 0:t.borderLeft}},last:{true:{borderRight:null==e||null==(n=e.last)?void 0:n.borderRight}},rowScope:{true:{background:null==e||null==(r=e.column)?void 0:r.background}},hover:{true:{"&:hover":{color:null==e||null==(i=e["&:hover"])?void 0:i.color,background:null==e||null==(o=e["&:hover"])?void 0:o.background}}}}})},td:function(e){var t,n,r,i,o,a,l,s,u,d,c,p;return pa({verticalAlign:"top",overflow:"hidden",position:"relative",whiteSpace:"nowrap",borderLeft:null==e||null==(t=e.body)||null==(n=t.cells)?void 0:n.borderLeft,borderRight:null==e||null==(r=e.body)||null==(i=r.cells)?void 0:i.borderRight,borderBottom:null==e||null==(o=e.body)||null==(a=o.cells)?void 0:a.borderBottom,fontSize:null==e||null==(l=e.body)||null==(s=l.cells)?void 0:s.fontSize,padding:null==e||null==(u=e.body)||null==(d=u.cells)?void 0:d.padding,variants:{first:{true:{borderLeft:null==e||null==(c=e.body)?void 0:c.borderLeft}},last:{true:{borderRight:null==e||null==(p=e.body)?void 0:p.borderRight}},align:{alignLeft:{textAlign:"left"},alignRight:{textAlign:"right"}}}})},tr:function(e){var t,n,r,i,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y;return pa({position:"relative",cursor:"default",variants:{even:{true:{background:null==e||null==(t=e.body)||null==(n=t.even)?void 0:n.background,color:null==e||null==(r=e.body)||null==(i=r.even)?void 0:i.color,"&:hover":{background:null==e||null==(o=e.body)||null==(a=o.even)||null==(l=a["&:hover"])?void 0:l.background,color:null==e||null==(s=e.body)||null==(u=s.even)||null==(d=u["&:hover"])?void 0:d.color}}},odd:{true:{background:null==e||null==(c=e.body)||null==(p=c.odd)?void 0:p.background,color:null==e||null==(f=e.body)||null==(m=f.odd)?void 0:m.color,"&:hover":{background:null==e||null==(h=e.body)||null==(v=h.odd)||null==(g=v["&:hover"])?void 0:g.background,color:null==e||null==(b=e.body)||null==(x=b.odd)||null==(y=x["&:hover"])?void 0:y.color}}}}})},showMoreButton:function(e){var t;return pa(U({color:null==e||null==(t=e.odd)?void 0:t.color,background:"transparent",padding:"0 4px 0 4px",minWidth:20,fontSize:"100%",border:0,fontWeight:300,alignSelf:"flex-end",position:"absolute",right:0,top:"40%",marginBottom:1},ca,{"&:hover":U({},ca,{opacity:.5}),"> svg":{marginTop:-2},"> span":{height:10,lineHeight:"1px",display:"block"}}))},tdContentWrapper:function(e){return pa({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"clip","> span":{fontSize:null!=e?e:"inherit"}})},thInner:function(e){var t,n;return pa({position:"relative",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:null==e||null==(t=e.inner)?void 0:t.padding,borderBottomWidth:null==e||null==(n=e.inner)?void 0:n.borderBottomWidth})},thLabel:function(e){return pa({textTransform:null==e?void 0:e.textTransform})},thButton:function(){return pa({marginTop:1,WebkitLineClamp:1,width:"calc(100% - 20px)",textTransform:"inherit",fontWeight:"inherit"})},thGroupRow:function(e){var t,n,r,i,o,a,l,s,u,d,c,p,f,m,h,v,g,b,x,y,w,C,j,S,F,k;return pa(U({display:"table-cell",position:"relative",fontWeight:null==e||null==(t=e.th)||null==(n=t.group)?void 0:n.fontWeight,fontSize:null==e||null==(r=e.th)||null==(i=r.group)?void 0:i.fontSize,background:null==e||null==(o=e.th)||null==(a=o.column)?void 0:a.background,textTransform:null==e||null==(l=e.th)||null==(s=l.group)?void 0:s.textTransform,color:null==e||null==(u=e.th)||null==(d=u.column)?void 0:d.color,whiteSpace:"nowrap",textAlign:"left",borderRight:null==e||null==(c=e.th)||null==(p=c.column)?void 0:p.borderRight,borderLeft:null==e||null==(f=e.th)||null==(m=f.column)?void 0:m.borderLeft,borderBottom:null==e||null==(h=e.body)||null==(v=h.cells)?void 0:v.borderBottom,padding:null==e||null==(g=e.th)||null==(b=g.column)?void 0:b.padding},ca,{variants:{first:{true:{borderLeft:null==e||null==(x=e.body)?void 0:x.borderLeft}},last:{true:{borderRight:null==e||null==(y=e.body)?void 0:y.borderRight}},deadSpace:{true:{borderBottom:null==e||null==(w=e.th)||null==(C=w.row)?void 0:C.borderBottom,borderRight:0,borderLeft:null==e||null==(j=e.th)||null==(S=j.column)?void 0:S.borderLeft}},level:{2:{background:null==e||null==(F=e.th)||null==(k=F.level)?void 0:k[2].background}}}}))},thGroupColumn:function(e){var t,n,r,i,o,a,l,s,u;return pa(U({display:"table-cell",position:"relative",fontWeight:null==e||null==(t=e.group)?void 0:t.fontWeight,fontSize:null==e||null==(n=e.group)?void 0:n.fontSize,textTransform:null==e||null==(r=e.group)?void 0:r.textTransform,background:null==e?void 0:e.background,color:null==e?void 0:e.color,whiteSpace:"nowrap",textAlign:"left",borderTop:null==e?void 0:e.borderTop,borderRight:null==e?void 0:e.borderRight,borderLeft:null==e?void 0:e.borderRight,borderBottom:null==e||null==(i=e.row)?void 0:i.borderBottom,padding:null==e||null==(o=e.row)?void 0:o.padding},ca,{variants:{first:{true:{borderLeft:null==e||null==(a=e.first)?void 0:a.borderLeft}},last:{true:{borderRight:null==e||null==(l=e.last)?void 0:l.borderRight}},hover:{true:{"&:hover":U({},ca,{color:null==e||null==(s=e["&:hover"])?void 0:s.color,background:null==e||null==(u=e["&:hover"])?void 0:u.background})}}}}))}}),dx=pa({textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}),cx=function(e){var n=e.columnIndex,r=e.type,i=e.fieldKey,o=e.onResized,a=e.width,l=t.useState(!1),s=l[0],u=l[1],d=b.useDrag({type:r,item:{columnIndex:n,fieldKey:i,width:a},collect:function(e){return{isDragging:e.isDragging()}},end:function(e,t){var n=t.getDifferenceFromInitialOffset();n&&o({columnIndex:e.columnIndex,fieldKey:i,width:e.width+n.x})}}),p=d[0],f=d[1],m=d[2];return t.useEffect((function(){if(m){var e=new Image;e.src=function(e,t){var n=document.createElement("canvas");n.width=1,n.height=1;var r=n.getContext("2d");return r&&(r.fillStyle="transparent",r.fillRect(0,0,1,1)),n.toDataURL()}(),e.onload=function(){return m(e)}}}),[m]),c.jsx("div",{className:""+px,ref:f,onMouseEnter:function(){return u(!0)},onMouseLeave:function(){return u(!1)},children:c.jsx("span",{className:""+fx({onHover:p.isDragging||s?"true":"false"})})})},px=pa({position:"absolute",right:-8,top:0,bottom:0,width:16,zIndex:1,cursor:"ew-resize"}),fx=pa({position:"absolute",top:4,bottom:4,right:6,transitionDuration:"100ms",transitionProperty:"all",transitionTimingFunction:"cubic-bezier(0.4,0,0.2,1)",borderRightWidth:3,borderRightStyle:"solid",variants:{onHover:{true:{borderRightColor:us.colors.blue},false:{borderRightColor:"transparent"}}}}),mx=t.forwardRef((function(e,t){return c.jsx("div",{ref:t,className:"vizzly-data-table "+ux.wrapper,children:c.jsx("table",{className:""+ux.table,children:e.children})})})),hx={name:"1pghby6",styles:"position:relative;box-sizing:border-box"},vx=t.forwardRef((function(e,n){var r,i,o,a,l=e.clickEnabled,s=rs(),u={first:e.first&&"true",last:e.last&&"true",hover:e.hover&&"true",level:null==e?void 0:e.level},d=t.useMemo((function(){return null!=e&&e.deadSpace||"row"===(null==e?void 0:e.scope)?"tables.th.column":null!=e&&e.group?"tables.th.row":e.level?"tables.th.level."+e.level:"tables.th"}),[null==e?void 0:e.deadSpace,null==e?void 0:e.scope,null==e?void 0:e.group]);return c.jsxs("th",{scope:null!=(r=null==e?void 0:e.scope)?r:"column",className:Zl(null!=e&&e.group?"row"===(null==e?void 0:e.scope)?""+ux.thGroupRow(null==s?void 0:s.tables)(U({},u,{deadSpace:(null==e?void 0:e.deadSpace)&&"true"})):""+ux.thGroupColumn(null==s||null==(o=s.tables)?void 0:o.th)(u):""+ux.th(null==s||null==(i=s.tables)?void 0:i.th)(U({},u,{rowScope:"row"===(null==e?void 0:e.scope)&&"true"}))),style:e.cellStyles,"data-themeapi":d,"data-chipposition":"top.left","data-first":e.first?"true":"false","data-last":e.last?"true":"false","data-hover":e.hover?"true":"false","data-deadspace":e.deadSpace?"true":"false",colSpan:e.colSpan,role:l?"button":void 0,tabIndex:l?0:void 0,"data-clickenabled":l?"true":"false",onClick:null==e?void 0:e.onClick,onKeyDown:function(t){null!=e&&e.onClick&&"Enter"===t.key&&(null==e||e.onClick())},children:[(null==e?void 0:e.dragSettings)&&c.jsx(cx,U({},null==e?void 0:e.dragSettings)),c.jsx("div",{css:hx,style:e.columnStyles,children:c.jsx("div",{className:""+ux.thInner(null==s||null==(a=s.tables)?void 0:a.th),ref:n,"data-themeapi":"tables.th.inner",children:c.jsxs(Gd,{as:"span",overflow:"hidden",alignItems:"center",gap:"0.5rem","data-component":"th-inner",paddingLeft:null!=e&&e.level&&1!==(null==e?void 0:e.level)?20*(null==e?void 0:e.level):void 0,children:[(null==e?void 0:e.expand)&&c.jsx(Cc,U({},e.expand,{label:null!=e&&e.expand.expanded?"Collapse "+(null==e?void 0:e.expand.label):"Expand "+e.expand.label,arrowStart:"side"})),e.children]})})})]})})),gx={name:"1flj9lk",styles:"text-align:left"},bx={name:"6r56vi",styles:"height:1rem;width:1rem"},xx=t.forwardRef((function(e,n){var r=t.useRef(null),i=e.label,o=function(e,n){var r=t.useState(!1),i=r[0],o=r[1];return t.useEffect((function(){var t,r=e.current;n&&r&&((r.offsetHeight<r.scrollHeight||r.offsetWidth<r.scrollWidth)&&o(!0),e.current&&(t=e.current).offsetWidth<t.scrollWidth&&o(!0))}),[e.current]),i}(r,i),a=t.useCallback((function(e){"function"==typeof n?n(e):null!=n&&(n.current=e),r.current=e}),[n,r]);return rs(),c.jsxs(t.Fragment,{children:[c.jsx("button",{onClick:function(){return e.onChange&&e.onChange()},css:gx,ref:a,className:Zl(o?""+dx:void 0,""+Aa.button,""+ux.thButton()),"data-testid":e.testIdPrefix+"-title",children:o?c.jsx(cp,{placement:"bottom-start",tooltipContent:function(){return c.jsx(cp.Content,{children:i})},className:""+dx,modifiers:[{name:"offset",options:{offset:[-50,10]}}],showTooltip:e.showTooltip,children:c.jsx(yx,{children:i})}):c.jsx(yx,{children:i})}),e.onSort&&c.jsxs("button",{type:"button",onClick:function(){return e.onSort&&e.onSort()},className:""+Aa.button,"aria-label":"Sort",css:bx,"data-testid":e.testIdPrefix+"-sort",children:[!e.direction&&c.jsx(v.SelectorIcon,{}),"asc"===e.direction&&c.jsx(v.ChevronUpIcon,{}),"desc"===e.direction&&c.jsx(v.ChevronDownIcon,{})]})]})})),yx=function(e){var t,n=rs();return c.jsx("span",{className:""+ux.thLabel(null==n||null==(t=n.tables)?void 0:t.th),children:e.children})},wx={name:"agbev0",styles:"min-width:100%;overflow:scroll;border-bottom-width:1px"},Cx=Object.assign((function(){return null}),{Wrapper:mx,Head:function(e){return c.jsx("thead",{children:e.children})},Body:function(e){return c.jsx("tbody",{css:wx,children:e.children})},TR:function(e){var t,n=rs();return c.jsx("tr",{"data-themeapi":e.odd?"tables.body.odd":"tables.body.even",className:""+ux.tr(null==n?void 0:n.tables)({odd:e.odd&&"true",even:e.even&&"true"}),"data-chipposition":"top.left","aria-expanded":!0===e.expanded?"true":!1===(null==e?void 0:e.expanded)?"false":void 0,"aria-level":null!=(t=e.level)?t:void 0,children:e.children})},TD:function(e){var r,i,o,a,l,s,u=rs(),d=n.useState(!1),p=d[0],f=d[1],m=e.clickEnabled,h=e.first,g=t.useRef(null);return t.useEffect((function(){var t,n,r=g.current;"number"==typeof(null==(t=e.style)?void 0:t.width)&&r&&f((null==(n=e.style)?void 0:n.width)<r.offsetWidth+16)}),[g.current,null==(r=e.style)?void 0:r.width]),c.jsxs("td",{style:U({},e.style),className:""+ux.td(null==u?void 0:u.tables)({first:e.first&&"true",last:e.last&&"true",align:null!=(i=e.align)?i:"alignRight"}),role:m?"button":void 0,tabIndex:m?0:void 0,"data-clickenabled":m?"true":"false",onClick:null==e?void 0:e.onClick,onKeyDown:function(t){null!=e&&e.onClick&&"Enter"===t.key&&(null==e||e.onClick())},"data-themeapi":"tables.body.cells","data-first":h?"true":"false","data-last":e.last?"true":"false",children:[c.jsx("div",{className:""+ux.tdContentWrapper(null==u||null==(o=u.tables)||null==(a=o.body)||null==(l=a.cells)?void 0:l.fontSize),style:function(t){var n,r,i,o="number"==typeof(null==(n=e.style)?void 0:n.width)?(null==(r=e.style)?void 0:r.width)-(t?36:16):null==(i=e.style)?void 0:i.width;return{width:o,minWidth:o}}(p),children:c.jsx("span",{ref:g,children:e.children})}),p&&c.jsx("button",{"aria-label":"string"==typeof e.children?"Show more: "+e.children:"Show more",onClick:function(){return e.onShowMore&&e.onShowMore()},className:""+ux.showMoreButton(null==u||null==(s=u.tables)?void 0:s.body),children:c.jsx(v.DotsHorizontalIcon,{})})]})},TH:vx,THButton:xx,THLabel:yx,HeadTR:function(e){return c.jsx("tr",{children:e.children})}}),jx=Object.assign(Cx.Wrapper,{Wrapper:Cx.Wrapper,Head:Cx.Head,Body:Cx.Body,TR:Cx.TR,TD:Cx.TD,TH:Cx.TH,THLabel:Cx.THLabel,THButton:Cx.THButton,HeadTR:Cx.HeadTR}),Sx=function(e){return c.jsx(Gd,{direction:"column",children:null==e?void 0:e.children})};function Fx(e){return null===e?"asc":"asc"===e?"desc":null}var kx=function(e){var n=i.debounce(e.onSetExportName),r=Object.entries(e.numberFormatOptions).map((function(e){return{label:e[1].description,value:e[0]}}));return c.jsx(t.Fragment,{children:e.open&&c.jsx(qd,{onClose:function(){return null==e?void 0:e.close()},width:220,position:null==e?void 0:e.triggerPosition,align:"right",children:c.jsxs(qd.Options,{padding:!0,children:[c.jsx(qd.Option,{children:c.jsx(Sx,{children:c.jsx(np,{label:"Title",id:"table-header-title","data-testid":"table-header-title",defaultValue:e.exportName,placeholder:e.originalPublicName,onChange:function(t){n(e.fieldId,t.target.value?t.target.value:void 0)}})})}),"number"==e.dataType&&c.jsx(qd.Option,{children:c.jsx(Sx,{children:c.jsx(Ac,{label:"Format",id:"table-header-format",testId:"table-header-format",showClearBtn:!0,selected:e.currentNumberFormat,options:r,onChange:function(t){e.onSetNumberFormat(t)}})})})]})})})},Tx=function(e){var t=e.fieldIndex,n=e.currentOrder,r=e.exportName,i=e.currentNumberFormat,o=e.fields[t],a={width:e.width,maxWidth:e.width,minWidth:e.width},l=Wd(),s=l.ref,u=l.show,d=l.position,p=l.close,f=l.open,m={fontFamily:a.fontFamily,translate:e.columnOffset+"px"};return e.isImpactedColumn&&(m.opacity=.1),c.jsxs(jx.TH,{cellStyles:a,columnStyles:m,first:0===t,last:null==e?void 0:e.last,hover:!0,group:!1,scope:null==e?void 0:e.scope,dragSettings:{columnIndex:t,type:e.id,fieldKey:o.datumKey,onResized:null==e?void 0:e.onResizedColumn,width:e.width},children:[c.jsx(jx.THButton,{onChange:function(){return f()},direction:n?null==n?void 0:n.direction:void 0,label:r||o.publicName,onSort:at(o)?void 0:function(){var t,r=nt(o.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});null==e.onOrderChange||e.onOrderChange({fieldId:r.field,function:r.function,direction:Fx(null!=(t=null==n?void 0:n.direction)?t:null)})},ref:s,testIdPrefix:"column-"+(null==o?void 0:o.id)}),c.jsx(kx,{open:u,triggerPosition:d,close:p,exportName:e.exportName||o.publicName,fieldId:o.datumKey,originalPublicName:o.publicName,onSetExportName:e.onSetExportName,onSetNumberFormat:function(t){return e.onSetNumberFormat(o.datumKey,t)},currentNumberFormat:i,numberFormatOptions:e.numberFormatOptions,dataType:o.dataType})]})},Ax=Object.assign((function(e){var n=e.content,r=t.useState(!1),i=r[0],o=r[1];return c.jsxs(Gd,{gap:"0.5rem",children:[c.jsx(zd,{textWrap:!0,flex:1,hyphens:"none",children:n}),c.jsxs(zd,{width:"2rem",position:"relative",children:[c.jsx(Ax.Button,{onClick:function(){"string"==typeof n&&(B(n),o(!0),setTimeout((function(){return o(!1)}),2e3))},copied:i}),c.jsx(Ax.Success,{copied:i})]})]})}),{Button:function(e){return c.jsxs("button",{onClick:function(){return null==e?void 0:e.onClick()},"aria-label":"Copy content",className:""+Aa.button,children:[!(null!=e&&e.copied)&&c.jsx("svg",{height:24,width:24,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:null==e?void 0:e.iconStyles,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z"})}),(null==e?void 0:e.copied)&&c.jsx("svg",{height:24,width:24,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",style:null==e?void 0:e.iconStyles,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0118 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3l1.5 1.5 3-3.75"})})]})},Success:function(e){return c.jsx(t.Fragment,{children:(null==e?void 0:e.copied)&&c.jsx("div",{style:{position:"absolute",right:0},className:""+dp.popover,children:"Copied!"})})}}),Dx=function(e){return c.jsxs(If,{onClose:function(){return null==e?void 0:e.onCloseModal()},isOpen:null==e?void 0:e.open,width:"sm",children:[c.jsx(If.Content,{children:c.jsx(Yg.Container,{children:c.jsx(Yg.Panel,{as:"div",children:c.jsx(Ax,{content:null==e?void 0:e.content})})})}),c.jsx(If.Footer,{buttons:"end",children:c.jsx(Ip,{secondary:!0,onClick:function(){return null==e?void 0:e.onCloseModal()},children:"Close"})})]})},Ix=pa({height:"1.25rem",width:"1.25rem","&:disabled":{opacity:.4}}),Px=pa({fontSize:13}),_x=function(e){var t,n;return c.jsxs(Gd,{justifyContent:"flex-end",alignItems:"center",margin:"0.5rem 0 0 0",children:[c.jsxs("span",{className:""+Px,children:["Page ",(null!=(t=e.offset)?t:0)/(null!=(n=e.limit)?n:1)+1]}),e.onPrevious&&c.jsx("button",{disabled:null==e?void 0:e.previousDisabled,onClick:e.onPrevious,"aria-label":"Previous",className:Aa.button+" "+Ix,children:c.jsx(v.ChevronLeftIcon,{})}),e.onNext&&c.jsx("button",{"aria-label":"Next",disabled:null==e?void 0:e.nextDisabled,className:Aa.button+" "+Ix,onClick:e.onNext,children:c.jsx(v.ChevronRightIcon,{})})]})},Ex=function(e,t){return t[e]?t[e]:No(e)?t[Bo(e)]:void 0},Ox=function(e){for(var t,n=[],r=function(){var e=t.value,r=n.find((function(t){return t.content===e}));r?r.colSpan+=1:n.push({content:e,colSpan:1})},i=te(e);!(t=i()).done;)r();return n},Lx=function(e,t,n,r,o,a,l,s,u,d,c){if(!e)return null;var p=[],f=[],m=void 0,h=function(e,t){var n="";return t&&"none"!=t&&(n=" ("+u[t].publicName+")"),""+e+n};if(e&&"dataTable"==t.type){var v=Ut(t),g=Gt(t),b=function(e,t,n,r){var o=i.groupBy(t,(function(e){return e.pivot||"x"})),a={x:(o.x||[]).map((function(e){return lt(e)})),y:(o.y||[]).map((function(e){return lt(e)}))},l=Vo(e,n,a,void 0,r),s=[].concat(a.x).map((function(t){return U({},Yo(e,t),{datumKey:t})})),u=[],d=Wo(a,n,e);return l.forEach((function(e){u.push([].concat(e.xValues,i.cloneDeep(d).map((function(t){return void 0===e[t]?null:e[t]}))))})),d.forEach((function(t){var n=zo(t),r=lt({field:n.fieldId,function:n.function}),i=Yo(e,r),o=Mo(n.dimensionKeys,n.dimensionValues,n.fieldId,n.function);s.push({id:r,datumKey:o,publicName:i.publicName,dataType:"number"})})),{fields:s,content:u}}(e,g,v,c);m=function(e,t,n,r,o){if(!i.some(t,(function(e){return"y"==e.pivot}))||!e)return!1;var a=n.flatMap((function(t){if(No(t.datumKey)){var n=zo(t.datumKey);return[n.dimensionValues.map((function(t,i){return function(e,t,n,r,i){var o=Ee(t,i);if(e&&o){var a=Yo(e,t),l=i[o.truncate].dateFormat,s="date_time"==(null==a?void 0:a.dataType)?new Date(n):n;return Je(s,r[l].formatter)||""+n}return""+n}(e,n.dimensionKeys[i],t,r,o)})).join(", ")]}return[]})),l=i.cloneDeep(t).flatMap((function(e){return"y"==e.pivot?[]:[{colSpan:1,content:"",rowGroup:!0}]}));return{consolidated:[].concat(l,Ox(a)),unconsolidated:[].concat(l,a.map((function(e){return{colSpan:1,content:e}})))}}(e,g,b.fields,a,d),f=b.content,p=b.fields}else e&&e.fields.forEach((function(e){p.push(U({},e,{datumKey:Mo([],[],e.id,"none")}))}));return p=p.map((function(e){var t=e.publicName,r="none",i=function(e,t){return t[e]?t[e]:No(e)?t[Bo(e)]:void 0}(e.datumKey,n||{});return i?t=i:No(e.datumKey)&&(r=zo(e.datumKey).function),U({},e,{publicName:i||h(t,r)})})),f=Rx(p,"dataTable"==t.type?f:e.content,r,o,a,l,s,c),{groupTitles:m,fields:p,content:f}},Rx=function(e,t,n,r,i,o,a,l){return t.map((function(t){return t.map((function(t,s){var u,d=e[s],c=n?function(e,t){var n;return null==(n=e.find((function(e){var n=t.id;return No(n)?Bo(n)==e.field:n==e.field})))?void 0:n.prefix}(n,e[s]):"",p=r?i[r].formatter:function(e){return e.toISOString()},f=o?Ex(null!=(u=d.datumKey)?u:"",o):"",m=a[f||""];return{value:t,displayValue:""+(null!=c?c:"")+(m&&"number"==d.dataType?m.formatter(t,l):Je(function(e,t){if(null===e)return null;switch(t){case"boolean":return!!e;case"date_time":return new Date(e);case"number":return Number(e);case"string[]":return""+(Array.isArray(e)?Qe(e,!1):""+e);case"string":return""+e}}(t,d.dataType),p,l))}}))}))};function Mx(e,t,n,r){var i,o;return r&&r.hasOwnProperty(e)?r[e]:null!=(i=null==(o=t[e])?void 0:o.width)?i:n}var Nx=function(e){var n=e.row,r=e.rowIndex,o=e.tableRepresentation,a=e.dimension,l=e.conditionalFormattingRules,u=e.dataSet,d=e.protectedFields,p=e.drilldownAction,f=Ol().queryEngineConfig;return c.jsx(t.Fragment,{children:n.map((function(t,m){if(null!=o&&o.fields[m].hidden)return null;if(null==o)return null;var h,v,g=o.fields[m],b=e.drilldown.length>0&&0===m,x=Mx(g.datumKey,null==e?void 0:e.sizing,null==e?void 0:e.defaultColumnWidth,null==e?void 0:e.alternativeColumnSizing);if(No(g.datumKey)){var y=zo(g.datumKey),w={};null==o||o.fields.forEach((function(e,t){var r,i;w[y.fieldId]=null==(r=n[t])?void 0:r.value,w[e.datumKey]=null==(i=n[t])?void 0:i.value})),y.dimensionKeys.forEach((function(e,t){w[e]=y.dimensionValues[t]}));var C=oa(a,l,w,g.datumKey,u);C&&(h=function(e){var t,n=e.rule,r=e.ruleValue,o=(t=r,i.maxBy(["white","black"],(function(e){return s.contrast(e,t)}))||t);switch(n){case"fontColor":return{color:r};case"backgroundColor":return{backgroundColor:r,color:o}}return{}}({rule:C.ruleType,ruleValue:C.ruleValue}))}return zb(a,g.id,{supportedAggregates:f.supportedAggregates,supportedTimeTruncFunctions:f.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0})?c.jsx(jx.TH,{first:0===m,last:m+1===n.length,group:!0,scope:"row",onClick:function(){return e.onViewClick(r,m,t.value,g.datumKey)},clickEnabled:$h(d),expand:p&&b?{expanded:null==p?void 0:p.expanded,onClick:function(){return null==p?void 0:p.onExpanded(null!=p&&p.expanded?void 0:r)},label:""+t.displayValue}:void 0,level:null!=(v=null==e?void 0:e.level)?v:void 0,children:"undefined"!==t.displayValue?t.displayValue:""},"table_row_"+r+"_cell_"+m):c.jsx(jx.TD,{first:0===m,last:m+1===n.length,onClick:function(){return e.onViewClick(r,m,t.value,g.datumKey)},align:"number"==g.dataType?"alignRight":"alignLeft",clickEnabled:$h(d),style:U({},null==e?void 0:e.cellStyles,h||{},{width:x,maxWidth:x,minWidth:x}),onShowMore:function(){return null==e?void 0:e.setShowMore(t.displayValue)},children:void 0!==t.displayValue?t.displayValue:""},"table_row_"+r+"_cell_"+m+"_"+JSON.stringify(t.displayValue)+"}")}))})},zx=function(e){var r=n.useState(void 0),i=r[0],o=r[1],a=e.rowIndex,l=e.dataSet,s=e.drilldown;t.useEffect((function(){return o(void 0)}),[e.queriesAreChanging]);var u=t.useState(),d=u[0],p=u[1],f=void 0!==i,m=s&&(null==s?void 0:s.length)>0,h=Ol().queryEngineConfig;return c.jsxs(t.Fragment,{children:[c.jsx(jx.TR,{odd:a%2!=0,even:a%2==0,level:s?1:void 0,expanded:s?f:void 0,children:c.jsx(Nx,U({},e,{drilldownAction:m?{onExpanded:function(t){if(void 0!==t){var n=function(e,t,n){return qx(t).map((function(t){var r,i,o,a=(o=Nb(t),e.fields.findIndex((function(e){return e.id===o})));return(i={})[t.field]=null==(r=e.content[n][a])?void 0:r.value,i}))}(e.tableRepresentation,e.dimension,t);null!==n&&o(n)}else o(void 0)},expanded:f}:void 0,onViewClick:function(t,n,r){e.handleOnChange(t,n,r,Zh(null==e?void 0:e.tableRepresentation.fields,h,e.row))}}))}),(null==e?void 0:e.drilldownInputProps)&&f&&m&&c.jsx(Bx,{setResults:function(e){return p({results:e})},dataSet:l,result:null==d?void 0:d.results[0],drilldownInputProps:null==e?void 0:e.drilldownInputProps,drilldown:s,selectedRow:i,tableRowProps:e,parentFields:e.tableRepresentation.fields,handleOnChange:e.handleOnChange,dimension:e.dimension})]})},Bx=function(e){var n,r,i,o,a,l,s,u,d,p,f=e.drilldownInputProps,m=f.component,h=f.runQueriesCallback,v=Ol(),g=v.queryEngineConfig,b=v.numberFormatOptions,x=v.dateTimeFormatOptions,y=(o=m.attributes,a=nt(e.drilldown[0].subsetDimension,g),l=e.dimension,p=(s=e.selectedRow).map((function(e){return Object.keys(e)})).flat(),u=o.filter.filter((function(e){return e.every((function(e){return!p.includes(e.field)}))})),(d=[].concat(u)).push(s.map((function(e){var t,n=Object.keys(e)[0];return{field:n,op:"=",value:e[n],function:(null==(t=l.find((function(e){return e.field===n})))?void 0:t.function)||"none"}}))),U({},o,{dimension:(n=o.dimension,r=a,i=n.filter((function(e){return"x"!==e.pivot})),[].concat(i,[U({},r)])),order:[{field:a.field,direction:"asc",function:a.function||"none"}],filter:d}));Uh(y,h,null==e?void 0:e.setResults,{localFilters:m.localFilters,globalFilters:e.drilldownInputProps.globalFilters},e.dataSet);var w=t.useMemo((function(){return Lx(e.result,y,y.exportNames,y.prefixes,y.dateTimeFormat,x,y.numberFormat,b,g.supportedAggregates,g.supportedTimeTruncFunctions)}),[e.result,y,g,b,x]),C=null==e?void 0:e.tableRowProps.row.length;return Uo(e.result)?c.jsx(jx.TR,{level:2,children:c.jsx(jx.TH,{colSpan:C,children:c.jsx(hc,{minHeight:30})})}):Go(e.result)?c.jsx(df,{}):c.jsx(t.Fragment,{children:(null==w?void 0:w.content)&&c.jsx(t.Fragment,{children:(null==w?void 0:w.content.length)>0?null==w?void 0:w.content.map((function(t,n){var r=function(e,t,n,r,i){return 0===e.length?[{value:r[0].value,displayValue:r[0].displayValue}]:e.map((function(e,o){if(0===o)return r[0];var a=t.fields.findIndex((function(t){return t.datumKey===e.datumKey})),l=i.find((function(t){return t.field===e.id}));return-1!==a?t.content[n][a]:l?{value:null,displayValue:""}:{value:null,displayValue:"No value"}}))}(e.parentFields,w,n,t,qx(e.dimension));return c.jsx(jx.TR,{level:2,odd:n%2!=0,even:n%2==0,children:c.jsx(Nx,U({},null==e?void 0:e.tableRowProps,{row:r,rowIndex:n,drilldownAction:void 0,level:2,subsetTableRepresentation:w,onViewClick:function(t,n,i,o){e.handleOnChange(t,n,i,Zh(e.parentFields,g,r,w.fields,e.drilldown[0]),function(e,t,n,r,i,o,a){var l=nt(e.subsetDimension,t),s=function(){var e=[{fieldId:l.field,function:l.function,aggregate:l.function,value:r}];return a.forEach((function(t){var r;"x"===t.pivot&&e.push({fieldId:t.field,function:t.function,aggregate:t.function,value:(null==n||null==(r=n.find((function(e){return Object.keys(e)[0]===t.field})))?void 0:r[t.field])||""})})),e}();return{value:function(){if(No(o)){var n=zo(o);return{fieldId:n.fieldId,value:i,function:n.function,aggregate:n.function,datum:o}}var r=nt(e.subsetDimension,t);return{fieldId:r.field,value:i,function:r.function,aggregate:r.function,datum:o}}(),grouping:s}}(null==e?void 0:e.drilldown[0],g,e.selectedRow,w.content[t][0].value,r[n].value,o,e.dimension))}}))},"table_row_level_2_"+n)})):c.jsx(jx.TR,{level:2,children:c.jsx(jx.TH,{colSpan:C,children:"No Results"})})})})};function qx(e){return e.filter((function(e){return"x"===e.pivot}))}var Vx={type:"dataTable",measure:[],dimension:[],timeDimension:null,order:[],displayTitle:"",displaySubject:"",filter:[],limit:10,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[]},Wx=function(e){var n,r,i,o,a,l,s={displayTitle:e.displayTitle,displaySubject:e.displaySubject,verified:null==e?void 0:e.protectedByOrganisation,library:null!=(n=null==e?void 0:e.library)&&n,localFilters:e.localFilters,setLocalFilters:e.setLocalFilters,dataSet:e.dataSet,componentType:null==e?void 0:e.type},u=e.sizing,d=$b(),p=d[0],f=function(e,t){var n=e/t;return n<200&&(n=200),n>300&&(n=300),n}(d[1],((null==(r=e.result)?void 0:r.fields)||[]).length),m=b.useDragLayer((function(e){if(e.isDragging()){var t,n=e.getItem(),r=e.getDifferenceFromInitialOffset();if(null!==r&&n)return(t={})[null==n?void 0:n.fieldKey]=(null==n?void 0:n.width)+(null==r?void 0:r.x),t}})),h=function(t){var n;return null==e?void 0:e.onSizingUpdate(U({},u,((n={})[t.fieldKey]={width:t.width},n)))},v=t.useState(null),g=v[0],x=v[1],y=t.useMemo((function(){return Lx(e.result,e,e.exportNames,e.prefixes,e.dateTimeFormat,e.dateTimeFormatOptions,e.numberFormat,e.numberFormatOptions,e.supportedAggregates,e.supportedTimeTruncFunctions)}),[e]),w=(null!=(i=e.result)&&i.content?null==(o=e.result)?void 0:o.content.length:0)>(y?y.content.length:0),C=t.useMemo((function(){var t,n,r;return c.jsx(c.Fragment,{children:e.result&&!w&&c.jsx(_x,{offset:null==e?void 0:e.offset,limit:null==e?void 0:e.limit,onNext:null==e?void 0:e.onNext,onPrevious:null==e?void 0:e.onPrevious,previousDisabled:!ax(null!=(t=e.offset)?t:0),nextDisabled:!lx({offset:null!=(n=e.offset)?n:0,limit:null!=(r=e.limit)?r:0,total:y?y.content.length:0})})})}),[e.offset,e.limit,e.onPrevious,e.onNext,null==(a=e.result)?void 0:a.content.length,w]);if(null===y)return null;if(Ko(e.result))return c.jsx(pf,U({},s,{children:C}));if(!On(e.type).isRunnable(e))return c.jsx(uf,{title:"Missing parameters",children:uv(e)});if(Uo(e.result))return c.jsx(hc,{});if(Go(e.result))return c.jsx(df,{});var j=rs(),S={fontFamily:null==j?void 0:j.fontFamily},F=function(t,n,r,i,o){return function(e,t,n,r,i,o){var a=e.result,l=e.onViewClick,s=e.type;if(null!=a&&a.fields&&l){var u,d,c,p,f=(null==(u=a.fields[t])?void 0:u.id)||"",m=rt(f,{supportedAggregates:null==e?void 0:e.supportedAggregates,supportedTimeTruncFunctions:void 0,supportedTransformationFunctions:void 0}),h=m.fieldId,v=m.function,g=(null==(d=a.content)?void 0:d[n])||[],b=function(e,t){var n={};return e.forEach((function(e,r){n[e.id]=t[r]})),n}(a.fields,g);if("dataTable"===s){var x,y={fieldId:h,function:v,value:r,aggregate:v};c={grouping:Xh(e.dimension,b,o),value:null!=(x=null==o?void 0:o.value)?x:y}}else c={fieldId:f,value:r,function:"none",aggregate:"none"};$h(null==e?void 0:e.protectedFields)&&l({viewId:null!=(p=null==e?void 0:e.viewId)?p:"",type:s,fields:b,clicked:c,fieldsV2:i})}}(e,n,t,r,i,o)};return c.jsxs(Tp,{queriesAreChanging:e.queriesAreChanging,children:[c.jsx(zd,{marginBottom:null!=e&&e.displayTitle&&(null==e?void 0:e.displayTitle.length)>0?"0.4rem":void 0,children:c.jsx(Rm,U({},s))}),c.jsxs(La,{disabledFeatures:null!=(l=null==e?void 0:e.library)&&l,children:[c.jsxs(jx.Wrapper,{ref:p,children:[c.jsxs(jx.Head,{children:[y.groupTitles&&c.jsx(jx.HeadTR,{children:y.groupTitles.consolidated.map((function(e,t){var n,r;return c.jsx(jx.TH,{colSpan:e.colSpan,group:!0,last:t+1===((null==y?void 0:y.groupTitles)&&(null==y||null==(n=y.groupTitles)||null==(r=n.consolidated)?void 0:r.length)),scope:e.rowGroup?"row":void 0,deadSpace:e.rowGroup,children:e.content},e+"_"+t)}))}),c.jsx(jx.HeadTR,{children:y.fields.map((function(t,n){if(t.hidden)return null;var r=e.order.find((function(n){var r=nt(t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0});return n.field===r.field&&r.function==n.function})),i=!!zb(null==e?void 0:e.dimension,t.id,{supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,supportedTransformationFunctions:void 0}),o=Mx(t.datumKey,u,f,m);return c.jsx(Tx,{exportName:t.publicName,onSetExportName:e.onSetExportName,supportedAggregates:e.supportedAggregates,supportedTimeTruncFunctions:e.supportedTimeTruncFunctions,id:e.id,isImpactedColumn:!1,width:o,columnOffset:0,currentOrder:r,onOrderChange:e.onOrderChange,fieldIndex:n,numberFormatOptions:e.numberFormatOptions,currentNumberFormat:Ex(t.datumKey,e.numberFormat),onSetNumberFormat:e.onSetNumberFormat,fields:null==y?void 0:y.fields,last:n+1===(null==y?void 0:y.fields.length),scope:i?"row":void 0,onResizedColumn:h},"table_column_"+n)}))})]}),c.jsx(jx.Body,{children:y.content.map((function(t,n){return c.jsx(zx,{protectedFields:null==e?void 0:e.protectedFields,dataSet:null==e?void 0:e.dataSet,conditionalFormattingRules:null==e?void 0:e.conditionalFormattingRules,dimension:null==e?void 0:e.dimension,rowIndex:n,row:t,tableRepresentation:y,sizing:u,defaultColumnWidth:f,alternativeColumnSizing:m,handleOnChange:F,cellStyles:S,setShowMore:x,drilldown:e.tableDrilldown,drilldownInputProps:null==e?void 0:e.drilldownInputProps,queriesAreChanging:e.queriesAreChanging},n)}))})]}),C]}),c.jsx(Dx,{open:!!g,onCloseModal:function(){return x(null)},content:g})]})};Wx.defaultProps=Vx;var Hx=function(e){return c.jsx(b.DndProvider,{backend:q.HTML5Backend,children:c.jsx(Wx,U({},e))})},Yx=function(e){var t=e.component,n=t.results,r=t.attributes,o=Uh(r,e.runQueriesCallback,e.setResults,{localFilters:t.localFilters,globalFilters:e.globalFilters},e.dataSet).queriesAreChanging,a=n[0];if(a&&a.fields.length!=r.dimension.length+r.measure.length)return null;var l=r.measure.map((function(e){return lt(e)})),s=r.dimension.map((function(e){return lt({function:e.function,field:e.field})}));return i.every(null==a?void 0:a.fields,(function(e){return s.includes(e.id)||l.includes(e.id)}))?c.jsx(Hx,U({},r,{dataSet:e.dataSet,onSetExportName:function(t,n){var i;e.updateComponentAttributes(U({},r,{exportNames:U({},r.exportNames,(i={},i[t]=n,i))}))},id:e.id,localFilters:e.component.localFilters,setLocalFilters:e.setLocalFilters,setParameterUpdate:function(){},result:a,onNext:function(){var t,i,o,a;lx({limit:null!=(t=r.limit)?t:0,offset:null!=(i=r.offset)?i:0,total:null!=(o=null==(a=n[0])?void 0:a.content.length)?o:0})&&e.updateComponentAttributes(U({},r,{offset:(r.offset||0)+(r.limit||Vx.limit)}))},onPrevious:function(){var t;ax(null!=(t=r.offset)?t:0)&&e.updateComponentAttributes(U({},r,{offset:(r.offset||0)-(r.limit||Vx.limit)}))},queriesAreChanging:o,onOrderChange:function(t){var n=t.fieldId,o=t.function,a=t.direction,l=i.cloneDeep(r.order),s=l.findIndex((function(e){return e.field===n&&e.function==o}));null===a?l.splice(s,1):s>-1?l[s].direction=a:l.push({field:n,direction:a,function:o}),e.updateComponentAttributes(U({},r,{order:l}))},numberFormatOptions:e.dashboardBehaviour.numberFormatOptions,dateTimeFormatOptions:e.dashboardBehaviour.dateTimeFormatOptions,onSetNumberFormat:function(t,n){var i=U({},r.numberFormat);n?i[t]=n:delete i[t],e.updateComponentAttributes(U({},r,{numberFormat:i}))},supportedAggregates:e.dashboardBehaviour.queryEngineConfig.supportedAggregates,supportedTimeTruncFunctions:e.dashboardBehaviour.queryEngineConfig.supportedTimeTruncFunctions,library:null==e?void 0:e.library,onViewClick:null==e?void 0:e.onViewClick,onSizingUpdate:function(t){e.updateComponentAttributes(U({},r,{sizing:t}))},drilldownInputProps:{component:e.component,runQueriesCallback:e.runQueriesCallback,globalFilters:e.globalFilters}})):null},Ux=function(e){var t=Bc().dashboard,n=Ol();if(!e.component.attributes)return null;var r=Mv(e.component,t.dataSets,n);if(r){if(r instanceof Yt)return c.jsx(Zp,{title:"Data set not available."});if(r instanceof Ht)return c.jsx(Zp,{title:"This view is no-longer supported."});if(r instanceof qt)return c.jsx(sf,{removeMissingField:function(){var t=On(e.component.attributes.type,{queryEngineConfig:n.queryEngineConfig});if(r instanceof qt){var i=t.removeField(e.component.attributes,r.getMissingFieldId());e.updateComponentAttributes(i)}}})}var i=Xr(t,e.component.attributes.dataSetId);if(e.isBeingSizeAdjusted)return c.jsx(Zp,{title:c.jsx(fc,{color:"#e5e5e5"})});var o=null!=e&&e.editor||null!=e&&e.library?void 0:e.component.colSpan<=2,a=function(r){(0,On(r.type,n).validate)(r,t.dataSets),e.updateComponentAttributes(r)};if("scatterChart"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(hv,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library})});if(["horizontalBarChart","barChart"].includes(e.component.attributes.type))return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(iv,{id:e.id,dataSet:i,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,runQueriesCallback:e.runQueriesCallback,updateComponentAttributes:function(e){return a(e)},component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library,onViewClick:n.onViewClick})});if("areaChart"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(Gh,{id:e.id,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library})});if("lineChart"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(sv,{id:e.id,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:i,updateComponentAttributes:function(e){return a(e)},runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library})});if("pieChart"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(Pv,{id:e.id,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library})});if("singleStat"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(ox,{id:e.id,setLocalFilters:e.setLocalFilters,setParameterUpdate:e.setParameterUpdate,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,library:null==e?void 0:e.library})});if("dataTable"==e.component.attributes.type||"basicTable"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(Yx,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,updateComponentAttributes:function(e){return a(e)},dashboardBehaviour:n,library:null==e?void 0:e.library,onViewClick:n.onViewClick})});if("comboChart"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(Gb,{id:e.id,setLocalFilters:e.setLocalFilters,dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n,sm:o,library:null==e?void 0:e.library})});if("custom"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(Yb,{component:e.component})});if("mercatorMap"==e.component.attributes.type)return c.jsx(vo,{renderOnError:function(e){return c.jsx(mf,{onManualRetry:e})},onError:n.onError,children:c.jsx(Xb,{id:e.id,setLocalFilters:e.setLocalFilters,onPositionChange:function(t){var r=(0,On("mercatorMap",n).setAttributes)(e.component.attributes,{position:t});e.updateComponentAttributes(r)},dataSet:i,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,globalFilters:t.globalFilters,dashboardBehaviour:n})});throw"Unsupported component in generic component wrapper. "+e.component.attributes.type},Gx=function(e){var t=e.component.localFilters||[],n=Bc(),r=Xr(n.dashboard,e.component.attributes.dataSetId);return r?c.jsx(Wf,{dataSets:[r],filters:t,show:null==e?void 0:e.show,onUpdate:function(n){var r=Hf(t,n);null==e||e.setLocalFilters(r)},source:"local",onDeleteItem:function(n){var r=[].concat(t);r.splice(n,1),null==e||e.setLocalFilters(r)},onClose:function(){return null==e?void 0:e.onClose()}}):null},Kx=function(e){var r=t.useState(!1),i=r[0],o=r[1],a=t.useState(!1),l=a[0],s=a[1],u=Bc().dispatch,d=e.component,p=e.libraryIndex,f=n.useState(!1),m=f[0],h=f[1],v=Ol().mode,g=window.disableViewCheck||m,b=rs(),x="admin"===v||!d.attributes.protectedByOrganisation&&"endUser"===v;return c.jsx(t.Fragment,{children:c.jsx(z,{active:!m,partialVisibility:!0,onChange:h,children:c.jsxs("button",{onClick:function(){return e.onSelectComponent(p)},className:""+Pa.selectedComponent(null==b?void 0:b.panels)({componentSelect:p===(null==e?void 0:e.selectedIndex)&&"true"}),"aria-selected":p===(null==e?void 0:e.selectedIndex),children:[c.jsxs(jm,{children:["View ",p+1,d.attributes.displayTitle?": "+d.attributes.displayTitle:""]}),!g&&c.jsx("div",{style:{height:"170px"},children:c.jsx(hc,{})}),g&&c.jsx(Rv,{children:c.jsxs(Ov,{width:340,height:306,percentage:100,children:[x&&c.jsx(Qx,{label:"View "+(p+1)+" Options",onEdit:function(){return null==e?void 0:e.onEdit(p)},onDelete:function(){return null==e?void 0:e.onDelete(p)},onSetParameters:function(){return o(!0)},onAddFilter:function(){return s(!0)},attributes:d.attributes}),c.jsx(Ux,{isBeingSizeAdjusted:!1,id:"library_"+p+"_"+Math.floor(1e11*Math.random()),setLocalFilters:function(){},setParameterUpdate:function(){},runQueriesCallback:e.runQueriesCallback,component:d,setResults:function(t){return e.setResults(t,p)},updateComponentAttributes:e.updateComponentAttributes,library:!0})]})},"select_component_preview_"+p),c.jsx(Vb,{setParameterUpdate:function(){},libraryIndex:e.libraryIndex,show:i,component:e.component,onClose:function(){return o(!1)}}),c.jsx(Gx,{component:e.component,onClose:function(){return s(!1)},show:l,setLocalFilters:function(e){u({type:"setLocalFilters",localFilters:e,libraryIndex:p})}})]})})})},Xx={name:"1v3ivpe",styles:"position:absolute;right:-1.25rem;top:0px"},Qx=function(e){var r,i=n.useRef(null),o=Ol(),a=On(null==e?void 0:e.attributes.type),l=t.useState(!1),s=l[0],u=l[1],d=t.useState(void 0),p=d[0],f=d[1],m=[{purpose:"editComponentsOnLibrary",renderIcon:function(){return c.jsx(Ul,{})},onClick:function(){return e.onEdit()}},{purpose:"removeComponentFromLibrary",renderIcon:function(){return c.jsx(Yl,{purpose:"removeComponentFromDashboard"})},onClick:function(){return e.onDelete()}}];o.featureToggles.parameters&&null!=(r=a.supportedFeatures)&&r.parameters&&"read_write"===o.scope&&m.push({purpose:"parameters",renderIcon:function(){return c.jsx(Gd,{width:20,justifyContent:"center",as:"span",children:c.jsx(ql,{})})},onClick:function(){return e.onSetParameters()}}),o.featureToggles.canConfigureLocalFilters&&m.push({purpose:"localFilter",renderIcon:function(){return c.jsx(Gd,{width:20,justifyContent:"center",as:"span",children:c.jsx(zl,{active:!1})})},onClick:function(){return e.onAddFilter()}});var h=rs();return c.jsxs("div",{css:Xx,ref:i,children:[c.jsxs("button",{"data-testid":"open-component-options",onClick:function(e){e.stopPropagation(),u(!s),i.current&&f(i.current.getBoundingClientRect())},"data-themeapi":"dashboard.icon",className:pp(null==h?void 0:h.dashboard)+" "+Aa.button+" open-component-options",children:[c.jsx(jm,{children:null==e?void 0:e.label}),c.jsx(Xl,{})]}),s&&c.jsx(qd,{onClose:function(){return u(!1)},position:p,children:c.jsx(Yv,{onClose:function(){return u(!1)},cellOptions:m})})]})},Jx=function(e){if(i.isEmpty(e.components))return c.jsx(Zp,{title:"Your library is empty"});var n=function(){var e=t.useRef(null);return t.useEffect((function(){e.current&&e.current.focus()}),[]),e}(),r=[].concat(e.components).map((function(e){return{displayTitle:e.attributes.displayTitle,displaySubject:e.attributes.displaySubject,component:e}})),o=Yd(r,["displayTitle","displaySubject"]),a=o.values,l=o.setSearch;return t.useEffect((function(){var t;null==e||e.onSelectComponent(null==(t=a[0])?void 0:t.refIndex)}),[o.searchString]),c.jsx(zd,{padding:"1.5rem",children:c.jsxs(es,{gap:"1.5rem",rows:["48px","1fr"],children:[c.jsx(zd,{children:c.jsx(Ev,{placeholder:"Search Library",onChange:l,inputRef:n})}),c.jsx(zd,{children:c.jsxs(es,{columns:["repeat(3, 1fr)"],gap:"1.5rem",children:[0===a.length&&c.jsx(Zp,{title:"Your search returned no results"}),[].concat(a).map((function(t){var n=t.refIndex;return c.jsx(Kx,{updateComponentAttributes:e.updateComponentAttributes,setResults:e.setResults,component:t.item.component,libraryIndex:n,onSelectComponent:null==e?void 0:e.onSelectComponent,runQueriesCallback:e.runQueriesCallback,selectedIndex:null==e?void 0:e.selectedIndex,onDelete:null==e?void 0:e.onDelete,onEdit:null==e?void 0:e.onEdit},n)}))]})})]})})},Zx={name:"om9tn6",styles:"margin:auto;height:24rem"},$x={name:"1g0vxgi",styles:"margin-top:0.75rem"},ey=function(){var e=Bc(),n=e.dispatch,r=e.dashboard,o=e.broadcastEvent,a=e.runQueriesCallback,l=t.useState(0),s=l[0],u=l[1],d=t.useState(null),p=d[0],f=d[1],m=Ol().featureToggles,h=m.canEditComponentLibrary,v=function(){var e=r.componentLibrary.length;o("library.startCreatingNew"),n({type:"startEditingComponent",libraryIndex:e,displayTarget:null,component:null})};return i.isEmpty(r.componentLibrary)?c.jsx("div",{className:uc("modal-empty-library"),css:Zx,children:c.jsx(Zp,{title:"There are no Views in your template library",renderExtra:function(){return m.canEditComponentLibrary&&c.jsx("div",{css:$x,children:c.jsx(_p,{onClick:v,children:"Create new"})})}})}):c.jsxs(c.Fragment,{children:[c.jsx(ty,{runQueriesCallback:a,onClose:function(){o("library.close"),n({type:"clearModal"})},onSelect:function(){n({type:"pickComponentFromLibraryForDisplay",libraryIndex:s})},updateComponentAttributes:function(e){n({type:"updateComponentLibraryAttributes",attributes:e,libraryIndex:s})},setFocussedComponentResults:function(e){n({type:"setResultsForComponentInLibrary",results:e,libraryIndex:s})},dashboard:r,selectedLibraryIndex:s,setResults:function(e,t){n({type:"setResultsForComponentInLibrary",results:e,libraryIndex:t})},canEditComponentLibrary:h,onEdit:function(e){var t=U({},r.componentLibrary[e]);o("library.startEditing"),n({type:"startEditingComponent",libraryIndex:e,displayTarget:null,component:t})},onDelete:f,onCreate:v,onSelectComponent:function(e){o("library.switchSelectedComponent"),u(e)}}),c.jsx(ny,{open:null!==p,onClose:function(){return f(null)},onDelete:function(){null!==p&&n({type:"removeComponentFromLibrary",libraryIndex:p}),f(null),u(0)}})]})},ty=function(e){var n,r,i,o,a,l,s=rs(),u="boolean"==typeof(null==s||null==(n=s.modals)||null==(r=n.options)||null==(i=r.showTitle)?void 0:i.library)&&!(null!=s&&null!=(o=s.modals)&&null!=(a=o.options)&&null!=(l=a.showTitle)&&l.library);return c.jsxs(t.Fragment,{children:[c.jsx(If.Header,{title:"Select Template","data-component":"library-header",hide:u}),c.jsx(If.Content,{scrollable:!0,"data-component":"library-content",children:c.jsx(Jx,{runQueriesCallback:null==e?void 0:e.runQueriesCallback,setResults:null==e?void 0:e.setResults,components:null==e?void 0:e.dashboard.componentLibrary,onSelectComponent:function(t){return null==e?void 0:e.onSelectComponent(t)},updateComponentAttributes:null==e?void 0:e.updateComponentAttributes,selectedIndex:null==e?void 0:e.selectedLibraryIndex,onDelete:null==e?void 0:e.onDelete,onEdit:null==e?void 0:e.onEdit})}),c.jsxs(If.Footer,{buttons:"space-between","data-component":"library-footer",children:[c.jsx(Of,{"data-component":"library-footer-left",children:(null==e?void 0:e.canEditComponentLibrary)&&c.jsx(_p,{testId:"library-create-new",onClick:function(){return null==e?void 0:e.onCreate()},secondary:!0,children:"Create New"})}),c.jsxs(Of,{buttons:"end","data-component":"library-footer-right",children:[c.jsx(_p,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},children:"Close"}),c.jsx(_p,{testId:"add-view-from-library-to-dashboard",onClick:function(){return null==e?void 0:e.onSelect()},children:"Add to Dashboard"})]})]})]})},ny=function(e){return c.jsxs(If,{width:"sm",isOpen:null==e?void 0:e.open,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(If.Header,{title:"Are you sure?"}),c.jsx(If.Content,{children:c.jsx("p",{className:""+Aa.text,children:"Are you sure you want to delete this component from your library?"})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Cancel"}),c.jsx(_p,{onClick:function(){return null==e?void 0:e.onDelete()},children:"Delete"})]})})]})},ry=Ml((function(e){var t=Bc().dashboard,n=Ol(),r=n.dateFilterOptions,i=n.cascadeFilterSelection;return c.jsx(Gd,{gap:"0.5rem","data-component":"filters",className:""+ay(n.scope),children:[].concat(e.globalFilters).map((function(n,o){return c.jsx(xm,{shouldAlwaysHaveValue:n.requiresValue,dataSets:t.dataSets,dateFilterOptions:r,filter:U({},n,{optionsFilters:mr(null==e?void 0:e.globalFilters,t.dataSets,r,i)}),filterIndex:o,onChange:function(t){var n=[].concat(e.globalFilters);n[o]=t,e.setGlobalFilters(n)}},o)}))})}),"renderGlobalFiltersViewComponent"),iy=function(e){var t=Ol(),n=t.featureToggles;return c.jsxs("div",{className:""+oy(t.scope),"data-component":"global-filters",children:[e.globalFilters.length>0&&c.jsx(ry,U({},e)),n.canManageGlobalFilters&&c.jsx(Uf,{})]})},oy=function(e){return pa("read"===e?{"@media (min-width: 768px)":{display:"flex",gridRow:1,gridColumn:2,gap:16,width:"100%"},"@media (max-width: 767px)":{display:"block"}}:{display:"flex",gridRow:1,gridColumn:2,gap:16,width:"100%"})},ay=function(e){return pa("read"===e?{"@media (min-width: 768px)":{flexDirection:"row"},"@media (max-width: 767px)":{flexDirection:"column"}}:{flexDirection:"row"})},ly=function(){var e=Bc(),t=e.dashboard,n=e.dispatch;return Ol().featureToggles.showGlobalFilters?c.jsx(iy,{globalFilters:t.globalFilters,setGlobalFilters:function(e){qr("Setting global filters",e),n({type:"setGlobalFilters",globalFilters:e})},setupAsyncOptionLoader:function(){return Y(W().mark((function e(){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw"Not implemented.";case 1:case"end":return e.stop()}}),e)})))}}):null},sy=function(e){return c.jsxs("pre",{css:["position:relative;margin-bottom:0.75rem;user-select:none;border-radius:0.5rem;background-color:rgb(0 0 0 / 0.9);padding:0.75rem;--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity));",e.sm&&{fontSize:"0.75rem",lineHeight:"1rem"},"",""],children:[c.jsx(uy,{content:e.content,copyContent:e.copyContent}),e.children||e.content]})},uy=function(e){var n=Hp().addToast,r=t.useState(!1),i=r[0],o=r[1];return c.jsx(Ax.Button,{onClick:Y(W().mark((function t(){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.copyContent){t.next=6;break}return t.next=3,e.copyContent();case 3:t.t0=t.sent,t.next=7;break;case 6:t.t0=e.content;case 7:B(t.t0),n((function(){return c.jsx(Bp,{message:"Copied to clipboard"})})),o(!0),setTimeout((function(){return o(!1)}),2e3);case 12:case"end":return t.stop()}}),t)}))),iconStyles:{position:"absolute",top:"0.75rem",right:"1.25rem"},copied:i})},dy={name:"1gok8e8",styles:"margin-bottom:0.5rem"},cy={name:"1mipg0r",styles:"margin-top:0.5rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 245 249 / var(--tw-bg-opacity));padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem"},py=function(){var e,t=Ol(),n=t.overrideDeveloperInfo,r=t.setOverrideDeveloperInfo;return c.jsx(If,{width:"xl",isOpen:!!n,onClose:function(){return r(null)},children:c.jsxs("div",{onClick:function(e){e.preventDefault(),e.stopPropagation()},children:[c.jsx(If.Header,{title:"Replace component"}),c.jsxs(If.Content,{children:[c.jsx("div",{css:dy,children:c.jsx(sy,{content:"<Vizzly.Dashboard\n// Rest of dashboard props...\n"+(null==n?void 0:n.overrideKey)+"={CustomComponent}\n/>"})}),c.jsxs("p",{children:["Adding the `",null==n?void 0:n.overrideKey,"` React prop of the Vizzly.Dashboard component, will allow you to render your own component."]}),!i.isEmpty(null==n?void 0:n.componentProps)&&c.jsx("div",{css:cy,children:c.jsx(Jc,{showAccordionIcon:!0,title:"View props",Icon:ol,children:c.jsx(sy,{content:(e=null==n?void 0:n.componentProps,JSON.stringify(e,(function(e,t){if("testId"!=e)return"children"==e?" [ React.JSX ] ":i.isFunction(t)?" [ function ] ":t}),2))})})})]})]})})},fy=function(e){var t=e.currentReports[0],n=t?t.id:l.v4(),r=Ol(),i=r.reportScheduleOptions,o=r.onScheduledReportChange,a=[].concat(i).map((function(e){return{label:e.description,value:e.cron}})),s=function(){var t=Y(W().mark((function t(r){var a,l;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o(n,r);case 2:a=t.sent,l=(i||[]).find((function(e){return e.cron==r})),e.setComponentReports("saved"==a?[{id:n,type:"scheduled",schedule:r,scheduleDescription:l.description}]:[]);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();return c.jsxs(If,{width:"xl",onClose:e.onClose,isOpen:e.isOpen,children:[c.jsx(If.Header,{title:"Set report schedule"}),c.jsx(If.Content,{children:c.jsx(Ac,{placeholder:"Select schedule",selected:t?t.schedule:null,showClearBtn:!0,onChange:s,options:a})}),c.jsx(If.Footer,{children:c.jsx(_p,{onClick:e.onClose,secondary:!0,children:"Close"})})]})},my=Object.assign((function(){return null}),{emptyCell:function(e){return pa({position:"relative",height:"100%",borderRadius:"0.75rem",borderColor:null==e?void 0:e.borderColor,borderWidth:null==e?void 0:e.borderWidth,borderStyle:null==e?void 0:e.borderStyle})}}),hy=function(e){return c.jsxs(zd,{children:[c.jsx(Tc,{as:"span",children:e.label}),c.jsx("div",{className:Zl(""+Aa.text,null==e?void 0:e.className),children:e.value})]})},vy=function(e){var n,r,o=(null==e?void 0:e.component).attributes,a=Bc().dispatch,l=function(){var t,n,r={};null==e||null==(t=e.component)||null==(n=t.results[0])||n.fields.forEach((function(e){r[e.id]=e.publicName}));var i=[];if("dimension"in o&&o.dimension.map((function(e){var t=r[tt(e)];i.push({value:e,label:t})})),"timeDimension"in o&&null!==o.timeDimension){var a=o.timeDimension,l=r[a?tt({field:null==a?void 0:a.field,function:null==a?void 0:a.truncate}):""];i.push({value:a,label:l})}return i.sort((function(e,t){return e.label.localeCompare(t.label,void 0,{sensitivity:"base"})})),i},s=t.useState(!1),u=s[0],d=s[1],p=t.useState((r=[],o&&"protectedFields"in o&&o.protectedFields&&"measure"in o.protectedFields&&o.protectedFields.measure&&(r=o.protectedFields.measure.map((function(e){return o.measure.findIndex((function(t){return t.field===e.field}))}))),r)),f=p[0],m=p[1],h=t.useState(function(){var e,t,n,r=[],i=l().map((function(e){return e.value}));return o&&"protectedFields"in o&&o.protectedFields&&"dimension"in o.protectedFields&&o.protectedFields.dimension&&(r=null!=(e=null==(t=o.protectedFields)||null==(n=t.dimension)?void 0:n.map((function(e){return i.findIndex((function(t){return(null==t?void 0:t.field)===e.field}))})))?e:[]),r}()),v=h[0],g=h[1],b=function(){null==e||e.onClose()};return c.jsxs(If,{width:"xl","data-testid":"edit-filter",isOpen:null==e?void 0:e.show,onClose:null==e?void 0:e.onClose,hideCloseIcon:!0,children:[c.jsx(If.Header,{title:"Click Settings",show:!0}),c.jsxs(If.Content,{children:[c.jsx(Rf,{children:c.jsx(hy,{label:"View Id",value:c.jsx(Yg.Panel,{children:c.jsx(Ax,{content:o.viewId})})})}),"basicTable"!==o.type&&c.jsx(Rf,{children:c.jsx(gy,{options:l(),selectedDimension:v,setSelectedDimesion:g})}),c.jsx(Rf,{children:c.jsx(by,{attributes:o,results:null==e||null==(n=e.component)?void 0:n.results,selectedMeasure:f,setSelectedMeasure:m,label:"Protected "+("basicTable"===o.type?"Columns":"Metrics")})})]}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Ip,{secondary:!0,onClick:function(){u||(b(),null==e||e.onClose())},disabled:u,children:"Cancel"}),c.jsx(Ip,{onClick:function(){return u?void 0:function(){d(!0);var t={};"measure"in o&&i.isArray(f)&&(t.measure=f.map((function(e){return null==o?void 0:o.measure[e]})));var n=l();n.length>0&&i.isArray(v)&&(t.dimension=v.map((function(e){return n[e]})).map((function(e){return e.value}))),"protectedFields"in o&&a({type:"setAttributes",attributes:U({},o,{protectedFields:t}),cellIndex:e.cellIndex,rowIndex:e.rowIndex}),d(!1),b()}()},disabled:u,primary:!0,children:"Confirm"})]})})]})},gy=function(e){var t=e.setSelectedDimesion;return c.jsx(Jf,{label:"Protected Grouping Fields",id:"protected-grouping-fields",setSelected:function(e){return t(e)},selected:e.selectedDimension,options:e.options})},by=function(e){var t=e.attributes,n=e.results,r=e.setSelectedMeasure;return c.jsx(Jf,{label:e.label,id:"protected-measure-fields",setSelected:function(e){return r(e)},selected:e.selectedMeasure,options:function(){var e,r={};null==(e=n[0])||e.fields.forEach((function(e){r[e.id]=e.publicName}));var i=[];return"measure"in t&&t.measure.map((function(e){var t=lt(e);i.push({value:e,label:r[t]+("none"!==e.function?" ("+e.function+")":"")})})),i}()})},xy=function(e){var t;return c.jsxs("svg",{height:null!=(t=null==e?void 0:e.height)?t:"535",viewBox:"0 0 1541 535",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("rect",{x:"1068",y:"287",width:"11",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),c.jsx("rect",{x:"1152",y:"259",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),c.jsx("rect",{x:"1232",y:"95",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),c.jsx("rect",{x:"1348",y:"256",width:"8",height:"4",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.17",strokeWidth:"4"}),c.jsx("rect",{x:"532",y:"312",width:"16",height:"15",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.24",strokeWidth:"4"}),c.jsx("rect",{x:"326",y:"197",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),c.jsx("rect",{x:"508.5",y:"56.5",width:"11",height:"3",rx:"1.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.24",strokeWidth:"3"}),c.jsx("rect",{x:"242",y:"236",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),c.jsx("rect",{x:"249",y:"302",width:"10",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.13",strokeWidth:"4"}),c.jsx("rect",{x:"203.25",y:"139.25",width:"2.5",height:"10.5",rx:"1.25",stroke:null==e?void 0:e.color,strokeOpacity:"0.22",strokeWidth:"2.5"}),c.jsx("rect",{x:"160",y:"88",width:"16",height:"14",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.3",strokeWidth:"4"}),c.jsx("rect",{x:"1203",y:"266",width:"120",height:"117",rx:"16",fill:"url(#paint0_linear_7_421)",fillOpacity:"0.2"}),c.jsx("rect",{x:"1205.5",y:"268.5",width:"115",height:"112",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M1205 299H1321",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"377",y:"177",width:"120",height:"117",rx:"16",fill:"url(#paint1_linear_7_421)"}),c.jsx("rect",{x:"379.5",y:"179.5",width:"115",height:"112",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M379 210H495",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsxs("g",{clipPath:"url(#clip0_7_421)",children:[c.jsx("rect",{x:"572",y:"61",width:"410",height:"322",rx:"24",fill:"#E7EAF1"}),c.jsx("rect",{x:"730",y:"116",width:"337.5",height:"239.708",rx:"8",fill:"#F3F5F9"}),c.jsx("g",{filter:"url(#filter0_d_7_421)",children:c.jsx("rect",{x:"741.926",y:"127.926",width:"78.7103",height:"66.7845",rx:"5.9629",fill:"white"})}),c.jsxs("g",{filter:"url(#filter1_d_7_421)",children:[c.jsx("rect",{x:"828.984",y:"127.926",width:"78.7103",height:"66.7845",rx:"5.9629",fill:"white"}),c.jsx("rect",{x:"829.484",y:"128.426",width:"77.7103",height:"65.7845",rx:"5.4629",stroke:null==e?void 0:e.color})]}),c.jsx("path",{d:"M888.611 160.721C888.611 172.247 879.267 181.591 867.741 181.591C856.214 181.591 846.871 172.247 846.871 160.721C846.871 149.195 856.214 139.851 867.741 139.851C879.267 139.851 888.611 149.195 888.611 160.721ZM855.661 160.721C855.661 167.393 861.069 172.801 867.741 172.801C874.412 172.801 879.821 167.393 879.821 160.721C879.821 154.049 874.412 148.641 867.741 148.641C861.069 148.641 855.661 154.049 855.661 160.721Z",fill:null==e?void 0:e.color}),c.jsx("path",{d:"M867.741 139.851C862.912 139.851 858.233 141.525 854.501 144.588C850.768 147.651 848.214 151.914 847.272 156.65C846.33 161.385 847.059 166.301 849.335 170.559C851.611 174.817 855.293 178.155 859.754 180.003C864.215 181.85 869.179 182.094 873.799 180.693C878.42 179.291 882.411 176.331 885.094 172.316C887.776 168.301 888.984 163.481 888.51 158.675C888.037 153.87 885.912 149.378 882.498 145.964L876.283 152.179C878.259 154.155 879.489 156.756 879.763 159.537C880.037 162.318 879.338 165.109 877.785 167.432C876.232 169.756 873.922 171.47 871.247 172.281C868.573 173.092 865.7 172.951 863.118 171.882C860.536 170.812 858.405 168.88 857.087 166.416C855.77 163.951 855.348 161.105 855.893 158.364C856.438 155.623 857.917 153.156 860.077 151.383C862.238 149.61 864.946 148.641 867.741 148.641L867.741 139.851Z",fill:null==e?void 0:e.color}),c.jsx("path",{d:"M867.741 139.851C864.309 139.851 860.929 140.697 857.903 142.315C854.876 143.933 852.295 146.273 850.388 149.126C848.481 151.98 847.308 155.26 846.971 158.675C846.635 162.091 847.146 165.537 848.459 168.708C849.773 171.879 851.848 174.677 854.501 176.854C857.154 179.031 860.303 180.521 863.669 181.19C867.035 181.86 870.515 181.689 873.799 180.693C877.083 179.696 880.071 177.905 882.498 175.479L876.283 169.263C874.878 170.668 873.148 171.704 871.247 172.281C869.346 172.858 867.332 172.957 865.384 172.569C863.436 172.181 861.613 171.319 860.077 170.059C858.542 168.799 857.34 167.179 856.58 165.344C855.82 163.509 855.524 161.514 855.719 159.537C855.914 157.56 856.593 155.662 857.697 154.01C858.8 152.358 860.294 151.004 862.046 150.067C863.798 149.131 865.754 148.641 867.741 148.641L867.741 139.851Z",fill:"#D9FFE8"}),c.jsx("g",{filter:"url(#filter2_d_7_421)",children:c.jsx("path",{d:"M916.042 133.889C916.042 130.595 918.712 127.926 922.005 127.926H1048.42C1051.71 127.926 1054.38 130.595 1054.38 133.889V262.687C1054.38 265.98 1051.71 268.65 1048.42 268.65H922.005C918.712 268.65 916.042 265.98 916.042 262.687V133.889Z",fill:"white"})}),c.jsx("path",{d:"M945.857 189.636C946.367 187.861 951.979 177.805 956.061 184.312C960.142 190.819 965.244 198.509 968.816 192.593C972.387 186.678 975.958 169.523 980.55 173.664C985.142 177.805 989.223 172.481 992.795 164.791C996.366 157.101 1000.45 158.284 1004.02 167.157C1007.59 176.03 1009.12 181.946 1015.24 181.946C1021.37 181.946 1023.92 189.044 1028.51 186.678C1032.18 184.785 1038.54 162.622 1041.26 151.777",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),c.jsx("path",{d:"M956.061 184.312C951.979 177.805 946.367 187.861 945.857 189.636V240.028H1041.26V151.777C1038.54 162.622 1032.18 184.785 1028.51 186.678C1023.92 189.044 1021.37 181.946 1015.24 181.946C1009.12 181.946 1007.59 176.03 1004.02 167.157C1000.45 158.284 996.366 157.101 992.795 164.791C989.223 172.481 985.142 177.805 980.55 173.664C975.958 169.523 972.387 186.678 968.816 192.593C965.244 198.509 960.142 190.819 956.061 184.312Z",fill:"url(#paint2_linear_7_421)"}),c.jsx("g",{filter:"url(#filter3_d_7_421)",children:c.jsx("rect",{x:"741.926",y:"203.058",width:"165.769",height:"66.7845",rx:"5.9629",fill:"white"})}),c.jsx("g",{filter:"url(#filter4_d_7_421)",children:c.jsx("rect",{x:"741.926",y:"278.191",width:"165.769",height:"66.7845",rx:"5.9629",fill:"white"})}),c.jsx("path",{d:"M749.081 337.82C775.101 330.469 781.606 307.366 802.422 306.316C823.238 305.266 832.345 323.118 840.151 319.967C847.957 316.817 862.268 279.012 892.191 300.015",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),c.jsx("path",{d:"M750.274 337.82C755.048 335.681 765.637 329.264 769.804 320.709C775.012 310.014 784.126 300.389 795.844 314.292C807.561 328.195 817.977 339.959 829.695 312.153C841.413 284.347 851.829 292.903 860.943 305.736C870.057 318.57 877.869 338.889 892.191 318.57",stroke:null==e?void 0:e.color,strokeWidth:"1.19258",strokeLinecap:"round"}),c.jsx("g",{filter:"url(#filter5_d_7_421)",children:c.jsx("rect",{x:"916.042",y:"278.191",width:"138.339",height:"66.7845",rx:"5.9629",fill:"white"})}),c.jsx("path",{d:"M764.015 167.45C763.28 167.45 762.601 167.361 761.978 167.183C761.354 167.005 760.798 166.76 760.308 166.448C759.83 166.136 759.429 165.775 759.106 165.363L760.375 163.86C760.62 164.239 760.937 164.567 761.327 164.845C761.716 165.112 762.156 165.324 762.646 165.48C763.135 165.624 763.636 165.697 764.148 165.697C764.827 165.697 765.362 165.585 765.751 165.363C766.141 165.14 766.335 164.812 766.335 164.378C766.335 164.099 766.224 163.86 766.002 163.66C765.79 163.459 765.417 163.298 764.883 163.176L762.545 162.641C761.922 162.497 761.388 162.296 760.943 162.04C760.497 161.784 760.158 161.473 759.924 161.105C759.702 160.727 759.59 160.293 759.59 159.803C759.59 159.157 759.763 158.584 760.108 158.083C760.464 157.582 760.965 157.182 761.61 156.881C762.267 156.581 763.057 156.43 763.981 156.43C764.95 156.43 765.801 156.597 766.536 156.931C767.27 157.265 767.894 157.76 768.406 158.417L767.204 159.803C766.758 159.235 766.263 158.823 765.718 158.567C765.183 158.3 764.555 158.167 763.831 158.167C763.341 158.167 762.941 158.228 762.629 158.35C762.317 158.462 762.084 158.617 761.928 158.818C761.783 159.018 761.711 159.246 761.711 159.502C761.711 159.703 761.755 159.886 761.844 160.053C761.933 160.209 762.1 160.348 762.345 160.471C762.601 160.593 762.963 160.71 763.43 160.821L765.434 161.272C766.48 161.506 767.232 161.851 767.688 162.307C768.155 162.753 768.389 163.348 768.389 164.094C768.389 164.806 768.205 165.413 767.838 165.914C767.471 166.415 766.953 166.799 766.285 167.066C765.629 167.322 764.872 167.45 764.015 167.45ZM763.23 169.002V154.911H764.783V169.002H763.23ZM771.992 167.466V160.487C771.992 160.231 771.992 159.97 771.992 159.703C772.003 159.424 772.014 159.141 772.025 158.851C771.647 159.196 771.224 159.497 770.756 159.753C770.289 160.009 769.81 160.187 769.321 160.287L769.02 158.35C769.276 158.328 769.56 158.256 769.872 158.133C770.194 158 770.517 157.844 770.84 157.666C771.174 157.477 771.474 157.282 771.742 157.081C772.02 156.87 772.231 156.658 772.376 156.447H774.246V167.466H771.992ZM777.502 164.912C777.947 164.912 778.298 165.034 778.554 165.279C778.821 165.524 778.954 165.852 778.954 166.264C778.954 166.687 778.821 167.021 778.554 167.266C778.298 167.5 777.947 167.617 777.502 167.617C777.057 167.617 776.701 167.5 776.433 167.266C776.177 167.021 776.049 166.687 776.049 166.264C776.049 165.852 776.177 165.524 776.433 165.279C776.701 165.034 777.057 164.912 777.502 164.912ZM778.199 156.447H786.931V158.2C786.007 159.124 785.272 160.076 784.727 161.055C784.182 162.035 783.786 163.053 783.541 164.111C783.308 165.168 783.191 166.287 783.191 167.466H780.904C780.904 166.242 781.054 165.068 781.354 163.944C781.666 162.808 782.139 161.729 782.773 160.705C783.419 159.669 784.237 158.679 785.228 157.733L785.695 158.334H778.199V156.447ZM800.402 156.447V167.466H798.315V161.723L798.431 158.501H798.398L795.343 167.466H793.456L790.417 158.501H790.384L790.501 161.723V167.466H788.414V156.447H791.753L793.74 162.458L794.441 164.945H794.474L795.192 162.474L797.163 156.447H800.402Z",fill:"#374151"}),c.jsx("rect",{x:"749.081",y:"210.214",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"749.081",y:"285.346",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"135.081",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"285.346",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"150.585",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"168.474",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"186.362",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"204.251",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"222.14",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"923.198",y:"240.028",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"941.087",y:"254.339",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"964.938",y:"254.339",width:"8.34806",height:"3.57774",rx:"1.78887",fill:"#F3F5F9"}),c.jsx("rect",{x:"769.355",y:"210.214",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"769.355",y:"285.346",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"943.472",y:"135.081",width:"15.5035",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"943.472",y:"285.346",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"970.901",y:"285.346",width:"8.34806",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"797.977",y:"210.214",width:"23.8516",height:"5.9629",rx:"2.38516",fill:"#F3F5F9"}),c.jsx("rect",{x:"752.659",y:"234.065",width:"5.9629",height:"27.4293",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"763.392",y:"229.295",width:"5.9629",height:"32.1996",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"774.125",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"784.859",y:"235.258",width:"5.9629",height:"26.2367",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"795.592",y:"247.184",width:"5.9629",height:"14.311",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"806.325",y:"241.221",width:"5.9629",height:"20.2739",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"817.058",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"827.792",y:"244.799",width:"5.9629",height:"16.6961",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"838.525",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"849.258",y:"229.295",width:"5.9629",height:"32.1996",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"859.991",y:"238.836",width:"5.9629",height:"22.659",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"870.724",y:"231.68",width:"5.9629",height:"29.8145",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"881.458",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"892.191",y:"224.525",width:"5.9629",height:"36.97",rx:"2.38516",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"923.198",y:"298.465",width:"82.288",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),c.jsx("rect",{x:"923.198",y:"313.968",width:"26.2367",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),c.jsx("rect",{x:"923.198",y:"329.472",width:"52.4735",height:"3.57774",rx:"1.78887",fill:"#D9FFE8"}),c.jsx("rect",{x:"923.198",y:"304.427",width:"118.065",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"923.198",y:"319.931",width:"85.8657",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),c.jsx("rect",{x:"923.198",y:"335.435",width:"70.3622",height:"3.57774",rx:"1.78887",fill:null==e?void 0:e.color}),c.jsxs("g",{filter:"url(#filter6_d_7_421)",children:[c.jsx("rect",{x:"594",y:"81",width:"155",height:"172",rx:"8",fill:"white"}),c.jsx("rect",{x:"594.5",y:"81.5",width:"154",height:"171",rx:"7.5",stroke:null==e?void 0:e.color})]}),c.jsx("rect",{x:"614",y:"223",width:"116",height:"17",rx:"3",fill:"#F3F5F9"}),c.jsx("rect",{x:"614",y:"103",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),c.jsx("rect",{x:"614",y:"209",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),c.jsx("rect",{x:"614",y:"122",width:"115",height:"3",rx:"1.5",fill:"#D9FFE8"}),c.jsx("rect",{x:"614",y:"122",width:"58",height:"3",rx:"1.5",fill:"#151515"}),c.jsx("circle",{cx:"673",cy:"123",r:"6",fill:"#151515"}),c.jsx("rect",{x:"614",y:"153",width:"28",height:"3",rx:"1.5",fill:"#6A788E"}),c.jsx("rect",{x:"614",y:"167",width:"16",height:"16",fill:"#151515"}),c.jsx("rect",{x:"714",y:"167",width:"16",height:"16",fill:"#F3F5F9"}),c.jsx("rect",{x:"639",y:"167",width:"16",height:"16",fill:"#374151"}),c.jsx("rect",{x:"661.5",y:"164.5",width:"21",height:"21",fill:null==e?void 0:e.color,stroke:"#151515"}),c.jsx("rect",{x:"689",y:"167",width:"16",height:"16",fill:"#D9FFE8"}),c.jsx("path",{d:"M674.157 178.471L674.157 178.471L674.159 178.477L689.023 218.322L689.024 218.322C689.212 218.826 689.552 219.258 689.997 219.558C690.443 219.859 690.971 220.013 691.508 219.999C692.045 219.985 692.564 219.803 692.993 219.479C693.422 219.155 693.738 218.706 693.9 218.193L693.902 218.186L697.67 205.899L710.895 218.839C710.896 218.84 710.898 218.841 710.899 218.842C711.381 219.322 712.034 219.591 712.715 219.591C713.397 219.591 714.051 219.32 714.534 218.839L714.537 218.837L718.249 215.115L718.251 215.113C718.731 214.629 719 213.974 719 213.293C719 212.611 718.731 211.956 718.251 211.472L718.245 211.466L718.24 211.461L705.081 198.603L717.11 194.872L717.126 194.867L717.142 194.861C717.649 194.685 718.089 194.355 718.399 193.918C718.71 193.48 718.877 192.957 718.877 192.42C718.877 191.884 718.71 191.36 718.399 190.922C718.091 190.488 717.656 190.16 717.154 189.983L677.486 175.165C677.485 175.164 677.485 175.164 677.485 175.164C677.022 174.991 676.52 174.954 676.038 175.058C675.555 175.162 675.112 175.402 674.762 175.751C674.412 176.099 674.169 176.54 674.062 177.022C673.955 177.504 673.988 178.007 674.157 178.471Z",fill:"black",stroke:"#E7EAF1",strokeWidth:"2"})]}),c.jsx("rect",{x:"217",y:"77",width:"96",height:"99",rx:"16",fill:"url(#paint3_linear_7_421)",fillOpacity:"0.2"}),c.jsx("rect",{x:"219.5",y:"79.5",width:"91",height:"94",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M218.5 104.5H311",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"1064",y:"69",width:"105",height:"99",rx:"16",fill:"url(#paint4_linear_7_421)",fillOpacity:"0.2"}),c.jsx("rect",{x:"1066.5",y:"71.5",width:"100",height:"94",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"1011",y:"218",width:"15",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),c.jsx("rect",{x:"1442",y:"227",width:"19",height:"16",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),c.jsx("rect",{x:"1269",y:"130",width:"15",height:"9",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.21",strokeWidth:"4"}),c.jsx("rect",{x:"420",y:"111",width:"18",height:"16",rx:"2",stroke:null==e?void 0:e.color,strokeOpacity:"0.28",strokeWidth:"4"}),c.jsx("path",{d:"M1066 97H1167",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"69",y:"193",width:"73",height:"72",rx:"16",fill:"url(#paint5_linear_7_421)",fillOpacity:"0.2"}),c.jsx("rect",{x:"71.5",y:"195.5",width:"68",height:"67",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M70 213H141",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("rect",{x:"1399",y:"116",width:"73",height:"72",rx:"16",fill:"url(#paint6_linear_7_421)"}),c.jsx("rect",{x:"1401.5",y:"118.5",width:"68",height:"67",rx:"13.5",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsx("path",{d:"M1400 136H1471",stroke:null==e?void 0:e.color,strokeOpacity:"0.75",strokeWidth:"5"}),c.jsxs("defs",{children:[c.jsxs("filter",{id:"filter0_d_7_421",x:"737.155",y:"123.155",width:"88.2509",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter1_d_7_421",x:"824.214",y:"123.155",width:"88.2509",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter2_d_7_421",x:"911.272",y:"123.155",width:"147.88",height:"150.265",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter3_d_7_421",x:"737.155",y:"198.288",width:"175.309",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter4_d_7_421",x:"737.155",y:"273.42",width:"175.309",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter5_d_7_421",x:"911.272",y:"273.42",width:"147.88",height:"76.3251",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"2.38516"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("filter",{id:"filter6_d_7_421",x:"580",y:"67",width:"183",height:"200",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[c.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),c.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),c.jsx("feOffset",{}),c.jsx("feGaussianBlur",{stdDeviation:"7"}),c.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),c.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0"}),c.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_7_421"}),c.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_7_421",result:"shape"})]}),c.jsxs("linearGradient",{id:"paint0_linear_7_421",x1:"1206.5",y1:"324",x2:"1319.5",y2:"324",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint1_linear_7_421",x1:"492",y1:"231.5",x2:"380.5",y2:"230.5",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.2"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint2_linear_7_421",x1:"993.56",y1:"151.777",x2:"993.56",y2:"240.028",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.72"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint3_linear_7_421",x1:"310.5",y1:"126",x2:"219.5",y2:"126",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint4_linear_7_421",x1:"1066.5",y1:"117",x2:"1164",y2:"118",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),c.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint5_linear_7_421",x1:"138",y1:"229",x2:"74",y2:"229",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.5"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsxs("linearGradient",{id:"paint6_linear_7_421",x1:"1404",y1:"152",x2:"1467.5",y2:"152",gradientUnits:"userSpaceOnUse",children:[c.jsx("stop",{stopColor:null==e?void 0:e.color,stopOpacity:"0.19"}),c.jsx("stop",{offset:"1",stopColor:null==e?void 0:e.color,stopOpacity:"0"})]}),c.jsx("clipPath",{id:"clip0_7_421",children:c.jsx("rect",{x:"572",y:"61",width:"410",height:"322",rx:"24",fill:"white"})})]})]})},yy=function(e){return c.jsxs(Gd,{justifyContent:"center",direction:"column",alignItems:"center",height:"100%","data-component":"empty-state",children:[c.jsx(xy,{height:160,color:null==e?void 0:e.illustrationColor}),c.jsxs(Gd,{direction:"column",gap:"1rem",alignItems:"center",children:[c.jsx(zd,{className:""+wy,children:null==e?void 0:e.title}),(null==e?void 0:e.children)&&c.jsx(zd,{children:null==e?void 0:e.children})]})]})},wy=pa({fontSize:16,fontWeight:500}),Cy={name:"1g6uwz7",styles:"display:grid;height:100%;width:100%;place-content:center"},jy={name:"1g6uwz7",styles:"display:grid;height:100%;width:100%;place-content:center"},Sy={name:"1q8mru7",styles:"margin-left:0.25rem;display:inline-block"},Fy=function(e){var n=rs(),r=Ol().featureToggles,i=r.canUseComponentLibrary,o=r.canCreateStandaloneComponents;return 0===(null==e?void 0:e.rowIndex)&&0===(null==e?void 0:e.cellIndex)&&r.canSeeEmptyState?c.jsx(Rv,{vizzlyPrefix:uc("populated-cell"),children:c.jsxs("div",{css:Cy,children:[c.jsx(Xv,{chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),onRemoveCell:null==e?void 0:e.onRemoveCell}),c.jsx(yy,{title:c.jsx(t.Fragment,{children:"Build a dashboard with your data and delight your customer."}),illustrationColor:"#43BA73",children:o&&c.jsx(Cp,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",testId:"add-adhoc-view",children:"+ Add View"})})]})}):c.jsx("div",{className:Zl(uc("empty-cell"),""+my.emptyCell(null==n?void 0:n.dashboard)),"data-themeapi":"dashboard","data-chipposition":"top.left",children:c.jsxs("div",{css:jy,children:[c.jsx(Xv,{chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),onRemoveCell:null==e?void 0:e.onRemoveCell}),c.jsxs(Gd,{gap:"0.5rem",wrap:!0,justifyContent:"center",children:[i&&c.jsx(Cp,{onChange:e.onPickFromLibrary,size:"small","data-component":"select-template",testId:"add-view-from-library",children:c.jsxs(Gd,{alignItems:"center",as:"span",children:[c.jsx(Ql,{}),c.jsx("span",{css:Sy,children:"Select Template"})]})}),o&&c.jsx(Cp,{onChange:e.onCreateNew,size:"small","data-component":"add-adhoc-view",testId:"add-adhoc-view",children:"+ Add View"})]})]})})},ky=function(e){var r,o,a=t.useState(!1),l=a[0],s=a[1],u=t.useState(!1),d=u[0],p=u[1],f=t.useState(!1),m=f[0],h=f[1],v=Bc().dispatch,g=Ol(),x=g.featureToggles,y=g.reportScheduleOptions,w=g.scope,C=x.canDownloadComponentData,j=x.canEditComponentsOnDashboard,S=x.canRemoveComponentsFromDashboard,F=n.useState(!1),k=F[0],T=F[1],A=t.useState(!1),D=A[0],I=A[1],P=n.useState(!1),_=P[0],E=P[1],O=window.disableViewCheck||_,L=!i.isEmpty(y)&&e.hasWebhookSetup,R=(r=e.rowIndex,o=e.cellIndex,b.useDrag((function(){return{type:"moveComponentPositionDragHandle",item:{rowIndex:r,cellIndex:o},collect:function(e){var t=e.isDragging();return{adjust:e.getDifferenceFromInitialOffset(),isDragging:t}}}}))),M=R[1],N=R[2],B=function(t){v({type:"setLocalFilters",localFilters:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},q=function(t){v({type:"setParameterBasedUpdate",payload:t,cellIndex:e.cellIndex,rowIndex:e.rowIndex})},V=t.useState(!1),W=V[0],H=V[1];return c.jsxs(c.Fragment,{children:[c.jsx(z,{active:!_,partialVisibility:!0,onChange:E,children:c.jsxs(Rv,{vizzlyPrefix:uc("populated-cell"),"data-testid":e.testId,ref:N,onHover:H,children:[c.jsx(fp,{dragSource:M,active:"read_write"===w&&W,enabled:"read_write"===w,top:Ty(e.component.attributes).top,height:Ty(e.component.attributes).height}),c.jsx(Kv,{canDownloadComponentData:C&&e.componentValidWithDataSet,canEditComponentsOnDashboard:j&&e.componentValidWithDataSet,canRemoveComponentsFromDashboard:S,onEdit:e.onEdit,onRemove:function(){return s(!0)},onDownload:e.onDownload,canSetupReportSchedule:L,onManageReport:function(){return T(!0)},onClickSettings:function(){return I(!0)},chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1),component:e.component,onAddFilter:function(){return p(!0)},onSetParameters:function(){return h(!0)}}),c.jsxs(zd,{height:"100%","data-component":"cell-contents",children:[O&&c.jsx(Ux,{id:e.id,setLocalFilters:B,setParameterUpdate:q,isBeingSizeAdjusted:e.isBeingSizeAdjusted,runQueriesCallback:e.runQueriesCallback,component:e.component,setResults:e.setResults,updateComponentAttributes:e.updateComponentAttributes}),!O&&c.jsx(hc,{})]})]})}),L&&c.jsx(fy,{setComponentReports:e.setComponentReports,currentReports:e.component.reports||[],isOpen:k,onClose:function(){return T(!1)}}),D&&c.jsx(vy,{show:D,component:null==e?void 0:e.component,onClose:function(){return I(!1)},cellIndex:e.cellIndex,rowIndex:e.rowIndex}),c.jsx(Qg,{message:"This view will be deleted from your dashboard.",onClose:function(t){t&&(null==e||e.onRemove()),s(!1)},show:l}),c.jsx(Gx,{component:e.component,onClose:function(){return p(!1)},show:d,setLocalFilters:B}),c.jsx(Vb,{cellIndex:e.cellIndex,setParameterUpdate:q,rowIndex:e.rowIndex,show:m,component:e.component,onClose:function(){return h(!1)}})]})},Ty=function(e){var t=e.displayTitle,n=e.displaySubject,r=t?15:8,i=28;return t&&(i+=13),n&&(i+=13),n&&t&&(i+=4),n&&!t&&(r=14),{top:r,height:i}},Ay=function(e,t){if(e){var n=[[].concat(e.fields).map((function(t,n){var r,i;if(!e.groupTitles)return t.publicName;var o=null==(r=e.groupTitles.unconsolidated)||null==(i=r[n])?void 0:i.content;return(o?"["+o+"] ":"")+t.publicName}))].concat(e.content),r="";n.forEach((function(e){var t=e.map((function(e){var t,n="object"==typeof e&&"value"in e?null!=(t=e.displayValue)?t:e.value:e;return"number"==typeof n?n:'"'+n+'"'})).join(",");r+=t+"\r\n"})),t(r)}else t("Download failed")},Dy=function(e){var t=new Blob([e],{type:"text/csv;charset=utf-8"});V.saveAs(t,"download.csv")},Iy=function(){var e=Y(W().mark((function e(t,n,r,o,a,l,s,u,d,c){var p,f,m,h,v,g;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===c&&(c=Dy),p=i.cloneDeep(a),e.prev=2,"limit"in p&&(p.limit=o),f=new AbortController,m="view-download-type"==t?p:[Hn(n,o,"filter"in p?p.filter:[])],e.next=8,Vc(m,r,f.signal,d);case 8:Go(v=null==(h=e.sent)?void 0:h[0])||Ko(v)||Uo(v)||(g=Lx(v,i.isArray(m)?m[0]:m,"exportNames"in p?p.exportNames:void 0,"prefixes"in p&&Array.isArray(p.prefixes)?p.prefixes:void 0,"dateTimeFormat"in p?p.dateTimeFormat:void 0,l,"numberFormat"in p?p.numberFormat:void 0,s,u.supportedAggregates,u.supportedTimeTruncFunctions,""),Ay(g,c)),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(2),console.error(e.t0);case 16:case"end":return e.stop()}}),e,null,[[2,13]])})));return function(t,n,r,i,o,a,l,s,u,d){return e.apply(this,arguments)}}(),Py=function(e){if(!e.show)return null;var t=e.onClose,r=e.component,i=n.useState(r.displayTitle),o=i[0],a=i[1],l=Bc().dispatch;return c.jsxs(If,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return t()},children:[c.jsx(If.Header,{title:"Update Header",show:!0}),c.jsx(If.Content,{children:c.jsx(Rf,{children:c.jsx(np,{id:"header-title",label:"Title",labelHidden:!0,value:o,onChange:function(e){return a(e.target.value)}})})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{onClick:function(){return t()},secondary:!0,children:"Close"}),c.jsx(_p,{onClick:function(){return n=U({},r,{displayTitle:o}),l({type:"setHeaderComponent",component:n,cellIndex:e.cellIndex,rowIndex:e.rowIndex}),void t();var n},children:"Update"})]})})]})},_y=function(e){var t,n,r,i,o=rs();return c.jsxs(Gd,{justifyContent:"space-between",alignItems:"center",margin:null!=(t=null==e?void 0:e.margin)?t:"0 0 1rem","data-component":"action-section",className:""+Ey(null==o?void 0:o.header),"data-themeapi":"header",children:[c.jsx(zd,{children:(null==e?void 0:e.title)&&c.jsxs(Gd,{direction:"column",gap:"0.5rem",children:[c.jsx(zd,{as:null!=(n=e.titleLevel)?n:null==o||null==(r=o.header)||null==(i=r.title)?void 0:i.htmlElement,className:""+Oy(null==o?void 0:o.header),"data-themeapi":"header.title",children:null==e?void 0:e.title}),(null==e?void 0:e.subTitle)&&c.jsx("p",{className:""+Ly,children:null==e?void 0:e.subTitle})]})}),(null==e?void 0:e.extra)&&c.jsx(zd,{children:null==e?void 0:e.extra})]})},Ey=function(e){var t;return pa({borderBottom:null==e?void 0:e.borderBottom,borderTop:null==e?void 0:e.borderTop,background:null==e?void 0:e.background,padding:null!=(t=null==e?void 0:e.padding)?t:"0.5rem 0",textAlign:null==e?void 0:e.textAlign})},Oy=function(e){var t,n,r,i,o,a;return pa({lineHeight:null==e||null==(t=e.title)?void 0:t.lineHeight,color:null==e||null==(n=e.title)?void 0:n.color,fontFamily:null==e||null==(r=e.title)?void 0:r.fontFamily,fontSize:null==e||null==(i=e.title)?void 0:i.fontSize,fontWeight:null==e||null==(o=e.title)?void 0:o.fontWeight,margin:null==e||null==(a=e.title)?void 0:a.margin})},Ly=pa({margin:0,fontSize:14}),Ry=function(e){var t=[],r=n.useState(!1),i=r[0],o=r[1],a=Ol(),l=a.featureToggles,s=a.scope;return t.push({purpose:"editComponentsOnDashboard",renderIcon:function(){return c.jsx(Jv,{})},onClick:function(){return o(!0)},testId:"edit"}),l.canRemoveComponentsFromDashboard&&t.push({purpose:"removeComponentFromDashboard",renderIcon:function(){return c.jsx(Qv,{})},onClick:function(){return e.onRemove()},testId:"remove"}),c.jsxs(zd,{position:"relative",height:"100%",margin:"0 0.1rem 0.5rem 0.1rem",children:[c.jsx(_y,{title:e.component.displayTitle,margin:0}),"read_write"===s&&c.jsx(Gv,{cellOptions:t,chartLabel:"Row "+((null==e?void 0:e.rowIndex)+1)+" Cell "+((null==e?void 0:e.cellIndex)+1)}),c.jsx(Py,{show:i,component:e.component,onClose:function(){return o(!1)},rowIndex:e.rowIndex,cellIndex:e.cellIndex})]})};function My(e,t){return!(t<=0||t>=e.length)&&e[t-1].components.some((function(e){return kr(e)}))}var Ny,zy=function(e,t,n){return e.slice(-15)+"_"+t+"_"+n},By=function(e){var t=e.onCreateNew,n=e.onPickFromLibrary,r=e.onRemoveCell,i=e.rowIndex,o=e.dispatch,a=e.cellIndex,l=e.dashboard,s=e.runQueriesCallback,u=e.broadcastEvent,d=Ol(),p=d.queryEngineConfig,f=d.dateTimeFormatOptions,m=d.numberFormatOptions,h=l.display[i].components[a],v=Fr(h)?"empty":kr(h)?"header":"populated",g=null!=l.webhookId,x=b.useDrop((function(){return{accept:"moveComponentPositionDragHandle",drop:function(t,n){e.dispatch({type:"swapComponents",positionA:{rowIndex:t.rowIndex,cellIndex:t.cellIndex},positionB:{rowIndex:e.rowIndex,cellIndex:e.cellIndex}})},collect:function(e){return{isOver:e.isOver()}}}}));return c.jsxs("div",{ref:x[1],css:["height:100%;padding:0.5rem;",x[0].isOver&&{opacity:"0.2"},"",""],children:["populated"==v&&!Fr(h)&&!kr(h)&&c.jsx(ky,{rowIndex:i,cellIndex:a,id:zy(l.id,i,a),hasWebhookSetup:g,componentValidWithDataSet:!0,setComponentReports:function(e){o({type:"setComponentReports",rowIndex:i,cellIndex:a,reports:e})},testId:"populated_cell_"+i+"_cell_"+a,isBeingSizeAdjusted:e.isBeingSizeAdjusted,component:h,runQueriesCallback:s,updateComponentAttributes:function(e){o({type:"updateDisplayComponentAttributes",rowIndex:i,cellIndex:a,attributes:e})},setResults:function(e){o({type:"setResultsForComponentInDisplay",rowIndex:i,cellIndex:a,results:e})},onEdit:function(){u("component.startEditing"),o({type:"startEditingComponent",displayTarget:{rowIndex:i,cellIndex:a},libraryIndex:null,component:h})},onRemove:function(){u("component.removeFromDisplay"),o({type:"clearCell",rowIndex:i,cellIndex:a})},onDownload:function(){var t=Y(W().mark((function t(n){var r,i;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=Rn(l.dataSets,h.attributes.dataSetId),i={globalFilters:l.globalFilters,localFilters:h.localFilters},r&&Iy(n,r,e.runQueriesCallback,e.maxCSVDownloadLimit,h.attributes,f,m,p,i);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}),"empty"==v&&c.jsx(Fy,{onCreateNew:function(){return t(i,a)},onPickFromLibrary:function(){return n(i,a)},onRemoveCell:function(){return r(i,a)},cellIndex:a,rowIndex:i}),"header"==v&&kr(h)&&c.jsx(Ry,{component:h,onRemove:function(){return r(i,a)},rowIndex:i,cellIndex:a})]},"row_"+i+"_cell_"+a)},qy=pa(U({width:"100%",cursor:"ns-resize",opacity:0,paddingTop:"0.75rem",paddingBottom:"0.75rem"},ca,{"&:hover":U({},ca,{opacity:100})})),Vy=pa({position:"relative",height:"0.25rem",marginLeft:"40%",width:"20%"}),Wy=pa(U({cursor:"ew-resize",position:"absolute",right:"-0.75rem",height:"25%",width:"0.25rem",top:"40%"},ca,{"&:hover":U({},ca,{opacity:80}),variants:{highlighted:(Ny={},Ny.true={opacity:100},Ny.false={opacity:0},Ny)}})),Hy=Object.assign((function(){return null}),{dragHandle:function(e){return pa({borderRadius:"0.75rem",background:null==e?void 0:e.borderColor})},cellDragHandle:Wy,rowDragHandle:Vy,rowDragHandleContainer:qy}),Yy=Object.assign((function(){return null}),{tooltip:pa({height:"100%",width:"100%",justifyContent:"center",alignItems:"center",display:"flex"})}),Uy=function(e){return null!=e&&e.narrow?c.jsx(cp,{placement:"right-start",tooltipContent:function(){return c.jsx(cp.Content,{children:null==e?void 0:e.tooltipLabel})},className:""+Yy.tooltip,classNameTrigger:""+Yy.tooltip,children:c.jsx(Gy,U({},e))}):c.jsx(Gy,U({},e))},Gy=function(e){var t;return c.jsxs(Cp,{onChange:null==e?void 0:e.onChange,size:"large","data-compenent":null!=(t=null==e?void 0:e["data-component"])?t:"add-cell-button",children:["+ ",c.jsx("span",{style:null!=e&&e.narrow?{display:"none"}:{},children:null==e?void 0:e.label})]})},Ky=function(e){var n=rs(),r=b.useDrag((function(){return{type:"rowHeightDragHandle",item:{rowIndex:e.rowIndex,displayRow:e.displayRow},collect:function(e){return{isDragging:e.isDragging()}},end:function(t,n){var r=n.getDifferenceFromInitialOffset();r&&e.onNewHeight(t.rowIndex,t.displayRow.height+r.y)}}}),[e.displayRow,e.rowIndex]),i=r[0],o=r[1],a=r[2];return t.useEffect((function(){a(q.getEmptyImage(),{captureDraggingState:!1})}),[]),i.isDragging?null:c.jsx("div",{ref:o,className:""+Hy.rowDragHandleContainer,children:c.jsx("div",{className:" "+Hy.dragHandle(null==n?void 0:n.dashboard)+" "+Hy.rowDragHandle,"data-themeapi":"dashboard"})})},Xy=function(e){var t=rs(),n=b.useDrag((function(){return{type:"componentWidthDragHandle",item:{displayRow:e.displayRow,cellIndex:e.cellIndex,rowIndex:e.rowIndex},collect:function(e){return{isDragging:e.isDragging()}}}}),[JSON.stringify(e.displayRow),JSON.stringify(e.rowIndex)]);return n[0].isDragging?null:c.jsx("div",{ref:n[1],className:Hy.dragHandle(null==t?void 0:t.dashboard)+" "+Hy.cellDragHandle({highlighted:null!=e&&e.rowHighlighted?"true":"false"})})},Qy={name:"b7hthc",styles:"position:absolute;top:-0.25rem;display:flex;height:100%;width:100%;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms"},Jy={name:"1vjyfqt",styles:"position:absolute;top:0px;height:0.5rem;width:0.5rem;border-radius:9999px;background-color:rgb(0 0 0 / 0.8)"},Zy={name:"ve8olc",styles:"position:absolute;top:0px;height:0.5rem;width:0.5rem;border-radius:9999px;background-color:rgb(0 0 0 / 0.1)"},$y=function(e){var t=b.useDrop((function(){return{accept:"componentWidthDragHandle",drop:function(t,n){var r=n.getDifferenceFromInitialOffset();r&&e.onDrop(t.cellIndex,r.x,t.displayRow)},collect:function(e){return{isOver:e.isOver()}}}}));return c.jsx("div",{ref:t[1],style:{position:"absolute",left:e.dropIndex*e.colWidth+e.colWidth/2+32+"px",width:e.colWidth+"px"},css:Qy,children:t[0].isOver?c.jsx("div",{style:{left:"calc(50% - 10px)"},css:Jy}):c.jsx(c.Fragment,{children:e.active&&c.jsx("div",{style:{left:"calc(50% - 10px)"},css:Zy})})})},ew={name:"1kzq5ms",styles:"height:100%;width:100%"},tw={name:"cvkgqy",styles:"display:inline-block;overflow-y:hidden"},nw={name:"1wv4onu",styles:"position:relative;height:100%"},rw=function(e){var n=$b(),r=n[0],o=n[1],a=t.useState(!1),l=a[0],s=a[1],u=Ol().scope,d=function(e){return parseFloat(((e-1)/12).toFixed(2))}(o),p=b.useDragLayer((function(t){var n=t.getItem(),r=t.getItemType(),i=t.getDifferenceFromInitialOffset(),o=[].concat(Ro(12)).map((function(){return 0})),a=0;if(null!=i)if("rowHeightDragHandle"==r&&e.rowIndex==n.rowIndex)a=i.y;else if("componentWidthDragHandle"==r&&n&&e.rowIndex==n.rowIndex){var l=i.x;o[n.cellIndex]=l,o[n.cellIndex+1]=-l}return{rowHeightAdjustment:a,moveType:r,adjustRowIndex:e.rowIndex,widthAdjustments:o,activeCell:n?n.cellIndex:null,activeRow:n?n.rowIndex:null,isDraggingComponentWidth:"componentWidthDragHandle"==r}})),f=p.rowHeightAdjustment,m=p.widthAdjustments,h=p.activeCell,v=p.activeRow,g=p.moveType,x=p.isDraggingComponentWidth,y=t.useRef(null),w=t.useState(),C=w[0],j=w[1];t.useEffect((function(){y.current&&j(y.current.offsetWidth)}),[]);var S=f+e.displayRow.height,F=e.displayRow.components.some((function(e){return kr(e)}));return c.jsx("div",{onMouseOver:function(){return s(!0)},onMouseLeave:function(){return s(!1)},onFocus:function(){return s(!0)},onBlur:function(){return s(!1)},style:{position:"relative"},children:c.jsxs(es,{columns:e.columns,"data-component":"panel-row",marginBottom:F?void 0:26,children:[c.jsx(Gd,{alignItems:"stretch",paddingBottom:10,paddingTop:8,"data-component":"add-cell",direction:"column",gap:"0.5rem",children:!F&&l&&e.canAddNewCells&&c.jsxs(t.Fragment,{children:[!e.hideAddNewHeaderRow&&c.jsx(zd,{minHeight:32,width:32,children:c.jsx(Uy,{onChange:e.onAddHeaderRow,narrow:!0,tooltipLabel:"Add Header",label:"Add Header","data-component":"add-header-row"})}),c.jsx(Uy,{onChange:e.onAppendCell,narrow:!0,tooltipLabel:"Add Cell to Dashboard",label:"Add Cell","data-component":"add-cell-button"})]})}),c.jsxs("div",{ref:y,className:""+ow(S,u,e.displayRow.components.length),"data-component":"rowContainer",children:[x&&c.jsx(c.Fragment,{children:Ro(12).map((function(t,n){return c.jsx($y,{onDrop:function(t,r,o){var a=i.cloneDeep(o),l=i.sumBy([].concat(a.components).splice(0,t),(function(e){return e.colSpan})),s=n+1-l,u=s-[].concat(a.components)[t].colSpan,d=[].concat(a.components).map((function(e){return e.colSpan}));d[t]=s,d[t+1]=d[t+1]-u,e.onColSpanChange(d.map((function(e){return{colSpan:e}})))},dropIndex:n,colWidth:d,active:null!=h},n)}))}),c.jsx("div",{css:ew,ref:r,children:[].concat(e.displayRow.components).map((function(t,n){var r=n==e.displayRow.components.length-1,i="componentWidthDragHandle"==g&&null!=h&&e.rowIndex==v&&(h==n||h+1==n),o="rowHeightDragHandle"==g&&e.rowIndex==v;return c.jsx("div",{css:tw,className:""+iw(S,d*t.colSpan+(m[n]||0),u,C),"data-component":"cellContainer",children:c.jsxs("div",{css:nw,style:{width:"calc(100% - 20px)"},children:[c.jsx(By,{maxCSVDownloadLimit:e.maxCSVDownloadLimit,isBeingSizeAdjusted:i||o,onCreateNew:e.onCreateNew,onPickFromLibrary:e.onPickFromLibrary,onRemoveCell:e.onRemoveCell,rowIndex:e.rowIndex,dispatch:e.dispatch,cellIndex:n,dashboard:e.dashboard,runQueriesCallback:e.runQueriesCallback,broadcastEvent:e.broadcastEvent}),!r&&"read_write"===u&&!F&&c.jsx(Xy,{displayRow:e.displayRow,rowIndex:e.rowIndex,cellIndex:n,rowHighlighted:l})]})},"row_"+e.rowIndex+"_cell_"+n)}))}),"read_write"===u&&c.jsx(Ky,{onNewHeight:function(t,n){e.dispatch({type:"setRowHeight",rowIndex:t,height:n})},dispatch:e.dispatch,displayRow:e.displayRow,rowIndex:e.rowIndex})]},"actual_resizable_row_"+e.rowIndex)]})})},iw=function(e,t,n,r){var i;return pa("read"===n?((i={})["@media (min-width: 768px)"]={width:t,height:"100%"},i["@media (max-width: 767px)"]={width:null!=r?r:"100%",height:e},i):{width:t,height:"100%"})},ow=function(e,t,n){var r;return pa("read"===t?((r={})["@media (min-width: 768px)"]={height:e},r["@media (max-width: 767px)"]={height:e*n},r):{height:e})},aw=function(e){var t,n;return c.jsx(zd,{padding:null==e?void 0:e.padding,marginTop:"0.50rem","data-component":null==e?void 0:e["data-component"],marginBottom:"1rem",className:"vizzly-toolbar",children:c.jsxs(Gd,{className:""+lw,children:[c.jsxs("a",{href:e.logo.href,className:""+sw,target:null!=(t=null==e||null==(n=e.logo)?void 0:n.target)?t:void 0,children:[c.jsx("span",{className:""+Aa.srOnly,children:"Vizzly"}),c.jsx(sl,{}),(null==e?void 0:e.logo.text)&&c.jsx(zd,{as:"span",paddingTop:2,children:e.logo.text})]}),null==e?void 0:e.children]})})},lw=pa({background:"#E7EAF1",color:"#151515",padding:"0 0.75rem",borderRadius:12,position:"relative",minHeight:40}),sw=pa({position:"absolute",left:12,top:7.5,display:"flex",gap:"0.5rem",alignItems:"center",fontSize:12,fontWeight:600}),uw=pa({height:30,background:us.colors.brand[20],width:1}),dw={background:"transparent",color:cs(0),border:"1px solid transparent",padding:"0.30rem 0.25rem",borderRadius:8,fontFamily:"system-ui, -apple-system","&:hover":{background:"rgba(48, 116, 217, 0.1)",border:"1px solid transparent",color:us.colors.brand.base},"&:focus":{background:"rgba(48, 116, 217, 0.1)",border:"1px solid transparent",color:us.colors.brand.base},fontSize:12,fontWeight:600},cw={name:"1gok8e8",styles:"margin-bottom:0.5rem"},pw={name:"1gok8e8",styles:"margin-bottom:0.5rem"},fw=function(){var e=t.useState("small"),n=e[0],r=e[1],i=Bc().dashboard,o=t.useState(!1),a=o[0],l=o[1],s=Ol(),u=s.featureToggles,d=s.scope,p=s.mode,f=s.onSave,m=s.queryEngineConfig,h=s.onOpenConfigManagerUi;if(s.disableToolbar)return null;var v=Qr(i),g=function(){"read_write"==d&&f(i)},b=Vi(m,"configManagerUi")&&h;t.useEffect((function(){!function(){var e=Y(W().mark((function e(){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u.disableAutoSave||"endUser"!=p?qr("Auto-save is disabled, so the dashboard will not be saved."):g();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()()}),[v&&JSON.stringify({display:v.display,componentLibrary:v.componentLibrary,globalFilters:v.globalFilters})]);var x=function(){l(!1)};return c.jsxs(c.Fragment,{children:[("admin"==p||b)&&"hidden"!==n&&c.jsx(aw,{"data-component":"admin-tools",logo:{href:"https://docs.vizzly.co/",target:"_blank"},children:c.jsx(Gd,{justifyContent:"end",alignItems:"center",padding:"0.1rem 0",children:c.jsxs(Of,{buttons:"end",children:[b&&c.jsx(_p,{testId:"manage-data-sets",secondary:!0,onClick:function(){h()},internal:!0,themeOverride:dw,children:"Config Manager"}),"admin"==p&&c.jsx(_p,{secondary:!0,testId:"save-dashboard",onClick:function(){l(!0)},internal:!0,themeOverride:dw,children:"Save"}),c.jsx("div",{className:""+uw}),c.jsxs(_p,{secondary:!0,onClick:function(){return r("hidden")},internal:!0,themeOverride:dw,children:[c.jsx("span",{className:""+Aa.srOnly,children:"Hide Tools"}),c.jsx(za,{})]})]})})}),c.jsxs(If,{width:"sm",isOpen:a,onClose:function(){return x()},children:[c.jsx(If.Header,{title:"Confirm changes?"}),c.jsxs(If.Content,{children:[c.jsx("p",{css:cw,children:"Are you sure you want to save this dashboard?"}),c.jsx("p",{css:pw,children:"This will save the dashboard that new users will see, and the verified views in the library for new and existing users."})]}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{secondary:!0,onClick:function(){return x()},children:"Cancel"}),c.jsx(_p,{testId:"confirm-save",onClick:function(){g(),x()},children:"Save"})]})})]})]})},mw=function(e){var n=Bc(),r=n.dashboard,o=n.dispatch,a=Ol().dashboardFilters,l=t.useState(0===r.globalFilters.length),s=l[0],u=l[1];return t.useEffect((function(){var e=function(e,t){var n,r=t(e.dataSets,[]).map((function(e){return U({},e,{managedByConfiguration:!0})})),o=[].concat(e.globalFilters).filter((function(e){return!e.managedByConfiguration})),a=t(e.dataSets,o),l=(n=r,[].concat(a).filter((function(e){return!pr(n,e)})));return e.globalFilters.length==l.length?i.cloneDeep(l):(Wr("dashboardFilters function did not return the same number of user-added dashboard filters, so changes made to user-added dashboard filters will be ignored."),i.cloneDeep(e.globalFilters))}(r,a);o({type:"setGlobalFilters",globalFilters:e}),u(!0)}),[]),s?c.jsx(c.Fragment,{children:e.children}):null},hw={name:"firlg",styles:"grid-column:span 2 / span 2"},vw=function(e){return c.jsx("div",{css:hw,children:e.children})},gw=function(e){return c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Gd,{gap:"0.75rem",direction:"column",children:e.section.metrics.map((function(t,n){return c.jsxs(vw,{children:[c.jsx(gf,{children:t.title}),c.jsx(mg,U({componentType:e.attributes.type},e,{allowsMultiple:t.allowsMultiple,propKey:t.propKey,setPartialAttributes:e.setAttributes,supportedAggregates:e.queryEngineConfig.supportedAggregates}))]},n)}))})})},bw=function(e){return(null==e?void 0:e.dataSets.length)<2&&!e.dataSet.preAggregated?null:c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,"data-component":"dataset-section",children:c.jsx(og,U({},e,{setPartialAttributes:e.setAttributes}))})},xw=function(e){var t=Ol();return 0==mb(t.featureToggles,e.attributes.type,null==e?void 0:e.queryEngineConfig).length||e.dataSet.preAggregated?null:c.jsx(c.Fragment,{children:e.featureToggles.canEditCustomMetrics&&c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,"data-component":"custom-metric-section",children:c.jsx(Cb,{queryEngineConfig:e.queryEngineConfig,setDataSets:e.setDataSets,dataSetId:e.attributes.dataSetId,dataSets:e.dataSets,componentType:e.attributes.type})})})},yw=function(e){if(e.dataSet.preAggregated)return null;if(!("order"in e.attributes))return null;var t=e.attributes,n=[],r=[];if("comboChart"===t.type){if(!("barDimension"in t&&"lineDimension"in t&&"barMeasure"in t&&"lineMeasure"in t))return null;var i=function(e){var t=[].concat(e.barDimension,e.lineDimension),n=[].concat(e.barMeasure,e.lineMeasure);return{dimension:t.filter((function(e,t,n){return n.findIndex((function(t){return JSON.stringify(t)===JSON.stringify(e)}))===t})),measure:n.filter((function(e,t,n){return n.findIndex((function(t){return JSON.stringify(t)===JSON.stringify(e)}))===t}))}}(t);n=i.dimension,r=i.measure}else{if(!("dimension"in t))return null;if(!("measure"in t))return null;n=t.dimension,r=t.measure}return c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,"data-component":"sort-section",children:c.jsx(gg,U({},e,{attributes:t,timeDimension:"timeDimension"in t&&t.timeDimension||null,dimension:n,measure:r,setPartialAttributes:e.setAttributes}))})},ww=function(e){var n=t.useState([]),r=n[0],i=n[1],o=Ol(),a=o.mode,l=o.queryEngineConfig,s=Tb(r,null==e?void 0:e.dataSet,"grouping",l,i),u=kb(null==e?void 0:e.dataSet,{onlyDimensions:!0},!0,[].concat(r,null==e?void 0:e.dimension)),d=Fb(r,"grouping",l,i);return c.jsxs(If,{width:"2xl",isOpen:e.show,onClose:function(){return e.onClose()},children:[c.jsx(If.Header,{title:"Add Drilldown"}),c.jsx(If.Content,{children:c.jsx(es,{columns:["1fr"],gap:"1rem",children:c.jsxs(Rf,{children:[c.jsx(Tc,{as:"p",children:"Drilldown field"}),c.jsx(kp,{mode:a,onDeleteItem:function(){return i([])},items:s,newItem:{callToAction:"Add drilldown field",onNew:d,initValues:u,hide:r.length>0}})]})})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{onClick:function(){return null==e?void 0:e.onClose()},secondary:!0,children:"Close"}),c.jsx(_p,{onClick:function(){var t;0===r.length||e.onClose({subsetDimension:tt({field:r[0].field,function:null==(t=r[0])?void 0:t.function})})},primary:!0,disabled:0===r.length,children:"Update"})]})})]})},Cw=function(e){var n=Ol(),r=n.mode,o=n.queryEngineConfig,a=t.useState(!1),l=a[0],s=a[1];t.useEffect((function(){null!=e&&e.drilldown&&(null==e?void 0:e.drilldown.length)>0&&(0!==e.dimensions.length||i.isEmpty(e.drilldown)||e.onSetDrilldown([]))}),[e.dimensions]);var u=function(){var t;if(!(null==e||null==(t=e.drilldown)?void 0:t[0]))return[];var n=nt(null==e?void 0:e.drilldown[0].subsetDimension,o),r=Mn(e.dataSet,n.field);return[{title:vg(r.publicName,n.function&&"none"!=n.function&&Ne(n.function))}]}();return c.jsxs(c.Fragment,{children:[c.jsx(kp,{mode:r,newItemBtn:i.isEmpty(null==e?void 0:e.drilldown)?{callToAction:"Add drilldown",onClick:function(){s(!0)}}:void 0,onDeleteItem:function(){return e.onSetDrilldown([])},items:u}),l&&c.jsx(ww,{show:l,onClose:function(t){t&&e.onSetDrilldown([t]),s(!1)},dimension:null==e?void 0:e.dimensions,dataSet:e.dataSet})]})},jw=function(e){return"tableDrilldown"in e.attributes?c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Cw,{dataSet:e.dataSet,dimensions:e.attributes.dimension,drilldown:null==e?void 0:e.attributes.tableDrilldown,onSetDrilldown:function(t){return e.setAttributes({tableDrilldown:t})}})}):null},Sw=function(e){return"filter"in e.attributes?e.dataSet.preAggregated?null:c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(_b,U({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes}))}):null},Fw=function(e){return"limit"in e.attributes?e.dataSet.preAggregated?null:c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Ob,{label:"Limit",labelHidden:!0,id:"limit",currentValue:e.attributes.limit,setNumber:function(t){return e.setAttributes({limit:t||0})}})}):null},kw=function(e){return"limit"in e.attributes?c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Ob,{label:"Limit",currentValue:e.attributes.limit,testId:"pagination-limit-input",setNumber:function(t){e.setAttributes({limit:t||0,offset:0})}})}):null},Tw=function(e){return"comboChart"!=e.attributes.type?null:c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,children:c.jsxs(Gd,{gap:"0.75rem",direction:"column","data-component":"combo-chart-compare",children:[c.jsxs(zd,{children:[c.jsx(gf,{children:"Line"}),c.jsx(cg,U({propKey:"lineDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),c.jsxs(zd,{children:[c.jsx(gf,{children:"Bar"}),c.jsx(cg,U({propKey:"barDimension"},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes,supportedTransformationFunctions:e.queryEngineConfig.supportedTransformationFunctions}))]}),c.jsxs(zd,{children:[c.jsx(gf,{children:"Time"}),c.jsx(pg,U({},e,{attributes:{timeDimensions:e.attributes.timeDimension?[e.attributes.timeDimension]:[]},allow:1,supportedTimeDimensions:e.queryEngineConfig.supportedTimeTruncFunctions,setPartialAttributes:function(t){var n;t.timeDimensions&&(null==e||e.setAttributes({timeDimension:null!=(n=t.timeDimensions[0])?n:null}))}}))]})]})})},Aw=function(e){return"measure"in e.attributes?c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(hg,U({},e,{attributes:e.attributes,setPartialAttributes:e.setAttributes}))}):null},Dw=function(e){return c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,"data-component":"views-section",children:c.jsx(Tg,U({},e,{setPartialAttributes:e.setAttributes}))})},Iw=function(e){return c.jsx(Yg,{title:e.section.title,tooltip:e.section.description,children:c.jsx(Sb,U({},e,e.section,{setPartialAttributes:e.setAttributes}))})},Pw=function(e){return c.jsx(es,{gap:"1.5rem",children:null==e?void 0:e.children})},_w=function(e){var t=Object.keys(e.queryEngineConfig.supportedTimeTruncFunctions),n=Ln(e.dataSet.fields,{onlyFieldTypes:["date_time"]});if(0===n.length)return null;var r,i=[];e.deltaTimeDimension&&i.push({title:Mn(e.dataSet,e.deltaTimeDimension.field).publicName,subtext:e.queryEngineConfig.supportedTimeTruncFunctions[null==(r=e.deltaTimeDimension)?void 0:r.truncate].publicName+" window",select:{onChange:function(t){e.deltaTimeDimension&&e.setDeltaTimeDimension(U({},e.deltaTimeDimension,{truncate:t}))},selected:e.deltaTimeDimension?e.deltaTimeDimension.truncate:t[0],options:[].concat(t).map((function(t){return{label:e.queryEngineConfig.supportedTimeTruncFunctions[t].publicName,value:t}}))}});var o=[].concat(n).map((function(e){return{title:""+e.publicName,subtext:"",value:e.id}})),a=Ol();return c.jsx(kp,{mode:a.mode,onDeleteItem:function(){e.setDeltaTimeDimension(null)},items:i,newItem:{callToAction:"Add percentage and absolute change",hide:null!=e.deltaTimeDimension,initValues:o,onNew:function(n){e.setDeltaTimeDimension({truncate:t[0],field:n,bucketFill:!1})}}})},Ew=function(e){var t,n=Ol().queryEngineConfig,r=null==e?void 0:e.attributes;return t=Ln((null==e?void 0:e.dataSet).fields,{onlyFieldTypes:["date_time"]}),a(t)?null:c.jsx(Yg,{title:"Comparison",children:c.jsx(_w,{dataSet:null==e?void 0:e.dataSet,deltaTimeDimension:r.deltaTimeDimension,setDeltaTimeDimension:function(t){e.setAttributes({deltaTimeDimension:t})},queryEngineConfig:n})})},Ow=function(e){var r=e.dataPanelConfig.some((function(e){return"function"!=typeof e&&("filter"===e.type||"customMetrics"==e.type||"limit"==e.type)}))&&!e.dataSet.preAggregated;return c.jsxs(Pw,{children:[e.dataPanelConfig.map((function(t,r){return"function"==typeof t?c.jsx(n.Fragment,{children:t({dataSet:e.dataSet,attributes:e.attributes,dataSets:e.dataSets,featureToggles:e.featureToggles,setDataSet:e.setDataSet,setAttributes:e.setAttributes,setDataSets:e.setDataSets,queryEngineConfig:e.queryEngineConfig})},""+r):c.jsxs(n.Fragment,{children:["fieldCollector"==t.type&&c.jsx(Iw,U({},e,{section:t})),"drilldown"==t.type&&c.jsx(jw,U({},e,{section:t})),"labelledMetrics"==t.type&&c.jsx(gw,U({},e,{section:t})),"fields"==t.type&&c.jsx(Aw,U({},e,{section:t})),"dataSet"==t.type&&c.jsx(bw,U({},e,{section:t})),"views"==t.type&&c.jsx(Dw,U({},e,{section:t})),"sort"==t.type&&c.jsx(yw,U({},e,{section:t})),"pagination"==t.type&&c.jsx(kw,U({},e,{section:t})),"comboChartDimension"==t.type&&c.jsx(Tw,U({},e,{section:t})),"comparison"==t.type&&c.jsx(Ew,U({},e,{section:t}))]},t.type+"_"+r)})),r&&c.jsx(Zc,{title:"Advanced Options",defaultOpen:!1,showAccordionIcon:!0,onOpened:function(){yb("bottom","editor-panel")},children:c.jsx(Pw,{children:e.dataPanelConfig.map((function(n,r){return"function"!=typeof n?c.jsxs(t.Fragment,{children:["filter"==n.type&&c.jsx(Sw,U({},e,{section:n})),"customMetrics"==n.type&&c.jsx(xw,U({},e,{section:n})),"limit"==n.type&&c.jsx(Fw,U({},e,{section:n}))]},r):null}))})})]})},Lw=function(){var e=jg();if(!e)return c.jsx(hc,{});var t=e.dataSet,n=e.queryEngineConfig,r=e.dataPanel,i=e.dashboard,o=e.setPartialAttributes,a=e.component.attributes;if(!t)throw"Data set required to show data props editor.";var l=On(a.type,{queryEngineConfig:n});return c.jsx(Ow,{setDataSets:e.setDataSets,setAttributes:o,setDataSet:e.setDataSet,dataSets:i.dataSets,dataSet:t,featureToggles:e.featureToggles,attributes:a,queryEngineConfig:n,dataPanelConfig:r(l.dataPanelConfig(),{type:a.type})})},Rw=function(e){var n,r=e.section,i=e.setAttributes,o=e.attributes;return c.jsx(Yg,{title:r.title,tooltip:null==r?void 0:r.description,children:c.jsx(Yg.Grid,{children:null==r||null==(n=r.subSection)?void 0:n.map((function(e,n){return c.jsxs(t.Fragment,{children:["title"===e.type&&c.jsx("div",{children:c.jsx(np,{label:null==e?void 0:e.title,"data-testid":"display-title-input",id:"display-title-input",type:"text",onChange:function(e){return i({displayTitle:e.target.value})},defaultValue:o.displayTitle})}),"subject"===e.type&&c.jsx("div",{children:c.jsx(np,{label:null==e?void 0:e.title,"data-testid":"display-subject-input",id:"display-subject-input",type:"text",onChange:function(e){i({displaySubject:e.target.value})},defaultValue:o.displaySubject})})]},n)}))})})},Mw=function(e){return c.jsx(Dc,{children:c.jsx(Ac,{labelHidden:null==e?void 0:e.labelHidden,label:e.label,id:null==e?void 0:e.id,onChange:e.onSelect,options:e.options,selected:e.currentValue,dynamicWidth:!0})})},Nw=function(e){return c.jsxs(Gd,{alignItems:"top"===(null==e?void 0:e.checkboxPosition)?"flex-start":"center",children:[c.jsx(rp,{onChange:function(t){e.setChecked(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),c.jsx(Tc,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},zw=function(e){var t,n=Ol().numberFormatOptions,r=Object.keys(n).map((function(e){return{value:e,label:n[e].description}}));return c.jsx(Dc,{children:c.jsx(Ac,{id:null==e?void 0:e.id,showClearBtn:!0,selected:null==e?void 0:e.currentValue,label:null!=(t=null==e?void 0:e.label)?t:"Format",onChange:function(t){return null==e?void 0:e.onChange(t)},options:r})})},Bw=function(e){var n=e.section,r=e.attributes,i=e.setAttributes,o=n.subSection.some((function(e){return"legend"===e.type||"numberFormat"===e.type})),a=n.subSection.some((function(e){return"stacked"===e.type||"curve"===e.type}));return c.jsx(Yg,{title:n.title,tooltip:null==n?void 0:n.description,children:c.jsxs(es,{gap:"1rem",children:[a&&c.jsx(Yg.Grid,{columns:2,"data-component":"layout",children:null==n?void 0:n.subSection.map((function(e,n){return c.jsxs(t.Fragment,{children:["stacked"===e.type&&c.jsx(Mw,{id:"format-layout-stacked",label:e.title,currentValue:void 0!==r.stacked&&r.stacked,onSelect:function(e){return i({stacked:e})},options:[{label:"Grouped",value:!1},{label:"Stacked",value:!0},{label:"Stacked (100%)",value:"100%"}]}),"curve"===e.type&&c.jsx(Mw,{label:e.title,id:"format-layout-curve",currentValue:r.lineCurve,onSelect:function(e){return i({lineCurve:e})},options:[{value:"natural",label:"Natural"},{value:"straight",label:"Straight"},{value:"step",label:"Step"}]})]},n)}))}),o&&c.jsx(Yg.Grid,{"data-component":"settings",children:null==n?void 0:n.subSection.map((function(e,n){return c.jsxs(t.Fragment,{children:["legend"===e.type&&c.jsx(Nw,{label:e.title,setChecked:function(e){return i({legend:e})},currentValue:r.legend,id:"show-legend-input"}),"numberFormat"===e.type&&c.jsx(zw,{label:e.title,onChange:function(e){return i({labelFormat:e})},id:"format-number",currentValue:r.labelFormat,testId:"format-number"})]},n)}))})]})})},qw=function(e){return c.jsx(Rf,{children:c.jsx("div",{className:""+Vw,children:c.jsx(np,{label:e.label,id:null==e?void 0:e.id,style:{padding:0,flexGrow:1,marginBottom:0},type:"color",onChange:function(t){e.setColor(t.target.value)},value:e.currentValue||void 0})})})},Vw=pa({width:"100%",flexDirection:"column",flexGrow:1,height:"100%",display:"flex"}),Ww=function(e){return c.jsx("div",{children:c.jsx(np,{id:null==e?void 0:e.id,label:null==e?void 0:e.label,maxLength:e.maxLength,onChange:function(t){e.setText(t.target.value)},defaultValue:e.currentValue||void 0})})},Hw=function(e){return c.jsxs(Gd,{alignItems:"center",children:[c.jsx(rp,{onChange:function(t){e.onChange(t.target.checked)},defaultChecked:e.currentValue||void 0,id:null==e?void 0:e.id}),c.jsx(Tc,{htmlFor:null==e?void 0:e.id,margin:0,fontWeight:"inherit",children:e.label})]})},Yw=[{label:"Auto",value:"auto"},{label:"Minimal",value:2},{label:"None",value:0}],Uw=function(e){var t,n,r,i,o,a,l,s,u,d,p,f,m,h,v,g,b,x="horizontalBarChart"==e.attributes.type,y=(null==(t=e.attributes)||null==(n=t.dimension)?void 0:n.length)>0&&"number"===Mn(e.dataSet,null==(r=e.attributes)||null==(i=r.dimension[0])?void 0:i.field).dataType&&!(null!=(o=e.attributes)&&o.timeDimension),w=x?{x:"y",y:"x"}:{x:"x",y:"y"},C=w.x,j=w.y;return c.jsx(Yg,{title:null==(a=e.section)?void 0:a.title,tooltip:null==(l=e.section)?void 0:l.description,"data-component":"axis-preference-section",children:c.jsxs(Yg.Container,{"data-component":"single-stats-labels",children:[c.jsxs(Yg.Panel,{title:null==(s=e.section[j])?void 0:s.title,children:[c.jsxs(Yg.Grid,{columns:2,children:[c.jsx(Ww,{label:e.section[j].prefix.title,setText:function(t){return e.setAttributes({yAxisPrefix:t})},currentValue:e.attributes.yAxisPrefix,maxLength:4,id:"axis-"+j+"-prefix"}),c.jsx(Ww,{label:e.section[j].postfix.title,setText:function(t){return e.setAttributes({yAxisPostfix:t})},currentValue:e.attributes.yAxisPostfix,maxLength:4,id:"axis-"+j+"-postfix"})]}),c.jsxs(Yg.Grid,{columns:2,children:[c.jsx(zw,{label:null==(u=e.section[j].format)?void 0:u.title,id:"axis-"+j+"-format",onChange:function(t){return e.setAttributes({yAxisFormat:t})},currentValue:e.attributes.yAxisFormat,testId:"axis-"+j+"-format"}),c.jsx(Mw,{id:"axis-"+j+"-label-count",label:e.section.y.count.title,currentValue:e.attributes.approxYAxisLabelCount,onSelect:function(t){return e.setAttributes({approxYAxisLabelCount:t})},options:Yw})]}),c.jsx(Yg.Grid,{children:c.jsx(Ww,{label:null!=(d=null==(p=e.section[j].axisTitle)?void 0:p.title)?d:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[j]=t,n)})},currentValue:null==(f=e.attributes.axisTitles)?void 0:f[j],id:"axis-"+[j]+"-axisTitle"})})]}),c.jsxs(Yg.Panel,{title:e.section[C].title,children:[c.jsxs(Yg.Grid,{columns:2,children:[c.jsx(Ww,{label:e.section[C].prefix.title,setText:function(t){return e.setAttributes({xAxisPrefix:t})},currentValue:e.attributes.xAxisPrefix,maxLength:4,id:"axis-"+C+"-prefix"}),c.jsx(Ww,{label:e.section[C].postfix.title,setText:function(t){return e.setAttributes({xAxisPostfix:t})},currentValue:e.attributes.xAxisPostfix,maxLength:4,id:"axis-"+C+"-postfix"})]}),c.jsx(Yg.Grid,{columns:y?2:1,children:c.jsxs(c.Fragment,{children:[y&&c.jsx(zw,{label:null==(m=e.section[C].format)?void 0:m.title,id:"axis-"+C+"-format",onChange:function(t){e.setAttributes({xAxisFormat:t})},currentValue:e.attributes.xAxisFormat,testId:"axis-"+j+"-format"}),null!=(h=e.attributes)&&h.timeDimension?c.jsx(Mw,{id:"axis-"+C+"-label-count",label:e.section.x.count.title,currentValue:e.attributes.approxXAxisLabelCount,onSelect:function(t){return e.setAttributes({approxXAxisLabelCount:t})},options:Yw}):c.jsx(Hw,{label:"Hide Labels",onChange:function(t){return e.setAttributes({approxXAxisLabelCount:t?0:"auto"})},id:"hide-labels",currentValue:0===e.attributes.approxXAxisLabelCount})]})}),c.jsx(Yg.Grid,{children:c.jsx(Ww,{label:null!=(v=null==(g=e.section[C].axisTitle)?void 0:g.title)?v:"",setText:function(t){var n;return e.setAttributes({axisTitles:(n={},n[C]=t,n)})},currentValue:null==(b=e.attributes.axisTitles)?void 0:b[C],id:"axis-"+[C]+"-axisTitle"})})]})]})})},Gw=function(e,t){return t.map((function(t){var n=Mn(e,t.field);return{label:n.publicName+(ut(t)?" ("+Ne(t.function)+")":""),value:lt(t),icon:c.jsx(oc,{icon:n.dataType,paddingTop:0})}}))},Kw=function(e,t){return[].concat(t).flatMap((function(t){var n=Mn(e,t.field);return"date_time"==n.dataType?[]:[{label:n.publicName,value:t.field,icon:c.jsx(oc,{icon:n.dataType,paddingTop:0})}]}))},Xw=function(e,t,n){var r=st(t,n),i=Mn(e,r.field);return"none"==r.function?i.dataType:"number"},Qw=function(e,t,n){if(!t)return[];var r=Xw(e,t,n);return[].concat(Me({dataType:r},n)).filter(Jw).map((function(e){return{label:qe(e),value:e}}))},Jw=function(e){return!("is_one_of"===e||"is_not_one_of"===e)},Zw={name:"xwlclt",styles:"display:grid;grid-template-columns:repeat(4, minmax(0, 1fr));gap:1rem"};function $w(e){var n=e.isOpen,r=e.dataSet,i=e.onClose,o=e.measures,a=e.dimension,l=e.onSave,s=e.ruleType,u=e.queryEngineConfig,d=t.useState(void 0),p=d[0],f=d[1],m=t.useState(void 0),h=m[0],v=m[1],g=t.useState(void 0),b=g[0],x=g[1],y=t.useState("#2aeb84"),w=y[0],C=y[1],j=p?Mn(r,rt(p,u).fieldId):null,S=void 0!==b&&"string"==typeof b&&0!==b.length||void 0!==b&&"boolean"==typeof b||void 0!==b&&"number"==typeof b&&!Number.isNaN(b),F=p?Xw(r,p,u):null;return c.jsxs(If,{isOpen:n,onClose:i,width:"4xl",children:[c.jsx(If.Header,{title:"Add Conditional Formatting",hiddenUnlessEnabledInCss:!1}),c.jsx(If.Content,{children:c.jsxs("div",{css:Zw,children:[c.jsx(Rf,{children:c.jsx(Ac,{id:"conditional-formatting-field",label:"Field",anchorLeft:!0,options:[].concat(Kw(r,a),Gw(r,o)),selected:p,onChange:function(e){return f(e)},renderSelected:function(e){return c.jsx(Ag,U({},e,{option:"inline"}))},controlClassName:""+Aa.paddingLeft("0.5rem")})}),c.jsx(Rf,{children:j&&c.jsx(Ac,{label:"Operator",id:"conditional-formatting-operator",anchorLeft:!0,options:[].concat(Qw(r,p,u)),selected:h,onChange:function(e){return v(e)}})}),"number"==F&&c.jsx(Ob,{id:"conditional-formatting-value",label:"Value",currentValue:b,setNumber:function(e){return x(e)}}),"string"==F&&c.jsx(Ww,{id:"conditional-formatting-value",label:"Value",currentValue:b,setText:function(e){return x(e)}}),"boolean"==F&&c.jsx(zd,{children:c.jsx(Ac,{label:"Value",id:"conditional-formatting-value",options:[{label:"True",value:!0},{label:"False",value:!1}],selected:b,onChange:function(e){return x(e)}})}),S&&c.jsx(qw,{id:"color-formatting",label:"Color",currentValue:w,setColor:function(e){return C(e)}})]})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{secondary:!0,onClick:i,children:"Cancel"}),c.jsx(_p,{onClick:function(){p&&h&&w&&(b||0==b)&&(l({field:p,operator:h,value:b,ruleType:s,ruleValue:w}),i())},children:"Save"})]})})]})}var eC={name:"s5xdrg",styles:"display:flex;align-items:center"},tC={name:"v5pkt6",styles:"margin-left:0.5rem;display:inline-block;height:1rem;width:1rem;border-radius:0.125rem"},nC=function(e){var t=rt(e.rule.field,e.queryEngineConfig),n=t.function,r=Mn(e.dataSet,t.fieldId);return c.jsxs("span",{css:eC,children:[c.jsxs("p",{className:""+Aa.text,children:["If"," ",c.jsxs("b",{children:[r.publicName," ",n&&"none"!=n&&"("+n+")"]})," ","is ",c.jsx("b",{children:e.rule.operator})," ",c.jsx("b",{children:e.rule.value})," then color is"]}),c.jsx("span",{css:tC,style:{backgroundColor:e.rule.ruleValue}})]})},rC=function(e){var n,r=t.useState(!1),i=r[0],o=r[1],a=Ol();return c.jsxs(c.Fragment,{children:[c.jsx(kp,{mode:a.mode,onOrderChange:function(t,n){var r=lg([].concat(e.conditionalFormattingRules),t,n);e.onSetConditionalFormattingRules(r)},items:(null!=(n=e.conditionalFormattingRules)?n:[]).map((function(t){var n=rt(t.field,e.queryEngineConfig);return{title:Mn(e.dataSet,n.fieldId).publicName,subtext:c.jsx(nC,{dataSet:e.dataSet,rule:t,queryEngineConfig:e.queryEngineConfig})}})),newItemBtn:{callToAction:"Add Condition",onClick:function(){return o(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.conditionalFormattingRules)?n:[]);r.splice(t,1),e.onSetConditionalFormattingRules(r)}}),c.jsx($w,{queryEngineConfig:e.queryEngineConfig,ruleType:e.ruleType,dataSet:e.dataSet,isOpen:i,onClose:function(){return o(!1)},measures:e.measure,dimension:e.dimension||[],onSave:function(t){var n;e.onSetConditionalFormattingRules([].concat(null!=(n=e.conditionalFormattingRules)?n:[],[t]))}})]})},iC=function(e){var t,n=e.section,r=e.attributes;return c.jsx(Yg,{title:n.title,tooltip:null==n?void 0:n.description,children:c.jsx(Gd,{gap:"0.75rem",direction:"column",children:n.subSection?null==(t=n.subSection)?void 0:t.map((function(t,i){var o,a;return c.jsxs("div",{children:[c.jsx(gf,{children:t.title}),c.jsx(rC,{dimension:"bar"===t.propKey?r.barDimension:[],ruleType:null==n?void 0:n.ruleType,onSetConditionalFormattingRules:function(n){var r;return e.setAttributes({conditionalFormattingRules:(r={},r[t.propKey]=n,r)})},measure:"bar"===t.propKey?r.barMeasure:[],dataSet:e.dataSet,conditionalFormattingRules:null!=(o=null==r||null==(a=r.conditionalFormattingRules)?void 0:a[t.propKey])?o:void 0,queryEngineConfig:e.queryEngineConfig})]},i)})):c.jsx(rC,{dimension:r.dimension,ruleType:null==n?void 0:n.ruleType,onSetConditionalFormattingRules:function(t){return e.setAttributes({conditionalFormattingRules:t})},measure:r.measure,dataSet:e.dataSet,conditionalFormattingRules:r.conditionalFormattingRules,queryEngineConfig:e.queryEngineConfig})})})},oC=function(e){var n,r,i,o=Ol().dateTimeFormatOptions;return c.jsx(Yg,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:null==e||null==(r=e.section)||null==(i=r.subSection)?void 0:i.map((function(n,r){return c.jsxs(t.Fragment,{children:["time"===n.type&&c.jsx("div",{children:c.jsx(Ac,{label:n.title,onChange:function(t){e.setAttributes({dateTimeFormat:t})},options:Object.keys(o).map((function(e){return{label:o[e].description,value:e}})),selected:e.attributes.dateTimeFormat})}),"fontSize"===n.type&&c.jsx(Ww,{label:null==n?void 0:n.title,currentValue:e.attributes.fontSize,setText:function(t){return e.setAttributes({fontSize:t})}})]},r)}))})},aC=function(e,t){return t.map((function(t){return{label:Mn(e,t.field).publicName,value:lt(t)}}))};function lC(e){var n=e.dataSet,r=e.isOpen,i=e.onClose,o=e.measures,a=e.onSave,l=t.useState(void 0),s=l[0],u=l[1],d=t.useState(void 0),p=d[0],f=d[1];return c.jsxs(If,{isOpen:r,onClose:i,width:"sm",children:[c.jsx(If.Header,{title:"Choose a prefix"}),c.jsxs(If.Content,{children:[c.jsxs(Rf,{children:[c.jsx(gf,{children:"Field"}),c.jsx(Ac,{options:aC(n,o),selected:s,onChange:function(e){return u(e)}})]}),c.jsx(Ww,{label:"Prefix",currentValue:p,setText:f})]}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{secondary:!0,onClick:i,children:"Cancel"}),c.jsx(_p,{onClick:function(){s&&p&&(a({field:s,prefix:p}),i())},children:"Save"})]})})]})}var sC=function(e){var n,r,i=t.useState(!1),o=i[0],a=i[1],l=Ol();return c.jsxs(Yg,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(n=e.section)?void 0:n.description,children:[c.jsx(kp,{mode:l.mode,items:(null!=(r=e.attributes.prefixes)?r:[]).map((function(t){var n=rt(t.field,e.queryEngineConfig),r=n.function;return{title:Mn(e.dataSet,n.fieldId).publicName+("none"!=r?" ("+e.queryEngineConfig.supportedAggregates[r].publicName+")":""),subtext:t.prefix}})),newItemBtn:{callToAction:"Add Prefix",onClick:function(){return a(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.attributes.prefixes)?n:[]);r.splice(t,1),e.setAttributes({prefixes:r})}}),c.jsx(lC,{dataSet:e.dataSet,isOpen:o,onClose:function(){return a(!1)},measures:e.attributes.measure,onSave:function(t){var n;return e.setAttributes({prefixes:[].concat(null!=(n=e.attributes.prefixes)?n:[],[t])})}})]})},uC=function(e){var t;if("mercatorMap"!=e.attributes.type)return null;var n=e.attributes,r=n.backgroundColor,o=n.noDataColor,a=n.maxValueColor,l=n.minValueColor,s=i.debounce(e.setAttributes,200);return c.jsx(Yg,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsxs(Yg.Grid,{columns:2,children:[c.jsx("div",{children:c.jsx(qw,{id:"map-background-color",label:"Background",currentValue:r,setColor:function(e){return s({backgroundColor:e})}})}),c.jsx("div",{children:c.jsx(qw,{id:"map-no-data-color",label:"No data",currentValue:o,setColor:function(e){return s({noDataColor:e})}})}),c.jsx("div",{children:c.jsx(qw,{id:"map-min-value-color",label:"Min value",currentValue:l,setColor:function(e){return s({minValueColor:e})}})}),c.jsx("div",{children:c.jsx(qw,{id:"map-max-value-color",label:"Max value",currentValue:a,setColor:function(e){return s({maxValueColor:e})}})})]})})},dC={name:"135831l",styles:"font-size:0.75rem;line-height:1rem;opacity:0.8"},cC=function(e){var n,r,i=Ol().numberFormatOptions,o=Object.keys(i).map((function(e){return{value:e,label:i[e].description}}));return c.jsxs(Yg,{title:null==e||null==(n=e.section)?void 0:n.title,tooltip:null==e||null==(r=e.section)?void 0:r.description,children:[0==e.attributes.measure.length&&c.jsx("p",{css:dC,children:"Please select a metric on the data panel."}),c.jsx(Yg.Container,{"data-component":"single-stats-labels",children:[].concat(e.attributes.measure).map((function(n,r){var i,a,l,s,u;return c.jsxs(Yg.Panel,{title:c.jsxs(t.Fragment,{children:[Mn(e.dataSet,n.field).publicName," ","(",e.queryEngineConfig.supportedAggregates[n.function].publicName.toLowerCase(),")"]}),children:[c.jsxs(Yg.Grid,{columns:2,children:[c.jsx(Ww,{label:null==e||null==(i=e.section)?void 0:i.prefix.title,currentValue:e.attributes.prefixes[lt(n)],setText:function(t){var r,i=U({},e.attributes.prefixes,((r={})[lt(n)]=t,r));e.setAttributes({prefixes:i})}}),c.jsx(Ww,{label:null==e||null==(a=e.section)?void 0:a.postfix.title,currentValue:e.attributes.postfixes[lt(n)],setText:function(t){var r,i=U({},e.attributes.postfixes,((r={})[lt(n)]=t,r));e.setAttributes({postfixes:i})}})]}),c.jsx(Yg.Grid,{children:c.jsx(Mw,{options:o,currentValue:e.attributes.formatter[lt(n)]||"_vizzly_number",onSelect:function(t){var r,i=U({},e.attributes.formatter,((r={})[lt(n)]=t,r));e.setAttributes({formatter:i})},label:null!=(l=null==e||null==(s=e.section)||null==(u=s.format)?void 0:u.title)?l:"Format"})})]},r)}))})]})},pC={value:void 0,strokeStyle:"dashed",strokeWidth:2,color:cs(0),label:void 0},fC=function(e){return!!Se().validate(e).error},mC=function(e){return null!=e&&e.show?c.jsx(hC,U({},e)):null},hC=function(e){var n=function(e,n){var r=t.useState(null!=e?e:pC),i=r[0],o=r[1];return t.useEffect((function(){o(e||pC)}),[JSON.stringify(e)]),U({},i,{handleUpsert:function(){n(i)},onChange:function(e){o(U({},i,e))},disabled:fC(i)})}(null==e?void 0:e.goalLine,null==e?void 0:e.onSave),r=n.value,i=n.onChange,o=n.color,a=n.disabled,l=n.handleUpsert;return c.jsxs(If,{isOpen:!0,onClose:null==e?void 0:e.onClose,width:"xl",children:[c.jsx(If.Header,{title:"Add Goal Line"}),c.jsx(If.Content,{children:c.jsxs(es,{columns:["1fr","1fr"],gap:"1rem",children:[c.jsx(Rf,{children:c.jsx(Ob,{id:"goal-line-value",label:"Value",currentValue:r,setNumber:function(e){return i({value:e})}})}),c.jsx(qw,{id:"color-formatting",label:"Color",currentValue:o,setColor:function(e){return i({color:e})}})]})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(_p,{secondary:!0,onClick:null==e?void 0:e.onClose,children:"Cancel"}),c.jsx(_p,{onClick:function(){return l()},disabled:a,children:"Save"})]})})]})},vC={name:"upzw6c",styles:"margin-right:0.25rem;display:inline-block;height:1rem;width:1rem;border-radius:0.125rem"},gC=function(e){var n,r=t.useState(!1),i=r[0],a=r[1],l=Ol();return c.jsxs(c.Fragment,{children:[c.jsx(kp,{mode:l.mode,onOrderChange:function(t,n){var r=lg([].concat(e.goalLines),t,n);e.onSetGoalLineRules(r)},items:(null!=(n=e.goalLines)?n:[]).map((function(e){return{title:c.jsxs(Gd,{alignItems:"center",gap:"0.25rem",children:[c.jsx("span",{css:vC,style:{backgroundColor:e.color}}),"Set to ",c.jsx("span",{className:""+Aa.bold,children:e.value})]}),onClick:function(){return a(e)}}})),newItemBtn:{callToAction:"Add Goal Line",onClick:function(){return a(!0)}},onDeleteItem:function(t){var n,r=[].concat(null!=(n=e.goalLines)?n:[]);r.splice(t,1),e.onSetGoalLineRules(r)}}),c.jsx(mC,{show:!!i,goalLine:"boolean"!=typeof i?i:void 0,onClose:function(){return a(!1)},onSave:function(t){a(!1);var n=function(e,t,n){var r;if("object"==typeof e&&null!==e){var i=o.findIndex(t,(function(t){return o.isEqual(t,e)}));-1!==i?(r=[].concat(t))[i]=n:r=[].concat(null!=t?t:[],[n])}else r=[].concat(null!=t?t:[],[n]);return r}(i,e.goalLines,t);e.onSetGoalLineRules(n)}})]})},bC=function(e){var t;return c.jsx(Yg,{title:null==e?void 0:e.section.title,tooltip:null==e||null==(t=e.section)?void 0:t.description,children:c.jsx(gC,{onSetGoalLineRules:function(t){return e.setAttributes({goalLines:t})},goalLines:e.attributes.goalLines})})},xC=function(e){return c.jsx(Pw,{children:null==e?void 0:e.formatPanelConfig.map((function(r,i){return"function"==typeof r?c.jsx(n.Fragment,{children:r({dataSet:e.dataSet,attributes:e.attributes,dataSets:e.dataSets,featureToggles:e.featureToggles,setDataSet:e.setDataSet,setAttributes:e.setAttributes,setDataSets:e.setDataSets,queryEngineConfig:e.queryEngineConfig})},""+i):c.jsxs(t.Fragment,{children:["heading"===r.type&&c.jsx(Rw,U({},e,{section:r})),"format"===r.type&&c.jsx(oC,U({},e,{section:r})),"prefixes"===r.type&&c.jsx(sC,U({},e,{section:r})),"axisLabels"===r.type&&c.jsx(Uw,U({},e,{section:r})),"mapColors"===r.type&&c.jsx(uC,U({},e,{section:r})),"conditionalFormatting"===r.type&&c.jsx(iC,U({},e,{section:r})),"goalLine"===r.type&&c.jsx(bC,U({},e,{section:r})),"chartStyles"===r.type&&c.jsx(Bw,U({},e,{section:r})),"statsLabels"===r.type&&c.jsx(cC,U({},e,{section:r}))]},i)}))})},yC=function(){var e=jg();if(!e)return c.jsx(hc,{});var t=On(e.component.attributes.type,{queryEngineConfig:e.queryEngineConfig});return c.jsx(xC,{setDataSets:e.setDataSets,setAttributes:e.setPartialAttributes,setDataSet:e.setDataSet,dataSets:e.dashboard.dataSets,dataSet:null==e?void 0:e.dataSet,featureToggles:e.featureToggles,attributes:e.component.attributes,queryEngineConfig:e.queryEngineConfig,formatPanelConfig:e.formatPanel(t.formatPanelConfig(),{type:e.component.attributes.type})})};function wC(e){return c.jsx(c.Fragment,{children:c.jsxs(Ef.Group,{defaultIndex:e.defaultTabOpen||0,children:[c.jsxs(Ef.List,{columns:"1fr 1fr",children:[c.jsx(Ef.Button,{"data-component":"tab-data",children:c.jsx(Up,{override:"editor.tab.heading.data",children:"Data"})}),c.jsx(Ef.Button,{"data-component":"tab-format",children:c.jsx(Up,{override:"editor.tab.heading.format",children:"Format"})})]}),c.jsxs(Ef.Panels,{children:[c.jsx(Ef.Panel,{children:c.jsx(Lw,{})}),c.jsx(Ef.Panel,{children:c.jsx(yC,{})})]})]})})}var CC=function(e){return Zt(null==e?void 0:e.component.attributes)?null:c.jsx(zd,{paddingX:24,paddingTop:16,children:c.jsx(ig,{title:"Feedback",type:"info",children:Jt(null==e?void 0:e.component.attributes)})})},jC=Object.assign((function(){return null}),{panel:function(e){return pa(U({height:"100%",overflow:"overlay",padding:2===e?0:"0 8px",marginLeft:2===e?"-0.5rem":void 0},Kd))},view:pa(U({height:"100%",overflow:"overlay"},Kd))}),SC=Object.assign((function(){return null}),{dataSetDescriptionPanel:function(){return pa({position:"absolute",marginTop:"-5px",padding:"8px"})}}),FC=function(e){var t=i.sortBy(e.fields,(function(e){return e.publicName}));return c.jsx("div",{children:c.jsx(es,{columns:["1fr","1fr","1fr"],gap:10,children:t.map((function(e){return c.jsxs(Gd,{direction:"row",gap:"0.2rem",children:[c.jsx(zd,{width:24,alignSelf:"start","data-component":"ai-field-data-type-icon",children:c.jsx(rc,{icon:e.dataType})}),e.publicName]})}))})})},kC=function(e){var n=t.useState(!1),r=n[0],o=n[1],a=t.useState("awaitingInput"),l=a[0],s=a[1],u=t.useState(""),d=u[0],p=u[1],f=rs(),m=function(){var t=Y(W().mark((function t(){var n;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e.onAskAI){t.next=10;break}return s("pending"),t.next=5,e.onAskAI(d,e.dataSet);case 5:e.setPartialAttributes(n=t.sent),console.log("aiGeneratedQueryAttributes",n),s("answered"),setTimeout((function(){s("awaitingInput")}),3e3);case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(0),console.error(t.t0);case 15:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(){return t.apply(this,arguments)}}(),h=i.groupBy(e.dataSet.fields,(function(e){return e.dataType}));return c.jsxs("div",{style:{width:"100%",position:"relative"},children:[c.jsxs(es,{columns:["1fr","auto"],children:[c.jsx(np,{placeholder:"Show me...",onFocus:function(){return o(!0)},onBlur:function(){return o(!1)},value:d,onChange:function(e){return p(e.target.value)}}),c.jsx(zd,{paddingX:10,position:"relative",width:"100%",children:c.jsxs(Ip,{primary:!0,disabled:"awaitingInput"!=l,onClick:function(){m()},children:["answered"==l&&"Done","awaitingInput"==l&&"Ask","pending"==l&&"Thinking"]})})]}),r&&c.jsx("div",{className:Qd.wrapper(null==f?void 0:f.dropdowns)+" "+SC.dataSetDescriptionPanel(),children:c.jsxs(es,{rows:["1fr"],gap:"1.5rem",children:[c.jsx(FC,{fields:h.number||[]}),c.jsx(FC,{fields:h.string||[]}),c.jsx(FC,{fields:h.date_time||[]}),c.jsx(FC,{fields:h.boolean||[]})]})})]})},TC=t.createContext(void 0),AC={name:"1n8cavw",styles:"height:40rem;width:100%"},DC=function(e){var n,r,o,a,l,s,u=jg(),d=t.useContext(TC);if(!u)return c.jsx(hc,{});var p=u.setAttributes,f=u.dashboard,m=u.dataSet,h=u.onAskAI,v=u.setPartialAttributes,g=u.setResults,b=u.mode,x=u.origin,y=u.componentEditor,w=u.runQueriesCallback,C=u.component,j=u.dispatch,S=u.broadcastEvent,F=u.queryEngineConfig,k=null==d?void 0:d.active,T=rs(),A="boolean"==typeof(null==T||null==(n=T.modals)||null==(r=n.options)||null==(o=r.showTitle)?void 0:o.editor)&&!(null!=T&&null!=(a=T.modals)&&null!=(l=a.options)&&null!=(s=l.showTitle)&&s.editor),D=(null==y?void 0:y.target.displayTarget)||i.isNumber(null==y?void 0:y.target.libraryIndex);return c.jsxs("div",{"data-testid":"editor",children:[c.jsx(yf,{title:"Editor","data-component":"editor-header",hide:A}),c.jsx(Cf,{"data-component":"editor-content",children:c.jsx("div",{css:AC,children:c.jsxs(es,{columns:["24rem","1fr"],height:"100%",children:[c.jsx("div",{id:"editor-panel",className:""+jC.panel(null==T?void 0:T.version),children:c.jsx(wC,{})}),c.jsxs(es,{rows:k?["50px","1fr","100px"]:["1fr","100px"],className:""+jC.view,children:[k&&c.jsx(kC,{dataSet:m,attributes:C.attributes,queryEngineConfig:F,onAskAI:h,setPartialAttributes:v}),c.jsx(zd,{paddingX:24,paddingTop:16,position:"relative",overflowY:"auto",width:"100%",children:c.jsx(Ux,{id:"editor_"+Math.floor(1e11*Math.random()),isBeingSizeAdjusted:!1,setLocalFilters:u.setLocalFilters,setParameterUpdate:u.setParameterUpdate,runQueriesCallback:w,setResults:g,component:C,updateComponentAttributes:p,editor:!0})}),c.jsx(CC,{component:C})]})]})})}),c.jsx(wf,{buttons:"end","data-component":"editor-footer",children:c.jsxs(Of,{children:[c.jsx(_p,{secondary:!0,onClick:function(){S("editor.changesCancelled"),e.onClose?e.onClose():j({type:"clearModal"})},children:D?"Cancel":"Close"}),D&&c.jsx(_p,{onClick:function(){S("editor.changesConfirmed"),j({type:"saveComponent",protectedComponent:"library"===x&&"admin"===b})},children:IC(b,x,(null==y?void 0:y.target.libraryIndex)!==f.componentLibrary.length)})]})})]})};function IC(e,t,n){return"library"===t&&n?"Save":"library"===t?"Add to Library":"endUser"===e?"Save":"Confirm"}var PC,_C,EC,OC,LC,RC=function(e){var n=Bc().dispatch,r=Ol().onReset,i=t.useState(!1),o=i[0],a=i[1],l=function(){var t=Y(W().mark((function t(){var i;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a(!0),t.next=3,r();case 3:(i=t.sent)&&n({type:"setDashboard",dashboard:i}),a(!1),null==e||e.onClose();case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),s=t.useState(!1),u=s[0],d=s[1];return t.useEffect((function(){e.show||(d(!1),a(!1))}),[e.show]),c.jsxs(If,{width:"sm",isOpen:null==e?void 0:e.show,onClose:function(){return null==e?void 0:e.onClose()},children:[c.jsx(If.Header,{title:"Confirm Reset",show:!0}),c.jsx(If.Content,{children:c.jsx(Nw,{label:"Any change you have made will be lost and the default dashboard will be restored.",setChecked:function(e){return d(e)},currentValue:u,id:"reset-dashboard",checkboxPosition:"top"})}),c.jsx(If.Footer,{buttons:"end",children:c.jsxs(Of,{children:[c.jsx(Ip,{secondary:!0,onClick:function(){return null==e?void 0:e.onClose()},disabled:o,children:"Cancel"}),c.jsx(Ip,{onClick:function(){u&&l()},disabled:!u||o,primary:!0,children:"Reset Dashboard"})]})})]})},MC=function(e){return!1===Ol().featureToggles.showResetButton?null:c.jsx(cp,{tooltipContent:function(){return"Reset dashboard to default"},children:c.jsx(Ip,{onClick:e.onChange,disabled:null==e?void 0:e.disabled,className:"vizzly_reset-button",children:"Reset"})})},NC=function(){var e=t.useState(!1),n=e[0],r=e[1],o=Bc(),a=o.runQueriesCallback,l=o.dashboard,s=o.dispatch,u=o.componentEditor,d=o.pickFromComponentLibrary,p=o.broadcastEvent,f=Ol(),m=f.maxCSVDownloadLimit,h=f.featureToggles,v=f.scope,g=function(e,t){p("library.open"),s({type:"startPickingComponentFromLibraryForDisplay",rowIndex:e,cellIndex:t})},x=function(e,t){p("manageDisplay.removeCell"),s({type:"removeCell",rowIndex:e,cellIndex:t})},y=function(e,t){s({type:"startEditingComponent",displayTarget:{rowIndex:e,cellIndex:t},libraryIndex:null,component:null})},w=null!=u||null!=d,C="neither",j=void 0;null!=u?(C="editor",j="modal-editor"):null!=d&&(C="library",j="modal-library");var S=h.showGlobalFilters,F=h.canAddNewRows,k=function e(t){return i.isArray(t)?i.every(t,e):!t.requiresValue||!(!t.requiresValue||!t.value)}(l.globalFilters);k||qr("Required dashboard filters do not have values, so the display of the dashboard will not render.",l.globalFilters);var T,A="read"===v,D=0===l.globalFilters.length&&A;return T=A&&l.globalFilters.length>0?["1fr"]:A||!1===F?["auto"]:["32px","auto"],c.jsx(b.DndProvider,{backend:q.HTML5Backend,children:c.jsxs(mw,{children:[c.jsx(fw,{}),c.jsx(zd,{padding:"0.25rem","data-component":"dashboard",overflow:"hidden",className:"vizzly-studio",children:c.jsxs(es,{rows:D?["auto"]:zC(),columns:T,gap:8,className:uc("dashboard"),"data-component":"dashboard-grid",children:[!D&&c.jsxs(Gd,{gridRow:1,gap:"16px","data-component":"toolbar",className:""+BC(v),justifyContent:"space-between",children:[c.jsx(zd,{flex:"0 0 80%",paddingLeft:A?"0.5rem":void 0,children:S&&c.jsx(ly,{})}),"read_write"===v&&c.jsx(zd,{children:c.jsx(MC,{onChange:function(){return r(!0)}})})]}),k&&c.jsxs(c.Fragment,{children:[c.jsx(zd,{gridColumn:"span 2/span 2",gridRow:2,"data-component":"panels",children:l.display.map((function(e,t){return c.jsx(rw,{maxCSVDownloadLimit:m,onCreateNew:y,onPickFromLibrary:g,onRemoveCell:x,rowIndex:t,dispatch:s,dashboard:l,runQueriesCallback:a,broadcastEvent:p,displayRow:l.display[t],onColSpanChange:function(e){s({type:"setColSpans",colSpans:e,rowIndex:t})},canAddNewCells:(n=e,h.canAddNewCells&&n.components.length<6),columns:T,onAppendCell:function(){return function(e){p("manageDisplay.appendCell"),s({type:"appendCell",rowIndex:e})}(t)},onAddHeaderRow:function(){return function(e){s({type:"addHeaderRow",rowIndex:e})}(t)},hideAddNewHeaderRow:My(l.display,t)},"dashboard_"+l.id+"_row_"+t);var n}))}),l.display.length<l.theme.rowLimit&&h.canAddNewRows&&c.jsx(Gd,{alignItems:"stretch",gridRow:3,gridColumn:2,paddingRight:28,"data-component":"add-row",children:c.jsx(Uy,{label:"Add Row",onChange:function(){var e;e=l.display.length,p("manageDisplay.newRow"),s({type:"insertRow",rowIndex:e}),yb(350)}})})]})]})}),c.jsxs(If,{width:"7xl",isOpen:w,onClose:function(){p("library.close"),s({type:"clearModal"})},transparentBackground:"modal-library"==j,namespace:j,children:["library"==C&&c.jsx(ey,{}),"editor"==C&&c.jsx(DC,{})]}),c.jsx(py,{}),c.jsx(RC,{show:n,onClose:function(){return r(!1)}})]})})},zC=function(){return["minmax(28px, 1fr)","auto","72px"]},BC=function(e){return pa("read"===e?{"@media (min-width: 767px)":{paddingRight:46,gridColumn:1},"@media (max-width: 768px)":{paddingRight:28,gridColumn:"span 2/span 2"}}:{paddingRight:29,gridColumn:2})},qC=function(e){var t=n.useState(0),r=t[0],i=t[1],o=function(){var t=Y(W().mark((function t(){var n;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.onReset();case 2:if(!(n=t.sent)){t.next=6;break}return i(r+1),t.abrupt("return",n);case 6:return t.abrupt("return",null);case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return c.jsx(El,{mode:e.dashboardBehaviour.mode,includeComponentTypes:e.includeComponents,excludeComponentTypes:e.excludeComponents,dashboardBehaviour:e.dashboardBehaviour,onError:null==e?void 0:e.onError,onViewClick:null==e?void 0:e.onViewClick,onReset:o,disableToolbar:null==e?void 0:e.dashboardBehaviour.disableToolbar,cascadeFilterSelection:null==e?void 0:e.dashboardBehaviour.cascadeFilterSelection,children:c.jsx(zc,{theme:null==e?void 0:e.theme,dashboard:e.dashboard,componentEditor:e.componentEditor,onDashboardUpdate:e.onDashboardUpdate,runQueriesCallback:function(t,n){var r;return e.runQueriesCallback(t,U({},n,{dataAccessToken:null==(r=e.identityConfig.dataAccess)?void 0:r.signature}))},children:c.jsx("div",{children:c.jsx(Wp,{children:null==e?void 0:e.children})},"_vizzly_dashboard_"+e.dashboard.id+"_"+r)})})},VC=t.createContext(void 0),WC=function(){var e=Y(W().mark((function e(t,n){var r,i,o,a,l;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("exact"!=t.type){e.next=7;break}return r=po(t.dashboardId,n.permissions),qr("A specific dashboard has been requested. This will be rendered with",i=r?"read_write":"read","scope.",t.dashboardId),e.abrupt("return",{dashboardId:t.dashboardId,mode:r&&t.dashboardId==n.defaultParentDashboardId?"admin":"endUser",scope:i});case 7:if("instantCopyOf"!=t.type){e.next=27;break}if(!po(t.parentDashboardId,n.permissions)){e.next=12;break}return qr("Write access to the parent dashboard has been found, so this dashboard will be shown with admin access.",t.parentDashboardId),e.abrupt("return",{dashboardId:t.parentDashboardId,mode:"admin",scope:"read_write"});case 12:if(o=Zr(t.parentDashboardId,n.writeAccessDashboards),!(a=function(e){return[].concat(e).sort((function(e,t){var n=new Date(e.updatedAt);return new Date(t.updatedAt).getTime()-n.getTime()}))}(o)[0]||null)){e.next=17;break}return qr("An existing child dashboard exists of the parent dashboard. As no specific dashboardId was provided, we will render the most recently updated child dashboard",a.id),e.abrupt("return",{dashboardId:a.id,mode:"endUser",scope:"read_write"});case 17:if(l=$r(n.dashboards,n.defaultParentDashboardId)){e.next=20;break}throw"Failed to find parent dashboard. "+n.defaultParentDashboardId;case 20:return qr("No previous child dashboard has been created on behalf of the current user for the parent dashboard",l.id,". Creating a child copy of the parent."),e.next=23,n.createDashboard({parentDashboardId:l.id,definition:Qr(l),meta:{},permissions:[{scope:"read_write"}]});case 23:return e.abrupt("return",{dashboardId:e.sent.id,scope:"read_write",mode:"endUser"});case 27:throw"Unsupported strategy";case 28:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),HC=function(e){function t(){var t;return(t=e.call(this,"At least one data set must be built for the Vizzly dashboard to render.")||this).name="NoDataSetResolved",t}return G(t,e),t}(Z(Error)),YC=function(){var e=Y(W().mark((function e(t,n,r){var i,o;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Ui(t),e.next=3,i({method:"post",body:{dynamicConfig:"object"==typeof t?t.dynamicConfig:void 0,integritySignature:n},mode:"cors",path:"/api/v1/resolve-data-sets",abortSignal:r});case 3:if(200!=(o=e.sent).status){e.next=6;break}return e.abrupt("return",o.body.dataSets);case 6:throw new Qi("Failed to resolve data sets from "+JSON.stringify(t)+". Received status "+o.status);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),UC=function(e){if("queryEngineEndpoint"in e&&e.queryEngineEndpoint)return t=e.queryEngineEndpoint,function(){var e=Y(W().mark((function e(n){var r;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,YC(t,null==(r=n.dataAccess)?void 0:r.signature);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();var t;if(!e.dataSets)throw new Zi;return e.dataSets},GC=function(e){return function(){var t=Y(W().mark((function t(n,r){var i,o;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"function"==typeof(i=UC(e))){t.next=4;break}throw new Zi;case 4:return t.next=6,i(n,r);case 6:if(o=t.sent){t.next=9;break}throw new Qi("Failed to fetch data sets from the query engine endpoint");case 9:return t.abrupt("return",o.map((function(e){return zn(e,r)})));case 12:if(t.prev=12,t.t0=t.catch(0),!(t.t0 instanceof Zi)){t.next=16;break}throw t.t0;case 16:throw new Qi("Failed to fetch data sets.");case 17:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(e,n){return t.apply(this,arguments)}}()},KC=function(e){return Y(W().mark((function t(){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("queryEngineConfig"in e)||!e.queryEngineConfig){t.next=4;break}return t.abrupt("return",Ki(e.queryEngineConfig));case 4:if(!("queryEngineEndpoint"in e)||!e.queryEngineEndpoint){t.next=6;break}return t.abrupt("return",Ki(e.queryEngineEndpoint));case 6:return t.abrupt("return",io);case 7:case"end":return t.stop()}}),t)})))},XC={file:"local file",environment:"environment variables",github:"GitHub",s3:"AWS S3",vizzlyEncrypted:"Vizzly API"},QC={name:"1gqeage",styles:"margin-right:0.75rem"},JC=function(e){return c.jsx("div",{children:c.jsxs("span",{children:[c.jsxs("span",{css:QC,children:[!0===e.status&&c.jsx(tj,{}),!1===e.status&&c.jsx(rj,{}),null===e.status&&c.jsx(oj,{})]}),!0===e.status&&e.successMessage,!1===e.status&&e.errorMessage,null===e.status&&e.unknownMessage]})})},ZC={name:"5edt7z",styles:"display:grid;grid-template-columns:repeat(1, minmax(0, 1fr));> :not([hidden]) ~ :not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse));}"},$C=function(e){return c.jsxs("div",{css:ZC,children:[c.jsx(JC,{status:e.statusReport.configFound,successMessage:e.statusReport.configSources?"Config was fetched from "+(t=e.statusReport.configSources.dataSets,Qe(t.map((function(e){return XC[e]})))+" with ")+Xe(e.statusReport.dataSetsCount||0,"data set","data sets"):"Config was found",errorMessage:"Config was not found",unknownMessage:"We did not check the existence of the Vizzly config"}),c.jsx(JC,{status:e.statusReport.configValid,successMessage:"Config is valid",errorMessage:"Config is not valid",unknownMessage:"We did not run any config validation checks"}),c.jsx(JC,{status:e.statusReport.connectionOk,successMessage:"Connection check passed",errorMessage:"Connection check failed. Please check the logs",unknownMessage:"We did not run a connection check"})]});var t},ej={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},tj=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:ej,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})},nj={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},rj=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:nj,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})})},ij={name:"opr68x",styles:"display:inline-block;height:1.5rem;width:1.5rem"},oj=function(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",css:ij,children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.625 12a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H8.25m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H12m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0h-.375M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})},aj=function(){var e=Y(W().mark((function e(t,n){var r,i,o;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Ui(t),e.next=3,r({path:"/api/status",method:"post",mode:"cors",abortSignal:n,body:{}});case 3:return o=(i=e.sent).body,e.abrupt("return",200==i.status?o:null);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),lj=function(e){var t=c.jsx("code",{style:{background:"rgba(0, 0, 0, 0.05)",borderRadius:"5px",padding:"2px 5px"},children:e.children});return e.href?c.jsx("a",{target:"_blank",href:e.href,children:t}):t},sj={name:"n4q3vn",styles:"margin-bottom:1.5rem;margin-top:1.5rem;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(243 245 249 / var(--tw-bg-opacity));padding:0.75rem"},uj={name:"1flj9lk",styles:"text-align:left"},dj={name:"1u8s3xj",styles:"margin-bottom:0.75rem;font-weight:700"},cj={name:"1gok8e8",styles:"margin-bottom:0.5rem"},pj={name:"1f0dvzm",styles:"margin-top:1.5rem;text-align:right"},fj={name:"y5vlkk",styles:"margin-top:0.75rem;width:100%;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(243 245 249 / var(--tw-bg-opacity));padding:0.75rem;text-align:left"},mj={name:"1u8s3xj",styles:"margin-bottom:0.75rem;font-weight:700"},hj={name:"12q5llh",styles:"margin-top:0.5rem;text-align:right"},vj={name:"fevti5",styles:"margin-bottom:0.75rem;margin-top:0.75rem;font-weight:700"},gj=function(e){var n=t.useState(void 0),r=n[0],i=n[1];return t.useEffect((function(){var t=new AbortController;return"self-hosted"==e.implementationMeta.type&&e.implementationMeta.queryEngineEndpoint&&function(){var e=Y(W().mark((function e(n){var o,a;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=setTimeout((function(){t.signal.aborted||void 0!==r||(t.abort(),i(null))}),2e3),e.prev=1,e.next=4,aj(n,t.signal);case 4:a=e.sent,clearTimeout(o),i(a||null),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),i(null);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()(e.implementationMeta.queryEngineEndpoint),function(){t.abort()}}),[]),c.jsx(Jp,{title:"Vizzly set up",renderExtra:function(){return c.jsxs("div",{style:{width:"650px"},children:[e.helpSections.map((function(e,t){return c.jsxs("div",{css:sj,children:[c.jsxs("div",{css:uj,children:[c.jsx("h2",{css:dj,className:""+Aa.text,children:e.title}),e.text.map((function(e,t){return c.jsx("p",{css:cj,className:""+Aa.text,children:e},t)}))]}),e.callToAction&&c.jsx("div",{css:pj,children:c.jsx("a",{target:"_blank",href:e.callToAction.link,children:c.jsx(_p,{children:e.callToAction.text})})})]},t)})),void 0!==r&&c.jsxs("div",{css:fj,children:[null===r&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{css:mj,className:""+Aa.text,children:"Vizzly Query Engine not found"}),c.jsxs("p",{className:""+Aa.text,children:["If you have deployed the Vizzly Query Engine, then please set the ",c.jsx(lj,{children:"queryEngineEndpoint"})," ","property to the URL where it is deployed too."]}),c.jsx("div",{css:hj,children:c.jsx("a",{target:"_blank",href:"https://docs.vizzly.co/query-engines/self-hosted-query-engine",children:c.jsx(_p,{children:"Deploy the Query Engine"})})})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx("h2",{css:vj,className:""+Aa.text,children:"Query engine status"}),c.jsx($C,{statusReport:r})]})]})]})}})},bj=function(e){return c.jsx(gj,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"Set up identity"},text:[c.jsxs(c.Fragment,{children:["We need to replace the current placeholder ",c.jsx(lj,{children:"identity"})," function with your own identity logic."]}),"Typically, this is an HTTPS call to your servers to retrieve the Vizzly identity tokens."]}]})},xj=function(e){return c.jsx(gj,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"See the docs"},text:["The async identity function must return the Vizzly access tokens in the correct format."]}]})},yj=function(e){var t=[];switch(e.implementationMeta.type){case"custom":case"in-browser":t=[c.jsxs(c.Fragment,{children:["The ",c.jsx(lj,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"}),"function must provide at least one data set"]})];break;case"self-hosted":t=[c.jsx(c.Fragment,{children:"To start using the Vizzly dashboard, you must add a data set to the Vizzly Query Engine."}),c.jsx(c.Fragment,{children:"If you have already done this, check the `dataSets` value in your identity token to make sure it allows at least one data set to be returned."})]}return c.jsx(gj,{implementationMeta:e.implementationMeta,helpSections:[{title:"At least one data set must be provided",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/dataSets",text:"See the docs"},text:t}]})},wj=function(e){return c.jsx(gj,{implementationMeta:e.implementationMeta,helpSections:[{title:"We did not fetch your data sets.",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/dataSets",text:"See the docs"},text:[c.jsxs(c.Fragment,{children:["If you are using the Vizzly Query Engine, then you will need to set the"," ",c.jsx(lj,{href:"https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint",children:"queryEngineEndpoint"})," ","property on the dashboard."]}),c.jsxs(c.Fragment,{children:["Alternatively, if you are not using the Vizzly Query Engine, then the"," ",c.jsx(lj,{href:"https://docs.vizzly.co/dashboard/properties/dataSets",children:"dataSets"})," property is required, and it must be an async function."]})]}]})},Cj={name:"185o5ba",styles:"text-decoration-line:underline"},jj=function(e){return c.jsx(gj,{implementationMeta:e.implementationMeta,helpSections:[{title:"Query Engine Endpoint",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/queryEngineEndpoint",text:"See the docs"},text:[c.jsxs(c.Fragment,{children:["Incorrect ",c.jsx(lj,{children:"queryEngineEndpoint"})," value",e.invalidEndpoint?" ("+JSON.stringify(e.invalidEndpoint)+")":"",". Please deploy the"," ",c.jsx("a",{css:Cj,href:"https://docs.vizzly.co/query-engines/self-hosted",children:"Vizzly Query Engine"}),", and then provide the URL to it as a string, or as an object with a string host value."]})]}]})},Sj=function(e){return c.jsx(gj,{implementationMeta:e.implementationMeta,helpSections:[{title:"Identity",callToAction:{link:"https://docs.vizzly.co/dashboard/properties/identity",text:"See the docs"},text:[c.jsxs(c.Fragment,{children:[c.jsx(lj,{children:"identity"})," must be an async function that returns your Vizzly identity tokens."]})]}]})};_C=PC||(PC={}),OC=EC||(EC=_C.ComponentOverrides||(_C.ComponentOverrides={})),function(e){var t;t||(t=e.ComponentOptions||(e.ComponentOptions={}))}(LC||(LC=OC.Props||(OC.Props={})));var Fj=function(e){Hr(e.error);var t=c.jsx("p",{children:"Unknown error"});return e.error instanceof HC&&(t=c.jsx(yj,{implementationMeta:e.implementationMeta})),e.error instanceof Zi&&(t=c.jsx(wj,{implementationMeta:e.implementationMeta})),e.error instanceof Hi&&(t=c.jsx(jj,{implementationMeta:e.implementationMeta,invalidType:!0})),e.error instanceof Wi&&(t=c.jsx(jj,{implementationMeta:e.implementationMeta,invalidEndpoint:e.error.invalidEndpoint})),e.error instanceof Ji&&(t=c.jsx(Sj,{implementationMeta:e.implementationMeta})),e.error instanceof Li&&(t=c.jsx(af,{})),e.error instanceof Ri&&(t=c.jsx(xj,{implementationMeta:e.implementationMeta})),e.error instanceof Mi&&(t=c.jsx(tf,{})),e.error instanceof Qi&&(t=c.jsx(nf,{})),e.error instanceof qi&&(t=c.jsx(bj,{implementationMeta:e.implementationMeta})),c.jsxs(vs,{children:[c.jsx(wo,{}),t]})},kj=function(e,t){return e.map((function(e){return e.map((function(e){var t=e.field;return{id:lt({field:t.id,function:e.functionId}),publicName:t.publicName,dataType:t.dataType}}))}))},Tj=function(e,t,n){var r=t.map((function(t){var r=Rn(e,t.dataSetId);if(!r)throw"Data set not found for query attributes query";return Et(r,t.measure,t.order,t.filter,t.dimension,t.timeDimension,t.limit,t.offset,n)}));return{queries:r.map((function(e){return e.query})),resultFields:kj([].concat(r).map((function(e){return e.measureDescription})))}};function Aj(e,t){var n=e.optionsFilters?e.optionsFilters[t.dataSetId]:[];return null==n?void 0:n.filter((function(e){return e.field!==t.fieldId}))}var Dj=function(e,t,n,r){var i=Lt(t,e.measure,e.order,It(e.filter,n),e.dimension,e.timeDimension||null,e.limit,e.offset,r);return{queries:[i.query],resultFields:kj([i.measureDescription])}},Ij=Dj,Pj=Dj,_j=Dj,Ej=Dj,Oj=Dj,Lj=Dj,Rj=Dj,Mj=function(e,t,n){var r=[],i=[];if(Array.isArray(e)&&"type"in e[0]&&"preparedQuery"==e[0].type){r=[e[0]];var o=Rn(n.dataSets,e[0].dataSetId);if(!o)throw"Data set not found for view attributes query";var a=Mn(o,e[0].fieldId),l=Mt(e[0].dataSetId,a);r=[l.query],i=[l.resultFields]}else if(Array.isArray(e)){var s=[].concat(e).map((function(e){var t=Rn(n.dataSets,e.dataSetId);if(!t)throw"Data set not found for query-attributes query";var r=dr(n.filterConfig,t,n.timeRangeOptions);return U({},e,{filter:It(e.filter,r)})})),u=Tj(n.dataSets,s,t);r=u.queries,i=u.resultFields}else if("type"in e&&("order"in e||"measure"in e)){var d=Rn(n.dataSets,e.dataSetId);if(!d)throw"Data set not found for view attributes query";var c=function(e,t,n,r){switch(e.type){case"areaChart":return Ij(e,t,n,r);case"barChart":return Pj(e,t,n,r);case"horizontalBarChart":return _j(e,t,n,r);case"lineChart":return Ej(e,t,n,r);case"pieChart":return Oj(e,t,n,r);case"dataTable":return Lj(e,t,n,r);case"basicTable":return Rj(e,t,n,r);case"comboChart":return function(e,t,n,r){var i=function(e,t,n,r){var i=Lt(t,e.lineMeasure,e.order,It(e.filter,r),e.lineDimension,e.timeDimension,e.limit,e.offset,n);return{bar:Lt(t,e.barMeasure,e.order,It(e.filter,r),e.barDimension,e.timeDimension,e.limit,e.offset,n),line:i}}(e,t,r,n),o=i.line,a=i.bar;return{queries:[o.query,a.query],resultFields:kj([o.measureDescription,a.measureDescription])}}(e,t,n,r);case"singleStat":return function(e,t,n,r){var i=function(e,t,n,r){var i=function(e,t,n,r){var i=Lt(n,e.measure,[],It(e.filter,t),[],null,1,e.offset,r),o=i.query,a=i.measureDescription;return o.measure=[{type:"number",value:0}].concat(o.measure),{query:o,measureDescription:a=[{field:{id:"single-stat-bumper-field",canBeDimension:!1,canBeMeasure:!1,publicName:"",dataType:"number",allowedOperators:[]},functionId:"none"}].concat(a)}}(e,r,t,n),o=function(e,t,n,r){return t.deltaTimeDimension?Lt(e,t.measure,[{field:t.deltaTimeDimension.field,direction:"asc",function:t.deltaTimeDimension.truncate}],It(t.filter,n),[],t.deltaTimeDimension,t.limit,t.offset,r):null}(t,e,r,n);return{queries:o?[i.query,o.query]:[i.query],measureDescription:o?[i.measureDescription,o.measureDescription]:[i.measureDescription]}}(e,t,r,n);return{queries:i.queries,resultFields:kj(i.measureDescription)}}(e,t,n,r);case"scatterChart":return function(e,t,n,r){var i=[];e.xMeasure&&i.push(e.xMeasure),e.yMeasure&&i.push(e.yMeasure);var o=Lt(t,i,e.order,It(e.filter,n),e.dimension,e.timeDimension,e.limit,e.offset,r);return{queries:[o.query],resultFields:kj([o.measureDescription])}}(e,t,n,r);case"mercatorMap":return function(e,t,n,r){return Tj([t],[{measure:e.measure,dataSetId:t.id,dimension:e.dimension,limit:e.limit,filter:It(e.filter,n),order:[],timeDimension:null}],r)}(e,t,n,r);default:throw"Unsupported."}}(e,d,dr(n.filterConfig,d,n.timeRangeOptions),t);r=c.queries,i=c.resultFields}else if("custom"!=e.type){var p=function(e,t,n){var r=[].concat(e.appliesToFields).map((function(r){var i=Rn(t,r.dataSetId);if(!i)throw"Data set not found for additional filter query";var o=Mn(i,r.fieldId);if("string[]"==o.dataType){var a=Pt([Aj(e,r)],n,i),l=Mt(r.dataSetId,o,a);return{queries:[l.query],resultFields:[l.resultFields]}}var s=Nt(i,r.fieldId,Aj(e,r));return Tj(t,[s],n)}));return{queries:r.flatMap((function(e){return e.queries})),resultFields:r.flatMap((function(e){return e.resultFields}))}}(e,n.dataSets,t);r=p.queries,i=p.resultFields}return{queries:r,resultFields:i}},Nj={},zj=function(e,t,n){var r=JSON.stringify(e),i=new Date;i.setSeconds(i.getSeconds()+n),qr("Browser cache new object set.",r),Nj[r]={item:t,expires:i}},Bj=function(e){var t=JSON.stringify(e),n=Nj[t];if(!n)return qr("Browser cache miss.",e),null;qr("Browser cache hit.",e);var r=n.item,i=n.expires;return new Date<i?r:(delete Nj[t],null)},qj=function e(t){return Array.isArray(t)?0==t.length:"object"==typeof t&&e(Object.keys(t))},Vj=function(){var e=Y(W().mark((function e(t,n,r,i){var o,a,l,s;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},t.forEach((function(e,t){var n=Bj(i(e));n&&(qr("Query result received from the cache."),o[t]=n)})),t.forEach((function(e,t){n(e)||(qr("Query is not runnable."),o[t]=null)})),a=t.filter((function(e,t){return n(e)&&void 0===o[t]})),l=[],qj(a)){e.next=9;break}return e.next=8,r(a);case 8:l=e.sent;case 9:if(null!==l){e.next=11;break}return e.abrupt("return",null);case 11:if(!qj(l)||!qj(o)){e.next=13;break}return e.abrupt("return",null);case 13:return s=[].concat(t).map((function(e,t){var r,a=o[t];if(n(e)&&null==a&&(a=(null==(r=l)?void 0:r.shift())||null,zj(i(e),a,20)),void 0===a)throw"A result went missing...";return a})),e.abrupt("return",s);case 15:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),Wj=function(){var e=Y(W().mark((function e(t,n,r,i){var o,a,l;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Ui(n),e.next=3,o({path:"/api/v1/create-results",method:"post",mode:"cors",body:{queries:t,virtualFields:{},dynamicConfig:"object"==typeof n?n.dynamicConfig:void 0,identityConfigIntegritySignature:r},abortSignal:i});case 3:return l=(a=e.sent).body,e.abrupt("return",200==a.status?l:null);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),Hj=function(){var e=Y(W().mark((function e(t,n,r){var i,o,a,l,s;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Mj(n,t.queryEngineConfig,r),o=i.queries,a=i.resultFields,e.next=3,Vj(o,(function(e){return!0}),function(){var e=Y(W().mark((function e(n){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wj(n,t.queryEngineEndpoint,t.dataAccessToken,r.abortSignal);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:return l=e.sent,s=[].concat(o).map((function(e,t){if(null===l)return null;var n=l[t];return void 0===n?null:{content:n,fields:a[t]}})),e.abrupt("return",s);case 6:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Yj={},Uj=[],Gj=function(){var e=Y(W().mark((function e(t,n,r){var i;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(qr("Fetching data for in-browser query engine. DataSet;",t.id,"CacheKey;",r),!Yj[r]){e.next=5;break}return e.abrupt("return",Yj[r]);case 5:return e.next=7,n(t);case 7:return(i=e.sent)||Uj.includes(t.id)||(Uj.push(t.id),console.error("Failed to download data for data set "+t.id)),Yj[r]=i,e.abrupt("return",i);case 11:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Kj=function e(t,n,r,i){switch(n.type){case"subquery":return r(n.value);case"number":return n.value;case"maths":var o=e(t,n.left,r,i),a=e(t,n.right,r,i);if(void 0===o)throw"Left is undefined";if(void 0===a)throw"Right is undefined";return function(e,t,n){var r=null;if(null===t||null===n)return null;switch(e){case"*":r=t*n;break;case"-":r=t-n;break;case"+":r=t+n;break;case"/":r=t/n;break;default:throw"Unrecognised op"}if(null===r)throw"Value after maths is null";return r}(n.op,o,a);case"field":var l=lt({field:n.value,function:n.function});if("none"===n.function)return t[n.value];if(void 0!==t[l])return t[l];if(i){var s=Jj({dataSetId:"",order:[],filter:[],group:[],type:"query",measure:[{type:"field",function:n.function,value:n.value}]},i,r);if(s&&s[0])return s[0][l];throw new Error("No value found in doMath")}}throw"Unsure how to handle this from doMath."},Xj=Object.keys(io.supportedTimeTruncFunctions),Qj=function(e,t,n){if("count"==e)return n.length;if("sum"==e)return i.sumBy(n,t);if("mean"==e)return i.meanBy(n,t);if("min"==e){var r=i.minBy(n,t);return r?r[t]:0}if("max"==e){var o=i.maxBy(n,t);return o?o[t]:0}if("countDistinct"==e)return i.uniqBy(n,t).length;if("custom-func"==e)return i.meanBy(n,t);throw"Aggregate '"+e+"' not recognised."},Jj=function(e,t,n){if(!Ot(e.measure)&&!function e(t){var n=[].concat("group"in t?t.group:[]).map((function(e){return e.index}));return i.some(t.measure,(function t(r,i){if("field"==r.type)return"none"!=r.function&&!n.includes(i);if("number"==r.type)return!1;if("subquery"==r.type)return e(r.value);if("maths"==r.type)return t(r.left)||t(r.right);if("function"==r.type)return"none"!=r.function||t(r.value);throw console.log("measure",JSON.stringify(r)),"not supported"}))}(e))return t;var r=function(e,t){return"group"in e?i.groupBy([].concat(t),(function(t){var n=[];return e.group.forEach((function(r){var i=e.measure[r.index];if("field"!=i.type||"string"!=typeof i.value)throw"Unsupported group on in local query engine.";if(Xj.includes(i.function)){var o=function(e,t){switch(t){case"second":return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds());case"minute":return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes());case"hour":return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours());case"day":return new Date(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());case"week":return r=(n=new Date(e)).getDay(),i=n.getDate()-r+(0==r?-6:1),new Date(n.setDate(i));case"month":return new Date(e.getUTCFullYear(),e.getUTCMonth());case"quarter":return function(e,t){if(1==t)return new Date(e.getUTCFullYear(),0);if(2==t)return new Date(e.getUTCFullYear(),3);if(3==t)return new Date(e.getUTCFullYear(),6);if(4==t)return new Date(e.getUTCFullYear(),9);throw"Invalid quarter "+t}(e,Po(e));case"year":return new Date(e.getUTCFullYear(),1);default:throw"Local query engine does not support time trunc function "+t}var n,r,i}(new Date(t[i.value]),i.function);t[i.value]=o.toISOString(),n=[].concat(n,[o.toISOString()])}else n=[].concat(n,[""+t[i.value]])})),n.join("|")})):{"":t}}(e,t);return i.map(Object.values(r),(function(t){var r=[].concat(e.measure);return U({},i.reduce(r,(function(e,r,i){var o=dt(r,i);switch(r.type){case"field":e[o]="none"==r.function||Xj.includes(r.function)?t[0][r.value]:Qj(r.function,r.value,t);break;case"function":if("none"==r.function)throw"Function type is redundant if function is 'none'.";var a=dt(r.value,i);e[o]=Qj(r.function,a,t);break;case"subquery":e[o]=n(r.value);break;case"number":e[o]=r.value;break;case"maths":(Ot([r.left])||Ot([r.right]))&&(e[o]=Kj(e,r,n,t))}return e}),{}))}))},Zj=function(e,t){return e+"::"+t},$j=function(e,t,n){return[].concat(e).map((function(e){var r=Nn(t,e.dataSetId)[0],o=Zj(n,e.dataSetId),a=Yj[o];return a&&r?function e(t,n,r){var o=function(e,t,n){return i.isEmpty(e.filter)?n:i.filter([].concat(n),(function(n){return function(e,t,n){return i.some(t,(function(t){return i.every(t,(function(t){if("field"==t.field.type&&"string"==typeof t.field.value){var r=e[t.field.value],i=Mn(n,t.field.value);r="date_time"==i.dataType?new Date(r):r;var o="date_time"==i.dataType?new Date(t.value):t.value;return Jo(U({},t,{value:o}),r)}throw"Unsure how to handle this."}))}))}(n,e.filter,t)}))}(t,n,i.cloneDeep(r)),a=function(o){var a=e({type:"query",dataSetId:t.dataSetId,measure:[o.measure[0]],filter:o.filter,order:[],group:[]},n,r);if(0==a.length)return null;if(!i.isNumber(a[0][0]))throw"Sub query must return a numeric result.";return a[0][0]};o=function(e,t,n){return t.map((function(t){var r=U({},t);return e.measure.forEach((function(e,i){var o=dt(e,i);if("maths"!=e.type||Ot([e.left])||Ot([e.right])){if("function"==e.type){var a=Kj(t,e.value,n),l=dt(e.value,i);r[l]=a}}else r[o]=Kj(t,e,n)})),r}))}(t,o,a),o=Jj(t,o,a),o=function(e,t){if(i.isEmpty(e.order))return t;var n=[].concat(e.order).map((function(t){var n=e.measure[t.index];if("field"==n.type&&"string"==typeof n.value)return lt({field:n.value,function:n.function});throw"Cannot sort by non-aggregate"})),r=[].concat(e.order).map((function(e){return e.direction}));return i.orderBy([].concat(t),n,r)}(t,o),o=function(e,t){return e.offset||e.limit?t.slice(e.offset).slice(0,e.limit):t}(t,o);var l=function(e,t){return[].concat(e.measure).map((function(e,t){return dt(e,t)}))}(t);return o.map((function(e){return[].concat(l).map((function(t){return e[t]}))}))}(e,r,a):(console.warn("Returning an empty result."),[])}))},eS=function(){var e=Y(W().mark((function e(t,n,r,i){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([].concat(t).flatMap(function(){var e=Y(W().mark((function e(t){var o,a;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=Nn(n,t.dataSetId),!(a=o[0])){e.next=8;break}return e.next=4,Gj(a,r,Zj(i,t.dataSetId));case 4:return e.t0=e.sent,e.abrupt("return",[e.t0]);case 8:return e.abrupt("return",[]);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return e.abrupt("return",$j(t,n,i));case 3:case"end":return e.stop()}}),e)})));return function(t,n,r,i){return e.apply(this,arguments)}}(),tS=function(){var e=Y(W().mark((function e(t,n,r){var i,o,a,l,s;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Mj(n,io,r),o=i.queries,a=i.resultFields,e.next=3,Vj(o,(function(e){return"preparedQuery"==e.type&&Wr("In-browser query engine does not support prepared queries."),"query"==e.type}),function(){var e=Y(W().mark((function e(n){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,eS(n,r.dataSets,t.loadData,t.cacheKeyNamespace);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:return null===(l=e.sent)&&(l=o.map((function(){return null}))),s=[].concat(o).map((function(e,t){if(null===l)return null;var n=l[t];return void 0===n?null:{content:n,fields:a[t]}})),e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),nS=function(){var e=Y(W().mark((function e(t,n,r){var i,o,a,l;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Mj(n,t.queryEngineConfig,r),o=i.queries,a=i.resultFields,e.next=3,Vj(o,(function(e){return"preparedQuery"==e.type&&Wr("Custom query engine does not support prepared queries."),"query"==e.type}),function(){var e=Y(W().mark((function e(n){var i;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.runQueries(n,U({},r,{dataAccessToken:t.dataAccessToken}));case 2:if(null!=(i=e.sent)){e.next=5;break}return e.abrupt("return",n.map((function(){return null})));case 5:return e.abrupt("return",i.map((function(e,t){return Array.isArray(e)?{fields:a[t],content:e}:e})));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(function(e){return{query:e,cacheKeyNamespace:t.cacheKeyNamespace}}));case 3:if(null!==(l=e.sent)){e.next=6;break}return e.abrupt("return",o.map((function(){return null})));case 6:return e.abrupt("return",l);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}();function rS(e,t,n){return iS.apply(this,arguments)}function iS(){return(iS=Y(W().mark((function e(t,n,r){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("vizzlyQueryEngine"!=t.type){e.next=4;break}return e.next=3,Hj(t,n,r);case 3:return e.abrupt("return",e.sent);case 4:if("vizzlyJsQueryEngine"!=t.type){e.next=8;break}return e.next=7,tS(t,n,r);case 7:return e.abrupt("return",e.sent);case 8:if("custom"!=t.type){e.next=12;break}return e.next=11,nS(t,n,r);case 11:return e.abrupt("return",e.sent);case 12:return e.abrupt("return",[]);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var oS=function(e){return d.createElement(aS,U({},e,{key:e.parentDashboardId+"_"+e.dashboardId}))},aS=function(e){var n,r,i,o,a,l,s,u,d=lS(e),p=e.vizzlyApiHost?{host:e.vizzlyApiHost}:{host:"https://api.vizzly.co"},f=Oi(p),m=(o={dashboardId:e.dashboardId,parentDashboardId:e.parentDashboardId,identityCallback:e.identity,loadDataSetsCallback:GC(e),vizzlyAPI:f,implementationMeta:d,loadQueryEngineConfigCallback:KC(e)},l=$i(o.identityCallback,o.loadDataSetsCallback,o.loadQueryEngineConfigCallback),u=function(e,n){var r=t.useState(),i=r[0],o=r[1];if(t.useEffect((function(){!function(){var t=Y(W().mark((function t(){var r,a,l,s;return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("isLoading"in n)){t.next=2;break}return t.abrupt("return");case 2:if(e){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,WC(e,n);case 6:a=(r=t.sent).mode,s=r.scope,(l=r.dashboardId)!=(null==i?void 0:i.dashboardId)&&o({mode:a,dashboardId:l,scope:s});case 11:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()()}),[JSON.stringify(e),n]),!i)return null;if("isLoading"in n)return null;var a=n.dashboards.find((function(e){return e.id==i.dashboardId}))||null;return{mode:i.mode,dashboard:a,scope:i.scope}}(function(e,t,n){if("accessType"in e&&"admin"==e.accessType){qr("Admin access found, so we will show the parent dashboard.",e.defaultParentDashboardId);var r=e.defaultParentDashboardId;if(n){var i=e.dashboards.find((function(e){return e.id==n}));null!=i&&i.parentDashboardId&&(qr("A child dashboard was provided whilst in admin mode. Therefore the parent of the given child will be shown to administer.",i.parentDashboardId),r=i.parentDashboardId)}return{type:"exact",dashboardId:r}}return n?(qr("Strategy will be to show dashboard",n),{type:"exact",dashboardId:n}):"childDashboardCount"in e&&1===e.childDashboardCount&&"read"==(null==t?void 0:t.dashboardAccess.scope)?(qr("Strategy will be to show read-only view of the only child dashboard. If you wish to render a read-only view of the parent dashboard, please make sure the `dashboardId` property matches the `parentDashboardId` property.",e.defaultParentDashboardId),{type:"exact",dashboardId:e.dashboards[0].id}):"read"==(null==t?void 0:t.dashboardAccess.scope)&&"defaultParentDashboardId"in e?(qr("Strategy will be to return read-only view of the parent dashboard.",e.defaultParentDashboardId),{type:"exact",dashboardId:e.defaultParentDashboardId}):"defaultParentDashboardId"in e?t&&t.dashboardAccess.dashboardId?(qr("Strategy will be to show a child of the parent dashboard determined by the identity config",null==t||null==(o=t.dashboardAccess)?void 0:o.dashboardId),{type:"instantCopyOf",parentDashboardId:null==t||null==(a=t.dashboardAccess)?void 0:a.dashboardId}):(qr("Strategy will be to show a child of the parent dashboard",e.defaultParentDashboardId),{type:"instantCopyOf",parentDashboardId:e.defaultParentDashboardId}):void 0;var o,a}(s=fo(null==l?void 0:l.identityConfig,null==l?void 0:l.dataSets,o.vizzlyAPI,o.parentDashboardId),l.identityConfig,o.dashboardId),s),0===(null==(a=l.dataSets)?void 0:a.length)?{error:new HC}:l.error?{error:l.error}:l.identityConfig&&l.queryEngineConfig?"isLoading"in s?null:u?{dashboardAPI:s,scope:u.scope,queryEngineConfig:l.queryEngineConfig,dashboard:u.dashboard,identityConfig:l.identityConfig,mode:u.mode,vizzlyApiConfig:o.vizzlyAPI.config}:null:null);if(null===m)return c.jsx(hc,{override:e.renderLoadingComponent});if("error"in m)return c.jsx(Fj,{implementationMeta:d,error:m.error});if(!m.dashboard)return c.jsx(hc,{override:e.renderLoadingComponent});var h=function(){var e=Y(W().mark((function e(t,n){var r;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!m.dashboard){e.next=6;break}return r=co(m.dashboard.id,m.dashboardAPI.permissions),e.next=4,f.askAi(t,r.token,n,m.queryEngineConfig);case 4:return e.abrupt("return",e.sent);case 6:return e.abrupt("return",{});case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),v=function(){var e=Y(W().mark((function e(t,n){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n||!m.dashboard){e.next=7;break}return e.next=3,m.dashboardAPI.saveScheduledReport({dashboardId:m.dashboard.id,cronSchedule:null,scheduledReportId:t});case 3:return e.abrupt("return",e.sent?"deleted":null);case 7:if(null==n||!m.dashboard){e.next=12;break}return e.next=10,m.dashboardAPI.saveScheduledReport({dashboardId:m.dashboard.id,cronSchedule:n,scheduledReportId:t});case 10:return e.abrupt("return",e.sent?"saved":null);case 12:return e.abrupt("return",null);case 13:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),g=function(){var e=Y(W().mark((function e(t){return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"read_write"==m.scope&&m.dashboardAPI.updateDashboard(t.id,{definition:Qr(t)});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),b=function(){var e=Y(W().mark((function e(){var t;return W().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===m||!("dashboard"in m)||null===m.dashboard){e.next=4;break}return t=ni(m.dashboard,m.dashboardAPI.dashboards,m.dashboardAPI.defaultParentDashboardId),g(t),e.abrupt("return",t);case 4:return e.abrupt("return",null);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=(null==(n=m.identityConfig)||null==(r=n.queryEngineAccessConfig)?void 0:r.allowDatabaseSchemaAccess)&&"self-hosted"==d.type,y=null!=(i=e.dateFilterOptions)?i:e.dateTimeFilterOptions,w=function(e,t,n){var r,i,o=(i=t.identityConfig.dashboardAccess,["accessType","dashboardId","projectId","userReference","scope"].map((function(e){return e+":"+i[e]})).join(":::"));if("queryEngineEndpoint"in e&&e.queryEngineEndpoint&&null!=(r=t.identityConfig.dataAccess)&&r.signature)return function(){var r=Y(W().mark((function r(i,a){var l;return W().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,rS({type:"vizzlyQueryEngine",queryEngineConfig:t.queryEngineConfig,dataAccessToken:null==(l=t.identityConfig.dataAccess)?void 0:l.signature,queryEngineEndpoint:e.queryEngineEndpoint,cacheKeyNamespace:o},i,{abortSignal:a.abortSignal,dataSets:a.dataSets,filterConfig:a.filterConfig||{},timeRangeOptions:n});case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r)})));return function(e,t){return r.apply(this,arguments)}}();if("runQueries"in e&&e.runQueries)return function(){var r=Y(W().mark((function r(i,a){var l;return W().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,rS({type:"custom",queryEngineConfig:t.queryEngineConfig,runQueries:e.runQueries,dataAccessToken:null==(l=t.identityConfig.dataAccess)?void 0:l.signature,cacheKeyNamespace:o},i,{abortSignal:a.abortSignal,dataSets:a.dataSets,filterConfig:a.filterConfig||{},timeRangeOptions:n});case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r)})));return function(e,t){return r.apply(this,arguments)}}();if(e.data)return function(){var t=Y(W().mark((function t(r,i){return W().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,rS({type:"vizzlyJsQueryEngine",loadData:e.data,cacheKeyNamespace:o},r,{abortSignal:i.abortSignal,dataSets:i.dataSets,filterConfig:i.filterConfig||{},timeRangeOptions:n});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}();throw"Missing required props."}(e,m,Sl(y));return c.jsx(VC.Provider,{value:U({},e,{onSave:g}),children:c.jsx(qC,{dashboardBehaviour:{onAskAI:h,mode:m.mode,scope:m.scope,dateFilterOptions:y,numberFormatOptions:null==e?void 0:e.numberFormatOptions,dateTimeFormatOptions:null==e?void 0:e.dateTimeFormatOptions,onEditorUpdate:null==e?void 0:e.onEditorUpdate,onScheduledReportChange:v,reportScheduleOptions:e.reportScheduleOptions,dataPanel:e.dataPanel,formatPanel:e.formatPanel,maxCSVDownloadLimit:e.maxCSVDownloadLimit,textOverrides:e.textOverrides,developerTools:e.developerTools,dashboardFilters:e.dashboardFilters,onDashboardFilterChange:e.onDashboardFilterChange,onSave:g,onOpenConfigManagerUi:x?function(){var e,t,n,r,i;x&&d.queryEngineEndpoint&&(window.location.href=(t=d.queryEngineEndpoint,(n=null==(e=m.identityConfig.queryEngineAccessConfig)?void 0:e.signature)?(r=JSON.stringify({queryEngineAccessToken:n,projectAccessToken:void 0}),i="object"==typeof window&&window&&window.btoa?window.btoa(r):Buffer.from(r).toString("base64"),Or(Xi(t),"/sign-in#"+i)):""))}:void 0,organizationName:e.organizationName,featureToggles:e.featureToggles,customComponents:e.customComponents,componentOverrides:Hb(e),queryEngineConfig:m.queryEngineConfig,disableToolbar:null==e?void 0:e.disableToolbar,cascadeFilterSelection:null==e?void 0:e.cascadeFilterSelection},onDashboardUpdate:null==e?void 0:e.onDashboardUpdate,dashboard:m.dashboard,runQueriesCallback:w,implementationMeta:d,identityConfig:m.identityConfig,includeComponents:null==e?void 0:e.includeComponents,excludeComponents:null==e?void 0:e.excludeComponents,onReset:b,onError:null==e?void 0:e.onError,theme:e.theme,vizzlyApiConfig:p,onViewClick:null==e?void 0:e.onViewClick,children:null==e?void 0:e.children})})},lS=function(e){return"queryEngineEndpoint"in e?{type:"self-hosted",queryEngineEndpoint:e.queryEngineEndpoint}:"runQueries"in e?{type:"custom"}:{type:"in-browser"}},sS=function(e){return c.jsxs(vo,{renderOnError:function(){return c.jsx("p",{children:"Unexpected vizzly error."})},onError:function(t,n){return(null==e?void 0:e.onError)&&(null==e?void 0:e.onError(t,n))},children:[c.jsx(wo,{}),c.jsx(oS,U({},e,{children:c.jsx(NC,{})}))]})},uS={Dashboard:sS,useDashboardManager:mo,useInBrowserDashboardManager:ho,NewVizzlyImplementation:qi,displayPositions:Ir,DataSetField:bo};exports.Dashboard=sS,exports.DataSetField=bo,exports.NewVizzlyImplementation=qi,exports.default=uS,exports.displayPositions=Ir,exports.useDashboardManager=mo,exports.useInBrowserDashboardManager=ho;
|